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


PHP Q_Request::url方法代码示例

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


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

示例1: Q_notFound

/**
 * Default Q/notFound handler.
 * Just displays Q/notFound.php view.
 */
function Q_notFound($params)
{
    header("HTTP/1.0 404 Not Found");
    Q_Dispatcher::result("Nothing found");
    $url = Q_Request::url();
    echo Q::view('Q/notFound.php', compact('url'));
}
开发者ID:dmitriz,项目名称:Platform,代码行数:11,代码来源:notFound.php

示例2: MyApp_notFound_response_content

function MyApp_notFound_response_content($params)
{
    header("HTTP/1.0 404 Not Found");
    $url = Q_Request::url();
    if (Q_Request::isAjax()) {
        throw new Q_Exception_NotFound(compact('url'));
    }
    return Q::view("MyApp/content/notFound.php", compact('url'));
}
开发者ID:dmitriz,项目名称:Platform,代码行数:9,代码来源:content.php

示例3: Q_before_Q_responseExtras

/**
 * This is the default handler for the Q/responseExtras event.
 * It should not be invoked during AJAX requests, and especially
 * not during JSONP requests. It will output things like the nonce,
 * which prevents CSRF attacks, but is only supposed to be printed
 * on our webpages and not also given to anyone who does a JSONP request.
 */
function Q_before_Q_responseExtras()
{
    $app = Q_Config::expect('Q', 'app');
    $uri = Q_Dispatcher::uri();
    $url = Q_Request::url(true);
    $base_url = Q_Request::baseUrl();
    $ajax = Q_Request::isAjax();
    if (!$uri) {
        return;
    }
    $info = array('url' => $url, 'uriString' => (string) $uri);
    if ($uri) {
        $info['uri'] = $uri->toArray();
    }
    if (!$ajax) {
        $info = array_merge(array('app' => Q_Config::expect('Q', 'app')), $info, array('proxies' => Q_Config::get('Q', 'proxies', array()), 'baseUrl' => $base_url, 'proxyBaseUrl' => Q_Uri::url($base_url), 'proxyUrl' => Q_Uri::url($url), 'sessionName' => Q_Session::name(), 'nodeUrl' => Q_Utils::nodeUrl(), 'slotNames' => Q_Config::get("Q", "response", "slotNames", array('content', 'dashboard', 'title', 'notices'))));
    }
    foreach ($info as $k => $v) {
        Q_Response::setScriptData("Q.info.{$k}", $v);
    }
    if (!$ajax) {
        $uris = Q_Config::get('Q', 'javascript', 'uris', array());
        $urls = array();
        foreach ($uris as $u) {
            $urls["{$u}"] = Q_Uri::url("{$u}");
        }
        Q_Response::setScriptData('Q.urls', $urls);
    }
    // Export more variables to inline js
    $nonce = isset($_SESSION['Q']['nonce']) ? $_SESSION['Q']['nonce'] : null;
    if ($nonce) {
        Q_Response::setScriptData('Q.nonce', $nonce);
    }
    // Attach stylesheets and scripts
    foreach (Q_Config::get('Q', 'javascript', 'responseExtras', array()) as $src => $b) {
        if (!$b) {
            continue;
        }
        Q_Response::addScript($src);
    }
    foreach (Q_Config::get('Q', 'stylesheets', 'responseExtras', array()) as $src => $media) {
        if (!$media) {
            continue;
        }
        if ($media === true) {
            $media = 'screen,print';
        }
        Q_Response::addStylesheet($src, null, $media);
    }
}
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:57,代码来源:responseExtras.php

示例4: Users_identifier_tool

