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


PHP bpBase::loadAppClass方法代码示例

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


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

示例1: getValue

 function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0)
 {
     //<stl:***></stl:***>
     $channelObj = bpBase::loadAppClass('channelObj', 'channel', 1);
     //
     $siteID = $avs['site'] == null ? $siteID : $avs['site'];
     //
     $upLevel = $avs['upLevel'] == null ? 0 : intval($avs['upLevel']);
     if ($avs['channelIndex']) {
         $thisChannel = $channelObj->getChannelByIndex($avs['channelIndex'], $siteID);
         $channels = $channelObj->getChannelsByParentID($thisChannel->id);
     } else {
         switch ($upLevel) {
             case 0:
                 break;
             case 1:
                 $currentChannel = $channelObj->getChannelByIndex($avs['channelIndex'], $siteID);
                 $channels = $channelObj->getChannelsByParentID($currentChannel->parentid);
                 break;
         }
     }
     //
     $returnStr = '';
     if ($channels) {
         $middleStr = parent::getMiddleBody($str, 'channels', $this->gTag);
         $i = 0;
         foreach ($channels as $c) {
             $start = intval($avs['startNum']) - 1;
             $count = intval($avs['totalNum']);
             if (!$count) {
                 $count = count($channels);
             }
             if ($i == $start || $i > $start) {
                 if ($i < $count) {
                     $rs = str_replace(array('[stl.channel.id]', '[stl.channel.name]', '[stl.channel.link]', '[stl.channel.num]', '<stl:contents'), array($c->id, $c->name, $c->link, $i + intval($avs['numStart']), '<stl:contents channelIndex="' . $c->cindex . '"'), $middleStr);
                     //current class
                     if ($channelID == $c->id) {
                         $rs = str_replace('[stl.channel.currentItemClass]', $avs['currentItemClass'], $rs);
                     } else {
                         $rs = str_replace('[stl.channel.currentItemClass]', '', $rs);
                     }
                     $returnStr .= $rs;
                 }
             }
             $i++;
         }
     }
     //处理stl:contents
     if (strExists($returnStr, '<stl:contents')) {
         $template = bpBase::loadAppClass('template', 'template');
         $now = SYS_TIME;
         $returnStr = $template->parseStr($returnStr, $now);
         @unlink(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . $now . '.parsed.tpl.php');
         @unlink(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . $now . '.tags.tpl.php');
     }
     //
     return $returnStr;
 }
开发者ID:ailingsen,项目名称:pigcms,代码行数:58,代码来源:tag_channels.class.php

示例2: logs

 public function logs()
 {
     $updateObj = bpBase::loadAppClass('updateObj', 'update', 1);
     $shouldUpdate = $updateObj->shouldUpdate($this->updateArr);
     $page = isset($_GET['page']) ? $_GET['page'] : '1';
     $logs = $this->update_log_db->listinfo('', $order = 'time DESC', $page, $pagesize = '20', '', '?m=update&c=update&a=logs&');
     $pages = $this->update_log_db->pages;
     include $this->showManageTpl('logs');
 }
开发者ID:liuguogen,项目名称:weixin,代码行数:9,代码来源:update.php

示例3: getValue

 function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0)
 {
     //<stl:***></stl:***>
     $siteID = $avs['siteID'] == null ? $siteID : $avs['siteID'];
     $site = bpBase::loadAppClass('siteObj', 'site', 1);
     $thisSite = $site->getSiteByID($siteID);
     //
     $type = strtolower($avs['type']);
     return $thisSite->{$type};
 }
开发者ID:ailingsen,项目名称:pigcms,代码行数:10,代码来源:tag_site.class.php

