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


PHP Article::loadContent方法代码示例

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


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

示例1: onUploadCompleteHook

	public static function onUploadCompleteHook( &$file ) {
		global $wgExIndexMIMETypes;

		$localFile = $file->getLocalFile();
		if ( $localFile !=  null && in_array( $localFile->getMimeType(), $wgExIndexMIMETypes ) ) {
			wfDebugLog( 'OracleTextSearch', 'Touching file page to force indexing');
			$article = new Article( $localFile->getTitle() );
			$article->loadContent();
			$article->doEdit( $article->mContent, $article->mComment );
		}
		return true;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:12,代码来源:SearchOracleText.php

示例2: hUnknownAction

 public function hUnknownAction($action, &$article)
 {
     // check if request 'action=formsubmit'
     if ($action != 'formsubmit') {
         return true;
     }
     // continue hook-chain.
     $article->loadContent();
     // follow redirects
     if ($article->mIsRedirect == true) {
         $title = Title::newFromRedirect($article->getContent());
         $article = new Article($title);
         $article->loadContent();
     }
     // Extract the code
     // Use our runphpClass helper
     $runphp = new runphpClass();
     $runphp->initFromContent($article->getContent());
     // Execute Code
     $code = $runphp->getCode(true);
     if (!empty($code)) {
         $callback = eval($code);
     }
     // we might implement functionality around a callback method in the future
     // Was there an expected class defined?
     $name = $article->mTitle->getDBkey();
     // the page name might actually be a sub-page; extract the basename without the full path.
     $pn = explode('/', $name);
     if (!empty($pn)) {
         $rn = array_reverse($pn);
         $name = $rn[0];
     }
     $name .= 'Class';
     if (class_exists($name)) {
         $class = new $name();
         if (is_object($class)) {
             if (method_exists($class, 'submit')) {
                 $class->submit();
             }
         }
     }
     // ... then it was a page built from ground up; nothing more to do here.
     return false;
 }
开发者ID:clrh,项目名称:mediawiki,代码行数:44,代码来源:FormProc.body.php

示例3: fetchArticleHtml

 protected function fetchArticleHtml($title, $revid)
 {
     if (!$revid) {
         $good = GoodRevision::newFromTitle($title, $title->getArticleID());
         if ($good) {
             $revid = $good->latestGood();
         }
     }
     $article = new Article($title, $revid);
     if (!$article) {
         return false;
     }
     $article->loadContent();
     $rev = $article->mRevision;
     if (!$rev) {
         return false;
     }
     $this->getNonMobileHtml($title, $rev);
     $builder = new MobileAppArticleBuilder();
     $this->html = $builder->createByHtml($title, $this->html);
     return true;
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:22,代码来源:ApiMobileArticleDownloader.body.php

示例4: onArticleFromTitle_New


//.........这里部分代码省略.........
         // any of them belong to our latest released version, redirect to
         // our latest handler.
         $latestReleasedVersion = PonyDocsProductVersion::GetLatestReleasedVersion($productName)->getVersionName();
         $found = false;
         foreach ($existingVersions as $docVersion) {
             if ($docVersion->getVersionName() == $latestReleasedVersion) {
                 $found = true;
                 break;
             }
         }
         if (!$found) {
             if (PONYDOCS_DEBUG) {
                 error_log("DEBUG [" . __METHOD__ . ":" . __LINE__ . "] redirecting to {$wgScriptPath}/Special:PonyDocsLatestDoc?t={$title}");
             }
             header("Location: " . $wgScriptPath . "/Special:SpecialLatestDoc?t={$title}", true, 302);
             exit(0);
         }
         /**
          * Now we need to filter out any versions which this user has no access to.  The easiest way is to loop through
          * our resulting $existingVersions and see if each is in_array( $versionNameList );  if its NOT, continue looping.
          * Once we hit one, redirect.  if we exhaust our list, go to the main page or something.
          */
         foreach ($existingVersions as $pV) {
             if (in_array($pV->getVersionName(), $versionNameList)) {
                 /**
                  * Look up topic name and redirect to URL.
                  */
                 $res = $dbr->select(array('categorylinks', 'page'), 'page_title', array('cl_from = page_id', 'page_namespace = "' . NS_PONYDOCS . '"', "cl_to = 'V:" . $dbr->strencode($pV->getProductName() . ':' . $pV->getVersionName()) . "'", 'cl_type = "page"', "cl_sortkey LIKE '" . $dbr->strencode(strtoupper("{$productName}:{$manualName}:{$topicName}")) . ":%'"), __METHOD__);
                 if (!$res->numRows()) {
                     if (PONYDOCS_DEBUG) {
                         error_log("DEBUG [" . __METHOD__ . ":" . __LINE__ . "] redirecting to {$defaultRedirect}");
                     }
                     header("Location: " . $defaultRedirect);
                     exit(0);
                 }
                 $row = $dbr->fetchObject($res);
                 $title = Title::newFromText(PONYDOCS_DOCUMENTATION_NAMESPACE_NAME . ":{$row->page_title}");
                 $article = new Article($title);
                 $article->loadContent();
                 PonyDocsProductVersion::SetSelectedVersion($pV->getProductName(), $pV->getVersionName());
                 if (!$article->exists()) {
                     $article = NULL;
                 } else {
                     // Without this we lose SplunkComments and version switcher.
                     // Probably we can replace with a RequestContext in the future...
                     $wgTitle = $title;
                 }
                 return TRUE;
             }
         }
         /**
          * Invalid redirect -- go to Main_Page or something.
          */
         if (PONYDOCS_DEBUG) {
             error_log("DEBUG [" . __METHOD__ . ":" . __LINE__ . "] redirecting to {$defaultRedirect}");
         }
         header("Location: " . $defaultRedirect);
         exit(0);
     } else {
         /**
          * Ensure version specified in aliased URL is a valid version -- if it is not we just need to do our default
          * redirect here.
          */
         $version = PonyDocsProductVersion::GetVersionByName($productName, $versionName);
         if (!$version) {
             if (PONYDOCS_DEBUG) {
                 error_log("DEBUG [" . __METHOD__ . ":" . __LINE__ . "] unable to retrieve version ({$versionName}) for product ({$productName}); redirecting to {$defaultRedirect}");
             }
             header("Location: " . $defaultRedirect);
             exit(0);
         }
         /**
          * Look up the TOPIC in the categorylinks and find the one which is tagged with the version supplied.  This
          * is the URL to redirect to.  
          */
         $res = $dbr->select(array('categorylinks', 'page'), 'page_title', array('cl_from = page_id', 'page_namespace = "' . NS_PONYDOCS . '"', "cl_to = 'V:" . $dbr->strencode($productName . ':' . $versionSelectedName) . "'", 'cl_type = "page"', "cl_sortkey LIKE '" . $dbr->strencode(strtoupper("{$productName}:{$manualName}:{$topicName}")) . ":%'"), __METHOD__);
         if (!$res->numRows()) {
             /**
              * Handle invalid redirects?
              */
             $wgHooks['BeforePageDisplay'][] = "PonyDocsExtension::handle404";
             return false;
         }
         $row = $dbr->fetchObject($res);
         $title = Title::newFromText(PONYDOCS_DOCUMENTATION_NAMESPACE_NAME . ":{$row->page_title}");
         /// FIXME this shouldn't be necessary because selected version already comes from here
         PonyDocsProductVersion::SetSelectedVersion($productName, $versionSelectedName);
         $article = new Article($title);
         $article->loadContent();
         if (!$article->exists()) {
             $article = NULL;
         } else {
             // Without this we lose SplunkComments and version switcher.
             // Probably we can replace with a RequestContext in the future...
             $wgTitle = $title;
         }
         return TRUE;
     }
     return FALSE;
 }
