return $instance;
}
if (static::isStrictModeEnabled()) {
throw new InvalidFormatException(implode(PHP_EOL, $lastErrors['errors']));
}
return false;
}
public static function createFromFormat($format, $time, $tz = null)
{
$function = static::$createFromFormatFunction;
if (!$function) {
return static::rawCreateFromFormat($format, $time, $tz);
}
if (\is_string($function) && method_exists(static::class, $function)) {
$function = [static::class, $function];
}
$time = get_field('starts_at_time', $this->event->ID);
if ($time) {
return Carbon::createFromFormat('Y-m-d H:i:s', get_field('starts_at', $this->event->ID).' '.$time, wp_timezone_string());
}
return Carbon::createFromFormat('Y-m-d', get_field('starts_at', $this->event->ID), wp_timezone_string())->setTime(0, 0, 0, 0);
}
public function getEnd() : Carbon|null
{
$endsAt = get_field('ends_at', $this->event->ID);
return false;
}
// If has no end date, treat end as start dates time 23:59:59
if (!$end) {
$start = $this->getStart();
$end = Carbon::createFromFormat('Y-m-d H:i:s', $start->format('Y-m-d').' 23:59:59', wp_timezone_string());
if ($end->isPast()) {
return false;
}
}
return false;
}
public function is_registration_open($event_id) {
return (new \App\Event($event_id))->isRegistrationOpen();
}
public function is_event_over() {
$current_date = wp_date('Y-m-d');
'is_user_registered' => $this->get_is_user_registered(),
'registration_url' => $this->get_registration_url($post->ID),
'unregister_url' => add_query_arg(['id' => $post->ID, 'event-unregister' => 1], get_permalink()),
'registered_users' => $this->get_registered_users($post->ID),
'is_event_over' => $this->is_event_over(),
'is_registration_open' => $this->is_registration_open($post->ID),
'message' => $this->get_message(),
'error' => $this->get_error(),
];
}
protected function merge()
{
return array_merge(
$this->with(),
$this->view->getData(),
$this->override()
);
}
/**
* Data to be passed to view before rendering
public function compose(View $view)
{
$this->view = $view;
$this->data = new Fluent($view->getData());
$view->with($this->merge());
}
/**
* Data to be merged and passed to the view before rendering.
*
// Once we have the class and method name, we can build the Closure to resolve
// the instance out of the IoC container and call the method on it with the
// given arguments that are passed to the Closure as the composer's data.
return function () use ($class, $method) {
return $this->container->make($class)->{$method}(...func_get_args());
};
}
/**
* Parse a class based composer name.
return function ($event, $payload) use ($listener, $wildcard) {
if ($wildcard) {
return $listener($event, $payload);
}
return $listener(...array_values($payload));
};
}
/**
* Create a class based listener using the IoC container.
}
$responses = [];
foreach ($this->getListeners($event) as $listener) {
$response = $listener($event, $payload);
// If a response is returned from the listener and event halting is enabled
// we will just return this response, and not call the rest of the event
// listeners. Otherwise we will add the response on the response list.
if ($halt && ! is_null($response)) {
* @param \Illuminate\Contracts\View\View $view
* @return void
*/
public function callComposer(ViewContract $view)
{
$this->events->dispatch('composing: '.$view->name(), [$view]);
}
/**
* Call the creator for a given view.
*
// We will keep track of the number of views being rendered so we can flush
// the section after the complete rendering operation is done. This will
// clear out the sections for any separate views that may be rendered.
$this->factory->incrementRender();
$this->factory->callComposer($this);
$contents = $this->getContents();
// Once we've finished rendering the view, we'll decrement the render count
// so that each section gets flushed out next time a view is created and
* @throws \Throwable
*/
public function render(callable $callback = null)
{
try {
$contents = $this->renderContents();
$response = isset($callback) ? $callback($this, $contents) : null;
// Once we have the contents of the view, we will flush the sections if we are
// done rendering all views so that there is nothing left hanging over when
<body <?php body_class(); ?>>
<?php wp_body_open(); ?>
<?php do_action('get_header'); ?>
<div id="app">
<?php echo view(app('sage.view'), app('sage.data'))->render(); ?>
</div>
<?php do_action('get_footer'); ?>
<?php wp_footer(); ?>
</body>
*
* @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() );
}
// Set up the WordPress query.
wp();
// Load the theme template.
require_once ABSPATH . WPINC . '/template-loader.php';
}
* @var bool
*/
define( 'WP_USE_THEMES', true );
/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/core/wp-blog-header.php' );
InvalidFormatException
|
---|
Carbon\Exceptions\InvalidFormatException: Data missing at /mnt/www/html/wp-content/themes/infohunt/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php:687 at Carbon\Carbon::rawCreateFromFormat() (/mnt/www/html/wp-content/themes/infohunt/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php:710) at Carbon\Carbon::createFromFormat() (/mnt/www/html/wp-content/themes/infohunt/app/events.php:116) at App\Event->getStart() (/mnt/www/html/wp-content/themes/infohunt/app/events.php:348) at App\Event->isRegistrationOpen() (/mnt/www/html/wp-content/themes/infohunt/app/View/Composers/Event.php:341) at App\View\Composers\Event->is_registration_open() (/mnt/www/html/wp-content/themes/infohunt/app/View/Composers/Event.php:65) at App\View\Composers\Event->override() (/mnt/www/html/wp-content/themes/infohunt/vendor/roots/acorn/src/Roots/Acorn/View/Composer.php:72) at Roots\Acorn\View\Composer->merge() (/mnt/www/html/wp-content/themes/infohunt/vendor/roots/acorn/src/Roots/Acorn/View/Composer.php:59) at Roots\Acorn\View\Composer->compose() (/mnt/www/html/wp-content/themes/infohunt/vendor/illuminate/view/Concerns/ManagesEvents.php:124) at Illuminate\View\Factory->Illuminate\View\Concerns\{closure}() (/mnt/www/html/wp-content/themes/infohunt/vendor/illuminate/events/Dispatcher.php:421) at Illuminate\Events\Dispatcher->Illuminate\Events\{closure}() (/mnt/www/html/wp-content/themes/infohunt/vendor/illuminate/events/Dispatcher.php:249) at Illuminate\Events\Dispatcher->dispatch() (/mnt/www/html/wp-content/themes/infohunt/vendor/illuminate/view/Concerns/ManagesEvents.php:177) at Illuminate\View\Factory->callComposer() (/mnt/www/html/wp-content/themes/infohunt/vendor/illuminate/view/View.php:176) at Illuminate\View\View->renderContents() (/mnt/www/html/wp-content/themes/infohunt/vendor/illuminate/view/View.php:147) at Illuminate\View\View->render() (/mnt/www/html/wp-content/themes/infohunt/index.php:14) at include('/mnt/www/html/wp-content/themes/infohunt/index.php') (/mnt/www/html/core/wp-includes/template-loader.php:106) at require_once('/mnt/www/html/core/wp-includes/template-loader.php') (/mnt/www/html/core/wp-blog-header.php:19) at require('/mnt/www/html/core/wp-blog-header.php') (/mnt/www/html/index.php:17) |