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


PHP helper::getDevice方法代码示例

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


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

示例1: loadConfigFromDB

 /**
  * Load configs from database and save it to config->system and config->personal.
  * 
  * @access public
  * @return void
  */
 public function loadConfigFromDB()
 {
     /* Get configs of system and current user. */
     $account = isset($this->app->user->account) ? $this->app->user->account : '';
     if ($this->config->db->name) {
         $config = $this->loadModel('setting')->getSysAndPersonalConfig($account);
     }
     $this->config->system = isset($config['system']) ? $config['system'] : array();
     $this->config->personal = isset($config[$account]) ? $config[$account] : array();
     /* Overide the items defined in config/config.php and config/my.php. */
     if (isset($this->config->system->common)) {
         foreach ($this->config->system->common as $record) {
             if ($record->section) {
                 if (!isset($this->config->{$record->section})) {
                     $this->config->{$record->section} = new stdclass();
                 }
                 if ($record->key) {
                     $this->config->{$record->section}->{$record->key} = $record->value;
                 }
             } else {
                 if (!$record->section) {
                     $this->config->{$record->key} = $record->value;
                 }
             }
         }
     }
     $device = helper::getDevice();
     if (isset($this->config->template->{$device}) and !is_object($this->config->template->{$device})) {
         $this->config->template->{$device} = json_decode($this->config->template->{$device});
     }
     if (!isset($this->config->site->status)) {
         $this->config->site->status = 'normal';
     }
     if ($this->loadModel('wechat')->getList()) {
         $this->config->site->wechat = true;
     }
 }
开发者ID:echenxin-company,项目名称:QuanFangXing,代码行数:43,代码来源:model.php

示例2: isset

?>
          <div class='tab-pane theme-control-tab-pane' id='cssTab'>
            <?php 
echo html::textarea('css', isset($block->content->custom->{$theme}->css) && !empty($block->content->custom->{$theme}->css) ? $block->content->custom->{$theme}->css : "#blockID\n{\n  /*.panel-heading {}*/\n  /*.panel-body    {}*/\n}", "rows=20 class='form-control codeeditor' data-mode='css' data-height='350'");
?>
            <p class='text-info text-tip'><?php 
echo $lang->block->placeholder->customStyleTip;
?>
</p>
          </div>
          <div class='tab-pane theme-control-tab-pane' id='jsTab'>
            <?php 
echo html::textarea('js', isset($block->content->custom->{$theme}->js) ? $block->content->custom->{$theme}->js : '', "rows=20 class='form-control codeeditor' data-mode='javascript' data-height='350'");
?>
            <?php 
$device = helper::getDevice();
?>
            <?php 
if ($device == 'mobile') {
    ?>
<p class='text-info text-tip'><?php 
    echo $lang->block->placeholder->mobileCustomScriptTip;
    ?>
</p><?php 
}
?>
            <?php 
