本文整理汇总了PHP中dslc_is_module_active函数的典型用法代码示例。如果您正苦于以下问题:PHP dslc_is_module_active函数的具体用法?PHP dslc_is_module_active怎么用?PHP dslc_is_module_active使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dslc_is_module_active函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dslc_downloads_module_init
function dslc_downloads_module_init()
{
if (!dslc_is_module_active('DSLC_Downloads', true)) {
return;
}
$capability = dslc_get_option('lc_min_capability_downloads_m', 'dslc_plugin_options_access_control');
if (!$capability) {
$capability = 'publish_posts';
}
// With Front
$with_front = dslc_get_option('with_front', 'dslc_plugin_options_cpt_slugs');
if (empty($with_front)) {
$with_front = 'disabled';
}
if ($with_front == 'enabled') {
$with_front = true;
} else {
$with_front = false;
}
/**
* Custom Post Type
*/
register_post_type('dslc_downloads', array('menu_icon' => 'dashicons-download', 'labels' => array('name' => __('Downloads', 'dslc_string'), 'singular_name' => __('Download Item', 'dslc_string'), 'add_new' => __('Add Download Item', 'dslc_string'), 'add_new_item' => __('Add Download Item', 'dslc_string'), 'edit' => __('Edit', 'dslc_string'), 'edit_item' => __('Edit Download Item', 'dslc_string'), 'new_item' => __('New Download Item', 'dslc_string'), 'view' => __('View Download Item', 'dslc_string'), 'view_item' => __('View Download Item', 'dslc_string'), 'search_items' => __('Search Download Item', 'dslc_string'), 'not_found' => __('No Download Item found', 'dslc_string'), 'not_found_in_trash' => __('No Download Item found in Trash', 'dslc_string'), 'parent' => __('Parent Download Item', 'dslc_string')), 'public' => true, 'rewrite' => array('slug' => dslc_get_option('downloads_slug', 'dslc_plugin_options_cpt_slugs'), 'with_front' => $with_front), 'supports' => array('title', 'custom-fields', 'excerpt', 'editor', 'author', 'thumbnail', 'comments'), 'capabilities' => array('publish_posts' => $capability, 'edit_posts' => $capability, 'edit_others_posts' => $capability, 'delete_posts' => $capability, 'delete_others_posts' => $capability, 'read_private_posts' => $capability, 'edit_post' => $capability, 'delete_post' => $capability, 'read_post' => $capability)));
/**
* Custom Taxonomies
*/
register_taxonomy('dslc_downloads_cats', 'dslc_downloads', array('labels' => array('name' => __('Downloads Categories', 'dslc_string'), 'singular_name' => __('Category', 'dslc_string'), 'search_items' => __('Search Categories', 'dslc_string'), 'all_items' => __('All Categories', 'dslc_string'), 'parent_item' => __('Parent Category', 'dslc_string'), 'parent_item_colon' => __('Parent Category:', 'dslc_string'), 'edit_item' => __('Edit Category', 'dslc_string'), 'update_item' => __('Update Category', 'dslc_string'), 'add_new_item' => __('Add New Category', 'dslc_string'), 'new_item_name' => __('New Category Name', 'dslc_string'), 'menu_name' => __('Categories', 'dslc_string')), 'hierarchical' => true, 'public' => true, 'rewrite' => array('slug' => dslc_get_option('downloads_cats_slug', 'dslc_plugin_options_cpt_slugs'), 'with_front' => $with_front), 'capabilities' => array('manage_terms' => $capability, 'edit_terms' => $capability, 'delete_terms' => $capability, 'assign_terms' => $capability)));
register_taxonomy('dslc_downloads_tags', 'dslc_downloads', array('labels' => array('name' => __('Downloads Tags', 'dslc_string'), 'singular_name' => __('Tag', 'dslc_string'), 'search_items' => __('Search Tags', 'dslc_string'), 'all_items' => __('All Tags', 'dslc_string'), 'parent_item' => __('Parent Tag', 'dslc_string'), 'parent_item_colon' => __('Parent Tag:', 'dslc_string'), 'edit_item' => __('Edit Tag', 'dslc_string'), 'update_item' => __('Update Tag', 'dslc_string'), 'add_new_item' => __('Add New Tag', 'dslc_string'), 'new_item_name' => __('New Tag Name', 'dslc_string'), 'menu_name' => __('Tags', 'dslc_string')), 'hierarchical' => false, 'public' => true, 'rewrite' => array('slug' => dslc_get_option('downloads_tags_slug', 'dslc_plugin_options_cpt_slugs'), 'with_front' => $with_front), 'capabilities' => array('manage_terms' => $capability, 'edit_terms' => $capability, 'delete_terms' => $capability, 'assign_terms' => $capability)));
/**
* Post Options
*/
global $dslc_var_post_options;
$dslc_var_post_options['dslc-downloads-module-options'] = array('title' => 'Download Options', 'show_on' => 'dslc_downloads', 'options' => array(array('label' => 'Downloadable File - Self Hosted', 'descr' => 'If you want the file hosted on your server you can upload and choose it here.', 'std' => '', 'id' => 'dslc_download_file', 'type' => 'file'), array('label' => 'Downloadable File - URL', 'descr' => 'If the file is already hosted somewhere else you can set the URL to it here.', 'std' => '', 'id' => 'dslc_download_url', 'type' => 'text')));
}
示例2: dslc_partners_module_cpt
/**
* Register Post Types and Taxonomies
*
* @since 1.0
*/
function dslc_partners_module_cpt()
{
// If module not active return
if (!dslc_is_module_active('DSLC_Partners', true)) {
return;
}
// Get capability
$capability = dslc_get_option('lc_min_capability_partners_m', 'dslc_plugin_options_access_control');
if (!$capability) {
$capability = 'publish_posts';
}
// With Front
$with_front = dslc_get_option('with_front', 'dslc_plugin_options_cpt_slugs');
if (empty($with_front)) {
$with_front = 'disabled';
}
if ($with_front == 'enabled') {
$with_front = true;
} else {
$with_front = false;
}
/**
* Register Post Type
*/
// Arguments
$cpt_args = array('menu_icon' => 'dashicons-groups', 'labels' => array('name' => __('Partners', 'live-composer-page-builder'), 'singular_name' => __('Partner', 'live-composer-page-builder'), 'add_new' => __('Add Partner', 'live-composer-page-builder'), 'add_new_item' => __('Add Partner', 'live-composer-page-builder'), 'edit' => __('Edit', 'live-composer-page-builder'), 'edit_item' => __('Edit Partner', 'live-composer-page-builder'), 'new_item' => __('New Partner', 'live-composer-page-builder'), 'view' => __('View Partner', 'live-composer-page-builder'), 'view_item' => __('View Partner', 'live-composer-page-builder'), 'search_items' => __('Search Partner', 'live-composer-page-builder'), 'not_found' => __('No Partner found', 'live-composer-page-builder'), 'not_found_in_trash' => __('No Partner found in Trash', 'live-composer-page-builder'), 'parent' => __('Parent Partner', 'live-composer-page-builder')), 'public' => true, 'rewrite' => array('slug' => dslc_get_option('partners_slug', 'dslc_plugin_options_cpt_slugs'), 'with_front' => $with_front), 'supports' => array('title', 'custom-fields', 'excerpt', 'editor', 'author', 'thumbnail', 'comments'), 'capabilities' => array('publish_posts' => $capability, 'edit_posts' => $capability, 'edit_others_posts' => $capability, 'delete_posts' => $capability, 'delete_others_posts' => $capability, 'read_private_posts' => $capability, 'edit_post' => $capability, 'delete_post' => $capability, 'read_post' => $capability));
// Apply filters
$cpt_args = apply_filters('dslc_partners_cpt_args', $cpt_args);
// Register post type
register_post_type('dslc_partners', $cpt_args);
/**
* Register Taxonomy ( Category )
*/
// Arguments
$cats_args = array('labels' => array('name' => __('Partners Categories', 'live-composer-page-builder'), 'singular_name' => __('Category', 'live-composer-page-builder'), 'search_items' => __('Search Categories', 'live-composer-page-builder'), 'all_items' => __('All Categories', 'live-composer-page-builder'), 'parent_item' => __('Parent Category', 'live-composer-page-builder'), 'parent_item_colon' => __('Parent Category:', 'live-composer-page-builder'), 'edit_item' => __('Edit Category', 'live-composer-page-builder'), 'update_item' => __('Update Category', 'live-composer-page-builder'), 'add_new_item' => __('Add New Category', 'live-composer-page-builder'), 'new_item_name' => __('New Category Name', 'live-composer-page-builder'), 'menu_name' => __('Categories', 'live-composer-page-builder')), 'hierarchical' => true, 'public' => true, 'rewrite' => array('slug' => dslc_get_option('partners_cats_slug', 'dslc_plugin_options_cpt_slugs'), 'with_front' => $with_front));
// Apply filters
$cats_args = apply_filters('dslc_partners_cats_args', $cats_args);
// Register taxonomy
register_taxonomy('dslc_partners_cats', 'dslc_partners', $cats_args);
}
示例3: dslc_timeline_module_cpt
function dslc_timeline_module_cpt()
{
if (!dslc_is_module_active('AS_Timeline', true)) {
return;
}
$capability = dslc_get_option('lc_min_capability_timeline_m', 'dslc_plugin_options_access_control');
if (!$capability) {
$capability = 'publish_posts';
}
// With Front
$with_front = dslc_get_option('with_front', 'dslc_plugin_options_cpt_slugs');
if (empty($with_front)) {
$with_front = 'disabled';
}
if ($with_front == 'enabled') {
$with_front = true;
} else {
$with_front = false;
}
register_post_type('dslc_timeline', array('menu_icon' => 'dashicons-feedback', 'labels' => array('name' => __('Timeline', 'dslc_string'), 'singular_name' => __('Timeline', 'dslc_string'), 'add_new' => __('Add Timeline', 'dslc_string'), 'add_new_item' => __('Add Timeline', 'dslc_string'), 'edit' => __('Edit', 'dslc_string'), 'edit_item' => __('Edit Timeline', 'dslc_string'), 'new_item' => __('New Timeline', 'dslc_string'), 'view' => __('View Timeline', 'dslc_string'), 'view_item' => __('View Timeline', 'dslc_string'), 'search_items' => __('Search Timeline', 'dslc_string'), 'not_found' => __('No Timeline found', 'dslc_string'), 'not_found_in_trash' => __('No Timeline found in Trash', 'dslc_string'), 'parent' => __('Parent Timeline', 'dslc_string')), 'public' => true, 'rewrite' => array('slug' => dslc_get_option('timeline_slug', 'dslc_plugin_options_cpt_slugs'), 'with_front' => $with_front), 'supports' => array('title', 'custom-fields', 'excerpt', 'editor', 'author', 'thumbnail', 'comments'), 'capabilities' => array('publish_posts' => $capability, 'edit_posts' => $capability, 'edit_others_posts' => $capability, 'delete_posts' => $capability, 'delete_others_posts' => $capability, 'read_private_posts' => $capability, 'edit_post' => $capability, 'delete_post' => $capability, 'read_post' => $capability)));
register_taxonomy('dslc_timeline_cats', 'dslc_timeline', array('labels' => array('name' => __('Timeline Categories', 'dslc_string'), 'singular_name' => __('Category', 'dslc_string'), 'search_items' => __('Search Categories', 'dslc_string'), 'all_items' => __('All Categories', 'dslc_string'), 'parent_item' => __('Parent Category', 'dslc_string'), 'parent_item_colon' => __('Parent Category:', 'dslc_string'), 'edit_item' => __('Edit Category', 'dslc_string'), 'update_item' => __('Update Category', 'dslc_string'), 'add_new_item' => __('Add New Category', 'dslc_string'), 'new_item_name' => __('New Category Name', 'dslc_string'), 'menu_name' => __('Categories', 'dslc_string')), 'hierarchical' => true, 'public' => true, 'rewrite' => array('slug' => dslc_get_option('timeline_cats_slug', 'dslc_plugin_options_cpt_slugs'), 'with_front' => $with_front), 'capabilities' => array('manage_terms' => $capability, 'edit_terms' => $capability, 'delete_terms' => $capability, 'assign_terms' => $capability)));
}
示例4: dslc_module_gen_css
/**
* Generate CSS - Module
*/
function dslc_module_gen_css($atts, $settings_raw)
{
$settings = maybe_unserialize(base64_decode($settings_raw));
// If it's an array
if (is_array($settings)) {
// The ID of the module
$module_id = $settings['module_id'];
// Check if module exists
if (!dslc_is_module_active($module_id)) {
return;
}
// If class does not exists
if (!class_exists($module_id)) {
return;
}
// Instanciate the module class
$module_instance = new $module_id();
// Get array of options
$options_arr = $module_instance->options();
// Load preset options if preset supplied
$settings = apply_filters('dslc_filter_settings', $settings);
// Transform image ID to URL
global $dslc_var_image_option_bckp;
$dslc_var_image_option_bckp = array();
foreach ($options_arr as $option_arr) {
if ($option_arr['type'] == 'image') {
if (isset($settings[$option_arr['id']]) && !empty($settings[$option_arr['id']]) && is_numeric($settings[$option_arr['id']])) {
$dslc_var_image_option_bckp[$option_arr['id']] = $settings[$option_arr['id']];
$image_info = wp_get_attachment_image_src($settings[$option_arr['id']], 'full');
$settings[$option_arr['id']] = $image_info[0];
}
}
// Fix css_custom value ( issue when default changed programmatically )
if ($option_arr['id'] == 'css_custom' && $module_id == 'DSLC_Text_Simple' && !isset($settings['css_custom'])) {
$settings['css_custom'] = $option_arr['std'];
}
}
// Generate custom CSS
if (($module_id == 'DSLC_TP_Content' || $module_id == 'DSLC_Html') && !isset($settings['css_custom'])) {
$css_output = '';
} elseif (isset($settings['css_custom']) && $settings['css_custom'] == 'disabled') {
$css_output = '';
} else {
$css_output = dslc_generate_custom_css($options_arr, $settings);
}
}
}