示例4: getValue

 function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0, $pagination = array('pageSize' => 20, 'totalCount' => 0, 'currentPage' => 1, 'urlPrefix' => '', 'urlSuffix' => ''))
 {
     //<stl:***></stl:***>
     $articleObj = bpBase::loadAppClass('articleObj', 'article');
     $thisContent = $articleObj->getContentByID($contentID);
     if ($thisContent->pagecount > 1) {
         $currentPage = intval($pagination['currentPage']);
         if (!$thisContent->title) {
             $sep = '';
             for ($i = 0; $i < $thisContent->pagecount; $i++) {
                 $thisContent->titles .= $sep . '';
                 $sep = '|';
             }
         }
         $titles = explode('|', $thisContent->titles);
         $str = '';
         $ah_str_l = '';
         $ah_str_r = '';
         if ($titles) {
             $i = 0;
             foreach ($titles as $t) {
                 $nextI = $i + 1;
                 if ($i == 0) {
                     $link = $pagination['urlPrefix'] . $pagination['urlSuffix'];
                 } else {
                     $link = $pagination['urlPrefix'] . '-' . $nextI . $pagination['urlSuffix'];
                 }
                 if ($pagination['currentPage'] != $nextI) {
                     $style = '';
                 } else {
                     $style = ' style="color:red"';
                 }
                 if (!isah()) {
                     $str .= '<li><a title="' . $t . '" href="' . $link . '"' . $style . '>第' . $nextI . '页:' . $t . '</a></li>';
                 } else {
                     $s = '<a title="' . $t . '" href="' . $link . '"' . $style . '>第' . $nextI . '页:' . $t . '</a><br>';
                     if ($i % 2 == 0) {
                         $ah_str_l .= $s;
                     } else {
                         $ah_str_r .= $s;
                     }
                 }
                 $i++;
             }
         }
     }
     if ($titles) {
         if (!isah()) {
             return '<div class="contentTitleNav"><h2>“' . $thisContent->title . '”导航</h2><div id="titles"><ul>' . $str . '<div class="clear"></div></ul><div class="clear" style="width:100%;height:1px"></div></div></div>';
         } else {
             return '<dl class="article_nav"><dt>文章导航条</dt><dd>' . $ah_str_l . '</dd><dd class="last">' . $ah_str_r . '</dd></dl>';
         }
     }
 }
开发者ID:ailingsen,项目名称:pigcms,代码行数:54,代码来源:tag_articlePageNav.class.php

示例5: currentCityInfo

 function currentCityInfo()
 {
     $geoObj = bpBase::loadAppClass('geoObj', 'geo', 1);
     $ipGeo = $geoObj->getGeoByIP(ip());
     if (!$ipGeo) {
         $geo_db = bpBase::loadModel('geo_model');
         $defaultChildLocation = $geo_db->getDefaultChildLocation();
         $ipGeo = $defaultChildLocation;
     }
     echo '{"city":[{"name":"' . $ipGeo->name . '","id":"' . $ipGeo->id . '","geoindex":"' . $ipGeo->geoindex . '"}]}';
 }
开发者ID:ailingsen,项目名称:pigcms,代码行数:11,代码来源:widget.php

示例6: parse

 function parse($siteid, $str = '')
 {
     //<stl:include></stl:include>
     $siteid = intval($siteid);
     $siteClass = bpBase::loadAppClass('siteObj', 'site', 1);
     $thisSite = $siteClass->getSiteByID($siteid);
     $filePath = ABS_PATH . str_replace('@', '', parent::getAttributeValue($str, $this->attributes[0]));
     $filePath = str_replace('{siteIndex}', $thisSite->siteindex, $filePath);
     if (file_exists($filePath)) {
         return file_get_contents($filePath);
     } else {
         return '';
     }
 }
开发者ID:ailingsen,项目名称:pigcms,代码行数:14,代码来源:tag_include.class.php