function Users_identifier_tool($options)
{
    $defaults = array('uri' => 'Users/identifier', 'omit' => array(), 'fields' => array(), 'title' => "Contact Info", 'collapsed' => false, 'toggle' => false, 'editing' => true, 'complete' => true, 'inProcess' => false, 'prompt' => "In order for things to work, we must be able to reach you.", 'button_content' => 'OK');
    extract(array_merge($defaults, $options));
    $default_fields = array('emailAddress' => array('type' => 'text', 'label' => 'Email'));
    $fields = array_merge($default_fields, $fields);
    $user = Users::loggedInUser(true);
    $email = null;
    if (isset($user->emailAddress)) {
        $fields['emailAddress']['value'] = $user->emailAddress;
    } else {
        if ($user->emailAddressPending) {
            $link = Q_Html::a('#resend', array('class' => 'Users_idenfitier_tool_resend'), "You can re-send the activation email");
            $email = new Users_Email();
            $email->address = $user->emailAddressPending;
            if ($email->retrieve()) {
                switch ($email->state) {
                    case 'active':
                        if ($email->userId == $user->id) {
                            $message = "Please confirm this email address.<br>{$link}";
                        } else {
                            $message = "This email seems to belong to another user";
                        }
                        break;
                    case 'suspended':
                        $message = "This address has been suspended.";
                        break;
                    case 'unsubscribed':
                        $message = "The owner of this address has unsubscribed";
                        break;
                    case 'unverified':
                    default:
                        $message = "Not verified yet.<br>{$link}";
                        break;
                }
                $fields['emailAddress']['value'] = $email->address;
                $fields['emailAddress']['message'] = $message;
            } else {
                // something went wrong, so we'll try to correct it
                $user->emailAddressPending = "";
                $user->save();
            }
        }
    }
    $onSuccess = Q_Request::special('onSuccess', Q_Request::url());
    $form = $static = compact('fields');
    return Q::tool('Q/panel', compact('uri', 'onSuccess', 'form', 'static', 'title', 'collapsed', 'toggle', 'complete', 'editing', 'inProcess', 'setSlots'));
}
开发者ID:dmitriz,项目名称:Platform,代码行数:48,代码来源:tool.php

示例5: Users_account_tool

function Users_account_tool($options)
{
    $uri = 'Users/account';
    $omit = array();
    $fields = array();
    $title = "Basic Info";
    $editing = true;
    $complete = true;
    $inProcess = false;
    $collapsed = false;
    $toggle = false;
    $omit = array();
    $setSlots = null;
    extract($options, EXTR_OVERWRITE);
    $default_fields = array('username' => array('type' => 'text', 'label' => 'Choose Username'), 'gender' => array('type' => 'select', 'label' => 'I am', 'options' => array('male' => 'a man', 'female' => 'a woman')), 'orientation' => array('type' => 'select', 'label' => 'Orientation', 'options' => array('straight' => 'straight', 'gay' => 'gay', 'bi' => 'bi')), 'relationship_status' => array('type' => 'select', 'label' => 'Status', 'options' => array('single' => "I'm single", 'open' => "I'm in an open relationship", 'relationship' => "I'm in a relationship", 'engaged' => "I'm engaged", 'married' => "I'm married", 'complicated' => "It's complicated", 'widowed' => "I'm widowed")), 'birthday' => array('type' => 'date', 'label' => 'My Birthday', 'options' => array('year_from' => '1920', 'year_to' => date('Y') - 16)), 'zipcode' => array('type' => 'text', 'label' => 'Zipcode', 'attributes' => array('maxlength' => 5)));
    $fields = array_merge($default_fields, $fields);
    $user = Users::loggedInUser(true);
    if (isset($user->gender)) {
        $fields['gender']['value'] = $user->gender;
    }
    if (isset($user->desired_gender)) {
        if ($user->desired_gender == 'either') {
            $fields['orientation']['value'] = 'bi';
        } else {
            if (isset($user->gender)) {
                $fields['orientation']['value'] = $user->gender != $user->desired_gender ? 'straight' : 'gay';
            }
        }
    }
    if (isset($user->relationship_status)) {
        $fields['relationship_status']['value'] = $user->relationship_status;
    }
    if (isset($user->birthday)) {
        $fields['birthday']['value'] = date("Y-m-d", Users::db()->fromDate($user->birthday));
    }
    if (isset($user->zipcode)) {
        $fields['zipcode']['value'] = $user->zipcode;
    }
    if (isset($user->username)) {
        $fields['username']['value'] = $user->username;
    }
    foreach ($omit as $v) {
        unset($fields[$v]);
    }
    $onSuccess = Q_Request::special('onSuccess', Q_Request::url());
    $form = $static = compact('fields');
    return Q::tool('Q/panel', compact('uri', 'title', 'form', 'static', 'onSuccess', 'complete', 'collapsed', 'toggle', 'editing', 'inProcess', 'static', 'setSlots'));
}
开发者ID:dmitriz,项目名称:Platform,代码行数:48,代码来源:tool.php

示例6: Q_response_content

function Q_response_content()
{
    $app = Q_Config::expect('Q', 'app');
    $url = Q_Request::url();
    $module = Q_Dispatcher::uri()->module;
    if (empty($module)) {
        return Q::event("{$app}/notFound/response/content");
    }
    $action = Q_Dispatcher::uri()->action;
    $event = "{$module}/{$action}/response/content";
    if (!Q::canHandle($event)) {
        return Q::event("{$app}/notFound/response/content");
    }
    // Go ahead and fire the event, returning the result.
    return Q::event($event);
}
开发者ID:dmitriz,项目名称:Platform,代码行数:16,代码来源:content.php

示例7: execute

 /**
  * Excecute web request
  * @method execute
  * @static
  */
 static function execute()
 {
     // Fixes for different platforms:
     if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
         // ISAPI 3.0
         $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
     }
     // Get the base URL
     $base_url = Q_Request::baseUrl();
     if (Q::$controller === 'Q_ActionController') {
         // we detected action.php in the URL, but
         // a misconfigured web server executed index.php instead
         return Q_ActionController::execute();
     }
     // Set the controller that is being used
     if (!isset(Q::$controller)) {
         Q::$controller = 'Q_WebController';
     }
     try {
         $slots = Q_Request::slotNames(false);
         $slots = $slots ? ' slots: (' . implode(',', $slots) . ') from' : '';
         $method = Q_Request::method();
         Q::log("{$method}{$slots} url: " . Q_Request::url(true), null, null, array('maxLength' => 10000));
         Q_Dispatcher::dispatch();
         $dispatchResult = Q_Dispatcher::result();
         if (!isset($dispatchResult)) {
             $dispatchResult = 'Ran dispatcher';
         }
         $uri = Q_Request::uri();
         $module = $uri->module;
         $action = $uri->action;
         if ($module and $action) {
             $slotNames = Q_Request::slotNames();
             $returned_slots = empty($slotNames) ? '' : implode(',', $slotNames);
             Q::log("~" . ceil(Q::milliseconds()) . 'ms+' . ceil(memory_get_peak_usage() / 1000) . 'kb.' . " {$dispatchResult} for {$module}/{$action}" . " ({$returned_slots})", null, null, array('maxLength' => 10000));
         } else {
             Q::log("~" . ceil(Q::milliseconds()) . 'ms+' . ceil(memory_get_peak_usage() / 1000) . 'kb.' . " {$dispatchResult} No route for " . $_SERVER['REQUEST_URI'], null, null, array('maxLength' => 10000));
         }
     } catch (Exception $exception) {
         /**
          * @event Q/exception
          * @param {Exception} exception
          */
         Q::event('Q/exception', compact('exception'));
     }
 }
开发者ID:dmitriz,项目名称:Platform,代码行数:51,代码来源:WebController.php

示例8: Q_response_content

