Enqueue styles/scripts.

@since 170218.31677 Scripts/styles.

@param string $caller `__METHOD__`.
@param array  $data   Library data.

@return array Reverberated `$data`.
541341
public function enqueueLibs(string $caller, array $data)
    {
        if (!$data) {
            return []; // No data.
        } // Data cannot be empty here.
        // Empty data would cause `did*()` functions
        // to return an empty array, which is unexpected!

        foreach ($data['styles'] ?? [] as $_handle => $_style) {
            if (!$_handle || !is_string($_handle)) {
                continue; // Invalid handle.
            }
            $_version = $_style['version'] ?? '';
            $_ver     = $_style['ver'] ?? null;

            $_url     = $_style['url'] ?? '';
            $_sri     = $_style['sri'] ?? null;
            $_media   = $_style['media'] ?? 'all';

            $_deps    = $_style['deps'] ?? [];

            $_inline  = $_style['inline'] ?? '';

            if ($_version && $_url) { // Version in URL?
                $_url = sprintf($_url, urlencode($_version));
            }
            if ($_url) { // Only if there is a URL to register.
                wp_register_style($_handle, $_url, $_deps, $_ver, $_media);
            }// If no URL, enqueue handle only.

            wp_enqueue_style($_handle); // Immediately.

            if ($_inline) { // Inline styles also?
                wp_add_inline_style($_handle, $_inline);
            }
            $this->did_enqueue_styles[$_handle] = [
                'version' => $_version,
                'ver'     => $_ver,

                'url'     => $_url,
                'sri'     => $_sri,
                'media'   => $_media,

                'deps'    => $_deps,

                'inline'  => $_inline,
            ];
        } // unset($_handle, $_script, $_version, $_ver, $_url, $_deps, $_media, $_inline);

        foreach ($data['scripts'] ?? [] as $_handle => $_script) {
            if (!$_handle || !is_string($_handle)) {
                continue; // Invalid handle.
            }
            $_version   = $_script['version'] ?? '';
            $_ver       = $_script['ver'] ?? null;

            $_url       = $_script['url'] ?? '';
            $_sri       = $_script['sri'] ?? null;

            $_deps      = $_script['deps'] ?? [];

            $_in_footer = $_script['in_footer'] ?? true;
            $_async     = $_script['async'] ?? false;
            $_defer     = $_script['defer'] ?? false;

            $_inline    = $_script['inline'] ?? '';
            $_localize  = $_script['localize'] ?? [];

            if ($_version && $_url) { // Version in URL?
                $_url = sprintf($_url, urlencode($_version));
            }
            if ($_url) { // Only if there is a URL to register.
                wp_register_script($_handle, $_url, $_deps, $_ver, $_in_footer);
            }// If no URL, enqueue handle only.

            wp_enqueue_script($_handle); // Immediately.

            if ($_inline) { // Inline scripting also?
                wp_add_inline_script($_handle, $_inline);
            }
            if (!empty($_localize['key']) && array_key_exists('data', $_localize)) {
                wp_localize_script($_handle, $_localize['key'], $_localize['data']);
            }
            $this->did_enqueue_scripts[$_handle] = [
                'version'   => $_version,
                'ver'       => $_ver,

                'url'       => $_url,
                'sri'       => $_sri,

                'deps'      => $_deps,

                'in_footer' => $_in_footer,
                'async'     => $_async,
                'defer'     => $_defer,

                'inline'    => $_inline,
                'localize'  => $_localize,
            ];
        } // unset($_handle, $_script, $_version, $_ver, $_url, $_deps, $_in_footer, $_localize);

        return $this->did_enqueue_libs[$caller] = $data;
    }
91793
public function group($data, $callback = null)
    {
        if (is_callable($data)) {
            $callback = $data;
            $data = null;
        }

        if ($data) {
            $this->prefix[] = $data;
        }

        call_user_func($callback, $this);

        if ($data) {
            array_pop($this->prefix);
        }
    }
429076
public function inline($what = null, $data = null, $return = false) {
        // not supported?
        if(!in_array($what, ['style', 'script']))
            throw new Exception("{$what} not supported");

        // call private function
        $function = '_inline' . ucfirst($what);
        $data = $this->$function($data);

        // return or output?
        if($return) return $data;
        echo $data;
    }
575765
public function wpEnqueueScript($handle, $src = '', $deps = [], $ver = false, $inFooter = false)
    {
        return $this->callGlobalFunction('wp_enqueue_script', [$handle, $src, $deps, $ver, $inFooter]);
    }
72948
protected function createPayload($job, $data = '', $queue = null)
	{
		if ($job instanceof Closure)
		{
			return json_encode($this->createClosurePayload($job, $data));
		}
		elseif (is_object($job))
		{
			return json_encode([
				'job' => 'Illuminate\Queue\CallQueuedHandler@call',
				'data' => ['command' => serialize(clone $job)],
			]);
		}

		return json_encode($this->createPlainPayload($job, $data));
	}
206030
protected function createListenerAndJob($class, $method, $arguments)
    {
        $listener = (new ReflectionClass($class))->newInstanceWithoutConstructor();

        return [$listener, $this->propogateListenerOptions(
            $listener,
            new CallQueuedListener($class, $method, $arguments)
        )];
    }
