當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。