示例7: getValue

 function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0)
 {
     //<stl:***></stl:***>
     $str = parent::removeProperties($str, $this->attributes);
     $middleStr = parent::getMiddleBody($str, 'a', $this->gTag);
     if (isset($avs['contentID']) && $avs['contentID']) {
         $articleObj = bpBase::loadAppClass('articleObj', 'article', 1);
         $thisContent = $articleObj->getContentByID($avs['contentID']);
         $valueStr = str_replace('[stl.content.title]', $thisContent->title, $middleStr);
         $link = $thisContent->link;
     } elseif (isset($avs['channelIndex']) && $avs['channelIndex']) {
         $channelObj = bpBase::loadAppClass('channelObj', 'channel', 1);
         if ($avs['site']) {
             //指定了站点
             $siteID = intval($avs['site']);
         }
         $thisChannel = $channelObj->getChannelByIndex($avs['channelIndex'], $siteID);
         //
         $valueStr = str_replace('[stl.channel.name]', $thisChannel->name, $middleStr);
         if ($avs['site'] || $siteID > 0) {
             //指定了站点
             $siteObj = bpBase::loadAppClass('siteObj', 'site', 1);
             $thisSite = $siteObj->getSiteByID($avs['site']);
             if (strExists($link, 'http://') || $thisChannel->externallink) {
                 $link = $thisChannel->link;
             } else {
                 $link = $thisSite->url . $thisChannel->link;
             }
         } else {
             if (strExists($link, 'http://') || $thisChannel->externallink) {
                 $link = $thisChannel->link;
             } else {
                 $link = MAIN_URL_ROOT . $thisChannel->link;
             }
         }
     } elseif (isset($avs['siteID']) && $avs['siteID']) {
         $siteObj = bpBase::loadAppClass('siteObj', 'site', 1);
         $thisSite = $siteObj->getSiteByID($avs['siteID']);
         //
         $valueStr = str_replace('[stl.site.name]', $thisSite->name, $middleStr);
         $link = $thisSite->url;
     }
     $str = str_replace('<stl:a', '<a href="' . $link . '"', $str);
     $str = str_replace('</stl:a', '</a', $str);
     $str = str_replace($middleStr, $valueStr, $str);
     return $str;
 }
开发者ID:ailingsen,项目名称:pigcms,代码行数:47,代码来源:tag_a.class.php

示例8: getValue

 function getValue($str = '', $avs, $csiteID = 0, $thisChannelID = 0, $contentID = 0)
 {
     //<stl:***></stl:***>
     $articleObj = bpBase::loadAppClass('articleObj', 'article');
     $site = bpBase::loadAppClass('siteObj', 'site');
     $content_db = bpBase::loadModel('article_model');
     $totalNum = $avs['totalNum'] ? $avs['totalNum'] : 10;
     $cat = $avs['cat'] ? $avs['cat'] : 'news';
     $cats = array('video', 'news', 'guide', 'comment', 'market');
     if (!in_array($cat, $cats)) {
         $cat = 'news';
     }
     $startNum = $avs['startNum'] ? intval($avs['startNum']) : 1;
     $startI = $startNum - 1;
     $totalNum = $startI + $totalNum;
     $orderBy = $avs['orderBy'] ? $avs['orderBy'] : 'viewcount';
     $contents = $articleObj->viewRanksByCat($cat, $totalNum, $orderBy);
     $returnStr = '';
     if ($contents) {
         $i = 0;
         $middleStr = parent::getMiddleBody($str, 'articleRanks', $this->gTag);
         $tags = array('[stl.content.link]', '[stl.content.title]', '[stl.content.thumb]');
         $count = 0;
         foreach ($contents as $c) {
             if ($i > $startI - 1 && $count < $totalNum) {
                 $replaces = array($c->link, $c->title, $c->thumb);
                 $valueStr = str_replace($tags, $replaces, $middleStr);
                 //time
                 $valueStr = str_replace('[stl.content.time]', date($avs['dateFormat'], $c->time), $valueStr);
                 //other thumb
                 $valueStr = str_replace('[stl.content.thumb2]', str_replace('.jpg', '_small.jpg', $c->thumb), $valueStr);
                 $valueStr = str_replace('[stl.content.thumb3]', str_replace('.jpg', '_middle.jpg', $c->thumb), $valueStr);
                 $valueStr = str_replace('[stl.content.thumb4]', str_replace('.jpg', '_big.jpg', $c->thumb), $valueStr);
                 //num
                 $valueStr = str_replace('[stl.content.num]', $count + $startNum, $valueStr);
                 //
                 $returnStr .= $valueStr;
                 $count++;
             }
             $i++;
         }
     }
     return $returnStr;
 }
