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


PHP Strings::webalize方法代码示例

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


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

示例1: allow_page_edit

 public static function allow_page_edit($presenter, $id)
 {
     if (!$presenter->user->isInRole('user')) {
         //probably admin -> allow
         return true;
     }
     //log all changes by users
     if (count($presenter->request->post)) {
         $v = PagesModel::getPageById($id);
     } else {
         $v = $presenter->request;
     }
     $key = Strings::webalize($presenter->user->id);
     $data = date("Y-m-d H:i:s ") . $_SERVER["REQUEST_URI"] . " " . base64_encode(print_r($v, 1));
     file_put_contents(WWW_DIR . "/data/activitylog/{$key}.log", $data, FILE_APPEND);
     if ($presenter->user->identity->webpages == 'all') {
         return true;
     }
     $allowed = explode(',', $presenter->user->identity->webpages);
     foreach (PagesModel::getPageById($id)->getParents() as $page) {
         if (in_array($page->id, $allowed)) {
             //allowed to edit page?
             return true;
         }
     }
     return false;
 }
开发者ID:osmcz,项目名称:website,代码行数:27,代码来源:OsmAuthPlugin.php

示例2: constructUrl

 function constructUrl(PresenterRequest $appRequest, Url $ref)
 {
     if ($appRequest->getPresenterName() !== self::PRESENTER) {
         return NULL;
     }
     $params = $appRequest->getParameters();
     //find the friendly-url in the database
     $lang = $params['lang'];
     if ($lang == NULL) {
         $lang = $this->getDefaultLang();
     }
     //lang base url (domain or just relative prefix?)
     $langDomains = Environment::getVariable("langDomains");
     if ($langDomains) {
         $baseUrl = $ref->scheme . ':' . $langDomains[$lang];
     } else {
         $baseUrl = $ref->getBaseUrl() . ($lang == $this->getDefaultLang() ? '' : "{$lang}/");
     }
     //NULL page = /
     if (!isset($params['id_page'])) {
         return $baseUrl;
     }
     //nonexisting page - do not route
     $page = PagesModel::getPageById($params['id_page'], $lang);
     if (!$page) {
         return NULL;
     }
     unset($params['lang']);
     unset($params['id_page']);
     unset($params['action']);
     // appended parameters
     $params = http_build_query($params, '', '&');
     if ($params) {
         $params = "?{$params}";
     }
     // no pagelink -> do /p123-friendly-name
     if (!$page['seoname']) {
         return $baseUrl . "p{$page->id}" . (Strings::webalize($page->name) ? '-' : '') . Strings::webalize($page->name) . $params;
     }
     // /sth  -> normal friendly url for that page
     if ($page['seoname'][0] == '/') {
         return $baseUrl . substr($page['seoname'], 1) . $params;
     }
     return NULL;
 }
开发者ID:osmcz,项目名称:website,代码行数:45,代码来源:PagesRouter.php

示例3: getSanitizedName

 /**
  * Returns the sanitized file name.
  * @return string
  */
 public function getSanitizedName()
 {
     return trim(Strings::webalize($this->name, '.', FALSE), '.-');
 }
开发者ID:riskatlas,项目名称:micka,代码行数:8,代码来源:FileUpload.php

示例4: foreach

            foreach ($voting->movies->movie as $movie) {
                ?>
						<li>
						<?php 
                if (isset($movie->result)) {
                    ?>
							<span class="result"><?php 
                    echo $movie->result;
                    ?>
</span>
							<?php 
                }
                if (isset($movie->title)) {
                    ?>
							<a href="<?php 
                    echo $page->getUrl(null, 'movies') . '#' . Strings::webalize($movie->title);
                    ?>
"><span class="title"><?php 
                    echo $movie->title;
                    ?>
</span></a>
							<?php 
                }
                ?>
						</li>
						<?php 
            }
            ?>
					</ul>
					<?php 
        }
开发者ID:marekcepcek,项目名称:pb029-hw2,代码行数:31,代码来源:results.php

