本文整理汇总了PHP中msp_is_plugin_active函数的典型用法代码示例。如果您正苦于以下问题:PHP msp_is_plugin_active函数的具体用法?PHP msp_is_plugin_active怎么用?PHP msp_is_plugin_active使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了msp_is_plugin_active函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_ms_slider_shortcode
/**
* Get generated ms_slider shortcode
*
* @return string [ms_slider] shortcode or empty string on error
*/
public function get_ms_slider_shortcode($the_content = '')
{
if (!isset($this->parsed_slider_data['setting'])) {
return '';
}
$shortcode_name = 'ms_slider';
// get the parsed slider setting
$setting = $this->parsed_slider_data['setting'];
$exclude_attrs = array('custom_style');
// create ms_slider shortcode
$attrs = '';
foreach ($setting as $attr => $attr_value) {
if (in_array($attr, $exclude_attrs)) {
continue;
}
$attrs .= sprintf('%s="%s" ', $attr, esc_attr($attr_value));
}
// get ms_slides shortcodes(s)
if ('post' == $this->parsed_slider_data['setting']['slider_type']) {
$the_content = $this->get_post_slider_ms_slides_shortcode();
} elseif ('wc-product' == $this->parsed_slider_data['setting']['slider_type']) {
if (!msp_is_plugin_active('woocommerce/woocommerce.php')) {
return __('Please install and activate WooCommerce plugin.', MSWP_TEXT_DOMAIN);
}
$the_content = $this->get_wc_slider_ms_slides_shortcode();
} else {
$the_content = $this->get_ms_slides_shortcode();
}
return sprintf('[%1$s %2$s]%3$s%4$s[/%1$s]', $shortcode_name, $attrs, "\n", $the_content);
}
示例2: get_settings_sections
function get_settings_sections()
{
$sections = array(array('id' => 'msp_general_setting', 'title' => __('General Settings', MSWP_TEXT_DOMAIN)));
if (!apply_filters(MSWP_SLUG . '_disable_auto_update', 0)) {
$sections[] = array('id' => 'msp_envato_license', 'title' => __('Enable Automatic Update', MSWP_TEXT_DOMAIN), 'desc' => __('To enable automatic update for Master Slider, a valid purchase code is required.', MSWP_TEXT_DOMAIN));
}
$woo_enabled = msp_is_plugin_active('woocommerce/woocommerce.php');
$woo_section_desc = $woo_enabled ? '' : __('You need to install and activate WooCommerce plugin to use following options.', MSWP_TEXT_DOMAIN);
$sections[] = array('id' => 'msp_woocommerce', 'title' => __('WooCommerce Setting', MSWP_TEXT_DOMAIN), 'desc' => $woo_section_desc);
$sections[] = array('id' => 'msp_advanced', 'title' => __('Advanced Setting', MSWP_TEXT_DOMAIN));
return $sections;
}
示例3: get_post_template_tags_value
function get_post_template_tags_value($post = null, $args = null)
{
$post = get_post($post);
$template_tags = msp_get_general_post_template_tags();
if (msp_is_plugin_active('woocommerce/woocommerce.php')) {
$template_tags = array_merge($template_tags, msp_get_woocommerce_template_tags());
}
$tags_dictionary = array();
foreach ($template_tags as $template_tag) {
$tags_dictionary[$template_tag['name']] = msp_get_template_tag_value($template_tag['name'], $post, $args);
}
return $tags_dictionary;
}
示例4: wc_slider_preview
/**
* Get preview data form woocommerce product in admin area
*
* @since 1.7.4
*/
public function wc_slider_preview()
{
header("Content-Type: application/json");
// verify nonce
if (!isset($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], "msp_panel")) {
echo json_encode(array('success' => false, 'message' => __("Authorization failed!", MSWP_TEXT_DOMAIN)));
exit;
}
if (!msp_is_plugin_active('woocommerce/woocommerce.php')) {
echo json_encode(array('success' => false, 'message' => __("Please install and activate WooCommerce plugin.", MSWP_TEXT_DOMAIN)));
}
$wcs = msp_get_wc_slider_class();
$posts_result = $wcs->parse_and_get_posts_result();
$template_tags = $wcs->get_first_post_template_tags_value();
if (empty($posts_result)) {
$template_tags = null;
}
echo json_encode(array('success' => true, 'type' => 'preview', 'message' => '', 'preview_results' => $posts_result, 'template_tags' => $template_tags));
exit;
// IMPORTANT
}
示例5: msp_get_template_tag_value
function msp_get_template_tag_value($tag_name, $post = null, $args = null)
{
$post = get_post($post);
$value = '{{' . $tag_name . '}}';
switch ($tag_name) {
case 'title':
$value = $post->post_title;
break;
case 'content':
$value = $post->post_content;
break;
case 'excerpt':
$value = $post->post_excerpt;
if (empty($value)) {
$excerpt_length = isset($args['excerpt_length']) ? (int) $args['excerpt_length'] : 80;
$value = msp_get_the_trim_excerpt($value, $excerpt_length);
}
break;
case 'permalink':
$value = $post->guid;
break;
case 'author':
$value = get_the_author_meta('display_name', (int) $post->post_author);
break;
case 'post_id':
$value = $post->ID;
break;
case 'categories':
$taxonomy_objects = get_object_taxonomies($post, 'objects');
$value = '';
foreach ($taxonomy_objects as $tax_name => $tax_info) {
if (1 == $tax_info->hierarchical) {
$term_list = wp_get_post_terms($post->ID, $tax_name, array("fields" => "names"));
$value .= implode(' / ', $term_list);
}
}
$value = rtrim($value, ' / ');
break;
case 'tags':
$taxonomy_objects = get_object_taxonomies($post, 'objects');
$value = '';
foreach ($taxonomy_objects as $tax_name => $tax_info) {
if (1 !== $tax_info->hierarchical) {
$term_list = wp_get_post_terms($post->ID, $tax_name, array("fields" => "names"));
$value .= implode(' / ', $term_list) . ' / ';
}
}
$value = rtrim($value, ' / ');
break;
case 'image':
$value = msp_get_auto_post_thumbnail_src($post, 'featured');
if (!empty($value)) {
$value = sprintf('<img src="%s" alt="%s" />', $value, $post->post_title);
}
break;
case 'image-url':
case 'slide-image-url':
$value = msp_get_auto_post_thumbnail_src($post, 'auto');
break;
case 'year':
$value = strtotime($post->post_date);
$value = date_i18n('Y', $value);
break;
case 'daynum':
$value = strtotime($post->post_date);
$value = date_i18n('j', $value);
break;
case 'day':
$value = strtotime($post->post_date);
$value = date_i18n('l', $value);
break;
case 'monthnum':
$value = strtotime($post->post_date);
$value = date_i18n('m', $value);
break;
case 'month':
$value = strtotime($post->post_date);
$value = date_i18n('F', $value);
break;
case 'time':
$value = strtotime($post->post_date);
$value = date_i18n('g:i A', $value);
break;
case 'date-published':
$value = $post->post_date;
break;
case 'date-modified':
$value = $post->post_modified;
break;
case 'commentnum':
$value = $post->comment_count;
break;
case 'wc_price':
if (!msp_is_plugin_active('woocommerce/woocommerce.php')) {
break;
}
$product = get_product($post);
$value = wc_format_decimal($product->get_price(), 2);
break;
case 'wc_regular_price':
//.........这里部分代码省略.........
示例6: msp_get_template_tag_value
//.........这里部分代码省略.........
$value = strtotime($post->post_date);
$value = date_i18n('Y', $value);
break;
case 'daynum':
$value = strtotime($post->post_date);
$value = date_i18n('j', $value);
break;
case 'day':
$value = strtotime($post->post_date);
$value = date_i18n('l', $value);
break;
case 'monthnum':
$value = strtotime($post->post_date);
$value = date_i18n('m', $value);
break;
case 'month':
$value = strtotime($post->post_date);
$value = date_i18n('F', $value);
break;
case 'time':
$value = strtotime($post->post_date);
$value = date_i18n('g:i A', $value);
break;
case 'date-published':
$value = $post->post_date;
break;
case 'date-modified':
$value = $post->post_modified;
break;
case 'commentnum':
$value = $post->comment_count;
break;
case 'wc_price':
if (!msp_is_plugin_active('woocommerce/woocommerce.php')) {
break;
}
$product = get_product($post);
$value = wc_format_decimal($product->get_price(), 2);
break;
case 'wc_regular_price':
if (!msp_is_plugin_active('woocommerce/woocommerce.php')) {
break;
}
$product = get_product($post);
$value = wc_format_decimal($product->get_regular_price(), 2);
break;
case 'wc_sale_price':
if (!msp_is_plugin_active('woocommerce/woocommerce.php')) {
break;
}
$product = get_product($post);
$value = $product->get_sale_price() ? wc_format_decimal($product->get_sale_price(), 2) : '';
break;
case 'wc_stock_status':
if (!msp_is_plugin_active('woocommerce/woocommerce.php')) {
break;
}
$product = get_product($post);
$value = $product->is_in_stock() ? __('In Stock', MSWP_TEXT_DOMAIN) : __('Out of Stock', MSWP_TEXT_DOMAIN);
break;
case 'wc_stock_quantity':
if (!msp_is_plugin_active('woocommerce/woocommerce.php')) {
break;
}
$product = get_product($post);
$value = (int) $product->get_stock_quantity();
示例7: add_panel_variables
/**
* Print required variable for master slider panel
*/
public function add_panel_variables()
{
wp_localize_script('jquery', '__MSP_SKINS', msp_get_skins());
global $mspdb;
$slider_alias = '';
// get and print slider id
if (isset($_REQUEST['slider_id'])) {
$slider_id = $_REQUEST['slider_id'];
} else {
$slider_id = 0;
if (isset($_REQUEST['action']) && 'add' == $_REQUEST['action']) {
$slider_id = $mspdb->add_slider(array('status' => 'draft'));
wp_localize_script('jquery', '__MSP_SLIDER_ID', (string) $slider_id);
$slider_alias = $mspdb->generate_slider_alias($slider_id);
wp_localize_script('jquery', '__MSP_SLIDER_ALIAS', $slider_alias);
}
}
// Get and print panel data
if ($slider_id) {
$slider_data = $mspdb->get_slider($slider_id);
$slider_type = isset($slider_data['type']) ? $slider_data['type'] : 'custom';
$slider_type = empty($slider_type) ? 'custom' : $slider_type;
$msp_data = isset($slider_data['params']) ? $slider_data['params'] : NULL;
$msp_data = empty($slider_data['params']) ? NULL : $slider_data['params'];
$msp_preset_style = msp_get_option('preset_style', NULL);
$msp_preset_effect = msp_get_option('preset_effect', NULL);
$msp_buttons_style = msp_get_option('buttons_style', NULL);
$msp_preset_style = empty($msp_preset_style) ? NULL : $msp_preset_style;
$msp_preset_effect = empty($msp_preset_effect) ? NULL : $msp_preset_effect;
$msp_buttons_style = empty($msp_buttons_style) ? NULL : $msp_buttons_style;
if (empty($slider_alias)) {
$slider_alias = isset($slider_data['alias']) && !empty($slider_data['alias']) ? $slider_data['alias'] : $mspdb->generate_slider_alias($slider_id);
wp_localize_script('jquery', '__MSP_SLIDER_ALIAS', $slider_alias);
}
wp_localize_script('jquery', '__MSP_DATA', $msp_data);
wp_localize_script('jquery', '__MSP_PRESET_STYLE', $msp_preset_style);
wp_localize_script('jquery', '__MSP_PRESET_EFFECT', $msp_preset_effect);
wp_localize_script('jquery', '__MSP_TYPE', $slider_type);
wp_localize_script('jquery', '__MSP_PRESET_BUTTON', $msp_buttons_style);
}
// print essential variables (types, taxs, terms, template tags) for post slider in admin panel
// since version 1.7
if (isset($slider_type) && 'post' == $slider_type) {
$defined_tags = msp_get_general_post_template_tags();
$tags = array();
foreach ($defined_tags as $defined_tag) {
$tag_type = '_general' == $defined_tag['type'] ? 'general' : $defined_tag['type'];
$tags[$tag_type][] = array('name' => $defined_tag['name'], 'label' => $defined_tag['label']);
}
// -- get post types, taxes and terms --
$PS = msp_get_post_slider_class();
$terms = $PS->get_tax_term_dictionary();
// -------------------------------------
//
$js_data = array('types_taxs_terms' => $terms, 'content_tags' => $tags);
wp_localize_script('jquery', '__MSP_POST', apply_filters('masterslider_post_slider_init_data', $js_data));
}
// print essential variables (types, taxs, terms, template tags) for woocommerce sliders in admin panel
// since version 1.8
if (isset($slider_type) && 'wc-product' == $slider_type) {
// if woocommerce is installed and actived
if (msp_is_plugin_active('woocommerce/woocommerce.php')) {
// -- template tags --------------------
$defined_tags = msp_get_general_post_template_tags();
$woocomm_tags = msp_get_woocommerce_template_tags();
$defined_tags = array_merge($defined_tags, $woocomm_tags);
$tags = array();
foreach ($defined_tags as $defined_tag) {
$tag_type = '_general' == $defined_tag['type'] ? 'general' : $defined_tag['type'];
$tags[$tag_type][] = array('name' => $defined_tag['name'], 'label' => $defined_tag['label']);
}
// -- get post types, taxes and terms --
$WCS = msp_get_wc_slider_class();
$terms = $WCS->get_tax_term_dictionary();
// -------------------------------------
$js_data = array('types_taxs_terms' => $terms, 'content_tags' => $tags);
// if woocommerce is not activated
} else {
$js_data = null;
$wc_installation_url = admin_url('plugin-install.php?tab=plugin-information&plugin=woocommerce&TB_iframe=true&width=600&height=550');
wp_localize_script('jquery', '__WC_INSTALL_URL', $wc_installation_url);
}
wp_localize_script('jquery', '__MSP_POST', apply_filters('masterslider_wc_product_slider_init_data', $js_data));
}
// define panel directory path
wp_localize_script('jquery', '__MSP_PATH', MSWP_AVERTA_ADMIN_URL . '/views/slider-panel/');
$slider_panel_default_setting = array('width' => 1000, 'height' => 500, 'autoCrop' => false, 'autoplay' => false, 'layout' => 'boxed', 'autoHeight' => false, 'transition' => 'basic', 'speed' => 20, 'className' => '', 'start' => 1, 'space' => 0, 'grabCursor' => true, 'swipe' => true, 'wheel' => false, 'mouse' => true, 'loop' => false, 'shuffle' => false, 'preload' => '-1', 'overPause' => true, 'endPause' => false, 'hideLayers' => false, 'dir' => 'h', 'parallaxMode' => 'swipe', 'centerControls' => true, 'instantShowLayers' => false, 'skin' => 'ms-skin-default', 'duration' => 3, 'slideFillMode' => 'fill', 'sliderVideoFillMode' => 'fill', 'slideVideoLoop' => true, 'slideVideoMute' => true, 'slideVideoAutopause' => false, 'layerContent' => 'Lorem Ipsum');
wp_localize_script('jquery', '__MSP_DEF_OPTIONS', apply_filters('masterslider_panel_default_setting', $slider_panel_default_setting));
do_action('masterslider_admin_add_panel_variables', $slider_type);
}
示例8: array
<?php
/**
*
* @package MasterSlider
* @author averta [averta.net]
* @license LICENSE.txt
* @link http://masterslider.com
* @copyright Copyright © 2014 averta
*/
// no direct access allowed
if (!defined('ABSPATH')) {
die;
}
if (!msp_is_plugin_active('woocommerce/woocommerce.php')) {
return '';
}
if (!class_exists('MSP_WP_Post')) {
include_once 'class-msp-wp-post.php';
}
if (!class_exists('MSP_WC_Product_Slider')) {
/**
*
*/
class MSP_WC_Product_Slider extends MSP_WP_Post
{
function get_tax_term_dictionary()
{
$tax_term_dictionary = array();
$post_types_tax_list = array();
$the_post_type = get_post_type_object('product');