function Q_response_content()
{
    $app = Q_Config::expect('Q', 'app');
    $url = Q_Request::url();
    $module = Q_Dispatcher::uri()->module;
    if (empty($module)) {
        return Q::event("{$app}/notFound/response/content");
    }
    $action = Q_Dispatcher::uri()->action;
    $event = "{$module}/{$action}/response/content";
    if (!Q::canHandle($event)) {
        return Q::event("{$app}/notFound/response/content");
    }
    Q_Response::setMeta('format-detection', 'telephone=no,date=no,address=no,email=no,url=no');
    // Go ahead and fire the event, returning the result.
    return Q::event($event);
}
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:17,代码来源:content.php

示例9: Users_importContacts_tool

/**
 * Renders an import tool
 * @param $options
 *   An associative array of parameters, which can include:
 *   "provider" => Required. The provider from which we are importing.
 * @return {string}
 */
function Users_importContacts_tool($options)
{
    $provider = $options['provider'];
    ob_start();
    try {
        if (!($client = Users::oAuth($provider))) {
            throw new Users_Exception_NotAuthorized();
        }
        Q::event('Users/importContacts/providers/' . $provider, array('client' => $client));
    } catch (Users_Exception_OAuthTokenInvalid $ex) {
        #TODO: Log something to error log?
        Users::oAuthClear($provider);
        Q_Response::redirect(Q_Uri::url(Q_Request::url(true)));
        return false;
    } catch (Zend_Oauth_Exception $ex) {
        #TODO: Show a nicely-formatted message and close the pop-up
        echo 'Could not import contacts: ' . $ex->getMessage();
    }
    $out = ob_get_contents();
    ob_clean();
    Q_Response::output($out, true);
    return true;
}
开发者ID:dmitriz,项目名称:Platform,代码行数:30,代码来源:tool.php

示例10: redirect

 /**
  * Sets a header to redirect to a given URI or URL.
  * @method redirect
  * @static
  * @param {string} $uri The URL or internal URI to redirect to
  * @param {array} $options An array of options that can include:
  *  "loop" => Defaults to false. If true, sets the redirect header even if the current URL is the same.
  *  "noProxy" => Defaults to false. If true, doesn't use the proxy mapping to determine URL
  *  "permanently" => If true, sets response code as 304 instead of 302
  * @param {boolean} [$noProxy=false]
  * @return {boolean}
  *  Return whether the redirect header was set.
  */
 static function redirect($uri, $options = array())
 {
     extract($options);
     $url = Q_Uri::url($uri, null, !empty($noProxy));
     if ($url === Q_Uri::unreachableUri()) {
         throw new Q_Exception_BadValue(array('internal' => 'uri', 'problem' => 'no url routes to it'));
     }
     $level = ob_get_level();
     for ($i = 0; $i < $level; ++$i) {
         ob_clean();
     }
     /**
      * @event Q/response {before}
      * @param {string} permanently
      * @param {string} uri
      * @param {string} url
      * @param {string} loop
      * @return {boolean}
      */
     $result = Q::event('Q/redirect', compact('uri', 'url', 'loop', 'permanently', 'noProxy', 'level'), 'before');
     if (isset($result)) {
         return $result;
     }
     if (!empty($loop) and Q_Request::url() === $url) {
         return false;
     }
     if (!Q_Request::isAjax()) {
         if (!empty($permanently)) {
             header("HTTP/1.1 301 Moved Permanently");
         }
         header("Location: {$url}");
     }
     self::$redirected = $uri;
     return true;
 }
开发者ID:dmitriz,项目名称:Platform,代码行数:48,代码来源:Response.php

示例11: First_errors_response_content

function First_errors_response_content($params)
{
    header('HTTP/1.0 503 Server Encountered Error');
    $url = Q_Request::url();
    return Q::view('First/content/errors.php', compact('url'));
}
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:6,代码来源:content.php

示例12: array

	<tr>
		<td><?php 
    echo $rule->ordinal;
    ?>
</td>
		<td><?php 
    echo $rule->filter;
    ?>
</td>
		<td><?php 
    echo $rule->deliver;
    ?>
