function ot_type_slider($args = array())
 {
     /* turns arguments array into variables */
     extract($args);
     /* verify a description */
     $has_desc = $field_desc ? true : false;
     /* format setting outer wrapper */
     echo '<div class="format-setting type-slider ' . ($has_desc ? 'has-desc' : 'no-desc') . '">';
     /* description */
     echo $has_desc ? '<div class="description">' . htmlspecialchars_decode($field_desc) . '</div>' : '';
     /* format setting inner wrapper */
     echo '<div class="format-setting-inner">';
     /* pass the settings array arround */
     echo '<input type="hidden" name="' . esc_attr($field_id) . '_settings_array" id="' . esc_attr($field_id) . '_settings_array" value="' . ot_encode(serialize($field_settings)) . '" />';
     /** 
      * settings pages have array wrappers like 'option_tree'.
      * So we need that value to create a proper array to save to.
      * This is only for NON metabox settings.
      */
     if (!isset($get_option)) {
         $get_option = '';
     }
     /* build list items */
     echo '<ul class="option-tree-setting-wrap option-tree-sortable" data-name="' . esc_attr($field_id) . '" data-id="' . esc_attr($post_id) . '" data-get-option="' . esc_attr($get_option) . '" data-type="' . esc_attr($type) . '">';
     if (is_array($field_value) && !empty($field_value)) {
         foreach ($field_value as $key => $list_item) {
             echo '<li class="ui-state-default list-list-item">';
             ot_list_item_view($field_id, $key, $list_item, $post_id, $get_option, $field_settings, $type);
             echo '</li>';
         }
     }
     echo '</ul>';
     /* button */
     echo '<a href="javascript:void(0);" class="option-tree-list-item-add option-tree-ui-button button button-primary right hug-right" title="' . __('Add New', 'option-tree') . '">' . __('Add New', 'option-tree') . '</a>';
     /* description */
     echo '<div class="list-item-description">' . __('You can re-order with drag & drop, the order will update after saving.', 'option-tree') . '</div>';
     echo '</div>';
     echo '</div>';
 }
Esempio n. 2
0
 /**
  * AJAX utility function for adding a new list item.
  */
 public function add_list_item()
 {
     ot_list_item_view($_REQUEST['name'], $_REQUEST['count'], array(), $_REQUEST['post_id'], $_REQUEST['get_option'], unserialize(ot_decode($_REQUEST['settings'])), $_REQUEST['type']);
     die;
 }
Esempio n. 3
0
 /**
  * AJAX utility function for adding a new list item.
  */
 public function add_list_item()
 {
     check_ajax_referer('option_tree', 'nonce');
     ot_list_item_view($_REQUEST['name'], $_REQUEST['count'], array(), $_REQUEST['post_id'], $_REQUEST['get_option'], unserialize(ot_decode($_REQUEST['settings'])), $_REQUEST['type']);
     die;
 }