本文整理汇总了PHP中vc_default_editor_post_types函数的典型用法代码示例。如果您正苦于以下问题:PHP vc_default_editor_post_types函数的具体用法?PHP vc_default_editor_post_types怎么用?PHP vc_default_editor_post_types使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vc_default_editor_post_types函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: vc_bc_access_rule_48_post_type_rule
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;
}
示例2: content_types_field_callback
/**
* 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
}
示例3: vc_check_post_type
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;
}
示例4: content_types_field_callback
/**
* 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
}
示例5: vc_check_post_type
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;
}
示例6: add_action
<?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)
{