示例#1
0
 public function Save()
 {
     $code = $_POST['code'];
     $this->stats_code = stripslashes($code);
     OnePanel::PackData();
     die(true);
 }
示例#2
0
 /**
  * Generic Dectivate
  * 
  * @return str span_id|off
  */
 public function Deactivate()
 {
     $this->active = false;
     OnePanel::PackData();
     $response = array();
     $response['module'] = is_null($this->alternate_key) ? get_class($this) : $this->alternate_key;
     $response['container_class'] = 'F-inactive';
     $response['thumb_class'] = 'ThumbInActive';
     $response['info_class'] = 'FeatureInActiveInfo';
     $response['info_content'] = 'Feature is inactive.';
     $response['button_text'] = '<a href="javascript:;" onclick="op_admin.AjaxOnOff(\'opcp_' . (is_null($this->alternate_key) ? get_class($this) : $this->alternate_key) . 'Activate\')"><img src="' . get_option('home') . '/wp-content/plugins/OnePanel/images/default/pop_content/enable.gif" border="0" /></a>';
     $response = json_encode($response);
     die($response);
 }
示例#3
0
 protected function IncreaseViewCount()
 {
     $this->view_count++;
     OnePanel::PackData();
 }
示例#4
0
 public function SaveURL()
 {
     $feedburner_url = mysql_real_escape_string($_POST['url']);
     if (is_string($feedburner_url)) {
         $feature =& $this->features['FeedBurnerToggle'];
         if (is_object($feature)) {
             $feature->SetFeedBurnerURL($feedburner_url);
             OnePanel::PackData();
             die(true);
         } else {
             die('No Feature by the name FeedBurnerToggle');
         }
     }
 }
示例#5
0
 public static function CleanupData($user_data)
 {
     // I'm just going to run this when debug is on
     if (!OnePanelConfig::UsingDebug()) {
         return true;
     } else {
         // TODO just for 2.0
         $laguage_name = self::$default_language;
         if (class_exists('OnePanel')) {
             $user_language_data =& OnePanel::GetLanguageData($laguage_name);
         } elseif (class_exists('OnePanelTheme')) {
             $user_language_data =& OnePanelTheme::GetLanguageData($laguage_name);
         } else {
             trigger_error('One Panel Error: No One Panel object present.', E_ERROR);
             die;
         }
         $config_file_data =& self::$data[$laguage_name];
         if (empty($config_file_data)) {
             trigger_error('One Panel Error: No language data in the config file.', E_ERROR);
             die;
         }
         $change_flag = false;
         // Lets check the config data for and additions
         foreach ($config_file_data as $key => &$term) {
             // Is it new?
             if (!isset($user_language_data[$key])) {
                 $change_flag = true;
                 $user_language_data[$key] = $term;
             }
         }
         // Now lets check for removals
         foreach ($user_language_data as $key => &$term) {
             // Has it gone?
             if (!isset($config_file_data[$key])) {
                 $change_flag = true;
                 unset($user_language_data[$key]);
             }
         }
         // All done, pack it up and lets get out of here
         if ($change_flag == true) {
             if (class_exists('OnePanel')) {
                 OnePanel::PackData();
             } elseif (class_exists('OnePanelTheme')) {
                 OnePanelTheme::PackData();
             }
         }
         return true;
     }
 }
示例#6
0
 public function ChangeMode()
 {
     $limit_mode = $_POST['limit_mode'];
     if (!is_numeric($limit_mode)) {
         die(false);
     }
     $limit_mode = (int) $limit_mode;
     $this->limit_mode = $limit_mode;
     if ($limit_mode == 3) {
         $limit = $_POST['limit'];
         if (!is_numeric($limit)) {
             die(false);
         }
         $this->content_limit = (int) $limit;
     }
     OnePanel::PackData();
     die(true);
 }
示例#7
0
 public function SwitchLink()
 {
     $feature_object =& $this->features['MenuLinksFeature'];
     if (is_object($feature_object)) {
         $feature_object->ToggleLink($_POST['menu'], $_POST['id'], $_POST['state']);
         OnePanel::PackData();
         die;
     } else {
         die('No object by the name: MenuLinksFeature');
     }
 }
示例#8
0
 public function SwitchLayout()
 {
     $layout = mysql_real_escape_string($_POST['layout']);
     $this->features['HomePageLayoutFeature']->SetDefaultLayout($layout);
     OnePanel::PackData();
     die(true);
 }
示例#9
0
 public function Save()
 {
     $response = '';
     if (!isset($_POST['key']) || !isset($_POST['text'])) {
         $response .= '<div class="popup_no_results"><div class="module_error_stroke">One Panel Error: Invalid Post</div></div>';
     } else {
         $key = $_POST['key'];
         $text = $_POST['text'];
         $editing_language = OnePanelLanguage::GetDefaultLanguage();
         // TODO this needs to change in 2.1
         if (!$editing_language) {
             trigger_error('One Panel Error: No default language.', E_WARNING);
         }
         $language_data =& OnePanel::GetLanguageData($editing_language);
         if (!isset($language_data[$key])) {
             $response .= '<div class="popup_no_results"><div class="module_error_stroke">One Panel Error: Invalid Language Term</div></div>';
         } else {
             $language_data[$key] = $text;
             OnePanel::PackData();
             $response = true;
         }
     }
     return $response;
 }
示例#10
0
 public function SaveCode()
 {
     $ad_code = stripslashes($_POST['code']);
     $block_name = mysql_real_escape_string($_POST['block_name']);
     if (is_string($ad_code)) {
         $feature =& $this->features[$this->GetBlockKey($block_name)];
         if (is_object($feature)) {
             $feature->SetAdCode($ad_code);
             OnePanel::PackData();
             die(true);
         } else {
             die('No Adblock by the name' . $block_name);
         }
     }
 }
示例#11
0
 public function SwitchEntryMode()
 {
     $entry_mode = mysql_real_escape_string($_POST['entry_mode']);
     $feature =& $this->features['FeaturedVideoFeature'];
     if (is_object($feature)) {
         if ($entry_mode == 'youtube') {
             $feature->SetVideoMode(2);
             OnePanel::PackData();
             die($feature->RenderYoutubeEntry());
         } elseif ($entry_mode == 'embed') {
             $feature->SetVideoMode(3);
             OnePanel::PackData();
             die($feature->RenderCodeEntry());
         }
     } else {
         die('No feature by the name FeaturedVideoFeature');
     }
 }
示例#12
0
 public function SetCategory()
 {
     $highlight_name = mysql_real_escape_string($_POST['highlight_name']);
     $highlight =& $this->features[self::GetHighlightKey($highlight_name)];
     $new_cat_id = (int) mysql_real_escape_string($_POST['id']);
     $highlight->SetSourceID($new_cat_id);
     OnePanel::PackData();
     $highlight->GetChunk();
     // Refresh the chunk data
     $response = '';
     if (is_object($highlight)) {
         $response .= '<div class="title">' . $highlight->GetDetailedChunk('Title') . '</div>';
         $response .= '<div>' . $highlight->GetDetailedChunk('Content') . '</div>';
     }
     die($response);
 }
示例#13
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));
 }