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


PHP strExists函数代码示例

本文整理汇总了PHP中strExists函数的典型用法代码示例。如果您正苦于以下问题:PHP strExists函数的具体用法?PHP strExists怎么用?PHP strExists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: import

 /**
  * 数据库导入
  */
 public function import()
 {
     $disfun = ini_get('disable_functions');
     if (!strpos($disfun, 'scandir') === false) {
         showmessage('scandir函数被禁用,请配置您的php环境支持该函数', '###', 10000);
     }
     if ($_POST['doSubmit']) {
         $files = scandir(ABS_PATH . 'backup' . DIRECTORY_SEPARATOR . $_POST['dir']);
         $sqlFiles = array();
         if ($files) {
             foreach ($files as $f) {
                 if ($f != '.' && $f != '..' && strExists($f, '.sql')) {
                     array_push($sqlFiles, ABS_PATH . 'backup' . DIRECTORY_SEPARATOR . $_POST['dir'] . DIRECTORY_SEPARATOR . $f);
                 }
             }
         }
         $sqlFilesStr = file_put_contents(ABS_PATH . 'backup' . DIRECTORY_SEPARATOR . 'importSqls.txt', serialize($sqlFiles));
         showmessage('正在执行,请勿关闭', '?m=manage&c=database&a=import_database', 1000);
     } else {
         $childDirsInDataDir = scandir(ABS_PATH . 'backup');
         $dirs = array();
         //存放备份数据的文件夹
         if ($childDirsInDataDir) {
             foreach ($childDirsInDataDir as $dir) {
                 if ($dir != '.' && $dir != '..' && strExists($dir, 'data') && is_dir(ABS_PATH . 'backup' . DIRECTORY_SEPARATOR . $dir)) {
                     array_push($dirs, $dir);
                 }
             }
         }
         include $this->showManageTpl('databaseImport');
     }
 }
开发者ID:ailingsen,项目名称:pigcms,代码行数:35,代码来源:database.php

示例2: createSitemap

 function createSitemap($type, $showMessage = 1)
 {
     $sitemapConfig = loadConfig('sitemap');
     $articleCount = $sitemapConfig['articleCount'] ? $sitemapConfig['articleCount'] : 500;
     $ucarCount = $sitemapConfig['ucarCount'] ? $sitemapConfig['ucarCount'] : 500;
     $datas = array();
     switch ($type) {
         default:
         case 'news':
             $article_db = bpBase::loadModel('article_model');
             $articles = $article_db->select(array('ex' => 0), 'link,time,title,keywords', '0,' . $articleCount, 'time DESC');
             if ($articles) {
                 foreach ($articles as $a) {
                     if (!strExists($a['link'], 'http://')) {
                         $a['link'] = MAIN_URL_ROOT . $a['link'];
                     }
                     if ($a['keywords'] == ',') {
                         $a['keywords'] = '';
                     }
                     array_push($datas, array('url' => $a['link'], 'time' => $a['time'], 'keywords' => $a['keywords']));
                 }
             }
             break;
     }
     $this->_createSitemap($type, $datas, $showMessage);
 }
开发者ID:ailingsen,项目名称:pigcms,代码行数:26,代码来源:seoObj.class.php

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

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

示例5: getTableFields

 function getTableFields($noFields = array())
 {
     //缓存字段名
     $table = $this->_getdbtable();
     $rs = F('_Fields/' . $this->dataBase->getDataBaseName() . '/_' . $table);
     if (!$rs) {
         $list = $this->dataBase->getFields($table);
         if ($list) {
             $rs = array();
             foreach ($list as $val) {
                 if ($val['Extra'] == 'auto_increment' || $val['Key'] == 'PRI') {
                     $rs['key'] = $val['Field'];
                 } else {
                     $rs['fields'][$val['Field']] = array('name' => $val['Comment'], 'value' => $val['Default'], 'null' => $val['Null'] == 'NO' ? 0 : 1, 'type' => strExists($val['Type'], 'int') ? 'int' : 'char');
                 }
             }
             F('_Fields/' . $this->dataBase->getDataBaseName() . '/_' . $table, $rs);
         }
     }
     //删除去除字段
     if ($noFields) {
         foreach ($noFields as $val) {
             if (isset($rs['fields'][$val])) {
                 unset($rs['fields'][$val]);
             }
         }
     }
     return $rs;
 }