</td>
		<td><?php 
    echo $rule->readyTime;
    ?>
</td>
		<td><?php 
    echo Q_Html::a(Q_Request::url(array('rules' => true, 'ordinal' => $rule->ordinal)), array(), 'edit');
    ?>
</td>
		<td><?php 
    echo Q_Html::a(Q_Request::url(array('rules' => true, 'ordinal' => $rule->ordinal, 'delete' => true)), array(), 'delete');
    ?>
</td>
	</tr>
	<?php 
}
?>
</table>
开发者ID:dmitriz,项目名称:Platform,代码行数:30,代码来源:rules.php

示例13: Q_tabs_tool

/**
 * This tool renders tabs which behave appropriately in many different environments
 * @class Q tabs
 * @constructor
 * @param {array} [$options] options to pass to the tool
 *  @param {array} [$options.tabs] An associative array of name: title pairs.
 *  @param {array} [$options.urls] An associative array of name: url pairs to override the default urls.
 *  @param {string} [$options.field='tab'] Uses this field when urls doesn't contain the tab name.
 *  @param {boolean} [options.checkQueryString=false] Whether the default getCurrentTab should check the querystring when determining the current tab
 *  @param {boolean} [$options.vertical=false] Stack the tabs vertically instead of horizontally
 *  @param {boolean} [$options.compact=false] Display the tabs interface in a compact space with a contextual menu
 *  @param {Object} [$options.overflow]
 *  @param {String} [$options.overflow.content] The html that is displayed when the tabs overflow. You can interpolate {{count}}, {{text}} or {{html}} in the string. 
 *  @param {String} [$options.overflow.glyph] Override the glyph that appears next to the overflow text. You can interpolate {{count}} here
 *  @param {String} [$options.overflow.defaultText] The text to interpolate {{text}} in the content when no tab is selected
 *  @param {String} [$options.overflow.defaultHtml] The text to interpolate {{text}} in the content when no tab is selected
 *  @param {string} [$options.defaultTabName] Here you can specify the name of the tab to show by default
 *  @param {string} [$options.selectors] Array of (slotName => selector) pairs, where the values are CSS style selectors indicating the element to update with javascript, and can be a parent of the tabs. Set to null to reload the page.
 *  @param {string} [$options.slot] The name of the slot to request when changing tabs with javascript.
 *  @param {string} [$options.classes] An associative array of the form name => classes, for adding classes to tabs
 *  @param {string} [$options.titleClasses]  An associative array for adding classes to tab titles
 *  @param {string} [$options.after] Name of an event that will return HTML to place after the generated HTML in the tabs tool element
 *  @param {string} [$options.loader] Name of a function which takes url, slot, callback. It should call the callback and pass it an object with the response info. Can be used to implement caching, etc. instead of the default HTTP request. This function shall be Q.batcher getter
 *  @param {string} [$options.onClick] Event when a tab was clicked, with arguments (name, element). Returning false cancels the tab switching.
 *  @param {string} [$options.beforeSwitch] Event when tab switching begins. Returning false cancels the switching.
 *  @param {string} [$options.beforeScripts] Name of the function to execute after tab is loaded but before its javascript is executed.
 *  @param {string} [$options.onCurrent] Name of the function to execute after a tab is shown to be selected.
 *  @param {string} [$options.onActivate] Name of the function to execute after a tab is activated.
 */
