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


PHP Url::base方法代码示例

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


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

示例1: before

 public function before()
 {
     $fullBaseUrl = Url::base(true);
     //was user on our site?
     if (strpos($this->request->referrer(), $fullBaseUrl) === 0) {
         //now check that a controller set, it wasn't the user controller, and that the session var "noReturn" is not false
         $uri = parse_url($this->request->referrer(), PHP_URL_PATH);
         // correct the path for url_base and index_file, in part taken from Kohana_Request::detect_uri()
         // Get the path from the base URL, including the index file
         $base_url = parse_url(Kohana::$base_url, PHP_URL_PATH);
         if (strpos($uri, $base_url) === 0) {
             // Remove the base URL from the URI
             $uri = (string) substr($uri, strlen($base_url));
         }
         if (Kohana::$index_file and strpos($uri, Kohana::$index_file) === 0) {
             // Remove the index file from the URI
             $uri = (string) substr($uri, strlen(Kohana::$index_file));
         }
         $processedRef = Request::process_uri($uri);
         $referrerController = Arr::path($processedRef, 'params.controller', false);
         if ($referrerController && $referrerController != 'user' && !Session::instance()->get('noReturn', false)) {
             Session::instance()->set('returnUrl', $this->request->referrer());
         }
     }
     parent::before();
 }
开发者ID:rafsoaken,项目名称:useradmin,代码行数:26,代码来源:user.php

示例2: instance

 /**
  * Main request singleton instance. If no URI is provided, the URI will
  * be automatically detected using PATH_INFO, REQUEST_URI, or PHP_SELF.
  *
  * @param   string   URI of the request
  * @return  Request
  */
 public static function instance(&$uri = TRUE)
 {
     $instance = parent::instance($uri);
     $index_page = Kohana::$index_file;
     $lang_uri_abbr = Kohana::config('appconf.lang_uri_abbr');
     $default_lang = Kohana::config('appconf.language_abbr');
     $lang_ignore = Kohana::config('appconf.lang_ignore');
     /* get the lang_abbr from uri segments */
     $segments = explode('/', $instance->uri);
     $lang_abbr = isset($segments[0]) ? $segments[0] : '';
     /* get current language */
     $cur_lang = $instance->param('lang', $default_lang);
     /* check for invalid abbreviation */
     if (!isset($lang_uri_abbr[$lang_abbr])) {
         /* check for abbreviation to be ignored */
         if ($cur_lang != $lang_ignore) {
             /* check and set the default uri identifier */
             $index_page .= empty($index_page) ? $default_lang : "/{$default_lang}";
             /* redirect after inserting language id */
             header('Location: ' . Url::base() . $index_page . '/' . $instance->uri);
             die;
         }
     }
     return $instance;
 }
开发者ID:hotosm,项目名称:Portal-ID,代码行数:32,代码来源:request.php

示例3: to

 /**
  *This method redirect to the specified page
  *
  *@param string $path The path to redirect to 
  *@param mixed $data The data with which to do redirect
  */
 public static function to($path, $data = null)
 {
     //compose full url
     $path = Url::base($path);
     //redirect to path
     header('Location: ' . $path);
     //stop any further html output
     exit;
 }
开发者ID:joycekenya,项目名称:gliver,代码行数:15,代码来源:Redirect.php

示例4: remove_file

 private function remove_file($file)
 {
     if (file_exists($file)) {
         $system_cmd = "rm {$file}";
         system($system_cmd, $return_code);
         if ($return_code != 0) {
             echo 'Error when running command &lt;' . $system_cmd . '&gt;: ' . $return_code . '<br><a href="' . Url::base() . '">&laquo; Back</a>';
             exit;
         }
     }
 }
开发者ID:peetucket,项目名称:ImpactProbe,代码行数:11,代码来源:params.php

示例5: before

 public function before()
 {
     $baseUrl = Url::base(true);
     if (substr($this->request->referrer(), 0, strlen($baseUrl)) == $baseUrl) {
         $urlPath = ltrim(parse_url($this->request->referrer(), PHP_URL_PATH), '/');
         $processedRef = Request::process_uri($urlPath);
         $referrerController = Arr::path($processedRef, 'params.controller', false);
         if ($referrerController && $referrerController != 'user' && !Session::instance()->get('noReturn', false)) {
             Session::instance()->set('returnUrl', $this->request->referrer());
         }
     }
     parent::before();
 }
