/**
  * Utility method to load Forecast Settings
  *
  * @param bool $reload      Forecast Reload the settings
  */
 protected static function loadForecastSettings($reload = false)
 {
     /* @var $admin Administration */
     if (empty(static::$settings) || $reload === true) {
         static::$settings = Forecast::getSettings($reload);
     }
 }
Example #2
0
 /**
  * Create a Dispatcher instance. We use init() method to create a singleton
  * Dispatcher instance.
  * 
  * @param Settings $settings
  */
 private function __construct(Settings $settings)
 {
     // Load environment settings, if not loaded.
     static::$settings = $settings;
     // Prepare default Httpful request template.
     $this->prepareRequestTemplate();
 }
Example #3
0
 public function run()
 {
     static::$netteDirectory = realpath(__DIR__ . '/../../../../app');
     $netteContainer = $this->getNetteContainer();
     if (php_sapi_name() !== 'cli') {
         define('STDIN', fopen('php://stdin', 'r'));
         echo '<pre>';
     }
     CLI::write('Welcome to the Nette Framework CRUD generator 1.0@beta5.', 0, FALSE);
     static::$settings = (object) ['netteRoot' => realpath(static::$netteDirectory . '/..'), 'netteConfig' => FALSE, 'netteDatabase' => FALSE, 'source' => \Utils\Constants::SOURCE_MYSQL_DISCOVERED, 'tables' => [], 'table' => FALSE, 'target' => \Utils\Constants::TARGET_NETTE_DATABASE, 'foreignKeys' => \Utils\Constants::FOREIGN_KEYS_TABLE, 'module' => FALSE, 'template' => realpath(__DIR__ . '/Templates/default'), 'php' => '<?php', 'entityManager' => NULL];
     $this->showSourceDialog();
     CLI::write('Verifying Nette configuration:', 0, TRUE, TRUE, TRUE);
     static::$settings->netteDatabase = $this->getDatabaseConnectionParameters($netteContainer);
     static::$settings->netteConfig = \Nette\Neon\Neon::decode(\Bruha\Generator\Utils\File::read(static::$netteDirectory . '/config/config.neon'));
     if ($this->checkExtensionsConfiguration()) {
         CLI::write('New extensions were installed.', 0, TRUE, TRUE, TRUE);
         CLI::write('Application needs to be restarted for loading them.', 1);
         CLI::write("Write 'php -f index.php' for start with new loaded extensions.", 2);
         exit;
     }
     $this->showTablesDialog($this->processSourceDialog($netteContainer));
     $this->showTargetDialog();
     $this->showForeignKeysDialog();
     $this->showModuleDialog();
     $this->chooseTemplatesDialog();
     static::$startTime = microtime(TRUE);
     $this->generate();
 }
 /**
  * @return array
  */
 public static function getSettings()
 {
     if (is_null(static::$settings)) {
         static::$settings = (array) CRM_Core_BAO_Setting::getItem('Extension', 'uk.co.compucorp.civicrm.giftaid:settings');
     }
     return static::$settings;
 }
 /** 
  * Helper to update Plugin Settings
  *
  * @since    1.0
  */
 protected static function update_settings($new_value)
 {
     if (isset($new_value) && $new_value != '') {
         static::$settings = $new_value;
         return is_multisite() ? update_site_option(self::SETTINGS_NAME, $new_value) : update_option(self::SETTINGS_NAME, $new_value);
     }
     return false;
 }
Example #6
0
 /**
  *
  * @param string $key
  * @return mixed string|null
  */
 public static function get($key)
 {
     if (static::$settings === null) {
         $table = static::instance();
         $query = $table->getAdapter()->query('SELECT `key`, `value` FROM `' . $table->getTableName() . '`');
         static::$settings = $query->fetchAll(\PDO::FETCH_KEY_PAIR);
     }
     return isset(static::$settings[$key]) ? static::$settings[$key] : null;
 }
Example #7
0
 public function __construct()
 {
     // Set settings, if not already set.
     if (!static::$settings) {
         static::$settings = new Settings();
     }
     // Initialize dipatcher using current settings.
     Dispatcher::init(static::$settings);
     // Get Links for the provided academic year.
     $this->links = new Links(static::$settings);
 }
