Пример #1
0
 function unsubscribe($method, $args)
 {
     $ret = $this->validate($args);
     if (is_array($ret)) {
         // Success
         // The remaining params are feed URLs
         foreach ($args as $arg) {
             $link_id = FeedWordPress::find_link($arg);
             if (!$link_id) {
                 $link_id = FeedWordPress::find_link($arg, 'link_url');
             }
             if ($link_id) {
                 $link = new SyndicatedLink($link_id);
                 $link->{$method}();
                 $ret[] = array('deactivated', $arg);
             } else {
                 $ret[] = array('error', $arg);
             }
         }
     }
     return $ret;
 }
 function syndicate_link($name, $uri, $rss)
 {
     // Get the category ID#
     $cat_id = FeedWordPress::link_category_id();
     if (!is_wp_error($cat_id)) {
         $link_category = array($cat_id);
     } else {
         $link_category = array();
     }
     // WordPress gets cranky if there's no homepage URI
     if (!is_string($uri) or strlen($uri) < 1) {
         $uri = $rss;
     }
     // Check if this feed URL is already being syndicated.
     $link_id = wp_insert_link(array("link_id" => FeedWordPress::find_link($rss), "link_rss" => $rss, "link_name" => $name, "link_url" => $uri, "link_category" => $link_category, "link_visible" => 'Y'));
     return $link_id;
 }
	function syndicate_link ($name, $uri, $rss) {
		// Get the category ID#
		$cat_id = FeedWordPress::link_category_id();
		if (!is_wp_error($cat_id)) :
			$link_category = array($cat_id);
		else :
			$link_category = array();
		endif;

		// WordPress gets cranky if there's no homepage URI
		if (!is_string($uri) or strlen($uri)<1) : $uri = $rss; endif;
		
		// Check if this feed URL is already being syndicated.
		$link_id = wp_insert_link(array(
		"link_id" => FeedWordPress::find_link($rss), // insert if nothing was found; else update
		"link_rss" => $rss,
		"link_name" => $name,
		"link_url" => $uri,
		"link_category" => $link_category,
		"link_visible" => 'Y', // reactivate if inactivated
		));

		return $link_id;
	} /* function FeedWordPress::syndicate_link() */