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


PHP IoC::resolve方法代码示例

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


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

示例1: testSendEmail

 /**
  * Test to send a real-world message
  *
  * @return void
  */
 public function testSendEmail()
 {
     require 'fixtures/message.php';
     $postmark = IoC::resolve('postmark');
     $return = $postmark->send(new Message('hello@yoozi.cn'));
     $this->assertTrue($return);
 }
开发者ID:SerdarSanri,项目名称:laravel-stampie,代码行数:12,代码来源:postmark.test.php

示例2: __get

 /**
  * 
  * @param string $name
  * @return object
  */
 public function __get($name)
 {
     self::$called_class = get_called_class();
     if (method_exists('\\system\\services\\SystemServiceRegistry', $name) || method_exists('\\application\\services\\AppServiceRegistry', $name)) {
         return IoC::resolve($name);
     }
 }
开发者ID:netprogs1,项目名称:yafop,代码行数:12,代码来源:ServiceLocator.php

示例3: _isUnread

 private function _isUnread()
 {
     if (Auth::guest()) {
         return false;
     }
     $markAsReadAfter = value(Config::get('forums::forums.mark_as_read_after'));
     if (!IoC::registered('topicsview')) {
         IoC::singleton('topicsview', function () use($markAsReadAfter) {
             return Forumview::where('updated_at', '>=', date('Y-m-d H:i:s', $markAsReadAfter))->where('user_id', '=', Auth::user()->id)->lists('topic_id');
         });
     }
     $tv = IoC::resolve('topicsview');
     $nb = count($tv);
     $view = Forumtopic::where('forumcategory_id', '=', $this->id)->where('updated_at', '>=', date('Y-m-d H:i:s', $markAsReadAfter));
     if ($nb > 0) {
         $view = $view->where_not_in('id', $tv);
     }
     $view = $view->count();
     if ($nb == 0 && $view > 0) {
         return true;
     }
     if ($view > 0) {
         return true;
     }
     return false;
 }
开发者ID:marmaray,项目名称:OLD-laravel-France-website,代码行数:26,代码来源:forumcategory.php

示例4: page_status

function page_status()
{
    if ($itm = IoC::resolve('page')) {
        return $itm->status;
    }
    return '';
}
开发者ID:rubenvincenten,项目名称:anchor-site,代码行数:7,代码来源:pages.php

示例5: parse

 private static function parse()
 {
     // get uri
     $uri = Request::uri();
     // lets log our initial uri
     Log::info('Requested URI: ' . $uri);
     // route definitions
     $routes = array();
     // posts host page
     if ($page = IoC::resolve('posts_page')) {
         $routes[$page->slug . '/(:any)'] = 'article/$1';
     }
     // fallback to 'admin'
     $admin_folder = Config::get('application.admin_folder', 'admin');
     // static routes
     $routes = array_merge($routes, array($admin_folder . '/(:any)/(:any)/(:any)' => 'admin/$1/$2/$3', $admin_folder . '/(:any)/(:any)' => 'admin/$1/$2', $admin_folder . '/(:any)' => 'admin/$1', $admin_folder => 'admin', 'search/(:any)' => 'search/$1', 'search' => 'search', 'rss' => 'rss', '(:any)' => 'page/$1'));
     // define wild-cards
     $search = array(':any', ':num');
     $replace = array('[0-9a-zA-Z~%\\.:_\\-]+', '[0-9]+');
     // parse routes
     foreach ($routes as $route => $translated) {
         // replace wildcards
         $route = str_replace($search, $replace, $route);
         // look for matches
         if (preg_match('#^' . $route . '#', $uri, $matches)) {
             // replace matched values
             foreach ($matches as $k => $match) {
                 $translated = str_replace('$' . $k, $match, $translated);
             }
             // return on first match
             return $translated;
         }
     }
     return $uri;
 }
开发者ID:nathggns,项目名称:anchor-cms,代码行数:35,代码来源:anchor.php

示例6: action_index

 public function action_index()
 {
     $markdown = IoC::resolve('markdown');
     $data['toc'] = $markdown->transform(File::get(VIEW_PATH . 'contents.md'));
     $data['default_contents'] = $markdown->transform(File::get(VIEW_PATH . 'start/install.md'));
     return View::make('home.index', $data);
 }
开发者ID:reith2004,项目名称:docs,代码行数:7,代码来源:home.php

示例7: is_postspage

