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


PHP PHPWS_Core::getConfigFile方法代码示例

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


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

示例1: getIconView

 public function getIconView($mode = 'icon')
 {
     static $icon_list = NULL;
     if (empty($icon_list)) {
         $file = PHPWS_Core::getConfigFile('filecabinet', 'icons.php');
         if (!$file) {
             return sprintf('<img class="fc-mime-icon" src="' . PHPWS_SOURCE_HTTP . 'mod/filecabinet/img/mime_types/text.png" title="%s" alt="%s" />', htmlspecialchars($this->title, ENT_QUOTES), htmlspecialchars($this->title, ENT_QUOTES));
         } else {
             include $file;
         }
     }
     if (isset($icon_list[$this->file_type])) {
         $graphic = $icon_list[$this->file_type];
         if ($mode == 'small_icon') {
             $graphic = 's_' . $graphic;
         }
         return sprintf('<img class="fc-mime-icon" src="' . PHPWS_SOURCE_HTTP . 'mod/filecabinet/img/mime_types/%s" title="%s" alt="%s" />', $graphic, htmlspecialchars($this->title, ENT_QUOTES), htmlspecialchars($this->title, ENT_QUOTES));
     } else {
         if ($mode == 'small_icon') {
             return sprintf('<img class="fc-mime-icon" src="' . PHPWS_SOURCE_HTTP . 'mod/filecabinet/img/mime_types/s_text.png" title="%s" alt="%s" />', htmlspecialchars($this->title, ENT_QUOTES), htmlspecialchars($this->title, ENT_QUOTES));
         } else {
             return sprintf('<img class="fc-mime-icon" src="' . PHPWS_SOURCE_HTTP . 'mod/filecabinet/img/mime_types/text.png" title="%s" alt="%s" />', htmlspecialchars($this->title, ENT_QUOTES), htmlspecialchars($this->title, ENT_QUOTES));
         }
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:25,代码来源:Document.php

示例2: get

 public static function get($value, $module, $funcName = NULL, $extraInfo = NULL)
 {
     $current_language = Language::getLocale();
     Language::setLocale(DEFAULT_LANGUAGE);
     if (empty($module)) {
         return PHPWS_Error::get(PHPWS_NO_MODULE, 'core', 'PHPWS_Error::get', 'Value: ' . $value . ', Function: ' . $funcName);
     }
     try {
         $errorFile = PHPWS_Core::getConfigFile($module, 'error.php');
     } catch (\Exception $e) {
         $errorFile = null;
     }
     if (empty($errorFile)) {
         // Error file not found in local config directory. Checking inc/ source directory
         if ($module == 'core') {
             $errorFile = PHPWS_SOURCE_DIR . 'core/inc/error.php';
         } else {
             $errorFile = PHPWS_SOURCE_DIR . 'mod/' . $module . '/inc/error.php';
         }
         if (!is_file($errorFile)) {
             // prevent infinite loop
             if ($module == 'core') {
                 echo _('Core could not locate its error.php file.');
                 die;
             }
             return PHPWS_Error::get(PHPWS_NO_ERROR_FILE, 'core', 'PHPWS_Error::get', 'Module: ' . $module);
         }
     }
     include $errorFile;
     if (!isset($errors)) {
         return FALSE;
     }
     if (PHPWS_Error::isError($value)) {
         $value = $value->getCode();
     }
     if ($module != 'core') {
         $fullError[] = $module;
     } else {
         $fullError[] = 'Core';
     }
     if (isset($funcName)) {
         $fullError[] = " - {$funcName}()";
     }
     if (isset($errors[$value])) {
         $message = $errors[$value];
     } else {
         $message = _('Unknown error code.');
     }
     $fullError[] = ' - ' . $message;
     if (isset($extraInfo)) {
         if (is_array($extraInfo)) {
             $message = vsprintf($message, $extraInfo);
         } else {
             $fullError[] = ' [' . $extraInfo . ']';
         }
     }
     $error = PHPWS_Error::raiseError($message, $value, NULL, NULL, implode('', $fullError));
     Language::setLocale($current_language);
     return $error;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:60,代码来源:PHPWS_Error.php

示例3: registerModule

 public static function registerModule($module, &$content)
 {
     if (is_file(PHPWS_SOURCE_DIR . 'mod/' . $module . '/conf/rss.php')) {
         $reg_file = PHPWS_Core::getConfigFile($module, 'rss.php');
     } else {
         $reg_file = false;
     }
     if ($reg_file == FALSE) {
         PHPWS_Boost::addLog($module, dgettext('rss', 'No RSS file found.'));
         return FALSE;
     }
     PHPWS_Core::initModClass('rss', 'Channel.php');
     include $reg_file;
     $oChannel = new RSS_Channel();
     $oChannel->module = $module;
     if (!isset($channel) || !is_array($channel)) {
         $content[] = dgettext('rss', 'RSS file found but no channel information.');
         PHPWS_Boost::addLog($module, dgettext('rss', 'RSS file found but no channel information.'));
     }
     $oModule = new PHPWS_Module($module);
     if (!empty($channel['title'])) {
         $oChannel->title = strip_tags($channel['title']);
     } else {
         $oChannel->title = $oModule->proper_name;
     }
     if (!empty($channel['description'])) {
         $oChannel->description = strip_tags($channel['description']);
     }
     if (!empty($channel['link'])) {
         $oChannel->link = strip_tags($channel['link']);
     } else {
         $oChannel->link = PHPWS_Core::getHomeHttp();
     }
     $result = $oChannel->save();
     if (PHPWS_Error::isError($result)) {
         PHPWS_Error::log($result);
         PHPWS_Boost::addLog($module, dgettext('rss', 'An error occurred registering to RSS module.'));
         $content[] = dgettext('rss', 'An error occurred registering to RSS module.');
         return NULL;
     } else {
         $content[] = sprintf(dgettext('rss', 'RSS registration to %s module successful.'), $oModule->proper_name);
         return TRUE;
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:44,代码来源:RSS.php

示例4: userForm

 public static function userForm(PHPWS_User $user, $message = NULL)
 {
     require_once PHPWS_SOURCE_DIR . 'core/class/Time.php';
     javascript('jquery');
     $form = new PHPWS_Form();
     $form->addHidden('module', 'users');
     $form->addHidden('action', 'user');
     $form->addHidden('command', 'my_page');
     $form->addHidden('subcommand', 'postUser');
     if (Current_User::allow('users') || $user->display_name == $user->username) {
         $form->addText('display_name', $user->display_name);
         $form->setClass('display_name', 'form-control');
         $form->setLabel('display_name', dgettext('users', 'Display Name'));
     } else {
         $form->addTplTag('DISPLAY_NAME_LABEL', dgettext('users', 'Display Name'));
         $tpl['DISPLAY_NAME'] = javascript('slider', array('link' => $user->display_name, 'id' => 'name-info', 'message' => dgettext('users', 'Once you change your display name, you may not change it again until reset by the site administrator.')));
     }
     if ($user->canChangePassword()) {
         $form->addPassword('password1');
         $form->setAutoComplete('password1');
         $form->setClass('password1', 'form-control');
         $form->addPassword('password2');
         $form->setAutoComplete('password2');
         $form->setClass('password2', 'form-control');
         $form->setTitle('password2', dgettext('users', 'Password confirm'));
         $form->setLabel('password1', dgettext('users', 'Password'));
     } else {
         $tpl['PASSWORD1_LABEL'] = dgettext('users', 'Password');
         $tpl['PASSWORD1'] = javascript('slider', array('link' => dgettext('users', 'Why can\'t I change my password?'), 'id' => 'pw-info', 'message' => dgettext('users', 'Your account is authorized external to this site. You will need to update it at the source.')));
     }
     $form->addText('email', $user->getEmail());
     $form->setSize('email', 40);
     $form->setLabel('email', dgettext('users', 'Email Address'));
     $form->setClass('email', 'form-control');
     if (isset($tpl)) {
         $form->mergeTemplate($tpl);
     }
     $tz_list = PHPWS_Time::getTZList();
     $timezones['server'] = dgettext('users', '-- Use server\'s time zone --');
     foreach ($tz_list as $tz) {
         if (!empty($tz['codes'])) {
             $timezones[$tz['id']] = sprintf('%s : %s', $tz['id'], $tz['codes'][0]);
         } elseif (!empty($tz['city'])) {
             $timezones[$tz['id']] = sprintf('%s : %s', $tz['id'], $tz['city'][0]);
         } else {
             $timezones[$tz['id']] = $tz['id'];
         }
     }
     if (isset($_REQUEST['timezone'])) {
         $user_tz = $_REQUEST['timezone'];
     } else {
         $user_tz = PHPWS_Cookie::read('user_tz');
     }
     $form->addSelect('timezone', $timezones);
     $form->setLabel('timezone', dgettext('users', 'Time Zone'));
     $form->setMatch('timezone', $user_tz);
     $form->setClass('timezone', 'form-control');
     if (isset($_REQUEST['dst']) && $_REQUEST['timezone'] != 'server') {
         $dst = $_REQUEST['dst'];
     } else {
         $dst = PHPWS_Cookie::read('user_dst');
     }
     $form->addCheckbox('dst', 1);
     $form->setMatch('dst', $dst);
     $form->setLabel('dst', dgettext('users', 'Use Daylight Savings Time'));
     if (isset($_POST['cp'])) {
         $cp = (int) $_POST['cp'];
     } else {
         $cp = (int) PHPWS_Cookie::read('user_cp');
     }
     if (Current_User::allowRememberMe()) {
         // User must authorize locally
         if ($_SESSION['User']->authorize == 1) {
             $form->addCheckbox('remember_me', 1);
             if (PHPWS_Cookie::read('remember_me')) {
                 $form->setMatch('remember_me', 1);
             }
             $form->setLabel('remember_me', dgettext('users', 'Remember me'));
         }
     }
     $form->addHidden('userId', $user->getId());
     $form->addSubmit('submit', dgettext('users', 'Update my information'));
     $form->setClass('submit', 'btn btn-primary');
     if (!DISABLE_TRANSLATION && !FORCE_DEFAULT_LANGUAGE) {
         $language_file = PHPWS_Core::getConfigFile('users', 'languages.php');
         if ($language_file) {
             include $language_file;
             $form->addSelect('language', $languages);
             $form->setClass('language', 'form-control');
             $form->setLabel('language', dgettext('users', 'Language preference'));
             if (isset($_COOKIE['phpws_default_language'])) {
                 $language = preg_replace('/\\W/', '', $_COOKIE['phpws_default_language']);
                 $form->setMatch('language', $language);
             }
         }
     }
     $template = $form->getTemplate();
     if (isset($message)) {
         foreach ($message as $tag => $error) {
             $template[$tag] = $error;
//.........这里部分代码省略.........
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:101,代码来源:my_page.php

示例5: parseKeywords

 /**
  * Filters text and clears common words from the inputed text
  */
 public function parseKeywords($text)
 {
     if (empty($text)) {
         return;
     }
     $text = $this->filterWords($text, false);
     /*
      $language = str_ireplace('.utf-8', '',
      Settings::get('Global', 'language'));
      $file_name = strtolower($language . '_wordlist.txt');
     */
     $file_name = 'en_us_wordlist.txt';
     // Removes trademark/registered, contractions, and website suffix
     $text = preg_replace('/(n\'t|\'([sd]|ll|re|ve))|\\.(com|edu|net|org)|\\(tm\\)|\\(r\\)/', '', $text);
     $config_file = PHPWS_Core::getConfigFile('search', $file_name);
     if (!$config_file) {
         $config_file = PHPWS_Core::getConfigFile('search', 'wordlist.txt');
         if (!$config_file) {
             return $text;
         }
     }
     $common_words = file($config_file);
     foreach ($common_words as $word) {
         $word = trim($word);
         // This line below does the majority of the work
         $text = preg_replace("/^{$word}\\s|\\s{$word}\\s|\\s{$word}\$/", ' ', $text);
         // This line removes repeats AND English language suffixes.
         $text = preg_replace("/ {$word}(es|s|ing|ed|d|ly|ings|ful|er|est)? /", ' ', $text);
     }
     return $text;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:34,代码来源:Search.php

示例6: coreModList

 /**
  * Returns an array of the core modules. Set from the core_modules.php file.
  */
 public static function coreModList()
 {
     static $core_modules = NULL;
     if (is_array($core_modules)) {
         return $core_modules;
     }
     $file = PHPWS_Core::getConfigFile('core', 'core_modules.php');
     if (PHPWS_Error::isError($file)) {
         return $file;
     }
     include $file;
     return $core_modules;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:16,代码来源:PHPWS_Core.php

示例7: addAlternates

 public static function addAlternates(PHPWS_Form $form)
 {
     $file = PHPWS_Core::getConfigFile('search', 'alternate.php');
     if ($file) {
         include $file;
         if (!empty($alternate_search_engine) && is_array($alternate_search_engine)) {
             $alternate_sites['local'] = dgettext('search', 'Local');
             foreach ($alternate_search_engine as $title => $altSite) {
                 $alternate_sites[$title] = $altSite['title'];
             }
             $form->addRadio('alternate', array_keys($alternate_sites));
             $form->setLabel('alternate', $alternate_sites);
             $form->setMatch('alternate', 'local');
         }
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:16,代码来源:User.php

示例8: getTZList

 public static function getTZList()
 {
     $file = PHPWS_Core::getConfigFile('core', 'timezone.php');
     include $file;
     return $timezones;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:6,代码来源:PHPWS_Time.php


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