开发者ID:ailingsen,项目名称:pigcms,代码行数:44,代码来源:tag_articleRanks.class.php

示例9: getValue

 function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0)
 {
     //<stl:***></stl:***>
     //
     $site = $avs['site'] == null ? $siteID : $avs['site'];
     $site = intval($site);
     //instance
     $channelObj = bpBase::loadAppClass('channelObj', 'channel');
     $upLevel = $avs['upLevel'] == null ? 0 : intval($avs['upLevel']);
     if ($avs['channelIndex'] != null) {
         $thisChannel = $channelObj->getChannelByIndex($avs['channelIndex'], $site);
     } else {
         switch ($upLevel) {
             case 0:
                 $thisChannel = $channelObj->getChannelByID($channelID);
                 break;
             case 1:
                 $currentChannel = $channelObj->getChannelByID($channelID);
                 $thisChannel = $channelObj->getChannelByID($currentChannel->parentid);
                 break;
         }
     }
     //
     $type = strtolower($avs['type']);
     if ($type == 'title') {
         $type = 'name';
     }
     if ($type == 'content') {
         $type = 'des';
     }
     if ($type == 'imageurl') {
         $type = 'thumb';
     }
     if ($type) {
         return $thisChannel->{$type};
     } else {
         return $thisChannel->name;
     }
 }
开发者ID:ailingsen,项目名称:pigcms,代码行数:39,代码来源:tag_channel.class.php

示例10: getValue

 function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0)
 {
     //<stl:***></stl:***>
     //properties
     $seperator = $avs['separator'];
     $linkClass = $avs['linkClass'];
     $target = $avs['target'] == null ? '_self' : $avs['target'];
     //
     $channel = bpBase::loadAppClass('channelObj', 'channel', 1);
     $crumbArr = $channel->crumbArr($channelID);
     $arrCount = count($crumbArr);
     //
     $site = bpBase::loadAppClass('siteObj', 'site', 1);
     if ($siteID < 100) {
         $thisSite = $site->getSiteByID($siteID);
     } else {
         $special_db = bpBase::loadModel('special_model');
         $thisSpecial = $special_db->get($siteID);
         $thisSite->main = false;
         $thisSite->url = $thisSpecial['url'];
         $crumbArr[0]['name'] = '专题:' . $thisSpecial['name'];
     }
     $currentChannel = $channel->getChannelByID($channelID);
     $returnStr = '';
     if (intval($thisSite->main)) {
         $returnStr .= '<a href="/" class="' . $linkClass . '" target="' . $target . '">' . $crumbArr[0]['name'] . '</a>' . $seperator;
     } else {
         $returnStr .= '<a href="' . $thisSite->url . '" class="' . $linkClass . '" target="' . $target . '">' . $crumbArr[0]['name'] . '</a>' . $seperator;
     }
     for ($i = 1; $i < $arrCount; $i++) {
         if (strlen($crumbArr[$i]['name'])) {
             $returnStr .= '<a href="' . $crumbArr[$i]['link'] . '" class="' . $linkClass . '" target="' . $target . '">' . $crumbArr[$i]['name'] . '</a>' . $seperator;
         }
     }
     $returnStr .= '<a href="' . $currentChannel->link . '" class="' . $linkClass . '" target="' . $target . '">' . $currentChannel->name . '</a>';
     return $returnStr;
 }
