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


PHP Q::includeFile方法代码示例

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


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

示例1: __construct

 /**
  * @constructor
  * @param {array} [$options=array()] Any initial options
  * @param {Users_User} [$options.user=Users::loggedInUser()] Allows us to set the user to charge
  * @param {string} [$options.authname] Optionally override the authname from config
  * @param {string} [$options.authkey] Optionally override the authkey from config
  */
 function __construct($options = array())
 {
     Q::includeFile(implode(DS, array(Q_PLUGINS_DIR, 'Assets', 'classes', 'Composer', 'vendor', 'autoload.php')));
     $testing = Q_Config::expect('Assets', 'payments', 'authnet', 'testing');
     $server = $testing ? net\authorize\api\constants\ANetEnvironment::SANDBOX : net\authorize\api\constants\ANetEnvironment::PRODUCTION;
     if (!isset($options['user'])) {
         $options['user'] = Users::loggedInUser(true);
     }
     $this->options = array_merge(array('authname' => Q_Config::expect('Assets', 'payments', 'authnet', 'name'), 'authkey' => Q_Config::expect('Assets', 'payments', 'authnet', 'transactionKey'), 'server' => $server), $options);
 }
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:17,代码来源:Authnet.php

示例2: stylesheetsInline

 /**
  * Returns a <style> tag with the content of all the stylesheets included inline
  * @method stylesheetsInline
  * @static
  * @param {array} [$styles=array()] If not empty, this associative array contains styles which will be
  * included at the end of the generated <style> tag.
  * @param {string} [$slotName=null] If provided, returns only the stylesheets added while filling this slot.
  * @return {string} the style tags and their contents inline
  */
 static function stylesheetsInline($styles = array(), $slotName = null)
 {
     if (empty(self::$stylesheets)) {
         return '';
     }
     $sheets = self::stylesheetsArray($slotName, false);
     $sheets_for_slots = array();
     if (!empty($sheets)) {
         foreach ($sheets as $stylesheet) {
             $href = '';
             $media = 'screen, print';
             $type = 'text/css';
             extract($stylesheet, EXTR_IF_EXISTS);
             $ob = new Q_OutputBuffer();
             if (Q_Valid::url($href)) {
                 try {
                     include $href;
                 } catch (Exception $e) {
                 }
             } else {
                 list($href, $filename) = Q_Html::themedUrlAndFilename($href);
                 try {
                     Q::includeFile($filename);
                 } catch (Exception $e) {
                 }
             }
             $sheets_for_slots[$stylesheet['slot']][] = "\n/* Included inline from {$href} */\n" . $ob->getClean();
         }
     }
     $parts = array();
     foreach ($sheets_for_slots as $slot => $texts) {
         $parts[] = Q_Html::tag('style', array('data-slot' => $slot), implode("\n\n", $texts));
     }
     return implode("", $parts);
 }
开发者ID:dmitriz,项目名称:Platform,代码行数:44,代码来源:Response.php

示例3: configure


