当前位置: 首页>>代码示例>>PHP>>正文


PHP msp_get_parser函数代码示例

本文整理汇总了PHP中msp_get_parser函数的典型用法代码示例。如果您正苦于以下问题:PHP msp_get_parser函数的具体用法?PHP msp_get_parser怎么用?PHP msp_get_parser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了msp_get_parser函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: msp_generate_buttons_css

function msp_generate_buttons_css()
{
    // load and get parser
    $parser = msp_get_parser();
    $buttons_style = msp_get_option('buttons_style', '');
    return $parser->get_buttons_styles($buttons_style);
}
开发者ID:xpander54,项目名称:wp-drz,代码行数:7,代码来源:msp-admin-functions.php

示例2: save_panel_ajax

 /**
  * Save ajax handler for main panel data
  *
  * @since    1.0.0
  */
 public function save_panel_ajax()
 {
     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!", 'master-slider')));
         exit;
     }
     // ignore the request if the current user doesn't have sufficient permissions
     if (!current_user_can('publish_masterslider')) {
         echo json_encode(array('success' => false, 'message' => apply_filters('masterslider_insufficient_permissions_to_publish_message', __("Sorry, You don't have enough permission to publish slider!", 'master-slider'))));
         exit;
     }
     /////////////////////////////////////////////////////////////////////////////////////////
     // Get the slider id
     $slider_id = isset($_REQUEST['slider_id']) ? $_REQUEST['slider_id'] : '';
     if (empty($slider_id)) {
         echo json_encode(array('success' => false, 'type' => 'save', 'message' => __("Slider id is not defined.", 'master-slider')));
         exit;
     }
     // get the slider type
     $slider_type = isset($_REQUEST['slider_type']) ? $_REQUEST['slider_type'] : 'custom';
     // get panel data
     $msp_data = isset($_REQUEST['msp_data']) ? $_REQUEST['msp_data'] : NULL;
     // get parse and database tools
     global $mspdb;
     // load and get parser and start parsing data
     $parser = msp_get_parser();
     $parser->set_data($msp_data, $slider_id);
     // get required parsed data
     $slider_setting = $parser->get_slider_setting();
     $slides = $parser->get_slides();
     $slider_custom_styles = $parser->get_styles();
     $fields = array('title' => $slider_setting['title'], 'type' => $slider_setting['slider_type'], 'slides_num' => count($slides), 'params' => $msp_data, 'custom_styles' => $slider_custom_styles, 'custom_fonts' => $slider_setting['gfonts'], 'status' => 'published');
     // store slider data in database
     $is_saved = $mspdb->update_slider($slider_id, $fields);
     msp_save_custom_styles();
     // flush slider cache if slider cache is enabled
     msp_flush_slider_cache($slider_id);
     // create and output the response
     if (isset($is_saved)) {
         $response = json_encode(array('success' => true, 'type' => 'save', 'message' => __("Saved Successfully.", 'master-slider')));
     } else {
         $response = json_encode(array('success' => true, 'type' => 'save', 'message' => __("No Data Recieved.", 'master-slider')));
     }
     echo $response;
     exit;
     // IMPORTANT
 }
开发者ID:blogfor,项目名称:king,代码行数:54,代码来源:class-msp-admin-ajax.php

示例3: msp_panel_data_2_ms_slider_shortcode

<?php

// define( 'IFRAME_REQUEST', true );
echo '<div id="ms-preview-wrapper">';
if (isset($_REQUEST['slider_params']) && !empty($_REQUEST['slider_params'])) {
    $slider_params = $_REQUEST['slider_params'];
    $slider_shortcodes = msp_panel_data_2_ms_slider_shortcode($slider_params);
    echo do_shortcode($slider_shortcodes);
    // print slider custom css inline in live preview
    $parser = msp_get_parser();
    $parser->set_data($slider_params);
    $slider_custom_css = $parser->get_styles();
    printf("<!-- Custom slider styles -->\n<style>%s</style>", $slider_custom_css);
} elseif (isset($_REQUEST['slider_id']) && !empty($_REQUEST['slider_id'])) {
    $slider_id = $_REQUEST['slider_id'];
    $slider_shortcodes = msp_get_ms_slider_shortcode_by_slider_id($slider_id);
    echo do_shortcode($slider_shortcodes);
    // print slider custom css inline in live preview
    printf("<!-- Custom slider styles -->\n<style>%s</style>", msp_get_slider_custom_css($slider_id));
} else {
    _e('Not found.', 'master-slider');
}
echo "</div>\n";
if (isset($_REQUEST['strip_wp'])) {
    ?>
<style>
#adminmenuwrap,
#wpadminbar,
#adminmenuback,
#screen-meta,
#screen-meta-links,
开发者ID:blogfor,项目名称:king,代码行数:31,代码来源:preview.php

示例4: get_ms_layer_shortcode

 public function get_ms_layer_shortcode($layer)
 {
     if (!isset($layer) || empty($layer)) {
         return '';
     }
     $shortcode_name = 'ms_layer';
     $attrs = '';
     foreach ($layer as $attr => $attr_value) {
         if ('content' == $attr) {
             continue;
         }
         if ('parallax' == $attr && 'off' == $this->parsed_slider_data['setting']['parallax_mode']) {
             continue;
         }
         // users can add {{original-image}} and {{slide-image}} in layer link to link layer to current slide image
         if ('link' == $attr) {
             if (in_array($this->parsed_slider_data['setting']['slider_type'], array('post', 'wc-product'))) {
                 $attr_value = preg_replace_callback('/{{[\\w-]+}}/', array($this, 'do_template_tag'), $attr_value);
             } elseif ('{{slide-image-url}}' == $attr_value) {
                 $factory = msp_get_parser();
                 $slide = $factory->get_parent_of_layer($layer['id']);
                 $attr_value = msp_get_the_absolute_media_url($slide['src_full']);
             }
         }
         $attrs .= sprintf('%s="%s" ', $attr, esc_attr($attr_value));
     }
     $content = $layer['content'];
     if (in_array($this->parsed_slider_data['setting']['slider_type'], array('post', 'wc-product'))) {
         $content = preg_replace_callback('/{{[\\w-]+}}/', array($this, 'do_template_tag'), $content);
     }
     return sprintf('[%1$s %2$s]%4$s%3$s[/%1$s]%4$s', $shortcode_name, $attrs, $content, "\n");
 }
开发者ID:pab44,项目名称:pab44,代码行数:32,代码来源:class-msp-shortcode-factory.php

示例5: msp_update_slider_custom_css_and_fonts

/**
 * Update custom_css, custom_fonts and slide num fields in sliders table
 * 
 * @param int $slider_id the slider id that is going to be updated             
 * @return int|false The number of rows updated, or false on error.
 */
function msp_update_slider_custom_css_and_fonts($slider_id)
{
    if (!isset($slider_id) || !is_numeric($slider_id)) {
        return false;
    }
    // get database tool
    global $mspdb;
    $slider_params = $mspdb->get_slider_field_val($slider_id, 'params');
    if (!$slider_params) {
        return false;
    }
    // load and get parser and start parsing data
    $parser = msp_get_parser();
    $parser->set_data($slider_params, $slider_id);
    // get required parsed data
    $slider_setting = $parser->get_slider_setting();
    $slides = $parser->get_slides();
    $slider_custom_styles = $parser->get_styles();
    $fields = array('slides_num' => count($slides), 'custom_styles' => $slider_custom_styles, 'custom_fonts' => $slider_setting['gfonts']);
    msp_save_custom_styles();
    $mspdb->update_slider($slider_id, $fields);
}
开发者ID:blogfor,项目名称:king,代码行数:28,代码来源:msp-functions.php

示例6: extract_slider_images

 /**
  * Extract images from slider data and add them to image_import_queue list
  *
  * @param  string $slider_params the slider params
  * @return void
  */
 public function extract_slider_images($slider_params)
 {
     $parser = msp_get_parser();
     $parser->set_data($slider_params);
     $results = $parser->get_results();
     // collect slider background image
     $this->image_import_queue[] = $results['setting']['bg_image'];
     if (isset($results['setting']['ps_slide_bg'])) {
         $this->image_import_queue[] = $results['setting']['ps_slide_bg'];
     }
     // collect layer's images
     if (isset($results['layers'])) {
         foreach ($results['layers'] as $layer) {
             $this->image_import_queue[] = $layer['src'];
         }
     }
     // collect slide's images
     if (isset($results['slides'])) {
         foreach ($results['slides'] as $slide) {
             // skip if current slide is 'overlay' slide not 'standard' slide
             if (empty($slide['src'])) {
                 continue;
             }
             $this->image_import_queue[] = $slide['src'];
             $this->image_import_queue[] = $slide['thumb'];
         }
     }
     $this->image_import_queue = apply_filters('masterslider_extract_slider_images_to_import', $this->image_import_queue, $results);
 }
开发者ID:pab44,项目名称:pab44,代码行数:35,代码来源:class-msp-importer.php

示例7: extract_slider_images

 /**
  * Extract images from slider data and add them to image_import_queue list
  * @param  string $slider_params the slider params
  * @return void
  */
 public function extract_slider_images($slider_params)
 {
     $parser = msp_get_parser();
     $parser->set_data($slider_params);
     $results = $parser->get_results();
     // collect slider background image
     $this->image_import_queue[] = $results['setting']['bg_image'];
     if (isset($results['setting']['ps_slide_bg'])) {
         $this->image_import_queue[] = $results['setting']['ps_slide_bg'];
     }
     // collect slide's images
     if (isset($results['slides'])) {
         foreach ($results['slides'] as $slide) {
             $this->image_import_queue[] = $slide['src'];
             $this->image_import_queue[] = $slide['thumb'];
         }
     }
     $this->image_import_queue = apply_filters('masterslider_extract_slider_images_to_import', $this->image_import_queue, $results);
 }
开发者ID:blogfor,项目名称:king,代码行数:24,代码来源:class-msp-importer.php

示例8: get_custom_msslider

function get_custom_msslider($atts)
{
    $upload_dir = wp_upload_dir();
    $slider_id = $atts['id'];
    $ms_db = new MSP_DB();
    $slider = $ms_db->get_slider($slider_id);
    $parser = msp_get_parser();
    $parser->set_data($slider['params'], $slider_id);
    $results = $parser->get_results();
    $all_slides = $results['slides'];
    $str = '<ul id="foo5">';
    for ($i = 0; $i <= count($all_slides) - 1; $i++) {
        $str .= ' <li><img class="img-responsive" src="' . $upload_dir['baseurl'] . $all_slides[$i]['src'] . '"></li>';
    }
    $str .= '</ul>';
    echo $str;
}
开发者ID:blogfor,项目名称:king,代码行数:17,代码来源:functions.php


注:本文中的msp_get_parser函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。