• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Stack类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getLink

 /**
  * Get post Uri
  *
  * @return string
  */
 public function getLink($type = 'default', $param = NULL)
 {
     switch ($type) {
         case 'edit':
             $uri = new Stack(array('name' => 'post.link.edit'));
             $uri->append('post');
             $uri->append('edit');
             break;
         case 'delete':
             $uri = new Stack(array('name' => 'post.link.edit'));
             $uri->append('post');
             $uri->append('delete');
             break;
         case 'hide':
             $uri = new Stack(array('name' => 'post.link.hide'));
             $uri->append('post');
             $uri->append('hide');
             break;
         case 'full':
             return '<a href="' . $this->getLink() . $param . '">' . $this->name . '</a>';
             break;
         default:
             $uri = new Stack(array('name' => 'post.link'));
             $uri->append('post');
     }
     $uri->append($this->id);
     return l('/' . $uri->render('/'));
 }
开发者ID:brussens,项目名称:cogear2,代码行数:33,代码来源:Object.php


示例2: tokenize

 /**
  * @param string $string
  * @return Stack
  */
 public function tokenize($string)
 {
     $stack = new Stack();
     $baseNameSpace = __NAMESPACE__ . '\\Tokens\\Token';
     $offset = 0;
     while (preg_match($this->tokens, $string, $matches, 0, $offset)) {
         $token = $this->getMatchedToken($matches);
         $className = $baseNameSpace . $token;
         $stack->attach(new $className($matches[$token], $offset, $stack));
         $offset += strlen($matches[0]);
     }
     return $stack;
 }
开发者ID:jamoli,项目名称:php-rule-parser,代码行数:17,代码来源:Tokenizer.php


示例3: action_template_header

 public function action_template_header($theme)
 {
     Stack::add('template_header_javascript', Site::get_url('scripts') . "/jquery.js", 'jquery');
     Stack::add('template_header_javascript', Site::get_url('theme') . "/js/jquery.bigframe.js", 'jquery.bigframe', 'jquery');
     Stack::add('template_header_javascript', Site::get_url('theme') . "/js/jquery.dimensions.js", 'jquery.dimensions', 'jquery');
     Stack::add('template_header_javascript', Site::get_url('theme') . "/js/jquery.tooltip.js", 'jquery.tooltip', 'jquery');
 }
开发者ID:habari-extras,项目名称:thePrestige,代码行数:7,代码来源:theme.php


示例4: Inbox

 function Inbox($POD, $count = 20, $offset = 0)
 {
     $this->POD = $POD;
     if (!$this->POD) {
         return false;
     }
     if (!$this->POD->isAuthenticated()) {
         return false;
     }
     // get unread count.
     $sql = "SELECT count(1) as count FROM messages WHERE userId=" . $this->POD->currentUser()->get('id') . " and status='new';";
     $this->POD->tolog($sql, 2);
     $res = mysql_query($sql, $this->POD->DATABASE);
     if ($ur = mysql_fetch_assoc($res)) {
         $this->UNREAD_COUNT = $ur['count'];
     }
     mysql_free_result($res);
     $conditions = array();
     $conditions['userId'] = $this->POD->currentUser()->get('id');
     $sort = 'GROUP by targetUserId ORDER BY max(date) DESC';
     $tables = 'FROM messages m';
     $select = 'SELECT m.targetUserId as id, m.userId as ownerId,m.targetUserId,max(m.date) as latestMessage,(TIME_TO_SEC(TIMEDIFF(NOW(),max(date))) / 60) as minutes';
     parent::Stack($POD, 'threads', $conditions, $sort, $count, $offset, $tables, $select);
     return $this;
 }
开发者ID:RichieDupes,项目名称:PeoplePods,代码行数:25,代码来源:Messages.php


