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


PHP URI::url_array方法代码示例

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


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

示例1: _index

 public function _index($account, $sub_tool = FALSE)
 {
     $url_array = URI::url_array();
     $page_name = $this->get_page_name($url_array['0'], 'account', $account->id);
     $username = $url_array['2'];
     $action = (empty($url_array['1']) or 'tool' == $url_array['1']) ? 'index' : $url_array['1'];
     switch ($action) {
         case 'index':
             $content = self::dashboard($page_name);
             break;
         case 'create':
             return $this->wrap_tool(self::create_account($page_name), 'account', $account);
             break;
         case 'profile':
             return $this->wrap_tool(self::profile($username), 'account', $account);
             break;
         case 'all':
             return $this->wrap_tool(self::all_users($page_name), 'account', $account);
             break;
         case 'edit_profile':
             $content = self::edit_profile($page_name);
             break;
         case 'change_password':
             $content = self::change_password($page_name);
             break;
         case 'reset_password':
             $content = self::reset_password($page_name);
             break;
         case 'logout':
             $this->account_user->logout();
             $primary = $this->display_login($page_name);
             return $this->wrap_tool($primary, 'account', $account);
             break;
             /* plusjade stuff only */
         /* plusjade stuff only */
         case 'safe_mode':
             $content = self::safe_mode($page_name, $username);
             break;
         case 'new_website':
             $content = self::new_website($page_name);
             break;
         default:
             Event::run('system.404');
     }
     # the logic above will determine whether the user is logged in/out
     $wrapper = $this->account_user->logged_in($this->site_id) ? new View('public_account/accounts/dashboard') : new View('public_account/accounts/index');
     $wrapper->content = $content;
     $wrapper->page_name = $page_name;
     return $this->wrap_tool($wrapper, 'account', $account);
 }
开发者ID:plusjade,项目名称:plusjade,代码行数:50,代码来源:account.php

示例2: get_site

function get_site()
{
    $session = Session::instance();
    $domain_array = explode('.', $_SERVER['HTTP_HOST']);
    # if the url = [subdomain].plusjade.org
    if (in_array(ROOTNAME, $domain_array)) {
        $field_name = 'subdomain';
        $site_name = $domain_array['0'];
        # if no subdomain, set the site_name to the admin account
        if ('2' == count($domain_array)) {
            $site_name = ROOTACCOUNT;
        }
    } else {
        $field_name = 'custom_domain';
        $site_name = $_SERVER['HTTP_HOST'];
    }
    $site = ORM::factory('site')->where(array($field_name => $site_name))->find();
    if (!$site->loaded) {
        header("HTTP/1.0 404 Not Found");
        die('site does not exist');
    }
    # IMPORTANT: sets the site name & non-sensitive site_data.
    $_SESSION['site_name'] = $site->subdomain;
    # Make sure site_config file exists
    # the site_config file is parsed in the root Controller_Core library file.
    $site_config_path = DATAPATH . "{$site->subdomain}/protected/site_config.yml";
    if (!file_exists($site_config_path)) {
        $replacements = array($site->id, $site->subdomain, $site->theme, $site->banner, $site->homepage);
        yaml::new_site_config($site_name, $replacements);
    }
    /*
    --- Route the URL ---
    ---------------------
    * The URL will tell us how to build the page.
        a. is /get/
        b. is file request     
        c. is ajax request
        d. is page_name
           is protected page?
    */
    # Get page_name
    $url_array = URI::url_array();
    $page_name = empty($url_array['0']) ? $site->homepage : $url_array['0'];
    # app/config/routes.php routes the url correctly.
    if ('get' == $page_name) {
        return FALSE;
    }
    if ('files' == $page_name) {
        $file = new Files_Controller();
        die($file->_output($url_array));
    }
    # Is page_name protected?
    $page_config_value = yaml::does_key_exist($site->subdomain, 'pages_config', $page_name);
    # Is protected ajax request?
    # get info from pages_config.yaml
    if ($page_config_value and request::is_ajax()) {
        # extract toolname and parent_id from pages_config.yaml
        $page_data = explode('-', $page_config_value);
        list($toolname, $parent_id) = $page_data;
        # make sure the page_name is correct.
        $url_array['0'] = $page_name;
        # send to tool _ajax handler. we expect raw data output.
        die(Load_Tool::factory($toolname)->_ajax($url_array, $parent_id));
    } elseif (isset($_POST['post_handler']) and request::is_ajax()) {
        # currently only enabled for format  form type.
        list($toolname, $parent_id) = explode(':', $_POST['post_handler']);
        die(Load_Tool::factory($toolname)->_ajax($url_array, $parent_id));
    }
    # Non-protected page_names can be a subdirectory name.
    # do this only if an actual url string is being sent.
    # so we need to get the full url string.
    if (!empty($url_array['1']) and !$page_config_value) {
        $page_name = strstr($_SERVER['REQUEST_URI'], '/');
        $page_name = ltrim($page_name, '/');
    }
    $page = ORM::factory('page')->where(array('fk_site' => $site->id, 'page_name' => $page_name))->find();
    if (!$page->loaded) {
        Event::run('system.404');
    }
    # Load the page!
    $build_page = new Build_Page_Controller();
    die($build_page->_index($page));
}
开发者ID:plusjade,项目名称:plusjade,代码行数:83,代码来源:get_site.php


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