/var/www/vhosts/ihelp.ro/httpdocs/vendor/mirko-pagliai/me-tools/src/View/Helper
NameSizeModeActions
AddButtonClassesTrait.php24000644editdlrm
BreadcrumbsHelper.php39780644editdlrm
DropdownHelper.php40920644editdlrm
FormHelper.php134400644editdlrm
HtmlHelper.php109430644editdlrm
IconHelper.php32180644editdlrm
LibraryHelper.php59250644editdlrm
PaginatorHelper.php36080644editdlrm
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/mirko-pagliai/me-tools/src/View/Helper/LibraryHelper.php (5925B)
output; } /** * Constructor hook method. * * Implement this method to avoid having to overwrite the constructor and call parent. * @param array $config The configuration settings provided to this helper * @return void * @since 2.18.0 */ public function initialize(array $config): void { parent::initialize($config); if (Plugin::getCollection()->has('Assets')) { /** @var \Assets\View\Helper\AssetHelper $asset */ $asset = $this->getView()->loadHelper('Assets.Asset'); } $this->Asset = $asset ?? clone $this->Html; } /** * Before layout callback. beforeLayout is called before the layout is rendered * @return void */ public function beforeLayout(): void { if (!$this->output) { return; } //Writes the output $output = array_map(fn(string $output): string => ' ' . $output, $this->output); $this->Html->scriptBlock('$(function() {' . PHP_EOL . implode(PHP_EOL, $output) . PHP_EOL . '});', ['block' => 'script_bottom']); //Resets the output $this->output = []; } /** * Loads all CKEditor scripts. * * To know how to install and configure CKEditor, please refer to the `README.md` file. * * CKEditor must be located into `APP/webroot/ckeditor`. * * To create an input field for CKEditor, you should use the `ckeditor()` method provided by the `FormHelper`. * @param bool $jquery `true` if you want to use the jQuery adapter * @return void * @throws \Tools\Exception\NotReadableException * @see http://docs.cksource.com CKEditor documentation * @see \MeTools\View\Helper\FormHelper::ckeditor() */ public function ckeditor(bool $jquery = false): void { Exceptionist::isReadable(WWW_ROOT . 'ckeditor' . DS . 'ckeditor.js'); $scripts = ['/ckeditor/ckeditor']; //Checks for the jQuery adapter if ($jquery && is_readable(WWW_ROOT . 'ckeditor' . DS . 'adapters' . DS . 'jquery.js')) { $scripts[] = '/ckeditor/adapters/jquery'; } /** * Checks the init file `APP/webroot/js/ckeditor_init.php` or `APP/webroot/js/ckeditor_init.js`. * Otherwise, it uses the init file `APP/plugin/MeTools/webroot/js/ckeditor_init.js`. */ $init = 'MeTools.ckeditor_init.php?type=js'; if (is_readable(WWW_ROOT . 'js' . DS . 'ckeditor_init.php')) { $init = 'ckeditor_init.php?type=js'; } elseif (is_readable(WWW_ROOT . 'js' . DS . 'ckeditor_init.js')) { $init = 'ckeditor_init'; } $this->Html->script([...$scripts, $init], ['block' => 'script_bottom']); } /** * Loads all fancybox files * @return void * @throws \Throwable * @link https://fancyapps.com/fancybox/3 fancybox documentation */ public function fancybox(): void { $this->Html->css('/vendor/fancyapps-fancybox/jquery.fancybox.min', ['block' => 'css_bottom']); $scripts = ['/vendor/fancyapps-fancybox/jquery.fancybox.min']; //Checks the init file inside `APP/webroot/js/`. if (is_readable(WWW_ROOT . 'js' . DS . 'fancybox_init.js')) { $scripts[] = 'fancybox_init'; } $this->Asset->script($scripts, ['block' => 'script_bottom']); } /** * Create a script block for Shareaholic. * * Note that this code only adds the Shareaholic "setup code". * To render the "share buttons", you have to use the `HtmlHelper`. * @param string $siteId Shareaholic site ID * @return string|null Html code * @see \MeTools\View\Helper\HtmlHelper::shareaholic() */ public function shareaholic(string $siteId): ?string { return $this->Html->script('https://dsms0mj1bbhn4.cloudfront.net/assets/pub/shareaholic.js', [ 'async' => 'async', 'block' => 'script_bottom', 'data-cfasync' => 'false', 'data-shr-siteid' => $siteId, ]); } /** * Through `slugify.js`, it provides the slug of a field. * * It reads the value of the `$sourceField` field and sets its slug to the `$targetField`. * @param string $sourceField Source field * @param string $targetField Target field * @return void * @throws \Throwable */ public function slugify(string $sourceField = 'form #title', string $targetField = 'form #slug'): void { $this->Asset->script('MeTools.slugify', ['block' => 'script_bottom']); $this->output[] = sprintf('$().slugify("%s", "%s");', $sourceField, $targetField); } }