function is_postspage()
{
    if ($itm = IoC::resolve('page')) {
        return $itm->id == Config::get('metadata.posts_page');
    }
    return false;
}
开发者ID:nathggns,项目名称:anchor-cms,代码行数:7,代码来源:helpers.php

示例8: menu_active

function menu_active()
{
    if ($itm = IoC::resolve('menu_item')) {
        return $itm->active;
    }
    return '';
}
开发者ID:reqshark,项目名称:anchor-cms,代码行数:7,代码来源:menus.php

示例9: comments_open

function comments_open()
{
    if ($itm = IoC::resolve('article')) {
        return $itm->comments ? true : false;
    }
    return false;
}
开发者ID:reqshark,项目名称:anchor-cms,代码行数:7,代码来源:comments.php

示例10: post_review

 public function post_review()
 {
     $this->filter('before', 'jboardOnly');
     $input = Input::all();
     //grab our input
     $rules = array('decision' => 'required', 'denyreason' => 'required', 'initials' => 'required|alpha|min:2', 'amtreduce' => 'numeric', 'details' => 'required');
     //validation rules
     $validation = Validator::make($input, $rules);
     //let's run the validator
     if ($validation->fails()) {
         return Redirect::to('jboard/review/' . Input::get('ticketid'))->with_errors($validation);
     }
     //insert ruling into database
     Ruling::create(array('decision' => Input::get('decision'), 'denyreason' => Input::get('denyreason'), 'reasoning' => Input::get('details'), 'intials' => Input::get('initials'), 'CWID' => Input::get('cwid'), 'amtReduce' => Input::get('amtreduce'), 'ticketID' => Input::get('ticketid')));
     //let's close the ticket now
     $close = DB::table('tickets')->where('ticketID', '=', Input::get('ticketid'))->update(array('appealStatus' => '1'));
     return Redirect::to('jboard/')->with('alertMessage', 'Ruling submitted successfully.');
     DB::table('tickets')->where('ticketID', '=', Input::get('ticketid'))->update(array('appealStatus' => '1'));
     /////////////////////
     // Now we're going to email the appellant to let them know that their appeal has been reviewed.
     /////////////////////
     // Get the Swift Mailer instance
     $mailer = IoC::resolve('mailer');
     //set the appellant's email address using CWID
     $email = Input::get('cwid') . '@marist.edu';
     //set html body of email
     $body = "This autogenerated email is to let you know that your appeal has been reviewed and closed by the Justice Board. Please login to the Online Parking Appeal System at <a href='http://sga.marist.edu/parkingappeals/'>http://sga.marist.edu/parkingappeals/</a>. Please do not reply to this message. <br><br> Thank you, <br> Student Government Association Justice Board";
     // Construct the message
     $message = Swift_Message::newInstance('[Marist SGA] Your Parking Appeal Has Been Reviewed')->setFrom(array('sga.judicial@marist.edu' => 'SGA Judicial Board'))->setTo(array($email => 'Appellant'))->addPart('This email is autogenerated to let you know that your appeal has been reviewed by the Justice Board. Please login to the Online Parking Appeal System at http://sga.marist.edu/parkingappeals to review the decision. ', 'text/plain')->setBody($body, 'text/html');
     // Send the email
     $mailer->send($message);
     return Redirect::to('jboard/')->with('alertMessage', 'Ruling submitted successfully.');
 }
开发者ID:nkwsy,项目名称:ParkingAppeal,代码行数:33,代码来源:jboard.php

示例11: run

 /**
  * run() is the start-point of the CLI request, the
  * first argument specifies the command, and sub-sequent
  * arguments are passed as arguments to the chosen generator.
  *
  * @param $arguments array The command and its arguments.
  * @return void
  */
 public function run($arguments = array())
 {
     if (!count($arguments)) {
         $this->_help();
     }
     // setup ansi support
     Common::detect_windows();
     // assign the params
     $command = $arguments[0] !== '' ? $arguments[0] : 'help';
     $args = array_slice($arguments, 1);
     switch ($command) {
         case "controller":
         case "c":
             new Generators_Controller($args);
             break;
         case "model":
         case "m":
             new Generators_Model($args);
             break;
         case "alias":
             new Generators_Alias($args);
             break;
         case "migration":
         case "mig":
             IoC::resolve('task: migrate')->make($args);
             break;
         case "bundle":
         case "b":
             new Generators_Bundle($args);
             break;
         case "test":
         case "t":
             new Generators_Test($args);
             break;
         case "task":
         case "ta":
             new Generators_Task($args);
             break;
         case "class":
         case "cl":
             new Generators_Class($args);
             break;
         case "install":
         case "i":
             IoC::resolve('task: bundle')->install($args);
             break;
         case "config":
         case "co":
             new Generators_Config($args);
             break;
         case "view":
         case "v":
             new Generators_View($args);
             break;
         default:
             $this->_help();
             break;
     }
 }