function Q_tabs_tool($options)
{
    $field = 'tab';
    $slot = 'content,title';
    $selectors = array('content' => '#content_slot');
    $urls = array();
    extract($options);
    if (!isset($tabs)) {
        return '';
    }
    if (isset($overflow) and is_string($overflow)) {
        $overflow = array('content' => $overflow);
    }
    /**
     * @var array $tabs
     * @var boolean $vertical
     * @var boolean $compact
     */
    $sel = isset($_REQUEST[$field]) ? $_REQUEST[$field] : null;
    $result = '';
    $i = 0;
    $selectedName = null;
    $uri_string = (string) Q_Dispatcher::uri();
    foreach ($tabs as $name => $title) {
        if ($name === $sel or $name === $uri_string or $urls[$name] === $uri_string or $urls[$name] === Q_Request::url()) {
            $selectedName = $name;
            break;
        }
    }
    foreach ($tabs as $name => $title) {
        if (isset($urls[$name])) {
            $urls[$name] = Q_Uri::url($urls[$name]);
        } else {
            $urls[$name] = Q_Uri::url(Q_Request::url(array($field => $name, "/Q\\.(.*)/" => null)));
        }
        $selected_class = $name === $selectedName ? ' Q_current' : '';
        $classes_string = " Q_tab_" . Q_Utils::normalize($name);
        if (isset($classes[$name])) {
            if (is_string($classes[$name])) {
                $classes_string .= ' ' . $classes[$name];
            } else {
                if (is_array($classes[$name])) {
                    $classes_string .= ' ' . implode(' ', $classes[$name]);
                }
            }
        }
        $titleClasses_string = '';
        if (isset($titleClasses[$name])) {
            if (is_string($titleClasses[$name])) {
                $titleClasses_string = $titleClasses[$name];
            } else {
                if (is_array($titleClasses[$name])) {
                    $titleClasses_string = implode(' ', $titleClasses[$name]);
                }
            }
        }
        $title_container = Q_Html::div(null, "Q_tabs_title {$titleClasses_string}", isset($title) ? $title : $name);
        $result .= Q_Html::tag('li', array('id' => 'tab_' . ++$i, 'class' => "Q_tabs_tab {$classes_string}{$selected_class}", 'data-name' => $name), Q_Html::a($urls[$name], $title_container));
    }
    Q_Response::setToolOptions(compact('selectors', 'slot', 'urls', 'defaultTabName', 'vertical', 'compact', 'overflow', 'field', 'loader', 'beforeSwitch', 'beforeScripts', 'onActivate'));
    Q_Response::addScript('plugins/Q/js/tools/tabs.js');
    Q_Response::addStylesheet('plugins/Q/css/tabs.css');
    $classes = empty($vertical) ? ' Q_tabs_horizontal' : ' Q_tabs_vertical';
    if (!empty($compact)) {
        $classes .= " Q_tabs_compact";
    }
    $after = isset($options['after']) ? Q::event($options['after'], $options) : '';
    return "<ul class='Q_tabs_tabs Q_clearfix{$classes}'>{$result}{$after}</ul>";
}
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:98,代码来源:tool.php

示例14: Q_noModule

/**
 * Default Q/noModule handler.
 * Just displays Q/notFound.php view.
 */
function Q_noModule($params)
{
    header("HTTP/1.0 404 Not Found");
    $url = Q_Request::url();
    echo Q::view('Q/notFound.php', compact('url'));
}
开发者ID:dmitriz,项目名称:Platform,代码行数:10,代码来源:noModule.php

示例15: filename

 /**
  * @method filename
  * @beta
  * @static
  * @return {string}
  */
 static function filename()
 {
     $url = Q_Request::url();
     $ret = Q::event("Q/Request/filename", compact('url'), 'before');
     if (isset($ret)) {
         return $ret;
     }
     $parts = explode('.', $url);
     $ext = end($parts);
     $intercept = true;
     switch ($ext) {
         case 'png':
         case 'jpeg':
         case 'gif':
         case 'jpg':
         case 'pdf':
         case 'js':
         case 'ogg':
         case 'mp3':
         case 'css':
         case 'cur':
             break;
         default:
             $intercept = false;
             break;
     }
     return $intercept ? Q_PLUGIN_WEB_DIR . DS . 'img' . DS . '404' . DS . "404.{$ext}" : null;
 }
开发者ID:dmitriz,项目名称:Platform,代码行数:34,代码来源:Request.php


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