/**
  * Parses saved styling looking for Google Fonts references to load them.
  * 
  * @since 1.0.0
  */
 public function render_style()
 {
     $styles = TF_Model::get_custom_styling(null, array('include_template_part' => true, 'include_global_style' => true));
     if (count($styles) > 0) {
         $this->generate_css($styles, true);
     }
 }
 public function get_bootstrap_styles($post_id, $args = array())
 {
     $make_data = array();
     $styles = TF_Model::get_custom_styling($post_id, $args);
     if (!empty($styles) && is_array($styles)) {
         foreach ($styles as $uniqid => $setting) {
             $temp_data = array('ID' => $uniqid, 'module' => $setting['module']);
             if (isset($setting['settings']) && count($setting['settings']) > 0) {
                 $temp_data['settings'] = array();
                 foreach ($setting['settings'] as $selector_key => $properties) {
                     $temp_setting = array('SettingKey' => $selector_key);
                     $temp_props = array();
                     foreach ($properties as $property => $value) {
                         $temp_props[$property] = $value;
                     }
                     $temp_data['settings'][] = array_merge($temp_setting, $temp_props);
                 }
             }
             $make_data[] = $temp_data;
         }
     }
     return $make_data;
 }
 /**
  * Update template stylesheet.
  * 
  * @since 1.0.0
  * @access public
  * @return json
  */
 public function clear_template_style()
 {
     // Check ajax referer
     check_ajax_referer($this->action_nonce, $this->field_nonce);
     global $tf_styles;
     $template_id = intval($_POST['template_id']);
     $dataStyling = isset($_POST['dataStyling']) ? json_decode(stripslashes($_POST['dataStyling']), true) : array();
     TF_Model::save_styling($template_id, $dataStyling);
     $styles = TF_Model::get_custom_styling($template_id, array('include_template_part' => true, 'include_global_style' => true));
     $data = '<style type="text/css" id="tf-template-layout-css">' . $tf_styles->generate_css($styles) . '</style>';
     wp_send_json_success($data);
 }
 /**
  * Fires to save Template Part form.
  * 
  * @since 1.0.0
  * @access public
  * @param array $post_data Form submit data.
  * @return json
  */
 public function saving_region_form($post_data)
 {
     global $tf_editor_ui;
     $slug = sanitize_text_field($post_data['tf_template_part_shortcode']);
     $shortcode = sprintf('[%s slug="%s"]', 'tf_template_part', $slug);
     $edit_url = TF_Model::get_template_part_edit_url($shortcode, array('tf_region' => $post_data['_target_region']));
     //$css = TF_Model::get_style_preview();
     global $TF, $tf_styles;
     $atom = get_page_by_path($slug, OBJECT, 'tf_template_part');
     if (is_object($atom)) {
         $css = $tf_styles->generate_css(TF_Model::get_custom_styling($atom->ID, array('include_template_part' => true, 'include_global_style' => false, 'include_module_style' => true)));
     } else {
         $css = '';
     }
     $tf_editor_ui->force_read_shortcode();
     $data = array('region' => $post_data['_target_region'], 'html' => do_shortcode($shortcode), 'shortcode' => $shortcode, 'edit_url' => $edit_url, 'slug' => $slug, 'caption' => sprintf(__('Template Part: %s', 'themify-flow'), TF_Model::get_template_part_title($slug)), 'styles' => $css);
     wp_send_json_success($data);
 }