function vc_bc_access_rule_48_post_type_rule($value, $role, $rule) { if (!$role) { return $value; } global $vc_bc_access_rule_48_editor_post_types; $part = vc_role_access()->who($role->name)->part('post_types'); if (!isset($part->getRole()->capabilities[$part->getStateKey()])) { if (is_null($vc_bc_access_rule_48_editor_post_types)) { $pt_array = vc_settings()->get('content_types'); $vc_bc_access_rule_48_editor_post_types = $pt_array ? $pt_array : vc_default_editor_post_types(); } return in_array($rule, $vc_bc_access_rule_48_editor_post_types); } return $value; }
/** * Content types checkboxes list callback function * @deprecated 4.8 */ public function content_types_field_callback() { // _deprecated_function( '\Vc_Settings::content_types_field_callback', '4.8 (will be removed in 4.11)' ); $pt_array = ($pt_array = get_option('wpb_js_content_types')) ? $pt_array : vc_default_editor_post_types(); foreach ($this->getPostTypes() as $pt) { if (!in_array($pt, $this->getExcluded())) { $checked = in_array($pt, $pt_array) ? ' checked' : ''; ?> <label> <input type="checkbox"<?php echo $checked; ?> value="<?php echo $pt; ?> " id="wpb_js_post_types_<?php echo $pt; ?> " name="<?php echo self::$field_prefix . 'content_types'; ?> []"> <?php echo $pt; ?> </label><br> <?php } } ?> <p class="description indicator-hint"><?php _e('Select content types available to Visual Composer.', 'js_composer'); ?> </p> <?php }
function vc_check_post_type($type) { if (empty($type)) { $type = get_post_type(); } $valid = apply_filters('vc_check_post_type_validation', null, $type); if (is_null($valid)) { if (is_multisite() && is_super_admin()) { return true; } $state = vc_user_access()->part('post_types')->getState(); if (null === $state) { return in_array($type, vc_default_editor_post_types()); } else { if (true === $state && !in_array($type, vc_default_editor_post_types())) { $valid = false; } else { $valid = vc_user_access()->part('post_types')->can($type)->get(); } } } return $valid; }
/** * Content types checkboxes list callback function */ public function content_types_field_callback() { $pt_array = ($pt_array = get_option('wpb_js_content_types')) ? $pt_array : vc_default_editor_post_types(); foreach ($this->getPostTypes() as $pt) { if (!in_array($pt, $this->getExcluded())) { $checked = in_array($pt, $pt_array) ? ' checked="checked"' : ''; ?> <label> <input type="checkbox"<?php echo $checked; ?> value="<?php echo $pt; ?> " id="wpb_js_post_types_<?php echo $pt; ?> " name="<?php echo self::$field_prefix . 'content_types'; ?> []"> <?php echo $pt; ?> </label><br> <?php } } ?> <p class="description indicator-hint"><?php _e("Select for which content types Visual Composer should be available during post creation/editing.", LANGUAGE_ZONE); ?> </p> <?php }
function vc_check_post_type($type) { if (empty($type)) { $type = get_post_type(); } $state = vc_user_access()->part('post_types')->getState(); if (null === $state) { return in_array($type, vc_default_editor_post_types()); } else { if (true === $state && !in_array($type, vc_default_editor_post_types())) { $valid = false; } else { $valid = vc_user_access()->part('post_types')->can($type)->get(); } } return $valid; }
<?php /* Plugin Name: Visual Composer widgets Plugin URI: http://azexo.com Description: Visual Composer widgets Author: azexo Author URI: http://azexo.com Version: 1.0 Text Domain: vc_widgets */ add_action('widgets_init', 'vc_widgets_register_widgets'); if (function_exists('vc_default_editor_post_types')) { $pt_array = ($pt_array = get_option('wpb_js_content_types')) ? $pt_array : vc_default_editor_post_types(); } else { $pt_array = ($pt_array = get_option('wpb_js_content_types')) ? $pt_array : array(); } $pt_array[] = 'vc_widget'; update_option('wpb_js_content_types', $pt_array); function vc_widgets_register_widgets() { register_widget('VC_Widget'); } class VC_Widget extends WP_Widget { function VC_Widget() { parent::__construct('vc_widget', AZEXO_THEME_NAME . ' - VC Widget'); } function widget($args, $instance) {