Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/content-.../inc/freemius/includes
File: class-fs-plugin-updater.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* @package Freemius
[2] Fix | Delete
* @copyright Copyright (c) 2015, Freemius, Inc.
[3] Fix | Delete
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
[4] Fix | Delete
* @since 1.0.4
[5] Fix | Delete
*
[6] Fix | Delete
* @link https://github.com/easydigitaldownloads/EDD-License-handler/blob/master/EDD_SL_Plugin_Updater.php
[7] Fix | Delete
*/
[8] Fix | Delete
[9] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[10] Fix | Delete
exit;
[11] Fix | Delete
}
[12] Fix | Delete
[13] Fix | Delete
class FS_Plugin_Updater {
[14] Fix | Delete
[15] Fix | Delete
/**
[16] Fix | Delete
* @var Freemius
[17] Fix | Delete
* @since 1.0.4
[18] Fix | Delete
*/
[19] Fix | Delete
private $_fs;
[20] Fix | Delete
/**
[21] Fix | Delete
* @var FS_Logger
[22] Fix | Delete
* @since 1.0.4
[23] Fix | Delete
*/
[24] Fix | Delete
private $_logger;
[25] Fix | Delete
/**
[26] Fix | Delete
* @var object
[27] Fix | Delete
* @since 1.1.8.1
[28] Fix | Delete
*/
[29] Fix | Delete
private $_update_details;
[30] Fix | Delete
/**
[31] Fix | Delete
* @var array
[32] Fix | Delete
* @since 2.1.2
[33] Fix | Delete
*/
[34] Fix | Delete
private $_translation_updates;
[35] Fix | Delete
[36] Fix | Delete
private static $_upgrade_basename = null;
[37] Fix | Delete
[38] Fix | Delete
#--------------------------------------------------------------------------------
[39] Fix | Delete
#region Singleton
[40] Fix | Delete
#--------------------------------------------------------------------------------
[41] Fix | Delete
[42] Fix | Delete
/**
[43] Fix | Delete
* @var FS_Plugin_Updater[]
[44] Fix | Delete
* @since 2.0.0
[45] Fix | Delete
*/
[46] Fix | Delete
private static $_INSTANCES = array();
[47] Fix | Delete
[48] Fix | Delete
/**
[49] Fix | Delete
* @param Freemius $freemius
[50] Fix | Delete
*
[51] Fix | Delete
* @return FS_Plugin_Updater
[52] Fix | Delete
*/
[53] Fix | Delete
static function instance( Freemius $freemius ) {
[54] Fix | Delete
$key = $freemius->get_id();
[55] Fix | Delete
[56] Fix | Delete
if ( ! isset( self::$_INSTANCES[ $key ] ) ) {
[57] Fix | Delete
self::$_INSTANCES[ $key ] = new self( $freemius );
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
return self::$_INSTANCES[ $key ];
[61] Fix | Delete
}
[62] Fix | Delete
[63] Fix | Delete
#endregion
[64] Fix | Delete
[65] Fix | Delete
private function __construct( Freemius $freemius ) {
[66] Fix | Delete
$this->_fs = $freemius;
[67] Fix | Delete
[68] Fix | Delete
$this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $freemius->get_slug() . '_updater', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
[69] Fix | Delete
[70] Fix | Delete
$this->filters();
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
/**
[74] Fix | Delete
* Initiate required filters.
[75] Fix | Delete
*
[76] Fix | Delete
* @author Vova Feldman (@svovaf)
[77] Fix | Delete
* @since 1.0.4
[78] Fix | Delete
*/
[79] Fix | Delete
private function filters() {
[80] Fix | Delete
// Override request for plugin information
[81] Fix | Delete
add_filter( 'plugins_api', array( &$this, 'plugins_api_filter' ), 10, 3 );
[82] Fix | Delete
[83] Fix | Delete
$this->add_transient_filters();
[84] Fix | Delete
[85] Fix | Delete
/**
[86] Fix | Delete
* If user has the premium plugin's code but do NOT have an active license,
[87] Fix | Delete
* encourage him to upgrade by showing that there's a new release, but instead
[88] Fix | Delete
* of showing an update link, show upgrade link to the pricing page.
[89] Fix | Delete
*
[90] Fix | Delete
* @since 1.1.6
[91] Fix | Delete
*
[92] Fix | Delete
*/
[93] Fix | Delete
// WP 2.9+
[94] Fix | Delete
add_action( "after_plugin_row_{$this->_fs->get_plugin_basename()}", array(
[95] Fix | Delete
&$this,
[96] Fix | Delete
'catch_plugin_update_row'
[97] Fix | Delete
), 9 );
[98] Fix | Delete
add_action( "after_plugin_row_{$this->_fs->get_plugin_basename()}", array(
[99] Fix | Delete
&$this,
[100] Fix | Delete
'edit_and_echo_plugin_update_row'
[101] Fix | Delete
), 11, 2 );
[102] Fix | Delete
[103] Fix | Delete
if ( ! $this->_fs->has_any_active_valid_license() ) {
[104] Fix | Delete
add_action( 'admin_head', array( &$this, 'catch_plugin_information_dialog_contents' ) );
[105] Fix | Delete
}
[106] Fix | Delete
[107] Fix | Delete
if ( ! WP_FS__IS_PRODUCTION_MODE ) {
[108] Fix | Delete
add_filter( 'http_request_host_is_external', array(
[109] Fix | Delete
$this,
[110] Fix | Delete
'http_request_host_is_external_filter'
[111] Fix | Delete
), 10, 3 );
[112] Fix | Delete
}
[113] Fix | Delete
[114] Fix | Delete
if ( $this->_fs->is_premium() ) {
[115] Fix | Delete
if ( ! $this->is_correct_folder_name() ) {
[116] Fix | Delete
add_filter( 'upgrader_post_install', array( &$this, '_maybe_update_folder_name' ), 10, 3 );
[117] Fix | Delete
}
[118] Fix | Delete
[119] Fix | Delete
add_filter( 'upgrader_pre_install', array( 'FS_Plugin_Updater', '_store_basename_for_source_adjustment' ), 1, 2 );
[120] Fix | Delete
add_filter( 'upgrader_source_selection', array( 'FS_Plugin_Updater', '_maybe_adjust_source_dir' ), 1, 3 );
[121] Fix | Delete
[122] Fix | Delete
if ( ! $this->_fs->has_any_active_valid_license() ) {
[123] Fix | Delete
add_filter( 'wp_prepare_themes_for_js', array( &$this, 'change_theme_update_info_html' ), 10, 1 );
[124] Fix | Delete
}
[125] Fix | Delete
}
[126] Fix | Delete
}
[127] Fix | Delete
[128] Fix | Delete
/**
[129] Fix | Delete
* @author Leo Fajardo (@leorw)
[130] Fix | Delete
* @since 2.1.4
[131] Fix | Delete
*/
[132] Fix | Delete
function catch_plugin_information_dialog_contents() {
[133] Fix | Delete
if (
[134] Fix | Delete
'plugin-information' !== fs_request_get( 'tab', false ) ||
[135] Fix | Delete
$this->_fs->get_slug() !== fs_request_get_raw( 'plugin', false )
[136] Fix | Delete
) {
[137] Fix | Delete
return;
[138] Fix | Delete
}
[139] Fix | Delete
[140] Fix | Delete
add_action( 'admin_footer', array( &$this, 'edit_and_echo_plugin_information_dialog_contents' ), 0, 1 );
[141] Fix | Delete
[142] Fix | Delete
ob_start();
[143] Fix | Delete
}
[144] Fix | Delete
[145] Fix | Delete
/**
[146] Fix | Delete
* @author Leo Fajardo (@leorw)
[147] Fix | Delete
* @since 2.1.4
[148] Fix | Delete
*
[149] Fix | Delete
* @param string $hook_suffix
[150] Fix | Delete
*/
[151] Fix | Delete
function edit_and_echo_plugin_information_dialog_contents( $hook_suffix ) {
[152] Fix | Delete
if (
[153] Fix | Delete
'plugin-information' !== fs_request_get( 'tab', false ) ||
[154] Fix | Delete
$this->_fs->get_slug() !== fs_request_get_raw( 'plugin', false )
[155] Fix | Delete
) {
[156] Fix | Delete
return;
[157] Fix | Delete
}
[158] Fix | Delete
[159] Fix | Delete
$license = $this->_fs->_get_license();
[160] Fix | Delete
[161] Fix | Delete
$subscription = ( is_object( $license ) && ! $license->is_lifetime() ) ?
[162] Fix | Delete
$this->_fs->_get_subscription( $license->id ) :
[163] Fix | Delete
null;
[164] Fix | Delete
[165] Fix | Delete
$contents = ob_get_clean();
[166] Fix | Delete
[167] Fix | Delete
$install_or_update_button_id_attribute_pos = strpos( $contents, 'id="plugin_install_from_iframe"' );
[168] Fix | Delete
[169] Fix | Delete
if ( false === $install_or_update_button_id_attribute_pos ) {
[170] Fix | Delete
$install_or_update_button_id_attribute_pos = strpos( $contents, 'id="plugin_update_from_iframe"' );
[171] Fix | Delete
}
[172] Fix | Delete
[173] Fix | Delete
if ( false !== $install_or_update_button_id_attribute_pos ) {
[174] Fix | Delete
$install_or_update_button_start_pos = strrpos(
[175] Fix | Delete
substr( $contents, 0, $install_or_update_button_id_attribute_pos ),
[176] Fix | Delete
'<a'
[177] Fix | Delete
);
[178] Fix | Delete
[179] Fix | Delete
$install_or_update_button_end_pos = ( strpos( $contents, '</a>', $install_or_update_button_id_attribute_pos ) + strlen( '</a>' ) );
[180] Fix | Delete
[181] Fix | Delete
/**
[182] Fix | Delete
* The part of the contents without the update button.
[183] Fix | Delete
*
[184] Fix | Delete
* @author Leo Fajardo (@leorw)
[185] Fix | Delete
* @since 2.2.5
[186] Fix | Delete
*/
[187] Fix | Delete
$modified_contents = substr( $contents, 0, $install_or_update_button_start_pos );
[188] Fix | Delete
[189] Fix | Delete
$install_or_update_button = substr( $contents, $install_or_update_button_start_pos, ( $install_or_update_button_end_pos - $install_or_update_button_start_pos ) );
[190] Fix | Delete
[191] Fix | Delete
/**
[192] Fix | Delete
* Replace the plugin information dialog's "Install Update Now" button's text and URL. If there's a license,
[193] Fix | Delete
* the text will be "Renew license" and will link to the checkout page with the license's billing cycle
[194] Fix | Delete
* and quota. If there's no license, the text will be "Buy license" and will link to the pricing page.
[195] Fix | Delete
*/
[196] Fix | Delete
$install_or_update_button = preg_replace(
[197] Fix | Delete
'/(\<a.+)(id="plugin_(install|update)_from_iframe")(.+href=")([^\s]+)(".*\>)(.+)(\<\/a>)/is',
[198] Fix | Delete
is_object( $license ) ?
[199] Fix | Delete
sprintf(
[200] Fix | Delete
'$1$4%s$6%s$8',
[201] Fix | Delete
$this->_fs->checkout_url(
[202] Fix | Delete
is_object( $subscription ) ?
[203] Fix | Delete
( 1 == $subscription->billing_cycle ? WP_FS__PERIOD_MONTHLY : WP_FS__PERIOD_ANNUALLY ) :
[204] Fix | Delete
WP_FS__PERIOD_LIFETIME,
[205] Fix | Delete
false,
[206] Fix | Delete
array( 'licenses' => $license->quota )
[207] Fix | Delete
),
[208] Fix | Delete
fs_text_inline( 'Renew license', 'renew-license', $this->_fs->get_slug() )
[209] Fix | Delete
) :
[210] Fix | Delete
sprintf(
[211] Fix | Delete
'$1$4%s$6%s$8',
[212] Fix | Delete
$this->_fs->pricing_url(),
[213] Fix | Delete
fs_text_inline( 'Buy license', 'buy-license', $this->_fs->get_slug() )
[214] Fix | Delete
),
[215] Fix | Delete
$install_or_update_button
[216] Fix | Delete
);
[217] Fix | Delete
[218] Fix | Delete
/**
[219] Fix | Delete
* Append the modified button.
[220] Fix | Delete
*
[221] Fix | Delete
* @author Leo Fajardo (@leorw)
[222] Fix | Delete
* @since 2.2.5
[223] Fix | Delete
*/
[224] Fix | Delete
$modified_contents .= $install_or_update_button;
[225] Fix | Delete
[226] Fix | Delete
/**
[227] Fix | Delete
* Append the remaining part of the contents after the update button.
[228] Fix | Delete
*
[229] Fix | Delete
* @author Leo Fajardo (@leorw)
[230] Fix | Delete
* @since 2.2.5
[231] Fix | Delete
*/
[232] Fix | Delete
$modified_contents .= substr( $contents, $install_or_update_button_end_pos );
[233] Fix | Delete
[234] Fix | Delete
$contents = $modified_contents;
[235] Fix | Delete
}
[236] Fix | Delete
[237] Fix | Delete
echo $contents;
[238] Fix | Delete
}
[239] Fix | Delete
[240] Fix | Delete
/**
[241] Fix | Delete
* @author Vova Feldman (@svovaf)
[242] Fix | Delete
* @since 2.0.0
[243] Fix | Delete
*/
[244] Fix | Delete
private function add_transient_filters() {
[245] Fix | Delete
if (
[246] Fix | Delete
$this->_fs->is_premium() &&
[247] Fix | Delete
$this->_fs->is_registered() &&
[248] Fix | Delete
! FS_Permission_Manager::instance( $this->_fs )->is_essentials_tracking_allowed()
[249] Fix | Delete
) {
[250] Fix | Delete
$this->_logger->log( 'Opted out sites cannot receive automatic software updates.' );
[251] Fix | Delete
[252] Fix | Delete
return;
[253] Fix | Delete
}
[254] Fix | Delete
[255] Fix | Delete
add_filter( 'pre_set_site_transient_update_plugins', array(
[256] Fix | Delete
&$this,
[257] Fix | Delete
'pre_set_site_transient_update_plugins_filter'
[258] Fix | Delete
) );
[259] Fix | Delete
[260] Fix | Delete
add_filter( 'pre_set_site_transient_update_themes', array(
[261] Fix | Delete
&$this,
[262] Fix | Delete
'pre_set_site_transient_update_plugins_filter'
[263] Fix | Delete
) );
[264] Fix | Delete
}
[265] Fix | Delete
[266] Fix | Delete
/**
[267] Fix | Delete
* @author Vova Feldman (@svovaf)
[268] Fix | Delete
* @since 2.0.0
[269] Fix | Delete
*/
[270] Fix | Delete
private function remove_transient_filters() {
[271] Fix | Delete
remove_filter( 'pre_set_site_transient_update_plugins', array(
[272] Fix | Delete
&$this,
[273] Fix | Delete
'pre_set_site_transient_update_plugins_filter'
[274] Fix | Delete
) );
[275] Fix | Delete
[276] Fix | Delete
remove_filter( 'pre_set_site_transient_update_themes', array(
[277] Fix | Delete
&$this,
[278] Fix | Delete
'pre_set_site_transient_update_plugins_filter'
[279] Fix | Delete
) );
[280] Fix | Delete
}
[281] Fix | Delete
[282] Fix | Delete
/**
[283] Fix | Delete
* Capture plugin update row by turning output buffering.
[284] Fix | Delete
*
[285] Fix | Delete
* @author Vova Feldman (@svovaf)
[286] Fix | Delete
* @since 1.1.6
[287] Fix | Delete
*/
[288] Fix | Delete
function catch_plugin_update_row() {
[289] Fix | Delete
ob_start();
[290] Fix | Delete
}
[291] Fix | Delete
[292] Fix | Delete
/**
[293] Fix | Delete
* Overrides default update message format with "renew your license" message.
[294] Fix | Delete
*
[295] Fix | Delete
* @author Vova Feldman (@svovaf)
[296] Fix | Delete
* @since 1.1.6
[297] Fix | Delete
*
[298] Fix | Delete
* @param string $file
[299] Fix | Delete
* @param array $plugin_data
[300] Fix | Delete
*/
[301] Fix | Delete
function edit_and_echo_plugin_update_row( $file, $plugin_data ) {
[302] Fix | Delete
$plugin_update_row = ob_get_clean();
[303] Fix | Delete
[304] Fix | Delete
$current = get_site_transient( 'update_plugins' );
[305] Fix | Delete
if ( ! isset( $current->response[ $file ] ) ) {
[306] Fix | Delete
echo $plugin_update_row;
[307] Fix | Delete
[308] Fix | Delete
return;
[309] Fix | Delete
}
[310] Fix | Delete
[311] Fix | Delete
$r = $current->response[ $file ];
[312] Fix | Delete
[313] Fix | Delete
$has_beta_update = $this->_fs->has_beta_update();
[314] Fix | Delete
[315] Fix | Delete
if ( $this->_fs->has_any_active_valid_license() ) {
[316] Fix | Delete
if ( $has_beta_update ) {
[317] Fix | Delete
/**
[318] Fix | Delete
* Turn the "new version" text into "new Beta version".
[319] Fix | Delete
*
[320] Fix | Delete
* Sample input:
[321] Fix | Delete
* There is a new version of Awesome Plugin available. <a href="...>View version x.y.z details</a> or <a href="...>update now</a>.
[322] Fix | Delete
* Output:
[323] Fix | Delete
* There is a new Beta version of Awesome Plugin available. <a href="...>View version x.y.z details</a> or <a href="...>update now</a>.
[324] Fix | Delete
*
[325] Fix | Delete
* @author Leo Fajardo (@leorw)
[326] Fix | Delete
* @since 2.3.0
[327] Fix | Delete
*/
[328] Fix | Delete
$plugin_update_row = preg_replace(
[329] Fix | Delete
'/(\<div.+>)(.+)(\<a.+href="([^\s]+)"([^\<]+)\>.+\<a.+)(\<\/div\>)/is',
[330] Fix | Delete
(
[331] Fix | Delete
'$1' .
[332] Fix | Delete
sprintf(
[333] Fix | Delete
fs_text_inline( 'There is a %s of %s available.', 'new-version-available', $this->_fs->get_slug() ),
[334] Fix | Delete
$has_beta_update ?
[335] Fix | Delete
fs_text_inline( 'new Beta version', 'new-beta-version', $this->_fs->get_slug() ) :
[336] Fix | Delete
fs_text_inline( 'new version', 'new-version', $this->_fs->get_slug() ),
[337] Fix | Delete
$this->_fs->get_plugin_title()
[338] Fix | Delete
) .
[339] Fix | Delete
' ' .
[340] Fix | Delete
'$3' .
[341] Fix | Delete
'$6'
[342] Fix | Delete
),
[343] Fix | Delete
$plugin_update_row
[344] Fix | Delete
);
[345] Fix | Delete
}
[346] Fix | Delete
} else {
[347] Fix | Delete
/**
[348] Fix | Delete
* Turn the "new version" text into a link that opens the plugin information dialog when clicked and
[349] Fix | Delete
* make the "View version x details" text link to the checkout page instead of opening the plugin
[350] Fix | Delete
* information dialog when clicked.
[351] Fix | Delete
*
[352] Fix | Delete
* Sample input:
[353] Fix | Delete
* There is a new version of Awesome Plugin available. <a href="...>View version x.y.z details</a> or <a href="...>update now</a>.
[354] Fix | Delete
* Output:
[355] Fix | Delete
* There is a <a href="...>new version</a> of Awesome Plugin available. <a href="...>Buy a license now</a> to access version x.y.z security & feature updates, and support.
[356] Fix | Delete
* OR
[357] Fix | Delete
* There is a <a href="...>new Beta version</a> of Awesome Plugin available. <a href="...>Buy a license now</a> to access version x.y.z security & feature updates, and support.
[358] Fix | Delete
*
[359] Fix | Delete
* @author Leo Fajardo (@leorw)
[360] Fix | Delete
*/
[361] Fix | Delete
$plugin_update_row = preg_replace(
[362] Fix | Delete
'/(\<div.+>)(.+)(\<a.+href="([^\s]+)"([^\<]+)\>.+\<a.+)(\<\/div\>)/is',
[363] Fix | Delete
(
[364] Fix | Delete
'$1' .
[365] Fix | Delete
sprintf(
[366] Fix | Delete
fs_text_inline( 'There is a %s of %s available.', 'new-version-available', $this->_fs->get_slug() ),
[367] Fix | Delete
sprintf(
[368] Fix | Delete
'<a href="$4"%s>%s</a>',
[369] Fix | Delete
'$5',
[370] Fix | Delete
$has_beta_update ?
[371] Fix | Delete
fs_text_inline( 'new Beta version', 'new-beta-version', $this->_fs->get_slug() ) :
[372] Fix | Delete
fs_text_inline( 'new version', 'new-version', $this->_fs->get_slug() )
[373] Fix | Delete
),
[374] Fix | Delete
$this->_fs->get_plugin_title()
[375] Fix | Delete
) .
[376] Fix | Delete
' ' .
[377] Fix | Delete
$this->_fs->version_upgrade_checkout_link( $r->new_version ) .
[378] Fix | Delete
'$6'
[379] Fix | Delete
),
[380] Fix | Delete
$plugin_update_row
[381] Fix | Delete
);
[382] Fix | Delete
}
[383] Fix | Delete
[384] Fix | Delete
if (
[385] Fix | Delete
$this->_fs->is_plugin() &&
[386] Fix | Delete
isset( $r->upgrade_notice ) &&
[387] Fix | Delete
strlen( trim( $r->upgrade_notice ) ) > 0
[388] Fix | Delete
) {
[389] Fix | Delete
$slug = $this->_fs->get_slug();
[390] Fix | Delete
[391] Fix | Delete
$upgrade_notice_html = sprintf(
[392] Fix | Delete
'<p class="notice fs-upgrade-notice fs-slug-%1$s fs-type-%2$s" data-slug="%1$s" data-type="%2$s"><strong>%3$s</strong> %4$s</p>',
[393] Fix | Delete
$slug,
[394] Fix | Delete
$this->_fs->get_module_type(),
[395] Fix | Delete
fs_text_inline( 'Important Upgrade Notice:', 'upgrade_notice', $slug ),
[396] Fix | Delete
esc_html( $r->upgrade_notice )
[397] Fix | Delete
);
[398] Fix | Delete
[399] Fix | Delete
$plugin_update_row = str_replace( '</div>', '</div>' . $upgrade_notice_html, $plugin_update_row );
[400] Fix | Delete
}
[401] Fix | Delete
[402] Fix | Delete
echo $plugin_update_row;
[403] Fix | Delete
}
[404] Fix | Delete
[405] Fix | Delete
/**
[406] Fix | Delete
* @author Leo Fajardo (@leorw)
[407] Fix | Delete
* @since 2.0.2
[408] Fix | Delete
*
[409] Fix | Delete
* @param array $prepared_themes
[410] Fix | Delete
*
[411] Fix | Delete
* @return array
[412] Fix | Delete
*/
[413] Fix | Delete
function change_theme_update_info_html( $prepared_themes ) {
[414] Fix | Delete
$theme_basename = $this->_fs->get_plugin_basename();
[415] Fix | Delete
[416] Fix | Delete
if ( ! isset( $prepared_themes[ $theme_basename ] ) ) {
[417] Fix | Delete
return $prepared_themes;
[418] Fix | Delete
}
[419] Fix | Delete
[420] Fix | Delete
$themes_update = get_site_transient( 'update_themes' );
[421] Fix | Delete
if ( ! isset( $themes_update->response[ $theme_basename ] ) ||
[422] Fix | Delete
empty( $themes_update->response[ $theme_basename ]['package'] )
[423] Fix | Delete
) {
[424] Fix | Delete
return $prepared_themes;
[425] Fix | Delete
}
[426] Fix | Delete
[427] Fix | Delete
$prepared_themes[ $theme_basename ]['update'] = preg_replace(
[428] Fix | Delete
'/(\<p.+>)(.+)(\<a.+\<a.+)\.(.+\<\/p\>)/is',
[429] Fix | Delete
'$1 $2 ' . $this->_fs->version_upgrade_checkout_link( $themes_update->response[ $theme_basename ]['new_version'] ) .
[430] Fix | Delete
'$4',
[431] Fix | Delete
$prepared_themes[ $theme_basename ]['update']
[432] Fix | Delete
);
[433] Fix | Delete
[434] Fix | Delete
// Set to false to prevent the "Update now" link for the context theme from being shown on the "Themes" page.
[435] Fix | Delete
$prepared_themes[ $theme_basename ]['hasPackage'] = false;
[436] Fix | Delete
[437] Fix | Delete
return $prepared_themes;
[438] Fix | Delete
}
[439] Fix | Delete
[440] Fix | Delete
/**
[441] Fix | Delete
* Since WP version 3.6, a new security feature was added that denies access to repository with a local ip.
[442] Fix | Delete
* During development mode we want to be able updating plugin versions via our localhost repository. This
[443] Fix | Delete
* filter white-list all domains including "api.freemius".
[444] Fix | Delete
*
[445] Fix | Delete
* @link http://www.emanueletessore.com/wordpress-download-failed-valid-url-provided/
[446] Fix | Delete
*
[447] Fix | Delete
* @author Vova Feldman (@svovaf)
[448] Fix | Delete
* @since 1.0.4
[449] Fix | Delete
*
[450] Fix | Delete
* @param bool $allow
[451] Fix | Delete
* @param string $host
[452] Fix | Delete
* @param string $url
[453] Fix | Delete
*
[454] Fix | Delete
* @return bool
[455] Fix | Delete
*/
[456] Fix | Delete
function http_request_host_is_external_filter( $allow, $host, $url ) {
[457] Fix | Delete
return ( false !== strpos( $host, 'freemius' ) ) ? true : $allow;
[458] Fix | Delete
}
[459] Fix | Delete
[460] Fix | Delete
/**
[461] Fix | Delete
* Check for Updates at the defined API endpoint and modify the update array.
[462] Fix | Delete
*
[463] Fix | Delete
* This function dives into the update api just when WordPress creates its update array,
[464] Fix | Delete
* then adds a custom API call and injects the custom plugin data retrieved from the API.
[465] Fix | Delete
* It is reassembled from parts of the native WordPress plugin update code.
[466] Fix | Delete
* See wp-includes/update.php line 121 for the original wp_update_plugins() function.
[467] Fix | Delete
*
[468] Fix | Delete
* @author Vova Feldman (@svovaf)
[469] Fix | Delete
* @since 1.0.4
[470] Fix | Delete
*
[471] Fix | Delete
* @uses FS_Api
[472] Fix | Delete
*
[473] Fix | Delete
* @param object $transient_data Update array build by WordPress.
[474] Fix | Delete
*
[475] Fix | Delete
* @return object Modified update array with custom plugin data.
[476] Fix | Delete
*/
[477] Fix | Delete
function pre_set_site_transient_update_plugins_filter( $transient_data ) {
[478] Fix | Delete
$this->_logger->entrance();
[479] Fix | Delete
[480] Fix | Delete
/**
[481] Fix | Delete
* "plugins" or "themes".
[482] Fix | Delete
*
[483] Fix | Delete
* @author Leo Fajardo (@leorw)
[484] Fix | Delete
* @since 1.2.2
[485] Fix | Delete
*/
[486] Fix | Delete
$module_type = $this->_fs->get_module_type() . 's';
[487] Fix | Delete
[488] Fix | Delete
/**
[489] Fix | Delete
* Ensure that we don't mix plugins update info with themes update info.
[490] Fix | Delete
*
[491] Fix | Delete
* @author Leo Fajardo (@leorw)
[492] Fix | Delete
* @since 1.2.2
[493] Fix | Delete
*/
[494] Fix | Delete
if ( "pre_set_site_transient_update_{$module_type}" !== current_filter() ) {
[495] Fix | Delete
return $transient_data;
[496] Fix | Delete
}
[497] Fix | Delete
[498] Fix | Delete
if ( empty( $transient_data ) ||
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function