本文整理汇总了PHP中UrlHelper类的典型用法代码示例。如果您正苦于以下问题:PHP UrlHelper类的具体用法?PHP UrlHelper怎么用?PHP UrlHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UrlHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getAuthorizationUserForm
private function getAuthorizationUserForm()
{
$urlHelper = new UrlHelper();
$this->form = '';
$this->form .= '<form class="AuthorizationForm" name="AuthorizationForm" action="' . $urlHelper->getThisPage() . '"
method="post" accept-charset="UTF-8" autocomplete="on">';
$this->form .= '<center>';
$this->form .= "<div class='AuthorizationFormBlock'>";
$this->form .= '<table class="AuthorizationFormTable" >';
$this->form .= '<tr>';
$this->form .= '<td>';
$this->form .= "<div class='AuthorizationFormLogin'></div>";
$this->form .= '</td>';
$this->form .= '<td>';
$this->form .= $this->inputHelper->paternTextBox("login", "login", "login", 25, true, $this->localization->getText("login"), "[A-Za-z0-9]{3,20}", null);
$this->form .= '</td>';
//$this->form .= '<td rowspan="2">';
//$this->form .= '</td>';
$this->form .= '</tr>';
$this->form .= '<tr>';
$this->form .= '<td>';
$this->form .= "<div class='AuthorizationFormPassword'></div>";
$this->form .= '</td>';
$this->form .= '<td>';
$this->form .= $this->inputHelper->paternPasswordBox("password", "password", "password", 25, true, $this->localization->getText("password"), "[A-Za-z0-9]{3,20}", null);
$this->form .= '</td>';
$this->form .= '</tr>';
$this->form .= '</tr>';
$this->form .= '</table>';
$this->form .= '<input class="AuthorizationFormButton" type="submit" name="AuthorizationFormSubmit" value="in" title="' . $this->localization->getText("authorizationFormText") . '">';
$this->form .= "</div>";
$this->form .= '</center>';
$this->form .= '</form>';
}
开发者ID:CompuProject,项目名称:Forsazh62,代码行数:34,代码来源:AuthorizationUserPanel.php
示例2: testAbsoluteLinkShouldCreateRequestFormGlobalsWhenNoRequestIsGiven
public function testAbsoluteLinkShouldCreateRequestFormGlobalsWhenNoRequestIsGiven()
{
$helper = new UrlHelper();
$_SERVER['HTTPS'] = 'on';
$_SERVER['HTTP_HOST'] = 'localhost';
$_SERVER['REQUEST_URI'] = '/webroot/test';
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['SCRIPT_NAME'] = '/webroot';
$this->assertEquals('https://localhost/webroot/page', $helper->absoluteLink('/page'));
}
开发者ID:holger,项目名称:yoshi,代码行数:10,代码来源:UrlHelperTest.php
示例3: generateHTML
private function generateHTML()
{
$this->getSliderData();
$out = '<div class="border_box">';
$out .= '<div class="box_skitter box_skitter_large ' . $this->name . '">';
$out .= '<ul>';
foreach ($this->data['slides'] as $slide) {
$html = "<li>";
// echo $this->sliderDir.$this->name.'/'.strtolower($this->thisLang).'/'.$slide['fileName']."<br>";
$img = '<img src="' . $this->sliderDir . $this->name . '/' . strtolower($this->thisLang) . '/' . $slide['fileName'] . '" class="' . $slide['animation'] . '" />';
$imgFile = $this->sliderDir . $this->name . '/' . strtolower($this->thisLang) . '/' . $slide['fileName'];
if (!file_exists($imgFile)) {
$imgFile = $this->sliderDir . $this->name . '/' . strtolower($this->defaultLang) . '/' . $slide['fileName'];
}
$img = '<img src="' . $imgFile . '" class="' . $slide['animation'] . '" />';
if (isset($slide['url']) && $slide['url'] != null && $slide['url'] != "") {
$urlHelper = new UrlHelper();
$target = "";
if (substr($slide['url'], 0, 1) == "#") {
$url = $urlHelper->getThisPage() . $slide['url'];
} else {
if (substr($slide['url'], 0, 1) == "\$") {
$url = $urlHelper->pageUrl(substr($slide['url'], 1), null);
} else {
if (substr($slide['url'], 0, 7) == "http://") {
$target = 'target="_blank"';
}
$url = $slide['url'];
}
}
$html .= '<a href="' . $url . ' ' . $target . '">';
$html .= $img;
$html .= '</a>';
} else {
$html .= $img;
}
if (isset($slide['text']) && $slide['text'] != null && $slide['text'] != "") {
$html .= '<div class="label_text">';
$html .= $slide['text'];
$html .= '</div>';
}
$html .= "</li>";
$out .= $html;
}
$out .= '</ul>';
$out .= '</div>';
$out .= '</div>';
$out .= $this->generateParams();
$this->html = $out;
}
开发者ID:CompuProject,项目名称:Forsazh62,代码行数:50,代码来源:Slider.php
示例4: generateMenuLevelHtml
private function generateMenuLevelHtml($parent)
{
$out = "";
if (isset($this->menuItems[$parent]) && count($this->menuItems[$parent]) > 0) {
if ($parent != 0) {
$javaID = $this->menuName . "_child_" . $parent;
$out .= "<ul id='" . $javaID . "' style='display: none;' ";
$out .= "class='menu child_menu " . $this->menuType . " ";
$out .= $this->menuCssClass . " " . $this->menuName . "' ";
$out .= "onmouseover=\"showChildMenu('{$javaID}');\" ";
$out .= "onmouseout=\"hideChildMenu('{$javaID}');\">";
} else {
$out .= "<ul id='" . $this->menuName . "' class='menu ";
$out .= $this->menuType . " " . $this->menuCssClass . " ";
$out .= $this->menuName . "'>";
}
foreach ($this->menuItems[$parent] as $menuItem) {
if ($this->checkValue($menuItem['url'])) {
$url = $menuItem['url'];
} else {
$urlHelper = new UrlHelper();
if ($menuItem['postfix'][0] == "/") {
$menuItem['postfix'] = substr($menuItem['postfix'], 1);
}
$url = $urlHelper->pageUrl($menuItem['page'], null) . $menuItem['postfix'];
}
global $_URL_PARAMS;
$thisPageClass = "";
if ($menuItem['page'] == $_URL_PARAMS['page']) {
$thisPageClass = "thisPage";
}
$javaChildID = $this->menuName . "_child_" . $menuItem['menuItem'];
// $out .= "<a href='$url' target='".$menuItem['target']."'>";
$out .= "<li onmouseover=\"showChildMenu('{$javaChildID}');\" onmouseout=\"hideChildMenu('{$javaChildID}');\" ";
$out .= "class='{$thisPageClass}'>";
$out .= "<a href='{$url}' target='" . $menuItem['target'] . "'>";
$out .= "<span text='text'>";
$out .= $menuItem['title'];
$out .= "</span>";
$out .= "</a>";
$out .= "</li>";
// $out .= "</a>";
$out .= $this->generateMenuLevelHtml($menuItem['menuItem']);
}
$out .= "</ul>";
}
return $out;
}
开发者ID:CompuProject,项目名称:Forsazh62,代码行数:48,代码来源:Menu.php
示例5: getInputHtml
/**
* Returns the field's input HTML.
*
* @param string $name
* @param mixed $value
* @return string
*/
public function getInputHtml($name, $value)
{
$id = craft()->templates->formatInputId($name);
craft()->templates->includeCssResource('twitter/css/tweet.css');
craft()->templates->includeJsResource('twitter/js/TweetInput.js');
craft()->templates->includeJs('new TweetInput("' . craft()->templates->namespaceInputId($id) . '");');
$tweet = $value;
$html = "";
if ($tweet && isset($tweet['id_str'])) {
$url = 'https://twitter.com/' . $tweet['user']['screen_name'] . '/status/' . $tweet['id_str'];
if (craft()->request->isSecureConnection()) {
$profileImageUrl = $tweet['user']['profile_image_url_https'];
} else {
$profileImageUrl = $tweet['user']['profile_image_url'];
}
if (craft()->twitter_plugin->checkDependencies()) {
$html .= '<div class="tweet-preview">' . '<div class="tweet-image" style="background-image: url(' . $profileImageUrl . ');"></div> ' . '<div class="tweet-user">' . '<span class="tweet-user-name">' . $tweet['user']['name'] . '</span> ' . '<a class="tweet-user-screenname light" href="http://twitter.com/' . $tweet['user']['screen_name'] . '" target="_blank">@' . $tweet['user']['screen_name'] . '</a>' . '</div>' . '<div class="tweet-text">' . $tweet['text'] . '</div>' . '</div>';
}
} else {
$url = $value;
$preview = '';
}
if (!craft()->twitter_plugin->checkDependencies()) {
$html .= '<p class="light">' . Craft::t("Twitter plugin is not configured properly. Please check {url} for more informations.", array('url' => Craft::t('<a href="' . UrlHelper::getUrl('twitter/settings') . '">{title}</a>', array('title' => 'Twitter plugin settings')))) . '</p>';
}
return '<div class="tweet">' . craft()->templates->render('_includes/forms/text', array('id' => $id, 'name' => $name, 'value' => $url, 'placeholder' => Craft::t('Enter a tweet URL or ID'))) . '<div class="spinner hidden"></div>' . $html . '</div>';
}
开发者ID:todamoon,项目名称:lHenry,代码行数:34,代码来源:Twitter_TweetFieldType.php
示例6: getCpEditUrl
public function getCpEditUrl()
{
$form = $this->getForm();
if ($form) {
return UrlHelper::getCpUrl('formerly/' . $form->handle . '/' . $this->id);
}
}
开发者ID:jeremyworboys,项目名称:Formerly,代码行数:7,代码来源:Formerly_SubmissionModel.php
示例7: addResources
protected function addResources()
{
// Get revision manifest
$manifestPath = dirname(__FILE__) . '/resources/rev-manifest.json';
$manifest = file_exists($manifestPath) && ($manifest = file_get_contents($manifestPath)) ? json_decode($manifest) : false;
// Get data
$data = ['fields' => [], 'entryTypeIds' => [], 'baseEditFieldUrl' => rtrim(UrlHelper::getCpUrl('settings/fields/edit'), '/'), 'baseEditEntryTypeUrl' => rtrim(UrlHelper::getCpUrl('settings/sections/sectionId/entrytypes'), '/'), 'baseEditGlobalSetUrl' => rtrim(UrlHelper::getCpUrl('settings/globals'), '/'), 'baseEditCategoryGroupUrl' => rtrim(UrlHelper::getCpUrl('settings/categories'), '/')];
$sectionIds = craft()->sections->allSectionIds;
foreach ($sectionIds as $sectionId) {
$entryTypes = craft()->sections->getEntryTypesBySectionId($sectionId);
$data['entryTypeIds']['' . $sectionId] = [];
foreach ($entryTypes as $entryType) {
$data['entryTypeIds']['' . $sectionId][] = $entryType->id;
}
}
$fields = craft()->fields->allFields;
foreach ($fields as $field) {
$data['fields'][$field->handle] = ['id' => $field->id, 'handle' => $field->handle, 'type' => $field->type];
}
$data = json_encode($data);
craft()->templates->includeJs('window._CpFieldLinksData=' . $data . ';');
// Include resources
$cssFile = 'stylesheets/CpFieldLinks.css';
$jsFile = 'javascripts/CpFieldLinks.js';
craft()->templates->includeCssResource('cpfieldlinks/' . ($manifest ? $manifest->{$cssFile} : $cssFile));
craft()->templates->includeJsResource('cpfieldlinks/' . ($manifest ? $manifest->{$jsFile} : $jsFile));
}
开发者ID:todamoon,项目名称:lHenry,代码行数:27,代码来源:CpFieldLinksPlugin.php
示例8: post
function post()
{
$blog_post_id = $this->node->arg('blog_post_id');
$values = array();
$form = $this->components->add('form', array('back' => $this->db->from('blog_post')->select('title')));
$author_id = $this->db->from('blog_author')->select('blog_author_id')->where('user_id', $this->plugin->Auth->get('user_id'))->fetchScalar();
$blog_post = $form->addTable('blog_post', array('title' => array('validator' => $this->valid->get('required', 'no_html')), 'content' => array('validator' => $this->valid->required), 'blog_author_id' => array('value' => $author_id), 'blog_id' => array('value' => $this->node->arg('blog_id')), 'pub_date' => array('value' => date('Y-m-d H:i:s')), 'summary' => array('validator' => $this->valid->required), 'status' => array('validator' => $this->valid->required), 'blog_category_id' => array('type' => 'dropdown', 'validator' => $this->valid->required)));
$plugins = $blog_post->content->getConfigOption('plugins');
$blog_post->content->setConfigOption('plugins', $plugins . ',table,pagebreak,markettoimages');
$blog_post->content->setConfigOption('pagebreak_separator', '<!-- Break -->');
$blog_post->content->setConfigOption('height', 600);
$blog_post->content->setConfigOption('theme_advanced_blockformats', "p,pre,h1,h2,h3,h4,blockquote,code");
$blog_post->content->setConfigOption('content_css', UrlHelper::resource('/blog/tinymce.css'));
$blog_post->content->setConfigOption('theme_advanced_buttons1_add', 'pagebreak,markettoimages');
$blog_post->content->setConfigOption('theme_advanced_buttons2', 'tablecontrols');
$blog_post->content->setConfigOption('valid_elements', '*[*]');
$blog_post->content->filter_html = false;
$blog_post->blog_category_id->setDataSource($this->db->from('blog_category')->select('blog_category_id', 'name')->where('blog_id', $this->node->arg('blog_id'))->orderby('name', 'asc'));
$blog_post->blog_category_id->add('', $this->lang->categories['select']);
$blog_post->status->setDataSource($this->lang->status);
$blog_post_tag = $form->addTable('blog_post_tag', array('blog_tag_id' => array('type' => '/blog/taglist')), array('keys' => array('blog_post_id' => $blog_post), 'delete' => array('blog_post_id' => $blog_post), 'multirow' => true, 'multicolumn' => true));
$blog_post_tag->blog_post_id->setReference($blog_post->blog_post_id, true);
$blog_post_tag->blog_tag_id->setNote($this->lang->fields['separated']);
if ($blog_post_id) {
$values = $this->db->from('blog_post')->where('blog_post_id', $blog_post_id)->fetchRow();
$form->setValues($blog_post, $values);
$values = $this->db->from('blog_post_tag')->select('blog_tag_id')->where('blog_post_id', $blog_post_id)->fetchArray();
$form->setValues($blog_post_tag, array('blog_tag_id' => $values));
}
}
开发者ID:RNKushwaha022,项目名称:orange-php,代码行数:30,代码来源:blogadmin.utility.php
示例9: actionEditSource
/**
* Edit an asset source.
*
* @param array $variables
*
* @throws HttpException
* @return null
*/
public function actionEditSource(array $variables = array())
{
if (empty($variables['source'])) {
if (!empty($variables['sourceId'])) {
$variables['source'] = craft()->assetSources->getSourceById($variables['sourceId']);
if (!$variables['source']) {
throw new HttpException(404);
}
$variables['sourceType'] = craft()->assetSources->populateSourceType($variables['source']);
} else {
$variables['source'] = new AssetSourceModel();
$variables['sourceType'] = craft()->assetSources->getSourceType('Local');
}
}
if (empty($variables['sourceType'])) {
$variables['sourceType'] = craft()->assetSources->populateSourceType($variables['source']);
}
if (craft()->getEdition() == Craft::Pro) {
$sourceTypes = craft()->assetSources->getAllSourceTypes();
$variables['sourceTypes'] = AssetSourceTypeVariable::populateVariables($sourceTypes);
}
$variables['isNewSource'] = !$variables['source']->id;
if ($variables['isNewSource']) {
$variables['title'] = Craft::t('Create a new asset source');
} else {
$variables['title'] = $variables['source']->name;
}
$variables['crumbs'] = array(array('label' => Craft::t('Settings'), 'url' => UrlHelper::getUrl('settings')), array('label' => Craft::t('Assets'), 'url' => UrlHelper::getUrl('settings/assets')), array('label' => Craft::t('Asset Sources'), 'url' => UrlHelper::getUrl('settings/assets')));
$variables['tabs'] = array('settings' => array('label' => Craft::t('Settings'), 'url' => '#assetsource-settings'), 'fieldlayout' => array('label' => Craft::t('Field Layout'), 'url' => '#assetsource-fieldlayout'));
$this->renderTemplate('settings/assets/sources/_edit', $variables);
}
开发者ID:jmstan,项目名称:craft-website,代码行数:39,代码来源:AssetSourcesController.php
示例10: includeCpResources
/**
* Includes the plugin's resources for the Control Panel.
*/
protected function includeCpResources()
{
// Prepare config
$config = [];
$config['iconMapping'] = craft()->config->get('iconMapping', 'redactoriconbuttons');
$iconAdminPath = craft()->path->getConfigPath() . 'redactoriconbuttons/icons.svg';
$iconPublicPath = craft()->config->get('iconFile', 'redactoriconbuttons');
if (IOHelper::fileExists($iconAdminPath)) {
$config['iconFile'] = UrlHelper::getResourceUrl('config/redactoriconbuttons/icons.svg');
} elseif ($iconPublicPath) {
$config['iconFile'] = craft()->config->parseEnvironmentString($iconPublicPath);
} else {
$config['iconFile'] = UrlHelper::getResourceUrl('redactoriconbuttons/icons/redactor-i.svg');
}
// Include JS
$config = JsonHelper::encode($config);
$js = "var RedactorIconButtons = {}; RedactorIconButtons.config = {$config};";
craft()->templates->includeJs($js);
craft()->templates->includeJsResource('redactoriconbuttons/redactoriconbuttons.js');
// Include CSS
craft()->templates->includeCssResource('redactoriconbuttons/redactoriconbuttons.css');
// Add external spritemap support for IE9+ and Edge 12
$ieShim = craft()->config->get('ieShim', 'redactoriconbuttons');
if (filter_var($ieShim, FILTER_VALIDATE_BOOLEAN)) {
craft()->templates->includeJsResource('redactoriconbuttons/lib/svg4everybody.min.js');
craft()->templates->includeJs('svg4everybody();');
}
}
开发者ID:carlcs,项目名称:craft-redactoriconbuttons,代码行数:31,代码来源:RedactorIconButtonsPlugin.php
示例11: getPageUrl
/**
* Returns the URL to a specific page
*
* @param int $page
*
* @return string|null
*/
public function getPageUrl($page)
{
if ($page >= 1 && $page <= $this->totalPages) {
$path = craft()->request->getPath();
$params = array();
if ($page != 1) {
$pageTrigger = craft()->config->get('pageTrigger');
if (!is_string($pageTrigger) || !strlen($pageTrigger)) {
$pageTrigger = 'p';
}
// Is this query string-based pagination?
if ($pageTrigger[0] === '?') {
$pageTrigger = trim($pageTrigger, '?=');
if ($pageTrigger === 'p') {
// Avoid conflict with the main 'p' param
$pageTrigger = 'pg';
}
$params = array($pageTrigger => $page);
} else {
if ($path) {
$path .= '/';
}
$path .= $pageTrigger . $page;
}
}
return UrlHelper::getUrl($path, $params);
}
}
开发者ID:nathanedwards,项目名称:cowfields.craft,代码行数:35,代码来源:PaginateVariable.php
示例12: getInputHtml
public function getInputHtml($name, $value)
{
// Include JavaScript & CSS
craft()->templates->includeJsResource('simplemeta/simple.meta.js');
craft()->templates->includeCssResource('simplemeta/simple.meta.css');
// Whether any assets sources exist
$sources = craft()->assets->findFolders();
$variables['assetsSourceExists'] = count($sources);
// URL to create a new assets source
$variables['newAssetsSourceUrl'] = UrlHelper::getUrl('settings/assets/sources/new');
if (!empty($value)) {
$simpleMetaModel = SimpleMeta_SimpleMetaModel::populateModel($value);
} else {
$simpleMetaModel = new SimpleMeta_SimpleMetaModel();
$simpleMetaModel->handle = $name;
}
// Set assets
$simplemetaAssets = array('socialOGImage' => $simpleMetaModel->socialOGImageId, 'socialTwitterGalleryImages' => $simpleMetaModel->socialTwitterGalleryImagesId, 'socialTwitterPhoto' => $simpleMetaModel->socialTwitterPhotoId, 'socialTwitterProductImage' => $simpleMetaModel->socialTwitterProductImageId, 'socialTwitterSummaryImage' => $simpleMetaModel->socialTwitterSummaryImageId, 'socialTwitterSummaryLargeImage' => $simpleMetaModel->socialTwitterSummaryLargeImageId);
foreach ($simplemetaAssets as $key => $value) {
if ($value) {
$asset = craft()->elements->getElementById($value);
$variables[$key . 'Elements'] = array($asset);
$variables[$key . 'Id'] = $asset->id;
} else {
$variables[$key . 'Elements'] = array();
$variables[$key . 'Id'] = "";
}
}
// Set element type
$variables['elementType'] = craft()->elements->getElementType(ElementType::Asset);
$data = array_merge($simpleMetaModel->getAttributes(), $variables);
return craft()->templates->render('simplemeta/input', $data);
}
开发者ID:jjmartucci,项目名称:Craft-SimpleMeta,代码行数:33,代码来源:SimpleMeta_SimpleMetaFieldType.php
示例13: runStep
/**
* @inheritDoc ITask::runStep()
*
* @param int $step
*
* @return bool
*/
public function runStep($step)
{
// NOTE: Perhaps much of this should be moved into a service
$batch = \Guzzle\Batch\BatchBuilder::factory()->transferRequests(20)->bufferExceptions()->build();
// Make the client
$client = new \Guzzle\Http\Client();
// Set the Accept header
$client->setDefaultOption('headers/Accept', '*/*');
// Loop the paths in this step
foreach ($this->_paths[$step] as $path) {
// Make the url, stripping 'site:' from the path if it exists
$newPath = preg_replace('/site:/', '', $path, 1);
$url = UrlHelper::getSiteUrl($newPath);
// Create the GET request
$request = $client->get($url);
// Add it to the batch
$batch->add($request);
}
// Flush the queue and retrieve the flushed items
$requests = $batch->flush();
// Log any exceptions
foreach ($batch->getExceptions() as $e) {
Craft::log('CacheMonster: an exception occurred: ' . $e->getMessage(), LogLevel::Error);
}
// Clear any exceptions
$batch->clearExceptions();
return true;
}
开发者ID:carlcs,项目名称:craft-cachemonster,代码行数:35,代码来源:CacheMonster_WarmTask.php
示例14: admin_setup
function admin_setup()
{
if ($this->layout) {
$this->layout = $this->load->layout('admin');
}
$default_utility = '/' . DEFAULT_MODULE . '/admin/' . DEFAULT_MODULE . 'admin';
if (!file_exists(APPD_APPLICATION . '/' . DEFAULT_MODULE . '/admin/' . DEFAULT_MODULE . 'admin.utility.php')) {
$default_utility = '/admin/admin/adminadmin';
}
$util = $this->load->utility($default_utility);
$path = $util ? DEFAULT_MODULE . '/' . DEFAULT_MODULE : 'admin/index';
$default_config = array('roles' => array('admin' => array('home' => $path, 'modules' => '*')), 'time_limit' => 500, 'memory_limit' => '128M');
$this->config = array_merge($default_config, $this->config);
$roles = array_keys($this->config['roles']);
$this->plugin->Auth->addArea('admin-area', $roles);
foreach ($roles as $role) {
$this->plugin->Auth->addRole($role, array('member-area', 'admin-area', 'open-area'));
}
$this->plugin->Auth->authorize('admin-area', array('admin', 'node', 'node_process', 'error'), array(&$this, '_goLogin'));
if (isset($this->config['language']) && $this->config['language'] != Lang::getCurrent()) {
$this->helper->redirect->to(UrlHelper::current($this->config['language']));
}
if (!ini_get('safe_mode') && is_callable('set_time_limit') && is_callable('ini_set')) {
@set_time_limit($this->config['time_limit']);
@ini_set("memory_limit", $this->config['memory_limit']);
}
}
开发者ID:RNKushwaha022,项目名称:orange-php,代码行数:27,代码来源:admin.controller.php
示例15: __callStatic
public function __callStatic($funName, $argu)
{
if (($index = strpos($funName, "Url")) && !method_exists(UrlHelper, $funName)) {
$type = strtolower(substr($funName, 0, $index));
return UrlHelper::CommonUrlHelper($type, $argu[0], $argu[1], $argu[2]);
}
}
开发者ID:Germey,项目名称:yinxingapply,代码行数:7,代码来源:UrlHelper.class.php
示例16: actionCropLogo
/**
* Crop user photo.
*
* @return null
*/
public function actionCropLogo()
{
$this->requireAjaxRequest();
$this->requireAdmin();
try {
$x1 = craft()->request->getRequiredPost('x1');
$x2 = craft()->request->getRequiredPost('x2');
$y1 = craft()->request->getRequiredPost('y1');
$y2 = craft()->request->getRequiredPost('y2');
$source = craft()->request->getRequiredPost('source');
// Strip off any querystring info, if any.
$source = UrlHelper::stripQueryString($source);
$imagePath = craft()->path->getTempUploadsPath() . $source;
if (IOHelper::fileExists($imagePath) && craft()->images->checkMemoryForImage($imagePath)) {
$targetPath = craft()->path->getStoragePath() . 'logo/';
IOHelper::ensureFolderExists($targetPath);
IOHelper::clearFolder($targetPath);
craft()->images->loadImage($imagePath, 300, 300)->crop($x1, $x2, $y1, $y2)->scaleToFit(300, 300, false)->saveAs($targetPath . $source);
IOHelper::deleteFile($imagePath);
$html = craft()->templates->render('settings/general/_logo');
$this->returnJson(array('html' => $html));
}
IOHelper::deleteFile($imagePath);
} catch (Exception $exception) {
$this->returnErrorJson($exception->getMessage());
}
$this->returnErrorJson(Craft::t('Something went wrong when processing the logo.'));
}
开发者ID:harish94,项目名称:Craft-Release,代码行数:33,代码来源:RebrandController.php
示例17: _handleSuccessfulLogin
/**
* Process Successful Login
*/
private function _handleSuccessfulLogin($setNotice)
{
// Get the current user
$currentUser = craft()->userSession->getUser();
// Were they trying to access a URL beforehand?
$returnUrl = craft()->userSession->getReturnUrl(null, true);
if ($returnUrl === null || $returnUrl == craft()->request->getPath()) {
// If this is a CP request and they can access the control panel, send them wherever
// postCpLoginRedirect tells us
if (craft()->request->isCpRequest() && $currentUser->can('accessCp')) {
$postCpLoginRedirect = craft()->config->get('postCpLoginRedirect');
$returnUrl = UrlHelper::getCpUrl($postCpLoginRedirect);
} else {
// Otherwise send them wherever postLoginRedirect tells us
$postLoginRedirect = craft()->config->get('postLoginRedirect');
$returnUrl = UrlHelper::getSiteUrl($postLoginRedirect);
}
}
// If this was an Ajax request, just return success:true
if (craft()->request->isAjaxRequest()) {
$this->returnJson(array('success' => true, 'returnUrl' => $returnUrl));
} else {
if ($setNotice) {
craft()->userSession->setNotice(Craft::t('Logged in.'));
}
$this->redirectToPostedUrl($currentUser, $returnUrl);
}
}
开发者ID:roundhouse,项目名称:Members-Craft-CMS,代码行数:31,代码来源:MembersController.php
示例18: login_process
function login_process()
{
$form = $this->load->form('login', $_POST);
if (!$form->validate()) {
Session::setFlash('next', $form->next->getValue());
$this->helper->redirect->flash(UrlHelper::referer(), $form->getId(), $form->getFlashParams());
}
$values = $form->getValue();
if ($form->next->getValue()) {
#Parameters 'auth' => 'login' are passed as a flash to the next page
$this->view->setRedirect($form->next->getValue(), 'auth', 'login');
} else {
$this->view->setRedirect('/');
}
$user_id = $this->db->Auth->getUserId($values['username'], $values['password']);
if (!$user_id && $this->config['old_password']) {
$user_id = $this->db->Auth->getUserIdFromOldPassword($values['username'], $form->password->getRawValue());
}
if (!$user_id) {
$form->username->setErrorCode('invalid');
$this->helper->redirect->flash(UrlHelper::referer(), $form->getId(), $form->getFlashParams());
}
if (!$this->db->Auth->isEnabled($user_id)) {
$this->helper->redirect->flash(UrlHelper::referer(), $form->getId(), $form->getFlashParams());
}
if (!$this->db->Auth->isActivated($user_id)) {
$this->helper->redirect->to('/auth/unconfirmed');
}
$this->plugin->Auth->login($user_id, $form->remember->isChecked(), $values['module']);
}
开发者ID:RNKushwaha022,项目名称:orange-php,代码行数:30,代码来源:auth.controller.php
示例19: actionEditDevice
/**
* Edit an device.
*
* @param array $variables
*
* @throws HttpException
*/
public function actionEditDevice(array $variables = array())
{
if (!empty($variables['appHandle'])) {
$variables['app'] = craft()->pushNotifications_apps->getAppByHandle($variables['appHandle']);
} elseif (!empty($variables['appId'])) {
$variables['app'] = craft()->pushNotifications_apps->getAppById($variables['appId']);
}
if (empty($variables['app'])) {
throw new HttpException(404);
}
// Now let's set up the actual device
if (empty($variables['device'])) {
if (!empty($variables['deviceId'])) {
$variables['device'] = craft()->pushNotifications_devices->getDeviceById($variables['deviceId']);
if (!$variables['device']) {
throw new HttpException(404);
}
} else {
$variables['device'] = new PushNotifications_DeviceModel();
$variables['device']->appId = $variables['app']->id;
}
}
if (!$variables['device']->id) {
$variables['title'] = Craft::t('Create a new device');
} else {
$variables['title'] = $variables['device']->title;
}
// Breadcrumbs
$variables['crumbs'] = array(array('label' => Craft::t('Push Notifications'), 'url' => UrlHelper::getUrl('pushnotifications')), array('label' => $variables['app']->name, 'url' => UrlHelper::getUrl('pushnotifications')));
// Set the "Continue Editing" URL
$variables['continueEditingUrl'] = 'pushnotifications/devices/' . $variables['app']->handle . '/{id}';
// Render the template!
$this->renderTemplate('pushnotifications/devices/_edit', $variables);
}
开发者ID:webremote,项目名称:pushnotifications,代码行数:41,代码来源:PushNotifications_DevicesController.php
示例20: actionInstall
/**
* Install examples
*
* @return void
*/
public function actionInstall()
{
$this->_installExampleTemplates();
$this->_installExampleData();
craft()->userSession->setNotice(Craft::t('Examples successfully installed.'));
$this->redirect(UrlHelper::getCpUrl() . '/sproutemail');
}
开发者ID:aladrach,项目名称:Bluefoot-Craft-Starter,代码行数:12,代码来源:SproutEmail_ExamplesController.php
注:本文中的UrlHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论