• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Kwf_Config类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: assets

 public function assets(Kwf_Assets_Package $assetsPackage, $language = null)
 {
     if (!$language) {
         $language = Kwf_Trl::getInstance()->getTargetLanguage();
     }
     $indent = str_repeat(' ', 8);
     $ret = '';
     foreach ($assetsPackage->getPackageUrls('text/css', $language) as $file) {
         $ret .= "{$indent}<link rel=\"stylesheet\" type=\"text/css\" href=\"" . htmlspecialchars($file) . "\" />\n";
     }
     foreach ($assetsPackage->getPackageUrls('text/css; media=print', $language) as $file) {
         $ret .= "{$indent}<link rel=\"stylesheet\" type=\"text/css\" href=\"" . htmlspecialchars($file) . "\" ";
         if (!Kwf_Config::getValue('debug.assets.usePrintCssForAllMedia')) {
             $ret .= "media=\"print\" ";
         }
         $ret .= "/>\n";
     }
     foreach ($assetsPackage->getPackageUrls('text/javascript', $language) as $file) {
         $ret .= "{$indent}<script type=\"text/javascript\" src=\"" . htmlspecialchars($file) . "\"></script>\n";
     }
     foreach ($assetsPackage->getPackageUrls('text/javascript; defer', $language) as $file) {
         $ret .= "<script type=\"text/javascript\">\n                var se=document.createElement('script');se.type='text/javascript';se.async=true;\n                se.src='" . $file . "';\n                var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(se,s);\n            </script>";
     }
     return $ret;
 }
开发者ID:nsams,项目名称:koala-framework,代码行数:25,代码来源:Assets.php


