当前位置: 首页>>代码示例>>PHP>>正文


PHP Article::exists方法代码示例

本文整理汇总了PHP中Article::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP Article::exists方法的具体用法?PHP Article::exists怎么用?PHP Article::exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Article的用法示例。


在下文中一共展示了Article::exists方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addPage

 /**
  *
  * Add/update a page to wiki
  * @param string $pagename
  * @param string $text
  * @param boolean $hasSemanticInternal whether this text contains semanticInternal Object.
  * SemanticInternal Object needs some special handling. First there is a bug in current
  * SemanticInternal Object implemenattion: the semantic internal properties can not be
  * saved in the very first time. Second, if the semantic internal object saving is not from
  * a special page action, but a regular page saving action, the semantic internal object
  * is confused about the "CURRENT" page. So asynchronous saving through a task is needed.
  *
  * @param $summary
  */
 public static function addPage($pagename, $text, $force = true, $astask = false, $hasSemanticInternal = false, $summary = "Auto generation")
 {
     global $wgUser;
     $title = str_replace(' ', '_', $pagename);
     $t = Title::makeTitleSafe(NS_MAIN, $title);
     $article = new Article($t);
     if ($article->exists() && !$force) {
         return false;
     }
     if (!$astask) {
         $e = $article->exists();
         //do adding inline
         $article->doEdit($text, $summary);
         if ($hasSemanticInternal && !$e) {
             //one more time
             $article->doEdit($text, $summary);
         }
         return true;
     } else {
         //add article asynchronously.
         $jobs = array();
         $job_params = array();
         $job_params['user_id'] = $wgUser->getId();
         $job_params['edit_summary'] = $summary;
         $job_params['text'] = $text;
         $jobs[] = new DTImportJob($t, $job_params);
         if ($hasSemanticInternal && !$article->exists()) {
             $jobs[] = new DTImportJob($t, $job_params);
         }
         Job::batchInsert($jobs);
     }
 }
开发者ID:kghbln,项目名称:semanticaccesscontrol,代码行数:46,代码来源:MWUtil.php

示例2: GetURI

 public static function GetURI($p_publicationId, $p_languageId, $p_issueNo = null, $p_sectionNo = null, $p_articleNo = null)
 {
     $translator = \Zend_Registry::get('container')->getService('translator');
     $languageObj = new Language($p_languageId);
     if (!$languageObj->exists()) {
         return new PEAR_Error($translator->trans('Language does not exist.'));
     }
     $uri = '/' . $languageObj->getCode() . '/';
     if (!is_null($p_issueNo) && is_null($p_articleNo)) {
         $issueObj = new Issue($p_publicationId, $p_languageId, $p_issueNo);
         if (!$issueObj->exists()) {
             return new PEAR_Error($translator->trans('Issue does not exist.'));
         }
         $uri .= $issueObj->getUrlName() . '/';
     }
     if (!is_null($p_sectionNo) && is_null($p_articleNo)) {
         $sectionObj = new Section($p_publicationId, $p_issueNo, $p_languageId, $p_sectionNo);
         if (!$sectionObj->exists()) {
             return new PEAR_Error($translator->trans('Section does not exist.'));
         }
         $uri .= $sectionObj->getUrlName() . '/';
     }
     if (!is_null($p_articleNo)) {
         $articleObj = new Article($p_languageId, $p_articleNo);
         if (!$articleObj->exists()) {
             return new PEAR_Error($translator->trans('Article does not exist.'));
         }
         $issueObj = new Issue($p_publicationId, $p_languageId, $articleObj->getIssueNumber());
         $sectionObj = new Section($p_publicationId, $articleObj->getIssueNumber(), $p_languageId, $articleObj->getSectionNumber());
         $uri .= $issueObj->getUrlName() . '/';
         $uri .= $sectionObj->getUrlName() . '/';
         $uri .= $articleObj->getUrlName() . '/';
     }
     return $uri;
 }