开发者ID:Thanandar,项目名称:GiftCircle,代码行数:13,代码来源:user.php

示例6: action_config

 public function action_config()
 {
     $max_size = strtolower(trim(ini_get('upload_max_filesize')));
     $max_size = preg_replace('/([kmg])b/i', '$1', $max_size);
     $sizer = substr($max_size, -1);
     $max_size = (int) $max_size;
     switch ($sizer) {
         case 'g':
             $max_size *= 1024;
         case 'm':
             $max_size *= 1024;
         case 'k':
             $max_size *= 1024;
     }
     $config = array('url' => Url::base(TRUE, TRUE) . Route::get('torn/upload')->uri(), 'cancel' => Url::base(TRUE, TRUE) . Route::get('torn/cancel')->uri(array('hash' => '--hash--')), 'swf' => Url::site('torn/media/TUploader.swf'), 'max_size' => $max_size, 'filters' => array(__('All files') => '*.*'), 'messages' => array('file_is_too_big' => __('File is too big'), 'config_error' => __('Torn Uploader: IO error (config)'), 'io_error' => __('The file could not be uploaded'), 'select_file' => __('Select file'), 'confirm' => __('Are you sure?'), 'cancel' => __('Cancel'), 'error' => __('Error'), 'done' => __('Done')));
     $this->request->response = json_encode($config);
 }
开发者ID:TdroL,项目名称:kohana-jelly-torn,代码行数:17,代码来源:torn.php

示例7: slideshow_image_path

 public static function slideshow_image_path($slideshow, $number, $size)
 {
     $image = null;
     foreach ($slideshow as $slideshow_image) {
         if ($slideshow_image->number == $number) {
             $image = $slideshow_image;
             break;
         }
     }
     if (isset($image)) {
         if (!empty($image->image_path)) {
             return $image->image_path . '/' . $size . '.png' . '?random=' . Str::random(10) . time();
         } else {
             return Url::base() . '/uploads/placeholder/' . $size . '.png' . '?random=' . Str::random(10) . time();
         }
     } else {
         return Url::base() . '/uploads/placeholder/' . $size . '.png' . '?random=' . Str::random(10) . time();
     }
 }
开发者ID:jvillasante,项目名称:cubanartjb,代码行数:19,代码来源:html_helpers.php