//.........这里部分代码省略.........
         // second round to catch configFiles inside configFiles
         $config_files = $app_tree->get('Q', 'configFiles', array());
         foreach ($config_files as $cf) {
             $app_tree->merge(Q_Config::getFromServer($cf));
         }
         $interval = $app_tree->get('Q', 'configServer', 'interval', 60);
         // reload each minute by default
         $app_tree->clear(null);
         $timestamp = Q_Cache::get("Q_Config\tupdate_time");
         if (!isset($timestamp) || time() - $timestamp > $interval) {
             $force_reload = true;
         }
     }
     if ($force_reload) {
         $old_setting = Q_Cache::ignore(true);
     }
     Q_Config::clear(null);
     // clear the config
     Q_Config::load('config/Q.json');
     // Get the app config, but don't load it yet
     $app_tree->load('config/app.json');
     $app_tree->load('local/app.json');
     // Load all the plugin config files first
     $paths = explode(PS, get_include_path());
     $plugins = $app_tree->get('Q', 'plugins', array());
     if (!in_array('Q', $plugins)) {
         array_unshift($plugins, 'Q');
     }
     global $Q_Bootstrap_config_plugin_limit;
     $i = 0;
     foreach ($plugins as $k => $v) {
         ++$i;
         if (isset($Q_Bootstrap_config_plugin_limit) and $i > $Q_Bootstrap_config_plugin_limit) {
             continue;
         }
         $plugin = is_numeric($k) ? $v : $k;
         $plugin_path = Q::realPath('plugins' . DS . $v);
         if (!$plugin_path) {
             throw new Q_Exception_MissingPlugin(compact('plugin'));
         }
         Q_Config::load($plugin_path . DS . 'config' . DS . 'plugin.json');
         array_splice($paths, 1, 0, array($plugin_path));
         $PLUGIN = strtoupper($plugin);
         if (!defined($PLUGIN . '_PLUGIN_DIR')) {
             define($PLUGIN . '_PLUGIN_DIR', $plugin_path);
         }
         if (!defined($PLUGIN . '_PLUGIN_CONFIG_DIR')) {
             define($PLUGIN . '_PLUGIN_CONFIG_DIR', $plugin_path . DS . 'config');
         }
         if (!defined($PLUGIN . '_PLUGIN_CLASSES_DIR')) {
             define($PLUGIN . '_PLUGIN_CLASSES_DIR', $plugin_path . DS . 'classes');
         }
         if (!defined($PLUGIN . '_PLUGIN_FILES_DIR')) {
             define($PLUGIN . '_PLUGIN_FILES_DIR', $plugin_path . DS . 'files');
         }
         if (!defined($PLUGIN . '_PLUGIN_HANDLERS_DIR')) {
             define($PLUGIN . '_PLUGIN_HANDLERS_DIR', $plugin_path . DS . 'handlers');
         }
         if (!defined($PLUGIN . '_PLUGIN_PLUGINS_DIR')) {
             define($PLUGIN . '_PLUGIN_PLUGINS_DIR', $plugin_path . DS . 'plugins');
         }
         if (!defined($PLUGIN . '_PLUGIN_SCRIPTS_DIR')) {
             define($PLUGIN . '_PLUGIN_SCRIPTS_DIR', $plugin_path . DS . 'scripts');
         }
         if (!defined($PLUGIN . '_PLUGIN_VIEWS_DIR')) {
             define($PLUGIN . '_PLUGIN_VIEWS_DIR', $plugin_path . DS . 'views');
         }
         if (!defined($PLUGIN . '_PLUGIN_TESTS_DIR')) {
             define($PLUGIN . '_PLUGIN_TESTS_DIR', $plugin_path . DS . 'tests');
         }
         if (!defined($PLUGIN . '_PLUGIN_WEB_DIR')) {
             define($PLUGIN . '_PLUGIN_WEB_DIR', $plugin_path . DS . 'web');
         }
         self::$plugins[$plugin] = $plugin_path;
     }
     $paths = array_unique($paths);
     set_include_path(implode(PS, $paths));
     // Now, we can merge in our app's config
     Q_Config::merge($app_tree);
     // Now, load any other files we were supposed to load
     $config_files = Q_Config::get('Q', 'configFiles', array());
     foreach ($config_files as $cf) {
         Q_Config::merge(Q_Config::getFromServer($cf));
     }
     // second round to catch configFiles inside configFiles
     $config_files = Q_Config::get('Q', 'configFiles', array());
     foreach ($config_files as $cf) {
         Q_Config::merge(Q_Config::getFromServer($cf));
     }
     $script_files = Q_Config::get('Q', 'scriptFiles', array());
     foreach ($script_files as $cf) {
         Q::includeFile($cf);
     }
     error_reporting(Q_Config::get('Q', 'errorReporting', E_ALL));
     if (isset($old_setting)) {
         Q_Cache::ignore($old_setting);
     }
     set_time_limit(Q_Config::get('Q', 'internal', 'phpTimeout', 30));
     self::setDefaultTimezone();
 }
开发者ID:atirjavid,项目名称:Platform,代码行数:101,代码来源:Bootstrap.php

示例4: installSchema


