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


PHP URL::sanitize方法代码示例

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


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

示例1: index

 public function index()
 {
     $p_var = Config::getPaginationVariable();
     $current_page = array_get($this->context, 'current_page');
     $total_pages = array_get($this->context, 'total_pages');
     $pages_to_show = $this->fetchParam('pages_to_show', 5, 'is_numeric', false, false);
     $q_strings = URL::sanitize($_GET);
     // catch less than 1 total pages
     if ($total_pages <= 1) {
         return 0;
     }
     $listing = '';
     $lower = max(1, min(floor($current_page - ($pages_to_show - 1) / 2), $total_pages - $pages_to_show + 1));
     $upper = $lower + min($total_pages, $pages_to_show) - 1;
     for ($i = $lower; $i <= $upper; $i++) {
         if ($i == $current_page) {
             $listing .= '<li class="active">';
         } else {
             $listing .= '<li>';
         }
         $q = http_build_query(array_merge($q_strings, array($p_var => $i)));
         $listing .= '<a href="{{ url }}?' . $q . '">' . $i . '</a></li>';
     }
     return $listing;
 }
开发者ID:jackmcdade,项目名称:statamic-pi-listpages,代码行数:25,代码来源:pi.listpages.php

示例2: getCurrentURL

 /**
  * Gets the current URL without needing the public API
  * 
  * @return string
  */
 private function getCurrentURL()
 {
     if (isset($_SERVER['REQUEST_URI']) && $_SERVER['REQUEST_URI']) {
         $url = $_SERVER['REQUEST_URI'];
     } else {
         // doesn't exist, hand-make it
         // code ported from \Slim\Environment
         if (strpos($_SERVER['REQUEST_URI'], $_SERVER['SCRIPT_NAME']) === 0) {
             $script_name = $_SERVER['SCRIPT_NAME'];
             //Without URL rewrite
         } else {
             $script_name = str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME']));
             //With URL rewrite
         }
         $url = '/' . ltrim(substr_replace($_SERVER['REQUEST_URI'], '', 0, strlen($script_name)), '/');
     }
     return URL::sanitize($url);
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:23,代码来源:api.html_caching.php

示例3: control_panel__add_to_publish_form_header

 /**
  * Add to the top of the publish form
  *
  * @return string
  */
 public function control_panel__add_to_publish_form_header()
 {
     // master switch for revisions
     if (!$this->core->isEnabled()) {
         return false;
     }
     $app = \Slim\Slim::getInstance();
     // hidden message field
     $html = '<input type="hidden" name="revisions__commit_message" id="revision-message">';
     $html .= '<div id="revision-default-serialized" style="display: none !important;"></div>';
     if ($this->blink->get('is_revision') && !$this->blink->get('is_latest_revision')) {
         // get the revision data
         $timestamp = $this->core->getRevisionTimestamp($this->core->getPath(), $this->blink->get('current_revision'));
         $html .= '<div class="revisions-feedback">';
         $html .= '  <span class="ss-icon">help</span>';
         $html .= '  ' . sprintf(__('viewing_revision'), Date::format(Config::getDateFormat(), $timestamp)) . ' ';
         $html .= '  <a href="' . $app->urlFor('publish') . '?path=' . URL::sanitize(Request::get('path')) . '">' . __('viewing_revision_link') . '.';
         $html .= '</div>';
     }
     return $html;
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:26,代码来源:hooks.revisions.php

示例4: ob_get_clean

    // mark milestone for debug panel
    Debug::markMilestone('page ready');

    $app->halt($response_code, ob_get_clean());

})->via('GET', 'POST', 'HEAD');


