PHP Configuration Code Examples

This page contains top rated real world PHP examples of Configuration extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
Show file File: SeleniumDrivenUserExpectations.php Project: xto/SUTA
0
 public static function setUpBeforeClass()
 {
     $configuration = new Configuration();
     self::$selenium_test_page_path = $configuration->getSeleniumTestPagePath();
     self::$selenium_execution_context = new SeleniumExecutionContext("firefox", "file://" . self::$selenium_test_page_path, "jQuery");
     self::$selenium_driven_user = new SeleniumDrivenUser(self::$selenium_execution_context);
 }
Example #2
Show file File: Profiles.php Project: walkthenight/walkthenight-wordpress
0
 /**
  * Constructor
  * 
  * Inits the appropriate endpoint and httpconnector objects 
  * Sets all of the Profiles class properties
  * 
  * @param \Beanstream\Configuration $config
  */
 function __construct(Configuration $config)
 {
     //init endpoint
     $this->_endpoint = new Endpoints($config->getPlatform(), $config->getApiVersion());
     //init http connector
     $this->_connector = new HttpConnector(base64_encode($config->getMerchantId() . ':' . $config->getApiKey()));
 }
Example #3
Show file File: RequestFactory.php Project: eshopino/api-helper
0
 public function createRequest()
 {
     $uri = $_SERVER['REQUEST_URI'];
     $basePath = $this->configuration->getBasePath();
     if ($basePath && strncmp($uri, $basePath, strlen($basePath)) !== 0) {
         throw new ApiException("Invalid endpoint");
     }
     $uri = substr($uri, strlen($basePath) - 1);
     if ($this->configuration->getPublicKey() !== trim($_SERVER['HTTP_X_API_KEY'])) {
         throw new AuthorizationException("Invalid API key");
     }
     $hasBody = $this->hasBody();
     $input = $hasBody ? file_get_contents('php://input') : '';
     $signature = hash_hmac('sha256', $uri . $input, $this->configuration->getPrivateKey());
     if ($signature !== trim($_SERVER['HTTP_X_API_SIGNATURE'])) {
         throw new AuthorizationException("Invalid signature");
     }
     if ($hasBody) {
         $parameters = json_decode($input, JSON_OBJECT_AS_ARRAY);
         if ($parameters === NULL && $input !== '' && strcasecmp(trim($input, " \t\n\r"), 'null') !== 0) {
             $error = json_last_error();
             throw new ApiException('JSON parsing error: ' . $error);
         }
     } else {
         $parameters = filter_input_array(INPUT_GET, FILTER_UNSAFE_RAW);
     }
     $name = ($a = strpos($uri, '?')) !== FALSE ? substr($uri, 0, $a) : $uri;
     return new Request(ltrim($name, '/'), $_SERVER['REQUEST_METHOD'], $parameters);
 }
Example #4
Show file File: ConfigTableSeeder.php Project: hopshoppub/hopshop.dev
0
 public function run()
 {
     $config = new Configuration();
     $config->name = 'beer_of_the_day_modification_date';
     $config->value = Carbon::now()->format('Y-m-d');
     $config->save();
 }
Example #5
Show file File: ConfiguratorTest.php Project: Innovacionlechuga/leaguewrap
0
 protected function assertConfiguration(Configuration $config, $srcDir, array $cloverXml, $jsonPath, $excludeNoStatements = false)
 {
     $this->assertEquals($srcDir, $config->getSrcDir());
     $this->assertEquals($cloverXml, $config->getCloverXmlPaths());
     $this->assertEquals($jsonPath, $config->getJsonPath());
     $this->assertEquals($excludeNoStatements, $config->isExcludeNoStatements());
 }
Example #6
Show file File: AddOnGateway.php Project: atulparmar/braintree_php
0
 /**
  *
  * @return AddOn[]
  */
 public function all()
 {
     $path = $this->_config->merchantPath() . '/add_ons';
     $response = $this->_http->get($path);
     $addOns = ["addOn" => $response['addOns']];
     return Util::extractAttributeAsArray($addOns, 'addOn');
 }
