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


PHP Stack::get方法代码示例

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


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

示例1: 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

示例2: run

 public function run()
 {
     // Run action of current instance
     $functions = Stack::get("action:" . $this->name);
     if (is_array($functions)) {
         $response = array();
         foreach ($functions as $function) {
             if (is_array($function)) {
                 $instance = null;
                 if (is_object($function[0])) {
                     $instance = $function[0];
                 } elseif (is_string($function[0]) && class_exists($function[0])) {
                     $instance = new $function[0]();
                 }
                 if (is_object($instance)) {
                     if (method_exists($instance, $function[1])) {
                         $response[] = $instance->{$function}[1]($this->args);
                     } else {
                         throw new Exception("Method '{$function[1]}' of object '{$function[0]}' for action '{$this->name}' not found!");
                     }
                 } else {
                     throw new Exception("Object for action '{$this->name}' not found!");
                 }
             } else {
                 if (function_exists($function)) {
                     $response[] = $function($this->args);
                 } else {
                     throw new Exception("Function '{$function}' for action '{$this->name}' not found!");
                 }
             }
         }
     } else {
         throw new Exception("Action '{$this->name}' not found in register!");
     }
     return $response;
 }
开发者ID:julianburr,项目名称:project-nutmouse,代码行数:36,代码来源:Action.php

示例3: theme_header

 public function theme_header()
 {
     $link = '<link rel="stylesheet" type="text/css" href="' . Site::get_url('theme', true) . '%s" media="%s" title="%s">';
     $output = Stack::get('template_stylesheet_with_title', $link . "\r\n");
     return $output;
 }
开发者ID:habari-extras,项目名称:styleswitcher,代码行数:6,代码来源:styleswitcher.plugin.php

示例4: theme_footer

 /**
  * Aggregates and echos the additional footer code by combining Plugins and Stack calls.
  */
 public function theme_footer($theme)
 {
     Plugins::act('template_footer', $theme);
     Stack::dependent('template_footer_javascript', 'template_header_javascript');
     Stack::dependent('template_footer_stylesheet', 'template_stylesheet');
     $output = Stack::get('template_footer_stylesheet', Method::create('\\Habari\\Stack', 'styles'));
     $output .= Stack::get('template_footer_javascript', Method::create('\\Habari\\Stack', 'scripts'));
     return $output;
 }
开发者ID:habari,项目名称:system,代码行数:12,代码来源:theme.php

示例5: theme_footer

	/**
	 * Aggregates and echos the additional footer code by combining Plugins and Stack calls.
	 */
	public function theme_footer( $theme )
	{
		Plugins::act( 'template_footer', $theme );
		$output = Stack::get( 'template_footer_stylesheet', array( 'Stack', 'styles' ) );
		$output .= Stack::get( 'template_footer_javascript', array( 'Stack', 'scripts' ) );
		return $output;
	}
开发者ID:rynodivino,项目名称:system,代码行数:10,代码来源:theme.php

示例6: getScripts

 public function getScripts($type, $env = "frontend")
 {
     // Get stacked scripts of requested type
     $scripts = Stack::get("scripts:" . $type);
     $included = array();
     $output = "";
     foreach ($scripts as $script) {
         if (isset($script['exclude']) && isset($script['exclude']['frontend'][$env]) && $script['exclude'][$env] || !isset($script['filepath']) || isset($script['id']) && in_array($script['id'], $included)) {
             continue;
         }
         // If set, save id as included to prevent multiple inclusion of the same file
         if (isset($script['id'])) {
             $included[] = $script['id'];
         }
         switch ($type) {
             case "js":
                 $output .= "/t<script src='" . $script['filepath'] . "'></script>/n";
                 break;
             case "css":
                 $output .= "/t<link rel='stylesheet' href='" . $script['filepath'] . "'>\n";
                 break;
         }
     }
     return $output;
 }
开发者ID:julianburr,项目名称:project-nutmouse,代码行数:25,代码来源:View.php


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