开发者ID:ailingsen,项目名称:pigcms,代码行数:37,代码来源:tag_location.class.php

示例11: getChannelTotalPage

 /**
  * 根据模板中的pageContents标签获取每页的数量值,仅生成静态页时有效
  *
  * @param unknown_type $channelID
  * @return unknown
  */
 public function getChannelTotalPage($channelID)
 {
     $tpl = bpBase::loadAppClass('template', 'template', 1);
     //channel
     $channelID = intval($channelID);
     $thisChannel = $this->getChannelByID($channelID);
     //分析模板
     $template = $tpl->get($thisChannel->channeltemplate);
     if (!file_exists(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . $template->id . '.parsed.tpl.php')) {
         $tpl->createChannelPageR($channelid);
     }
     //只有生成静态页的情况下,下面的代码才有效
     $totalPage = 1;
     if (file_exists(ABS_PATH . '/templatesCache/' . $template->id . '.tags.tpl.php')) {
         @(require ABS_PATH . '/templatesCache/' . $template->id . '.tags.tpl.php');
         $pageSize = 20;
         //判断是否有分页标签
         $isPagination = false;
         if ($tagsArr) {
             foreach ($tagsArr as $t) {
                 if ($t['name'] == 'pageContents') {
                     //
                     $isPagination = true;
                     $pageSize = $t['avs']['pageNum'];
                 }
             }
         }
         if ($isPagination) {
             $childChannels = $this->getChannelsByParentID($channelID);
             $channelidArr = array($channelID);
             if ($childChannels) {
                 foreach ($childChannels as $c) {
                     array_push($channelidArr, $c->id);
                 }
             }
             $article_db = bpBase::loadModel('article_model');
             $where = to_sqls($channelidArr, '', 'channel_id');
             $totalCount = $article_db->get_var($where, 'COUNT(id)', '', '');
             $totalPage = $totalCount % $pageSize > 0 ? intval($totalCount / $pageSize) + 1 : $totalCount / $pageSize;
             $totalPage = $totalPage < 1 ? 1 : $totalPage;
         } else {
             $totalPage = 1;
         }
     }
     return $totalPage;
 }
开发者ID:ailingsen,项目名称:pigcms,代码行数:52,代码来源:channelObj.class.php

示例12: hotel

 function hotel()
 {
     $sitePage = bpBase::loadAppClass('sitePage', 'site', 1);
     $sitePage->hotel();
 }
开发者ID:liuguogen,项目名称:weixin,代码行数:5,代码来源:home.php

示例13: autoPriceTables

 public function autoPriceTables()
 {
     $taskName = 'autoPriceTables';
     //$this->executedCheck($taskName);
     $thisTask = $this->update_log_db->get_one(array('file' => $taskName));
     //
     $autoprice_db = bpBase::loadModel('autoprice_model');
     $autoprices = $autoprice_db->get_all('DISTINCT(autoid)', '', '', 'autoid ASC');
     $count = count($autoprices);
     $i = intval($_GET['i']);
     if ($i < $count) {
         //start
         $autoclassification_db = bpBase::loadModel('autoclassification_model');
         $thisAuto = $autoclassification_db->getCfByID($autoprices[$i]['autoid']);
         $parentAuto = $autoclassification_db->getCfByID($thisAuto->parentid);
         $autoObj = bpBase::loadAppClass('autoObj', 'auto', 1);
         $logo = $autoObj->getLogo($parentAuto->id, $parentAuto->logo);
         $autoprice_db->update(array('serieid' => $parentAuto->id, 'seriename' => $parentAuto->name, 'autoname' => $thisAuto->name, 'companyprice' => $thisAuto->companyprice, 'logo' => $logo), array('autoid' => $thisAuto->id));
         //end
         $i++;
         showMessage($thisTask['des'] . ':' . $i . '/' . $count, '?m=update&c=updateTask&a=' . $taskName . '&i=' . $i, 0);
     } else {
         //删除缓存
         @rename(ABS_PATH . 'cache', ABS_PATH . 'backup' . DIRECTORY_SEPARATOR . 'cache_' . time());
         $this->_finishTask($taskName);
     }
 }
