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


PHP Bootstrap::getInstance方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     $b = Bootstrap::getInstance();
     $b->init();
     $b->includeWordPress();
     $this->uploadDir = wp_upload_dir();
 }
开发者ID:eriktorsner,项目名称:wp-bootstrap-ui,代码行数:7,代码来源:Extractmedia.php

示例2: getGeoInfo

 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;
 }
开发者ID:ligerzero459,项目名称:block-explorer,代码行数:25,代码来源:MaxMind.php

示例3: __construct

 public function __construct()
 {
     $this->bootstrap = Bootstrap::getInstance();
     $this->import = Import::getInstance();
     $this->resolver = Resolver::getInstance();
     $dir = BASEPATH . '/bootstrap/sidebars';
     foreach ($this->bootstrap->getFiles($dir) as $sidebar) {
         $subdir = BASEPATH . "/bootstrap/sidebars/{$sidebar}";
         $newSidebar = new \stdClass();
         $newSidebar->slug = $sidebar;
         $newSidebar->items = array();
         $newSidebar->meta = unserialize(file_get_contents($subdir . '/meta'));
         foreach ($newSidebar->meta as $key => $widgetRef) {
             $widget = new \stdClass();
             $parts = explode('-', $widgetRef);
             $ord = end($parts);
             $type = substr($widgetRef, 0, -1 * strlen('-' . $ord));
             $widget->type = $type;
             $widget->ord = $ord;
             $widget->meta = unserialize(file_get_contents($subdir . '/' . $widgetRef));
             $newSidebar->items[] = $widget;
         }
         $this->sidebars[] = $newSidebar;
     }
     $baseUrl = get_option('siteurl');
     $neutralUrl = Bootstrap::NETURALURL;
     $this->resolver->fieldSearchReplace($this->sidebars, Bootstrap::NETURALURL, $this->import->baseUrl);
     $this->process();
 }
开发者ID:eriktorsner,项目名称:wp-bootstrap-ui,代码行数:29,代码来源:Pushsidebars.php

示例4: __construct

 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();
 }
开发者ID:eriktorsner,项目名称:wp-bootstrap-ui,代码行数:30,代码来源:Pushmenus.php

示例5: export

 public function export()
 {
     $this->bootstrap = Bootstrap::getInstance();
     $this->resolver = Resolver::getInstance();
     $this->extractMedia = new Extractmedia();
     $this->bootstrap->init();
     $this->bootstrap->includeWordPress();
     $this->mediaIds = array();
     $this->baseUrl = get_option('siteurl');
     $this->exportSettings();
     $this->exportContent();
 }
开发者ID:eriktorsner,项目名称:wp-bootstrap-ui,代码行数:12,代码来源:Export.php

示例6: provideStorage

 public function provideStorage()
 {
     $mysql = Bootstrap::getInstance()->getMysqlPdo();
     $postgres = Bootstrap::getInstance()->getPostgresPdo();
     $sqlite = Bootstrap::getInstance()->getSqlitePdo();
     $mongo = Bootstrap::getInstance()->getMongo();
     $redis = Bootstrap::getInstance()->getRedisStorage();
     $cassandra = Bootstrap::getInstance()->getCassandraStorage();
     $memory = Bootstrap::getInstance()->getMemoryStorage();
     /* hack until we can fix "default_scope" dependencies in other tests */
     $memory->defaultScope = 'defaultscope1 defaultscope2';
     return array(array($memory), array($sqlite), array($mysql), array($postgres), array($mongo), array($redis), array($cassandra));
 }
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:13,代码来源:BaseTest.php

示例7: isHomepage

 static function isHomepage()
 {
     $Dispatcher = Dispatcher::getInstance();
     $Bootstrap = Bootstrap::getInstance();
     if ($Dispatcher->getControllerName() . '/' . $Dispatcher->getActionName() == $Bootstrap->getDefaultPath()) {
         return true;
     } else {
         if ($Dispatcher->getControllerName() . '/' . $Dispatcher->getActionName() == 'default/index') {
             return true;
         }
     }
     return false;
 }