示例5: createRouter

 /**
  * @return \Nette\Application\IRouter
  */
 public function createRouter()
 {
     $router = new RouteList();
     $context = $this->context;
     Route::$styles['path'] = array(Route::PATTERN => '.*?');
     Route::setStyleProperty('presenter', Route::FILTER_TABLE, array('profil' => 'User:User', 'moje-akce' => 'User:Events', 'moje-mista' => 'User:Places', 'katalog' => 'Catalog', 'akce-pro-deti' => 'Calendar', 'clanky' => 'Articles', 'newsletter' => 'Newsletter', 'admin' => 'Admin:Default', 'ucet' => 'Account', 'o' => 'About', 'souteze' => 'Competitions', 'reklama' => 'Advertising', 'odkazy' => 'Links', 'partneri' => 'Partners', 'vyhledavani' => 'Search'));
     Route::setStyleProperty('action', Route::FILTER_TABLE, array('lokalita' => 'locality', 'mesto' => 'district', 'kraj' => 'shire', 'komentare' => 'comments', 'nas' => 'us'));
     Route::addStyle('timeframe');
     Route::setStyleProperty('timeframe', Route::FILTER_TABLE, array('vikend' => 'weekend', 'pristi-vikend' => 'next weekend', 'tyden' => 'week', 'pristi-tyden' => 'next week', 'tento-mesic' => 'month', 'pristi-mesic' => 'next month', 'dnes' => 'today', 'zitra' => 'tomorrow'));
     Route::addStyle('title');
     Route::setStyleProperty('title', Route::FILTER_OUT, function ($url) {
         return Strings::webalize($url);
     });
     Route::setStyleProperty('title', Route::FILTER_IN, function ($url) {
         return Strings::webalize($url);
     });
     $router[] = new Route('index.php', 'Service:default', Route::ONE_WAY);
     // @deprecated
     $router[] = new Route('akce-pro-deti.php', 'Calendar:default', Route::ONE_WAY);
     // @deprecated
     $router[] = new Route('kalendar.php', 'Calendar:default', Route::ONE_WAY);
     // @deprecated
     $router[] = new Route('infoservis[/<code>].php', 'Articles:default', Route::ONE_WAY);
     // @deprecated
     $router[] = new Route('odkazy.php', 'Links:default', Route::ONE_WAY);
     // @deprecated
     $router[] = new Route('partneri.php', 'Partners:default', Route::ONE_WAY);
     // @deprecated
     $router[] = new Route('inzerce.php', 'Advertising:default', Route::ONE_WAY);
     // @deprecated
     $router[] = new Route('souteze.php', 'Competitions:default', Route::ONE_WAY);
     // @deprecated
     $router[] = new Route('sdruzeni_pro_aktivni_rodinu.php', 'About:us', Route::ONE_WAY);
     // @deprecated
     $router[] = new Route('tipy/', 'Catalog:default', Route::ONE_WAY);
     // @deprecated
     $router[] = new Route('katalog_formular.php', 'Homepage:default', Route::ONE_WAY);
     // @deprecated
     $router[] = new Route('kalendar_formular.php', 'Homepage:default', Route::ONE_WAY);
     // @deprecated
     $router[] = new Route('katalog/kategorie/detska-predstaveni/', array('presenter' => "Calendar", 'action' => 'default', 'category' => 'detska-predstaveni'), Route::ONE_WAY);
     // @deprecated
     $router[] = new Route('<presenter clanky>/<code>/', 'Articles:detail');
     $router[] = new Route('<presenter souteze>/<code>/', 'Competitions:detail');
     $router[] = new Route('<presenter image>/<action [a-z]+>-<x [0-9]+>x<y [0-9]+>/<code>', 'Image:default');
     $router[] = new Route('<presenter katalog>/kategorie/<category>/', 'Catalog:default');
     $router[] = new Route('<presenter katalog>/aktivita/<category>/', 'Catalog:default');
     // @deprecated
     $router[] = new Route('<presenter katalog>/aktivita/<category>/kraj/<shire>', 'Catalog:default');
     // @deprecated
     $router[] = new Route('<presenter katalog>/lokalita/<locality>/', 'Catalog:default');
     $router[] = new Route('<presenter katalog>/mesto/<district>/', 'Catalog:default');
     $router[] = new Route('<presenter katalog>/kraj/<shire>/', 'Catalog:default');
     $router[] = new Route('<presenter katalog>[/detail]/<code>/', 'Catalog:detail');
     $router[] = new Route('<presenter akce-pro-deti>/kategorie/<category>/', 'Calendar:default');
     $router[] = new Route('<presenter akce-pro-deti>/lokalita/<locality>/', 'Calendar:default');
     $router[] = new Route('<presenter akce-pro-deti>/kraj/<shire>/', 'Calendar:default');
     //$router[] = new Route('<presenter akce-pro-deti>[/detail]/<id>/', 'Calendar:detail');
     $router[] = new Route('<presenter akce-pro-deti>[/detail]/<id>/', array('presenter' => "Calendar", 'action' => 'detail', 'id' => array(Route::FILTER_IN => function ($id) use($context) {
         if (is_numeric($id)) {
             return $id;
         } else {
             $code = substr($id, strpos($id, '-') + 1);
             $id = substr($id, 0, strpos($id, '-'));
             $pages = $context->createServiceEvents()->where('code', $code)->where('id', $id)->fetch();
             if (!$pages) {
                 throw new \Nette\Application\BadRequestException("Tato stránka neexistuje.", 404);
             }
             if ($pages->deleted == 1) {
                 throw new \Nette\Application\BadRequestException("Tato stránka byla odstraněna.", 410);
             }
             return $pages->id;
         }
     }, Route::FILTER_OUT => function ($id) use($context) {
         if (!is_numeric($id)) {
             return $id;
         } else {
             $pages = $context->createServiceEvents()->where('id', $id)->fetch();
             return $pages->id . '-' . $pages->code;
         }
     })));
     $router[] = new Route('<presenter akce-pro-deti>/kdy/<timeframe>/', 'Calendar:default');
     $router[] = new Route('<presenter>/<action>[/<id [0-9]+>/]', 'Homepage:default');
     $router[] = new Route('<presenter>/<action>[/<id>]', 'Homepage:default');
     return $router;
 }
开发者ID:soundake,项目名称:pd,代码行数:89,代码来源:RouterFactory.php

示例6: SimpleXMLElement

<?php

require_once 'libs/strings.php';
$data = new SimpleXMLElement(file_get_contents('data/movies/' . $page->getYear() . '.xml'));
?>
<div id="movies">
	<ul>
		<?php 
if ($data && isset($data->movies, $data->movies->movie)) {
    foreach ($data->movies->movie as $movie) {
        ?>
				<li id="<?php 
        echo isset($movie->title) ? Strings::webalize($movie->title) : '';
        ?>
" class="row full-section">
					<div class="center-section">
						<div class="col-sm-6">
						<?php 
        if (isset($movie->title)) {
            ?>
							<h2><?php 
            echo $movie->title;
            ?>
</h2>
							<?php 
        }
        if (isset($movie->description)) {
            ?>
							<span class="description"><?php 
            echo $movie->description;
            ?>
开发者ID:marekcepcek,项目名称:pb029-hw2,代码行数:31,代码来源:movies.php


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