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


PHP ot_insert_css_with_markers函数代码示例

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


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

示例1: save_meta_box

 /**
  * Saves the meta box values
  *
  * @return    void
  *
  * @access    public
  * @since     1.0
  */
 function save_meta_box($post_id, $post_object)
 {
     global $pagenow;
     /* don't save during quick edit */
     if ($pagenow == 'admin-ajax.php') {
         return $post_id;
     }
     /* don't save during autosave */
     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
         return $post_id;
     }
     /* don't save if viewing a revision */
     if ($post_object->post_type == 'revision') {
         return $post_id;
     }
     /* verify nonce */
     if (isset($_POST[$this->meta_box['id'] . '_nonce']) && !wp_verify_nonce($_POST[$this->meta_box['id'] . '_nonce'], $this->meta_box['id'])) {
         return $post_id;
     }
     /* check permissions */
     if (isset($_POST['post_type']) && 'page' == $_POST['post_type']) {
         if (!current_user_can('edit_page', $post_id)) {
             return $post_id;
         }
     } else {
         if (!current_user_can('edit_post', $post_id)) {
             return $post_id;
         }
     }
     foreach ($this->meta_box['fields'] as $field) {
         $old = get_post_meta($post_id, $field['id'], true);
         $new = '';
         /* there is data to validate */
         if (isset($_POST[$field['id']])) {
             /* slider and list item */
             if (in_array($field['type'], array('list-item', 'slider'))) {
                 /* required title setting */
                 $required_setting = array(array('id' => 'title', 'label' => __('Title', 'option-tree'), 'desc' => '', 'std' => '', 'type' => 'text', 'rows' => '', 'class' => 'option-tree-setting-title', 'post_type' => '', 'choices' => array()));
                 /* get the settings array */
                 $settings = isset($_POST[$field['id'] . '_settings_array']) ? unserialize(ot_decode($_POST[$field['id'] . '_settings_array'])) : array();
                 /* settings are empty for some odd ass reason get the defaults */
                 if (empty($settings)) {
                     $settings = 'slider' == $field['type'] ? ot_slider_settings($field['id']) : ot_list_item_settings($field['id']);
                 }
                 /* merge the two settings array */
                 $settings = array_merge($required_setting, $settings);
                 foreach ($_POST[$field['id']] as $k => $setting_array) {
                     foreach ($settings as $sub_setting) {
                         /* verify sub setting has a type & value */
                         if (isset($sub_setting['type']) && isset($_POST[$field['id']][$k][$sub_setting['id']])) {
                             $_POST[$field['id']][$k][$sub_setting['id']] = ot_validate_setting($_POST[$field['id']][$k][$sub_setting['id']], $sub_setting['type'], $sub_setting['id']);
                         }
                     }
                 }
                 /* set up new data with validated data */
                 $new = $_POST[$field['id']];
             } else {
                 /* run through validattion */
                 $new = ot_validate_setting($_POST[$field['id']], $field['type'], $field['id']);
             }
             /* insert CSS */
             if ($field['type'] == 'css') {
                 /* insert CSS into dynamic.css */
                 if ('' !== $new) {
                     ot_insert_css_with_markers($field['id'], $new, true);
                     /* remove old CSS from dynamic.css */
                 } else {
                     ot_remove_old_css($field['id']);
                 }
             }
         }
         if ($new && $new !== $old) {
             update_post_meta($post_id, $field['id'], $new);
         } else {
             if ('' == $new && $old) {
                 delete_post_meta($post_id, $field['id'], $old);
             }
         }
     }
 }
开发者ID:Jwiens92,项目名称:CumberLandSpice,代码行数:88,代码来源:ot-meta-box-api.php

示例2: ot_save_css

 function ot_save_css($options)
 {
     /* grab a copy of the settings */
     $settings = get_option(ot_settings_id());
     /* has settings */
     if (isset($settings['settings'])) {
         /* loop through sections and insert CSS when needed */
         foreach ($settings['settings'] as $k => $setting) {
             /* is the CSS option type */
             if (isset($setting['type']) && 'css' == $setting['type']) {
                 /* insert CSS into dynamic.css */
                 if (isset($options[$setting['id']]) && '' !== $options[$setting['id']]) {
                     ot_insert_css_with_markers($setting['id'], $options[$setting['id']]);
                     /* remove old CSS from dynamic.css */
                 } else {
                     ot_remove_old_css($setting['id']);
                 }
             }
         }
     }
 }
开发者ID:ElectricEasel,项目名称:reflection,代码行数:21,代码来源:ot-functions-admin.php


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