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


PHP Container::instance方法代码示例

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


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

示例1: setUp

 /**
  * Setup the tests
  */
 public function setUp()
 {
     $this->app = IlluminageServiceProvider::make();
     $this->app->instance('path.public', 'tests/public');
     // Bind mocked config
     $this->app->bind('config', function () {
         return Mockery::mock('config', function ($mock) {
             $mock->shouldReceive('get')->with('illuminage::image_engine', '')->andReturn('Gd');
             $mock->shouldReceive('get')->with('illuminage::quality', '')->andReturn(75);
             $mock->shouldReceive('get')->with('illuminage::cache_folder', '')->andReturn('');
         });
     });
     // Create some dummy instances
     $this->image = $this->app['illuminage']->image('foo.jpg');
     $this->thumb = $this->app['illuminage']->thumb('foo.jpg', 100, 100);
 }
开发者ID:anahkiasen,项目名称:illuminage,代码行数:19,代码来源:IlluminageTestCase.php

示例2: page_data

 public static function page_data($e)
 {
     $pid = $e->pid;
     $cid = $e->container;
     $dd = $e->as_array();
     $data = array();
     $fields = array('copy', 'title', 'date_added', 'date_modified', 'meta_keywords', 'meta_description');
     foreach ($fields as $field) {
         if (isset($dd[$field])) {
             $data[$field] = $dd[$field];
         }
     }
     $data['url'] = url::site('page/' . $dd['name'] . '.html');
     $data['plugins'] = array();
     $plugins = Container::instance($cid)->get_blocks_flat($pid);
     foreach ($plugins as $k => $v) {
         $d = $v->data();
         if (empty($d)) {
             continue;
         }
         $data['plugins'][$v->get_name()] = $d;
     }
     // var_dump( $data ); exit;
     return $data;
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:25,代码来源:page_listeners.php

示例3: render

 /**
  * render
  *
  * @return void
  * @author Andy Bennett
  */
 public static function render()
 {
     $content = array();
     $content['content'] = new stdClass();
     $content['content']->title = '';
     $content['content']->copy = Event::$data;
     $container = Container::instance(1)->render($content, null);
     Display::instance()->display($container);
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:15,代码来源:blog_listeners.php

示例4: render

 /**
  * render list of plugins
  *
  * @param string $copy 
  * @return void
  * @author Andy Bennett
  */
 function render($copy)
 {
     $admin_container = Kohana::config('containers.admin_container');
     $content = new stdClass();
     $content->header = 'Containers Admin';
     $content->sub_header = '';
     $content->copy = $copy;
     $page_content = Container::instance()->init($admin_container)->render($content);
     Display::instance()->display($page_content);
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:17,代码来源:plugins_admin.php

示例5: get_container_info

 /**
  * get container info
  *
  * @param string $container_id 
  * @return object
  * @author Andy Bennett
  */
 public static function get_container_info($container_id)
 {
     $info = new stdClass();
     Container::instance()->init($container_id);
     $info->template = Container::instance()->get_template();
     $info->section_nav = current(Container::instance()->get_plugins(array('column' => 'nav')));
     $info->left_column = Container::instance()->get_plugins(array('column' => 'left-col'));
     $info->mid_column = Container::instance()->get_plugins(array('column' => 'middle-col'));
     $info->right_column = Container::instance()->get_plugins(array('column' => 'right-col'));
     $info->palette_plugins = Container::instance()->get_plugins(array('column' => 'palette'));
     return $info;
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:19,代码来源:containers_helper.php

示例6: index

 /**
  * Get plugins and show
  *
  * @return void
  * @author Dan Chadwick
  */
 public function index()
 {
     Event::add('steamcore.aclcheck', array('acl_listeners', 'redirect'));
     $data = array('action' => 'admin', 'name' => null, 'role' => User::instance()->get_role());
     Event::run('steamcore.aclcheck', $data);
     Assets::instance()->add_css('admin');
     $view = View::factory('plugins_list');
     $view->plugins = PluginManager::instance()->getPluginObjects();
     $content = array('content' => new stdClass());
     $content['content']->title = 'Plugins Admin';
     $content['content']->copy = $view->render();
     Assets::instance()->add_css('/cache/css/display');
     Assets::instance()->add_javascript('/cache/js/display');
     Display::instance()->display(Container::instance('display')->render($content));
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:21,代码来源:plugins.php

示例7: admin

 /**
  * listing
  *
  * @return void
  * @author Andy Bennett
  */
 public function admin()
 {
     $data = array('action' => 'edit', 'name' => $this->name, 'role' => User::instance()->get_role());
     Event::run('steamcore.aclcheck', $data);
     $blog = URI::instance()->segment(3, 1);
     $nodes = ORM::factory('blogpost')->where(array('lvl' => 1, 'blog_id' => $blog))->orderby(array('date_added' => 'DESC'))->find_all();
     $lvl = ORM::factory('blogpost')->level_column;
     $data = array('nodes' => $nodes, 'level_column' => $lvl, 'controller' => 'blogposts');
     $copy = View::factory('blog/postslist_admin', $data)->render();
     $content = array();
     $content['content'] = new stdClass();
     $content['content']->title = 'Blog Posts';
     $content['content']->copy = $copy;
     $container = Container::instance(3)->render($content);
     Display::instance()->display($container);
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:22,代码来源:Blog.php

示例8: admin

 public function admin()
 {
     $data = array('action' => 'edit', 'name' => $this->name, 'role' => User::instance()->get_role());
     Event::run('steamcore.aclcheck', $data);
     $root = ORM::factory('pages_position')->where('lft', 0)->find();
     $xml = $root->render_descendants('pages', false)->render();
     $l = xsl::translate_string($xml, 'pages_admin', array(), array('pages_helper::check_acl'));
     $pages = pages_helper::get_pages($root = true);
     $move = View::factory('pageadmin/movepage', array('pagelist' => $pages))->render();
     $c = View::factory('pages/pages', array('list' => $l, 'controller' => 'pages', 'move' => $move))->render();
     $content = array();
     $content['content'] = new stdClass();
     $content['content']->title = 'Pages';
     $content['content']->copy = $c;
     $container = Container::instance(3)->render($content);
     Display::instance()->display($container);
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:17,代码来源:Pages.php

示例9: comments_list

 /**
  * get list of comments
  *
  * @param string $post_id 
  * @return void
  * @author Andy Bennett
  */
 public function comments_list($post_id)
 {
     try {
         $node = ORM::factory('blogpost', $post_id);
         if ($node->has_children()) {
             $data = array();
             $data['post_title'] = $node->title;
             $data['nodes'] = $node->descendants()->find_all();
             $data['controller'] = 'blog_comments';
             $copy = View::factory('blog/post_comments_admin', $data)->render();
             $content = array();
             $content['content'] = new stdClass();
             $content['content']->title = 'Blog Post Comments';
             $content['content']->copy = $copy;
             $container = Container::instance(3)->render($content);
             Display::instance()->display($container);
         }
     } catch (Exception $e) {
         var_dump($e->getMessage());
         Kohana::log('debug', $e->getMessage());
     }
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:29,代码来源:blog_comments.php

示例10: testInstanceArgsFail2

 /**
  * @expectedException \RuntimeException
  */
 public function testInstanceArgsFail2()
 {
     $container = new Container();
     $container['fixture'] = $container->instance('Packfire\\FuelBlade\\ServiceLoadingException');
     $obj = $container['fixture'];
 }
开发者ID:packfire,项目名称:fuelblade,代码行数:9,代码来源:ContainerTest.php

示例11: getContainer

 /**
  * @return Container
  */
 public function getContainer()
 {
     return Container::instance();
 }
开发者ID:im286er,项目名称:FocusPHP,代码行数:7,代码来源:ContainerAwareTrait.php

示例12: testStaticInstance

 public function testStaticInstance()
 {
     $di = new Container();
     $di1 = new Container();
     $this->assertNotSame($di, Container::instance());
     $this->assertSame($di1, Container::instance());
 }
开发者ID:lebran,项目名称:container,代码行数:7,代码来源:ContainerTest.php

示例13: listing

 /**
  * list the containers
  *
  * @return void
  * @author Andy Bennett
  */
 private function listing()
 {
     $data = array('action' => 'edit', 'name' => null, 'role' => User::instance()->get_role());
     Event::run('steamcore.aclcheck', $data);
     $root = ORM::factory('pages_position')->where('lft', 0)->find();
     $xml = $root->render_descendants('pages', false)->render();
     $l = xsl::translate_string($xml, 'page_plugins_list', array(), array(''));
     $c = View::factory('pages/page_plugins_list', array('list' => $l, 'controller' => 'page_plugins'))->render();
     preg_match_all('/{pid=([0-9]+)}/', $c, $matches);
     $count = count($matches[0]);
     for ($i = 0; $i < $count; $i++) {
         $c = str_replace($matches[0][$i], plugins::page_plugins_admin($matches[1][$i]), $c);
     }
     $content = array();
     $content['content'] = new stdClass();
     $content['content']->title = 'Page Plugins';
     $content['content']->copy = $c;
     Assets::instance()->add_css('/cache/css/display');
     Assets::instance()->add_javascript('/cache/js/display');
     $container = Container::instance('display')->render($content);
     Display::instance()->display($container);
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:28,代码来源:Pageplugins.php

示例14: getProvider

 /**
  * @return static
  */
 public static function getProvider()
 {
     return Container::instance(static::class);
 }
开发者ID:rhubarbphp,项目名称:rhubarb,代码行数:7,代码来源:ProviderTrait.php

示例15: item_view_listener

 /**
  * item view
  *
  * @return void
  * @author Andy Bennett
  */
 public static function item_view_listener()
 {
     $cid = Event::$data['data']['row']->container;
     $pid = Event::$data['data']['row']->pid;
     $content = array();
     $content['content'] = new stdClass();
     $content['content']->title = Event::$data['data']['row']->title;
     $content['content']->copy = View::factory('pages/' . Event::$data['view'], Event::$data['data'])->render();
     $container = Container::instance($cid)->render($content, null, $pid);
     Display::instance()->display($container);
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:17,代码来源:MY_steam_listeners.php


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