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


PHP Sanitize::getVar方法代码示例

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


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

示例1: _edit

 function _edit()
 {
     $this->autoRender = false;
     $this->autoLayout = false;
     $response = array();
     $review_id = Sanitize::getInt($this->params, 'review_id');
     $extension = $this->Review->getReviewExtension($review_id);
     // Dynamic loading Everywhere Model for given extension
     $this->Everywhere->loadListingModel($this, $extension);
     $fields = array('Criteria.id AS `Criteria.criteria_id`', 'Criteria.criteria AS `Criteria.criteria`', 'Criteria.state AS `Criteria.state`', 'Criteria.required AS `Criteria.required`', 'Criteria.tooltips AS `Criteria.tooltips`', 'Criteria.weights AS `Criteria.weights`', 'Criteria.config AS `ListingType.config`');
     $review = $this->Review->findRow(array('fields' => $fields, 'conditions' => array('Review.id = ' . $review_id)));
     # Override global configuration
     isset($review['ListingType']) and $this->Config->override($review['ListingType']['config']);
     $review['Criteria']['required'] = explode("\n", Sanitize::getVar($review['Criteria'], 'required'));
     if (count($review['Criteria']['required']) != count($review['Criteria']['criteria'])) {
         $review['Criteria']['required'] = array_fill(0, count($review['Criteria']['criteria']), 1);
     }
     if (!$this->Access->canEditReview($review['User']['user_id'])) {
         return $this->ajaxError(s2Messages::accessDenied());
     }
     # Set the theme suffix
     if ($review['Review']['extension'] == 'com_content') {
         $this->Theming->setSuffix(array('listing_id' => $review['Review']['listing_id']));
     }
     # Get custom fields for review form is form is shown on page
     $review_fields = $this->Field->getFieldsArrayNew($review['Criteria']['criteria_id'], 'review', $review);
     $review['Review']['criteria_id'] = $review['Criteria']['criteria_id'];
     # Form integrity
     $this->set(array('User' => $this->_user, 'Access' => $this->Access, 'review' => $review, 'review_fields' => $review_fields, 'formTokenKeys' => $this->formTokenKeys));
     return $this->ajaxUpdateDialog($this->render('reviews', 'create'));
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:31,代码来源:reviews_controller.php

示例2: overallRatings

 function overallRatings($listing, $page, $type = '')
 {
     $editor_reviews = $this->Config->getOverride('author_review', $listing['ListingType']['config']);
     $user_reviews = $this->Config->getOverride('user_reviews', $listing['ListingType']['config']);
     if (!($listing['Criteria']['state'] == 1 && ($editor_reviews || $user_reviews))) {
         return '';
     }
     $ratings = '<div class="overall_ratings">';
     // editor ratings
     if ($editor_reviews && $type != 'user') {
         $editor_rating = Sanitize::getVar($listing['Review'], 'editor_rating');
         $editor_rating_count = Sanitize::getInt($listing['Review'], 'editor_rating_count');
         $rating_stars = $this->drawStars($editor_rating, $this->Config->rating_scale, 'editor');
         $rating_value = $this->round($editor_rating, $this->Config->rating_scale);
         $rating_count = $editor_rating_count > 1 ? ' (' . $editor_rating_count . ')' : '';
         $ratings .= '<div class="overall_editor" title="' . __t("Editor rating", true) . '">';
         $ratings .= '<span class="rating_label jrIcon jrIconEditorReview">' . __t("Editor rating", true) . '</span>';
         $ratings .= '<div class="rating_stars">' . $rating_stars . '</div>';
         $ratings .= '<span class="rating_value">' . $rating_value . $rating_count . '</span>';
         $ratings .= '</div>';
     }
     // user ratings
     if ($page == 'content' && $user_reviews && $type != 'editor') {
         $user_rating = Sanitize::getVar($listing['Review'], 'user_rating');
         $rating_stars = $this->drawStars($user_rating, $this->Config->rating_scale, 'user');
         $rating_value = $this->round($user_rating, $this->Config->rating_scale);
         $rating_count = Sanitize::getInt($listing['Review'], 'user_rating_count');
         $review_s = "";
         if ($rating_count > 1) {
             $review_s = "reviews";
         } else {
             $review_s = "review";
         }
         $ratings .= '<div class="overall_user rating" title="' . __t("User rating", true) . '">';
         $ratings .= '<span class="rating_label jrIcon jrIconUserReviews">' . __t("User rating", true) . '</span>';
         $ratings .= '<div class="rating_stars">' . $rating_stars . '</div>';
         $ratings .= '<span class="rating_value average">' . $rating_value . '<span class="best"><span class="value-title" title="' . $this->Config->rating_scale . '"></span></span> (<span class="count">' . $rating_count . '</span> ' . $review_s . ')</span>';
         $ratings .= '</div>';
     } else {
         if ($page == 'list' && $user_reviews && $this->Config->list_show_user_rating && $type != 'editor') {
             $user_rating = Sanitize::getVar($listing['Review'], 'user_rating');
             $rating_stars = $this->drawStars($user_rating, $this->Config->rating_scale, 'user');
             $rating_value = $this->round($user_rating, $this->Config->rating_scale);
             $rating_count = Sanitize::getInt($listing['Review'], 'user_rating_count');
             $review_s = "";
             if ($rating_count > 1) {
                 $review_s = "reviews";
             } else {
                 $review_s = "review";
             }
             $ratings .= '<div class="overall_user" title="' . __t("User rating", true) . '">';
             $ratings .= '<span class="rating_label jrIcon jrIconUserReviews">' . __t("User rating", true) . '</span>';
             $ratings .= '<div class="rating_stars">' . $rating_stars . '</div>';
             $ratings .= '<span class="rating_value">' . $rating_value . ' (<span class="count">' . $rating_count . '</span> ' . $review_s . ')</span>';
             $ratings .= '</div>';
         }
     }
     $ratings .= '</div>';
     return $ratings;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:60,代码来源:rating.php

示例3: _save

 function _save()
 {
     $response = array();
     $this->Config->twitter_oauth = Sanitize::getVar($this->data, 'twitter_oauth');
     $this->Config->store();
     $response[] = 'jreviews_admin.dialog.close();';
     return $this->ajaxResponse($response);
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:8,代码来源:admin_twitter_controller.php

示例4: beforeSave

 function beforeSave(&$data)
 {
     // Convert Control Value array to string
     if (isset($data['Group']['control_value'])) {
         $control_value = Sanitize::getVar($data['Group'], 'control_value');
         $data['Group']['control_value'] = !empty($control_value) ? '*' . implode('*', $control_value) . '*' : '';
     } else {
         $data['Group']['control_field'] = '';
     }
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:10,代码来源:group.php

示例5: _edit

 function _edit()
 {
     $this->autoRender = false;
     $this->autoLayout = false;
     $response = array();
     $review_id = Sanitize::getInt($this->params, 'review_id');
     $extension = $this->Review->getReviewExtension($review_id);
     // Dynamic loading Everywhere Model for given extension
     $this->Everywhere->loadListingModel($this, $extension);
     //		unset($this->Review->joins['listings'],$this->Review->joins['jreviews_categories'],$this->Review->joins['criteria']);
     $fields = array('Criteria.id AS `Criteria.criteria_id`', 'Criteria.criteria AS `Criteria.criteria`', 'Criteria.state AS `Criteria.state`', 'Criteria.required AS `Criteria.required`', 'Criteria.tooltips AS `Criteria.tooltips`', 'Criteria.weights AS `Criteria.weights`');
     $review = $this->Review->findRow(array('fields' => $fields, 'conditions' => array('Review.id = ' . $review_id)));
     $review['Criteria']['required'] = explode("\n", Sanitize::getVar($review['Criteria'], 'required'));
     if (count($review['Criteria']['required']) != count($review['Criteria']['criteria'])) {
         $review['Criteria']['required'] = array_fill(0, count($review['Criteria']['criteria']), 1);
     }
     if (!$this->Access->canEditReview($review['User']['user_id'])) {
         return $this->ajaxError(s2Messages::accessDenied());
     }
     # Get custom fields for review form is form is shown on page
     $review_fields = $this->Field->getFieldsArrayNew($review['Criteria']['criteria_id'], 'review', $review);
     $this->set(array('User' => $this->_user, 'Access' => $this->Access, 'review' => $review, 'review_fields' => $review_fields));
     return $this->ajaxUpdateDialog($this->render('reviews', 'create'));
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:24,代码来源:reviews_controller.php

示例6: makeJsonObject


//.........这里部分代码省略.........
                 }
             }
             if (isset($result['Geomaps']) && $result['Geomaps']['lat'] != '' && $result['Geomaps']['lon'] != '' && $result['Geomaps']['lat'] != 0 && $result['Geomaps']['lon']) {
                 # Create infowindow JSON object
                 // start with standard fields
                 $infowindow = array('id' => $result['Listing']['listing_id'], 'url' => str_replace(array($www_base, '&amp;'), array('', '&'), $Routes->content('', $results[$key], array('return_url' => true))), 'index' => $listing_index, 'title' => $result['Listing']['title'], 'image' => str_replace($www_base, '', $Thumbnail->thumb($result, 0, array('tn_mode' => $this->c->Config->list_thumb_mode, 'location' => 'list', 'dimensions' => array($this->c->Config->list_image_resize), 'return_src' => 1))), 'featured' => $result['Listing']['featured'], 'rating_scale' => $this->c->Config->rating_scale, 'user_rating' => $result['Review']['user_rating'], 'user_rating_count' => $result['Review']['user_rating_count'], 'editor_rating' => $result['Review']['editor_rating'], 'editor_rating_count' => $result['Review']['editor_rating_count'], 'lat' => (double) $result['Geomaps']['lat'], 'lon' => (double) $result['Geomaps']['lon'], 'icon' => $icon_name);
                 if (!empty($result['Field']['pairs'])) {
                     # Limit fields will included in the payload json object
                     $result['Field']['pairs'] = array_intersect_key($result['Field']['pairs'], array_flip($infowindow_fields));
                     foreach ($result['Field']['pairs'] as $name => $fieldArray) {
                         $infowindow['field'][$name] = $CustomFields->field($name, $result);
                     }
                 }
                 $infowindow_data['id' . $result['Listing']['listing_id']] = $infowindow;
             }
         }
     }
     $this->c->Config->{'geomaps.enable_map_list'} = $map_counter;
     $mapUI = array();
     $zoom = '';
     switch ($this->c->name) {
         case 'categories':
             $maptypes = Sanitize::getString($this->c->Config, 'geomaps.ui.maptype_list', 'buttons');
             //buttons|menu|none
             $maptype_def = Sanitize::getString($this->c->Config, 'geomaps.ui.maptype_def_list', 'G_NORMAL_MAP');
             $map = Sanitize::getBool($this->c->Config, 'geomaps.ui.map_list', 1);
             $hybrid = Sanitize::getBool($this->c->Config, 'geomaps.ui.hybrid_list', 1);
             $satellite = Sanitize::getBool($this->c->Config, 'geomaps.ui.satellite_list', 1);
             $terrain = Sanitize::getBool($this->c->Config, 'geomaps.ui.terrain_list', 1);
             $panzoom = Sanitize::getBool($this->c->Config, 'geomaps.ui.panzoom_list', 1);
             $scale = Sanitize::getBool($this->c->Config, 'geomaps.ui.scale_list', 0);
             $scrollwheel = Sanitize::getBool($this->c->Config, 'geomaps.ui.scrollwheel_list', 0);
             $doubleclick = Sanitize::getBool($this->c->Config, 'geomaps.ui.doubleclick_list', 1);
             $mapUI['title']['trim'] = Sanitize::getVar($this->c->Config, 'geomaps.ui.trimtitle_list', 0);
             $mapUI['title']['trimchars'] = Sanitize::getVar($this->c->Config, 'geomaps.ui.trimtitle_chars', 30);
             break;
         case 'com_content':
             $maptypes = Sanitize::getString($this->c->Config, 'geomaps.ui.maptype_detail', 'buttons');
             //buttons|menu|none
             $maptype_def = Sanitize::getString($this->c->Config, 'geomaps.ui.maptype_def_detail', 'G_NORMAL_MAP');
             $map = Sanitize::getBool($this->c->Config, 'geomaps.ui.map_detail', 1);
             $hybrid = Sanitize::getBool($this->c->Config, 'geomaps.ui.hybrid_detail', 1);
             $satellite = Sanitize::getBool($this->c->Config, 'geomaps.ui.satellite_detail', 1);
             $terrain = Sanitize::getBool($this->c->Config, 'geomaps.ui.terrain_detail', 1);
             $panzoom = Sanitize::getBool($this->c->Config, 'geomaps.ui.panzoom_detail', 1);
             $scale = Sanitize::getBool($this->c->Config, 'geomaps.ui.scale_detail', 0);
             $scrollwheel = Sanitize::getBool($this->c->Config, 'geomaps.ui.scrollwheel_detail', 0);
             $doubleclick = Sanitize::getBool($this->c->Config, 'geomaps.ui.doubleclick_detail', 1);
             $zoom = Sanitize::getInt($this->c->Config, 'geomaps.ui.zoom_detail', '');
             $mapUI['title']['trim'] = Sanitize::getVar($this->c->Config, 'geomaps.ui.trimtitle_detail', 0);
             $mapUI['title']['trimchars'] = Sanitize::getVar($this->c->Config, 'geomaps.ui.trimtitle_chars', 30);
             break;
         case 'module_geomaps':
             $maptypes = Sanitize::getString($options, 'ui_maptype', 2) == '2' ? Sanitize::getString($this->c->Config, 'geomaps.ui.maptype_module', 'buttons') : Sanitize::getString($options, 'ui_maptype');
             //buttons|menu|none
             $maptype_def = Sanitize::getString($options, 'ui_maptype_def', 2) == '2' ? Sanitize::getString($this->c->Config, 'geomaps.ui.maptype_def_module', 'G_NORMAL_MAP') : Sanitize::getString($options, 'ui_maptype_def', 'G_NORMAL_MAP');
             $map = Sanitize::getInt($options, 'ui_map', 2) == '2' ? Sanitize::getBool($this->c->Config, 'geomaps.ui.map_module', 1) : Sanitize::getBool($options, 'ui_map');
             $hybrid = Sanitize::getInt($options, 'ui_hybrid', 2) == '2' ? Sanitize::getBool($this->c->Config, 'geomaps.ui.hybrid_module', 1) : Sanitize::getBool($options, 'ui_hybrid');
             $satellite = Sanitize::getInt($options, 'ui_satellite', 2) == '2' ? Sanitize::getBool($this->c->Config, 'geomaps.ui.satellite_module', 1) : Sanitize::getBool($options, 'ui_satellite');
             $terrain = Sanitize::getInt($options, 'ui_terrain', 2) == '2' ? Sanitize::getBool($this->c->Config, 'geomaps.ui.terrain_module', 1) : Sanitize::getBool($options, 'ui_terrain');
             $panzoom = Sanitize::getInt($options, 'ui_panzoom', 2) == '2' ? Sanitize::getBool($this->c->Config, 'geomaps.ui.panzoom_module', 1) : Sanitize::getBool($options, 'ui_panzoom');
             $scale = Sanitize::getInt($options, 'ui_scale', 2) == '2' ? Sanitize::getBool($this->c->Config, 'geomaps.ui.scale_module', 0) : Sanitize::getBool($options, 'ui_scale');
             $scrollwheel = Sanitize::getInt($options, 'ui_scrollwheel', 2) == '2' ? Sanitize::getBool($this->c->Config, 'geomaps.ui.scrollwheel_module', 0) : Sanitize::getBool($options, 'ui_scrollwheel');
             $doubleclick = Sanitize::getInt($options, 'ui_doubleclick', 2) == '2' ? Sanitize::getBool($this->c->Config, 'geomaps.ui.doubleclick_module', 1) : Sanitize::getBool($options, 'ui_doubleclick');
             $mapUI['title']['trim'] = Sanitize::getInt($options, 'ui_trimtitle_module', 2) == '2' ? Sanitize::getBool($this->c->Config, 'geomaps.ui.trimtitle_module', 30) : Sanitize::getBool($options, 'ui_trimtitle_module');
             $mapUI['title']['trimchars'] = Sanitize::getInt($options, 'ui_trimtitle_chars', 2) == '2' ? Sanitize::getInt($this->c->Config, 'geomaps.ui.trimtitle_chars', 30) : Sanitize::getInt($options, 'ui_trimtitle_chars');
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:67,代码来源:geomaps.php

示例7: listings

 function listings()
 {
     // Initialize variables
     $id = Sanitize::getInt($this->params, 'id');
     $option = Sanitize::getString($this->params, 'option');
     $view = Sanitize::getString($this->params, 'view');
     $menu_id = Sanitize::getString($this->params, 'Itemid');
     // Read params
     $cat_id = '';
     $criteria_ids = '';
     $in_detail_view = false;
     $detail_view = 1;
     $dir_id = Sanitize::getString($this->params, 'dir');
     $section_id = Sanitize::getString($this->params, 'section');
     $cat_id = Sanitize::getString($this->params, 'cat');
     $extension = 'com_content';
     $custom_where = null;
     $custom_fields = array();
     $click2search_auto = false;
     $cache = 0;
     $radius = 0;
     $mode = 0;
     if (isset($this->params['module'])) {
         // Read module parameters
         $click2search_auto = Sanitize::getBool($this->params['module'], 'click2search_auto', false);
         $custom_where = Sanitize::getString($this->params['module'], 'custom_where');
         $filter = Sanitize::getString($this->params['module'], 'filter');
         $detail_view = Sanitize::getString($this->params['module'], 'detail_view', 1);
         $dir_id = Sanitize::getString($this->params['module'], 'dir');
         $section_id = Sanitize::getString($this->params['module'], 'section');
         $cat_id = Sanitize::getString($this->params['module'], 'category');
         $listing_id = Sanitize::getString($this->params['module'], 'listing');
         $criteria_ids = Sanitize::getString($this->params['module'], 'criteria');
         $limit_results = Sanitize::getInt($this->params['module'], 'limit_results');
         $mode = Sanitize::getInt($this->params['module'], 'mode', 0);
         $custom_fields = str_replace(" ", "", Sanitize::getString($this->Config, 'geomaps.infowindow_fields'));
         $custom_fields = $custom_fields != '' ? explode(",", $custom_fields) : array();
         /**
          * 0 - Normal
          * 1 - GeoTargeting
          * 2 - Custom center and zoom
          */
         $radius = Sanitize::getInt($this->params['module'], 'radius');
         $cache = $mode == 1 ? 0 : Sanitize::getInt($this->params['module'], 'cache_map');
         $custom_lat = Sanitize::getFloat($this->params['module'], 'custom_lat');
         $custom_lon = Sanitize::getFloat($this->params['module'], 'custom_lon');
         if ($mode == 2 && ($custom_lat == 0 || $custom_lon == 0)) {
             echo __t("You selected the Custom Center mode, but did not specify the coordinates.");
             return;
         }
     }
     # Prevent sql injection
     $token = Sanitize::getString($this->params, 'token');
     $tokenMatch = 0 === strcmp($token, cmsFramework::formIntegrityToken($this->params, array('module', 'module_id', 'form', 'data'), false));
     $filters = $listing_id != '' || $dir_id != '' || $section_id != '' || $cat_id != '';
     if (!$filters && $id > 0 && 'article' == $view && 'com_content' == $option) {
         $sql = "SELECT catid FROM #__content WHERE id = " . $id;
         $this->_db->setQuery($sql);
         $cat_id_host_page = $this->_db->loadResult();
         if (!empty($cat_id_host_page) && $this->Category->isJreviewsCategory($cat_id_host_page)) {
             $in_detail_view = true;
             $cat_id = $cat_id_host_page;
         }
     }
     $detail_view = $this->params['module']['detail_view'] = (int) ($detail_view && $in_detail_view);
     # Custom WHERE
     $tokenMatch and $custom_where and $conditions[] = $custom_where;
     if ($click2search_auto && isset($this->params['tag'])) {
         $field = 'jr_' . Sanitize::getString($this->params['tag'], 'field');
         $value = Sanitize::getString($this->params['tag'], 'value');
         $query = "SELECT Field.type FROM #__jreviews_fields AS Field WHERE Field.name = " . $this->quote($field);
         $this->_db->setQuery($query);
         $type = $this->_db->loadResult();
         if (in_array($type, array('select', 'selectmultiple', 'checkboxes', 'radiobuttons'))) {
             $conditions[] = "Field.{$field} LIKE " . $this->quoteLike('*' . $value . '*');
         } else {
             $conditions[] = "Field.{$field} = " . $this->quote($value);
         }
     }
     # Category auto detect
     if (isset($this->params['module']) && Sanitize::getInt($this->params['module'], 'cat_auto') && $extension == 'com_content') {
         $ids = CommonController::_discoverIDs($this);
         extract($ids);
     }
     $autodetect = compact('dir_id', 'section_id', 'cat_id');
     // Check for cached version if cache enabled
     if ($cache) {
         $params = array();
         foreach ($this->params as $key => $value) {
             if ((!is_array($value) || $key == 'module') && !in_array($key, array('page', 'limit', 'order', 'Itemid'))) {
                 $params[$key] = $value;
             }
         }
         $cache_key = array_merge($params, $autodetect, Sanitize::getVar($this->params, 'tag', array()));
         $json_filename = 'geomaps_' . md5(serialize($cache_key)) . '.json';
         $json_data = S2Cache::read($json_filename);
         if ($json_data && $json_data != '') {
             $this->set('json_data', $json_data);
             S2Cache::write($json_filename, $json_data);
             return $this->render('modules', 'geomaps');
//.........这里部分代码省略.........
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:101,代码来源:module_geomaps_controller.php

示例8: __relatedlistings

 private function __relatedlistings(&$listing, &$settings, &$conditions)
 {
     $match = Sanitize::getString($settings, 'match');
     $curr_fname = Sanitize::getString($settings, 'curr_fname');
     $match_fname = Sanitize::getString($settings, 'match_fname');
     $created_by = $listing['User']['user_id'];
     $listing_id = $listing['Listing']['listing_id'];
     $title = $listing['Listing']['title'];
     $custom_order = Sanitize::getString($settings, 'custom_order');
     $custom_order and $this->Listing->order[] = $custom_order;
     switch ($match) {
         case 'id':
             // Specified field matches the current listing id
             if ($curr_fname != '') {
                 $conditions[] = "`Field`.{$curr_fname} = " . (int) $listing_id;
                 $conditions[] = 'Listing.id <> ' . $listing_id;
             } else {
                 $this->abort = true;
             }
             break;
         case 'about':
             // Specified field matches the current listing id
             if ($curr_fname != '' && ($field = Sanitize::getVar($listing['Field']['pairs'], $curr_fname))) {
                 $value = $field['type']['relatedlisting'] ? $field['real_value'][0] : $field['value'][0];
                 $conditions[] = "Listing.id = " . (int) $value;
             } else {
                 $this->abort = true;
             }
             break;
         case 'field':
             // Specified field matches the current listing field of the same name
             $field_conditions = array();
             if ($curr_fname != '' && ($field = Sanitize::getVar($listing['Field']['pairs'], $curr_fname))) {
                 foreach ($field['value'] as $value) {
                     if (in_array($field['type'], array('selectmultiple', 'checkboxes'))) {
                         $field_conditions[] = "`Field`.{$curr_fname} LIKE " . $this->quoteLike('*' . $value . '*');
                     } elseif (in_array($field['type'], array('select', 'radiobuttons'))) {
                         $field_conditions[] = "`Field`.{$curr_fname} = " . $this->quote('*' . $value . '*');
                     } elseif ($field['type'] == 'relatedlisting') {
                         $value = $field['real_value'][0];
                         $field_conditions[] = "`Field`.{$curr_fname} = " . (int) $value;
                     } else {
                         $field_conditions[] = "`Field`.{$curr_fname} = " . $this->quote($value);
                     }
                 }
                 !empty($field_conditions) and $conditions[] = '(' . implode(' OR ', $field_conditions) . ')';
                 $conditions[] = 'Listing.id <> ' . $listing_id;
             } else {
                 $this->abort = true;
             }
             break;
         case 'diff_field':
             // Specified field matches a different field in the current listing
             $curr_listing_fname = $match_fname;
             $search_listing_fname = $curr_fname;
             $field_conditions = array();
             if ($curr_listing_fname != '' && $search_listing_fname != '' && ($curr_field = Sanitize::getVar($listing['Field']['pairs'], $curr_listing_fname))) {
                 if (!($search_field = Sanitize::getVar($listing['Field']['pairs'], $search_listing_fname))) {
                     // Need to query the field type
                     $query = "SELECT fieldid AS field_id,type FROM #__jreviews_fields WHERE name = " . $this->quote($search_listing_fname);
                     $this->_db->setQuery($query);
                     $search_field = array_shift($this->_db->loadAssocList());
                 }
                 foreach ($curr_field['value'] as $value) {
                     if (in_array($search_field['type'], array('selectmultiple', 'checkboxes'))) {
                         $field_conditions[] = "`Field`.{$search_listing_fname} LIKE " . $this->quoteLike('*' . $value . '*');
                     } elseif (in_array($search_field['type'], array('select', 'radiobuttons'))) {
                         $field_conditions[] = "`Field`.{$search_listing_fname} = " . $this->quote('*' . $value . '*');
                     } elseif ($search_field['type'] == 'relatedlisting') {
                         $value = $curr_field['real_value'][0];
                         $field_conditions[] = "`Field`.{$search_listing_fname} = " . (int) $value;
                     } else {
                         $field_conditions[] = "`Field`.{$search_listing_fname} = " . $this->quote($value);
                     }
                 }
                 !empty($field_conditions) and $conditions[] = '(' . implode(' OR ', $field_conditions) . ')';
                 $conditions[] = 'Listing.id <> ' . $listing_id;
             } else {
                 $this->abort = true;
             }
             break;
         case 'title':
             // Specified field matches the current listing title
             if ($curr_fname != '') {
                 // Need to find out the field type. First check if the field exists for this listing type
                 if (!($field = Sanitize::getVar($listing['Field']['pairs'], $curr_fname))) {
                     // Need to query the field type
                     $query = "SELECT fieldid AS field_id,type FROM #__jreviews_fields WHERE name = " . $this->quote($curr_fname);
                     $this->_db->setQuery($query);
                     $field = array_shift($this->_db->loadAssocList());
                 }
                 switch ($field['type']) {
                     case 'relatedlisting':
                         $this->abort = true;
                         break;
                     case 'text':
                         $conditions[] = "`Field`.{$curr_fname} = " . $this->quote($title);
                         break;
                     case 'select':
                     case 'selectmultiple':
//.........这里部分代码省略.........
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:101,代码来源:module_listings_controller.php

示例9: str_replace

    $url_param = $url;
    $url = str_replace('menu', '', $url);
    $db = cmsFramework::getDB();
    $query = "SELECT * FROM #__menu WHERE id = " . $menu_id;
    $db->setQuery($query);
    $menu = end($db->loadObjectList());
    $mparams = getCmsVersion() == CMS_JOOMLA16 ? json_decode($menu->params, true) : stringToArray($menu->params);
    if (isset($mparams['action'])) {
        $action = paramsRoute((int) $mparams['action']);
        $_REQUEST['Itemid'] = $_GET['Itemid'] = $menu->id;
        // For default - home page menu
        unset($mparams['action']);
        $menu_params['data'] = $mparams;
        $filters = array('dir' => 'dirid', 'section' => 'sectionid', 'cat' => 'catid', 'criteria' => 'criteriaid');
        foreach ($filters as $key => $key2) {
            $menu_params[$key] = Sanitize::getVar($mparams, $key2);
            is_array($menu_params[$key]) and $menu_params[$key] = implode(',', $menu_params[$key]);
        }
        //        $menu_params['url'] = 'menu';
        $menu_params['data']['component_menu'] = true;
        $menu_params['data']['controller'] = $action[0];
        $menu_params['data']['action'] = $action[1];
    }
}
$Dispatcher = new S2Dispatcher('jreviews');
echo $Dispatcher->dispatch($menu_params);
unset($db, $User, $menu, $Dispatcher);
function paramsRoute($action)
{
    $a = array("100" => "m", "0" => array('directories', 'index'), "1" => array('categories', 'section'), "2" => array('categories', 'category'), "3" => array('listings', 'create'), "4" => array('categories', 'toprated'), "5" => array('categories', 'topratededitor'), "6" => array('categories', 'latest'), "7" => array('categories', 'popular'), "8" => array('categories', 'mostreviews'), "9" => array('categories', 'featured'), "10" => array('reviews', 'myreviews'), "11" => array('search', 'index'), "12" => array('categories', 'mylistings'), "13" => array('categories', 'favorites'), "14" => array('reviews', 'latest'), "15" => array('reviews', 'latest_user'), "16" => array('reviews', 'latest_editor'), "17" => array('discussions', 'latest'), "18" => array('reviews', 'rankings'), "19" => array('paidlistings', 'myaccount'), "20" => array('paidlistings_plans', 'index'), "21" => array('categories', 'custom'));
    return $a[$action];
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:31,代码来源:index.php

示例10: define

    if (getCmsVersion() == CMS_JOOMLA15) {
        define('_PLUGIN_DIR_NAME', 'plugins');
    } else {
        define('_PLUGIN_DIR_NAME', 'mambots');
    }
}
$query = "SELECT published,params FROM #__" . _PLUGIN_DIR_NAME . " WHERE element = 'jreviews' AND folder = 'content' LIMIT 1";
$CMS->_db->setQuery($query);
$jrbot = current($CMS->_db->loadObjectList());
$params = stringToArray($jrbot->params);
$published = $jrbot->published;
if ((int) (!$published)) {
    return;
}
$frontpageOff = Sanitize::getVar($params, 'frontpage');
$blogLayoutOff = Sanitize::getVar($params, 'blog');
# Get theme, suffix and load CSS so it's not killed by the built-in cache
if (getCmsVersion() == CMS_JOOMLA10 || getCmsVersion() == CMS_MAMBO46) {
    if ($option == 'com_content' && ($task == 'category' || $task == 'section' || $blogLayoutOff && $task == 'blogsection' || $blogLayoutOff && $task == 'blogcategory') || $frontpageOff && $option == 'com_frontpage') {
        return;
    }
} elseif ($blogLayoutOff && $option == 'com_content' && ($view == 'category' || $view == 'section') && ($layout == 'blog' || $layout == 'blogfull')) {
    return;
} elseif ($frontpageOff && $view == 'frontpage') {
    return;
}
jimport('joomla.plugin.plugin');
class plgContentJreviews extends JPlugin
{
    function plgContentJreviews(&$subject, $params)
    {
开发者ID:bizanto,项目名称:Hooked,代码行数:31,代码来源:jreviews.php

示例11: _changeOrder

 function _changeOrder()
 {
     $row_id = Sanitize::getInt($this->params, 'entry_id');
     $inc = Sanitize::getVar($this->params, 'direction');
     // Move row
     $group = $this->Group->findRow(array('conditions' => array('groupid = ' . $row_id)));
     $group['Group']['groupid'] = $group['Group']['group_id'];
     unset($group['Group']['group_id']);
     $this->Group->Result = $group;
     $this->Group->move($inc, "type = '{$group['Group']['type']}'");
     $this->data['Group']['type'] = $group['Group']['type'];
     return $this->index();
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:13,代码来源:groups_controller.php

示例12: __seo_fields

 function __seo_fields(&$page)
 {
     if ($tag = Sanitize::getVar($this->params, 'tag')) {
         $field = 'jr_' . $tag['field'];
         //            $value = $tag['value'];
         // Field value underscore fix: remove extra menu parameter not removed in routes regex
         $value = preg_replace(array('/_m[0-9]+$/', '/_m$/', '/_$/', '/:/'), array('', '', '', '-'), $tag['value']);
         $query = "\n                    SELECT \n                        fieldid,type,metatitle,metakey,metadesc \n                    FROM \n                        #__jreviews_fields \n                    WHERE \n                        name = " . $this->quote($field) . " AND `location` = 'content'\n                ";
         $this->_db->setQuery($query);
         $meta = $this->_db->loadObjectList();
         if ($meta) {
             $meta = $meta[0];
             $multichoice = array('select', 'selectmultiple', 'checkboxes', 'radiobuttons');
             if (in_array($meta->type, $multichoice)) {
                 $query = "\n                                SELECT \n                                    optionid, text \n                                FROM \n                                    #__jreviews_fieldoptions \n                                WHERE \n                                    fieldid = '{$meta->fieldid}' AND value = " . $this->quote(stripslashes($value));
                 $this->_db->setQuery($query);
                 $fieldValue = array_shift($this->_db->loadAssocList());
                 $fieldValue = $fieldValue['text'];
             } else {
                 $fieldValue = urldecode($value);
             }
             $page['title'] = $meta->metatitle == '' ? $fieldValue : str_replace("{FIELDVALUE}", $fieldValue, $meta->metatitle);
             $page['keywords'] = str_replace("{FIELDVALUE}", $fieldValue, $meta->metakey);
             $page['description'] = str_replace("{FIELDVALUE}", $fieldValue, $meta->metadesc);
             $page['show_title'] = $this->Config->seo_title;
             $page['show_description'] = $this->Config->seo_description;
         }
     }
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:29,代码来源:categories_controller.php

示例13: _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);
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:17,代码来源:common_controller.php

示例14: makeJsonObject

 /**
  * Creates the json object used for map rendering
  *     
  * @param array $results listings
  * @param mixed $fields  custom fields, required when using the GeoMaps module
  * @param mixed $options mapUI options to override globals when using GeoMaps module
  */
 function makeJsonObject(&$results, &$fields = array(), $options = array())
 {
     $www_base = array_shift(pathinfo(WWW_ROOT));
     // Required for thumbnail path
     $paths = array(S2Paths::get('jreviews', 'S2_VIEWS_OVERRIDES') . 'themes' . DS . $this->c->Config->template . DS . 'theme_images' . DS, S2Paths::get('jreviews', 'S2_VIEWS') . 'themes' . DS . $this->c->Config->template . DS . 'theme_images' . DS, S2Paths::get('jreviews', 'S2_VIEWS_OVERRIDES') . 'themes' . DS . 'default' . DS . 'theme_images' . DS, S2Paths::get('jreviews', 'S2_VIEWS') . 'themes' . DS . 'default' . DS . 'theme_images' . DS);
     $path = fileExistsInPath(array('name' => '', 'suffix' => '', 'ext' => ''), $paths);
     App::import('Helper', array('html', 'routes', 'custom_fields', 'thumbnail'));
     $Html = new HtmlHelper();
     $Routes = new RoutesHelper();
     $CustomFields = new CustomFieldsHelper();
     $Thumbnail = new ThumbnailHelper();
     $Thumbnail->app = 'jreviews';
     $Thumbnail->name = $this->c->name;
     $Thumbnail->action = $this->c->action;
     $Routes->Config = $CustomFields->Config = $Thumbnail->Config = $this->c->Config;
     $Routes->Access = $CustomFields->Access = $Thumbnail->Access = $this->c->Access;
     $Routes->Html = $CustomFields->Html = $Thumbnail->Html = $Html;
     $CustomFields->viewTheme = $Thumbnail->viewTheme =& $this->c->viewTheme;
     $CustomFields->viewSuffix =& $this->c->viewSuffix;
     // Check format of results because we may need to re-format and add fields for Geomaps module
     $first = current($results);
     if (!isset($first['Listing'])) {
         $results = $this->buildListingArray($results, $fields);
     }
     // PaidListings - remove unpaid info
     Configure::read('PaidListings') and PaidListingsComponent::processPaidData($results);
     $marker_icons = array();
     $infowindow_data = array();
     $i = 1;
     $default_icon = $this->c->name == 'categories' ? 'numbered' : 'default';
     // make sure we only have the numeric part of the id from request when checking against listing ids
     $request_id = explode(':', JRequest::getVar('id'));
     $request_id = $request_id[0];
     if (!empty($results)) {
         foreach ($results as $key => $result) {
             $results[$key] = $this->injectDistanceGroup($result);
             // Add menu id if not already there
             if (!isset($result['Listing']['menu_id'])) {
                 $results[$key]['Listing']['menu_id'] = $this->c->Menu->getCategory($result['Listing']['cat_id'], $result['Listing']['section_id'], $result['Directory']['dir_id'], $result['Listing']['listing_id']);
             }
             // Added to support extra coordinates
             //$coords = $result["Field"]["groups"]["Location Info"]["Fields"]["jr_extracoords"]["value"][0];
             //$xtracoords = $CustomFields->field('jr_extracoords', $listing, false, false);
             if (isset($result["Field"]["groups"]["Location Info"]) && isset($result["Field"]["groups"]["Location Info"]["Fields"]["jr_extracoords"])) {
                 $coords = $result["Field"]["groups"]["Location Info"]["Fields"]["jr_extracoords"]["value"][0];
                 if ($coords) {
                     $coords = json_decode($coords);
                     $results[$key]["ExtraCoords"] = $coords;
                     if (JRequest::getString("option") != "com_content") {
                         $results[$key]["ExtraCoords"] = 0;
                     }
                     // HTGMOD
                 }
             } elseif (isset($result["Field"]["pairs"]["jr_extracoords"])) {
                 //detail page
                 $coords = $result["Field"]["pairs"]["jr_extracoords"]["value"][0];
                 if ($coords) {
                     $coords = json_decode($coords);
                     $results[$key]["ExtraCoords"] = $coords;
                     if ($results[$key]["Listing"]["listing_id"] != $request_id) {
                         // "if the current listing_id in the loop == the listing_id being viewed on the detail page...."
                         $results[$key]["ExtraCoords"] = 0;
                     }
                 }
             }
             $listing_index = ($this->c->page - 1) * $this->c->limit + $i++;
             // Process and add icon info
             $icon = isset($result['Geomaps']) ? json_decode($result['Geomaps']['icon'], true) : array();
             $results[$key]['Geomaps']['icon'] = '';
             $icon_name = $default_icon;
             if (!empty($icon)) {
                 $foundIcon = false;
                 // Check if custom field assigned
                 if ($icon['field'] != '' && substr($icon['field'], 0, 3) == 'jr_') {
                     if (isset($result['Field']['pairs'][$icon['field']]) && isset($result['Field']['pairs'][$icon['field']]['image'][0])) {
                         $icon_name = substr($result['Field']['pairs'][$icon['field']]['image'][0], 0, strpos($result['Field']['pairs'][$icon['field']]['image'][0], '.'));
                         $marker_icons[$icon_name] = $results[$key]['Geomaps']['icon'] = $result['Field']['pairs'][$icon['field']]['image'][0];
                         $foundIcon = true;
                     }
                 } elseif ($icon['cat'] != '' && !$foundIcon) {
                     $icon_name = substr($icon['cat'], 0, strpos($icon['cat'], '.'));
                     if ($icon_name != 'default') {
                         $marker_icons[$icon_name] = $results[$key]['Geomaps']['icon'] = $icon['cat'];
                     }
                 }
             }
             if (isset($result['Geomaps']) && $result['Geomaps']['lat'] != '' && $result['Geomaps']['lon'] != '' && $result['Geomaps']['lat'] != 0 && $result['Geomaps']['lon']) {
                 # Create infowindow JSON object
                 // start with standard fields
                 $infowindow = array('id' => $result['Listing']['listing_id'], 'url' => str_replace(array($www_base, '&amp;'), array('', '&'), $Routes->content('', $results[$key], array('return_url' => true))), 'index' => $listing_index, 'title' => $result['Listing']['title'], 'image' => str_replace($www_base, '', $Thumbnail->thumb($result, 0, 'scale', 'list', array($this->c->Config->list_image_resize), array('return_src' => 1))), 'featured' => $result['Listing']['featured'], 'rating_scale' => $this->c->Config->rating_scale, 'user_rating' => $result['Review']['user_rating'], 'user_rating_count' => $result['Review']['user_rating_count'], 'editor_rating' => $result['Review']['editor_rating'], 'editor_rating_count' => $result['Review']['editor_rating_count'], 'lat' => (double) $result['Geomaps']['lat'], 'lon' => (double) $result['Geomaps']['lon'], 'icon' => $icon_name);
                 // Added for Hooked
                 $infowindow['criteria_id'] = $result['Criteria']['criteria_id'];
                 if (isset($results[$key]["ExtraCoords"])) {
//.........这里部分代码省略.........
开发者ID:bizanto,项目名称:Hooked,代码行数:101,代码来源:geomaps.php

示例15: loadWysiwygEditor

 function loadWysiwygEditor()
 {
     return $this->in_groups(Sanitize::getVar($this->Config, 'addnewwysiwyg'));
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:4,代码来源:access.php


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