public final function _convergeControlData()
 {
     $control_objects = array();
     $defaults = array();
     foreach ($this->legacy_controls as $item) {
         $name = $item['name'];
         $config = array('type' => $item['controlType'], 'ui' => array(), 'options' => $item['options'], 'suggest' => $item['defaultValue']);
         if (!is_null($item['controlTitle'])) {
             $config['ui']['title'] = $item['controlTitle'];
         }
         if (!is_null($item['controlTooltip'])) {
             $config['ui']['tooltip'] = $item['controlTooltip'];
         }
         $control = Cornerstone_Control::factory($name, $config);
         if (is_wp_error($control)) {
             trigger_error('Failed to create Cornerstone_Control: ' . $control->get_error_message(), E_USER_WARNING);
             continue;
         }
         // Factory can send back an array, but we don't need to add that support for legacy elements
         if (is_array($control)) {
             trigger_error('Failed to create Cornerstone_Control: Old element version does not support groups. ' . $name, E_USER_WARNING);
         } else {
             $defaults[$control->name] = $control->transformSuggestion($item['defaultValue']);
             $control_objects[] = $control;
         }
     }
     $control_models = array();
     foreach ($control_objects as $control) {
         $control_models[] = $control->model_data();
     }
     return array('controls' => $control_models, 'defaults' => $defaults);
 }
 /**
  * Process data before it is rendered.
  * @param  array   $data    Input data
  * @param  boolean $saving  If the data is meant to be saved (otherwise we're in the preview window)
  * @param  boolean $child   Flag indicating if we're working recursively
  * @return [type]           Formatted output data
  */
 public function formatData($data, $saving = false, $child = false)
 {
     $element = $this->manager->get($data['_type']);
     $data = wp_parse_args($data, $element->get_defaults());
     if (isset($data['_csmeta'])) {
         unset($data['_csmeta']);
     }
     // Recursively apply to child collections
     if (isset($data['elements']) && count($data['elements']) > 0) {
         $elements = array();
         foreach ($data['elements'] as $key => $item) {
             $elements[] = $this->formatData($item, $saving, true);
         }
         $data['elements'] = $elements;
     } else {
         $data['elements'] = array();
     }
     if (isset($data['custom_id'])) {
         $data['id'] = $data['custom_id'];
         unset($data['custom_id']);
     }
     // Format data before rendering
     foreach ($data as $key => $item) {
         if (is_array($item) && count($item) == 5 && ($item[4] == 'linked' || $item[4] == 'unlinked')) {
             $data[$key . '_linked'] = array_pop($item);
             $data[$key] = array_map('esc_html', array($item[0], $item[1], $item[2], $item[3]));
             continue;
         }
         // Convert boolean to string
         if ($item === true) {
             $data[$key] = 'true';
             continue;
         }
         if ($item === false) {
             $data[$key] = 'false';
             continue;
         }
         // Secure HTML from unworthy users
         if (is_string($item)) {
             $data[$key] = Cornerstone_Control::sanitize_html($item);
             continue;
         }
     }
     if (!isset($data['content'])) {
         $data['content'] = '';
     }
     return $data;
 }
 public function sanitize($data)
 {
     return Cornerstone_Control::sanitize_html($data);
 }
 public function sanitize($data)
 {
     $controls = $this->get_controls_by_keys(array_keys($data));
     foreach ($data as $key => $value) {
         if ($key == 'elements') {
             continue;
         }
         $data[$key] = isset($controls[$key]) ? $controls[$key]->sanitize($value) : Cornerstone_Control::default_sanitize($value, $key);
     }
     return $data;
 }
 public static function kses_tags()
 {
     if (!isset(self::$kses_tags)) {
         self::$kses_tags = wp_kses_allowed_html('post');
         self::$kses_tags['iframe'] = array('align' => true, 'frameborder' => true, 'height' => true, 'width' => true, 'sandbox' => true, 'seamless' => true, 'scrolling' => true, 'srcdoc' => true, 'src' => true, 'class' => true, 'id' => true, 'style' => true, 'border' => true, 'list' => true);
     }
     return self::$kses_tags;
 }