public function Save() { $code = $_POST['code']; $this->stats_code = stripslashes($code); OnePanel::PackData(); die(true); }
/** * Start * * Singleton shortcut to run the constructor without returning the instance * */ public static function Start() { if (!is_object(self::$instance)) { // Check for the existence of the OnePanel object if (class_exists('OnePanel')) { if (is_object(OnePanel::GetInstance())) { return false; } } else { self::$instance = new OnePanelTheme(); } } }
/** * 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); }
* TODO consider allowing language terms of One Panel to be editable in future, * the object will need to be started here at that point. */ OnePanelLib::RequireFileOnce(ONE_PANEL_DIR . '/language.php'); // Include the config class, and create the OnePanelConfig Object OnePanelLib::RequireFileOnce(ONE_PANEL_DIR . '/onepanelconfig.php'); OnePanelConfig::Start(); // Include Externals //OnePanelLib::RequireFileOnce( ONE_PANEL_DIR .'/onepanelexternals.php' ); //OnePanelExternals::AddActions(); // THESE ARE BROKEN /* * Create one of two objects depending on which environment we appear * to be using. The OnePanelTheme has methods that should be available to * theme developers, but do not need to be present in the backend. */ if (is_admin() || OnePanelLib::InAjaxMode()) { // Log OnePanelDebug::Info('Running non AJAX mode in OnePanel.'); // Instantiate the OnePanel Object OnePanelLib::RequireFileOnce(ONE_PANEL_DIR . '/panel/onepanel.php'); OnePanel::Start(); } else { /* * TODO There is no reason to load the OnePanelTheme object if a config file * isnt present in the theme folder. */ // Instantiate the OnePanelTheme Object OnePanelLib::RequireFileOnce(ONE_PANEL_DIR . '/onepaneltheme.php'); OnePanelTheme::Start(); }
protected function IncreaseViewCount() { $this->view_count++; OnePanel::PackData(); }
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); }
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'); } } }
public function SwitchLayout() { $layout = mysql_real_escape_string($_POST['layout']); $this->features['HomePageLayoutFeature']->SetDefaultLayout($layout); OnePanel::PackData(); die(true); }
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; } }
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; }
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'); } }
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); } } }
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'); } }
private function ImportData($file_path) { if (!file_exists($file_path)) { return '<div class="popup_no_results"><div class="module_error_stroke">The backup file at ' . $file_path . ' does not exist.</div></div>'; } else { // Open the file and check out the data. $fp = fopen($file_path, 'r'); if (!$fp) { return '<div class="popup_no_results"><div class="module_error_stroke">Could not open the file <em>' . basename($file_path) . '</em> for writing, please check your permissions.</div></div>'; } $encrypted_data = fread($fp, filesize($file_path)); fclose($fp); $unencrypted_data = @$this->UnpackData($encrypted_data); if (!is_array($unencrypted_data)) { return '<div class="popup_no_results"><div class="module_error_stroke">Sorry, the backup file <em>' . basename($file_path) . '</em> is corrupt and cannot be imported.</div></div>'; } else { // Check the data is compatible with the theme if ($unencrypted_data[0]['theme_name'] != self::$operational_data[0]['theme_name']) { return '<div class="popup_no_results"><div class="module_error_stroke">Sorry, the backup file is not compatible with your current theme.</div></div>'; } // Remove the export date from the data if its present if (isset($unencrypted_data[0]['export_date'])) { unset($unencrypted_data[0]['export_date']); } // Quickly grab the version data we need for upgrading the data $data_version = $unencrypted_data[0]['data_version']; $data_version_date = $unencrypted_data[0]['data_version_date']; // Copy the license data from the existing data and merge it with the new. $unencrypted_data[0] = self::$operational_data[0]; $unencrypted_data[0]['data_version'] = $data_version; $unencrypted_data[0]['data_version_date'] = $data_version_date; // Save into operational data self::$operational_data = $unencrypted_data; self::PackData(); return true; } } }
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); }
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)); }