开发者ID:sdgdsffdsfff,项目名称:51jhome_customerservice,代码行数:29,代码来源:model.class.php

示例6: _fliter

 function _fliter($path, $generatePath, $htmlStr)
 {
     $path = strtolower($path);
     $generatePath = strtolower($generatePath);
     $logFilePath = ABS_PATH . 'qinru.html';
     if (strExists($path, '.php') || strExists($generatePath, '.php')) {
         $log = date('Y-m-d H:i:s', SYS_TIME) . '----' . ip() . '<br>' . @file_get_contents($logFilePath);
         file_put_contents($logFilePath, $log);
         showMessage('路径不能包含.php', $_SERVER['HTTP_REFERER'], 2000);
         exit;
     }
     $htmlStr = strtolower($htmlStr);
     $words = array('eval(', '<?', '<%', '{php', '_post', '<FilesMatch');
     foreach ($words as $word) {
         if (strExists($htmlStr, $word)) {
             $log = date('Y-m-d H:i:s', SYS_TIME) . '----' . ip() . '<br>' . @file_get_contents($logFilePath);
             file_put_contents($logFilePath, $log);
             showMessage('模板代码中含有非法词汇', $_SERVER['HTTP_REFERER'], 2000);
             exit;
         }
     }
 }
开发者ID:liuguogen,项目名称:weixin,代码行数:22,代码来源:m_template.php

示例7: checkRobot

/**
 * 获取是否为搜索引擎爬虫
 * @param string $userAgent 用户信息
 * @return bool
 */
function checkRobot($userAgent = '')
{
    static $kwSpiders = 'Bot|Crawl|Spider|slurp|sohu-search|lycos|robozilla';
    static $kwBrowsers = 'MSIE|Netscape|Opera|Konqueror|Mozilla';
    $userAgent = empty($userAgent) ? $_SERVER['HTTP_USER_AGENT'] : $userAgent;
    if (!strExists($userAgent, 'http://') && preg_match("/({$kwBrowsers})/i", $userAgent)) {
        return false;
    } elseif (preg_match("/({$kwSpiders})/i", $userAgent)) {
        return true;
    } else {
        return false;
    }
}
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:18,代码来源:global.func.php