//.........这里部分代码省略.........
         }
         // collect script files for upgrade
         $scriptsdir = $base_dir . DS . 'scripts' . DS . $name;
         $scripts = array();
         if (!is_dir($scriptsdir)) {
             return;
         }
         $dir = opendir($scriptsdir);
         // Find all scripts for this dbms
         while (($entry = readdir($dir)) !== false) {
             $parts = preg_split('/(-|__)/', $entry, 2);
             // wrong filename format
             if (count($parts) < 2) {
                 continue;
             }
             list($sqlver, $tail) = $parts;
             if ($tail !== "{$conn_name}.{$dbms}" and $tail !== "{$conn_name}.{$dbms}.php") {
                 continue;
                 // not schema file or php script
             }
             // If this sql file is for earlier or same plugin version than installed - skip it
             // If this sql file is for later plugin version than we are installing - skip it
             if (Q::compare_version($sqlver, $current_version) <= 0 || Q::compare_version($sqlver, $version) > 0) {
                 continue;
             }
             // we shall install this script!
             if ($tail !== "{$conn_name}.{$dbms}.php") {
                 $scripts[$sqlver] = $entry;
             } else {
                 $scripts["{$sqlver}.php"] = $entry;
             }
         }
         closedir($dir);
         // Sort scripts according to version
         uksort($scripts, array('Q', 'compare_version'));
         if (!empty($scripts)) {
             echo "Running SQL scripts for {$type} {$name} on {$conn_name} ({$dbms})" . PHP_EOL;
         }
         // echo "Begin transaction".PHP_EOL;
         // $query = $db->rawQuery('')->begin()->execute();
         // Process script files
         foreach ($scripts as $script) {
             try {
                 if (substr($script, -4) === '.php') {
                     echo "Processing PHP file: {$script} \n";
                     Q::includeFile($scriptsdir . DS . $script);
                     continue;
                 }
                 echo "Processing SQL file: {$script} ";
                 $sqltext = file_get_contents($scriptsdir . DS . $script);
                 $sqltext = str_replace('{$prefix}', $prefix, $sqltext);
                 $sqltext = str_replace('{$dbname}', $db->dbname, $sqltext);
                 $queries = $db->scriptToQueries($sqltext);
                 // Process each query
                 foreach ($queries as $q) {
                     $db->rawQuery($q)->execute();
                     echo ".";
                 }
                 // Update plugin db version
                 if ($dbms === 'mysql') {
                     list($newver) = preg_split('/(-|__)/', $script, 2);
                     $db->insert("{$prefix}Q_{$type}", array($type => $name, 'version' => $newver))->onDuplicateKeyUpdate(array('version' => $newver))->execute();
                     $current_version = $newver;
                 }
                 echo PHP_EOL;
             } catch (Exception $e) {
                 $errorCode = $pdo->errorCode();
                 if ($errorCode != '00000') {
                     $info = $pdo->errorInfo();
                     $err = new Q_Exception("{$info['2']}", array(), $errorCode, $e->getFile(), $e->getLine(), $e->getTrace(), $e->getTraceAsString());
                 } else {
                     $err = $e;
                 }
                 throw $err;
                 // echo PHP_EOL;
                 // echo "Rollback".PHP_EOL;
                 // try {
                 // 	$query = $db->rawQuery('')->rollback()->execute();
                 // } catch (Exception $e) {
                 // 	throw $err;
                 // }
             }
         }
         try {
             if (Q::compare_version($version, $current_version) > 0) {
                 $db->insert("{$prefix}Q_{$type}", array($type => $name, 'version' => $version))->onDuplicateKeyUpdate(array('version' => $version))->execute();
             }
         } catch (Exception $e) {
             if ($pdo->errorCode() != '00000') {
                 // echo "Rollback".PHP_EOL;
                 // $query = $db->rawQuery('')->rollback()->execute();
                 // $err = $pdo->errorInfo();
                 throw new Exception("{$err['2']}");
             }
         }
         // echo "Commit transaction".PHP_EOL;
         // $query = $db->rawQuery('')->commit()->execute();
         echo '+ ' . ucfirst($type) . " '{$name}' schema on '{$conn_name}'{$shard_text} (v. {$current_version} -> {$version}) installed" . PHP_EOL;
     }
 }
开发者ID:atirjavid,项目名称:Platform,代码行数:101,代码来源:Plugin.php


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