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


PHP CS函数代码示例

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


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

示例1: addMediaButton

 public function addMediaButton($editor_id)
 {
     $this->enqueue();
     $title = sprintf(__('Insert Shortcodes', csl18n()));
     $contents = (include CS()->path('includes/builder/svg/nav-elements-solid.php'));
     echo "<button href=\"#\" title=\"{$title}\" id=\"cs-insert-shortcode-button\" class=\"button cs-insert-btn\">{$contents}</button>";
 }
开发者ID:datracka,项目名称:datalook.io,代码行数:7,代码来源:class-shortcode-generator.php

示例2: preInit

 public static function preInit()
 {
     global $wp_version;
     if (version_compare($wp_version, '4.1', '<')) {
         require_once CS()->path('includes/utility/wp-json.php');
     }
 }
开发者ID:saparhadi,项目名称:morowaliweb,代码行数:7,代码来源:conflict-resolution.php

示例3: ajax_handler

 public function ajax_handler($data)
 {
     CS_Shortcode_Preserver::init();
     if ($this->sandbox_the_content) {
         CS_Shortcode_Preserver::sandbox('cs_render_the_content');
     }
     add_filter('cs_preserve_shortcodes_no_wrap', '__return_true');
     $this->orchestrator = $this->plugin->component('Element_Orchestrator');
     $this->orchestrator->load_elements();
     $this->mk1 = new Cornerstone_Legacy_Renderer($this->plugin->component('Legacy_Elements'));
     global $post;
     if (!isset($data['post_id']) || !($post = get_post((int) $data['post_id']))) {
         wp_send_json_error(array('message' => 'post_id not set'));
     }
     setup_postdata($post);
     $this->enqueue_extractor = $this->plugin->loadComponent('Enqueue_Extractor');
     $this->enqueue_extractor->start();
     if (isset($data['raw_markup'])) {
         $this->raw_markup = (bool) $data['raw_markup'];
     }
     if (!isset($data['batch'])) {
         wp_send_json_error(array('message' => 'No element data recieved'));
     }
     $jobs = $this->batch($data['batch']);
     $scripts = $this->enqueue_extractor->get_scripts();
     if (is_wp_error($jobs)) {
         wp_send_json_error(array('message' => $jobs->get_error_message()));
     }
     $result = array('jobs' => $jobs, 'scripts' => $scripts);
     //Suppress PHP error output unless debugging
     if (CS()->common()->isDebug()) {
         return wp_send_json_success($result);
     }
     return @wp_send_json_success($result);
 }
开发者ID:bitflipper1,项目名称:ghcontracting,代码行数:35,代码来源:class-builder-renderer.php

示例4: inlineStyles

 /**
  * Load generated CSS output and place style tag in wp_head
  */
 public function inlineStyles()
 {
     ob_start();
     echo '<style id="cornerstone-generated-preview-css" type="text/css">';
     $settings = CS()->settings();
     $options = CS()->customizer()->optionData();
     extract($settings);
     extract($options);
     include CS()->path() . 'includes/builder/styles.php';
     do_action('cornerstone_generated_preview_css');
     echo '</style>';
     $css = ob_get_contents();
     ob_end_clean();
     //
     // 1. Remove comments.
     // 2. Remove whitespace.
     // 3. Remove starting whitespace.
     //
     $output = preg_replace('#/\\*.*?\\*/#s', '', $css);
     // 1
     $output = preg_replace('/\\s*([{}|:;,])\\s+/', '$1', $output);
     // 2
     $output = preg_replace('/\\s\\s+(.*)/', '$1', $output);
     // 3
     echo $output;
 }
开发者ID:saparhadi,项目名称:morowaliweb,代码行数:29,代码来源:class-preview-window.php

示例5: __construct

 public function __construct()
 {
     /* Get all saved data and put them in self::$settings for later use */
     self::$settings = CS()->settings();
     /* Handles post data */
     if (isset($_POST['cornerstone_options_submitted']) && isset($_POST['cornerstone-fields'])) {
         if (strip_tags($_POST['cornerstone_options_submitted']) == 'submitted' && current_user_can('manage_options')) {
             $fields = $_POST['cornerstone-fields'];
             // Empty checkboxes
             if (isset($_POST['cornerstone-checkboxes'])) {
                 foreach ($_POST['cornerstone-checkboxes'] as $name) {
                     if (!in_array($name, $fields)) {
                         self::$settings[$name] = array();
                     }
                 }
             }
             // Convert checkbox to boolean
             if (isset($_POST['cornerstone-checkbox'])) {
                 foreach ($_POST['cornerstone-checkbox'] as $name) {
                     self::$settings[$name] = in_array($name, $fields);
                 }
             }
             foreach ($fields as $name => $value) {
                 // remove html tags
                 self::$settings[$name] = is_array($value) ? array_map('strip_tags', $value) : strip_tags($value);
             }
             update_option('cornerstone_settings', self::$settings);
         }
     }
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:30,代码来源:class-settings-handler.php

示例6: addMediaButton

 public function addMediaButton($editor_id)
 {
     $this->enqueue();
     $title = sprintf(__('Insert Shortcodes', csl18n()));
     $contents = CS()->view('svg/nav-elements-solid', false);
     echo "<button href=\"#\" title=\"{$title}\" id=\"cs-insert-shortcode-button\" class=\"button cs-insert-btn\">{$contents}</button>";
 }
开发者ID:bitflipper1,项目名称:ghcontracting,代码行数:7,代码来源:class-shortcode-generator.php

示例7: controls

 public function controls()
 {
     global $post;
     $url = add_query_arg(array('url' => CS()->common()->getEditURL(get_the_id())), admin_url('customize.php'));
     $link = '<a href="' . $url . '">' . __('Customizer', csl18n()) . '</a>';
     $html = '<ul class="cs-controls"><li class="cs-control cs-control-info-box"><h4>' . __('Looking for global styling?', csl18n()) . '</h4><p>' . sprintf(__('Sitewide styles outside of the content area are managed via the %s.', csl18n()), $link) . '</p></li></ul>';
     return array('customizer_message' => array('type' => 'custom-markup', 'ui' => array(), 'options' => array('html' => $html)));
 }
开发者ID:elinberg,项目名称:ericlinberg,代码行数:8,代码来源:definition.php

示例8: getAllowedPostTypes

 /**
  * Get an array of post types allowed for Cornerstone.
  * This is based on both user role, and enabled post types
  * @return array
  */
 public function getAllowedPostTypes()
 {
     $settings = CS()->settings();
     $user = wp_get_current_user();
     if (!empty($user) && (user_can($user, 'manage_options') || count(array_intersect($settings['permitted_roles'], (array) $user->roles)) > 0)) {
         return apply_filters('cornerstone_allowed_post_types', $settings['allowed_post_types']);
     }
     return array();
 }
开发者ID:GolgoSoft,项目名称:KeenerWP,代码行数:14,代码来源:class-common.php

示例9: preInit

 public static function preInit()
 {
     // Disable NextGEN Resource Manager
     add_filter('run_ngg_resource_manager', '__return_false');
     global $wp_version;
     if (version_compare($wp_version, '4.1', '<')) {
         require_once CS()->path('includes/utility/wp-json.php');
     }
 }
开发者ID:aguidetta,项目名称:Enduris,代码行数:9,代码来源:conflict-resolution.php

示例10: setup

 public function setup()
 {
     // Disable revision through filter
     if (apply_filters('cornerstone_disable_revisions', false) || !CS()->common()->uses_cornerstone()) {
         return;
     }
     // Save cornerstone revision
     add_action('save_post', array($this, 'saveRevision'), 10, 2);
     // Restore cornerstone revision
     add_action('wp_restore_post_revision', array($this, 'restoreRevision'), 10, 2);
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:11,代码来源:class-revision-manager.php

示例11: handler

 public function handler($data)
 {
     global $post;
     $settings = get_post_meta($post->ID, '_cornerstone_settings', true);
     $settings['responsive_text'] = isset($data['elements']) ? $data['elements'] : array();
     update_post_meta($post->ID, '_cornerstone_settings', $settings);
     $save_handler = CS()->component('Save_Handler');
     foreach ($settings['responsive_text'] as $element) {
         $save_handler->append_element($element);
     }
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:11,代码来源:definition.php

示例12: setup

 /**
  * Instantiate
  */
 public function setup()
 {
     $this->fontIcons = $this->plugin->config('common/font-icons');
     add_action('init', array($this, 'init'));
     $version = CS()->version();
     if (false !== strpos($version, '-alpha')) {
         $this->plugin->loadComponent('Alpha');
     }
     if (false !== strpos($version, '-')) {
         $this->plugin->loadComponent('Prerelease');
     }
 }
开发者ID:elinberg,项目名称:ericlinberg,代码行数:15,代码来源:class-common.php

示例13: __construct

 public function __construct($data, $parent = null)
 {
     $this->parent = $parent;
     $this->data = $data;
     $type = isset($this->data['_type']) ? $this->data['_type'] : 'undefined';
     $this->definition = CS()->component('Element_Orchestrator')->get($type);
     if (isset($data['elements'])) {
         unset($this->data['elements']);
         foreach ($data['elements'] as $element) {
             $this->elements[] = new self($element, $this);
         }
     }
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:13,代码来源:class-element-walker.php

示例14: ajaxResponseDelete

 public function ajaxResponseDelete()
 {
     if (!isset($_POST['slug'])) {
         return wp_send_json_error('Invalid request.');
     }
     $query = new WP_Query(array('post_type' => 'cs_user_templates', 'meta_key' => 'cs_template_slug', 'meta_value' => $_POST['slug']));
     if ($query->post && wp_delete_post($query->post->ID, true)) {
         if (CS()->common()->isDebug()) {
             return wp_send_json_success();
         }
         return @wp_send_json_success();
     }
     return wp_send_json_error('Unable to delete template.');
 }
开发者ID:GolgoSoft,项目名称:KeenerWP,代码行数:14,代码来源:class-user-layout-manager.php

示例15: x_pairing_notice

function x_pairing_notice()
{
    if (x_plugin_cornerstone_exists() && class_exists('CS')) {
        if (!defined('X_CURRENT') || version_compare(CS()->version(), X_CORNERSTONE_CURRENT, '<')) {
            ?>

      <div class="updated x-notice warning">
        <p><strong>IMPORTANT: Please update Cornerstone</strong>. You are using a newer version of X that may not be compatible. After updating, please ensure that you have cleared out your browser cache and any caching plugins you may be using. This message will self destruct upon updating Cornerstone.</p>
      </div>

    <?php 
        }
    }
}
开发者ID:ju4nr3v0l,项目名称:juandavidmarulanda.com,代码行数:14,代码来源:migration.php


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