protected function addTemplateValues(&$data)
 {
     parent::addTemplateValues($data);
     if (!isset($this->data["noscript"])) {
         $data['[SCRIPT]'] = sprintf('<script type="text/javascript">%s</script>', str_replace("[ID]", $data['[ID]'], $this->jsInit()));
     } else {
         $data['[SCRIPT]'] = "";
     }
     $data["[VALUE]"] = empty($this->data["value"]) ? $this->data["default"] : $this->data["value"];
     $palette = empty($this->data["palette"]) ? array() : array_flip($this->data["palette"]);
     $t =& peTheme();
     $colors = $t->color->options();
     if (!empty($colors)) {
         $options = $t->options->all();
         $colors = array_keys($colors);
         foreach ($colors as $key) {
             if ($color = empty($options->{$key}) ? false : $options->{$key}) {
                 $palette[$color] = $color;
             }
         }
     }
     $palette["#000000"] = true;
     $palette["#ffffff"] = true;
     $palette["#dd3333"] = true;
     $palette["#eeee22"] = true;
     $palette["#81d742"] = true;
     $palette["#1e73be"] = true;
     if (!empty($palette)) {
         $data["[PALETTE]"] = sprintf('data-palette="%s"', esc_attr(json_encode(array_keys($palette))));
     }
 }
 protected function addTemplateValues(&$data)
 {
     parent::addTemplateValues($data);
     $blocks = isset($this->data["value"]) ? $this->data["value"] : false;
     if (!$blocks && is_array($data["[DEFAULT]"])) {
         $blocks = $data["[DEFAULT]"];
     }
     $buffer =& $data["[BLOCKS]"];
     $buffer = "";
     if ($blocks && is_array($blocks) && count($blocks) > 0) {
         $buffer = json_encode($blocks);
         if (strpos($buffer, '&quot;') > -1) {
             // kill goddamn &quot; which breaks esc_attr(json)
             array_walk_recursive($blocks, array("PeThemeFormElementLayout", "sanitize"));
             $buffer = json_encode($blocks);
         }
         $buffer = esc_attr($buffer);
     }
     $data["[ALLOWED]"] = empty($this->data["allowed"]) ? '' : esc_attr($this->data["allowed"]);
     $views = $this->data["views"];
     $buffer =& $data["[MODULES]"];
     $buffer = "";
     if (!empty($views)) {
         foreach ($views as $s => $section) {
             foreach ($section as $idx => $view) {
                 $cssClass = $view->cssClass();
                 $buffer .= sprintf('<div id="pe_module_%s" class="pe_module type_%s group_%s"><h3>%s<span class="help" title="%s">?</span></h3><div>%s</div></div>', $view->option(), $cssClass, $view->group(), $view->name(), $view->tooltip(), $s);
             }
         }
     }
 }
 public function registerAssets()
 {
     parent::registerAssets();
     PeThemeAsset::addScript("framework/js/admin/jquery.theme.field.icon.js", array("jquery-ui-dialog", "pe_theme_utils"), "pe_theme_field_icon");
     PeThemeAsset::addStyle("css/entypo-icon-font.css", array("wp-jquery-ui-dialog"), "pe_theme_admin_icon_font");
     wp_localize_script("pe_theme_field_icon", "pe_theme_field_icon", array("icons" => PeGlobal::$const->data->icons));
     wp_enqueue_style("pe_theme_admin_icon_font");
     wp_enqueue_script("pe_theme_field_icon");
 }
 public function registerAssets()
 {
     parent::registerAssets();
     PeThemeAsset::addScript("framework/js/admin/jquery.theme.field.sidebars.js", array("pe_theme_utils", "jquery-ui-sortable", "json2"), "pe_theme_field_sidebars");
     wp_enqueue_script("pe_theme_field_sidebars");
     // prototype.js alters JSON2 behaviour, it shouldn't be loaded in our admin page anyway but
     // if other plugins are forcing it in all wordpress admin pages, we get rid of it here.
     wp_deregister_script("prototype");
 }
 public function registerAssets()
 {
     parent::registerAssets();
     peTheme()->asset->registerAssets();
     PeThemeAsset::addScript("framework/js/admin/jquery.theme.field.thumbnails.js", array("jquery", "pe_theme_transform", "pe_theme_utils_geom"), "pe_theme_field_thumbnails");
     PeThemeAsset::addStyle("framework/css/jquery.theme.field.thumbnails.css", null, "pe_theme_field_thumbnails");
     wp_enqueue_script("pe_theme_field_thumbnails");
     wp_enqueue_style("pe_theme_field_thumbnails");
 }
 public function registerAssets()
 {
     parent::registerAssets();
     wp_enqueue_script("pe_theme_field_select");
     if (function_exists("wp_enqueue_media")) {
         PeThemeAsset::addScript("framework/js/admin/jquery.theme.field.upload.v35.js", array(), "pe_theme_field_upload");
         wp_enqueue_media();
     } else {
         PeThemeAsset::addScript("framework/js/admin/jquery.theme.field.upload.js", array(), "pe_theme_field_upload");
         wp_enqueue_script("thickbox");
         wp_enqueue_script("media-upload");
         wp_enqueue_style("thickbox");
     }
     wp_enqueue_script("pe_theme_field_upload");
 }
 protected function addTemplateValues(&$data)
 {
     parent::addTemplateValues($data);
     $blocks = isset($this->data["value"]) ? $this->data["value"] : false;
     if (!$blocks && is_array($data["[DEFAULT]"])) {
         $blocks = $data["[DEFAULT]"];
     }
     $data["[JSON]"] = $blocks && is_array($blocks) && count($blocks) > 0 ? json_encode($blocks) : "false";
     $data["[ALLOWED]"] = empty($this->data["allowed"]) ? '' : esc_attr($this->data["allowed"]);
     $views = $this->data["views"];
     $buffer =& $data["[MODULES]"];
     $buffer = "";
     if (!empty($views)) {
         foreach ($views as $s => $section) {
             foreach ($section as $idx => $view) {
                 $cssClass = $view->cssClass();
                 $buffer .= sprintf('<div id="pe_module_%s" class="pe_module type_%s group_%s"><h3>%s<span class="help" title="%s">?</span></h3><div>%s</div></div>', $view->option(), $cssClass, $view->group(), $view->name(), $view->tooltip(), $s);
             }
         }
     }
 }
 public function registerAssets()
 {
     parent::registerAssets();
 }
 public function registerAssets()
 {
     parent::registerAssets();
     PeThemeAsset::addScript("framework/js/admin/jquery.theme.field.select.js", array(), "pe_theme_field_select");
     wp_enqueue_script("pe_theme_field_select");
 }
 public function registerAssets()
 {
     parent::registerAssets();
     PeThemeAsset::addScript("framework/js/admin/jquery.theme.field.envatoUsername.js", array("jquery"), "pe_theme_field_envatoUsername");
     wp_enqueue_script("pe_theme_field_envatoUsername");
 }
 public function registerAssets()
 {
     parent::registerAssets();
     PeThemeAsset::addScript("framework/js/admin/jquery.theme.field.importDemo.js", array("jquery-ui-progressbar"), "pe_theme_field_importDemo");
     wp_enqueue_script("pe_theme_field_importDemo");
 }