: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
defined( 'ABSPATH' ) || exit;
* Enqueue JS and CSS for Themify settings page and meta boxes
*******************************************************/
function themify_enqueue_scripts($page){
$pagenow = isset( $_GET['page'] ) ? $_GET['page'] : '';
// Don't do anything while updating the theme
if ( 'themify' === $pagenow && isset( $_GET['action'] ) && 'upgrade' === $_GET['action'] ) {
$types = themify_post_types();
$pages = apply_filters( 'themify_top_pages', array( 'post.php', 'post-new.php', 'toplevel_page_themify', 'nav-menus.php' ) );
$pagenows = apply_filters( 'themify_pagenow', array( 'themify' ) );
wp_register_style( 'tf_base', THEMIFY_URI . '/css/base.min.css', null, THEMIFY_VERSION);
wp_register_style( 'themify-ui', THEMIFY_URI . '/css/themify-ui.css', array('tf_base'), THEMIFY_VERSION );
wp_register_style( 'themify-ui-rtl', THEMIFY_URI . '/css/themify-ui-rtl.css', array('themify-ui'), THEMIFY_VERSION );
wp_register_style( 'themify-colorpicker', THEMIFY_METABOX_URI . 'css/jquery.minicolors.css', null, THEMIFY_VERSION );
wp_register_script( 'markjs', THEMIFY_URI . '/js/admin/jquery-mark.min.js', array('jquery'), THEMIFY_VERSION,true );
wp_register_script( 'themify-colorpicker', THEMIFY_METABOX_URI . 'js/jquery.minicolors.js', array('jquery'), THEMIFY_VERSION,true );
wp_localize_script( 'themify-colorpicker', 'themifyCM', Themify_Metabox::themify_localize_cm_data() );
wp_register_script( 'themify-scripts', THEMIFY_URI . '/js/admin/scripts.js', array('jquery', 'jquery-ui-tabs'), THEMIFY_VERSION,true );
wp_register_script( 'themify-plupload', THEMIFY_METABOX_URI . 'js/plupload.js', array('jquery', 'themify-scripts'), THEMIFY_VERSION,true);
wp_register_style ( 'magnific', THEMIFY_URI . '/css/modules/lightbox.css', array(), THEMIFY_VERSION );
wp_register_script( 'magnific', THEMIFY_URI . '/js/modules/lightbox.min.js', array('jquery'), THEMIFY_VERSION, true );
if( ($page === 'post.php' || $page === 'post-new.php') && in_array($typenow, $types,true) ){
wp_enqueue_script( 'meta-box-tabs' );
wp_enqueue_script( 'media-library-browse' );
// Register icon assets for later enqueueing.
wp_register_style( 'themify-icons', THEMIFY_URI . '/themify-icons/themify-icons.css', array(), THEMIFY_VERSION );
'nonce' => wp_create_nonce('tf_nonce'),
'admin_url' => admin_url( 'admin.php?page=themify' ),
'page_not_found' => esc_html__( 'Page not found', 'themify' )
if( $page === 'toplevel_page_themify' ){
wp_enqueue_script( 'jquery-ui-sortable' );
// Load main.js for using fontawsome function
themify_enque_script( 'themify-main-script', THEMIFY_URI.'/js/main.js', THEMIFY_VERSION, array('jquery'));
Themify_Enqueue_Assets::addLocalization('url', THEMIFY_URI, false);
$admin_vars['empty_li']=__('The fileds could not be empty!','themify');
$admin_vars['theme']=get_template();
$admin_vars['erase']=array(
'processing'=>__('Erasing... ','themify'),
'done'=>__('Erasing complete','themify'),
'error'=>__('An error occurred: %error%','themify')
$admin_vars['license']=array(
'title'=>__('Themify License','themify'),
'name'=>__('Themify Username','themify'),
'key'=>__('License Key','themify'),
'update'=>__('Update','themify'),
'link'=> sprintf('%s<a href="https://themify.me/member/softsale/license" target="_blank" rel="noopener">%s</a>%s',__('Please enter your Themify username and ','themify'),__('license key','themify'),__('. Make sure your membership/license key is active (not expired).','themify'))
$admin_vars['import']=array(
'posts' => __('Importing Posts (%from%/%to%): %post%', 'themify'),
'terms' => __('Importing Taxonomies (%from%/%to%): %post%', 'themify'),
'menu_items' => __('Importing menu items (%from%/%to%): %post%', 'themify'),
'menu' => __('Importing menus', 'themify'),
'theme' => __('Importing theme Settings', 'themify'),
'done'=>__('Import successfully finished', 'themify'),
'import_gs_data' => __('Importing Global Styling', 'themify'),
'download_images'=> __( 'Downloading images (%from%/%to%):', 'themify' ),
'upload_images'=> __( 'Uploading images (%from%/%to%):', 'themify' ),
'import_skip' => __('Failed import. Skip importing %post%', 'tbp'),
'import_failed' => __('Failed import: %post%', 'themify'),
'download_fail' => __('download failed.', 'themify'),
'upload_fail' => __('upload failed (%msg%)', 'themify'),
'memory'=>(int)(wp_convert_hr_to_bytes(WP_MEMORY_LIMIT)*MB_IN_BYTES)
if(class_exists('Themify_Updater',false)){
$themify_updater = Themify_Updater::get_instance();
$username=$themify_updater->get_setting('username');
$key=$themify_updater->get_setting('key');
$admin_vars['license']['username']=!empty($username)?$username:'';
$admin_vars['license']['key']=!empty($key)?$key:'';
unset($themify_updater,$key,$username);
themify_get_icon('info','ti');
themify_get_icon('alert','ti');
themify_get_icon('check','ti');
themify_get_icon('cog','fa');
if( in_array( $page, $pages,true ) ) {
wp_enqueue_style( 'themify-ui' );
wp_enqueue_style( 'themify-metabox' );
wp_enqueue_style( 'themify-ui-rtl' );
wp_enqueue_style( 'themify-colorpicker' );
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'jquery-ui-core' );
wp_enqueue_script( 'jquery-ui-tabs' );
wp_enqueue_script( 'jquery-ui-slider' );
if( 'themify' === $pagenow){
wp_enqueue_script( 'jquery-ui-autocomplete' );
wp_enqueue_script( 'json2' );
wp_enqueue_script( 'plupload-all' );
wp_enqueue_script( 'markjs' );
wp_enqueue_script( 'themify-colorpicker' );
if( in_array($typenow, $types,true) || in_array( $pagenow, $pagenows,true ) ){
//Don't include Themify JavaScript if we're not in one of the Themify-managed pages
wp_enqueue_script( 'themify-scripts' );
wp_enqueue_script( 'themify-plupload' );
Themify_Metabox::get_instance()->enqueue();
// Enqueue font icon assets.
wp_enqueue_style( 'themify-icons' );
Themify_Icon_Font::enqueue();
wp_enqueue_style ( 'magnific' );
wp_enqueue_script( 'magnific' );
wp_localize_script('themify-scripts', 'themify_js_vars', $admin_vars);
wp_localize_script('themify-scripts', 'themify_lang', array(
'confirm_reset_settings' => __('Are you sure you want to reset your theme settings?', 'themify'),
'check_backup' => __('Make sure to backup before upgrading. Files and settings may get lost or changed.', 'themify'),
'confirm_delete_image' => __('Do you want to delete this image permanently?', 'themify'),
'confirm_demo' => __( 'This will import demo and override current Themify panel settings.', 'themify' ),
wp_localize_script('themify-plupload', 'themify_plupload_lang', array(
'enable_zip_upload' => sprintf(
__('Install the "File Upload Types" plugin and add the file extension upload support.', 'themify'),
esc_url( network_admin_url('settings.php').'#upload_filetypes' )
'filesize_error' => __('The file you are trying to upload exceeds the maximum file size allowed.', 'themify'),
'filesize_error_fix' => sprintf(
__('Go to your <a href="%s">Network Settings</a> and increase the value of the <strong>Max upload file size</strong>.', 'themify'),
esc_url( network_admin_url('settings.php').'#fileupload_maxk' )
// Enqueu admin widgets stuff
if( $page === 'index.php' && themify_is_themify_theme()) {
wp_enqueue_style( 'themify-admin-widgets-css' );
wp_enqueue_script( 'themify-admin-widgets-js' );
* Checks if current user is allowed to view the update interface.
function themify_allow_update() {
return current_user_can( 'update_themes' );
///////////////////////////////////////////
///////////////////////////////////////////
function themify_admin_nav() {
$name = $theme->display('Name');
$can_manage_option = current_user_can( 'manage_options' );
$themify_page = add_menu_page( 'themify',$name , 'edit_posts', 'themify', $can_manage_option?'themify_page':'',"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='%23ffcc08' viewBox='0 0 32 32'%3E%3Cpath d='M11.5 3.5c15.8-5 21.8 9 20.3 17.3-.9 4.5-10 5.7-18 6.5-6.9.7-12.1 2.3-12.1 2.3s6.2-4.7 2.1-6.8C1.4 21.6-6.6 9.1 11.5 3.5zm7.3 6c-1 0-1.9.8-1.9 1.8a2 2 0 0 0 2 1.9c1 0 1.8-.9 1.8-1.9 0-1-.8-1.9-1.9-1.9zm-9.4.9a1.9 1.9 0 0 0-1.9 1.9 2 2 0 0 0 2 1.8 2 2 0 0 0 1.8-1.8c0-1.1-.9-2-1.9-2zM7 17.8s7.7 9.8 18.2-1.8c0 0-12.1 7.2-18.2 1.8z'%3E%3C/path%3E%3C/svg%3E", '49.3' );
* Add Themify settings page
add_submenu_page( 'themify', $name, __('Themify Settings', 'themify'), 'manage_options', 'themify', 'themify_page' );
if ( class_exists('Themify_Builder_Model',false) && Themify_Builder_Model::builder_check() ) {
* Add Themify Builder Layouts page
add_submenu_page ( 'themify', __( 'Saved Layouts', 'themify' ), __( 'Saved Layouts', 'themify' ), 'edit_posts', 'edit.php?post_type=tbuilder_layout' );
* Add Themify Builder Layout Parts page
add_submenu_page( 'themify', __( 'Layout Parts', 'themify' ), __( 'Layout Parts', 'themify' ), 'edit_posts', 'edit.php?post_type=tbuilder_layout_part' );
* Add Themify Global Styles page
add_submenu_page ( 'themify', __( 'Global Styles', 'themify' ), __( 'Global Styles', 'themify' ), 'edit_posts', 'themify-global-styles', 'themify_global_styles_page' );
* Add Themify Custom Fonts page
add_submenu_page( 'themify', __( 'Custom Fonts', 'themify' ), __( 'Custom Fonts', 'themify' ), 'edit_posts', 'edit.php?post_type=tb_cf' );
* Add Themify Customize submenu entry
add_submenu_page( 'themify', 'themify_customize', __( 'Customize', 'themify' ), 'manage_options', 'customize.php?themify=1' );
if ( is_plugin_active( 'themify-updater/themify-updater.php' ) ) {
* Add Themify Updater License page link
add_submenu_page ( 'themify', __( 'Themify License', 'themify' ), __( 'Themify License', 'themify' ), 'manage_options', 'index.php?page=themify-license' );
* Add submenu entry that redirects to Themify documentation site
$submenu['themify'][] = array( __( 'Documentation', 'themify' ), 'manage_options', 'https://themify.me/docs/' . str_replace( 'themify-', '', $theme->get_template() ) );
$submenu['themify'][] = array( __( 'Contact Support', 'themify' ), 'manage_options', 'https://themify.me/new-topic/' );
remove_submenu_page('themify','themify');
function themify_get_theme_required_plugins() {
$info = get_file_data( trailingslashit( get_template_directory() ) . 'style.css', array( 'Required Plugins' ) );
return isset( $info[0] )?$info[0]:'';
/***************************************************************************/
function themify_sort_config($themify_config) {
$themify_config['panel']['settings']['tab']['theme_settings']['custom-module'][] = array(
'title' => __('Accessibility', 'themify'),
'function' => 'accessibility_options'
'title' => __('Favicon', 'themify'),
'target' => 'uploads/favicon/'
'title' => __('Header Code', 'themify'),
'function' => 'header_html'
'title' => __('Footer Code', 'themify'),
'function' => 'footer_html'
'title' => __('Google Analytics', 'themify'),
'function' => 'themify_google_analytics_settings'
'title' => __('Search Settings', 'themify'),
'function' => 'search_settings'
'title' => __('Error 404 Page', 'themify'),
'function' => 'page_404_settings'
'title' => __('Google Fonts', 'themify'),
'function' => 'themify_webfonts_subsets'
'title' => __('Schema Microdata', 'themify'),
'function' => 'themify_framework_theme_microdata_config_callback'
'title' => __('Maintenance Mode', 'themify'),
'function' => 'themify_maintenance_mode_settings'
'title' => __('Feed Settings', 'themify'),
'function' => 'feed_settings'
'title' => __('Custom Feed URL', 'themify'),
'function' => 'custom_feed_url'
'function' => 'performance_settings'
'title' => __('Manage Social Links', 'themify'),
'function' => 'themify_manage_links'
'title' => __('Image Script Settings', 'themify'),
'function' => 'img_settings'
'integration-api'=>array(
'title' => __('Google Map API Settings', 'themify'),
'function' => 'themify_google_map_key'
'title' => __('Bing Map API Settings', 'themify'),
'function' => 'themify_bing_map_key'
'title' => __('Cloudflare API Settings', 'themify'),
'function' => 'themify_cloudflare_setting'
'title' => __('reCaptcha API Settings', 'themify'),
'function' => 'themify_recaptcha_setting'
'title' => __( 'hCaptcha API Settings', 'themify' ),
'function' => 'themify_hcaptcha_setting'
//'title' => __('Youtube/Vimeo GDPR', 'themify'),
//'function' => 'themify_video_gdpr'
'custom-icon-font'=>array(
'title' => __('Custom Icon Font', 'themify'),
'function' => 'themify_fontello_input_callback',
foreach($defaultModules as $k=>$def){
if(isset($themify_config['panel']['settings']['tab'][$k]['custom-module'])){
$defaultModules[$k]=array_merge($def,$themify_config['panel']['settings']['tab'][$k]['custom-module']);
$themify_config['panel']['settings']['tab']['general'] = array(
'title' => __('General', 'themify'),
'custom-module' =>$defaultModules['general']
$themify_config['panel']['settings']['tab']['performance'] = array(
'title' => __('Performance', 'themify'),
'custom-module' => $defaultModules['performance']
$themify_config['panel']['settings']['tab']['social_links'] = array(
'title' => __('Social Links', 'themify'),
'custom-module' => $defaultModules['social_links']
$themify_config['panel']['settings']['tab']['image_script'] = array(
'title' => __('Image Script', 'themify'),
'custom-module' =>$defaultModules['image_script']
$themify_config['panel']['settings']['tab']['integration-api'] = array(
'title' => __('Integration API', 'themify'),
'id' => 'integration-api',
'custom-module' => $defaultModules['integration-api']
$themify_config['panel']['settings']['tab']['custom-icon-font'] = array(
'title' => __('Custom Icon Font', 'themify'),
'id' => 'custom-icon-font',
'custom-module' => $defaultModules['custom-icon-font']
$sort=array('general','default_layouts','performance','theme_settings','shop_settings','portfolio_layouts','page_builder','social_links','hook-content','image_script','integration-api','role_access','custom-icon-font');
if(isset($themify_config['panel']['settings']['tab'][$v])){
$ordered['panel']['settings']['tab'][$v]=$themify_config['panel']['settings']['tab'][$v];
unset($themify_config['panel']['settings']['tab'][$v]);
if(!empty($themify_config['panel']['settings']['tab'])){
foreach($themify_config['panel']['settings']['tab'] as $k=>$v){
$ordered['panel']['settings']['tab'][$k]=$v;
return apply_filters('themify_theme_config_sort',$ordered);
///////////////////////////////////////////
///////////////////////////////////////////
function themify_page() {
if ( ! current_user_can( 'manage_options' ) )
wp_die( __( 'You do not have sufficient permissions to update this site.', 'themify' ) );
if (isset($_GET['action'])) {
$themify_theme_config=array();
include locate_template(array('custom-config.php', 'theme-config.php'));
$themify_config = apply_filters('themify_theme_config_setup', $themify_theme_config);
unset($themify_theme_config);
$themify_config=themify_sort_config($themify_config);
// check theme information
$is_child = is_child_theme();
$check_theme_name = $is_child? $theme->parent()->Name : $theme->display('Name');
$check_theme_version = $is_child ? $theme->parent()->Version : $theme->display('Version');
* Markup for Themify skins. It's empty if there are no skins
$themify_skins = themify_get_skins();
/* special admin tab that shows available skins with option to import demo separately for each */
$skins_and_demos = current_theme_supports( 'themify-skins-and-demos' );
<div class="tb_alert"></div>
<div id="tf_message" data-dismiss="<?php _e( 'Dismiss', 'themify' ); ?>"></div>
<!-- gzip issue detection -->
<script>document.body.classList.add( 'tf_litespeed' );</script>
.tf_litespeed #wpbody-content > * { display: none; }
.tf_litespeed #tf_gz_message { margin: 2em; display: block !important; }
<div id="tf_gz_message" style="display: none"><?php printf( __( 'It appears your server doesn\'t load .gz file correctly. Please contact your host provide to fix the issue. As a temporary solution, you may <a href="%s">install this plugin</a> or delete all gz files packed in the theme (which it would load the original scripts).', 'themify' ), 'https://themify.me/files/themify-gzip-cleaner.zip' ); ?> <a class="button button-primary" href="<?php echo add_query_arg( 'tf_clean_gz', 1 ); ?>"><?php _e( 'Remove all GZIP files', 'themify' ); ?></a></div>
<script async src="<?php echo THEMIFY_URI . '/js/admin/litespeed-gzip.min.js'; ?>"></script>
<form id="themify" method="post" action="" enctype="multipart/form-data">
<p id="theme-title"><?php echo esc_html( $check_theme_name ); ?> <em><?php echo esc_html( $check_theme_version ); ?> (<a href="<?php echo themify_https_esc( 'https://themify.org/changelogs/' ); ?><?php echo get_template(); ?>.txt" class="themify_changelogs" target="_blank" rel="noopener" data-changelog="<?php echo themify_https_esc( 'https://themify.org/changelogs/' ); ?><?php echo get_template(); ?>.txt"><?php _e('changelogs', 'themify'); ?></a>)</em></p>
<a href="#" class="save-button"><?php _e('Save', 'themify'); ?></a>
<li class="setting"><a href="#setting"><?php _e( 'Settings', 'themify' ); ?></a></li>
<?php if( $skins_and_demos ) : ?>
<li class="skins"><a href="#skins"><?php _e( 'Skins & Demos', 'themify' ); ?></a></li>
<?php elseif ( ! empty( $themify_skins ) ) : ?>
<li class="skins"><a href="#skins"><?php _e( 'Skins', 'themify' ); ?></a></li>
<li class="transfer"><a href="#transfer"><?php _e( 'Transfer', 'themify' ); ?></a></li>
<?php if( ! $skins_and_demos ) : ?>
<li class="demo-import"><a href="#demo-import"><?php _e( 'Demo Import', 'themify' ); ?></a></li>
<?php if ( themify_allow_update() ) : ?>
<li class="update-check"><a href="#update-check"><?php _e( 'Update', 'themify' ); ?></a></li>