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: fs-plugin-info-dialog.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.6
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[8] Fix | Delete
exit;
[9] Fix | Delete
}
[10] Fix | Delete
[11] Fix | Delete
/**
[12] Fix | Delete
* Class FS_Plugin_Info_Dialog
[13] Fix | Delete
*
[14] Fix | Delete
* @author Vova Feldman (@svovaf)
[15] Fix | Delete
* @since 1.1.7
[16] Fix | Delete
*/
[17] Fix | Delete
class FS_Plugin_Info_Dialog {
[18] Fix | Delete
/**
[19] Fix | Delete
* @since 1.1.7
[20] Fix | Delete
*
[21] Fix | Delete
* @var FS_Logger
[22] Fix | Delete
*/
[23] Fix | Delete
private $_logger;
[24] Fix | Delete
[25] Fix | Delete
/**
[26] Fix | Delete
* @since 1.1.7
[27] Fix | Delete
*
[28] Fix | Delete
* @var Freemius
[29] Fix | Delete
*/
[30] Fix | Delete
private $_fs;
[31] Fix | Delete
[32] Fix | Delete
/**
[33] Fix | Delete
* Collection of plugin installation, update, download, activation, and purchase actions. This is used in
[34] Fix | Delete
* populating the actions dropdown list when there are at least 2 actions. If there's only 1 action, a button
[35] Fix | Delete
* is used instead.
[36] Fix | Delete
*
[37] Fix | Delete
* @author Leo Fajardo (@leorw)
[38] Fix | Delete
* @since 2.3.0
[39] Fix | Delete
*
[40] Fix | Delete
* @var string[]
[41] Fix | Delete
*/
[42] Fix | Delete
private $actions;
[43] Fix | Delete
[44] Fix | Delete
/**
[45] Fix | Delete
* Contains plugin status information that is used to determine which actions should be part of the actions
[46] Fix | Delete
* dropdown list.
[47] Fix | Delete
*
[48] Fix | Delete
* @author Leo Fajardo (@leorw)
[49] Fix | Delete
* @since 2.3.0
[50] Fix | Delete
*
[51] Fix | Delete
* @var string[]
[52] Fix | Delete
*/
[53] Fix | Delete
private $status;
[54] Fix | Delete
[55] Fix | Delete
function __construct( Freemius $fs ) {
[56] Fix | Delete
$this->_fs = $fs;
[57] Fix | Delete
[58] Fix | Delete
$this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $fs->get_slug() . '_info', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
[59] Fix | Delete
[60] Fix | Delete
// Remove default plugin information action.
[61] Fix | Delete
remove_all_actions( 'install_plugins_pre_plugin-information' );
[62] Fix | Delete
[63] Fix | Delete
// Override action with custom plugins function for add-ons.
[64] Fix | Delete
add_action( 'install_plugins_pre_plugin-information', array( &$this, 'install_plugin_information' ) );
[65] Fix | Delete
[66] Fix | Delete
// Override request for plugin information for Add-ons.
[67] Fix | Delete
add_filter(
[68] Fix | Delete
'fs_plugins_api',
[69] Fix | Delete
array( &$this, '_get_addon_info_filter' ),
[70] Fix | Delete
WP_FS__DEFAULT_PRIORITY, 3 );
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
/**
[74] Fix | Delete
* Generate add-on plugin information.
[75] Fix | Delete
*
[76] Fix | Delete
* @author Vova Feldman (@svovaf)
[77] Fix | Delete
* @since 1.0.6
[78] Fix | Delete
*
[79] Fix | Delete
* @param array $data
[80] Fix | Delete
* @param string $action
[81] Fix | Delete
* @param object|null $args
[82] Fix | Delete
*
[83] Fix | Delete
* @return array|null
[84] Fix | Delete
*/
[85] Fix | Delete
function _get_addon_info_filter( $data, $action = '', $args = null ) {
[86] Fix | Delete
$this->_logger->entrance();
[87] Fix | Delete
[88] Fix | Delete
$parent_plugin_id = fs_request_get( 'parent_plugin_id', $this->_fs->get_id() );
[89] Fix | Delete
[90] Fix | Delete
if ( $this->_fs->get_id() != $parent_plugin_id ||
[91] Fix | Delete
( 'plugin_information' !== $action ) ||
[92] Fix | Delete
! isset( $args->slug )
[93] Fix | Delete
) {
[94] Fix | Delete
return $data;
[95] Fix | Delete
}
[96] Fix | Delete
[97] Fix | Delete
// Find add-on by slug.
[98] Fix | Delete
$selected_addon = $this->_fs->get_addon_by_slug( $args->slug, WP_FS__DEV_MODE );
[99] Fix | Delete
[100] Fix | Delete
if ( false === $selected_addon ) {
[101] Fix | Delete
return $data;
[102] Fix | Delete
}
[103] Fix | Delete
[104] Fix | Delete
if ( ! isset( $selected_addon->info ) ) {
[105] Fix | Delete
// Setup some default info.
[106] Fix | Delete
$selected_addon->info = new stdClass();
[107] Fix | Delete
$selected_addon->info->selling_point_0 = 'Selling Point 1';
[108] Fix | Delete
$selected_addon->info->selling_point_1 = 'Selling Point 2';
[109] Fix | Delete
$selected_addon->info->selling_point_2 = 'Selling Point 3';
[110] Fix | Delete
$selected_addon->info->description = '<p>Tell your users all about your add-on</p>';
[111] Fix | Delete
}
[112] Fix | Delete
[113] Fix | Delete
fs_enqueue_local_style( 'fs_addons', '/admin/add-ons.css' );
[114] Fix | Delete
[115] Fix | Delete
$data = $args;
[116] Fix | Delete
[117] Fix | Delete
$has_free_plan = false;
[118] Fix | Delete
$has_paid_plan = false;
[119] Fix | Delete
[120] Fix | Delete
// Load add-on pricing.
[121] Fix | Delete
$has_pricing = false;
[122] Fix | Delete
$has_features = false;
[123] Fix | Delete
$plans = false;
[124] Fix | Delete
[125] Fix | Delete
$result = $this->_fs->get_api_plugin_scope()->get( $this->_fs->add_show_pending( "/addons/{$selected_addon->id}/pricing.json?type=visible" ) );
[126] Fix | Delete
[127] Fix | Delete
if ( ! isset( $result->error ) ) {
[128] Fix | Delete
$plans = $result->plans;
[129] Fix | Delete
[130] Fix | Delete
if ( is_array( $plans ) ) {
[131] Fix | Delete
for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
[132] Fix | Delete
$pricing = isset( $plans[ $i ]->pricing ) ? $plans[ $i ]->pricing : null;
[133] Fix | Delete
$features = isset( $plans[ $i ]->features ) ? $plans[ $i ]->features : null;
[134] Fix | Delete
[135] Fix | Delete
$plans[ $i ] = new FS_Plugin_Plan( $plans[ $i ] );
[136] Fix | Delete
$plan = $plans[ $i ];
[137] Fix | Delete
[138] Fix | Delete
if ( 'free' == $plans[ $i ]->name ||
[139] Fix | Delete
! is_array( $pricing ) ||
[140] Fix | Delete
0 == count( $pricing )
[141] Fix | Delete
) {
[142] Fix | Delete
$has_free_plan = true;
[143] Fix | Delete
}
[144] Fix | Delete
[145] Fix | Delete
if ( is_array( $pricing ) && 0 < count( $pricing ) ) {
[146] Fix | Delete
$filtered_pricing = array();
[147] Fix | Delete
[148] Fix | Delete
foreach ( $pricing as $prices ) {
[149] Fix | Delete
$prices = new FS_Pricing( $prices );
[150] Fix | Delete
[151] Fix | Delete
if ( ! $prices->is_usd() ) {
[152] Fix | Delete
/**
[153] Fix | Delete
* Skip non-USD pricing.
[154] Fix | Delete
*
[155] Fix | Delete
* @author Leo Fajardo (@leorw)
[156] Fix | Delete
* @since 2.3.1
[157] Fix | Delete
*/
[158] Fix | Delete
continue;
[159] Fix | Delete
}
[160] Fix | Delete
[161] Fix | Delete
if ( ( $prices->has_monthly() && $prices->monthly_price > 1.0 ) ||
[162] Fix | Delete
( $prices->has_annual() && $prices->annual_price > 1.0 ) ||
[163] Fix | Delete
( $prices->has_lifetime() && $prices->lifetime_price > 1.0 )
[164] Fix | Delete
) {
[165] Fix | Delete
$filtered_pricing[] = $prices;
[166] Fix | Delete
}
[167] Fix | Delete
}
[168] Fix | Delete
[169] Fix | Delete
if ( ! empty( $filtered_pricing ) ) {
[170] Fix | Delete
$has_paid_plan = true;
[171] Fix | Delete
[172] Fix | Delete
$plan->pricing = $filtered_pricing;
[173] Fix | Delete
[174] Fix | Delete
$has_pricing = true;
[175] Fix | Delete
}
[176] Fix | Delete
}
[177] Fix | Delete
[178] Fix | Delete
if ( is_array( $features ) && 0 < count( $features ) ) {
[179] Fix | Delete
$plan->features = $features;
[180] Fix | Delete
[181] Fix | Delete
$has_features = true;
[182] Fix | Delete
}
[183] Fix | Delete
}
[184] Fix | Delete
}
[185] Fix | Delete
}
[186] Fix | Delete
[187] Fix | Delete
$latest = null;
[188] Fix | Delete
[189] Fix | Delete
if ( ! $has_paid_plan && $selected_addon->is_wp_org_compliant ) {
[190] Fix | Delete
$repo_data = FS_Plugin_Updater::_fetch_plugin_info_from_repository(
[191] Fix | Delete
'plugin_information', (object) array(
[192] Fix | Delete
'slug' => $selected_addon->slug,
[193] Fix | Delete
'is_ssl' => is_ssl(),
[194] Fix | Delete
'fields' => array(
[195] Fix | Delete
'banners' => true,
[196] Fix | Delete
'reviews' => true,
[197] Fix | Delete
'downloaded' => false,
[198] Fix | Delete
'active_installs' => true
[199] Fix | Delete
)
[200] Fix | Delete
) );
[201] Fix | Delete
[202] Fix | Delete
if ( ! empty( $repo_data ) ) {
[203] Fix | Delete
$data = $repo_data;
[204] Fix | Delete
$data->wp_org_missing = false;
[205] Fix | Delete
} else {
[206] Fix | Delete
// Couldn't find plugin on .org.
[207] Fix | Delete
$selected_addon->is_wp_org_compliant = false;
[208] Fix | Delete
[209] Fix | Delete
// Plugin is missing, not on Freemius nor WP.org.
[210] Fix | Delete
$data->wp_org_missing = true;
[211] Fix | Delete
}
[212] Fix | Delete
[213] Fix | Delete
$data->fs_missing = ( ! $has_free_plan || $data->wp_org_missing );
[214] Fix | Delete
} else {
[215] Fix | Delete
$data->has_purchased_license = false;
[216] Fix | Delete
$data->wp_org_missing = false;
[217] Fix | Delete
[218] Fix | Delete
$fs_addon = null;
[219] Fix | Delete
$current_addon_version = false;
[220] Fix | Delete
if ( $this->_fs->is_addon_activated( $selected_addon->id ) ) {
[221] Fix | Delete
$fs_addon = $this->_fs->get_addon_instance( $selected_addon->id );
[222] Fix | Delete
$current_addon_version = $fs_addon->get_plugin_version();
[223] Fix | Delete
} else if ( $this->_fs->is_addon_installed( $selected_addon->id ) ) {
[224] Fix | Delete
$addon_plugin_data = get_plugin_data(
[225] Fix | Delete
( WP_PLUGIN_DIR . '/' . $this->_fs->get_addon_basename( $selected_addon->id ) ),
[226] Fix | Delete
false,
[227] Fix | Delete
false
[228] Fix | Delete
);
[229] Fix | Delete
[230] Fix | Delete
if ( ! empty( $addon_plugin_data ) ) {
[231] Fix | Delete
$current_addon_version = $addon_plugin_data['Version'];
[232] Fix | Delete
}
[233] Fix | Delete
}
[234] Fix | Delete
[235] Fix | Delete
// Fetch latest version from Freemius.
[236] Fix | Delete
$latest = $this->_fs->_fetch_latest_version(
[237] Fix | Delete
$selected_addon->id,
[238] Fix | Delete
true,
[239] Fix | Delete
WP_FS__TIME_24_HOURS_IN_SEC,
[240] Fix | Delete
$current_addon_version
[241] Fix | Delete
);
[242] Fix | Delete
[243] Fix | Delete
if ( $has_paid_plan ) {
[244] Fix | Delete
$blog_id = fs_request_get( 'fs_blog_id' );
[245] Fix | Delete
$has_valid_blog_id = is_numeric( $blog_id );
[246] Fix | Delete
[247] Fix | Delete
if ( $has_valid_blog_id ) {
[248] Fix | Delete
switch_to_blog( $blog_id );
[249] Fix | Delete
}
[250] Fix | Delete
[251] Fix | Delete
$data->checkout_link = $this->_fs->checkout_url(
[252] Fix | Delete
WP_FS__PERIOD_ANNUALLY,
[253] Fix | Delete
false,
[254] Fix | Delete
array(),
[255] Fix | Delete
( $has_valid_blog_id ? false : null )
[256] Fix | Delete
);
[257] Fix | Delete
[258] Fix | Delete
if ( $has_valid_blog_id ) {
[259] Fix | Delete
restore_current_blog();
[260] Fix | Delete
}
[261] Fix | Delete
}
[262] Fix | Delete
[263] Fix | Delete
/**
[264] Fix | Delete
* Check if there's a purchased license in case the add-on can only be installed/downloaded as part of a purchased bundle.
[265] Fix | Delete
*
[266] Fix | Delete
* @author Leo Fajardo (@leorw)
[267] Fix | Delete
* @since 2.4.1
[268] Fix | Delete
*/
[269] Fix | Delete
if ( is_object( $fs_addon ) ) {
[270] Fix | Delete
$data->has_purchased_license = $fs_addon->has_active_valid_license();
[271] Fix | Delete
} else {
[272] Fix | Delete
$account_addons = $this->_fs->get_account_addons();
[273] Fix | Delete
if ( ! empty( $account_addons ) && in_array( $selected_addon->id, $account_addons ) ) {
[274] Fix | Delete
$data->has_purchased_license = true;
[275] Fix | Delete
}
[276] Fix | Delete
}
[277] Fix | Delete
[278] Fix | Delete
if ( $has_free_plan || $data->has_purchased_license ) {
[279] Fix | Delete
$data->download_link = $this->_fs->_get_latest_download_local_url( $selected_addon->id );
[280] Fix | Delete
}
[281] Fix | Delete
[282] Fix | Delete
$data->fs_missing = (
[283] Fix | Delete
false === $latest &&
[284] Fix | Delete
(
[285] Fix | Delete
empty( $selected_addon->premium_releases_count ) ||
[286] Fix | Delete
! ( $selected_addon->premium_releases_count > 0 )
[287] Fix | Delete
)
[288] Fix | Delete
);
[289] Fix | Delete
[290] Fix | Delete
// Fetch as much as possible info from local files.
[291] Fix | Delete
$plugin_local_data = $this->_fs->get_plugin_data();
[292] Fix | Delete
$data->author = $plugin_local_data['Author'];
[293] Fix | Delete
[294] Fix | Delete
if ( ! empty( $selected_addon->info->banner_url ) ) {
[295] Fix | Delete
$data->banners = array(
[296] Fix | Delete
'low' => $selected_addon->info->banner_url,
[297] Fix | Delete
);
[298] Fix | Delete
}
[299] Fix | Delete
[300] Fix | Delete
if ( ! empty( $selected_addon->info->screenshots ) ) {
[301] Fix | Delete
$view_vars = array(
[302] Fix | Delete
'screenshots' => $selected_addon->info->screenshots,
[303] Fix | Delete
'plugin' => $selected_addon,
[304] Fix | Delete
);
[305] Fix | Delete
$data->sections['screenshots'] = fs_get_template( '/plugin-info/screenshots.php', $view_vars );
[306] Fix | Delete
}
[307] Fix | Delete
[308] Fix | Delete
if ( is_object( $latest ) ) {
[309] Fix | Delete
$data->version = $latest->version;
[310] Fix | Delete
$data->last_updated = $latest->created;
[311] Fix | Delete
$data->requires = $latest->requires_platform_version;
[312] Fix | Delete
$data->requires_php = $latest->requires_programming_language_version;
[313] Fix | Delete
$data->tested = $latest->tested_up_to_version;
[314] Fix | Delete
} else if ( ! empty( $current_addon_version ) ) {
[315] Fix | Delete
$data->version = $current_addon_version;
[316] Fix | Delete
} else {
[317] Fix | Delete
// Add dummy version.
[318] Fix | Delete
$data->version = '1.0.0';
[319] Fix | Delete
[320] Fix | Delete
// Add message to developer to deploy the plugin through Freemius.
[321] Fix | Delete
}
[322] Fix | Delete
}
[323] Fix | Delete
[324] Fix | Delete
$data->name = $selected_addon->title;
[325] Fix | Delete
$view_vars = array( 'plugin' => $selected_addon );
[326] Fix | Delete
[327] Fix | Delete
if ( is_object( $latest ) && isset( $latest->readme ) && is_object( $latest->readme ) ) {
[328] Fix | Delete
$latest_version_readme_data = $latest->readme;
[329] Fix | Delete
if ( isset( $latest_version_readme_data->sections ) ) {
[330] Fix | Delete
$data->sections = (array) $latest_version_readme_data->sections;
[331] Fix | Delete
} else {
[332] Fix | Delete
$data->sections = array();
[333] Fix | Delete
}
[334] Fix | Delete
}
[335] Fix | Delete
[336] Fix | Delete
$data->sections['description'] = fs_get_template( '/plugin-info/description.php', $view_vars );
[337] Fix | Delete
[338] Fix | Delete
if ( $has_pricing ) {
[339] Fix | Delete
// Add plans to data.
[340] Fix | Delete
$data->plans = $plans;
[341] Fix | Delete
[342] Fix | Delete
if ( $has_features ) {
[343] Fix | Delete
$view_vars = array(
[344] Fix | Delete
'plans' => $plans,
[345] Fix | Delete
'plugin' => $selected_addon,
[346] Fix | Delete
);
[347] Fix | Delete
$data->sections['features'] = fs_get_template( '/plugin-info/features.php', $view_vars );
[348] Fix | Delete
}
[349] Fix | Delete
}
[350] Fix | Delete
[351] Fix | Delete
$data->has_free_plan = $has_free_plan;
[352] Fix | Delete
$data->has_paid_plan = $has_paid_plan;
[353] Fix | Delete
$data->is_paid = $has_paid_plan;
[354] Fix | Delete
$data->is_wp_org_compliant = $selected_addon->is_wp_org_compliant;
[355] Fix | Delete
$data->premium_slug = $selected_addon->premium_slug;
[356] Fix | Delete
$data->addon_id = $selected_addon->id;
[357] Fix | Delete
[358] Fix | Delete
if ( ! isset( $data->has_purchased_license ) ) {
[359] Fix | Delete
$data->has_purchased_license = false;
[360] Fix | Delete
}
[361] Fix | Delete
[362] Fix | Delete
return $data;
[363] Fix | Delete
}
[364] Fix | Delete
[365] Fix | Delete
/**
[366] Fix | Delete
* @author Vova Feldman (@svovaf)
[367] Fix | Delete
* @since 1.1.7
[368] Fix | Delete
*
[369] Fix | Delete
* @param FS_Plugin_Plan $plan
[370] Fix | Delete
*
[371] Fix | Delete
* @return string
[372] Fix | Delete
*/
[373] Fix | Delete
private function get_billing_cycle( FS_Plugin_Plan $plan ) {
[374] Fix | Delete
$billing_cycle = null;
[375] Fix | Delete
[376] Fix | Delete
if ( 1 === count( $plan->pricing ) && 1 == $plan->pricing[0]->licenses ) {
[377] Fix | Delete
$pricing = $plan->pricing[0];
[378] Fix | Delete
if ( isset( $pricing->annual_price ) ) {
[379] Fix | Delete
$billing_cycle = 'annual';
[380] Fix | Delete
} else if ( isset( $pricing->monthly_price ) ) {
[381] Fix | Delete
$billing_cycle = 'monthly';
[382] Fix | Delete
} else if ( isset( $pricing->lifetime_price ) ) {
[383] Fix | Delete
$billing_cycle = 'lifetime';
[384] Fix | Delete
}
[385] Fix | Delete
} else {
[386] Fix | Delete
foreach ( $plan->pricing as $pricing ) {
[387] Fix | Delete
if ( isset( $pricing->annual_price ) ) {
[388] Fix | Delete
$billing_cycle = 'annual';
[389] Fix | Delete
} else if ( isset( $pricing->monthly_price ) ) {
[390] Fix | Delete
$billing_cycle = 'monthly';
[391] Fix | Delete
} else if ( isset( $pricing->lifetime_price ) ) {
[392] Fix | Delete
$billing_cycle = 'lifetime';
[393] Fix | Delete
}
[394] Fix | Delete
[395] Fix | Delete
if ( ! is_null( $billing_cycle ) ) {
[396] Fix | Delete
break;
[397] Fix | Delete
}
[398] Fix | Delete
}
[399] Fix | Delete
}
[400] Fix | Delete
[401] Fix | Delete
return $billing_cycle;
[402] Fix | Delete
}
[403] Fix | Delete
[404] Fix | Delete
/**
[405] Fix | Delete
* @author Vova Feldman (@svovaf)
[406] Fix | Delete
* @since 2.0.0
[407] Fix | Delete
*
[408] Fix | Delete
* @param FS_Plugin_Plan $plan
[409] Fix | Delete
* @param FS_Pricing $pricing
[410] Fix | Delete
*
[411] Fix | Delete
* @return float|null|string
[412] Fix | Delete
*/
[413] Fix | Delete
private function get_price_tag( FS_Plugin_Plan $plan, FS_Pricing $pricing ) {
[414] Fix | Delete
$price_tag = '';
[415] Fix | Delete
if ( isset( $pricing->annual_price ) ) {
[416] Fix | Delete
$price_tag = $pricing->annual_price . ( $plan->is_block_features ? ' / year' : '' );
[417] Fix | Delete
} else if ( isset( $pricing->monthly_price ) ) {
[418] Fix | Delete
$price_tag = $pricing->monthly_price . ' / mo';
[419] Fix | Delete
} else if ( isset( $pricing->lifetime_price ) ) {
[420] Fix | Delete
$price_tag = $pricing->lifetime_price;
[421] Fix | Delete
}
[422] Fix | Delete
[423] Fix | Delete
return '$' . $price_tag;
[424] Fix | Delete
}
[425] Fix | Delete
[426] Fix | Delete
/**
[427] Fix | Delete
* @author Leo Fajardo (@leorw)
[428] Fix | Delete
* @since 2.3.0
[429] Fix | Delete
*
[430] Fix | Delete
* @param object $api
[431] Fix | Delete
* @param FS_Plugin_Plan $plan
[432] Fix | Delete
*
[433] Fix | Delete
* @return string
[434] Fix | Delete
*/
[435] Fix | Delete
private function get_actions_dropdown( $api, $plan = null ) {
[436] Fix | Delete
$this->actions = isset( $this->actions ) ?
[437] Fix | Delete
$this->actions :
[438] Fix | Delete
$this->get_plugin_actions( $api );
[439] Fix | Delete
[440] Fix | Delete
$actions = $this->actions;
[441] Fix | Delete
[442] Fix | Delete
$checkout_cta = $this->get_checkout_cta( $api, $plan );
[443] Fix | Delete
if ( ! empty( $checkout_cta ) ) {
[444] Fix | Delete
/**
[445] Fix | Delete
* If there's no license yet, make the checkout button the main CTA. Otherwise, make it the last item in
[446] Fix | Delete
* the actions dropdown.
[447] Fix | Delete
*
[448] Fix | Delete
* @author Leo Fajardo (@leorw)
[449] Fix | Delete
* @since 2.3.0
[450] Fix | Delete
*/
[451] Fix | Delete
if ( ! $api->has_purchased_license ) {
[452] Fix | Delete
array_unshift( $actions, $checkout_cta );
[453] Fix | Delete
} else {
[454] Fix | Delete
$actions[] = $checkout_cta;
[455] Fix | Delete
}
[456] Fix | Delete
}
[457] Fix | Delete
[458] Fix | Delete
if ( empty( $actions ) ) {
[459] Fix | Delete
return '';
[460] Fix | Delete
}
[461] Fix | Delete
[462] Fix | Delete
$total_actions = count( $actions );
[463] Fix | Delete
if ( 1 === $total_actions ) {
[464] Fix | Delete
return $actions[0];
[465] Fix | Delete
}
[466] Fix | Delete
[467] Fix | Delete
ob_start();
[468] Fix | Delete
[469] Fix | Delete
?>
[470] Fix | Delete
<div class="fs-cta fs-dropdown">
[471] Fix | Delete
<div class="button-group">
[472] Fix | Delete
<?php
[473] Fix | Delete
// This should NOT be sanitized as the $actions are HTML buttons already.
[474] Fix | Delete
echo $actions[0] ?>
[475] Fix | Delete
<div class="button button-primary fs-dropdown-arrow-button">
[476] Fix | Delete
<span class="fs-dropdown-arrow"></span>
[477] Fix | Delete
<ul class="fs-dropdown-list" style="display: none">
[478] Fix | Delete
<?php for ( $i = 1; $i < $total_actions; $i ++ ) : ?>
[479] Fix | Delete
<li><?php echo str_replace( 'button button-primary', '', $actions[ $i ] ) ?></li>
[480] Fix | Delete
<?php endfor ?>
[481] Fix | Delete
</ul>
[482] Fix | Delete
</div>
[483] Fix | Delete
</div>
[484] Fix | Delete
</div>
[485] Fix | Delete
<?php
[486] Fix | Delete
[487] Fix | Delete
return ob_get_clean();
[488] Fix | Delete
}
[489] Fix | Delete
[490] Fix | Delete
/**
[491] Fix | Delete
* @author Vova Feldman (@svovaf)
[492] Fix | Delete
* @since 1.1.7
[493] Fix | Delete
*
[494] Fix | Delete
* @param object $api
[495] Fix | Delete
* @param FS_Plugin_Plan $plan
[496] Fix | Delete
*
[497] Fix | Delete
* @return string
[498] Fix | Delete
*/
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function