Example #8
0
 /**
  *
  */
 public static function init()
 {
     static::$settings = array('sorter' => array(), 'listing' => array(), 'translation' => array());
     if (class_exists('Chansig\\DirectoryIndex\\Settings')) {
         static::$settings = array_replace_recursive(static::$settings, Settings::getSettings());
     }
     Listing::setup(static::$settings['listing']);
     Sorter::setup(static::$settings['sorter']);
     Translation::setup(static::$settings['sorter']);
     Theme::setup(static::$settings['sorter']);
 }
 public static function start($config, $settings)
 {
     static::init($config);
     static::$settings = $settings;
     static::$server = new WorkermanFastCGIWrapper(static::$host, static::$port);
     if (!empty(static::$settings)) {
         static::$server->set(static::$settings);
     }
     static::$server->on('Receive', [static::class, 'onReceive']);
     static::$server->on('WorkerStart', [static::class, 'onWorkerStart']);
     require __DIR__ . '/Mime.php';
     static::$server->start();
 }
Example #10
0
 public static function start($config, $settings)
 {
     static::init($config);
     static::$settings = $settings;
     static::$server = new SwooleHttpWrapper(static::$host, static::$port);
     if (!empty(static::$settings)) {
         static::$server->set(static::$settings);
     }
     static::$server->on('Start', [static::class, 'onServerStart']);
     static::$server->on('Shutdown', [static::class, 'onServerShutdown']);
     static::$server->on('WorkerStart', [static::class, 'onWorkerStart']);
     static::$server->on('Request', [static::class, 'onRequest']);
     require __DIR__ . '/Mime.php';
     static::$server->start();
 }
Example #11
0
 public function __construct($key)
 {
     if (!function_exists("mcrypt_encrypt")) {
         throw new \HalfMoon\HalfMoonException("mcrypt extension not " . "installed");
     }
     if (strlen($key) != 32) {
         throw new \HalfMoon\HalfMoonException("cookie encryption key must " . "be 32 characters long");
     }
     /* disable php's own sending of session cookies since they will
      * conflict with what we're generating here */
     ini_set("session.use_cookies", "off");
     /* load settings as they are from boot, since controllers may change
      * them */
     static::$settings = session_get_cookie_params();
     $this->key = pack("H*", $key);
 }
 static function get_all($refresh = false)
 {
     if (empty(static::$settings) === true || $refresh === true) {
         $settings = Model_Setting::query()->get();
         $get_settings = array();
         if (empty($settings) === false) {
             foreach ($settings as $setting) {
                 if ($setting->data == 1) {
                     $setting->data = true;
                 }
                 $get_settings[$setting->name] = $setting->data;
             }
         }
         static::$settings = $get_settings;
     }
     return static::$settings;
 }
Example #13
0
 /**
  * Returns all available plugin settings, even settings for inactive plugins. A plugin has to specify a file named
  * `Settings.php` containing a class named `Settings` that extends `Piwik\Plugin\Settings` in order to be
  * considered as a plugin setting. Otherwise the settings for a plugin won't be available.
  *
  * @return \Piwik\Plugin\Settings[]   An array containing array([pluginName] => [setting instance]).
  */
 public static function getAllPluginSettings()
 {
     $numActivatedPlugins = PluginManager::getInstance()->getNumberOfActivatedPlugins();
     if (static::$numPluginsChecked != $numActivatedPlugins) {
         static::$numPluginsChecked = $numActivatedPlugins;
         static::$settings = array();
     }
     if (empty(static::$settings)) {
         $settings = array();
         $pluginNames = PluginManager::getInstance()->getLoadedPluginsName();
         foreach ($pluginNames as $pluginName) {
             $settings[$pluginName] = self::getPluginSettingsClass($pluginName);
         }
         static::$settings = array_filter($settings);
     }
     return static::$settings;
 }
Example #14
0
 public static function start($config, $settings)
 {
     // override
     $config['deal_with_public'] = false;
     parent::init($config);
     static::$settings = $settings;
     static::$server = new SwooleFastCGIWrapper(static::$host, static::$port);
     if (!empty(static::$settings)) {
         static::$server->set(static::$settings);
     }
     static::$server->on('Start', [static::class, 'onServerStart']);
     static::$server->on('Receive', [static::class, 'onReceive']);
     static::$server->on('Shutdown', [static::class, 'onServerShutdown']);
     static::$server->on('WorkerStart', [static::class, 'onWorkerStart']);
     require __DIR__ . '/Mime.php';
     static::$server->start();
 }
