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


PHP news::briefText方法代码示例

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


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

示例1: buildPageAuxHead


//.........这里部分代码省略.........
     // ---------------------------------------------------------------------------
     //TODO: this revision date is not ok for generated content!
     $GLOBALS[SUBSITE]["head"][] = "    <!--meta name='date-revision-yyyymmdd' content='" . $this->getConfig("revision") . "'-->\r\n" . "\r\n";
     // ---------------------------------------------------------------------------
     // Prevent Internet Explorer from placing download icons over images
     // HTML5: bad value http-equiv='imagetoolbar'
     // ---------------------------------------------------------------------------
     $GLOBALS[SUBSITE]["head"][] = "    <!--[if IE]>" . "<meta http-equiv='imagetoolbar' content='no'>" . "<![endif]-->\r\n" . "\r\n";
     // ---------------------------------------------------------------------------
     // Always force Internet Explorer to use latest IE rendering engine,
     // and use Chrome Frame if installed
     //   http://msdn.microsoft.com/library/cc817574.aspx
     //   http://www.chromium.org/developers/how-tos/chrome-frame-getting-started
     //   http://stackoverflow.com/questions/22059060/is-it-still-valid-to-use-ie-edge-chrome-1
     // HTML5: bad value http-equiv='X-UA-Compatible'
     // ---------------------------------------------------------------------------
     $GLOBALS[SUBSITE]["head"][] = "    <!--[if IE]>" . "<meta http-equiv='X-UA-Compatible' content='IE=edge'>" . "<![endif]-->\r\n" . "\r\n";
     // ---------------------------------------------------------------------------
     // Open Graph properties (needed for Facebook integration)
     //   http://...
     // HTML5: ....
     // ---------------------------------------------------------------------------
     if (IS_NEWS && !empty($_REQUEST["articleid"])) {
         if (!isset($GLOBALS["newsClass"])) {
             if (!class_exists("fromdb_nwnews", FALSE)) {
                 require_once PATH_CLASSES . "/fromdb/nwnews.php";
             }
             $GLOBALS["newsClass"] = new fromdb_nwnews();
         }
         if (!class_exists("news", FALSE)) {
             require_once PATH_CLASSES . "/lib/news.php";
         }
         $thearticle = $GLOBALS["newsClass"]->getArticle(NEWS_ANYARTICLE, $_REQUEST["articleid"]);
         $GLOBALS[SUBSITE]["head"][] = "    <meta property='og:type'        content='website'>\r\n" . (!empty($thearticle["title"]) ? "    <meta property='og:title'       content='" . $thearticle["title"] . "'>\r\n" : "") . "    <meta property='og:url'         content='" . REQUESTSCHEME . "://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"] . "'>\r\n" . (!empty($thearticle["text"]) ? "    <meta property='og:description' content='" . news::briefText($thearticle["text"], 225) . "'>\r\n" : "") . "\r\n";
     }
     // ---------------------------------------------------------------------------
     // Windows Taskbar Pinning (from Windows 7 = IE 9).
     // Note that essentially every new version of IE has new backwards-incompatible
     // versions of these tags. IE 11 does not actually need the tags to be present
     // in the document, so you can save users who do not intend to pin your site the
     // bandwidth (thus gaining performance) by including a browserconfig.xml in your
     // root (eg. example.com/browserconfig.xml). So what you do is include the
     // two/three tags IE 10 needs, and put the new IE 11 tags in your browser config file.
     // Windows 8 requires no padding in their image, only a transparent background.
     // Windows 8.1 (IE 11), however, expect 1/5 of the tile images to be left
     // transparent for padding. You will stick out like a sore thumb amongst the
     // other applications if you do not pay attention to the padding.
     //   http://msdn.microsoft.com/en-us/library/ie/gg491732%28v=vs.85%29.aspx
     //   http://msdn.microsoft.com/en-us/library/ie/hh772707%28v=vs.85%29.aspx
     //   http://davidwalsh.name/msapplication-task
     //   http://stackoverflow.com/questions/17474389/windows-8-prepare-site-for-pinning
     //   http://www.buildmypinnedsite.com/ [= Windows 8 Wizard]
     //   http://www.buildmypinnedsite.com/windows7/en
     //   http://msdn.microsoft.com/en-us/library/ie/dn320426%28v=vs.85%29.aspx
     // HTML5: ....
     // ---------------------------------------------------------------------------
     $GLOBALS[SUBSITE]["head"][] = "    <!--[if IE 9]>\r\n" . "    <meta name='application-name' content='Nordita Web'>\r\n" . "    <meta name='msapplication-starturl' content='/'>\r\n" . "    <meta name='msapplication-tooltip' content='Nordita Web'>\r\n" . "    <meta name='msapplication-navbutton-color' content='#fff'>\r\n" . "    <meta name='msapplication-window' content='width=1024;height=768'>\r\n" . "    <meta name='msapplication-task' content='name=Nordita News;action-uri=" . REQUESTSCHEME . "://www.nordita.org/news/;icon-uri=" . REQUESTSCHEME . "://www.nordita.org/img/_theme/th-white/icon_fav.ico'>\r\n" . "    <meta name='msapplication-task' content='name=Nordita on YouTube;action-uri=http://www.youtube.com/user/NorditaStockholm/videos?flow=grid&amp;view=1;icon-uri=http://youtube.com/favicon.ico'>\r\n" . "    <meta name='msapplication-task' content='name=Nordita on Twitter;action-uri=http://www.twitter.com/NorditaSweden;icon-uri=http://twitter.com/favicon.ico'>\r\n" . "    <meta name='msapplication-task' content='name=Nordita on Facebook;action-uri=http://www.facebook.com/nordita.stockholm;icon-uri=https://s-static.ak.facebook.com/rsrc.php/yi/r/q9U99v3_saj.ico'>\r\n" . "    <meta name='msapplication-task' content='name=Nordita on LinkedIn;action-uri=http://www.linkedin.com/company/nordita;icon-uri=http://linkedin.com/favicon.ico'>\r\n" . "    <![endif]-->\r\n" . "    <!--[if IE 10]><meta name='msapplication-TileImage' content='" . REQUESTSCHEME . "://www.nordita.org/img/_theme/default/logo_msapplication_144x144.png'><![endif]-->\r\n" . "\r\n";
     // ---------------------------------------------------------------------------
     // Address icons
     // HTML5: bad value rel='apple-touch-icon'
     // ---------------------------------------------------------------------------
     // Favicons are 16x16 px
     //   Default name and place (in MSIE): '/favicon.ico'
     //   NB: for the benefit of MSIE, use (also) a file with the default name and place
     // Apple iPhone Touch Icons are 57x57 px (also used in Android)
     //   Default name and place: '/apple-touch-icon.png'
