clean up indentation

This commit is contained in:
John Bintz 2009-06-26 07:18:00 -04:00
parent a072157f1b
commit bd3620a2ae
2 changed files with 77 additions and 77 deletions

View File

@ -8,61 +8,61 @@ class PluginWonderful {
function PluginWonderful() {} function PluginWonderful() {}
function _retrieve_url($url) { function _retrieve_url($url) {
return @file_get_contents($url); return @file_get_contents($url);
} }
function init() { function init() {
if (empty($this->adboxes_client)) { if (empty($this->adboxes_client)) {
$this->messages = array(); $this->messages = array();
$this->adboxes_client = new PWAdboxesClient(); $this->adboxes_client = new PWAdboxesClient();
$this->_get_publisher_info(); $this->_get_publisher_info();
$this->_update_database_version(); $this->_update_database_version();
if (!empty($_POST)) { $this->handle_action(); } if (!empty($_POST)) { $this->handle_action(); }
} }
} }
function _get_new_publisher_info_object() { function _get_new_publisher_info_object() {
return new PublisherInfo(); return new PublisherInfo();
} }
function _update_database_version() { function _update_database_version() {
$result = get_option('plugin-wonderful-database-version'); $result = get_option('plugin-wonderful-database-version');
if (empty($result) || ($result < PLUGIN_WONDERFUL_DATABASE_VERSION)) { if (empty($result) || ($result < PLUGIN_WONDERFUL_DATABASE_VERSION)) {
if ($this->adboxes_client->initialize(true)) { if ($this->adboxes_client->initialize(true)) {
update_option('plugin-wonderful-database-version', PLUGIN_WONDERFUL_DATABASE_VERSION); update_option('plugin-wonderful-database-version', PLUGIN_WONDERFUL_DATABASE_VERSION);
} else { } else {
$this->messages[] = "Unable to update database schema!"; $this->messages[] = "Unable to update database schema!";
} }
} }
} }
function _get_publisher_info() { function _get_publisher_info() {
$this->publisher_info = false; $this->publisher_info = false;
$member_id = get_option('plugin-wonderful-memberid'); $member_id = get_option('plugin-wonderful-memberid');
if (is_numeric($member_id)) { if (is_numeric($member_id)) {
$member_id = (int)$member_id; $member_id = (int)$member_id;
$this->publisher_info = $this->adboxes_client->get_ads($member_id); $this->publisher_info = $this->adboxes_client->get_ads($member_id);
$last_update = get_option('plugin-wonderful-last-update') ; $last_update = get_option('plugin-wonderful-last-update') ;
if (!is_numeric($last_update)) { $last_update = 0; } if (!is_numeric($last_update)) { $last_update = 0; }
$last_update = (int)$last_update; $last_update = (int)$last_update;
if (($last_update + PLUGIN_WONDERFUL_UPDATE_TIME) < time()) { if (($last_update + PLUGIN_WONDERFUL_UPDATE_TIME) < time()) {
if (($result = $this->_retrieve_url(sprintf(PLUGIN_WONDERFUL_XML_URL, (int)get_option('plugin-wonderful-memberid')))) !== false) { if (($result = $this->_retrieve_url(sprintf(PLUGIN_WONDERFUL_XML_URL, (int)get_option('plugin-wonderful-memberid')))) !== false) {
$this->publisher_info = $this->_get_new_publisher_info_object(); $this->publisher_info = $this->_get_new_publisher_info_object();
if ($this->publisher_info->parse($result)) { if ($this->publisher_info->parse($result)) {
$this->adboxes_client->post_ads($this->publisher_info); $this->adboxes_client->post_ads($this->publisher_info);
update_option('plugin-wonderful-last-update', time()); update_option('plugin-wonderful-last-update', time());
} }
} }
} }
} }
return $this->publisher_info; return $this->publisher_info;
} }
function insert_rss_feed_ads($content) { function insert_rss_feed_ads($content) {
if (is_feed()) { if (is_feed()) {
@ -80,13 +80,13 @@ class PluginWonderful {
} }
function get_ad_widget_ordering($adbox_id) { function get_ad_widget_ordering($adbox_id) {
if (($result = get_option('plugin-wonderful-sidebar-adboxes')) !== false) { if (($result = get_option('plugin-wonderful-sidebar-adboxes')) !== false) {
foreach ($result as $position => $id) { foreach ($result as $position => $id) {
if ($id == $adbox_id) { return $position; } if ($id == $adbox_id) { return $position; }
} }
} }
return null; return null;
} }
function insert_activation_ad() { function insert_activation_ad() {
$result = get_option('plugin-wonderful-activate-ad-code'); $result = get_option('plugin-wonderful-activate-ad-code');
@ -107,7 +107,7 @@ class PluginWonderful {
} }
function handle_activation() { function handle_activation() {
$this->init(); $this->init();
$this->adboxes_client->initialize(); $this->adboxes_client->initialize();
} }
@ -157,26 +157,26 @@ class PluginWonderful {
if (method_exists($this, $action)) { call_user_func(array($this, $action)); } if (method_exists($this, $action)) { call_user_func(array($this, $action)); }
// handle widget updates // handle widget updates
if (isset($_POST['pw']['_nonce'])) { if (isset($_POST['pw']['_nonce'])) {
if (wp_verify_nonce($_POST['pw']['_nonce'], "plugin-wonderful")) { $this->handle_action_save_widgets(); } if (wp_verify_nonce($_POST['pw']['_nonce'], "plugin-wonderful")) { $this->handle_action_save_widgets(); }
} }
} }
function handle_action_save_widgets() { function handle_action_save_widgets() {
$new_boxes = array(); $new_boxes = array();
if ($this->publisher_info !== false) { if ($this->publisher_info !== false) {
foreach ($this->publisher_info->adboxes as $box) { foreach ($this->publisher_info->adboxes as $box) {
if (isset($_POST['pw']['center'][$box->adboxid])) { if (isset($_POST['pw']['center'][$box->adboxid])) {
$this->adboxes_client->set_widget_centering($box->adboxid, true); $this->adboxes_client->set_widget_centering($box->adboxid, true);
$box->center_widget = "1"; $box->center_widget = "1";
} else { } else {
$this->adboxes_client->set_widget_centering($box->adboxid, false); $this->adboxes_client->set_widget_centering($box->adboxid, false);
$box->center_widget = "0"; $box->center_widget = "0";
} }
$new_boxes[] = $box; $new_boxes[] = $box;
} }
$this->publisher_info->adboxes = $new_boxes; $this->publisher_info->adboxes = $new_boxes;
} }
} }
function handle_action_change_adbox_settings() { function handle_action_change_adbox_settings() {