wp/wp-content/plugins/option-tree/includes/ot-meta-box-api.php
author ymh <ymh.work@gmail.com>
Mon, 14 Oct 2019 17:39:30 +0200
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
permissions -rwxr-xr-x
resynchronize code repo with production
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php if ( ! defined( 'OT_VERSION' ) ) exit( 'No direct script access allowed' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
 * OptionTree Meta Box API
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
 * This class loads all the methods and helpers specific to build a meta box.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
 * @package   OptionTree
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
 * @author    Derek Herman <derek@valendesigns.com>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
 * @copyright Copyright (c) 2013, Derek Herman
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
if ( ! class_exists( 'OT_Meta_Box' ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
  class OT_Meta_Box {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
  
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
    /* variable to store the meta box array */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
    private $meta_box;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
  
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
    /**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
     * PHP5 constructor method.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
     *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
     * This method adds other methods of the class to specific hooks within WordPress.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
     *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
     * @uses      add_action()
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
     *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
     * @return    void
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
     *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
     * @access    public
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
     * @since     1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
     */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
    function __construct( $meta_box ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
      if ( ! is_admin() )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
        return;
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    33
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    34
      global $ot_meta_boxes;
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    35
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    36
      if ( ! isset( $ot_meta_boxes ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    37
        $ot_meta_boxes = array();
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    38
      }
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    39
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    40
      $ot_meta_boxes[] = $meta_box;
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    41
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
      $this->meta_box = $meta_box;
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    43
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
      add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    45
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
      add_action( 'save_post', array( $this, 'save_meta_box' ), 1, 2 );
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    47
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
    }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
    
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
    /**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
     * Adds meta box to any post type
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
     *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
     * @uses      add_meta_box()
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
     *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
     * @return    void
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
     *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
     * @access    public
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
     * @since     1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
     */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
    function add_meta_boxes() {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
      foreach ( (array) $this->meta_box['pages'] as $page ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
        add_meta_box( $this->meta_box['id'], $this->meta_box['title'], array( $this, 'build_meta_box' ), $page, $this->meta_box['context'], $this->meta_box['priority'], $this->meta_box['fields'] );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    63
      }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    64
    }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
    
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
    /**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
     * Meta box view
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
     *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    69
     * @return    string
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    70
     *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    71
     * @access    public
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    72
     * @since     1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    73
     */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    74
    function build_meta_box( $post, $metabox ) {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    75
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    76
      echo '<div class="ot-metabox-wrapper">';
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    77
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    78
        /* Use nonce for verification */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
        echo '<input type="hidden" name="' . $this->meta_box['id'] . '_nonce" value="' . wp_create_nonce( $this->meta_box['id'] ) . '" />';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    80
        
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    81
        /* meta box description */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    82
        echo isset( $this->meta_box['desc'] ) && ! empty( $this->meta_box['desc'] ) ? '<div class="description" style="padding-top:10px;">' . htmlspecialchars_decode( $this->meta_box['desc'] ) . '</div>' : '';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    83
      
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    84
        /* loop through meta box fields */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    85
        foreach ( $this->meta_box['fields'] as $field ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    86
        
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    87
          /* get current post meta data */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    88
          $field_value = get_post_meta( $post->ID, $field['id'], true );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    89
          
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    90
          /* set standard value */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    91
          if ( isset( $field['std'] ) ) {  
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
            $field_value = ot_filter_std_value( $field_value, $field['std'] );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    93
          }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    94
          
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    95
          /* build the arguments array */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    96
          $_args = array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    97
            'type'              => $field['type'],
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    98
            'field_id'          => $field['id'],
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    99
            'field_name'        => $field['id'],
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   100
            'field_value'       => $field_value,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   101
            'field_desc'        => isset( $field['desc'] ) ? $field['desc'] : '',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   102
            'field_std'         => isset( $field['std'] ) ? $field['std'] : '',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   103
            'field_rows'        => isset( $field['rows'] ) && ! empty( $field['rows'] ) ? $field['rows'] : 10,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   104
            'field_post_type'   => isset( $field['post_type'] ) && ! empty( $field['post_type'] ) ? $field['post_type'] : 'post',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   105
            'field_taxonomy'    => isset( $field['taxonomy'] ) && ! empty( $field['taxonomy'] ) ? $field['taxonomy'] : 'category',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   106
            'field_min_max_step'=> isset( $field['min_max_step'] ) && ! empty( $field['min_max_step'] ) ? $field['min_max_step'] : '0,100,1',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   107
            'field_class'       => isset( $field['class'] ) ? $field['class'] : '',
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   108
            'field_condition'   => isset( $field['condition'] ) ? $field['condition'] : '',
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   109
            'field_operator'    => isset( $field['operator'] ) ? $field['operator'] : 'and',
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   110
            'field_choices'     => isset( $field['choices'] ) ? $field['choices'] : array(),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   111
            'field_settings'    => isset( $field['settings'] ) && ! empty( $field['settings'] ) ? $field['settings'] : array(),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   112
            'post_id'           => $post->ID,
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   113
            'meta'              => true
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   114
          );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   115
          
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   116
          $conditions = '';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   117
          
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   118
          /* setup the conditions */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   119
          if ( isset( $field['condition'] ) && ! empty( $field['condition'] ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   120
  
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   121
            $conditions = ' data-condition="' . $field['condition'] . '"';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   122
            $conditions.= isset( $field['operator'] ) && in_array( $field['operator'], array( 'and', 'AND', 'or', 'OR' ) ) ? ' data-operator="' . $field['operator'] . '"' : '';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   123
  
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   124
          }
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   125
          
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   126
          /* only allow simple textarea due to DOM issues with wp_editor() */
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   127
          if ( apply_filters( 'ot_override_forced_textarea_simple', false, $field['id'] ) == false && $_args['type'] == 'textarea' )
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   128
            $_args['type'] = 'textarea-simple';
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   129
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   130
          // Build the setting CSS class
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   131
          if ( ! empty( $_args['field_class'] ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   132
            
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   133
            $classes = explode( ' ', $_args['field_class'] );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   134
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   135
            foreach( $classes as $key => $value ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   136
            
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   137
              $classes[$key] = $value . '-wrap';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   138
              
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   139
            }
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   140
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   141
            $class = 'format-settings ' . implode( ' ', $classes );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   142
            
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   143
          } else {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   144
          
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   145
            $class = 'format-settings';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   146
            
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   147
          }
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   148
          
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   149
          /* option label */
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   150
          echo '<div id="setting_' . $field['id'] . '" class="' . $class . '"' . $conditions . '>';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   151
            
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   152
            echo '<div class="format-setting-wrap">';
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   153
            
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   154
              /* don't show title with textblocks */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   155
              if ( $_args['type'] != 'textblock' && ! empty( $field['label'] ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   156
                echo '<div class="format-setting-label">';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   157
                  echo '<label for="' . $field['id'] . '" class="label">' . $field['label'] . '</label>';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   158
                echo '</div>';
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   159
              }
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   160
      
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   161
              /* get the option HTML */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   162
              echo ot_display_by_type( $_args );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   163
              
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   164
            echo '</div>';
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   165
            
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   166
          echo '</div>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   167
          
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   168
        }
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   169
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   170
        echo '<div class="clear"></div>';
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   171
      
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   172
      echo '</div>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   173
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   174
    }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   175
    
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   176
    /**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   177
     * Saves the meta box values
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   178
     *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   179
     * @return    void
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   180
     *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   181
     * @access    public
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   182
     * @since     1.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   183
     */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   184
    function save_meta_box( $post_id, $post_object ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   185
      global $pagenow;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   186
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   187
      /* don't save if $_POST is empty */
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   188
      if ( empty( $_POST ) || ( isset( $_POST['vc_inline'] ) && $_POST['vc_inline'] == true ) )
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   189
        return $post_id;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   190
      
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   191
      /* don't save during quick edit */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   192
      if ( $pagenow == 'admin-ajax.php' )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   193
        return $post_id;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   194
        
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   195
      /* don't save during autosave */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   196
      if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   197
        return $post_id;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   198
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   199
      /* don't save if viewing a revision */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   200
      if ( $post_object->post_type == 'revision' || $pagenow == 'revision.php' )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   201
        return $post_id;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   202
  
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   203
      /* verify nonce */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   204
      if ( isset( $_POST[ $this->meta_box['id'] . '_nonce'] ) && ! wp_verify_nonce( $_POST[ $this->meta_box['id'] . '_nonce'], $this->meta_box['id'] ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   205
        return $post_id;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   206
    
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   207
      /* check permissions */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   208
      if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   209
        if ( ! current_user_can( 'edit_page', $post_id ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   210
          return $post_id;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   211
      } else {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   212
        if ( ! current_user_can( 'edit_post', $post_id ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   213
          return $post_id;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   214
      }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   215
      
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   216
      foreach ( $this->meta_box['fields'] as $field ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   217
        
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   218
        $old = get_post_meta( $post_id, $field['id'], true );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   219
        $new = '';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   220
        
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   221
        /* there is data to validate */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   222
        if ( isset( $_POST[$field['id']] ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   223
        
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   224
          /* slider and list item */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   225
          if ( in_array( $field['type'], array( 'list-item', 'slider' ) ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   226
              
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   227
            /* required title setting */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   228
            $required_setting = array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   229
              array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   230
                'id'        => 'title',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   231
                'label'     => __( 'Title', 'option-tree' ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   232
                'desc'      => '',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   233
                'std'       => '',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   234
                'type'      => 'text',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   235
                'rows'      => '',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   236
                'class'     => 'option-tree-setting-title',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   237
                'post_type' => '',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   238
                'choices'   => array()
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   239
              )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   240
            );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   241
            
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   242
            /* get the settings array */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   243
            $settings = isset( $_POST[$field['id'] . '_settings_array'] ) ? unserialize( ot_decode( $_POST[$field['id'] . '_settings_array'] ) ) : array();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   244
            
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   245
            /* settings are empty for some odd ass reason get the defaults */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   246
            if ( empty( $settings ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   247
              $settings = 'slider' == $field['type'] ? 
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   248
              ot_slider_settings( $field['id'] ) : 
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   249
              ot_list_item_settings( $field['id'] );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   250
            }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   251
            
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   252
            /* merge the two settings array */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   253
            $settings = array_merge( $required_setting, $settings );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   254
            
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   255
            foreach( $_POST[$field['id']] as $k => $setting_array ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   256
  
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   257
              foreach( $settings as $sub_setting ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   258
                
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   259
                /* verify sub setting has a type & value */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   260
                if ( isset( $sub_setting['type'] ) && isset( $_POST[$field['id']][$k][$sub_setting['id']] ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   261
                  
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   262
                  $_POST[$field['id']][$k][$sub_setting['id']] = ot_validate_setting( $_POST[$field['id']][$k][$sub_setting['id']], $sub_setting['type'], $sub_setting['id'] );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   263
                  
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   264
                }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   265
                
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   266
              }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   267
            
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   268
            }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   269
            
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   270
            /* set up new data with validated data */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   271
            $new = $_POST[$field['id']];
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   272
          
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   273
          } else if ( $field['type'] == 'social-links' ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   274
            
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   275
            /* get the settings array */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   276
            $settings = isset( $_POST[$field['id'] . '_settings_array'] ) ? unserialize( ot_decode( $_POST[$field['id'] . '_settings_array'] ) ) : array();
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   277
            
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   278
            /* settings are empty get the defaults */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   279
            if ( empty( $settings ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   280
              $settings = ot_social_links_settings( $field['id'] );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   281
            }
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   282
            
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   283
            foreach( $_POST[$field['id']] as $k => $setting_array ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   284
  
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   285
              foreach( $settings as $sub_setting ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   286
                
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   287
                /* verify sub setting has a type & value */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   288
                if ( isset( $sub_setting['type'] ) && isset( $_POST[$field['id']][$k][$sub_setting['id']] ) ) {
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   289
                  
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   290
                  $_POST[$field['id']][$k][$sub_setting['id']] = ot_validate_setting( $_POST[$field['id']][$k][$sub_setting['id']], $sub_setting['type'], $sub_setting['id'] );
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   291
                  
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   292
                }
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   293
                
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   294
              }
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   295
            
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   296
            }
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   297
            
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   298
            /* set up new data with validated data */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   299
            $new = $_POST[$field['id']];
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   300
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   301
          } else {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   302
            
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   303
            /* run through validattion */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   304
            $new = ot_validate_setting( $_POST[$field['id']], $field['type'], $field['id'] );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   305
            
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   306
          }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   307
          
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   308
          /* insert CSS */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   309
          if ( $field['type'] == 'css' ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   310
            
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   311
            /* insert CSS into dynamic.css */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   312
            if ( '' !== $new ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   313
              
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   314
              ot_insert_css_with_markers( $field['id'], $new, true );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   315
            
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   316
            /* remove old CSS from dynamic.css */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   317
            } else {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   318
            
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   319
              ot_remove_old_css( $field['id'] );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   320
              
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   321
            }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   322
          
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   323
          }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   324
        
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   325
        }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   326
        
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   327
        if ( isset( $new ) && $new !== $old ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   328
          update_post_meta( $post_id, $field['id'], $new );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   329
        } else if ( '' == $new && $old ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   330
          delete_post_meta( $post_id, $field['id'], $old );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   331
        }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   332
      }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   333
  
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   334
    }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   335
  
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   336
  }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   337
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   338
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   339
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   340
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   341
 * This method instantiates the meta box class & builds the UI.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   342
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   343
 * @uses     OT_Meta_Box()
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   344
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   345
 * @param    array    Array of arguments to create a meta box
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   346
 * @return   void
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   347
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   348
 * @access   public
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   349
 * @since    2.0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   350
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   351
if ( ! function_exists( 'ot_register_meta_box' ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   352
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   353
  function ot_register_meta_box( $args ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   354
    if ( ! $args )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   355
      return;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   356
      
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   357
    $ot_meta_box = new OT_Meta_Box( $args );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   358
  }
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   359
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   360
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   361
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   362
/* End of file ot-meta-box-api.php */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   363
/* Location: ./includes/ot-meta-box-api.php */