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/embedpre.../EmbedPre.../Includes/Classes
File: EmbedPress_Notice.php
<?php
[0] Fix | Delete
namespace EmbedPress\Includes\Classes;
[1] Fix | Delete
[2] Fix | Delete
if (!defined('ABSPATH')) {
[3] Fix | Delete
exit;
[4] Fix | Delete
} // Exit if accessed directly.
[5] Fix | Delete
[6] Fix | Delete
class EmbedPress_Notice {
[7] Fix | Delete
/**
[8] Fix | Delete
* Admin Notice Key
[9] Fix | Delete
*
[10] Fix | Delete
* @var array
[11] Fix | Delete
*/
[12] Fix | Delete
const ADMIN_UPDATE_NOTICE_KEY = 'wpdeveloper_notices_seen';
[13] Fix | Delete
public $text_domain = 'embedpress';
[14] Fix | Delete
/**
[15] Fix | Delete
* All Data
[16] Fix | Delete
* @var array
[17] Fix | Delete
*/
[18] Fix | Delete
private $data = array();
[19] Fix | Delete
private $properties = array(
[20] Fix | Delete
'links', 'message', 'thumbnail',
[21] Fix | Delete
);
[22] Fix | Delete
private $methods = array(
[23] Fix | Delete
'message', 'thumbnail', 'classes'
[24] Fix | Delete
);
[25] Fix | Delete
/**
[26] Fix | Delete
* cne_day == current_notice_end_day
[27] Fix | Delete
*
[28] Fix | Delete
* @var integer
[29] Fix | Delete
*/
[30] Fix | Delete
public $cne_time = '2 day';
[31] Fix | Delete
public $maybe_later_time = '7 day';
[32] Fix | Delete
public $finish_time = [];
[33] Fix | Delete
/**
[34] Fix | Delete
* Plugin Name
[35] Fix | Delete
*
[36] Fix | Delete
* @var string
[37] Fix | Delete
*/
[38] Fix | Delete
private $plugin_name;
[39] Fix | Delete
/**
[40] Fix | Delete
* Plugin File Name
[41] Fix | Delete
* @var string
[42] Fix | Delete
*/
[43] Fix | Delete
private $plugin_file;
[44] Fix | Delete
/**
[45] Fix | Delete
* First Install Version Of The Plugin
[46] Fix | Delete
*
[47] Fix | Delete
* @var string
[48] Fix | Delete
*/
[49] Fix | Delete
private $version;
[50] Fix | Delete
/**
[51] Fix | Delete
* Saved Data in DB
[52] Fix | Delete
* @var array
[53] Fix | Delete
*/
[54] Fix | Delete
private $options_data;
[55] Fix | Delete
/**
[56] Fix | Delete
* Current Timestamp
[57] Fix | Delete
* @var integer
[58] Fix | Delete
*/
[59] Fix | Delete
public $timestamp;
[60] Fix | Delete
/**
[61] Fix | Delete
* Primary Notice Action
[62] Fix | Delete
*
[63] Fix | Delete
* @var string
[64] Fix | Delete
*/
[65] Fix | Delete
private $do_notice_action;
[66] Fix | Delete
/**
[67] Fix | Delete
* Default Options Set
[68] Fix | Delete
*
[69] Fix | Delete
* @var array
[70] Fix | Delete
*/
[71] Fix | Delete
public $options_args = array();
[72] Fix | Delete
/**
[73] Fix | Delete
* Notice ID for users.
[74] Fix | Delete
* @var string
[75] Fix | Delete
*/
[76] Fix | Delete
private $notice_id;
[77] Fix | Delete
/**
[78] Fix | Delete
* Upsale Notice Arguments
[79] Fix | Delete
* @var array
[80] Fix | Delete
*/
[81] Fix | Delete
public $upsale_args;
[82] Fix | Delete
[83] Fix | Delete
/**
[84] Fix | Delete
* Revoke this function when the object is created.
[85] Fix | Delete
*
[86] Fix | Delete
* @param string $plugin_file
[87] Fix | Delete
* @param string $version
[88] Fix | Delete
*/
[89] Fix | Delete
public function __construct( $plugin_file = '', $version = '' ) {
[90] Fix | Delete
$this->plugin_file = $plugin_file;
[91] Fix | Delete
$this->plugin_name = basename( $plugin_file, '.php' );
[92] Fix | Delete
$this->version = $version;
[93] Fix | Delete
$this->timestamp = intval( current_time( 'timestamp' ) );
[94] Fix | Delete
$this->notice_id = 'wpdeveloper_notice_' . str_replace( '.', '_', $this->version );
[95] Fix | Delete
[96] Fix | Delete
$this->do_notice_action = 'wpdeveloper_notices_for_' . $this->plugin_name;
[97] Fix | Delete
new EmbedPress_Core_Installer( $this->plugin_name );
[98] Fix | Delete
[99] Fix | Delete
}
[100] Fix | Delete
/**
[101] Fix | Delete
* Initiate The Plugin
[102] Fix | Delete
* @return void
[103] Fix | Delete
*/
[104] Fix | Delete
public function init(){
[105] Fix | Delete
add_action( 'init', array( $this, 'first_install_track') );
[106] Fix | Delete
add_action( 'deactivate_' . $this->plugin_file, array( $this, 'first_install_end' ) );
[107] Fix | Delete
add_action( 'init', array( $this, 'hooks' ) );
[108] Fix | Delete
}
[109] Fix | Delete
/**
[110] Fix | Delete
* All Hooks
[111] Fix | Delete
* @return void
[112] Fix | Delete
*/
[113] Fix | Delete
public function hooks(){
[114] Fix | Delete
add_action( 'wpdeveloper_notice_clicked_for_' . $this->plugin_name, array( $this, 'clicked' ) );
[115] Fix | Delete
add_action( 'wp_ajax_wpdeveloper_upsale_notice_dissmiss_for_' . $this->plugin_name, array( $this, 'upsale_notice_dissmiss' ) );
[116] Fix | Delete
add_action( 'wp_ajax_wpdeveloper_notice_dissmiss_for_' . $this->plugin_name, array( $this, 'notice_dissmiss' ) );
[117] Fix | Delete
add_action( 'wpdeveloper_before_notice_for_' . $this->plugin_name, array( $this, 'before' ) );
[118] Fix | Delete
add_action( 'wpdeveloper_after_notice_for_' . $this->plugin_name, array( $this, 'after' ) );
[119] Fix | Delete
add_action( 'wpdeveloper_before_upsale_notice_for_' . $this->plugin_name, array( $this, 'before_upsale' ) );
[120] Fix | Delete
add_action( 'wpdeveloper_after_upsale_notice_for_' . $this->plugin_name, array( $this, 'after' ) );
[121] Fix | Delete
add_action( $this->do_notice_action, array( $this, 'content' ) );
[122] Fix | Delete
if( current_user_can( 'install_plugins' ) ) {
[123] Fix | Delete
if( isset( $_GET['plugin'] ) && $_GET['plugin'] == $this->plugin_name ) {
[124] Fix | Delete
if( isset( $_GET['tab'] ) && $_GET['tab'] === 'plugin-information' ) {
[125] Fix | Delete
return;
[126] Fix | Delete
}
[127] Fix | Delete
do_action( 'wpdeveloper_notice_clicked_for_' . $this->plugin_name );
[128] Fix | Delete
/**
[129] Fix | Delete
* Redirect User To the Current URL, but without set query arguments.
[130] Fix | Delete
*/
[131] Fix | Delete
wp_safe_redirect( $this->redirect_to() );
[132] Fix | Delete
}
[133] Fix | Delete
$return_notice = $this->next_notice();
[134] Fix | Delete
$current_notice = current( $return_notice );
[135] Fix | Delete
$next_notice = next( $return_notice );
[136] Fix | Delete
[137] Fix | Delete
$deserve_notice = $this->deserve_notice( $current_notice );
[138] Fix | Delete
$options_data = $this->get_options_data();
[139] Fix | Delete
$user_notices = $this->get_user_notices();
[140] Fix | Delete
[141] Fix | Delete
$notice_time = isset( $options_data[ $this->plugin_name ]['notice_will_show'][ $current_notice ] )
[142] Fix | Delete
? $options_data[ $this->plugin_name ]['notice_will_show'][ $current_notice ] : $this->timestamp;
[143] Fix | Delete
$next_notice_time = $next_notice ? $options_data[ $this->plugin_name ]['notice_will_show'][ $next_notice ] : $this->timestamp;
[144] Fix | Delete
$current_notice_end = $this->makeTime( $notice_time, $this->cne_time );
[145] Fix | Delete
[146] Fix | Delete
if( ! $deserve_notice ) {
[147] Fix | Delete
unset( $options_data[ $this->plugin_name ]['notice_will_show'][ $current_notice ] );
[148] Fix | Delete
$this->update_options_data( $options_data[ $this->plugin_name ] );
[149] Fix | Delete
}
[150] Fix | Delete
[151] Fix | Delete
if( $deserve_notice ) {
[152] Fix | Delete
/**
[153] Fix | Delete
* TODO: automatic maybe later setup with time.
[154] Fix | Delete
*/
[155] Fix | Delete
if( ( $this->timestamp >= $current_notice_end ) || ( $this->timestamp > $next_notice_time ) ) {
[156] Fix | Delete
$this->maybe_later( $current_notice );
[157] Fix | Delete
$notice_time = false;
[158] Fix | Delete
}
[159] Fix | Delete
[160] Fix | Delete
if( isset( $this->finish_time[ $current_notice ] ) ) {
[161] Fix | Delete
if( $this->timestamp >= strtotime( $this->finish_time[ $current_notice ] ) ) {
[162] Fix | Delete
unset( $options_data[ $this->plugin_name ]['notice_will_show'][ $current_notice ] );
[163] Fix | Delete
$this->update_options_data( $options_data[ $this->plugin_name ] );
[164] Fix | Delete
$notice_time = false;
[165] Fix | Delete
}
[166] Fix | Delete
}
[167] Fix | Delete
[168] Fix | Delete
if( $notice_time != false ) {
[169] Fix | Delete
if( $notice_time <= $this->timestamp ) {
[170] Fix | Delete
if( $current_notice === 'upsale' ) {
[171] Fix | Delete
$upsale_args = $this->get_upsale_args();
[172] Fix | Delete
if( empty( $upsale_args ) ) {
[173] Fix | Delete
unset( $options_data[ $this->plugin_name ]['notice_will_show'][ $current_notice ] );
[174] Fix | Delete
$this->update_options_data( $options_data[ $this->plugin_name ] );
[175] Fix | Delete
} else {
[176] Fix | Delete
if( isset( $upsale_args['condition'], $upsale_args['condition']['by'] ) ) {
[177] Fix | Delete
switch( $upsale_args['condition']['by'] ) {
[178] Fix | Delete
case 'class' :
[179] Fix | Delete
if( isset( $upsale_args['condition']['class'] ) && class_exists( $upsale_args['condition']['class'] ) ) {
[180] Fix | Delete
unset( $options_data[ $this->plugin_name ]['notice_will_show'][ $current_notice ] );
[181] Fix | Delete
$this->update_options_data( $options_data[ $this->plugin_name ] );
[182] Fix | Delete
return;
[183] Fix | Delete
}
[184] Fix | Delete
break;
[185] Fix | Delete
case 'function' :
[186] Fix | Delete
if( isset( $upsale_args['condition']['function'] ) && function_exists( $upsale_args['condition']['function'] ) ) {
[187] Fix | Delete
unset( $options_data[ $this->plugin_name ]['notice_will_show'][ $current_notice ] );
[188] Fix | Delete
$this->update_options_data( $options_data[ $this->plugin_name ] );
[189] Fix | Delete
return;
[190] Fix | Delete
}
[191] Fix | Delete
break;
[192] Fix | Delete
}
[193] Fix | Delete
}
[194] Fix | Delete
if( isset( $upsale_args['slug'], $upsale_args['file'] ) ) {
[195] Fix | Delete
if ( ! function_exists( 'get_plugins' ) ) {
[196] Fix | Delete
include ABSPATH . '/wp-admin/includes/plugin.php';
[197] Fix | Delete
}
[198] Fix | Delete
$plugins = get_plugins();
[199] Fix | Delete
$pkey = $upsale_args['slug'] . '/' . $upsale_args['file'];
[200] Fix | Delete
if( isset( $plugins[ $pkey ] ) ) {
[201] Fix | Delete
$this->update( $current_notice );
[202] Fix | Delete
return;
[203] Fix | Delete
}
[204] Fix | Delete
}
[205] Fix | Delete
add_action( 'admin_notices', array( $this, 'upsale_notice' ) );
[206] Fix | Delete
}
[207] Fix | Delete
} else {
[208] Fix | Delete
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
[209] Fix | Delete
}
[210] Fix | Delete
}
[211] Fix | Delete
}
[212] Fix | Delete
}
[213] Fix | Delete
}
[214] Fix | Delete
}
[215] Fix | Delete
/**
[216] Fix | Delete
* Make time using timestamp and a string like 2 Hour, 2 Day, 30 Minutes, 1 Week, 1 year
[217] Fix | Delete
* @param integer $current
[218] Fix | Delete
* @param string $time
[219] Fix | Delete
* @return integer
[220] Fix | Delete
*/
[221] Fix | Delete
public function makeTime( $current, $time ) {
[222] Fix | Delete
return intval( strtotime( date('r', $current) . " +$time" ) );
[223] Fix | Delete
}
[224] Fix | Delete
/**
[225] Fix | Delete
* Automatice Maybe Later.
[226] Fix | Delete
* @param string $notice
[227] Fix | Delete
* @return void
[228] Fix | Delete
*/
[229] Fix | Delete
private function maybe_later( $notice ){
[230] Fix | Delete
if( empty( $notice ) ) {
[231] Fix | Delete
return;
[232] Fix | Delete
}
[233] Fix | Delete
$options_data = $this->get_options_data();
[234] Fix | Delete
$options_data[ $this->plugin_name ]['notice_will_show'][ $notice ] = $this->makeTime( $this->timestamp, $this->maybe_later_time );
[235] Fix | Delete
$this->update_options_data( $options_data[ $this->plugin_name ] );
[236] Fix | Delete
}
[237] Fix | Delete
/**
[238] Fix | Delete
* When links are clicked, this function will invoked.
[239] Fix | Delete
* @return void
[240] Fix | Delete
*/
[241] Fix | Delete
public function clicked(){
[242] Fix | Delete
if( isset( $_GET['plugin'] ) ) {
[243] Fix | Delete
$plugin = sanitize_text_field( $_GET['plugin'] );
[244] Fix | Delete
if( $plugin === $this->plugin_name ) {
[245] Fix | Delete
$options_data = $this->get_options_data();
[246] Fix | Delete
$clicked_from = current( $this->next_notice() );
[247] Fix | Delete
if( isset( $_GET['plugin_action'] ) ) {
[248] Fix | Delete
$plugin_action = sanitize_text_field( $_GET['plugin_action'] );
[249] Fix | Delete
}
[250] Fix | Delete
if( isset( $_GET['dismiss'] ) ) {
[251] Fix | Delete
$dismiss = sanitize_text_field( $_GET['dismiss'] );
[252] Fix | Delete
}
[253] Fix | Delete
if( isset( $_GET['later'] ) ) {
[254] Fix | Delete
$later = sanitize_text_field( $_GET['later'] );
[255] Fix | Delete
}
[256] Fix | Delete
[257] Fix | Delete
$later_time = '';
[258] Fix | Delete
[259] Fix | Delete
switch( $clicked_from ) {
[260] Fix | Delete
[261] Fix | Delete
case 'opt_in' :
[262] Fix | Delete
$dismiss = ( isset( $plugin_action ) ) ? $plugin_action : false ;
[263] Fix | Delete
$later_time = $this->makeTime( $this->timestamp, $this->maybe_later_time );
[264] Fix | Delete
break;
[265] Fix | Delete
[266] Fix | Delete
case 'first_install' :
[267] Fix | Delete
$later_time = $this->makeTime( $this->timestamp, $this->maybe_later_time );
[268] Fix | Delete
break;
[269] Fix | Delete
[270] Fix | Delete
case 'update' :
[271] Fix | Delete
$dismiss = ( isset( $plugin_action ) ) ? $plugin_action : false ;
[272] Fix | Delete
$later_time = $this->makeTime( $this->timestamp, $this->maybe_later_time );
[273] Fix | Delete
break;
[274] Fix | Delete
[275] Fix | Delete
case 'review' :
[276] Fix | Delete
$later_time = $this->makeTime( $this->timestamp, $this->maybe_later_time );
[277] Fix | Delete
break;
[278] Fix | Delete
[279] Fix | Delete
case 'upsale' :
[280] Fix | Delete
$later_time = $this->makeTime( $this->timestamp, $this->maybe_later_time );
[281] Fix | Delete
break;
[282] Fix | Delete
}
[283] Fix | Delete
[284] Fix | Delete
if( isset( $later ) && $later == true ) {
[285] Fix | Delete
$options_data[ $this->plugin_name ]['notice_will_show'][ $clicked_from ] = $later_time;
[286] Fix | Delete
}
[287] Fix | Delete
if( isset( $dismiss ) && $dismiss == true ) {
[288] Fix | Delete
update_user_meta( get_current_user_id(), $this->plugin_name . '_' . $clicked_from, true );
[289] Fix | Delete
$this->update( $clicked_from );
[290] Fix | Delete
}
[291] Fix | Delete
$this->update_options_data( $options_data[ $this->plugin_name ] );
[292] Fix | Delete
}
[293] Fix | Delete
}
[294] Fix | Delete
}
[295] Fix | Delete
/**
[296] Fix | Delete
* For Redirecting Current Page without Arguments!
[297] Fix | Delete
*
[298] Fix | Delete
* @return void
[299] Fix | Delete
*/
[300] Fix | Delete
private function redirect_to(){
[301] Fix | Delete
$request_uri = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
[302] Fix | Delete
$query_string = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_QUERY );
[303] Fix | Delete
parse_str( $query_string, $current_url );
[304] Fix | Delete
[305] Fix | Delete
$unset_array = array( 'dismiss', 'plugin', '_wpnonce', 'later', 'plugin_action', 'marketing_optin' );
[306] Fix | Delete
[307] Fix | Delete
foreach( $unset_array as $value ) {
[308] Fix | Delete
if( isset( $current_url[ $value ] ) ) {
[309] Fix | Delete
unset( $current_url[ $value ] );
[310] Fix | Delete
}
[311] Fix | Delete
}
[312] Fix | Delete
[313] Fix | Delete
$current_url = http_build_query($current_url);
[314] Fix | Delete
$redirect_url = $request_uri . '?' . $current_url;
[315] Fix | Delete
return $redirect_url;
[316] Fix | Delete
}
[317] Fix | Delete
/**
[318] Fix | Delete
* Before Notice
[319] Fix | Delete
* @return void
[320] Fix | Delete
*/
[321] Fix | Delete
public function before(){
[322] Fix | Delete
$current_notice = current( $this->next_notice() );
[323] Fix | Delete
$classes = 'notice notice-info put-dismiss-notice';
[324] Fix | Delete
if( isset( $this->data['classes'] ) ) {
[325] Fix | Delete
if( isset( $this->data['classes'][ $current_notice ] ) ) {
[326] Fix | Delete
$classes = $this->data['classes'][ $current_notice ];
[327] Fix | Delete
}
[328] Fix | Delete
}
[329] Fix | Delete
[330] Fix | Delete
if( $this->has_thumbnail( $current_notice ) ) {
[331] Fix | Delete
$classes .= 'notice-has-thumbnail';
[332] Fix | Delete
}
[333] Fix | Delete
[334] Fix | Delete
if( ! $this->has_notice( $current_notice ) ) {
[335] Fix | Delete
return;
[336] Fix | Delete
}
[337] Fix | Delete
[338] Fix | Delete
echo '<div data-notice="'. $current_notice .'" class="'. $classes .' wpdeveloper-'. $current_notice .'-notice">';
[339] Fix | Delete
}
[340] Fix | Delete
/**
[341] Fix | Delete
* After Notice
[342] Fix | Delete
* @return void
[343] Fix | Delete
*/
[344] Fix | Delete
public function after(){
[345] Fix | Delete
$current_notice = current( $this->next_notice() );
[346] Fix | Delete
if( ! $this->has_notice( $current_notice ) ) {
[347] Fix | Delete
return;
[348] Fix | Delete
}
[349] Fix | Delete
echo '</div>';
[350] Fix | Delete
}
[351] Fix | Delete
/**
[352] Fix | Delete
* Content generation & Hooks Funciton.
[353] Fix | Delete
* @return void
[354] Fix | Delete
*/
[355] Fix | Delete
public function content(){
[356] Fix | Delete
$options_data = $this->get_options_data();
[357] Fix | Delete
$notice = current( $this->next_notice() );
[358] Fix | Delete
[359] Fix | Delete
switch( $notice ) {
[360] Fix | Delete
case 'opt_in' :
[361] Fix | Delete
do_action('wpdeveloper_optin_notice_for_' . $this->plugin_name );
[362] Fix | Delete
break;
[363] Fix | Delete
case 'first_install' :
[364] Fix | Delete
if( $options_data[ $this->plugin_name ]['first_install'] !== 'deactivated' ) {
[365] Fix | Delete
do_action( 'wpdeveloper_first_install_notice_for_' . $this->plugin_name );
[366] Fix | Delete
$this->get_thumbnail( 'first_install' );
[367] Fix | Delete
$this->get_message( 'first_install' );
[368] Fix | Delete
}
[369] Fix | Delete
break;
[370] Fix | Delete
case 'update' :
[371] Fix | Delete
do_action( 'wpdeveloper_update_notice_for_' . $this->plugin_name );
[372] Fix | Delete
$this->get_thumbnail( 'update' );
[373] Fix | Delete
$this->get_message( 'update' );
[374] Fix | Delete
$this->dismiss_button_scripts();
[375] Fix | Delete
break;
[376] Fix | Delete
case 'review' :
[377] Fix | Delete
do_action( 'wpdeveloper_review_notice_for_' . $this->plugin_name );
[378] Fix | Delete
$this->get_thumbnail( 'review' );
[379] Fix | Delete
$this->get_message( 'review' );
[380] Fix | Delete
break;
[381] Fix | Delete
}
[382] Fix | Delete
}
[383] Fix | Delete
/**
[384] Fix | Delete
* Before Upsale Notice
[385] Fix | Delete
* @return void
[386] Fix | Delete
*/
[387] Fix | Delete
public function before_upsale(){
[388] Fix | Delete
$classes = '';
[389] Fix | Delete
if( $this->has_thumbnail('upsale') ) {
[390] Fix | Delete
$classes = 'notice-has-thumbnail';
[391] Fix | Delete
}
[392] Fix | Delete
echo '<div class="error notice is-dismissible wpdeveloper-upsale-notice '. $classes .'">';
[393] Fix | Delete
}
[394] Fix | Delete
/**
[395] Fix | Delete
* Upsale Notice
[396] Fix | Delete
*/
[397] Fix | Delete
public function upsale_notice(){
[398] Fix | Delete
do_action( 'wpdeveloper_before_upsale_notice_for_' . $this->plugin_name );
[399] Fix | Delete
do_action('wpdeveloper_upsale_notice_for_' . $this->plugin_name);
[400] Fix | Delete
$this->get_thumbnail( 'upsale' );
[401] Fix | Delete
$this->get_message( 'upsale' );
[402] Fix | Delete
do_action( 'wpdeveloper_after_upsale_notice_for_' . $this->plugin_name );
[403] Fix | Delete
$this->upsale_button_script();
[404] Fix | Delete
}
[405] Fix | Delete
/**
[406] Fix | Delete
* Get upsale arguments.
[407] Fix | Delete
* @return array
[408] Fix | Delete
*/
[409] Fix | Delete
private function get_upsale_args(){
[410] Fix | Delete
return ( empty( $this->upsale_args ) ) ? array() : $this->upsale_args;
[411] Fix | Delete
}
[412] Fix | Delete
/**
[413] Fix | Delete
* This function is responsible for making the button visible to the upsale notice.
[414] Fix | Delete
*/
[415] Fix | Delete
private function upsale_button(){
[416] Fix | Delete
$upsale_args = $this->get_upsale_args();
[417] Fix | Delete
if( isset( $upsale_args['href'] ) ) {
[418] Fix | Delete
echo '<a href="'. $upsale_args['href'] .'" target="_blank" class="button button-primary">'. $upsale_args['btn_text'] .'</a>';
[419] Fix | Delete
return;
[420] Fix | Delete
}
[421] Fix | Delete
$plugin_slug = ( isset( $upsale_args['slug'] )) ? $upsale_args['slug'] : '' ;
[422] Fix | Delete
if( empty( $plugin_slug ) ) {
[423] Fix | Delete
return;
[424] Fix | Delete
}
[425] Fix | Delete
echo '<button data-slug="'. $plugin_slug .'" id="plugin-install-core-'. $this->plugin_name .'" class="button button-primary">'. __( 'Install Now!', 'embedpress' ) .'</button>';
[426] Fix | Delete
}
[427] Fix | Delete
/**
[428] Fix | Delete
* This methods is responsible for get notice image.
[429] Fix | Delete
*
[430] Fix | Delete
* @param string $msg_for
[431] Fix | Delete
* @return void
[432] Fix | Delete
*/
[433] Fix | Delete
protected function get_thumbnail( $msg_for ){
[434] Fix | Delete
$output = '';
[435] Fix | Delete
if( isset( $this->data['thumbnail'] ) && isset( $this->data['thumbnail'][ $msg_for ] ) ) {
[436] Fix | Delete
$output = '<div class="wpdeveloper-notice-thumbnail">';
[437] Fix | Delete
$output .= '<img src="'. esc_url($this->data['thumbnail'][ $msg_for ]) .'" alt="NotificationX">';
[438] Fix | Delete
$output .= '</div>';
[439] Fix | Delete
}
[440] Fix | Delete
echo $output;
[441] Fix | Delete
}
[442] Fix | Delete
/**
[443] Fix | Delete
* Has Thumbnail Check
[444] Fix | Delete
*
[445] Fix | Delete
* @param string $msg_for
[446] Fix | Delete
* @return boolean
[447] Fix | Delete
*/
[448] Fix | Delete
protected function has_thumbnail( $msg_for = '' ){
[449] Fix | Delete
if( empty( $msg_for ) ) {
[450] Fix | Delete
return false;
[451] Fix | Delete
}
[452] Fix | Delete
if( isset( $this->data['thumbnail'] ) && isset( $this->data['thumbnail'][ $msg_for ] ) ) {
[453] Fix | Delete
return true;
[454] Fix | Delete
}
[455] Fix | Delete
return false;
[456] Fix | Delete
}
[457] Fix | Delete
private function has_notice( $notice ){
[458] Fix | Delete
return isset( $this->data['message'], $this->data['message'][ $notice ] );
[459] Fix | Delete
}
[460] Fix | Delete
/**
[461] Fix | Delete
* This method is responsible for get messages.
[462] Fix | Delete
*
[463] Fix | Delete
* @param string $msg_for
[464] Fix | Delete
* @return void
[465] Fix | Delete
*/
[466] Fix | Delete
protected function get_message( $msg_for ){
[467] Fix | Delete
if( isset( $this->data['message'] ) && isset( $this->data['message'][ $msg_for ] ) ) {
[468] Fix | Delete
echo '<div class="wpdeveloper-notice-message">';
[469] Fix | Delete
echo $this->data['message'][ $msg_for ];
[470] Fix | Delete
if( $msg_for === 'upsale' ) {
[471] Fix | Delete
$this->upsale_button();
[472] Fix | Delete
}
[473] Fix | Delete
$this->dismissible_notice( $msg_for );
[474] Fix | Delete
echo '</div>';
[475] Fix | Delete
}
[476] Fix | Delete
}
[477] Fix | Delete
/**
[478] Fix | Delete
* Detect which notice will show @ next.
[479] Fix | Delete
* @return void
[480] Fix | Delete
*/
[481] Fix | Delete
protected function next_notice(){
[482] Fix | Delete
$options_data = $this->get_options_data();
[483] Fix | Delete
if( ! $options_data ) {
[484] Fix | Delete
$args = $this->get_args();
[485] Fix | Delete
$return_notice = $args['notice_will_show'];
[486] Fix | Delete
} else {
[487] Fix | Delete
$return_notice = $options_data[ $this->plugin_name ]['notice_will_show'];
[488] Fix | Delete
}
[489] Fix | Delete
[490] Fix | Delete
if( is_array( $return_notice ) ) {
[491] Fix | Delete
$return_notice = array_flip( $return_notice );
[492] Fix | Delete
ksort( $return_notice );
[493] Fix | Delete
}
[494] Fix | Delete
[495] Fix | Delete
return $return_notice;
[496] Fix | Delete
}
[497] Fix | Delete
/**
[498] Fix | Delete
* Which notice is deserve to show in next slot.
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function