wp_create_nonce('tf_nonce'), 'admin_url' => admin_url( 'admin.php?page=themify' ), 'page_not_found' => esc_html__( 'Page not found', 'themify' ) ); // Settings Panel 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'), 'labels'=>array( 'name'=>__('Themify Username','themify'), 'key'=>__('License Key','themify'), 'update'=>__('Update','themify'), ), 'link'=> sprintf('%s%s%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_utils', false ) ) { $tf_tu_utils = WP_PLUGIN_DIR . '/themify-updater/includes/class.utils.php'; if ( is_readable( $tf_tu_utils ) ) { require_once $tf_tu_utils; } } $license_username = ''; $license_key = ''; $license_hide_name = false; $license_hide_key = false; if ( class_exists( 'Themify_Updater', false ) ) { $themify_updater = Themify_Updater::get_instance(); $license_username = (string) $themify_updater->get_setting( 'username' ); $license_key = (string) $themify_updater->get_setting( 'key' ); $license_hide_name = (bool) $themify_updater->get_setting( 'hideName' ); $license_hide_key = (bool) $themify_updater->get_setting( 'hideKey' ); unset( $themify_updater ); } else { $license_opt = get_option( 'themify_updater_licence', '' ); if ( is_string( $license_opt ) && $license_opt !== '' ) { $license_dec = json_decode( $license_opt, true ); if ( is_array( $license_dec ) ) { $license_username = isset( $license_dec['username'] ) ? preg_replace( '/[^0-9A-Za-z_-]/', '', (string) $license_dec['username'] ) : ''; $license_key = isset( $license_dec['key'] ) ? preg_replace( '/[^0-9A-Za-z]/', '', (string) $license_dec['key'] ) : ''; $license_hide_name = ! empty( $license_dec['hideName'] ); $license_hide_key = ! empty( $license_dec['hideKey'] ); } } } if ( class_exists( 'Themify_Updater_utils', false ) ) { if ( $license_hide_name && $license_username !== '' ) { $license_username = Themify_Updater_utils::preg_replace( $license_username, 'username', '*' ); } if ( $license_hide_key && $license_key !== '' ) { $license_key = Themify_Updater_utils::preg_replace( $license_key, 'key', '*' ); } } $admin_vars['license']['username'] = $license_username; $admin_vars['license']['key'] = $license_key; //used icons 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 ) ) { //Enqueue styles wp_enqueue_style( 'themify-ui' ); wp_enqueue_style( 'themify-metabox' ); if ( is_rtl() ) { wp_enqueue_style( 'themify-ui-rtl' ); } wp_enqueue_style( 'themify-colorpicker' ); //Enqueue scripts 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 Network Settings and increase the value of the Max upload file size.', '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. * * @since 2.0.0 * * @return bool */ function themify_allow_update() { return current_user_can( 'update_themes' ); } /////////////////////////////////////////// // Create Nav Options /////////////////////////////////////////// function themify_admin_nav() { global $submenu; $theme = wp_get_theme(); $name = $theme->display('Name'); $can_manage_option = current_user_can( 'manage_options' ); /** * Add Themify menu entry * @since 2.0.2 */ $themify_page = add_menu_page( 'themify',$name , 'edit_posts', 'themify', $can_manage_option?'themify_page':'', THEMIFY_URI . '/img/favicon.svg', '49.3' ); /** * Add Themify settings page * @since 2.0.2 */ if($can_manage_option){ 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 * @since 2.0.2 */ add_submenu_page ( 'themify', __( 'Saved Layouts', 'themify' ), __( 'Saved Layouts', 'themify' ), 'edit_posts', 'edit.php?post_type=tbuilder_layout' ); /** * Add Themify Builder Layout Parts page * @since 2.0.2 */ add_submenu_page( 'themify', __( 'Layout Parts', 'themify' ), __( 'Layout Parts', 'themify' ), 'edit_posts', 'edit.php?post_type=tbuilder_layout_part' ); /** * Add Themify Global Styles page * @since 4.5.0 */ add_submenu_page ( 'themify', __( 'Global Styles', 'themify' ), __( 'Global Styles', 'themify' ), 'edit_posts', 'themify-global-styles', 'themify_global_styles_page' ); } /** * Add Themify Custom Fonts page * @since 4.6.3 */ add_submenu_page( 'themify', __( 'Custom Fonts', 'themify' ), __( 'Custom Fonts', 'themify' ), 'edit_posts', 'edit.php?post_type=tb_cf' ); /** * Add Themify Customize submenu entry * @since 2.0.2 */ 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 * @since 4.2.2 */ add_submenu_page ( 'themify', __( 'Themify License', 'themify' ), __( 'Themify License', 'themify' ), 'manage_options', 'index.php?page=themify-license' ); } if ( $can_manage_option ) { $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/' ); } else { 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]:''; } /* Pages /***************************************************************************/ function themify_sort_config($themify_config) { $themify_config['panel']['settings']['tab']['theme_settings']['custom-module'][] = array( 'title' => __('Accessibility', 'themify'), 'function' => 'accessibility_options' ); $defaultModules=array( 'general'=>array( array( 'title' => __('Favicon', 'themify'), 'function' => 'favicon', 'target' => 'uploads/favicon/' ), array( 'title' => __('Header Code', 'themify'), 'function' => 'header_html' ), array( 'title' => __('Footer Code', 'themify'), 'function' => 'footer_html' ), array( 'title' => __('Google Analytics', 'themify'), 'function' => 'themify_google_analytics_settings' ), array( 'title' => __('Search Settings', 'themify'), 'function' => 'search_settings' ), array( 'title' => __('Error 404 Page', 'themify'), 'function' => 'page_404_settings' ), array( 'title' => __('Google Fonts', 'themify'), 'function' => 'themify_webfonts_subsets' ), array( 'title' => __('Schema Microdata', 'themify'), 'function' => 'themify_framework_theme_microdata_config_callback' ), array( 'title' => __('Maintenance Mode', 'themify'), 'function' => 'themify_maintenance_mode_settings' ), array( 'title' => __('Feed Settings', 'themify'), 'function' => 'feed_settings' ), array( 'title' => __('Custom Feed URL', 'themify'), 'function' => 'custom_feed_url' ), ), 'performance'=>array( array( 'title' => '', 'function' => 'performance_settings' ) ), 'social_links'=>array( array( 'title' => __('Manage Social Links', 'themify'), 'function' => 'themify_manage_links' ) ), 'image_script'=> array( array( 'title' => __('Image Script Settings', 'themify'), 'function' => 'img_settings' ) ), 'integration-api'=>array( array( 'title' => __('Google Map API Settings', 'themify'), 'function' => 'themify_google_map_key' ), array( 'title' => __('Bing Map API Settings', 'themify'), 'function' => 'themify_bing_map_key' ), array( 'title' => __('Azure Map API Settings', 'themify'), 'function' => 'themify_azure_map_key' ), array( 'title' => __('Cloudflare API Settings', 'themify'), 'function' => 'themify_cloudflare_setting' ), array( 'title' => __('reCaptcha API Settings', 'themify'), 'function' => 'themify_recaptcha_setting' ), array( 'title' => __( 'hCaptcha API Settings', 'themify' ), 'function' => 'themify_hcaptcha_setting' ), array( 'title' => __('Cloudflare Turnstile API Settings', 'themify'), 'function' => 'themify_turnstile_setting' ), // array( //'title' => __('Youtube/Vimeo GDPR', 'themify'), //'function' => 'themify_video_gdpr' // ), ), 'custom-icon-font'=>array( 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'), 'id' => 'general', 'custom-module' =>$defaultModules['general'] ); $themify_config['panel']['settings']['tab']['performance'] = array( 'title' => __('Performance', 'themify'), 'id' => 'performance', 'custom-module' => $defaultModules['performance'] ); $themify_config['panel']['settings']['tab']['social_links'] = array( 'title' => __('Social Links', 'themify'), 'id' => 'social_links', 'custom-module' => $defaultModules['social_links'] ); $themify_config['panel']['settings']['tab']['image_script'] = array( 'title' => __('Image Script', 'themify'), 'id' => 'image_script', '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'] ); unset($defaultModules); $ordered=array(); $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'); foreach($sort as $v){ 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); } /////////////////////////////////////////// // Themify Page /////////////////////////////////////////// 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'])) { $action = 'upgrade'; themify_updater(); } /** * Load themify_config */ $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 $theme = wp_get_theme(); $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 * @since 2.1.8 * @var string */ $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' ); ?>
array( array( 'name' => __( 'Default', 'themify' ), 'version' => null, 'description' => null, 'screenshot' => get_template_directory_uri() . '/themify/img/non-skin.gif', ), ), ); if ( is_dir( $dir ) && ($handle = opendir( $dir ) )) { // Grab Folders while ( false !== ( $dirTwo = readdir($handle) ) ) { if( $dirTwo !== '.' && $dirTwo !== '..' ) { $path = trailingslashit( $dir ) . $dirTwo; if( is_file( $path . '/style.css' ) ) { $info = get_file_data( $path . '/style.css', array( 'Skin Name', 'Version', 'Description', 'Demo URI', 'Required Plugins', 'Display Order' ) ); $order = empty( $info[5] ) ? 10 : $info[5]; $skins[ $order ][ $dirTwo ] = array( 'name' => $info[0], 'version' => $info[1], 'description' => $info[2], 'demo_uri' => $info[3], 'required_plugins' => $info[4], ); } } } closedir($handle); } ksort( $skins ); // sort skin groups ksort( $skins[10] ); // sort by skin name $skins = call_user_func_array( 'array_merge', $skins ); return apply_filters( 'themify_theme_skins', $skins ); } /** * Display the admin field for the theme skins * * @return string */ function themify_get_skins_admin(){ $skins = themify_get_skins(); $output = ''; $template = get_template(); $skins_with_demos = current_theme_supports( 'themify-skins-and-demos' ); if( ! empty( $skins ) ) { $current=themify_get_skin(); $canImport = current_user_can('manage_options'); $hasDemo=current_user_can('delete_pages') && Themify_Import_Helper::has_demo_content(); foreach( $skins as $id => $skin ) { $selected = $current === $id ? 'selected' : ''; $screenshot = 0 === $id ? get_template_directory_uri() . '/themify/img/screenshot-na.png' : 'https://themify.org/public-api/screenshots/' . $template . '/' . $id . '/screenshot.jpg'; if( ($id === 'default' || 0 === $id) &&(!$current || $current==='default')) { $selected = 'selected'; } $output .= ''. sprintf('%s %s', ucfirst($cPost['name']), __('Archive Sidebar', 'themify'));
$val = isset( $data[$prefix.$key.'_archive'] ) ? $data[$prefix.$key.'_archive'] : '';
foreach ( $sidebar_location_options as $option ) {
if ( ( '' == $val || ! $val || ! isset( $val ) ) && ( isset( $option['selected'] ) && $option['selected'] ) ) {
$val = $option['value'];
}
$class = $val == $option['value']?'selected':'';
$w= isset($option['w'])?$option['w']:'46';
$h= isset($option['w'])?$option['w']:'35';
$output .= '';
}
$output .= '
' . sprintf( __( '%s Archive Content Width', 'themify' ), $cPost['name'] ) . '
'. sprintf('%s %s', ucfirst($cPost['name']), __('Single Sidebar', 'themify'));
$val = isset( $data[$prefix.$key.'_single'] ) ? $data[$prefix.$key.'_single'] : '';
foreach ( $sidebar_location_options as $option ) {
if ( ( '' == $val || ! $val || ! isset( $val ) ) && ( isset( $option['selected'] ) && $option['selected'] ) ) {
$val = $option['value'];
}
$class = $val == $option['value']?'selected':'';
$w= isset($option['w'])?$option['w']:'46';
$h= isset($option['w'])?$option['w']:'35';
$output .= '';
}
$output .= '
' . __( 'Default Single Content Width', 'themify' ) . '
' . __( 'Custom Feed URL', 'themify' ) . '
' . __( 'e.g. http://feedburner.com/userid', 'themify' ) . '
' . __('The following code will add to the <head> tag.', 'themify') . '
' . __('Useful if you need to add additional scripts such as CSS or JS.', 'themify') . '
' . __('The following code will be added to the footer before the closing </body> tag.', 'themify') . '
' . __('Useful if you need to Javascript or tracking code.', 'themify') . '
' . __( 'Search in Category IDs', 'themify' ) .themify_help(__( 'Use minus sign (-) to exclude categories. Example: (1,4,-7) = search only in Category 1 & 4, and exclude Category 7.', 'themify' )) . '
'; $pre = 'setting-search_exclude_'; $checkboxes = ''; $exclude_types = apply_filters( 'themify_types_excluded_in_search', get_post_types( array( '_builtin' => false, 'public' => true, 'exclude_from_search' => false ) ) ); foreach ( array_keys( $exclude_types ) as $post_type ) { $type = get_post_type_object( $post_type ); if ( is_object( $type ) ) { $checkboxes .= '
'; } } if ( '' != $checkboxes ) { $out .= $checkboxes; } return apply_filters('themify_search_settings_output', $out); } /////////////////////////////////////////// // 404 Page Settings Module /////////////////////////////////////////// if( !function_exists( 'page_404_settings' ) ){ function page_404_settings(){ $data = themify_get_data(); $page_404 = themify_get( 'setting-page_404','',true ); $max = 100; $args = array( 'sort_order' => 'asc', 'sort_column' => 'post_title', 'post_type' => 'page', 'ignore_sticky_posts'=>true, 'post_status' => 'publish', 'cache_results'=>false, 'update_post_term_cache'=>false, 'update_post_meta_cache'=>false, 'posts_per_page' => $max ); $pages = new WP_Query( $args ); $front = get_option('page_on_front'); $out = '
' . __( 'Custom 404 Page', 'themify' ) .themify_help(__('First create a new Page (eg. 404) and then select it here. The selected page will be used for error 404 (when a URL is not found on your site).', 'themify')). ' '; if($pages->max_num_pages>1){ $post_name = ''; if($page_404){ $post_name = get_post($page_404); if(!empty($post_name)){ $post_name = esc_attr($post_name->post_title); } } $out .= ''; $out .= ''; $out .= ''; } else{ $out.=''; } wp_reset_postdata(); return $out; } } /////////////////////////////////////////// // RSS Feed Settings Module /////////////////////////////////////////// function themify_feed_settings( $data = array() ) { $checked_use = ''; $feed_settings = themify_get( 'setting-feed_settings','',true ); $feed_custom_post = themify_get( 'setting-feed_custom_post','',true ); $custom_posts = array_diff( get_post_types( array('public' => true, 'publicly_queryable' => 'true' ) ) , array('attachment', 'tbuilder_layout', 'tbuilder_layout_part', 'section','tglobal_style') ); $custom_posts_options = ''; if ( 'on' === themify_get( 'setting-exclude_img_rss','',true ) ) { $checked_use = 'checked="checked"'; } if( ! empty( $custom_posts ) ) { array_unshift( $custom_posts, 'all' ); $feed_custom_post_arr = explode( ',', trim( $feed_custom_post ) ); foreach( $custom_posts as $c_post ) { $custom_posts_options .= sprintf( '' , in_array( $c_post, $feed_custom_post_arr ) ? 'selected="selected"' : '' , $c_post , ucfirst( preg_replace( "/[-_]/", ' ', $c_post ) ) ); } } return '
' . __('Feed Category', 'themify') .themify_help(__('Use minus sign (-) to exclude categories.
Example: (2,-9) = include only Category 2 in feeds and exclude Category 9.', 'themify')) . '
' . __('Post Image in RSS', 'themify') .themify_help(__('Check this to exclude post image in RSS feeds', 'themify')) . '
' . __('Custom Posts in RSS', 'themify') .themify_help(__( 'Select "All" to add all available posts in your feed or select the specific ones.', 'themify')) . '
'; } /** * Outputs Image Script module in theme settings. */ function themify_img_settings( $data = array() ) { $feature_sizes = themify_get_image_sizes_list(); $checked_use = ''; $disable = ''; $imaging_library = wp_image_editor_supports(); $imaging_library_error = ''; if ( ! $imaging_library || themify_is_image_script_disabled() ) { $checked_use = "checked='checked'"; if ( ! $imaging_library ) { $disable = ' style="pointer-events: none;"'; $imaging_library_error = '' . __( 'WordPress Gallery', 'themify' ) . '
'; $out .= ''; $out .= '
'. __( 'All links to jpg, png, and gif will open in lightbox.', 'themify' ) .'
'; return $out; } /** * Template to display a link in Links module, also used when creating a link. * @param array $data * @return string * @since 1.2.7 */ function themify_add_link_template( $fid, $data = array(), $ajax = false, $type = 'image-icon' ) { $pre = 'setting-link_'; $type_name = $pre.'type_'.$fid; if ( $ajax ) { $type_val = $type; } else { $type_val = isset($data[$type_name])? $data[$type_name] : 'image-icon'; } $title_name = $pre.'title_'.$fid; $title_val = isset($data[$title_name])? esc_attr(trim($data[$title_name])): ''; $link_name = $pre.'link_'.$fid; $link_val = isset($data[$link_name])? esc_attr(trim($data[$link_name])) : ''; $img_name = $pre.'img_'.$fid; $img_val = ! isset( $data[$img_name] ) || '' == $data[$img_name]? '' : esc_attr($data[$img_name]); $ficon_name = $pre.'ficon_'.$fid; $ficon_val = trim( isset($data[$ficon_name])? esc_attr($data[$ficon_name]) : '' ); $ficolor_name = $pre.'ficolor_'.$fid; $ficolor_val = isset($data[$ficolor_name])? esc_attr($data[$ficolor_name]) : ''; $fibgcolor_name = $pre.'fibgcolor_'.$fid; $fibgcolor_val = isset($data[$fibgcolor_name])? esc_attr($data[$fibgcolor_name]) : ''; /** * TODO: Add appearance checkboxes */ $out = '
'; foreach ( $field_ids as $fid ) { $out .= themify_add_link_template( $fid, $data ); } $out .= '
'; $out .= '' . __('Add Link', 'themify') . '
'; $out .= ''; $out .= ''; //$out .= 'Fields: '.json_encode($field_ids).'
Hash: '.$field_hash.'
'; return $out; } /** * Outputs post meta options * @param string $pmkey Key used to get data from theme settings array * @param array $data Theme settings data * @param array $metas Optional array stating the metas available. * @return string $out Markup for options */ function themify_post_meta_options( $pmkey, $data, $metas = array(), $states = array(), $group_label = false ) { if ( empty($metas ) ) { $metas = array ( '' => __( 'Hide All', 'themify' ), 'author' => __( 'Author', 'themify' ), 'category' => __( 'Category', 'themify' ), 'comment' => __( 'Comment', 'themify' ), 'tag' => __( 'Tag', 'themify' ) ); } if ( empty( $states ) ) { $states = array( array( 'name' => __( 'Hide', 'themify' ), 'value' => 'yes', 'icon' => THEMIFY_URI . '/img/ddbtn-cross.svg', 'title' => __( 'Hide this meta', 'themify' ) ), array( 'name' => __( 'Show', 'themify' ), 'value' => 'no', 'icon' => THEMIFY_URI . '/img/ddbtn-check.svg', 'title' => __( 'Show this meta', 'themify' ) ) ); } if ( ! $group_label ) { $group_label = __( 'Post Meta', 'themify' ); } $default = array( 'name' => __( 'Theme', 'themify' ), 'value' => '', 'icon' => THEMIFY_URI . '/img/ddbtn-blank.png', 'title' => esc_attr(__( 'Use theme settings', 'themify' )) ); $out = '' . __( 'Order By', 'themify' ) . '
' . __( 'Custom Field Key', 'themify' ) . '
' . __( 'Order', 'themify' ) . '
'; return $out; } } if ( ! function_exists( 'themify_homepage_welcome' ) ) { /** * Homepage Welcome Function * @return string Markup for welcome text control */ function themify_homepage_welcome() { return ''; } } if ( ! function_exists( 'themify_exclude_rss' ) ) { /** * Exclude RSS * @return string */ function themify_exclude_rss() { return ''; } } if ( ! function_exists( 'themify_exclude_search_form' ) ) { /** * Exclude Search Form * @return string */ function themify_exclude_search_form() { return ''; } } if( ! function_exists( 'footer_text_settings' ) ) { /** * Footer Text Settings * @return string */ function footer_text_settings() { return '' . __('Footer Text One', 'themify') . '
'; } } if ( ! function_exists( 'themify_footer_text_right' ) ) { /** * Footer Text Right Function * @return string */ function themify_footer_text_right(){ return '' . __('Footer Text Two', 'themify') . '
'; } } if(!function_exists('themify_homepage_widgets')){ /** * Widgets module function * @return string Module markup */ function themify_homepage_widgets(){ $val = themify_get( 'setting-homepage_widgets',false,true ); $options = array( array( 'value' => 'homewidget-4col', 'img' => 'themify/img/sidebars/4col.png', 'title' => __('Widgets 4 Columns', 'themify')), array( 'value' => 'homewidget-3col', 'img' => 'themify/img/sidebars/3col.png', 'title' => __('Widgets 3 Columns', 'themify'), 'selected' => true), array( 'value' => 'homewidget-2col', 'img' => 'themify/img/sidebars/2col.png', 'title' => __('Widgets 3 Columns', 'themify')), array( 'value' => 'homewidget-1col', 'img' => 'themify/img/sidebars/1col.png', 'title' => __('Widgets 1 Column', 'themify')), array( 'value' => 'none', 'img' => 'themify/img/sidebars/none.png', 'title' => __('No Widgets', 'themify')) ); $output = ''; foreach($options as $option){ if(!$val && !empty($option['selected'])){ $val = $option['value']; } $class = $val === $option['value']?' selected':''; $output .= ''; // Numbered pagination $html .= ''; $html .= '
'; return $html; } } /** * Renders Accessibility options * * @return string */ function themify_accessibility_options( $data = array() ) { $key = 'setting-acc_'; $out = ''; // Previous / Next links $html .= ''; $html .= '
' . __( 'Link Focus Outline', 'themify' ) . '
'; $out .= '' . __( 'General Font Size', 'themify' ) . '
'; return $out; } /** * Render the input field to allow uploading font packages * * @return string */ function themify_fontello_input_callback( $data = array() ) { return ''.__('Try to fix it','themify').''; } $tmp.='
' . __( 'Cache Expires', 'themify' ) . '
'; $key='setting-cache-ignore'; $tmp.='' . __( 'Exclude Caching On', 'themify' ) . ''; } $tmp.='
'; $output.='
' . __( 'Development Mode', 'themify' ) .themify_help(__('Warning: the following will be disabled: Themify cache, menu cache, concate CSS caching, Gzip scripts. Only enable this for development purposes (eg. preview child theme CSS/script changes).','themify')) . ''; $output.='
'; if ( $disabled ) { $output .= '
' . __( 'This option is being overriden due to THEMIFY_DEV constant being defined. Try checking wp-config.php.', 'themify' ) . '
'; } unset( $disabled ); $output.=''; $output.=''; $output.=''.__('Warning: the following will be disabled: Themify cache, menu cache, concate CSS caching, Gzip scripts. Only enable this for development purposes (eg. preview child theme CSS/script changes).','themify').''; $output.=''; $output.='
' . __( 'Themify Cache', 'themify' ) .themify_help(__('Caching can reduce page size and server responses (only frontend public viewing will be cached). Themify Cache can not be used with third party cache plugins to avoid conflicts.','themify')) . ' '.$warning.'
'; $output.=''.__('Clear Themify Cache','themify').''; if($isMultiSite){ $output.='
'; } $output.='
' . __( 'Browser Caching', 'themify' ) .themify_help(__("Cache static assets (CSS, JS, images, etc.) on user's browser. HTML is not cached",'themify')) . '
'; $output.='' . __( 'Gzip Scripts', 'themify' ) .themify_help(__('Using Gzip version of scripts can reduce script file size by 60-80%.','themify')) . ' '.$message.'
'; if ( ! wp_image_editor_supports() ) { $message=__('The GD library or Imagick extensions are not installed. Ask your host provider to enable them to use this feature.','themify'); $webp=null; } else{ $message=''; $webp=themify_check( 'setting-webp',true ); if ( $server === 'litespeed' ) { $message = sprintf( __( 'It looks like you are using LiteSpeed server. Please follow this tutorial to enable WebP images on your server.', 'themify' ), 'https://docs.litespeedtech.com/lscache/lscwp/imageopt/' ); $webp = null; } else if ( $server !== 'apache' ) { $message=sprintf(__('It looks like you are using %s server. Please follow this tutorial to enable this feature.','themify'), ucfirst($server),'https://themify.me/docs/enable-webp-nginx-servers'); } } $webp_quality = (int) themify_get( 'setting-webp-quality', '5', true ); $output.=''; $output.='' . __( 'Concate CSS', 'themify' ) . ' '.__('Clear Concate & Builder CSS Cache','themify').' '; if(!Themify_Enqueue_Assets::createDir()){ $output.=''.__('It looks like the WordPress upload folder path is set wrong or have file permission issue. Please check the upload path on WP Settings > Media. Make sure the folder is set correctly and it has correct file permission.','themify').''; } elseif($isMultiSite){ $output.='
'; $key='setting-cache-menu'; $output.=''; } $output.='
' . __( 'WordPress Menus Cache', 'themify' ) .themify_help(__('Caching WordPress menus can reduce queries. Will only work when there is no active cache plugin. If you have server cache, you can disable this feature.', 'themify')) . ''; if ( defined( 'POLYLANG_VERSION' ) ) { $output .= '' . __( 'Themify menu cache has been disabled because Polylang is detected and it can not work with menu caching.', 'themify' ) . ''; } else { $output .= ''; } $output .= '
' . __( 'WebP Image', 'themify' ) .themify_help(__('Using WebP image format can reduce file size by 50-90%. Only local images will be converted. The CDN and external images can not be converted. For background images of Themify Builder, you have to regenerate CSS and .htaccess file must be writeable.','themify')) . '
' . __( 'WebP Image Quality', 'themify' ) . themify_help( __( 'Lower quality has smaller file size, but image might appear pixelated/blurry.', 'themify' ) ) . '
'.__('Clear WebP Images','themify').''; if($message!==''){ $output.=''.$message.''; } $key='setting-jquery'; $output.='' . __( 'jQuery Script', 'themify' ) .themify_help(__('Defer jQuery and all scripts can prevent render blocking. If your site/plugin(s) have inline jQuery code conflicting it, disable this option.','themify')) . '
'; $key = 'setting-jquery-migrate'; $output.='' . __( 'jQuery Migrate', 'themify' ) .themify_help(__('Only enable this if your plugin(s) use the deprecated jQuery versions.','themify')) . '
'; if(themify_is_woocommerce_active()){ $key='setting-optimize-wc'; $output.='' . __( 'WooCommerce Script Optimization', 'themify' ) .themify_help(__('Themify loads WooCommerce scripts on demand for faster page load. If you are encountering issues with third party WooCommerce extensions, try to disable WooCommerce script optimization.','themify')) . '
'; $key='setting-defer-wc'; $output.='' . __( 'WooCommerce Script Defer', 'themify' ) .themify_help(__('WooCommerce scripts are deferred for faster page load. If you are encountering issues with third party WooCommerce extensions, try to disable script defer.','themify')) . '
' . __( 'WordPress Emoji', 'themify' ) .themify_help(__('If you are not using WordPress Emoji icons, keep it disabled to reduce script load.','themify')) . '
'; return $output; } } if(!function_exists('themify_webfonts_subsets')) { /** * Module to specify additional characters subsets * @param array Themify data * @return string Module markup * @since 1.3.9 */ function themify_webfonts_subsets($data = array()){ $html=''; // List of fonts, recommended or full if(!defined('THEMIFY_GOOGLE_FONTS') || THEMIFY_GOOGLE_FONTS == true){ $key = 'setting-gf'; $html='' . __( 'Download Google Fonts', 'themify' ) .' '.__('Downloads all Google Fonts used in the theme and Builder to your local server. Note: Google Maps, YouTube and any embeds loaded in iframe are excluded as they are loaded in the iframe.','themify').' '; $html.='
'.__('Clear Google Fonts Cache','themify').'
'; } $key = 'setting-webfonts_list'; $html.= '
' . __('Google Fonts List', 'themify') . ''; // Disable Google fonts $html .= '
'; return $html; } } /** * Renders the option to responsive design * * @since 2.1.5 * @return string */ function themify_disable_responsive_design_option( $data = array() ) { $out = sprintf( ''; // Recommended list $html .= '
'; // Full list $html .= '
%s
', esc_html__( 'Responsive Breakpoints:', 'themify' ) ); $opt_data = themify_get_data(); $break_points = themify_get_breakpoints('',true); $pre = 'setting-customizer_responsive_design_'; $bp_tablet_landscape = !empty( $opt_data[ $pre . 'tablet_landscape'] ) ? $opt_data[ $pre . 'tablet_landscape'] : 1024; $bp_tablet = !empty( $opt_data[ $pre . 'tablet'] ) ? $opt_data[ $pre . 'tablet'] : 768; $bp_mobile =!empty( $opt_data[ $pre . 'mobile'] ) ? $opt_data[ $pre . 'mobile'] : 600; $out .= sprintf( '' . __( 'Mobile Menu', 'themify' ) .themify_help(__( 'Main menu will toggle to mobile menu style when viewport width meets the entered value.', 'themify' )) . ' ' . __( 'Mobile menu viewport (px)', 'themify' ) .'
'; return $out; } if ( ! function_exists( 'themify_generic_slider_controls' ) ) { /** * Creates a general module to setup slider parameters * @param $prefix * @return string */ function themify_generic_slider_controls( $prefix ) { /** * Associative array containing theme settings * @var array */ $auto_options = apply_filters( 'themify_generic_slider_auto', array( __('4 Secs (default)', 'themify') => 4000, __('Off', 'themify') => 'off', __('1 Sec', 'themify') => 1000, __('2 Secs', 'themify') => 2000, __('3 Secs', 'themify') => 3000, __('4 Secs', 'themify') => 4000, __('5 Secs', 'themify') => 5000, __('6 Secs', 'themify') => 6000, __('7 Secs', 'themify') => 7000, __('8 Secs', 'themify') => 8000, __('9 Secs', 'themify') => 9000, __('10 Secs', 'themify')=> 10000 ) ); $speed_options = apply_filters( 'themify_generic_slider_speed', array( __('Fast', 'themify') => 500, __('Normal', 'themify') => 1000, __('Slow', 'themify') => 1500 ) ); $effect_options = array( array('name' => __('Slide', 'themify'), 'value' => 'slide'), array('name' => __('Fade', 'themify'), 'value' =>'fade') ); /** * Auto Play */ $output = '' . __('Auto Play', 'themify') . '
'; /** * Effect */ $output .= '' . __( 'Effect', 'themify' ) . '
'; /** * Transition Speed */ $output .= '' . __( 'Transition Speed', 'themify' ) . '
'; return apply_filters( 'themify_generic_slider_controls', $output ); } } /** * Display select element with featured image sizes + blank slot * @param String $key setting name * @return String * @since 1.1.5 */ function themify_feature_image_sizes_select($key = ''){ /** Define WP Featured Image sizes + blank + Themify's image script * @var array */ $themify_layout_feature_sizes = themify_get_image_sizes_list(); $output = '' . __('Featured Image Size', 'themify') . '
'; return $output; } if ( ! function_exists( 'themify_theme_mega_menu_controls' ) ) { /** * Mega Menu Controls * @param array $data Theme settings data * @return string Markup for module. * @since 3.5.8 */ function themify_theme_mega_menu_controls( $data = array() ) { /** * Theme Settings Option Key Prefix * * @var string */ $key = 'setting-mega_menu'; $orderby = [ 'date' => __('Date', 'ptb'), 'id' => __('Id', 'ptb'), 'author' => __('Author', 'ptb'), 'title' => __('Title', 'ptb'), 'name' => __('Name', 'ptb'), 'modified' => __('Modified', 'ptb'), 'rand' => __('Random', 'ptb'), 'comment_count' => __('Comment count', 'ptb'), 'menu_order' => __('Menu Order', 'ptb') ]; /** * Module markup * @var string */ $out = '' . __( 'Mega Menu Posts', 'themify' ) .themify_help(__( 'Number of posts to show on mega menu.', 'themify' )) . ' ' . __( 'Posts', 'themify' ) .'
'; $out .= '' . __( 'Mega Menu Posts Order', 'themify' ) . '
'; $out .= '' . __( 'Mega Post Image', 'themify' ) .themify_help(__( 'Enter featured image size on mega menu posts.', 'themify' )) . ' X ' . __( 'px', 'themify' ) .'
'; return apply_filters('themify_mega_menu_settings',$out); } } /** * Display google map api key input * @return String * @since 2.7.7 */ function themify_google_map_key($data=array()){ $value = themify_get( 'setting-google_map_key','',true); $validate = !empty($value) && strip_tags( $value ) !== $value ? sprintf( '%s
' . __( 'Google Map Key', 'themify' ) . '
'; } /** * Display bing map api key input * @return String * @since 2.8.0 */ function themify_bing_map_key($data=array()){ $value = themify_get( 'setting-bing_map_key','',true ); $validate = !empty($value) && strip_tags( $value ) !== $value ? sprintf( '' . '' . sprintf( __( 'Google API key is required to use Builder Map module and Map shortcode. Generate an API key and insert it here. Also, please ensure you\'ve setup a billing plan.', 'themify' ), '//developers.google.com/maps/documentation/javascript/get-api-key#key', 'https://support.google.com/googleapi/answer/6158867' ) . '' . $validate . '
%s
' . __( 'Bing Maps Key', 'themify' ) . '
'; } function themify_azure_map_key($data=array()){ $value = themify_get( 'setting-azure_map_key','',true ); $validate = !empty($value) && strip_tags( $value ) !== $value ? sprintf( '' . sprintf( __( 'To use Bing Maps, generate an API key and insert it here.', 'themify' ), 'https://msdn.microsoft.com/en-us/library/ff428642.aspx' ) . '' . $validate . $dep_notice . '
%s
' . __( 'Azure Subscription Key', 'themify' ) . '
'; return $output; } /** * Display Cloudflare api key input * @return String * @since 2.8.0 */ function themify_cloudflare_setting($data=array()){ $key='setting-clf_email'; $email=themify_get( $key,'',true ); $output = ''; $output .= '
' . __( 'To get your key:', 'themify' ) . '
'; $output .= '- ' . sprintf( __( 'Sign in to Azure portal', 'themify' ), 'https://portal.azure.com/' ) . '
';
$output .= '- ' . sprintf( __( 'Create an Azure Map resource if you haven\'t already.', 'themify' ), 'https://learn.microsoft.com/en-us/azure/azure-maps/quick-demo-map-app#create-an-azure-maps-account' ) . '
';
$output .= '- ' . sprintf( __( 'Get your subscription key (Primary Key) and paste it here.', 'themify' ), 'https://learn.microsoft.com/en-us/azure/azure-maps/quick-demo-map-app#get-the-subscription-key-for-your-account' ) . '
';
$output .= '
' . $validate . '' . __( 'Account Email', 'themify' ) . '
'; $key='setting-clf_key'; $api=themify_get( $key,'',true ); $validate = !empty($api) && strip_tags( $api ) !== $api ? sprintf( '%s
' . __( 'API Key', 'themify' ) . ' ' . $validate . '
'; $key='setting-clf_z_'.crc32($email.$api); $zone=themify_get( $key,'',true ); if(!empty($zone)){ $output .= ''; } $output .= '' . __( 'To clear Cloudflare cache upon theme update or purge Themify cache, please login to your Cloudflare account and insert your information here.', 'themify' ) . '
'; return $output; } /** * Display recaptcha api key input */ function themify_recaptcha_setting($data=array()) : string { $version=Themify_Builder_Model::getReCaptchaOption( 'version'); $options=''; for($i=2;$i<4;$i++){ $selected = $version=='v'.$i?' selected="selected"':''; $options.=''; } $public_key = Themify_Builder_Model::getReCaptchaOption( 'public_key' ); $private_key = Themify_Builder_Model::getReCaptchaOption( 'private_key' ); $output='' . __( 'ReCaptcha Version', 'themify' ) . '
'; $validate = !empty($public_key) && strip_tags( $public_key ) !== $public_key ? sprintf( '%s
' . __( 'ReCaptcha Site Key', 'themify' ) . ' ' . $validate . '
'; $validate = !empty($private_key) && strip_tags( $private_key ) !== $private_key ? sprintf( '%s
' . __( 'ReCaptcha Secret Key', 'themify' ) . '
'; return $output; } /** * Display hcaptcha api key input */ function themify_hcaptcha_setting($data=array()) : string { $secret_key = themify_builder_get( 'setting-hcaptcha_secret', 'hcaptcha_secret' ); $site_key = themify_builder_get( 'setting-hcaptcha_site', 'hcaptcha_site' ); $validate = !empty($secret_key) && strip_tags( $secret_key ) !== $secret_key ? sprintf( ''.sprintf( __( 'Go to reCAPTCHA Admin Console to create API keys for your domain. A Google account is required.', 'themify' ), 'https://www.google.com/recaptcha/admin' ).' ' . $validate . '
%s
' . __( 'hCaptcha Secret Key', 'themify' ) . '
'; $validate = !empty($site_key) && strip_tags( $site_key ) !== $site_key ? sprintf( '' . sprintf( __( 'You can find the secret key on your hCaptcha profile page.', 'themify' ), 'https://dashboard.hcaptcha.com/settings' ) . ' ' . $validate . '
%s
' . __( 'hCaptcha Site Key', 'themify' ) . '
'; return $output; } /** * Display Cloudflare Turnstile api key input */ function themify_turnstile_setting($data=array()) : string { $secret_key = themify_builder_get( 'setting-turnstile_secret', 'turnstile_secret' ); $site_key = themify_builder_get( 'setting-turnstile_site', 'turnstile_site' ); $validate = !empty($secret_key) && strip_tags( $secret_key ) !== $secret_key ? sprintf( '' . sprintf( __( 'You can find the site key from the sites page on your hCaptcha profile. Note that you also need to add your site domain(s) in the site key.', 'themify' ), 'https://dashboard.hcaptcha.com/sites' ) . ' ' . $validate . '
%s
' . __( 'Secret Key', 'themify' ) . ' ' . $validate . '
'; $validate = !empty($site_key) && strip_tags( $site_key ) !== $site_key ? sprintf( '%s
' . __( 'Site Key', 'themify' ) . '
'; return $output; } /** * Display video gdpr * @return String */ function themify_video_gdpr($data=array()){ $key='setting-gdpr'; $imgKey=$key.'-img'; $media=array( 'fields' => $imgKey, 'medialib'=>1, 'preview' => true ); $imgVal=themify_get( $imgKey,'',true ); $output = '' . sprintf( __( 'Get API keys at Cloudflare Dashboard > Application Security > Turnstile (more info).', 'themify' ), 'https://developers.cloudflare.com/turnstile/get-started/#get-a-sitekey-and-secret-key' ) . ' ' . $validate . '
' . __( 'Once it is enabled, only logged-in users can see your site.', 'themify' ) . '
'; $output .= '' . __( 'Once it is enabled, only logged-in users can see your site.', 'themify' ) . '
'; $message = themify_builder_get( 'setting-maintenance_message', 'tools_maintenance_message' ); $output .= '' . __( 'Measurement ID', 'themify' ) . '
'; } /** * Callback for themify_framework_theme_microdata_config(), to display the options * * @return string */ function themify_framework_theme_microdata_config_callback() { return '' . sprintf( __( 'Set up Analytics for your website. Afterwards, go to your Analytics admin dashboard and select Data Streams, click on the item you want, then copy the Measurement ID (starts with "G-") and paste it here.', 'themify' ), 'https://support.google.com/analytics/answer/9304153', 'https://support.google.com/analytics/answer/6132368' ) . '
' . __('Schema Microdata', 'themify') . '
'; } /** * Display Builder Styles page content * @return String * @since 4.5.0 */ function themify_global_styles_page(){ if ( ! current_user_can( 'edit_posts' ) ) wp_die( __( 'You do not have sufficient permissions to update this site.', 'themify' ) ); return Themify_Global_Styles::page_content(); } /////////////////////////////////////////// // Scrub Function /////////////////////////////////////////// function themify_scrub_func($string=''){ return str_replace(array(' ', '/', ','), array('_', '_', '-'), strtolower($string)); } /////////////////////////////////////////// // Scrub /////////////////////////////////////////// function themify_scrub($string=''){ return str_replace(array('#','-',' ','.',':',',','[',']','=','<','>'), array('_id_','_dash_','_space_','_class_','_colon_','_comma_','_opensquare_','_closesquare_','_equal_','_openbracket_','_closebracket_'), $string); } /** * Check if multiple plugins are active, returns true only if all of them are * * @return bool * @since 2.8.6 */ function themify_are_plugins_active( $plugins ) { foreach( $plugins as $plugin ) { if( ! is_plugin_active( $plugin ) ) { return false; } } return true; } if ( ! function_exists( 'themify_lightbox_link_field' ) ) { /** * Returns Lightbox Link field definition for themify custom panel * @return array */ function themify_lightbox_link_field( $args = array() ) { $defaults = array( 'name' => 'multi_lightbox_link', 'title' => __('Lightbox Link', 'themify'), 'description' => '', 'type' => 'multi', 'meta' => array( 'fields' => array( // Lightbox link field array( 'name' => 'lightbox_link', 'label' => '', 'description' => __('Link Featured Image and Post Title to lightbox image, video or iframe URL(learn more)', 'themify'), 'type' => 'textbox', 'meta' => array(), 'before' => '', 'after' => '', ), array( 'name' => 'iframe_url', 'label' => __('iFrame URL', 'themify'), 'description' => '', 'type' => 'checkbox', 'before' => '', 'after' => '', ), array( 'name' => 'lightbox_icon', 'label' => __('Add zoom icon on lightbox link', 'themify'), 'description' => '', 'type' => 'checkbox', 'before' => '', 'after' => '', ) ), 'description' => '', 'before' => '', 'after' => '', 'separator' => '' ) ); $field = wp_parse_args( $args, $defaults ); return apply_filters( 'themify_lightbox_link_field', $field ); } } if( ! function_exists( 'themify_image_dimensions_field' ) ) { /** * Multi field: Image dimensions fields to enter width and height. * @param array $args * @param string $prefix * @return mixed|void * @since 1.5.2 */ function themify_image_dimensions_field( $args = array(), $prefix = 'image' ) { if(!themify_is_image_script_disabled()){ $defaults = array( 'type' => 'multi', 'name' => $prefix . '_dimensions', 'title' => __('Featured Image Size', 'themify'), 'meta' => array( 'fields' => array( // Image Width array( 'name' => $prefix . '_width', 'label' => __('width', 'themify'), 'description' => '', 'type' => 'textbox', 'meta' => array('size' => 'small') ), // Image Height array( 'name' => $prefix . '_height', 'label' => __('height', 'themify'), 'type' => 'textbox', 'meta' => array( 'size' => 'small') ), ), 'description' => __('Enter height = 0 to disable vertical cropping with image script enabled', 'themify'), 'before' => '', 'after' => '', 'separator' => '' ) ); } else { $defaults = array( 'name'=>'','type'=>'' ); } $field = wp_parse_args( $args, $defaults ); return apply_filters( 'themify_image_dimensions_field', $field ); } } /** * Returns a collection of options: yes, no and default which means the theme settings will be used. * * @since 2.1.3 * * @param string $yes * @param string $no * @param string $default * @param array $args * * @return array */ function themify_ternary_options( $yes = '', $no = '', $default = '', $args = array() ) { return wp_parse_args( $args, array( array( 'value' => 'default', 'name' => !empty( $default ) ? $default : __( 'Default', 'themify' ), 'selected' => true ), array( 'value' => 'yes', 'name' => !empty( $yes ) ? $yes : __( 'Yes', 'themify' ), ), array( 'value' => 'no', 'name' => !empty( $no ) ? $no : __( 'No', 'themify' ), ), )); } /** * Returns a collection of states: yes, no and default which means the theme settings will be used. * * @since 2.1.3 * * @param string $yes * @param string $no * @param string $default * @param array $args * * @return array */ function themify_ternary_states( $args = array(), $all = array() ) { $args = wp_parse_args( $args, array( 'icon_yes' => THEMIFY_URI . '/img/ddbtn-check.svg', 'icon_no' => THEMIFY_URI . '/img/ddbtn-cross.svg', 'value_default' => '', ) ); return wp_parse_args( $all, array( array( 'name' => empty( $args['label_yes'] ) ? __('Hide', 'themify') : $args['label_yes'], 'value' => 'yes', 'icon' => $args['icon_no'], 'title' => __('Hide this', 'themify') ), array( 'name' => empty( $args['label_no'] ) ? __('Show', 'themify') : $args['label_no'], 'value' => 'no', 'icon' => $args['icon_yes'], 'title' => __('Show this', 'themify') ), array( 'name' => empty( $args['default'] ) ? __('Theme default', 'themify') : $args['default'], 'value' => $args['value_default'], 'icon' => THEMIFY_URI . '/img/ddbtn-blank.png', 'title' => __('Use theme settings', 'themify'), 'default' => true ) )); } if( ! function_exists( 'themify_multi_meta_field' ) ) { /** * Definition for tri-state hide meta buttons * * @param array $args * @param string $prefix * * @return mixed|void * @since 1.5.2 */ function themify_multi_meta_field( $args = array(), $prefix = 'hide_meta' ) { $states = themify_ternary_states( array( 'label_no' => __('Show', 'themify') ) ); $defaults = array( 'name' => $prefix . '_multi', 'title' => __('Post Meta', 'themify'), 'description' => '', 'type' => 'multi', 'meta' => array ( 'fields' => array( array( 'name' => $prefix . '_all', 'title' => __('Hide All', 'themify'), 'description' => '', 'type' => 'dropdownbutton', 'states' => $states, 'main' => true, 'disable_value' => 'yes' ), array( 'name' => $prefix . '_author', 'title' => __('Author', 'themify'), 'description' => '', 'type' => 'dropdownbutton', 'states' => $states, 'sub' => true ), array( 'name' => $prefix . '_category', 'title' => __('Category', 'themify'), 'description' => '', 'type' => 'dropdownbutton', 'states' => $states, 'sub' => true ), array( 'name' => $prefix . '_comment', 'title' => __('Comment', 'themify'), 'description' => '', 'type' => 'dropdownbutton', 'states' => $states, 'sub' => true ), array( 'name' => $prefix . '_tag', 'title' => __('Tag', 'themify'), 'description' => '', 'type' => 'dropdownbutton', 'states' => $states, 'sub' => true ), ), 'description' => '', 'before' => '', 'after' => '', 'separator' => '' ) ); $field = wp_parse_args( $args, $defaults ); return apply_filters( 'themify_multi_meta_field', $field ); } } function themify_meta_field_fontawesome( $args, $call_before_after = true, $echo = true ) { $meta_box = $args['meta_box']; $meta_value = $args['meta_value']; $class = isset( $meta_box['meta']['size'] ) && 'small' === $meta_box['meta']['size']?'small': ''; $html = '
'.__('Themify:','themify').'
'.__('It looks like the WordPress upload folder path is set wrong or have file permission issue. Please check the upload path on WP Settings > Media. Make sure the folder is set correctly and it has correct file permission.','themify').'
'; if ( current_user_can( 'manage_options' ) && class_exists( 'Themify_System_Status', false ) ) { $dismiss_url = Themify_System_Status::get_optional_notice_dismiss_url( 'updir' ); if ( $dismiss_url ) { echo '' . esc_html__( 'Dismiss (do not show again)', 'themify' ) . '
'; } } echo '