开发者ID:gigikiri,项目名称:masjid-l3,代码行数:67,代码来源:build.php

示例12: run

 /**
  * Run the test and create a TestLog.
  */
 public function run()
 {
     $tester = IoC::resolve('tester');
     $passed = $tester->test($this->type, $this->url, $this->options);
     $message = $passed ? 'Test Passed' : 'Test Failed';
     #todo: more descriptive messages
     Test\Log::create(array('test_id' => $this->id, 'message' => $message, 'passed' => $passed));
 }
开发者ID:netcon-source,项目名称:clementia,代码行数:11,代码来源:test.php

示例13: action_index

 public function action_index($folder = null)
 {
     //if ( ! Request::ajax())
     //return;
     //Bundle::start('juploader');
     $uploader = IoC::resolve('Uploader');
     $uploader->with_uploader('Uploader\\DatabaseUploadHandler')->with_argument('1')->with_option('script_url', URL::to_action('juploader::dbupload@index'))->Start();
     return $uploader->get_response();
 }
开发者ID:ajayvaineela,项目名称:laravel-juploader,代码行数:9,代码来源:dbupload.php

示例14: generate

 public static function generate()
 {
     // create a dom xml object
     static::$document = new DOMDocument('1.0', 'UTF-8');
     // create our rss feed
     $rss = static::element('rss', null, array('version' => '2.0', 'xmlns:atom' => 'http://www.w3.org/2005/Atom'));
     static::$document->appendChild($rss);
     // create channel
     $channel = static::element('channel');
     $rss->appendChild($channel);
     // title
     $title = static::element('title', Config::get('metadata.sitename'));
     $channel->appendChild($title);
     // link
     $url = 'http://' . $_SERVER['HTTP_HOST'];
     $link = static::element('link', $url);
     $channel->appendChild($link);
     // description
     $description = static::element('description', Config::get('metadata.description'));
     $channel->appendChild($description);
     // laguage
     // http://www.rssboard.org/rss-language-codes
     $language = static::element('language', Config::get('application.language', 'en'));
     $channel->appendChild($language);
     $ttl = static::element('ttl', 60);
     $channel->appendChild($ttl);
     $docs = static::element('docs', 'http://blogs.law.harvard.edu/tech/rss');
     $channel->appendChild($docs);
     $copyright = static::element('copyright', Config::get('metadata.sitename'));
     $channel->appendChild($copyright);
     // atom self link
     $atom = static::element('atom:link', null, array('href' => $url, 'rel' => 'self', 'type' => 'application/rss+xml'));
     $channel->appendChild($atom);
     // articles
     $params = array('status' => 'published', 'sortby' => 'id', 'sortmode' => 'desc');
     foreach (Posts::list_all($params) as $post) {
         $item = static::element('item');
         $channel->appendChild($item);
         // title
         $title = static::element('title', $post->title);
         $item->appendChild($title);
         // link
         $url = 'http://' . $_SERVER['HTTP_HOST'] . Url::make(IoC::resolve('posts_page')->slug . '/' . $post->slug);
         $link = static::element('link', $url);
         $item->appendChild($link);
         // description
         $description = static::element('description', $post->description);
         $item->appendChild($description);
         // date
         $date = static::element('pubDate', date(DATE_RSS, $post->created));
         $item->appendChild($date);
     }
     // dump xml tree
     return static::$document->saveXML();
 }
开发者ID:nathggns,项目名称:anchor-cms,代码行数:55,代码来源:rss.php

示例15: search_results

function search_results()
{
    $posts = IoC::resolve('search');
    if ($result = $posts->valid()) {
        // register single post
        IoC::instance('article', $posts->current(), true);
        // move to next
        $posts->next();
    }
    return $result;
}
开发者ID:rubenvincenten,项目名称:anchor-site,代码行数:11,代码来源:search.php


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