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


PHP HTMLFileCache::fetchPageText方法代码示例

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


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

示例1: getHTML

    function getHTML()
    {
        global $wgTitle, $wgUseFileCache, $title, $wgInputEncoding;
        global $wgSitename, $wgServer, $wgMessageCache;
        # I give up, Brion is right. Getting the message cache to work when there is no DB is tricky.
        # Hard coding strings instead.
        $noconnect = '<style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "/skins/WikiHow/main.css"; /*]]>*/</style>' . "<p style='padding-left:80px;'><strong>Sorry! This site is under going routine maintenance. </strong><br/>\n\t\t\t\t<br/><br/>\n\t\t\tThe maintenance will problem will likely be completed shortly, try waiting a few minutes and refreshing the page. <br/><br/>\n\t\t\t<b>Thanks for your patience.</b><br/><br/>\n\t\t\tIn the meantime, you can try accessing <a href='http://72.14.209.104/search?q=cache:" . $_SERVER['SCRIPT_URI'] . "'>Google's cached copy of this page</a>.\n\t\t\t<!-- (Can't contact the database server: \$1) -->\n\t\t\t</p>";
        $mainpage = 'Main Page';
        $searchdisabled = <<<EOT
<p style="margin: 1.5em 2em 1em">{$wgSitename} search is disabled for performance reasons. You can search via Google in the meantime.
<span style="font-size: 89%; display: block; margin-left: .2em">Note that their indexes of {$wgSitename} content may be out of date.</span></p>',
EOT;
        $googlesearch = "\n<!-- SiteSearch Google -->\n<FORM method=GET action=\"http://www.google.com/search\">\n<TABLE bgcolor=\"#FFFFFF\"><tr><td>\n<A HREF=\"http://www.google.com/\">\n<IMG SRC=\"http://www.google.com/logos/Logo_40wht.gif\"\nborder=\"0\" ALT=\"Google\"></A>\n</td>\n<td>\n<INPUT TYPE=text name=q size=31 maxlength=255 value=\"\$1\">\n<INPUT type=submit name=btnG VALUE=\"Google Search\">\n<font size=-1>\n<input type=hidden name=domains value=\"{$wgServer}\"><br /><input type=radio name=sitesearch value=\"\"> WWW <input type=radio name=sitesearch value=\"{$wgServer}\" checked> {$wgServer} <br />\n<input type='hidden' name='ie' value='\$2'>\n<input type='hidden' name='oe' value='\$2'>\n</font>\n</td></tr></TABLE>\n</FORM>\n<!-- SiteSearch Google -->";
        $cachederror = "The following is a cached copy of the requested page, and may not be up to date. ";
        # No database access
        if (is_object($wgMessageCache)) {
            $wgMessageCache->disable();
        }
        if (trim($this->error) == '') {
            $this->error = $this->db->getProperty('mServer');
        }
        $text = str_replace('$1', $this->error, $noconnect);
        //		$text .= wfGetSiteNotice();
        if ($wgUseFileCache) {
            if ($wgTitle) {
                $t =& $wgTitle;
            } else {
                if ($title) {
                    $t = Title::newFromURL($title);
                } elseif (@$_REQUEST['search']) {
                    $search = $_REQUEST['search'];
                    return $searchdisabled . str_replace(array('$1', '$2'), array(htmlspecialchars($search), $wgInputEncoding), $googlesearch);
                } else {
                    $t = Title::newFromText($mainpage);
                }
            }
            $cache = new HTMLFileCache($t);
            if ($cache->isFileCached()) {
                // @todo, FIXME: $msg is not defined on the next line.
                $msg = '<p style="color: red"><b>' . $msg . "<br />\n" . $cachederror . "</b></p>\n";
                $tag = '<div id="article">';
                $text = str_replace($tag, $tag . $msg, $cache->fetchPageText());
            }
        }
        return $text;
    }
开发者ID:ErdemA,项目名称:wikihow,代码行数:46,代码来源:Database.php