开发者ID:nicolasmartin,项目名称:framework,代码行数:13,代码来源:Url.php

示例8: testGetClientKey

 /** @dataProvider provideStorage */
 public function testGetClientKey(JwtBearerInterface $storage)
 {
     if ($storage instanceof NullStorage) {
         $this->markTestSkipped('Skipped Storage: ' . $storage->getMessage());
         return;
     }
     // nonexistant client_id
     $key = $storage->getClientKey('this-is-not-real', 'nor-is-this');
     $this->assertFalse($key);
     // valid client_id and subject
     $key = $storage->getClientKey('oauth_test_client', 'test_subject');
     $this->assertNotNull($key);
     $this->assertEquals($key, Bootstrap::getInstance()->getTestPublicKey());
 }
开发者ID:huangzhwork,项目名称:oauth2-server-php,代码行数:15,代码来源:JwtBearerTest.php

示例9: __construct

 public function __construct($calling_file_php)
 {
     $this->view = new Zend_View(array("basePath" => dirname($calling_file_php)));
     // Modifier for the links in the headers.
     $bibledit_root_folder = Bootstrap::getInstance()->bibledit_root_folder;
     $file_path = dirname($calling_file_php);
     $header_path_modifier = "";
     $iterations_count = 0;
     while ($file_path != $bibledit_root_folder && $iterations_count < 10) {
         $file_path = dirname($file_path);
         $iterations_count++;
         $header_path_modifier .= "../";
     }
     $this->view->header_path_modifier = $header_path_modifier;
 }
开发者ID:alerque,项目名称:bibledit,代码行数:15,代码来源:view.php

示例10: testSetAccessToken

 /** @dataProvider provideStorage */
 public function testSetAccessToken($storage)
 {
     if ($storage instanceof NullStorage) {
         $this->markTestSkipped('Skipped Storage: ' . $storage->getMessage());
         return;
     }
     if (!$storage instanceof PublicKeyInterface) {
         // incompatible storage
         return;
     }
     $configDir = Bootstrap::getInstance()->getConfigDir();
     $globalPublicKey = file_get_contents($configDir . '/keys/id_rsa.pub');
     $globalPrivateKey = file_get_contents($configDir . '/keys/id_rsa');
     /* assert values from storage */
     $this->assertEquals($storage->getPublicKey(), $globalPublicKey);
     $this->assertEquals($storage->getPrivateKey(), $globalPrivateKey);
 }
开发者ID:huangzhwork,项目名称:oauth2-server-php,代码行数:18,代码来源:PublicKeyTest.php

示例11: import

 public function import()
 {
     error_reporting(-1);
     $this->bootstrap = Bootstrap::getInstance();
     $this->resolver = Resolver::getInstance();
     $this->bootstrap->init();
     $this->bootstrap->includeWordPress();
     require_once $this->bootstrap->localSettings->wppath . '/wp-admin/includes/image.php';
     $this->baseUrl = get_option('siteurl');
     $this->uploadDir = wp_upload_dir();
     $this->importSettings();
     $this->importContent();
     // references
     $this->resolveMetaReferences();
     $this->resolvePostReferences();
     $this->resolveOptionReferences();
 }
开发者ID:eriktorsner,项目名称:wp-bootstrap-ui,代码行数:17,代码来源:Import.php

示例12: __construct

 public function __construct()
 {
     $this->bootstrap = Bootstrap::getInstance();
     $dir = BASEPATH . '/bootstrap/taxonomies';
     foreach ($this->bootstrap->getFiles($dir) as $subdir) {
         $taxonomy = new \stdClass();
         $taxonomy->slug = $subdir;
         $taxonomy->terms = array();
         foreach ($this->bootstrap->getFiles($dir . '/' . $subdir) as $file) {
             $term = new \stdClass();
             $term->done = false;
             $term->id = 0;
             $term->slug = $file;
             $term->term = unserialize(file_get_contents($dir . '/' . $subdir . '/' . $file));
             $taxonomy->terms[] = $term;
         }
         $this->taxonomies[] = $taxonomy;
     }
     $this->process();
 }