开发者ID:liuguogen,项目名称:weixin,代码行数:27,代码来源:updateTask.php

示例14: handleRelateAutoPage

 function handleRelateAutoPage()
 {
     $autoids = explode(',', $_GET['autoids']);
     /*因为只查找跟第一级车型、第三级车型相关的文章,所以只处理第一级车型和第三级车型即可*/
     $g1autoids = array();
     //第一级别车型id组成一个数组,用来判断相关车型一共有多少个不同的第一级别车型id
     $g3autoids = array();
     //第3级别车型id组成一个数组,用来判断相关车型一共有多少个不同的第一级别车型id
     //
     if ($autoids) {
         $autodb = bpBase::loadModel('autoclassification_model');
         foreach ($autoids as $autoid) {
             if (intval($autoid)) {
                 $thisAuto = $autodb->getCfByID($autoid);
                 switch (intval($thisAuto->grade)) {
                     default:
                         break;
                     case 1:
                         if (!in_array($autoid, $g1autoids)) {
                             array_push($g1autoids, $autoid);
                         }
                         $autoWhere = array('grade' => 4, 'g1id' => $thisAuto->id);
                         break;
                     case 2:
                         if (!in_array($thisAuto->parentid, $g1autoids)) {
                             array_push($g1autoids, $thisAuto->parentid);
                         }
                         $autoWhere = array('grade' => 4, 'g2id' => $thisAuto->id);
                     case 3:
                         $g1autoid = intval($thisAuto->g1id);
                         if (!in_array($g1autoid, $g1autoids)) {
                             array_push($g1autoids, $g1autoid);
                         }
                         //
                         if (!in_array($autoid, $g3autoids)) {
                             array_push($g3autoids, $autoid);
                         }
                         $autoWhere = array('grade' => 4, 'parentid' => $thisAuto->id);
                     case 4:
                         $g1autoid = intval($thisAuto->g1id);
                         if (!in_array($g1autoid, $g1autoids)) {
                             array_push($g1autoids, $g1autoid);
                         }
                         //
                         if (!in_array($thisAuto->parentid, $g3autoids)) {
                             array_push($g3autoids, $thisAuto->parentid);
                         }
                         $autoWhere = array('id' => $thisAuto->id);
                         break;
                 }
             }
         }
     }
     /*静态页列表*/
     $pages = array();
     $caches = array();
     $toHtml = loadConfig('site', 'tohtml');
     $html_refresh_db = bpBase::loadModel('htmlpage_needrefresh_model');
     if ($g1autoids) {
         foreach ($g1autoids as $g1autoid) {
             if ($toHtml) {
                 $html_refresh_db->insert(array('pagetype' => 'brandIndex', 'parmid' => $g1autoid, 'time' => SYS_TIME));
                 //品牌主页
             }
             //array_push($caches,cache_articlesOfAuto(array('autoid'=>$g1autoid)));
         }
     }
     if ($g3autoids) {
         foreach ($g3autoids as $autoid) {
             if ($toHtml) {
                 $html_refresh_db->insert(array('pagetype' => 'brandIndex', 'parmid' => $g1autoid, 'time' => SYS_TIME));
                 //品牌主页
                 $html_refresh_db->insert(array('pagetype' => 'serieIndex', 'parmid' => $autoid, 'time' => SYS_TIME));
                 //3级主页
             }
             //所有四级主页
             if ($toHtml) {
                 $childrenCfs = $autodb->get_results('*', '', $autoWhere);
                 if ($childrenCfs) {
                     foreach ($childrenCfs as $ccf) {
                         $html_refresh_db->insert(array('pagetype' => 'autoIndex', 'parmid' => $ccf->id, 'time' => SYS_TIME));
                     }
                 }
             }
             //array_push($caches,cache_articlesOfAuto(array('autoid'=>$autoid)));
         }
     }
     //生成
     $tpl = bpBase::loadAppClass('template', 'template');
     $channelObj = bpBase::loadAppClass('channelObj', 'channel');
     $thisChannel = $channelObj->getChannelByID($_GET['channelid']);
     $tpl->createContentPageR($_GET['contentid'], $thisChannel);
     /*下一个页面*/
     $nextUrl = '?m=article&c=m_article&a=articles&id=' . $_GET['channelid'] . '&site=' . $_GET['site'];
     showMessage('处理完成', $nextUrl, 500);
 }
