• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP textpattern函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中textpattern函数的典型用法代码示例。如果您正苦于以下问题:PHP textpattern函数的具体用法?PHP textpattern怎么用?PHP textpattern使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: define

define("txpinterface", "admin");
$thisversion = '4.1.0';
$txp_using_svn = true;
// set false for releases
ob_start(NULL, 2048);
if (!@(include './config.php')) {
    ob_end_clean();
    include txpath . '/setup/index.php';
    exit;
} else {
    ob_end_clean();
}
header("Content-type: text/html; charset=utf-8");
if (isset($_POST['form_preview'])) {
    include txpath . '/publish.php';
    textpattern();
    exit;
}
error_reporting(E_ALL);
@ini_set("display_errors", "1");
include_once txpath . '/lib/constants.php';
include_once txpath . '/lib/mdb.php';
include_once txpath . '/lib/txplib_db.php';
include_once txpath . '/lib/txplib_prefs.php';
include_once txpath . '/lib/txplib_forms.php';
include_once txpath . '/lib/txplib_html.php';
include_once txpath . '/lib/txplib_misc.php';
include_once txpath . '/lib/txplib_element.php';
include_once txpath . '/lib/txplib_class.php';
include_once txpath . '/lib/admin_config.php';
include_once txpath . '/lib/txplib_controller.php';
开发者ID:bgarrels,项目名称:textpattern,代码行数:31,代码来源:index.php


示例2: _textpattern

 function _textpattern()
 {
     global $plugins_ver, $pretext, $prefs, $plugin_callback;
     $this->debug('Plugin: ' . $this->plugin_name . ' - ' . $plugins_ver[$this->plugin_name]);
     $this->debug('Function: ' . __FUNCTION__ . '()');
     // URI
     $req = $pretext['req'];
     $req = preg_replace('%\\?[^\\/]+$%', '', $req);
     $this->debug('Request URI: ' . $req);
     $uri = explode('/', trim($req, '/'));
     // The number of components comes in useful when determining the best partial match.
     $uri_component_count = count($uri);
     // Permanent links
     $permlinks = $this->get_all_permlinks(1);
     // Force Textpattern and tags to use messy URLs - these are easier to
     // find in regex
     $this->set_permlink_mode();
     if (count($permlinks)) {
         // We also want to match the front page of the site (for page numbers / feeds etc..).
         // Add a permlinks rule which will do that.
         $permlinks['default'] = array('components' => array(), 'settings' => array('pl_name' => 'gbp_permanent_links_default', 'pl_precedence' => '', 'pl_preview' => '/', 'con_section' => '', 'con_category' => '', 'des_section' => '', 'des_category' => '', 'des_permlink' => '', 'des_feed' => '', 'des_location' => '', 'des_page' => ''));
         // Extend the pretext_replacement scope outside the foreach permlink loop
         $pretext_replacement = NULL;
         foreach ($permlinks as $id => $pl) {
             // Extract the permlink settings
             $pl_settings = $pl['settings'];
             extract($pl_settings);
             $this->debug('Permlink name: ' . $pl_name);
             $this->debug('Permlink id: ' . $id);
             $this->debug('Preview: ' . $pl_preview);
             $pl_components = $pl['components'];
             // URI components
             $uri_components = $uri;
             $this->debug('PL component count: ' . count($pl_components));
             $this->debug('URL component count: ' . count($uri_components));
             $date = false;
             $title_page_feed = false;
             foreach ($pl_components as $pl_c) {
                 // Are we expecting a date component? If so the number of pl and uri components won't match
                 if ($pl_c['type'] == 'date') {
                     $date = true;
                 } else {
                     if (in_array($pl_c['type'], array('title', 'page', 'feed'))) {
                         $title_page_feed = true;
                     }
                 }
             }
             if (!$title_page_feed) {
                 // If there isn't a title, page or feed component then append a special type for cleaver partial matching
                 $pl_components[] = array('type' => 'title_page_feed', 'prefix' => '', 'suffix' => '', 'regex' => '', 'text' => '');
             }
             // Exit early if there are more URL components than PL components,
             // taking into account whether there is a data component
             if (!$uri_components[0] || count($uri_components) > count($pl_components) + ($date ? 2 : 0)) {
                 $this->debug('More URL components than PL components');
                 continue;
             }
             // Reset pretext_replacement as we are about to start another comparison
             $pretext_replacement = array('permlink_id' => $id);
             // Reset the article context string
             $context = array();
             unset($context_str);
             if (!empty($des_section)) {
                 $context[] = "`Section` = '{$des_section}'";
             }
             if (!empty($des_category)) {
                 $context[] = "(`Category1` = '{$des_category}' OR `Category2` = '{$des_category}')";
             }
             $context_str = count($context) > 0 ? 'and ' . join(' and ', $context) : '';
             // Assume there is no match
             $partial_match = false;
             $cleaver_partial_match = false;
             // Loop through the permlink components
             foreach ($pl_components as $pl_c_index => $pl_c) {
                 // Assume there is no match
                 $match = false;
                 // Check to see if there are still URI components to be checked.
                 if (count($uri_components)) {
                     // Get the next component.
                     $uri_c = array_shift($uri_components);
                 } else {
                     if (!$title_page_feed && count($pl_components) - 1 == $uri_component_count) {
                         // If we appended a title_page_feed component earlier and permlink and URI components
                         // counts are equal, we must of finished checking this permlink, and it matches so break.
                         $match = true;
                         break;
                     } else {
                         // If there are no more URI components then we have a partial match.
                         // Store the partial match data unless there has been a preceding permlink with the
                         // same number of components, as permlink have already been sorted by precedence.
                         if (!array_key_exists($uri_component_count, $this->partial_matches)) {
                             $this->partial_matches[$uri_component_count] = $pretext_replacement;
                         }
                         // Unset pretext_replacement as changes could of been made in a preceding component
                         unset($pretext_replacement);
                         // Break early form the foreach permlink components loop.
                         $partial_match = true;
                         break;
                     }
                 }
//.........这里部分代码省略.........
开发者ID:gbp,项目名称:gbp_permanent_links,代码行数:101,代码来源:gbp_permanent_links.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP texttooltip函数代码示例发布时间:2022-05-23
下一篇:
PHP textlib_get_instance函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap