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


PHP DataUtil::formatForURL方法代码示例

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


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

示例1: smarty_function_id

/**
 * Smarty function to generate a valid atom ID for the feed
 *
 * Example
 *
 *   <id>{id}</id>
 *
 * @return       string the atom ID
 */
function smarty_function_id($params, &$smarty)
{
    $baseurl = System::getBaseUrl();
    $parts = parse_url($baseurl);
    $starttimestamp = strtotime(System::getVar('startdate'));
    $startdate = strftime('%Y-%m-%d', $starttimestamp);
    $sitename = System::getVar('sitename');
    $sitename = preg_replace('/[^a-zA-Z0-9-\\s]/', '', $sitename);
    $sitename = DataUtil::formatForURL($sitename);
    return "tag:{$parts['host']},{$startdate}:{$sitename}";
}
开发者ID:rmaiwald,项目名称:core,代码行数:20,代码来源:function.id.php

示例2: importData

 /**
  * create the new pages and content items from data
  */
 private function importData()
 {
     $this->createRecords();
     $items = $this->records;
     foreach ($items as $item) {
         // create page
         $page = array('parentPageId' => (int) $this->pageMap[(int) $item['ppid']], 'level' => $item['level'], 'title' => $item['title'], 'urlname' => DataUtil::formatForURL($item['title']), 'layout' => $item['layouttype'], 'showTitle' => $item['showtitle'], 'views' => $item['views'], 'activeFrom' => $item['activefrom'], 'activeTo' => $item['activeto'], 'active' => $item['active'], 'categoryId' => $this->categoryMap[(int) $item['categoryid']], 'position' => $item['position'], 'setLeft' => $item['setleft'], 'setRight' => $item['setright'], 'language' => $item['language']);
         // insert the page
         $obj = DBUtil::insertObject($page, 'content_page');
         // add item id to pagemap
         $this->pageMap[(int) $item['id']] = (int) $obj['id'];
         // create the contentitems for this page
         $content = array();
         if ($item['useheader']) {
             $content[] = array('pageId' => $obj['id'], 'areaIndex' => '0', 'position' => '0', 'module' => 'Content', 'type' => 'Heading', 'data' => serialize(array('text' => $item['title'], 'headerSize' => 'h3')));
         }
         foreach ($item['contentitems'] as $position => $pageParts) {
             $content[] = array('pageId' => $obj['id'], 'areaIndex' => $pageParts['areaIndex'], 'position' => $position, 'module' => 'Content', 'type' => $pageParts['contenttype'], 'data' => serialize(array('text' => $pageParts['data'], 'inputType' => $pageParts['inputType'])));
         }
         // write the items to the dbase
         foreach ($content as $contentItem) {
             DBUtil::insertObject($contentItem, 'content_content');
         }
     }
 }
开发者ID:robbrandt,项目名称:Content,代码行数:28,代码来源:AbstractModule.php

示例3: decodeurl

 /**
  * decode custom url string
  *
  * @author Philipp Niethammer
  * @return bool true if succeded false otherwise
  */
 public function decodeurl($args)
 {
     $suffix = $this->getVar('shorturlsuffix');
     $supportedfunctions = array('main', 'list', 'view', 'subpages', 'sitemap', 'extlist', 'categoriesList', 'pagelist');
     $argsnum = count($args['vars']);
     if (!isset($args['vars'][2]) || empty($args['vars'][2])) {
         System::queryStringSetVar('func', 'sitemap');
         return true;
     }
     if (in_array($args['vars'][2], $supportedfunctions)) {
         return false;
     }
     $lastarg = end($args['vars']);
     $urlname = '';
     if (substr($lastarg, strlen($lastarg) - strlen($suffix)) == $suffix) {
         for ($i = 2; $i < $argsnum; $i++) {
             if (!empty($urlname)) {
                 $urlname .= '/';
             }
             $urlname .= $args['vars'][$i];
         }
         if (($suffixLen = strlen($suffix)) > 0) {
             $urlname = substr($urlname, 0, -$suffixLen);
         }
         System::queryStringSetVar('func', 'view');
         System::queryStringSetVar('name', $urlname);
         return true;
     }
     if (!isset($args['vars'][3]) || empty($args['vars'][3])) {
         $mainCategory = CategoryRegistryUtil::getRegisteredModuleCategory('Content', 'content_page', $this->getVar('categoryPropPrimary'), 30);
         // 30 == /__SYSTEM__/Modules/Global
         //$cats = CategoryUtil::getCategoriesByParentID($mainCategory);
         $cats = CategoryUtil::getSubCategories($mainCategory);
         foreach ($cats as $cat) {
             if ($args['vars'][2] == $cat['name'] || $args['vars'][2] == DataUtil::formatForURL($cat['name'])) {
                 System::queryStringSetVar('func', 'listpages');
                 System::queryStringSetVar('cat', $cat['id']);
                 return true;
             }
         }
     }
     for ($i = 2; $i < $argsnum; $i++) {
         if (!empty($urlname)) {
             $urlname .= '/';
         }
         $urlname .= $args['vars'][$i];
     }
     System::queryStringSetVar('func', 'subpages');
     System::queryStringSetVar('name', $urlname);
     return true;
 }
开发者ID:robbrandt,项目名称:Content,代码行数:57,代码来源:User.php


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