示例8: bbcode2email

 public function bbcode2email($text, $wrap_length = 72)
 {
     static $base_url;
     if (!isset($base_url)) {
         $base_url = Url::base();
     }
     $text = Utils::trim($text, "\t\n ");
     $shortcut_urls = array('topic' => '/topic/$1/', 'post' => '/post/$1/#p$1', 'forum' => '/forum/$1/', 'user' => '/user/$1/');
     // Split code blocks and text so BBcode in codeblocks won't be touched
     list($code, $text) = $this->extract_blocks($text, '[code]', '[/code]');
     // Strip all bbcodes, except the quote, url, img, email, code and list items bbcodes
     $text = preg_replace(array('%\\[/?(?!(?:quote|url|topic|post|user|forum|img|email|code|list|\\*))[a-z]+(?:=[^\\]]+)?\\]%i', '%\\n\\[/?list(?:=[^\\]]+)?\\]%i'), '', $text);
     // Match the deepest nested bbcode
     // An adapted example from Mastering Regular Expressions
     $match_quote_regex = '%
         \\[(quote|\\*|url|img|email|topic|post|user|forum)(?:=([^\\]]+))?\\]
         (
             (?>[^\\[]*)
             (?>
                 (?!\\[/?\\1(?:=[^\\]]+)?\\])
                 \\[
                 [^\\[]*
             )*
         )
         \\[/\\1\\]
     %ix';
     $url_index = 1;
     $url_stack = array();
     while (preg_match($match_quote_regex, $text, $matches)) {
         // Quotes
         if ($matches[1] == 'quote') {
             // Put '>' or '> ' at the start of a line
             $replacement = preg_replace(array('%^(?=\\>)%m', '%^(?!\\>)%m'), array('>', '> '), $matches[2] . " said:\n" . $matches[3]);
         } elseif ($matches[1] == '*') {
             $replacement = ' * ' . $matches[3];
         } elseif (in_array($matches[1], array('url', 'email'))) {
             if (!empty($matches[2])) {
                 $replacement = '[' . $matches[3] . '][' . $url_index . ']';
                 $url_stack[$url_index] = $matches[2];
                 $url_index++;
             } else {
                 $replacement = '[' . $matches[3] . ']';
             }
         } elseif ($matches[1] == 'img') {
             if (!empty($matches[2])) {
                 $replacement = '[' . $matches[2] . '][' . $url_index . ']';
             } else {
                 $replacement = '[' . basename($matches[3]) . '][' . $url_index . ']';
             }
             $url_stack[$url_index] = $matches[3];
             $url_index++;
         } elseif (in_array($matches[1], array('topic', 'post', 'forum', 'user'))) {
             $url = isset($shortcut_urls[$matches[1]]) ? $base_url . $shortcut_urls[$matches[1]] : '';
             if (!empty($matches[2])) {
                 $replacement = '[' . $matches[3] . '][' . $url_index . ']';
                 $url_stack[$url_index] = str_replace('$1', $matches[2], $url);
                 $url_index++;
             } else {
                 $replacement = '[' . str_replace('$1', $matches[3], $url) . ']';
             }
         }
         // Update the main text if there is a replacement
         if (!is_null($replacement)) {
             $text = str_replace($matches[0], $replacement, $text);
             $replacement = null;
         }
     }
     // Put code blocks and text together
     if (isset($code)) {
         $parts = explode("", $text);
         $text = '';
         foreach ($parts as $i => $part) {
             $text .= $part;
             if (isset($code[$i])) {
                 $text .= trim($code[$i], "\n\r");
             }
         }
     }
     // Put URLs at the bottom
     if ($url_stack) {
         $text .= "\n\n";
         foreach ($url_stack as $i => $url) {
             $text .= "\n" . ' [' . $i . ']: ' . $url;
         }
     }
     // Wrap lines if $wrap_length is higher than -1
     if ($wrap_length > -1) {
         // Split all lines and wrap them individually
         $parts = explode("\n", $text);
         foreach ($parts as $k => $part) {
             preg_match('%^(>+ )?(.*)%', $part, $matches);
             $parts[$k] = wordwrap($matches[1] . $matches[2], $wrap_length - strlen($matches[1]), "\n" . $matches[1]);
         }
         return implode("\n", $parts);
     } else {
         return $text;
     }
 }
开发者ID:bohwaz,项目名称:featherbb,代码行数:98,代码来源:Email.php

示例9: clusters

>scatter clusters</option>
   <option value="cluster_size"<?php 
if ($cluster_log['order'] == 'cluster_size') {
    echo " selected";
}
?>
>order by cluster size</option>
</select>
<input type="submit" id="submit_btn" name="submit_btn" value="Recluster">
</p>
</form>

<?php 
echo $chart_html;
?>

<?php 
if ($singleton_clusters > 0) {
    ?>
<p>[<a href="javascript:startLyteframe('Singleton clusters (<?php 
    echo $singleton_clusters;
    ?>
 total)', '<?php 
    echo Url::base() . 'index.php/results/singleton_clusters/' . $project_data['project_id'];
    ?>
')">view singleton clusters (<?php 
    echo $singleton_clusters;
    ?>
)</a>]</p>
<?php 
}
开发者ID:peetucket,项目名称:ImpactProbe,代码行数:31,代码来源:cluster_view.php

示例10: date

            if ($result['date_published'] > 0) {
                echo date($date_format, $result['date_published']);
            }
            ?>
</td>
            <td align="center"><?php 
            echo date($date_format, $result['date_retrieved']);
            ?>
</td>
            <td align="left">
            <?php 
            foreach ($result['keywords_phrases'] as $keyword_phrase) {
                echo $keyword_phrase['keyword'] . ": " . $keyword_phrase['num_occurrences'] . "<br>";
            }
            ?>
            </td>
            <td align="center"><?php 
            echo '[<a href="' . $result['url'] . '" target="_blank">url</a>] [<a href="' . Url::base() . 'index.php/results/view_document/' . $project_data['project_id'] . '?meta_id=' . $result['meta_id'] . '" rel="lyteframe" title="Viewing raw text" rev="width: 500px; height: 400px; scrolling: yes;">text</a>]';
            ?>
</td>
        </tr>
        <?php 
            $i++;
        }
    }
    ?>
</table></p>
<?php 
} else {
    echo "<p>No results to display</p>";
}
开发者ID:peetucket,项目名称:ImpactProbe,代码行数:31,代码来源:results_basic.php