示例8: getLink

 /**
  * 获取链接
  *
  * @param unknown_type $url
  * @return unknown
  */
 public function getLink($url)
 {
     $url = $url ? $url : 'javascript:void(0)';
     $urlArr = explode(' ', $url);
     $urlInfoCount = count($urlArr);
     if ($urlInfoCount > 1) {
         $itemid = intval($urlArr[1]);
     }
     //会员卡 刮刮卡 团购 商城 大转盘 优惠券 订餐 商家订单 表单
     if (strExists($url, '刮刮卡')) {
         $link = '/index.php?g=Wap&m=Guajiang&a=index&token=' . $this->token . '&wecha_id=' . $this->wecha_id;
         if ($itemid) {
             $link .= '&id=' . $itemid;
         }
     } elseif (strExists($url, '大转盘')) {
         $link = '/index.php?g=Wap&m=Lottery&a=index&token=' . $this->token . '&wecha_id=' . $this->wecha_id;
         if ($itemid) {
             $link .= '&id=' . $itemid;
         }
     } elseif (strExists($url, '优惠券')) {
         $link = '/index.php?g=Wap&m=Coupon&a=index&token=' . $this->token . '&wecha_id=' . $this->wecha_id;
         if ($itemid) {
             $link .= '&id=' . $itemid;
         }
     } elseif (strExists($url, '刮刮卡')) {
         $link = '/index.php?g=Wap&m=Guajiang&a=index&token=' . $this->token . '&wecha_id=' . $this->wecha_id;
         if ($itemid) {
             $link .= '&id=' . $itemid;
         }
     } elseif (strExists($url, '商家订单')) {
         if ($itemid) {
             $link = $link = '/index.php?g=Wap&m=Host&a=index&token=' . $this->token . '&wecha_id=' . $this->wecha_id . '&hid=' . $itemid;
         } else {
             $link = '/index.php?g=Wap&m=Host&a=Detail&token=' . $this->token . '&wecha_id=' . $this->wecha_id;
         }
     } elseif (strExists($url, '万能表单')) {
         if ($itemid) {
             $link = $link = '/index.php?g=Wap&m=Selfform&a=index&token=' . $this->token . '&wecha_id=' . $this->wecha_id . '&id=' . $itemid;
         }
     } elseif (strExists($url, '相册')) {
         $link = '/index.php?g=Wap&m=Photo&a=index&token=' . $this->token . '&wecha_id=' . $this->wecha_id;
         if ($itemid) {
             $link = '/index.php?g=Wap&m=Photo&a=plist&token=' . $this->token . '&wecha_id=' . $this->wecha_id . '&id=' . $itemid;
         }
     } elseif (strExists($url, '全景')) {
         $link = '/index.php?g=Wap&m=Panorama&a=index&token=' . $this->token . '&wecha_id=' . $this->wecha_id;
         if ($itemid) {
             $link = '/index.php?g=Wap&m=Panorama&a=item&token=' . $this->token . '&wecha_id=' . $this->wecha_id . '&id=' . $itemid;
         }
     } elseif (strExists($url, '会员卡')) {
         $link = '/index.php?g=Wap&m=Card&a=index&token=' . $this->token . '&wecha_id=' . $this->wecha_id;
     } elseif (strExists($url, '商城')) {
         $link = '/index.php?g=Wap&m=Product&a=index&token=' . $this->token . '&wecha_id=' . $this->wecha_id;
     } elseif (strExists($url, '订餐')) {
         $link = '/index.php?g=Wap&m=Product&a=dining&dining=1&token=' . $this->token . '&wecha_id=' . $this->wecha_id;
     } elseif (strExists($url, '团购')) {
         $link = '/index.php?g=Wap&m=Groupon&a=grouponIndex&token=' . $this->token . '&wecha_id=' . $this->wecha_id;
     } elseif (strExists($url, '首页')) {
         $link = '/index.php?g=Wap&m=Index&a=index&token=' . $this->token . '&wecha_id=' . $this->wecha_id;
     } elseif (strExists($url, '网站分类')) {
         $link = '/index.php?g=Wap&m=Index&a=lists&token=' . $this->token . '&wecha_id=' . $this->wecha_id;
         if ($itemid) {
             $link = '/index.php?g=Wap&m=Index&a=lists&token=' . $this->token . '&wecha_id=' . $this->wecha_id . '&classid=' . $itemid;
         }
     } elseif (strExists($url, '图文回复')) {
         if ($itemid) {
             $link = '/index.php?g=Wap&m=Index&a=index&token=' . $this->token . '&wecha_id=' . $this->wecha_id . '&id=' . $itemid;
         }
     } elseif (strExists($url, 'LBS信息')) {
         $link = '/index.php?g=Wap&m=Company&a=map&token=' . $this->token . '&wecha_id=' . $this->wecha_id;
         if ($itemid) {
             $link = '/index.php?g=Wap&m=Company&a=map&token=' . $this->token . '&wecha_id=' . $this->wecha_id . '&companyid=' . $itemid;
         }
     } elseif (strExists($url, 'DIY宣传页')) {
         $link = '/index.php/show/' . $this->token;
     } elseif (strExists($url, '婚庆喜帖')) {
         if ($itemid) {
             $link = '/index.php?g=Wap&m=Wedding&a=index&token=' . $this->token . '&wecha_id=' . $this->wecha_id . '&id=' . $itemid;
         }
     } elseif (strExists($url, '投票')) {
         if ($itemid) {
             $link = '/index.php?g=Wap&m=Vote&a=index&token=' . $this->token . '&wecha_id=' . $this->wecha_id . '&id=' . $itemid;
         }
     } else {
         $link = str_replace(array('{wechat_id}', '{siteUrl}', '&amp;'), array($this->wecha_id, C('site_url'), '&'), $url);
         if (!!(strpos($url, 'tel') === false) && $url != 'javascript:void(0)' && !strpos($url, 'wecha_id=')) {
             if (strpos($url, '?')) {
                 $link = $link . '&wecha_id=' . $this->wecha_id;
             } else {
                 $link = $link . '?wecha_id=' . $this->wecha_id;
             }
         }
     }
     return $link;
//.........这里部分代码省略.........
开发者ID:SubDong,项目名称:pigcms,代码行数:101,代码来源:IndexAction.class.php

示例9: mobileIndex20130809

 public function mobileIndex20130809()
 {
     $taskName = 'mobileIndex20130809';
     $thisTask = $this->update_log_db->get_one(array('file' => $taskName));
     $this->_executedCheck($taskName, $thisTask);
     //
     $fileTemplatePath = ABS_PATH . 'templates' . DIRECTORY_SEPARATOR . AUTO_SKIN . DIRECTORY_SEPARATOR . 'index.html';
     copy($fileTemplatePath, $fileTemplatePath . '_bak');
     $code = file_get_contents($fileTemplatePath);
     if (!strExists($code, 'r={versions:function(){var u=navigator.userAgent,app=navigato')) {
         $jsStr = '{literal}<script>var browser={versions:function(){var u=navigator.userAgent,app=navigator.appVersion;return{trident:u.indexOf(\'Trident\')>-1,presto:u.indexOf(\'Presto\')>-1,webKit:u.indexOf(\'AppleWebKit\')>-1,gecko:u.indexOf(\'Gecko\')>-1&&u.indexOf(\'KHTML\')==-1,mobile:!!u.match(/AppleWebKit.*Mobile.*/)||!!u.match(/AppleWebKit/),ios:!!u.match(/\\(i[^;]+;( U;)? CPU.+Mac OS X/),android:u.indexOf(\'Android\')>-1||u.indexOf(\'Linux\')>-1,iPhone:u.indexOf(\'iPhone\')>-1||u.indexOf(\'Mac\')>-1,iPad:u.indexOf(\'iPad\')>-1,webApp:u.indexOf(\'Safari\')==-1,QQbrw:u.indexOf(\'MQQBrowser\')>-1,ucLowEnd:u.indexOf(\'UCWEB7.\')>-1,ucSpecial:u.indexOf(\'rv:1.2.3.4\')>-1,ucweb:function(){try{return parseFloat(u.match(/ucweb\\d+\\.\\d+/gi).toString().match(/\\d+\\.\\d+/).toString())>=8.2}catch(e){if(u.indexOf(\'UC\')>-1){return true;}else{return false;}}}(),Symbian:u.indexOf(\'Symbian\')>-1,ucSB:u.indexOf(\'Firefox/1.\')>-1};}()};var _gaq=_gaq||[];(function(win,browser,undefined){var rf=document.referrer;if(rf===""||rf.toLocaleLowerCase().indexOf(".{/literal}{$domainRoot}{literal}")===-1){if(screen==undefined||screen.width<810){if(browser.versions.iPad==true){return;}if(browser.versions.webKit==true||browser.versions.mobile==true||browser.versions.ios==true||browser.versions.iPhone==true||browser.versions.ucweb==true||browser.versions.ucSpecial==true){win.location.href="{/literal}{$mainUrlRoot}/index.php?m=site&c=home&a=indexSelect{literal}";return;}if(browser.versions.Symbian){win.location.href="{/literal}{$mainUrlRoot}/index.php?m=site&c=home&a=indexSelect{literal}";}}}})(window,browser);</script>{/literal}';
         $code = str_replace(array('<body id="body">', '<body>'), array('<body id="body">' . $jsStr, '<body>' . $jsStr), $code);
         file_put_contents($fileTemplatePath, $code);
     }
     //top.html
     $tfileTemplatePath = ABS_PATH . 'templates' . DIRECTORY_SEPARATOR . AUTO_SKIN . DIRECTORY_SEPARATOR . 'top.html';
     copy($tfileTemplatePath, $tfileTemplatePath . '_bak');
     $tcode = file_get_contents($tfileTemplatePath);
     if (strExists($tcode, '<li style="display:none"><a href="#" class="icon01">移动客户端</a></li>') || strExists($tcode, '<div class="fr"><a onclick="this.style.behavior=')) {
         $tcode = str_replace(array('<li style="display:none"><a href="#" class="icon01">移动客户端</a></li>', '<li style="display:none">|</li>'), array('<li><a href="/index.php?m=site&c=home&a=mobileIndexOnPC" target="_blank" class="icon01">手机版</a></li>', '<li>|</li>'), $tcode);
         $tcode = str_replace(array('<div class="fr"><a onclick="this.style.behavior='), array('<div class="fr"><a href="/index.php?m=site&c=home&a=mobileIndexOnPC" target="_blank">手机版</a>&#160;<a onclick="this.style.behavior='), $tcode);
         file_put_contents($tfileTemplatePath, $tcode);
     }
     //
     $this->_finishTask($taskName, $thisTask);
 }
开发者ID:liuguogen,项目名称:weixin,代码行数:26,代码来源:updateTask.php

示例10: strExists

?>
" />
                  <span class="help-block"></span></div>
              </div>
              <div class="form-group">
                <label class="col-sm-1 control-label">分享图片</label>
                <div class="col-sm-3">
                  <input type="text" name="imgUrl" id="imgUrl" placeholder="" class="form-control" value="<?php 
echo $rs['imgUrl'];
?>
" />
                  <span class="help-block">LOGO图标,标准尺寸110px*110px <?php 
if ($rs['imgUrl']) {
    ?>
[<a rel="pop" class="red" target="_blank" href="<?php 
    echo strExists($rs['imgUrl'], 'http://') ? $rs['imgUrl'] : getImgUrl($rs['imgUrl']);
    ?>
">预览>></a>]<?php 
}
?>
</span></div>
                <div class="col-sm-3">
                  <iframe width="280" height="24" src="<?php 
echo U('upload/index', array('id' => 'imgUrl'));
?>
" scrolling="no" frameborder="0"></iframe>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-1 control-label">分享内容</label>
                <div class="col-sm-3">
开发者ID:sdgdsffdsfff,项目名称:51jhome_customerservice,代码行数:31,代码来源:share_tpl.php

示例11: getUserAgent

/**
 * 获取访问者来源(移动端)
 * @param 无
 * @return string 用户客户端设备类型
 */
function getUserAgent()
{
    $userAgent = 'unknown';
    $ua = strtolower(USER_AGENT);
    if ($ua) {
        if (preg_match("/(mobile|iphone|android|webos|ios|wap|blackberry|meizu|mobi)/i", $ua)) {
            if (strExists($ua, 'micromessenger')) {
                $userAgent = 'weixin';
            } elseif (strExists($ua, 'iphone')) {
                $userAgent = 'iPhone';
            } elseif (strExists($ua, 'ipad')) {
                $userAgent = 'iPad';
            } elseif (strExists($ua, 'android')) {
                $userAgent = 'Android';
            } elseif (strExists($ua, 'windows phone')) {
                $userAgent = 'Windows Phone';
            } elseif (strExists($ua, 'iemobile')) {
                $userAgent = 'Windows Phone';
            } elseif (strExists($ua, 'symbianos')) {
                $userAgent = 'Symbian';
            } elseif (strExists($ua, 'nokia')) {
                $userAgent = 'Symbian';
            }
        }
    }
    return $userAgent;
}
开发者ID:sdgdsffdsfff,项目名称:51jhome_customerservice,代码行数:32,代码来源:common.php

示例12: parseFirstLayerTag

 function parseFirstLayerTag($templateid, $siteID = 0, $channelID = 0, $contentID = 0, $saveFilePath = '', $tagsArr = array(), $pagination = array('pageSize' => 20, 'totalCount' => 0, 'currentPage' => 1, 'urlPrefix' => '', 'urlSuffix' => ''), $obj = null, $type = '', $onlyTags = array(), $exceptTags = array())
 {
     if ($type == 'channel' && file_exists(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . $templateid . '.channel.parsed.tpl.php')) {
         $templateHtml = file_get_contents(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . $templateid . '.channel.parsed.tpl.php');
     } else {
         $templateHtml = file_get_contents(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . $templateid . '.parsed.tpl.php');
     }
     //
     $dir = substr(__FILE__, 0, -7);
     $i = 0;
     if (!$tagsArr) {
         include ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . $templateid . '.tags.tpl.php';
     }
     if ($tagsArr) {
         foreach ($tagsArr as $tag) {
             $parseThisTag = true;
             if (count($onlyTags) && !in_array($tag['name'], $onlyTags)) {
                 //如果标签不在限制的解析标签中则不解析
                 $parseThisTag = false;
             }
             if (in_array($tag['name'], $exceptTags)) {
                 $parseThisTag = false;
             }
             if ($parseThisTag && bpBase::loadTagClass('tag_' . $tag['name'])) {
                 $thisTagClassName = 'tag_' . $tag['name'];
                 $thisTagClass = bpBase::loadTagClass('tag_' . $tag['name'], 1);
                 $returnStr = $thisTagClass->getValue($tag['string'], $tag['avs'], $siteID, $channelID, $contentID, $pagination, $obj);
                 $templateHtml = str_replace('<tag_' . $tag['name'] . '_' . $i . '/>', $returnStr, $templateHtml);
             }
             $i++;
         }
     }
     //保存路径
     if (!$saveFilePath) {
         if ($siteID < 100) {
             $thisSpecial = '';
             $specialIndex = '';
         } else {
             //专题首页
             $special_db = bpBase::loadModel('special_model');
             $thisSpecial = $special_db->get_one(array('id' => $siteID));
             $specialIndex = $thisSpecial['specialindex'];
         }
         $tplGPath = $this->createGeneratePath($templateid, $channelID, $contentID, $thisSpecial);
         $saveFilePath = ABS_PATH . $tplGPath;
     }
     //stag
     if (strExists($templateHtml, '[stl.')) {
         $stag = bpBase::loadAppClass('stag', 'template');
         $templateHtml = $stag->handleStag($templateHtml);
     }
     file_put_contents($saveFilePath, $templateHtml);
     return $templateHtml;
 }
开发者ID:ailingsen,项目名称:pigcms,代码行数:54,代码来源:template.class.php

示例13: saveshare

 function saveshare()
 {
     $title = $this->_post('title', '');
     $imgUrl = $this->_post('imgUrl', '');
     $desc = $this->_post('desc', '');
     if ($title && $imgUrl && $desc) {
         F('steward/share_order', array('title' => $title, 'imgUrl' => strExists($imgUrl, 'http://') ? $imgUrl : getImgUrl($imgUrl), 'desc' => $desc));
         $this->JsonReturn('操作成功', null, 1);
     } else {
         $this->JsonReturn('内容不能为空');
     }
 }
开发者ID:sdgdsffdsfff,项目名称:51jhome_customerservice,代码行数:12,代码来源:homeAction.class.php

示例14: page

function page($total, $page, $showId = '', $pageSize = 20, $mypage = 'p', $url = '', $maxLength = 5)
{
    $page = intval($page);
    $page = $page < 1 ? 1 : $page;
    $start = ($page - 1) * $pageSize;
    $totalPage = ceil($total / $pageSize);
    $totalPage = $totalPage < 1 ? 1 : $totalPage;
    $page = $page > $totalPage ? $totalPage : $page;
    $showType = 'href';
    if (!empty($showId)) {
        $showType = 'href="javascript:;" rel';
        $showId .= '_pagebox';
    }
    $urlHome = '';
    //如果$url使用默认,即空值,则赋值为本页URL:
    if (!$url) {
        //        $url = $_SERVER['REQUEST_URI'];
        $urlHome = U(getUrlStrList(array($mypage => null), true));
    }
    //===========解析参数开始,主要为去掉分页标示======
    if (C('System', 'path_mod') == '1' && C('System', 'postfix')) {
        //开启路由模式
        $urlHome = str_replace(C('System', 'postfix'), '', $urlHome);
    } else {
        if (!strExists($urlHome, '?')) {
            $urlHome .= '?';
        } else {
            $urlHome .= '&';
        }
        if (strExists($urlHome, '?&')) {
            $urlHome = str_replace('?&', '?', $urlHome);
        }
    }
    //===========解析参数结束,主要为去掉分页标示======
    $pageTable = '';
    //aways in the pages
    $pageTable = '<div id="' . $showId . '" class="pagebox">';
    $pageTable .= '<span class="total">共 ' . $total . ' 条 <font class="red">' . $page . '</font>/' . $totalPage . '页</span>';
    //显示第一页
    if ($page == 1) {
        $pageTable .= '<span class="nolink">上页</span><span class="nonce">1</span>';
    } else {
        $pageTable .= '<a ' . $showType . '="' . _mkpageurl($urlHome, $mypage, $page - 1) . '" target="_self">上页</a><a ' . $showType . '="' . _mkpageurl($urlHome, $mypage, 1) . '" target="_self">1</a>';
    }
    //循环中间页码
    if ($totalPage < $maxLength * 2) {
        $loopStart = 2;
        $loopEnd = $totalPage - 1;
    } else {
        $loopStart = $page - $maxLength;
        $loopStart = $loopStart < 2 ? 2 : $loopStart;
        $loopEnd = $page + $maxLength;
        $loopEnd = $loopEnd < $maxLength * 2 ? $maxLength * 2 : $loopEnd;
        $loopEnd = $loopEnd > $totalPage ? $totalPage - 1 : $loopEnd;
    }
    //... link
    $linkStart = $loopStart - $maxLength < 2 ? 2 : $loopStart - $maxLength;
    $linkEnd = $loopEnd + $maxLength > $totalPage ? $totalPage : $loopEnd + $maxLength;
    if ($loopStart > 2) {
        $pageTable .= '<a ' . $showType . '="' . _mkpageurl($urlHome, $mypage, $linkStart) . '" target="_self">...</a>';
    }
    //中间链接
    for ($i = $loopStart; $i <= $loopEnd; $i++) {
        if ($page == $i) {
            $pageTable .= '<span class="nonce">' . $i . '</span>';
        } else {
            $pageTable .= '<a ' . $showType . '="' . _mkpageurl($urlHome, $mypage, $i) . '" target="_self">' . $i . '</a>';
        }
    }
    if ($loopEnd < $totalPage - 1) {
        $pageTable .= '<a ' . $showType . '="' . _mkpageurl($urlHome, $mypage, $linkEnd) . '" target="_self">...</a>';
    }
    //末页链接
    if ($totalPage != 1) {
        if ($page == $totalPage) {
            $pageTable .= '<span class="nonce">' . $totalPage . '</span><span class="nolink">下页</span>';
        } else {
            $pageTable .= '<a ' . $showType . '="' . _mkpageurl($urlHome, $mypage, $totalPage) . '" target="_self">' . $totalPage . '</a><a ' . $showType . '="' . _mkpageurl($urlHome, $mypage, $page + 1) . '" target="_self">下页</a>';
        }
    } else {
        $pageTable .= '<span class="nolink">下页</span>';
    }
    $pageTable .= '</div>';
    //输出分页代码
    return $pageTable;
}
开发者ID:sdgdsffdsfff,项目名称:51jhome_customerservice,代码行数:86,代码来源:view.fun.php

示例15: getLinkInfo

 /**
  * 根据url判断文章类型,文章id,因为有些文章是外部链接,移动版无法直接读取外部链接
  *
  * @param unknown_type $url
  */
 function getLinkInfo($url)
 {
     if (!strExists($url, 'http:') || strExists($url, DOMAIN_ROOT)) {
         //肯定是站内的
         if (strExists($url, 'store/')) {
             //经销商新闻
             $urls = explode('/', $url);
             $count = count($urls);
             $id = str_replace('.html', '', $urls[$count - 1]);
             //
             $store_content_db = bpBase::loadModel('store_content_model');
             $thisContent = $store_content_db->get($id);
             //
             return array('type' => 'storeContent', 'id' => $id, 'storeid' => $thisContent->storeid);
         } else {
             //普通文章
             $urls = explode('/', $url);
             $count = count($urls);
             $id = str_replace(array('.html', '.shtml'), '', $urls[$count - 1]);
             return array('type' => 'content', 'id' => $id);
         }
     } else {
         //站外的地址
         return null;
     }
 }
开发者ID:ailingsen,项目名称:pigcms,代码行数:31,代码来源:articleObj.class.php


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