Example #7
Show file File: ReminderMgr.php Project: munishsethi777/eliveui
0
 public static function reminderInvoker(Folder $folder)
 {
     $configuration = new Configuration();
     //parameter to know the max gap between last parsing done on the folder.
     $invokeMinutes = $configuration->getConfiguration(ConfigurationKeys::$reminderInvokeMinutes);
     //parameter to know the max gap between notifications
     $intervalMinutes = $configuration->getConfiguration(ConfigurationKeys::$reminderIntervalMinutes);
     $invokeMinutes = intval($invokeMinutes);
     $intervalMinutes = intval($intervalMinutes);
     $parsedSinceMinutes = self::getDatesDifferenceInMinutes($folder->getLastParsedOn(), date("Y-m-d H:i:s"));
     if ($parsedSinceMinutes > 0) {
         //OK we have some minutes passed with no parsing undertook
         if ($parsedSinceMinutes > $invokeMinutes) {
             //if reminder already sent, check interval and send again
             if ($folder->getLastRemindedOn() != null) {
                 $lastRemindedSince = self::getDatesDifferenceInMinutes($folder->getLastRemindedOn(), date("Y-m-d H:i:s"));
                 if ($lastRemindedSince > $intervalMinutes) {
                     self::sendNotification($folder);
                     FolderDataStore::getInstance()->updateLastReminderDate($folder->getSeq());
                 }
             } else {
                 self::sendNotification($folder);
                 FolderDataStore::getInstance()->updateLastReminderDate($folder->getSeq());
             }
         } else {
             //time still there to remind
         }
     }
 }
Example #8
Show file File: BaseMediaPlugin.php Project: samrahman/providence
0
 public function __construct()
 {
     parent::__construct();
     $this->opo_app_config = Configuration::load();
     $vs_external_app_config_path = $this->opo_app_config->get('external_applications');
     $this->opo_external_app_config = Configuration::load($vs_external_app_config_path);
 }
Example #9
Show file File: ConfigurationTest.php Project: m1105/steam-api-php
0
 public function testSetOptionsWithValidOptions()
 {
     $key = 'steam-api-key';
     $options = array(Configuration::STEAM_KEY => $key);
     $this->configuration->setOptions($options);
     $this->assertEquals($key, $this->configuration->getSteamKey());
 }
Example #10
Show file File: MicroKernel.class.php Project: paolocl/ChezPaolo
0
 public function loadClass($class)
 {
     // Enable PSR-4 style namespace support.
     $class = str_replace('\\', DIRECTORY_SEPARATOR, $class);
     if (substr($class, -10) == 'Controller') {
         // This is a controller class file.
         $filename = "{$this->controllerPath}/{$class}.class.php";
     } else {
         if (substr($class, -4) == 'Form') {
             // This is a form class file.
             $filename = "{$this->applicationPath}/forms/{$class}.class.php";
         } elseif (substr($class, -5) == 'Model') {
             // This is a model class file.
             $filename = "{$this->applicationPath}/models/{$class}.class.php";
         } else {
             // This is an application class file (outside of MVC).
             $filename = "{$this->applicationPath}/classes/{$class}.class.php";
         }
     }
     if (file_exists($filename) == true) {
         /** @noinspection PhpIncludeInspection */
         include $filename;
     } else {
         if ($this->configuration->get('library', 'autoload-chain', false) == false) {
             throw new ErrorException("La classe <strong>{$class}</strong> ne se trouve pas " . "dans le fichier<br><strong>{$filename}</strong>");
         }
     }
 }
Example #11
Show file File: Connection.php Project: boiler256/DesignPatternsPHP
0
 /**
  * connection using the injected config
  */
 public function connect()
 {
     $host = $this->configuration->get('host');
     // connection to host, authentication etc...
     //if connected
     $this->host = $host;
 }
Example #12
Show file File: DependencyInjectionContainerNegativeTest.php Project: mdio/injektor
0
 public function testGetInstanceWithWrongConfiguredParameterThrowsException()
 {
     $this->setExpectedException('rg\\injektor\\InjectionException', 'Invalid argument without class typehint class: [rg\\injektor\\DICTestClassNoTypeHint] method: [__construct] argument: [two]');
     $config = new Configuration(null, '');
     $config->setClassConfig('rg\\injektor\\DICTestClassNoTypeHint', array('params' => array('one' => array('value' => 'foo'))));
     $dic = $this->getContainer($config);
     $dic->getInstanceOfClass('rg\\injektor\\DICTestClassNoTypeHint');
 }
Example #13
Show file File: MysqlAdmin.class.php Project: BackupTheBerlios/dolphin-dwbn-svn
0
 public function __construct(Configuration $configuration, DatabaseVersion $dbVersion, DeltaDirectory $deltaDirectory)
 {
     $this->dbName = $configuration->dbName();
     $this->dbUsername = $configuration->dbUsername();
     $this->dbPassword = $configuration->dbPassword();
     $this->dbVersion = $dbVersion;
     $this->deltaDirectory = $deltaDirectory;
 }
Example #14
Show file File: ServiceManagerBuilder.php Project: kpacha/config
0
 public function build(Configuration $config)
 {
     $serviceConfig = $config->get(Configuration::SERVICE);
     $serviceClass = $this->getServiceClass($serviceConfig);
     $serverUrl = $this->extractParameter(AbstractServiceManager::SERVER_URL, $serviceConfig);
     $watchedServices = $this->getWatchedServices($serviceConfig);
     return new $serviceClass($serverUrl, $config->getConfigDir(), $watchedServices);
 }
