<?php class TD_Shortcode extends Module { public function __construct() { $this->name = 'td_shortcode'; $this->tab = 'front_office_feature'; $this->version = 1.0; $this->author = 'Tung Dao'; $this->need_instance = 0; parent::__construct(); $this->displayName = $this->l('Shortcode plugin for Prestashop CMS Content.'); $this->description = $this->l('Supported: , [slide] and [module].'); // The module could be initialized multiple times, this guard make sure // the plugins only be registered with Smarty once. if (!self::$initialized) { self::$initialized = true; $smarty->registerPlugin('modifier', $smarty->registerPlugin('modifier', } } public function install() { if (parent::install() == false || $this->registerHook('displayHeader') == false) { return false; } return true; } public function hookDisplayHeader() {} /** * [b] shortcode * * Usage: [b]Some text */ public function smarty_modifier_b($content) { } protected function render_b($text) { } /** * [module] shortcode. * Inspired by <a href="http://www.ecartservice.net/prestashop-articles/tired-of-hooks-try-a-plugin-prestashop-1-4/" target="_blank">http://www.ecartservice.net/prestashop-art...prestashop-1-4/</a> * * Usage: [module name="" hook="" ...] */ public function smarty_modifier_module($content) { } protected function render_module($text) { $params = $this->parse_shortcode_atts($text[2]); $params['cookie'] = $cookie; $params['cart'] = $cart; $params['altern'] = 1; $output = ''; $instance = Module::getInstanceByName($params['name']); return $output; } protected function parse_shortcode_atts($text) { // Copied from Wordpress // <a href="https://core.trac.wordpress.org/browser/tags/3.9.1/src/wp-includes/shortcodes.php#L306" target="_blank">https://core.trac.wordpress.org/browser/tag...tcodes.php#L306</a> $pattern = '/(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/'; foreach ($match as $m) { } } else { } return $atts; } }
Jednak dostaje komunikat:
td_shortcode (parse error in /modules/td_shortcode/td_shortcode.php)
td_shortcode (class missing in /modules/td_shortcode/td_shortcode.php)
niestety bez podanych linii błędów, mógłby ktoś rzucić okiem na to?