/var/webs/kontrafunk-app/webroot/wp-content/themes/kontrafunk/app/Services/PersonService.php
public function listByArray( $list ) : array {
$return = [] ;
$query = $this->query() ;
$this->filterByArray($query,$list ) ;
$items = $query->get() ;
if ( !empty( $items ) ) {
foreach ($items as $item) {
$return[] = $item;
}
}
return $return ;
}
public function listNames( array $list ) : array {
$return = [] ;
foreach( $this->listByArray( $list ) as $item ) {
$return[] = $item->title ;
}
return $return ;
}
public function listNamesWithLinks( array $list ) : array {
$return = [] ;
foreach( $this->listByArray( $list ) as $item ) {
$return[] = "<a href='/stimmen/{$item->alias}/'>{$item->title}</a>" ;
}
return $return ;
}
}
/var/webs/kontrafunk-app/webroot/wp-content/themes/kontrafunk/app/Services/ArticleService.php
// $this->queryAppendCategories($article) ;
$article->findById( $id ) ;
/* --------------------------------------------------------------------------------------------------------------------------------
* Autoren Liste
* --------------------------------------------------------------------------------------------------------------------------------
*/
$personService = new PersonService() ;
$moderatoren = UtilityService::json($article->stimme_moderation) ;
$personService = new PersonService() ;
$moderator = null ;
if ( !empty( $moderatoren) ) {
$moderator = $personService->getPersonDetailById( $moderatoren[0] ) ;
}
$stimmeModeration = $personService->listNames( $moderatoren ) ;
$stimmeGaeste = $personService->listNames( UtilityService::json($article->stimme_gaeste) ) ;
$autor_list =
FormatService::formatList(
$stimmeModeration ,
delimiter: ", ",
lastDelimiter: " und ",
) .
FormatService::formatList(
$stimmeGaeste ,
delimiter: ", ",
lastDelimiter: " und ",
listPrefix: " im gespräch mit "
)
;
/* --------------------------------------------------------------------------------------------------------------------------------
* Tags
/var/webs/kontrafunk-app/webroot/wp-content/themes/kontrafunk/app/Services/ArticleService.php
$i = 0 ;
foreach ( $clips as &$clip ) {
$i++ ;
$clip['playerId'] = $article->id . "-" . $i ;
$clip['articleId'] = $article->id ;
}
$article->clips = $clips ;
return $article ;
}
else {
return null ;
}
}
public function getArticleDetailByAlias( string $alias ) : object | null {
$article = Article::new()->findByAlias( $alias ) ;
if ( $article ) {
return $this->getArticleDetailById( $article->id ) ;
}
else {
return null ;
}
}
public function listActiveArticles( ) : object | null {
return self::listArticles()->where("state", "=", "1") ;
}
public function queryArticles( ) : object | null {
$query = Article::new() ;
Article::new()->decorateCategories($query);
$this->filterActiveArticles( $query );
return $query ;
/var/webs/kontrafunk-app/webroot/wp-content/themes/kontrafunk/app/Controllers/ArticleController.php
<?php
namespace App\Controllers;
use App\Services\ArticleService;
use TypeRocket\Controllers\Controller;
class ArticleController extends Controller
{
// protected $modelClass = Category::class;
public function article( $alias ) {
$data = [] ;
$articleService = new ArticleService ;
$data['article'] = $articleService->getArticleDetailByAlias( $alias ) ;
return tr_view('article.vArticleDetail', ['data' => $data]);
}
}
/var/webs/kontrafunk-app/webroot/wp-content/mu-plugins/typerocket/vendor/typerocket/core/src/Core/Resolver.php
/**
* Resolve Callable
*
* @param $handler
* @param null|array $args
* @return mixed
* @throws \ReflectionException
*/
public function resolveCallable($handler, $args = null)
{
if ( is_array($handler) ) {
$ref = new \ReflectionMethod($handler[0], $handler[1]);
} else {
$ref = new \ReflectionFunction($handler);
}
$params = $ref->getParameters();
$dependencies = $this->getDependencies($params, $args);
return call_user_func_array( $handler, $dependencies );
}
/**
* Get Dependencies
*
* @param array $parameters
* @param null|array $args
*
* @return array
* @throws \ReflectionException
*/
public function getDependencies($parameters, $args = null)
{
$dependencies = [];
$i = 0;
foreach ($parameters as $parameter) {
$varName = $parameter->getName();
$dependency = $parameter->getType();
/var/webs/kontrafunk-app/webroot/wp-content/mu-plugins/typerocket/vendor/typerocket/core/src/Core/Resolver.php
/**
* Resolve Callable
*
* @param $handler
* @param null|array $args
* @return mixed
* @throws \ReflectionException
*/
public function resolveCallable($handler, $args = null)
{
if ( is_array($handler) ) {
$ref = new \ReflectionMethod($handler[0], $handler[1]);
} else {
$ref = new \ReflectionFunction($handler);
}
$params = $ref->getParameters();
$dependencies = $this->getDependencies($params, $args);
return call_user_func_array( $handler, $dependencies );
}
/**
* Get Dependencies
*
* @param array $parameters
* @param null|array $args
*
* @return array
* @throws \ReflectionException
*/
public function getDependencies($parameters, $args = null)
{
$dependencies = [];
$i = 0;
foreach ($parameters as $parameter) {
$varName = $parameter->getName();
$dependency = $parameter->getType();
/var/webs/kontrafunk-app/webroot/wp-content/mu-plugins/typerocket/vendor/typerocket/core/src/Http/ControllerContainer.php
*
* @param Request $request
* @param Response $response
* @param Handler $handler
* @throws \Exception
*/
public function __construct( Request $request, Response $response, Handler $handler )
{
$this->request = $request;
$this->response = $response;
$this->handler = $handler;
$this->controller = $this->handler->getController();
}
/**
* Handle routing to controller
* @throws \Exception
*/
public function handle() {
$returned = (new Resolver)->resolveCallable($this->controller, $this->handler->getArgs());
$this->response->setReturn($returned);
}
/**
* Get the middleware group
*
* @return array ['group_name', 'group_name']
*/
public function getMiddlewareGroups()
{
$groups = [];
$action = null;
$middleware = null;
if( is_array($this->controller) && method_exists($this->controller[0], 'getMiddleware') ) {
/** @var Controller|object $controller */
$controller = $this->controller[0];
$middleware = $controller->getMiddleware();
$action = $this->controller[1];
}
/var/webs/kontrafunk-app/webroot/wp-content/mu-plugins/typerocket/vendor/typerocket/core/src/Http/Middleware/BaseVerify.php
*
* Checks wp_verify_nonce()
*/
public function handle() {
$path = $this->request->getPathWithoutRoot();
if( ! $this->excludePath($path) ) {
if( ! $this->request->isGet() ) {
$action = sanitize_key($_REQUEST['_tr_nonce_form_action'] ?? '');
$token = $this->request->checkNonce( $action );
if ( ! $token ) {
$this->response->setError('csrf', true);
$this->response->flashNow('Request Failed. Invalid CSRF Token. Try reloading the page or reauthenticate.', 'error');
$this->response->exitAny( 403 );
}
}
}
$this->next->handle();
}
/**
* Check for excluded paths
*
* @param string $path
*
* @return bool
*/
public function excludePath($path)
{
$path = trim($path, '/');
$except = apply_filters('typerocket_verify_nonce_except', $this->except);
foreach ($except as $exclude ) {
$exclude = explode( '/', trim($exclude, '/') );
$explodedPath = explode('/', $path);
$excluding = true;
if( count($explodedPath) == count($exclude) ) {
foreach ($explodedPath as $index => $part) {
/var/webs/kontrafunk-app/webroot/wp-content/mu-plugins/typerocket/vendor/typerocket/core/src/Http/Stack.php
}
/**
* Handle
*
* @param Request $request
* @param Response $response
* @param ControllerContainer $client
* @param mixed $handler
*
* @throws \Exception
*/
public function handle($request, $response, $client, $handler)
{
foreach($this->middleware as $class) {
/** @var Middleware $client */
$client = new $class($request, $response, $client, $handler);
}
$client->handle();
}
/**
* Set Middleware
*
* @param array $middleware
*/
public function setMiddleware(array $middleware)
{
$this->middleware = $middleware;
}
/**
* Get Middleware
*
* @return array
*/
public function getMiddleware()
{
return $this->middleware;
/var/webs/kontrafunk-app/webroot/wp-content/mu-plugins/typerocket/vendor/typerocket/core/src/Http/HttpKernel.php
* @param Response $response
* @param Handler $handler
*/
public function __construct(Request $request, Response $response, Handler $handler)
{
$this->response = $response;
$this->request = $request;
$this->handler = $handler;
do_action('typerocket_kernel', $this);
}
/**
* Run Kernel
* @throws \Exception
*/
public function run()
{
$this->controller = new ControllerContainer($this->request, $this->response, $this->handler);
$stack = new Stack( $this, $this->compileMiddleware() );
$stack->handle($this->request, $this->response, $this->controller, $this->handler);
}
/**
* Compile middleware from controller, router and kernel
*/
public function compileMiddleware() : array
{
$stacks = [];
// Route middleware
$route = $this->handler->getRoute();
if(!empty($route) && $route->middleware) {
if(!is_array($route->middleware)) {
$route->middleware = [$route->middleware];
}
$routeMiddleware = [];
foreach ($route->middleware as $m) {
if(is_string($m) && !empty($this->middleware[$m])) {
/var/webs/kontrafunk-app/webroot/wp-content/mu-plugins/typerocket/vendor/typerocket/core/src/Http/Responders/Responder.php
* Respond
*
* @param array $args
* @return mixed
*/
abstract function respond( $args );
/**
* Run the Kernel
*
* @param Request $request
* @param Response $response
* @param Handler $handler
*/
public function runKernel(Request $request, Response $response, Handler $handler )
{
try {
$Kernel = \TypeRocket\Utility\Helper::appNamespace("Http\\Kernel");
$this->kernel = new $Kernel( $request, $response, $handler);
$this->kernel->run();
} catch (\Throwable $e ) {
$code = $e->getCode();
if($e instanceof RedirectError) {
$errorRedirect = $e->redirect();
$response->setStatus(302);
$response->setReturn($errorRedirect)->finish();
}
if(!$e instanceof \Requests_Exception_HTTP) {
$code = 500;
\TypeRocket\Utility\Helper::reportError($e);
}
$response->setStatus($code);
if($request->isMarkedAjax() || $request->wants('json')) {
$response->exitJson();
}
/var/webs/kontrafunk-app/webroot/wp-content/mu-plugins/typerocket/vendor/typerocket/core/src/Http/Responders/HttpResponder.php
use TypeRocket\Http\Request;
class HttpResponder extends Responder
{
/**
* Respond to custom requests
*
* Create proper request and run through Kernel
*
* @param array $args
*/
public function respond( $args )
{
$request = new Request;
$response = \TypeRocket\Http\Response::getFromContainer();
$this->handler->setArgs($args);
$this->runKernel($request, $response, $this->handler);
}
}
/var/webs/kontrafunk-app/webroot/wp-content/mu-plugins/typerocket/vendor/typerocket/core/src/Http/Router.php
}
if($redirect) {
$redirect = Str::replaceFirst($requestedPath, $redirect, $this->request->getUri());
$redirect = apply_filters('typerocket_route_redirect', $redirect, $this, $wpTrailingslash);
if($redirect) {
wp_redirect($redirect, 301);
die();
}
}
$responder = new HttpResponder;
$responder
->getHandler()
->setRoute( $this->route )
->setController( $this->route->do );
$responder->respond( $this->args );
\TypeRocket\Http\Response::getFromContainer()->finish();
}
/**
* Route request through registered routes if these is a match
* @return Router
*/
public function detectRoute()
{
$root = $this->config['root'] ?? get_site_url();
$routesRegistered = $this->routes->getRegisteredRoutes($this->request->getFormMethod());
$this->path = $this->request->getPathWithoutRoot($root);
if( $this->matchRoute($this->path, $routesRegistered) ) {
add_filter( 'redirect_canonical', [$this, 'redirectCanonical'] , 10, 2);
}
return $this;
}
/var/webs/kontrafunk-app/webroot/wp-content/mu-plugins/typerocket/vendor/typerocket/core/src/Http/Router.php
*/
public function __construct($request, $config, RouteCollection $routes)
{
$this->request = $request;
$this->config = $config;
$this->routes = $routes;
}
/**
* Init Hooks
*
* @return $this
*/
public function initHooks()
{
if( ! is_admin() ) {
// template_include is needed to keep admin bar
add_filter('template_include', function( $template ) {
if( $this->route ) {
$this->runRoute();
}
return $template;
});
add_filter( 'query_vars', function($vars) {
$vars[] = 'tr_route_var';
return $vars;
} );
add_filter( 'posts_request', function($sql, $q) {
/** @var WP_Query $q */
if ( $q->is_main_query() && !empty($q->query['tr_route_var']) ) {
// disable row count
$q->query_vars['no_found_rows'] = true;
// disable cache
$q->query_vars['cache_results'] = false;
$q->query_vars['update_post_meta_cache'] = false;
$q->query_vars['update_post_term_cache'] = false;
/var/webs/kontrafunk-app/webroot/wp-includes/class-wp-hook.php
$this->iterations[ $nesting_level ] = $this->priorities;
$num_args = count( $args );
do {
$this->current_priority[ $nesting_level ] = current( $this->iterations[ $nesting_level ] );
$priority = $this->current_priority[ $nesting_level ];
foreach ( $this->callbacks[ $priority ] as $the_ ) {
if ( ! $this->doing_action ) {
$args[0] = $value;
}
// Avoid the array_slice() if possible.
if ( 0 === $the_['accepted_args'] ) {
$value = call_user_func( $the_['function'] );
} elseif ( $the_['accepted_args'] >= $num_args ) {
$value = call_user_func_array( $the_['function'], $args );
} else {
$value = call_user_func_array( $the_['function'], array_slice( $args, 0, $the_['accepted_args'] ) );
}
}
} while ( false !== next( $this->iterations[ $nesting_level ] ) );
unset( $this->iterations[ $nesting_level ] );
unset( $this->current_priority[ $nesting_level ] );
--$this->nesting_level;
return $value;
}
/**
* Calls the callback functions that have been added to an action hook.
*
* @since 4.7.0
*
* @param array $args Parameters to pass to the callback functions.
/var/webs/kontrafunk-app/webroot/wp-includes/plugin.php
$all_args = func_get_args(); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection
_wp_call_all_hook( $all_args );
}
if ( ! isset( $wp_filter[ $hook_name ] ) ) {
if ( isset( $wp_filter['all'] ) ) {
array_pop( $wp_current_filter );
}
return $value;
}
if ( ! isset( $wp_filter['all'] ) ) {
$wp_current_filter[] = $hook_name;
}
// Pass the value to WP_Hook.
array_unshift( $args, $value );
$filtered = $wp_filter[ $hook_name ]->apply_filters( $value, $args );
array_pop( $wp_current_filter );
return $filtered;
}
/**
* Calls the callback functions that have been added to a filter hook, specifying arguments in an array.
*
* @since 3.0.0
*
* @see apply_filters() This function is identical, but the arguments passed to the
* functions hooked to `$hook_name` are supplied using an array.
*
* @global WP_Hook[] $wp_filter Stores all of the filters and actions.
* @global int[] $wp_filters Stores the number of times each filter was triggered.
* @global string[] $wp_current_filter Stores the list of current filters with the current one last.
*
* @param string $hook_name The name of the filter hook.
* @param array $args The arguments supplied to the functions hooked to `$hook_name`.
/var/webs/kontrafunk-app/webroot/wp-includes/template-loader.php
if ( 'is_attachment' === $tag ) {
remove_filter( 'the_content', 'prepend_attachment' );
}
break;
}
}
if ( ! $template ) {
$template = get_index_template();
}
/**
* Filters the path of the current template before including it.
*
* @since 3.0.0
*
* @param string $template The path of the template to include.
*/
$template = apply_filters( 'template_include', $template );
if ( $template ) {
include $template;
} elseif ( current_user_can( 'switch_themes' ) ) {
$theme = wp_get_theme();
if ( $theme->errors() ) {
wp_die( $theme->errors() );
}
}
return;
}
/var/webs/kontrafunk-app/webroot/wp-blog-header.php
<?php
/**
* Loads the WordPress environment and template.
*
* @package WordPress
*/
if ( ! isset( $wp_did_header ) ) {
$wp_did_header = true;
// Load the WordPress library.
require_once __DIR__ . '/wp-load.php';
// Set up the WordPress query.
wp();
// Load the theme template.
require_once ABSPATH . WPINC . '/template-loader.php';
}
/var/webs/kontrafunk-app/webroot/index.php
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define( 'WP_USE_THEMES', true );
/** Loads the WordPress Environment and Template */
require __DIR__ . '/wp-blog-header.php';