if ($device == 'desktop') {
    ?>
<p class='text-info text-tip'><?php 
    echo $lang->block->placeholder->desktopCustomScriptTip;
开发者ID:qiaqiali,项目名称:chanzhieps,代码行数:31,代码来源:edit.html.php

示例3: parseBlockContent

 /**
  * Parse the content of one block.
  *
  * @param  object    $block
  * @param  bool      $withGrid
  * @param  string    $containerHeader
  * @param  string    $containerFooter
  * @access private
  * @return string
  */
 private function parseBlockContent($block, $withGrid = false, $containerHeader, $containerFooter)
 {
     $withGrid = ($withGrid and isset($block->grid));
     $isRegion = isset($block->type) && $block->type === 'region';
     if ($isRegion || !empty($block->children)) {
         if ($withGrid) {
             if ($block->grid == 0) {
                 echo "<div class='col col-row'><div class='row' data-id='{$block->id}'>";
             } else {
                 echo "<div class='col col-row' data-grid='{$block->grid}'><div class='row' data-id='{$block->id}'>";
             }
         }
         if (!empty($block->children)) {
             foreach ($block->children as $child) {
                 $this->parseBlockContent($child, $withGrid, $containerHeader, $containerFooter);
             }
         }
         if ($withGrid) {
             echo '</div></div>';
         }
     } else {
         if ($withGrid) {
             if (!isset($block->grid)) {
                 $block->grid = 12;
             }
             if ($block->grid == 0) {
                 echo "<div class='col'>";
             } else {
                 echo "<div class='col' data-grid='{$block->grid}'>";
             }
         }
         $device = helper::getDevice();
         $template = $this->config->template->{$device}->name;
         $theme = $this->config->template->{$device}->theme;
         $tplPath = $this->app->getTplRoot() . $template . DS . 'view' . DS . 'block' . DS;
         /* First try block/ext/sitecode/view/block/ */
         $extBlockRoot = $tplPath . "/ext/_{$this->config->site->code}/";
         $blockFile = $extBlockRoot . strtolower($block->type) . '.html.php';
         /* Then try block/ext/view/block/ */
         if (!file_exists($blockFile)) {
             $extBlockRoot = $tplPath . 'ext' . DS;
             $blockFile = $extBlockRoot . strtolower($block->type) . '.html.php';
             /* No ext file, use the block/view/block/. */
             if (!file_exists($blockFile)) {
                 $blockFile = $tplPath . strtolower($block->type) . '.html.php';
                 if (!file_exists($blockFile)) {
                     if ($withGrid) {
                         echo '</div>';
                     }
                     return '';
                 }
             }
         }
         foreach ($this->config->block->categoryList as $category => $typeList) {
             if (is_numeric(strpos($typeList, ",{$block->type},"))) {
                 $blockCategory = $category;
             }
         }
         $blockClass = "block-{$blockCategory}-{$block->type}";
         if (isset($block->borderless) and $block->borderless) {
             $blockClass .= ' panel-borderless';
         }
         if (isset($block->titleless) and $block->titleless) {
             $blockClass .= ' panel-titleless';
         }
         $content = is_object($block->content) ? $block->content : json_decode($block->content);
         if (isset($content->class)) {
             $blockClass .= ' ' . $content->class;
         }
         if (isset($this->config->block->defaultIcons[$block->type])) {
             $defaultIcon = $this->config->block->defaultIcons[$block->type];
             $iconClass = isset($content->icon) ? $content->icon : $defaultIcon;
             $icon = $iconClass ? "<i class='icon panel-icon {$iconClass}'></i> " : "";
         }
         $style = '<style>';
         if (isset($content->custom->{$theme})) {
             $style .= '#block' . $block->id . '{';
             $style .= !empty($content->custom->{$theme}->backgroundColor) ? 'background-color:' . $content->custom->{$theme}->backgroundColor . ' !important;' : '';
             $style .= !empty($content->custom->{$theme}->textColor) ? 'color:' . $content->custom->{$theme}->textColor . ' !important;;' : '';
             $style .= !empty($content->custom->{$theme}->borderColor) ? 'border-color:' . $content->custom->{$theme}->borderColor . ' !important;' : '';
             $style .= '}';
             $style .= '#block' . $block->id . ' .panel-heading{';
             $style .= !empty($content->custom->{$theme}->titleColor) ? 'color:' . $content->custom->{$theme}->titleColor . ';' : '';
             $style .= !empty($content->custom->{$theme}->titleBackground) ? 'background:' . $content->custom->{$theme}->titleBackground . ' !important;;' : '';
             $style .= '}';
             $style .= !empty($content->custom->{$theme}->iconColor) ? '#block' . $block->id . ' .panel-icon {color:' . $content->custom->{$theme}->iconColor . ' !important;}' : '';
             $style .= !empty($content->custom->{$theme}->linkColor) ? '#block' . $block->id . ' a{color:' . $content->custom->{$theme}->linkColor . ' !important;}' : '';
             $style .= isset($content->custom->{$theme}->paddingTop) ? '#block' . $block->id . ' .panel-body' . '{padding-top:' . $content->custom->{$theme}->paddingTop . 'px !important;}' : '';
             $style .= isset($content->custom->{$theme}->paddingRight) ? '#block' . $block->id . ' .panel-body' . '{padding-right:' . $content->custom->{$theme}->paddingRight . 'px !important;}' : '';
             $style .= isset($content->custom->{$theme}->paddingBottom) ? '#block' . $block->id . ' .panel-body' . '{padding-bottom:' . $content->custom->{$theme}->paddingBottom . 'px !important;}' : '';
//.........这里部分代码省略.........
开发者ID:wenyinos,项目名称:chanzhieps,代码行数:101,代码来源:model.php

示例4: setOptionWithFile

 /**
  * Set UI option with file.
  *
  * @param  int    $type
  * @param  int    $htmlTagName
  * @access public
  * @return void
  */
 public function setOptionWithFile($section, $htmlTagName, $allowedFileType = 'jpg,jpeg,png,gif,bmp')
 {
     if (empty($_FILES)) {
         return array('result' => false, 'message' => $this->lang->ui->noSelectedFile);
     }
     $fileType = substr($_FILES['files']['name'], strrpos($_FILES['files']['name'], '.') + 1);
     if (strpos($allowedFileType, $fileType) === false) {
         return array('result' => false, 'message' => sprintf($this->lang->ui->notAlloweFileType, $allowedFileType));
     }
     $fileModel = $this->loadModel('file');
     if (!$this->file->checkSavePath()) {
         return array('result' => false, 'message' => $this->lang->file->errorUnwritable);
     }
     /* Delete old files. */
     if ($section != 'logo') {
         $clientLang = $this->app->getClientLang();
         $oldFiles = $this->dao->select('id')->from(TABLE_FILE)->where('objectType')->eq($section)->andWhere('lang')->eq($clientLang)->fetchAll('id');
         foreach ($oldFiles as $file) {
             $fileModel->delete($file->id);
         }
         if (dao::isError()) {
             return array('result' => false, 'message' => $this->lang->fail);
         }
     }
     /* Upload new logo. */
     $uploadResult = $fileModel->saveUpload($htmlTagName);
     if (!$uploadResult) {
         return array('result' => false, 'message' => $this->lang->fail);
     }
     $fileIdList = array_keys($uploadResult);
     $file = $fileModel->getById($fileIdList[0]);
     /* Save new data. */
     $setting = new stdclass();
     $setting->fileID = $file->id;
     $setting->pathname = $file->pathname;
     $setting->webPath = $file->webPath;
     $setting->addedBy = $file->addedBy;
     $setting->addedDate = $file->addedDate;
     if ($section == 'logo') {
         $device = helper::getDevice();
         $template = $this->config->template->{$device}->name;
         $theme = $this->post->theme == 'all' ? 'all' : $this->config->template->{$device}->theme;
         $logo = isset($this->config->site->logo) ? json_decode($this->config->site->logo, true) : array();
         if (!isset($logo[$template])) {
             $logo[$template] = array();
         }
         $logo[$template]['themes'][$theme] = $setting;
         $result = $this->loadModel('setting')->setItems('system.common.site', array($section => helper::jsonEncode($logo)));
     } else {
         $result = $this->loadModel('setting')->setItems('system.common.site', array($section => helper::jsonEncode($setting)));
     }
     if ($result) {
         return array('result' => true);
     }
     return array('result' => false, 'message' => $this->lang->fail);
 }
开发者ID:jnan77,项目名称:chanzhieps,代码行数:64,代码来源:model.php

示例5: createLink

 /**
  * Create a link to a module's method.
  * 
  * This method also mapped in control class to call conveniently.
  * <code>
  * <?php
  * helper::createLink('hello', 'index', 'var1=value1&var2=value2');
  * helper::createLink('hello', 'index', array('var1' => 'value1', 'var2' => 'value2');
  * ?>
  * </code>
  * @param string       $moduleName     module name
  * @param string       $methodName     method name
  * @param string|array $vars           the params passed to the method, can be array('key' => 'value') or key1=value1&key2=value2) or key1=value1&key2=value2
  * @param string|array $alias          the alias  params passed to the method, can be array('key' => 'value') or key1=value1&key2=value2) or key1=value1&key2=value2
  * @param string       $viewType       the view type
  * @static
  * @access public
  * @return string the link string.
  */
 public static function createLink($moduleName, $methodName = 'index', $vars = '', $alias = array(), $viewType = '')
 {
     global $app, $config;
     $requestType = $config->requestType;
     if (defined('FIX_PATH_INFO2') and FIX_PATH_INFO2) {
         $config->requestType = 'PATH_INFO2';
     }
     $clientLang = $app->getClientLang();
     $lang = $config->langCode;
     /* Set viewType is mhtml if visit with mobile.*/
     if (!$viewType and RUN_MODE == 'front' and helper::getDevice() == 'mobile' and $methodName != 'oauthCallback') {
         $viewType = 'mhtml';
     }
     /* Set vars and alias. */
     if (!is_array($vars)) {
         parse_str($vars, $vars);
     }
     if (!is_array($alias)) {
         parse_str($alias, $alias);
     }
     foreach ($alias as $key => $value) {
         $alias[$key] = urlencode($value);
     }
     /* Seo modules return directly. */
     if (helper::inSeoMode() and method_exists('uri', 'create' . $moduleName . $methodName)) {
         if ($config->requestType == 'PATH_INFO2') {
             $config->webRoot = $_SERVER['SCRIPT_NAME'] . '/';
         }
         $link = call_user_func_array('uri::create' . $moduleName . $methodName, array('param' => $vars, 'alias' => $alias, 'viewType' => $viewType));
         /* Add client lang. */
         if ($lang and $link) {
             $link = $config->webRoot . $lang . '/' . substr($link, strlen($config->webRoot));
         }
         if ($config->requestType == 'PATH_INFO2') {
             $config->webRoot = getWebRoot();
         }
         $config->requestType = $requestType;
         if ($link) {
             return $link;
         }
     }
     /* Set the view type. */
     if (empty($viewType)) {
         $viewType = $app->getViewType();
     }
     if ($config->requestType == 'PATH_INFO') {
         $link = $config->webRoot;
     }
     if ($config->requestType == 'PATH_INFO2') {
         $link = $_SERVER['SCRIPT_NAME'] . '/';
     }
     if ($config->requestType == 'GET') {
         $link = $_SERVER['SCRIPT_NAME'];
     }
     if ($config->requestType != 'GET' and $lang) {
         $link .= "{$lang}/";
     }
     /* Common method. */
     if (helper::inSeoMode()) {
         /* If the method equal the default method defined in the config file and the vars is empty, convert the link. */
         if ($methodName == $config->default->method and empty($vars)) {
             /* If the module also equal the default module, change index-index to index.html. */
             if ($moduleName == $config->default->module) {
                 $link .= 'index.' . $viewType;
             } elseif ($viewType == $app->getViewType()) {
                 $link .= $moduleName . '/';
             } else {
                 $link .= $moduleName . '.' . $viewType;
             }
         } else {
             $link .= "{$moduleName}{$config->requestFix}{$methodName}";
             foreach ($vars as $value) {
                 $link .= "{$config->requestFix}{$value}";
             }
             $link .= '.' . $viewType;
         }
     } else {
         $link .= "?{$config->moduleVar}={$moduleName}&{$config->methodVar}={$methodName}";
         if ($viewType != 'html') {
             $link .= "&{$config->viewVar}=" . $viewType;
         }
//.........这里部分代码省略.........
开发者ID:qiaqiali,项目名称:chanzhieps,代码行数:101,代码来源:helper.class.php

示例6: setSavePath

 public function setSavePath($objectType = '')
 {
     $savePath = $this->app->getDataRoot() . "upload/" . date('Ym/', $this->now);
     $this->savePath = dirname($savePath) . '/';
     if ($objectType == 'source') {
         $device = helper::getDevice();
         $template = $this->config->template->{$device}->name;
         $theme = $this->config->template->{$device}->theme;
         $savePath = $this->app->getDataRoot() . "source/{$template}/{$theme}/";
         $this->savePath = $this->app->getDataRoot();
     }
     if (!file_exists($savePath)) {
         @mkdir($savePath, 0777, true);
         if (is_writable($savePath) && !file_exists($savePath . DS . 'index.html')) {
             $fd = @fopen($savePath . DS . 'index.html', "a+");
             fclose($fd);
             chmod($savePath . DS . 'index.html', 0755);
         }
     }
 }
开发者ID:hansen1416,项目名称:eastsoft,代码行数:20,代码来源:model.php

示例7: checkSameFile

 /**
  * Check title conflict or not.
  * 
  * @param  int     $fileID 
  * @param  string  $filename 
  * @access public
  * @return void
  */
 public function checkSameFile($filename, $fileID = 0)
 {
     $device = helper::getDevice();
     $template = $this->config->template->{$device}->name;
     $theme = $this->config->template->{$device}->theme;
     return $this->dao->select('*')->from(TABLE_FILE)->where('title')->eq($filename)->andWhere('objectType')->eq('source')->andWhere('objectID')->eq("{$template}_{$theme}")->beginIF($fileID)->andWhere('id')->ne($fileID)->fi()->fetch();
 }
开发者ID:hansen1416,项目名称:eastsoft,代码行数:15,代码来源:model.php

示例8: loadLang

 /**
  * Load lang and return it as the global lang object.
  * 
  * @param   string $moduleName     the module name
  * @access  public
  * @return  bool|ojbect the lang object or false.
  */
 public function loadLang($moduleName)
 {
     $modulePath = $this->getModulePath($moduleName);
     $mainLangFile = $modulePath . 'lang' . DS . $this->clientLang . '.php';
     /* get ext lang files. */
     $extLangPath = $this->getModuleExtPath($moduleName, 'lang');
     $commonExtLangFiles = helper::ls($extLangPath['common'] . $this->clientLang, '.php');
     $siteExtLangFiles = helper::ls($extLangPath['site'] . $this->clientLang, '.php');
     $extLangFiles = array_merge($commonExtLangFiles, $siteExtLangFiles);
     /* Set the files to includ. */
     if (!is_file($mainLangFile)) {
         if (empty($extLangFiles)) {
             return false;
         }
         // also no extension file.
         $langFiles = $extLangFiles;
     } else {
         $langFiles = array_merge(array($mainLangFile), $extLangFiles);
     }
     global $app;
     if (is_object($app)) {
         $device = helper::getDevice();
         $langPath = $this->getTplRoot() . $this->config->template->{$device}->name . DS . 'lang' . DS . $moduleName . DS;
         $templateLangFile = $langPath . $this->clientLang . '.php';
         if (file_exists($templateLangFile)) {
             $langFiles[] = $templateLangFile;
         }
     }
     global $lang;
     if (!is_object($lang)) {
         $lang = new language();
     }
     if (!isset($lang->{$moduleName})) {
         $lang->{$moduleName} = new stdclass();
     }
     static $loadedLangs = array();
     foreach ($langFiles as $langFile) {
         if (in_array($langFile, $loadedLangs)) {
             continue;
         }
         include $langFile;
         $loadedLangs[] = $langFile;
     }
     $this->lang = $lang;
     return $lang;
 }
开发者ID:hansen1416,项目名称:eastsoft,代码行数:53,代码来源:router.class.php

示例9: setCurrentDevice

 /**
  * Set current device of visit website.
  * 
  * @access public
  * @return void
  */
 public function setCurrentDevice()
 {
     $this->device = helper::getDevice();
 }
开发者ID:peirancao,项目名称:chanzhieps,代码行数:10,代码来源:control.class.php


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