當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。