示例11: image

 /**
  * Create image
  *
  *	<code>
  *  	echo Html::image('data/files/pic1.jpg');
  * 	</code>
  *
  * @param array  $attributes Image attributes
  * @param string $file       File
  * @uses  Url::base
  * @return string
  */
 public static function image($file, array $attributes = null)
 {
     if (strpos($file, '://') === FALSE) {
         $file = Url::base() . '/' . $file;
     }
     // Add the image link
     $attributes['src'] = $file;
     $attributes['alt'] = isset($attributes['alt']) ? $attributes['alt'] : pathinfo($file, PATHINFO_FILENAME);
     return '<img' . Html::attributes($attributes) . '>';
 }
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:22,代码来源:Html.php

示例12: populate

 private static function populate()
 {
     self::$populated = true;
     self::$base = Config::get('other:baseUrl');
     self::$static = Config::get('other:staticUrl');
 }
开发者ID:Bren2010,项目名称:BlueElephant,代码行数:6,代码来源:url.php

示例13:

        echo Url::base(TRUE) . 'gather/log/' . $project['project_id'];
        ?>
">log</a>] [<a href="<?php 
        echo Url::base(TRUE) . 'params/modify/' . $project['project_id'];
        ?>
">params</a>]  [<a href="<?php 
        echo Url::base(TRUE) . 'home/project_change_state/' . $project['project_id'];
        ?>
"><?php 
        echo $project['active'] ? 'deactivate' : 'activate';
        ?>
</a>]
            <?php 
        if (!$project['active']) {
            echo '[<a href="javascript:DeleteProject(' . $project['project_id'] . ')">delete</a>]';
        }
        ?>
</td>
        </tr>
    <?php 
    }
    ?>
</table>
<?php 
}
?>

<p><a href="<?php 
echo Url::base(TRUE);
?>
params/new">New Monitoring Project</a></p>
开发者ID:peetucket,项目名称:ImpactProbe,代码行数:31,代码来源:home.php

示例14: formatEvent

