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


PHP CommonController::_discoverIDs方法代码示例

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


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

示例1: index

 function index($params)
 {
     /*        if($this->_user->id === 0) 
             {
                 $this->cacheAction = Configure::read('Cache.expires');        
             }*/
     $this->action = 'directory';
     // Set view file
     # Read module params
     $dir_id = isset($this->params['module']) ? cleanIntegerCommaList(Sanitize::getString($this->params['module'], 'dir_ids')) : '';
     $conditions = array();
     $order = array();
     $cat_id = '';
     $section_id = '';
     if ($this->cmsVersion == CMS_JOOMLA15) {
         $directories = $this->Directory->getTree($dir_id, true);
     } else {
         $directories = $this->Category->findTree(array('level' => $this->Config->dir_category_levels, 'menu_id' => true, 'dir_id' => $dir_id, 'pad_char' => ''));
     }
     if ($menu_id = Sanitize::getInt($this->params, 'Itemid')) {
         $menuParams = $this->Menu->getMenuParams($menu_id);
     }
     # Category auto detect
     $ids = CommonController::_discoverIDs($this);
     extract($ids);
     if ($this->cmsVersion == CMS_JOOMLA15 && ($cat_id != '' && $section_id == '')) {
         $cat_id = cleanIntegerCommaList($cat_id);
         $sql = "SELECT section FROM #__categories WHERE id IN (" . $cat_id . ")";
         $this->_db->setQuery($sql);
         $section_id = $this->_db->loadResult();
     }
     $this->set(array('directories' => $directories, 'dir_id' => $dir_id, 'cat_id' => is_numeric($cat_id) && $cat_id > 0 ? $cat_id : false, 'section_id' => $section_id));
     return $this->render('modules', 'directories');
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:34,代码来源:module_directories_controller.php

示例2: index

 function index($params)
 {
     $this->action = 'directory';
     // Set view file
     # Read module params
     $dir_id = cleanIntegerCommaList(Sanitize::getString($this->params['module'], 'dir_ids'));
     $conditions = array();
     $order = array();
     $cat_id = '';
     $section_id = '';
     $directories = $this->Directory->getTree($dir_id, true);
     if ($menu_id = Sanitize::getInt($this->params, 'Itemid')) {
         $menuParams = $this->Menu->getMenuParams($menu_id);
     }
     # Category auto detect
     $ids = CommonController::_discoverIDs($this);
     extract($ids);
     if ($cat_id != '' && $section_id == '') {
         $cat_id = cleanIntegerCommaList($cat_id);
         $sql = "SELECT section FROM #__categories WHERE id IN (" . $cat_id . ")";
         $this->_db->setQuery($sql);
         $section_id = $this->_db->loadResult();
     }
     $this->set(array('directories' => $directories, 'cat_id' => is_numeric($cat_id) && $cat_id > 0 ? $cat_id : false, 'section_id' => $section_id));
     return $this->render('modules', 'directories');
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:26,代码来源:module_directories_controller.php

示例3: index

 function index()
 {
     global $Itemid;
     $cat_id = null;
     $conditions = array();
     $joins = array();
     $order = array();
     $menu_id = '';
     // Read module params
     $dir_id = Sanitize::getString($this->params['module'], 'dir');
     $section_id = Sanitize::getString($this->params, 'section');
     $cat_id = Sanitize::getString($this->params['module'], 'cat');
     $criteria_id = Sanitize::getString($this->params['module'], 'criteria');
     $itemid_options = Sanitize::getString($this->params['module'], 'itemid_options');
     $itemid_hc = Sanitize::getInt($this->params['module'], 'hc_itemid');
     $field = Sanitize::getString($this->params['module'], 'field');
     $option_length = Sanitize::getInt($this->params['module'], 'fieldoption_length');
     $custom_params = Sanitize::getString($this->params['module'], 'custom_params');
     $sort = Sanitize::getString($this->params['module'], 'fieldoption_order');
     # Set menu id
     switch ($itemid_options) {
         case 'none':
             $menu_id = '';
             break;
         case 'current':
             break;
         case 'hardcode':
             $menu_id = $itemid_hc;
             break;
     }
     # Category auto detect
     if (Sanitize::getInt($this->params['module'], 'catauto')) {
         $ids = CommonController::_discoverIDs($this);
         extract($ids);
     }
     $this->FieldOption->modelUnbind(array('FieldOption.value AS `FieldOption.value`', 'FieldOption.fieldid AS `FieldOption.fieldid`', 'FieldOption.image AS `FieldOption.image`', 'FieldOption.ordering AS `FieldOption.ordering`', 'FieldOption.optionid AS `FieldOption.optionid`', 'FieldOption.text AS `FieldOption.text`'));
     $fields[] = 'FieldOption.optionid AS `FieldOption.optionid`';
     $fields[] = 'FieldOption.value AS `FieldOption.value`';
     if ($option_length) {
         $fields[] = 'IF(CHAR_LENGTH(FieldOption.text)>' . $option_length . ',CONCAT(SUBSTR(FieldOption.text,1,' . $option_length . '),"..."),FieldOption.text) AS `FieldOption.text`';
     } else {
         $fields[] = 'FieldOption.text AS `FieldOption.text`';
     }
     $joins[] = 'INNER JOIN #__jreviews_fields AS Field ON Field.fieldid = FieldOption.fieldid';
     $order[] = 'FieldOption.' . $sort;
     $field_options = $this->FieldOption->findAll(array('fields' => $fields, 'conditions' => 'Field.name = "' . $field . '"', 'joins' => $joins, 'order' => $order));
     # Send variables to view template
     $this->set(array('field' => $field, 'field_options' => $field_options, 'section_ids' => $section_id, 'category_ids' => $cat_id, 'criteria_id' => $criteria_id, 'menu_id' => $menu_id, 'custom_params' => $custom_params));
     return $this->render('modules', 'fields');
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:50,代码来源:module_fields_controller.php

示例4: index

 function index()
 {
     global $Itemid;
     $cat_id = null;
     $conditions = array();
     $joins = array();
     $order = array();
     $menu_id = '';
     // Read module params
     $itemid_options = Sanitize::getString($this->params['module'], 'itemid_options');
     $itemid_hc = Sanitize::getInt($this->params['module'], 'hc_itemid');
     $field = Sanitize::getString($this->params['module'], 'field');
     $custom_params = Sanitize::getString($this->params['module'], 'custom_params');
     $dir_id = Sanitize::getString($this->params['module'], 'dir');
     $section_id = Sanitize::getString($this->params, 'section');
     $cat_id = Sanitize::getString($this->params['module'], 'cat');
     $criteria_id = Sanitize::getString($this->params['module'], 'criteria');
     # Set menu id
     switch ($itemid_options) {
         case 'none':
             $menu_id = '';
             break;
         case 'current':
             break;
         case 'hardcode':
             $menu_id = $itemid_hc;
             break;
     }
     # Category auto detect
     if (Sanitize::getInt($this->params['module'], 'catauto')) {
         $ids = CommonController::_discoverIDs($this);
         extract($ids);
     }
     # Send variables to view template
     $this->set(array('field' => $field, 'dir_id' => $dir_id, 'section_ids' => $section_id, 'category_ids' => $cat_id, 'criteria_id' => $criteria_id, 'menu_id' => $menu_id, 'custom_params' => $custom_params));
     return $this->render('modules', 'range');
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:37,代码来源:module_range_controller.php

示例5: 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

示例6: index

 function index()
 {
     /*        if($this->_user->id === 0) 
             {
                 $this->cacheAction = Configure::read('Cache.expires');        
             }*/
     // Required for ajax pagination to remember module settings
     $ids = $conditions = $joins = $order = $having = array();
     $module_id = Sanitize::getInt($this->params, 'module_id', Sanitize::getInt($this->data, 'module_id'));
     if (!isset($this->params['module'])) {
         $this->params['module'] = array();
     }
     // For direct calls to the controller
     # Find the correct set of params to use
     if ($this->ajaxRequest && Sanitize::getInt($this->params, 'listing_id')) {
         $this->params['module'] = array_merge($this->params['module'], $this->__processListingTypeWidgets($conditions));
     } elseif ($this->ajaxRequest && empty($this->params['module']) && $module_id) {
         $query = "SELECT params FROM #__modules WHERE id = " . $module_id;
         $this->_db->setQuery($query);
         $this->params['module'] = stringToArray($this->_db->loadResult());
     }
     if ($this->abort) {
         return $this->ajaxResponse('', false);
     }
     # Read module parameters
     $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');
     $created_by = Sanitize::getString($this->params['module'], 'owner');
     $criteria_id = Sanitize::getString($this->params['module'], 'criteria');
     $limit = Sanitize::getInt($this->params['module'], 'module_limit', 5);
     $total = min(50, Sanitize::getInt($this->params['module'], 'module_total', 10));
     $extension = Sanitize::getString($this->params['module'], 'extension');
     $extension = $extension != '' ? $extension : 'com_content';
     $sort = Sanitize::getString($this->params['module'], 'listing_order');
     if (in_array($sort, array('random', 'featuredrandom'))) {
         srand((double) microtime() * 1000000);
         $this->params['rand'] = rand();
     }
     # Prevent sql injection
     $token = Sanitize::getString($this->params, 'token');
     $tokenMatch = 0 === strcmp($token, cmsFramework::formIntegrityToken($this->params, array('module', 'module_id', 'form', 'data'), false));
     isset($this->params['module']) and $this->viewSuffix = Sanitize::getString($this->params['module'], 'tmpl_suffix');
     if (isset($this->Listing)) {
         $this->Listing->_user = $this->_user;
         // This parameter determines the module mode
         $custom_order = Sanitize::getString($this->params['module'], 'custom_order');
         $custom_where = Sanitize::getString($this->params['module'], 'custom_where');
         if ($extension != 'com_content' && in_array($sort, array('topratededitor', 'featuredrandom', 'rhits'))) {
             echo "You have selected the {$sort} mode which is not supported for components other than com_content. Please read the tooltips in the module parameters for more info on allowed settings.";
             return;
         }
         # Category auto detect
         if (Sanitize::getInt($this->params['module'], 'cat_auto') && $extension == 'com_content') {
             $ids = CommonController::_discoverIDs($this);
             extract($ids);
         }
         # Set conditionals based on configuration parameters
         if ($extension == 'com_content') {
             // Perform tag replacement for listing_id to allow for related listing queries
             if (Sanitize::getString($this->params, 'view') == 'article' && $custom_where != '') {
                 $curr_listing_id = Sanitize::getInt($this->params, 'id');
                 $custom_where = str_replace('{listing_id}', $curr_listing_id, $custom_where);
             }
             // Only works for core articles
             $conditions = array_merge($conditions, array('Listing.state = 1', '( Listing.publish_up = "' . NULL_DATE . '" OR DATE(Listing.publish_up) <= DATE("' . _CURRENT_SERVER_TIME . '") )', '( Listing.publish_down = "' . NULL_DATE . '" OR DATE(Listing.publish_down) >= DATE("' . _CURRENT_SERVER_TIME . '") )'));
             if ($this->cmsVersion == CMS_JOOMLA15) {
                 //                    $conditions[] = 'Section.access <= ' . $this->Access->getAccessId();
                 $conditions[] = 'Category.access <= ' . $this->Access->getAccessId();
                 $conditions[] = 'Listing.access <= ' . $this->Access->getAccessId();
             } else {
                 $conditions[] = 'Category.access IN (' . $this->Access->getAccessLevels() . ')';
                 $conditions[] = 'Listing.access IN (' . $this->Access->getAccessLevels() . ')';
             }
             // Remove unnecessary fields from model query
             $this->Listing->modelUnbind(array('Listing.fulltext AS `Listing.description`', 'Listing.metakey AS `Listing.metakey`', 'Listing.metadesc AS `Listing.metadesc`', 'User.email AS `User.email`'));
             if (!empty($cat_id)) {
                 $conditions[] = $this->cmsVersion == CMS_JOOMLA15 ? 'Listing.catid IN (' . cleanIntegerCommaList($cat_id) . ')' : 'ParentCategory.id IN (' . cleanIntegerCommaList($cat_id) . ')';
             } else {
                 unset($this->Listing->joins['ParentCategory']);
             }
             empty($cat_id) and !empty($section_id) and $conditions[] = 'Listing.sectionid IN (' . cleanIntegerCommaList($section_id) . ')';
             empty($cat_id) and !empty($dir_id) and $conditions[] = 'JreviewsCategory.dirid IN (' . cleanIntegerCommaList($dir_id) . ')';
             empty($cat_id) and !empty($criteria_id) and $conditions[] = 'JreviewsCategory.criteriaid IN (' . cleanIntegerCommaList($criteria_id) . ')';
         } else {
             if (Sanitize::getInt($this->params['module'], 'cat_auto') && method_exists($this->Listing, 'catUrlParam')) {
                 if ($cat_id = Sanitize::getInt($this->passedArgs, $this->Listing->catUrlParam())) {
                     $conditions[] = 'JreviewsCategory.id IN (' . cleanIntegerCommaList($cat_id) . ')';
                 }
             } elseif ($cat_id) {
                 $conditions[] = 'JreviewsCategory.id IN (' . cleanIntegerCommaList($cat_id) . ')';
             }
         }
         $listing_id and $conditions[] = "Listing.{$this->Listing->realKey} IN (" . cleanIntegerCommaList($listing_id) . ")";
         switch ($sort) {
             case 'random':
                 $order[] = 'RAND(' . $this->params['rand'] . ')';
                 break;
             case 'featured':
//.........这里部分代码省略.........
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:101,代码来源:module_listings_controller.php

示例7: index

 function index()
 {
     /*        if($this->_user->id === 0) 
             {
                 $this->cacheAction = Configure::read('Cache.expires');        
             }   */
     $this->EverywhereAfterFind = true;
     // Triggers the afterFind in the Observer Model
     if (!isset($this->params['module'])) {
         $this->params['module'] = array();
     }
     // For direct calls to the controller
     $module_id = Sanitize::getInt($this->params, 'module_id', Sanitize::getInt($this->data, 'module_id'));
     if (empty($this->params)) {
         $query = "SELECT params FROM #__modules WHERE id = " . $module_id;
         $this->_db->setQuery($query);
         $this->params['module'] = stringToArray($this->_db->loadResult());
     }
     $ids = $conditions = $joins = $order = array();
     # Read module parameters
     $extension = Sanitize::getString($this->params['module'], 'extension');
     $reviews_type = Sanitize::getString($this->params['module'], 'reviews_type');
     $custom_where = Sanitize::getString($this->params['module'], 'custom_where');
     $cat_id = Sanitize::getString($this->params['module'], 'category');
     $listing_id = Sanitize::getString($this->params['module'], 'listing');
     $limit = Sanitize::getInt($this->params['module'], 'module_limit', 5);
     $total = min(50, Sanitize::getInt($this->params['module'], 'module_total', 10));
     if ($extension == 'com_content') {
         $dir_id = Sanitize::getString($this->params['module'], 'dir');
         $section_id = Sanitize::getString($this->params['module'], 'section');
         $criteria_id = Sanitize::getString($this->params['module'], 'criteria');
     } else {
         $dir_id = null;
         $section_id = null;
         $criteria_id = null;
     }
     # Prevent sql injection
     $token = Sanitize::getString($this->params, 'token');
     $tokenMatch = 0 === strcmp($token, cmsFramework::formIntegrityToken($this->params, array('module', 'module_id', 'form', 'data'), false));
     isset($this->params['module']) and $this->viewSuffix = Sanitize::getString($this->params['module'], 'tmpl_suffix');
     // This parameter determines the module mode
     $sort = Sanitize::getString($this->params['module'], 'reviews_order');
     if (in_array($sort, array('random'))) {
         srand((double) microtime() * 1000000);
         $this->params['rand'] = rand();
     }
     # Category auto detect
     if (Sanitize::getInt($this->params['module'], 'cat_auto') && $extension == 'com_content') {
         $ids = CommonController::_discoverIDs($this);
         extract($ids);
     }
     $extension != '' and $conditions[] = "Review.mode = " . $this->quote($extension);
     # Set conditionals based on configuration parameters
     if ($extension == 'com_content') {
         $conditions = array_merge($conditions, array('Listing.state = 1', '( Listing.publish_up = "' . NULL_DATE . '" OR DATE(Listing.publish_up) <= DATE("' . _CURRENT_SERVER_TIME . '") )', '( Listing.publish_down = "' . NULL_DATE . '" OR DATE(Listing.publish_down) >= DATE("' . _CURRENT_SERVER_TIME . '") )'));
         if ($this->cmsVersion == CMS_JOOMLA15) {
             //                $conditions[] = 'Section.access <= ' . $this->Access->getAccessId();
             $conditions[] = 'Category.access <= ' . $this->Access->getAccessId();
             $conditions[] = 'Listing.access <= ' . $this->Access->getAccessId();
         } else {
             $conditions[] = 'Category.access IN (' . $this->Access->getAccessLevels() . ')';
             $conditions[] = 'Listing.access IN ( ' . $this->Access->getAccessLevels() . ')';
         }
         if (!empty($cat_id)) {
             if ($this->cmsVersion == CMS_JOOMLA15) {
                 $conditions[] = 'Listing.catid IN (' . cleanIntegerCommaList($cat_id) . ')';
             } else {
                 $this->Review->joins['ParentCategory'] = "LEFT JOIN #__categories AS ParentCategory ON Category.lft BETWEEN ParentCategory.lft AND ParentCategory.rgt";
                 $conditions[] = 'ParentCategory.id IN (' . cleanIntegerCommaList($cat_id) . ')';
             }
         }
         empty($cat_id) and !empty($section_id) and $conditions[] = 'Listing.sectionid IN (' . cleanIntegerCommaList($section_id) . ')';
         empty($cat_id) and !empty($dir_id) and $conditions[] = 'JreviewsCategory.dirid IN (' . cleanIntegerCommaList($dir_id) . ')';
         empty($cat_id) and !empty($criteria_id) and $conditions[] = 'JreviewsCategory.criteriaid IN (' . cleanIntegerCommaList($criteria_id) . ')';
     } else {
         if (Sanitize::getInt($this->params['module'], 'cat_auto') && isset($this->Listing) && method_exists($this->Listing, 'catUrlParam')) {
             if ($cat_id = Sanitize::getInt($this->passedArgs, $this->Listing->catUrlParam())) {
                 $conditions[] = 'JreviewsCategory.id IN (' . $cat_id . ')';
             }
         } elseif ($cat_id) {
             $conditions[] = 'JreviewsCategory.id IN (' . cleanIntegerCommaList($cat_id) . ')';
         }
     }
     $listing_id and $conditions[] = "Review.pid IN ( " . cleanIntegerCommaList($listing_id) . ")";
     $conditions[] = 'Review.published > 0';
     switch ($sort) {
         case 'latest':
             $order[] = $this->Review->processSorting('rdate');
             break;
         case 'helpful':
             $order[] = $this->Review->processSorting('helpful');
             break;
         case 'random':
             $order[] = 'RAND(' . $this->params['rand'] . ')';
             break;
         default:
             $order[] = $this->Review->processSorting('rdate');
             break;
     }
     switch ($reviews_type) {
//.........这里部分代码省略.........
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:101,代码来源:module_reviews_controller.php

示例8: afterFilter

 /**
  * Dynamically replace the field tags with their labels/form field equivalents
  */
 function afterFilter()
 {
     $output =& $this->output;
     $names = array();
     $labels = array();
     $select = array();
     $cat_tag = false;
     $date_field = false;
     $cat_auto = Sanitize::getInt($this->params['module'], 'cat_auto');
     $dir_id = $section_id = $cat_id = $criteria_id = '';
     # Initialize FormHelper
     $Form = new FormHelper();
     $CustomFields = new CustomFieldsHelper();
     $CustomFields->Config =& $this->Config;
     # Process custom field tag attributes
     foreach ($this->fieldTags as $key => $value) {
         $var = explode('|', $value);
         if (!strstr($value, '_label')) {
             $names[$var[0]] = $value;
         } elseif (strstr($value, '_label')) {
             $labels[] = substr($value, 0, -6);
         }
         if ($value == 'category') {
             $cat_tag = true;
             /************************/
             if (isset($var[1]) && $var[1] == 'm') {
                 $category_select_type = ' multiple="multiple"';
             }
             if (isset($var[2]) && (int) $var[2] > 0) {
                 $category_select_size = ' size="' . $var[2] . '"';
             }
             /************************/
         }
         if (isset($var[1]) && strtolower($var[1]) == 'm') {
             $select[$var[0]] = 'selectmultiple';
         } elseif (isset($var[1]) && strtolower($var[1]) == 's') {
             $select[$var[0]] = 'select';
         }
         $select_size[$var[0]] = isset($var[2]) ? $var[2] : 5;
         # Check for category select list
         if ($var[0] == 'category') {
             if (isset($var[1]) && strtolower($var[1]) == 's') {
                 $category_select_type = ' multiple="multiple"';
             }
             if (isset($var[2]) && (int) $var[2] > 0) {
                 $category_select_size = ' size="' . $var[2] . '"';
             }
         }
     }
     # Get selected values from url
     $entry = array();
     foreach ($this->params as $key => $value) {
         if (substr($key, 0, 3) == 'jr_') {
             $entry['Field']['pairs'][$key]['value'] = explode('_', $value);
         }
         // Add categories/sections
     }
     if (isset($this->params['tag'])) {
         $entry['Field']['pairs']['jr_' . $this->params['tag']['field']]['value'] = array($this->params['tag']['value']);
     }
     # Generate category list if tag found in view
     if ($cat_tag) {
         # Get module params before auto-detect
         $param_cat_id = Sanitize::getString($this->params['module'], 'cat_id');
         $param_dir_id = Sanitize::getString($this->params['module'], 'dir_id');
         $param_type_id = Sanitize::getString($this->params['module'], 'criteria_id');
         # Category auto detect
         $ids = CommonController::_discoverIDs($this);
         if ($cat_auto) {
             extract($ids);
         } elseif ($this->cmsVersion != CMS_JOOMLA15) {
             isset($ids['cat_id']) and $cat_id = $ids['cat_id'];
         }
         if ($this->cmsVersion == CMS_JOOMLA15 && $section_id == '' && $cat_id != '') {
             $sql = "SELECT section FROM #__categories WHERE id IN (" . $cat_id . ")";
             $this->_db->setQuery($sql);
             $section_id = $this->_db->loadResult();
         }
         $cat_id != '' and $this->params['module']['cat_id'] = $cat_id;
         $cat_id == '' and $section_id != '' and $this->params['module']['section_id'] = $section_id;
         $cat_id == '' and $criteria_id != '' and $this->params['module']['criteria_id'] = $criteria_id;
         if ($this->cmsVersion == CMS_JOOMLA15) {
             $categorySelect = $this->Category->categoryTree($this->_user->gid, $this->params);
         } else {
             $options = array('disabled' => false, 'cat_id' => !empty($param_cat_id) && !$cat_auto ? $param_cat_id : ($cat_auto ? $cat_id : ''), 'parent_id' => !empty($param_cat_id) && !$cat_auto ? $param_cat_id : ($cat_auto ? $cat_id : ''), 'dir_id' => !empty($param_dir_id) && !$cat_auto ? $param_dir_id : ($cat_auto ? $dir_id : ''), 'type_id' => !empty($param_type_id) && !$cat_auto ? $param_type_id : ($cat_auto ? $criteria_id : ''));
             if ($cat_auto && empty($options['cat_id'])) {
                 $options['level'] = 1;
             }
             $categories = $this->Category->getCategoryList($options);
             // Now get the parent and sibling categories
             if ($cat_auto && isset($categories[$cat_id]) && count($categories) == 1) {
                 $options['cat_id'] = $options['parent_id'] = $categories[$cat_id]->parent_id;
                 $categories = $this->Category->getCategoryList($options);
             }
             $categorySelect = $Form->select('data[categories]', array_merge(array(array('value' => null, 'text' => '- ' . __t("Select Category", true) . ' -')), $categories), $cat_id, array('class' => 'jrSelect'));
         }
         $output = str_replace('{' . $names['category'] . '}', $categorySelect, $output);
//.........这里部分代码省略.........
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:101,代码来源:module_advanced_search_controller.php

示例9: index

 function index()
 {
     $this->EverywhereAfterFind = true;
     // Triggers the afterFind in the Observer Model
     if (!isset($this->params['module'])) {
         $this->params['module'] = array();
     }
     // For direct calls to the controller
     // Required for ajax pagination to remember module settings
     $Session = RegisterClass::getInstance('MvcSession');
     $module_id = Sanitize::getInt($this->params, 'module_id', Sanitize::getInt($this->data, 'module_id'));
     if ($this->ajaxRequest) {
         $this->params = $Session->get('module_params' . $module_id, null, S2Paths::get('jreviews', 'S2_CMSCOMP'));
     } else {
         srand((double) microtime() * 1000000);
         $this->params['rand'] = rand();
         $Session->set('module_rand' . $module_id, $this->params['rand'], S2Paths::get('jreviews', 'S2_CMSCOMP'));
         $Session->set('module_params' . $module_id, $this->params, S2Paths::get('jreviews', 'S2_CMSCOMP'));
     }
     # Prevent sql injection
     $token = Sanitize::getString($this->params, 'token');
     $tokenMatch = 0 === strcmp($token, cmsFramework::formIntegrityToken($this->params, array('module', 'module_id', 'form', 'data'), false));
     $this->viewSuffix = Sanitize::getString($this->params['module'], 'tmpl_suffix');
     $conditions = array();
     $joins = array();
     $order = array();
     # Read module parameters
     $extension = Sanitize::getString($this->params['module'], 'extension');
     $reviews_type = Sanitize::getString($this->params['module'], 'reviews_type');
     $custom_where = Sanitize::getString($this->params['module'], 'custom_where');
     $cat_id = Sanitize::getString($this->params['module'], 'category');
     $listing_id = Sanitize::getString($this->params['module'], 'listing');
     if ($extension == 'com_content') {
         $dir_id = Sanitize::getString($this->params['module'], 'dir');
         $section_id = Sanitize::getString($this->params['module'], 'section');
         $criteria_id = Sanitize::getString($this->params['module'], 'criteria');
     } else {
         $dir_id = null;
         $section_id = null;
         $criteria_id = null;
     }
     // This parameter determines the module mode
     $sort = Sanitize::getString($this->params['module'], 'reviews_order');
     # Category auto detect
     if (Sanitize::getInt($this->params['module'], 'cat_auto') && $extension == 'com_content') {
         $ids = CommonController::_discoverIDs($this);
         extract($ids);
     }
     $extension != '' and $conditions[] = "Review.mode = " . $this->quote($extension);
     # Set conditionals based on configuration parameters
     if ($extension == 'com_content') {
         $conditions = array_merge($conditions, array('Listing.state = 1', '( Listing.publish_up = "' . NULL_DATE . '" OR DATE(Listing.publish_up) <= DATE("' . _CURRENT_SERVER_TIME . '") )', '( Listing.publish_down = "' . NULL_DATE . '" OR DATE(Listing.publish_down) >= DATE("' . _CURRENT_SERVER_TIME . '") )', 'Listing.access <= ' . $this->_user->gid));
         $cat_id != '' and $conditions[] = 'Listing.catid IN (' . cleanIntegerCommaList($cat_id) . ')';
         $cat_id == '' and $section_id != '' and $conditions[] = 'Listing.sectionid IN (' . cleanIntegerCommaList($section_id) . ')';
         $cat_id == '' and $dir_id != '' and $conditions[] = 'JreviewsCategory.dirid IN (' . cleanIntegerCommaList($dir_id) . ')';
         $cat_id == '' and $criteria_id != '' and $conditions[] = 'JreviewsCategory.criteriaid IN (' . cleanIntegerCommaList($criteria_id) . ')';
     } else {
         if (Sanitize::getInt($this->params['module'], 'cat_auto') && isset($this->Listing) && method_exists($this->Listing, 'catUrlParam')) {
             if ($cat_id = Sanitize::getInt($this->passedArgs, $this->Listing->catUrlParam())) {
                 $conditions[] = 'JreviewsCategory.id IN (' . $cat_id . ')';
             }
         } elseif ($cat_id) {
             $conditions[] = 'JreviewsCategory.id IN (' . cleanIntegerCommaList($cat_id) . ')';
         }
     }
     $listing_id and $conditions[] = "Review.pid IN ( " . cleanIntegerCommaList($listing_id) . ")";
     $conditions[] = 'Review.published > 0';
     switch ($sort) {
         case 'latest':
             $order[] = $this->Review->processSorting('rdate');
             break;
         case 'helpful':
             $order[] = $this->Review->processSorting('helpful');
             break;
         case 'random':
             $order[] = 'RAND(' . $this->params['rand'] . ')';
             break;
         default:
             $order[] = $this->Review->processSorting('rdate');
             break;
     }
     switch ($reviews_type) {
         case 'all':
             break;
         case 'user':
             $conditions[] = 'Review.author = 0';
             break;
         case 'editor':
             $conditions[] = 'Review.author = 1';
             break;
     }
     # Custom WHERE
     $tokenMatch and $custom_where and $conditions[] = $custom_where;
     $queryData = array('joins' => $joins, 'conditions' => $conditions, 'order' => $order, 'limit' => $this->module_limit, 'offset' => $this->module_offset);
     # Don't run it here because it's run in the Everywhere Observer Component
     $this->Review->runProcessRatings = false;
     // Excludes listing owner info in Everywhere component
     $this->Review->controller = 'module_reviews';
     $reviews = $this->Review->findAll($queryData);
     if (Sanitize::getInt($this->params['module'], 'ajax_nav', 1)) {
//.........这里部分代码省略.........
开发者ID:bizanto,项目名称:Hooked,代码行数:101,代码来源:module_reviews_controller.php

示例10: index

 function index()
 {
     global $Itemid;
     $cat_id = null;
     $conditions = array();
     $joins = array();
     $order = array();
     $menu_id = '';
     // Read module params
     $dir_id = Sanitize::getString($this->params['module'], 'dir');
     $section_id = Sanitize::getString($this->params, 'section');
     $cat_id = Sanitize::getString($this->params['module'], 'cat');
     $criteria_id = Sanitize::getString($this->params['module'], 'criteria');
     $itemid_options = Sanitize::getString($this->params['module'], 'itemid_options');
     $itemid_hc = Sanitize::getInt($this->params['module'], 'hc_itemid');
     $field = Sanitize::paranoid(Sanitize::getString($this->params['module'], 'field'), array('_'));
     $option_length = Sanitize::getInt($this->params['module'], 'fieldoption_length');
     $custom_params = Sanitize::getString($this->params['module'], 'custom_params');
     $sort = Sanitize::paranoid(Sanitize::getString($this->params['module'], 'fieldoption_order'));
     # Category auto detect
     if (Sanitize::getInt($this->params['module'], 'catauto')) {
         $ids = CommonController::_discoverIDs($this);
         extract($ids);
     }
     # Set menu id
     switch ($itemid_options) {
         case 'category':
             $click2searchUrl = 'index.php?option=com_jreviews&amp;Itemid={itemid}&amp;url=tag/{field}/{optionvalue}/';
             if (is_numeric($cat_id) && $cat_id > 0) {
                 $query = "\n\t\t\t\t\t\t\tSELECT \n\t\t\t\t\t\t\t\tdirid\n\t\t\t\t\t\t\tFROM \n\t\t\t\t\t\t\t\t#__jreviews_categories\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\tid = " . (int) $cat_id . "\n\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\t`option` = 'com_content'\n\t\t\t\t\t\t";
                 $this->_db->setQuery($query);
                 $dir_id = $this->_db->loadResult();
                 $menu_id = $this->Menu->getCategory(array('cat_id' => $cat_id, 'dir_id' => $dir_id));
             } elseif (is_numeric($dir_id) && $dir_id > 0) {
                 $menu_id = $this->Menu->getDir($dir_id);
             } else {
                 $click2searchUrl = 'index.php?option=com_jreviews&amp;Itemid=&amp;url=tag/{field}/{optionvalue}/';
             }
             $click2searchUrl = str_replace(array('{itemid}', '{field}', '/cat:{catid}', '/criteria:{criteriaid}'), array($menu_id, substr($field, 3), '', ''), $click2searchUrl);
             break;
         case 'search':
             // Need a criteria id. If not specified in the module settings, we can get it from the category id if one is detected
             if (empty($criteria_id) && $cat_id > 0) {
                 $query = "\n\t\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\t\tcriteriaid\n\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t#__jreviews_categories\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\tid = " . (int) $cat_id . "\n\t\t\t\t\t\t";
                 $this->_db->setQuery($query);
                 $criteria_id = $this->_db->loadResult();
             }
             $click2searchUrl = 'index.php?option=com_jreviews&amp;Itemid={itemid}&amp;url=tag/{field}/{optionvalue}/';
             if (is_numeric($criteria_id) && $criteria_id > 0) {
                 $menu_id = $this->Menu->get('jr_advsearch_' . $criteria_id);
             }
             if (empty($menu_id)) {
                 $menu_id = $this->Menu->get('jr_advsearch');
             }
             $click2searchUrl = str_replace(array('{itemid}', '{field}', '/cat:{catid}', '/criteria:{criteriaid}'), array($menu_id, substr($field, 3), '', ''), $click2searchUrl);
             break;
         case 'hardcode':
             $click2searchUrl = 'index.php?option=com_jreviews&amp;Itemid={itemid}&amp;url=tag/{field}/{optionvalue}/';
             $urlParamArray = array('dir' => $dir_id, 'criteria' => $criteria_id, 'cat' => $cat_id, 'section' => $section_id);
             $params = arrayToParams($urlParamArray);
             $click2searchUrl .= $params != '' ? $params . '/' : '';
             $menu_id = $itemid_hc;
             $click2searchUrl = str_ireplace(array('{itemid}', '{field}'), array($menu_id, substr($field, 3)), $click2searchUrl);
             break;
         case 'none':
         default:
             $click2searchUrl = 'index.php?option=com_jreviews&amp;Itemid=&amp;url=tag/{field}/{optionvalue}/';
             $urlParamArray = array('dir' => $dir_id, 'criteria' => $criteria_id, 'cat' => $cat_id, 'section' => $section_id);
             $params = arrayToParams($urlParamArray);
             $click2searchUrl .= $params != '' ? $params . '/' : '';
             $menu_id = $itemid_hc;
             $click2searchUrl = str_replace('{field}', substr($field, 3), $click2searchUrl);
             break;
     }
     $this->FieldOption->modelUnbind(array('FieldOption.value AS `FieldOption.value`', 'FieldOption.fieldid AS `FieldOption.fieldid`', 'FieldOption.image AS `FieldOption.image`', 'FieldOption.ordering AS `FieldOption.ordering`', 'FieldOption.optionid AS `FieldOption.optionid`', 'FieldOption.text AS `FieldOption.text`'));
     $fields[] = 'FieldOption.optionid AS `FieldOption.optionid`';
     $fields[] = 'FieldOption.value AS `FieldOption.value`';
     if ($option_length) {
         $fields[] = 'IF(CHAR_LENGTH(FieldOption.text)>' . $option_length . ',CONCAT(SUBSTR(FieldOption.text,1,' . $option_length . '),"..."),FieldOption.text) AS `FieldOption.text`';
     } else {
         $fields[] = 'FieldOption.text AS `FieldOption.text`';
     }
     $joins[] = 'INNER JOIN #__jreviews_fields AS Field ON Field.fieldid = FieldOption.fieldid';
     $order[] = 'FieldOption.' . $sort;
     $field_options = $this->FieldOption->findAll(array('fields' => $fields, 'conditions' => 'Field.name = ' . $this->quote($field), 'joins' => $joins, 'order' => $order));
     # Send variables to view template
     $this->set(array('field' => $field, 'click2searchUrl' => $click2searchUrl, 'field_options' => $field_options, 'custom_params' => $custom_params));
     return $this->render('modules', 'fields');
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:89,代码来源:module_fields_controller.php

示例11: index

 function index()
 {
     // Required for ajax pagination to remember module settings
     $Session = RegisterClass::getInstance('MvcSession');
     $module_id = Sanitize::getInt($this->params, 'module_id', Sanitize::getInt($this->data, 'module_id'));
     if (!isset($this->params['module'])) {
         $this->params['module'] = array();
     }
     // For direct calls to the controller
     if ($this->ajaxRequest) {
         $this->params = $Session->get('module_params' . $module_id, null, S2Paths::get('jreviews', 'S2_CMSCOMP'));
     } else {
         srand((double) microtime() * 1000000);
         $this->params['rand'] = rand();
         $Session->set('module_rand' . $module_id, $this->params['rand'], S2Paths::get('jreviews', 'S2_CMSCOMP'));
         $Session->set('module_params' . $module_id, $this->params, S2Paths::get('jreviews', 'S2_CMSCOMP'));
     }
     # Prevent sql injection
     $token = Sanitize::getString($this->params, 'token');
     $tokenMatch = 0 === strcmp($token, cmsFramework::formIntegrityToken($this->params, array('module', 'module_id', 'form', 'data'), false));
     $this->viewSuffix = Sanitize::getString($this->params['module'], 'tmpl_suffix');
     $conditions = array();
     $joins = array();
     $order = array();
     $having = array();
     # Read module parameters
     $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_id = Sanitize::getString($this->params['module'], 'criteria');
     $limit = Sanitize::getString($this->params['module'], 'module_limit', 5);
     $extension = Sanitize::getString($this->params['module'], 'extension');
     $extension = $extension != '' ? $extension : 'com_content';
     if (isset($this->Listing)) {
         $this->Listing->_user = $this->_user;
         // This parameter determines the module mode
         $sort = Sanitize::getString($this->params['module'], 'listing_order');
         $custom_order = Sanitize::getString($this->params['module'], 'custom_order');
         $custom_where = Sanitize::getString($this->params['module'], 'custom_where');
         if ($extension != 'com_content' && in_array($sort, array('topratededitor', 'featuredrandom', 'rhits'))) {
             echo "You have selected the {$sort} mode which is not supported for components other than com_content. Please read the tooltips in the module parameters for more info on allowed settings.";
             return;
         }
         # Category auto detect
         if (Sanitize::getInt($this->params['module'], 'cat_auto') && $extension == 'com_content') {
             $ids = CommonController::_discoverIDs($this);
             extract($ids);
         }
         # Set conditionals based on configuration parameters
         if ($extension == 'com_content') {
             // Only works for core articles
             $conditions = array_merge($conditions, array('Listing.state = 1', '( Listing.publish_up = "' . NULL_DATE . '" OR DATE(Listing.publish_up) <= DATE("' . _CURRENT_SERVER_TIME . '") )', '( Listing.publish_down = "' . NULL_DATE . '" OR DATE(Listing.publish_down) >= DATE("' . _CURRENT_SERVER_TIME . '") )', 'Listing.access <= ' . $this->_user->gid));
             // Remove unnecessary fields from model query
             $this->Listing->modelUnbind(array('Listing.fulltext AS `Listing.description`', 'Listing.metakey AS `Listing.metakey`', 'Listing.metadesc AS `Listing.metadesc`', 'User.email AS `User.email`'));
             $cat_id != '' and $conditions[] = 'Listing.catid IN (' . cleanIntegerCommaList($cat_id) . ')';
             $cat_id == '' and $section_id != '' and $conditions[] = 'Listing.sectionid IN (' . cleanIntegerCommaList($section_id) . ')';
             $cat_id == '' and $dir_id != '' and $conditions[] = 'JreviewsCategory.dirid IN (' . cleanIntegerCommaList($dir_id) . ')';
             $cat_id == '' and $criteria_id != '' and $conditions[] = 'JreviewsCategory.criteriaid IN (' . cleanIntegerCommaList($criteria_id) . ')';
         } else {
             if (Sanitize::getInt($this->params['module'], 'cat_auto') && method_exists($this->Listing, 'catUrlParam')) {
                 if ($cat_id = Sanitize::getInt($this->passedArgs, $this->Listing->catUrlParam())) {
                     $conditions[] = 'JreviewsCategory.id IN (' . cleanIntegerCommaList($cat_id) . ')';
                 }
             } elseif ($cat_id) {
                 $conditions[] = 'JreviewsCategory.id IN (' . cleanIntegerCommaList($cat_id) . ')';
             }
         }
         $listing_id and $conditions[] = "Listing.{$this->Listing->realKey} IN (" . cleanIntegerCommaList($listing_id) . ")";
         switch ($sort) {
             case 'random':
                 $order[] = 'RAND(' . $this->params['rand'] . ')';
                 break;
             case 'featuredrandom':
                 $conditions[] = 'featured > 0';
                 $order[] = 'RAND(' . $this->params['rand'] . ')';
                 break;
             case 'topratededitor':
                 $conditions[] = 'Totals.editor_rating > 0';
                 break;
                 // Editor rating sorting options dealt with in the Listing->processSorting method
         }
         # Custom WHERE
         $tokenMatch and $custom_where and $conditions[] = $custom_where;
         # Filtering options
         $having = array();
         // Listings submitted in the past x days
         $entry_period = Sanitize::getInt($this->params['module'], 'filter_listing_period');
         if ($entry_period > 0 && $this->Listing->dateKey) {
             $conditions[] = "Listing.{$this->Listing->dateKey} >= DATE_SUB('" . _CURRENT_SERVER_TIME . "', INTERVAL {$entry_period} DAY)";
         }
         // Listings with reviews submitted in past x days
         $review_period = Sanitize::getInt($this->params['module'], 'filter_review_period');
         if ($review_period > 0) {
             $conditions[] = "Review.created >= DATE_SUB(CURDATE(), INTERVAL {$review_period} DAY)";
             $joins[] = 'LEFT JOIN #__jreviews_comments AS Review ON Listing.' . $this->Listing->realKey . ' = Review.pid';
         }
         // Listings with review count higher than
         $filter_review_count = Sanitize::getInt($this->params['module'], 'filter_review_count');
         $filter_review_count > 0 and $conditions[] = "Totals.user_rating_count >= " . $filter_review_count;
//.........这里部分代码省略.........
开发者ID:bizanto,项目名称:Hooked,代码行数:101,代码来源:module_listings_controller.php


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