开发者ID:simcen,项目名称:ponydocs,代码行数:101,代码来源:PonyDocsExtension.body.php

示例5: runTests

	function runTests() {
		global $wgOut, $wgTitle;

		$wgOut->wrapWikiMsg('<h1>$1</h1>', 'offline_heading_status');

		$wgOut->addHTML('<ul>');
		// lookup a real article in the index can be searched
		$results = DumpReader::index_search(wfMsg('offline_test_article'));
		if (count($results) > 0)
			list ($bz_file, $offset, $entry_title) = $results[0];

		$test_index = isset($bz_file);
		$this->printTest($test_index, 'offline_index_test');
		if (!$test_index) {
			$this->diagnoseIndex();
			return;
		}

		// tests that bz2 dumpfiles can be opened and read
		$xml = DumpReader::load_bz($bz_file, $entry_title);
		$test_bz = isset($xml);
		$this->printTest($test_bz, 'offline_bzload_test');
		if (!$test_bz) {
			$this->diagnoseBzload($bz_file);
			return;
		}
			//report subdirectory setting
//                if (substr($bz_file, 0, 1) == 'x') {
//                    $subdir = dirname($bz_file); //TODO strip absolute components if needed
//                    $wgOut->addWikiMsg('offline_subdir-status', $subdir);
//                    $wgOut->addHTML(
//                        '<label>' .  wfMsg('offline_change-subdir') .
//                        '<input type=text size=20 name="subdir" value="'.$subdir.'">
//                        <input type=submit name="subdir" value="Change">
//                        </label/>'
//                    );
//                }

		// TODO report language settings and availabilities

		//test that a specific article can be loaded
		$article_wml = DumpReader::load_article($entry_title);
		$test_article = isset($article_wml);
		$this->printTest($test_article, 'offline_article_test');
		if (!$test_article) {
			//TODO diagnose
			return;
		}
		//TODO test that the wml has not been padded or truncated

		//test that our handler is still hooked in
		$mw_api_article = new Article(Title::newFromText($entry_title));
		$mw_api_article->loadContent();
		$content = $mw_api_article->getContent();
//wfDebug('got '.strlen($mw_api_article->mContent).' bytes of wml from cache');
		$test_hooks = $mw_api_article->mContentLoaded;
		// TODO false positive
		$this->printTest($test_hooks, 'offline_hooks_test');
		if (!$test_hooks) {
			$this->diagnoseHooks();
			return;
		}

		//TODO test Templates

		$wgOut->addHTML('</ul>');

		$wgOut->wrapWikiMsg('<i>$1</i>', 'offline_all_tests_pass');
		//TODO div collapse or load on demand
		//$wgOut->addWikiText($content);
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:71,代码来源:SpecialOffline.php

示例6: Article

<?php

require_once '/classes/Article.php';
$path = '';
if (isset($_POST['articleTitle'])) {
    $obj = new Article($_POST['articleTitle']);
}
if (isset($_POST['language'])) {
    $path = $obj->loadContent($_POST['language']);
}
return $path;
开发者ID:khushboo30796,项目名称:language-transltr,代码行数:11,代码来源:articleprocess.php

示例7: doRedirect

    function doRedirect($form_name, $page_name, $params)
    {
        global $wgOut;
        $page_title = Title::newFromText($page_name);
        if ($page_title->exists()) {
            // It exists - see if page is a redirect; if
            // it is, edit the target page instead.
            $article = new Article($page_title, 0);
            $article->loadContent();
            $redirect_title = Title::newFromRedirect($article->fetchContent());
            if ($redirect_title != null) {
                $page_title = $redirect_title;
                $page_name = SFUtils::titleURLString($redirect_title);
            }
            // HACK - if this is the default form for
            // this page, send to the regular 'formedit'
            // tab page; otherwise, send to the 'Special:FormEdit'
            // page, with the form name hardcoded.
            // Is this logic necessary? Or should we just
            // out-guess the user and always send to the
            // standard form-edit page, with the 'correct' form?
            $default_forms = SFFormLinker::getDefaultFormsForPage($page_title);
            if (count($default_forms) > 0) {
                $default_form_name = $default_forms[0];
            } else {
                $default_form_name = null;
            }
            if ($form_name == $default_form_name) {
                $redirect_url = $page_title->getLocalURL('action=formedit');
            } else {
                $redirect_url = self::getFormEditURL($form_name, $page_name);
            }
        } else {
            $redirect_url = self::getFormEditURL($form_name, $page_name);
            // Of all the request values, send on to 'FormEdit'
            // only 'preload' and specific form fields - we can
            // identify the latter because they show up as arrays.
            foreach ($_REQUEST as $key => $val) {
                if (is_array($val)) {
                    $template_name = urlencode($key);
                    foreach ($val as $field_name => $value) {
                        $field_name = urlencode($field_name);
                        $value = urlencode($value);
                        $redirect_url .= strpos($redirect_url, '?') > -1 ? '&' : '?';
                        $redirect_url .= $template_name . '[' . $field_name . ']=' . $value;
                    }
                } elseif ($key == 'preload') {
                    $redirect_url .= strpos($redirect_url, '?') > -1 ? '&' : '?';
                    $redirect_url .= "{$key}={$val}";
                }
            }
        }
        if (!is_null($params) && $params !== '') {
            $redirect_url .= strpos($redirect_url, '?') > -1 ? '&' : '?';
            $redirect_url .= $params;
        }
        $wgOut->setArticleBodyOnly(true);
        // Show "loading" animated image while people wait for the
        // redirect.
        global $sfgScriptPath;
        $text = "<p style=\"position: absolute; left: 45%; top: 45%;\"><img src=\"{$sfgScriptPath}/skins/loading.gif\" /></p>\n";
        $text .= <<<END
\t\t<script type="text/javascript">
\t\twindow.onload = function() {
\t\t\twindow.location="{$redirect_url}";
\t\t}
\t\t</script>

END;
        $wgOut->addHTML($text);
        return;
    }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:72,代码来源:SF_FormStart.php

示例8: doRedirect

    function doRedirect($form_name, $page_name, $params)
    {
        global $wgOut;
        $page_title = Title::newFromText($page_name);
        if ($page_title->exists()) {
            // It exists - see if page is a redirect; if
            // it is, edit the target page instead.
            $article = new Article($page_title, 0);
            $article->loadContent();
            $redirect_title = Title::newFromRedirect($article->fetchContent());
            if ($redirect_title != null) {
                $page_title = $redirect_title;
                $page_name = SFUtils::titleURLString($redirect_title);
            }
            // HACK - if this is the default form for
            // this page, send to the regular 'formedit'
            // tab page; otherwise, send to the 'Special:FormEdit'
            // page, with the form name hardcoded.
            // Is this logic necessary? Or should we just
            // out-guess the user and always send to the
            // standard form-edit page, with the 'correct' form?
            $default_forms = SFFormLinker::getDefaultFormsForPage($page_title);
            if (count($default_forms) > 0) {
                $default_form_name = $default_forms[0];
            } else {
                $default_form_name = null;
            }
            if ($form_name == $default_form_name) {
                $redirect_url = $page_title->getLocalURL('action=formedit');
            } else {
                $redirect_url = self::getFormEditURL($form_name, $page_name);
            }
        } else {
            $redirect_url = self::getFormEditURL($form_name, $page_name);
            // Of all the request values, send on to 'FormEdit'
            // only 'preload' and specific form fields - we can
            // identify the latter because they show up as arrays.
            foreach ($_REQUEST as $key => $val) {
                if (is_array($val)) {
                    $redirect_url .= strpos($redirect_url, '?') > -1 ? '&' : '?';
                    // Re-add the key (i.e. the template
                    // name), so we can make a nice query
                    // string snippet out of the whole
                    // thing.
                    $wrapperArray = array($key => $val);
                    $redirect_url .= urldecode(http_build_query($wrapperArray));
                } elseif ($key == 'preload') {
                    $redirect_url .= strpos($redirect_url, '?') > -1 ? '&' : '?';
                    $redirect_url .= "{$key}={$val}";
                }
            }
        }
        if (!is_null($params) && $params !== '') {
            $redirect_url .= strpos($redirect_url, '?') > -1 ? '&' : '?';
            $redirect_url .= $params;
        }
        $wgOut->setArticleBodyOnly(true);
        // Show "loading" animated image while people wait for the
        // redirect.
        global $sfgScriptPath;
        $text = <<<END
\t<p style="position: absolute; left: 45%; top: 45%;">
\t<img src="{$sfgScriptPath}/skins/loading.gif" />
\t</p>
 \t<meta http-equiv="refresh" content="0; url={$redirect_url}" />

END;
        $wgOut->addHTML($text);
        return;
    }
开发者ID:roland2025,项目名称:mediawiki-extensions-SemanticForms,代码行数:70,代码来源:SF_FormStart.php

示例9: loadTitleRevision

 static function loadTitleRevision($title, $revid = 0)
 {
     if (!$revid) {
         $good = GoodRevision::newFromTitle($title, $title->getArticleId());
         if ($good) {
             $revid = $good->latestGood();
         }
     }
     // TODO these two are to be uncommented only for debugging
     //$revision = Revision::newFromTitle($title);
     //$revid = $revision->getId();
     $article = new Article($title, $revid);
     if (!$article) {
         return null;
     }
     $article->loadContent();
     $rev = $article->mRevision;
     return $rev ? $rev : null;
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:19,代码来源:ApiApp.body.php

示例10: FindH1ForTitle

 /**
  * CHANGE THIS TO CACHE THESE IN MEMCACHE OR WHATEVER.
  *
  * This takes a title (text form) and extracts the H1 content for the title and returns it.
  * This is used in display (heading and TOC).
  * 
  * @static
  * @param string $title The text form of the title to get the H1 content for.
  * @return string The resulting H1 content; or boolean false if title not found.
  */
 public static function FindH1ForTitle($title)
 {
     $article = new Article(Title::newFromText($title), 0);
     $content = $article->loadContent();
     if (!preg_match('/^\\s*=(.*)=/D', $article->getContent(), $matches)) {
         return false;
     }
     return $matches[1];
 }
开发者ID:Velody,项目名称:ponydocs,代码行数:19,代码来源:PonyDocsTopic.php

示例11: execute

 function execute($par)
 {
     global $wgOut;
     include "Parse_Entries.php";
     #Don't want to output standard Wiki stuff, just want blank page.
     $wgOut->disable();
     # If just Special:BibtexExport , explain what it is and die.
     if ($par == "") {
         echo "<h3>You haven't specified which wiki page you would like the BibTeX from.</h3>";
         echo "<div style=\"width:33em\">";
         echo "To grab the BibTeX between the &lt;bibtex&gt; and &lt;/bibtex&gt; tags ";
         echo "in an article, simply visit Special:BibtexExport/Article_Name.";
         echo "<p>";
         echo "To narrow it down you can append a query to the URL. For example, if you ";
         echo "wanted to get the bibtex for all the Haystack publications by David Huynh ";
         echo "in the year 2005, simply visit: <p>";
         echo "<a href=\"http://simile.mit.edu/exhibited-wiki/Special:BibtexExport/Haystack?field:author=David%20Huynh&field:year=2005\">";
         echo "http://simile.mit.edu/exhibited-wiki/Special:BibtexExport/Haystack?field:author=David%20Huynh&field:year=2005</a>";
         echo "</div>";
         die;
     }
     # Grab the article associated with the text past Special:BibtexExport.
     # e.g. Special:BibtexExport/Some_Article will grab all the data in the
     # Some_Article page.
     $title = Title::newFromURL($par);
     $article = new Article($title);
     $article->loadContent();
     $text = $article->getContent();
     # Try to get just the stuff in <bibtex> </bibtex> tags.
     $bibtexmatches = array();
     $anything = Parser::extractTagsAndParams(array('bibtex'), $text, $bibtexmatches);
     # info stored in $bibtexmatches array, but key is randomly generated, so must
     # iterate through the *one* element in the array.
     # that in turn is an array, with the second key being the content
     foreach ($bibtexmatches as $match) {
         $bibtex = $match[1];
     }
     # If there's a query string (e.g. Special:BibtexExport/Article?author=name)
     # we have more work to do. Otherwise, we're done.
     if (!$_SERVER['QUERY_STRING']) {
         echo "{$bibtex}";
     } else {
         #Parse Bibtex
         $parse = new PARSEENTRIES();
         $parse->loadBibtexString($bibtex);
         $parse->extractEntries();
         list($preamble, $strings, $entries, $undefinedStrings) = $parse->returnArrays();
         #filter by queries of form, e.g., ?field:author=Charles%20Darwin
         $queries = explode("&", $_SERVER['QUERY_STRING']);
         foreach ($queries as $query) {
             $survivingentries = array();
             list($attr, $val) = explode("=", $query);
             $val = rawurldecode($val);
             $explodedattr = explode(":", $attr);
             if ($explodedattr[0] == "field") {
                 # filter by some field
                 $filterby = $explodedattr[1];
                 #Now we know what to filter by, let's go through the bibtex.
                 foreach ($entries as $entry) {
                     if ($filterby == "author") {
                         $authorarray = explode(" and ", $entry['author']);
                         if (in_array($val, $authorarray)) {
                             $survivingentries[] = $entry;
                         }
                     } elseif ($entry[$filterby] == $val) {
                         $survivingentries[] = $entry;
                     }
                 }
             }
             unset($entries);
             $entries = $survivingentries;
             unset($survivingentries);
         }
         #Surviving entries should now be in $entries.
         echo self::parsedEntriesToBibtex($entries);
     }
     exit;
 }
开发者ID:Elhellawy,项目名称:simile-widgets,代码行数:78,代码来源:BibtexExport_body.php

示例12: wfFiAddCheckboxToUploadForm

function wfFiAddCheckboxToUploadForm(&$oUploadForm)
{
    global $wgRequest, $wgFiCreateOnUploadByDefault, $wgFiArticleNamespace;
    /*
     * Formular abeschickt?
     * Ja => Harken setzen, wie vor dem Abschicken
     * Nein => Artikel zur Datei aus dem Namensraum $wgFiArticleNamespace existiert?
     * 		Ja => Harken setzen, wenn darin Index gefunden wird
     * 		Nein => Harken nach globalen $wgFiCreateOnUploadByDefault setzen
     */
    $bCheckboxChecked = true;
    if (!is_null($wgRequest->getVal('wpUpload'))) {
        $bCheckboxChecked = !is_null($wgRequest->getVal('wpProcessIndex')) && $wgRequest->getVal('wpProcessIndex') == "true";
    } else {
        $iIndexArticleNamespace = $wgFiArticleNamespace > -1 ? $wgFiArticleNamespace : NS_IMAGE;
        if ($oUploadForm->mDesiredDestName != "") {
            $oTitle = Title::makeTitleSafe($iIndexArticleNamespace, $oUploadForm->mDesiredDestName);
            $oArticle = new Article($oTitle);
            if ($oArticle->exists()) {
                $oArticle->loadContent();
                $bCheckboxChecked = !(wfFiGetIndexFragments($oArticle->mContent) === false);
            } else {
                $bCheckboxChecked = $wgFiCreateOnUploadByDefault;
            }
        } else {
            $bCheckboxChecked = $wgFiCreateOnUploadByDefault;
        }
    }
    $oUploadForm->uploadFormTextAfterSummary .= "</td></tr><tr><td align=right>FileIndexer:</td><td><input type='checkbox' name='wpProcessIndex' value='true' " . ($bCheckboxChecked ? "checked" : "") . "> " . wfMsg('fileindexer_form_label_create_index') . "\n";
    return true;
}
开发者ID:Ratin,项目名称:Taken,代码行数:31,代码来源:FileIndexer.php


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