示例5: action_admin_header

    function action_admin_header()
    {
        $url = URL::get('auth_ajax', 'context=extendedlog');
        $script = <<<SCRIPT
\$(function(){
\tvar initi = itemManage.initItems;
\titemManage.initItems = function(){
\t\tiniti();
\t\t\$('.page-logs .manage .item .less,.page-logs .manage .item .message.minor').hide();
\t\t\$('.page-logs .manage .item .more').show().css({clear: 'both', marginLeft: '40px', fontWeight: 'bold', width: '100%'});
\t\t\$('.page-logs .manage .item').click(function(){
\t\t\t\$('.extendedlog').remove();
\t\t\t\$(this).after('<div class="extendedlog"><div class="textarea" style="white-space:pre;font-family:consolas,courier new,monospace;border:1px solid #999;padding:20px;margin:20px 0px;height:100px;overflow-y:auto;">Loading...</div></div>');
\t\t\t\$('.extendedlog .textarea').resizeable();
\t\t\t\$.post(
\t\t\t\t'{$url}',
\t\t\t\t{
\t\t\t\t\tlog_id: \$('.checkbox input', \$(this)).attr('id').match(/\\[([0-9]+)\\]/)[1]
\t\t\t\t},
\t\t\t\tfunction(result){
\t\t\t\t\t\$('.extendedlog .textarea').html(result)
\t\t\t\t}
\t\t\t);
\t\t});
\t}
});
SCRIPT;
        Stack::add('admin_header_javascript', $script, 'extendedlog', array('jquery', 'admin'));
    }
开发者ID:habari-extras,项目名称:extendedlog,代码行数:29,代码来源:extendedlog.plugin.php


示例6: get_dashboard

 /**
  * Handles get requests for the dashboard
  * @todo update check should probably be cron'd and cached, not re-checked every load
  */
 public function get_dashboard()
 {
     // Not sure how best to determine this yet, maybe set an option on install, maybe do this:
     $firstpostdate = DB::get_value('SELECT min(pubdate) FROM {posts} WHERE status = ?', array(Post::status('published')));
     if ($firstpostdate) {
         $this->theme->active_time = DateTime::create($firstpostdate);
     }
     // check to see if we have updates to display
     $this->theme->updates = Options::get('updates_available', array());
     // collect all the stats we display on the dashboard
     $user = User::identify();
     $this->theme->stats = array('author_count' => Users::get(array('count' => 1)), 'post_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('any'), 'status' => Post::status('published'))), 'comment_count' => Comments::count_total('approved', false), 'tag_count' => Tags::vocabulary()->count_total(), 'user_draft_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('any'), 'status' => Post::status('draft'), 'user_id' => $user->id)), 'unapproved_comment_count' => User::identify()->can('manage_all_comments') ? Comments::count_total('unapproved', false) : Comments::count_by_author(User::identify()->id, Comment::status('unapproved')), 'spam_comment_count' => $user->can('manage_all_comments') ? Comments::count_total('spam', false) : Comments::count_by_author($user->id, Comment::status('spam')), 'user_scheduled_count' => Posts::get(array('count' => 1, 'content_type' => Post::type('any'), 'status' => Post::status('scheduled'), 'user_id' => $user->id)));
     // check for first run
     $u = User::identify();
     $uinfo = $u->info;
     if (!isset($uinfo->experience_level)) {
         $this->theme->first_run = true;
         $u->info->experience_level = 'user';
         $u->info->commit();
     } else {
         $this->theme->first_run = false;
     }
     $this->get_additem_form();
     Stack::add('admin_header_javascript', 'dashboard-js');
     $this->display('dashboard');
 }
开发者ID:habari,项目名称:system,代码行数:30,代码来源:admindashboardhandler.php


示例7: action_admin_header

 /**
  * Add appropriate CSS to this plugin's configuration form
  */
 public function action_admin_header($theme)
 {
     $vars = Controller::get_handler_vars();
     if ($theme->admin_page == 'plugins' && isset($vars['configure']) && $vars['configure'] === $this->plugin_id) {
         Stack::add('admin_stylesheet', array($this->get_url() . '/metaseo.css', 'screen'));
     }
 }
开发者ID:habari-extras,项目名称:metaseo,代码行数:10,代码来源:metaseo.plugin.php