开发者ID:eriktorsner,项目名称:wp-bootstrap-ui,代码行数:20,代码来源:Pushtaxonomies.php

示例13: __construct

 public function __construct()
 {
     $this->bootstrap = Bootstrap::getInstance();
     $this->import = Import::getInstance();
     $this->resolver = Resolver::getInstance();
     $dir = BASEPATH . '/bootstrap/posts';
     foreach ($this->bootstrap->getFiles($dir) as $postType) {
         foreach ($this->bootstrap->getFiles($dir . '/' . $postType) as $slug) {
             $newPost = new \stdClass();
             $newPost->done = false;
             $newPost->id = 0;
             $newPost->parentId = 0;
             $newPost->slug = $slug;
             $file = BASEPATH . "/bootstrap/posts/{$postType}/{$slug}";
             $newPost->post = unserialize(file_get_contents($file));
             $this->posts[] = $newPost;
         }
     }
     $this->resolver->fieldSearchReplace($this->posts, Bootstrap::NETURALURL, $this->import->baseUrl);
     $this->process();
 }
开发者ID:eriktorsner,项目名称:wp-bootstrap-ui,代码行数:21,代码来源:Pushposts.php

示例14: testCreatePdoStorageUsingConfig

 public function testCreatePdoStorageUsingConfig()
 {
     $config = array('dsn' => sprintf('sqlite://%s', Bootstrap::getInstance()->getSqliteDir()));
     $storage = new Pdo($config);
     $this->assertNotNull($storage->getClientDetails('oauth_test_client'));
 }
开发者ID:huangzhwork,项目名称:oauth2-server-php,代码行数:6,代码来源:PdoTest.php

示例15: define

 * @version		5.0,0
 */
// ------------------------------------------------------------------------
// define the current environment
define('ENVIRONMENT', 'development');
//define the url for textstem (assumes the installation is in the root directory)
define('TEXTSTEM_URL', '/' . basename(dirname(__FILE__)));
//define the installation path (ie path to the folder this file is in).
define('INSTALL_PATH', rtrim(dirname(__FILE__), '/\\') . DIRECTORY_SEPARATOR);
//define the root path (assumes the INSTALL PATH is in the root).
define('ROOT_PATH', rtrim(dirname(INSTALL_PATH), '/\\') . DIRECTORY_SEPARATOR);
// define the system. Usually, this is a folder called 'System' in the install folder
define('SYSTEM_PATH', INSTALL_PATH . 'System' . DIRECTORY_SEPARATOR);
// define the app path. Usually, this is a folder called 'Application' in the install folder
define('APP_PATH', INSTALL_PATH . 'Application' . DIRECTORY_SEPARATOR);
// define the vendor path. Usually, this is a folder called 'Vendor' in the System folder
define('VENDOR_PATH', SYSTEM_PATH . 'Vendor' . DIRECTORY_SEPARATOR);
// define the app path. Usually, this is a folder called 'Textstem' in the System folder
define('TEXTSTEM_PATH', SYSTEM_PATH . 'Textstem' . DIRECTORY_SEPARATOR);
// define the cache path. Usually, this is a folder called 'Cache' in the Application folder
define('CACHE_PATH', APP_PATH . 'Cache' . DIRECTORY_SEPARATOR);
/**
 * Load bootstrap
 */
require_once SYSTEM_PATH . 'Bootstrap.php';
Bootstrap::getInstance()->Initialise();
/**
 * Start the APP
 */
Debug::clockIn();
Textstem::getInstance()->handleRequest();
开发者ID:luke-mml,项目名称:twigstem,代码行数:31,代码来源:index.php


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