function us_is_vc_fe() { if (function_exists('vc_mode') and in_array(vc_mode(), array('page_editable', 'admin_frontend_editor', 'admin_page'))) { return TRUE; } else { return FALSE; } }
public function init() { $this->addHooks(); /** * If current mode of VC is frontend editor load it. */ if(vc_is_frontend_editor()) { vc_frontend_editor()->hookLoadEdit(); } elseif(vc_mode() === 'page_editable') { /** * if page loaded inside frontend editor iframe it has page_editable mode. * It required to some some js/css elements and add few helpers for editor to be used. */ $this->buildEditablePage(); } else { // Is it is simple page just enable buttons and controls $this->buildPage(); } }
/** * Add filter for yoast. * @since 4.4 */ public function load() { if (class_exists('WPSEO_Metabox') && (vc_mode() == 'admin_page' || vc_mode() === 'admin_frontend_editor')) { add_filter('wpseo_pre_analysis_post_content', array(&$this, 'filterResults')); //add_action( 'vc_frontend_editor_render_template', array( &$this, 'addSubmitBox' ) ); } }
/** * Add filter for yoast. * @since 4.4 */ public function load() { if (class_exists('WPSEO_Metabox') && (vc_mode() == 'admin_page' || vc_mode() === 'admin_frontend_editor')) { add_filter('wpseo_pre_analysis_post_content', array(&$this, 'filterResults')); add_action('vc_frontend_editor_render_template', array(&$this, 'addSubmitBox')); } // removed due to woocommerce fatal error :do_shortcode in is_admin() mode = fatal error }
/** * @since 4.2 * @return bool */ function vc_is_page_editable() { return 'page_editable' === vc_mode(); }
* add action in admin for vc grid item editor manager */ add_action('init', 'vc_grid_item_editor_create_post_type'); add_action('admin_init', 'vc_grid_item_editor_init'); add_action('vc_after_init', 'vc_grid_item_editor_shortcodes'); /** * Call preview as ajax request is called. */ add_action('wp_ajax_vc_gitem_preview', 'vc_grid_item_render_preview', 5); /** * Add vc grid item to the list of the excluded post types for enabling Vc editor. * * Called with with 'vc_settings_exclude_post_type' action. * @deprecated */ if (vc_mode() === 'admin_settings_page') { add_filter('vc_settings_exclude_post_type', 'vc_grid_item_vc_settings_exclude'); } /** * Add WP ui pointers in grid element editor. */ if (is_admin()) { add_filter('vc_ui-pointers-vc_grid_item', 'vc_grid_item_register_pointer'); } function vc_grid_item_register_pointer($p) { $screen = get_current_screen(); if ('add' === $screen->action) { $p['vc_grid_item'] = array('name' => 'vcPointersController', 'messages' => array(array('target' => '#vc_templates-editor-button', 'options' => array('content' => sprintf('<h3> %s </h3> <p> %s </p>', __('Start Here!', 'js_composer'), __('Start easy - use predefined template as a starting point and modify it.', 'js_composer')), 'position' => array('edge' => 'left', 'align' => 'center'))), array('target' => '[data-vc-navbar-control="animation"]', 'options' => array('content' => sprintf('<h3> %s </h3> <p> %s </p>', __('Use Animations', 'js_composer'), __('Select animation preset for grid element. "Hover" state will be added next to the "Normal" state tab.', 'js_composer')), 'position' => array('edge' => 'right', 'align' => 'center'))), array('target' => '.vc_gitem_animated_block-shortcode', 'options' => array('content' => sprintf('<h3> %s </h3> <p> %s </p>', __('Style Design Options', 'js_composer'), __('Edit "Normal" state to set "Featured image" as a background, control zone sizing proportions and other design options (Height mode: Select "Original" to scale image without cropping).', 'js_composer')), 'position' => array('edge' => 'bottom', 'align' => 'center'))), array('target' => '[data-vc-gitem="add-c"][data-vc-position="top"]', 'options' => array('content' => sprintf('<h3> %s </h3> <p> %s </p>', __('Extend Element', 'js_composer'), __('Additional content zone can be added to grid element edges (Note: This zone can not be animated).', 'js_composer')) . '<p><img src="' . vc_asset_url('vc/gb_additional_content.png') . '" alt="" /></p>', 'position' => array('edge' => 'right', 'align' => 'center'))), array('target' => '#wpadminbar', 'options' => array('content' => sprintf('<h3> %s </h3> %s', __('Watch Video Tutorial', 'js_composer'), '<p>' . __('Have a look how easy it is to work with grid element builder.', 'js_composer') . '</p>' . '<iframe width="500" height="281" src="//www.youtube.com/embed/sBvEiIL6Blo" frameborder="0" allowfullscreen></iframe>'), 'position' => array('edge' => 'top', 'align' => 'center'), 'pointerClass' => 'vc_gitem-animated-block-pointer-video', 'pointerWidth' => '530')))); } return $p;
$post_title = trim($post->post_title); $nonce_action = $nonce_action = 'update-post_' . $editor->post_id; $user_ID = isset($editor->current_user) && isset($editor->current_user->ID) ? (int) $editor->current_user->ID : 0; $form_action = 'editpost'; $menu = array(); add_thickbox(); wp_enqueue_media(array('post' => $editor->post_id)); require_once $editor->adminFile('admin-header.php'); // @since 4.8 js logic for user role access manager. vc_include_template('editors/partials/access-manager-js.tpl.php'); ?> <div id="vc_preloader"></div> <script type="text/javascript"> document.getElementById( 'vc_preloader' ).style.height = window.screen.availHeight; var vc_mode = '<?php echo vc_mode(); ?> ', vc_iframe_src = '<?php echo esc_attr($editor->url); ?> '; </script> <input type="hidden" name="vc_post_title" id="vc_title-saved" value="<?php echo esc_attr($post_title); ?> "/> <input type="hidden" name="vc_post_id" id="vc_post-id" value="<?php echo esc_attr($editor->post_id); ?> "/>
/** * @since 4.2 * @return bool */ function vc_is_page_editable() { return vc_mode() == 'page_editable'; }
* add action in admin for vc grid item editor manager */ add_action('init', 'vc_grid_item_editor_create_post_type'); add_action('admin_init', 'vc_grid_item_editor_init'); add_action('vc_after_init', 'vc_grid_item_editor_shortcodes'); /** * Call preview as ajax request is called. */ add_action('wp_ajax_vc_gitem_preview', 'vc_grid_item_render_preview', 5); /** * Add vc grid item to the list of the excluded post types for enabling Vc editor. * * Called with with 'vc_settings_exclude_post_type' action. * @deprecated, will be removed in 4.10 */ if ('admin_settings_page' === vc_mode()) { add_filter('vc_settings_exclude_post_type', 'vc_grid_item_vc_settings_exclude'); } /** * Add WP ui pointers in grid element editor. */ if (is_admin()) { add_filter('vc_ui-pointers-vc_grid_item', 'vc_grid_item_register_pointer'); } function vc_grid_item_register_pointer($pointers) { $screen = get_current_screen(); if ('add' === $screen->action) { $pointers['vc_grid_item'] = array('name' => 'vcPointersController', 'messages' => array(array('target' => '#vc_templates-editor-button', 'options' => array('content' => sprintf('<h3> %s </h3> <p> %s </p>', __('Start Here!', 'js_composer'), __('Start easy - use predefined template as a starting point and modify it.', 'js_composer')), 'position' => array('edge' => 'left', 'align' => 'center'))), array('target' => '[data-vc-navbar-control="animation"]', 'options' => array('content' => sprintf('<h3> %s </h3> <p> %s </p>', __('Use Animations', 'js_composer'), __('Select animation preset for grid element. "Hover" state will be added next to the "Normal" state tab.', 'js_composer')), 'position' => array('edge' => 'right', 'align' => 'center'))), array('target' => '.vc_gitem_animated_block-shortcode', 'options' => array('content' => sprintf('<h3> %s </h3> <p> %s </p>', __('Style Design Options', 'js_composer'), __('Edit "Normal" state to set "Featured image" as a background, control zone sizing proportions and other design options (Height mode: Select "Original" to scale image without cropping).', 'js_composer')), 'position' => array('edge' => 'bottom', 'align' => 'center'))), array('target' => '[data-vc-gitem="add-c"][data-vc-position="top"]', 'options' => array('content' => sprintf('<h3> %s </h3> <p> %s </p>', __('Extend Element', 'js_composer'), __('Additional content zone can be added to grid element edges (Note: This zone can not be animated).', 'js_composer')) . '<p><img src="' . vc_asset_url('vc/gb_additional_content.png') . '" alt="" /></p>', 'position' => array('edge' => 'right', 'align' => 'center'))), array('target' => '#wpadminbar', 'options' => array('content' => sprintf('<h3> %s </h3> %s', __('Watch Video Tutorial', 'js_composer'), '<p>' . __('Have a look how easy it is to work with grid element builder.', 'js_composer') . '</p>' . '<iframe width="500" height="281" src="//www.youtube.com/embed/sBvEiIL6Blo" frameborder="0" allowfullscreen></iframe>'), 'position' => array('edge' => 'top', 'align' => 'center'), 'pointerClass' => 'vc_gitem-animated-block-pointer-video', 'pointerWidth' => '530')))); } return $pointers;
/** * */ public function init() { $this->addHooks(); /** * If current mode of VC is frontend editor load it. */ if (vc_is_frontend_editor()) { vc_frontend_editor()->hookLoadEdit(); } elseif (vc_mode() === 'page_editable') { /** * if page loaded inside frontend editor iframe it has page_editable mode. * It required to some some js/css elements and add few helpers for editor to be used. */ $this->buildEditablePage(); } else { // Is it is simple page just enable buttons and controls $this->buildPage(); } /** * Load required vendors classes; * @deprecated since 4.4 due to autoload logic */ visual_composer()->vendorsManager()->load(); }
/** * Register admin javascript libs. * * Calls wp_register_script for required css libraries files for Admin dashboard. * * @since 3.1 * vc_filter: vc_i18n_locale_composer_js_view, since 4.4 - override localization for js * @access public */ public function registerAdminJavascript() { /** * TODO: REFACTOR * Save register only core js files and check for backend or front */ // $this->frontJsRegister(); wp_register_script('wpb_php_js', vc_asset_url('lib/php.default/php.default.min.js'), array('jquery'), WPB_VC_VERSION, true); wp_register_script('isotope', vc_asset_url('lib/bower/isotope/dist/isotope.pkgd.min.js'), array('jquery'), WPB_VC_VERSION, true); wp_register_script('wpb_scrollTo_js', vc_asset_url('lib/bower/scrollTo/jquery.scrollTo.min.js'), array('jquery'), WPB_VC_VERSION, true); wp_register_script('wpb_json-js', vc_asset_url('lib/bower/json-js/json2.js'), false, WPB_VC_VERSION, true); wp_register_script('wpb_js_composer_js_listeners', vc_asset_url('js/lib/events.js'), array('jquery', 'backbone', 'wpb_json-js'), WPB_VC_VERSION, true); wp_localize_script('wpb_js_composer_js_listeners', 'vcData', apply_filters('vc_global_js_data', array('version' => WPB_VC_VERSION, 'debug' => wpb_debug()))); wp_register_script('wpb_js_composer_js_tools', vc_asset_url('js/backend/composer-tools.js'), array('jquery', 'backbone', 'wpb_json-js', 'wpb_js_composer_js_listeners'), WPB_VC_VERSION, true); wp_register_script('wpb_js_composer_settings', vc_asset_url('js/backend/composer-settings-page.js'), array('jquery', 'wpb_js_composer_js_tools'), WPB_VC_VERSION, true); wp_register_script('wpb_jscomposer_media_editor_js', vc_asset_url('js/backend/media-editor.js'), array('media-views', 'media-editor', 'mce-view', 'wpb_js_composer_js_view'), WPB_VC_VERSION, true); wp_register_script('wpb_js_composer_js_atts', vc_asset_url('js/params/composer-atts.js'), array('wp-color-picker', 'wpb_js_composer_js_tools'), WPB_VC_VERSION, true); wp_register_script('wpb_js_composer_js_storage', vc_asset_url('js/backend/composer-storage.js'), array('wpb_js_composer_js_atts'), WPB_VC_VERSION, true); wp_register_script('wpb_js_composer_js_models', vc_asset_url('js/backend/composer-models.js'), array('wpb_js_composer_js_storage'), WPB_VC_VERSION, true); wp_register_script('wpb_js_composer_editor_panels', vc_asset_url('js/editors/panels.js'), array('wpb_js_composer_js_models'), WPB_VC_VERSION, true); wp_register_script('wpb_js_composer_js_view', vc_asset_url('js/backend/composer-view.js'), array('wpb_js_composer_editor_panels'), WPB_VC_VERSION, true); wp_register_script('wpb_js_composer_js_custom_views', vc_asset_url('js/backend/composer-custom-views.js'), array('wpb_js_composer_js_view'), WPB_VC_VERSION, true); wp_register_script('wpb_jscomposer_autosuggest_js', vc_asset_url('lib/autosuggest/jquery.autoSuggest.js'), array('wpb_js_composer_js_view'), WPB_VC_VERSION, true); wp_register_script('wpb_jscomposer_teaser_js', vc_asset_url('js/backend/composer-teaser.js'), array(), WPB_VC_VERSION, true); if (!vc_is_as_theme() || vc_is_as_theme() && 'admin_settings_page' !== vc_mode()) { wp_register_script('ace-editor', vc_asset_url('lib/bower/ace-builds/src-min-noconflict/ace.js'), array('jquery'), WPB_VC_VERSION, true); } /** * vc_filter: vc_i18n_locale_composer_js_view - @since 4.4 */ wp_localize_script('wpb_js_composer_js_view', 'i18nLocale', apply_filters('vc_i18n_locale_composer_js_view', array('add_remove_picture' => __('Add/remove picture', 'js_composer'), 'finish_adding_text' => __('Finish Adding Images', 'js_composer'), 'add_image' => __('Add Image', 'js_composer'), 'add_images' => __('Add Images', 'js_composer'), 'settings' => __('Settings', 'js_composer'), 'main_button_title' => __('Visual Composer', 'js_composer'), 'main_button_title_backend_editor' => __('BACKEND EDITOR', 'js_composer'), 'main_button_title_frontend_editor' => __('FRONTEND EDITOR', 'js_composer'), 'main_button_title_revert' => __('CLASSIC MODE', 'js_composer'), 'please_enter_templates_name' => __('Please enter template name', 'js_composer'), 'confirm_deleting_template' => __('Confirm deleting "{template_name}" template, press Cancel to leave. This action cannot be undone.', 'js_composer'), 'press_ok_to_delete_section' => __('Press OK to delete section, Cancel to leave', 'js_composer'), 'drag_drop_me_in_column' => __('Drag and drop me in the column', 'js_composer'), 'press_ok_to_delete_tab' => __('Press OK to delete "{tab_name}" tab, Cancel to leave', 'js_composer'), 'slide' => __('Slide', 'js_composer'), 'tab' => __('Tab', 'js_composer'), 'section' => __('Section', 'js_composer'), 'please_enter_new_tab_title' => __('Please enter new tab title', 'js_composer'), 'press_ok_delete_section' => __('Press OK to delete "{tab_name}" section, Cancel to leave', 'js_composer'), 'section_default_title' => __('Section', 'js_composer'), 'please_enter_section_title' => __('Please enter new section title', 'js_composer'), 'error_please_try_again' => __('Error. Please try again.', 'js_composer'), 'if_close_data_lost' => __('If you close this window all shortcode settings will be lost. Close this window?', 'js_composer'), 'header_select_element_type' => __('Select element type', 'js_composer'), 'header_media_gallery' => __('Media gallery', 'js_composer'), 'header_element_settings' => __('Element settings', 'js_composer'), 'add_tab' => __('Add tab', 'js_composer'), 'are_you_sure_convert_to_new_version' => __('Are you sure you want to convert to new version?', 'js_composer'), 'loading' => __('Loading...', 'js_composer'), 'set_image' => __('Set Image', 'js_composer'), 'are_you_sure_reset_css_classes' => __('Are you sure that you want to remove all your data?', 'js_composer'), 'loop_frame_title' => __('Loop settings'), 'enter_custom_layout' => __('Custom row layout', 'js_composer'), 'wrong_cells_layout' => __('Wrong row layout format! Example: 1/2 + 1/2 or span6 + span6.', 'js_composer'), 'row_background_color' => __('Row background color', 'js_composer'), 'row_background_image' => __('Row background image', 'js_composer'), 'column_background_color' => __('Column background color', 'js_composer'), 'column_background_image' => __('Column background image', 'js_composer'), 'guides_on' => __('Guides ON', 'js_composer'), 'guides_off' => __('Guides OFF', 'js_composer'), 'template_save' => __('New template successfully saved!', 'js_composer'), 'template_added' => __('Template added to the page.', 'js_composer'), 'template_added_with_id' => __('Template added to the page. Template has ID attributes, make sure that they are not used more than once on the same page.', 'js_composer'), 'template_removed' => __('Template successfully removed.', 'js_composer'), 'template_is_empty' => __('Nothing to save. Template is empty.', 'js_composer'), 'css_updated' => __('Page settings updated!', 'js_composer'), 'update_all' => __('Update all', 'js_composer'), 'confirm_to_leave' => __('The changes you made will be lost if you navigate away from this page.', 'js_composer'), 'inline_element_saved' => __('%s saved!', 'js_composer'), 'inline_element_deleted' => __('%s deleted!', 'js_composer'), 'inline_element_cloned' => __('%s cloned. <a href="#" class="vc_edit-cloned" data-model-id="%s">Edit now?</a>', 'js_composer'), 'gfonts_loading_google_font_failed' => __('Loading Google Font failed', 'js_composer'), 'gfonts_loading_google_font' => __('Loading Font...', 'js_composer'), 'gfonts_unable_to_load_google_fonts' => __('Unable to load Google Fonts', 'js_composer'), 'no_title_parenthesis' => sprintf('(%s)', __('no title', 'js_composer')), 'error_while_saving_image_filtered' => __('Error while applying filter to the image. Check your server and memory settings.', 'js_composer')))); /** * @since 4.4 */ do_action('vc_base_register_admin_js'); }
/** * Add filter for yoast. * @since 4.4 */ public function load() { if (class_exists('WPSEO_Metabox') && ('admin_page' === vc_mode() || 'admin_frontend_editor' === vc_mode())) { add_filter('wpseo_pre_analysis_post_content', array(&$this, 'filterResults')); } }
/** * Add filter for yoast. * @since 4.4 */ public function load() { if (class_exists('WPSEO_Metabox') && vc_mode() == 'admin_page') { add_filter('wpseo_pre_analysis_post_content', array(&$this, 'filterResults')); } }