本文整理汇总了PHP中cmsFramework::route方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsFramework::route方法的具体用法?PHP cmsFramework::route怎么用?PHP cmsFramework::route使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsFramework
的用法示例。
在下文中一共展示了cmsFramework::route方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: click2Search
function click2Search($field, $criteriaid, $catid, $Itemid)
{
if (isset($field['properties']['click2search'])) {
$Itemid = $Itemid ? $Itemid : '';
if (isset($field['properties']['click2searchlink']) && $field['properties']['click2searchlink'] != '') {
$click2searchlink = $field['properties']['click2searchlink'];
} else {
$click2searchlink = 'index.php?option=' . S2Paths::get('jreviews', 'S2_CMSCOMP') . '&Itemid={ITEMID}&url=tag/{FIELDNAME}/{FIELDTEXT}/criteria' . _PARAM_CHAR . '{CRITERIAID}';
}
foreach ($this->output as $key => $text) {
if ($field['type'] == 'date') {
$field['value'][$key] = str_replace(' 00:00:00', '', $field['value'][$key]);
}
$url = $click2searchlink;
if ($Itemid > 0) {
$url = str_replace('{ITEMID}', $Itemid, $url);
} else {
$url = str_replace(array('_m{ITEMID}', '&Itemid={ITEMID}'), '', $url);
}
$url = str_ireplace(array('{FIELDNAME}', '{FIELDTEXT}', '{CRITERIAID}', '{CATID}'), array(substr($field['name'], 3), urlencode($field['value'][$key]), urlencode($criteriaid), urlencode($catid)), $url);
$url = s2ampReplace($url);
$url = cmsFramework::route($url);
$this->output[$key] = "<a href=\"{$url}\">{$text}</a>";
}
}
}
示例2: generateFormSelect
function generateFormSelect($orderingList, $selected, $attributes)
{
# Construct new route
$new_route = cmsFramework::constructRoute($this->passedArgs, array('order', 'page'));
$selectList = array();
foreach ($orderingList as $value => $text) {
$selectList[] = array('value' => cmsFramework::route($new_route . '/order' . _PARAM_CHAR . $value), 'text' => $text);
}
$selected = cmsFramework::route($new_route . '/order' . _PARAM_CHAR . $selected);
return $this->Form->select('order', $selectList, $selected, $attributes);
}
示例3: Categories
function Categories()
{
$assets = array('js' => array('jreviews', 'jquery', 'jreviews.compare', 'jq.ui.core', 'jq.ui.slider', 'jq.json', 'jq.jsoncookie'), 'css' => array('theme', 'theme.list', 'paginator', 'jq.ui.core'));
$this->_user->id > 0 and array_push($assets['js'], 'jq.jreviews.plugins');
?>
<script type="text/javascript">
jQuery(document).ready(function() {
jreviewsCompare.set({
'numberOfListingsPerPage':<?php
echo Sanitize::getInt($this->Config, 'list_compare_columns', 3);
?>
,
'lang': {
'compare_all':'<?php
__t("Compare All", false, true);
?>
',
'remove_all':'<?php
__t("Remove All", false, true);
?>
',
'select_more':'<?php
__t("You need to select more than one listing for comparison!", false, true);
?>
'
},
'compareURL':'<?php
echo cmsFramework::route('index.php?option=com_jreviews&url=categories/compare/type:type_id/');
?>
'
});
<?php
if ($this->action == 'compare') {
?>
jreviewsCompare.initComparePage();<?php
}
?>
jreviewsCompare.initCompareDashboard();
<?php
if ($this->action != 'compare') {
?>
jreviewsCompare.initListPage();<?php
}
?>
// fix the height of divs on comparison page after everything is loaded
jQuery(window).load(function(){ jreviewsCompare.fixCompareImagesAlignment(); });
});
</script>
<?php
$this->send($assets);
}
示例4: _process
function _process()
{
$urlSeparator = "_";
$simple_search = Sanitize::getInt($this->data, 'simple_search');
$keywords = Sanitize::getVar($this->data, 'keywords');
$criteria = isset($this->data['Search']) ? Sanitize::getInt($this->data['Search'], 'criteria_id') : null;
$dir = str_replace(array(',', ' '), array($urlSeparator, ''), Sanitize::getString($this->data, 'dir'));
$cat = str_replace(array(',', ' '), array($urlSeparator, ''), Sanitize::getString($this->data, 'cat'));
$section = str_replace(array(',', ' '), array($urlSeparator, ''), Sanitize::getString($this->data, 'section'));
/*J15*/
$order = Sanitize::getVar($this->data, 'order');
$query_type = Sanitize::getVar($this->data, 'search_query_type');
$scope = Sanitize::getVar($this->data, 'contentoptions');
$author = Sanitize::getString($this->data, 'author');
$categories = Sanitize::getVar($this->data, 'categories');
$menu_id = Sanitize::getInt($this->data, 'menu_id');
$tmpl_suffix = Sanitize::getString($this->data, 'tmpl_suffix');
$illegal_chars = array('#', '/', '?', ':', urldecode('%E3%80%80'));
// Last one is japanese double space
$sort = '';
# Load Routes helper
App::import('Helper', 'routes', 'jreviews');
$Routes = new RoutesHelper();
// Replace ampersands with temp string to be replaced back as urlencoded ampersand further below
$keywords = str_replace(array_keys($this->KeywordReplacementMask), array_values($this->KeywordReplacementMask), $keywords);
# Get the Itemid
$menu_id_param = $menu_id > 0 ? $menu_id : '';
$url_params = '';
# SIMPLE SEARCH
if ($simple_search) {
# Build the query string
if (trim($keywords) != '') {
$url_params .= (cmsFramework::mosCmsSef() ? '' : '/') . 'keywords' . _PARAM_CHAR . str_replace(' ', '+', urlencode(str_replace($illegal_chars, ' ', $keywords)));
}
!empty($dir) and $url_params .= "/dir" . _PARAM_CHAR . $dir;
!empty($section) and $url_params .= "/cat" . _PARAM_CHAR . 's' . $section;
/*J15*/
!empty($cat) and $url_params .= "/cat" . _PARAM_CHAR . $cat;
!empty($tmpl_suffix) and $url_params .= '/tmpl_suffix' . _PARAM_CHAR . $tmpl_suffix;
!empty($order) and $sort = '/order' . _PARAM_CHAR . $order;
# Checks if need to keep the Itemid on the result page
if ($this->Config->search_itemid && $menu_id) {
$url = $Routes->search_results($menu_id_param, '');
} else {
$url = $Routes->search_results(null, '');
}
$url = cmsFramework::route($url . $url_params . $sort);
$url = str_replace(array_keys($this->KeywordReplacementUrl), array_values($this->KeywordReplacementUrl), $url);
cmsFramework::redirect($url);
exit;
}
# ADVANCED SEARCH
$url_params = array();
$criteria_param = $criteria ? (cmsFramework::mosCmsSef() ? '' : '/') . 'criteria:' . $criteria : '';
// Search query type
!empty($query_type) and $url_params[] = "query" . _PARAM_CHAR . $query_type;
!empty($dir) != '' and $url_params[] = "dir" . _PARAM_CHAR . $dir;
// Listing and reviews
if ($keywords) {
if ($scope) {
$url_params[] = "scope" . _PARAM_CHAR . urlencode(implode($urlSeparator, $scope));
}
$url_params[] = "keywords" . _PARAM_CHAR . urlencode(str_replace($illegal_chars, ' ', $keywords));
}
// Author
!empty($author) and $url_params[] = "author" . _PARAM_CHAR . urlencode($author);
// Categories
if (is_array($categories)) {
// Remove empty values from array
foreach ($categories as $index => $value) {
if (empty($value)) {
unset($categories[$index]);
}
}
if (!empty($categories)) {
$cat = urlencode(implode($urlSeparator, $categories));
!empty($cat) and $url_params[] = "cat" . _PARAM_CHAR . $cat;
}
} elseif ($categories != '') {
// Single select category list
!empty($categories) and $url_params[] = "cat" . _PARAM_CHAR . $categories;
}
// First pass to process numeric values, need to merge operator and operand into one parameter
if (isset($this->data['Field'])) {
foreach ($this->data['Field']['Listing'] as $key => $value) {
if (substr($key, -9, 9) == '_operator') {
$operand = substr($key, 0, -9);
if (is_array($this->data['Field']['Listing'][$operand]) && is_numeric($this->data['Field']['Listing'][$operand][0]) || is_numeric($this->data['Field']['Listing'][$operand])) {
$this->data['Field']['Listing'][$operand] = $value . $urlSeparator . trim(implode('_', $this->data['Field']['Listing'][$operand]));
} elseif (is_array($this->data['Field']['Listing'][$operand]) && trim($this->data['Field']['Listing'][$operand][0]) != '' || !is_array($this->data['Field']['Listing'][$operand]) && trim($this->data['Field']['Listing'][$operand]) != '') {
// Assume it's a date field
$this->data['Field']['Listing'][$operand] = $value . $urlSeparator . "date_" . implode('_', $this->data['Field']['Listing'][$operand]);
} else {
$this->data['Field']['Listing'][$operand] = '';
}
// Remove trailing separator char
$this->data['Field']['Listing'][$operand] = rtrim($this->data['Field']['Listing'][$operand], $urlSeparator);
}
}
// Second pass to process everything
//.........这里部分代码省略.........
示例5: makeAbsUrl
/**
* Convert relative urls to absolute for use in feeds, emails, etc.
*/
function makeAbsUrl($url, $options = array())
{
$options = array_merge(array('sef' => false, 'ampreplace' => false), $options);
$options['sef'] and $url = cmsFramework::route($url);
$options['ampreplace'] and $url = str_replace('&', '&', $url);
if (!strstr($url, 'http')) {
$url_parts = parse_url(WWW_ROOT);
$url = $url_parts['scheme'] . '://' . $url_parts['host'] . $url;
}
return $url;
}
示例6: listingsFeed
function listingsFeed($title = '', $attributes = array())
{
$base_url = rtrim(cmsFramework::constructRoute($this->passedArgs), '/') . '/action:xml/';
$title = sprintf(__t("%s listing feeds", true), $title);
if (isset($attributes['return_url'])) {
$base_url = cmsFramework::route($base_url);
return $base_url;
} else {
$attributes = array_merge(array('title' => $title, 'class' => 'jr_feedListings'), $attributes);
return $this->Html->link('', $base_url, $attributes);
}
}
示例7: ListingsDetail
function ListingsDetail()
{
$assets = array('js' => array('jreviews', 'jreviews.compare', 'jquery', 'jq.ui.core', 'jreviews.fields', 'jq.ui.rating', 'jq.jreviews.plugins', 'jq.tooltip', 'jq.json', 'jq.jsoncookie'), 'css' => array('theme', 'theme.detail', 'theme.form', 'paginator', 'jq.ui.core'));
$facebook_id = Sanitize::getString($this->Config, 'facebook_appid');
$facebook_opengraph = Sanitize::getBool($this->Config, 'facebook_opengraph', true);
$facebook_xfbml = $facebook_id && $facebook_opengraph;
$facebook_post = $facebook_id && $this->Access->canAddReview() && !$this->Access->moderateReview() && $this->Config->facebook_enable && $this->Config->facebook_reviews;
?>
<script type="text/javascript">
/* <![CDATA[ */
jQuery(document).ready(function()
{
jreviewsCompare.set({
'numberOfListingsPerPage':<?php
echo Sanitize::getInt($this->Config, 'list_compare_columns', 3);
?>
,
'maxNumberOfListings' : 15,
'compareURL':'<?php
echo cmsFramework::route('index.php?option=com_jreviews&url=categories/compare/type:type_id/');
?>
'
});
jreviewsCompare.initCompareDashboard();
jreviewsCompare.initListingsSelection();
<?php
if ($facebook_xfbml || $facebook_post) {
?>
if(!jQuery('#fb-root').length) jQuery("body").append('<div id="fb-root"></div>');
jreviews.facebook.init({
'appid':'<?php
echo $this->Config->facebook_appid;
?>
'
});
<?php
}
?>
});
/* ]]> */
</script>
<?php
$this->send($assets);
}
示例8: _sefUrl
/**
* Returns sef urls passed as posted data via curl
* Used to get front end sef urls from admin side
*
*/
function _sefUrl()
{
$sef_urls = array();
$urls = Sanitize::getVar($this->data, 'url');
if (empty($urls)) {
return;
}
foreach ($urls as $key => $url) {
$sef_urls[$key] = cmsFramework::route($url);
}
echo json_encode($sef_urls);
}
示例9: _save
//.........这里部分代码省略.........
$currImages = $this->Uploads->images;
}
$this->data['Listing']['images'] = implode("\n", $currImages);
}
# Save listing
$savedListing = $this->Listing->store($this->data);
$listing_id = $this->data['Listing']['id'];
if (!$savedListing) {
$validation .= __t("The was a problem saving the listing", true, true);
}
// Error on listing save
if ($validation != '') {
$response[] = "{$parentFrame}.jQuery('#jr_listingFormValidation').html('{$validation}');";
$response[] = "{$parentFrame}.jQuery('.button').removeAttr('disabled');";
$response[] = "{$parentFrame}.jQuery('.jr_loadingSmall').hide();";
return $this->makeJS($response);
}
# Save listing custom fields
$this->data['Field']['Listing']['contentid'] = $this->data['Listing']['id'];
$this->Field->save($this->data, 'listing', $isNew, $listing_valid_fields);
# Begin insert review in table
if ($revFormEnabled && $criteria['Criteria']['state']) {
// Get reviewer type, for now editor reviews don't work in Everywhere components
$this->data['Review']['author'] = (int) $this->Access->isJreviewsEditor($this->_user->id);
$this->data['Review']['mode'] = 'com_content';
$this->data['Review']['pid'] = (int) $this->data['Listing']['id'];
// Force plugin loading on Review model
$this->_initPlugins('Review');
$this->Review->isNew = true;
$savedReview = $this->Review->save($this->data, $this->Access, $review_valid_fields);
}
# Before render callback
if ($isNew && isset($this->Listing->plgBeforeRenderListingSaveTrigger)) {
$plgBeforeRenderListingSave = $this->Listing->plgBeforeRenderListingSave();
switch ($plgBeforeRenderListingSave) {
case '0':
$this->data['Listing']['state'] = 1;
break;
case '1':
$this->data['Listing']['state'] = 0;
break;
case '':
break;
default:
return $plgBeforeRenderListingSave;
break;
}
}
# Moderation disabled
if (!isset($this->data['Listing']['state']) || $this->data['Listing']['state']) {
$fields = array('Criteria.criteria AS `Criteria.criteria`', 'Criteria.tooltips AS `Criteria.tooltips`');
$listing = $this->Listing->findRow(array('fields' => $fields, 'conditions' => array('Listing.id = ' . $listing_id)), array('afterFind'));
# Facebook wall integration
$fb_checkbox = Sanitize::getBool($this->data, 'fb_publish');
$facebook_integration = Sanitize::getBool($this->Config, 'facebook_enable') && Sanitize::getBool($this->Config, 'facebook_listings') && $fb_checkbox;
$token = cmsFramework::getCustomToken($listing_id);
$facebook_integration and $response[] = $parentFrame . '.jQuery.get(' . $parentFrame . '.s2AjaxUri+' . $parentFrame . '.jreviews.ajax_params()+\'&url=facebook/_postListing/id:' . $listing_id . '&' . $token . '=1\');
';
$url = cmsFramework::route($listing['Listing']['url']);
$update_text = $isNew ? __t("Thank you for your submission.", true, true) : __t("The listing was successfully saved.", true, true);
//JOEYG CODE
//THE FOLLOWING GETS THE LISTING TYPE FROM THE DB FOR THE NEWLY SAVED LISTING
//IF THE TYPE IS BUSINESS PROFILE OR PROJECT LISTING THEN DISPLAY THE after_submit.thtml file
//ELSE DISPLAY NORMAL MESSAGE
//IF WE ONLY WANT TO ADD THE after_submit.thtml if the listing is new then add
if ($isNew) {
$query = "SELECT `listing_type` FROM `jos_vpbd_content_criteria` WHERE `jos_vpbd_content_criteria`.`listing_id` = " . $this->data['Listing']['id'];
$this->_db->setQuery($query);
$jg_listing_type = $this->_db->loadResult();
if ($jg_listing_type == 2 || $jg_listing_type == 7) {
$update_html = $this->render('listings', 'after_submit');
} else {
$update_html = "<a href=\"{$url}\">" . __t("Click here to view your listing", true) . "</a>";
}
//ends if/else
} else {
//not new
$update_html = "<a href=\"{$url}\">" . __t("Click here to view your listing", true) . "</a>";
}
//ends if($isNew)
//ENDS JOEYG ALTER CODE
$jsonObject = json_encode(compact('target_id', 'update_text', 'update_html'));
$response[] = '
var $parentForm = ' . $parentFrame . '.jQuery(\'#jr_listingForm\');
$parentForm.scrollTo({duration:400,offset:-100});
$parentForm.s2ShowUpdate(' . $jsonObject . ');
';
return $this->makeJS($response);
}
# Moderation enabled
$update_text = __t("Thank you for your submission. It will be published once it is verified.", true);
$update_html = '<div id=\\"s2Msgjr_listingForm\\" class=\\"jr_postUpdate\\">' . $update_text . '</div>';
$response[] = '
var $parentForm = ' . $parentFrame . '.jQuery(\'#jr_listingForm\');
$parentForm.scrollTo({duration:400,offset:-100},function(){
$parentForm.fadeOut(250,function(){$parentForm.html("' . $update_html . '").show();});
});
';
return $this->makeJS($response);
}
示例10: display_items_per_page
/**
* Generates the dropdown list for number of items per page
* @return html select list
*/
function display_items_per_page()
{
$args = func_get_args();
if (func_num_args() == 2) {
$this->update_id = array_shift($args);
$items_per_page = array_shift($args);
} else {
$items_per_page = array(5, 10, 15, 20, 25, 30, 35, 40, 45, 50);
}
$Form = ClassRegistry::getClass('FormHelper');
$segments = '';
$url_param = array();
$passedArgs = $this->passedArgs;
if ($this->ajaxRequest) {
foreach ($items_per_page as $limit) {
$selectList[] = array('value' => $limit, 'text' => $limit);
}
$selected = $this->limit;
//Sanitize::getInt($this->data,'limit');
$onchange = ($this->ajax_scroll ? "jQuery('#" . $this->scroll_id . "').scrollTo(500,100);" : '') . " \r\n var \$form = jQuery(this).parents('form');\r\n \$form.find('input[name="data[page]"]').val(1);\r\n \$form.find('input[name="data[limit]"]').val(this.value);\r\n \$form.find('input[name="data[action]"]').val('{$this->action}');\r\n jQuery.post(s2AjaxUri,\$form.serialize(),function(s2Out){jQuery('#{$this->update_id}').html(s2Out);},'html');\r\n ";
return __t("Results per page", true) . ': ' . $Form->select('order_limit', $selectList, $selected, array('onchange' => $onchange));
} else {
foreach ($items_per_page as $limit) {
if (defined('MVC_FRAMEWORK_ADMIN')) {
$url = $this->base_url . 'page' . _PARAM_CHAR . '1/limit' . _PARAM_CHAR . $limit;
} else {
$url = cmsFramework::route($this->base_url . '/page' . _PARAM_CHAR . '1/limit' . _PARAM_CHAR . $limit . (cmsFramework::mosCmsSef() ? '' : '/'));
}
$selectList[] = array('value' => $url, 'text' => $limit);
}
if (defined('MVC_FRAMEWORK_ADMIN')) {
$selected = $this->base_url . 'page' . _PARAM_CHAR . '1/limit' . _PARAM_CHAR . $this->limit;
} else {
$selected = cmsFramework::route($this->base_url . '/page' . _PARAM_CHAR . '1/limit' . _PARAM_CHAR . $this->limit . (cmsFramework::mosCmsSef() ? '' : '/'));
}
return __t("Results per page", true) . ': ' . $Form->select('order_limit', $selectList, $selected, array('onchange' => "window.location=this.value"));
}
}
示例11: generateFormSelect
function generateFormSelect($orderingList, $selected, $attributes)
{
# Construct new route
$new_route = cmsFramework::constructRoute($this->passedArgs, array('lang', 'order', 'page'));
if (Sanitize::getInt($this->params, 'page', 1) == 1 && preg_match('/^(index.php\\?option=com_jreviews&Itemid=[0-9]+)(&url=menu\\/)$/i', $new_route, $matches)) {
// Remove menu segment from url if page 1 and it' a menu
$new_route_page_1 = $matches[1];
}
$selectList = array();
foreach ($orderingList as $value => $text) {
$default_order = Sanitize::getString($this->params, 'default_order');
// Default order takes user back to the first page
if ($value == $default_order) {
$selectList[] = array('value' => cmsFramework::route($new_route_page_1), 'text' => $text);
} else {
$selectList[] = array('value' => cmsFramework::route($new_route . '/order' . _PARAM_CHAR . $value), 'text' => $text);
}
}
if ($selected == $default_order) {
$selected = cmsFramework::route($new_route_page_1);
} else {
$selected = cmsFramework::route($new_route . '/order' . _PARAM_CHAR . $selected);
}
return $this->Form->select('order', $selectList, $selected, $attributes);
}
示例12: loadListingModel
/**
* Dynamic Listing Model Loading for jReviewsEverywhere extensions
* Detects which extension is being used to load the correct Listing model
*
* @param object $controller
* @param string $extension
*/
function loadListingModel(&$controller, $extension = null)
{
if (in_array($controller->name, array('admin/reviews', 'reviews')) && $controller->action == '_save') {
$extension = Sanitize::getString($controller->data['Review'], 'mode');
!$extension and isset($controller->data['Listing']) and $extension = Sanitize::getString($controller->data['Listing'], 'extension');
} else {
$extension = $extension ? $extension : Sanitize::getString($controller->params, 'extension', Sanitize::getString($controller->data, 'extension'));
}
if (!$extension && isset($controller->params['module'])) {
// Final check for module parameter
$extension = Sanitize::getString($controller->params['module'], 'extension');
}
$extension == '' and $controller->name != 'facebook' and $controller->name != 'reviews' and $controller->name != 'community_reviews' and $controller->name != 'module_reviews' and $controller->name != 'discussions' and $controller->name != 'admin/reviews' and $controller->name != 'admin/admin_owner_replies' and $controller->name != 'admin/admin_reports' and $controller->name != 'admin/admin_discussions' and $extension = 'com_content';
// Check if in listing detail page and it's a 3rd party component to dynamically load it's Listing model
if ($extension) {
$name = $this->name . '_' . $extension;
App::import('Model', $name, 'jreviews');
$class_name = inflector::camelize($this->name . '_' . $extension) . 'Model';
if ($extension != '' && class_exists($class_name)) {
$controller->Listing = new $class_name($controller->params);
if (isset($controller->Review) && $controller->action != '_save') {
unset($controller->Review->joins['listings'], $controller->Review->joins['jreviews_categories'], $controller->Review->joins['criteria']);
$controller->Review->joins = array_merge($controller->Review->joins, $controller->Listing->joinsReviews);
}
} else {
// Extension used in url doesn't have a plugin so we redirect to 404 error page
$controller->autoLayout = false;
$controller->autoRender = true;
cmsFramework::redirect(cmsFramework::route('index.php?option=com_jreviews&url=404'));
}
}
}
示例13: makeAbsUrl
/**
* Convert relative urls to absolute for use in feeds, emails, etc.
*/
function makeAbsUrl($url, $options = array())
{
$options = array_merge(array('sef' => false, 'ampreplace' => false), $options);
$options['sef'] and $url = cmsFramework::route($url);
$options['ampreplace'] and $url = str_replace('&', '&', $url);
if (!strstr($url, 'http')) {
$url_parts = parse_url(WWW_ROOT);
# If the site is in a folder make sure it is included in the url just once
if ($url_parts['path'] != '') {
if (strcmp($url_parts['path'], substr($url, 0, strlen($url_parts['path']))) !== 0) {
$url = rtrim($url_parts['path'], '/') . $url;
}
}
$url = $url_parts['scheme'] . '://' . $url_parts['host'] . $url;
}
return $url;
}
示例14: sefLink
function sefLink($title, $url = null, $attributes = array())
{
$url = str_replace('{_PARAM_CHAR}', _PARAM_CHAR, $url);
if (isset($attributes['return_url'])) {
return cmsFramework::route($url);
}
$attributes = $this->_parseAttributes($attributes);
return sprintf($this->tags['link'], cmsFramework::route($url), $attributes, $title);
}