本文整理汇总了PHP中vc_action函数的典型用法代码示例。如果您正苦于以下问题:PHP vc_action函数的具体用法?PHP vc_action怎么用?PHP vc_action使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vc_action函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: visual_composer_include
/**
* Allow for VC to use this plugin
*/
public static function visual_composer_include()
{
if (@is_user_logged_in()) {
if (!function_exists('vc_map') || !function_exists('vc_action')) {
return false;
}
if ('vc_inline' === vc_action() || is_admin()) {
add_action('init', array('RevSliderTinyBox', 'add_to_VC'));
}
}
}
示例2: vc_init_vendor_yoast
function vc_init_vendor_yoast()
{
include_once ABSPATH . 'wp-admin/includes/plugin.php';
// Require plugin.php to use is_plugin_active() below
if (is_plugin_active('wordpress-seo/wp-seo.php') || class_exists('WPSEO_Metabox')) {
require_once vc_path_dir('VENDORS_DIR', 'plugins/class-vc-vendor-yoast_seo.php');
$vendor = new Vc_Vendor_YoastSeo();
if (defined('WPSEO_VERSION') && version_compare(WPSEO_VERSION, '3.0.0') === -1) {
add_action('vc_after_set_mode', array($vendor, 'load'));
} elseif (is_admin() && 'vc_inline' === vc_action()) {
// $GLOBALS['pagenow'] = 'post.php?vc_action=vc_inline';
$vendor->frontendEditorBuild();
}
}
}
示例3: setMode
/**
* Set VC mode.
*
* Mode depends on which page is requested by client from server and request parameters like vc_action.
*
* @since 4.2
* @access protected
*
* @return void
*/
protected function setMode()
{
/**
* TODO: Create another system (When ajax rebuild).
* Use vc_action param to define mode.
* 1. admin_frontend_editor - set by editor or request param
* 2. admin_backend_editor - set by editor or request param
* 3. admin_frontend_editor_ajax - set by request param
* 4. admin_backend_editor_ajax - set by request param
* 5. admin_updater - by vc_action
* 6. page_editable - by vc_action
*/
if (is_admin()) {
if ('vc_inline' === vc_action()) {
vc_user_access()->wpAny(array('edit_post', (int) vc_request_param('post_id')))->validateDie()->part('frontend_editor')->can()->validateDie();
$this->mode = 'admin_frontend_editor';
} elseif (vc_user_access()->wpAny('edit_posts', 'edit_pages')->get() && ('vc_upgrade' === vc_action() || 'update-selected' === vc_get_param('action') && $this->pluginName() === vc_get_param('plugins'))) {
$this->mode = 'admin_updater';
} elseif (vc_user_access()->wpAny('manage_options')->get() && isset($_GET['page']) && $_GET['page'] === $this->settings()->page()) {
$this->mode = 'admin_settings_page';
} else {
$this->mode = 'admin_page';
}
} else {
if (isset($_GET['vc_editable']) && 'true' === $_GET['vc_editable']) {
vc_user_access()->checkAdminNonce()->validateDie()->wpAny(array('edit_post', (int) vc_request_param('vc_post_id')))->validateDie()->part('frontend_editor')->can()->validateDie();
$this->mode = 'page_editable';
} else {
$this->mode = 'page';
}
}
}
示例4: vc_is_inline
/**
* Get is inline or not.
* @since 4.2
* @return bool
*/
function vc_is_inline()
{
global $vc_is_inline;
if (is_null($vc_is_inline)) {
$vc_is_inline = (current_user_can('edit_posts') || current_user_can('edit_pages')) && 'vc_inline' === vc_action() || !is_null(vc_request_param('vc_inline')) || 'true' === vc_request_param('vc_editable');
}
return $vc_is_inline;
}
示例5: vc_is_inline
/**
* Get is inline or not.
* @since 4.2
* @return bool
*/
function vc_is_inline()
{
global $vc_is_inline;
if (is_null($vc_is_inline)) {
$vc_is_inline = vc_action() === 'vc_inline' || !is_null(vc_request_param('vc_inline')) || vc_request_param('vc_editable') === 'true';
}
return $vc_is_inline;
}
示例6: parseEditableContent
/**
* Main purpose of this function is to
* 1) Parse post content to get ALL shortcodes in to array
* 2) Wrap all shortcodes into editable-wrapper
* 3) Return "iframe" editable content in extra-script wrapper
*
* @param Wp_Post $post
*/
public function parseEditableContent($post)
{
if (vc_action() || vc_post_param('action')) {
return;
}
$post_id = (int) vc_get_param('vc_post_id');
if ($post_id > 0 && $post->ID === $post_id && !defined('VC_LOADING_EDITABLE_CONTENT')) {
define('VC_LOADING_EDITABLE_CONTENT', true);
remove_filter('the_content', 'wpautop');
do_action('vc_load_shortcode');
ob_start();
$this->getPageShortcodesByContent($post->post_content);
vc_include_template('editors/partials/vc_welcome_block.tpl.php');
$post_content = ob_get_clean();
ob_start();
vc_include_template('editors/partials/post_shortcodes.tpl.php', array('editor' => $this));
$post_shortcodes = ob_get_clean();
$GLOBALS['vc_post_content'] = '<script type="template/html" id="vc_template-post-content" style="display:none">' . rawurlencode(apply_filters('the_content', $post_content)) . '</script>' . $post_shortcodes;
// . '<span id="vc_inline-anchor" style="display:none !important;"></span>';
// We already used the_content filter, we need to remove it to avoid double-using
remove_all_filters('the_content');
// Used for just returning $post->post_content
add_filter('the_content', array(&$this, 'editableContent'));
}
}
示例7: setMode
/**
* Set VC mode.
*
* Mode depends on which page is requested by client from server and request parameters like vc_action.
*
* @since 4.2
* @access protected
* @return void
*/
protected function setMode()
{
if (is_admin()) {
if (vc_action() === 'vc_inline') {
$this->mode = 'admin_frontend_editor';
} elseif (vc_action() === 'vc_upgrade' || vc_get_param('action') === 'update-selected' && vc_get_param('plugins') === $this->pluginName()) {
$this->mode = 'admin_updater';
} elseif (isset($_GET['page']) && $_GET['page'] === $this->settings()->page()) {
$this->mode = 'admin_settings_page';
} else {
$this->mode = 'admin_page';
}
} else {
if (isset($_GET['vc_editable']) && $_GET['vc_editable'] === 'true') {
$this->mode = 'page_editable';
} else {
$this->mode = 'page';
}
}
}
示例8: setMode
/**
* Set VC mode.
*
* Mode depends on which page is requested by client from server and request parameters like vc_action.
*
* @since 4.2
* @access protected
*
* @return void
*/
protected function setMode()
{
/**
* @todo: Create another system (When ajax rebuild).
* Use vc_action param to define mode.
* 1. admin_frontend_editor - set by editor or request param
* 2. admin_backend_editor - set by editor or request param
* 3. admin_frontend_editor_ajax - set by request param
* 4. admin_backend_editor_ajax - set by request param
* 5. admin_updater - by vc_action
* 6. page_editable - by vc_action
*/
if (is_admin()) {
if (vc_action() === 'vc_inline') {
$this->mode = 'admin_frontend_editor';
} elseif (vc_action() === 'vc_upgrade' || vc_get_param('action') === 'update-selected' && vc_get_param('plugins') === $this->pluginName()) {
$this->mode = 'admin_updater';
} elseif (isset($_GET['page']) && $_GET['page'] === $this->settings()->page()) {
$this->mode = 'admin_settings_page';
} else {
$this->mode = 'admin_page';
}
} else {
if (isset($_GET['vc_editable']) && $_GET['vc_editable'] === 'true') {
$this->mode = 'page_editable';
} else {
$this->mode = 'page';
}
}
}
示例9: getAffiliateSufix
return $this->_resizeHeight;
}
public function getAffiliateSufix()
{
return $this->_affiliateSufix;
}
public function getVerifiedKey()
{
return $this->_verifiedKey;
}
public function getCompressionType()
{
return $this->_compressionType;
}
}
function onInit()
{
if (!is_admin() || !is_user_logged_in() || !current_user_can('manage_options')) {
return;
}
$pluginInstance = new WPShortPixel();
global $pluginInstance;
}
if (!function_exists('vc_action') || vc_action() !== 'vc_inline') {
//handle incompatibility with Visual Composer
add_action('init', 'onInit');
register_activation_hook(__FILE__, array('WPShortPixel', 'shortPixelActivatePlugin'));
register_deactivation_hook(__FILE__, array('WPShortPixel', 'shortPixelDeactivatePlugin'));
}
//$pluginInstance = new WPShortPixel();
//global $pluginInstance;
示例10: initAdmin
/**
* Init settings page && menu item
* vc_filter: vc_settings_tabs - hook to override settings tabs
*/
public function initAdmin()
{
$this->setTabs();
self::$color_settings = array(array('vc_color' => array('title' => __('Main accent color', 'js_composer'))), array('vc_color_hover' => array('title' => __('Hover color', 'js_composer'))), array('vc_color_call_to_action_bg' => array('title' => __('Call to action background color', 'js_composer'))), array('vc_color_google_maps_bg' => array('title' => __('Google maps background color', 'js_composer'))), array('vc_color_post_slider_caption_bg' => array('title' => __('Post slider caption background color', 'js_composer'))), array('vc_color_progress_bar_bg' => array('title' => __('Progress bar background color', 'js_composer'))), array('vc_color_separator_border' => array('title' => __('Separator border color', 'js_composer'))), array('vc_color_tab_bg' => array('title' => __('Tabs navigation background color', 'js_composer'))), array('vc_color_tab_bg_active' => array('title' => __('Active tab background color', 'js_composer'))));
self::$defaults = array('vc_color' => '#f7f7f7', 'vc_color_hover' => '#F0F0F0', 'margin' => '35px', 'gutter' => '15', 'responsive_max' => '768', 'compiled_js_composer_less' => '');
$vc_action = vc_action();
if ($vc_action === 'restore_color') {
$this->restoreColor();
} elseif ($vc_action === 'remove_all_css_classes') {
$this->removeAllCssClasses();
}
/**
* @since 4.5 used to call update file once option is changed
*/
add_action('update_option_wpb_js_compiled_js_composer_less', array(&$this, 'buildCustomColorCss'));
/**
* @since 4.5 used to call update file once option is changed
*/
add_action('update_option_wpb_js_custom_css', array(&$this, 'buildCustomCss'));
/**
* @since 4.5 used to call update file once option is changed
*/
add_action('add_option_wpb_js_compiled_js_composer_less', array(&$this, 'buildCustomColorCss'));
/**
* @since 4.5 used to call update file once option is changed
*/
add_action('add_option_wpb_js_custom_css', array(&$this, 'buildCustomCss'));
$this->deactivate = vc_license()->deactivation();
// TODO: Refactor with separate class.
/**
* Tab: General Settings
*/
$tab = 'general';
$this->addSection($tab);
$this->addField($tab, __("Content types", "js_composer"), 'content_types', array(&$this, 'sanitize_post_types_callback'), array(&$this, 'content_types_field_callback'));
$this->addField($tab, __("User groups access rules", "js_composer"), 'groups_access_rules', array(&$this, 'sanitize_group_access_rules_callback'), array(&$this, 'groups_access_rules_callback'));
$this->addField($tab, __("Disable responsive content elements", "js_composer"), 'not_responsive_css', array(&$this, 'sanitize_not_responsive_css_callback'), array(&$this, 'not_responsive_css_field_callback'));
$this->addField($tab, __("Google fonts subsets", "js_composer"), 'google_fonts_subsets', array(&$this, 'sanitize_google_fonts_subsets_callback'), array(&$this, 'google_fonts_subsets_callback'));
/**
* Tab: Design Options
*/
$tab = 'color';
$this->addSection($tab);
// Use custom checkbox
$this->addField($tab, __('Use custom design options', 'js_composer'), 'use_custom', array(&$this, 'sanitize_use_custom_callback'), array(&$this, 'use_custom_callback'));
foreach (self::$color_settings as $color_set) {
foreach ($color_set as $key => $data) {
$this->addField($tab, $data['title'], $key, array(&$this, 'sanitize_color_callback'), array(&$this, 'color_callback'), array('id' => $key));
}
}
// Margin
$this->addField($tab, __('Elements bottom margin', 'js_composer'), 'margin', array(&$this, 'sanitize_margin_callback'), array(&$this, 'margin_callback'));
// Gutter
$this->addField($tab, __('Grid gutter width', 'js_composer'), 'gutter', array(&$this, 'sanitize_gutter_callback'), array(&$this, 'gutter_callback'));
// Responsive max width
$this->addField($tab, __('Mobile screen width', 'js_composer'), 'responsive_max', array(&$this, 'sanitize_responsive_max_callback'), array(&$this, 'responsive_max_callback'));
$this->addField($tab, false, 'compiled_js_composer_less', array(&$this, 'sanitize_compiled_js_composer_less_callback'), array(&$this, 'compiled_js_composer_less_callback'));
/**
* Tab: Element Class names
*/
$tab = 'element_css';
$this->addSection($tab);
$this->addField($tab, __('Row CSS class name', 'js_composer'), 'row_css_class', array(&$this, 'sanitize_row_css_class_callback'), array(&$this, 'row_css_class_callback'));
$this->addField($tab, __('Columns CSS class names', 'js_composer'), 'column_css_classes', array(&$this, 'sanitize_column_css_classes_callback'), array(&$this, 'column_css_classes_callback'));
/**
* Tab: Custom CSS
*/
$tab = 'custom_css';
$this->addSection($tab);
$this->addField($tab, __("Paste your CSS code", "js_composer"), 'custom_css', array(&$this, 'sanitize_custom_css_callback'), array(&$this, 'custom_css_field_callback'));
/**
* Custom Tabs
*/
foreach ($this->getTabs() as $tab => $title) {
do_action('vc_settings_tab-' . preg_replace('/^vc\\-/', '', $tab), $this);
}
/**
* Tab: Updater
*/
$tab = 'updater';
$this->addSection($tab);
$this->addField($tab, __('Envato Username', 'js_composer'), 'envato_username', array(&$this, 'sanitize_envato_username'), array(&$this, 'envato_username_callback'));
$this->addField($tab, __('Secret API Key', 'js_composer'), 'envato_api_key', array(&$this, 'sanitize_envato_api_key'), array(&$this, 'envato_api_key_callback'));
$this->addField($tab, __('Visual Composer License Key', 'js_composer'), 'js_composer_purchase_code', array(&$this, 'sanitize_js_composer_purchase_code'), array(&$this, 'js_composer_purchase_code_callback'));
}
示例11: setMode
/**
* Set VC mode.
*
* Mode depends on which page is requested by client from server and request parameters like vc_action.
*
* @since 4.2
* @access protected
*
* @return void
*/
protected function setMode() {
/**
* TODO: Create another system (When ajax rebuild).
* Use vc_action param to define mode.
* 1. admin_frontend_editor - set by editor or request param
* 2. admin_backend_editor - set by editor or request param
* 3. admin_frontend_editor_ajax - set by request param
* 4. admin_backend_editor_ajax - set by request param
* 5. admin_updater - by vc_action
* 6. page_editable - by vc_action
*/
if ( is_admin() ) {
if ( vc_action() === 'vc_inline' && ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) ) {
$this->mode = 'admin_frontend_editor';
} elseif ( ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) && (
vc_action() === 'vc_upgrade' ||
( vc_get_param( 'action' ) === 'update-selected' && vc_get_param( 'plugins' ) === $this->pluginName() )
) ) {
$this->mode = 'admin_updater';
} elseif ( current_user_can( 'manage_options' ) && isset( $_GET['page'] ) && $_GET['page'] === $this->settings()->page() ) {
$this->mode = 'admin_settings_page';
} else {
$this->mode = 'admin_page';
}
} else {
if ( vc_verify_admin_nonce() && current_user_can( 'edit_post', (int) vc_request_param( 'vc_post_id' ) ) && isset( $_GET['vc_editable'] ) && 'true' === $_GET['vc_editable'] ) {
$this->mode = 'page_editable';
} else {
$this->mode = 'page';
}
}
}