742374
public function store($caller, array $parameters = [])
    {
        $this->forget('all', ['columns' => ['*']]);

        $cacheKey = $this->cacheKey($caller, $parameters);

        return $this->cache()->remember($cacheKey, $this->lifetime, function () use ($caller, $parameters) {
            return call_user_func_array([$this->repository->mediator, 'database'], [$caller, $parameters]);
        });
    }
25740
protected function expandWithPriority(
        ListenerInterface $listener,
        /*# string */ $eventName,
        $data
    )/*# : array */ {
        if (is_array($data) && is_int($data[1])) {
            $callable = $this->expandCallable($listener, $data[0]);
            $priority = $data[1];
            $scope = isset($data[2]) ? $data[2] : null;
        } else {
            $callable = $this->expandCallable($listener, $data);
            $priority = 0; // default
            $scope = null;
        }
        return [$eventName, $callable, $priority, $scope];
    }
244238
protected function callDisplayCallbacks($value, $key)
    {
        foreach ($this->displayCallbacks as $callback) {
            $previous = $value;

            $callback = $this->bindOriginalRowModel($callback, $key);
            $value = call_user_func_array($callback, [$value, $this]);

            if (($value instanceof static) &&
                ($last = array_pop($this->displayCallbacks))
            ) {
                $last = $this->bindOriginalRowModel($last, $key);
                $value = call_user_func($last, $previous);
            }
        }

        return $value;
    }
776927
public static function copyFile($files, $dataPost, $caller) {

        $manager = $caller->managers()->getDalInstance("Document");
        $manager->setRootDirectory($caller->app()->config()->get(\Puzzlout\Framework\Enums\AppSettingKeys::RootDocumentUpload));
        $manager->setWebDirectory($caller->app()->config()->get(\Puzzlout\Framework\Enums\AppSettingKeys::BaseUrl) . $caller->app()->config()->get(\Puzzlout\Framework\Enums\AppSettingKeys::RootUploadsFolderPath));
        $directory = str_replace("_id", "", $dataPost['itemCategory']);
        $manager->setObjectDirectory($directory);
        if ($dataPost['itemReplace'] === "true") {
            $manager->selectManyByCategoryAndId($dataPost['itemCategory'], $dataPost['itemId']);
        }
        $manager->setFilenamePrefix($dataPost['itemId'] . '_');
        $document = new \Applications\EasyMvc\Models\Dao\Document();
        $document->setDocument_category($dataPost['itemCategory']);
        if (isset($dataPost['title']) && $dataPost['title'] != "") {
            $document->setDocument_title($dataPost['title']);
        } else {
            $document->setDocument_title($files['file']['name']);
        }

        $manager->copyWithFile($document, $files['file']);
    }
610430
public function loop($data, Closure $callback)
    {
        TypeChecker::isIterable($data);

        foreach ($data as $key => $value) {
            $builder = new static();
            $callback($builder, $value, $key);
            $this->addNotification($builder->getNotification());
        }

        return $this;
    }
1092309
public function queue($view, array $data, $callback, $queue = null)
    {
        $callback = $this->buildQueueCallable($callback);

        return $this->queue->push('mailer@handleQueuedMessage', compact('view', 'data', 'callback'), $queue);
    }
473947
public static function findFirst(array $data, callable $callback = null)
    {
        $results = static::find($data, $callback, false, 0, 1);

        return count($results) ? $results[0] : null;
    }
280414
public function call($method, $data)
    {
        try {
            $response = $this->http->request('POST', $method, [
                'headers' => [
                    'X-Viber-Auth-Token' => $this->token
                ],
                'json' => $data
            ]);
            return \Viber\Api\Response::create($response);
        } catch (\RuntimeException $e) {
            throw new ApiException($e->getMessage(), $e->getCode(), $e);
        }
    }
417003
public function refresh($caller, array $parameters = [])
    {
        $cacheKey = $this->cacheKey($caller, $parameters);

        $this->cache()->forget($cacheKey);

        return $this->store($caller, $parameters);
    }
34355
public function cacheKey($caller, array $parameters = [])
    {
        $parameters = compact('caller', 'parameters');

        if ($this->repository->model instanceof Eloquent || $this->repository->model instanceof Builder) {
            $parameters['eager'] = md5(serialize($this->repository->with));
        }

        if ($this->repository->mediator->criteria()->hasCriteria()) {
            $parameters['criteria'] = md5(serialize($this->repository->mediator->criteria()->getCriterias()));
        }

        return md5(serialize($parameters));
    }
1049714
public function trigger( $key, $caller = NULL, $arguments = NULL ){
		if( !( $events = $this->getBoundEvents( $key, TRUE ) ) )
			return NULL;
		$this->removeStopMark( $key );
		foreach( $events as $callback ){
			if( in_array( $key, $this->stopped ) )
				continue;
			$event	= new ADT_Event_Data( $this );
			$event->key			= $callback[0];
			$event->trigger		= $key;
			$event->caller		= $caller;
			$event->data		= $callback[1]->getData();
			$event->arguments	= $arguments;
			$result			= call_user_func( $callback[1]->getCallback(), $event );
			if( $result === FALSE )
				return FALSE;
		}
		return TRUE;
	}