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


PHP Sanitize::getBool方法代码示例

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


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

示例1: index

 function index($params)
 {
     $this->action = 'directory';
     // Trigger assets helper method
     if ($this->_user->id === 0) {
         $this->cacheAction = Configure::read('Cache.expires');
     }
     $page = array('title' => '', 'show_title' => 0);
     $conditions = array();
     $order = array();
     if ($menu_id = Sanitize::getInt($this->params, 'Itemid')) {
         $menuParams = $this->Menu->getMenuParams($menu_id);
         $page['title'] = Sanitize::getString($menuParams, 'title');
         $page['show_title'] = Sanitize::getString($menuParams, 'dirtitle', 0);
     }
     $override_keys = array('dir_show_alphaindex', 'dir_cat_images', 'dir_columns', 'dir_cat_num_entries', 'dir_category_hide_empty', 'dir_category_levels', 'dir_cat_format');
     if (Sanitize::getBool($menuParams, 'dir_overrides')) {
         $overrides = array_intersect_key($menuParams, array_flip($override_keys));
         $this->Config->override($overrides);
     }
     if ($this->cmsVersion == CMS_JOOMLA15) {
         $directories = $this->Directory->getTree(Sanitize::getString($this->params, 'dir'));
     } else {
         $directories = $this->Category->findTree(array('level' => $this->Config->dir_cat_format === 0 ? 2 : $this->Config->dir_category_levels, 'menu_id' => true, 'dir_id' => Sanitize::getString($this->params, 'dir'), 'pad_char' => ''));
     }
     $this->set(array('page' => $page, 'directories' => $directories));
     return $this->render('directories', 'directory');
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:28,代码来源:directories_controller.php

示例2: orderingListReviews

 function orderingListReviews($selected, $params = false)
 {
     $options_array = array('rdate' => __t("Most recent", true), 'date' => __t("Oldest", true), 'updated' => __t("Last updated", true), 'rating' => __t("Highest user rating", true), 'rrating' => __t("Lowest user rating", true), 'helpful' => __t("Most helpful", true), 'rhelpful' => __t("Least helpful", true), 'discussed' => __t("Most discussed", true));
     $orderingList = $options_array;
     if (Sanitize::getBool($params, 'return')) {
         return $orderingList;
     }
     $attributes = array('size' => '1', 'onchange' => "window.location=this.value;return false;");
     return $this->generateFormSelect($orderingList, $selected, $attributes);
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:10,代码来源:jreviews.php

示例3: orderingListReviews

 function orderingListReviews($selected, $options = array(), $params = false)
 {
     $options_array = array('rdate' => __t("Most recent", true), 'date' => __t("Oldest", true), 'rating' => __t("Highest user rating", true), 'rrating' => __t("Lowest user rating", true), 'helpful' => __t("Most helpful", true), 'rhelpful' => __t("Least helpful", true));
     if (!empty($options)) {
         foreach ($options as $key) {
             if (isset($options_array[$key])) {
                 $orderingList[$key] = $options_array[$key];
             }
         }
     } else {
         $orderingList = $options_array;
     }
     if (Sanitize::getBool($params, 'return')) {
         return $orderingList;
     }
     $attributes = array('size' => '1', 'onchange' => "window.location=this.value;return false;");
     return $this->generateFormSelect($orderingList, $selected, $attributes);
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:18,代码来源:jreviews.php

示例4: _save

 function _save()
 {
     $response = array();
     $this->data['Vote']['user_id'] = $this->_user->id;
     $this->data['Vote']['review_id'] = (int) $this->data['Vote']['review_id'];
     # Exact vote check to prevent form tampering. User can cheat the js and enter any interger, thus increasing the count
     $this->data['Vote']['vote_yes'] = Sanitize::getInt($this->data['Vote'], 'vote_yes') ? 1 : 0;
     $this->data['Vote']['vote_no'] = Sanitize::getInt($this->data['Vote'], 'vote_no') ? 1 : 0;
     $this->data['Vote']['created'] = gmdate('Y-m-d H:i:s');
     $this->data['Vote']['ipaddress'] = $this->ipaddress;
     if (!$this->data['Vote']['review_id']) {
         return $this->ajaxError(s2Messages::submitErrorGeneric());
     }
     // Find duplicates
     $duplicate = $this->Vote->findCount(array('conditions' => array('review_id = ' . $this->data['Vote']['review_id'], 'ipaddress = ' . $this->Vote->Quote($this->data['Vote']['ipaddress']))));
     // It's a guest so we only care about checking the IP address if this feature is not disabled and
     // server is not localhost
     if (!$this->_user->id) {
         if (!$this->Config->vote_ipcheck_disable && $this->ipaddress != '127.0.0.1') {
             // Do the ip address check everywhere except in localhost
             $duplicate = $this->Vote->findCount(array('conditions' => array('review_id = ' . $this->data['Vote']['review_id'], 'ipaddress = ' . $this->Vote->Quote($this->ipaddress))));
         }
     } else {
         $duplicate = $this->Vote->findCount(array('conditions' => array('review_id = ' . $this->data['Vote']['review_id'], "(user_id = {$this->_user->id}" . ($this->ipaddress != '127.0.0.1' && !$this->Config->vote_ipcheck_disable ? " OR ipaddress = " . $this->Vote->Quote($this->ipaddress) . ") " : ')'))));
     }
     if ($duplicate > 0) {
         # Hides vote buttons and shows message alert
         $response[] = "jQuery('#jr_reviewVote{$this->data['Vote']['review_id']}').fadeOut('medium',function(){\n                jQuery(this).html('" . __t("You already voted.", true, true) . "').fadeIn();\n            });";
         return $this->ajaxResponse($response);
     }
     if ($this->Vote->store($this->data)) {
         # Hides vote buttons and shows message alert
         $response[] = "jQuery('#jr_reviewVote{$this->data['Vote']['review_id']}').fadeOut('medium',function(){\n                jQuery(this).html('" . __t("Thank you for your vote.", true, true) . "').fadeIn();\n            });";
         # Facebook wall integration only for positive votes
         $facebook_integration = Sanitize::getBool($this->Config, 'facebook_enable') && Sanitize::getBool($this->Config, 'facebook_votes');
         $token = cmsFramework::getCustomToken($this->data['Vote']['review_id']);
         $facebook_integration and $this->data['Vote']['vote_yes'] and $response[] = "\n                jQuery.ajax({url:s2AjaxUri+jreviews.ajax_params()+'&url=facebook/_postVote/id:{$this->data['Vote']['review_id']}&{$token}=1',dataType:'script'});\n            ";
         return $this->ajaxResponse($response);
     }
     return $this->ajaxError(s2Messages::submitErrorDb());
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:41,代码来源:votes_controller.php

示例5: socialBookmarks

 function socialBookmarks($listing)
 {
     $googlePlusOne = $twitter = $facebook = '';
     $facebook_xfbml = Sanitize::getBool($this->Config, 'facebook_opengraph') && Sanitize::getBool($this->Config, 'facebook_appid');
     $href = cmsFramework::makeAbsUrl($listing['Listing']['url'], array('sef' => true));
     $twitter = '
         <a href="http://twitter.com/share" data-url="' . $href . '" class="twitter-share-button" data-count="horizontal">Tweet</a>
         <script type="text/javascript">jQuery(document).ready(function(){jQuery.getScript("http://platform.twitter.com/widgets.js");})</script>';
     if ($facebook_xfbml) {
         $facebook = '<fb:like href="' . $href . '" action="like" colorscheme="light" layout="button_count" show_faces="false"></fb:like>';
     } else {
         $facebook = '<script src="http://connect.facebook.net/' . cmsFramework::getLocale() . '/all.js#xfbml=1"></script><fb:like layout="button_count" show_faces="false"></fb:like>';
     }
     if ($this->Config->facebook_send) {
         $facebook .= '<div style="display:inline;margin-right: 15px;"><fb:send href="' . $href . '" colorscheme="light"></fb:send></div>';
     }
     $googlePlusOne = '
         <g:plusone href="' . $href . '" size="medium"></g:plusone>
         <script type="text/javascript" src="http://apis.google.com/js/plusone.js"></script>
     ';
     return $googlePlusOne . $twitter . $facebook;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:22,代码来源:community.php

示例6: _save


//.........这里部分代码省略.........
             $ratingErr = $criteria_qty;
         } else {
             for ($i = 0; $i < $criteria_qty; $i++) {
                 if (!isset($this->data['Rating']['ratings'][$i]) || (empty($this->data['Rating']['ratings'][$i]) || $this->data['Rating']['ratings'][$i] == 'undefined' || (double) $this->data['Rating']['ratings'][$i] > $this->Config->rating_scale)) {
                     $ratingErr++;
                 }
             }
         }
         $this->Review->validateInput('', "rating", "text", sprintf(__t("You are missing a rating in %s criteria.", true), $ratingErr), $ratingErr);
     }
     # Validate custom fields
     $review_valid_fields = $this->Field->validate($this->data, 'review', $this->Access);
     $this->Review->validateErrors = array_merge($this->Review->validateErrors, $this->Field->validateErrors);
     $this->Review->validateInput($this->data['Review']['comments'], "comments", "text", __t("You must fill in your comment.", true), $this->Config->reviewform_comment == 'required' ? true : false);
     # Validate security code
     if ($isNew && $this->Access->showCaptcha()) {
         if (!isset($this->data['Captcha']['code'])) {
             $this->Review->validateSetError("code", __t("The security code you entered was invalid.", true));
         } elseif ($this->data['Captcha']['code'] == '') {
             $this->Review->validateInput($this->data['Captcha']['code'], "code", "text", __t("You must fill in the security code.", true), 1);
         } else {
             if (!$this->Captcha->checkCode($this->data['Captcha']['code'], $this->ipaddress)) {
                 $this->Review->validateSetError("code", __t("The security code you entered was invalid.", true));
             }
         }
     }
     # Process validation errors
     $validation = $this->Review->validateGetErrorArray();
     if (!empty($validation)) {
         if ($isNew && $this->Access->showCaptcha()) {
             // Replace captcha with new instance
             $captcha = $this->Captcha->displayCode();
             $response[] = "jQuery('.jr_captcha').find('img').attr('src','{$captcha['src']}');";
             $response[] = "jQuery('.jr_captcha_code').val('');";
         }
         return $this->ajaxValidation(implode('<br />', $validation), $response);
     }
     $savedReview = $this->Review->save($this->data, $this->Access, $review_valid_fields);
     $review_id = $this->data['Review']['id'];
     // Error on review save
     if (Sanitize::getString($savedReview, 'err')) {
         return $this->ajaxError($savedReview['err']);
     }
     // Process moderated actions
     if ($isNew && $this->Access->moderateReview() && !$this->data['Review']['author'] || !$isNew && ($this->Config->moderation_review_edit && $this->Access->moderateReview()) && !$this->data['Review']['author'] || $isNew && $this->Config->moderation_editor_reviews && $this->data['Review']['author'] || !$isNew && ($this->Config->moderation_editor_review_edit && $this->Config->moderation_editor_reviews && $this->Access->moderateReview()) && $this->data['Review']['author']) {
         $target_id = $isNew ? 'jr_review0Form' : 'jr_review_' . $review_id;
         $update_text = __t("Thank you for your submission. It will be published once it is verified.", true);
         return $this->ajaxUpdatePage($target_id, $update_text, '');
     }
     // Get updated review info for non-moderated actions and plugin callback
     $fields = array('Criteria.id AS `Criteria.criteria_id`', 'Criteria.criteria AS `Criteria.criteria`', 'Criteria.state AS `Criteria.state`', 'Criteria.tooltips AS `Criteria.tooltips`', 'Criteria.weights AS `Criteria.weights`');
     $joins = $this->Listing->joinsReviews;
     // Triggers the afterFind in the Observer Model
     $this->EverywhereAfterFind = true;
     if (isset($this->viewVars['reviews'])) {
         $review = current($this->viewVars['reviews']);
     } else {
         $this->Review->runProcessRatings = true;
         $review = $this->Review->findRow(array('fields' => $fields, 'conditions' => 'Review.id = ' . $this->data['Review']['id'], 'joins' => $joins), array('afterFind'));
     }
     $this->set(array('reviewType' => 'user', 'User' => $this->_user, 'Access' => $this->Access, 'reviews' => array($review['Review']['review_id'] => $review)));
     $response = array();
     $fb_checkbox = Sanitize::getBool($this->data, 'fb_publish');
     $facebook_integration = Sanitize::getBool($this->Config, 'facebook_enable') && Sanitize::getBool($this->Config, 'facebook_reviews') && $fb_checkbox;
     // Process non moderated actions
     # New user review
     if ($isNew && !$this->data['Review']['author']) {
         $remove_class = true;
         $target_id = 'jr_user_reviews';
         $update_text = __t("Thank you for your submission.", true);
         $update_html = $this->render('reviews', 'reviews');
         # Facebook wall integration
         $token = cmsFramework::getCustomToken($review['Review']['review_id']);
         $facebook_integration and $response[] = "\n                    jQuery.get(s2AjaxUri+jreviews.ajax_params()+'&url=facebook/_postReview/id:{$review['Review']['review_id']}&{$token}=1');\n                ";
         return $this->ajaxUpdatePage($target_id, $update_text, $update_html, compact('response', 'remove_class'));
     }
     # Edited user review
     if (!$isNew && !$this->data['Review']['author']) {
         // Setup vars for post submit effects
         $target_id = 'jr_review_' . $review_id;
         $update_text = __t("Your changes were saved.", true);
         $update_html = $this->render('reviews', 'reviews');
         return $this->ajaxUpdatePage($target_id, $update_text, $update_html);
     }
     # New editor review
     if ($isNew && $this->data['Review']['author']) {
         $target_id = 'jr_review_' . $review_id;
         $update_text = Sanitize::getInt($review['Criteria'], 'state') != 2 ? __t("Thank you for your submission. Refresh the page to see your review.", true) : __t("Thank you for your submission. Refresh the page to see your comment.", true);
         # Facebook wall integration
         $token = cmsFramework::getCustomToken($review['Review']['review_id']);
         $facebook_integration and $response[] = "\n                    jQuery.get(s2AjaxUri+jreviews.ajax_params()+'&url=facebook/_postReview/id:{$review['Review']['review_id']}&{$token}=1');\n                ";
         return $this->ajaxUpdatePage($target_id, $update_text, '', compact('response'));
     }
     # Edited editor review
     if (!$isNew && $this->data['Review']['author']) {
         $target_id = 'jr_review_' . $review_id;
         $update_text = __t("Your changes were saved, refresh the page to see them.", true);
         return $this->ajaxUpdatePage($target_id, $update_text);
     }
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:101,代码来源:reviews_controller.php

示例7: _plgReviewAfterSave

 function _plgReviewAfterSave(&$model)
 {
     $content = '';
     $activity_thumb = '';
     $stream = Sanitize::getInt($this->c->Config, 'jomsocial_reviews');
     /**
      * Check if there's something to do and run the query only if necessary. Then set it in the
      * controller (viewVars) to make it available in other plugins
      */
     if ($stream || $this->points) {
         $review = $this->_getReview($model);
     }
     /**
      * Publish activity to JomSocial stream
      */
     if ($stream) {
         // Treat moderated reviews as new
         $this->inAdmin and Sanitize::getBool($model->data, 'moderation') and $model->isNew = true;
         if ($stream == 1 && (!isset($model->isNew) || !$model->isNew)) {
             return;
         }
         // Don't run for edits
         if ($stream == 1 && $review['Review']['modified'] != NULL_DATE) {
             return;
         }
         // Don't run for edits
         if ($stream == 2 && (!isset($model->isNew) || !$model->isNew) && $this->c->_user->id != $review['User']['user_id']) {
             return;
         }
         // Don't run for edits by users other than the owner of this post
         if (isset($model->isNew) && $review['Review']['published'] == 1) {
             $listing_link = $this->Html->sefLink($review['Listing']['title'], $review['Listing']['url']);
             !empty($review['Listing']['images']) and $activity_thumb = $this->Thumbnail->thumb($review, 0, array('tn_mode' => $this->c->Config->jomsocial_tnmode, 'location' => 'activity', 'dimensions' => array($this->c->Config->jomsocial_tnsize)));
             $thumb_link = $activity_thumb ? $this->Html->sefLink($activity_thumb, $review['Listing']['url']) : '';
             if (isset($model->isNew) && $model->isNew && $review['Review']['modified'] == NULL_DATE) {
                 $title = sprintf($this->activities['review_new'], $listing_link);
             } else {
                 $title = sprintf($this->activities['review_edit'], $listing_link);
             }
             if ($activity_thumb || $review['Review']['comments'] != '') {
                 $content = '<ul class="cDetailList clrfix">';
                 $thumb_link and $content .= '<li style="float:left;">' . $thumb_link . '</li>';
                 $thumb_link and $content .= '<li class="detailWrap">';
                 $review['Review']['comments'] != '' and $content .= '<div class="newsfeed-quote">' . $this->Text->truncateWords($review['Review']['comments'], 25) . '</div>';
                 $thumb_link and $content .= '</li>';
                 $content .= '</ul>';
             }
             //begin activity stream
             $act = new stdClass();
             $act->cmd = 'wall.write';
             $act->actor = $review['User']['user_id'];
             $act->target = 0;
             // no target
             $act->title = $title;
             $act->content = $content;
             $act->app = 'wall';
             $act->cid = 0;
             CFactory::load('libraries', 'activities');
             CActivityStream::add($act);
         }
     }
     if ($this->points) {
         if (isset($model->isNew) && $model->isNew && $review['Review']['published'] == 1) {
             // Begin add points
             CuserPoints::assignPoint('jreviews.review.add', $review['User']['user_id']);
         }
     }
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:68,代码来源:jomsocial.php

示例8: 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;
     $map_counter = 0;
     $default_icon = $this->c->name == 'categories' ? 'numbered' : 'default';
     if (!empty($results)) {
         $infowindow_fields = str_replace(" ", "", Sanitize::getString($this->c->Config, 'geomaps.infowindow_fields'));
         $infowindow_fields = $infowindow_fields != '' ? explode(",", $infowindow_fields) : array();
         foreach ($results as $key => $result) {
             $results[$key] = $this->injectDistanceGroup($result);
             // Override global setting for map display in lists if at least one listing has map enabled
             // For it's listing type and has valid coordinates
             if ($this->c->name == 'categories' && isset($result['ListingType']) && Sanitize::getBool($result['ListingType']['config'], 'geomaps.enable_map_list', true)) {
                 if (isset($result['Geomaps']) && abs($result['Geomaps']['lat']) > 0 && abs($result['Geomaps']['lon']) > 0) {
                     $map_counter++;
                 }
             }
             // Add menu id if not already there
             if (!isset($result['Listing']['menu_id'])) {
                 $results[$key]['Listing']['menu_id'] = $this->c->Menu->getCategory(array('cat_id' => $result['Listing']['cat_id'], 'dir_id' => $result['Directory']['dir_id'], 'section_id' => isset($result['Listing']['section_id']) ? $result['Listing']['section_id'] : null, 'listing' => $result['Listing']['listing_id']));
             }
             $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, 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);
//.........这里部分代码省略.........
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:101,代码来源:geomaps.php

示例9: _postVote

 function _postVote()
 {
     # Check if FB integration for reviews is enabled
     $facebook_integration = Sanitize::getBool($this->Config, 'facebook_enable') && Sanitize::getBool($this->Config, 'facebook_reviews');
     if (!$facebook_integration) {
         return;
     }
     $review_id = Sanitize::getInt($this->params, 'id');
     # First check - review id
     if (!$review_id) {
         return;
     }
     $facebook = $this->_getFBClass();
     # Second check - FB session
     if ($fbsession = $facebook->getSession()) {
         try {
             //get user id
             $uid = $facebook->getUser();
             $user = $facebook->api('/me');
             $fql = "SELECT publish_stream FROM permissions WHERE uid = " . $uid;
             $param = array('method' => 'fql.query', 'query' => $fql, 'callback' => '');
             $fqlResult = $facebook->api($param);
             if (!$fqlResult[0]['publish_stream']) {
                 return false;
             } else {
                 $review = $this->Review->findRow(array('conditions' => array('Review.id = ' . $review_id)), array());
                 $this->Everywhere->loadListingModel($this, $review['Review']['extension']);
                 $listing = $this->Listing->findRow(array('conditions' => array('Listing.' . $this->Listing->realKey . ' = ' . $review['Review']['listing_id'])), array('afterFind'));
                 $listing_url = $this->makeUrl($listing['Listing']['url']);
                 # Publish stream permission granted so we can post on the user's wall!
                 # Begin building the stream $fbArray
                 $fbArray = array();
                 $fbArray['method'] = 'stream.publish';
                 $fbArray['message'] = sprintf($this->activities['vote helpful'], $listing['Listing']['title']);
                 $fbArray['attachment'] = array('name' => $listing['Listing']['title'], 'href' => $listing_url, 'description' => strip_tags($review['Review']['comments']));
                 $fbArray['attachment']['properties'][__t("Website", true)] = array('text' => cmsFramework::getConfig('sitename'), 'href' => WWW_ROOT);
                 $review['Rating']['average_rating'] > 0 and $fbArray['attachment']['properties'][__t("Rating", true)] = sprintf(__t("%s stars", true), round($review['Rating']['average_rating'], 1));
                 isset($listing['Listing']['images'][0]) and $fbArray['attachment']['media'] = array(array('type' => 'image', 'src' => WWW_ROOT . _JR_WWW_IMAGES . $listing['Listing']['images'][0]['path'], 'href' => $listing_url));
                 $fbArray['attachment'] = json_encode($fbArray['attachment']);
                 $fbArray['action_links'] = json_encode(array(array('text' => __t("Read review", true), 'href' => $listing_url)));
                 $fbArray['comments_xid'] = $listing['Listing']['listing_id'];
                 if ($this->Config->facebook_optout) {
                     return "FB.ui(" . json_encode($fbArray) . ")";
                 }
                 $fb_update = $facebook->api($fbArray);
                 return true;
             }
         } catch (Exception $o) {
             // Error reading permissions
             return false;
         }
     }
     return false;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:54,代码来源:facebook_controller.php

示例10: _loadFieldData

 /**
  * Returns a json object of field options used to dynamicaly show and populate dependent fields
  *         
  */
 function _loadFieldData($json = true, $_data = array())
 {
     !empty($_data) and $this->data = $_data;
     $fields = $field_options = $selected_values = $group_ids = array();
     $selected_values_autocomplete = array();
     $dependent_fields = $dependent_groups = $control_fields = $fields = $responses = array();
     $location = strtolower(Sanitize::getString($this->data, 'fieldLocation', 'content'));
     $location == 'listing' and $location = 'content';
     $recursive = Sanitize::getBool($this->data, 'recursive');
     $field_names = Sanitize::getVar($this->data, 'fields');
     $control_field = $field_names = is_array($field_names) ? array_filter($field_names) : array($field_names);
     $page_setup = Sanitize::getInt($this->data, 'page_setup', false);
     $control_value = Sanitize::getVar($this->data, 'value');
     $entry_id = Sanitize::getInt($this->data, 'entry_id');
     $referrer = Sanitize::getString($this->data, 'referrer');
     $edit = (bool) $entry_id || is_array($control_value);
     // In adv. search module we make it work like edit for previously searched values which are passed as an array in $control_value
     # Access check
     # Need to pass token to validate the listing id and check user access.
     # Filter passed field names to fix those with double underscores which are checkboxes and radiobuttons
     foreach ($field_names as $key => $name) {
         if (substr_count($name, '_') > 1) {
             $tmp = explode('_', $name);
             array_pop($tmp);
             $field_names[$key] = implode('_', $tmp);
         }
     }
     $field_names = array_unique($field_names);
     /** 
      * We are in edit mode. Find selected values
      */
     if ($page_setup && $entry_id > 0) {
         # PaidListings integration
         if ($location == 'content' && Configure::read('PaidListings.enabled') && PaidPlanCategoryModel::isInPaidCategoryByListingId($entry_id)) {
             // Load the paid_listing_fields table instead of the jos_content table so users can see all their
             // fields when editing a listing
             Configure::write('ListingEdit', false);
             $curr_field_values = PaidListingFieldModel::edit($entry_id);
             if ($curr_field_values && !empty($curr_field_values)) {
                 $curr_field_values = (array) array_shift($curr_field_values);
                 $curr_field_values['contentid'] = $curr_field_values['element_id'];
                 unset($curr_field_values['element_id'], $curr_field_values['email']);
             }
         }
         if (empty($curr_field_values)) {
             $query = $location == 'content' ? "SELECT * FROM #__jreviews_content WHERE contentid = {$entry_id}" : "SELECT * FROM #__jreviews_review_fields WHERE reviewid = {$entry_id}";
             $this->_db->setQuery($query);
             $curr_field_values = array_shift($this->_db->loadAssocList());
         }
         if (!empty($curr_field_values)) {
             foreach ($curr_field_values as $key => $val) {
                 if (substr($key, 0, 3) == 'jr_') {
                     $selected_values[$key] = $val != '' ? is_array($val) ? $val : array($val) : array();
                 }
             }
         }
     } elseif (is_array($control_value)) {
         $selected_values = $control_value;
         $control_value = '';
     }
     /****************************************************************************************
      *  Control field option selected, so we find all dependent fields and groups
      *  Need to look in FieldOptions, Fields and FieldGroups
      ****************************************************************************************/
     if (!$page_setup) {
         # Find dependent FieldOptions
         $query = "\r\n                SELECT \r\n                    DISTINCT Field.name\r\n                FROM \r\n                    #__jreviews_fieldoptions AS FieldOption\r\n                LEFT JOIN\r\n                    #__jreviews_fields AS Field ON Field.fieldid = FieldOption.fieldid AND (\r\n                        Field.published = 1 AND Field.location = " . $this->quote($location) . "\r\n                    )\r\n                LEFT JOIN\r\n                    #__jreviews_groups AS FieldGroup ON Field.groupid = FieldGroup.groupid\r\n                WHERE\r\n                    Field.published = 1 AND Field.location = " . $this->quote($location) . "\r\n                    AND FieldOption.control_field = " . $this->quote($control_field) . " AND FieldOption.control_value LIKE " . $this->quoteLike('*' . $control_value . '*') . "\r\n                ORDER BY \r\n                    FieldGroup.ordering, Field.ordering \r\n            ";
         $this->_db->setQuery($query);
         $field_names = $this->_db->loadResultArray();
         # Find dependent Fields
         $query = "\r\n                SELECT \r\n                    DISTINCT Field.name\r\n                FROM \r\n                    #__jreviews_fields AS Field\r\n                LEFT JOIN\r\n                    #__jreviews_groups AS FieldGroup ON Field.groupid = FieldGroup.groupid\r\n                WHERE\r\n                    Field.published = 1 AND Field.location = " . $this->quote($location) . "\r\n                    AND Field.control_field = " . $this->quote($control_field) . " AND Field.control_value LIKE " . $this->quoteLike('*' . $control_value . '*') . "\r\n                ORDER BY \r\n                    FieldGroup.ordering, Field.ordering \r\n            ";
         $this->_db->setQuery($query);
         $field_names = is_array($field_names) ? array_merge($field_names, $this->_db->loadResultArray()) : $this->_db->loadResultArray();
         # Find depedent Field Groups
         $query = "\r\n                SELECT DISTINCT\r\n                   FieldGroup.groupid\r\n                FROM \r\n                    #__jreviews_groups AS FieldGroup\r\n                LEFT JOIN\r\n                    #__jreviews_fields AS Field ON Field.groupid = FieldGroup.groupid\r\n                WHERE\r\n                    Field.published = 1 AND Field.location = " . $this->quote($location) . "  \r\n                    AND FieldGroup.type = " . $this->quote($location) . "\r\n                    AND FieldGroup.control_field = " . $this->quote($control_field) . "\r\n                    AND FieldGroup.control_value LIKE " . $this->quoteLike('*' . $control_value . '*') . "\r\n                ORDER BY\r\n                    FieldGroup.ordering\r\n           ";
         $this->_db->setQuery($query);
         $group_ids = $this->_db->loadResultArray();
         !empty($field_names) and $field_names = array_unique($field_names);
         if (empty($field_names) && empty($group_ids)) {
             return json_encode(compact('control_field', 'dependent_fields', 'dependent_groups', 'data'));
         }
     }
     # Get info for all fields
     $query = "\r\n            SELECT \r\n                Field.fieldid, Field.groupid, Field.title, Field.name, Field.type, Field.options, Field.control_field, Field.control_value, FieldGroup.name AS group_name\r\n            FROM \r\n                #__jreviews_fields AS Field \r\n            LEFT JOIN\r\n                #__jreviews_groups AS FieldGroup ON Field.groupid = FieldGroup.groupid\r\n            WHERE \r\n                Field.published = 1 AND Field.location = " . $this->quote($location) . "\r\n                AND (\r\n                    " . (!empty($field_names) ? "Field.name IN (" . $this->quote($field_names) . ")" : '') . "\r\n                    " . (!empty($field_names) && !empty($group_ids) ? " OR " : '') . "\r\n                    " . (!empty($group_ids) ? "Field.groupid IN (" . $this->quote($group_ids) . ")" : '') . "\r\n                )\r\n            ORDER BY \r\n                FieldGroup.ordering, Field.ordering\r\n        ";
     $this->_db->setQuery($query);
     $curr_form_fields = $this->_db->loadAssocList('name');
     if (empty($curr_form_fields)) {
         return json_encode(compact('control_field', 'dependent_fields', 'dependent_groups', 'data'));
     }
     foreach ($curr_form_fields as $key => $curr_form_field) {
         $curr_form_fields[$key]['options'] = stringToArray($curr_form_field['options']);
     }
     /****************************************************************************************
      *  Check if fields have any dependents to avoid unnecessary ajax requests 
      *  Three tables need to be checked: fieldoptions, fields, and fieldgroups
      ****************************************************************************************/
//.........这里部分代码省略.........
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:101,代码来源:fields_controller.php

示例11: beforeFilter

 function beforeFilter()
 {
     # These should be called in each controller where they are required instead of globally
     $this->_db = cmsFramework::getDB();
     $this->_user = cmsFramework::getUser();
     # Overcome host restrictions
     $query = "SET SQL_BIG_SELECTS=1";
     $this->_db->setQuery($query);
     $this->_db->query();
     # Fix Joomla bug when language filter is active with default language code hidden in url
     if (isset($this->params['lang'])) {
         $this->params['lang'] = cmsFramework::getUrlLanguageCode();
     }
     # Init Access
     if (isset($this->Access)) {
         $this->Access->init($this->Config);
     }
     App::import('Component', 'theming', 'jreviews');
     $this->Theming = ClassRegistry::getClass('ThemingComponent');
     $this->Theming->startup($this);
     # Set pagination vars
     // First check url, then menu parameter. Otherwise the limit list in pagination doesn't respond b/c menu params always wins
     $this->limit = Sanitize::getInt($this->params, 'limit', Sanitize::getInt($this->data, 'limit_special', Sanitize::getInt($this->data, 'limit')));
     //		$this->passedArgs['limit'] = $this->limit;
     $this->page = Sanitize::getInt($this->data, 'page', Sanitize::getInt($this->params, 'page', 1));
     if (!$this->limit) {
         if (Sanitize::getVar($this->params, 'action') == 'myreviews') {
             $this->limit = Sanitize::getInt($this->params, 'limit', $this->Config->user_limit);
             $this->params['default_limit'] = $this->Config->user_limit;
         } else {
             $this->limit = Sanitize::getInt($this->params, 'limit', $this->Config->list_limit);
             $this->params['default_limit'] = $this->Config->list_limit;
         }
     }
     if (Sanitize::getVar($this->params, 'action') == 'myreviews') {
         $this->params['default_limit'] = $this->Config->user_limit;
     } else {
         $this->params['default_limit'] = $this->Config->list_limit;
     }
     // Set a hard code limit to prevent abuse
     $this->limit = max(min($this->limit, 50), 1);
     // Need to normalize the limit var for modules
     if (isset($this->params['module'])) {
         $module_limit = Sanitize::getInt($this->params['module'], 'module_limit', 5);
     } else {
         $module_limit = 5;
     }
     $this->module_limit = Sanitize::getInt($this->data, 'module_limit', $module_limit);
     $this->module_page = Sanitize::getInt($this->data, 'module_page', 1);
     $this->module_page = $this->module_page === 0 ? 1 : $this->module_page;
     $this->module_offset = (int) ($this->module_page - 1) * $this->module_limit;
     if ($this->module_offset < 0) {
         $this->module_offset = 0;
     }
     $this->page = $this->page === 0 ? 1 : $this->page;
     $this->offset = (int) ($this->page - 1) * $this->limit;
     if ($this->offset < 0) {
         $this->offset = 0;
     }
     # Required further below for Community Model init
     if (!isset($this->Menu)) {
         App::import('Model', 'menu', 'jreviews');
         $this->Menu = ClassRegistry::getClass('MenuModel');
     }
     if (!$this->ajaxRequest) {
         if (!($menu_id = Configure::read('_public_menu_id'))) {
             # Find and set one public Itemid to use for Ajax requests
             $menu_id = '';
             $menu_id = $this->Menu->get('jreviews_public');
             $menu_id = $menu_id != '' ? $menu_id : 99999;
             Configure::write('_public_menu_id', $menu_id);
         }
         if (!($search_itemid = Configure::read('_search_itemid'))) {
             // Set search menu Itemid used in several of the controllers
             $option = Sanitize::getString($this->params, 'option');
             $auto_itemid = Sanitize::getBool($this->Config, 'search_itemid', false);
             $hc_itemid = Sanitize::getInt($this->Config, 'search_itemid_hc', '');
             $search_menuid = $this->Menu->get('jr_advsearch');
             $search_itemid = '';
             switch ($option) {
                 case 'com_jreviews':
                     // page Itemid is enabled
                     if (!$auto_itemid && $hc_itemid > 0) {
                         $search_itemid = $hc_itemid;
                     } elseif (!$auto_itemid & $search_menuid > 0) {
                         $search_itemid = $search_menuid;
                     }
                     break;
                 default:
                     // Non-JReviews pages - can't use current page Itemid
                     if ($hc_itemid > 0) {
                         $search_itemid = $hc_itemid;
                     } else {
                         $search_itemid = $search_menuid;
                     }
                     break;
             }
             $search_itemid == '' and $option == 'com_jreviews' and $search_itemid = Sanitize::getString($this->params, 'Itemid');
             Configure::write('_search_itemid', $search_itemid);
         }
//.........这里部分代码省略.........
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:101,代码来源:my_controller.php

示例12: search


//.........这里部分代码省略.........
                         if ($isDate) {
                             @($searchValues[1] = low($searchValues[2]) == 'today' ? _TODAY : $searchValues[2]);
                             @($searchValues[2] = low($searchValues[3]) == 'today' ? _TODAY : $searchValues[3]);
                         }
                         $low = is_numeric($searchValues[1]) ? $searchValues[1] : $this->quote($searchValues[1]);
                         $high = is_numeric($searchValues[2]) ? $searchValues[2] : $this->quote($searchValues[2]);
                         $wheres[] = "\n" . $key . " BETWEEN " . $low . ' AND ' . $high;
                     } else {
                         if ($searchValues[1] == "date") {
                             $searchValues[1] = low($searchValues[2]) == 'today' ? _TODAY : $searchValues[2];
                         }
                         $value = is_numeric($searchValues[1]) ? $searchValues[1] : $this->quote($searchValues[1]);
                         $wheres[] = "\n" . $key . $allowedOperators[$operator] . $value;
                     }
                 } else {
                     // This is a field with pre-defined options
                     $whereFields = array();
                     if (isset($tag) && ($key = 'jr_' . $tag['field'])) {
                         // Field value underscore fix
                         if (in_array($fieldType, $OR_fields)) {
                             $whereFields[] = " {$key} = '*" . $this->quote('*' . urldecode($value) . '*');
                         } else {
                             $whereFields[] = " {$key} LIKE " . $this->quote('%*' . urldecode($value) . '*%');
                         }
                     } elseif (!empty($searchValues)) {
                         foreach ($searchValues as $value) {
                             $searchValue = urldecode($value);
                             if (in_array($fieldType, $OR_fields)) {
                                 $whereFields[] = " {$key} = " . $this->quote('*' . $value . '*');
                             } else {
                                 $whereFields[] = " {$key} LIKE " . $this->quote('%*' . $value . '*%');
                             }
                         }
                     }
                     if (in_array($fieldType, $OR_fields)) {
                         // Single option field
                         $wheres[] = '(' . implode(') OR (', $whereFields) . ')';
                     } else {
                         // Multiple option field
                         $wheres[] = '(' . implode(') AND (', $whereFields) . ')';
                     }
                 }
             } else {
                 $value = urldecode($value);
                 $whereFields = array();
                 if (in_array($fieldType, $OR_fields)) {
                     $whereFields[] = " {$key} = " . $this->quote('*' . $value . '*');
                 } elseif (in_array($fieldType, $AND_fields)) {
                     $whereFields[] = " {$key} LIKE " . $this->quote('%*' . $value . '*%');
                 } elseif (in_array($fieldType, array('integer', 'decimal'))) {
                     // Does an exact search for numeric fields
                     $words = explode(' ', trim($value));
                     foreach ($words as $word) {
                         $whereFields[] = "{$key} = " . $this->quote($word);
                     }
                 } else {
                     $whereFields[] = " {$key} LIKE " . $this->quoteLike($value);
                 }
                 $wheres[] = " (" . implode(') AND (', $whereFields) . ")";
             }
         }
         // endforeach
     }
     $where = !empty($wheres) ? "\n (" . implode(") AND (", $wheres) . ")" : '';
     // Determine which categories to include in the queries
     if ($cat_id = Sanitize::getString($this->params, 'cat')) {
         $section_ids = array();
         $category_ids = explode($urlSeparator, $this->params['cat']);
         // Remove empty or nonpositive values from array
         if (!empty($category_ids)) {
             foreach ($category_ids as $index => $value) {
                 // Check if it's a section
                 if ($value[0] == 's' && is_numeric(substr($value, 1)) && substr($value, 1) > 0) {
                     $section_ids[] = substr($value, 1);
                     unset($category_ids[$index]);
                     // It's a section, not a category
                 } elseif (empty($value) || $value < 1 || !is_numeric($value)) {
                     unset($category_ids[$index]);
                 }
             }
         }
         $section_ids = implode(',', $section_ids);
         $category_ids = is_array($category_ids) ? implode(',', $category_ids) : $category_ids;
         $category_ids != '' and $this->params['cat'] = $category_ids;
         $section_ids != '' and $this->params['section'] = $section_ids;
     } elseif (isset($criteria_ids) && trim($criteria_ids) != '') {
         $criteria_ids = str_replace($urlSeparator, ',', $criteria_ids);
         $criteria_ids != '' and $this->params['criteria'] = $criteria_ids;
     } elseif (isset($dir_id) && trim($dir_id) != '') {
         $dir_id = str_replace($urlSeparator, ',', $dir_id);
         $dir_id != '' and $this->params['dir'] = $dir_id;
     }
     # Add search conditions to Listing model
     if ($where != '') {
         $this->Listing->conditions[] = $where;
     } elseif (empty($this->Listing->conditions) && $dir_id == '' && $category_ids == '' && $criteria_ids == '' && ($this->cmsVersion == CMS_JOOMLA15 && $section_ids == '' || $this->cmsVersion != CMS_JOOMLA15) && !Sanitize::getBool($this->Config, 'search_return_all', false)) {
         return $this->render('listings', 'listings_noresults');
     }
     return $this->listings();
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:101,代码来源:categories_controller.php

示例13: makeJsonObject


//.........这里部分代码省略.........
                 // Added for Hooked
                 $infowindow['criteria_id'] = $result['Criteria']['criteria_id'];
                 if (isset($results[$key]["ExtraCoords"])) {
                     $infowindow['extracoords'] = $results[$key]["ExtraCoords"];
                 }
                 if (isset($results[$key]['Listing']['relations'])) {
                     $infowindow['relations'] = $results[$key]['Listing']['relations'];
                 }
                 if ($results[$key]['Listing']['section_id'] != 1) {
                     $infowindow['hascontent'] = 1;
                 } else {
                     if (isset($results[$key]['Listing']['summary']) && $results[$key]['Listing']['summary'] != '') {
                         $infowindow['hascontent'] = 1;
                     } else {
                         $infowindow['hascontent'] = 0;
                     }
                 }
                 if (!empty($result['Field']['pairs'])) {
                     foreach ($result['Field']['pairs'] as $name => $fieldArray) {
                         $infowindow['field'][$name] = $CustomFields->field($name, $result);
                     }
                 }
                 $infowindow_data['id' . $result['Listing']['listing_id']] = $infowindow;
             }
         }
     }
     $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');
开发者ID:bizanto,项目名称:Hooked,代码行数:67,代码来源:geomaps.php

示例14: select

 function select($fieldName, $options = array(), $selected = null, $attributes = array())
 {
     $sel = '';
     if (!is_null($selected) && $selected != '') {
         if (!is_array($selected)) {
             $selected = array(strtolower($selected));
         }
     } else {
         if (isset($attributes['value'])) {
             if (!is_array($attributes['value'])) {
                 $selected = array(strtolower($attributes['value']));
             } else {
                 $selected = $attributes['value'];
             }
             unset($attributes['value']);
         }
     }
     if (isset($attributes['multiple'])) {
         $select = sprintf($this->Html->tags['selectmultiplestart'], $fieldName, $this->_parseAttributes($attributes));
         unset($attributes['multiple']);
     } else {
         $select = sprintf($this->Html->tags['selectstart'], $fieldName, $this->_parseAttributes($attributes));
     }
     foreach ($options as $value => $text) {
         $disabled = false;
         $sel = '';
         if (is_array($text) || is_object($text)) {
             $text = (array) $text;
             $disabled = Sanitize::getBool($text, 'disabled', false);
             if (!isset($text['text'])) {
                 $text = current($text);
             }
             $value = isset($text['value']) ? $text['value'] : $value;
             $text = $text['text'];
             // For CMS db query results w/o having to do an additional foreach
         }
         $text = htmlspecialchars($text, ENT_QUOTES, 'utf-8', false);
         # Multiple select list
         if ($selected && is_array($selected)) {
             $sel = deep_in_array($value, $selected, true) ? ' selected="selected"' : '';
             # Single select list
         } elseif ($selected) {
             $sel = $value == $selected ? ' selected="selected"' : '';
         }
         $disabled and $sel .= ' disabled="disabled"';
         $select .= sprintf($this->Html->tags['selectoption'], $value, $sel, $text);
     }
     $select .= $this->Html->tags['selectend'];
     return $select;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:50,代码来源:form.php

示例15: store

 function store(&$data, $updateNulls = false, $callbacks = array('beforeSave', 'afterSave', 'plgBeforeSave', 'plgAfterSave'))
 {
     Sanitize::getBool($data, 'insert') and $insert = true or $insert = false;
     if (method_exists($this, 'beforeSave') && in_array('beforeSave', $callbacks)) {
         $this->beforeSave($data);
     }
     if (method_exists($this, 'plgBeforeSave') && in_array('plgBeforeSave', $callbacks)) {
         $data = $this->plgBeforeSave($data);
     }
     $table = substr($this->useTable, 0, strpos($this->useTable, ' AS'));
     $primaryKeyString = isset($this->realKey) ? $this->realKey : $this->primaryKey;
     $keyName = end(explode('.', str_replace('`', '', $primaryKeyString)));
     if (isset($data[$this->name][$keyName]) && $data[$this->name][$keyName] > 0 && !$insert) {
         $ret = $this->update($table, $this->name, $data, $keyName, $updateNulls);
     } else {
         $ret = $this->insert($table, $this->name, $data, $keyName);
     }
     if (!$ret) {
         $this->_error = strtolower(get_class($this)) . "::store failed <br />" . $this->_db->getErrorMsg();
     }
     $this->data =& $data;
     if (method_exists($this, 'afterSave') && in_array('afterSave', $callbacks)) {
         $this->afterSave($ret);
     }
     if (method_exists($this, 'plgAfterSave') && in_array('plgAfterSave', $callbacks)) {
         $this->plgAfterSave($ret);
     }
     clearCache('', 'views');
     clearCache('', '__data');
     return $ret;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:31,代码来源:model.php


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