public function __construct()
 {
     // Set meta-box context name
     parent::__construct('feedwordpressperformancepage');
     $this->dispatch = 'feedwordpress_performance';
     $this->filename = __FILE__;
 }
 function FeedWordPressAuthorsPage($link)
 {
     FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpressauthors', $link);
     $this->refresh_author_list();
     $this->dispatch = 'feedwordpress_author_settings';
     $this->filename = FWP_AUTHORS_PAGE_SLUG;
 }
 function FeedWordPressDiagnosticsPage()
 {
     // Set meta-box context name
     FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpressdiagnosticspage');
     $this->dispatch = 'feedwordpress_diagnostics';
     $this->filename = FWP_DIAGNOSTICS_PAGE_SLUG;
 }
 function FeedWordPressDiagnosticsPage()
 {
     // Set meta-box context name
     FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpressdiagnosticspage');
     $this->dispatch = 'feedwordpress_diagnostics';
     $this->filename = __FILE__;
 }
 function FeedWordPressPerformancePage()
 {
     // Set meta-box context name
     FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpressperformancepage');
     $this->dispatch = 'feedwordpress_performance';
     $this->filename = __FILE__;
 }
 /**
  * Construct the posts page object.
  *
  * @param mixed $link An object of class {@link SyndicatedLink} if created for one feed's settings, NULL if created for global default settings
  */
 function FeedWordPressPostsPage($link = NULL)
 {
     FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpresspostspage', $link);
     $this->dispatch = 'feedwordpress_posts_settings';
     $this->filename = FWP_POSTS_PAGE_SLUG;
     $this->updatedPosts = new UpdatedPostsControl($this);
 }
 function FeedWordPressSyndicationPage()
 {
     FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpresssyndication', NULL);
     // No over-arching form element
     $this->dispatch = NULL;
     $this->filename = FWP_SYNDICATION_PAGE_SLUG;
 }
 function FeedWordPressPerformancePage()
 {
     // Set meta-box context name
     FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpressperformancepage');
     $this->dispatch = 'feedwordpress_performance';
     $this->filename = FWP_PERFORMANCE_PAGE_SLUG;
 }
	function FeedWordPressDiagnosticsPage () {
		// Set meta-box context name
		FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpressdiagnosticspage');
		$this->dispatch = 'feedwordpress_diagnostics';
		$this->filename = __FILE__;
		
		$this->test_html = array();
		add_action('feedwordpress_diagnostics_do_http_test', array($this, 'do_http_test'), 10, 1);
	}
 public function __construct()
 {
     // Set meta-box context name
     parent::__construct('feedwordpressdiagnosticspage');
     $this->dispatch = 'feedwordpress_diagnostics';
     $this->filename = __FILE__;
     $this->test_html = array();
     add_action('feedwordpress_diagnostics_do_http_test', array($this, 'do_http_test'), 10, 1);
 }
 /**
  * Constructs the Feeds page object
  *
  * @param mixed $link An object of class {@link SyndicatedLink} if created for one feed's settings, NULL if created for global default settings
  */
 function FeedWordPressFeedsPage($link = -1)
 {
     if (is_numeric($link) and -1 == $link) {
         $link = FeedWordPressAdminPage::submitted_link();
     }
     FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpressfeeds', $link);
     $this->dispatch = get_class($this);
     $this->filename = FWP_FEEDS_PAGE_SLUG;
     $this->updatedPosts = new UpdatedPostsControl($this);
 }
 function submitted_link()
 {
     $link_id = FeedWordPressAdminPage::submitted_link_id();
     if (is_numeric($link_id) and $link_id) {
         $link = new SyndicatedLink($link_id);
     } else {
         $link = NULL;
     }
     return $link;
 }
 public function __construct($filename = NULL)
 {
     parent::__construct('feedwordpresssyndication', NULL);
     // No over-arching form element
     $this->dispatch = NULL;
     if (is_null($filename)) {
         $this->filename = __FILE__;
     } else {
         $this->filename = $filename;
     }
 }
 function FeedWordPressSyndicationPage($filename = NULL)
 {
     FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpresssyndication', NULL);
     // No over-arching form element
     $this->dispatch = NULL;
     if (is_null($filename)) {
         $this->filename = __FILE__;
     } else {
         $this->filename = $filename;
     }
 }
	function FeedWordPressSyndicationPage ($filename = NULL) {
		FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpresssyndication', /*link=*/ NULL);

		// No over-arching form element
		$this->dispatch = NULL;
		if (is_null($filename)) :
			$this->filename = __FILE__;
		else :
			$this->filename = $filename;
		endif;
	} /* FeedWordPressSyndicationPage constructor */
	function display () {
		////////////////////////////////////////////////
		// Display settings boxes //////////////////////
		////////////////////////////////////////////////
	
		$this->boxes_by_methods = array(
			'feed_categories_box' => __('Feed Categories & Tags'),
			'categories_box' => array('title' => __('Categories'), 'id' => 'categorydiv'),
		);

		parent::display();	
	}
 function save_settings($post)
 {
     if ($this->for_feed_settings()) {
         if (isset($post['link_rss_params_key'])) {
             $qp = array();
             foreach ($post['link_rss_params_key'] as $index => $key) {
                 if (strlen($key) > 0) {
                     if (isset($post['link_rss_params_value'][$index]) and strlen($post['link_rss_params_value'][$index])) {
                         $value = $post['link_rss_params_value'][$index];
                         $qp[] = array($key, $value);
                     }
                 }
             }
             $this->update_setting('query parameters', serialize($qp));
         }
         // custom feed settings first
         foreach ($post['notes'] as $mn) {
             $mn['key0'] = isset($mn['key0']) ? trim($mn['key0']) : NULL;
             $mn['key1'] = trim($mn['key1']);
             if (preg_match("^((" . implode(')|(', $this->special_settings) . "))\$i", $mn['key1'])) {
                 $mn['key1'] = 'user/' . $mn['key1'];
             }
             if (strlen($mn['key0']) > 0) {
                 unset($this->link->settings[$mn['key0']]);
                 // out with the old
             }
             if ($mn['action'] == 'update' and strlen($mn['key1']) > 0) {
                 $this->link->settings[$mn['key1']] = $mn['value'];
                 // in with the new
             }
         }
         // now stuff through the web form
         // hardcoded feed info
         foreach (array('name', 'description', 'url') as $what) {
             // We have a checkbox for "No," so if it's unchecked, mark as "Yes."
             $this->link->settings["hardcode {$what}"] = isset($post["hardcode_{$what}"]) ? $post["hardcode_{$what}"] : 'yes';
             if (FeedWordPress::affirmative($this->link->settings, "hardcode {$what}")) {
                 $this->link->link->{'link_' . $what} = $post['link' . $what];
             }
         }
         // Update scheduling
         if (isset($post['update_schedule'])) {
             $this->link->settings['update/hold'] = $post['update_schedule'];
         }
         if (isset($post['use_default_update_window']) and strtolower($post['use_default_update_window']) == 'yes') {
             unset($this->link->settings['update/window']);
         } elseif (isset($post['update_window'])) {
             if ((int) $post['update_window'] > 0) {
                 $this->link->settings['update/window'] = (int) $post['update_window'];
             }
         }
     } else {
         // Global
         update_option('feedwordpress_cat_id', $post['syndication_category']);
         if (!isset($post['automatic_updates']) or !in_array($post['automatic_updates'], array('init', 'shutdown'))) {
             $automatic_updates = NULL;
         } else {
             $automatic_updates = $post['automatic_updates'];
         }
         update_option('feedwordpress_automatic_updates', $automatic_updates);
         if (isset($post['update_window'])) {
             if ((int) $post['update_window'] > 0) {
                 update_option('feedwordpress_update_window', (int) $post['update_window']);
             }
         }
         update_option('feedwordpress_update_time_limit', $post['update_time_limit'] == 'yes' ? (int) $post['time_limit_seconds'] : 0);
         foreach (array('name', 'description', 'url') as $what) {
             // We have a checkbox for "No," so if it's unchecked, mark as "Yes."
             $hardcode = isset($post["hardcode_{$what}"]) ? $post["hardcode_{$what}"] : 'yes';
             update_option("feedwordpress_hardcode_{$what}", $hardcode);
         }
     }
     if (isset($post['fetch_timeout'])) {
         if (isset($post['fetch_timeout_default']) and $post['fetch_timeout_default'] == 'yes') {
             $timeout = NULL;
         } else {
             $timeout = $post['fetch_timeout'];
         }
         if (is_int($timeout)) {
             $timeout = intval($timeout);
         }
         $this->update_setting('fetch timeout', $timeout);
     }
     if (isset($post['update_minimum'])) {
         $this->update_setting('update/minimum', $post['update_minimum']);
     }
     if (isset($post['link_rss_auth_method']) and $post['link_rss_auth_method'] and '-' != $post['link_rss_auth_method']) {
         $this->update_setting('http auth method', $post['link_rss_auth_method']);
     } else {
         $this->update_setting('http auth method', NULL);
     }
     if (isset($post['link_rss_username']) and strlen($post['link_rss_username']) > 0 and '-' != $post['link_rss_auth_method']) {
         $this->update_setting('http username', $post['link_rss_username']);
     } else {
         $this->update_setting('http username', NULL);
     }
     if (isset($post['link_rss_password']) and strlen($post['link_rss_password']) > 0 and '-' != $post['link_rss_auth_method']) {
         $this->update_setting('http password', $post['link_rss_password']);
     } else {
         $this->update_setting('http password', NULL);
     }
     $this->updatedPosts->accept_POST($post);
     parent::save_settings($post);
 }
	/*static*/ function submitted_link () {
		$link_id = FeedWordPressAdminPage::submitted_link_id();
		if (is_numeric($link_id) and $link_id) :
			$link = new SyndicatedLink($link_id);
		else :
			$link = NULL;
		endif;
		return $link;
	} /* FeedWordPressAdminPage::submitted_link () */
 function display()
 {
     ////////////////////////////////////////////////
     // Display settings boxes //////////////////////
     ////////////////////////////////////////////////
     $this->boxes_by_methods = array('feed_categories_box' => __('Feed Categories' . FEEDWORDPRESS_AND_TAGS), 'categories_box' => array('title' => __('Categories'), 'id' => 'categorydiv'));
     if (!FeedWordPressCompatibility::post_tags()) {
         unset($this->boxes_by_methods['tags_box']);
     }
     parent::display();
 }