示例2: open

 /**
  * opening of the session - mandatory arguments won't be needed
  *
  * @param string $savePath
  * @param string $sessionName
  * @return bool
  */
 public function open($savePath, $sessionName)
 {
     if (!isset($this->_lifeTime)) {
         $this->_lifeTime = intval(ini_get("session.gc_maxlifetime"));
     }
     if (!isset($this->_refreshTime)) {
         $this->_refreshTime = ceil($this->_lifeTime / 3);
     }
     $this->_initSessionData = null;
     $this->_memcache = new Memcache();
     if (Kwf_Config::getValue('aws.simpleCacheCluster')) {
         $servers = Kwf_Util_Aws_ElastiCache_CacheClusterEndpoints::getCached(Kwf_Config::getValue('aws.simpleCacheCluster'));
     } else {
         if (Kwf_Cache_Simple::$memcacheHost) {
             $servers = array(array('host' => Kwf_Cache_Simple::$memcacheHost, 'port' => Kwf_Cache_Simple::$memcachePort));
         } else {
             throw new Kwf_Exception("no memcache configured");
         }
     }
     foreach ($servers as $s) {
         if (version_compare(phpversion('memcache'), '2.1.0') == -1 || phpversion('memcache') == '2.2.4') {
             // < 2.1.0
             $this->_memcache->addServer($s['host'], $s['port'], true, 1, 1, 1);
         } else {
             if (version_compare(phpversion('memcache'), '3.0.0') == -1) {
                 // < 3.0.0
                 $this->_memcache->addServer($s['host'], $s['port'], true, 1, 1, 1, true, null, 10000);
             } else {
                 $this->_memcache->addServer($s['host'], $s['port'], true, 1, 1, 1);
             }
         }
     }
     return true;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:41,代码来源:SessionHandler.php


示例3: getSettings

 public static function getSettings()
 {
     $ret = parent::getSettings();
     $ret['generators']['child'] = array('class' => 'Kwf_Component_Generator_Static', 'component' => array('linkTag' => 'Kwc_Basic_ImageEnlarge_EnlargeTag_Component'), 'addUrlPart' => false);
     $ret['cssClass'] = 'kwcBasicImageEnlarge ' . Kwf_Config::getValue('kwc.imageEnlarge.cssClass');
     return $ret;
 }
开发者ID:nsams,项目名称:koala-framework,代码行数:7,代码来源:Component.php


示例4: getContentsPacked

 public function getContentsPacked()
 {
     $contents = file_get_contents($this->getAbsoluteFileName());
     $useTrl = strpos($contents, 'trl') !== false && preg_match('#trl(c|p|cp)?(Kwf)?(Static)?\\(#', $contents);
     $trlData = array();
     if ($useTrl) {
         foreach (Kwf_TrlJsParser_UnderscoreTemplateParser::parseContent($contents) as $trlElement) {
             $d = Kwf_Assets_Util_Trl::getJsReplacement($trlElement);
             $contents = str_replace($d['before'], $d['replace'], $contents);
             $trlData[] = $d['trlElement'];
         }
     }
     $contents = str_replace("\n", '\\n', $contents);
     $contents = str_replace("'", "\\'", $contents);
     $contents = "var _ = require('underscore');\n" . "module.exports = _.template('" . $contents . "');\n";
     $replacements = array();
     if (strpos($contents, 'kwfUp-') !== false) {
         if (Kwf_Config::getValue('application.uniquePrefix')) {
             $replacements['kwfUp-'] = Kwf_Config::getValue('application.uniquePrefix') . '-';
         } else {
             $replacements['kwfUp-'] = '';
         }
     }
     foreach ($replacements as $search => $replace) {
         $contents = str_replace($search, $replace, $contents);
     }
     $map = Kwf_SourceMaps_SourceMap::createEmptyMap($contents);
     $data = $map->getMapContentsData();
     $data->{'_x_org_koala-framework_masterFiles'} = array($this->getAbsoluteFileName());
     if ($trlData) {
         $data->{'_x_org_koala-framework_trlData'} = $trlData;
     }
     return $map;
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:34,代码来源:TemplateDependency.php


示例5: _processContents

 protected function _processContents($ret)
 {
     $pathType = $this->getType();
     if ($pathType == 'ext2') {
         //hack um bei ext-css-dateien korrekte pfade für die bilder zu haben
         $ret = str_replace('../images/', '/assets/ext2/resources/images/', $ret);
     }
     //convert relative paths (as in bower dependencies; example: jquery.socialshareprivacy, mediaelement
     $fn = $this->getFileNameWithType();
     $fnDir = substr($fn, 0, strrpos($fn, '/'));
     $ret = preg_replace('#url\\(\\s*([^)]+?)\\s*\\)#', 'url(\\1)', $ret);
     //remove spaces inside url()
     $ret = preg_replace('#url\\((\'|")(?![a-z]+:)([^/\'"])#', 'url(\\1/assets/' . $fnDir . '/\\2', $ret);
     $ret = preg_replace('#url\\((?![a-z]+:)([^/\'"])#', 'url(/assets/' . $fnDir . '/\\1', $ret);
     $ret = self::expandAssetVariables($ret);
     if (strpos($ret, 'cssClass') !== false && (strpos($ret, '$cssClass') !== false || strpos($ret, '.cssClass') !== false)) {
         $cssClass = $this->_getComponentCssClass();
         if ($cssClass) {
             $ret = str_replace('$cssClass', $cssClass, $ret);
             $ret = str_replace('.cssClass', '.' . $cssClass, $ret);
         }
     }
     if (strpos($ret, 'kwfup-') !== false) {
         if (Kwf_Config::getValue('application.uniquePrefix')) {
             $ret = str_replace('kwfup-', Kwf_Config::getValue('application.uniquePrefix') . '-', $ret);
         } else {
             $ret = str_replace('kwfup-', '', $ret);
         }
     }
     return $ret;
 }
开发者ID:nsams,项目名称:koala-framework,代码行数:31,代码来源:Css.php


示例6: money

 public static function money($context, $amount)
 {
     $data = null;
     if (isset($context['data']) && $context['data'] instanceof Kwf_Component_Data) {
         $data = $context['data'];
     } else {
         if (isset($context['item']) && $context['item'] instanceof Kwf_Component_Data) {
             $data = $context['item'];
         }
     }
     if ($data) {
         $format = $data->getBaseProperty('money.format');
         $decimals = $data->getBaseProperty('money.decimals');
         $decimalSeparator = $data->getBaseProperty('money.decimalSeparator');
         $thousandSeparator = $data->getBaseProperty('money.thousandSeparator');
         if (is_null($decimalSeparator)) {
             $decimalSeparator = $data->trlcKwf('decimal separator', ".");
         }
         if (is_null($thousandSeparator)) {
             $thousandSeparator = $data->trlcKwf('thousands separator', ",");
         }
     } else {
         $format = Kwf_Config::getValue('money.format');
         $decimals = Kwf_Config::getValue('money.decimals');
         $decimalSeparator = trlcKwf('decimal separator', ".");
         $thousandSeparator = trlcKwf('thousands separator', ",");
     }
     $number = number_format($amount, $decimals, $decimalSeparator, $thousandSeparator);
     return str_replace('{0}', $number, $format);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:30,代码来源:Environment.php


示例7: getContent

 public function getContent($includeMaster)
 {
     if ($this->_data->getBaseProperty('preLogin')) {
         $ignore = false;
         foreach (Kwf_Config::getValueArray('preLoginIgnoreIp') as $i) {
             $ip = $_SERVER['REMOTE_ADDR'];
             if ($ip == $i) {
                 $ignore = true;
             }
             if (!$ignore && substr($i, -1) == '*') {
                 $i = substr($i, 0, -1);
                 if (substr($ip, 0, strlen($i)) == $i) {
                     $ignore = true;
                 }
             }
             if (!$ignore && substr($i, 0, 1) == '*') {
                 $i = substr($i, 1);
                 if (substr($ip, -strlen($i)) == $i) {
                     $ignore = true;
                 }
             }
         }
         Kwf_Setup::checkPreLogin($this->_data->getBaseProperty('preLoginUser'), $this->_data->getBaseProperty('preLoginPassword'));
     }
     $benchmarkEnabled = Kwf_Benchmark::isEnabled();
     if ($benchmarkEnabled) {
         $startTime = microtime(true);
     }
     $process = $this->_getProcessInputComponents($includeMaster);
     if ($benchmarkEnabled) {
         Kwf_Benchmark::subCheckpoint('getProcessInputComponents', microtime(true) - $startTime);
     }
     self::_callProcessInput($process);
     if ($benchmarkEnabled) {
         Kwf_Benchmark::checkpoint('processInput');
     }
     $ret = array();
     $hasDynamicParts = false;
     $ret['content'] = $this->_render($includeMaster, $hasDynamicParts);
     if ($benchmarkEnabled) {
         Kwf_Benchmark::checkpoint('render');
     }
     $ret['mimeType'] = 'text/html; charset=utf-8';
     if (!$includeMaster) {
         $assetsBox = $this->_data->getChildComponent('-assets');
         if ($assetsBox) {
             $ret['assets'] = $assetsBox->render(null, false, $hasDynamicParts);
         } else {
             $ret['assets'] = '';
         }
     }
     if (!$hasDynamicParts) {
         $ret['lifetime'] = 60 * 60;
     }
     self::_callPostProcessInput($process);
     if ($benchmarkEnabled) {
         Kwf_Benchmark::checkpoint('postProcessInput');
     }
     return $ret;
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:60,代码来源:Default.php


示例8: getInstance

 public static function getInstance()
 {
     static $i;
     if (!isset($i)) {
         if (Kwf_Config::getValue('server.aws')) {
             throw new Kwf_Exception_NotYetImplemented("using counter on multiple servers is not yet implemented");
         }
         if (extension_loaded('apc')) {
             if (function_exists('apc_inc')) {
                 //apc >= 3.1.1
                 $i = new Kwf_Benchmark_Counter_Apc();
             } else {
                 //kein memcache-fallback, da der dann *nur* für den counter verwendet werden würde
                 $i = new Kwf_Benchmark_Counter_File();
             }
         } else {
             if (class_exists('Memcache')) {
                 $i = new Kwf_Benchmark_Counter_Memcache();
             } else {
                 $i = new Kwf_Benchmark_Counter_File();
             }
         }
     }
     return $i;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:25,代码来源:Counter.php


示例9: indexAction

 public function indexAction()
 {
     $ok = false;
     foreach (Kwf_Config::getValueArray('debug.benchmarkCounterAccessIp') as $i) {
         if (substr($i, -1) == '*') {
             $i = substr($i, 0, -1);
             if (substr($_SERVER['REMOTE_ADDR'], 0, strlen($i)) == $i) {
                 $ok = true;
             }
         } else {
             if ($_SERVER['REMOTE_ADDR'] == $i) {
                 $ok = true;
             }
         }
     }
     if (!$ok) {
         throw new Kwf_Exception_AccessDenied();
     }
     $names = array('content-requests', 'asset-requests', 'media-requests', 'admin-requests', 'fullpage-hit', 'fullpage-miss', 'dbqueries', 'render-hit', 'render-miss', 'render-noviewcache', 'viewcache-mem', 'viewcache-db', 'viewcache-miss', 'viewcache-delete-page', 'viewcache-delete-component', 'viewcache-delete-master', 'viewcache-delete-partial', 'viewcache-delete-componentLink', 'viewcache-delete-fullPage');
     $out = array();
     $load = @file_get_contents('/proc/loadavg');
     $load = explode(' ', $load);
     $out['load'] = (double) $load[0];
     foreach ($names as $name) {
         $out[$name] = Kwf_Benchmark_Counter::getInstance()->getValue($name);
     }
     echo json_encode($out);
     exit;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:29,代码来源:BenchmarkCounterController.php


示例10: _getRedirectPage

 protected function _getRedirectPage()
 {
     if (!Kwf_Config::getValue('fbAppData.pageTabUrl')) {
         throw new Kwf_Exception('kwc.fbApp.Data.pageTabUrl has to be set in config');
     }
     return Kwf_Config::getValue('fbAppData.pageTabUrl');
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:7,代码来源:CheckFanRedirect.php


示例11: clean

 public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array())
 {
     switch ($mode) {
         case Zend_Cache::CLEANING_MODE_ALL:
             $ret = true;
             if (PHP_SAPI == 'cli') {
                 if (Kwf_Config::getValue('externalClearCacheScript')) {
                     throw new Kwf_Exception("Dont't delete complete apc-user cache via cli.");
                 }
                 $ret = Kwf_Util_Apc::callClearCacheByCli(array('type' => 'user'));
             }
             if (extension_loaded('apcu')) {
                 return $ret && apc_clear_cache('user');
             } else {
                 return $ret && apc_clear_cache();
             }
             break;
         case Zend_Cache::CLEANING_MODE_OLD:
             $this->_log("Zend_Cache_Backend_Apc::clean() : CLEANING_MODE_OLD is unsupported by the Apc backend");
             break;
         case Zend_Cache::CLEANING_MODE_MATCHING_TAG:
         case Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG:
         case Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG:
             $this->_log(self::TAGS_UNSUPPORTED_BY_CLEAN_OF_APC_BACKEND);
             break;
         default:
             Zend_Cache::throwException('Invalid mode for clean() method');
             break;
     }
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:30,代码来源:Apc.php


示例12: getTemplateVars

 public function getTemplateVars(Kwf_Component_Renderer_Abstract $renderer)
 {
     $ret = parent::getTemplateVars($renderer);
     $ret['settingsRow'] = $this->_getRow();
     $ret['tableStyle'] = $this->_getRow()->table_style;
     $ret['columnCount'] = $this->getColumnCount();
     if (Kwf_Config::getValue('kwc.responsive')) {
         $ret['rootElementClass'] .= ' responsive' . ucfirst($this->_getRow()->responsive_style);
     }
     $dataSelect = new Kwf_Model_Select();
     $dataSelect->whereEquals('visible', 1);
     $dataSelect->order('pos', 'ASC');
     $ret['dataRows'] = array();
     $rows = $this->_getRow()->getChildRows('tableData', $dataSelect);
     foreach ($rows as $row) {
         $rowData = array();
         $rowData['cssStyle'] = $row->css_style;
         $rowData['data'] = array();
         for ($i = 1; $i <= $ret['columnCount']; $i++) {
             $rowData['data']['column' . $i] = array('value' => $row->{'column' . $i}, 'cssClass' => '');
         }
         $ret['dataRows'][] = $rowData;
     }
     $ret['dataRows'] = Kwc_Basic_Table_Component::addDefaultCssClasses($ret['dataRows'], $this->_getSetting('rowStyles'));
     $ret['headerRows'] = array();
     if (isset($ret['dataRows'][0]['htmlTag']) && $ret['dataRows'][0]['htmlTag'] == 'th') {
         $ret['headerRows'] = array(array_shift($ret['dataRows']));
     }
     return $ret;
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:30,代码来源:Component.php


示例13: getTemplateVars

 public function getTemplateVars($values, $fieldNamePostfix = '', $idPrefix = '')
 {
     $ret = parent::getTemplateVars($values, $fieldNamePostfix, $idPrefix);
     require_once 'vendor/koala-framework/recaptcha-php/recaptchalib.php';
     $ret['html'] = "<div data-fieldname=\"" . $this->getFieldName() . $fieldNamePostfix . "\">" . recaptcha_get_html(Kwf_Config::getValue('recaptcha.publicKey')) . "</div>";
     return $ret;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:7,代码来源:Recaptcha.php


示例14: _render

 protected function _render($includeMaster, &$hasDynamicParts)
 {
     $lightboxContent = $this->_data->render(null, false, $hasDynamicParts);
     $kwfUniquePrefix = Kwf_Config::getValue('application.uniquePrefix');
     if ($kwfUniquePrefix) {
         $kwfUniquePrefix = $kwfUniquePrefix . '-';
     }
     if ($includeMaster) {
         $parent = $this->_getParent();
         $parentContentSender = Kwc_Abstract::getSetting($parent->componentClass, 'contentSender');
         $parentContentSender = new $parentContentSender($parent);
         $parentContent = $parentContentSender->_render($includeMaster, $hasDynamicParts);
         //remove main content to avoid duplicate content for search engines
         //content will be loaded using ajax
         $startPos = strpos($parentContent, '<main class="' . $kwfUniquePrefix . 'kwfMainContent">');
         $endPos = strpos($parentContent, '</main><!--/' . $kwfUniquePrefix . 'kwfMainContent-->');
         $parentContent = substr($parentContent, 0, $startPos) . '<main class="' . $kwfUniquePrefix . 'kwfMainContent" data-kwc-component-id="' . $parent->componentId . '">' . substr($parentContent, $endPos);
         foreach ($this->_data->getRecursiveChildComponents(array('flag' => 'hasInjectIntoRenderedHtml')) as $component) {
             $box = $component;
             $isInBox = false;
             while (!$isInBox && $box) {
                 if (isset($box->box)) {
                     $isInBox = true;
                 }
                 $box = $box->parent;
             }
             if ($isInBox) {
                 $parentContent = $component->getComponent()->injectIntoRenderedHtml($parentContent);
             }
         }
         //append lightbox after <body> in parent
         $options = $this->_getOptions();
         $style = '';
         if (isset($options['width'])) {
             $style .= "width: {$options['width']}px;";
         }
         if (isset($options['height'])) {
             $style .= "height: {$options['height']}px";
         }
         $class = $kwfUniquePrefix . 'kwfLightbox';
         $class .= " " . $kwfUniquePrefix . "kwfLightbox{$options['style']}";
         if (isset($options['cssClass'])) {
             $class .= " {$options['cssClass']}";
         }
         if (isset($options['adaptHeight']) && $options['adaptHeight']) {
             $class .= " adaptHeight";
         }
         $options = htmlspecialchars(json_encode($options));
         $lightboxContent = "<div class=\"{$class} " . $kwfUniquePrefix . "kwfLightboxOpen\">\n" . "    <div class=\"" . $kwfUniquePrefix . "kwfLightboxScrollOuter\">\n" . "        <div class=\"" . $kwfUniquePrefix . "kwfLightboxScroll\">\n" . "            <div class=\"" . $kwfUniquePrefix . "kwfLightboxBetween\">\n" . "               <div class=\"" . $kwfUniquePrefix . "kwfLightboxBetweenInner\">\n" . "                   <div class=\"" . $kwfUniquePrefix . "kwfLightboxInner\" style=\"{$style}\">\n" . "                       <input type=\"hidden\" class=\"options\" value=\"{$options}\" />\n" . "                       <div class=\"" . $kwfUniquePrefix . "kwfLightboxContent\">\n" . "                           {$lightboxContent}\n" . "                       </div>\n" . "                       <a class=\"" . $kwfUniquePrefix . "closeButton\" href=\"{$parent->url}\"><span class=\"" . $kwfUniquePrefix . "innerCloseButton\">" . $this->_data->trlKwf('Close') . "</span></a>\n" . "                   </div>\n" . "               </div>\n" . "            </div>\n" . "        </div>\n" . "        <div class=\"" . $kwfUniquePrefix . "kwfLightboxMask " . $kwfUniquePrefix . "kwfLightboxMaskOpen\"></div>\n" . "    </div>\n" . "</div>\n";
         $ret = preg_replace('#(<body[^>]*>)#', "\\1\n" . $lightboxContent, $parentContent);
         if (preg_match('#<html[^>]* class#', $ret)) {
             $ret = preg_replace('#(<html[^>]*?)( class="([^"]*)")#', "\\1 class=\"\\3 " . $kwfUniquePrefix . "kwfLightboxActive\"", $ret);
         } else {
             $ret = preg_replace('#(<html[^>]*)#', "\\1 class=\"\\3" . $kwfUniquePrefix . "kwfLightboxActive\"", $ret);
         }
         return $ret;
     } else {
         return $lightboxContent;
     }
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:60,代码来源:Lightbox.php


示例15: money

 public function money($amount)
 {
     $component = null;
     if (isset($this->_view) && $this->_view && $this->_view->data && $this->_view->data instanceof Kwf_Component_Data) {
         $component = $this->_view->data;
     }
     if ($component) {
         $format = $component->getBaseProperty('money.format');
         $decimals = $component->getBaseProperty('money.decimals');
         $decimalSeparator = $component->getBaseProperty('money.decimalSeparator');
         $thousandSeparator = $component->getBaseProperty('money.thousandSeparator');
         if (is_null($decimalSeparator)) {
             $decimalSeparator = $component->trlcKwf('decimal separator', ".");
         }
         if (is_null($thousandSeparator)) {
             $thousandSeparator = $component->trlcKwf('thousands separator', ",");
         }
     } else {
         $format = Kwf_Config::getValue('money.format');
         $decimals = Kwf_Config::getValue('money.decimals');
         $decimalSeparator = trlcKwf('decimal separator', ".");
         $thousandSeparator = trlcKwf('thousands separator', ",");
     }
     $number = number_format($amount, $decimals, $decimalSeparator, $thousandSeparator);
     return str_replace('{0}', $number, $format);
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:26,代码来源:Money.php


示例16: _init

 protected function _init()
 {
     parent::_init();
     if (is_null($this->_useMobileBreakpoints)) {
         $this->_useMobileBreakpoints = Kwf_Config::getValue('kwc.mobileBreakpoints');
     }
 }
开发者ID:nsams,项目名称:koala-framework,代码行数:7,代码来源:Generator.php


示例17: testExceptions

 public function testExceptions()
 {
     // Ohne Mail
     $exception = new Kwf_Exception();
     $view = $this->_processException($exception);
     $this->assertEquals($view->message, $exception->getMessage());
     $this->assertTrue($view->debug);
     $this->assertEquals($view->template, 'error.tpl');
     // Mit Mail
     Zend_Registry::get('config')->debug->error->log = true;
     Kwf_Config::deleteValueCache('debug.error.log');
     $exception = new Kwf_Exception();
     $view = $this->_processException($exception);
     $this->assertEquals($view->message, $exception->getMessage());
     $this->assertFalse($view->debug);
     $this->assertEquals($view->template, 'error.tpl');
     // Nicht-Kwf_Exception mit Mail
     Zend_Registry::get('config')->debug->error->log = true;
     Kwf_Config::deleteValueCache('debug.error.log');
     $e = new Zend_Exception();
     $exception = new Kwf_Exception_Other($e);
     $view = $this->_processException($exception);
     $this->assertEquals($view->message, $e->getMessage());
     $this->assertFalse($view->debug);
     $this->assertEquals($view->template, 'error.tpl');
     Zend_Registry::get('config')->debug->error->log = false;
     Kwf_Config::deleteValueCache('debug.error.log');
     // Kwf_Exception_NoLog mit Debug
     Zend_Registry::get('config')->debug->error->log = true;
     Kwf_Config::deleteValueCache('debug.error.log');
     $exception = new Kwf_Exception_NoLog();
     $view = $this->_processException($exception);
     $this->assertEquals($view->message, $exception->getMessage());
     $this->assertFalse($view->debug);
     Zend_Registry::get('config')->debug->error->log = false;
     Kwf_Config::deleteValueCache('debug.error.log');
     $this->assertEquals($view->template, 'error.tpl');
     // Kwf_Exception_NoLog ohne Debug
     $exception = new Kwf_Exception_NoLog();
     $view = $this->_processException($exception);
     $this->assertEquals($view->message, $exception->getMessage());
     $this->assertTrue($view->debug);
     $this->assertEquals($view->template, 'error.tpl');
     // Kwf_Exception_NotFound
     $exception = new Kwf_Exception_NotFound();
     $view = $this->_processException($exception);
     $this->assertEquals($view->message, $exception->getMessage());
     $this->assertEquals($view->template, 'error404.tpl');
     // Nicht-Kwf_Exception
     $exception = new Exception();
     $view = $this->_processException($exception);
     $this->assertEquals($view->message, $exception->getMessage());
     $this->assertEquals($view->template, 'error.tpl');
     // ClientException
     $exception = new Kwf_ClientException();
     $view = $this->_processException($exception);
     $this->assertEquals($view->message, $exception->getMessage());
     $this->assertEquals($view->template, 'error-client.tpl');
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:59,代码来源:ExceptionTest.php


示例18: getContentsPacked

 public function getContentsPacked()
 {
     if (!$this->_features) {
         return null;
     }
     $modernizrPath = getcwd() . '/node_modules/modernizr';
     $outputFile = tempnam('./temp', 'modernizr');
     $configAll = json_decode(file_get_contents($modernizrPath . '/lib/config-all.json'), true);
     $allFeatureDetects = $configAll['feature-detects'];
     $options = array();
     foreach ($configAll['options'] as $i) {
         $options[$i] = false;
     }
     $options['mq'] = true;
     $options['setClasses'] = true;
     $featureDetects = array();
     foreach ($this->_features as $f) {
         if (isset($options[strtolower($f)])) {
             //for prefixed
             $options[strtolower($f)] = true;
         } else {
             $filter = new Zend_Filter_Word_CamelCaseToSeparator('/');
             $fFiltered = strtolower($filter->filter($f));
             if (!in_array($fFiltered, $allFeatureDetects)) {
                 throw new Kwf_Exception("Invalid Modernizr Dependency, test doesn't exist: '" . $f . "'");
             }
             $featureDetects[] = $fFiltered;
         }
     }
     foreach ($options as $k => $i) {
         if (!$i) {
             unset($options[$k]);
         }
     }
     $options = array_keys($options);
     $classPrefix = '';
     if (Kwf_Config::getValue('application.uniquePrefix')) {
         $classPrefix = Kwf_Config::getValue('application.uniquePrefix') . '-';
     }
     $config = array('classPrefix' => $classPrefix, 'options' => $options, 'feature-detects' => $featureDetects);
     $configFile = tempnam('temp/', 'modernizrbuild');
     unlink($configFile);
     $configFile .= '.json';
     file_put_contents($configFile, json_encode($config, JSON_PRETTY_PRINT));
     $cmd = getcwd() . "/" . VENDOR_PATH . "/bin/node {$modernizrPath}/bin/modernizr --config {$configFile} --uglify --dest " . $outputFile;
     exec($cmd, $out, $retVar);
     if ($retVar) {
         throw new Kwf_Exception("modernizr failed: " . implode("\n", $out));
     }
     $ret = file_get_contents($outputFile);
     unlink($configFile);
     unlink($outputFile);
     //remove comments containing selected tests
     $ret = preg_replace("#\n/\\*!\n\\{.*?\\}\n!\\*/\n#s", '', $ret);
     $ret = Kwf_SourceMaps_SourceMap::createEmptyMap($ret);
     $map = $ret->getMapContentsData(false);
     $map->{'_x_org_koala-framework_masterFiles'} = array(getcwd() . '/node_modules/modernizr/package.json');
     return $ret;
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:59,代码来源:Dependency.php


示例19: setUp

 public function setUp()
 {
     if (!Kwf_Config::getValue('aws.key') || !Kwf_Config::getValue('aws.secret')) {
         $this->markTestSkipped();
     }
     Kwf_Registry::get('config')->aws->uploadsBucket = 'kwf-test';
     Kwf_Config::deleteValueCache('aws.uploadsBucket');
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:8,代码来源:S3Test.php


示例20: createPackages

 public static function createPackages()
 {
     $packages = array(self::getInstance('Frontend'), self::getInstance('Admin'));
     foreach (Kwf_Config::getValueArray('assets.packages') as $i) {
         $packages[] = self::getInstance($i);
     }
     return $packages;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:8,代码来源:Default.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Kwf_Model_Abstract类代码示例发布时间:2022-05-23
下一篇:
PHP Kwf_Component_NoCategoriesRoot类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap