/** * Bootstrap the application * * Throws Steelcode_Application_Exception if Bootstrap class * does not extend Steelcode_Application_Bootstrap_Abstract * * @param array $options * @return Stelcode_Application_Config * @throws Steelcode_Application_Exception */ public function bootstrap($options = array()) { if (!$this->_bootstrap instanceof Steelcode_Application_Bootstrap) { throw new Steelcode_Application_Exception('Class Bootstrap does not extend Steelcode_Application_Bootstrap_Abstract'); } return $this->_bootstrap->bootstrap($options); }
/** * generate Input type */ public function generate_meta_box() { global $post_id; $bootstrap = new Bootstrap(); $bootstrap->load_bootstrap_css(); foreach ($this->meta_boxes["input"] as $input) { switch ($input["type"]) { case "text": $this->render->view("input.text", $input, plugin_dir_path(__FILE__) . "../views/admin"); break; case "editor": $this->render->view("input.editor", $input, plugin_dir_path(__FILE__) . "../views/admin"); break; case "textarea": $this->render->view("input.textarea", $input, plugin_dir_path(__FILE__) . "../views/admin"); break; case "email": $this->render->view("input.email", $input, plugin_dir_path(__FILE__) . "../views/admin"); break; case "img": wp_enqueue_media(); $this->render->view("img", $input, plugin_dir_path(__FILE__) . "../views/admin"); break; default: $this->render->view($input["type"], $input, plugin_dir_path(__FILE__) . "../views/admin"); break; } } }
public function init() { X_VlcShares_Plugins::broker()->gen_beforeInit($this); $this->bootstrap = $this->getFrontController()->getParam('bootstrap'); $this->options = $this->bootstrap->getResource('configs'); $this->translate = $this->bootstrap->getResource('translation'); X_VlcShares_Plugins::broker()->gen_afterInit($this); }
public function bootstrap($bootstrap_nodes = NULL) { $nodes = $this->settings->kbuckets->toNodeList(); if ($bootstrap_nodes !== NULL) { $nodes->addNodeList($bootstrap_nodes); } $task = new Bootstrap($this->settings, $nodes); return $task->enqueue(); }
/** * Run the bootstrap process of the application * Define constants, settings etc. * Main point in index.php * * @return void */ public static function run() { if (self::$instance === null) { self::$instance = new Bootstrap(); } self::$instance->app = new \Silex\Application(); self::$instance->defineConstants(); self::$instance->includeSettingsAndRoutes(); self::$instance->app->run(); }
/** * @param string $url * @param \Phalcon\DI\FactoryDefault $di */ private function runApplication($url, DI\FactoryDefault $di = null) { require_once dirname(__DIR__) . '/../fixtures/app/Bootstrap.php'; $config = (require dirname(__DIR__) . '/../fixtures/app/config/config.php'); $config = new \Phalcon\Config($config); $bootstrap = new \Bootstrap($config); if ($di != null) { $bootstrap->setDi($di); } $bootstrap->setup()->run($url); }
/** * @test * @dataProvider BootstrapCssFilenames */ public function UsesBootstrapCssDependingOnSwitches($cdn, $responsive, $fontawesome, $mincss, $expected_filename) { $component = new Bootstrap(); $component->_assetsUrl = 'assets'; $component->assetsRegistry = new FakeAssetsRegistry(); $component->enableCdn = $cdn; $component->responsiveCss = $responsive; $component->fontAwesomeCss = $fontawesome; $component->minify = $mincss; $component->registerBootstrapCss(); $this->assertEquals($expected_filename, $component->assetsRegistry->getLastRegisteredCssFile()); }
/** * @covers \Heystack\Core\Bootstrap::__construct * @covers \Heystack\Core\Bootstrap::postRequest * @covers \Heystack\Core\Bootstrap::doBootstrap */ public function testPostRequestDoesDispatch() { $session = $this->getSessionMock(); $sessionBackend = $this->getMock('Heystack\\Core\\State\\Backends\\Session'); $eventDispatcher = $this->getMock('Heystack\\Core\\EventDispatcher'); $sessionBackend->expects($this->once())->method('setSession')->with($session); $eventDispatcher->expects($this->once())->method('dispatch')->with(Events::POST_REQUEST); $this->container->expects($this->at(0))->method('get')->with(Services::BACKEND_SESSION)->will($this->returnValue($sessionBackend)); $this->container->expects($this->at(1))->method('get')->with(Services::EVENT_DISPATCHER)->will($this->returnValue($eventDispatcher)); $b = new Bootstrap($this->container); $b->doBootstrap($session); $b->postRequest($this->getRequestMock(), $this->getMock('SS_HTTPResponse'), $this->getMock('DataModel')); }
/** * Returns the path to system file configurated to log errors. If no paramter * is passed, tries to load bootstrap from Agana_Util_Bootstrap, else, loads * from parameter variable. * * @param Bootstrap $bootsrap * @return string System error file path */ public static function getSystemLogPath($bootsrap = null) { if ($bootsrap) { $options = $bootsrap->getOption('agana'); } else { $options = Agana_Util_Bootstrap::getOption('agana'); } if (isset($options['app']['syserrorfile'])) { $sysLogFile = $options['app']['syserrorfile']; } else { $sysLogFile = APPLICATION_DATA_PATH . '/app.error.log.xml'; } return $sysLogFile; }
public function setUp() { $_SERVER['HTTP_HOST'] = 'vegas.dev'; $_SERVER['REQUEST_URI'] = '/'; $this->di = DI::getDefault(); $modules = (new ModuleLoader())->dump(TESTS_ROOT_DIR . '/fixtures/app', TESTS_ROOT_DIR . '/fixtures/app/config/'); $app = new Application(); $app->registerModules($modules); require_once TESTS_ROOT_DIR . '/fixtures/app/Bootstrap.php'; $config = (require TESTS_ROOT_DIR . '/fixtures/app/config/config.php'); $config = new \Phalcon\Config($config); $bootstrap = new \Bootstrap($config); $bootstrap->setup(); $this->bootstrap = $bootstrap; }
/** *### .init() * * Initializes the widget. */ public function init() { parent::init(); $classes = array('table'); if (isset($this->type)) { if (is_string($this->type)) { $this->type = explode(' ', $this->type); } if (!empty($this->type)) { $validTypes = array(self::TYPE_STRIPED, self::TYPE_BORDERED, self::TYPE_CONDENSED, self::TYPE_HOVER); foreach ($this->type as $type) { if (in_array($type, $validTypes)) { $classes[] = 'table-' . $type; } } } } if (!empty($classes)) { $classes = implode(' ', $classes); if (isset($this->itemsCssClass)) { $this->itemsCssClass .= ' ' . $classes; } else { $this->itemsCssClass = $classes; } } $booster = Bootstrap::getBooster(); $popover = $booster->popoverSelector; $tooltip = $booster->tooltipSelector; $afterAjaxUpdate = "js:function() {\n\t\t\tjQuery('.popover').remove();\n\t\t\tjQuery('{$popover}').popover();\n\t\t\tjQuery('.tooltip').remove();\n\t\t\tjQuery('{$tooltip}').tooltip();\n\t\t}"; if (!isset($this->afterAjaxUpdate)) { $this->afterAjaxUpdate = $afterAjaxUpdate; } }
public static function getInstance() { if (!self::$_instance) { self::$_instance = new self(); } return self::$_instance; }
/** * Regresa el Service MAnager * @return ServiceManager */ public static function getSm() { if (self::$sm === null) { self::$sm = self::configSm(); } return self::$sm; }
public static function setupRegistry() { self::$registry = new Zend_Registry(array(), ArrayObject::ARRAY_AS_PROPS); Zend_Registry::setInstance(self::$registry); $registry = Zend_Registry::getInstance(); $registry->set('root', self::$root); }
public static function init() { if (self::$init == null) { self::$init = new self(); } return self::$init; }
public static function getInstance() { if (!isset(self::$instance)) { self::$instance = new self(); } return self::$instance; }
public static function setSkin($parser, $skin) { /* @todo: in order to work with parsercache this needs to cache the value in wikitext and retreive it before the skin is initialized */ Bootstrap::$pageSkin = $skin; return true; }
public function __construct() { $config = Config::GetConfig(); $this->_dba = DatabaseAdapter::Create($config['db_adapter']); $this->_dba->connect($config['db_host'], $config['db_user'], $config['db_pass'], $config['db_flags']); // Connect to the default database // @todo Move this decision out of this class if (class_exists('Bootstrap', false)) { $this->_dba->selectDatabase(Bootstrap::GetDefaultDatabase()); // @todo Abstraction violation! } else { $default_db = Config::GetValue('default_db'); if (isset($default_db)) { $this->_dba->selectDatabase($default_db); // @todo Hack! } } return; }
public function __construct() { $b = Bootstrap::getInstance(); $b->init(); $b->includeWordPress(); $this->uploadDir = wp_upload_dir(); }
/** * @access public * @static * @param array $attrs (default: array()) * @return void */ public static function forge(array $attrs = array()) { is_null(self::$helper) and self::$helper = Bootstrap::forge('html'); // increment instance num, if we need to render more tan than 1 tabs element self::$inst_num++; return new self($attrs); }
/** * Initializes the entire admin app * @access public */ public function __construct($config) { // call the bootstrap function to initialize everything parent::__construct($config); // if new display settings are set in the url, save them to the database if ($this->params->get->getElemId('sort_location') && $this->params->get->getElemId('sort_by')) { $this->prefs->addSort($this->params->get->getElemId('sort_location'), $this->params->get->getElemId('sort_by'), $this->params->get->getElemId('sort_direction')); } if ($this->config('enable_authentication_support')) { // load all default user preferences if ($this->params->session->getInt('user_id')) { $this->prefs->loadUserPreferences(); } // determine if the current user is an admin define('IS_ADMIN', $this->user->userHasGlobalAccess()); // determine if this a one-user system or not define('MULTIPLE_USERS', $this->user->userAccountCount() == 1 ? false : true); } else { define('IS_ADMIN', false); define('MULTIPLE_USERS', false); } // set the referring page unless we're POSTing $post_set = $this->params->getRawSource('post'); if (!$post_set) { $this->router->setReturnToReferrer(); } // load a module based off of parameters in the URL $this->router->loadFromUrl(); // end logging $end = Date::microtime(); $this->log->write('Application request completed at ' . Date::formatMicrotime($end)); $this->log->write('Time Spent: ' . ($end - Date::microtime(EXECUTION_START)) . ' seconds'); }
public function errorAction() { parent::errorAction(); $this->_helper->output('proto'); $this->view->setClass('Application\\Proto\\AsyncNotification\\Service\\Response'); $this->view->reason = $this->_message; /* const OK = 0; const EXPIRED = 1; const UNKNOWN_TOKEN = 2; const WRONG_TOKEN = 3; const WRONG_PROTO = 4; const WRONG_MESSAGE = 5; const UNKNOWN = 10; */ // TODO: review exception $ex = $this->_exception; switch (true) { case $ex instanceof Application\Model\Mapper\Exception\MissingCacheException: $this->view->code = Application\Proto\AsyncNotification\Service\Response\Code::EXPIRED; break; case $ex instanceof Application\Model\Mapper\Exception\InvalidArgumentException: $this->view->code = Application\Proto\AsyncNotification\Service\Response\Code::WRONG_TOKEN; break; default: $this->view->code = Application\Proto\AsyncNotification\Service\Response\Code::UNKNOWN; break; } // TODO Why is sometimes sending response twice??? :S Bootstrap::$responseSent = true; }
/** * @param string $file * @param string $content * @return boolean */ public function write($file, $content) { $pathSavePHPUnit = Bootstrap::factory()->config('config.output.phpunit'); $pathReadFiles = Bootstrap::factory()->config('config.input.selenium'); $namespaces = explode('/', str_replace(array('_de_', '_', $pathReadFiles . '/', '.selenium'), array('De', '', '', ''), $file)); $namespaces[1] = "Suite{$namespaces[1]}"; $tmplStaticPageTest = file_get_contents('templates/TemplateStaticPageTest.php'); $tmplSuitePageTest = file_get_contents('templates/TemplateSuitePageTest.php'); $tmplTestPageTest = file_get_contents('templates/TemplateTestPageTest.php'); //write function $tmplStaticPageTest = str_replace(array('CLASS_NAME', 'FUNCTION_NAME'), array($namespaces[0], $namespaces[0]), $tmplStaticPageTest); $s1 = @file_put_contents("{$pathSavePHPUnit}/TemplateStaticPage{$namespaces[0]}Test.php", $tmplStaticPageTest); //write suite $tmplSuitePageTest = str_replace(array('CLASS_NAME', 'FUNCTION_NAME', 'SUITE_NAME'), array($namespaces[0] . $namespaces[1], $namespaces[0], $namespaces[1]), $tmplSuitePageTest); $s2 = @file_put_contents("{$pathSavePHPUnit}/TemplateSuitePage{$namespaces[1]}Test.php", $tmplSuitePageTest); //write test $tmplTestPageTest = str_replace(array('CONTENT_XEBIUM', 'CLASS_NAME', 'FUNCTION_NAME', 'SUITE_NAME', 'TEST_NAME'), array($content, $namespaces[0] . $namespaces[1] . $namespaces[2], $namespaces[0], "{$namespaces[1]}", $namespaces[2]), $tmplTestPageTest); $s3 = @file_put_contents("{$pathSavePHPUnit}/TemplateTestPage{$namespaces[2]}Test.php", $tmplTestPageTest); if (!$s1) { throw new Exception('Ocorreu um erro na criação da classe TemplateStaticPage!'); } if (!$s2) { throw new Exception('Ocorreu um erro na criação da classe TemplateSuitePage!'); } if (!$s3) { throw new Exception('Ocorreu um erro na criação da classe TemplateTestPage!'); } return true; }
public static function instance() { if (self::$_instance === false) { self::$_instance = new Bootstrap(); } return self::$_instance; }
public function errorAction() { parent::errorAction(); $this->view->message = $this->_message; $this->view->error = $this->_errorCode; if (!empty($this->_validationEntity)) { $this->view->entity = $this->_validationEntity; } if (!empty($this->_validationErrors)) { $this->view->validationErrors = $this->_validationErrors; } if (!empty($this->_errorMessages)) { $this->view->errorMessages = $this->_errorMessages; } if ($this->_exception instanceof Application\Model\Mapper\Exception\EricssonException) { $this->view->reason = $this->_exception->getReason(); } //We need a big body to avoid IE bug about error responses inside iFrame if ($this->getRequest()->getParam('iframeHack', false)) { $hash = md5('I hate IE'); $this->_helper->output()->setContentType('text/html'); $this->view->ieHack = str_repeat($hash, 10); } // TODO Why is sometimes sending response twice??? :S Bootstrap::$responseSent = true; }
public function getGeoInfo($ip) { $cache = Cache::getInstance(); $return = $cache->get('geo:' . $ip); if ($cache->wasResultFound()) { if (DEBUG_BAR) { Bootstrap::getInstance()->debugbar['messages']->addMessage("Cached GeoInfo: {$ip}"); } return $return; } $client = new \GuzzleHttp\Client(); //'https://geoip.maxmind.com/geoip/v2.1/city/me $res = $client->get($this->url . $ip, array('auth' => array($this->user, $this->password))); $body = $res->getBody(true); $json = json_decode($body); $return = array('countryCode' => $json->country->iso_code, 'countryName' => $json->country->names->en, 'state' => $json->subdivisions[0]->names->en, 'city' => $json->city->names->en); if (empty($return['city'])) { $return['city'] = 'Unknown'; } if (empty($return['state'])) { $return['state'] = 'Unknown'; } $cache->set('geo:' . $ip, $return, 3600); return $return; }
public function search($url, $form = array()) { if (!isset($form['class'])) { $form['class'] = 'navbar-form navbar-right'; } return "\n\t" . parent::search($url, $form); }
function __construct() { $this->lines = []; $this->debug = false; $this->verbose = false; $this->session_id = 'USR35AVKKF2TK'; // if( ($domain = getenv('DOMAIN')) && ( $mode = getenv('MODE') ) ) // $this->url = "http://".$mode.".api.".$domain; // else // throw new \Exception(" error in ".__METHOD__." environment variables DOMAIN and MODE not set"); // var_dump($this->url); // exit(); // if (getenv('URL')) { $url = getenv('URL'); $this->url = $url; } else { if (getenv('DOMAIN') && getenv('MODE')) { $domain = getenv('DOMAIN'); $mode = getenv('MODE'); $this->url = "http://" . $mode . ".api." . $domain; } else { if (is_null(self::$apiUrl) && class_exists("\\Bootstrap")) { $this->url = Bootstrap::getApiUrl(); } else { $this->url = self::apiUrl; } } } // var_dump($this->url); // $this->url = "http://stringy"; // The POST URL // $this->content_type = "Content-type: application/json"; $this->content_type = "Content-type: text/plain"; $this->request_block = ['jsonrpc' => '2.0', 'id' => 'rob', 'session_id' => 'USR35AVKKF2TK']; }
public function __construct() { $this->ROOT = realpath(dirname(__FILE__) . '/../../../'); //imports require_once $this->ROOT . '/inc/config.inc.php'; Bootstrap::start(); $this->db = Database::obtain(INIT::$DB_SERVER, INIT::$DB_USER, INIT::$DB_PASS, INIT::$DB_DATABASE); $this->db->connect(); //init params $this->path = $this->ROOT . '/lib/Utils/converter_checker'; $resultSet = $this->db->fetch_array(self::selectAllNotOffline); if (empty($resultSet)) { self::_prettyEcho("------------------------------------"); self::_prettyEcho("************* WARNING **************"); self::_prettyEcho("------------------------------------"); $this->alertForEmptyPool(); die(1); } foreach ($resultSet as $conv) { // self::$ipLog = $conv[ 'ip_converter' ]; $this->resultSet[$conv['ip_converter']] = $conv; $this->host_machine_map[$conv['ip_converter']] = array('ip_machine_host' => $conv['ip_machine_host'], 'machine_host_user' => $conv['machine_host_user'], 'machine_host_pass' => $conv['machine_host_pass'], 'instance_name' => $conv['instance_name']); // self::_prettyEcho( "Retrieving Processes Info on " . $conv[ 'ip_converter' ] ); // $converter_json_top = self::getNodeProcessInfo( $conv[ 'ip_converter' ] ); // if ( !empty( $converter_json_top ) ) { // $this->convertersTop[ $conv[ 'ip_converter' ] ] = array( // 'converter_load' => $converter_json_top[ 0 ], // 'converter_json_top' => $converter_json_top[ 1 ] // ); // } } $this->converterFactory = new FileFormatConverter(); }
public function __construct() { $this->bootstrap = Bootstrap::getInstance(); $this->import = Import::getInstance(); $this->resolver = Resolver::getInstance(); foreach ($this->bootstrap->appSettings->wpbootstrap->menus as $menu => $locations) { $dir = BASEPATH . "/bootstrap/menus/{$menu}"; $newMenu = new \stdClass(); $newMenu->slug = $menu; $newMenu->locations = $locations; $newMenu->items = array(); foreach ($this->getFiles($dir) as $file) { $menuItem = new \stdClass(); $menuItem->done = false; $menuItem->id = 0; $menuItem->parentId = 0; $menuItem->slug = $file; $menuItem->menu = unserialize(file_get_contents($dir . '/' . $file)); $newMenu->items[] = $menuItem; } usort($newMenu->items, function ($a, $b) { return (int) $a->menu->menu_order - (int) $b->menu->menu_order; }); $this->menus[] = $newMenu; } $baseUrl = get_option('siteurl'); $neutralUrl = Bootstrap::NETURALURL; $this->resolver->fieldSearchReplace($this->menus, Bootstrap::NETURALURL, $this->import->baseUrl); $this->process(); }