public function AddColorPalette(AdsenseColorPalette $palette, $skin_name)
 {
     // If debug, check for the existence of the skin
     if (is_string($skin_name)) {
         if (OnePanelConfig::UsingDebug()) {
             $skins =& OnePanelConfig::GetSkins();
             if (!array_key_exists($skin_name, $skins)) {
                 die('You are trying to add a color palette for a skin that has not been added.');
             }
         }
     } else {
         die('You must pass a valid string name to AddColorPalette');
     }
     $this->palettes[$skin_name] =& $palette;
 }
Example #2
0
 public function ResetImage()
 {
     $feature_key = $_POST['feature_key'];
     $image_key = $_POST['image_key'];
     $skin_name = $_POST['skin_name'];
     $feature = $this->features[$feature_key];
     if (is_object($feature)) {
         $config_skins =& OnePanelConfig::GetSkins();
         $config_images = $config_skins[$skin_name]->GetManagableImages();
         $default = $config_images[$image_key];
         $feature->UpdateImage($image_key, $default);
         OnePanel::PackData();
         $response['new_image'] = $default;
         $response['preview_id'] = 'upload_preview_' . str_replace(' ', '_', $image_key);
     } else {
         die('Nothing by the name ' . $feature_key);
     }
     // TODO what if it fails?
     die(json_encode($response));
 }