本文整理汇总了PHP中WPBMap::user_categories方法的典型用法代码示例。如果您正苦于以下问题:PHP WPBMap::user_categories方法的具体用法?PHP WPBMap::user_categories怎么用?PHP WPBMap::user_categories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPBMap
的用法示例。
在下文中一共展示了WPBMap::user_categories方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateUserData
public static function generateUserData($force = false)
{
if (!$force && self::$user_sc !== false && self::$user_categories !== false) {
return true;
}
$settings = self::getSettings();
self::$user_sc = self::$user_categories = self::$user_sorted_sc = array();
foreach (self::$sc_row as $values) {
$name = $values['base'];
if (!isset($settings[self::$user_role]['shortcodes']) || isset($settings[self::$user_role]['shortcodes'][$name]) && (int) $settings[self::$user_role]['shortcodes'][$name] == 1) {
if ($name != 'vc_column' && (!isset($values['content_element']) || $values['content_element'] === true)) {
$categories = isset($values['category']) ? $values['category'] : '_other_category_';
$values['_category_ids'] = array();
if (is_array($categories)) {
foreach ($categories as $c) {
if (array_search($c, self::$user_categories) === false) {
self::$user_categories[] = $c;
}
$values['_category_ids'][] = md5($c);
// array_search($category, self::$categories);
}
} else {
if (array_search($categories, self::$user_categories) === false) {
self::$user_categories[] = $categories;
}
$values['_category_ids'][] = md5($categories);
// array_search($category, self::$categories);
}
}
self::$user_sc[$name] = $values;
self::$user_sorted_sc[] = $values;
}
}
usort(self::$user_sorted_sc, array("WPBMap", "sort"));
}
示例2: generateUserData
public static function generateUserData()
{
if (self::$user_sc !== false && self::$user_categories !== false) {
return true;
}
$settings = self::getSettings();
self::$user_sc = self::$user_categories = array();
foreach (self::$sc as $name => $values) {
if (!isset($settings[self::$user_role]['shortcodes']) || isset($settings[self::$user_role]['shortcodes'][$name]) && (int) $settings[self::$user_role]['shortcodes'][$name] == 1) {
self::$user_sc[$name] = $values;
if ($name != 'vc_column' && (!isset($values['content_element']) || $values['content_element'] === true)) {
$category = isset($values['category']) ? $values['category'] : '_other_category_';
if (array_search($category, self::$user_categories) === false) {
self::$user_categories[] = $category;
}
}
}
}
}
示例3: dropAllShortcodes
public static function dropAllShortcodes()
{
if (!self::$is_init) {
vc_mapper()->addActivity('mapper', 'drop_all_shortcodes', array());
return false;
}
foreach (self::$sc as $name => $data) {
visual_composer()->removeShortCode($name);
}
self::$sc = array();
self::$user_sc = self::$user_categories = self::$user_sorted_sc = false;
return true;
}
示例4: generateUserData
/**
* Generates list of shortcodes taking into account the access rules for shortcodes from VC Settings page.
*
* This method parses the list of mapped shortcodes and creates categories list for users.
*
* @static
*
* @param bool $force - force data generation even data already generated.
*/
protected static function generateUserData($force = false)
{
if (!$force && self::$user_sc !== false && self::$user_categories !== false) {
return;
}
$settings = self::getSettings();
self::$user_sc = self::$user_categories = self::$user_sorted_sc = array();
foreach (self::$sc as $name => $values) {
if (in_array($name, array('vc_column', 'vc_row', 'vc_row_inner', 'vc_column_inner')) || !isset($settings[self::$user_role]['shortcodes']) || isset($settings[self::$user_role]['shortcodes'][$name]) && (int) $settings[self::$user_role]['shortcodes'][$name] == 1) {
if (!isset($values['content_element']) || $values['content_element'] === true) {
$categories = isset($values['category']) ? $values['category'] : '_other_category_';
$values['_category_ids'] = array();
if (is_array($categories)) {
foreach ($categories as $c) {
if (array_search($c, self::$user_categories) === false) {
self::$user_categories[] = $c;
}
$values['_category_ids'][] = md5($c);
// array_search($category, self::$categories);
}
} else {
if (array_search($categories, self::$user_categories) === false) {
self::$user_categories[] = $categories;
}
$values['_category_ids'][] = md5($categories);
// array_search($category, self::$categories);
}
}
self::$user_sc[$name] = $values;
self::$user_sorted_sc[] = $values;
}
}
$sort = new Vc_Sort(self::$user_sorted_sc);
self::$user_sorted_sc = $sort->sortByKey();
}