开发者ID:,项目名称:,代码行数:67,代码来源:

示例2: drawCover

 public static function drawCover($issue_id = 0)
 {
     $stdout = "";
     // -----------------------------------------------------------
     // -- Obtain data
     // -----------------------------------------------------------
     self::initiateNewsClass();
     $dataCoverFeature = $dataCoverArticle = array();
     if (!empty($issue_id)) {
         $dataCoverFeature = $GLOBALS["newsClass"]->getArticle(NEWS_ANYARTICLE, 0, NEWS_FEATURE, $issue_id);
         if (is_array($dataCoverFeature)) {
             $dataCoverFeature = array_shift($dataCoverFeature);
         }
         $dataCoverArticle = $GLOBALS["newsClass"]->getArticle(NEWS_ANYARTICLE, 0, 0, $issue_id, 'A.cover_order', 1);
     }
     if (empty($dataCoverFeature) && empty($dataCoverArticle)) {
         return NEWS_EMPTY_HOOK . $stdout . functions::boxMessage("error", "No cover can be put together for this issue of Nordita News.", 1) . "";
     }
     $path_newsarticle = SUBSITE == PATH_NEWSTEST ? str_replace(PATH_NEWS . "/", PATH_NEWSTEST . "/", PATH_NEWSARTICLE) : PATH_NEWSARTICLE;
     //debug::rr($dataCoverFeature);
     //debug::rr($dataCoverArticle);
     // -----------------------------------------------------------
     // -- Output
     // -----------------------------------------------------------
     $stdout .= "<div class='col c1of2'>\r\n";
     if (empty($dataCoverFeature)) {
         $stdout .= functions::boxMessage("error", "No feature has been written for this issue.", 1) . "";
     } else {
         $url = isInPath("/archive/") ? $path_newsarticle . "/index.php?articleid=" . $dataCoverFeature["article_id"] : SUBSITE . "/feature/index.php";
         $title = str_replace("&amp;nbsp;", "&nbsp;", $dataCoverFeature["title"]);
         $readmore = "<strong>Read more</strong>";
         if (SUBSITE != PATH_NEWSEDIT && SUBSITE != PATH_NEWSEDITTEST) {
             $title = "<a href='" . $url . "'>" . $title . "</a>";
             $readmore = "<a href='" . $url . "'>" . $readmore . "</a>";
         }
         $text = htmlspecialchars_decode($dataCoverFeature["text"]);
         $text = preg_replace("#<p class='caption'>.*</p>#imU", "", $text);
         $text = news::briefText($text, 450);
         $stdout .= "  <div class='box roundcorners grayborder shadow padding'>\r\n" . "    <h3 style='font-size:1.6em;text-align:left'>" . $title . "</h3>\r\n" . "    <p style='margin-top:1em;clear:both;text-align:center;margin-bottom:-1em'>" . "<a href='" . $url . "'>" . "<img src='" . $dataCoverFeature["cover_image"] . "' style='width:320px'>" . "</a>" . "</p>\r\n" . "    <p>" . $text . "...&nbsp; [" . $readmore . "]</p>\r\n" . "  </div>\r\n" . "\r\n";
     }
     $stdout .= "</div>\r\n<div class='col c2of2'>\r\n";
     if (empty($dataCoverArticle)) {
         $stdout .= functions::boxMessage("error", "No news articles have been written for this issue of Nordita News.", 1) . "";
     } else {
         foreach ($dataCoverArticle as $key => $data) {
             $path = isset(self::$sectionPaths[$data["section_id"]]) ? self::$sectionPaths[$data["section_id"]] . "/" : "";
             $url = isInPath("/archive/") ? $path_newsarticle . "/index.php?articleid=" . $data["article_id"] : SUBSITE . "/" . $path . "index.php#" . $data["article_id"];
             $title = htmlspecialchars_decode(str_replace("&amp;quot;", "\"", $data["title"]));
             //if (strlen($title)>45) $title = functions::truncateStringByWord($title,45);
             $title = news::briefText($title, 45);
             if (SUBSITE != PATH_NEWSEDIT && SUBSITE != PATH_NEWSEDITTEST) {
                 $title = "<a href='" . $url . "'>" . $title . "</a>";
             }
             $text = preg_replace("#<p class='caption'>.*</p>#imU", "", htmlspecialchars_decode($data["text"]));
             $text = news::briefText($text, 130);
             $stdout .= "  <div class='coverlistitem'>\r\n" . "    <h4>" . $title . "</h4>\r\n" . "    <p><em>" . (!empty($data["cover_image"]) ? "<img src='" . $data["cover_image"] . "'> " : "") . $text . "</em></p>\r\n" . "  </div>\r\n" . "\r\n";
         }
     }
     $stdout .= "</div>\r\n<div style='clear:both'><br></div>\r\n";
     // -----------------------------------------------------------
     return $stdout;
 }
开发者ID:,项目名称:,代码行数:62,代码来源:


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