├── .gitignore ├── LICENSE ├── README.md ├── ansible-callbacks ├── .gitignore ├── ansible-logger.conf.dist └── logger.py ├── ansible-logger-web ├── .gitignore ├── config │ └── config.inc.php.dist ├── includes │ ├── Slim │ │ ├── Environment.php │ │ ├── Exception │ │ │ ├── Pass.php │ │ │ └── Stop.php │ │ ├── Helper │ │ │ └── Set.php │ │ ├── Http │ │ │ ├── Cookies.php │ │ │ ├── Headers.php │ │ │ ├── Request.php │ │ │ ├── Response.php │ │ │ └── Util.php │ │ ├── Log.php │ │ ├── LogWriter.php │ │ ├── Middleware.php │ │ ├── Middleware │ │ │ ├── ContentTypes.php │ │ │ ├── Flash.php │ │ │ ├── MethodOverride.php │ │ │ ├── PrettyExceptions.php │ │ │ └── SessionCookie.php │ │ ├── Route.php │ │ ├── Router.php │ │ ├── Slim.php │ │ ├── View.php │ │ └── Views │ │ │ ├── Twig.php │ │ │ └── TwigExtension.php │ ├── Twig │ │ ├── Autoloader.php │ │ ├── Compiler.php │ │ ├── CompilerInterface.php │ │ ├── Environment.php │ │ ├── Error.php │ │ ├── Error │ │ │ ├── Loader.php │ │ │ ├── Runtime.php │ │ │ └── Syntax.php │ │ ├── ExistsLoaderInterface.php │ │ ├── ExpressionParser.php │ │ ├── Extension.php │ │ ├── Extension │ │ │ ├── Core.php │ │ │ ├── Debug.php │ │ │ ├── Escaper.php │ │ │ ├── Optimizer.php │ │ │ ├── Profiler.php │ │ │ ├── Sandbox.php │ │ │ ├── Staging.php │ │ │ └── StringLoader.php │ │ ├── ExtensionInterface.php │ │ ├── FileExtensionEscapingStrategy.php │ │ ├── Filter.php │ │ ├── Filter │ │ │ ├── Function.php │ │ │ ├── Method.php │ │ │ └── Node.php │ │ ├── FilterCallableInterface.php │ │ ├── FilterInterface.php │ │ ├── Function.php │ │ ├── Function │ │ │ ├── Function.php │ │ │ ├── Method.php │ │ │ └── Node.php │ │ ├── FunctionCallableInterface.php │ │ ├── FunctionInterface.php │ │ ├── Lexer.php │ │ ├── LexerInterface.php │ │ ├── Loader │ │ │ ├── Array.php │ │ │ ├── Chain.php │ │ │ ├── Filesystem.php │ │ │ └── String.php │ │ ├── LoaderInterface.php │ │ ├── Markup.php │ │ ├── Node.php │ │ ├── Node │ │ │ ├── AutoEscape.php │ │ │ ├── Block.php │ │ │ ├── BlockReference.php │ │ │ ├── Body.php │ │ │ ├── CheckSecurity.php │ │ │ ├── Do.php │ │ │ ├── Embed.php │ │ │ ├── Expression.php │ │ │ ├── Expression │ │ │ │ ├── Array.php │ │ │ │ ├── AssignName.php │ │ │ │ ├── Binary.php │ │ │ │ ├── Binary │ │ │ │ │ ├── Add.php │ │ │ │ │ ├── And.php │ │ │ │ │ ├── BitwiseAnd.php │ │ │ │ │ ├── BitwiseOr.php │ │ │ │ │ ├── BitwiseXor.php │ │ │ │ │ ├── Concat.php │ │ │ │ │ ├── Div.php │ │ │ │ │ ├── EndsWith.php │ │ │ │ │ ├── Equal.php │ │ │ │ │ ├── FloorDiv.php │ │ │ │ │ ├── Greater.php │ │ │ │ │ ├── GreaterEqual.php │ │ │ │ │ ├── In.php │ │ │ │ │ ├── Less.php │ │ │ │ │ ├── LessEqual.php │ │ │ │ │ ├── Matches.php │ │ │ │ │ ├── Mod.php │ │ │ │ │ ├── Mul.php │ │ │ │ │ ├── NotEqual.php │ │ │ │ │ ├── NotIn.php │ │ │ │ │ ├── Or.php │ │ │ │ │ ├── Power.php │ │ │ │ │ ├── Range.php │ │ │ │ │ ├── StartsWith.php │ │ │ │ │ └── Sub.php │ │ │ │ ├── BlockReference.php │ │ │ │ ├── Call.php │ │ │ │ ├── Conditional.php │ │ │ │ ├── Constant.php │ │ │ │ ├── ExtensionReference.php │ │ │ │ ├── Filter.php │ │ │ │ ├── Filter │ │ │ │ │ └── Default.php │ │ │ │ ├── Function.php │ │ │ │ ├── GetAttr.php │ │ │ │ ├── MethodCall.php │ │ │ │ ├── Name.php │ │ │ │ ├── Parent.php │ │ │ │ ├── TempName.php │ │ │ │ ├── Test.php │ │ │ │ ├── Test │ │ │ │ │ ├── Constant.php │ │ │ │ │ ├── Defined.php │ │ │ │ │ ├── Divisibleby.php │ │ │ │ │ ├── Even.php │ │ │ │ │ ├── Null.php │ │ │ │ │ ├── Odd.php │ │ │ │ │ └── Sameas.php │ │ │ │ ├── Unary.php │ │ │ │ └── Unary │ │ │ │ │ ├── Neg.php │ │ │ │ │ ├── Not.php │ │ │ │ │ └── Pos.php │ │ │ ├── Flush.php │ │ │ ├── For.php │ │ │ ├── ForLoop.php │ │ │ ├── If.php │ │ │ ├── Import.php │ │ │ ├── Include.php │ │ │ ├── Macro.php │ │ │ ├── Module.php │ │ │ ├── Print.php │ │ │ ├── Sandbox.php │ │ │ ├── SandboxedPrint.php │ │ │ ├── Set.php │ │ │ ├── SetTemp.php │ │ │ ├── Spaceless.php │ │ │ └── Text.php │ │ ├── NodeInterface.php │ │ ├── NodeOutputInterface.php │ │ ├── NodeTraverser.php │ │ ├── NodeVisitor │ │ │ ├── Escaper.php │ │ │ ├── Optimizer.php │ │ │ ├── SafeAnalysis.php │ │ │ └── Sandbox.php │ │ ├── NodeVisitorInterface.php │ │ ├── Parser.php │ │ ├── ParserInterface.php │ │ ├── Profiler │ │ │ ├── Dumper │ │ │ │ ├── Blackfire.php │ │ │ │ ├── Html.php │ │ │ │ └── Text.php │ │ │ ├── Node │ │ │ │ ├── EnterProfile.php │ │ │ │ └── LeaveProfile.php │ │ │ ├── NodeVisitor │ │ │ │ └── Profiler.php │ │ │ └── Profile.php │ │ ├── Sandbox │ │ │ ├── SecurityError.php │ │ │ ├── SecurityNotAllowedFilterError.php │ │ │ ├── SecurityNotAllowedFunctionError.php │ │ │ ├── SecurityNotAllowedTagError.php │ │ │ ├── SecurityPolicy.php │ │ │ └── SecurityPolicyInterface.php │ │ ├── SimpleFilter.php │ │ ├── SimpleFunction.php │ │ ├── SimpleTest.php │ │ ├── Template.php │ │ ├── TemplateInterface.php │ │ ├── Test.php │ │ ├── Test │ │ │ ├── Function.php │ │ │ ├── IntegrationTestCase.php │ │ │ ├── Method.php │ │ │ ├── Node.php │ │ │ └── NodeTestCase.php │ │ ├── TestCallableInterface.php │ │ ├── TestInterface.php │ │ ├── Token.php │ │ ├── TokenParser.php │ │ ├── TokenParser │ │ │ ├── AutoEscape.php │ │ │ ├── Block.php │ │ │ ├── Do.php │ │ │ ├── Embed.php │ │ │ ├── Extends.php │ │ │ ├── Filter.php │ │ │ ├── Flush.php │ │ │ ├── For.php │ │ │ ├── From.php │ │ │ ├── If.php │ │ │ ├── Import.php │ │ │ ├── Include.php │ │ │ ├── Macro.php │ │ │ ├── Sandbox.php │ │ │ ├── Set.php │ │ │ ├── Spaceless.php │ │ │ └── Use.php │ │ ├── TokenParserBroker.php │ │ ├── TokenParserBrokerInterface.php │ │ ├── TokenParserInterface.php │ │ └── TokenStream.php │ └── ansible-logger.php ├── public │ ├── .htaccess │ ├── index.php │ └── static │ │ ├── css │ │ ├── ansible-logger.css │ │ ├── bootstrap-theme.css │ │ ├── bootstrap-theme.css.map │ │ ├── bootstrap-theme.min.css │ │ ├── bootstrap.css │ │ ├── bootstrap.css.map │ │ ├── bootstrap.min.css │ │ └── dashboard.css │ │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 │ │ └── js │ │ ├── bootstrap.js │ │ ├── bootstrap.min.js │ │ ├── bootstrap3-typeahead.js │ │ ├── ie10-viewport-bug-workaround.js │ │ └── npm.js └── tpl │ ├── index.html │ ├── page_dashboard.html │ ├── page_factbrowser.html │ ├── page_hostfactview.html │ ├── page_hostplayhistory.html │ ├── page_hosts.html │ └── page_playbookdetails.html ├── helpers └── dbprep │ ├── README.md │ ├── dbprep.py │ ├── facts │ ├── debian_wheezy │ ├── ubuntu_trusty_1 │ └── ubuntu_trusty_2 │ ├── hostnames │ ├── hostpatterns │ ├── playbooks │ └── tasks └── sql └── schema.sql /.gitignore: -------------------------------------------------------------------------------- 1 | venv/ 2 | .idea -------------------------------------------------------------------------------- /ansible-callbacks/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.conf 3 | -------------------------------------------------------------------------------- /ansible-callbacks/ansible-logger.conf.dist: -------------------------------------------------------------------------------- 1 | [database] 2 | host = localhost 3 | user = someuser 4 | password = somepassword 5 | db = somedatabase 6 | 7 | [log-settings] 8 | logging = false 9 | loglevel = debug 10 | logpath = /tmp/ 11 | 12 | -------------------------------------------------------------------------------- /ansible-logger-web/.gitignore: -------------------------------------------------------------------------------- 1 | config/*.php 2 | -------------------------------------------------------------------------------- /ansible-logger-web/config/config.inc.php.dist: -------------------------------------------------------------------------------- 1 | 14 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Slim/Exception/Pass.php: -------------------------------------------------------------------------------- 1 | 6 | * @copyright 2011 Josh Lockhart 7 | * @link http://www.slimframework.com 8 | * @license http://www.slimframework.com/license 9 | * @version 2.6.1 10 | * @package Slim 11 | * 12 | * MIT LICENSE 13 | * 14 | * Permission is hereby granted, free of charge, to any person obtaining 15 | * a copy of this software and associated documentation files (the 16 | * "Software"), to deal in the Software without restriction, including 17 | * without limitation the rights to use, copy, modify, merge, publish, 18 | * distribute, sublicense, and/or sell copies of the Software, and to 19 | * permit persons to whom the Software is furnished to do so, subject to 20 | * the following conditions: 21 | * 22 | * The above copyright notice and this permission notice shall be 23 | * included in all copies or substantial portions of the Software. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 29 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 30 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 31 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 32 | */ 33 | namespace Slim\Exception; 34 | 35 | /** 36 | * Pass Exception 37 | * 38 | * This Exception will cause the Router::dispatch method 39 | * to skip the current matching route and continue to the next 40 | * matching route. If no subsequent routes are found, a 41 | * HTTP 404 Not Found response will be sent to the client. 42 | * 43 | * @package Slim 44 | * @author Josh Lockhart 45 | * @since 1.0.0 46 | */ 47 | class Pass extends \Exception 48 | { 49 | } 50 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Slim/Exception/Stop.php: -------------------------------------------------------------------------------- 1 | 6 | * @copyright 2011 Josh Lockhart 7 | * @link http://www.slimframework.com 8 | * @license http://www.slimframework.com/license 9 | * @version 2.6.1 10 | * @package Slim 11 | * 12 | * MIT LICENSE 13 | * 14 | * Permission is hereby granted, free of charge, to any person obtaining 15 | * a copy of this software and associated documentation files (the 16 | * "Software"), to deal in the Software without restriction, including 17 | * without limitation the rights to use, copy, modify, merge, publish, 18 | * distribute, sublicense, and/or sell copies of the Software, and to 19 | * permit persons to whom the Software is furnished to do so, subject to 20 | * the following conditions: 21 | * 22 | * The above copyright notice and this permission notice shall be 23 | * included in all copies or substantial portions of the Software. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 29 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 30 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 31 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 32 | */ 33 | namespace Slim\Exception; 34 | 35 | /** 36 | * Stop Exception 37 | * 38 | * This Exception is thrown when the Slim application needs to abort 39 | * processing and return control flow to the outer PHP script. 40 | * 41 | * @package Slim 42 | * @author Josh Lockhart 43 | * @since 1.0.0 44 | */ 45 | class Stop extends \Exception 46 | { 47 | } 48 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Slim/LogWriter.php: -------------------------------------------------------------------------------- 1 | 6 | * @copyright 2011 Josh Lockhart 7 | * @link http://www.slimframework.com 8 | * @license http://www.slimframework.com/license 9 | * @version 2.6.1 10 | * @package Slim 11 | * 12 | * MIT LICENSE 13 | * 14 | * Permission is hereby granted, free of charge, to any person obtaining 15 | * a copy of this software and associated documentation files (the 16 | * "Software"), to deal in the Software without restriction, including 17 | * without limitation the rights to use, copy, modify, merge, publish, 18 | * distribute, sublicense, and/or sell copies of the Software, and to 19 | * permit persons to whom the Software is furnished to do so, subject to 20 | * the following conditions: 21 | * 22 | * The above copyright notice and this permission notice shall be 23 | * included in all copies or substantial portions of the Software. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 29 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 30 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 31 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 32 | */ 33 | namespace Slim; 34 | 35 | /** 36 | * Log Writer 37 | * 38 | * This class is used by Slim_Log to write log messages to a valid, writable 39 | * resource handle (e.g. a file or STDERR). 40 | * 41 | * @package Slim 42 | * @author Josh Lockhart 43 | * @since 1.6.0 44 | */ 45 | class LogWriter 46 | { 47 | /** 48 | * @var resource 49 | */ 50 | protected $resource; 51 | 52 | /** 53 | * Constructor 54 | * @param resource $resource 55 | * @throws \InvalidArgumentException If invalid resource 56 | */ 57 | public function __construct($resource) 58 | { 59 | if (!is_resource($resource)) { 60 | throw new \InvalidArgumentException('Cannot create LogWriter. Invalid resource handle.'); 61 | } 62 | $this->resource = $resource; 63 | } 64 | 65 | /** 66 | * Write message 67 | * @param mixed $message 68 | * @param int $level 69 | * @return int|bool 70 | */ 71 | public function write($message, $level = null) 72 | { 73 | return fwrite($this->resource, (string) $message . PHP_EOL); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Autoloader.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Autoloader 18 | { 19 | /** 20 | * Registers Twig_Autoloader as an SPL autoloader. 21 | * 22 | * @param bool $prepend Whether to prepend the autoloader or not. 23 | */ 24 | public static function register($prepend = false) 25 | { 26 | if (PHP_VERSION_ID < 50300) { 27 | spl_autoload_register(array(__CLASS__, 'autoload')); 28 | } else { 29 | spl_autoload_register(array(__CLASS__, 'autoload'), true, $prepend); 30 | } 31 | } 32 | 33 | /** 34 | * Handles autoloading of classes. 35 | * 36 | * @param string $class A class name. 37 | */ 38 | public static function autoload($class) 39 | { 40 | if (0 !== strpos($class, 'Twig')) { 41 | return; 42 | } 43 | 44 | if (is_file($file = dirname(__FILE__).'/../'.str_replace(array('_', "\0"), array('/', ''), $class).'.php')) { 45 | require $file; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/CompilerInterface.php: -------------------------------------------------------------------------------- 1 | 16 | * 17 | * @deprecated since 1.12 (to be removed in 3.0) 18 | */ 19 | interface Twig_CompilerInterface 20 | { 21 | /** 22 | * Compiles a node. 23 | * 24 | * @param Twig_NodeInterface $node The node to compile 25 | * 26 | * @return Twig_CompilerInterface The current compiler instance 27 | */ 28 | public function compile(Twig_NodeInterface $node); 29 | 30 | /** 31 | * Gets the current PHP code after compilation. 32 | * 33 | * @return string The PHP code 34 | */ 35 | public function getSource(); 36 | } 37 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Error/Loader.php: -------------------------------------------------------------------------------- 1 | 24 | */ 25 | class Twig_Error_Loader extends Twig_Error 26 | { 27 | public function __construct($message, $lineno = -1, $filename = null, Exception $previous = null) 28 | { 29 | parent::__construct($message, false, false, $previous); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Error/Runtime.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | class Twig_Error_Runtime extends Twig_Error 19 | { 20 | } 21 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Error/Syntax.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | class Twig_Error_Syntax extends Twig_Error 19 | { 20 | } 21 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/ExistsLoaderInterface.php: -------------------------------------------------------------------------------- 1 | 16 | * 17 | * @deprecated since 1.12 (to be removed in 3.0) 18 | */ 19 | interface Twig_ExistsLoaderInterface 20 | { 21 | /** 22 | * Check if we have the source code of a template, given its name. 23 | * 24 | * @param string $name The name of the template to check if we can load 25 | * 26 | * @return bool If the template source code is handled by this loader or not 27 | */ 28 | public function exists($name); 29 | } 30 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Extension.php: -------------------------------------------------------------------------------- 1 | $isDumpOutputHtmlSafe ? array('html') : array(), 'needs_context' => true, 'needs_environment' => true)), 32 | ); 33 | } 34 | 35 | /** 36 | * Returns the name of the extension. 37 | * 38 | * @return string The extension name 39 | */ 40 | public function getName() 41 | { 42 | return 'debug'; 43 | } 44 | } 45 | 46 | function twig_var_dump(Twig_Environment $env, $context) 47 | { 48 | if (!$env->isDebug()) { 49 | return; 50 | } 51 | 52 | ob_start(); 53 | 54 | $count = func_num_args(); 55 | if (2 === $count) { 56 | $vars = array(); 57 | foreach ($context as $key => $value) { 58 | if (!$value instanceof Twig_Template) { 59 | $vars[$key] = $value; 60 | } 61 | } 62 | 63 | var_dump($vars); 64 | } else { 65 | for ($i = 2; $i < $count; $i++) { 66 | var_dump(func_get_arg($i)); 67 | } 68 | } 69 | 70 | return ob_get_clean(); 71 | } 72 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Extension/Optimizer.php: -------------------------------------------------------------------------------- 1 | optimizers = $optimizers; 18 | } 19 | 20 | /** 21 | * {@inheritdoc} 22 | */ 23 | public function getNodeVisitors() 24 | { 25 | return array(new Twig_NodeVisitor_Optimizer($this->optimizers)); 26 | } 27 | 28 | /** 29 | * {@inheritdoc} 30 | */ 31 | public function getName() 32 | { 33 | return 'optimizer'; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Extension/Profiler.php: -------------------------------------------------------------------------------- 1 | actives = array($profile); 19 | } 20 | 21 | public function enter(Twig_Profiler_Profile $profile) 22 | { 23 | $this->actives[0]->addProfile($profile); 24 | array_unshift($this->actives, $profile); 25 | } 26 | 27 | public function leave(Twig_Profiler_Profile $profile) 28 | { 29 | $profile->leave(); 30 | array_shift($this->actives); 31 | 32 | if (1 === count($this->actives)) { 33 | $this->actives[0]->leave(); 34 | } 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function getNodeVisitors() 41 | { 42 | return array(new Twig_Profiler_NodeVisitor_Profiler($this->getName())); 43 | } 44 | 45 | /** 46 | * {@inheritdoc} 47 | */ 48 | public function getName() 49 | { 50 | return 'profiler'; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Extension/Staging.php: -------------------------------------------------------------------------------- 1 | 18 | */ 19 | class Twig_Extension_Staging extends Twig_Extension 20 | { 21 | protected $functions = array(); 22 | protected $filters = array(); 23 | protected $visitors = array(); 24 | protected $tokenParsers = array(); 25 | protected $globals = array(); 26 | protected $tests = array(); 27 | 28 | public function addFunction($name, $function) 29 | { 30 | $this->functions[$name] = $function; 31 | } 32 | 33 | /** 34 | * {@inheritdoc} 35 | */ 36 | public function getFunctions() 37 | { 38 | return $this->functions; 39 | } 40 | 41 | public function addFilter($name, $filter) 42 | { 43 | $this->filters[$name] = $filter; 44 | } 45 | 46 | /** 47 | * {@inheritdoc} 48 | */ 49 | public function getFilters() 50 | { 51 | return $this->filters; 52 | } 53 | 54 | public function addNodeVisitor(Twig_NodeVisitorInterface $visitor) 55 | { 56 | $this->visitors[] = $visitor; 57 | } 58 | 59 | /** 60 | * {@inheritdoc} 61 | */ 62 | public function getNodeVisitors() 63 | { 64 | return $this->visitors; 65 | } 66 | 67 | public function addTokenParser(Twig_TokenParserInterface $parser) 68 | { 69 | $this->tokenParsers[] = $parser; 70 | } 71 | 72 | /** 73 | * {@inheritdoc} 74 | */ 75 | public function getTokenParsers() 76 | { 77 | return $this->tokenParsers; 78 | } 79 | 80 | public function addGlobal($name, $value) 81 | { 82 | $this->globals[$name] = $value; 83 | } 84 | 85 | /** 86 | * {@inheritdoc} 87 | */ 88 | public function getGlobals() 89 | { 90 | return $this->globals; 91 | } 92 | 93 | public function addTest($name, $test) 94 | { 95 | $this->tests[$name] = $test; 96 | } 97 | 98 | /** 99 | * {@inheritdoc} 100 | */ 101 | public function getTests() 102 | { 103 | return $this->tests; 104 | } 105 | 106 | /** 107 | * {@inheritdoc} 108 | */ 109 | public function getName() 110 | { 111 | return 'staging'; 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Extension/StringLoader.php: -------------------------------------------------------------------------------- 1 | true)), 20 | ); 21 | } 22 | 23 | /** 24 | * {@inheritdoc} 25 | */ 26 | public function getName() 27 | { 28 | return 'string_loader'; 29 | } 30 | } 31 | 32 | /** 33 | * Loads a template from a string. 34 | * 35 | *
36 | * {{ include(template_from_string("Hello {{ name }}")) }} 37 | *38 | * 39 | * @param Twig_Environment $env A Twig_Environment instance 40 | * @param string $template A template as a string 41 | * 42 | * @return Twig_Template A Twig_Template instance 43 | */ 44 | function twig_template_from_string(Twig_Environment $env, $template) 45 | { 46 | return $env->createTemplate($template); 47 | } 48 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/ExtensionInterface.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | interface Twig_ExtensionInterface 18 | { 19 | /** 20 | * Initializes the runtime environment. 21 | * 22 | * This is where you can load some file that contains filter functions for instance. 23 | * 24 | * @param Twig_Environment $environment The current Twig_Environment instance 25 | */ 26 | public function initRuntime(Twig_Environment $environment); 27 | 28 | /** 29 | * Returns the token parser instances to add to the existing list. 30 | * 31 | * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances 32 | */ 33 | public function getTokenParsers(); 34 | 35 | /** 36 | * Returns the node visitor instances to add to the existing list. 37 | * 38 | * @return Twig_NodeVisitorInterface[] An array of Twig_NodeVisitorInterface instances 39 | */ 40 | public function getNodeVisitors(); 41 | 42 | /** 43 | * Returns a list of filters to add to the existing list. 44 | * 45 | * @return array An array of filters 46 | */ 47 | public function getFilters(); 48 | 49 | /** 50 | * Returns a list of tests to add to the existing list. 51 | * 52 | * @return array An array of tests 53 | */ 54 | public function getTests(); 55 | 56 | /** 57 | * Returns a list of functions to add to the existing list. 58 | * 59 | * @return array An array of functions 60 | */ 61 | public function getFunctions(); 62 | 63 | /** 64 | * Returns a list of operators to add to the existing list. 65 | * 66 | * @return array An array of operators 67 | */ 68 | public function getOperators(); 69 | 70 | /** 71 | * Returns a list of global variables to add to the existing list. 72 | * 73 | * @return array An array of global variables 74 | */ 75 | public function getGlobals(); 76 | 77 | /** 78 | * Returns the name of the extension. 79 | * 80 | * @return string The extension name 81 | */ 82 | public function getName(); 83 | } 84 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/FileExtensionEscapingStrategy.php: -------------------------------------------------------------------------------- 1 | 22 | */ 23 | class Twig_FileExtensionEscapingStrategy 24 | { 25 | /** 26 | * Guesses the best autoescaping strategy based on the file name. 27 | * 28 | * @param string $filename The template file name 29 | * 30 | * @return string The escaping strategy name to use 31 | */ 32 | public static function guess($filename) 33 | { 34 | if (!preg_match('{\.(js|css|txt)(?:\.[^/\\\\]+)?$}', $filename, $match)) { 35 | return 'html'; 36 | } 37 | 38 | switch ($match[1]) { 39 | case 'js': 40 | return 'js'; 41 | 42 | case 'css': 43 | return 'css'; 44 | 45 | case 'txt': 46 | return false; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Filter.php: -------------------------------------------------------------------------------- 1 | 18 | * @deprecated since 1.12 (to be removed in 2.0) 19 | */ 20 | abstract class Twig_Filter implements Twig_FilterInterface, Twig_FilterCallableInterface 21 | { 22 | protected $options; 23 | protected $arguments = array(); 24 | 25 | public function __construct(array $options = array()) 26 | { 27 | $this->options = array_merge(array( 28 | 'needs_environment' => false, 29 | 'needs_context' => false, 30 | 'pre_escape' => null, 31 | 'preserves_safety' => null, 32 | 'callable' => null, 33 | ), $options); 34 | } 35 | 36 | public function setArguments($arguments) 37 | { 38 | $this->arguments = $arguments; 39 | } 40 | 41 | public function getArguments() 42 | { 43 | return $this->arguments; 44 | } 45 | 46 | public function needsEnvironment() 47 | { 48 | return $this->options['needs_environment']; 49 | } 50 | 51 | public function needsContext() 52 | { 53 | return $this->options['needs_context']; 54 | } 55 | 56 | public function getSafe(Twig_Node $filterArgs) 57 | { 58 | if (isset($this->options['is_safe'])) { 59 | return $this->options['is_safe']; 60 | } 61 | 62 | if (isset($this->options['is_safe_callback'])) { 63 | return call_user_func($this->options['is_safe_callback'], $filterArgs); 64 | } 65 | } 66 | 67 | public function getPreservesSafety() 68 | { 69 | return $this->options['preserves_safety']; 70 | } 71 | 72 | public function getPreEscape() 73 | { 74 | return $this->options['pre_escape']; 75 | } 76 | 77 | public function getCallable() 78 | { 79 | return $this->options['callable']; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Filter/Function.php: -------------------------------------------------------------------------------- 1 | 18 | * @deprecated since 1.12 (to be removed in 2.0) 19 | */ 20 | class Twig_Filter_Function extends Twig_Filter 21 | { 22 | protected $function; 23 | 24 | public function __construct($function, array $options = array()) 25 | { 26 | $options['callable'] = $function; 27 | 28 | parent::__construct($options); 29 | 30 | $this->function = $function; 31 | } 32 | 33 | public function compile() 34 | { 35 | return $this->function; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Filter/Method.php: -------------------------------------------------------------------------------- 1 | 18 | * @deprecated since 1.12 (to be removed in 2.0) 19 | */ 20 | class Twig_Filter_Method extends Twig_Filter 21 | { 22 | protected $extension; 23 | protected $method; 24 | 25 | public function __construct(Twig_ExtensionInterface $extension, $method, array $options = array()) 26 | { 27 | $options['callable'] = array($extension, $method); 28 | 29 | parent::__construct($options); 30 | 31 | $this->extension = $extension; 32 | $this->method = $method; 33 | } 34 | 35 | public function compile() 36 | { 37 | return sprintf('$this->env->getExtension(\'%s\')->%s', $this->extension->getName(), $this->method); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Filter/Node.php: -------------------------------------------------------------------------------- 1 | 18 | * @deprecated since 1.12 (to be removed in 2.0) 19 | */ 20 | class Twig_Filter_Node extends Twig_Filter 21 | { 22 | protected $class; 23 | 24 | public function __construct($class, array $options = array()) 25 | { 26 | parent::__construct($options); 27 | 28 | $this->class = $class; 29 | } 30 | 31 | public function getClass() 32 | { 33 | return $this->class; 34 | } 35 | 36 | public function compile() 37 | { 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/FilterCallableInterface.php: -------------------------------------------------------------------------------- 1 | 18 | * @deprecated since 1.12 (to be removed in 2.0) 19 | */ 20 | interface Twig_FilterCallableInterface 21 | { 22 | public function getCallable(); 23 | } 24 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/FilterInterface.php: -------------------------------------------------------------------------------- 1 | 18 | * @deprecated since 1.12 (to be removed in 2.0) 19 | */ 20 | interface Twig_FilterInterface 21 | { 22 | /** 23 | * Compiles a filter. 24 | * 25 | * @return string The PHP code for the filter 26 | */ 27 | public function compile(); 28 | 29 | public function needsEnvironment(); 30 | 31 | public function needsContext(); 32 | 33 | public function getSafe(Twig_Node $filterArgs); 34 | 35 | public function getPreservesSafety(); 36 | 37 | public function getPreEscape(); 38 | 39 | public function setArguments($arguments); 40 | 41 | public function getArguments(); 42 | } 43 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Function.php: -------------------------------------------------------------------------------- 1 | 18 | * @deprecated since 1.12 (to be removed in 2.0) 19 | */ 20 | abstract class Twig_Function implements Twig_FunctionInterface, Twig_FunctionCallableInterface 21 | { 22 | protected $options; 23 | protected $arguments = array(); 24 | 25 | public function __construct(array $options = array()) 26 | { 27 | $this->options = array_merge(array( 28 | 'needs_environment' => false, 29 | 'needs_context' => false, 30 | 'callable' => null, 31 | ), $options); 32 | } 33 | 34 | public function setArguments($arguments) 35 | { 36 | $this->arguments = $arguments; 37 | } 38 | 39 | public function getArguments() 40 | { 41 | return $this->arguments; 42 | } 43 | 44 | public function needsEnvironment() 45 | { 46 | return $this->options['needs_environment']; 47 | } 48 | 49 | public function needsContext() 50 | { 51 | return $this->options['needs_context']; 52 | } 53 | 54 | public function getSafe(Twig_Node $functionArgs) 55 | { 56 | if (isset($this->options['is_safe'])) { 57 | return $this->options['is_safe']; 58 | } 59 | 60 | if (isset($this->options['is_safe_callback'])) { 61 | return call_user_func($this->options['is_safe_callback'], $functionArgs); 62 | } 63 | 64 | return array(); 65 | } 66 | 67 | public function getCallable() 68 | { 69 | return $this->options['callable']; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Function/Function.php: -------------------------------------------------------------------------------- 1 | 19 | * @deprecated since 1.12 (to be removed in 2.0) 20 | */ 21 | class Twig_Function_Function extends Twig_Function 22 | { 23 | protected $function; 24 | 25 | public function __construct($function, array $options = array()) 26 | { 27 | $options['callable'] = $function; 28 | 29 | parent::__construct($options); 30 | 31 | $this->function = $function; 32 | } 33 | 34 | public function compile() 35 | { 36 | return $this->function; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Function/Method.php: -------------------------------------------------------------------------------- 1 | 19 | * @deprecated since 1.12 (to be removed in 2.0) 20 | */ 21 | class Twig_Function_Method extends Twig_Function 22 | { 23 | protected $extension; 24 | protected $method; 25 | 26 | public function __construct(Twig_ExtensionInterface $extension, $method, array $options = array()) 27 | { 28 | $options['callable'] = array($extension, $method); 29 | 30 | parent::__construct($options); 31 | 32 | $this->extension = $extension; 33 | $this->method = $method; 34 | } 35 | 36 | public function compile() 37 | { 38 | return sprintf('$this->env->getExtension(\'%s\')->%s', $this->extension->getName(), $this->method); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Function/Node.php: -------------------------------------------------------------------------------- 1 | 18 | * @deprecated since 1.12 (to be removed in 2.0) 19 | */ 20 | class Twig_Function_Node extends Twig_Function 21 | { 22 | protected $class; 23 | 24 | public function __construct($class, array $options = array()) 25 | { 26 | parent::__construct($options); 27 | 28 | $this->class = $class; 29 | } 30 | 31 | public function getClass() 32 | { 33 | return $this->class; 34 | } 35 | 36 | public function compile() 37 | { 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/FunctionCallableInterface.php: -------------------------------------------------------------------------------- 1 | 18 | * @deprecated since 1.12 (to be removed in 2.0) 19 | */ 20 | interface Twig_FunctionCallableInterface 21 | { 22 | public function getCallable(); 23 | } 24 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/FunctionInterface.php: -------------------------------------------------------------------------------- 1 | 19 | * @deprecated since 1.12 (to be removed in 2.0) 20 | */ 21 | interface Twig_FunctionInterface 22 | { 23 | /** 24 | * Compiles a function. 25 | * 26 | * @return string The PHP code for the function 27 | */ 28 | public function compile(); 29 | 30 | public function needsEnvironment(); 31 | 32 | public function needsContext(); 33 | 34 | public function getSafe(Twig_Node $filterArgs); 35 | 36 | public function setArguments($arguments); 37 | 38 | public function getArguments(); 39 | } 40 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/LexerInterface.php: -------------------------------------------------------------------------------- 1 | 16 | * 17 | * @deprecated since 1.12 (to be removed in 3.0) 18 | */ 19 | interface Twig_LexerInterface 20 | { 21 | /** 22 | * Tokenizes a source code. 23 | * 24 | * @param string $code The source code 25 | * @param string $filename A unique identifier for the source code 26 | * 27 | * @return Twig_TokenStream A token stream instance 28 | * 29 | * @throws Twig_Error_Syntax When the code is syntactically wrong 30 | */ 31 | public function tokenize($code, $filename = null); 32 | } 33 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Loader/Array.php: -------------------------------------------------------------------------------- 1 | 23 | */ 24 | class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterface 25 | { 26 | protected $templates = array(); 27 | 28 | /** 29 | * Constructor. 30 | * 31 | * @param array $templates An array of templates (keys are the names, and values are the source code) 32 | * 33 | * @see Twig_Loader 34 | */ 35 | public function __construct(array $templates) 36 | { 37 | $this->templates = $templates; 38 | } 39 | 40 | /** 41 | * Adds or overrides a template. 42 | * 43 | * @param string $name The template name 44 | * @param string $template The template source 45 | */ 46 | public function setTemplate($name, $template) 47 | { 48 | $this->templates[(string) $name] = $template; 49 | } 50 | 51 | /** 52 | * {@inheritdoc} 53 | */ 54 | public function getSource($name) 55 | { 56 | $name = (string) $name; 57 | if (!isset($this->templates[$name])) { 58 | throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name)); 59 | } 60 | 61 | return $this->templates[$name]; 62 | } 63 | 64 | /** 65 | * {@inheritdoc} 66 | */ 67 | public function exists($name) 68 | { 69 | return isset($this->templates[(string) $name]); 70 | } 71 | 72 | /** 73 | * {@inheritdoc} 74 | */ 75 | public function getCacheKey($name) 76 | { 77 | $name = (string) $name; 78 | if (!isset($this->templates[$name])) { 79 | throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name)); 80 | } 81 | 82 | return $this->templates[$name]; 83 | } 84 | 85 | /** 86 | * {@inheritdoc} 87 | */ 88 | public function isFresh($name, $time) 89 | { 90 | $name = (string) $name; 91 | if (!isset($this->templates[$name])) { 92 | throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name)); 93 | } 94 | 95 | return true; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Loader/String.php: -------------------------------------------------------------------------------- 1 | 25 | */ 26 | class Twig_Loader_String implements Twig_LoaderInterface, Twig_ExistsLoaderInterface 27 | { 28 | /** 29 | * {@inheritdoc} 30 | */ 31 | public function getSource($name) 32 | { 33 | return $name; 34 | } 35 | 36 | /** 37 | * {@inheritdoc} 38 | */ 39 | public function exists($name) 40 | { 41 | return true; 42 | } 43 | 44 | /** 45 | * {@inheritdoc} 46 | */ 47 | public function getCacheKey($name) 48 | { 49 | return $name; 50 | } 51 | 52 | /** 53 | * {@inheritdoc} 54 | */ 55 | public function isFresh($name, $time) 56 | { 57 | return true; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/LoaderInterface.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | interface Twig_LoaderInterface 18 | { 19 | /** 20 | * Gets the source code of a template, given its name. 21 | * 22 | * @param string $name The name of the template to load 23 | * 24 | * @return string The template source code 25 | * 26 | * @throws Twig_Error_Loader When $name is not found 27 | */ 28 | public function getSource($name); 29 | 30 | /** 31 | * Gets the cache key to use for the cache for a given template name. 32 | * 33 | * @param string $name The name of the template to load 34 | * 35 | * @return string The cache key 36 | * 37 | * @throws Twig_Error_Loader When $name is not found 38 | */ 39 | public function getCacheKey($name); 40 | 41 | /** 42 | * Returns true if the template is still fresh. 43 | * 44 | * @param string $name The template name 45 | * @param int $time Timestamp of the last modification time of the 46 | * cached template 47 | * 48 | * @return bool true if the template is fresh, false otherwise 49 | * 50 | * @throws Twig_Error_Loader When $name is not found 51 | */ 52 | public function isFresh($name, $time); 53 | } 54 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Markup.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Markup implements Countable 18 | { 19 | protected $content; 20 | protected $charset; 21 | 22 | public function __construct($content, $charset) 23 | { 24 | $this->content = (string) $content; 25 | $this->charset = $charset; 26 | } 27 | 28 | public function __toString() 29 | { 30 | return $this->content; 31 | } 32 | 33 | public function count() 34 | { 35 | return function_exists('mb_get_info') ? mb_strlen($this->content, $this->charset) : strlen($this->content); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/AutoEscape.php: -------------------------------------------------------------------------------- 1 | 22 | */ 23 | class Twig_Node_AutoEscape extends Twig_Node 24 | { 25 | public function __construct($value, Twig_NodeInterface $body, $lineno, $tag = 'autoescape') 26 | { 27 | parent::__construct(array('body' => $body), array('value' => $value), $lineno, $tag); 28 | } 29 | 30 | /** 31 | * Compiles the node to PHP. 32 | * 33 | * @param Twig_Compiler $compiler A Twig_Compiler instance 34 | */ 35 | public function compile(Twig_Compiler $compiler) 36 | { 37 | $compiler->subcompile($this->getNode('body')); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Block.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | class Twig_Node_Block extends Twig_Node 19 | { 20 | public function __construct($name, Twig_NodeInterface $body, $lineno, $tag = null) 21 | { 22 | parent::__construct(array('body' => $body), array('name' => $name), $lineno, $tag); 23 | } 24 | 25 | /** 26 | * Compiles the node to PHP. 27 | * 28 | * @param Twig_Compiler $compiler A Twig_Compiler instance 29 | */ 30 | public function compile(Twig_Compiler $compiler) 31 | { 32 | $compiler 33 | ->addDebugInfo($this) 34 | ->write(sprintf("public function block_%s(\$context, array \$blocks = array())\n", $this->getAttribute('name')), "{\n") 35 | ->indent() 36 | ; 37 | 38 | $compiler 39 | ->subcompile($this->getNode('body')) 40 | ->outdent() 41 | ->write("}\n\n") 42 | ; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/BlockReference.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | class Twig_Node_BlockReference extends Twig_Node implements Twig_NodeOutputInterface 19 | { 20 | public function __construct($name, $lineno, $tag = null) 21 | { 22 | parent::__construct(array(), array('name' => $name), $lineno, $tag); 23 | } 24 | 25 | /** 26 | * Compiles the node to PHP. 27 | * 28 | * @param Twig_Compiler $compiler A Twig_Compiler instance 29 | */ 30 | public function compile(Twig_Compiler $compiler) 31 | { 32 | $compiler 33 | ->addDebugInfo($this) 34 | ->write(sprintf("\$this->displayBlock('%s', \$context, \$blocks);\n", $this->getAttribute('name'))) 35 | ; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Body.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Node_Body extends Twig_Node 18 | { 19 | } 20 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Do.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Node_Do extends Twig_Node 18 | { 19 | public function __construct(Twig_Node_Expression $expr, $lineno, $tag = null) 20 | { 21 | parent::__construct(array('expr' => $expr), array(), $lineno, $tag); 22 | } 23 | 24 | /** 25 | * Compiles the node to PHP. 26 | * 27 | * @param Twig_Compiler $compiler A Twig_Compiler instance 28 | */ 29 | public function compile(Twig_Compiler $compiler) 30 | { 31 | $compiler 32 | ->addDebugInfo($this) 33 | ->write('') 34 | ->subcompile($this->getNode('expr')) 35 | ->raw(";\n") 36 | ; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Embed.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Node_Embed extends Twig_Node_Include 18 | { 19 | // we don't inject the module to avoid node visitors to traverse it twice (as it will be already visited in the main module) 20 | public function __construct($filename, $index, Twig_Node_Expression $variables = null, $only = false, $ignoreMissing = false, $lineno, $tag = null) 21 | { 22 | parent::__construct(new Twig_Node_Expression_Constant('not_used', $lineno), $variables, $only, $ignoreMissing, $lineno, $tag); 23 | 24 | $this->setAttribute('filename', $filename); 25 | $this->setAttribute('index', $index); 26 | } 27 | 28 | protected function addGetTemplate(Twig_Compiler $compiler) 29 | { 30 | $compiler 31 | ->write("\$this->loadTemplate(") 32 | ->string($this->getAttribute('filename')) 33 | ->raw(', ') 34 | ->repr($compiler->getFilename()) 35 | ->raw(', ') 36 | ->repr($this->getLine()) 37 | ->raw(', ') 38 | ->string($this->getAttribute('index')) 39 | ->raw(")") 40 | ; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | abstract class Twig_Node_Expression extends Twig_Node 19 | { 20 | } 21 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Array.php: -------------------------------------------------------------------------------- 1 | index = -1; 20 | foreach ($this->getKeyValuePairs() as $pair) { 21 | if ($pair['key'] instanceof Twig_Node_Expression_Constant && ctype_digit((string) $pair['key']->getAttribute('value')) && $pair['key']->getAttribute('value') > $this->index) { 22 | $this->index = $pair['key']->getAttribute('value'); 23 | } 24 | } 25 | } 26 | 27 | public function getKeyValuePairs() 28 | { 29 | $pairs = array(); 30 | 31 | foreach (array_chunk($this->nodes, 2) as $pair) { 32 | $pairs[] = array( 33 | 'key' => $pair[0], 34 | 'value' => $pair[1], 35 | ); 36 | } 37 | 38 | return $pairs; 39 | } 40 | 41 | public function hasElement(Twig_Node_Expression $key) 42 | { 43 | foreach ($this->getKeyValuePairs() as $pair) { 44 | // we compare the string representation of the keys 45 | // to avoid comparing the line numbers which are not relevant here. 46 | if ((string) $key == (string) $pair['key']) { 47 | return true; 48 | } 49 | } 50 | 51 | return false; 52 | } 53 | 54 | public function addElement(Twig_Node_Expression $value, Twig_Node_Expression $key = null) 55 | { 56 | if (null === $key) { 57 | $key = new Twig_Node_Expression_Constant(++$this->index, $value->getLine()); 58 | } 59 | 60 | array_push($this->nodes, $key, $value); 61 | } 62 | 63 | /** 64 | * Compiles the node to PHP. 65 | * 66 | * @param Twig_Compiler $compiler A Twig_Compiler instance 67 | */ 68 | public function compile(Twig_Compiler $compiler) 69 | { 70 | $compiler->raw('array('); 71 | $first = true; 72 | foreach ($this->getKeyValuePairs() as $pair) { 73 | if (!$first) { 74 | $compiler->raw(', '); 75 | } 76 | $first = false; 77 | 78 | $compiler 79 | ->subcompile($pair['key']) 80 | ->raw(' => ') 81 | ->subcompile($pair['value']) 82 | ; 83 | } 84 | $compiler->raw(')'); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/AssignName.php: -------------------------------------------------------------------------------- 1 | raw('$context[') 24 | ->string($this->getAttribute('name')) 25 | ->raw(']') 26 | ; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary.php: -------------------------------------------------------------------------------- 1 | $left, 'right' => $right), array(), $lineno); 17 | } 18 | 19 | /** 20 | * Compiles the node to PHP. 21 | * 22 | * @param Twig_Compiler $compiler A Twig_Compiler instance 23 | */ 24 | public function compile(Twig_Compiler $compiler) 25 | { 26 | $compiler 27 | ->raw('(') 28 | ->subcompile($this->getNode('left')) 29 | ->raw(' ') 30 | ; 31 | $this->operator($compiler); 32 | $compiler 33 | ->raw(' ') 34 | ->subcompile($this->getNode('right')) 35 | ->raw(')') 36 | ; 37 | } 38 | 39 | abstract public function operator(Twig_Compiler $compiler); 40 | } 41 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary/Add.php: -------------------------------------------------------------------------------- 1 | raw('+'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary/And.php: -------------------------------------------------------------------------------- 1 | raw('&&'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary/BitwiseAnd.php: -------------------------------------------------------------------------------- 1 | raw('&'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary/BitwiseOr.php: -------------------------------------------------------------------------------- 1 | raw('|'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary/BitwiseXor.php: -------------------------------------------------------------------------------- 1 | raw('^'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary/Concat.php: -------------------------------------------------------------------------------- 1 | raw('.'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary/Div.php: -------------------------------------------------------------------------------- 1 | raw('/'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary/EndsWith.php: -------------------------------------------------------------------------------- 1 | getVarName(); 16 | $right = $compiler->getVarName(); 17 | $compiler 18 | ->raw(sprintf('(is_string($%s = ', $left)) 19 | ->subcompile($this->getNode('left')) 20 | ->raw(sprintf(') && is_string($%s = ', $right)) 21 | ->subcompile($this->getNode('right')) 22 | ->raw(sprintf(') && (\'\' === $%2$s || $%2$s === substr($%1$s, -strlen($%2$s))))', $left, $right)) 23 | ; 24 | } 25 | 26 | public function operator(Twig_Compiler $compiler) 27 | { 28 | return $compiler->raw(''); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary/Equal.php: -------------------------------------------------------------------------------- 1 | raw('=='); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary/FloorDiv.php: -------------------------------------------------------------------------------- 1 | raw('intval(floor('); 21 | parent::compile($compiler); 22 | $compiler->raw('))'); 23 | } 24 | 25 | public function operator(Twig_Compiler $compiler) 26 | { 27 | return $compiler->raw('/'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary/Greater.php: -------------------------------------------------------------------------------- 1 | raw('>'); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary/GreaterEqual.php: -------------------------------------------------------------------------------- 1 | raw('>='); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary/In.php: -------------------------------------------------------------------------------- 1 | raw('twig_in_filter(') 22 | ->subcompile($this->getNode('left')) 23 | ->raw(', ') 24 | ->subcompile($this->getNode('right')) 25 | ->raw(')') 26 | ; 27 | } 28 | 29 | public function operator(Twig_Compiler $compiler) 30 | { 31 | return $compiler->raw('in'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary/Less.php: -------------------------------------------------------------------------------- 1 | raw('<'); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary/LessEqual.php: -------------------------------------------------------------------------------- 1 | raw('<='); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary/Matches.php: -------------------------------------------------------------------------------- 1 | raw('preg_match(') 17 | ->subcompile($this->getNode('right')) 18 | ->raw(', ') 19 | ->subcompile($this->getNode('left')) 20 | ->raw(')') 21 | ; 22 | } 23 | 24 | public function operator(Twig_Compiler $compiler) 25 | { 26 | return $compiler->raw(''); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary/Mod.php: -------------------------------------------------------------------------------- 1 | raw('%'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary/Mul.php: -------------------------------------------------------------------------------- 1 | raw('*'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary/NotEqual.php: -------------------------------------------------------------------------------- 1 | raw('!='); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary/NotIn.php: -------------------------------------------------------------------------------- 1 | raw('!twig_in_filter(') 22 | ->subcompile($this->getNode('left')) 23 | ->raw(', ') 24 | ->subcompile($this->getNode('right')) 25 | ->raw(')') 26 | ; 27 | } 28 | 29 | public function operator(Twig_Compiler $compiler) 30 | { 31 | return $compiler->raw('not in'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary/Or.php: -------------------------------------------------------------------------------- 1 | raw('||'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary/Power.php: -------------------------------------------------------------------------------- 1 | raw('pow(') 22 | ->subcompile($this->getNode('left')) 23 | ->raw(', ') 24 | ->subcompile($this->getNode('right')) 25 | ->raw(')') 26 | ; 27 | } 28 | 29 | public function operator(Twig_Compiler $compiler) 30 | { 31 | return $compiler->raw('**'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary/Range.php: -------------------------------------------------------------------------------- 1 | raw('range(') 22 | ->subcompile($this->getNode('left')) 23 | ->raw(', ') 24 | ->subcompile($this->getNode('right')) 25 | ->raw(')') 26 | ; 27 | } 28 | 29 | public function operator(Twig_Compiler $compiler) 30 | { 31 | return $compiler->raw('..'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary/StartsWith.php: -------------------------------------------------------------------------------- 1 | getVarName(); 16 | $right = $compiler->getVarName(); 17 | $compiler 18 | ->raw(sprintf('(is_string($%s = ', $left)) 19 | ->subcompile($this->getNode('left')) 20 | ->raw(sprintf(') && is_string($%s = ', $right)) 21 | ->subcompile($this->getNode('right')) 22 | ->raw(sprintf(') && (\'\' === $%2$s || 0 === strpos($%1$s, $%2$s)))', $left, $right)) 23 | ; 24 | } 25 | 26 | public function operator(Twig_Compiler $compiler) 27 | { 28 | return $compiler->raw(''); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Binary/Sub.php: -------------------------------------------------------------------------------- 1 | raw('-'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/BlockReference.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | class Twig_Node_Expression_BlockReference extends Twig_Node_Expression 19 | { 20 | public function __construct(Twig_NodeInterface $name, $asString = false, $lineno, $tag = null) 21 | { 22 | parent::__construct(array('name' => $name), array('as_string' => $asString, 'output' => false), $lineno, $tag); 23 | } 24 | 25 | /** 26 | * Compiles the node to PHP. 27 | * 28 | * @param Twig_Compiler $compiler A Twig_Compiler instance 29 | */ 30 | public function compile(Twig_Compiler $compiler) 31 | { 32 | if ($this->getAttribute('as_string')) { 33 | $compiler->raw('(string) '); 34 | } 35 | 36 | if ($this->getAttribute('output')) { 37 | $compiler 38 | ->addDebugInfo($this) 39 | ->write("\$this->displayBlock(") 40 | ->subcompile($this->getNode('name')) 41 | ->raw(", \$context, \$blocks);\n") 42 | ; 43 | } else { 44 | $compiler 45 | ->raw("\$this->renderBlock(") 46 | ->subcompile($this->getNode('name')) 47 | ->raw(", \$context, \$blocks)") 48 | ; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Conditional.php: -------------------------------------------------------------------------------- 1 | $expr1, 'expr2' => $expr2, 'expr3' => $expr3), array(), $lineno); 17 | } 18 | 19 | public function compile(Twig_Compiler $compiler) 20 | { 21 | $compiler 22 | ->raw('((') 23 | ->subcompile($this->getNode('expr1')) 24 | ->raw(') ? (') 25 | ->subcompile($this->getNode('expr2')) 26 | ->raw(') : (') 27 | ->subcompile($this->getNode('expr3')) 28 | ->raw('))') 29 | ; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Constant.php: -------------------------------------------------------------------------------- 1 | $value), $lineno); 17 | } 18 | 19 | public function compile(Twig_Compiler $compiler) 20 | { 21 | $compiler->repr($this->getAttribute('value')); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/ExtensionReference.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Node_Expression_ExtensionReference extends Twig_Node_Expression 18 | { 19 | public function __construct($name, $lineno, $tag = null) 20 | { 21 | parent::__construct(array(), array('name' => $name), $lineno, $tag); 22 | } 23 | 24 | /** 25 | * Compiles the node to PHP. 26 | * 27 | * @param Twig_Compiler $compiler A Twig_Compiler instance 28 | */ 29 | public function compile(Twig_Compiler $compiler) 30 | { 31 | $compiler->raw(sprintf("\$this->env->getExtension('%s')", $this->getAttribute('name'))); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Filter.php: -------------------------------------------------------------------------------- 1 | $node, 'filter' => $filterName, 'arguments' => $arguments), array(), $lineno, $tag); 17 | } 18 | 19 | public function compile(Twig_Compiler $compiler) 20 | { 21 | $name = $this->getNode('filter')->getAttribute('value'); 22 | $filter = $compiler->getEnvironment()->getFilter($name); 23 | 24 | $this->setAttribute('name', $name); 25 | $this->setAttribute('type', 'filter'); 26 | $this->setAttribute('thing', $filter); 27 | $this->setAttribute('needs_environment', $filter->needsEnvironment()); 28 | $this->setAttribute('needs_context', $filter->needsContext()); 29 | $this->setAttribute('arguments', $filter->getArguments()); 30 | if ($filter instanceof Twig_FilterCallableInterface || $filter instanceof Twig_SimpleFilter) { 31 | $this->setAttribute('callable', $filter->getCallable()); 32 | } 33 | 34 | $this->compileCallable($compiler); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Node/Expression/Filter/Default.php: -------------------------------------------------------------------------------- 1 | 16 | * {{ var.foo|default('foo item on var is not defined') }} 17 | * 18 | * 19 | * @author Fabien Potencier
'.parent::dump($profile).''; 27 | } 28 | 29 | protected function formatTemplate(Twig_Profiler_Profile $profile, $prefix) 30 | { 31 | return sprintf('%s└ %s', $prefix, self::$colors['template'], $profile->getTemplate()); 32 | } 33 | 34 | protected function formatNonTemplate(Twig_Profiler_Profile $profile, $prefix) 35 | { 36 | return sprintf('%s└ %s::%s(%s)', $prefix, $profile->getTemplate(), $profile->getType(), isset(self::$colors[$profile->getType()]) ? self::$colors[$profile->getType()] : 'auto', $profile->getName()); 37 | } 38 | 39 | protected function formatTime(Twig_Profiler_Profile $profile, $percent) 40 | { 41 | return sprintf('%.2fms/%.0f%%', $percent > 20 ? self::$colors['big'] : 'auto', $profile->getDuration() * 1000, $percent); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Profiler/Dumper/Text.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | class Twig_Profiler_Dumper_Text 16 | { 17 | private $root; 18 | 19 | public function dump(Twig_Profiler_Profile $profile) 20 | { 21 | return $this->dumpProfile($profile); 22 | } 23 | 24 | protected function formatTemplate(Twig_Profiler_Profile $profile, $prefix) 25 | { 26 | return sprintf('%s└ %s', $prefix, $profile->getTemplate()); 27 | } 28 | 29 | protected function formatNonTemplate(Twig_Profiler_Profile $profile, $prefix) 30 | { 31 | return sprintf('%s└ %s::%s(%s)', $prefix, $profile->getTemplate(), $profile->getType(), $profile->getName()); 32 | } 33 | 34 | protected function formatTime(Twig_Profiler_Profile $profile, $percent) 35 | { 36 | return sprintf('%.2fms/%.0f%%', $profile->getDuration() * 1000, $percent); 37 | } 38 | 39 | private function dumpProfile(Twig_Profiler_Profile $profile, $prefix = '', $sibling = false) 40 | { 41 | if ($profile->isRoot()) { 42 | $this->root = $profile->getDuration(); 43 | $start = $profile->getName(); 44 | } else { 45 | if ($profile->isTemplate()) { 46 | $start = $this->formatTemplate($profile, $prefix); 47 | } else { 48 | $start = $this->formatNonTemplate($profile, $prefix); 49 | } 50 | $prefix .= $sibling ? '│ ' : ' '; 51 | } 52 | 53 | $percent = $this->root ? $profile->getDuration() / $this->root * 100 : 0; 54 | 55 | if ($profile->getDuration() * 1000 < 1) { 56 | $str = $start."\n"; 57 | } else { 58 | $str = sprintf("%s %s\n", $start, $this->formatTime($profile, $percent)); 59 | } 60 | 61 | $nCount = count($profile->getProfiles()); 62 | foreach ($profile as $i => $p) { 63 | $str .= $this->dumpProfile($p, $prefix, $i + 1 !== $nCount); 64 | } 65 | 66 | return $str; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Profiler/Node/EnterProfile.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Profiler_Node_EnterProfile extends Twig_Node 18 | { 19 | public function __construct($extensionName, $type, $name, $varName) 20 | { 21 | parent::__construct(array(), array('extension_name' => $extensionName, 'name' => $name, 'type' => $type, 'var_name' => $varName)); 22 | } 23 | 24 | /** 25 | * {@inheritdoc} 26 | */ 27 | public function compile(Twig_Compiler $compiler) 28 | { 29 | $compiler 30 | ->write(sprintf("\$%s = \$this->env->getExtension(", $this->getAttribute('var_name'))) 31 | ->repr($this->getAttribute('extension_name')) 32 | ->raw(");\n") 33 | ->write(sprintf("\$%s->enter(\$%s = new Twig_Profiler_Profile(\$this->getTemplateName(), ", $this->getAttribute('var_name'), $this->getAttribute('var_name').'_prof')) 34 | ->repr($this->getAttribute('type')) 35 | ->raw(", ") 36 | ->repr($this->getAttribute('name')) 37 | ->raw("));\n\n") 38 | ; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Profiler/Node/LeaveProfile.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Profiler_Node_LeaveProfile extends Twig_Node 18 | { 19 | public function __construct($varName) 20 | { 21 | parent::__construct(array(), array('var_name' => $varName)); 22 | } 23 | 24 | /** 25 | * {@inheritdoc} 26 | */ 27 | public function compile(Twig_Compiler $compiler) 28 | { 29 | $compiler 30 | ->write("\n") 31 | ->write(sprintf("\$%s->leave(\$%s);\n\n", $this->getAttribute('var_name'), $this->getAttribute('var_name').'_prof')) 32 | ; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Profiler/NodeVisitor/Profiler.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | class Twig_Profiler_NodeVisitor_Profiler implements Twig_NodeVisitorInterface 16 | { 17 | private $extensionName; 18 | 19 | public function __construct($extensionName) 20 | { 21 | $this->extensionName = $extensionName; 22 | } 23 | 24 | /** 25 | * {@inheritdoc} 26 | */ 27 | public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) 28 | { 29 | return $node; 30 | } 31 | 32 | /** 33 | * {@inheritdoc} 34 | */ 35 | public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env) 36 | { 37 | if ($node instanceof Twig_Node_Module) { 38 | $varName = $this->getVarName(); 39 | $node->setNode('display_start', new Twig_Node(array(new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::TEMPLATE, $node->getAttribute('filename'), $varName), $node->getNode('display_start')))); 40 | $node->setNode('display_end', new Twig_Node(array(new Twig_Profiler_Node_LeaveProfile($varName), $node->getNode('display_end')))); 41 | } elseif ($node instanceof Twig_Node_Block) { 42 | $varName = $this->getVarName(); 43 | $node->setNode('body', new Twig_Node_Body(array( 44 | new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::BLOCK, $node->getAttribute('name'), $varName), 45 | $node->getNode('body'), 46 | new Twig_Profiler_Node_LeaveProfile($varName), 47 | ))); 48 | } elseif ($node instanceof Twig_Node_Macro) { 49 | $varName = $this->getVarName(); 50 | $node->setNode('body', new Twig_Node_Body(array( 51 | new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::MACRO, $node->getAttribute('name'), $varName), 52 | $node->getNode('body'), 53 | new Twig_Profiler_Node_LeaveProfile($varName), 54 | ))); 55 | } 56 | 57 | return $node; 58 | } 59 | 60 | private function getVarName() 61 | { 62 | return sprintf('__internal_%s', hash('sha256', uniqid(mt_rand(), true), false)); 63 | } 64 | 65 | /** 66 | * {@inheritdoc} 67 | */ 68 | public function getPriority() 69 | { 70 | return 0; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Sandbox/SecurityError.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Sandbox_SecurityError extends Twig_Error 18 | { 19 | } 20 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Sandbox/SecurityNotAllowedFilterError.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Sandbox_SecurityNotAllowedFilterError extends Twig_Sandbox_SecurityError 18 | { 19 | private $filterName; 20 | 21 | public function __construct($message, $functionName, $lineno = -1, $filename = null, Exception $previous = null) 22 | { 23 | parent::__construct($message, $lineno, $filename, $previous); 24 | $this->filterName = $functionName; 25 | } 26 | 27 | public function getFilterName() 28 | { 29 | return $this->filterName; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Sandbox/SecurityNotAllowedFunctionError.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Sandbox_SecurityNotAllowedFunctionError extends Twig_Sandbox_SecurityError 18 | { 19 | private $functionName; 20 | 21 | public function __construct($message, $functionName, $lineno = -1, $filename = null, Exception $previous = null) 22 | { 23 | parent::__construct($message, $lineno, $filename, $previous); 24 | $this->functionName = $functionName; 25 | } 26 | 27 | public function getFunctionName() 28 | { 29 | return $this->functionName; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Sandbox/SecurityNotAllowedTagError.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Sandbox_SecurityNotAllowedTagError extends Twig_Sandbox_SecurityError 18 | { 19 | private $tagName; 20 | 21 | public function __construct($message, $tagName, $lineno = -1, $filename = null, Exception $previous = null) 22 | { 23 | parent::__construct($message, $lineno, $filename, $previous); 24 | $this->tagName = $tagName; 25 | } 26 | 27 | public function getTagName() 28 | { 29 | return $this->tagName; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Sandbox/SecurityPolicyInterface.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | interface Twig_Sandbox_SecurityPolicyInterface 18 | { 19 | public function checkSecurity($tags, $filters, $functions); 20 | 21 | public function checkMethodAllowed($obj, $method); 22 | 23 | public function checkPropertyAllowed($obj, $method); 24 | } 25 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/SimpleFilter.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_SimpleFilter 18 | { 19 | protected $name; 20 | protected $callable; 21 | protected $options; 22 | protected $arguments = array(); 23 | 24 | public function __construct($name, $callable, array $options = array()) 25 | { 26 | $this->name = $name; 27 | $this->callable = $callable; 28 | $this->options = array_merge(array( 29 | 'needs_environment' => false, 30 | 'needs_context' => false, 31 | 'is_safe' => null, 32 | 'is_safe_callback' => null, 33 | 'pre_escape' => null, 34 | 'preserves_safety' => null, 35 | 'node_class' => 'Twig_Node_Expression_Filter', 36 | ), $options); 37 | } 38 | 39 | public function getName() 40 | { 41 | return $this->name; 42 | } 43 | 44 | public function getCallable() 45 | { 46 | return $this->callable; 47 | } 48 | 49 | public function getNodeClass() 50 | { 51 | return $this->options['node_class']; 52 | } 53 | 54 | public function setArguments($arguments) 55 | { 56 | $this->arguments = $arguments; 57 | } 58 | 59 | public function getArguments() 60 | { 61 | return $this->arguments; 62 | } 63 | 64 | public function needsEnvironment() 65 | { 66 | return $this->options['needs_environment']; 67 | } 68 | 69 | public function needsContext() 70 | { 71 | return $this->options['needs_context']; 72 | } 73 | 74 | public function getSafe(Twig_Node $filterArgs) 75 | { 76 | if (null !== $this->options['is_safe']) { 77 | return $this->options['is_safe']; 78 | } 79 | 80 | if (null !== $this->options['is_safe_callback']) { 81 | return call_user_func($this->options['is_safe_callback'], $filterArgs); 82 | } 83 | } 84 | 85 | public function getPreservesSafety() 86 | { 87 | return $this->options['preserves_safety']; 88 | } 89 | 90 | public function getPreEscape() 91 | { 92 | return $this->options['pre_escape']; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/SimpleFunction.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_SimpleFunction 18 | { 19 | protected $name; 20 | protected $callable; 21 | protected $options; 22 | protected $arguments = array(); 23 | 24 | public function __construct($name, $callable, array $options = array()) 25 | { 26 | $this->name = $name; 27 | $this->callable = $callable; 28 | $this->options = array_merge(array( 29 | 'needs_environment' => false, 30 | 'needs_context' => false, 31 | 'is_safe' => null, 32 | 'is_safe_callback' => null, 33 | 'node_class' => 'Twig_Node_Expression_Function', 34 | ), $options); 35 | } 36 | 37 | public function getName() 38 | { 39 | return $this->name; 40 | } 41 | 42 | public function getCallable() 43 | { 44 | return $this->callable; 45 | } 46 | 47 | public function getNodeClass() 48 | { 49 | return $this->options['node_class']; 50 | } 51 | 52 | public function setArguments($arguments) 53 | { 54 | $this->arguments = $arguments; 55 | } 56 | 57 | public function getArguments() 58 | { 59 | return $this->arguments; 60 | } 61 | 62 | public function needsEnvironment() 63 | { 64 | return $this->options['needs_environment']; 65 | } 66 | 67 | public function needsContext() 68 | { 69 | return $this->options['needs_context']; 70 | } 71 | 72 | public function getSafe(Twig_Node $functionArgs) 73 | { 74 | if (null !== $this->options['is_safe']) { 75 | return $this->options['is_safe']; 76 | } 77 | 78 | if (null !== $this->options['is_safe_callback']) { 79 | return call_user_func($this->options['is_safe_callback'], $functionArgs); 80 | } 81 | 82 | return array(); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/SimpleTest.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_SimpleTest 18 | { 19 | protected $name; 20 | protected $callable; 21 | protected $options; 22 | 23 | public function __construct($name, $callable, array $options = array()) 24 | { 25 | $this->name = $name; 26 | $this->callable = $callable; 27 | $this->options = array_merge(array( 28 | 'node_class' => 'Twig_Node_Expression_Test', 29 | ), $options); 30 | } 31 | 32 | public function getName() 33 | { 34 | return $this->name; 35 | } 36 | 37 | public function getCallable() 38 | { 39 | return $this->callable; 40 | } 41 | 42 | public function getNodeClass() 43 | { 44 | return $this->options['node_class']; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/TemplateInterface.php: -------------------------------------------------------------------------------- 1 | 16 | * 17 | * @deprecated since 1.12 (to be removed in 3.0) 18 | */ 19 | interface Twig_TemplateInterface 20 | { 21 | const ANY_CALL = 'any'; 22 | const ARRAY_CALL = 'array'; 23 | const METHOD_CALL = 'method'; 24 | 25 | /** 26 | * Renders the template with the given context and returns it as string. 27 | * 28 | * @param array $context An array of parameters to pass to the template 29 | * 30 | * @return string The rendered template 31 | */ 32 | public function render(array $context); 33 | 34 | /** 35 | * Displays the template with the given context. 36 | * 37 | * @param array $context An array of parameters to pass to the template 38 | * @param array $blocks An array of blocks to pass to the template 39 | */ 40 | public function display(array $context, array $blocks = array()); 41 | 42 | /** 43 | * Returns the bound environment for this template. 44 | * 45 | * @return Twig_Environment The current environment 46 | */ 47 | public function getEnvironment(); 48 | } 49 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Test.php: -------------------------------------------------------------------------------- 1 | 16 | * @deprecated since 1.12 (to be removed in 2.0) 17 | */ 18 | abstract class Twig_Test implements Twig_TestInterface, Twig_TestCallableInterface 19 | { 20 | protected $options; 21 | protected $arguments = array(); 22 | 23 | public function __construct(array $options = array()) 24 | { 25 | $this->options = array_merge(array( 26 | 'callable' => null, 27 | ), $options); 28 | } 29 | 30 | public function getCallable() 31 | { 32 | return $this->options['callable']; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Test/Function.php: -------------------------------------------------------------------------------- 1 | 16 | * @deprecated since 1.12 (to be removed in 2.0) 17 | */ 18 | class Twig_Test_Function extends Twig_Test 19 | { 20 | protected $function; 21 | 22 | public function __construct($function, array $options = array()) 23 | { 24 | $options['callable'] = $function; 25 | 26 | parent::__construct($options); 27 | 28 | $this->function = $function; 29 | } 30 | 31 | public function compile() 32 | { 33 | return $this->function; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Test/Method.php: -------------------------------------------------------------------------------- 1 | 16 | * @deprecated since 1.12 (to be removed in 2.0) 17 | */ 18 | class Twig_Test_Method extends Twig_Test 19 | { 20 | protected $extension; 21 | protected $method; 22 | 23 | public function __construct(Twig_ExtensionInterface $extension, $method, array $options = array()) 24 | { 25 | $options['callable'] = array($extension, $method); 26 | 27 | parent::__construct($options); 28 | 29 | $this->extension = $extension; 30 | $this->method = $method; 31 | } 32 | 33 | public function compile() 34 | { 35 | return sprintf('$this->env->getExtension(\'%s\')->%s', $this->extension->getName(), $this->method); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Test/Node.php: -------------------------------------------------------------------------------- 1 | 16 | * @deprecated since 1.12 (to be removed in 2.0) 17 | */ 18 | class Twig_Test_Node extends Twig_Test 19 | { 20 | protected $class; 21 | 22 | public function __construct($class, array $options = array()) 23 | { 24 | parent::__construct($options); 25 | 26 | $this->class = $class; 27 | } 28 | 29 | public function getClass() 30 | { 31 | return $this->class; 32 | } 33 | 34 | public function compile() 35 | { 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/Test/NodeTestCase.php: -------------------------------------------------------------------------------- 1 | assertNodeCompilation($source, $node, $environment); 21 | } 22 | 23 | public function assertNodeCompilation($source, Twig_Node $node, Twig_Environment $environment = null) 24 | { 25 | $compiler = $this->getCompiler($environment); 26 | $compiler->compile($node); 27 | 28 | $this->assertEquals($source, trim($compiler->getSource())); 29 | } 30 | 31 | protected function getCompiler(Twig_Environment $environment = null) 32 | { 33 | return new Twig_Compiler(null === $environment ? $this->getEnvironment() : $environment); 34 | } 35 | 36 | protected function getEnvironment() 37 | { 38 | return new Twig_Environment(); 39 | } 40 | 41 | protected function getVariableGetter($name, $line = false) 42 | { 43 | $line = $line > 0 ? "// line {$line}\n" : ''; 44 | 45 | if (PHP_VERSION_ID >= 50400) { 46 | return sprintf('%s(isset($context["%s"]) ? $context["%s"] : null)', $line, $name, $name); 47 | } 48 | 49 | return sprintf('%s$this->getContext($context, "%s")', $line, $name); 50 | } 51 | 52 | protected function getAttributeGetter() 53 | { 54 | if (function_exists('twig_template_get_attributes')) { 55 | return 'twig_template_get_attributes($this, '; 56 | } 57 | 58 | return '$this->getAttribute('; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/TestCallableInterface.php: -------------------------------------------------------------------------------- 1 | 16 | * @deprecated since 1.12 (to be removed in 2.0) 17 | */ 18 | interface Twig_TestCallableInterface 19 | { 20 | public function getCallable(); 21 | } 22 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/TestInterface.php: -------------------------------------------------------------------------------- 1 | 16 | * @deprecated since 1.12 (to be removed in 2.0) 17 | */ 18 | interface Twig_TestInterface 19 | { 20 | /** 21 | * Compiles a test. 22 | * 23 | * @return string The PHP code for the test 24 | */ 25 | public function compile(); 26 | } 27 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/TokenParser.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | abstract class Twig_TokenParser implements Twig_TokenParserInterface 18 | { 19 | /** 20 | * @var Twig_Parser 21 | */ 22 | protected $parser; 23 | 24 | /** 25 | * Sets the parser associated with this token parser 26 | * 27 | * @param Twig_Parser $parser A Twig_Parser instance 28 | */ 29 | public function setParser(Twig_Parser $parser) 30 | { 31 | $this->parser = $parser; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ansible-logger-web/includes/Twig/TokenParser/Block.php: -------------------------------------------------------------------------------- 1 | 17 | * {% block head %} 18 | * 19 | *
Start Time | 33 |Duration | 34 |Group/Hostname | 35 |Hosts | 36 |Tasks | 37 |Changed | 38 |Result | 39 |
---|---|---|---|---|---|---|
{{ item.playStart }} | 45 |{% if item.isRunning %}Running{% else %}{{ item.playTimePretty }}{% endif %} | 46 |{{ item.playPattern }} | 47 |{{ item.hostCount }} | 48 |{{ item.taskCount }} | 49 |{% if item.hasChanged %}Yes{% else %}No{% endif %} | 50 |{% if item.hasFailed %}Failed{% else %}OK | {% endif %} 51 |
Fact | 32 |Value | 33 |
---|---|
{{ item.factName }} | 39 |{{ item.factData }} | 40 |
Start Time | 33 |Duration | 34 |Group/Hostname | 35 |Hosts | 36 |Tasks | 37 |Changed | 38 |Result | 39 |
---|---|---|---|---|---|---|
{{ item.playStart }} | 45 |{% if item.isRunning %}Running{% else %}{{ item.playTimePretty }}{% endif %} | 46 |{{ item.playPattern }} | 47 |{{ item.hostCount }} | 48 |{{ item.taskCount }} | 49 |{% if item.hasChanged %}Yes{% else %}No{% endif %} | 50 |{% if item.hasFailed %}Failed{% else %}OK | {% endif %} 51 |
FQDN | 32 |Last Seen | 33 |Recent Playbooks | 34 |Facts | 35 |
---|---|---|---|
{{ item.hostName }} | 41 |{{ item.lastSeen }} | 42 |View | 43 |View | 44 |
19 | Host: {{ runItem.hostName }}{% if runItem.delegated %} (delegated to: {{ runItem.delegatedHost }}){% endif %} 20 | {% if runItem.extraInfo %} 21 | View Module output 22 | {% endif %} 23 |
24 | {% if runItem.extraInfo %} 25 |{{ runItem.extraInfo }}27 |
Host: {{ runItem.hostName }}
{{ runItem.failMsg }}
Host: {{ runItem.hostName }}
{{ runItem.failMsg }}
Host: {{ runItem.hostName}}
35 | {% else %} 36 |37 | Host: {{ runItem.hostName }}{% if runItem.delegated %} (delegated to: {{ runItem.delegatedHost }}){% endif %} 38 | {% if runItem.extraInfo %} 39 | View Module output 40 | {% endif %} 41 |
42 | {% if runItem.extraInfo %} 43 |{{ runItem.extraInfo }}45 |