开发者ID:sourcefabric,项目名称:newscoop,代码行数:35,代码来源:ShortURL.php

示例3: execute

 function execute($par)
 {
     global $wgOut, $wgRequest, $wgUseTidy;
     wfLoadExtensionMessages('SpecialCite');
     // Having tidy on causes whitespace and <pre> tags to
     // be generated around the output of the CiteOutput
     // class TODO FIXME.
     $wgUseTidy = false;
     $this->setHeaders();
     $this->outputHeader();
     $page = isset($par) ? $par : $wgRequest->getText('page');
     $id = $wgRequest->getInt('id');
     $title = Title::newFromText($page);
     if ($title) {
         $article = new Article($title);
     }
     $cform = new CiteForm($title);
     if (!$title || !$article->exists()) {
         $cform->execute();
     } else {
         $cform->execute();
         $cout = new CiteOutput($title, $article, $id);
         $cout->execute();
     }
 }
开发者ID:ui-libraries,项目名称:TIRW,代码行数:25,代码来源:SpecialCite_body.php

示例4: detail

 function detail($title_none = NULL)
 {
     $title_none = $this->uri->segment(3);
     $arrTitle = explode('.', $title_none);
     if ($arrTitle[1] == '' || $arrTitle[1] != 'html') {
         redirect('');
     }
     $title_none = $arrTitle[0];
     $news = new Article();
     $news->where('title_none', $title_none);
     $news->get();
     //print_r($this->db->last_query());exit();
     if (!$news->exists()) {
         show_404();
     }
     $dis['news'] = $news;
     //related news
     $related_news = new Article();
     $related_news->where('recycle', 0);
     $related_news->where('newscatalogue_id', $news->newscatalogue_id);
     $related_news->where("id !=", $news->id);
     $related_news->order_by('created', 'DESC');
     $related_news->get_paged(0, 10, TRUE);
     $dis['related_news'] = $related_news;
     $category = new Newscatalogue($news->newscatalogue_id);
     $dis['category'] = $category;
     $this->page_title = $news->{'title_vietnamese'};
     $this->page_description = $news->short_vietnamese;
     $this->page_keyword = $news->tag;
     $dis['base_url'] = base_url();
     $dis['link'] = base_url() . $_SERVER['REQUEST_URI'];
     $dis['view'] = 'front/services/news_de';
     $this->viewfront($dis);
 }
开发者ID:lxthien,项目名称:batdongsan,代码行数:34,代码来源:fservices.php

示例5: execute

 function execute()
 {
     global $wgRequest, $wgOut, $wgUser, $wgArticle;
     $sitting_of = $wgRequest->getVal('sitting_of');
     $session_number = $wgRequest->getVal('session_number');
     $sitting_start_date_time = $wgRequest->getVal('sitting_start_date_and_time');
     $sitting_end_date_time = $wgRequest->getVal('sitting_end_date_and_time');
     $sitting_session_number = $wgRequest->getVal('sitting_session_number');
     $wpEditToken = $wgRequest->getVal('wpEditToken');
     $sitting_desc = $wgRequest->getVal('sitting_desc');
     $sitting_start_date = substr($sitting_start_date_time, 0, strpos($sitting_start_date_time, ' '));
     $sitting_start_time = substr($sitting_start_date_time, strpos($sitting_start_date_time, ' ') + 1);
     $sitting_end_date = substr($sitting_end_date_time, 0, strpos($sitting_end_date_time, ' '));
     $sitting_end_time = substr($sitting_end_date_time, strpos($sitting_end_date_time, ' ') + 1);
     $sitting_name = $sitting_of . '-' . $sitting_start_date;
     //$sitting_of.'-'.$sitting_start_date_time.'-'
     $title = Title::newFromText($sitting_name, MV_NS_SITTING);
     $wgArticle = new Article($title);
     $wgArticle->doEdit($sitting_desc, wfMsg('mv_summary_add_sitting'));
     $dbkey = $title->getDBKey();
     $sitting = new MV_Sitting(array('name' => $dbkey, 'start_date' => $sitting_start_date, 'start_time' => $sitting_start_time, 'end_date' => $sitting_end_date, 'end_time' => $sitting_end_time));
     //$sitting->db_load_sitting();
     //$sitting->db_load_streams();
     if ($sitting->insertSitting()) {
         if ($wgArticle->exists()) {
             $wgOut->redirect($title->getLocalURL("action=staff"));
         } else {
             $html .= 'Article ' . $sitting_name . ' does not exist';
             $wgOut->addHtml($html);
         }
     } else {
         $WgOut->addHTML('Error: Duplicate Sitting Name?');
     }
 }
开发者ID:BenoitTalbot,项目名称:bungeni-portal,代码行数:34,代码来源:MV_SpecialEditSitting.php

示例6: GetURI

 public static function GetURI($p_publicationId, $p_languageId, $p_issueNo = null, $p_sectionNo = null, $p_articleNo = null)
 {
     $languageObj = new Language($p_languageId);
     if (!$languageObj->exists()) {
         return new PEAR_Error(getGS('Language does not exist.'));
     }
     $uri = $GLOBALS['Campsite']['SUBDIR'] . '/' . $languageObj->getCode() . '/';
     if (!is_null($p_issueNo) && is_null($p_articleNo)) {
         $issueObj = new Issue($p_publicationId, $p_languageId, $p_issueNo);
         if (!$issueObj->exists()) {
             return new PEAR_Error(getGS('Issue does not exist.'));
         }
         $uri .= $issueObj->getUrlName() . '/';
     }
     if (!is_null($p_sectionNo) && is_null($p_articleNo)) {
         $sectionObj = new Section($p_publicationId, $p_issueNo, $p_languageId, $p_sectionNo);
         if (!$sectionObj->exists()) {
             return new PEAR_Error(getGS('Section does not exist.'));
         }
         $uri .= $sectionObj->getUrlName() . '/';
     }
     if (!is_null($p_articleNo)) {
         $articleObj = new Article($p_languageId, $p_articleNo);
         if (!$articleObj->exists()) {
             return new PEAR_Error(getGS('Article does not exist.'));
         }
         $issueObj = new Issue($p_publicationId, $p_languageId, $articleObj->getIssueNumber());
         $sectionObj = new Section($p_publicationId, $articleObj->getIssueNumber(), $p_languageId, $articleObj->getSectionNumber());
         $uri .= $issueObj->getUrlName() . '/';
         $uri .= $sectionObj->getUrlName() . '/';
         $uri .= $articleObj->getUrlName() . '/';
     }
     return $uri;
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:34,代码来源:ShortURL.php

示例7: revertList

 public function revertList($list, $revertUser)
 {
     global $wgServer, $wgLanguageCode;
     $results = array();
     foreach ($list as $l) {
         if (preg_match('@^http://(.+)\\.wikihow\\.com/(.+)@', $l, $matches)) {
             if (!($wgLanguageCode == "en" && $matches[1] == "www" || $matches[1] == $wgLanguageCode)) {
                 $results[] = array('url' => $l, 'success' => false, 'msg' => "Invalid URL for language");
             } else {
                 $link = $matches[2];
                 $title = Title::newFromUrl($link);
                 $article = new Article($title);
                 if ($article && $article->exists()) {
                     $ret = $article->commitRollback($revertUser, wfMsg("mass-revert-message"), TRUE, $resultDetails);
                     if (empty($ret)) {
                         $results[] = array('url' => $l, 'success' => true);
                     } else {
                         $results[] = array('url' => $l, 'success' => false, 'msg' => $ret[0][0]);
                     }
                 } else {
                     $results[] = array('url' => $l, 'success' => false, 'msg' => "Article not found");
                 }
             }
         } else {
             $results[] = array('url' => $l, 'success' => false, 'msg' => "Bad URL");
         }
     }
     return $results;
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:29,代码来源:RevertTool.body.php

示例8: detail

 function detail($url)
 {
     $urlcat = $this->uri->segment(1);
     $category = new Newscatalogue();
     $category->where(array('recycle' => 0, 'name_none' => $urlcat))->get();
     if (!$category->exists()) {
         show_404();
     }
     $dis['category'] = $category;
     $url = geturlfromuri($this->uri->segment(2));
     $news = new Article();
     $news->where(array('title_none' => $url, 'recycle' => 0));
     $news->get();
     if (!$news->exists()) {
         show_404();
     }
     $dis['news'] = $news;
     $this->page_title = $news->title_vietnamese;
     $this->page_description = $news->short_vietnamese;
     $this->page_keyword = $news->tag;
     //related news
     $related_news = new Article();
     $related_news->where('recycle', 0);
     $related_news->where('newscatalogue_id', $news->newscatalogue_id);
     $related_news->where("id !=", $news->id);
     $related_news->order_by('created', 'DESC');
     $related_news->get_paged(0, 10, TRUE);
     $dis['related_news'] = $related_news;
     $dis['base_url'] = base_url();
     $dis['view'] = 'front/newsother/news_de';
     $this->viewfront($dis);
 }
开发者ID:lxthien,项目名称:batdongsan,代码行数:32,代码来源:fnewsother.php

示例9: convert

 function convert($newFormat, $pageName, $calName, $redirect, $go)
 {
     $search = "{$pageName}/{$calName}";
     $pages = PrefixSearch::titleSearch($search, 1000000);
     //search upto 1,000,000 events (no performace issue)
     $count = $erroredCount = 0;
     foreach ($pages as $page) {
         $retval = false;
         $newPage = $this->convertToNewPage($page, $newFormat);
         $article = new Article(Title::newFromText($page));
         if ($newPage != '') {
             $fromTitle = Title::newFromText($page);
             $toTitle = Title::newFromText($newPage);
             $articleNew = new Article(Title::newFromText($newPage));
             if (!$article->isRedirect() && !$articleNew->exists()) {
                 if ($go) {
                     $retval = $fromTitle->moveTo($toTitle, true, 'CalendarConversion', $redirect);
                 } else {
                     if ($count < 10) {
                         $testRun .= '&nbsp;&nbsp;' . $page . '  &rarr;&rarr;  ' . $newPage . '<br>';
                     }
                 }
             }
         }
     }
     unset($pages);
     if ($go) {
         $ret = "Conversion completed.";
     } else {
         $ret = "<b>Test Results, add '<i>go</i>' to the <i>dateConverter</i> tag to convert:</b><br>{$testRun}";
     }
     return $ret;
 }
开发者ID:mediawiki-extensions,项目名称:mw-calendar,代码行数:33,代码来源:DateConverter.php

示例10: doRender404

    /**
     * Just render some simple 404 page
     */
    public function doRender404()
    {
        global $wgOut, $wgContLang, $wgCanonicalNamespaceNames;
        /**
         * check, maybe we have article with that title, if yes 301redirect to
         * this article
         */
        $uri = $_SERVER['REQUEST_URI'];
        if (!preg_match('!^https?://!', $uri)) {
            $uri = 'http://unused' . $uri;
        }
        $uri = substr(parse_url($uri, PHP_URL_PATH), 1);
        Wikia::log(__METHOD__, false, isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "[no referer]");
        $title = $wgContLang->ucfirst(urldecode(ltrim($uri, "/")));
        $namespace = NS_MAIN;
        /**
         * first check if title is in namespace other than main
         */
        $parts = explode(":", $title, 2);
        if (count($parts) == 2) {
            foreach ($wgCanonicalNamespaceNames as $id => $name) {
                $translated = $wgContLang->getNsText($id);
                if (strtolower($translated) === strtolower($parts[0]) || strtolower($name) === strtolower($parts[0])) {
                    $namespace = $id;
                    $title = $parts[1];
                    break;
                }
            }
        }
        /**
         * create title from parts
         */
        $oTitle = Title::newFromText($title, $namespace);
        if (!is_null($oTitle)) {
            if ($namespace == NS_SPECIAL || $namespace == NS_MEDIA) {
                /**
                 * these namespaces are special and don't have articles
                 */
                header("X-Redirected-By: Our404Handler");
                header(sprintf("Location: %s", $oTitle->getFullURL()), true, 301);
                exit(0);
            } else {
                $oArticle = new Article($oTitle);
                if ($oArticle->exists()) {
                    header("X-Redirected-By: Our404Handler");
                    header(sprintf("Location: %s", $oArticle->getTitle()->getFullURL()), true, 301);
                    exit(0);
                }
            }
        }
        /**
         * but if doesn't exist, we eventually show 404page
         */
        $wgOut->setStatusCode(404);
        $info = wfMsgForContent('message404', $uri, urldecode($title));
        $wgOut->addHTML('<h2>' . wfMsg('our404handler-oops') . '</h2>
						<div>' . $wgOut->parse($info) . '</div>');
    }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:61,代码来源:SpecialOur404Handler_body.php

示例11: Article

 function article_unique_title($str)
 {
     $this->form_validation->set_message('article_unique_title', 'Es existier bereits ein Artikel mit diesem Titel.');
     $article = new Article();
     $article->where('title', $str)->get();
     if ($article->exists()) {
         return FALSE;
     }
     return TRUE;
 }
开发者ID:juna,项目名称:notre-menage,代码行数:10,代码来源:articles.php

示例12: Article

	function test_article() {
		$article = new Article(9000001,9000002,9000003,9000004);

		// Test create
		$article->create("Unit Test Long Name",
						 "Unit Test Short Name",
						 "fastnews");
		$this->assertTrue($article->exists());

		// Test SET functions
		$article->setTitle("Unit Test New Title");
		$article->setCreatorId(9000005);
		$article->setOnFrontPage(true);
		$article->setOnSection(true);
		$article->setWorkflowStatus('Y');
		$article->setKeywords("Unit, Test");
		$article->setIsIndexed(true);

		// Test GET functions
		$articleCopy = new Article(9000001, 9000002, 9000003, 9000004, $article->getArticleId());
		$this->assertEquals(9000001, $articleCopy->getPublicationId());
		$this->assertEquals(9000002, $articleCopy->getIssueNumber());
		$this->assertEquals(9000003, $articleCopy->getSectionNumber());
		$this->assertEquals(9000004, $articleCopy->getLanguageId());
		$this->assertEquals(9000005, $articleCopy->getCreatorId());
		$this->assertEquals("Unit Test New Title", $articleCopy->getTitle());
		$this->assertEquals(true, $articleCopy->onFrontPage());
		$this->assertEquals(true, $articleCopy->onSection());
		$this->assertEquals('Y', $articleCopy->getWorkflowStatus());
		$this->assertEquals("Unit, Test", $articleCopy->getKeywords());
		$this->assertEquals(true, $articleCopy->isIndexed());

		// Test DELETE functions
		$article->delete();
		$this->assertFalse($article->exists());
	}
开发者ID:nistormihai,项目名称:Newscoop,代码行数:36,代码来源:CampsiteTests.php

示例13: checkForEmpty

function checkForEmpty($t)
{
    $deleteComment = "Deleting unused profile box page";
    if ($t) {
        $a = new Article($t);
        if ($a->exists()) {
            $content = $a->getContent();
            if ($content == "") {
                if ($a->doDeleteArticle($deleteComment)) {
                    echo $deleteComment . " " . $t->getText() . "\n";
                    return true;
                }
            }
        }
    }
    return false;
}
开发者ID:biribogos,项目名称:wikihow-src,代码行数:17,代码来源:removeEmptyProfilePages.php

示例14: showList

 function showList()
 {
     global $wgOut, $wgUser, $wgContLang;
     $fname = "BookSourceList::showList()";
     # First, see if we have a custom list setup in
     # [[Wikipedia:Book sources]] or equivalent.
     $bstitle = Title::makeTitleSafe(NS_PROJECT, wfMsg("booksources"));
     $bsarticle = new Article($bstitle);
     if ($bsarticle->exists()) {
         $bstext = $bsarticle->getContent(false);
         if ($bstext) {
             $bstext = str_replace("MAGICNUMBER", $this->mIsbn, $bstext);
             $wgOut->addWikiText($bstext);
             return;
         }
     }
     # Otherwise, use the list of links in the default Language.php file.
     $s = wfMsg("booksourcetext") . "<ul>\n";
     $bs = $wgContLang->getBookstoreList();
     $bsn = array_keys($bs);
     foreach ($bsn as $name) {
         $adr = $bs[$name];
         if (!$this->mIsbn) {
             $adr = explode(":", $adr, 2);
             $adr = explode("/", $adr[1]);
             $a = "";
             while ($a == "") {
                 $a = array_shift($adr);
             }
             $adr = "http://" . $a;
         } else {
             $adr = str_replace("\$1", $this->mIsbn, $adr);
         }
         $name = htmlspecialchars($name);
         $adr = htmlspecialchars($adr);
         $s .= "<li><a href=\"{$adr}\" class=\"external\">{$name}</a></li>\n";
     }
     $s .= "</ul>\n";
     $wgOut->addHTML($s);
 }
开发者ID:BackupTheBerlios,项目名称:openzaurus-svn,代码行数:40,代码来源:SpecialBooksources.php

示例15: execute

 /**
  * Show the special page
  *
  * @param $params Mixed: parameter(s) passed to the page or null
  */
 public function execute($params)
 {
     global $wgOut, $wgUser, $wgMemc;
     // This feature is only available to logged-in users.
     if (!$wgUser->isLoggedIn()) {
         throw new ErrorPageError('error', 'badaccess');
     }
     // Show a message if the database is in read-only mode
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
         return;
     }
     $dbr = wfGetDB(DB_MASTER);
     $s = $dbr->selectRow('user_profile', array('up_user_id'), array('up_user_id' => $wgUser->getID()), __METHOD__);
     if ($s === false) {
         $dbw = wfGetDB(DB_MASTER);
         $dbw->insert('user_profile', array('up_user_id' => $wgUser->getID()), __METHOD__);
     }
     $profile = new UserProfile($wgUser->getName());
     $profile_data = $profile->getProfile();
     $user_page_type = $profile_data['user_page_type'] == 1 ? 0 : 1;
     $dbw = wfGetDB(DB_MASTER);
     $dbw->update('user_profile', array('up_type' => $user_page_type), array('up_user_id' => $wgUser->getID()), __METHOD__);
     $key = wfMemcKey('user', 'profile', 'info', $wgUser->getID());
     $wgMemc->delete($key);
     if ($user_page_type == 1 && !$wgUser->isBlocked()) {
         $user_page = Title::makeTitle(NS_USER, $wgUser->getName());
         $article = new Article($user_page);
         $user_page_content = $article->getContent();
         $user_wiki_title = Title::makeTitle(NS_USER_WIKI, $wgUser->getName());
         $user_wiki = new Article($user_wiki_title);
         if (!$user_wiki->exists()) {
             $user_wiki->doEdit($user_page_content, 'import user wiki');
         }
     }
     $title = Title::makeTitle(NS_USER, $wgUser->getName());
     $wgOut->redirect($title->getFullURL());
 }
开发者ID:kghbln,项目名称:semantic-social-profile,代码行数:43,代码来源:SpecialToggleUserPageType.php


注:本文中的Article::exists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。