Example #15
0
 /**
  * Returns all available plugin settings, even settings for inactive plugins. A plugin has to specify a file named
  * `Settings.php` containing a class named `Settings` that extends `Piwik\Plugin\Settings` in order to be
  * considered as a plugin setting. Otherwise the settings for a plugin won't be available.
  *
  * @return \Piwik\Plugin\Settings[]   An array containing array([pluginName] => [setting instance]).
  */
 public static function getAllPluginSettings()
 {
     $numActivatedPlugins = PluginManager::getInstance()->getNumberOfActivatedPlugins();
     if (static::$numPluginsChecked != $numActivatedPlugins) {
         static::$numPluginsChecked = $numActivatedPlugins;
         static::$settings = array();
     }
     if (empty(static::$settings)) {
         $settings = PluginManager::getInstance()->findComponents('Settings', 'Piwik\\Plugin\\Settings');
         $byPluginName = array();
         foreach ($settings as $setting) {
             $byPluginName[$setting->getPluginName()] = $setting;
         }
         static::$settings = $byPluginName;
     }
     return static::$settings;
 }
Example #16
0
 public static function setup($settings)
 {
     static::$settings = array_replace_recursive(static::$settings, $settings);
 }
Example #17
0
 /**
  * Read configuration and set up EntityManager singleton
  */
 public static function _init()
 {
     static::$settings = \Config::load('db', true);
 }
Example #18
0
 /**
  * Merge the new settings into the old settings.
  *
  * @param mixed[] $new_settings New settings array.
  */
 public static function load_settings($new_settings)
 {
     // The old variables are maintained unless overwritten.
     static::$settings = array_merge(static::$settings, $new_settings);
 }
Example #19
0
 /**
  * Instantiates Imwg and receives the filetype, width, height and attributes for
  * <img src='' ..attributes.. />
  * @param mixed $file string path or array from Input::file('form_field')
  * can _NOT_ hold multiple images
  */
 public function __construct($file)
 {
     if (is_array($file)) {
         $file = $file['tmp_name'];
     }
     static::$settings = LaravelConfig::get('imwg::settings');
     static::$file = $file;
     static::$file_info = static::imageInfo($file);
     $this->createImageResource();
 }
Example #20
0
 /**
  * Inits
  * @since WP Theater 1.0.0
  */
 public static function init()
 {
     register_activation_hook(__FILE__, array(__CLASS__, 'activation'));
     register_deactivation_hook(__FILE__, array(__CLASS__, 'deactivation'));
     register_uninstall_hook(__FILE__, array(__CLASS__, 'uninstall'));
     if (is_admin()) {
         add_action('load-plugins.php', array(__CLASS__, 'activate_notices'));
         add_action('admin_init', array(__CLASS__, 'admin_notices'));
         require_once static::$inc . 'class-settings.php';
         static::$settings = new WP_Theater_Settings();
     } else {
         require_once static::$inc . 'class-presets.php';
         require_once static::$inc . 'class-shortcodes.php';
         require_once static::$inc . 'filters.php';
         static::$presets = new WP_Theater_Presets();
         static::$shortcodes = new WP_Theater_Shortcodes();
     }
 }
Example #21
0
 public static function setup($settings)
 {
     static::$settings = $settings;
 }
Example #22
0
 /**
  * Initiate the settings list if not done already.
  * 
  * @since ?
  * 
  * @return boolean True if the settings where initiates in this call.
  */
 protected static function initIfNeeded()
 {
     $init = static::$settings === false;
     if ($init) {
         static::$settings = array('default' => static::getDefaultSettings(), 'php' => static::getPhpSettings());
     }
     return $init;
 }
Example #23
0
 public static function getSettings($reload = false)
 {
     /* @var $admin Administration */
     if (empty(static::$settings) || $reload === true) {
         $admin = BeanFactory::getBean('Administration');
         static::$settings = $admin->getConfigForModule('Opportunities');
     }
     return static::$settings;
 }
 /**
  * Retrieves all of the settings from the database
  *
  * @since    1.0.0
  * @return array
  */
 public static function get_settings($setting_name = false)
 {
     if (!isset(static::$settings)) {
         static::$settings = get_option(static::SETTINGS_NAME, array());
     }
     if ($setting_name) {
         return isset(static::$settings[$setting_name]) ? static::$settings[$setting_name] : array();
     }
     return static::$settings;
 }
 /** 
  * Helper to update Plugin Settings
  *
  * @since    1.0.0
  * @return boolean
  */
 protected static function update_settings($new_value, $setting_name = false)
 {
     if (isset($new_value)) {
         if ($setting_name) {
             static::get_settings();
             static::$settings[$setting_name] = $new_value;
             $new_value = static::$settings;
         } else {
             static::$settings = $new_value;
         }
         return update_option(static::SETTINGS_NAME, $new_value);
     }
     return false;
 }
Example #26
0
 /**
  * Global settings.
  *
  * @param array $settings settings.
  */
 public static function settings(array $settings = array())
 {
     static::$settings = array_merge(static::$settings, $settings);
 }
Example #27
0
 public static function connSettings($settings)
 {
     static::$settings = $settings;
 }