wp/wp-content/plugins/portfolio/bws_menu/bws_functions.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
     1 <?php
     1 <?php
     2 /**
     2 /**
     3  * @package BWS Menu
     3  * @package BWS Menu
     4  * @version 2.4.2
     4  * @version 2.4.3
     5  * Main functions
     5  * Main functions
     6  */
     6  */
       
     7 
       
     8 if ( ! defined( 'ABSPATH' ) ) {
       
     9 	exit;
       
    10 }
     7 
    11 
     8 /**
    12 /**
     9  * General functions for BestWebSoft plugins
    13  * General functions for BestWebSoft plugins
    10  */
    14  */
    11 require dirname( __FILE__ ) . '/deprecated.php';
    15 require dirname( __FILE__ ) . '/deprecated.php';
    15 if ( ! function_exists( 'bws_get_mofile' ) ) {
    19 if ( ! function_exists( 'bws_get_mofile' ) ) {
    16 	/**
    20 	/**
    17 	 * Function to add 'bestwebsoft' slug for BWS_Menu MO file if BWS_Menu loaded from theme.
    21 	 * Function to add 'bestwebsoft' slug for BWS_Menu MO file if BWS_Menu loaded from theme.
    18 	 *
    22 	 *
    19 	 * @since 1.9.7
    23 	 * @since 1.9.7
       
    24 	 * @param string $mofile Mo file name.
       
    25 	 * @param string $domain Domain name.
    20 	 */
    26 	 */
    21 	function bws_get_mofile( $mofile, $domain ) {
    27 	function bws_get_mofile( $mofile, $domain ) {
    22 		if ( 'bestwebsoft' === $domain ) {
    28 		if ( 'bestwebsoft' === $domain ) {
    23 			$locale = get_locale();
    29 			$locale = get_locale();
    24 			return str_replace( $locale, "bestwebsoft-{$locale}", $mofile );
    30 			return str_replace( $locale, "bestwebsoft-{$locale}", $mofile );
    39 	remove_filter( 'load_textdomain_mofile', 'bws_get_mofile' );
    45 	remove_filter( 'load_textdomain_mofile', 'bws_get_mofile' );
    40 } else {
    46 } else {
    41 	load_plugin_textdomain( 'bestwebsoft', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
    47 	load_plugin_textdomain( 'bestwebsoft', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
    42 }
    48 }
    43 
    49 
    44 /**
       
    45  * Function to getting url to current BWS_Menu.
       
    46  *
       
    47  * @since 1.9.7
       
    48  */
       
    49 if ( ! function_exists( 'bws_menu_url' ) ) {
    50 if ( ! function_exists( 'bws_menu_url' ) ) {
       
    51 	/**
       
    52 	 * Function to getting url to current BWS_Menu.
       
    53 	 *
       
    54 	 * @since 1.9.7
       
    55 	 * @param string $path Plugin path.
       
    56 	 */
    50 	if ( ! isset( $bws_menu_source ) || 'plugins' === $bws_menu_source ) {
    57 	if ( ! isset( $bws_menu_source ) || 'plugins' === $bws_menu_source ) {
    51 		function bws_menu_url( $path = '' ) {
    58 		function bws_menu_url( $path = '' ) {
    52 			return plugins_url( $path, __FILE__ );
    59 			return plugins_url( $path, __FILE__ );
    53 		}
    60 		}
    54 	} else {
    61 	} else {
    60 			return sprintf( '%s/%s', $bws_menu_current_url, $path );
    67 			return sprintf( '%s/%s', $bws_menu_current_url, $path );
    61 		}
    68 		}
    62 	}
    69 	}
    63 }
    70 }
    64 
    71 
    65 /**
       
    66  * Function check if plugin is compatible with current WP version
       
    67  *
       
    68  * @return void
       
    69  */
       
    70 if ( ! function_exists( 'bws_wp_min_version_check' ) ) {
    72 if ( ! function_exists( 'bws_wp_min_version_check' ) ) {
       
    73 	/**
       
    74 	 * Function check if plugin is compatible with current WP version
       
    75 	 *
       
    76 	 * @param string $plugin_basename Plugin basename.
       
    77 	 * @param array  $plugin_info Plugin info.
       
    78 	 * @param string $require_wp Wp version.
       
    79 	 * @param string $min_wp (Optional) Flag for min WP version.
       
    80 	 */
    71 	function bws_wp_min_version_check( $plugin_basename, $plugin_info, $require_wp, $min_wp = false ) {
    81 	function bws_wp_min_version_check( $plugin_basename, $plugin_info, $require_wp, $min_wp = false ) {
    72 		global $wp_version, $bws_versions_notice_array;
    82 		global $wp_version, $bws_versions_notice_array;
    73 		if ( false === $min_wp ) {
    83 		if ( false === $min_wp ) {
    74 			$min_wp = $require_wp;
    84 			$min_wp = $require_wp;
    75 		}
    85 		}
    98 			);
   108 			);
    99 		}
   109 		}
   100 	}
   110 	}
   101 }
   111 }
   102 
   112 
   103 /**
       
   104  * Function display review block
       
   105  *
       
   106  * @echo string
       
   107  */
       
   108 if ( ! function_exists( 'bws_plugin_reviews_block' ) ) {
   113 if ( ! function_exists( 'bws_plugin_reviews_block' ) ) {
       
   114 	/**
       
   115 	 * Function display review block
       
   116 	 *
       
   117 	 * @param string $plugin_name Plugin name.
       
   118 	 * @param string $plugin_slug Plugin slug.
       
   119 	 * @echo string
       
   120 	 */
   109 	function bws_plugin_reviews_block( $plugin_name, $plugin_slug ) { ?>
   121 	function bws_plugin_reviews_block( $plugin_name, $plugin_slug ) { ?>
   110 		<div class="bws-plugin-reviews">
   122 		<div class="bws-plugin-reviews">
   111 			<div class="bws-plugin-reviews-rate">
   123 			<div class="bws-plugin-reviews-rate">
   112 				<?php esc_html_e( 'Like the plugin?', 'bestwebsoft' ); ?>
   124 				<?php esc_html_e( 'Like the plugin?', 'bestwebsoft' ); ?>
   113 				<a href="https://wordpress.org/support/view/plugin-reviews/<?php echo esc_attr( $plugin_slug ); ?>?filter=5" target="_blank" title="<?php printf( esc_html__( '%s reviews', 'bestwebsoft' ), esc_html( sanitize_text_field( $plugin_name ) ) ); ?>">
   125 				<a href="https://wordpress.org/support/view/plugin-reviews/<?php echo esc_attr( $plugin_slug ); ?>?filter=5" target="_blank" title="<?php printf( esc_html__( '%s reviews', 'bestwebsoft' ), esc_html( sanitize_text_field( $plugin_name ) ) ); ?>">
   130 		</div>
   142 		</div>
   131 		<?php
   143 		<?php
   132 	}
   144 	}
   133 }
   145 }
   134 
   146 
   135 /**
       
   136  * Function display license notification
       
   137  *
       
   138  * @echo string
       
   139  */
       
   140 if ( ! function_exists( 'bws_plugin_update_row' ) ) {
   147 if ( ! function_exists( 'bws_plugin_update_row' ) ) {
       
   148 	/**
       
   149 	 * Function display license notification
       
   150 	 *
       
   151 	 * @param string $plugin_key       Plugin key.
       
   152 	 * @param string $link_slug        (Optional) Link slug.
       
   153 	 * @param string $free_plugin_name (Optional) Free version plugin name.
       
   154 	 * @echo string
       
   155 	 */
   141 	function bws_plugin_update_row( $plugin_key, $link_slug = false, $free_plugin_name = false ) {
   156 	function bws_plugin_update_row( $plugin_key, $link_slug = false, $free_plugin_name = false ) {
   142 		global $bstwbsftwppdtplgns_options, $wp_version;
   157 		global $bstwbsftwppdtplgns_options, $wp_version;
   143 		$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
   158 		$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
   144 		if ( isset( $bstwbsftwppdtplgns_options['wrong_license_key'][ $plugin_key ] ) ) {
   159 		if ( isset( $bstwbsftwppdtplgns_options['wrong_license_key'][ $plugin_key ] ) ) {
   145 			$explode_plugin_key = explode( '/', $plugin_key );
   160 			$explode_plugin_key = explode( '/', $plugin_key );
   208 				</tr>';
   223 				</tr>';
   209 		}
   224 		}
   210 	}
   225 	}
   211 }
   226 }
   212 
   227 
   213 /**
       
   214  * Function display admin notices
       
   215  *
       
   216  * @echo string
       
   217  */
       
   218 if ( ! function_exists( 'bws_admin_notices' ) ) {
   228 if ( ! function_exists( 'bws_admin_notices' ) ) {
       
   229 	/**
       
   230 	 * Function display admin notices
       
   231 	 *
       
   232 	 * @echo string
       
   233 	 */
   219 	function bws_admin_notices() {
   234 	function bws_admin_notices() {
   220 		global $bws_versions_notice_array, $bws_plugin_banner_to_settings, $bstwbsftwppdtplgns_options, $bws_plugin_banner_go_pro, $bstwbsftwppdtplgns_banner_array, $bws_plugin_banner_timeout;
   235 		global $bws_versions_notice_array, $bws_plugin_banner_to_settings, $bstwbsftwppdtplgns_options, $bws_plugin_banner_go_pro, $bstwbsftwppdtplgns_banner_array, $bws_plugin_banner_timeout;
   221 
   236 
   222 		/* bws_plugin_banner_go_pro */
   237 		/* bws_plugin_banner_go_pro */
   223 		if ( ! empty( $bws_plugin_banner_go_pro ) ) {
   238 		if ( ! empty( $bws_plugin_banner_go_pro ) ) {
   262 					<div class="<?php echo esc_attr( $banner_value['prefix'] ); ?>_message_timeout bws_banner_on_plugin_page bws_banner_timeout" style="display:none;">
   277 					<div class="<?php echo esc_attr( $banner_value['prefix'] ); ?>_message_timeout bws_banner_on_plugin_page bws_banner_timeout" style="display:none;">
   263 						<button class="<?php echo esc_attr( $banner_value['prefix'] ); ?>_close_icon close_icon notice-dismiss bws_hide_settings_notice" title="<?php esc_html_e( 'Close notice', 'bestwebsoft' ); ?>"></button>
   278 						<button class="<?php echo esc_attr( $banner_value['prefix'] ); ?>_close_icon close_icon notice-dismiss bws_hide_settings_notice" title="<?php esc_html_e( 'Close notice', 'bestwebsoft' ); ?>"></button>
   264 						<div class="icon">
   279 						<div class="icon">
   265 							<img title="" src="<?php echo esc_url( $banner_value['banner_url'] ); ?>" alt="" />
   280 							<img title="" src="<?php echo esc_url( $banner_value['banner_url'] ); ?>" alt="" />
   266 						</div>
   281 						</div>
   267 						<div class="text"><?php printf( esc_html__( "Your license key for %1\$s expires on %2\$s and you won't be granted TOP-PRIORITY SUPPORT or UPDATES.", 'bestwebsoft' ), '<strong>' . esc_html__( $banner_value['plugin_name'] ) . '</strong>', esc_html__( $bstwbsftwppdtplgns_options['time_out'][ $banner_value['plugin_key'] ] ) ); ?> <a target="_new" href="https://support.bestwebsoft.com/entries/53487136"><?php esc_html_e( 'Learn more', 'bestwebsoft' ); ?></a></div>
   282 						<div class="text"><?php printf( esc_html__( "Your license key for %1\$s expires on %2\$s and you won't be granted TOP-PRIORITY SUPPORT or UPDATES.", 'bestwebsoft' ), '<strong>' . esc_html( $banner_value['plugin_name'] ) . '</strong>', esc_html( $bstwbsftwppdtplgns_options['time_out'][ $banner_value['plugin_key'] ] ) ); ?> <a target="_new" href="https://support.bestwebsoft.com/entries/53487136"><?php esc_html_e( 'Learn more', 'bestwebsoft' ); ?></a></div>
   268 					</div>
   283 					</div>
   269 				</div>
   284 				</div>
   270 				<?php
   285 				<?php
   271 			}
   286 			}
   272 		}
   287 		}
   277 				?>
   292 				?>
   278 				<div class="update-nag">
   293 				<div class="update-nag">
   279 					<?php
   294 					<?php
   280 					printf(
   295 					printf(
   281 						'<strong>%s</strong> %s <strong>WordPress %s</strong> %s',
   296 						'<strong>%s</strong> %s <strong>WordPress %s</strong> %s',
   282 						esc_html__( $value['name'] ),
   297 						esc_html( $value['name'] ),
   283 						esc_html__( 'requires', 'bestwebsoft' ),
   298 						esc_html__( 'requires', 'bestwebsoft' ),
   284 						esc_html__( $value['version'] ),
   299 						esc_html( $value['version'] ),
   285 						esc_html__( 'or higher! We do not guarantee that our plugin will work correctly. Please upgrade to WordPress latest version.', 'bestwebsoft' )
   300 						esc_html__( 'or higher! We do not guarantee that our plugin will work correctly. Please upgrade to WordPress latest version.', 'bestwebsoft' )
   286 					);
   301 					);
   287 					?>
   302 					?>
   288 				</div>
   303 				</div>
   289 				<?php
   304 				<?php
   387 			}
   402 			}
   388 		}
   403 		}
   389 	}
   404 	}
   390 }
   405 }
   391 
   406 
   392 /**
       
   393  * Function display banner
       
   394  *
       
   395  * @return array
       
   396  */
       
   397 if ( ! function_exists( 'bws_plugin_banner_go_pro' ) ) {
   407 if ( ! function_exists( 'bws_plugin_banner_go_pro' ) ) {
       
   408 	/**
       
   409 	 * Function display banner
       
   410 	 *
       
   411 	 * @param array  $plugin_options     Plugin options array.
       
   412 	 * @param array  $plugin_info        Plugin info array.
       
   413 	 * @param string $this_banner_prefix Banner prefix.
       
   414 	 * @param string $bws_link_slug      Slug for link.
       
   415 	 * @param string $link_key           Key for plugin.
       
   416 	 * @param string $link_pn            PN for plugin.
       
   417 	 * @param string $banner_url_or_slug Url or slug for icon.
       
   418 	 * @return array
       
   419 	 */
   398 	function bws_plugin_banner_go_pro( $plugin_options, $plugin_info, $this_banner_prefix, $bws_link_slug, $link_key, $link_pn, $banner_url_or_slug ) {
   420 	function bws_plugin_banner_go_pro( $plugin_options, $plugin_info, $this_banner_prefix, $bws_link_slug, $link_key, $link_pn, $banner_url_or_slug ) {
   399 		global $bws_plugin_banner_go_pro, $wp_version, $bstwbsftwppdtplgns_banner_array;
   421 		global $bws_plugin_banner_go_pro, $wp_version, $bstwbsftwppdtplgns_banner_array;
   400 
   422 
   401 		if ( ! isset( $plugin_options['first_install'] ) || strtotime( '-1 week' ) < $plugin_options['first_install'] ) {
   423 		if ( ! isset( $plugin_options['first_install'] ) || strtotime( '-1 week' ) < $plugin_options['first_install'] ) {
   402 			return;
   424 			return;
   422 			bws_get_banner_array();
   444 			bws_get_banner_array();
   423 		}
   445 		}
   424 	}
   446 	}
   425 }
   447 }
   426 
   448 
   427 /**
       
   428  * Function update banner params
       
   429  *
       
   430  * @return global array
       
   431  */
       
   432 if ( ! function_exists( 'bws_add_plugin_banner_timeout' ) ) {
   449 if ( ! function_exists( 'bws_add_plugin_banner_timeout' ) ) {
       
   450 	/**
       
   451 	 * Function update banner params
       
   452 	 *
       
   453 	 * @param string $plugin_key         Plugin key.
       
   454 	 * @param string $plugin_prefix      Plugin prefix.
       
   455 	 * @param string $plugin_name        Plugin name.
       
   456 	 * @param string $banner_url_or_slug Url or slug for icon.
       
   457 	 */
   433 	function bws_add_plugin_banner_timeout( $plugin_key, $plugin_prefix, $plugin_name, $banner_url_or_slug ) {
   458 	function bws_add_plugin_banner_timeout( $plugin_key, $plugin_prefix, $plugin_name, $banner_url_or_slug ) {
   434 		global $bws_plugin_banner_timeout;
   459 		global $bws_plugin_banner_timeout;
   435 
   460 
   436 		if ( isset( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) && ( strtotime( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) < strtotime( gmdate( 'm/d/Y' ) . '+1 month' ) ) && ( strtotime( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) > strtotime( gmdate( 'm/d/Y' ) ) ) ) {
   461 		if ( isset( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) && ( strtotime( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) < strtotime( gmdate( 'm/d/Y' ) . '+1 month' ) ) && ( strtotime( $bstwbsftwppdtplgns_options['time_out'][ $plugin_key ] ) > strtotime( gmdate( 'm/d/Y' ) ) ) ) {
   437 
   462 
   447 			);
   472 			);
   448 		}
   473 		}
   449 	}
   474 	}
   450 }
   475 }
   451 
   476 
   452 /**
       
   453  * Function settings for banner
       
   454  *
       
   455  * @return global array
       
   456  */
       
   457 if ( ! function_exists( 'bws_plugin_banner_to_settings' ) ) {
   477 if ( ! function_exists( 'bws_plugin_banner_to_settings' ) ) {
       
   478 	/**
       
   479 	 * Function settings for banner
       
   480 	 *
       
   481 	 * @param array $plugin_info              Plugin info.
       
   482 	 * @param array $plugin_options_name      Plugin option name.
       
   483 	 * @param array $banner_url_or_slug       Url or slug for icon.
       
   484 	 * @param array $settings_url             Url for settings.
       
   485 	 * @param array $post_type_url (Optional) Url for banner.
       
   486 	 * @return global array
       
   487 	 */
   458 	function bws_plugin_banner_to_settings( $plugin_info, $plugin_options_name, $banner_url_or_slug, $settings_url, $post_type_url = false ) {
   488 	function bws_plugin_banner_to_settings( $plugin_info, $plugin_options_name, $banner_url_or_slug, $settings_url, $post_type_url = false ) {
   459 		global $bws_plugin_banner_to_settings;
   489 		global $bws_plugin_banner_to_settings;
   460 
   490 
   461 		$is_network_admin = is_network_admin();
   491 		$is_network_admin = is_network_admin();
   462 
   492 
   488 			'post_type_url'       => $post_type_url,
   518 			'post_type_url'       => $post_type_url,
   489 		);
   519 		);
   490 	}
   520 	}
   491 }
   521 }
   492 
   522 
   493 /**
       
   494  * Function display for feature banner
       
   495  *
       
   496  * @echo string
       
   497  */
       
   498 if ( ! function_exists( 'bws_plugin_suggest_feature_banner' ) ) {
   523 if ( ! function_exists( 'bws_plugin_suggest_feature_banner' ) ) {
       
   524 	/**
       
   525 	 * Function display for feature banner
       
   526 	 *
       
   527 	 * @param array $plugin_info              Plugin info.
       
   528 	 * @param array $plugin_options_name      Plugin option name.
       
   529 	 * @param array $banner_url_or_slug       Url or slug for icon.
       
   530 	 * @echo string
       
   531 	 */
   499 	function bws_plugin_suggest_feature_banner( $plugin_info, $plugin_options_name, $banner_url_or_slug ) {
   532 	function bws_plugin_suggest_feature_banner( $plugin_info, $plugin_options_name, $banner_url_or_slug ) {
   500 		$is_network_admin = is_network_admin();
   533 		$is_network_admin = is_network_admin();
   501 
   534 
   502 		$plugin_options = $is_network_admin ? get_site_option( $plugin_options_name ) : get_option( $plugin_options_name );
   535 		$plugin_options = $is_network_admin ? get_site_option( $plugin_options_name ) : get_option( $plugin_options_name );
   503 
   536 
   505 			return;
   538 			return;
   506 		}
   539 		}
   507 
   540 
   508 		if ( ! isset( $plugin_options['first_install'] ) ) {
   541 		if ( ! isset( $plugin_options['first_install'] ) ) {
   509 			$plugin_options['first_install'] = strtotime( 'now' );
   542 			$plugin_options['first_install'] = strtotime( 'now' );
   510 			$update_option                   = $return = true;
   543 			$update_option                   = true;
       
   544 			$return                          = true;
   511 		} elseif ( strtotime( '-2 week' ) < $plugin_options['first_install'] ) {
   545 		} elseif ( strtotime( '-2 week' ) < $plugin_options['first_install'] ) {
   512 			$return = true;
   546 			$return = true;
   513 		}
   547 		}
   514 
   548 
   515 		if ( ! isset( $plugin_options['go_settings_counter'] ) ) {
   549 		if ( ! isset( $plugin_options['go_settings_counter'] ) ) {
   516 			$plugin_options['go_settings_counter'] = 1;
   550 			$plugin_options['go_settings_counter'] = 1;
   517 			$update_option                         = $return = true;
   551 			$update_option                         = true;
       
   552 			$return                                = true;
   518 		} elseif ( 20 > $plugin_options['go_settings_counter'] ) {
   553 		} elseif ( 20 > $plugin_options['go_settings_counter'] ) {
   519 			$plugin_options['go_settings_counter'] = $plugin_options['go_settings_counter'] + 1;
   554 			$plugin_options['go_settings_counter'] = $plugin_options['go_settings_counter'] + 1;
   520 			$update_option                         = $return = true;
   555 			$update_option                         = true;
       
   556 			$return                                = true;
   521 		}
   557 		}
   522 
   558 
   523 		if ( isset( $update_option ) ) {
   559 		if ( isset( $update_option ) ) {
   524 			if ( $is_network_admin ) {
   560 			if ( $is_network_admin ) {
   525 				update_site_option( $plugin_options_name, $plugin_options );
   561 				update_site_option( $plugin_options_name, $plugin_options );
   565 		</div>
   601 		</div>
   566 		<?php
   602 		<?php
   567 	}
   603 	}
   568 }
   604 }
   569 
   605 
   570 /**
       
   571  * Function display affiliate postbox
       
   572  *
       
   573  * @echo string
       
   574  */
       
   575 if ( ! function_exists( 'bws_affiliate_postbox' ) ) {
   606 if ( ! function_exists( 'bws_affiliate_postbox' ) ) {
       
   607 	/**
       
   608 	 * Function display affiliate postbox
       
   609 	 *
       
   610 	 * @echo string
       
   611 	 */
   576 	function bws_affiliate_postbox() {
   612 	function bws_affiliate_postbox() {
   577 
   613 
   578 		$dismissed = get_user_meta( get_current_user_id(), '_bws_affiliate_postbox_dismissed', true );
   614 		$dismissed = get_user_meta( get_current_user_id(), '_bws_affiliate_postbox_dismissed', true );
   579 
   615 
   580 		if ( ! empty( $dismissed ) && strtotime( '-3 month' ) < $dismissed ) {
   616 		if ( ! empty( $dismissed ) && strtotime( '-3 month' ) < $dismissed ) {
   619 		</div>
   655 		</div>
   620 		<?php
   656 		<?php
   621 	}
   657 	}
   622 }
   658 }
   623 
   659 
   624 /**
       
   625  * Function display settings notice
       
   626  *
       
   627  * @echo string
       
   628  */
       
   629 if ( ! function_exists( 'bws_show_settings_notice' ) ) {
   660 if ( ! function_exists( 'bws_show_settings_notice' ) ) {
       
   661 	/**
       
   662 	 * Function display settings notice
       
   663 	 *
       
   664 	 * @echo string
       
   665 	 */
   630 	function bws_show_settings_notice() {
   666 	function bws_show_settings_notice() {
   631 		?>
   667 		?>
   632 		<div id="bws_save_settings_notice" class="updated fade below-h2" style="display:none;">
   668 		<div id="bws_save_settings_notice" class="updated fade below-h2" style="display:none;">
   633 			<p>
   669 			<p>
   634 				<strong><?php esc_html_e( 'Notice', 'bestwebsoft' ); ?></strong>: <?php esc_html_e( "The plugin's settings have been changed.", 'bestwebsoft' ); ?>
   670 				<strong><?php esc_html_e( 'Notice', 'bestwebsoft' ); ?></strong>: <?php esc_html_e( "The plugin's settings have been changed.", 'bestwebsoft' ); ?>
   637 		</div>
   673 		</div>
   638 		<?php
   674 		<?php
   639 	}
   675 	}
   640 }
   676 }
   641 
   677 
   642 /**
       
   643  * Function for hide premium options
       
   644  *
       
   645  * @echo string
       
   646  */
       
   647 if ( ! function_exists( 'bws_hide_premium_options' ) ) {
   678 if ( ! function_exists( 'bws_hide_premium_options' ) ) {
       
   679 	/**
       
   680 	 * Function for hide premium options
       
   681 	 *
       
   682 	 * @param array $options Plugin options.
       
   683 	 * @echo string
       
   684 	 */
   648 	function bws_hide_premium_options( $options ) {
   685 	function bws_hide_premium_options( $options ) {
   649 		if ( ! isset( $options['hide_premium_options'] ) || ! is_array( $options['hide_premium_options'] ) ) {
   686 		if ( ! isset( $options['hide_premium_options'] ) || ! is_array( $options['hide_premium_options'] ) ) {
   650 			$options['hide_premium_options'] = array();
   687 			$options['hide_premium_options'] = array();
   651 		}
   688 		}
   652 
   689 
   657 			'options' => $options,
   694 			'options' => $options,
   658 		);
   695 		);
   659 	}
   696 	}
   660 }
   697 }
   661 
   698 
   662 /**
       
   663  * Function for check checkbox for hide premium options
       
   664  *
       
   665  * @return bool
       
   666  */
       
   667 if ( ! function_exists( 'bws_hide_premium_options_check' ) ) {
   699 if ( ! function_exists( 'bws_hide_premium_options_check' ) ) {
       
   700 	/**
       
   701 	 * Function for check checkbox for hide premium options
       
   702 	 *
       
   703 	 * @param array $options Plugin options.
       
   704 	 * @return bool
       
   705 	 */
   668 	function bws_hide_premium_options_check( $options ) {
   706 	function bws_hide_premium_options_check( $options ) {
   669 		if ( ! empty( $options['hide_premium_options'] ) && in_array( get_current_user_id(), $options['hide_premium_options'] ) ) {
   707 		if ( ! empty( $options['hide_premium_options'] ) && in_array( get_current_user_id(), $options['hide_premium_options'] ) ) {
   670 			return true;
   708 			return true;
   671 		} else {
   709 		} else {
   672 			return false;
   710 			return false;
   673 		}
   711 		}
   674 	}
   712 	}
   675 }
   713 }
   676 
   714 
   677 /**
       
   678  * Function init fir dashboard
       
   679  */
       
   680 if ( ! function_exists( 'bws_plugins_admin_init' ) ) {
   715 if ( ! function_exists( 'bws_plugins_admin_init' ) ) {
       
   716 	/**
       
   717 	 * Function init fir dashboard
       
   718 	 */
   681 	function bws_plugins_admin_init() {
   719 	function bws_plugins_admin_init() {
   682 		$page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
   720 		$page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
   683 		if ( isset( $_GET['bws_activate_plugin'] ) && check_admin_referer( 'bws_activate_plugin' . sanitize_text_field( wp_unslash( $_GET['bws_activate_plugin'] ) ) ) ) {
   721 		if ( isset( $_GET['bws_activate_plugin'] ) && check_admin_referer( 'bws_activate_plugin' . sanitize_text_field( wp_unslash( $_GET['bws_activate_plugin'] ) ) ) ) {
   684 
   722 
   685 			$plugin = isset( $_GET['bws_activate_plugin'] ) ? sanitize_text_field( wp_unslash( $_GET['bws_activate_plugin'] ) ) : '';
   723 			$plugin = isset( $_GET['bws_activate_plugin'] ) ? sanitize_text_field( wp_unslash( $_GET['bws_activate_plugin'] ) ) : '';
   728 
   766 
   729 		bws_add_editor_buttons();
   767 		bws_add_editor_buttons();
   730 	}
   768 	}
   731 }
   769 }
   732 
   770 
   733 /**
       
   734  * Function add scripts ans syles for dashboard
       
   735  */
       
   736 if ( ! function_exists( 'bws_admin_enqueue_scripts' ) ) {
   771 if ( ! function_exists( 'bws_admin_enqueue_scripts' ) ) {
       
   772 	/**
       
   773 	 * Function add scripts ans syles for dashboard
       
   774 	 */
   737 	function bws_admin_enqueue_scripts() {
   775 	function bws_admin_enqueue_scripts() {
   738 		global $wp_scripts, $hook_suffix,
   776 		global $wp_scripts,
       
   777 			$hook_suffix,
   739 			$post_type,
   778 			$post_type,
   740 			$bws_plugin_banner_go_pro, $bws_plugin_banner_timeout, $bstwbsftwppdtplgns_banner_array,
   779 			$bws_plugin_banner_go_pro, $bws_plugin_banner_timeout, $bstwbsftwppdtplgns_banner_array,
   741 			$bws_shortcode_list,
   780 			$bws_shortcode_list,
   742 			$wp_filesystem;
   781 			$wp_filesystem,
       
   782 			$bws_plugins,
       
   783 			$pagenow;
   743 
   784 
   744 		$page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
   785 		$page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
   745 
   786 
   746 		$jquery_ui_version = isset( $wp_scripts->registered['jquery-ui-core']->ver ) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.12.1';
       
   747 		WP_Filesystem();
       
   748 		if ( ! $wp_filesystem->exists( dirname( __FILE__ ) . '/css/jquery-ui-styles/' . $jquery_ui_version . '/' ) ) {
       
   749 			$jquery_ui_version = '1.12.1';
       
   750 		}
       
   751 		if ( 'et_divi_options' !== $page ) {
       
   752 			wp_enqueue_style( 'jquery-ui-style', bws_menu_url( 'css/jquery-ui-styles/' . $jquery_ui_version . '/jquery-ui.css', array(), $jquery_ui_version ) );
       
   753 		}
       
   754 		wp_enqueue_style( 'bws-admin-css', bws_menu_url( 'css/general_style.css' ), array(), '2.4.2' );
   787 		wp_enqueue_style( 'bws-admin-css', bws_menu_url( 'css/general_style.css' ), array(), '2.4.2' );
   755 		wp_enqueue_script( 'bws-admin-scripts', bws_menu_url( 'js/general_script.js' ), array( 'jquery', 'jquery-ui-tooltip' ) );
   788 		wp_enqueue_script( 'bws-admin-scripts', bws_menu_url( 'js/general_script.js' ), array( 'jquery', 'jquery-ui-tooltip' ) );
   756 
   789 
   757 		if ( in_array( $page, array( 'bws_panel', 'bws_themes', 'bws_system_status' ) ) || strpos( $page, '-bws-panel' ) ) {
   790 		$plugin_dir  = explode( '/', plugin_basename( __FILE__ ) )[0];
       
   791 		$plugin_file = array_keys( get_plugins( "/$plugin_dir" ) )[0];
       
   792 
       
   793 		$include_jquery_ui = false;
       
   794 		if ( ! empty( $bws_plugins ) ) {
       
   795 			$admin_page_free = $pagenow . '?page=' . str_replace( '-pro', '', $page );
       
   796 
       
   797 			foreach ( $bws_plugins as $bws_plugin ) {
       
   798 				if ( $admin_page_free === $bws_plugin['settings'] ) {
       
   799 					$include_jquery_ui = true;
       
   800 					break;
       
   801 				}
       
   802 			}
       
   803 		}
       
   804 
       
   805 		if ( in_array( $page, array( 'bws_panel', 'bws_themes', 'bws_system_status', $plugin_file ) ) || $include_jquery_ui || strpos( $page, '-bws-panel' ) ) {
       
   806 			$jquery_ui_version = isset( $wp_scripts->registered['jquery-ui-core']->ver ) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.12.1';
       
   807 			WP_Filesystem();
       
   808 			if ( ! $wp_filesystem->exists( dirname( __FILE__ ) . '/css/jquery-ui-styles/' . $jquery_ui_version . '/' ) ) {
       
   809 				$jquery_ui_version = '1.12.1';
       
   810 			}
       
   811 			wp_enqueue_style( 'jquery-ui-style', bws_menu_url( 'css/jquery-ui-styles/' . $jquery_ui_version . '/jquery-ui.css', array(), $jquery_ui_version ) );
   758 			wp_enqueue_style( 'bws_menu_style', bws_menu_url( 'css/style.css' ), array(), '2.4.2' );
   812 			wp_enqueue_style( 'bws_menu_style', bws_menu_url( 'css/style.css' ), array(), '2.4.2' );
   759 			wp_enqueue_script( 'bws_menu_script', bws_menu_url( 'js/bws_menu.js' ), array(), '2.4.2', true );
   813 			wp_enqueue_script( 'bws_menu_script', bws_menu_url( 'js/bws_menu.js' ), array(), '2.4.2', true );
   760 			wp_enqueue_script( 'theme-install' );
   814 			wp_enqueue_script( 'theme-install' );
   761 			add_thickbox();
   815 			add_thickbox();
   762 			wp_enqueue_script( 'plugin-install' );
   816 			wp_enqueue_script( 'plugin-install' );
   824 			if ( ! defined( 'DOING_AJAX' ) ) {
   878 			if ( ! defined( 'DOING_AJAX' ) ) {
   825 				wp_enqueue_style( 'bws-modal-css', bws_menu_url( 'css/modal.css' ) );
   879 				wp_enqueue_style( 'bws-modal-css', bws_menu_url( 'css/modal.css' ) );
   826 
   880 
   827 				bws_add_deactivation_feedback_dialog_box();
   881 				bws_add_deactivation_feedback_dialog_box();
   828 			}
   882 			}
       
   883 		}
       
   884 
       
   885 		if ( 'multilanguage-languages.php' === $page ) {
       
   886 			wp_enqueue_style( 'bws-modal-css', bws_menu_url( 'css/modal.css' ) );
   829 		}
   887 		}
   830 
   888 
   831 		if ( ! empty( $bws_shortcode_list ) ) {
   889 		if ( ! empty( $bws_shortcode_list ) ) {
   832 			/* TinyMCE Shortcode Plugin */
   890 			/* TinyMCE Shortcode Plugin */
   833 			$script = "var bws_shortcode_button = {
   891 			$script = "var bws_shortcode_button = {
   864 			}
   922 			}
   865 		}
   923 		}
   866 	}
   924 	}
   867 }
   925 }
   868 
   926 
   869 /**
       
   870 * add styles and scripts for Bws_Settings_Tabs
       
   871 *
       
   872 * @since 1.9.8
       
   873 */
       
   874 if ( ! function_exists( 'bws_enqueue_settings_scripts' ) ) {
   927 if ( ! function_exists( 'bws_enqueue_settings_scripts' ) ) {
       
   928 	/**
       
   929 	 * Add styles and scripts for Bws_Settings_Tabs
       
   930 	 *
       
   931 	 * @since 1.9.8
       
   932 	 */
   875 	function bws_enqueue_settings_scripts() {
   933 	function bws_enqueue_settings_scripts() {
   876 		wp_enqueue_script( 'jquery-ui-resizable' );
   934 		wp_enqueue_script( 'jquery-ui-resizable' );
   877 		wp_enqueue_script( 'jquery-ui-tabs' );
   935 		wp_enqueue_script( 'jquery-ui-tabs' );
   878 		wp_enqueue_style( 'bws-modal-css', bws_menu_url( 'css/modal.css' ), array(), '2.4.2' );
   936 		wp_enqueue_style( 'bws-modal-css', bws_menu_url( 'css/modal.css' ), array(), '2.4.2' );
   879 	}
   937 	}
   880 }
   938 }
   881 
   939 
   882 /**
       
   883  * Function add syles into admin head
       
   884  *
       
   885  * @since 1.9.8
       
   886  */
       
   887 if ( ! function_exists( 'bws_plugins_admin_head' ) ) {
   940 if ( ! function_exists( 'bws_plugins_admin_head' ) ) {
       
   941 	/**
       
   942 	 * Function add syles into admin head
       
   943 	 *
       
   944 	 * @since 1.9.8
       
   945 	 */
   888 	function bws_plugins_admin_head() {
   946 	function bws_plugins_admin_head() {
   889 		$page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
   947 		$page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
   890 
   948 
   891 		if ( $page === 'bws_panel' ) {
   949 		if ( 'bws_panel' === $page ) {
   892 			?>
   950 			?>
   893 			<noscript>
   951 			<noscript>
   894 				<style type="text/css">
   952 				<style type="text/css">
   895 					.bws_product_button {
   953 					.bws_product_button {
   896 						display: inline-block;
   954 						display: inline-block;
   900 			<?php
   958 			<?php
   901 		}
   959 		}
   902 	}
   960 	}
   903 }
   961 }
   904 
   962 
   905 /**
       
   906  * Function add syles into admin footer
       
   907  *
       
   908  * @since 1.9.8
       
   909  */
       
   910 if ( ! function_exists( 'bws_plugins_admin_footer' ) ) {
   963 if ( ! function_exists( 'bws_plugins_admin_footer' ) ) {
       
   964 	/**
       
   965 	 * Function add syles into admin footer
       
   966 	 *
       
   967 	 * @since 1.9.8
       
   968 	 */
   911 	function bws_plugins_admin_footer() {
   969 	function bws_plugins_admin_footer() {
   912 		bws_shortcode_media_button_popup();
   970 		$screen = get_current_screen();
   913 	}
   971 		if ( 'edit' === $screen->parent_base ) {
   914 }
   972 			bws_shortcode_media_button_popup();
   915 
   973 		}
   916 /**
   974 	}
   917  * Function add style and scripts for older version
   975 }
   918  *
   976 
   919  * @since 1.9.8
       
   920  */
       
   921 if ( ! function_exists( 'bws_plugins_include_codemirror' ) ) {
   977 if ( ! function_exists( 'bws_plugins_include_codemirror' ) ) {
       
   978 	/**
       
   979 	 * Function add style and scripts for older version
       
   980 	 *
       
   981 	 * @since 1.9.8
       
   982 	 */
   922 	function bws_plugins_include_codemirror() {
   983 	function bws_plugins_include_codemirror() {
   923 		global $wp_version;
   984 		global $wp_version;
   924 		if ( version_compare( $wp_version, '4.9.0', '>=' ) ) {
   985 		if ( version_compare( $wp_version, '4.9.0', '>=' ) ) {
   925 			wp_enqueue_style( 'wp-codemirror' );
   986 			wp_enqueue_style( 'wp-codemirror' );
   926 			wp_enqueue_script( 'wp-codemirror' );
   987 			wp_enqueue_script( 'wp-codemirror' );
   927 		} else {
   988 		}
   928 			wp_enqueue_style( 'codemirror.css', bws_menu_url( 'css/codemirror.css' ), array(), '2.4.2' );
   989 	}
   929 			wp_enqueue_script( 'codemirror.js', bws_menu_url( 'js/codemirror.js' ), array( 'jquery' ), '2.4.2' );
   990 }
   930 		}
   991 
   931 
       
   932 	}
       
   933 }
       
   934 
       
   935 /**
       
   936  * Tooltip block
       
   937  */
       
   938 if ( ! function_exists( 'bws_add_tooltip_in_admin' ) ) {
   992 if ( ! function_exists( 'bws_add_tooltip_in_admin' ) ) {
       
   993 	/**
       
   994 	 * Tooltip block
       
   995 	 *
       
   996 	 * @param array $tooltip_args Args for tooltip.
       
   997 	 */
   939 	function bws_add_tooltip_in_admin( $tooltip_args = array() ) {
   998 	function bws_add_tooltip_in_admin( $tooltip_args = array() ) {
   940 		new BWS_Admin_Tooltip( $tooltip_args );
   999 		new BWS_Admin_Tooltip( $tooltip_args );
   941 	}
  1000 	}
   942 }
  1001 }
   943 
  1002 
   944 /**
       
   945  * Class for Tooltip
       
   946  *
       
   947  * @since 1.9.8
       
   948  */
       
   949 if ( ! class_exists( 'BWS_Admin_Tooltip' ) ) {
  1003 if ( ! class_exists( 'BWS_Admin_Tooltip' ) ) {
       
  1004 	/**
       
  1005 	 * Class for Tooltip
       
  1006 	 *
       
  1007 	 * @since 1.9.8
       
  1008 	 */
   950 	class BWS_Admin_Tooltip {
  1009 	class BWS_Admin_Tooltip {
   951 		private $tooltip_args;
  1010 		private $tooltip_args;
   952 
  1011 
       
  1012 		/**
       
  1013 		 * Tooltip construct
       
  1014 		 *
       
  1015 		 * @param array $tooltip_args Args for tooltip.
       
  1016 		 */
   953 		public function __construct( $tooltip_args ) {
  1017 		public function __construct( $tooltip_args ) {
   954 			global $bstwbsftwppdtplgns_tooltip_script_add;
  1018 			global $bstwbsftwppdtplgns_tooltip_script_add;
   955 
  1019 
   956 			/* Default arguments */
  1020 			/* Default arguments */
   957 			$tooltip_args_default = array(
  1021 			$tooltip_args_default = array(
  1045 			wp_add_inline_script( 'bws-tooltip-script-single-' . $this->tooltip_args['tooltip_id'], sprintf( $script ) );
  1109 			wp_add_inline_script( 'bws-tooltip-script-single-' . $this->tooltip_args['tooltip_id'], sprintf( $script ) );
  1046 		}
  1110 		}
  1047 	}
  1111 	}
  1048 }
  1112 }
  1049 
  1113 
  1050 /**
       
  1051  * Function display confirm
       
  1052  *
       
  1053  * @since 1.9.8
       
  1054  */
       
  1055 if ( ! function_exists( 'bws_form_restore_default_confirm' ) ) {
  1114 if ( ! function_exists( 'bws_form_restore_default_confirm' ) ) {
       
  1115 	/**
       
  1116 	 * Function display confirm
       
  1117 	 *
       
  1118 	 * @since 1.9.8
       
  1119 	 * @param string $plugin_basename Plugin basename.
       
  1120 	 */
  1056 	function bws_form_restore_default_confirm( $plugin_basename ) {
  1121 	function bws_form_restore_default_confirm( $plugin_basename ) {
  1057 		?>
  1122 		?>
  1058 		<div>
  1123 		<div>
  1059 			<p><?php esc_html_e( 'Are you sure you want to restore default settings?', 'bestwebsoft' ); ?></p>
  1124 			<p><?php esc_html_e( 'Are you sure you want to restore default settings?', 'bestwebsoft' ); ?></p>
  1060 			<form method="post" action="">
  1125 			<form method="post" action="">
  1067 		</div>
  1132 		</div>
  1068 		<?php
  1133 		<?php
  1069 	}
  1134 	}
  1070 }
  1135 }
  1071 
  1136 
  1072 /**
       
  1073  * Function for shortcode
       
  1074  *
       
  1075  * @since 1.9.8
       
  1076  */
       
  1077 if ( ! function_exists( 'bws_add_editor_buttons' ) ) {
  1137 if ( ! function_exists( 'bws_add_editor_buttons' ) ) {
       
  1138 	/**
       
  1139 	 * Function for shortcode
       
  1140 	 *
       
  1141 	 * @since 1.9.8
       
  1142 	 */
  1078 	function bws_add_editor_buttons() {
  1143 	function bws_add_editor_buttons() {
  1079 		global $bws_shortcode_list;
  1144 		global $bws_shortcode_list;
  1080 		if ( ! empty( $bws_shortcode_list ) && current_user_can( 'edit_posts' ) && current_user_can( 'edit_pages' ) ) {
  1145 		if ( ! empty( $bws_shortcode_list ) && current_user_can( 'edit_posts' ) && current_user_can( 'edit_pages' ) ) {
  1081 			add_filter( 'mce_external_plugins', 'bws_add_buttons' );
  1146 			add_filter( 'mce_external_plugins', 'bws_add_buttons' );
  1082 			add_filter( 'mce_buttons', 'bws_register_buttons' );
  1147 			add_filter( 'mce_buttons', 'bws_register_buttons' );
  1083 		}
  1148 		}
  1084 	}
  1149 	}
  1085 }
  1150 }
  1086 
  1151 
  1087 /**
       
  1088  * Function add button for editor
       
  1089  *
       
  1090  * @since 1.9.8
       
  1091  */
       
  1092 if ( ! function_exists( 'bws_add_buttons' ) ) {
  1152 if ( ! function_exists( 'bws_add_buttons' ) ) {
       
  1153 	/**
       
  1154 	 * Function add button for editor
       
  1155 	 *
       
  1156 	 * @since 1.9.8
       
  1157 	 * @param array $plugin_array Editor scripts.
       
  1158 	 */
  1093 	function bws_add_buttons( $plugin_array ) {
  1159 	function bws_add_buttons( $plugin_array ) {
  1094 		$plugin_array['add_bws_shortcode'] = bws_menu_url( 'js/shortcode-button.js' );
  1160 		$plugin_array['add_bws_shortcode'] = bws_menu_url( 'js/shortcode-button.js' );
  1095 		return $plugin_array;
  1161 		return $plugin_array;
  1096 	}
  1162 	}
  1097 }
  1163 }
  1098 
  1164 
  1099 /**
       
  1100  * Function register button for editor
       
  1101  *
       
  1102  * @since 1.9.8
       
  1103  */
       
  1104 if ( ! function_exists( 'bws_register_buttons' ) ) {
  1165 if ( ! function_exists( 'bws_register_buttons' ) ) {
       
  1166 	/**
       
  1167 	 * Function register button for editor
       
  1168 	 *
       
  1169 	 * @since 1.9.8
       
  1170 	 * @param array $buttons Editor buttons.
       
  1171 	 */
  1105 	function bws_register_buttons( $buttons ) {
  1172 	function bws_register_buttons( $buttons ) {
  1106 		array_push( $buttons, 'add_bws_shortcode' ); /* dropcap', 'recentposts */
  1173 		array_push( $buttons, 'add_bws_shortcode' ); /* dropcap', 'recentposts */
  1107 		return $buttons;
  1174 		return $buttons;
  1108 	}
  1175 	}
  1109 }
  1176 }
  1110 
  1177 
  1111 /**
       
  1112  * Function Generate inline content for the popup window when the "bws shortcode" button is clicked
       
  1113  *
       
  1114  * @since 1.9.8
       
  1115  */
       
  1116 if ( ! function_exists( 'bws_shortcode_media_button_popup' ) ) {
  1178 if ( ! function_exists( 'bws_shortcode_media_button_popup' ) ) {
       
  1179 	/**
       
  1180 	 * Function Generate inline content for the popup window when the "bws shortcode" button is clicked
       
  1181 	 *
       
  1182 	 * @since 1.9.8
       
  1183 	 */
  1117 	function bws_shortcode_media_button_popup() {
  1184 	function bws_shortcode_media_button_popup() {
  1118 		global $bws_shortcode_list;
  1185 		global $bws_shortcode_list;
  1119 
  1186 
  1120 		if ( ! empty( $bws_shortcode_list ) ) {
  1187 		if ( ! empty( $bws_shortcode_list ) ) {
  1121 			?>
  1188 			?>
  1130 						</select>
  1197 						</select>
  1131 					</div>
  1198 					</div>
  1132 					<div class="clear"></div>
  1199 					<div class="clear"></div>
  1133 					<div id="bws_shortcode_content">
  1200 					<div id="bws_shortcode_content">
  1134 						<h4><?php esc_html_e( 'Shortcode settings', 'bestwebsoft' ); ?></h4>
  1201 						<h4><?php esc_html_e( 'Shortcode settings', 'bestwebsoft' ); ?></h4>
  1135 						<?php echo wp_kses_post( apply_filters( 'bws_shortcode_button_content', '' ) ); ?>
  1202 						<?php
       
  1203 						$ws_shortcode_button_content = apply_filters( 'bws_shortcode_button_content', '' );
       
  1204 						if ( ! empty( $ws_shortcode_button_content ) ) {
       
  1205 							echo wp_kses_post( $ws_shortcode_button_content );
       
  1206 						}
       
  1207 						?>
  1136 					</div>
  1208 					</div>
  1137 					<div class="clear"></div>
  1209 					<div class="clear"></div>
  1138 					<div id="bws_shortcode_content_bottom">
  1210 					<div id="bws_shortcode_content_bottom">
  1139 						<p><?php esc_html_e( 'The shortcode will be inserted', 'bestwebsoft' ); ?></p>
  1211 						<p><?php esc_html_e( 'The shortcode will be inserted', 'bestwebsoft' ); ?></p>
  1140 						<div id="bws_shortcode_block"><div id="bws_shortcode_display"></div></div>
  1212 						<div id="bws_shortcode_block"><div id="bws_shortcode_display"></div></div>
  1144 			<?php
  1216 			<?php
  1145 		}
  1217 		}
  1146 	}
  1218 	}
  1147 }
  1219 }
  1148 
  1220 
  1149 /**
       
  1150  * Output shortcode in a special block
       
  1151  *
       
  1152  * @since 1.9.8
       
  1153  */
       
  1154 if ( ! function_exists( 'bws_shortcode_output' ) ) {
  1221 if ( ! function_exists( 'bws_shortcode_output' ) ) {
       
  1222 	/**
       
  1223 	 * Output shortcode in a special block
       
  1224 	 *
       
  1225 	 * @since 1.9.8
       
  1226 	 * @param string $shortcode Shortcode string.
       
  1227 	 */
  1155 	function bws_shortcode_output( $shortcode ) {
  1228 	function bws_shortcode_output( $shortcode ) {
  1156 		?>
  1229 		?>
  1157 		<span class="bws_shortcode_output"><input type="text" onfocus="this.select();" readonly="readonly" value="<?php echo esc_attr( $shortcode ); ?>" class="large-text bws_no_bind_notice"></span>
  1230 		<span class="bws_shortcode_output"><input type="text" onfocus="this.select();" readonly="readonly" value="<?php echo esc_attr( $shortcode ); ?>" class="large-text bws_no_bind_notice"></span>
  1158 		<?php
  1231 		<?php
  1159 	}
  1232 	}
  1160 }
  1233 }
  1161 
  1234 
  1162 /**
       
  1163  * Output tooltip
       
  1164  *
       
  1165  * @since 1.9.8
       
  1166  * @param   string   $content  - HTML content for the tooltip
       
  1167  * @param   string   $class  - Can be standart "bws-hide-for-mobile" (tooltip will be hidden in 782px) and "bws-auto-width" (need for img) or some custom class.
       
  1168  */
       
  1169 if ( ! function_exists( 'bws_add_help_box' ) ) {
  1235 if ( ! function_exists( 'bws_add_help_box' ) ) {
       
  1236 	/**
       
  1237 	 * Output tooltip
       
  1238 	 *
       
  1239 	 * @since 1.9.8
       
  1240 	 * @param string $content HTML content for the tooltip.
       
  1241 	 * @param string $class   Can be standart "bws-hide-for-mobile" (tooltip will be hidden in 782px) and "bws-auto-width" (need for img) or some custom class.
       
  1242 	 */
  1170 	function bws_add_help_box( $content, $class = '' ) {
  1243 	function bws_add_help_box( $content, $class = '' ) {
  1171 		return '<span class="bws_help_box dashicons dashicons-editor-help ' . $class . ' hide-if-no-js">
  1244 		return '<span class="bws_help_box dashicons dashicons-editor-help ' . $class . ' hide-if-no-js">
  1172 			<span class="bws_hidden_help_text">' . $content . '</span>
  1245 			<span class="bws_hidden_help_text">' . $content . '</span>
  1173 		</span>';
  1246 		</span>';
  1174 	}
  1247 	}
  1175 }
  1248 }
  1176 
  1249 
  1177 /**
       
  1178  * Function add help tab
       
  1179  *
       
  1180  * @since 1.9.8
       
  1181  */
       
  1182 if ( ! function_exists( 'bws_help_tab' ) ) {
  1250 if ( ! function_exists( 'bws_help_tab' ) ) {
       
  1251 	/**
       
  1252 	 * Function add help tab
       
  1253 	 *
       
  1254 	 * @since 1.9.8
       
  1255 	 * @param string $screen Screen name.
       
  1256 	 * @param array  $args   Args for screen.
       
  1257 	 */
  1183 	function bws_help_tab( $screen, $args ) {
  1258 	function bws_help_tab( $screen, $args ) {
  1184 		$url = ( ! empty( $args['section'] ) ) ? 'https://support.bestwebsoft.com/hc/en-us/sections/' . $args['section'] : 'https://support.bestwebsoft.com/';
  1259 		$url = ( ! empty( $args['section'] ) ) ? 'https://support.bestwebsoft.com/hc/en-us/sections/' . $args['section'] : 'https://support.bestwebsoft.com/';
  1185 
  1260 
  1186 		$content = '<p><a href="' . esc_url( $url ) . '" target="_blank">' . __( 'Visit Help Center', 'bestwebsoft' ) . '</a></p>';
  1261 		$content = '<p><a href="' . esc_url( $url ) . '" target="_blank">' . __( 'Visit Help Center', 'bestwebsoft' ) . '</a></p>';
  1187 
  1262 
  1200 			'<p><a href="https://support.bestwebsoft.com/hc/en-us/requests/new" target="_blank">' . esc_html__( 'Submit a Request', 'bestwebsoft' ) . '</a></p>'
  1275 			'<p><a href="https://support.bestwebsoft.com/hc/en-us/requests/new" target="_blank">' . esc_html__( 'Submit a Request', 'bestwebsoft' ) . '</a></p>'
  1201 		);
  1276 		);
  1202 	}
  1277 	}
  1203 }
  1278 }
  1204 
  1279 
  1205 /**
       
  1206  * Function add css and js
       
  1207  *
       
  1208  * @since 1.9.8
       
  1209  */
       
  1210 if ( ! function_exists( 'bws_enqueue_custom_code_css_js' ) ) {
  1280 if ( ! function_exists( 'bws_enqueue_custom_code_css_js' ) ) {
       
  1281 	/**
       
  1282 	 * Function add css and js
       
  1283 	 *
       
  1284 	 * @since 1.9.8
       
  1285 	 */
  1211 	function bws_enqueue_custom_code_css_js() {
  1286 	function bws_enqueue_custom_code_css_js() {
  1212 		global $bstwbsftwppdtplgns_options;
  1287 		global $bstwbsftwppdtplgns_options;
  1213 
  1288 
  1214 		if ( ! isset( $bstwbsftwppdtplgns_options ) ) {
  1289 		if ( ! isset( $bstwbsftwppdtplgns_options ) ) {
  1215 			$bstwbsftwppdtplgns_options = ( function_exists( 'is_multisite' ) && is_multisite() ) ? get_site_option( 'bstwbsftwppdtplgns_options' ) : get_option( 'bstwbsftwppdtplgns_options' );
  1290 			$bstwbsftwppdtplgns_options = ( function_exists( 'is_multisite' ) && is_multisite() ) ? get_site_option( 'bstwbsftwppdtplgns_options' ) : get_option( 'bstwbsftwppdtplgns_options' );
  1234 			}
  1309 			}
  1235 		}
  1310 		}
  1236 	}
  1311 	}
  1237 }
  1312 }
  1238 
  1313 
  1239 /**
       
  1240  * Function add custom php code
       
  1241  *
       
  1242  * @since 1.9.8
       
  1243  */
       
  1244 if ( ! function_exists( 'bws_enqueue_custom_code_php' ) ) {
  1314 if ( ! function_exists( 'bws_enqueue_custom_code_php' ) ) {
       
  1315 	/**
       
  1316 	 * Function add custom php code
       
  1317 	 *
       
  1318 	 * @since 1.9.8
       
  1319 	 */
  1245 	function bws_enqueue_custom_code_php() {
  1320 	function bws_enqueue_custom_code_php() {
  1246 		if ( is_admin() ) {
  1321 		if ( is_admin() ) {
  1247 			return;
  1322 			return;
  1248 		}
  1323 		}
  1249 
  1324 
  1291 			}
  1366 			}
  1292 		}
  1367 		}
  1293 	}
  1368 	}
  1294 }
  1369 }
  1295 
  1370 
  1296 /**
       
  1297  * Function delete plugin
       
  1298  *
       
  1299  * @since 1.9.8
       
  1300  */
       
  1301 if ( ! function_exists( 'bws_delete_plugin' ) ) {
  1371 if ( ! function_exists( 'bws_delete_plugin' ) ) {
       
  1372 	/**
       
  1373 	 * Function delete plugin
       
  1374 	 *
       
  1375 	 * @since 1.9.8
       
  1376 	 * @param string $basename Plugin basename.
       
  1377 	 */
  1302 	function bws_delete_plugin( $basename ) {
  1378 	function bws_delete_plugin( $basename ) {
  1303 		global $bstwbsftwppdtplgns_options;
  1379 		global $bstwbsftwppdtplgns_options;
  1304 
  1380 
  1305 		$is_multisite = is_multisite();
  1381 		$is_multisite = is_multisite();
  1306 		if ( $is_multisite ) {
  1382 		if ( $is_multisite ) {