ID, $builder_var, true)) !== '') { return $val; } return null; } } if ( ! function_exists( 'themify_builder_check' ) ) { function themify_builder_check(string $theme_var, $builder_var = false, bool $data_only = true ):bool { $val = \themify_builder_get( $theme_var, $builder_var, $data_only ); return $val !== null && $val !== '' && $val !== 'off'; } } /** * Init themify builder class */ add_action('after_setup_theme', 'themify_builder_init', 15); function themify_builder_init() { if ( \class_exists( 'Themify_Builder',false ) && \Themify_Builder_Model::builder_check() ) { do_action( 'themify_builder_before_init' ); global $ThemifyBuilder;//deprecated $ThemifyBuilder = new Themify_Builder();//deprecated add_action( 'init', array( 'Themify_Builder','init' ), 0 ); /* WPML custom field translation, has to load early */ add_action( 'wpml_load_page_builders_integration', [ 'Themify_Builder', 'wpml_load_page_builders_integration' ] ); } } if (!function_exists('themify_manage_builder')) { /** * Builder Settings * @param array $data * @return string * @since 1.2.7 */ function themify_manage_builder($data = array()):string{ $data = themify_get_data(); $pre = 'setting-page_builder_'; $output='
'; $modules=Themify_Builder_Component_Module::load_modules('all'); foreach ($modules as $k=>$m) { $name= is_string($m)?$m::get_module_name():$m->get_name(); $exclude = $pre . 'exc_' . $k; $checked = !empty($data[$exclude]) ? 'checked="checked"' : ''; $output .= '

'; } $output.='
'; return $output; } } if (!function_exists('tb_tools_options')) { /** * Call and return all tools options HTML * @return string posts id * @since 4.1.2 */ function tb_tools_options():string { return '
'.tb_find_and_replace().themify_regenerate_css_files().'
'; } } if (!function_exists('themify_regenerate_css_files')) { /** * Builder Settings * @param array $data * @return string * @since 1.2.7 */ function themify_regenerate_css_files($data = array()):string { $output = '

'.__('Regenerate CSS Files','themify').'

'; $output .= '
'; if(is_multisite()){ $output.='
'; } return $output; } } if (!function_exists('tb_find_and_replace')) { /** * Add find and replace string tool to builder setting * @param array $data * @return string * @since 4.1.2 */ function tb_find_and_replace($data = array()):string { $in_progress = '1' === Themify_Storage::get( 'themify_find_and_replace_in_progress' ); $disabled = $in_progress ? 'disabled="disabled"' : ''; $value = $in_progress ? __('Replacing ...','themify') : __('Replace','themify'); $output = '

'.__('Search & Replace URLs','themify').'

'; $output .= '

' . __( 'Search for', 'themify' ) . '

'; $output .= '

' . __( 'Replace to', 'themify' ) .themify_help(__('Use this tool to replace the URLs in the Builder content. Warning: Please backup your database before replacing URLs, this can not be undone.', 'themify')) . '

'; $output .= '

'; return $output; } } if (!function_exists('themify_manage_builder_active')) { /** * Builder Settings * @param array $data * @return string * @since 1.2.7 */ function themify_manage_builder_active($data = array()):string { $pre = 'setting-page_builder_'; $options = array( array('name' => __('Enable', 'themify'), 'value' => 'enable'), array('name' => __('Disable', 'themify'), 'value' => 'disable') ); $output = sprintf('

%s%s

', esc_html__('Themify Builder:', 'themify'), $pre . 'is_active', $pre . 'is_active', themify_options_module($options, $pre . 'is_active'), sprintf('%s' , esc_html__('WARNING: When Builder is disabled, all Builder content/layout will not appear. They will re-appear once Builder is enabled.', 'themify')) ); if (Themify_Builder_Model::builder_check()) { $output .= '
'; $excludes =array(Themify_Builder_Layouts::LAYOUT_SLUG, Themify_Builder_Layouts::LAYOUT_PART_SLUG,Themify_Global_Styles::SLUG, 'tbp_template'); foreach( Themify_Builder::builder_post_types_support() as $v ) { if(in_array($v,$excludes,true)){ continue; } $key = $pre.'disable_'.$v; $output .= sprintf('

', $key, $key, $key, checked('on', themify_builder_get($key, 'builder_disable_tb_'.$v), false), sprintf(__('Disable Builder on "%s" type', 'themify'), $v)); } $output .= sprintf('

',$pre . 'disable_shortcuts', $pre . 'disable_shortcuts', $pre . 'disable_shortcuts', checked('on', themify_builder_get($pre . 'disable_shortcuts', 'builder_disable_shortcuts'), false), wp_kses_post(__('Disable Builder shortcuts (eg. disable shortcut like Cmd+S = save)', 'themify')) ); // Disable WP editor $output .= sprintf('

', $pre . 'disable_wp_editor', $pre . 'disable_wp_editor', $pre . 'disable_wp_editor', checked('on', themify_builder_get($pre . 'disable_wp_editor', 'builder_disable_wp_editor'), false), wp_kses_post(__('Disable WordPress editor when Builder is in use', 'themify')) ); /** * Scroll to Offset */ $output .= '

'. '' . __('ScrollTo Position', 'themify') .themify_help(__('Enter the top position where row anchor should scrollTo', 'themify')) . ''. ' ' . '

'; $output .= '

'. '' . __('ScrollTo Speed', 'themify') .themify_help(__('Speed of scrolling animation. Default: 0.9 second', 'themify')) . ''. ' ' . __( 'Seconds', 'themify' ) . '

'; $output .= sprintf( '

%s

', esc_html__('Gallery Module Lightbox', 'themify'), $pre . 'gallery_lightbox', $pre . 'gallery_lightbox', themify_options_module($options, $pre . 'gallery_lightbox') ); $gutters=Themify_Builder_Model::get_gutters(); $gutters=array( 'gutter'=>array('label'=>__('Normal ','themify'),'def'=>$gutters['gutter']), 'narrow'=>array('label'=>__('Narrow ','themify'),'def'=>$gutters['narrow']), 'none'=>array('label'=>__('None','themify'),'def'=>$gutters['none']) ); $output.='
' .__('Column Gutter','themify') . '
'; $output.='
'; foreach($gutters as $k=>$v){ $k='setting-'.$k; $val=themify_builder_get($k); if($val===null ||$val===''){ $val=$v['def']; } $output .=''; } $output.='
'; } return $output; } } if (!function_exists('themify_manage_builder_animation')) { /** * Builder Setting Animations * @param array $data * @return string * @since 2.0.0 */ function themify_manage_builder_animation($data = array()):string { $pre = 'setting-page_builder_animation_'; $options = array( array('name' => '', 'value' => 'none'), array('name' => esc_html__('Disable on mobile & tablet', 'themify'), 'value' => 'mobile'), array('name' => esc_html__('Disable on all devices', 'themify'), 'value' => 'all') ); $output='
'; $output.= sprintf('

', $pre . 'appearance', esc_html__('Entrance Animation', 'themify'), $pre . 'appearance', $pre . 'appearance', themify_options_module($options, $pre . 'appearance') ); $output .= sprintf('

', $pre . 'parallax_bg', esc_html__('Parallax Background', 'themify'), $pre . 'parallax_bg', $pre . 'parallax_bg', themify_options_module($options, $pre . 'parallax_bg') ); $output .= sprintf('

', $pre . 'scroll_effect', esc_html__('Scroll Effects', 'themify'), $pre . 'scroll_effect', $pre . 'scroll_effect', themify_options_module($options, $pre . 'scroll_effect', true) ); $output .= sprintf('

', $pre . 'sticky_scroll', esc_html__('Sticky Scrolling', 'themify'), $pre . 'sticky_scroll', $pre . 'sticky_scroll', themify_options_module($options, $pre . 'sticky_scroll') ); $output.='
'; return $output; } } /** * Add Builder to all themes using the themify_theme_config_setup filter. * @param $themify_theme_config * @return mixed * @since 1.4.2 */ function themify_framework_theme_config_add_builder(array $themify_theme_config):array { $themify_theme_config['panel']['settings']['tab']['page_builder'] = array( 'title' => __('Themify Builder', 'themify'), 'id' => 'themify-builder', 'custom-module' => array( array( 'title' => __('Themify Builder Options', 'themify'), 'function' => 'themify_manage_builder_active' ) ) ); if(Themify_Builder_Model::builder_check()){ $themify_theme_config['panel']['settings']['tab']['integration-api']['custom-module'][] = array( 'title' => __('Optin', 'themify'), 'function' => 'themify_setting_optin', ); $themify_theme_config['panel']['settings']['tab']['page_builder']['custom-module'][] = array( 'title' => __('Animation Effects', 'themify'), 'function' => 'themify_manage_builder_animation' ); $themify_theme_config['panel']['settings']['tab']['page_builder']['custom-module'][] = array( 'title' => __('Builder Modules', 'themify'), 'function' => 'themify_manage_builder' ); $themify_theme_config['panel']['settings']['tab']['page_builder']['custom-module'][] = array( 'title' => __('Tools', 'themify'), 'function' => 'tb_tools_options' ); } return $themify_theme_config; } add_filter( 'themify_theme_config_setup', 'themify_framework_theme_config_add_builder', 11 ); function themify_setting_optin() { $providers = Builder_Optin_Service::get_providers('all',true); $clear=isset( $_GET['tb_option_flush_cache'] ); ob_start(); foreach ( $providers as $id => $provider ) { if ( $clear===true ) { $provider::clear_cache(); } if ( $options = $provider::get_global_options() ) { ?>

>