示例8: call

 public static function call($hook, $args = null)
 {
     // Run all registered functions of called hookpoint
     $functions = Stack::get("hook:" . $hook);
     foreach ($functions as $function) {
         if (is_array($function)) {
             if (is_string($function[0]) && class_exists($function[0])) {
                 $instance = new $function[0]();
             } else {
                 $instance = $function[0];
             }
             if (method_exists($instance, $function[1])) {
                 $args = $instance->{$function}[1]($args);
             } else {
                 throw new Exception("Hooked method '{$function[1]}' of class '{$function[0]}' for hookpoint '{$hook}' not found!");
             }
         } else {
             if (function_exists($function)) {
                 $args = $function($args);
             } else {
                 throw new Exception("Hooked function '{$function}' for hookpoint '{$hook}' not found!");
             }
         }
     }
     // Return possibly modified arguments
     return $args;
 }
开发者ID:julianburr,项目名称:project-nutmouse,代码行数:27,代码来源:HookPoint.php


示例9: view_details

	public function view_details($cID, $msg = false) {
		$s = Stack::getByID($cID);
		if (is_object($s)) {
			$blocks = $s->getBlocks('Main');
			$view = View::getInstance();
			foreach($blocks as $b1) {
				$btc = $b1->getInstance();
				// now we inject any custom template CSS and JavaScript into the header
				if('Controller' != get_class($btc)){
					$btc->outputAutoHeaderItems();
				}
				$btc->runTask('on_page_view', array($view));
			}
			$this->addHeaderItem('<style type="text/css">' . $s->outputCustomStyleHeaderItems(true) . '</style>');

			$this->set('stack', $s);
			$this->set('blocks', $blocks);
			switch($msg) {
				case 'delete_saved':
					$this->set('message', t('Delete request saved. You must complete the delete workflow before this stack can be deleted.'));
					break;
			
			}
		} else {
			throw new Exception(t('Invalid stack'));
		}
	}
开发者ID:ronlobo,项目名称:concrete5,代码行数:27,代码来源:stacks.php


示例10: OutputException

 public function OutputException()
 {
     echo '<h1>Error.</h1>';
     echo '<p>Stack Trace</p>';
     // Show base
     $msg = sprintf(err_exception, __CLASS__, $this->code, "<i>" . $this->message . '</i> attempting to run process ' . Stack::Top());
     $basearray = array('class' => __CLASS__, 'code' => $this->code, 'message' => $this->message, 'file' => $this->file, 'line' => $this->line);
     self::Render('Error Base', $msg, $basearray);
     // Show codelines
     $codelines = self::GetCodeLines(5);
     self::Render('Source', 'From ' . $this->file . ' around line ' . $this->line, implode($codelines, ''));
     // Show backtrace
     $trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT);
     if (count($trace) > 1) {
         unset($trace[0]);
     }
     self::Render('Backtrace', null, $trace);
     // Show stack
     $stack = array();
     for ($i = 0; $i < Stack::Count(); $i++) {
         $stack[$i] = Stack::Get($i);
     }
     $msg = 'Stack pointer at position #' . Stack::Pointer() . ' (' . Stack::Top() . ')';
     self::Render('Stack', $msg, $stack);
     // Show requests
     self::Render('Requests', null, $_REQUEST);
 }
开发者ID:xcelaio,项目名称:xcela,代码行数:27,代码来源:exceptions.php


示例11: on_page_view

 public function on_page_view()
 {
     $stack = Stack::getByID($this->stID);
     if (!is_object($stack)) {
         return false;
     }
     $p = new Permissions($stack);
     if ($p->canViewPage()) {
         $blocks = $stack->getBlocks();
         foreach ($blocks as $b) {
             $bp = new Permissions($b);
             if ($bp->canViewBlock()) {
                 $btc = $b->getInstance();
                 if ('Controller' != get_class($btc)) {
                     $btc->outputAutoHeaderItems();
                 }
                 $csr = $b->getBlockCustomStyleRule();
                 if (is_object($csr)) {
                     $styleHeader = '#' . $csr->getCustomStyleRuleCSSID(1) . ' {' . $csr->getCustomStyleRuleText() . "} \r\n";
                     $btc->addHeaderItem("<style type=\"text/css\"> \r\n" . $styleHeader . '</style>', 'VIEW');
                 }
                 $btc->runTask('on_page_view', array($view));
             }
         }
     }
 }
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:26,代码来源:core_stack_display.php


