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/themify-.../admin
File: class-tbp-admin.php
<?php
[0] Fix | Delete
[1] Fix | Delete
/**
[2] Fix | Delete
* The admin-specific functionality of the plugin.
[3] Fix | Delete
*
[4] Fix | Delete
* @link https://themify.me/
[5] Fix | Delete
* @since 1.0.0
[6] Fix | Delete
*
[7] Fix | Delete
* @package Tbp
[8] Fix | Delete
* @subpackage Tbp/admin
[9] Fix | Delete
*/
[10] Fix | Delete
[11] Fix | Delete
/**
[12] Fix | Delete
* The admin-specific functionality of the plugin.
[13] Fix | Delete
*
[14] Fix | Delete
* Defines the plugin name, version, and two examples hooks for how to
[15] Fix | Delete
* enqueue the admin-specific stylesheet and JavaScript.
[16] Fix | Delete
*
[17] Fix | Delete
* @package Tbp
[18] Fix | Delete
* @subpackage Tbp/admin
[19] Fix | Delete
* @author Themify <themify@themify.me>
[20] Fix | Delete
*/
[21] Fix | Delete
final class Tbp_Admin {
[22] Fix | Delete
[23] Fix | Delete
[24] Fix | Delete
public $theme;
[25] Fix | Delete
[26] Fix | Delete
public $template;
[27] Fix | Delete
[28] Fix | Delete
public static $currentPage=null;
[29] Fix | Delete
[30] Fix | Delete
/**
[31] Fix | Delete
* Initialize the class and set its properties.
[32] Fix | Delete
*
[33] Fix | Delete
* @since 1.0.0
[34] Fix | Delete
* @param string $plugin_name The name of this plugin.
[35] Fix | Delete
* @param string $version The version of this plugin.
[36] Fix | Delete
*/
[37] Fix | Delete
public static function run() {
[38] Fix | Delete
add_action('themify_builder_setup_modules',array(__CLASS__,'init'));
[39] Fix | Delete
}
[40] Fix | Delete
[41] Fix | Delete
public static function init(){
[42] Fix | Delete
add_action( 'admin_menu', array( __CLASS__, 'register_admin_menu' ), 11 );
[43] Fix | Delete
add_filter('themify_module_categories', array('Tbp_Utils', 'module_categories'));
[44] Fix | Delete
add_filter('themify_builder_ajax_admin_vars',array('Tbp_Utils','localize_predesigned_templates'));
[45] Fix | Delete
add_action('themify_builder_admin_enqueue', array( 'Tbp_Utils', 'load_tbp_active' ) );
[46] Fix | Delete
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'register_scripts' ) );
[47] Fix | Delete
[48] Fix | Delete
$is_ajax = Tbp_Utils::isAjax() || Tbp_Utils::isRest();
[49] Fix | Delete
if(isset($_REQUEST['post_type']) && $_REQUEST['post_type']===Tbp_Templates::$post_type){
[50] Fix | Delete
self::$currentPage=Tbp_Templates::$post_type;
[51] Fix | Delete
}
[52] Fix | Delete
elseif(isset($_REQUEST['page']) && $_REQUEST['page']===Tbp_Themes::$post_type){
[53] Fix | Delete
self::$currentPage=Tbp_Themes::$post_type;
[54] Fix | Delete
}
[55] Fix | Delete
if ( self::$currentPage == Tbp_Templates::$post_type || $is_ajax === true || ( isset($_REQUEST['post']) && 'post.php' === $GLOBALS['pagenow'] && Tbp_Templates::$post_type === get_post_type( $_REQUEST['post'] ) ) ) {
[56] Fix | Delete
new Tbp_Templates();
[57] Fix | Delete
}
[58] Fix | Delete
if(self::$currentPage===Tbp_Themes::$post_type || $is_ajax===true){
[59] Fix | Delete
new Tbp_Themes();
[60] Fix | Delete
if($is_ajax===true){
[61] Fix | Delete
add_filter('themify_load_predesigned_templates',array('Tbp_Utils','load_predesigned_templates'),10);
[62] Fix | Delete
}
[63] Fix | Delete
}
[64] Fix | Delete
}
[65] Fix | Delete
[66] Fix | Delete
public static function register_scripts(){
[67] Fix | Delete
$name = Tbp::get_plugin_name();
[68] Fix | Delete
wp_register_script( $name.'-admin', themify_enque(TBP_URL. 'admin/js/tbp-admin.js'), array( 'jquery'), Tbp::get_version(), true );
[69] Fix | Delete
wp_localize_script( $name.'-admin', 'tbpAdminVars', array(
[70] Fix | Delete
'i18n' => array(
[71] Fix | Delete
'import' => __( 'Import Demo', 'tbp' ),
[72] Fix | Delete
'import_warning' => __( 'Warning: this will import the demo posts, pages, menus, etc. as per our demo. It may take a few minutes. You can erase demo on Pro Themes > Theme > Theme Details.', 'tbp' ),
[73] Fix | Delete
)
[74] Fix | Delete
) );
[75] Fix | Delete
[76] Fix | Delete
$screen = get_current_screen();
[77] Fix | Delete
if (
[78] Fix | Delete
( $screen->base === 'edit' && $screen->post_type === Tbp_Templates::$post_type )
[79] Fix | Delete
|| self::$currentPage === Tbp_Themes::$post_type
[80] Fix | Delete
) {
[81] Fix | Delete
add_action( 'admin_footer', array( __CLASS__, 'enqueue_scripts' ) );
[82] Fix | Delete
}
[83] Fix | Delete
}
[84] Fix | Delete
[85] Fix | Delete
/**
[86] Fix | Delete
* Register the JavaScript for the admin area.
[87] Fix | Delete
*
[88] Fix | Delete
* @since 1.0.0
[89] Fix | Delete
*/
[90] Fix | Delete
public static function enqueue_scripts() {
[91] Fix | Delete
/**
[92] Fix | Delete
* This function is provided for demonstration purposes only.
[93] Fix | Delete
*
[94] Fix | Delete
* An instance of this class should be passed to the run() function
[95] Fix | Delete
* defined in Tbp_Loader as all of the hooks are defined
[96] Fix | Delete
* in that particular class.
[97] Fix | Delete
*
[98] Fix | Delete
* The Tbp_Loader will then create the relationship
[99] Fix | Delete
* between the defined hooks and the functions defined in this
[100] Fix | Delete
* class.
[101] Fix | Delete
*/
[102] Fix | Delete
$name=Tbp::get_plugin_name();
[103] Fix | Delete
$v = Tbp::get_version();
[104] Fix | Delete
if(current_user_can('upload_files') ) {
[105] Fix | Delete
wp_enqueue_media();
[106] Fix | Delete
}
[107] Fix | Delete
if(false === wp_script_is( 'themify-metabox','enqueued' )){
[108] Fix | Delete
wp_enqueue_style( 'themify-metabox' );
[109] Fix | Delete
wp_enqueue_script( 'themify-metabox' );
[110] Fix | Delete
wp_enqueue_script( 'themify-plupload' );
[111] Fix | Delete
do_action( 'themify_metabox_enqueue_assets' );
[112] Fix | Delete
}
[113] Fix | Delete
wp_enqueue_style( $name, themify_enque(TBP_URL . 'admin/css/tbp-admin.css'), array(), $v, 'all' );
[114] Fix | Delete
[115] Fix | Delete
if ( ! wp_style_is( 'themify-icons' ) ) {
[116] Fix | Delete
wp_enqueue_style( 'themify-icons', themify_enque(THEMIFY_URI . '/themify-icons/themify-icons.css'), array(), THEMIFY_VERSION );
[117] Fix | Delete
}
[118] Fix | Delete
[119] Fix | Delete
wp_enqueue_script('themify-main-script', themify_enque(THEMIFY_URI . '/js/main.js'), null, THEMIFY_VERSION, true);
[120] Fix | Delete
wp_enqueue_script($name.'-admin');
[121] Fix | Delete
$button=null;
[122] Fix | Delete
if(current_user_can( 'manage_options' )){
[123] Fix | Delete
wp_enqueue_script( 'themify-plupload' );
[124] Fix | Delete
$button = themify_get_uploader('tbp-themes-import', array(
[125] Fix | Delete
'label' => __('Import', 'tbp'),
[126] Fix | Delete
'preset' => false,
[127] Fix | Delete
'preview' => false,
[128] Fix | Delete
'tomedia' => false,
[129] Fix | Delete
'topost' => '',
[130] Fix | Delete
'fields' => '',
[131] Fix | Delete
'featured' => '',
[132] Fix | Delete
'message' => '',
[133] Fix | Delete
'fallback' => '',
[134] Fix | Delete
'dragfiles' => false,
[135] Fix | Delete
'confirm' => false,
[136] Fix | Delete
'medialib' => false,
[137] Fix | Delete
'formats' => 'zip,txt',
[138] Fix | Delete
'type' => '',
[139] Fix | Delete
'action' => self::$currentPage.'_plupload',
[140] Fix | Delete
)
[141] Fix | Delete
);
[142] Fix | Delete
}
[143] Fix | Delete
$labels = Themify_Builder::get_i18n();
[144] Fix | Delete
$labels['label']['browse_image'] = __('Add Image','tbp');
[145] Fix | Delete
$ph_image = 'tbp_theme' === self::$currentPage ? 'theme' : 'template';
[146] Fix | Delete
wp_localize_script('themify-main-script', 'themifyBuilder', array(
[147] Fix | Delete
'ajaxurl' => admin_url('admin-ajax.php'),
[148] Fix | Delete
'includes_url' => includes_url(),
[149] Fix | Delete
'meta_url' => THEMIFY_METABOX_URI,
[150] Fix | Delete
'tb_load_nonce' => wp_create_nonce('tb_load_nonce'),
[151] Fix | Delete
'import_nonce' => wp_create_nonce('themify_builder_import_filethemify-builder-plupload'),
[152] Fix | Delete
'tbAppUrl'=>themify_enque(THEMIFY_BUILDER_URI . '/js/editor/themify-builder-app.js'),
[153] Fix | Delete
'constructorUrl'=>themify_enque(THEMIFY_BUILDER_URI . '/js/editor/themify-constructor.js'),
[154] Fix | Delete
'builderToolbarUrl'=>themify_enque(THEMIFY_BUILDER_URI . '/css/editor/toolbar.css'),
[155] Fix | Delete
'builderCombineUrl'=>themify_enque(THEMIFY_BUILDER_URI . '/css/editor/combine.css'),
[156] Fix | Delete
'v'=>THEMIFY_VERSION,
[157] Fix | Delete
'import_btn'=>$button,
[158] Fix | Delete
'pageId'=>self::$currentPage,
[159] Fix | Delete
'ph_image'=> TBP_URL . '/admin/img/'.$ph_image.'-placeholder.png',
[160] Fix | Delete
'labels'=>$labels['label']
[161] Fix | Delete
));
[162] Fix | Delete
$labels=null;
[163] Fix | Delete
wp_enqueue_style( 'tf-base', THEMIFY_URI . '/css/base.min.css', null, THEMIFY_VERSION );
[164] Fix | Delete
wp_enqueue_style( 'themify-ui' );
[165] Fix | Delete
include( TBP_DIR . 'admin/partials/lightbox-tpl.php' );
[166] Fix | Delete
themify_get_icon( 'help','ti' ); // load ti-help svg graphic
[167] Fix | Delete
[168] Fix | Delete
// Init Pointers
[169] Fix | Delete
TBP_Pointers::run();
[170] Fix | Delete
}
[171] Fix | Delete
[172] Fix | Delete
public static function register_admin_menu() {
[173] Fix | Delete
global $submenu;
[174] Fix | Delete
$menu_id = themify_is_themify_theme() ? 'themify' : 'themify-builder';
[175] Fix | Delete
if(empty($submenu[$menu_id])){
[176] Fix | Delete
return;
[177] Fix | Delete
}
[178] Fix | Delete
$label = '<span class="update-plugins"><span class="plugin-count" aria-hidden="true">PRO</span></span>';
[179] Fix | Delete
add_submenu_page( $menu_id, esc_html__( 'Themes ', 'tbp' ), sprintf(__( '%s Themes', 'tbp' ),$label), 'edit_posts', Tbp_Themes::$post_type , array( 'Tbp_Themes', 'render_page' ) );
[180] Fix | Delete
end($submenu[$menu_id]);
[181] Fix | Delete
Tbp_Utils::move_array_index( $submenu[$menu_id], key($submenu[$menu_id]), 1 );
[182] Fix | Delete
add_submenu_page( $menu_id, esc_html__( 'Templates', 'tbp' ), sprintf(__( '%s Templates', 'tbp' ),$label), 'edit_posts', 'edit.php?post_type='.Tbp_Templates::$post_type );
[183] Fix | Delete
end($submenu[$menu_id]);
[184] Fix | Delete
Tbp_Utils::move_array_index( $submenu[$menu_id], key($submenu[$menu_id]), 2 );
[185] Fix | Delete
}
[186] Fix | Delete
[187] Fix | Delete
}
[188] Fix | Delete
[189] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function