开发者ID:liuguogen,项目名称:weixin,代码行数:96,代码来源:m_article.php

示例15: getSelectContentsSimpleSql

 public function getSelectContentsSimpleSql($channelID, $getCount = 0, $orderBy = 'taxis', $start = 0, $scope = 'self', $onlyImg = null, $exceptChannelids = '')
 {
     /*select what?*/
     $start = intval($start);
     $getCount = intval($getCount);
     /*select condition?*/
     $channelID = intval($channelID);
     $selectCondition = '';
     if ($channelID) {
         //scope
         switch ($scope) {
             default:
             case 'self':
                 $selectCondition = 'channel_id=' . $channelID;
                 break;
             case 'children':
                 $channel = bpBase::loadAppClass('channelObj', 'channel', 1);
                 $descents = $channel->getChannelsByParentID($channelID);
                 $cidStr = $channelID;
                 if ($descents) {
                     $comma = ',';
                     foreach ($descents as $item) {
                         if ($item->id) {
                             $cidStr .= $comma . $item->id;
                         }
                     }
                     $selectCondition = 'channel_id IN (' . $cidStr . ')';
                 } else {
                     $selectCondition = 'channel_id=' . $channelID;
                 }
                 break;
         }
     } else {
         $selectCondition = 'channel_id!=0';
     }
     if (!in_array($orderBy, array('taxis', 'time', 'viewcount'))) {
         $orderBy = 'time';
     }
     //is image
     if (is_null($onlyImg)) {
     } else {
         if ($onlyImg == 0) {
             $selectCondition .= ' AND (thumb IS NULL OR thumb=\'\')';
         } else {
             $selectCondition .= ' AND thumb IS NOT NULL AND thumb!=\'\'';
         }
     }
     $exceptChannelSql = '';
     if ($exceptChannelids && is_array($exceptChannelids)) {
         $exceptChannelSql = ' AND channel_id NOT IN (';
         $comma = '';
         foreach ($exceptChannelids as $exid) {
             $exceptChannelSql .= $comma . $exid;
             $comma = ',';
         }
         $exceptChannelSql .= ')';
     }
     if ($getCount) {
         $sql = 'SELECT id,site,link,externallink,thumb,title,subtitle,intro,source,author,time,keywords,pagecount,content,autoname,autograde,autoid,viewcount FROM ' . TABLE_PREFIX . 'article WHERE ' . $selectCondition . $exceptChannelSql . ' AND time<{sysTime} ORDER BY ' . $orderBy . ' DESC LIMIT ' . $start . ',' . $getCount;
     } else {
         $sql = 'SELECT id,site,link,externallink,thumb,title,subtitle,intro,source,author,time,keywords,pagecount,content,autoname,autograde,autoid,viewcount FROM ' . TABLE_PREFIX . 'article WHERE ' . $selectCondition . $exceptChannelSql . ' AND time<{sysTime} ORDER BY ' . $orderBy . ' DESC';
     }
     return $sql;
 }
开发者ID:liuguogen,项目名称:weixin,代码行数:64,代码来源:tag_contents.class.php


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