Example #15
Show file File: ConfigurationTest.php Project: airbrake/airbrake-php
0
 /**
  * @covers Airbrake\Configuration::verify
  */
 public function testVerify()
 {
     $this->object->set('apiKey', null);
     try {
         $this->object->verify();
     } catch (\Exception $e) {
         $this->assertInstanceOf('Airbrake\\Exception', $e);
     }
 }
Example #16
Show file File: Configuration.class.php Project: thib3113/yana-server
0
 public function add($key, $value, $ns = 'conf')
 {
     $config = new Configuration();
     $config->setKey($ns . ':' . $key);
     $config->setValue($value);
     $config->save();
     $this->confTab[$ns][$key] = $value;
     unset($_SESSION['configuration']);
 }
Example #17
Show file File: ConfigurationTest.php Project: tailored-tunes/php-env-config
0
 public function testNonDefaultValuesDefine()
 {
     $name = uniqid('name');
     $realValue = uniqid('realValue');
     $default = uniqid('value');
     $config = new Configuration([$name => $realValue]);
     $config->define($name, $default);
     $expected = $realValue;
     $this->assertEquals(constant($name), $expected, 'The parameter is not defined properly with real value');
 }
Example #18
Show file File: ConfigurationTest.php Project: acorncom/deployer
0
 /**
  * Test get pass phrase with use PasswordGetter system
  */
 public function testGetPassPhraseWithUsePasswordGetter()
 {
     $configuration = new Configuration('name', 'localhost', 80);
     $configuration->setUser('user');
     $passwordGetter = $this->getMockForAbstractClass('Deployer\\Server\\Password\\PasswordGetterInterface');
     $passwordGetter->expects($this->once())->method('getPassword')->with('localhost', 'user')->will($this->returnValue('some-pass-phrase'));
     $configuration->setPassPhrase($passwordGetter);
     $passPhrase = $configuration->getPassPhrase();
     $this->assertEquals('some-pass-phrase', $passPhrase, 'Pass phrases mismatch');
 }
Example #19
Show file File: FileUtil.php Project: bmdevel/bav
0
 /**
  * Returns a writable directory for temporary files
  *
  * @return String
  * @see Configuration::setTempDirectory()
  * @throws NoTempDirectoryException
  */
 public function getTempDirectory()
 {
     if (!is_null($this->configuration->getTempDirectory())) {
         return $this->configuration->getTempDirectory();
     }
     if (is_null($this->cachedTempDirectory)) {
         $this->cachedTempDirectory = $this->findTempDirectory();
     }
     return $this->cachedTempDirectory;
 }
Example #20
Show file File: ConfigurationTest.php Project: luispabon/paratest
0
 public function testGlobbingSupport()
 {
     $basePath = getcwd() . DS;
     $configuration = new Configuration($this->fixture('phpunit-globbing.xml'));
     /** @var SuitePath[][] $suites */
     $suites = $configuration->getSuites();
     $this->assertEquals($basePath . 'test' . DS . 'fixtures' . DS . 'globbing-support-tests' . DS . 'some-dir', $suites["ParaTest Fixtures"][0]->getPath());
     $this->assertEquals($basePath . 'test' . DS . 'fixtures' . DS . 'globbing-support-tests' . DS . 'some-dir2', $suites["ParaTest Fixtures"][1]->getPath());
     return $suites;
 }
Example #21
Show file File: Configuration.php Project: ratibus/Crew
0
 /**
  * @static
  * @param $name
  * @param $value
  * @return void
  */
 public static function set($name, $value = null)
 {
     $configuration = ConfigurationPeer::retrieveByName($name);
     if (!$configuration) {
         $configuration = new Configuration();
         $configuration->setName($name);
     }
     $configuration->setValue($value);
     $configuration->save();
 }
Example #22
Show file File: database.class.php Project: richardhodgson/rhodgson.co.uk
0
 function getConnectionSettings()
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/conf/configuration.class.php';
     $configuration = new Configuration();
     extract($configuration->getDatabaseConnectionSettings());
     $this->host = $host;
     $this->database = $database;
     $this->username = $username;
     $this->password = $password;
 }
Example #23
Show file File: DataManager.php Project: aazhbd/ArtWebCms
0
 /**
  * DataManager constructor.
  * @param Configuration $conf
  */
 function __construct(Configuration $conf)
 {
     $this->message = "";
     try {
         $data = new \PDO('mysql:host=' . $conf->getDbHost() . ';dbname=' . $conf->getDbName() . '', $conf->getDbUser(), $conf->getDbPass());
         $this->data_manager = new \FluentPDO($data);
         $this->data_manager->debug = false;
     } catch (\Exception $ex) {
         $this->message = "Database connection failed : " . $ex->getMessage();
     }
 }
