/** * Constructor. * * @param $id Entry universally unique identifier. Required. * @param $title Entry title. Required. Text or HTML (Atom only). * @param $updated Last updated date/time. If omitted, the current * date/time is assumed. * @param $url Entry URL, pointing back to the page it represents. * Optional. * @param $author Entry author. Optional. * @param $content Entry content. Optional. */ function __construct( $id, $title, $updated = null, $url = null, $author = null, $content = null ) { parent::__construct( $id, $title, $updated ); if ( $url ) { global $wgMimeType; $this->addLink( $url, $wgMimeType ); } if ( $author ) { $this->addAuthor( $author ); } if ( $content ) { $this->setContent( $content ); } }
/** * Find and add categories for the given feed or entry. */ protected function addCategories( WlSyndicationBase $obj, $pageid ) { $scheme = SpecialPage::getTitleFor( 'Categories' )->getFullUrl(); $res = $this->mDb->select( array( 'categorylinks', 'page', 'page_props' ), array( 'page_title' ), array( /* conds */ 'cl_from' => $pageid, 'page_title IS NOT NULL', 'pp_value IS NULL' ), __METHOD__, array( /* options */ ), array( /* joins */ 'page' => array( 'LEFT JOIN', array( 'page_namespace' => NS_CATEGORY, 'page_title = cl_to' ) ), 'page_props' => array( 'LEFT JOIN', array( 'pp_propname' => 'hiddencat', 'pp_page = page_id' ) ) ) ); foreach ( $res as $row ) { $term = $row->page_title; $label = preg_replace( '/(?:.*\/)?(.+?)(?:\s*\(.*\))?/', '$1', $term ); $label = str_replace( '_', ' ', $label ); $obj->addCategory( $term, $scheme, $label ); } }