示例12: __construct

 public function __construct()
 {
     // Enforce time limit, ignore aborts
     set_time_limit(2);
     ignore_user_abort();
     // Load constants
     require_once 'system/core/constants.php';
     // Set error reporting (debuging mode)
     if (debug) {
         error_reporting(E_ALL ^ E_DEPRECATED);
     }
     // Load security
     require_once 'system/core/security.php';
     // Load dependencies
     require_once 'system/core/dependencies.php';
     // Session handling
     date_default_timezone_set(local_timezone);
     session_start();
     // Initialize the stack (stack routing)
     Stack::Push((isset($_REQUEST[route_key]) and trim($_REQUEST[route_key]) != '') ? $_REQUEST[route_key] : route_home);
     // Initialize buffering
     ob_start();
     // Cycle the processes stack, run all the processors sucessively until the stack is empty.
     while (Stack::Ahead() > 0) {
         // Pre-init / re-init 'found' flag (in case the stack had multiple items)
         $found = false;
         // Catch anything that might happen
         try {
             foreach (route_repos as $rep => $types) {
                 if (!is_array($types)) {
                     $types = array($types);
                 }
                 foreach ($types as $t) {
                     $p = $rep . Stack::Top() . $t;
                     if (is_file($p)) {
                         $found = true;
                         // Update the output sequencer
                         Output::Path(Stack::Path());
                         if (!(include $p)) {
                             throw new SystemException(sprintf(err_include500, Stack::Top()));
                         }
                         break 2;
                     }
                 }
             }
             if (!$found) {
                 throw new SystemException(sprintf(err_include404, Stack::Top()));
             }
             // Processor completed; pop the stack
             Stack::Pop();
         } catch (Exception $e) {
             throw new SystemException($e);
         }
     }
     $this->buffer = ob_get_contents();
     ob_end_clean();
     // Pass the buffer to the output handler for final render
     Output::Flush($this->buffer);
     exit(1);
 }
开发者ID:xcelaio,项目名称:xcela,代码行数:60,代码来源:core.php