Example #24
Show file File: PackageCore.php Project: YesWiki/yeswiki-extension-autoupdate
0
 protected function localRelease()
 {
     $configuration = new Configuration('wakka.config.php');
     $configuration->load();
     $release = Release::UNKNOW_RELEASE;
     if (isset($configuration['yeswiki_release'])) {
         $release = $configuration['yeswiki_release'];
     }
     $release = new Release($release);
     return $release;
 }
Example #25
Show file File: ViewTest.php Project: rubendgr/lunr
0
 /**
  * TestCase Constructor.
  *
  * @return void
  */
 public function setUp()
 {
     $this->sub_configuration = $this->getMock('Lunr\\Core\\Configuration');
     $this->configuration = $this->getMock('Lunr\\Core\\Configuration');
     $map = array(array('path', $this->sub_configuration));
     $this->configuration->expects($this->any())->method('offsetGet')->will($this->returnValueMap($map));
     $this->request = $this->getMock('Lunr\\Corona\\RequestInterface');
     $this->response = $this->getMock('Lunr\\Corona\\Response');
     $this->class = $this->getMockBuilder('Lunr\\Corona\\View')->setConstructorArgs(array($this->request, $this->response, $this->configuration))->getMockForAbstractClass();
     $this->reflection = new ReflectionClass('Lunr\\Corona\\View');
 }
Example #26
Show file File: z_cssLeedMaker.plugin.disabled.php Project: kraoc/Leed-market
0
function zcssleedmaker_plugin_update($_)
{
    if ($_['action'] == 'zcssleedmaker_update') {
        $configurationManager = new Configuration();
        $configurationManager->getAll();
        $configurationManager->put('plugin_cssLeedMaker_css', $_['plugin_cssLeedMaker_css']);
        $configurationManager->put('plugin_cssLeedMaker_addcss', rawurlencode($_['plugin_cssLeedMaker_addcss']));
        $_SESSION['configuration'] = null;
        header('location: settings.php#CSSLeedMaker');
    }
}
Example #27
Show file File: ConfigurationManager.php Project: cundd/noshi
0
 /**
  * Initializes the shared configuration
  *
  * @param string $basePath
  * @return Configuration
  */
 public static function initializeConfiguration($basePath)
 {
     // Read the configurations file
     $configuration = array();
     $configurationFile = $basePath . 'Configurations/Configuration.json';
     if (file_exists($configurationFile) && is_readable($configurationFile)) {
         $configuration = json_decode(file_get_contents($configurationFile), TRUE);
     }
     self::$sharedConfiguration = new Configuration($configuration);
     self::$sharedConfiguration->set('basePath', $basePath);
     return self::$sharedConfiguration;
 }
Example #28
Show file File: Mapping.php Project: samrahman/providence
0
 /**
  * Mapping constructor.
  */
 public function __construct()
 {
     // set up basic properties
     $this->opo_datamodel = \Datamodel::load();
     $this->opo_search_conf = \Configuration::load(\Configuration::load()->get('search_config'));
     $this->opo_indexing_conf = \Configuration::load($this->opo_search_conf->get('search_indexing_config'));
     $this->opo_db = new \Db();
     $this->opo_search_base = new \SearchBase($this->opo_db, null, false);
     $this->opa_element_info = array();
     $this->opo_app_vars = new \ApplicationVars($this->opo_db);
     $this->prefetchElementInfo();
 }
Example #29
Show file File: masterclass.class.php Project: richardhodgson/rhodgson.co.uk
0
 function TemplatePath($name)
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/conf/configuration.class.php';
     $Configuration = new Configuration();
     $prepend = $Configuration->TemplateDirectory();
     $file = $prepend . '/' . $name . '.template.php';
     if (is_file($file)) {
         return $file;
     } else {
         return false;
     }
 }
Example #30
Show file File: intheleed.plugin.disabled.php Project: kraoc/Leed-market
0
function intheleed_plugin_update($_)
{
    $myUser = isset($_SESSION['currentUser']) ? unserialize($_SESSION['currentUser']) : false;
    if ($myUser === false) {
        exit(_t('P_INTHELEED_CONNECTION_ERROR'));
    }
    if ($_['action'] == 'intheleed_update') {
        $configurationManager = new Configuration();
        $configurationManager->put('plugin_poche_link', $_['plugin_poche_link']);
        $_SESSION['configuration'] = null;
        header('location: settings.php');
    }
}
Frequently Used Methods