44 }
45
46 $component = $query->get('component', 'cmd');
47
48 if(false === $route = $context->router->resolve($component.':'.$route, $query->toArray())) {
49 throw new Library\HttpExceptionNotFound('Page Not Found');
50 }
51
52 //Set the query in the request
53 $context->getRequest()->setQuery($route->query);
54
115 * @param CommandInterface $command The command
116 * @return mixed Return the result of the handler.
117 */
118 public function invokeCommandCallback($method, CommandInterface $command)
119 {
120 return $this->$method($command);
121 }
122
123 /**
124 * Add a callback
125 *
95 {
96 $method = $handler['method'];
97 $params = $handler['params'];
98
99 if(is_string($method)) {
100 $result = $this->invokeCommandCallback($method, $command->append($params));
101 } else {
102 $result = $method($command->append($params));
103 }
104
105 if($result !== null && $result === $this->getBreakCondition()) {
116 * @param CommandChainInterface $chain The chain executing the command
117 * @return mixed If a handler breaks, returns the break condition. Returns the result of the handler otherwise.
118 */
119 public function execute(CommandInterface $command, CommandChainInterface $chain)
120 {
121 return parent::invokeCallbacks($command);
122 }
123
124 /**
125 * Add a command callback
126 *
125 $command->setSubject($subject);
126 }
127
128 foreach ($this->__stack->peek() as $handler)
129 {
130 $result = $handler->execute($command, $this);
131
132 if($result === $this->getBreakCondition()) {
133 break;
134 }
135 }
136 public function invokeCommand($command, $attributes = null, $subject = null)
137 {
138 //Default the subject to the mixer
139 $subject = $subject ?: $this->getMixer();
140
141 return $this->getCommandChain()->execute($command, $attributes, $subject);
142 }
143
144 /**
145 * Invoke a command callback or delegate invocation to the mixer
146 *
397 $mixin = $this->__mixed_methods[$method];
398
399 //Switch the mixin's attached mixer
400 $mixin->setMixer($this);
401
402 $result = $mixin->$method(...$arguments);
403 }
404 else $result = $this->__mixed_methods[$method];
405
406 return $result;
407 }
392 if ($parts[0] == 'is' && isset($parts[1])) {
393 return false;
394 }
395 }
396
397 return parent::__call($method, $args);
398 }
399 }
116 //Retrieve the context name and subject
117 $subject = $context->getSubject();
118 $name = $context->getName();
119
120 //Execute the action
121 if($this->invokeCommand('before.'.$action, $context) !== false)
122 {
123 $method = '_action' . ucfirst($action);
124
125 if (!method_exists($this, $method))
126 {
379 $context->result = false;
380 }
381 else $context = $data;
382
383 //Execute the action
384 return $this->execute($method, $context);
385 }
386
387 if (!$this->isMixedMethod($method))
388 {
389 //Check if a behavior is mixed
180 'blocks' => $context->param->block ? [$context->param->block] : $this->getConfig()->blocks
181 //'endpoint' => $context->param->endpoint ?? false
182 ]);
183 }
184
185 $dispatcher->dispatch();
186 }
187 }
188 }
189 catch (\Exception $e)
190 {
130 "Can't execute '$action', method: '$method' does not exist"
131 );
132 }
133 else $context->result = parent::__call($action, array($context));
134 }
135 else $context->result = $this->$method($context);
136
137 $this->invokeCommand('after.'.$action, $context);
138 }
139
140 //Reset the context
379 $context->result = false;
380 }
381 else $context = $data;
382
383 //Execute the action
384 return $this->execute($method, $context);
385 }
386
387 if (!$this->isMixedMethod($method))
388 {
389 //Check if a behavior is mixed
284 $route['endpoint'] = trim($path, '/');
285
286 $request = $this->getObject('request');
287 $request->getQuery()->add($route);
288
289 $this->dispatch();
290
291 $content = $this->render();
292
293 $post = new \Foliolabs\WP\Post( (object) [
294 'ID' => 0,
321 if ( 0 === $the_['accepted_args'] ) {
322 $value = call_user_func( $the_['function'] );
323 } elseif ( $the_['accepted_args'] >= $num_args ) {
324 $value = call_user_func_array( $the_['function'], $args );
325 } else {
326 $value = call_user_func_array( $the_['function'], array_slice( $args, 0, $the_['accepted_args'] ) );
327 }
328 }
329 } while ( false !== next( $this->iterations[ $nesting_level ] ) );
330
331 unset( $this->iterations[ $nesting_level ] );
200 }
201
202 // Pass the value to WP_Hook.
203 array_unshift( $args, $value );
204
205 $filtered = $wp_filter[ $hook_name ]->apply_filters( $value, $args );
206
207 array_pop( $wp_current_filter );
208
209 return $filtered;
210 }
143 *
144 * @param bool $bool Whether or not to parse the request. Default true.
145 * @param WP $wp Current WordPress environment instance.
146 * @param array|string $extra_query_vars Extra passed query variables.
147 */
148 if ( ! apply_filters( 'do_parse_request', true, $this, $extra_query_vars ) ) {
149 return false;
150 }
151
152 $this->query_vars = array();
153 $post_type_query_vars = array();
808 * @param string|array $query_args Passed to parse_request().
809 */
810 public function main( $query_args = '' ) {
811 $this->init();
812
813 $parsed = $this->parse_request( $query_args );
814
815 if ( $parsed ) {
816 $this->query_posts();
817 $this->handle_404();
818 $this->register_globals();
1331 * @param string|array $query_vars Default WP_Query arguments.
1332 */
1333 function wp( $query_vars = '' ) {
1334 global $wp, $wp_query, $wp_the_query;
1335
1336 $wp->main( $query_vars );
1337
1338 if ( ! isset( $wp_the_query ) ) {
1339 $wp_the_query = $wp_query;
1340 }
1341 }
11
12 // Load the WordPress library.
13 require_once __DIR__ . '/wp-load.php';
14
15 // Set up the WordPress query.
16 wp();
17
18 // Load the theme template.
19 require_once ABSPATH . WPINC . '/template-loader.php';
20
21 }
12 * @var bool
13 */
14 define( 'WP_USE_THEMES', true );
15
16 /** Loads the WordPress Environment and Template */
17 require __DIR__ . '/wp-blog-header.php';
0 |
string(48) "E:\Domains\ccwro.org\httpdocs\wp-blog-header.php" |