示例2: getHTML

    function getHTML()
    {
        global $wgTitle, $wgUseFileCache, $title, $wgInputEncoding;
        global $wgSitename, $wgServer, $wgMessageCache;
        # I give up, Brion is right. Getting the message cache to work when there is no DB is tricky.
        # Hard coding strings instead.
        $noconnect = "<p><strong>Sorry! This site is experiencing technical difficulties.</strong></p><p>Try waiting a few minutes and reloading.</p><p><small>(Can't contact the database server: \$1)</small></p>";
        $mainpage = 'Main Page';
        $searchdisabled = <<<EOT
<p style="margin: 1.5em 2em 1em">{$wgSitename} search is disabled for performance reasons. You can search via Google in the meantime.
<span style="font-size: 89%; display: block; margin-left: .2em">Note that their indexes of {$wgSitename} content may be out of date.</span></p>',
EOT;
        $googlesearch = "\n<!-- SiteSearch Google -->\n<FORM method=GET action=\"http://www.google.com/search\">\n<TABLE bgcolor=\"#FFFFFF\"><tr><td>\n<A HREF=\"http://www.google.com/\">\n<IMG SRC=\"http://www.google.com/logos/Logo_40wht.gif\"\nborder=\"0\" ALT=\"Google\"></A>\n</td>\n<td>\n<INPUT TYPE=text name=q size=31 maxlength=255 value=\"\$1\">\n<INPUT type=submit name=btnG VALUE=\"Google Search\">\n<font size=-1>\n<input type=hidden name=domains value=\"{$wgServer}\"><br /><input type=radio name=sitesearch value=\"\"> WWW <input type=radio name=sitesearch value=\"{$wgServer}\" checked> {$wgServer} <br />\n<input type='hidden' name='ie' value='\$2'>\n<input type='hidden' name='oe' value='\$2'>\n</font>\n</td></tr></TABLE>\n</FORM>\n<!-- SiteSearch Google -->";
        $cachederror = "The following is a cached copy of the requested page, and may not be up to date. ";
        # No database access
        if (is_object($wgMessageCache)) {
            $wgMessageCache->disable();
        }
        if (trim($this->error) == '') {
            $this->error = $this->db->getProperty('mServer');
        }
        $text = str_replace('$1', $this->error, $noconnect);
        $text .= wfGetSiteNotice();
        if ($wgUseFileCache) {
            if ($wgTitle) {
                $t =& $wgTitle;
            } else {
                if ($title) {
                    $t = Title::newFromURL($title);
                } elseif (@$_REQUEST['search']) {
                    $search = $_REQUEST['search'];
                    return $searchdisabled . str_replace(array('$1', '$2'), array(htmlspecialchars($search), $wgInputEncoding), $googlesearch);
                } else {
                    $t = Title::newFromText($mainpage);
                }
            }
            $cache = new HTMLFileCache($t);
            if ($cache->isFileCached()) {
                // @todo, FIXME: $msg is not defined on the next line.
                $msg = '<p style="color: red"><b>' . $msg . "<br />\n" . $cachederror . "</b></p>\n";
                $tag = '<div id="article">';
                $text = str_replace($tag, $tag . $msg, $cache->fetchPageText());
            }
        }
        return $text;
    }
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:46,代码来源:Database.php

示例3: fileCachedPage

 function fileCachedPage()
 {
     global $wgTitle, $wgLang, $wgOut;
     if ($wgOut->isDisabled()) {
         return;
         // Done already?
     }
     $mainpage = 'Main Page';
     if ($wgLang instanceof Language) {
         $mainpage = htmlspecialchars($wgLang->getMessage('mainpage'));
     }
     if ($wgTitle) {
         $t =& $wgTitle;
     } else {
         $t = Title::newFromText($mainpage);
     }
     $cache = new HTMLFileCache($t);
     if ($cache->isFileCached()) {
         return $cache->fetchPageText();
     } else {
         return '';
     }
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:23,代码来源:Database.php

示例4: fileCachedPage

 /**
  * @return string
  */
 private function fileCachedPage()
 {
     global $wgTitle, $wgOut;
     if ($wgOut->isDisabled()) {
         return;
         // Done already?
     }
     if ($wgTitle) {
         $t =& $wgTitle;
     } else {
         $t = Title::newFromText($this->msg('mainpage', 'Main Page'));
     }
     $cache = new HTMLFileCache($t);
     if ($cache->isFileCached()) {
         return $cache->fetchPageText();
     } else {
         return '';
     }
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:22,代码来源:DatabaseError.php


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