示例13: GetInstance

 /**
  * @return Stack
  */
 public static function GetInstance()
 {
     if (!self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
开发者ID:rocknoon,项目名称:Stack,代码行数:10,代码来源:Stack.php


示例14: filter_theme_call_header

 public function filter_theme_call_header($return, $theme)
 {
     if (User::identify() != FALSE) {
         Stack::add('template_header_javascript', Site::get_url('scripts') . '/jquery.js', 'jquery');
     }
     return $return;
 }
开发者ID:habari-extras,项目名称:georgia,代码行数:7,代码来源:theme.php


示例15: test_stack_order

	function test_stack_order()
	{
		Stack::add( 'test_stack', 'a', 'a' );
		Stack::add( 'test_stack', 'b after(a)', 'b', 'a' );
		$sorted = Stack::get_sorted_stack('test_stack');
		$this->assert_equal( implode(', ', $sorted), 'a, b after(a)' );

		Stack::add( 'test_stack', 'c after(b,d,f)', 'c', array('b','d','f') );
		$sorted = Stack::get_sorted_stack('test_stack');
		$this->assert_equal( implode(', ', $sorted), 'a, b after(a), c after(b,d,f)' );

		Stack::add( 'test_stack', 'd after(b)', 'd', 'b' );
		$sorted = Stack::get_sorted_stack('test_stack');
		$this->assert_equal( implode(', ', $sorted), 'a, b after(a), d after(b), c after(b,d,f)' );

		Stack::add( 'test_stack', 'e after(b)', 'e', 'b' );
		$sorted = Stack::get_sorted_stack('test_stack');
		$this->assert_equal( implode(', ', $sorted), 'a, b after(a), d after(b), c after(b,d,f), e after(b)' );

		Stack::add( 'test_stack', 'f after(b)', 'f', 'b' );
		$sorted = Stack::get_sorted_stack('test_stack');
		$this->assert_equal( implode(', ', $sorted), 'a, b after(a), d after(b), f after(b), e after(b), c after(b,d,f)' );

		Stack::add( 'test_stack', 'g after(e)', 'g', 'e');
		$sorted = Stack::get_sorted_stack('test_stack');
		$this->output(implode(', ', $sorted));
		$this->assert_equal( implode(', ', $sorted), 'a, b after(a), d after(b), f after(b), c after(b,d,f), e after(b), g after(e)' );
	}
开发者ID:rynodivino,项目名称:tests,代码行数:28,代码来源:test_stack.php


示例16: expression

 public function expression($str)
 {
     $input = new Stack();
     $output = new Stack();
     foreach ($this->tokenizer->tokenize($str) as $token) {
         $part = Dictionary::fromString($token);
         $part->isOperator() ? $input->push($part) : $output->push($part);
     }
     while ($operator = $input->pop()) {
         $output->push($operator);
     }
     // Ran out of time, this'll only work with addition
     $op = $output->pop();
     $val = $op->operate($output);
     return $val;
 }
开发者ID:aaronmu,项目名称:calculator,代码行数:16,代码来源:Math.php


示例17: setPermissionObject

 public function setPermissionObject(Area $a)
 {
     $ax = $a;
     if ($a->isGlobalArea()) {
         $cx = Stack::getByName($a->getAreaHandle());
         $a = Area::get($cx, STACKS_AREA_NAME);
     }
     $this->permissionObject = $a;
     // if the area overrides the collection permissions explicitly (with a one on the override column) we check
     if ($a->overrideCollectionPermissions()) {
         $this->permissionObjectToCheck = $a;
     } else {
         if ($a->getAreaCollectionInheritID() > 0) {
             // in theory we're supposed to be inheriting some permissions from an area with the same handle,
             // set on the collection id specified above (inheritid). however, if someone's come along and
             // reverted that area to the page's permissions, there won't be any permissions, and we
             // won't see anything. so we have to check
             $areac = Page::getByID($a->getAreaCollectionInheritID());
             $inheritArea = Area::get($areac, $a->getAreaHandlE());
             if (is_object($inheritArea) && $inheritArea->overrideCollectionPermissions()) {
                 // okay, so that area is still around, still has set permissions on it. So we
                 // pass our current area to our grouplist, userinfolist objects, knowing that they will
                 // smartly inherit the correct items.
                 $this->permissionObjectToCheck = $inheritArea;
             }
         }
         if (!$this->permissionObjectToCheck) {
             $this->permissionObjectToCheck = $a->getAreaCollectionObject();
         }
     }
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:31,代码来源:area.php


示例18: action_admin_header

	/**
	 * Actually add the required javascript to the publish page
	 * @param Theme $theme The admin theme instance
	 **/
	public function action_admin_header($theme)
	{
		if( $theme->page == 'publish' ) {
			Stack::add( 'admin_header_javascript', 'multicomplete' );
			Stack::add( 'admin_header_javascript', 'tags_auto' );
		}
	}
开发者ID:rick-c,项目名称:TagsAutocomplete,代码行数:11,代码来源:tagautocomplete.plugin.php


示例19: __construct

 public function __construct()
 {
     parent::__construct();
     $request = $this->request;
     $arHandle = $request->query->get('arHandle');
     $bID = $request->query->get('bID');
     $a = \Area::get($this->page, $arHandle);
     if (!is_object($a)) {
         throw new \Exception('Invalid Area');
     }
     $this->area = $a;
     if (!$a->isGlobalArea()) {
         $b = \Block::getByID($bID, $this->page, $a);
         $this->set('isGlobalArea', false);
     } else {
         $stack = \Stack::getByName($arHandle);
         $sc = ConcretePage::getByID($stack->getCollectionID(), 'RECENT');
         $b = \Block::getByID($bID, $sc, STACKS_AREA_NAME);
         $b->setBlockAreaObject($a);
         // set the original area object
         $this->set('isGlobalArea', true);
     }
     $this->block = $b;
     $this->permissions = new \Permissions($b);
     $this->set('bp', $this->permissions);
     $this->set('b', $b);
 }
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:27,代码来源:block.php


示例20: action_init_theme_any

 /**
  * Add the tracking code to the template_header_javascript Stack.
  *
  * @todo determine if there is a better action to use
  * @return null
  */
 public function action_init_theme_any($theme)
 {
     $code = $this->tracking_code();
     if ($code != null) {
         Stack::add('template_header_javascript', $code, 'googleanalytics');
     }
 }
开发者ID:habari-extras,项目名称:googleanalytics,代码行数:13,代码来源:googleanalytics.plugin.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Staff类代码示例发布时间:2022-05-23
下一篇:
PHP SquidUpdate类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap