diff --git a/README.md b/README.md new file mode 100644 index 0000000..5fe9ab4 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Eve_simple_spoiler_ext diff --git a/simplespoiler/composer.json b/simplespoiler/composer.json new file mode 100644 index 0000000..1abadbd --- /dev/null +++ b/simplespoiler/composer.json @@ -0,0 +1,45 @@ +{ + "name": "alfredoramos/simplespoiler", + "type": "phpbb-extension", + "description": "Simple Spoiler BBCode extension for phpBB", + "homepage": "https://github.com/AlfredoRamos/phpbb-ext-simple-spoiler", + "version": "2.3.2", + "time": "2020-10-12", + "keywords": [ + "phpbb", + "extension", + "spoiler", + "bbcode", + "html5" + ], + "license": "GPL-2.0-only", + "authors": [ + { + "name": "Alfredo Ramos", + "email": "alfredo.ramos@yandex.com", + "homepage": "https://alfredoramos.mx/", + "role": "Lead Developer" + } + ], + "require": { + "php": "^7.1.3", + "composer/installers": "~1.0.0", + "phpbb/phpbb": "~3.3.0" + }, + "require-dev": { + "phing/phing": "^2.16.0", + "pear/archive_tar": "^1.4.0" + }, + "extra": { + "display-name": "Simple Spoiler BBCode", + "soft-require": { + "phpbb/phpbb": "~3.3.0" + }, + "version-check": { + "host": "www.phpbb.com", + "directory": "/customise/db/extension/simple_spoiler_bbcode", + "filename": "version_check", + "ssl": true + } + } +} \ No newline at end of file diff --git a/simplespoiler/config/services.yml b/simplespoiler/config/services.yml new file mode 100644 index 0000000..9d9ac64 --- /dev/null +++ b/simplespoiler/config/services.yml @@ -0,0 +1,21 @@ +services: + alfredoramos.simplespoiler.listener: + class: alfredoramos\simplespoiler\event\listener + arguments: + - '@alfredoramos.simplespoiler.helper' + tags: + - { name: event.listener } + + alfredoramos.simplespoiler.helper: + class: alfredoramos\simplespoiler\includes\helper + arguments: + - '@dbal.conn' + - '@filesystem' + - '@language' + - '@template' + - '@config' + - '@text_formatter.utils' + - '@ext.manager' + - '%core.root_path%' + - '%core.php_ext%' + - '%tables.bbcodes%' diff --git a/simplespoiler/event/listener.php b/simplespoiler/event/listener.php new file mode 100644 index 0000000..c903c3f --- /dev/null +++ b/simplespoiler/event/listener.php @@ -0,0 +1,165 @@ + + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +namespace alfredoramos\simplespoiler\event; + +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use alfredoramos\simplespoiler\includes\helper as helper; + +class listener implements EventSubscriberInterface +{ + /** @var \alfredoramos\simplespoiler\includes\helper */ + protected $helper; + + /** + * Listener constructor. + * + * @param \alfredoramos\simplespoiler\includes\helper $helper + * + * @return void + */ + public function __construct(helper $helper) + { + $this->helper = $helper; + } + + /** + * Assign functions defined in this class to event listeners in the core. + * + * @return array + */ + static public function getSubscribedEvents() + { + return [ + 'core.user_setup' => 'user_setup', + 'core.text_formatter_s9e_configure_after' => 'configure_spoiler', + 'core.text_formatter_s9e_parse_after' => 'parser_check_message', + 'core.help_manager_add_block_before' => 'bbcode_help', + 'core.acp_board_config_edit_add' => 'acp_config_add', + 'core.posting_modify_template_vars' => 'posting_template_vars', + 'alfredoramos.seometadata.clean_description_after' => 'clean_description_after' + ]; + } + + /** + * Load language files and modify user data on every page. + * + * @param object $event + * + * @return void + */ + public function user_setup($event) + { + $lang_set_ext = $event['lang_set_ext']; + $lang_set_ext[] = [ + 'ext_name' => 'alfredoramos/simplespoiler', + 'lang_set' => 'posting' + ]; + $event['lang_set_ext'] = $lang_set_ext; + } + + /** + * Add BBCode. + * + * @param object $event + * + * @return void + */ + public function configure_spoiler($event) + { + $configurator = $event['configurator']; + $spoiler = $this->helper->bbcode_data(); + + // Spoiler data must not be empty + if (empty($spoiler) || + empty($spoiler['bbcode_tag']) || + empty($spoiler['bbcode_match']) || + empty($spoiler['bbcode_tpl'])) + { + return; + } + + // Remove previous definitions + unset( + $configurator->BBCodes[$spoiler['bbcode_tag']], + $configurator->tags[$spoiler['bbcode_tag']] + ); + + // Create spoiler BBCode + $configurator->BBCodes->addCustom( + $spoiler['bbcode_match'], + $spoiler['bbcode_tpl'] + ); + } + + /** + * Remove spoilers that are nested too deep. + * + * @param object $event + * + * @return void + */ + public function parser_check_message($event) + { + $event['xml'] = $this->helper->remove_nested_spoilers($event['xml']); + } + + /** + * Add a new BBCode FAQ entry. + * + * @param object $event + * + * @return void + */ + public function bbcode_help($event) + { + $this->helper->add_bbcode_help($event['block_name']); + } + + /** + * Add ACP configuration data. + * + * @param object $event + * + * @return void + */ + public function acp_config_add($event) + { + if ($event['mode'] !== 'post') + { + return; + } + + $event['display_vars'] = $this->helper->add_acp_config($event['display_vars']); + } + + /** + * Add posting template variables. + * + * @param object $event + * + * @return void + */ + public function posting_template_vars($event) + { + $event['page_data'] = $this->helper->posting_template_vars($event['page_data']); + } + + /** + * Remove spoilers from post description. + * + * @param object $event + * + * @return void + */ + public function clean_description_after($event) + { + $event['description'] = $this->helper->remove_description_spoilers($event['description']); + } +} diff --git a/simplespoiler/ext.php b/simplespoiler/ext.php new file mode 100644 index 0000000..809f927 --- /dev/null +++ b/simplespoiler/ext.php @@ -0,0 +1,25 @@ + + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +namespace alfredoramos\simplespoiler; + +use phpbb\extension\base; + +class ext extends base +{ + /** + * Check whether or not the extension can be enabled. + * + * @return bool + */ + public function is_enableable() + { + return phpbb_version_compare(PHPBB_VERSION, '3.3.0', '>='); + } +} diff --git a/simplespoiler/includes/helper.php b/simplespoiler/includes/helper.php new file mode 100644 index 0000000..cf7df34 --- /dev/null +++ b/simplespoiler/includes/helper.php @@ -0,0 +1,463 @@ + + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +namespace alfredoramos\simplespoiler\includes; + +use phpbb\db\driver\factory as database; +use phpbb\filesystem\filesystem; +use phpbb\language\language; +use phpbb\template\template; +use phpbb\config\config; +use phpbb\textformatter\s9e\utils; +use phpbb\extension\manager as ext_manager; + +class helper +{ + /** @var \phpbb\db\driver\factory */ + protected $db; + + /** @var \phpbb\filesystem\filesystem */ + protected $filesystem; + + /** @var \phpbb\language\language */ + protected $language; + + /** @var \phpbb\template\template */ + protected $template; + + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\textformatter\s9e\utils */ + protected $utils; + + /** @var \phpbb\extension\manager */ + protected $ext_manager; + + /** @var string */ + protected $root_path; + + /** @var string */ + protected $php_ext; + + /** @var \acp_bbcodes */ + protected $acp_bbcodes; + + /** @var array */ + protected $tables; + + /** + * Constructor of the helper class. + * + * @param \phpbb\db\driver\factory $db + * @param \phpbb\filesystem\filesystem $filesystem + * @param \phpbb\language\language $language + * @param \phpbb\template\template $template + * @param \phpbb\config\config $config + * @param \phpbb\textformatter\s9e\utils $utils + * @param \phpbb\extension\manager $ext_manager + * @param string $root_path + * @param string $php_ext + * @param string $bbcodes_table + * + * @return void + */ + public function __construct(database $db, filesystem $filesystem, language $language, template $template, config $config, utils $utils, ext_manager $ext_manager, $root_path, $php_ext, $bbcodes_table) + { + $this->db = $db; + $this->filesystem = $filesystem; + $this->language = $language; + $this->template = $template; + $this->config = $config; + $this->utils = $utils; + $this->ext_manager = $ext_manager; + $this->root_path = $root_path; + $this->php_ext = $php_ext; + + // Assign tables + if (empty($this->tables)) + { + $this->tables = [ + 'bbcodes' => $bbcodes_table + ]; + } + } + + /** + * Install the new BBCode adding it in the database or updating it if it already exists. + * + * @return void + */ + public function install_bbcode() + { + $data = $this->bbcode_data(); + + if (empty($data)) + { + return; + } + + // Lazy load BBCodes helper + if (!isset($this->acp_bbcodes)) + { + if (!class_exists('acp_bbcodes')) + { + include($this->root_path . 'includes/acp/acp_bbcodes.' . $this->php_ext); + } + + $this->acp_bbcodes = new \acp_bbcodes; + } + + // Remove conflicting BBCode + $this->remove_bbcode('spoiler='); + + $data['bbcode_id'] = (int) $this->bbcode_id(); + $data = array_replace( + $data, + $this->acp_bbcodes->build_regexp( + $data['bbcode_match'], + $data['bbcode_tpl'] + ) + ); + + // Get old BBCode ID + $old_bbcode_id = (int) $this->bbcode_exists($data['bbcode_tag']); + + // Update or add BBCode + if ($old_bbcode_id > NUM_CORE_BBCODES) + { + $this->update_bbcode($old_bbcode_id, $data); + } + else + { + $this->add_bbcode($data); + } + } + + /** + * Uninstall the BBCode from the database. + * + * @return void + */ + public function uninstall_bbcode() + { + $this->remove_bbcode('spoiler'); + } + + /** + * Check whether BBCode already exists. + * + * @param string $bbcode_tag + * + * @return integer + */ + public function bbcode_exists($bbcode_tag = '') + { + if (empty($bbcode_tag)) + { + return -1; + } + + $sql = 'SELECT bbcode_id + FROM ' . $this->tables['bbcodes'] . ' + WHERE ' . $this->db->sql_build_array('SELECT', ['bbcode_tag' => $bbcode_tag]); + $result = $this->db->sql_query($sql); + $bbcode_id = (int) $this->db->sql_fetchfield('bbcode_id'); + $this->db->sql_freeresult($result); + + // Set invalid index if BBCode doesn't exist to avoid + // getting the first record of the table + $bbcode_id = $bbcode_id > NUM_CORE_BBCODES ? $bbcode_id : -1; + + return $bbcode_id; + } + + /** + * Calculate the ID for the BBCode that is about to be installed. + * + * @return integer + */ + public function bbcode_id() + { + $sql = 'SELECT MAX(bbcode_id) as last_id + FROM ' . $this->tables['bbcodes']; + $result = $this->db->sql_query($sql); + $bbcode_id = (int) $this->db->sql_fetchfield('last_id'); + $this->db->sql_freeresult($result); + $bbcode_id += 1; + + if ($bbcode_id <= NUM_CORE_BBCODES) + { + $bbcode_id = NUM_CORE_BBCODES + 1; + } + + return $bbcode_id; + } + + + /** + * Add the BBCode in the database. + * + * @param array $data + * + * @return void + */ + public function add_bbcode($data = []) + { + if (empty($data) || + (!empty($data['bbcode_id']) && (int) $data['bbcode_id'] > BBCODE_LIMIT)) + { + return; + } + + $sql = 'INSERT INTO ' . $this->tables['bbcodes'] . ' + ' . $this->db->sql_build_array('INSERT', $data); + $this->db->sql_query($sql); + + } + + /** + * Remove BBCode by tag. + * + * @param string $bbcode_tag + * + * @return void + */ + public function remove_bbcode($bbcode_tag = '') + { + if (empty($bbcode_tag)) + { + return; + } + + $bbcode_id = (int) $this->bbcode_exists($bbcode_tag); + + // Remove only if exists + if ($bbcode_id > NUM_CORE_BBCODES) + { + $sql = 'DELETE FROM ' . $this->tables['bbcodes'] . ' + WHERE bbcode_id = ' . $bbcode_id; + $this->db->sql_query($sql); + } + } + + /** + * Update BBCode data if it already exists. + * + * @param integer $bbcode_id + * @param array $data + * + * @return void + */ + public function update_bbcode($bbcode_id = -1, $data = []) + { + $bbcode_id = (int) $bbcode_id; + + if ($bbcode_id <= NUM_CORE_BBCODES || empty($data)) + { + return; + } + + unset($data['bbcode_id']); + + $sql = 'UPDATE ' . $this->tables['bbcodes'] . ' + SET ' . $this->db->sql_build_array('UPDATE', $data) . ' + WHERE bbcode_id = ' . $bbcode_id; + $this->db->sql_query($sql); + } + + /** + * Add a new entry in the BBCode FAQ. + * + * @param string $block_name + * + * @return void + */ + public function add_bbcode_help($block_name = '') + { + if (empty($block_name) || $block_name !== 'HELP_BBCODE_BLOCK_OTHERS') + { + return; + } + + // Load language keys + $this->language->add_lang('help/bbcode', 'alfredoramos/simplespoiler'); + + // FAQ helper, it just stores language keys + $faq = [ + 'title' => 'HELP_BBCODE_BLOCK_SPOILERS', + 'questions' => [ + 'HELP_BBCODE_SPOILERS_BASIC_QUESTION' => 'HELP_BBCODE_SPOILERS_BASIC_ANSWER', + 'HELP_BBCODE_SPOILERS_TITLE_QUESTION' => 'HELP_BBCODE_SPOILERS_TITLE_ANSWER' + ] + ]; + + // Add help block + $this->template->assign_block_vars('faq_block', [ + 'BLOCK_TITLE' => $this->language->lang($faq['title']), + 'SWITCH_COLUMN' => false + ]); + + // Arguments for functions generate_text_for_{storage,display}() + $uid = $bitfield = $flags = null; + + // Generate questions and answers + foreach ($faq['questions'] as $key => $value) + { + $has_title = (strpos($key, 'TITLE') !== false); + $text = sprintf( + '[spoiler%2$s]%1$s[/spoiler]', + $this->language->lang('HELP_BBCODE_SPOILERS_DEMO_BODY'), + $has_title ? sprintf(' title=%s', $this->language->lang('HELP_BBCODE_SPOILERS_DEMO_TITLE')) : '' + ); + generate_text_for_storage($text, $uid, $bitfield, $flags, true, true, true); + $parsed_text = generate_text_for_display($text, $uid, $bitfield, $flags); + + $this->template->assign_block_vars('faq_block.faq_row', [ + 'FAQ_QUESTION' => $this->language->lang($key), + 'FAQ_ANSWER' => $this->language->lang( + $value, + $parsed_text, + $this->language->lang('HELP_BBCODE_SPOILERS_DEMO_BODY'), + ($has_title ? $this->language->lang('HELP_BBCODE_SPOILERS_DEMO_TITLE') : null) + ) + ]); + } + } + + /** + * Add ACP configuration data. + * + * @param array $display_vars + * + * @return array + */ + public function add_acp_config($display_vars = []) + { + if (empty($display_vars) || empty($display_vars['vars'])) + { + return []; + } + + if (!function_exists('phpbb_insert_config_array')) + { + include($this->root_path . 'includes/functions_acp.' . $this->php_ext); + } + + $display_vars['vars'] = phpbb_insert_config_array( + $display_vars['vars'], + [ + 'max_spoiler_depth' => [ + 'lang' => 'SPOILER_DEPTH_LIMIT', + 'validate' => 'int:0:9999', + 'type' => 'number:0:9999', + 'explain' => true + ] + ], + ['after' => 'max_quote_depth'] + ); + + return $display_vars; + } + + /** + * Remove nested spoilers at given depth. + * + * @param string $xml + * + * @return string + */ + public function remove_nested_spoilers($xml = '') + { + if (empty($xml)) + { + return ''; + } + + $max_depth = (int) $this->config['max_spoiler_depth']; + + if ($max_depth <= 0) + { + return $xml; + } + + return $this->utils->remove_bbcode($xml, 'SPOILER', $max_depth); + } + + /** + * Remove spoilers from post description. + * + * @param string $description + * + * @see \alfredoramos\seometadata\includes\helper::clean_description() + * + * @return string + */ + public function remove_description_spoilers($description = '') + { + if (empty($description)) + { + return ''; + } + + // Remove spoilers at any depth + return $this->utils->remove_bbcode($description, 'SPOILER', 0); + } + + /** + * Set template variable for ABBC3 icon type. + * + * @param array $template_vars + * + * @return array + */ + public function posting_template_vars($template_vars = []) + { + if (empty($template_vars) || !$this->ext_manager->is_enabled('vse/abbc3') || empty($this->config['abbc3_icons_type'])) + { + return $template_vars; + } + + return array_merge($template_vars, [ + 'SIMPLE_SPOILER_ABBC3_ICON_TYPE' => $this->config['abbc3_icons_type'] + ]); + } + + /** + * BBCode data used in the migration files. + * + * @return array + */ + public function bbcode_data() + { + // Return absolute path if file exists + $xsl = $this->filesystem->realpath( + __DIR__ . '/../styles/all/template/spoiler.xsl' + ); + + // Store the (trimmed) file content if it is readable + $template = $this->filesystem->is_readable($xsl) ? trim(file_get_contents($xsl)) : ''; + + // The spoiler template should not be empty + if (empty($template)) + { + return []; + } + + return [ + 'bbcode_tag' => 'spoiler', + 'bbcode_match' => '[spoiler={PARSE=/(?.+)/} title={TEXT2;optional}]{TEXT1}[/spoiler]', + 'bbcode_tpl' => $template, + + // Kept for backwards compatibility + 'bbcode_helpline' => 'SPOILER_HELPLINE', + 'display_on_posting' => 1 + ]; + } +} diff --git a/simplespoiler/language/en/acp/info_acp_settings.php b/simplespoiler/language/en/acp/info_acp_settings.php new file mode 100644 index 0000000..d635434 --- /dev/null +++ b/simplespoiler/language/en/acp/info_acp_settings.php @@ -0,0 +1,29 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +/** + * @ignore + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * @ignore + */ +if (empty($lang) || !is_array($lang)) +{ + $lang = []; +} + +$lang = array_merge($lang, [ + 'SPOILER_DEPTH_LIMIT' => 'Maximum nesting depth for spoilers', + 'SPOILER_DEPTH_LIMIT_EXPLAIN' => 'Maximum spoiler nesting depth in a post. Set to <samp>0</samp> for unlimited depth.' +]); diff --git a/simplespoiler/language/en/help/bbcode.php b/simplespoiler/language/en/help/bbcode.php new file mode 100644 index 0000000..1961082 --- /dev/null +++ b/simplespoiler/language/en/help/bbcode.php @@ -0,0 +1,37 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +/** + * @ignore + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * @ignore + */ +if (empty($lang) || !is_array($lang)) +{ + $lang = []; +} + +$lang = array_merge($lang, [ + 'HELP_BBCODE_BLOCK_SPOILERS' => 'Generating Spoilers', + + 'HELP_BBCODE_SPOILERS_BASIC_QUESTION' => 'Adding a spoiler into a post', + 'HELP_BBCODE_SPOILERS_BASIC_ANSWER' => 'A basic spoiler consist in a text wrapped in <strong>[spoiler][/spoiler]</strong>. For example:<br><br><strong>[spoiler]</strong>%2$s<strong>[/spoiler]</strong><br><br>This would generate:<br>%1$s', + + 'HELP_BBCODE_SPOILERS_TITLE_QUESTION' => 'Adding a spoiler with title into a post', + 'HELP_BBCODE_SPOILERS_TITLE_ANSWER' => 'A spoiler can optionally show a custom title, to do so the text need to be wrapped in <strong>[spoiler title=][/spoiler]</strong>. For example:<br><br><strong>[spoiler title=</strong>%3$s<strong>]</strong>%2$s<strong>[/spoiler]</strong><br><br>This would generate:<br>%1$s', + + 'HELP_BBCODE_SPOILERS_DEMO_TITLE' => 'Plot summary', + 'HELP_BBCODE_SPOILERS_DEMO_BODY' => 'Details about the movie narrative' +]); diff --git a/simplespoiler/language/en/posting.php b/simplespoiler/language/en/posting.php new file mode 100644 index 0000000..a6afed1 --- /dev/null +++ b/simplespoiler/language/en/posting.php @@ -0,0 +1,29 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +/** + * @ignore + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * @ignore + */ +if (empty($lang) || !is_array($lang)) +{ + $lang = []; +} + +$lang = array_merge($lang, [ + 'SPOILER' => 'Spoiler', + 'SPOILER_HELPLINE' => 'Usage: [spoiler]text[/spoiler] or [spoiler title=title]text[/spoiler]' +]); diff --git a/simplespoiler/language/es/acp/info_acp_settings.php b/simplespoiler/language/es/acp/info_acp_settings.php new file mode 100644 index 0000000..01e0550 --- /dev/null +++ b/simplespoiler/language/es/acp/info_acp_settings.php @@ -0,0 +1,29 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +/** + * @ignore + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * @ignore + */ +if (empty($lang) || !is_array($lang)) +{ + $lang = []; +} + +$lang = array_merge($lang, [ + 'SPOILER_DEPTH_LIMIT' => 'Profundidad máxima de anidamiento para spoilers', + 'SPOILER_DEPTH_LIMIT_EXPLAIN' => 'Profundidad máxima de anidamiento para spoilers por mensaje. Ajuste este valor en <samp>0</samp> para una profundidad ilimitada.' +]); diff --git a/simplespoiler/language/es/help/bbcode.php b/simplespoiler/language/es/help/bbcode.php new file mode 100644 index 0000000..2ab612e --- /dev/null +++ b/simplespoiler/language/es/help/bbcode.php @@ -0,0 +1,37 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +/** + * @ignore + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * @ignore + */ +if (empty($lang) || !is_array($lang)) +{ + $lang = []; +} + +$lang = array_merge($lang, [ + 'HELP_BBCODE_BLOCK_SPOILERS' => 'Creando Spoilers', + + 'HELP_BBCODE_SPOILERS_BASIC_QUESTION' => 'Agregando un spoiler en un mensaje', + 'HELP_BBCODE_SPOILERS_BASIC_ANSWER' => 'Un spoiler básico consiste en texto encapsulado entre las etiquetas <strong>[spoiler][/spoiler]</strong>. Por ejemplo:<br><br><strong>[spoiler]</strong>%2$s<strong>[/spoiler]</strong><br><br>Esto generará:<br>%1$s', + + 'HELP_BBCODE_SPOILERS_TITLE_QUESTION' => 'Agregando un spoiler con título en un mensaje', + 'HELP_BBCODE_SPOILERS_TITLE_ANSWER' => 'Un spoiler opcionalmente puede mostrar un título personalizado, para hacerlo el texto necesita ser encapsulado entre las etiquetas <strong>[spoiler title=][/spoiler]</strong>. Por ejemplo:<br><br><strong>[spoiler title=</strong>%3$s<strong>]</strong>%2$s<strong>[/spoiler]</strong><br><br>Esto generará:<br>%1$s', + + 'HELP_BBCODE_SPOILERS_DEMO_TITLE' => 'Resumen de la trama', + 'HELP_BBCODE_SPOILERS_DEMO_BODY' => 'Detalles de la narrativa de la película' +]); diff --git a/simplespoiler/language/es/posting.php b/simplespoiler/language/es/posting.php new file mode 100644 index 0000000..b1182e2 --- /dev/null +++ b/simplespoiler/language/es/posting.php @@ -0,0 +1,29 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +/** + * @ignore + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * @ignore + */ +if (empty($lang) || !is_array($lang)) +{ + $lang = []; +} + +$lang = array_merge($lang, [ + 'SPOILER' => 'Spoiler', + 'SPOILER_HELPLINE' => 'Uso: [spoiler]texto[/spoiler] o [spoiler title=título]texto[/spoiler]' +]); diff --git a/simplespoiler/language/es_x_tu/acp/info_acp_settings.php b/simplespoiler/language/es_x_tu/acp/info_acp_settings.php new file mode 100644 index 0000000..b009348 --- /dev/null +++ b/simplespoiler/language/es_x_tu/acp/info_acp_settings.php @@ -0,0 +1,29 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +/** + * @ignore + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * @ignore + */ +if (empty($lang) || !is_array($lang)) +{ + $lang = []; +} + +$lang = array_merge($lang, [ + 'SPOILER_DEPTH_LIMIT' => 'Profundidad máxima de anidamiento para spoilers', + 'SPOILER_DEPTH_LIMIT_EXPLAIN' => 'Profundidad máxima de anidamiento para spoilers por mensaje. Ajusta este valor en <samp>0</samp> para una profundidad ilimitada.' +]); diff --git a/simplespoiler/language/es_x_tu/help/bbcode.php b/simplespoiler/language/es_x_tu/help/bbcode.php new file mode 100644 index 0000000..2ab612e --- /dev/null +++ b/simplespoiler/language/es_x_tu/help/bbcode.php @@ -0,0 +1,37 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +/** + * @ignore + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * @ignore + */ +if (empty($lang) || !is_array($lang)) +{ + $lang = []; +} + +$lang = array_merge($lang, [ + 'HELP_BBCODE_BLOCK_SPOILERS' => 'Creando Spoilers', + + 'HELP_BBCODE_SPOILERS_BASIC_QUESTION' => 'Agregando un spoiler en un mensaje', + 'HELP_BBCODE_SPOILERS_BASIC_ANSWER' => 'Un spoiler básico consiste en texto encapsulado entre las etiquetas <strong>[spoiler][/spoiler]</strong>. Por ejemplo:<br><br><strong>[spoiler]</strong>%2$s<strong>[/spoiler]</strong><br><br>Esto generará:<br>%1$s', + + 'HELP_BBCODE_SPOILERS_TITLE_QUESTION' => 'Agregando un spoiler con título en un mensaje', + 'HELP_BBCODE_SPOILERS_TITLE_ANSWER' => 'Un spoiler opcionalmente puede mostrar un título personalizado, para hacerlo el texto necesita ser encapsulado entre las etiquetas <strong>[spoiler title=][/spoiler]</strong>. Por ejemplo:<br><br><strong>[spoiler title=</strong>%3$s<strong>]</strong>%2$s<strong>[/spoiler]</strong><br><br>Esto generará:<br>%1$s', + + 'HELP_BBCODE_SPOILERS_DEMO_TITLE' => 'Resumen de la trama', + 'HELP_BBCODE_SPOILERS_DEMO_BODY' => 'Detalles de la narrativa de la película' +]); diff --git a/simplespoiler/language/es_x_tu/posting.php b/simplespoiler/language/es_x_tu/posting.php new file mode 100644 index 0000000..b1182e2 --- /dev/null +++ b/simplespoiler/language/es_x_tu/posting.php @@ -0,0 +1,29 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +/** + * @ignore + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * @ignore + */ +if (empty($lang) || !is_array($lang)) +{ + $lang = []; +} + +$lang = array_merge($lang, [ + 'SPOILER' => 'Spoiler', + 'SPOILER_HELPLINE' => 'Uso: [spoiler]texto[/spoiler] o [spoiler title=título]texto[/spoiler]' +]); diff --git a/simplespoiler/language/fr/acp/info_acp_settings.php b/simplespoiler/language/fr/acp/info_acp_settings.php new file mode 100644 index 0000000..d98a920 --- /dev/null +++ b/simplespoiler/language/fr/acp/info_acp_settings.php @@ -0,0 +1,29 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +/** + * @ignore + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * @ignore + */ +if (empty($lang) || !is_array($lang)) +{ + $lang = []; +} + +$lang = array_merge($lang, [ + 'SPOILER_DEPTH_LIMIT' => 'Profondeur d\'imbrication maximale pour les spoilers', + 'SPOILER_DEPTH_LIMIT_EXPLAIN' => 'Profondeur maximale d\'imbrication du spoiler dans un post. Définissez à <samp>0</samp> pour une profondeur illimitée.' +]); diff --git a/simplespoiler/language/fr/help/bbcode.php b/simplespoiler/language/fr/help/bbcode.php new file mode 100644 index 0000000..20cf82d --- /dev/null +++ b/simplespoiler/language/fr/help/bbcode.php @@ -0,0 +1,37 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +/** + * @ignore + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * @ignore + */ +if (empty($lang) || !is_array($lang)) +{ + $lang = []; +} + +$lang = array_merge($lang, [ + 'HELP_BBCODE_BLOCK_SPOILERS' => 'Génération de spoilers', + + 'HELP_BBCODE_SPOILERS_BASIC_QUESTION' => 'Ajouter un spoiler dans un message', + 'HELP_BBCODE_SPOILERS_BASIC_ANSWER' => 'Un spoiler de base consiste en un texte contenu dans une balise <strong>[spoiler][/spoiler]</strong>. Par exemple:<br><br><strong>[spoiler]</strong>%2$s<strong>[/spoiler]</strong><br><br>Cela générera<br>%1$s', + + 'HELP_BBCODE_SPOILERS_TITLE_QUESTION' => 'Ajouter un spoiler avec un titre dans un message', + 'HELP_BBCODE_SPOILERS_TITLE_ANSWER' => 'Un spoiler peut éventuellement afficher un titre personnalisé, pour ce faire, le texte doit être contenu dans <strong>[spoiler title=][/spoiler]</strong>. Par exemple:<br><br><strong>[spoiler title=</strong>%3$s<strong>]</strong>%2$s<strong>[/spoiler]</strong><br><br>Cela générera<br>%1$s', + + 'HELP_BBCODE_SPOILERS_DEMO_TITLE' => 'Résumé de l\'intrigue', + 'HELP_BBCODE_SPOILERS_DEMO_BODY' => 'Détails sur le récit du film' +]); diff --git a/simplespoiler/language/fr/posting.php b/simplespoiler/language/fr/posting.php new file mode 100644 index 0000000..7d4eff8 --- /dev/null +++ b/simplespoiler/language/fr/posting.php @@ -0,0 +1,29 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +/** + * @ignore + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * @ignore + */ +if (empty($lang) || !is_array($lang)) +{ + $lang = []; +} + +$lang = array_merge($lang, [ + 'SPOILER' => 'Spoiler', + 'SPOILER_HELPLINE' => 'Utilisation : [spoiler]text[/spoiler] ou [spoiler title=title]text[/spoiler]' +]); diff --git a/simplespoiler/language/he/acp/info_acp_settings.php b/simplespoiler/language/he/acp/info_acp_settings.php new file mode 100644 index 0000000..bf07093 --- /dev/null +++ b/simplespoiler/language/he/acp/info_acp_settings.php @@ -0,0 +1,29 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +/** + * @ignore + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * @ignore + */ +if (empty($lang) || !is_array($lang)) +{ + $lang = []; +} + +$lang = array_merge($lang, [ + 'SPOILER_DEPTH_LIMIT' => 'גודל מקסימלי לתיבות ספוילרים', + 'SPOILER_DEPTH_LIMIT_EXPLAIN' => 'הגודל המקסימלי של תיבות ספויילרים בהודעה. הגדר כ <samp>0</samp> כדי לבטל את ההגבלה.' +]); diff --git a/simplespoiler/language/he/help/bbcode.php b/simplespoiler/language/he/help/bbcode.php new file mode 100644 index 0000000..69aeffb --- /dev/null +++ b/simplespoiler/language/he/help/bbcode.php @@ -0,0 +1,37 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +/** + * @ignore + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * @ignore + */ +if (empty($lang) || !is_array($lang)) +{ + $lang = []; +} + +$lang = array_merge($lang, [ + 'HELP_BBCODE_BLOCK_SPOILERS' => 'מייצר ספויילרים', + + 'HELP_BBCODE_SPOILERS_BASIC_QUESTION' => 'הוסף ספויילר להודעה', + 'HELP_BBCODE_SPOILERS_BASIC_ANSWER' => 'ספויילר בסיסי מוקף בתגים <strong>[spoiler][/spoiler]</strong>. לדוגמה:<br><br><strong>[spoiler]</strong>%2$s<strong>[/spoiler]</strong><br><br> מייצר:<br>%1$s', + + 'HELP_BBCODE_SPOILERS_TITLE_QUESTION' => 'הוספת ספויילר עם כותרת לתוך ההודעה', + 'HELP_BBCODE_SPOILERS_TITLE_ANSWER' => 'ספויילר יכול להכין כותרת מותאמת אישית, כדי לעשות זאת צריך שהטקסט יהיה מוקף ב<strong>[spoiler title=][/spoiler]</strong>. לדוגמה:<br><br><strong>[spoiler title=</strong>%3$s<strong>]</strong>%2$s<strong>[/spoiler]</strong><br><br> יציג על המסך:<br>%1$s', + + 'HELP_BBCODE_SPOILERS_DEMO_TITLE' => 'תקציר העלילה', + 'HELP_BBCODE_SPOILERS_DEMO_BODY' => 'פרטים על עלילת הסרט' +]); diff --git a/simplespoiler/language/he/posting.php b/simplespoiler/language/he/posting.php new file mode 100644 index 0000000..f481586 --- /dev/null +++ b/simplespoiler/language/he/posting.php @@ -0,0 +1,29 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +/** + * @ignore + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * @ignore + */ +if (empty($lang) || !is_array($lang)) +{ + $lang = []; +} + +$lang = array_merge($lang, [ + 'SPOILER' => 'ספויילר', + 'SPOILER_HELPLINE' => 'שימוש: [spoiler]טקסט[/spoiler] או [spoiler title=title]טקסט[/spoiler]' +]); diff --git a/simplespoiler/language/nl/acp/info_acp_settings.php b/simplespoiler/language/nl/acp/info_acp_settings.php new file mode 100644 index 0000000..e8a9b8f --- /dev/null +++ b/simplespoiler/language/nl/acp/info_acp_settings.php @@ -0,0 +1,29 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +/** + * @ignore + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * @ignore + */ +if (empty($lang) || !is_array($lang)) +{ + $lang = []; +} + +$lang = array_merge($lang, [ + 'SPOILER_DEPTH_LIMIT' => 'Maximale nestdiepte voor spoilers', + 'SPOILER_DEPTH_LIMIT_EXPLAIN' => 'Maximale spoiler nestdiepte in een bericht. Zet op <samp>0</samp> voor ongelimiteerde diepte.' +]); diff --git a/simplespoiler/language/nl/help/bbcode.php b/simplespoiler/language/nl/help/bbcode.php new file mode 100644 index 0000000..e88d7c1 --- /dev/null +++ b/simplespoiler/language/nl/help/bbcode.php @@ -0,0 +1,37 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +/** + * @ignore + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * @ignore + */ +if (empty($lang) || !is_array($lang)) +{ + $lang = []; +} + +$lang = array_merge($lang, [ + 'HELP_BBCODE_BLOCK_SPOILERS' => 'Spoilers aanmaken', + + 'HELP_BBCODE_SPOILERS_BASIC_QUESTION' => 'Een spoiler toevoegen aan een bericht', + 'HELP_BBCODE_SPOILERS_BASIC_ANSWER' => 'Een basisspoiler bestaat uit een tekst ingepakt in <strong>[spoiler][/spoiler]</strong>. Bijvoorbeeld:<br><br><strong>[spoiler]</strong>%2$s<strong>[/spoiler]</strong><br><br>Dit zou genereren:<br>%1$s', + + 'HELP_BBCODE_SPOILERS_TITLE_QUESTION' => 'Een spoiler met titel toevoegen aan een bericht', + 'HELP_BBCODE_SPOILERS_TITLE_ANSWER' => 'Een spoiler kan optioneel een aangepaste titel tonen, daarvoor moet de tekst worden ingepakt in <strong>[spoiler title=][/spoiler]</strong>. Bijvoorbeeld:<br><br><strong>[spoiler title=</strong>%3$s<strong>]</strong>%2$s<strong>[/spoiler]</strong><br><br>Dit zou genereren:<br>%1$s', + + 'HELP_BBCODE_SPOILERS_DEMO_TITLE' => 'Plotsamenvatting', + 'HELP_BBCODE_SPOILERS_DEMO_BODY' => 'Details over het verhaal van de film' +]); diff --git a/simplespoiler/language/nl/posting.php b/simplespoiler/language/nl/posting.php new file mode 100644 index 0000000..8b7c6d4 --- /dev/null +++ b/simplespoiler/language/nl/posting.php @@ -0,0 +1,29 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +/** + * @ignore + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * @ignore + */ +if (empty($lang) || !is_array($lang)) +{ + $lang = []; +} + +$lang = array_merge($lang, [ + 'SPOILER' => 'Spoiler', + 'SPOILER_HELPLINE' => 'Gebruik: [spoiler]tekst[/spoiler] of [spoiler title=tittel]tekst[/spoiler]' +]); diff --git a/simplespoiler/language/pt_br/acp/info_acp_settings.php b/simplespoiler/language/pt_br/acp/info_acp_settings.php new file mode 100644 index 0000000..096c71f --- /dev/null +++ b/simplespoiler/language/pt_br/acp/info_acp_settings.php @@ -0,0 +1,29 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +/** + * @ignore + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * @ignore + */ +if (empty($lang) || !is_array($lang)) +{ + $lang = []; +} + +$lang = array_merge($lang, [ + 'SPOILER_DEPTH_LIMIT' => 'Número máximo de spoilers por post', + 'SPOILER_DEPTH_LIMIT_EXPLAIN' => 'Número máximo de spoilers por post, sendo <samp>0</samp> igual a um valor ilimitado.' +]); diff --git a/simplespoiler/language/pt_br/help/bbcode.php b/simplespoiler/language/pt_br/help/bbcode.php new file mode 100644 index 0000000..1a93124 --- /dev/null +++ b/simplespoiler/language/pt_br/help/bbcode.php @@ -0,0 +1,37 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +/** + * @ignore + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * @ignore + */ +if (empty($lang) || !is_array($lang)) +{ + $lang = []; +} + +$lang = array_merge($lang, [ + 'HELP_BBCODE_BLOCK_SPOILERS' => 'Gerando Spoilers', + + 'HELP_BBCODE_SPOILERS_BASIC_QUESTION' => 'Adicionando um spoiler em um post', + 'HELP_BBCODE_SPOILERS_BASIC_ANSWER' => 'Um spoiler básico consiste em um texto contido em <strong>[spoiler][/spoiler]</strong>. Por exemplo:<br><br><strong>[spoiler]</strong>%2$s<strong>[/spoiler]</strong><br><br>Isso geraria:<br>%1$s', + + 'HELP_BBCODE_SPOILERS_TITLE_QUESTION' => 'Adicionando um spoiler com título em um post', + 'HELP_BBCODE_SPOILERS_TITLE_ANSWER' => 'Um spoiler pode, opcionalmente, mostrar um título personalizado. Para isso, o texto precisa ser agrupado em <strong>[spoiler title=][/spoiler]</strong>. Por exemplo:<br><br><strong>[spoiler title=</strong>%3$s<strong>]</strong>%2$s<strong>[/spoiler]</strong><br><br>Isso geraria:<br>%1$s', + + 'HELP_BBCODE_SPOILERS_DEMO_TITLE' => 'Resumo do enredo', + 'HELP_BBCODE_SPOILERS_DEMO_BODY' => 'Detalhes sobre a narrativa do filme' +]); diff --git a/simplespoiler/language/pt_br/posting.php b/simplespoiler/language/pt_br/posting.php new file mode 100644 index 0000000..62d5465 --- /dev/null +++ b/simplespoiler/language/pt_br/posting.php @@ -0,0 +1,29 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +/** + * @ignore + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * @ignore + */ +if (empty($lang) || !is_array($lang)) +{ + $lang = []; +} + +$lang = array_merge($lang, [ + 'SPOILER' => 'Spoiler', + 'SPOILER_HELPLINE' => 'Uso: [spoiler]texto[/spoiler] ou [spoiler=título]texto[/spoiler]' +]); diff --git a/simplespoiler/language/ru/acp/info_acp_settings.php b/simplespoiler/language/ru/acp/info_acp_settings.php new file mode 100644 index 0000000..5c34eb5 --- /dev/null +++ b/simplespoiler/language/ru/acp/info_acp_settings.php @@ -0,0 +1,29 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +/** + * @ignore + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * @ignore + */ +if (empty($lang) || !is_array($lang)) +{ + $lang = []; +} + +$lang = array_merge($lang, [ + 'SPOILER_DEPTH_LIMIT' => 'Максимальная глубина вложенности для спойлеров', + 'SPOILER_DEPTH_LIMIT_EXPLAIN' => 'Максимальная глубина вложенности для спойлеров в сообщениях. Введите <samp>0</samp> для снятия ограничений.' +]); diff --git a/simplespoiler/language/ru/help/bbcode.php b/simplespoiler/language/ru/help/bbcode.php new file mode 100644 index 0000000..0d905a0 --- /dev/null +++ b/simplespoiler/language/ru/help/bbcode.php @@ -0,0 +1,37 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +/** + * @ignore + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * @ignore + */ +if (empty($lang) || !is_array($lang)) +{ + $lang = []; +} + +$lang = array_merge($lang, [ + 'HELP_BBCODE_BLOCK_SPOILERS' => 'Создание спойлеров', + + 'HELP_BBCODE_SPOILERS_BASIC_QUESTION' => 'Добавление спойлера в сообщение', + 'HELP_BBCODE_SPOILERS_BASIC_ANSWER' => 'Простой спойлер состоит из текста, заключенного в теги <strong>[spoiler][/spoiler]</strong>. Например:<br><br><strong>[spoiler]</strong>%2$s<strong>[/spoiler]</strong><br><br>Это выведет:<br>%1$s', + + 'HELP_BBCODE_SPOILERS_TITLE_QUESTION' => 'Добавление спойлера с названием в сообщение', + 'HELP_BBCODE_SPOILERS_TITLE_ANSWER' => 'Спойлер может иметь произвольное название, для этого текст заключается в теги <strong>[spoiler title=][/spoiler]</strong>. Например:<br><br><strong>[spoiler title=</strong>%3$s<strong>]</strong>%2$s<strong>[/spoiler]</strong><br><br>Это выведет:<br>%1$s', + + 'HELP_BBCODE_SPOILERS_DEMO_TITLE' => 'Краткий сюжет', + 'HELP_BBCODE_SPOILERS_DEMO_BODY' => 'Подробности о сюжете фильма' +]); diff --git a/simplespoiler/language/ru/posting.php b/simplespoiler/language/ru/posting.php new file mode 100644 index 0000000..4b98786 --- /dev/null +++ b/simplespoiler/language/ru/posting.php @@ -0,0 +1,29 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +/** + * @ignore + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * @ignore + */ +if (empty($lang) || !is_array($lang)) +{ + $lang = []; +} + +$lang = array_merge($lang, [ + 'SPOILER' => 'Спойлер', + 'SPOILER_HELPLINE' => 'Спойлер: [spoiler]текст[/spoiler] или [spoiler title=заголовок]текст[/spoiler]' +]); diff --git a/simplespoiler/license.txt b/simplespoiler/license.txt new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/simplespoiler/license.txt @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/simplespoiler/migrations/v10x/m1_spoiler_data.php b/simplespoiler/migrations/v10x/m1_spoiler_data.php new file mode 100644 index 0000000..a66a205 --- /dev/null +++ b/simplespoiler/migrations/v10x/m1_spoiler_data.php @@ -0,0 +1,79 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +namespace alfredoramos\simplespoiler\migrations\v10x; + +use phpbb\db\migration\container_aware_migration; +use alfredoramos\simplespoiler\includes\helper as spoiler_helper; + +class m1_spoiler_data extends container_aware_migration +{ + /** @var \alfredoramos\simplespoiler\includes\helper */ + private $spoiler = null; + + /** + * Install BBCode in database. + * + * @return array + */ + public function update_data() + { + return [ + [ + 'custom', + [ + [$this->get_helper(), 'install_bbcode'] + ] + ] + ]; + } + + /** + * Uninstall BBCode from database. + * + * @return array + */ + public function revert_data() + { + return [ + [ + 'custom', + [ + [$this->get_helper(), 'uninstall_bbcode'] + ] + ] + ]; + } + + /** + * Spoiler helper. + * + * @return \alfredoramos\simplespoiler\includes\helper + */ + private function get_helper() + { + if ($this->spoiler === null) + { + $this->spoiler = new spoiler_helper( + $this->container->get('dbal.conn'), + $this->container->get('filesystem'), + $this->container->get('language'), + $this->container->get('template'), + $this->container->get('config'), + $this->container->get('text_formatter.utils'), + $this->container->get('ext.manager'), + $this->container->getParameter('core.root_path'), + $this->container->getParameter('core.php_ext'), + $this->container->getParameter('tables.bbcodes') + ); + } + + return $this->spoiler; + } +} diff --git a/simplespoiler/migrations/v13x/m1_spoiler_data.php b/simplespoiler/migrations/v13x/m1_spoiler_data.php new file mode 100644 index 0000000..e84dcdf --- /dev/null +++ b/simplespoiler/migrations/v13x/m1_spoiler_data.php @@ -0,0 +1,50 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +namespace alfredoramos\simplespoiler\migrations\v13x; + +use phpbb\db\migration\migration; + +class m1_spoiler_data extends migration +{ + /** + * Migration dependencies. + * + * @return array + */ + static public function depends_on() + { + return ['\alfredoramos\simplespoiler\migrations\v10x\m1_spoiler_data']; + } + + /** + * Check if it's already installed. + * + * @return bool + */ + public function effectively_installed() + { + return isset($this->config['max_spoiler_depth']); + } + + /** + * Add Spoiler configuration. + * + * @return array + */ + public function update_data() + { + return [ + [ + 'config.add', + ['max_spoiler_depth', 3] + ] + ]; + } +} diff --git a/simplespoiler/migrations/v20x/m1_spoiler_data.php b/simplespoiler/migrations/v20x/m1_spoiler_data.php new file mode 100644 index 0000000..5c54b06 --- /dev/null +++ b/simplespoiler/migrations/v20x/m1_spoiler_data.php @@ -0,0 +1,72 @@ +<?php + +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +namespace alfredoramos\simplespoiler\migrations\v20x; + +use phpbb\db\migration\container_aware_migration; +use alfredoramos\simplespoiler\includes\helper as spoiler_helper; + +class m1_spoiler_data extends container_aware_migration +{ + /** @var \alfredoramos\simplespoiler\includes\helper */ + private $spoiler = null; + + /** + * Migration dependencies. + * + * @return array + */ + static public function depends_on() + { + return ['\alfredoramos\simplespoiler\migrations\v13x\m1_spoiler_data']; + } + + /** + * Install BBCode in database. + * + * @return array + */ + public function update_data() + { + return [ + [ + 'custom', + [ + [$this->get_helper(), 'uninstall_bbcode'] + ] + ] + ]; + } + + /** + * Spoiler helper. + * + * @return \alfredoramos\simplespoiler\includes\helper + */ + private function get_helper() + { + if ($this->spoiler === null) + { + $this->spoiler = new spoiler_helper( + $this->container->get('dbal.conn'), + $this->container->get('filesystem'), + $this->container->get('language'), + $this->container->get('template'), + $this->container->get('config'), + $this->container->get('text_formatter.utils'), + $this->container->get('ext.manager'), + $this->container->getParameter('core.root_path'), + $this->container->getParameter('core.php_ext'), + $this->container->getParameter('tables.bbcodes') + ); + } + + return $this->spoiler; + } +} diff --git a/simplespoiler/styles/all/template/event/ext_quickreply_editor_buttons_custom_tags_before.html b/simplespoiler/styles/all/template/event/ext_quickreply_editor_buttons_custom_tags_before.html new file mode 100644 index 0000000..9795502 --- /dev/null +++ b/simplespoiler/styles/all/template/event/ext_quickreply_editor_buttons_custom_tags_before.html @@ -0,0 +1 @@ +{% include '@alfredoramos_simplespoiler/spoiler_button.html' ignore missing %} diff --git a/simplespoiler/styles/all/template/event/overall_footer_body_after.html b/simplespoiler/styles/all/template/event/overall_footer_body_after.html new file mode 100644 index 0000000..50ebc4d --- /dev/null +++ b/simplespoiler/styles/all/template/event/overall_footer_body_after.html @@ -0,0 +1,12 @@ +{% if not INCLUDED_DETAILS_POLYFILL_JS %} +{%- if S_ALLOW_CDN -%} +{% INCLUDEJS 'https://unpkg.com/details-element-polyfill@2.4.0/dist/details-element-polyfill.js' %} +{%- else -%} +{% INCLUDEJS '@alfredoramos_simplespoiler/js/details-element-polyfill.min.js' %} +{%- endif -%} +{%- set INCLUDED_DETAILS_POLYFILL_JS = true -%} +{% endif %} +{% if not INCLUDED_SPOILER_JS %} +{% INCLUDEJS '@alfredoramos_simplespoiler/js/spoiler.min.js' %} +{%- set INCLUDED_SPOILER_JS = true -%} +{% endif %} diff --git a/simplespoiler/styles/all/template/event/overall_header_head_append.html b/simplespoiler/styles/all/template/event/overall_header_head_append.html new file mode 100644 index 0000000..b2a2989 --- /dev/null +++ b/simplespoiler/styles/all/template/event/overall_header_head_append.html @@ -0,0 +1,6 @@ +{% if not INCLUDED_SPOILER_CSS %} +{% INCLUDECSS '@alfredoramos_simplespoiler/css/common.min.css' %} +{% INCLUDECSS '@alfredoramos_simplespoiler/css/style.min.css' %} +{% INCLUDECSS '@alfredoramos_simplespoiler/css/colors.min.css' %} +{%- set INCLUDED_SPOILER_CSS = true -%} +{% endif %} diff --git a/simplespoiler/styles/all/template/event/posting_editor_buttons_custom_tags_before.html b/simplespoiler/styles/all/template/event/posting_editor_buttons_custom_tags_before.html new file mode 100644 index 0000000..9795502 --- /dev/null +++ b/simplespoiler/styles/all/template/event/posting_editor_buttons_custom_tags_before.html @@ -0,0 +1 @@ +{% include '@alfredoramos_simplespoiler/spoiler_button.html' ignore missing %} diff --git a/simplespoiler/styles/all/template/event/vse_abbc3_posting_editor_buttons_custom_tags_before.html b/simplespoiler/styles/all/template/event/vse_abbc3_posting_editor_buttons_custom_tags_before.html new file mode 100644 index 0000000..c946a70 --- /dev/null +++ b/simplespoiler/styles/all/template/event/vse_abbc3_posting_editor_buttons_custom_tags_before.html @@ -0,0 +1 @@ +{% include '@alfredoramos_simplespoiler/abbc3_spoiler_button.html' ignore missing %} diff --git a/simplespoiler/styles/all/template/spoiler.xsl b/simplespoiler/styles/all/template/spoiler.xsl new file mode 100644 index 0000000..482436d --- /dev/null +++ b/simplespoiler/styles/all/template/spoiler.xsl @@ -0,0 +1,23 @@ +<details class="spoiler"> + <summary class="spoiler-header"> + <span class="spoiler-title"> + <xsl:choose> + <xsl:when test="@title and string-length(normalize-space(@title)) > 0"> + <xsl:choose> + <xsl:when test="string-length(normalize-space(@title)) > 140"> + <xsl:value-of select="concat(normalize-space(substring(normalize-space(@title), 0, 140)), '…')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="normalize-space(@title)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise>{L_SPOILER}</xsl:otherwise> + </xsl:choose> + </span> + <span class="spoiler-status"> + <i class="icon fa-fw fa-eye" aria-hidden="true"></i> + </span> + </summary> + <div class="spoiler-body"><xsl:apply-templates/></div> +</details> diff --git a/simplespoiler/styles/all/theme/css/common.css b/simplespoiler/styles/all/theme/css/common.css new file mode 100644 index 0000000..70ada72 --- /dev/null +++ b/simplespoiler/styles/all/theme/css/common.css @@ -0,0 +1,65 @@ +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +.spoiler { + overflow: hidden; +} + +.spoiler-header { + display: -ms-flexbox; + display: flex; + -ms-flex-wrap: wrap; + flex-wrap: wrap; + -ms-flex-align: start; + align-items: flex-start; + -ms-flex-pack: justify; + justify-content: space-between; + cursor: pointer; +} + +.spoiler-title { + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + -ms-flex-preferred-size: 0; + flex-basis: 0; + -ms-flex-positive: 1; + flex-grow: 1; + min-width: 0; + max-width: 100%; +} + +.spoiler-status { + margin-left: 3px; + -ms-flex: 0 0 auto; + flex: 0 0 auto; + width: auto; + max-width: 100%; + -ms-flex-item-align: end; + align-self: flex-end; + text-align: center; +} + +.faq details.spoiler { + max-width: 650px; +} + +/* Polyfill */ +.spoiler-header::before { + padding-right: 0; + font-size: 1em; +} + +.spoiler-header::before, +.spoiler[open] > .spoiler-header::before { + content: ''; +} + +/* Chrome */ +.spoiler-header::-webkit-details-marker { + display: none; +} diff --git a/simplespoiler/styles/all/theme/css/common.min.css b/simplespoiler/styles/all/theme/css/common.min.css new file mode 100644 index 0000000..8d6d522 --- /dev/null +++ b/simplespoiler/styles/all/theme/css/common.min.css @@ -0,0 +1 @@ +.spoiler{overflow:hidden}.spoiler-header{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:start;align-items:flex-start;-ms-flex-pack:justify;justify-content:space-between;cursor:pointer}.spoiler-title{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;-ms-flex-preferred-size:0;flex-basis:0;-ms-flex-positive:1;flex-grow:1;min-width:0;max-width:100%}.spoiler-status{margin-left:3px;-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:100%;-ms-flex-item-align:end;align-self:flex-end;text-align:center}.faq details.spoiler{max-width:650px}.spoiler-header::before{padding-right:0;font-size:1em}.spoiler-header::before,.spoiler[open]>.spoiler-header::before{content:''}.spoiler-header::-webkit-details-marker{display:none} diff --git a/simplespoiler/styles/all/theme/images/eye-invisible.svg b/simplespoiler/styles/all/theme/images/eye-invisible.svg new file mode 100644 index 0000000..5d2a6f1 --- /dev/null +++ b/simplespoiler/styles/all/theme/images/eye-invisible.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60"><path fill="#405866" d="M59.994 29.998c.034-.578-.088-1.16-.433-1.647-4.057-5.723-8.759-10.83-14.604-14.95-7.915-5.357-16.99-6.616-25.794-2.436-3.906 1.852-7.413 4.644-10.487 7.564-2.992 2.838-6.217 6.276-8.237 9.827a3.398 3.398 0 00-.437 1.646h.003c-.033.578.089 1.161.434 1.646C4.498 37.37 9.2 42.478 15.044 46.6c7.915 5.353 16.99 6.615 25.794 2.434 3.905-1.852 7.411-4.644 10.486-7.555 2.992-2.838 6.219-6.277 8.237-9.828A3.389 3.389 0 0060 30.006h-.006"/><path fill="#fff" d="M52.913 29.998c.026-.443-.07-.89-.332-1.257-3.101-4.377-6.694-8.278-11.157-11.424-6.048-4.092-12.98-5.05-19.706-1.86-2.983 1.414-5.666 3.548-8.013 5.775C11.42 23.4 8.96 26.03 7.41 28.742A2.577 2.577 0 007.077 30h.005c-.028.44.068.887.33 1.257 3.101 4.374 6.694 8.277 11.158 11.422 6.048 4.091 12.979 5.053 19.707 1.861 2.982-1.415 5.666-3.549 8.011-5.775 2.287-2.167 4.752-4.798 6.294-7.509a2.59 2.59 0 00.334-1.257h-.003"/><path fill="#ccc" d="M20.503 42.68c-4.466-3.145-8.058-7.047-11.157-11.421-.264-.372-.358-.819-.332-1.257h-.003c0-.443.12-.886.333-1.257 1.543-2.713 4.008-5.343 6.292-7.51 2.35-2.227 5.03-4.362 8.013-5.774 2.4-1.14 4.822-1.745 7.226-1.875-3.028-.161-6.112.428-9.156 1.875-2.983 1.412-5.667 3.547-8.013 5.774-2.285 2.167-4.745 4.796-6.295 7.51a2.571 2.571 0 00-.333 1.257h.005c-.028.438.068.885.33 1.257 3.101 4.374 6.694 8.277 11.158 11.422 3.892 2.632 8.148 3.966 12.48 3.736-3.66-.196-7.238-1.496-10.548-3.736"/><path fill="#bcbec0" d="M39.795 42.69c4.466-3.149 8.058-7.049 11.157-11.425.266-.369.359-.815.334-1.255h.002c0-.443-.124-.884-.334-1.258-1.543-2.713-4.009-5.343-6.292-7.51-2.351-2.224-5.03-4.357-8.014-5.774-2.399-1.138-4.823-1.744-7.225-1.875 3.029-.16 6.112.43 9.156 1.875 2.983 1.417 5.657 3.549 8.01 5.775 2.286 2.167 4.752 4.796 6.293 7.509.215.373.337.815.337 1.258h-.008c.03.44-.068.886-.33 1.255-3.099 4.376-6.692 8.277-11.155 11.425-3.89 2.632-8.149 3.965-12.483 3.734 3.664-.196 7.242-1.494 10.552-3.734"/><path fill="#237a99" d="M37.514 30.003a7.516 7.516 0 11-15.031 0 7.516 7.516 0 0115.03 0"/><path fill="#34abc6" d="M29.998 16.45c-7.482 0-13.549 6.067-13.549 13.553 0 7.484 6.067 13.55 13.55 13.55 7.484 0 13.552-6.066 13.552-13.55.001-7.486-6.067-13.553-13.553-13.553m0 21.089a7.391 7.391 0 010-14.782 7.391 7.391 0 110 14.782"/><path fill="#242f35" d="M34.928 30.145A4.926 4.926 0 0130 35.072a4.93 4.93 0 01-4.93-4.927 4.929 4.929 0 119.857 0"/><rect width="6.054" height="70.636" x="40.106" y="-35.318" fill="#405866" rx="2.232" ry="1.149" transform="rotate(45)"/></svg> \ No newline at end of file diff --git a/simplespoiler/styles/all/theme/js/details-element-polyfill.min.js b/simplespoiler/styles/all/theme/js/details-element-polyfill.min.js new file mode 100644 index 0000000..fa13ff8 --- /dev/null +++ b/simplespoiler/styles/all/theme/js/details-element-polyfill.min.js @@ -0,0 +1,21 @@ +/* +Details Element Polyfill 2.4.0 +Copyright © 2019 Javan Makhmali +*/ +(function(){"use strict";var element=document.createElement("details");var elementIsNative=typeof HTMLDetailsElement!="undefined"&&element instanceof HTMLDetailsElement;var support={open:"open"in element||elementIsNative,toggle:"ontoggle"in element};var styles='\ndetails, summary {\n display: block;\n}\ndetails:not([open]) > *:not(summary) {\n display: none;\n}\nsummary::before {\n content: "►";\n padding-right: 0.3rem;\n font-size: 0.6rem;\n cursor: default;\n}\n[open] > summary::before {\n content: "▼";\n}\n';var _ref=[],forEach=_ref.forEach,slice=_ref.slice;if(!support.open){polyfillStyles();polyfillProperties();polyfillToggle();polyfillAccessibility();} +if(support.open&&!support.toggle){polyfillToggleEvent();} +function polyfillStyles(){document.head.insertAdjacentHTML("afterbegin","<style>"+styles+"</style>");} +function polyfillProperties(){var prototype=document.createElement("details").constructor.prototype;var setAttribute=prototype.setAttribute,removeAttribute=prototype.removeAttribute;var open=Object.getOwnPropertyDescriptor(prototype,"open");Object.defineProperties(prototype,{open:{get:function get(){if(this.tagName=="DETAILS"){return this.hasAttribute("open");}else{if(open&&open.get){return open.get.call(this);}}},set:function set(value){if(this.tagName=="DETAILS"){return value?this.setAttribute("open",""):this.removeAttribute("open");}else{if(open&&open.set){return open.set.call(this,value);}}}},setAttribute:{value:function value(name,_value){var _this=this;var call=function call(){return setAttribute.call(_this,name,_value);};if(name=="open"&&this.tagName=="DETAILS"){var wasOpen=this.hasAttribute("open");var result=call();if(!wasOpen){var summary=this.querySelector("summary");if(summary)summary.setAttribute("aria-expanded",true);triggerToggle(this);} +return result;} +return call();}},removeAttribute:{value:function value(name){var _this2=this;var call=function call(){return removeAttribute.call(_this2,name);};if(name=="open"&&this.tagName=="DETAILS"){var wasOpen=this.hasAttribute("open");var result=call();if(wasOpen){var summary=this.querySelector("summary");if(summary)summary.setAttribute("aria-expanded",false);triggerToggle(this);} +return result;} +return call();}}});} +function polyfillToggle(){onTogglingTrigger(function(element){element.hasAttribute("open")?element.removeAttribute("open"):element.setAttribute("open","");});} +function polyfillToggleEvent(){if(window.MutationObserver){new MutationObserver(function(mutations){forEach.call(mutations,function(mutation){var target=mutation.target,attributeName=mutation.attributeName;if(target.tagName=="DETAILS"&&attributeName=="open"){triggerToggle(target);}});}).observe(document.documentElement,{attributes:true,subtree:true});}else{onTogglingTrigger(function(element){var wasOpen=element.getAttribute("open");setTimeout(function(){var isOpen=element.getAttribute("open");if(wasOpen!=isOpen){triggerToggle(element);}},1);});}} +function polyfillAccessibility(){setAccessibilityAttributes(document);if(window.MutationObserver){new MutationObserver(function(mutations){forEach.call(mutations,function(mutation){forEach.call(mutation.addedNodes,setAccessibilityAttributes);});}).observe(document.documentElement,{subtree:true,childList:true});}else{document.addEventListener("DOMNodeInserted",function(event){setAccessibilityAttributes(event.target);});}} +function setAccessibilityAttributes(root){findElementsWithTagName(root,"SUMMARY").forEach(function(summary){var details=findClosestElementWithTagName(summary,"DETAILS");summary.setAttribute("aria-expanded",details.hasAttribute("open"));if(!summary.hasAttribute("tabindex"))summary.setAttribute("tabindex","0");if(!summary.hasAttribute("role"))summary.setAttribute("role","button");});} +function eventIsSignificant(event){return!(event.defaultPrevented||event.ctrlKey||event.metaKey||event.shiftKey||event.target.isContentEditable);} +function onTogglingTrigger(callback){addEventListener("click",function(event){if(eventIsSignificant(event)){if(event.which<=1){var element=findClosestElementWithTagName(event.target,"SUMMARY");if(element&&element.parentNode&&element.parentNode.tagName=="DETAILS"){callback(element.parentNode);}}}},false);addEventListener("keydown",function(event){if(eventIsSignificant(event)){if(event.keyCode==13||event.keyCode==32){var element=findClosestElementWithTagName(event.target,"SUMMARY");if(element&&element.parentNode&&element.parentNode.tagName=="DETAILS"){callback(element.parentNode);event.preventDefault();}}}},false);} +function triggerToggle(element){var event=document.createEvent("Event");event.initEvent("toggle",false,false);element.dispatchEvent(event);} +function findElementsWithTagName(root,tagName){return(root.tagName==tagName?[root]:[]).concat(typeof root.getElementsByTagName=="function"?slice.call(root.getElementsByTagName(tagName)):[]);} +function findClosestElementWithTagName(element,tagName){if(typeof element.closest=="function"){return element.closest(tagName);}else{while(element){if(element.tagName==tagName){return element;}else{element=element.parentNode;}}}}})(); diff --git a/simplespoiler/styles/all/theme/js/spoiler.js b/simplespoiler/styles/all/theme/js/spoiler.js new file mode 100644 index 0000000..3d32a28 --- /dev/null +++ b/simplespoiler/styles/all/theme/js/spoiler.js @@ -0,0 +1,65 @@ +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +(function() { + 'use strict'; + + // Polyfill for Element.matches() + // https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill + if (!Element.prototype.matches) { + Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; + } + + // Polyfill for Element.closest() + // https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill + if (!Element.prototype.closest) { + Element.prototype.closest = function(s) { + let el = this; + + do { + if (el.matches(s)) { + return el; + } + + el = el.parentElement || el.parentNode; + } while (el !== null && el.nodeType === 1); + + return null; + }; + } + + // Toggle status icon + document.body.addEventListener('click', function(e) { + // Trigger event on the spoiler header + if (!e.target.closest('.spoiler-header')) { + return; + } + + // Generate elements + let elements = { + container: e.target.closest('.spoiler') + }; + + if (!elements.container) { + return; + } + + // Status icon + elements.icon = elements.container.querySelector('.spoiler-status > .icon'); + + if (!elements.icon) { + return; + } + + // Check if spoiler is opened + let isOpen = elements.container.hasAttribute('open'); + + // Toggle FontAwesome icon + elements.icon.classList.toggle('fa-eye', isOpen); + elements.icon.classList.toggle('fa-eye-slash', !isOpen); + }); +})(); diff --git a/simplespoiler/styles/all/theme/js/spoiler.min.js b/simplespoiler/styles/all/theme/js/spoiler.min.js new file mode 100644 index 0000000..7dd0c72 --- /dev/null +++ b/simplespoiler/styles/all/theme/js/spoiler.min.js @@ -0,0 +1 @@ +!function(){'use strict';Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(e){let t=this;do{if(t.matches(e))return t;t=t.parentElement||t.parentNode}while(null!==t&&1===t.nodeType);return null}),document.body.addEventListener('click',function(e){if(!e.target.closest('.spoiler-header'))return;let t={container:e.target.closest('.spoiler')};if(!t.container)return;if(t.icon=t.container.querySelector('.spoiler-status > .icon'),!t.icon)return;let o=t.container.hasAttribute('open');t.icon.classList.toggle('fa-eye',o),t.icon.classList.toggle('fa-eye-slash',!o)})}(); diff --git a/simplespoiler/styles/prosilver/template/abbc3_spoiler_button.html b/simplespoiler/styles/prosilver/template/abbc3_spoiler_button.html new file mode 100644 index 0000000..1be2fa3 --- /dev/null +++ b/simplespoiler/styles/prosilver/template/abbc3_spoiler_button.html @@ -0,0 +1 @@ +<button type="button" class="bbcode-spoiler abbc3_button{% if SIMPLE_SPOILER_ABBC3_ICON_TYPE %} icon-type-{{ SIMPLE_SPOILER_ABBC3_ICON_TYPE|lower|striptags|escape }}{% endif %}" name="addspoiler" onclick="bbfontstyle('[spoiler]', '[/spoiler]');" title="{{ lang('SPOILER_HELPLINE')|striptags|escape }}" accesskey="e"></button> diff --git a/simplespoiler/styles/prosilver/template/spoiler_button.html b/simplespoiler/styles/prosilver/template/spoiler_button.html new file mode 100644 index 0000000..eb2ea14 --- /dev/null +++ b/simplespoiler/styles/prosilver/template/spoiler_button.html @@ -0,0 +1,3 @@ +<button type="button" class="button button-icon-only bbcode-spoiler" name="addspoiler" value="{{ lang('SPOILER')|striptags|escape }}" onclick="bbfontstyle('[spoiler]', '[/spoiler]');" title="{{ lang('SPOILER_HELPLINE')|striptags|escape }}" accesskey="e"> + <i class="icon fa-fw fa-eye-slash" aria-hidden="true"></i> +</button> diff --git a/simplespoiler/styles/prosilver/theme/css/colors.css b/simplespoiler/styles/prosilver/theme/css/colors.css new file mode 100644 index 0000000..c8461be --- /dev/null +++ b/simplespoiler/styles/prosilver/theme/css/colors.css @@ -0,0 +1,33 @@ +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +details.spoiler { + background-color: #fff; +} + +details.spoiler, +.spoiler-header { + border-color: #ddd; +} + +.spoiler-header { + background-color: #f3f3f3; + color: #333; +} + +.spoiler-status { + background-color: #d9534f; +} + +.spoiler-status, +.spoiler-status > .icon { + color: #fff; +} + +details.spoiler[open] > .spoiler-header > .spoiler-status { + background-color: #5cb85c; +} diff --git a/simplespoiler/styles/prosilver/theme/css/colors.min.css b/simplespoiler/styles/prosilver/theme/css/colors.min.css new file mode 100644 index 0000000..05c560e --- /dev/null +++ b/simplespoiler/styles/prosilver/theme/css/colors.min.css @@ -0,0 +1 @@ +details.spoiler{background-color:#fff}details.spoiler,.spoiler-header{border-color:#ddd}.spoiler-header{background-color:#f3f3f3;color:#333}.spoiler-status{background-color:#d9534f}.spoiler-status,.spoiler-status>.icon{color:#fff}details.spoiler[open]>.spoiler-header>.spoiler-status{background-color:#5cb85c} diff --git a/simplespoiler/styles/prosilver/theme/css/style.css b/simplespoiler/styles/prosilver/theme/css/style.css new file mode 100644 index 0000000..4977cd1 --- /dev/null +++ b/simplespoiler/styles/prosilver/theme/css/style.css @@ -0,0 +1,52 @@ +/** + * Simple Spoiler extension for phpBB. + * @author Alfredo Ramos <alfredo.ramos@yandex.com> + * @copyright 2017 Alfredo Ramos + * @license GPL-2.0-only + */ + +details.spoiler { + border-width: 1px; + border-style: solid; + margin: 1em 0; +} + +details.spoiler .spoiler:last-child { + margin-bottom: 5px; +} + +details.spoiler, +.spoiler-header { + padding: 3px 5px; +} + +.spoiler, +.spoiler-status { + border-radius: 4px; +} + +.spoiler-header { + margin: -3px -5px; +} + +.spoiler[open] > .spoiler-header { + margin-bottom: 5px; + border-width: 0 0 1px; + border-style: solid; +} + +.spoiler-status { + padding: 1px 4px; +} + +.bbcode-spoiler.abbc3_button { + background-image: url('../../../all/theme/images/eye-invisible.svg'); + background-size: contain; + background-position: center; + background-repeat: no-repeat; +} + +.bbcode-spoiler.abbc3_button.icon-type-svg { + -webkit-filter: grayscale(1); + filter: grayscale(1); +} diff --git a/simplespoiler/styles/prosilver/theme/css/style.min.css b/simplespoiler/styles/prosilver/theme/css/style.min.css new file mode 100644 index 0000000..045e16b --- /dev/null +++ b/simplespoiler/styles/prosilver/theme/css/style.min.css @@ -0,0 +1 @@ +details.spoiler{border-width:1px;border-style:solid;margin:1em 0}details.spoiler .spoiler:last-child{margin-bottom:5px}details.spoiler,.spoiler-header{padding:3px 5px}.spoiler,.spoiler-status{border-radius:4px}.spoiler-header{margin:-3px -5px}.spoiler[open]>.spoiler-header{margin-bottom:5px;border-width:0 0 1px;border-style:solid}.spoiler-status{padding:1px 4px}.bbcode-spoiler.abbc3_button{background-image:url("../../../all/theme/images/eye-invisible.svg");background-size:contain;background-position:center;background-repeat:no-repeat}.bbcode-spoiler.abbc3_button.icon-type-svg{-webkit-filter:grayscale(1);filter:grayscale(1)}