// a second route that captures all routes, but will always return the 404 page
$app->map('/(:segments+)', function ($segments = array()) use ($app) {
    global $is_debuggable_route;
    $is_debuggable_route = true;

    // clean segments
    $segments = URL::sanitize($segments);

    // segments
    foreach ($segments as $key => $seg) {
        $count                            = $key + 1;
        $app->config['segment_' . $count] = $seg;
    }
    $app->config['last_segment'] = end($segments);

    $path = '/404';

    $app->config['current_path'] = $path;

    // init some variables for below
    $app->config['current_url']  = $app->config['current_path'];
    $app->config['current_path'] = $path; # override global current_path
开发者ID:jalmelb,项目名称:24hl2015,代码行数:30,代码来源:routes.php

示例5: setDefaultTags

 /**
  * Set up any and all global vars, tags, and other defaults
  *
  * @return void
  */
 public static function setDefaultTags()
 {
     $app = \Slim\Slim::getInstance();
     /*
     |--------------------------------------------------------------------------
     | User & Session Authentication
     |--------------------------------------------------------------------------
     |
     | This may be overwritten later, but let's go ahead and set the default
     | layout file to start assembling our front-end view.
     |
     */
     $current_member = Auth::getCurrentMember();
     $app->config['logged_in'] = !is_null($current_member);
     $app->config['username'] = $current_member ? $current_member->get('username') : false;
     $app->config['is_admin'] = $current_member ? $current_member->hasRole('admin') : false;
     // current member data
     if ($current_member) {
         $app->config['current_member'] = array('logged_in' => !is_null($current_member), 'username' => $current_member->get('username')) + $current_member->export();
         // load up roles
         foreach ($current_member->get('roles') as $role) {
             $app->config['current_member']['is_' . $role] = 'true';
         }
     }
     /*
     |--------------------------------------------------------------------------
     | GET and POST global vars
     |--------------------------------------------------------------------------
     |
     | Use these at your own risk, of course. Don't be stupid.
     |
     */
     $app->config['get'] = URL::sanitize($_GET);
     $app->config['post'] = URL::sanitize($_POST);
     $app->config['get_post'] = $app->config['get'] + $app->config['post'];
     $app->config['homepage'] = Config::getSiteRoot();
     $app->config['now'] = time();
 }
开发者ID:zane-insight,项目名称:WhiteLaceInn,代码行数:43,代码来源:statamic.php

示例6: getResourceURI

 /**
  * Retrieves the resource URI for this request
  *
  * @param mixed  $default  Default value to use if not set
  * @return string
  */
 public static function getResourceURI($default = NULL)
 {
     return Helper::pick(URL::sanitize(\Slim\Slim::getInstance()->request()->getResourceUri()), $default);
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:10,代码来源:request.php

示例7: createPaginationData

 public static function createPaginationData($count, $limit)
 {
     $q_strings = URL::sanitize($_GET);
     $p_var = Config::getPaginationVariable();
     $page = Request::get($p_var, 1);
     $current_page = (int) min(max(1, $page), max(1, $page));
     $data = array();
     $data['current_page'] = $current_page;
     $data['total_items'] = (int) max(0, $count);
     $data['items_per_page'] = (int) max(1, $limit);
     $data['total_pages'] = (int) ceil($count / $limit);
     $data['current_first_item'] = (int) min(($page - 1) * $limit + 1, $count);
     $data['current_last_item'] = (int) min($data['current_first_item'] + $limit - 1, $count);
     $data['offset'] = (int) (($current_page - 1) * $limit);
     $data['previous_page'] = $current_page > 1 ? '?' . http_build_query(array_merge($q_strings, array($p_var => $current_page - 1))) : FALSE;
     $data['next_page'] = $current_page < $data['total_pages'] ? '?' . http_build_query(array_merge($q_strings, array($p_var => $current_page + 1))) : FALSE;
     $data['first_page'] = $current_page === 1 ? FALSE : '?' . http_build_query(array_merge($q_strings, array($p_var => 1)));
     $data['last_page'] = $current_page >= $data['total_pages'] ? FALSE : '?' . http_build_query(array_merge($q_strings, array($p_var => $data['total_pages'])));
     return $data;
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:20,代码来源:helper.php


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