Exemple #20
0
 function save_settings($post)
 {
     if ($this->for_feed_settings()) {
         $alter = array();
         // Unfamiliar author rule
         if (isset($post["unfamiliar_author"])) {
             if ('newuser' == $post['unfamiliar_author']) {
                 $new_name = trim($post["unfamiliar_author_newuser"]);
                 $this->link->map_name_to_new_user(NULL, $new_name);
             } else {
                 $this->link->update_setting("unfamiliar author", $post['unfamiliar_author'], 'site-default');
             }
         }
         // Handle author mapping rules
         if (isset($post['author_rules_name']) and isset($post['author_rules_action'])) {
             if (isset($post['author_rules_name']['all'])) {
                 if (strlen($post['author_rules_name']['all']) > 0) {
                     $post['author_rules_name'] = array('all' => $post['author_rules_name']['all']);
                     // Erase all the rest.
                 }
             }
             unset($this->link->settings['map authors']);
             foreach ($post['author_rules_name'] as $key => $name) {
                 // Normalize for case and whitespace
                 $name = strtolower(trim($name));
                 $author_action = strtolower(trim($post['author_rules_action'][$key]));
                 if (strlen($name) > 0) {
                     if ('newuser' == $author_action) {
                         $new_name = trim($post['author_rules_newuser'][$key]);
                         $this->link->map_name_to_new_user($name, $new_name);
                     } else {
                         $this->link->settings['map authors']['name'][$name] = $author_action;
                     }
                 }
             }
         }
         if (isset($post['add_author_rule_name']) and isset($post['add_author_rule_action'])) {
             $name = strtolower(trim($post['add_author_rule_name']));
             $author_action = strtolower(trim($post['add_author_rule_action']));
             if (strlen($name) > 0) {
                 if ('newuser' == $author_action) {
                     $new_name = trim($post['add_author_rule_newuser']);
                     $this->link->map_name_to_new_user($name, $new_name);
                 } else {
                     $this->link->settings['map authors']['name'][$name] = $author_action;
                 }
             }
         }
     } else {
         if ('newuser' == $post['unfamiliar_author']) {
             $new_name = trim($post['unfamiliar_author_newuser']);
             $new_id = fwp_insert_new_user($new_name);
             if (is_numeric($new_id)) {
                 update_option('feedwordpress_unfamiliar_author', $new_id);
             } else {
                 // TODO: Add some error detection and reporting
                 // Put WP_Error stuff into $this->mesg ?
             }
         } else {
             update_option('feedwordpress_unfamiliar_author', $post['unfamiliar_author']);
         }
         update_option('feedwordpress_do_not_match_author_by_email', (isset($post['match_author_by_email']) and 'yes' == $post['match_author_by_email']) ? 'no' : 'yes');
         if (isset($post['null_emails'])) {
             update_option('feedwordpress_null_email_set', $post['null_emails']);
         }
     }
     parent::save_settings($post);
     $this->refresh_author_list();
 }
 function FeedWordPressCategoriesPage($link)
 {
     FeedWordPressAdminPage::FeedWordPressAdminPage('feedwordpresscategories', $link);
     $this->dispatch = 'feedwordpress_categories_settings';
     $this->filename = FWP_CATEGORIES_PAGE_SLUG;
 }
 function display()
 {
     $this->boxes_by_methods = array('publication_box' => __('Syndicated Posts'), 'links_box' => __('Links'), 'formatting_box' => __('Formatting'), 'comments_and_pings_box' => __('Comments & Pings'), 'custom_post_settings_box' => __('Custom Post Settings (to apply to each syndicated post)'), 'custom_post_types_box' => 'Custom Post Types (advanced database settings)');
     parent::display();
 }