function formatEvent($event, $showProject = false)
{
    switch ($event->getEventTypeID()) {
        case 'create_user':
            $formatted = sprintf("%s registered for %s.", formatUserLink($event->getUser1ID()), '<a href="' . Url::base() . '">' . PIPELINE_NAME . '</a>');
            break;
        case 'send_message':
            $formatted = sprintf("%s sent a message to %s.", formatUserLink($event->getUser1ID()), formatUserLink($event->getUser2ID()));
            break;
        case 'accept_member_invitation':
            $predicate = $showProject ? 'the project ' . formatProjectLink($event->getProjectID()) : "this project";
            $formatted = sprintf("%s accepted %s's invitation to join %s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), formatUserLink($event->getUser2ID(), $event->getProjectID()), $predicate);
            break;
        case 'trust_member':
            $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : '';
            $formatted = sprintf("%s trusted %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), formatUserLink($event->getUser2ID(), $event->getProjectID()), $predicate);
            break;
        case 'untrust_member':
            $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : '';
            $formatted = sprintf("%s untrusted %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), formatUserLink($event->getUser2ID(), $event->getProjectID()), $predicate);
            break;
        case 'join_project':
            $predicate = $showProject ? ' ' . formatProjectLink($event->getProjectID()) : '';
            $formatted = sprintf("%s joined the project%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), $predicate);
            break;
        case 'leave_project':
            $predicate = $showProject ? ' ' . formatProjectLink($event->getProjectID()) : '';
            $formatted = sprintf("%s left the project%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), $predicate);
            break;
        case 'follow_project':
            $predicate = $showProject ? ' ' . formatProjectLink($event->getProjectID()) : '';
            $formatted = sprintf("%s followed the project%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), $predicate);
            break;
        case 'unfollow_project':
            $predicate = $showProject ? ' ' . formatProjectLink($event->getProjectID()) : '';
            $formatted = sprintf("%s unfollowed the project%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), $predicate);
            break;
        case 'ban_user':
            $predicate = $showProject ? ' from the project ' . formatProjectLink($event->getProjectID()) : '';
            $formatted = sprintf("%s banned %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), formatUserLink($event->getUser2ID(), $event->getProjectID()), $predicate);
            break;
        case 'unban_user':
            $predicate = $showProject ? ' from the project ' . formatProjectLink($event->getProjectID()) : '';
            $formatted = sprintf("%s unbanned %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), formatUserLink($event->getUser2ID(), $event->getProjectID()), $predicate);
            break;
        case 'create_project':
            $predicate = $showProject ? 'the project ' . formatProjectLink($event->getProjectID()) : 'this project';
            $formatted = sprintf("%s created %s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), formatProjectLink($event->getProjectID()));
            break;
        case 'edit_pitch':
            $predicate = $showProject ? ' for the project ' . formatProjectLink($event->getProjectID()) : '';
            $formatted = sprintf("%s edited the %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . Url::pitch($event->getProjectID()) . '">pitch</a>', $predicate);
            break;
        case 'edit_specs':
            $predicate = $showProject ? ' for the project ' . formatProjectLink($event->getProjectID()) : '';
            $formatted = sprintf("%s edited the %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . Url::specs($event->getProjectID()) . '">specs</a>', $predicate);
            break;
        case 'edit_rules':
            $predicate = $showProject ? ' for the project ' . formatProjectLink($event->getProjectID()) : '';
            $formatted = sprintf("%s edited the %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . Url::rules($event->getProjectID()) . '">rules</a>', $predicate);
            break;
        case 'edit_project_status':
            $predicate = $showProject ? 'the project ' . formatProjectLink($event->getProjectID()) : 'this project';
            $status = $event->getData2();
            $formatted = sprintf("%s changed the %s of %s to &ldquo;%s.&rdquo;", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . Url::status($event->getProjectID()) . '">status</a>', $predicate, formatProjectStatus($status));
            break;
        case 'edit_project_deadline':
            $deadline = $event->getData2();
            if ($deadline != null) {
                $predicate = $showProject ? 'the project ' . formatProjectLink($event->getProjectID()) : 'this project';
                $formatted = sprintf("%s changed the %s of %s to %s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . Url::deadline($event->getProjectID()) . '">deadline</a>', $predicate, strftime("%a, %b %d, %Y", strtotime($deadline)));
            } else {
                $predicate = $showProject ? 'the project ' . formatProjectLink($event->getProjectID()) : 'this project';
                $formatted = sprintf("%s removed the %s for %s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . Url::deadline($event->getProjectID()) . '">deadline</a>', $predicate);
            }
            break;
        case 'create_discussion':
            $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : '';
            $discussion = Discussion::load($event->getItem1ID());
            $title = $discussion->getTitle();
            $url = Url::discussion($discussion->getID());
            $formatted = sprintf("%s posted the discussion %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $url . '">' . $title . '</a>', $predicate);
            break;
        case 'lock_discussion':
            $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : '';
            $discussion = Discussion::load($event->getItem1ID());
            $title = $discussion->getTitle();
            $url = Url::discussion($discussion->getID());
            $formatted = sprintf("%s locked the discussion %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $url . '">' . $title . '</a>', $predicate);
            break;
        case 'unlock_discussion':
            $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : '';
            $discussion = Discussion::load($event->getItem1ID());
            $title = $discussion->getTitle();
            $url = Url::discussion($discussion->getID());
            $formatted = sprintf("%s unlocked the discussion %s%s.", formatUserLink($event->getUser1ID(), $event->getProjectID()), '<a href="' . $url . '">' . $title . '</a>', $predicate);
            break;
        case 'create_discussion_reply':
            $predicate = $showProject ? ' in the project ' . formatProjectLink($event->getProjectID()) : '';
            $discussion = Discussion::load($event->getItem2ID());
//.........这里部分代码省略.........
开发者ID:malimu,项目名称:Pipeline,代码行数:101,代码来源:formatEvents.php

示例15: function

?>
		<![endif]-->
		<?php 
echo Html::css('recess');
?>
		 
		<?php 
echo Html::css('SyntaxHighlighter');
echo Html::js('shCore');
echo Html::js('shBrushPhp');
echo Html::js('shBrushSql');
?>
		<script language="javascript">
			window.onload = function() {
				dp.SyntaxHighlighter.ClipboardSwf = '<?php 
echo Url::base('flash/clipboard.swf');
?>
'
				dp.SyntaxHighlighter.HighlightAll('code');
			}
		</script>
		<?php 
echo $scripts;
?>
		<title>Recess Tools! - <?php 
echo $title;
?>
</title>
	</head>
	<body>
	<div class="container">
开发者ID:amitshukla30,项目名称:recess,代码行数:31,代码来源:master.layout.php


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