initial commit: Easy Import / Export [NAT] for OpenCart 4.0.x
This commit is contained in:
commit
0f031e5660
|
|
@ -0,0 +1,109 @@
|
||||||
|
=============================================================================
|
||||||
|
Easy Import/Export [NAT]
|
||||||
|
Version: 1.0.0
|
||||||
|
Compatibility: OpenCart 3.0.x / ocStore 3.0.x
|
||||||
|
Author: NAT
|
||||||
|
Support: info@nat.od.ua
|
||||||
|
=============================================================================
|
||||||
|
|
||||||
|
---------------------------------------------------------
|
||||||
|
🇷🇺 РУССКИЙ ЯЗЫК
|
||||||
|
---------------------------------------------------------
|
||||||
|
УСТАНОВКА:
|
||||||
|
1. В админ-панели OpenCart перейдите в раздел "Модули / Расширения" -> "Установка расширений". Загрузите архив `easy_import_export_nat_OC_30_1_0.ocmod.zip`.
|
||||||
|
2. Перейдите в "Модули / Расширения" -> "Модификаторы" и нажмите синюю кнопку "Обновить" (Очистить кэш).
|
||||||
|
3. Перейдите в "Система" -> "Пользователи" -> "Группы пользователей", выберите вашу группу (Administrator), нажмите "Выделить все" в правах просмотра и изменения, затем сохраните.
|
||||||
|
4. Перейдите в "Модули / Расширения" -> "Расширения" -> тип "Модули", найдите "Easy Import/Export [NAT]" и нажмите "Установить", затем "Редактировать".
|
||||||
|
|
||||||
|
ОБНОВЛЕНИЕ:
|
||||||
|
1. Загрузите новый архив через "Установка расширений" поверх старого.
|
||||||
|
2. Обновите кэш в разделе "Модификаторы".
|
||||||
|
3. Очистите кэш браузера (Ctrl+F5) на странице настроек модуля.
|
||||||
|
|
||||||
|
УДАЛЕНИЕ:
|
||||||
|
1. Перейдите в "Модули / Расширения", найдите модуль и нажмите красную кнопку "Деинсталлировать".
|
||||||
|
2. Перейдите в "Установка расширений", найдите модуль в истории загрузок и удалите его файлы.
|
||||||
|
3. Обновите кэш модификаторов.
|
||||||
|
|
||||||
|
КЛЮЧЕВЫЕ ФУНКЦИИ И ВОЗМОЖНОСТИ:
|
||||||
|
* Интерактивное превью: При загрузке файла или получении по ссылке модуль моментально выводит таблицу с первыми 5 строками. Это позволяет визуально проверить структуру данных и соответствие колонок перед запуском импорта.
|
||||||
|
* Умное автосопоставление: Автоматическая привязка колонок прайс-листа к полям OpenCart (Модель, SKU, Цена, Количество, Статус) по встроенным словарям синонимов, защищенная от дублирования связей.
|
||||||
|
* Живые счетчики импорта: Панель импорта в реальном времени отображает ход работы (Всего строк, Обновлено товаров, Не найдено в каталоге, Пропущено).
|
||||||
|
* Условные модификаторы цен и остатков: Тонкая настройка правил (например, "Если цена меньше 100 — умножить остаток на 2") с WAF-совместимыми кодами сравнения (eq, ne, gt, lt), которые не блокируются серверами хостинга.
|
||||||
|
* Парсер ссылок Google Sheets: Автоматическое определение ссылок совместного доступа Google Таблиц и их конвертация в прямую WAF-безопасную ссылку на CSV экспорт.
|
||||||
|
* Интеграция с REST API поставщиков [BETA]: Встроенный гибкий клиент, поддерживающий GET/POST запросы, авторизацию Basic/Bearer/Custom POST Token, постраничную пагинацию или пагинацию со смещением, а также потоковую memory-safe запись JSON/XML ответов на диск.
|
||||||
|
|
||||||
|
КАК РАБОТАТЬ С МОДУЛЕМ:
|
||||||
|
1. Вкладка "Настройки": Управление лицензией, отображение быстрых кнопок действий в каталоге и редакторах, пути для экспорта.
|
||||||
|
2. Вкладка "Экспорт": Выгрузка данных в CSV, XML, JSON или Excel. Настройка идентификаторов, фильтров категорий/производителей и формул модификации перед скачиванием.
|
||||||
|
3. Вкладка "Импорт": Загрузка файлов или указание ссылок, настройка соответствия колонок по превью и запуск импорта с живой статистикой.
|
||||||
|
4. Вкладка "Автоимпорт (CRON)": Создание множественных задач для автоматического обновления цен и остатков по расписанию с индивидуальными настройками связей и условных модификаторов.
|
||||||
|
|
||||||
|
|
||||||
|
---------------------------------------------------------
|
||||||
|
🇬🇧 ENGLISH
|
||||||
|
---------------------------------------------------------
|
||||||
|
INSTALLATION:
|
||||||
|
1. Go to OpenCart admin panel: "Extensions" -> "Installer".
|
||||||
|
2. Upload the `easy_import_export_nat_OC_30_1_0.ocmod.zip` archive.
|
||||||
|
3. Go to "Extensions" -> "Modifications" and click the blue "Refresh" button.
|
||||||
|
4. Go to "System" -> "Users" -> "User Groups", edit your group (Top Administrator), click "Select All" for Access and Modify permissions, then Save.
|
||||||
|
5. Go to "Extensions" -> "Extensions" -> choose "Modules", find "Easy Import/Export [NAT]", click "Install" and then "Edit".
|
||||||
|
|
||||||
|
UPDATE:
|
||||||
|
1. Upload the new zip file via Extension Installer over the old one.
|
||||||
|
2. Refresh modifications cache.
|
||||||
|
3. Hard refresh your browser cache (Ctrl+F5) on the module settings page.
|
||||||
|
|
||||||
|
UNINSTALLATION:
|
||||||
|
1. Go to Extensions -> Modules, click the red "Uninstall" button next to the module.
|
||||||
|
2. Go to the Extension Installer history and delete the module files.
|
||||||
|
3. Refresh modifications cache.
|
||||||
|
|
||||||
|
KEY FEATURES:
|
||||||
|
* Interactive Pre-upload Preview: Displays a 5-row preview table immediately after file upload or URL fetch to verify data structure and mapping presets.
|
||||||
|
* Smart Auto-mapping: Auto-detects columns using synonym dictionaries for standard OpenCart fields (Model, SKU, Price, Qty, Status) without mapping collisions.
|
||||||
|
* Live Import Dashboard: Monitors import runs in real-time, showing count tiles for Total, Updated, Not Found, and Skipped products.
|
||||||
|
* Conditional Modifiers: Setup robust target-modifier conditions (e.g. "If Price lt 100 -> Qty * 2") using WAF-safe alphanumeric operators (eq, ne, gt, lt).
|
||||||
|
* Google Sheets Link Converter: Automatically transforms shared Google Sheets URLs into direct CSV export endpoints.
|
||||||
|
* Supplier REST API Client [BETA]: Built-in flexible client supporting GET/POST requests, Basic/Bearer/Custom POST Token auth, offset/page-based paginations, and memory-safe streaming of JSON/XML payloads.
|
||||||
|
|
||||||
|
HOW TO USE:
|
||||||
|
1. "Settings" Tab: Manage license, paths, and visibility of Fast Import/Export catalog action buttons.
|
||||||
|
2. "Export" Tab: Dump product data to CSV, XML, JSON, or Excel with custom filters, fields, and pricing modifiers.
|
||||||
|
3. "Import" Tab: Direct file upload or URL inputs, mapping configurations through visual preview table, and live update stats.
|
||||||
|
4. "Auto Import (CRON)" Tab: Manage multiple scheduled automation cron tasks, each configured with specific mapping and modifier rules.
|
||||||
|
|
||||||
|
|
||||||
|
---------------------------------------------------------
|
||||||
|
🇺🇦 УКРАЇНСЬКА МОВА
|
||||||
|
---------------------------------------------------------
|
||||||
|
ВСТАНОВЛЕННЯ:
|
||||||
|
1. В адмін-панелі OpenCart перейдіть до "Модулі / Розширення" -> "Встановлення розширень". Завантажте архів `easy_import_export_nat_OC_30_1_0.ocmod.zip`.
|
||||||
|
2. Перейдіть до "Модулі / Розширення" -> "Модифікатори" і натисніть синю кнопку "Оновити".
|
||||||
|
3. Перейдіть до "Система" -> "Користувачі" -> "Групи користувачів", виберіть вашу групу (Administrator), натисніть "Виділити все" у правах перегляду та зміни, збережіть.
|
||||||
|
4. Перейдіть до "Модулі / Розширення" -> "Розширення" -> тип "Модулі", знайдіть "Easy Import/Export [NAT]", натисніть "Встановити", а потім "Редагувати".
|
||||||
|
|
||||||
|
ОНОВЛЕННЯ:
|
||||||
|
1. Завантажте новий архів через "Встановлення розширень" поверх старого.
|
||||||
|
2. Оновите кеш у розділі "Модифікатори".
|
||||||
|
3. Очистіть кеш браузера (Ctrl+F5) на сторінці налаштувань модуля.
|
||||||
|
|
||||||
|
ВИДАЛЕННЯ:
|
||||||
|
1. Перейдіть у "Модулі / Розширення", знайдіть модуль та натисніть червону кнопку "Деінсталювати".
|
||||||
|
2. Перейдіть у "Встановлення розширень", знайдіть модуль в історії та видаліть його файли.
|
||||||
|
3. Оновите кеш модифікаторів.
|
||||||
|
|
||||||
|
КЛЮЧОВІ ФУНКЦІЇ ТА МОЖЛИВОСТІ:
|
||||||
|
* Інтерактивне прев'ю: Миттєво виводить перші 5 рядків завантаженого файлу чи посилання для візуальної перевірки відповідності колонок перед стартом імпорту.
|
||||||
|
* Розумне автозіставлення: Автоматично розпізнає колонки за словниками синонімів для полів OpenCart (Модель, SKU, Ціна, Кількість, Статус) без перехресних конфліктів.
|
||||||
|
* Живі лічильники імпорту: Панель відображає прогрес виконання у реальному часі (Всього рядків, Оновлено, Не знайдено в каталозі, Пропущено).
|
||||||
|
* Умовні модифікатори цін і залишків: Гнучкі правила (наприклад, "Якщо ціна менша 100 — помножити кількість на 2") з WAF-безпечними символами порівняння (eq, ne, gt, lt), які не блокуються хостингами.
|
||||||
|
* Парсер лінків Google Sheets: Розпізнає посилання спільного доступу Google Таблиць та перетворює їх на прямі WAF-безпечні лінки CSV експорту.
|
||||||
|
* Інтеграція з REST API постачальників [BETA]: Вбудований гнучкий клієнт, що підтримує GET/POST запити, авторизацію Basic/Bearer/Custom POST Token, постраничну пагінацію або пагінацію зі зміщенням, а також потоковий memory-safe запис JSON/XML відповідей на диск.
|
||||||
|
|
||||||
|
ЯК ПРАЦЮВАТИ З МОДУЛЕМ:
|
||||||
|
1. Вкладка "Налаштування": Керування ліцензією, активація швидких кнопок імпорту/експорту в каталозі, налаштування шляхів.
|
||||||
|
2. Вкладка "Експорт": Вивантаження каталогу в CSV, XML, JSON чи Excel з налаштуванням фільтрів та модифікаторів перед скачуванням.
|
||||||
|
3. Вкладка "Імпорт": Завантаження прайс-листів, налаштування зв'язків колонок по прев'ю та імпорт з показом статистики в реальному часі.
|
||||||
|
4. Вкладка "Автоимпорт (CRON)": Створення декількох автоматичних завдань для оновлення за розкладом з індивідуальними налаштуваннями відповідності полів та модифікаторів.
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,572 @@
|
||||||
|
<?php
|
||||||
|
if (!defined('DIR_APPLICATION')) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$_['heading_title'] = '<b><i class="fa fa-space-shuttle fa-rotate-270" style="color: #ec741c; margin-right: 3px; vertical-align: -1px;"></i>Easy Import/Export [NAT]:</b> Fast import/export of prices and stock';
|
||||||
|
$_['heading_title_raw'] = 'Easy Import/Export [NAT]';
|
||||||
|
|
||||||
|
$_['tab_nat_info'] = 'About Module';
|
||||||
|
$_['text_nat_author'] = 'Author / Developer:';
|
||||||
|
$_['text_nat_support'] = 'Technical Support:';
|
||||||
|
$_['text_nat_tg_channel'] = 'Support Telegram Bot:';
|
||||||
|
$_['text_nat_dev_profile'] = 'Forum Profile:';
|
||||||
|
$_['text_nat_site'] = 'Official Website:';
|
||||||
|
$_['text_nat_version_badge']= 'Official Version 3.0 ai';
|
||||||
|
$_['tab_settings'] = 'Settings';
|
||||||
|
$_['tab_export'] = 'Export';
|
||||||
|
$_['tab_import'] = 'Import';
|
||||||
|
$_['tab_cron'] = 'Auto Import (CRON)';
|
||||||
|
$_['tab_info'] = 'Info / [NAT] Ecosystem';
|
||||||
|
$_['text_extension'] = 'Extensions';
|
||||||
|
$_['text_success'] = 'Success: Module settings saved successfully!';
|
||||||
|
$_['text_edit'] = 'Manage Easy Import/Export [NAT]';
|
||||||
|
$_['text_support'] = 'Technical support and suggestions:';
|
||||||
|
$_['entry_license'] = 'License Key';
|
||||||
|
$_['entry_menu_position'] = 'Menu Position [NAT]';
|
||||||
|
$_['text_menu_module_only'] = 'Only in "Modules / Extensions"';
|
||||||
|
$_['text_menu_header'] = 'In Header Panel';
|
||||||
|
$_['text_menu_sidebar'] = 'In Sidebar (Left)';
|
||||||
|
$_['text_menu_both'] = 'In Header and Sidebar';
|
||||||
|
$_['entry_show_list'] = 'Show FAST Buttons';
|
||||||
|
$_['help_show_list'] = 'Global switch to display quick access buttons.';
|
||||||
|
$_['entry_btn_catalog'] = 'Buttons in Product List (Catalog)';
|
||||||
|
$_['entry_btn_batch'] = 'Buttons in Batch Editor';
|
||||||
|
$_['entry_btn_handy'] = 'Buttons in Handy Product Manager';
|
||||||
|
$_['btn_fast_export'] = 'FAST EXPORT';
|
||||||
|
$_['btn_fast_import'] = 'FAST IMPORT';
|
||||||
|
$_['btn_fast_backup'] = 'BACKUP (SQL)';
|
||||||
|
$_['button_export'] = 'Start Export';
|
||||||
|
$_['button_simulate'] = 'Simulate (Dry-Run)';
|
||||||
|
$_['button_import'] = 'Apply Changes';
|
||||||
|
$_['btn_clear_log'] = 'Clear Log';
|
||||||
|
$_['btn_download_log'] = 'Download Log (.txt)';
|
||||||
|
$_['entry_export_format'] = 'Export Format';
|
||||||
|
$_['entry_export_identifier'] = 'Main Identifier';
|
||||||
|
$_['text_ident_model'] = 'Model';
|
||||||
|
$_['text_ident_sku'] = 'SKU';
|
||||||
|
$_['text_ident_id'] = 'Product ID';
|
||||||
|
$_['text_ident_name'] = 'Product Name (Reference)';
|
||||||
|
$_['entry_price_mode'] = 'Price Mode';
|
||||||
|
$_['text_price_simple'] = 'Base Price Only';
|
||||||
|
$_['text_price_special'] = 'Price + Special (General)';
|
||||||
|
$_['text_price_special_group'] = 'Price + Specials by Customer Groups';
|
||||||
|
$_['text_price_discount'] = 'Price + Discounts (Quantity based)';
|
||||||
|
$_['entry_status'] = 'Module Status';
|
||||||
|
$_['help_status'] = 'Enables or disables the functions of the module.';
|
||||||
|
$_['entry_filter_category'] = 'Filter: Categories';
|
||||||
|
$_['help_filter_category'] = 'Filter exported products by selected categories. If none are selected, all categories will be exported.';
|
||||||
|
$_['entry_filter_manufacturer'] = 'Filter: Manufacturers';
|
||||||
|
$_['help_filter_manufacturer'] = 'Filter exported products by selected manufacturers. If none are selected, all manufacturers will be exported.';
|
||||||
|
$_['entry_filter_status'] = 'Product Status';
|
||||||
|
$_['help_filter_status'] = 'Filter exported products by their status (Enabled/Disabled).';
|
||||||
|
$_['entry_cron_status'] = 'Task Status';
|
||||||
|
$_['help_cron_status'] = 'Enable or disable the execution of this cron task.';
|
||||||
|
$_['text_export_link_label'] = 'File Link';
|
||||||
|
$_['text_import_source_label'] = 'Import Source';
|
||||||
|
$_['text_all_statuses'] = '-- All Statuses --';
|
||||||
|
$_['text_status_on'] = 'Enabled (Yes)';
|
||||||
|
$_['text_status_off'] = 'Disabled (No)';
|
||||||
|
$_['entry_filter_quantity'] = 'Min. Quantity in Stock';
|
||||||
|
$_['help_filter_quantity'] = 'Example 1: exports only in-stock products (>0). 0: exports all.';
|
||||||
|
$_['entry_filter_price'] = 'Filter: Price (From & To)';
|
||||||
|
$_['entry_filter_date'] = 'Filter: Date Modified (From & To)';
|
||||||
|
$_['entry_filter_batch'] = 'Filter: Import Label (import_batch)';
|
||||||
|
$_['text_batch_empty'] = '[No Label / Empty]';
|
||||||
|
$_['help_filter_batch_multi'] = 'You can select multiple using a semicolon (;)';
|
||||||
|
$_['text_select_all'] = 'Select All';
|
||||||
|
$_['text_unselect_all'] = 'Unselect All';
|
||||||
|
$_['text_filter_hint'] = 'Hint: If nothing is selected (unchecked), ALL products will be exported.';
|
||||||
|
$_['entry_batch_export'] = 'Products per Pass (Export)';
|
||||||
|
$_['help_batch_export'] = 'Default is 200. Decrease if export terminates due to timeout.';
|
||||||
|
$_['text_warning_backup'] = 'WARNING: Before uploading the file, it is highly recommended to backup prices and stock using the BACKUP (SQL) button at the top!';
|
||||||
|
$_['entry_import_source'] = 'Data Source';
|
||||||
|
$_['text_source_file'] = 'Upload File from PC (.xlsx, .xls, .csv, .xml, .json)';
|
||||||
|
$_['text_source_url'] = 'Direct Link (URL / Google Sheet)';
|
||||||
|
$_['entry_import_file'] = 'File / Link to Upload';
|
||||||
|
$_['text_modifiers_title'] = 'Data Modifiers / Virtual Fields';
|
||||||
|
$_['text_modifiers_desc'] = 'Create new columns on the fly or modify existing ones before saving to the DB.';
|
||||||
|
$_['text_modifier_add'] = 'Add Rule';
|
||||||
|
$_['text_modifier_col'] = 'Column from Price List';
|
||||||
|
$_['text_modifier_action'] = 'Action';
|
||||||
|
$_['text_modifier_target'] = 'Where to save result';
|
||||||
|
$_['text_modifier_target_new'] = '-- Create New Virtual Field --';
|
||||||
|
$_['text_modifier_math'] = 'Calculator (Math)';
|
||||||
|
$_['text_modifier_replace'] = 'Text Replace / Merge';
|
||||||
|
$_['text_mapping_title'] = 'System Field Mapping';
|
||||||
|
$_['text_mapping_desc'] = 'Specify which columns in your file (or virtual fields) contain the required data.';
|
||||||
|
$_['text_mapping_skip'] = '-- Skip --';
|
||||||
|
$_['entry_import_missing'] = 'Action for products NOT in the file';
|
||||||
|
$_['text_missing_skip'] = 'Do nothing (skip)';
|
||||||
|
$_['text_missing_zero_all'] = 'Zero stock (for all products on the site)';
|
||||||
|
$_['text_missing_zero_cat'] = 'Zero stock (only in affected categories/brands)';
|
||||||
|
$_['text_missing_zero_batch'] = 'Zero stock (only matching current Session Label)';
|
||||||
|
$_['text_missing_disable'] = 'Disable products (Status = Disabled)';
|
||||||
|
$_['text_missing_disable_batch'] = 'Disable products (only matching current Session Label)';
|
||||||
|
$_['entry_import_batch_name'] = 'Assign Import Label (import_batch)';
|
||||||
|
$_['help_import_batch'] = 'Helps to easily find, export, or delete exactly these products in the future.';
|
||||||
|
$_['entry_batch_import'] = 'Products per Pass (Import)';
|
||||||
|
$_['entry_log_mode'] = 'Logging Mode';
|
||||||
|
$_['text_log_full'] = 'Full (Log all actions)';
|
||||||
|
$_['text_log_changes'] = 'Changes Only (Recommended)';
|
||||||
|
$_['text_log_off'] = 'Disabled (Dry statistics only)';
|
||||||
|
$_['text_log_simulation'] = 'Simulation Mode (Dry-Run): Changes are NOT saved to the DB yet.';
|
||||||
|
$_['text_log_writing'] = 'Performing live write to the database...';
|
||||||
|
$_['text_log_found'] = 'Products Found:';
|
||||||
|
$_['text_log_updated'] = 'To be updated:';
|
||||||
|
$_['text_log_not_found'] = 'Not found in DB:';
|
||||||
|
$_['text_log_missing_action'] = 'Affected by "Missing" action:';
|
||||||
|
$_['text_import_complete'] = 'Import completed successfully!';
|
||||||
|
$_['text_cron_profiles'] = 'Automation Profiles (CRON)';
|
||||||
|
$_['text_add_profile'] = 'Add Profile';
|
||||||
|
$_['text_edit_profile'] = 'Edit Profile';
|
||||||
|
$_['column_profile_name'] = 'Profile Name';
|
||||||
|
$_['column_profile_status'] = 'Status';
|
||||||
|
$_['column_date_last_run'] = 'Last Run';
|
||||||
|
$_['column_action'] = 'Action';
|
||||||
|
$_['entry_profile_name'] = 'Profile Name';
|
||||||
|
$_['entry_profile_url'] = 'Price List Link (URL)';
|
||||||
|
$_['entry_cron_command'] = 'CRON Command for Hosting';
|
||||||
|
$_['help_cron_command'] = 'Copy this command and add it to the task scheduler (CRON) on your server.';
|
||||||
|
$_['btn_add'] = 'Add';
|
||||||
|
$_['btn_edit'] = 'Edit';
|
||||||
|
$_['btn_delete'] = 'Delete';
|
||||||
|
$_['btn_cancel'] = 'Cancel';
|
||||||
|
$_['btn_save_profile'] = 'Save Profile';
|
||||||
|
$_['text_no_profiles'] = 'No profiles';
|
||||||
|
$_['text_cron_mapping_info'] = 'To configure field mapping and parameters, click the "Check and fetch columns" button so the script downloads headers from your price list URL.';
|
||||||
|
$_['error_empty_url'] = 'Please enter a valid URL';
|
||||||
|
$_['text_downloading'] = 'Downloading...';
|
||||||
|
$_['error_fetch'] = 'Error downloading file.';
|
||||||
|
$_['error_upload_failed'] = 'Error uploading file.';
|
||||||
|
$_['text_confirm_clear_log'] = 'Clear log and file cache?';
|
||||||
|
$_['text_log_cleared'] = 'Log cleared.\n';
|
||||||
|
$_['text_confirm_import'] = 'Are you sure? Data will be written to the database.';
|
||||||
|
$_['text_log_start_sim'] = '--- SIMULATION START ---';
|
||||||
|
$_['text_log_start_imp'] = '--- IMPORT START ---';
|
||||||
|
$_['text_log_batch_done'] = 'processed.';
|
||||||
|
$_['text_log_total_title'] = '=== TOTAL ===';
|
||||||
|
$_['text_confirm_delete'] = 'Delete profile?';
|
||||||
|
$_['text_cron_dev_edit'] = 'Profile Editing';
|
||||||
|
$_['text_cron_dev_delete'] = 'Profile Deletion';
|
||||||
|
$_['text_cron_dev_save'] = 'Profile Saving';
|
||||||
|
$_['error_permission'] = 'You do not have permission to modify this module!';
|
||||||
|
$_['error_license'] = 'Invalid or missing license key!';
|
||||||
|
$_['error_file_upload'] = 'File upload error. Check server limits.';
|
||||||
|
$_['error_file_type'] = 'Invalid file format! Only .xlsx, .xls, .csv, .xml and .json are allowed';
|
||||||
|
$_['error_lib_missing'] = 'PhpSpreadsheet library not found! Upload it to system/library/nat/phpspreadsheet/';
|
||||||
|
$_['text_backup_error'] = 'Backup creation error! Check write permissions in /system/storage/cache/';
|
||||||
|
$_['text_processing'] = 'Processing...';
|
||||||
|
$_['text_no_products'] = 'No products found by your filter!';
|
||||||
|
$_['text_exporting'] = 'Exporting batch ';
|
||||||
|
$_['text_of'] = ' of ';
|
||||||
|
$_['text_error_batch'] = 'Critical error while processing batch ';
|
||||||
|
$_['text_error_init'] = 'Export initialization error';
|
||||||
|
$_['text_ecosystem_title'] = '[NAT] Modules Ecosystem';
|
||||||
|
$_['text_ecosystem_desc'] = 'For maximum speed and security of your store, we developed a series of highly specialized modules operating by Zero Trust standards:';
|
||||||
|
$_['btn_all_modules'] = 'Profile on OpenCart.com';
|
||||||
|
$_['btn_forum_modules'] = 'Profile on OpenCartForum';
|
||||||
|
$_['text_mod_admin_tools'] = 'Admin Tools [NAT]';
|
||||||
|
$_['text_mod_admin_tools_desc'] = 'Handy administrator tools: login as customer, admin customization, user permissions management, and hiding unnecessary menu items.';
|
||||||
|
$_['text_mod_cat_opt'] = 'Catalog Optimizer [NAT]';
|
||||||
|
$_['text_mod_cat_opt_desc'] = 'Hide empty categories/brands + SEO sorting (in-stock first) + DB garbage cleanup.';
|
||||||
|
$_['text_mod_db_opt'] = 'Database Optimizer [NAT]';
|
||||||
|
$_['text_mod_db_opt_desc'] = 'Intelligent database garbage collection, system log management, and adding critical indexes for site speedup.';
|
||||||
|
$_['text_mod_dom_scan'] = 'Domain Scanner [NAT]';
|
||||||
|
$_['text_mod_dom_scan_desc'] = 'Search and clean external links and HTTP images in DB and theme files. Perfect for HTTPS migration or parsing cleanup.';
|
||||||
|
$_['text_mod_easy_import'] = 'Easy Import/Export [NAT]';
|
||||||
|
$_['text_mod_easy_import_desc'] = 'Current module. Fast import/export of prices, stocks and products from XLS/XLSX/CSV/XML/JSON. Field mapping, Cron jobs and URL support.';
|
||||||
|
$_['text_mod_img_opt'] = 'Image Optimizer [NAT]';
|
||||||
|
$_['text_mod_img_opt_desc'] = 'Original image compression to WebP + Mass cleanup of unused images on the server.';
|
||||||
|
$_['text_mod_new_arrivals'] = 'New Arrivals [NAT]: True Sort by Date';
|
||||||
|
$_['text_mod_new_arrivals_desc'] = 'Automatic SEO page for new arrivals. Displays items strictly by actual added date. Sliders, grids, and smart date archive sidebar.';
|
||||||
|
$_['text_mod_utm_tracker'] = 'Order UTM Tracker [NAT]';
|
||||||
|
$_['text_mod_utm_tracker_desc'] = 'Automatic tracking of UTM tags during checkout. Saves the traffic source, campaign, keywords, and displays this data in order details to analyze advertising effectiveness.';
|
||||||
|
$_['text_mod_poll'] = 'Poll Widget [NAT]';
|
||||||
|
$_['text_mod_poll_desc'] = 'Create polls and voting widgets with a visual design builder, detailed statistics, and fraud protection.';
|
||||||
|
$_['text_mod_promo_top_bar'] = 'Promo Top Bar [NAT]: Upper promotional info-banner, information bar above header, marquee and top-banner';
|
||||||
|
$_['text_mod_promo_top_bar_desc'] = 'Create interactive promo bars and header slideshows with a block builder, countdown timers, subscription forms, and flexible targeting.';
|
||||||
|
$_['text_help_export_format'] = '<i class="fa fa-info-circle"></i> <b>Complex Pricing Export Formats:</b><br>If <b>"ALL AT ONCE"</b> mode is selected, data is exported into 1 cell (separated by semicolon <code>;</code>):<br>• Specials: <code>Group_ID:Price</code> (example: <code>1:99.00; 2:95.00</code>)<br>• Discounts: <code>Group_ID:Quantity:Price</code> (example: <code>1:10:90.00</code>)';
|
||||||
|
$_['text_help_import_format'] = '<i class="fa fa-info-circle"></i> <b>Discount Import Syntax:</b><br>If you map <b>"Specials (Groups)"</b> or <b>"Discounts (Qty)"</b> columns, the price list must have a strict format:<br>• For specials: <code>Group_ID:Price</code> (e.g. <code>1:150.50</code>)<br>• For discounts: <code>Group_ID:From_Quantity:Price</code> (e.g. <code>1:5:140.00; 1:10:130.00</code>)';
|
||||||
|
$_['text_format_auto'] = 'Auto-detect (Recommended)';
|
||||||
|
$_['text_format_xlsx'] = '.xlsx (Modern Excel)';
|
||||||
|
$_['text_format_xls'] = '.xls (Legacy Excel 97-2004)';
|
||||||
|
$_['text_format_csv'] = '.csv';
|
||||||
|
$_['text_format_xml'] = '.xml / .yml (XML format)';
|
||||||
|
$_['text_format_json'] = '.json';
|
||||||
|
$_['text_format_hint'] = 'If the PhpSpreadsheet library is not found on the server, .csv will be forcibly exported';
|
||||||
|
$_['text_price_all_advanced'] = 'ALL AT ONCE (Base + Group Specials + Quantity Discounts)';
|
||||||
|
$_['text_col_price'] = 'Price (Base Price)';
|
||||||
|
$_['text_col_quantity'] = 'Quantity (Stock)';
|
||||||
|
$_['text_col_status'] = 'Status';
|
||||||
|
$_['text_col_special'] = 'Special';
|
||||||
|
$_['text_col_specials_group'] = 'Specials (Groups)';
|
||||||
|
$_['text_col_discounts_group'] = 'Discounts (Qty)';
|
||||||
|
$_['text_placeholder_batch'] = 'price_update_1';
|
||||||
|
$_['text_placeholder_cron_name']= 'Price List from Supplier A';
|
||||||
|
$_['text_placeholder_url'] = 'https://example.com/price.csv';
|
||||||
|
$_['btn_cron_fetch'] = 'Check and Fetch Columns';
|
||||||
|
$_['text_cron_mapping_title'] = 'Column Mapping for this profile';
|
||||||
|
$_['text_cron_actions_title'] = 'Actions for this profile';
|
||||||
|
$_['entry_log_lines'] = 'Max log lines on screen';
|
||||||
|
$_['text_empty_title'] = 'Untitled';
|
||||||
|
$_['error_empty_file'] = 'Error: File is empty or has invalid format!';
|
||||||
|
$_['error_mapping'] = 'Error: Critical mapping error! Main identifier is not selected.';
|
||||||
|
$_['error_temp_file'] = 'Error: Temporary file not found, please re-upload the price list!';
|
||||||
|
$_['entry_profile_type'] = 'Profile Type';
|
||||||
|
$_['text_type_import'] = 'Import (Load to DB)';
|
||||||
|
$_['text_type_export'] = 'Export (Download via link)';
|
||||||
|
$_['entry_export_dest'] = 'File Name for Export';
|
||||||
|
$_['help_export_dest'] = 'Example: pricelist.xml. File will be available via link: ';
|
||||||
|
$_['text_cron_export_info'] = 'Warning: In Export mode, mapping settings are hidden. Export will be generated based on your filters from the "Export" tab.';
|
||||||
|
$_['entry_cron_secret'] = 'Secret Key (CRON Token)';
|
||||||
|
$_['help_cron_secret'] = 'Protects the script from unauthorized runs. Enter any complex phrase (e.g. s3cr3t_t0k3n). Without it, CRON will not work.';
|
||||||
|
$_['error_cron_secret'] = 'Error: CRON secret key is not set!';
|
||||||
|
$_['text_cron_export_link'] = 'Permanent link for your clients:';
|
||||||
|
$_['entry_inverse_special'] = 'Inverse Special Prices';
|
||||||
|
$_['help_inverse_special'] = 'If the supplier provides the discounted price in the main column, and the old (higher) price as the special price - the module will swap them.';
|
||||||
|
$_['entry_export_folder'] = 'Export Files Folder';
|
||||||
|
$_['help_export_folder'] = 'Folder name on the server. The script will create it and protect it with .htaccess.';
|
||||||
|
$_['entry_export_path'] = 'Export Folder Location';
|
||||||
|
$_['text_path_root'] = 'Site Root (Recommended)';
|
||||||
|
$_['text_path_image'] = 'In image/catalog/ folder';
|
||||||
|
$_['text_custom_fields'] = 'Custom Fields Mapping';
|
||||||
|
$_['text_export_custom_fields'] = 'Export Custom Fields';
|
||||||
|
$_['text_add_custom_field'] = 'Add Field';
|
||||||
|
$_['text_table'] = 'Table (Where product_id exists)';
|
||||||
|
$_['text_column'] = 'Column Name';
|
||||||
|
$_['text_action_math'] = 'Calculator (Math)';
|
||||||
|
$_['text_action_replace'] = 'Text Replace / Merge';
|
||||||
|
$_['text_math_help'] = 'Example: +15%, *1.2, -10.5';
|
||||||
|
$_['text_replace_help'] = 'Example: Find "OldBrand", replace with "NewBrand"';
|
||||||
|
$_['btn_settings'] = 'Setup';
|
||||||
|
$_['text_target_col_name'] = 'Column Name in Price List (CSV/XML/JSON)';
|
||||||
|
$_['text_rule_merge_col1'] = 'First Column';
|
||||||
|
$_['text_rule_merge_sep'] = 'Separator (e.g. space, -, <br>)';
|
||||||
|
$_['text_rule_merge_col2'] = 'Second Column';
|
||||||
|
$_['text_rule_merge_hint'] = 'Merges the values of two columns into one using the specified separator.';
|
||||||
|
$_['text_btn_merge_setup'] = 'Setup Merge';
|
||||||
|
$_['text_btn_merge_done'] = 'Merge configured';
|
||||||
|
$_['text_target_self'] = 'Current Column/Field';
|
||||||
|
$_['text_mod_action_add'] = '+ Add Number';
|
||||||
|
$_['text_mod_action_sub'] = '- Subtract Number';
|
||||||
|
$_['text_mod_action_mul'] = '* Multiply by';
|
||||||
|
$_['text_mod_action_div'] = '/ Divide by';
|
||||||
|
$_['text_mod_action_add_pct'] = '+ Add Percentage (%)';
|
||||||
|
$_['text_mod_action_sub_pct'] = '- Subtract Percentage (%)';
|
||||||
|
$_['text_mod_action_rnd_0'] = 'Round to Integer';
|
||||||
|
$_['text_mod_action_rnd_2'] = 'Round to Cents (.00)';
|
||||||
|
$_['text_mod_action_replace'] = 'Text Replace';
|
||||||
|
$_['text_mod_action_merge'] = 'Merge Columns';
|
||||||
|
$_['text_export_modifiers'] = 'Data Modifiers (Export)';
|
||||||
|
$_['error_server_500'] = 'SERVER ERROR (500/504):';
|
||||||
|
$_['text_status_code'] = 'Status: ';
|
||||||
|
$_['text_server_response'] = 'Server Response: ';
|
||||||
|
$_['text_no_parameters'] = 'No parameters';
|
||||||
|
$_['text_search_for'] = 'Search for';
|
||||||
|
$_['text_replace_with'] = 'Replace with';
|
||||||
|
$_['text_field_1'] = 'Field 1';
|
||||||
|
$_['text_field_2'] = 'Field 2';
|
||||||
|
$_['text_separator'] = 'Separator';
|
||||||
|
$_['text_value'] = 'Value';
|
||||||
|
$_['text_new_field'] = 'New Field';
|
||||||
|
$_['text_new_field_name'] = 'New field name';
|
||||||
|
$_['text_table_select'] = '-- Table --';
|
||||||
|
$_['text_select'] = '-- Select --';
|
||||||
|
$_['text_enter_manually'] = '-- Enter Manually --';
|
||||||
|
$_['text_virtual'] = '[Virtual] ';
|
||||||
|
$_['error_prefix'] = 'Error: ';
|
||||||
|
$_['text_import_finished_cleanup'] = '*** Import finished! File deleted. Please select the file again for a new upload. ***';
|
||||||
|
$_['text_fast_buttons'] = 'FAST Buttons';
|
||||||
|
$_['text_min'] = 'Min';
|
||||||
|
$_['text_max'] = 'Max';
|
||||||
|
$_['text_batch_label'] = 'Batch';
|
||||||
|
$_['text_help_specials_group_title'] = 'Format for specials by group: customer_group_id:price;customer_group_id:price';
|
||||||
|
$_['text_help_discounts_group_title'] = 'Format for discounts by group: customer_group_id:quantity:price;customer_group_id:quantity:price';
|
||||||
|
$_['text_custom_text_label'] = 'Custom Text';
|
||||||
|
$_['text_custom_text_placeholder'] = 'Enter text...';
|
||||||
|
$_['text_condition'] = 'Condition';
|
||||||
|
$_['text_cond_always'] = '-- Always Apply --';
|
||||||
|
$_['text_cond_equals'] = 'Equals (=)';
|
||||||
|
$_['text_cond_not_equals'] = 'Not Equals (!=)';
|
||||||
|
$_['text_cond_greater'] = 'Greater Than (>)';
|
||||||
|
$_['text_cond_less'] = 'Less Than (<)';
|
||||||
|
$_['text_cond_contains'] = 'Contains';
|
||||||
|
$_['text_cond_not_contains'] = 'Does Not Contain';
|
||||||
|
$_['text_cond_empty'] = 'Is Empty';
|
||||||
|
$_['text_cond_not_empty'] = 'Is Not Empty';
|
||||||
|
$_['text_preview_title'] = 'File Data Preview (First 5 Rows)';
|
||||||
|
$_['text_source_api'] = 'REST API (Supplier Catalog URL) [BETA]';
|
||||||
|
$_['text_api_settings'] = 'REST API Source Settings';
|
||||||
|
$_['entry_api_endpoint'] = 'API Endpoint URL';
|
||||||
|
$_['help_api_endpoint'] = 'Use {page}, {offset}, {limit}, {token} placeholders if pagination/auth is enabled. E.g. https://api.com/products?page={page}';
|
||||||
|
$_['entry_api_method'] = 'Request Method';
|
||||||
|
$_['entry_api_headers'] = 'Request Headers';
|
||||||
|
$_['help_api_headers'] = 'Enter one header per line. E.g.:<br>Accept: application/json<br>X-API-Key: {token}';
|
||||||
|
$_['entry_api_body'] = 'Request Body (POST)';
|
||||||
|
$_['help_api_body'] = 'Body string for POST method. Supports placeholders.';
|
||||||
|
$_['entry_api_auth_mode'] = 'Authentication Mode';
|
||||||
|
$_['text_auth_none'] = 'No Auth';
|
||||||
|
$_['text_auth_basic'] = 'Basic Auth (User/Password)';
|
||||||
|
$_['text_auth_bearer'] = 'Static Bearer Token';
|
||||||
|
$_['text_auth_custom_post'] = 'Dynamic Token via Auth POST request';
|
||||||
|
$_['entry_api_username'] = 'Auth Username';
|
||||||
|
$_['entry_api_password'] = 'Auth Password';
|
||||||
|
$_['entry_api_bearer_token'] = 'Bearer Token';
|
||||||
|
$_['entry_api_auth_url'] = 'Auth Request URL (POST)';
|
||||||
|
$_['entry_api_auth_body'] = 'Auth Request Body (POST)';
|
||||||
|
$_['help_api_auth_body'] = 'JSON or form payload to request token. E.g. {"username": "admin", "password": "123"}';
|
||||||
|
$_['entry_api_auth_token_path'] = 'Auth Token JSON Path';
|
||||||
|
$_['help_api_auth_token_path'] = 'Dot notation path to token in response. E.g. data.access_token';
|
||||||
|
$_['entry_api_pagination_mode'] = 'Pagination Mode';
|
||||||
|
$_['text_pagi_none'] = 'No Pagination (Single request)';
|
||||||
|
$_['text_pagi_page'] = 'Page-based pagination';
|
||||||
|
$_['text_pagi_offset'] = 'Offset-based pagination';
|
||||||
|
$_['entry_api_page_placeholder'] = 'Page Placeholder in URL/Body';
|
||||||
|
$_['entry_api_start_page'] = 'Start Page Number';
|
||||||
|
$_['entry_api_offset_placeholder'] = 'Offset Placeholder in URL/Body';
|
||||||
|
$_['entry_api_start_offset'] = 'Start Offset Value';
|
||||||
|
$_['entry_api_limit_placeholder'] = 'Limit/Batch Size Placeholder';
|
||||||
|
$_['entry_api_limit_value'] = 'Items per Request (Limit)';
|
||||||
|
$_['entry_api_response_format'] = 'API Response Format';
|
||||||
|
$_['entry_api_json_root_path'] = 'JSON Root Path of products';
|
||||||
|
$_['help_api_json_root_path'] = 'Dot-separated key path to product items array. Empty if root is array.';
|
||||||
|
$_['entry_api_xml_product_tag'] = 'XML Product Tag';
|
||||||
|
$_['help_api_xml_product_tag'] = 'Element tag containing product data. E.g. offer';
|
||||||
|
$_['text_col_category'] = 'Category / Category Path';
|
||||||
|
$_['text_category_bindings'] = 'Category Bindings';
|
||||||
|
$_['btn_load_categories'] = 'Load Categories from File';
|
||||||
|
$_['text_supplier_category'] = 'Supplier Category';
|
||||||
|
$_['text_store_category'] = 'Store Category';
|
||||||
|
$_['text_select_category'] = '--- Select Category ---';
|
||||||
|
|
||||||
|
$_['text_mod_action_markup_table'] = 'Markup Range Table';
|
||||||
|
$_['text_mod_action_comma_to_dot'] = 'Comma to Dot Float Parser';
|
||||||
|
$_['text_mod_action_currency_convert'] = 'Currency Convert';
|
||||||
|
$_['text_mod_action_combine_fields'] = 'Pattern Combine Fields';
|
||||||
|
|
||||||
|
$_['entry_option_quantity_sync'] = 'Sync option stock';
|
||||||
|
$_['help_option_quantity_sync'] = 'Auto-recalculate product stock quantity as the sum of all its option stocks.';
|
||||||
|
$_['text_search_mapping_placeholder'] = 'Search column names...';
|
||||||
|
$_['text_profile_select'] = 'Select Profile';
|
||||||
|
$_['text_select_profile_placeholder'] = '--- New Profile / Standard ---';
|
||||||
|
$_['btn_delete_profile'] = 'Delete Profile';
|
||||||
|
$_['error_stock_guard'] = 'Import aborted by Stock Guard: %s%% of items in the feed are out of stock (guard threshold: %s%%).';
|
||||||
|
$_['entry_price_guard'] = 'Price Guard';
|
||||||
|
$_['help_price_guard'] = 'Do not lower product prices if the feed price is lower than the current price on the store.';
|
||||||
|
$_['entry_stock_guard'] = 'Stock Guard';
|
||||||
|
$_['help_stock_guard'] = 'Abort import if the percentage of out-of-stock items in the feed exceeds this threshold.';
|
||||||
|
$_['entry_map_image'] = 'Main Image URL';
|
||||||
|
$_['entry_map_additional_images'] = 'Additional Images URLs (comma-separated)';
|
||||||
|
$_['entry_img_overwrite'] = 'Overwrite existing images';
|
||||||
|
$_['help_img_overwrite'] = 'If enabled, images will be re-downloaded from the source URL. If disabled, download is skipped if the local file exists.';
|
||||||
|
$_['entry_img_dir'] = 'Images Subdirectory';
|
||||||
|
$_['help_img_dir'] = 'Folder inside image/catalog/ where downloaded images will be stored (e.g. easy_import).';
|
||||||
|
$_['entry_visual_diff'] = 'Visual Diff for Simulation';
|
||||||
|
$_['help_visual_diff'] = 'If enabled, simulation results will be displayed as an interactive table of changes.';
|
||||||
|
$_['text_visual_diff_title'] = 'Changes Table (Visual Diff)';
|
||||||
|
$_['placeholder_search_model'] = 'Search by model...';
|
||||||
|
$_['btn_filter_all'] = 'All';
|
||||||
|
$_['btn_filter_updated'] = 'Updated';
|
||||||
|
$_['btn_filter_skipped'] = 'Skipped (Price Guard)';
|
||||||
|
$_['entry_field'] = 'Field';
|
||||||
|
$_['entry_old_value'] = 'Was';
|
||||||
|
$_['entry_new_value'] = 'Will Be';
|
||||||
|
$_['btn_show_cron_command'] = 'Show Cron Command';
|
||||||
|
$_['text_cron_instructions'] = 'Copy one of the commands below and add it to your hosting Cron task scheduler:';
|
||||||
|
$_['btn_copy'] = 'Copy';
|
||||||
|
$_['text_copied'] = 'Copied!';
|
||||||
|
$_['entry_update_content'] = 'Update content & promotions';
|
||||||
|
$_['help_update_content'] = 'Disabled by default. Enable this option if you need to update catalog content (name, images, category) and promotions/discounts in addition to core prices and stock.';
|
||||||
|
$_['text_col_discount'] = 'Simple Discount';
|
||||||
|
$_['text_help_discount_title'] = 'Discount price applied to default customer group once the specified quantity threshold is reached (default: from 2 pcs).';
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Step navigation ---
|
||||||
|
$_['btn_next_mappings'] = 'Next: Field Mapping';
|
||||||
|
$_['btn_next_custom_fields'] = 'Next: Custom Fields';
|
||||||
|
$_['btn_next_category_bindings'] = 'Next: Category Bindings';
|
||||||
|
$_['btn_next_advanced_settings'] = 'Next: Advanced Settings';
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Hardcoded messages ---
|
||||||
|
$_['text_no_categories_yet'] = 'No categories loaded yet. Map the Category column first and click "Load Categories".';
|
||||||
|
$_['text_no_categories_yet_short'] = 'No categories loaded yet. Map Category first.';
|
||||||
|
$_['error_api_endpoint_required'] = 'API Endpoint URL is required.';
|
||||||
|
$_['text_manual_import'] = 'Manual Import';
|
||||||
|
$_['error_upload_file_first'] = 'Please upload a file first.';
|
||||||
|
$_['error_select_category_first'] = 'Please select the Category column mapping first.';
|
||||||
|
$_['error_ajax_failed'] = 'AJAX request failed.';
|
||||||
|
$_['error_load_file_first'] = 'Please load/fetch the file first.';
|
||||||
|
$_['text_loading'] = 'Loading...';
|
||||||
|
$_['text_off'] = 'Off';
|
||||||
|
$_['text_enabled'] = 'Enabled';
|
||||||
|
$_['text_disabled'] = 'Disabled';
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Placeholders ---
|
||||||
|
$_['text_placeholder_default'] = 'Default';
|
||||||
|
$_['text_placeholder_price'] = 'Price';
|
||||||
|
$_['text_placeholder_qty'] = 'Qty';
|
||||||
|
$_['text_placeholder_currency_from'] = 'From (e.g. USD)';
|
||||||
|
$_['text_placeholder_currency_to'] = 'To (e.g. UAH)';
|
||||||
|
$_['text_placeholder_multiplier'] = 'Multiplier';
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Profile modal ---
|
||||||
|
$_['error_profile_name_empty'] = 'Profile name cannot be empty.';
|
||||||
|
$_['text_profile_saved'] = 'Profile saved successfully.';
|
||||||
|
$_['text_profile_deleted'] = 'Profile deleted successfully.';
|
||||||
|
$_['text_save_profile_title'] = 'Save Import Profile';
|
||||||
|
$_['text_save_profile_target'] = 'Save to';
|
||||||
|
$_['text_profile_new'] = '--- New Profile ---';
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Mapping & search ---
|
||||||
|
$_['text_mapping_no_results'] = 'No results found';
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Discount format hints ---
|
||||||
|
$_['text_help_simple_discount_format'] = 'Single number — discount price. Applied to all customers when buying 2+ pcs. Example: 150.00';
|
||||||
|
$_['text_help_discounts_group_format'] = 'Format: group_id:quantity:price separated by semicolons. Example: 1:5:140.00;1:10:130.00';
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Image mode ---
|
||||||
|
$_['text_images_single_col'] = 'All images in one column (comma-separated)';
|
||||||
|
$_['text_images_multi_col'] = 'Each image in a separate column';
|
||||||
|
$_['btn_add_image_col'] = 'Add image column';
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Price Guard % ---
|
||||||
|
$_['entry_price_guard_pct'] = 'Max price decrease (%)';
|
||||||
|
$_['help_price_guard_pct'] = 'Do not update the price if it drops by more than the specified percentage. 0 = no limit.';
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Category binding modes ---
|
||||||
|
$_['entry_cat_binding_mode'] = 'Category Binding Mode';
|
||||||
|
$_['text_cat_bind_mixed'] = 'Mixed (find or create)';
|
||||||
|
$_['text_cat_bind_exact'] = 'Exact match only';
|
||||||
|
$_['text_cat_bind_skip_new'] = 'Skip if not found';
|
||||||
|
$_['help_map_category'] = 'If not mapped — categories are not updated. Supports full path: Parent > Subcategory.';
|
||||||
|
|
||||||
|
// --- Additional keys for currency, rounding, history and licensing ---
|
||||||
|
$_['text_confirm_delete_profile'] = 'Are you sure you want to delete this profile?';
|
||||||
|
$_['entry_currency_col'] = 'Currency Column';
|
||||||
|
$_['entry_currency_feed'] = 'Feed Currency';
|
||||||
|
$_['entry_currency_mode'] = 'Currency Mode';
|
||||||
|
$_['entry_currency_rate'] = 'Exchange Rate';
|
||||||
|
$_['entry_currency_rate_selector'] = 'Rate Source';
|
||||||
|
$_['entry_currency_rules'] = 'Currency Rules';
|
||||||
|
$_['entry_currency_source'] = 'Source Currency';
|
||||||
|
$_['btn_add_currency_rule'] = '+ Add Rule';
|
||||||
|
$_['text_currency_multi'] = 'Multi-currency';
|
||||||
|
$_['text_currency_off'] = 'Disabled';
|
||||||
|
$_['text_currency_single'] = 'Single (global rate)';
|
||||||
|
$_['text_currency_source_custom'] = 'Custom Rate';
|
||||||
|
$_['text_currency_source_store'] = 'Store Rate';
|
||||||
|
$_['text_supplier_currency'] = 'Supplier Currency';
|
||||||
|
$_['entry_rounding_precision'] = 'Round to';
|
||||||
|
$_['entry_rounding_type'] = 'Rounding Method';
|
||||||
|
$_['text_section_currency_rounding'] = 'Rounding';
|
||||||
|
$_['text_rounding_ceil'] = 'Round up';
|
||||||
|
$_['text_rounding_floor'] = 'Round down';
|
||||||
|
$_['text_rounding_math'] = 'Mathematical';
|
||||||
|
$_['text_rounding_off'] = 'No rounding';
|
||||||
|
$_['text_precision_int'] = 'Integer (0)';
|
||||||
|
$_['text_precision_1dec'] = '1 decimal (0.0)';
|
||||||
|
$_['text_precision_2dec'] = '2 decimals (0.00)';
|
||||||
|
$_['text_precision_tens'] = 'Tens (10, 20...)';
|
||||||
|
$_['text_precision_hundreds'] = 'Hundreds (100, 200...)';
|
||||||
|
$_['text_precision_90'] = 'X9 (99, 199...)';
|
||||||
|
$_['text_precision_99'] = 'XX9 (999, 1999...)';
|
||||||
|
$_['tab_history'] = 'History';
|
||||||
|
$_['text_history_date'] = 'Date';
|
||||||
|
$_['text_history_profile'] = 'Profile';
|
||||||
|
$_['text_history_type'] = 'Type';
|
||||||
|
$_['text_history_status'] = 'Status';
|
||||||
|
$_['text_history_updated'] = 'Updated';
|
||||||
|
$_['text_history_skipped'] = 'Skipped';
|
||||||
|
$_['text_history_actions'] = 'Actions';
|
||||||
|
$_['text_history_not_found'] = 'No history records found.';
|
||||||
|
$_['button_clear_history'] = 'Clear History';
|
||||||
|
$_['text_confirm_clear_history'] = 'Clear all import history?';
|
||||||
|
$_['text_col_identifier'] = 'Identifier';
|
||||||
|
$_['text_ident_product_id'] = 'Product ID';
|
||||||
|
$_['text_no_results'] = 'No results found.';
|
||||||
|
$_['text_12_hours'] = 'Every 12 hours';
|
||||||
|
$_['text_24_hours'] = 'Every 24 hours';
|
||||||
|
$_['text_3_days'] = 'Every 3 days';
|
||||||
|
$_['text_7_days'] = 'Every 7 days';
|
||||||
|
$_['text_14_days'] = 'Every 14 days';
|
||||||
|
$_['text_30_days'] = 'Every 30 days';
|
||||||
|
$_['help_batch_import'] = 'Batch name to group import sessions for reporting.';
|
||||||
|
$_['entry_cron_alert_threshold'] = 'Alert if price drops by (%)';
|
||||||
|
$_['help_cron_alert_threshold'] = 'Send alert when price drops more than this % threshold (0 = disabled).';
|
||||||
|
$_['text_license_invalid'] = 'License not activated!';
|
||||||
|
$_['text_license_help'] = 'To activate the module, please enter your license key. If you purchased the module on OpenCartForum, the key has been sent to your email and via the Telegram bot. For support or getting a key, contact us at <a href="mailto:info@nat.od.ua">info@nat.od.ua</a> or send a PM to <strong>NAT</strong> on the forum.';
|
||||||
|
$_['text_if_drops_by'] = 'if drops by';
|
||||||
|
$_['text_required'] = 'Required';
|
||||||
|
$_['help_cat_binding_mode'] = 'Mixed = Find or create category. Exact = Bind only if matches exactly. Skip new = Skip binding if not found in store.';
|
||||||
|
$_['text_set_for_all'] = '--- Set for all products ---';
|
||||||
|
// New features from Universal Import analysis
|
||||||
|
$_['entry_price_ignore_zero'] = 'Ignore zero/empty prices';
|
||||||
|
$_['help_price_ignore_zero'] = 'Do not update product price if it is 0 or empty in the import file.';
|
||||||
|
$_['entry_missing_limit_batch'] = 'Limit to current batch only';
|
||||||
|
$_['help_missing_limit_batch'] = 'Apply action to missing products only if they belong to the same import batch (protects other suppliers).';
|
||||||
|
$_['entry_option_update_mode'] = 'Options update mode';
|
||||||
|
$_['text_option_overwrite'] = 'Overwrite (delete old options)';
|
||||||
|
$_['text_option_update'] = 'Update (update price/qty, insert new)';
|
||||||
|
$_['entry_image_update_mode'] = 'Additional images';
|
||||||
|
$_['text_image_overwrite'] = 'Overwrite (delete old)';
|
||||||
|
$_['text_image_keep'] = 'Keep existing (add new)';
|
||||||
|
$_['text_missing_zero_brand'] = 'Set quantity 0 for products of these manufacturers';
|
||||||
|
$_['text_missing_disable_brand'] = 'Disable products of these manufacturers';
|
||||||
|
|
||||||
|
$_['text_help_custom_fields_info'] = 'Custom fields allow mapping CSV/XLSX columns to any database table and column in OpenCart. Popular examples: <b>product_description</b> (meta_h1, meta_title, tag), <b>product</b> (jan, isbn, mpn, location, weight, length).';
|
||||||
|
|
||||||
|
$_['text_sim_new_products'] = 'New Products';
|
||||||
|
$_['text_sim_updated_products'] = 'Updated Products';
|
||||||
|
$_['text_sim_price_guarded'] = 'Price Guarded';
|
||||||
|
$_['text_sim_skipped_products'] = 'Skipped Rows';
|
||||||
|
$_['btn_export_profile_json'] = 'Download Profile JSON';
|
||||||
|
$_['btn_import_profile_json'] = 'Upload Profile JSON';
|
||||||
|
|
||||||
|
$_['text_markup_up_to'] = 'Price up to';
|
||||||
|
$_['text_markup_multiplier'] = 'Multiplier (e.g. 1.25)';
|
||||||
|
$_['text_markup_add_tier'] = 'Add Tier';
|
||||||
|
$_['text_markup_raw_string'] = 'Raw text';
|
||||||
|
|
||||||
|
$_['text_cron_never_run'] = 'Never run';
|
||||||
|
$_['text_cron_status_active'] = 'Active';
|
||||||
|
$_['text_cron_status_alert'] = 'Alert';
|
||||||
|
$_['text_cron_status_error'] = 'Error';
|
||||||
|
$_['text_cron_alert_tooltip'] = 'Alert: No activity for %s days (threshold: %s)';
|
||||||
|
$_['text_cron_error_tooltip'] = 'Last run finished with error: %s';
|
||||||
|
|
||||||
|
$_['text_col_manufacturer'] = 'Manufacturer';
|
||||||
|
$_['help_map_manufacturer'] = 'Manufacturer mapping. Supports search by name or ID, as well as automatic creation.';
|
||||||
|
$_['entry_empty_special_action'] = 'When promotion in file is empty';
|
||||||
|
$_['text_empty_special_skip'] = 'Skip (preserve existing promotions)';
|
||||||
|
$_['text_empty_special_delete'] = 'Delete promotions from product';
|
||||||
|
$_['help_empty_special_action'] = 'Defines what to do with store specials if the supplier feed cell is empty.';
|
||||||
|
$_['entry_category_update_mode'] = 'Category update mode';
|
||||||
|
$_['text_category_mode_overwrite'] = 'Overwrite (replace category bindings)';
|
||||||
|
$_['text_category_mode_append'] = 'Append (preserve existing categories)';
|
||||||
|
$_['help_category_update_mode'] = 'Overwrite replaces all category bindings. Append keeps existing categories and attaches the new one.';
|
||||||
|
$_['entry_man_binding_mode'] = 'Manufacturer binding mode';
|
||||||
|
$_['text_man_binding_mixed'] = 'Mixed (find or create)';
|
||||||
|
$_['text_man_binding_search'] = 'Link to existing only';
|
||||||
|
$_['text_man_binding_create'] = 'Always create new';
|
||||||
|
$_['help_man_binding_mode'] = 'Mixed = search for match by name, otherwise create new manufacturer.';
|
||||||
|
$_['entry_model'] = 'Model';
|
||||||
|
$_['entry_name'] = 'Product Name';
|
||||||
|
$_['help_map_image'] = 'Main product image (direct URL or local path in image/catalog/)';
|
||||||
|
$_['text_action_translit'] = 'Transliterate to SEO URL';
|
||||||
|
$_['text_missing_disable_cat'] = 'Disable (selected categories only)';
|
||||||
|
$_['text_log_real_import'] = 'Real Product Import...';
|
||||||
|
$_['error_post_max_size'] = 'Error: uploaded file size exceeds server post_max_size limit (%s)!';
|
||||||
|
|
||||||
|
// --- Лицензирование NAT (Стандарт V5 Final) ---
|
||||||
|
$_['nat_gk_title'] = 'Module Activation';
|
||||||
|
$_['text_nat_domain_label'] = 'Your domain:';
|
||||||
|
$_['text_nat_copy_domain'] = 'Copy';
|
||||||
|
$_['text_nat_enter_key'] = 'Enter license key:';
|
||||||
|
$_['button_nat_activate'] = 'Activate';
|
||||||
|
$_['text_nat_bot_btn'] = 'Get key via Telegram Bot';
|
||||||
|
$_['text_nat_rule_domain'] = '<b>License terms:</b> 1 purchase = 1 domain. The key is bound to the primary domain without the www prefix.';
|
||||||
|
$_['text_nat_contacts_title'] = 'Get key and support:';
|
||||||
|
$_['placeholder_license'] = 'XXXX - XXXX - XXXX - XXXX';
|
||||||
|
$_['text_license_active'] = 'License Active';
|
||||||
|
$_['text_nat_domain_copied'] = 'Copied!';
|
||||||
|
$_['text_nat_support'] = 'Support:';
|
||||||
|
$_['entry_license'] = 'License Key:';
|
||||||
|
|
@ -0,0 +1,573 @@
|
||||||
|
<?php
|
||||||
|
if (!defined('DIR_APPLICATION')) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$_['heading_title'] = '<b><i class="fa fa-space-shuttle fa-rotate-270" style="color: #ec741c; margin-right: 3px; vertical-align: -1px;"></i>Easy Import/Export [NAT]:</b> Быстрый импорт/экспорт цен и остатков';
|
||||||
|
$_['heading_title_raw'] = 'Easy Import/Export [NAT]';
|
||||||
|
|
||||||
|
// Вкладка «О модуле»
|
||||||
|
$_['tab_nat_info'] = 'О модуле';
|
||||||
|
$_['text_nat_author'] = 'Автор / Разработчик:';
|
||||||
|
$_['text_nat_support'] = 'Техническая поддержка:';
|
||||||
|
$_['text_nat_tg_channel'] = 'Telegram-бот поддержки:';
|
||||||
|
$_['text_nat_dev_profile'] = 'Профиль на форуме:';
|
||||||
|
$_['text_nat_site'] = 'Официальный сайт:';
|
||||||
|
$_['text_nat_version_badge']= 'Официальная версия 3.0 ai';
|
||||||
|
$_['tab_settings'] = 'Настройки';
|
||||||
|
$_['tab_export'] = 'Экспорт (Выгрузка)';
|
||||||
|
$_['tab_import'] = 'Импорт (Загрузка)';
|
||||||
|
$_['tab_cron'] = 'Автоимпорт (CRON)';
|
||||||
|
$_['tab_info'] = 'Инфо / Экосистема [NAT]';
|
||||||
|
$_['text_extension'] = 'Расширения';
|
||||||
|
$_['text_success'] = 'Успех: Настройки модуля успешно сохранены!';
|
||||||
|
$_['text_edit'] = 'Управление Easy Import/Export [NAT]';
|
||||||
|
$_['text_support'] = 'Техническая поддержка и пожелания:';
|
||||||
|
$_['entry_license'] = 'Лицензионный ключ';
|
||||||
|
$_['entry_menu_position'] = 'Расположение меню [NAT]';
|
||||||
|
$_['text_menu_module_only'] = 'Только в "Модули / Расширения"';
|
||||||
|
$_['text_menu_header'] = 'В верхней панели (Шапка)';
|
||||||
|
$_['text_menu_sidebar'] = 'В боковом меню (Слева)';
|
||||||
|
$_['text_menu_both'] = 'В шапке и в боковом меню';
|
||||||
|
$_['entry_show_list'] = 'Показывать кнопки FAST';
|
||||||
|
$_['help_show_list'] = 'Глобальный переключатель отображения кнопок быстрого доступа.';
|
||||||
|
$_['entry_btn_catalog'] = 'Кнопки в списке товаров (Каталог)';
|
||||||
|
$_['entry_btn_batch'] = 'Кнопки в Batch Editor';
|
||||||
|
$_['entry_btn_handy'] = 'Кнопки в Handy Product Manager';
|
||||||
|
$_['btn_fast_export'] = 'FAST EXPORT';
|
||||||
|
$_['btn_fast_import'] = 'FAST IMPORT';
|
||||||
|
$_['btn_fast_backup'] = 'BACKUP (SQL)';
|
||||||
|
$_['button_export'] = 'Начать выгрузку';
|
||||||
|
$_['button_simulate'] = 'Симуляция (Dry-Run)';
|
||||||
|
$_['button_import'] = 'Применить изменения';
|
||||||
|
$_['btn_clear_log'] = 'Очистить лог';
|
||||||
|
$_['btn_download_log'] = 'Скачать лог (.txt)';
|
||||||
|
$_['entry_export_format'] = 'Формат выгрузки';
|
||||||
|
$_['entry_export_identifier'] = 'Главный идентификатор';
|
||||||
|
$_['text_ident_model'] = 'Model (Модель)';
|
||||||
|
$_['text_ident_sku'] = 'SKU (Артикул)';
|
||||||
|
$_['text_ident_id'] = 'Product ID (Системный ID)';
|
||||||
|
$_['text_ident_name'] = 'Название товара (Справочно)';
|
||||||
|
$_['entry_price_mode'] = 'Режим работы с ценами';
|
||||||
|
$_['text_price_simple'] = 'Только базовая цена';
|
||||||
|
$_['text_price_special'] = 'Цена + Общая акция';
|
||||||
|
$_['text_price_special_group'] = 'Цена + Акции по группам покупателей';
|
||||||
|
$_['text_price_discount'] = 'Цена + Скидки (от количества)';
|
||||||
|
$_['entry_status'] = 'Статус модуля';
|
||||||
|
$_['help_status'] = 'Включает или отключает функции импорта и экспорта модуля.';
|
||||||
|
$_['entry_filter_category'] = 'Фильтр: Категории';
|
||||||
|
$_['help_filter_category'] = 'Фильтровать выгружаемые товары по выбранным категориям. Если ничего не выбрано, будут выгружены все категории.';
|
||||||
|
$_['entry_filter_manufacturer'] = 'Фильтр: Производители';
|
||||||
|
$_['help_filter_manufacturer'] = 'Фильтровать выгружаемые товары по выбранным производителям. Если ничего не выбрано, будут выгружены все производители.';
|
||||||
|
$_['entry_filter_status'] = 'Статус товара';
|
||||||
|
$_['help_filter_status'] = 'Фильтровать выгружаемые товары по их статусу (Включено/Отключено).';
|
||||||
|
$_['entry_cron_status'] = 'Статус задачи';
|
||||||
|
$_['help_cron_status'] = 'Включить или отключить выполнение этой задачи кроном.';
|
||||||
|
$_['text_export_link_label'] = 'Ссылка на файл';
|
||||||
|
$_['text_import_source_label'] = 'Источник импорта';
|
||||||
|
$_['text_all_statuses'] = '-- Все статусы --';
|
||||||
|
$_['text_status_on'] = 'Включено (Да)';
|
||||||
|
$_['text_status_off'] = 'Отключено (Нет)';
|
||||||
|
$_['entry_filter_quantity'] = 'Мин. количество в наличии';
|
||||||
|
$_['help_filter_quantity'] = 'Например 1: выгрузит только товары в наличии (>0). 0: выгрузит все.';
|
||||||
|
$_['entry_filter_price'] = 'Фильтр: Цена (От и До)';
|
||||||
|
$_['entry_filter_date'] = 'Фильтр: Дата изменения (От и До)';
|
||||||
|
$_['entry_filter_batch'] = 'Фильтр: Метка импорта (import_batch)';
|
||||||
|
$_['text_batch_empty'] = '[Без метки / Пусто]';
|
||||||
|
$_['help_filter_batch_multi'] = 'Можно указать несколько через точку с запятой (;)';
|
||||||
|
$_['text_select_all'] = 'Выбрать все';
|
||||||
|
$_['text_unselect_all'] = 'Снять все';
|
||||||
|
$_['text_filter_hint'] = 'Подсказка: Если ничего не выбрано (галочки сняты), будут выгружены ВСЕ товары.';
|
||||||
|
$_['entry_batch_export'] = 'Товаров за проход (Экспорт)';
|
||||||
|
$_['help_batch_export'] = 'По умолчанию 200. Уменьшите, если экспорт обрывается по таймауту.';
|
||||||
|
$_['text_warning_backup'] = 'ВНИМАНИЕ: Перед загрузкой файла настоятельно рекомендуется сделать резервную копию цен и остатков с помощью кнопки BACKUP (SQL) вверху!';
|
||||||
|
$_['entry_import_source'] = 'Источник данных';
|
||||||
|
$_['text_source_file'] = 'Загрузить файл с ПК (.xlsx, .xls, .csv, .xml, .json)';
|
||||||
|
$_['text_source_url'] = 'Указать прямую ссылку (URL / Google Таблица)';
|
||||||
|
$_['entry_import_file'] = 'Файл / Ссылка для загрузки';
|
||||||
|
$_['text_modifiers_title'] = 'Модификаторы данных / Виртуальные поля';
|
||||||
|
$_['text_modifiers_desc'] = 'Создайте новые колонки на лету или измените существующие перед их загрузкой в БД.';
|
||||||
|
$_['text_modifier_add'] = 'Добавить правило';
|
||||||
|
$_['text_modifier_col'] = 'Колонка из прайса';
|
||||||
|
$_['text_modifier_action'] = 'Действие';
|
||||||
|
$_['text_modifier_target'] = 'Куда сохранить результат';
|
||||||
|
$_['text_modifier_target_new'] = '-- Создать новое виртуальное поле --';
|
||||||
|
$_['text_modifier_math'] = 'Калькулятор (Математика)';
|
||||||
|
$_['text_modifier_replace'] = 'Замена текста / Склейка';
|
||||||
|
$_['text_mapping_title'] = 'Маппинг системных полей';
|
||||||
|
$_['text_mapping_desc'] = 'Укажите, в каких колонках вашего файла (или виртуальных полях) находятся нужные данные.';
|
||||||
|
$_['text_mapping_skip'] = '-- Пропустить --';
|
||||||
|
$_['entry_import_missing'] = 'Действие с товарами, которых НЕТ в файле';
|
||||||
|
$_['text_missing_skip'] = 'Ничего не делать (пропустить)';
|
||||||
|
$_['text_missing_zero_all'] = 'Обнулить остатки (у всех товаров на сайте)';
|
||||||
|
$_['text_missing_zero_cat'] = 'Обнулить остатки (только в затронутых категориях/брендах)';
|
||||||
|
$_['text_missing_zero_batch'] = 'Обнулить остаток (только для текущей маркировки импорта)';
|
||||||
|
$_['text_missing_disable'] = 'Отключить товары (Статус = Отключено)';
|
||||||
|
$_['text_missing_disable_batch'] = 'Отключить товары (только для текущей маркировки импорта)';
|
||||||
|
$_['entry_import_batch_name'] = 'Назначить метку импорта (import_batch)';
|
||||||
|
$_['help_import_batch'] = 'Позволит в будущем легко найти, выгрузить или удалить именно эти товары.';
|
||||||
|
$_['entry_batch_import'] = 'Товаров за проход (Импорт)';
|
||||||
|
$_['entry_log_mode'] = 'Режим логгирования';
|
||||||
|
$_['text_log_full'] = 'Полный (Писать все действия)';
|
||||||
|
$_['text_log_changes'] = 'Только изменения (Рекомендуется)';
|
||||||
|
$_['text_log_off'] = 'Отключен (Только сухая статистика)';
|
||||||
|
$_['text_log_simulation'] = 'Режим симуляции (Dry-Run): Изменения пока НЕ сохранены в БД.';
|
||||||
|
$_['text_log_writing'] = 'Выполняется боевая запись в базу данных...';
|
||||||
|
$_['text_log_found'] = 'Найдено товаров:';
|
||||||
|
$_['text_log_updated'] = 'Будет обновлено:';
|
||||||
|
$_['text_log_not_found'] = 'Не найдено в БД:';
|
||||||
|
$_['text_log_missing_action'] = 'Попадут под действие "Отсутствующие":';
|
||||||
|
$_['text_import_complete'] = 'Импорт успешно завершен!';
|
||||||
|
$_['text_cron_profiles'] = 'Профили Автоматизации (CRON)';
|
||||||
|
$_['text_add_profile'] = 'Добавить профиль';
|
||||||
|
$_['text_edit_profile'] = 'Редактировать профиль';
|
||||||
|
$_['column_profile_name'] = 'Название профиля';
|
||||||
|
$_['column_profile_status'] = 'Статус';
|
||||||
|
$_['column_date_last_run'] = 'Последний запуск';
|
||||||
|
$_['column_action'] = 'Действие';
|
||||||
|
$_['entry_profile_name'] = 'Название профиля';
|
||||||
|
$_['entry_profile_url'] = 'Ссылка на прайс (URL)';
|
||||||
|
$_['entry_cron_command'] = 'CRON Команда для хостинга';
|
||||||
|
$_['help_cron_command'] = 'Скопируйте эту команду и добавьте в планировщик задач (CRON) на вашем сервере.';
|
||||||
|
$_['btn_add'] = 'Добавить';
|
||||||
|
$_['btn_edit'] = 'Редактировать';
|
||||||
|
$_['btn_delete'] = 'Удалить';
|
||||||
|
$_['btn_cancel'] = 'Отмена';
|
||||||
|
$_['btn_save_profile'] = 'Сохранить профиль';
|
||||||
|
$_['text_no_profiles'] = 'Нет профилей';
|
||||||
|
$_['text_cron_mapping_info'] = 'Для настройки маппинга полей и параметров, нажмите кнопку "Проверить и получить колонки", чтобы скрипт скачал заголовки из вашего прайса по ссылке.';
|
||||||
|
$_['error_empty_url'] = 'Пожалуйста, введите валидный URL';
|
||||||
|
$_['text_downloading'] = 'Загрузка...';
|
||||||
|
$_['error_fetch'] = 'Ошибка скачивания файла.';
|
||||||
|
$_['error_upload_failed'] = 'Ошибка загрузки файла.';
|
||||||
|
$_['text_confirm_clear_log'] = 'Очистить лог и кэш файлов?';
|
||||||
|
$_['text_log_cleared'] = 'Лог очищен.\n';
|
||||||
|
$_['text_confirm_import'] = 'Вы уверены? Данные будут записаны в базу.';
|
||||||
|
$_['text_log_start_sim'] = '--- СТАРТ СИМУЛЯЦИИ ---';
|
||||||
|
$_['text_log_start_imp'] = '--- СТАРТ ИМПОРТА ---';
|
||||||
|
$_['text_log_batch_done'] = 'обработан.';
|
||||||
|
$_['text_log_total_title'] = '=== ИТОГО ===';
|
||||||
|
$_['text_confirm_delete'] = 'Удалить профиль?';
|
||||||
|
$_['text_cron_dev_edit'] = 'Редактирование профиля';
|
||||||
|
$_['text_cron_dev_delete'] = 'Удаление профиля';
|
||||||
|
$_['text_cron_dev_save'] = 'Сохранение профиля';
|
||||||
|
$_['error_permission'] = 'У вас нет прав для управления этим модулем!';
|
||||||
|
$_['error_license'] = 'Неверный или отсутствующий лицензионный ключ!';
|
||||||
|
$_['error_file_upload'] = 'Ошибка загрузки файла. Проверьте лимиты сервера.';
|
||||||
|
$_['error_file_type'] = 'Недопустимый формат файла! Разрешены только .xlsx, .xls, .csv, .xml и .json';
|
||||||
|
$_['error_lib_missing'] = 'Библиотека PhpSpreadsheet не найдена! Загрузите её в system/library/nat/phpspreadsheet/';
|
||||||
|
$_['text_backup_error'] = 'Ошибка создания бэкапа! Проверьте права на запись в /system/storage/cache/';
|
||||||
|
$_['text_processing'] = 'Обработка...';
|
||||||
|
$_['text_no_products'] = 'Товары по вашему фильтру не найдены!';
|
||||||
|
$_['text_exporting'] = 'Выгрузка батча ';
|
||||||
|
$_['text_of'] = ' из ';
|
||||||
|
$_['text_error_batch'] = 'Критическая ошибка при обработке батча ';
|
||||||
|
$_['text_error_init'] = 'Ошибка инициализации экспорта';
|
||||||
|
$_['text_ecosystem_title'] = 'Экосистема модулей [NAT]';
|
||||||
|
$_['text_ecosystem_desc'] = 'Для максимальной скорости и безопасности вашего магазина мы разработали серию узкоспециализированных модулей, работающих по стандартам Zero Trust:';
|
||||||
|
$_['btn_all_modules'] = 'Профиль на OpenCart.com';
|
||||||
|
$_['btn_forum_modules'] = 'Профиль на OpenCartForum';
|
||||||
|
$_['text_mod_admin_tools'] = 'Admin Tools [NAT]';
|
||||||
|
$_['text_mod_admin_tools_desc'] = 'Удобные инструменты администратора: вход под клиентом, кастомизация админки, управление правами пользователей и скрытие ненужных пунктов меню.';
|
||||||
|
$_['text_mod_cat_opt'] = 'Catalog Optimizer [NAT]';
|
||||||
|
$_['text_mod_cat_opt_desc'] = 'Скрытие пустых категорий/брендов + SEO-сортировка (сначала в наличии) + очистка мусора в БД.';
|
||||||
|
$_['text_mod_db_opt'] = 'Database Optimizer [NAT]';
|
||||||
|
$_['text_mod_db_opt_desc'] = 'Интеллектуальный сборщик мусора базы данных, управление системными логами и добавление критических индексов для ускорения сайта.';
|
||||||
|
$_['text_mod_dom_scan'] = 'Domain Scanner [NAT]';
|
||||||
|
$_['text_mod_dom_scan_desc'] = 'Поиск и очистка внешних ссылок и HTTP-изображений в БД и файлах темы. Идеально для перехода на HTTPS или очистки после парсинга.';
|
||||||
|
$_['text_mod_easy_import'] = 'Easy Import/Export [NAT]';
|
||||||
|
$_['text_mod_easy_import_desc'] = 'Текущий модуль. Быстрый импорт/экспорт цен, остатков и товаров из XLS/XLSX/CSV/XML/JSON. Маппинг полей, Cron и поддержка URL.';
|
||||||
|
$_['text_mod_img_opt'] = 'Image Optimizer [NAT]';
|
||||||
|
$_['text_mod_img_opt_desc'] = 'Сжатие оригинальных изображений в WebP + массовая очистка неиспользуемых изображений на сервере.';
|
||||||
|
$_['text_mod_new_arrivals'] = 'New Arrivals [NAT]: True Sort by Date';
|
||||||
|
$_['text_mod_new_arrivals_desc'] = 'Автоматическая SEO-страница для новинок. Отображает товары строго по фактической дате добавления. Слайдеры, сетки и умный виджет архива дат в сайдбаре.';
|
||||||
|
$_['text_mod_utm_tracker'] = 'Order UTM Tracker [NAT]';
|
||||||
|
$_['text_mod_utm_tracker_desc'] = 'Автоматическое отслеживание UTM-меток при оформлении заказа. Сохраняет источник трафика, кампанию, ключевые слова и отображает эти данные в деталях заказа для анализа эффективности рекламы.';
|
||||||
|
$_['text_mod_poll'] = 'Poll Widget [NAT]';
|
||||||
|
$_['text_mod_poll_desc'] = 'Создание опросов и виджетов голосования с визуальным конструктором дизайна, детальной статистикой и защитой от накруток.';
|
||||||
|
$_['text_mod_promo_top_bar'] = 'Promo Top Bar [NAT]: Верхний рекламный инфо-баннер, информационная полоса над шапкой, бегущая строка и топ-баннер';
|
||||||
|
$_['text_mod_promo_top_bar_desc'] = 'Создание интерактивных промо-панелей и слайд-шоу в шапке сайта с конструктором блоков, таймерами, формой подписки и гибким таргетингом.';
|
||||||
|
$_['text_help_export_format'] = '<i class="fa fa-info-circle"></i> <b>Форматы выгрузки сложных цен:</b><br>Если выбран режим <b>"ВСЁ СРАЗУ"</b>, данные выгружаются в 1 ячейку (через точку с запятой <code>;</code>):<br>• Акции: <code>ID_группы:Цена</code> (пример: <code>1:99.00; 2:95.00</code>)<br>• Скидки: <code>ID_группы:Кол-во:Цена</code> (пример: <code>1:10:90.00</code>)';
|
||||||
|
$_['text_help_import_format'] = '<i class="fa fa-info-circle"></i> <b>Синтаксис импорта скидок:</b><br>Если вы мапите колонки <b>"Акции (Группы)"</b> или <b>"Скидки (Кол-во)"</b>, в прайсе должен быть строгий формат:<br>• Для акций: <code>ID_группы:Цена</code> (например <code>1:150.50</code>)<br>• Для скидок: <code>ID_группы:От_скольких_штук:Цена</code> (например <code>1:5:140.00; 1:10:130.00</code>)';
|
||||||
|
$_['text_format_auto'] = 'Автоопределение (Рекомендуется)';
|
||||||
|
$_['text_format_xlsx'] = '.xlsx (Modern Excel)';
|
||||||
|
$_['text_format_xls'] = '.xls (Legacy Excel 97-2004)';
|
||||||
|
$_['text_format_csv'] = '.csv';
|
||||||
|
$_['text_format_xml'] = '.xml / .yml (XML-формат)';
|
||||||
|
$_['text_format_json'] = '.json';
|
||||||
|
$_['text_format_hint'] = 'Если библиотека PhpSpreadsheet не найдена на сервере, будет принудительно выгружен .csv';
|
||||||
|
$_['text_price_all_advanced'] = 'ВСЁ СРАЗУ (Базовая + Акции групп + Скидки количеств)';
|
||||||
|
$_['text_col_price'] = 'Price (Базовая цена)';
|
||||||
|
$_['text_col_quantity'] = 'Quantity (Остаток)';
|
||||||
|
$_['text_col_status'] = 'Status (Статус)';
|
||||||
|
$_['text_col_special'] = 'Special (Акция)';
|
||||||
|
$_['text_col_specials_group'] = 'Акции (Группы)';
|
||||||
|
$_['text_col_discounts_group'] = 'Скидки (Кол-во)';
|
||||||
|
$_['text_placeholder_batch'] = 'price_update_1';
|
||||||
|
$_['text_placeholder_cron_name']= 'Прайс от Поставщика А';
|
||||||
|
$_['text_placeholder_url'] = 'https://example.com/price.csv';
|
||||||
|
$_['btn_cron_fetch'] = 'Проверить и получить колонки';
|
||||||
|
$_['text_cron_mapping_title'] = 'Маппинг колонок для этого профиля';
|
||||||
|
$_['text_cron_actions_title'] = 'Действия для этого профиля';
|
||||||
|
$_['entry_log_lines'] = 'Макс. строк лога на экране';
|
||||||
|
$_['text_empty_title'] = 'Без названия';
|
||||||
|
$_['error_empty_file'] = 'Ошибка: Файл пуст или имеет неверный формат!';
|
||||||
|
$_['error_mapping'] = 'Ошибка: Критическая ошибка маппинга! Не выбран главный идентификатор.';
|
||||||
|
$_['error_temp_file'] = 'Ошибка: Временный файл не найден, загрузите прайс заново!';
|
||||||
|
$_['entry_profile_type'] = 'Тип профиля';
|
||||||
|
$_['text_type_import'] = 'Импорт (Загрузка в БД)';
|
||||||
|
$_['text_type_export'] = 'Экспорт (Выгрузка по ссылке)';
|
||||||
|
$_['entry_export_dest'] = 'Имя файла для экспорта';
|
||||||
|
$_['help_export_dest'] = 'Например: pricelist.xml. Файл будет доступен по ссылке: ';
|
||||||
|
$_['text_cron_export_info'] = 'Внимание: В режиме Экспорта настройки маппинга скрыты. Выгрузка будет формироваться на основе ваших фильтров из вкладки "Экспорт".';
|
||||||
|
$_['entry_cron_secret'] = 'Секретный ключ (CRON Token)';
|
||||||
|
$_['help_cron_secret'] = 'Защита скрипта от запуска посторонними. Введите любую сложную фразу (напр. s3cr3t_t0k3n). Без нее CRON не сработает.';
|
||||||
|
$_['error_cron_secret'] = 'Ошибка: Не задан секретный ключ CRON!';
|
||||||
|
$_['text_cron_export_link'] = 'Постоянная ссылка для ваших клиентов:';
|
||||||
|
$_['entry_inverse_special'] = 'Инверсия акционных цен';
|
||||||
|
$_['help_inverse_special'] = 'Если поставщик указывает цену со скидкой в основной колонке, а старую (большую) цену как акционную - модуль сам поменяет их местами.';
|
||||||
|
$_['entry_export_folder'] = 'Папка для файлов экспорта';
|
||||||
|
$_['help_export_folder'] = 'Название папки на сервере. Скрипт сам создаст её и защитит файл .htaccess.';
|
||||||
|
$_['entry_export_path'] = 'Расположение папки экспорта';
|
||||||
|
$_['text_path_root'] = 'В корне сайта (Рекомендуется)';
|
||||||
|
$_['text_path_image'] = 'В папке image/catalog/';
|
||||||
|
$_['text_custom_fields'] = 'Маппинг кастомных полей';
|
||||||
|
$_['text_export_custom_fields'] = 'Выгрузка кастомных полей';
|
||||||
|
$_['text_add_custom_field'] = 'Добавить поле';
|
||||||
|
$_['text_table'] = 'Таблица (Где есть product_id)';
|
||||||
|
$_['text_column'] = 'Название колонки';
|
||||||
|
$_['text_action_math'] = 'Калькулятор (Математика)';
|
||||||
|
$_['text_action_replace'] = 'Замена текста / Склейка';
|
||||||
|
$_['text_math_help'] = 'Пример: +15%, *1.2, -10.5';
|
||||||
|
$_['text_replace_help'] = 'Пример: Найти "СтарыйБренд", заменить на "НовыйБренд"';
|
||||||
|
$_['btn_settings'] = 'Настроить';
|
||||||
|
$_['text_target_col_name'] = 'Название колонки в прайсе (CSV/XML/JSON)';
|
||||||
|
$_['text_rule_merge_col1'] = 'Первая колонка';
|
||||||
|
$_['text_rule_merge_sep'] = 'Разделитель (например: пробел, -, <br>)';
|
||||||
|
$_['text_rule_merge_col2'] = 'Вторая колонка';
|
||||||
|
$_['text_rule_merge_hint'] = 'Склеивает значения двух колонок в одну через указанный разделитель.';
|
||||||
|
$_['text_btn_merge_setup'] = 'Настроить склейку';
|
||||||
|
$_['text_btn_merge_done'] = 'Склейка настроена';
|
||||||
|
$_['text_target_self'] = 'Текущий столбец/поле';
|
||||||
|
$_['text_mod_action_add'] = '+ Прибавить число';
|
||||||
|
$_['text_mod_action_sub'] = '- Отнять число';
|
||||||
|
$_['text_mod_action_mul'] = '* Умножить на';
|
||||||
|
$_['text_mod_action_div'] = '/ Разделить на';
|
||||||
|
$_['text_mod_action_add_pct'] = '+ Прибавить процент (%)';
|
||||||
|
$_['text_mod_action_sub_pct'] = '- Отнять процент (%)';
|
||||||
|
$_['text_mod_action_rnd_0'] = 'Округлить до целого';
|
||||||
|
$_['text_mod_action_rnd_2'] = 'Округлить до копеек (.00)';
|
||||||
|
$_['text_mod_action_replace'] = 'Замена текста';
|
||||||
|
$_['text_mod_action_merge'] = 'Склейка колонок';
|
||||||
|
$_['text_export_modifiers'] = 'Модификаторы данных (Экспорт)';
|
||||||
|
$_['error_server_500'] = 'СИСТЕМНАЯ ОШИБКА СЕРВЕРА (500/504):';
|
||||||
|
$_['text_status_code'] = 'Статус: ';
|
||||||
|
$_['text_server_response'] = 'Ответ сервера: ';
|
||||||
|
$_['text_no_parameters'] = 'Без параметров';
|
||||||
|
$_['text_search_for'] = 'Что найти';
|
||||||
|
$_['text_replace_with'] = 'На что заменить';
|
||||||
|
$_['text_field_1'] = 'Поле 1';
|
||||||
|
$_['text_field_2'] = 'Поле 2';
|
||||||
|
$_['text_separator'] = 'Разделитель';
|
||||||
|
$_['text_value'] = 'Значение';
|
||||||
|
$_['text_new_field'] = 'Новое поле';
|
||||||
|
$_['text_new_field_name'] = 'Имя нового поля';
|
||||||
|
$_['text_table_select'] = '-- Таблица --';
|
||||||
|
$_['text_select'] = '-- Выберите --';
|
||||||
|
$_['text_enter_manually'] = '-- Ввести вручную --';
|
||||||
|
$_['text_virtual'] = '[Вирт] ';
|
||||||
|
$_['error_prefix'] = 'Ошибка: ';
|
||||||
|
$_['text_import_finished_cleanup'] = '*** Импорт завершен! Файл удален. Для новой загрузки выберите файл заново. ***';
|
||||||
|
$_['text_fast_buttons'] = 'Быстрые кнопки';
|
||||||
|
$_['text_min'] = 'Мин';
|
||||||
|
$_['text_max'] = 'Макс';
|
||||||
|
$_['text_batch_label'] = 'Батч';
|
||||||
|
$_['text_help_specials_group_title'] = 'Формат акций по группам: customer_group_id:price;customer_group_id:price';
|
||||||
|
$_['text_help_discounts_group_title'] = 'Формат скидок по группам: customer_group_id:quantity:price;customer_group_id:quantity:price';
|
||||||
|
$_['text_custom_text_label'] = 'Свой текст';
|
||||||
|
$_['text_custom_text_placeholder'] = 'Введите текст...';
|
||||||
|
$_['text_condition'] = 'Условие';
|
||||||
|
$_['text_cond_always'] = '-- Всегда применять --';
|
||||||
|
$_['text_cond_equals'] = 'Равно (=)';
|
||||||
|
$_['text_cond_not_equals'] = 'Не равно (!=)';
|
||||||
|
$_['text_cond_greater'] = 'Больше (>)';
|
||||||
|
$_['text_cond_less'] = 'Меньше (<)';
|
||||||
|
$_['text_cond_contains'] = 'Содержит';
|
||||||
|
$_['text_cond_not_contains'] = 'Не содержит';
|
||||||
|
$_['text_cond_empty'] = 'Пусто';
|
||||||
|
$_['text_cond_not_empty'] = 'Не пусто';
|
||||||
|
$_['text_preview_title'] = 'Предпросмотр данных файла (первые 5 строк)';
|
||||||
|
$_['text_source_api'] = 'REST API (Ссылка на каталог поставщика) [BETA]';
|
||||||
|
$_['text_api_settings'] = 'Настройки REST API';
|
||||||
|
$_['entry_api_endpoint'] = 'URL API Endpoint';
|
||||||
|
$_['help_api_endpoint'] = 'Используйте плейсхолдеры {page}, {offset}, {limit}, {token}. Пример: https://api.com/products?page={page}';
|
||||||
|
$_['entry_api_method'] = 'Метод запроса';
|
||||||
|
$_['entry_api_headers'] = 'Заголовки запроса (Headers)';
|
||||||
|
$_['help_api_headers'] = 'Один заголовок на строку. Пример:<br>Accept: application/json<br>X-API-Key: {token}';
|
||||||
|
$_['entry_api_body'] = 'Тело запроса (POST)';
|
||||||
|
$_['help_api_body'] = 'Строка тела запроса для POST. Поддерживает плейсхолдеры.';
|
||||||
|
$_['entry_api_auth_mode'] = 'Режим авторизации';
|
||||||
|
$_['text_auth_none'] = 'Без авторизации';
|
||||||
|
$_['text_auth_basic'] = 'Basic Auth (Логин/Пароль)';
|
||||||
|
$_['text_auth_bearer'] = 'Статический Bearer Token';
|
||||||
|
$_['text_auth_custom_post'] = 'Динамический Token через Auth POST запрос';
|
||||||
|
$_['entry_api_username'] = 'Имя пользователя Auth';
|
||||||
|
$_['entry_api_password'] = 'Пароль Auth';
|
||||||
|
$_['entry_api_bearer_token'] = 'Bearer Token';
|
||||||
|
$_['entry_api_auth_url'] = 'URL запроса авторизации (POST)';
|
||||||
|
$_['entry_api_auth_body'] = 'Тело запроса авторизации (POST)';
|
||||||
|
$_['help_api_auth_body'] = 'JSON или форма для авторизации. Пример: {"username": "admin", "password": "123"}';
|
||||||
|
$_['entry_api_auth_token_path'] = 'JSON путь к токену';
|
||||||
|
$_['help_api_auth_token_path'] = 'Точечный путь к токену в ответе. Пример: data.access_token';
|
||||||
|
$_['entry_api_pagination_mode'] = 'Режим пагинации';
|
||||||
|
$_['text_pagi_none'] = 'Без пагинации (Один запрос)';
|
||||||
|
$_['text_pagi_page'] = 'Пагинация по страницам';
|
||||||
|
$_['text_pagi_offset'] = 'Пагинация со смещением (Offset)';
|
||||||
|
$_['entry_api_page_placeholder'] = 'Плейсхолдер страницы в URL/Теле';
|
||||||
|
$_['entry_api_start_page'] = 'Начальный номер страницы';
|
||||||
|
$_['entry_api_offset_placeholder'] = 'Плейсхолдер смещения в URL/Теле';
|
||||||
|
$_['entry_api_start_offset'] = 'Начальное значение смещения';
|
||||||
|
$_['entry_api_limit_placeholder'] = 'Плейсхолдер размера лимита/пачки';
|
||||||
|
$_['entry_api_limit_value'] = 'Элементов на запрос (Limit)';
|
||||||
|
$_['entry_api_response_format'] = 'Формат ответа API';
|
||||||
|
$_['entry_api_json_root_path'] = 'JSON путь к массиву товаров';
|
||||||
|
$_['help_api_json_root_path'] = 'Точечный путь к массиву товаров. Оставьте пустым, если корень — массив.';
|
||||||
|
$_['entry_api_xml_product_tag'] = 'Тег товара XML';
|
||||||
|
$_['help_api_xml_product_tag'] = 'Имя тега элемента, содержащего товар. Пример: offer';
|
||||||
|
$_['text_col_category'] = 'Категория / Путь категории';
|
||||||
|
$_['text_category_bindings'] = 'Связи категорий';
|
||||||
|
$_['btn_load_categories'] = 'Загрузить категории из файла';
|
||||||
|
$_['text_supplier_category'] = 'Категория поставщика';
|
||||||
|
$_['text_store_category'] = 'Категория магазина';
|
||||||
|
$_['text_select_category'] = '--- Выберите категорию ---';
|
||||||
|
|
||||||
|
$_['text_mod_action_markup_table'] = 'Таблица наценок';
|
||||||
|
$_['text_mod_action_comma_to_dot'] = 'Разделитель запятая в точку';
|
||||||
|
$_['text_mod_action_currency_convert'] = 'Конвертация валюты';
|
||||||
|
$_['text_mod_action_combine_fields'] = 'Объединение по шаблону';
|
||||||
|
|
||||||
|
$_['entry_option_quantity_sync'] = 'Синхронизировать остаток опций';
|
||||||
|
$_['help_option_quantity_sync'] = 'Автоматически пересчитывать общее количество товара как сумму остатков всех его опций.';
|
||||||
|
$_['text_search_mapping_placeholder'] = 'Поиск по названию колонки...';
|
||||||
|
$_['text_profile_select'] = 'Выберите профиль';
|
||||||
|
$_['text_select_profile_placeholder'] = '--- Новый профиль / Стандартный ---';
|
||||||
|
$_['btn_delete_profile'] = 'Удалить профиль';
|
||||||
|
$_['error_stock_guard'] = 'Импорт прерван защитой остатков: %s%% товаров в фиде имеют нулевой остаток (лимит защиты: %s%%).';
|
||||||
|
$_['entry_price_guard'] = 'Защита цен (Price Guard)';
|
||||||
|
$_['help_price_guard'] = 'Не понижать цену товара, если цена в фиде ниже текущей цены на сайте.';
|
||||||
|
$_['entry_stock_guard'] = 'Защита остатков (Stock Guard)';
|
||||||
|
$_['help_stock_guard'] = 'Прервать импорт, если количество обнуляемых товаров превышает указанный процент от общего числа.';
|
||||||
|
$_['entry_map_image'] = 'URL главного изображения';
|
||||||
|
$_['entry_map_additional_images'] = 'URL дополнительных изображений (через запятую)';
|
||||||
|
$_['entry_img_overwrite'] = 'Перезаписывать существующие картинки';
|
||||||
|
$_['help_img_overwrite'] = 'Если включено, картинки будут скачиваться заново. Если выключено — скачивание пропускается, если файл уже есть на диске.';
|
||||||
|
$_['entry_img_dir'] = 'Подпапка для картинок';
|
||||||
|
$_['help_img_dir'] = 'Папка внутри image/catalog/, в которую сохраняются скачанные картинки (например, easy_import).';
|
||||||
|
$_['entry_visual_diff'] = 'Visual Diff при симуляции';
|
||||||
|
$_['help_visual_diff'] = 'Если включено, результаты тестовой симуляции будут показаны в виде удобной таблицы изменений.';
|
||||||
|
$_['text_visual_diff_title'] = 'Таблица изменений (Visual Diff)';
|
||||||
|
$_['placeholder_search_model'] = 'Поиск по модели...';
|
||||||
|
$_['btn_filter_all'] = 'Все';
|
||||||
|
$_['btn_filter_updated'] = 'Обновлено';
|
||||||
|
$_['btn_filter_skipped'] = 'Пропущено (Price Guard)';
|
||||||
|
$_['entry_field'] = 'Поле';
|
||||||
|
$_['entry_old_value'] = 'Было';
|
||||||
|
$_['entry_new_value'] = 'Станет';
|
||||||
|
$_['btn_show_cron_command'] = 'Показать команду Cron';
|
||||||
|
$_['text_cron_instructions'] = 'Скопируйте одну из команд ниже и добавьте ее в планировщик задач Cron на вашем хостинге:';
|
||||||
|
$_['btn_copy'] = 'Копировать';
|
||||||
|
$_['text_copied'] = 'Скопировано!';
|
||||||
|
$_['entry_update_content'] = 'Обновлять контент и акции';
|
||||||
|
$_['help_update_content'] = 'По умолчанию выключено. Включите, если кроме цен и остатков требуется обновить текстовые данные (названия), привязки категорий, скидки, акции и картинки.';
|
||||||
|
$_['text_col_discount'] = 'Простая скидка от кол-ва';
|
||||||
|
$_['text_help_discount_title'] = 'Цена скидки, которая применится для первой группы покупателей при достижении указанного количества товаров (по умолчанию: от 2 шт.).';
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Step navigation ---
|
||||||
|
$_['btn_next_mappings'] = 'Далее: Маппинг полей';
|
||||||
|
$_['btn_next_custom_fields'] = 'Далее: Кастомные поля';
|
||||||
|
$_['btn_next_category_bindings'] = 'Далее: Привязка категорий';
|
||||||
|
$_['btn_next_advanced_settings'] = 'Далее: Расширенные настройки';
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Hardcoded messages ---
|
||||||
|
$_['text_no_categories_yet'] = 'Категории ещё не загружены. Сначала назначьте колонку категории и нажмите «Загрузить категории».';
|
||||||
|
$_['text_no_categories_yet_short'] = 'Категории ещё не загружены. Назначьте маппинг категории.';
|
||||||
|
$_['error_api_endpoint_required'] = 'Укажите URL API Endpoint.';
|
||||||
|
$_['text_manual_import'] = 'Ручной импорт';
|
||||||
|
$_['error_upload_file_first'] = 'Сначала загрузите файл.';
|
||||||
|
$_['error_select_category_first'] = 'Сначала назначьте колонку категории в маппинге.';
|
||||||
|
$_['error_ajax_failed'] = 'Ошибка AJAX запроса.';
|
||||||
|
$_['error_load_file_first'] = 'Сначала загрузите или скачайте файл.';
|
||||||
|
$_['text_loading'] = 'Загрузка...';
|
||||||
|
$_['text_off'] = 'Выкл';
|
||||||
|
$_['text_enabled'] = 'Включено';
|
||||||
|
$_['text_disabled'] = 'Отключено';
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Placeholders ---
|
||||||
|
$_['text_placeholder_default'] = 'По умолчанию';
|
||||||
|
$_['text_placeholder_price'] = 'Цена';
|
||||||
|
$_['text_placeholder_qty'] = 'Кол-во';
|
||||||
|
$_['text_placeholder_currency_from'] = 'Из (напр. USD)';
|
||||||
|
$_['text_placeholder_currency_to'] = 'В (напр. UAH)';
|
||||||
|
$_['text_placeholder_multiplier'] = 'Множитель';
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Profile modal ---
|
||||||
|
$_['error_profile_name_empty'] = 'Название профиля не может быть пустым.';
|
||||||
|
$_['text_profile_saved'] = 'Профиль успешно сохранён.';
|
||||||
|
$_['text_profile_deleted'] = 'Профиль удалён.';
|
||||||
|
$_['text_save_profile_title'] = 'Сохранить профиль импорта';
|
||||||
|
$_['text_save_profile_target'] = 'Сохранить в';
|
||||||
|
$_['text_profile_new'] = '--- Новый профиль ---';
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Mapping & search ---
|
||||||
|
$_['text_mapping_no_results'] = 'Ничего не найдено';
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Discount format hints ---
|
||||||
|
$_['text_help_simple_discount_format'] = 'Одно число — цена скидки. Применяется ко всем покупателям при покупке от 2 шт. Пример: 150.00';
|
||||||
|
$_['text_help_discounts_group_format'] = 'Формат: ID_группы:Кол-во:Цена через точку с запятой. Пример: 1:5:140.00;1:10:130.00';
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Image mode ---
|
||||||
|
$_['text_images_single_col'] = 'Все фото в одной колонке (через запятую)';
|
||||||
|
$_['text_images_multi_col'] = 'Каждое фото в отдельной колонке';
|
||||||
|
$_['btn_add_image_col'] = 'Добавить столбец фото';
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Price Guard % ---
|
||||||
|
$_['entry_price_guard_pct'] = 'Макс. снижение цены (%)';
|
||||||
|
$_['help_price_guard_pct'] = 'Не обновлять цену, если она снижается более чем на указанный процент. 0 = без ограничений.';
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Category binding modes ---
|
||||||
|
$_['entry_cat_binding_mode'] = 'Режим привязки категорий';
|
||||||
|
$_['text_cat_bind_mixed'] = 'Смешанный (найти или создать)';
|
||||||
|
$_['text_cat_bind_exact'] = 'Только точное совпадение';
|
||||||
|
$_['text_cat_bind_skip_new'] = 'Пропустить если не найдено';
|
||||||
|
$_['help_map_category'] = 'Если не назначено — категории не обновляются. Поддерживает полный путь: Главная > Подкатегория.';
|
||||||
|
|
||||||
|
// --- Additional keys for currency, rounding, history and licensing ---
|
||||||
|
$_['text_confirm_delete_profile'] = 'Вы уверены, что хотите удалить этот профиль?';
|
||||||
|
$_['entry_currency_col'] = 'Колонка валюты';
|
||||||
|
$_['entry_currency_feed'] = 'Валюта источника';
|
||||||
|
$_['entry_currency_mode'] = 'Режим конвертации';
|
||||||
|
$_['entry_currency_rate'] = 'Курс обмена';
|
||||||
|
$_['entry_currency_rate_selector'] = 'Источник курса';
|
||||||
|
$_['entry_currency_rules'] = 'Правила конвертации';
|
||||||
|
$_['entry_currency_source'] = 'Валюта поставщика';
|
||||||
|
$_['btn_add_currency_rule'] = '+ Добавить правило';
|
||||||
|
$_['text_currency_multi'] = 'Мультивалюта';
|
||||||
|
$_['text_currency_off'] = 'Отключено';
|
||||||
|
$_['text_currency_single'] = 'Одна (глобальный курс)';
|
||||||
|
$_['text_currency_source_custom'] = 'Свой курс';
|
||||||
|
$_['text_currency_source_store'] = 'Курс магазина';
|
||||||
|
$_['text_supplier_currency'] = 'Валюта поставщика';
|
||||||
|
$_['entry_rounding_precision'] = 'Округлить до';
|
||||||
|
$_['entry_rounding_type'] = 'Метод округления';
|
||||||
|
$_['text_section_currency_rounding'] = 'Округление';
|
||||||
|
$_['text_rounding_ceil'] = 'Вверх';
|
||||||
|
$_['text_rounding_floor'] = 'Вниз';
|
||||||
|
$_['text_rounding_math'] = 'Математическое';
|
||||||
|
$_['text_rounding_off'] = 'Без округления';
|
||||||
|
$_['text_precision_int'] = 'Целое (0)';
|
||||||
|
$_['text_precision_1dec'] = '1 знак (0.0)';
|
||||||
|
$_['text_precision_2dec'] = '2 знака (0.00)';
|
||||||
|
$_['text_precision_tens'] = 'Десятки (10, 20...)';
|
||||||
|
$_['text_precision_hundreds'] = 'Сотни (100, 200...)';
|
||||||
|
$_['text_precision_90'] = 'X9 (99, 199...)';
|
||||||
|
$_['text_precision_99'] = 'XX9 (999, 1999...)';
|
||||||
|
$_['tab_history'] = 'История';
|
||||||
|
$_['text_history_date'] = 'Дата';
|
||||||
|
$_['text_history_profile'] = 'Профиль';
|
||||||
|
$_['text_history_type'] = 'Тип';
|
||||||
|
$_['text_history_status'] = 'Статус';
|
||||||
|
$_['text_history_updated'] = 'Обновлено';
|
||||||
|
$_['text_history_skipped'] = 'Пропущено';
|
||||||
|
$_['text_history_actions'] = 'Действия';
|
||||||
|
$_['text_history_not_found'] = 'История пуста.';
|
||||||
|
$_['button_clear_history'] = 'Очистить историю';
|
||||||
|
$_['text_confirm_clear_history'] = 'Очистить всю историю импорта?';
|
||||||
|
$_['text_col_identifier'] = 'Идентификатор';
|
||||||
|
$_['text_ident_product_id'] = 'Product ID';
|
||||||
|
$_['text_no_results'] = 'Ничего не найдено.';
|
||||||
|
$_['text_12_hours'] = 'Каждые 12 часов';
|
||||||
|
$_['text_24_hours'] = 'Каждые 24 часа';
|
||||||
|
$_['text_3_days'] = 'Каждые 3 дня';
|
||||||
|
$_['text_7_days'] = 'Каждые 7 дней';
|
||||||
|
$_['text_14_days'] = 'Каждые 14 дней';
|
||||||
|
$_['text_30_days'] = 'Каждые 30 дней';
|
||||||
|
$_['help_batch_import'] = 'Имя партии для группировки сессий в истории.';
|
||||||
|
$_['entry_cron_alert_threshold'] = 'Оповещать если цена упала на (%)';
|
||||||
|
$_['help_cron_alert_threshold'] = 'Уведомить когда цена упала больше чем на % (0 = выкл).';
|
||||||
|
$_['text_license_invalid'] = 'Лицензия не активирована!';
|
||||||
|
$_['text_license_help'] = 'Для работы модуля введите лицензионный ключ. Если вы приобрели модуль на OpenCartForum, ключ отправлен вам на почту и в Telegram-боте. По вопросам получения ключа пишите на <a href="mailto:info@nat.od.ua">info@nat.od.ua</a> или в личные сообщения <strong>NAT</strong> на форуме.';
|
||||||
|
$_['text_if_drops_by'] = 'если цена упала на';
|
||||||
|
$_['text_required'] = 'Обязательно';
|
||||||
|
$_['help_cat_binding_mode'] = 'Смешанный = Найти или создать категорию. Только точное = Привязывать только при точном совпадении. Пропустить = Пропустить привязку категории, если не найдена.';
|
||||||
|
$_['text_set_for_all'] = '--- Установить для всех ---';
|
||||||
|
// New features from Universal Import analysis
|
||||||
|
$_['entry_price_ignore_zero'] = 'Игнорировать нулевые/пустые цены';
|
||||||
|
$_['help_price_ignore_zero'] = 'Не обновлять цену товара, если в файле импорта она равна 0 или пустая.';
|
||||||
|
$_['entry_missing_limit_batch'] = 'Ограничить только текущей партией';
|
||||||
|
$_['help_missing_limit_batch'] = 'Применять действия к отсутствующим товарам только если они принадлежат к этой же партии импорта (защищает товары других поставщиков).';
|
||||||
|
$_['entry_option_update_mode'] = 'Режим обновления опций';
|
||||||
|
$_['text_option_overwrite'] = 'Перезаписать (удалить старые опции)';
|
||||||
|
$_['text_option_update'] = 'Обновить (обновить количество/цену совпавших, добавить новые)';
|
||||||
|
$_['entry_image_update_mode'] = 'Дополнительные фото';
|
||||||
|
$_['text_image_overwrite'] = 'Перезаписать (удалить старые)';
|
||||||
|
$_['text_image_keep'] = 'Добавить новые (сохранить существующие)';
|
||||||
|
$_['text_missing_zero_brand'] = 'Обнулить количество для товаров этих производителей';
|
||||||
|
$_['text_missing_disable_brand'] = 'Отключить товары этих производителей';
|
||||||
|
|
||||||
|
$_['text_help_custom_fields_info'] = 'Кастомные поля позволяют сопоставлять колонки файла с любыми полями БД OpenCart. Популярные примеры: <b>product_description</b> (meta_h1, meta_title, tag), <b>product</b> (jan, isbn, mpn, location, weight, length).';
|
||||||
|
|
||||||
|
$_['text_sim_new_products'] = 'Новых товаров';
|
||||||
|
$_['text_sim_updated_products'] = 'Обновится товаров';
|
||||||
|
$_['text_sim_price_guarded'] = 'Защищено от падения цены';
|
||||||
|
$_['text_sim_skipped_products'] = 'Пропущено строк';
|
||||||
|
$_['btn_export_profile_json'] = 'Скачать профиль в JSON';
|
||||||
|
$_['btn_import_profile_json'] = 'Загрузить профиль из JSON';
|
||||||
|
|
||||||
|
$_['text_markup_up_to'] = 'Цена до';
|
||||||
|
$_['text_markup_multiplier'] = 'Коэф. (напр. 1.25)';
|
||||||
|
$_['text_markup_add_tier'] = 'Добавить порог';
|
||||||
|
$_['text_markup_raw_string'] = 'Строка';
|
||||||
|
|
||||||
|
$_['text_cron_never_run'] = 'Не запускался';
|
||||||
|
$_['text_cron_status_active'] = 'Активен';
|
||||||
|
$_['text_cron_status_alert'] = 'Внимание';
|
||||||
|
$_['text_cron_status_error'] = 'Ошибка';
|
||||||
|
$_['text_cron_alert_tooltip'] = 'Внимание: нет активности %s дней (порог: %s)';
|
||||||
|
$_['text_cron_error_tooltip'] = 'Последний запуск завершился с ошибкой: %s';
|
||||||
|
|
||||||
|
$_['text_col_manufacturer'] = 'Производитель';
|
||||||
|
$_['help_map_manufacturer'] = 'Привязка производителя. Поддерживает поиск по имени или ID, а также автоматическое создание.';
|
||||||
|
$_['entry_empty_special_action'] = 'При пустом значении акции в файле';
|
||||||
|
$_['text_empty_special_skip'] = 'Пропустить (сохранить акции в магазине)';
|
||||||
|
$_['text_empty_special_delete'] = 'Удалить акции у товара';
|
||||||
|
$_['help_empty_special_action'] = 'Определяет, что делать с акциями в магазине, если колонка акции в прайсе поставщика пуста.';
|
||||||
|
$_['entry_category_update_mode'] = 'Режим обновления категорий';
|
||||||
|
$_['text_category_mode_overwrite'] = 'Перезаписать (заменять привязку)';
|
||||||
|
$_['text_category_mode_append'] = 'Добавлять (сохранять существующие категории)';
|
||||||
|
$_['help_category_update_mode'] = 'Перезаписать — удаляет старые привязки к категориям. Добавлять — сохраняет товар в существующих категориях и добавляет новую.';
|
||||||
|
$_['entry_man_binding_mode'] = 'Режим привязки производителей';
|
||||||
|
$_['text_man_binding_mixed'] = 'Смешанный (найти или создать)';
|
||||||
|
$_['text_man_binding_search'] = 'Только связывать с существующим';
|
||||||
|
$_['text_man_binding_create'] = 'Всегда создавать нового';
|
||||||
|
$_['help_man_binding_mode'] = 'Смешанный = найти совпадение по названию, иначе создать производителя.';
|
||||||
|
$_['entry_model'] = 'Модель';
|
||||||
|
$_['entry_name'] = 'Название товара';
|
||||||
|
$_['help_map_image'] = 'Основное изображение товара (прямой URL или локальный путь в image/catalog/)';
|
||||||
|
$_['text_action_translit'] = 'Транслитерация в ЧПУ (SEO URL)';
|
||||||
|
$_['text_missing_disable_cat'] = 'Отключить (только выбранные категории)';
|
||||||
|
$_['text_log_real_import'] = 'Реальный импорт товаров...';
|
||||||
|
$_['error_post_max_size'] = 'Ошибка: размер загружаемого файла превышает лимит сервера post_max_size (%s)!';
|
||||||
|
|
||||||
|
// --- Лицензирование NAT (Стандарт V5 Final) ---
|
||||||
|
$_['nat_gk_title'] = 'Активация модуля';
|
||||||
|
$_['text_nat_domain_label'] = 'Ваш домен:';
|
||||||
|
$_['text_nat_copy_domain'] = 'Копировать';
|
||||||
|
$_['text_nat_enter_key'] = 'Введите лицензионный ключ:';
|
||||||
|
$_['button_nat_activate'] = 'Активировать';
|
||||||
|
$_['text_nat_bot_btn'] = 'Получить ключ в Telegram-боте';
|
||||||
|
$_['text_nat_rule_domain'] = '<b>Условия лицензии:</b> 1 покупка = 1 домен. Ключ привязывается к основному домену без префикса www.';
|
||||||
|
$_['text_nat_contacts_title'] = 'Получение ключа и поддержка:';
|
||||||
|
$_['placeholder_license'] = 'XXXX - XXXX - XXXX - XXXX';
|
||||||
|
$_['text_license_active'] = 'Лицензия активна';
|
||||||
|
$_['text_nat_domain_copied'] = 'Скопировано!';
|
||||||
|
$_['text_nat_support'] = 'Поддержка:';
|
||||||
|
$_['entry_license'] = 'Лицензионный ключ:';
|
||||||
|
|
@ -0,0 +1,574 @@
|
||||||
|
<?php
|
||||||
|
if (!defined('DIR_APPLICATION')) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$_['heading_title'] = '<b><i class="fa fa-space-shuttle fa-rotate-270" style="color: #ec741c; margin-right: 3px; vertical-align: -1px;"></i>Easy Import/Export [NAT]:</b> Швидкий імпорт/експорт цін та залишків';
|
||||||
|
$_['heading_title_raw'] = 'Easy Import/Export [NAT]';
|
||||||
|
|
||||||
|
$_['tab_nat_info'] = 'Про модуль';
|
||||||
|
$_['text_nat_author'] = 'Автор / Розробник:';
|
||||||
|
$_['text_nat_support'] = 'Технічна підтримка:';
|
||||||
|
$_['text_nat_tg_channel'] = 'Telegram-бот підтримки:';
|
||||||
|
$_['text_nat_dev_profile'] = 'Профіль на форумі:';
|
||||||
|
$_['text_nat_site'] = 'Офіційний сайт:';
|
||||||
|
$_['text_nat_version_badge']= 'Офіційна версія 3.0 ai';
|
||||||
|
$_['tab_settings'] = 'Налаштування';
|
||||||
|
$_['tab_export'] = 'Експорт (Вивантаження)';
|
||||||
|
$_['tab_import'] = 'Імпорт (Завантаження)';
|
||||||
|
$_['tab_cron'] = 'Автоімпорт (CRON)';
|
||||||
|
$_['tab_info'] = 'Інфо / Екосистема [NAT]';
|
||||||
|
$_['text_extension'] = 'Розширення';
|
||||||
|
$_['text_success'] = 'Успіх: Налаштування модуля успішно збережено!';
|
||||||
|
$_['text_edit'] = 'Керування Easy Import/Export [NAT]';
|
||||||
|
$_['text_support'] = 'Технічна підтримка та побажання:';
|
||||||
|
$_['entry_license'] = 'Ліцензійний ключ';
|
||||||
|
$_['entry_menu_position'] = 'Розташування меню [NAT]';
|
||||||
|
$_['text_menu_module_only'] = 'Тільки у "Модулі / Розширення"';
|
||||||
|
$_['text_menu_header'] = 'У верхній панелі (Шапка)';
|
||||||
|
$_['text_menu_sidebar'] = 'У бічному меню (Ліворуч)';
|
||||||
|
$_['text_menu_both'] = 'У шапці та у бічному меню';
|
||||||
|
$_['entry_show_list'] = 'Показувати кнопки FAST';
|
||||||
|
$_['help_show_list'] = 'Глобальний перемикач відображення кнопок швидкого доступу.';
|
||||||
|
$_['entry_btn_catalog'] = 'Кнопки у списку товарів (Каталог)';
|
||||||
|
$_['entry_btn_batch'] = 'Кнопки у Batch Editor';
|
||||||
|
$_['entry_btn_handy'] = 'Кнопки у Handy Product Manager';
|
||||||
|
$_['btn_fast_export'] = 'FAST EXPORT';
|
||||||
|
$_['btn_fast_import'] = 'FAST IMPORT';
|
||||||
|
$_['btn_fast_backup'] = 'BACKUP (SQL)';
|
||||||
|
$_['button_export'] = 'Почати вивантаження';
|
||||||
|
$_['button_simulate'] = 'Симуляція (Dry-Run)';
|
||||||
|
$_['button_import'] = 'Застосувати зміни';
|
||||||
|
$_['btn_clear_log'] = 'Очистити лог';
|
||||||
|
$_['btn_download_log'] = 'Завантажити лог (.txt)';
|
||||||
|
$_['entry_export_format'] = 'Формат вивантаження';
|
||||||
|
$_['entry_export_identifier'] = 'Головний ідентифікатор';
|
||||||
|
$_['text_ident_model'] = 'Model (Модель)';
|
||||||
|
$_['text_ident_sku'] = 'SKU (Артикул)';
|
||||||
|
$_['text_ident_id'] = 'Product ID (Системний ID)';
|
||||||
|
$_['text_ident_name'] = 'Назва товару (Довідково)';
|
||||||
|
$_['entry_price_mode'] = 'Режим роботи з цінами';
|
||||||
|
$_['text_price_simple'] = 'Тільки базова ціна';
|
||||||
|
$_['text_price_special'] = 'Ціна + Загальна акція';
|
||||||
|
$_['text_price_special_group'] = 'Ціна + Акції за групами покупців';
|
||||||
|
$_['text_price_discount'] = 'Ціна + Знижки (від кількості)';
|
||||||
|
$_['entry_status'] = 'Статус модуля';
|
||||||
|
$_['help_status'] = 'Включає або вимикає функції імпорту та експорту модуля.';
|
||||||
|
$_['entry_filter_category'] = 'Фільтр: Категорії';
|
||||||
|
$_['help_filter_category'] = 'Фільтрувати товари, що вивантажуються, за вибраними категоріями. Якщо нічого не вибрано, будуть вивантажені всі категорії.';
|
||||||
|
$_['entry_filter_manufacturer'] = 'Фільтр: Виробники';
|
||||||
|
$_['help_filter_manufacturer'] = 'Фільтрувати товари, що вивантажуються, за вибраними виробниками. Якщо нічого не вибрано, будуть вивантажені всі виробники.';
|
||||||
|
$_['entry_filter_status'] = 'Статус товару';
|
||||||
|
$_['help_filter_status'] = 'Фільтрувати товари, що вивантажуються, за їх статусом (Увімкнено/Вимкнено).';
|
||||||
|
$_['entry_cron_status'] = 'Статус задачі';
|
||||||
|
$_['help_cron_status'] = 'Увімкнути або вимкнути виконання цієї задачі кроном.';
|
||||||
|
$_['text_export_link_label'] = 'Посилання на файл';
|
||||||
|
$_['text_import_source_label'] = 'Джерело імпорту';
|
||||||
|
$_['text_all_statuses'] = '-- Всі статуси --';
|
||||||
|
$_['text_status_on'] = 'Увімкнено (Так)';
|
||||||
|
$_['text_status_off'] = 'Вимкнено (Ні)';
|
||||||
|
$_['entry_filter_quantity'] = 'Мін. кількість у наявності';
|
||||||
|
$_['help_filter_quantity'] = 'Наприклад 1: вивантажить тільки товари в наявності (>0). 0: вивантажить всі.';
|
||||||
|
$_['entry_filter_price'] = 'Фільтр: Ціна (Від та До)';
|
||||||
|
$_['entry_filter_date'] = 'Фільтр: Дата зміни (Від та До)';
|
||||||
|
$_['entry_filter_batch'] = 'Фільтр: Мітка імпорту (import_batch)';
|
||||||
|
$_['text_batch_empty'] = '[Без мітки / Порожньо]';
|
||||||
|
$_['help_filter_batch_multi'] = 'Можна вказати декілька через крапку з комою (;)';
|
||||||
|
$_['text_select_all'] = 'Обрати все';
|
||||||
|
$_['text_unselect_all'] = 'Зняти все';
|
||||||
|
$_['text_filter_hint'] = 'Підказка: Якщо нічого не обрано (галочки зняті), будуть вивантажені ВСІ товари.';
|
||||||
|
$_['entry_batch_export'] = 'Товарів за прохід (Експорт)';
|
||||||
|
$_['help_batch_export'] = 'За замовчуванням 200. Зменшіть, якщо експорт обривається за таймаутом.';
|
||||||
|
$_['text_warning_backup'] = 'УВАГА: Перед завантаженням файлу настійно рекомендується зробити резервну копію цін та залишків за допомогою кнопки BACKUP (SQL) вгорі!';
|
||||||
|
$_['entry_import_source'] = 'Джерело даних';
|
||||||
|
$_['text_source_file'] = 'Завантажити файл з ПК (.xlsx, .xls, .csv, .xml, .json)';
|
||||||
|
$_['text_source_url'] = 'Вказати пряме посилання (URL / Google Таблиця)';
|
||||||
|
$_['entry_import_file'] = 'Файл / Посилання для завантаження';
|
||||||
|
$_['text_modifiers_title'] = 'Модифікатори даних / Віртуальні поля';
|
||||||
|
$_['text_modifiers_desc'] = 'Створіть нові колонки на льоту або змініть існуючі перед їх завантаженням у БД.';
|
||||||
|
$_['text_modifier_add'] = 'Додати правило';
|
||||||
|
$_['text_modifier_col'] = 'Колонка з прайсу';
|
||||||
|
$_['text_modifier_action'] = 'Дія';
|
||||||
|
$_['text_modifier_target'] = 'Куди зберегти результат';
|
||||||
|
$_['text_modifier_target_new'] = '-- Створити нове віртуальне поле --';
|
||||||
|
$_['text_modifier_math'] = 'Калькулятор (Математика)';
|
||||||
|
$_['text_modifier_replace'] = 'Заміна тексту / Склейка';
|
||||||
|
$_['text_mapping_title'] = 'Мапінг системних полів';
|
||||||
|
$_['text_mapping_desc'] = 'Вкажіть, у яких колонках вашого файлу (або віртуальних полях) знаходяться потрібні дані.';
|
||||||
|
$_['text_mapping_skip'] = '-- Пропустити --';
|
||||||
|
$_['entry_import_missing'] = 'Дія з товарами, яких НЕМАЄ у файлі';
|
||||||
|
$_['text_missing_skip'] = 'Нічого не робити (пропустити)';
|
||||||
|
$_['text_missing_zero_all'] = 'Обнулити залишки (у всіх товарів на сайті)';
|
||||||
|
$_['text_missing_zero_cat'] = 'Обнулити залишки (тільки в порушених категоріях/брендах)';
|
||||||
|
$_['text_missing_disable'] = 'Вимкнути товари (Статус = Вимкнено)';
|
||||||
|
$_['entry_import_batch_name'] = 'Призначити мітку імпорту (import_batch)';
|
||||||
|
$_['help_import_batch'] = 'Дозволить у майбутньому легко знайти, вивантажити або видалити саме ці товари.';
|
||||||
|
$_['entry_batch_import'] = 'Товарів за прохід (Імпорт)';
|
||||||
|
$_['entry_log_mode'] = 'Режим логування';
|
||||||
|
$_['text_log_full'] = 'Повний (Писати всі дії)';
|
||||||
|
$_['text_log_changes'] = 'Тільки зміни (Рекомендується)';
|
||||||
|
$_['text_log_off'] = 'Вимкнений (Тільки суха статистика)';
|
||||||
|
$_['text_log_simulation'] = 'Режим симуляції (Dry-Run): Зміни поки НЕ збережені у БД.';
|
||||||
|
$_['text_log_writing'] = 'Виконується бойовий запис у базу даних...';
|
||||||
|
$_['text_log_found'] = 'Знайдено товарів:';
|
||||||
|
$_['text_log_updated'] = 'Буде оновлено:';
|
||||||
|
$_['text_log_not_found'] = 'Не знайдено у БД:';
|
||||||
|
$_['text_log_missing_action'] = 'Потраплять під дію "Відсутні":';
|
||||||
|
$_['text_import_complete'] = 'Імпорт успішно завершено!';
|
||||||
|
$_['text_cron_profiles'] = 'Профілі Автоматизації (CRON)';
|
||||||
|
$_['text_add_profile'] = 'Додати профіль';
|
||||||
|
$_['text_edit_profile'] = 'Редагувати профіль';
|
||||||
|
$_['column_profile_name'] = 'Назва профілю';
|
||||||
|
$_['column_profile_status'] = 'Статус';
|
||||||
|
$_['column_date_last_run'] = 'Останній запуск';
|
||||||
|
$_['column_action'] = 'Дія';
|
||||||
|
$_['entry_profile_name'] = 'Назва профілю';
|
||||||
|
$_['entry_profile_url'] = 'Посилання на прайс (URL)';
|
||||||
|
$_['entry_cron_command'] = 'CRON Команда для хостингу';
|
||||||
|
$_['help_cron_command'] = 'Скопіюйте цю команду та додайте у планувальник завдань (CRON) на вашому сервері.';
|
||||||
|
$_['btn_add'] = 'Додати';
|
||||||
|
$_['text_mod_admin_tools'] = 'Admin Tools [NAT]';
|
||||||
|
$_['text_mod_admin_tools_desc'] = 'Зручні інструменти адміністратора: вхід під клієнтом, кастомізація адмінки, управління правами користувачів та приховування непотрібних пунктів меню.';
|
||||||
|
$_['text_mod_cat_opt'] = 'Catalog Optimizer [NAT]';
|
||||||
|
$_['text_mod_cat_opt_desc'] = 'Приховування порожніх категорій/брендів + SEO-сортування (спочатку в наявності) + очищення сміття в БД.';
|
||||||
|
$_['text_mod_db_opt'] = 'Database Optimizer [NAT]';
|
||||||
|
$_['text_mod_db_opt_desc'] = 'Інтелектуальний збирач сміття бази даних, управління системними логами та додавання критичних індексів для прискорення сайту.';
|
||||||
|
$_['text_mod_dom_scan'] = 'Domain Scanner [NAT]';
|
||||||
|
$_['text_mod_dom_scan_desc'] = 'Пошук та очищення зовнішніх посилань та HTTP-зображень у БД та файлах теми. Ідеально для переходу на HTTPS або очищення після парсингу.';
|
||||||
|
$_['text_mod_easy_import'] = 'Easy Import/Export [NAT]';
|
||||||
|
$_['text_mod_easy_import_desc'] = 'Поточний модуль. Швидкий імпорт/експорт цін, залишків та товарів з XLS/XLSX/CSV/XML/JSON. Мапінг полів, Cron та підтримка URL.';
|
||||||
|
$_['text_mod_img_opt'] = 'Image Optimizer [NAT]';
|
||||||
|
$_['text_mod_img_opt_desc'] = 'Стиснення оригінальних зображень у WebP + масове очищення неиспользуемых зображень на сервері.';
|
||||||
|
$_['text_mod_new_arrivals'] = 'New Arrivals [NAT]: True Sort by Date';
|
||||||
|
$_['text_mod_new_arrivals_desc'] = 'Автоматична SEO-сторінка для новинок. Відображає товари строго за фактичною датою додавання. Слайдери, сітки та розумний віджет архіву дат у сайдбарі.';
|
||||||
|
$_['text_mod_utm_tracker'] = 'Order UTM Tracker [NAT]';
|
||||||
|
$_['text_mod_utm_tracker_desc'] = 'Автоматичне відстеження UTM-міток при оформленні замовлення. Зберігає джерело трафіку, кампанію, ключові слова та відображає ці дані в деталях замовлення для аналізу ефективності реклами.';
|
||||||
|
$_['text_mod_poll'] = 'Poll Widget [NAT]';
|
||||||
|
$_['text_mod_poll_desc'] = 'Створення опитувань та віджетів голосування з візуальним конструктором дизайну, детальною статистикою та захистом від накруток.';
|
||||||
|
$_['text_mod_promo_top_bar'] = 'Promo Top Bar [NAT]: Верхній рекламний інфо-баннер, інформаційна смуга над шапкою, рухомий рядок та топ-баннер';
|
||||||
|
$_['text_mod_promo_top_bar_desc'] = 'Створення інтерактивних промо-панелей та слайд-шоу в шапці сайту з конструктором блоків, таймерами, формою підписки та гнучким націлюванням.';
|
||||||
|
$_['btn_edit'] = 'Редагувати';
|
||||||
|
$_['btn_delete'] = 'Видалити';
|
||||||
|
$_['btn_cancel'] = 'Скасувати';
|
||||||
|
$_['btn_save_profile'] = 'Зберегти профіль';
|
||||||
|
$_['text_no_profiles'] = 'Немає профілів';
|
||||||
|
$_['text_cron_mapping_info'] = 'Для налаштування мапінгу полів і параметрів, натисніть кнопку "Перевірити і отримати колонки", щоб скрипт завантажив заголовки з вашого прайсу за посиланням.';
|
||||||
|
$_['error_empty_url'] = 'Будь ласка, введіть валідний URL';
|
||||||
|
$_['text_downloading'] = 'Завантаження...';
|
||||||
|
$_['error_fetch'] = 'Помилка завантаження файлу.';
|
||||||
|
$_['error_upload_failed'] = 'Помилка завантаження файлу.';
|
||||||
|
$_['text_confirm_clear_log'] = 'Очистити лог та кеш файлів?';
|
||||||
|
$_['text_log_cleared'] = 'Лог очищено.\n';
|
||||||
|
$_['text_confirm_import'] = 'Ви впевнені? Дані будуть записані в базу.';
|
||||||
|
$_['text_log_start_sim'] = '--- СТАРТ СИМУЛЯЦІЇ ---';
|
||||||
|
$_['text_log_start_imp'] = '--- СТАРТ ІМПОРТУ ---';
|
||||||
|
$_['text_log_batch_done'] = 'оброблено.';
|
||||||
|
$_['text_log_total_title'] = '=== РАЗОМ ===';
|
||||||
|
$_['text_confirm_delete'] = 'Видалити профіль?';
|
||||||
|
$_['text_cron_dev_edit'] = 'Редагування профілю';
|
||||||
|
$_['text_cron_dev_delete'] = 'Видалення профілю';
|
||||||
|
$_['text_cron_dev_save'] = 'Збереження профілю';
|
||||||
|
$_['error_permission'] = 'У вас немає прав для управління цим модулем!';
|
||||||
|
$_['error_license'] = 'Невірний або відсутній ліцензійний ключ!';
|
||||||
|
$_['error_file_upload'] = 'Помилка завантаження файлу. Перевірте ліміти сервера.';
|
||||||
|
$_['error_file_type'] = 'Недопустимий формат файлу! Дозволено лише .xlsx, .xls, .csv, .xml та .json';
|
||||||
|
$_['error_lib_missing'] = 'Бібліотеку PhpSpreadsheet не знайдено! Завантажте її у system/library/nat/phpspreadsheet/';
|
||||||
|
$_['text_backup_error'] = 'Помилка створення бекапу! Перевірте права на запис у /system/storage/cache/';
|
||||||
|
$_['text_processing'] = 'Обробка...';
|
||||||
|
$_['text_no_products'] = 'Товари за вашим фільтром не знайдено!';
|
||||||
|
$_['text_exporting'] = 'Вивантаження батчу ';
|
||||||
|
$_['text_of'] = ' з ';
|
||||||
|
$_['text_error_batch'] = 'Критична помилка під час обробки батчу ';
|
||||||
|
$_['text_error_init'] = 'Помилка ініціалізації експорту';
|
||||||
|
$_['text_ecosystem_title'] = 'Екосистема модулів [NAT]';
|
||||||
|
$_['text_ecosystem_desc'] = 'Для максимальної швидкості та безпеки вашого магазину ми розробили серію вузькоспеціалізованих модулів, що працюють за стандартами Zero Trust:';
|
||||||
|
$_['btn_all_modules'] = 'Профіль на OpenCart.com';
|
||||||
|
$_['btn_forum_modules'] = 'Профіль на OpenCartForum';
|
||||||
|
|
||||||
|
$_['text_help_export_format'] = '<i class="fa fa-info-circle"></i> <b>Формати вивантаження складних цін:</b><br>Якщо вибрано режим <b>"ВСЕ ВІДРАЗУ"</b>, дані вивантажуються в 1 клітинку (через крапку з комою <code>;</code>):<br>• Акції: <code>ID_групи:Ціна</code> (приклад: <code>1:99.00; 2:95.00</code>)<br>• Знижки: <code>ID_групи:Кількість:Ціна</code> (приклад: <code>1:10:90.00</code>)';
|
||||||
|
$_['text_help_import_format'] = '<i class="fa fa-info-circle"></i> <b>Синтаксис імпорту знижок:</b><br>Якщо ви мапите колонки <b>"Акції (Групи)"</b> або <b>"Знижки (Кіл-ть)"</b>, у прайсі має бути строгий формат:<br>• Для акцій: <code>ID_групи:Ціна</code> (наприклад <code>1:150.50</code>)<br>• Для знижок: <code>ID_групи:Від_скількох_штук:Ціна</code> (наприклад <code>1:5:140.00; 1:10:130.00</code>)';
|
||||||
|
$_['text_format_auto'] = 'Автовизначення (Рекомендується)';
|
||||||
|
$_['text_format_xlsx'] = '.xlsx (Modern Excel)';
|
||||||
|
$_['text_format_xls'] = '.xls (Legacy Excel 97-2004)';
|
||||||
|
$_['text_format_csv'] = '.csv';
|
||||||
|
$_['text_format_xml'] = '.xml / .yml (XML-формат)';
|
||||||
|
$_['text_format_json'] = '.json';
|
||||||
|
$_['text_format_hint'] = 'Якщо бібліотека PhpSpreadsheet не знайдена на сервері, буде примусово вивантажено .csv';
|
||||||
|
$_['text_price_all_advanced'] = 'ВСЕ ВІДРАЗУ (Базова + Акції груп + Знижки кількостей)';
|
||||||
|
$_['text_col_price'] = 'Price (Базова ціна)';
|
||||||
|
$_['text_col_quantity'] = 'Quantity (Залишок)';
|
||||||
|
$_['text_col_status'] = 'Status (Статус)';
|
||||||
|
$_['text_col_special'] = 'Special (Акція)';
|
||||||
|
$_['text_col_specials_group'] = 'Акції (Групи)';
|
||||||
|
$_['text_col_discounts_group'] = 'Знижки (Кіл-ть)';
|
||||||
|
$_['text_placeholder_batch'] = 'price_update_1';
|
||||||
|
$_['text_placeholder_cron_name']= 'Прайс від Постачальника А';
|
||||||
|
$_['text_placeholder_url'] = 'https://example.com/price.csv';
|
||||||
|
$_['btn_cron_fetch'] = 'Перевірити і отримати колонки';
|
||||||
|
$_['text_cron_mapping_title'] = 'Мапінг колонок для цього профілю';
|
||||||
|
$_['text_cron_actions_title'] = 'Дії для цього профілю';
|
||||||
|
$_['entry_log_lines'] = 'Макс. рядків логу на екрані';
|
||||||
|
$_['text_empty_title'] = 'Без назви';
|
||||||
|
$_['error_empty_file'] = 'Помилка: Файл порожній або має невірний формат!';
|
||||||
|
$_['error_mapping'] = 'Помилка: Критична помилка мапінгу! Не вибрано головний ідентифікатор.';
|
||||||
|
$_['error_temp_file'] = 'Помилка: Тимчасовий файл не знайдено, завантажте прайс заново!';
|
||||||
|
$_['entry_profile_type'] = 'Тип профілю';
|
||||||
|
$_['text_type_import'] = 'Імпорт (Завантаження в БД)';
|
||||||
|
$_['text_type_export'] = 'Експорт (Вивантаження за посиланням)';
|
||||||
|
$_['entry_export_dest'] = 'Ім\'я файлу для експорту';
|
||||||
|
$_['help_export_dest'] = 'Наприклад: pricelist.xml. Файл буде доступний за посиланням: ';
|
||||||
|
$_['text_cron_export_info'] = 'Увага: У режимі Експорту налаштування мапінгу приховані. Вивантаження формуватиметься на основі ваших фільтрів із вкладки "Експорт".';
|
||||||
|
$_['entry_cron_secret'] = 'Секретний ключ (CRON Token)';
|
||||||
|
$_['help_cron_secret'] = 'Захист скрипта від запуску сторонніми. Введіть будь-яку складну фразу (напр. s3cr3t_t0k3n). Без неї CRON не спрацює.';
|
||||||
|
$_['error_cron_secret'] = 'Помилка: Не задано секретний ключ CRON!';
|
||||||
|
$_['text_cron_export_link'] = 'Постійне посилання для ваших клієнтів:';
|
||||||
|
$_['entry_inverse_special'] = 'Інверсія акційних цін';
|
||||||
|
$_['help_inverse_special'] = 'Якщо постачальник вказує ціну зі знижкою в основній колонці, а стару (більшу) ціну як акційну - модуль сам поміняє їх місцями.';
|
||||||
|
$_['entry_export_folder'] = 'Папка для файлів експорту';
|
||||||
|
$_['help_export_folder'] = 'Назва папки на сервері. Скрипт сам створить її та захистить файл .htaccess.';
|
||||||
|
$_['entry_export_path'] = 'Розташування папки експорту';
|
||||||
|
$_['text_path_root'] = 'В корені сайту (Рекомендується)';
|
||||||
|
$_['text_path_image'] = 'В папці image/catalog/';
|
||||||
|
$_['text_custom_fields'] = 'Мапінг кастомних полів';
|
||||||
|
$_['text_export_custom_fields'] = 'Вивантаження кастомних полів';
|
||||||
|
$_['text_add_custom_field'] = 'Додати поле';
|
||||||
|
$_['text_table'] = 'Таблиця (Де є product_id)';
|
||||||
|
$_['text_column'] = 'Назва колонки';
|
||||||
|
$_['text_action_math'] = 'Калькулятор (Математика)';
|
||||||
|
$_['text_action_replace'] = 'Заміна тексту / Склейка';
|
||||||
|
$_['text_math_help'] = 'Приклад: +15%, *1.2, -10.5';
|
||||||
|
$_['text_replace_help'] = 'Приклад: Знайти "СтарийБренд", замінити на "НовийБренд"';
|
||||||
|
$_['btn_settings'] = 'Налаштувати';
|
||||||
|
$_['text_target_col_name'] = 'Назва колонки в прайсі (CSV/XML/JSON)';
|
||||||
|
$_['text_rule_merge_col1'] = 'Перша колонка';
|
||||||
|
$_['text_rule_merge_sep'] = 'Розділювач (наприклад: пробіл, -, <br>)';
|
||||||
|
$_['text_rule_merge_col2'] = 'Друга колонка';
|
||||||
|
$_['text_rule_merge_hint'] = 'Склеює значення двох колонок в одну через вказаний розділювач.';
|
||||||
|
$_['text_btn_merge_setup'] = 'Налаштувати склейку';
|
||||||
|
$_['text_btn_merge_done'] = 'Склейка налаштована';
|
||||||
|
$_['text_target_self'] = 'Поточний стовпець/поле';
|
||||||
|
$_['text_mod_action_add'] = '+ Додати число';
|
||||||
|
$_['text_mod_action_sub'] = '- Відняти число';
|
||||||
|
$_['text_mod_action_mul'] = '* Помножити на';
|
||||||
|
$_['text_mod_action_div'] = '/ Розділити на';
|
||||||
|
$_['text_mod_action_add_pct'] = '+ Додати відсоток (%)';
|
||||||
|
$_['text_mod_action_sub_pct'] = '- Відняти відсоток (%)';
|
||||||
|
$_['text_mod_action_rnd_0'] = 'Округлити до цілого';
|
||||||
|
$_['text_mod_action_rnd_2'] = 'Округлити до копійок (.00)';
|
||||||
|
$_['text_mod_action_replace'] = 'Заміна тексту';
|
||||||
|
$_['text_mod_action_merge'] = 'Склейка колонок';
|
||||||
|
$_['text_export_modifiers'] = 'Модифікатори даних (Експорт)';
|
||||||
|
$_['error_server_500'] = 'СИСТЕМНА ПОМИЛКА СЕРВЕРА (500/504):';
|
||||||
|
$_['text_status_code'] = 'Статус: ';
|
||||||
|
$_['text_server_response'] = 'Відповідь сервера: ';
|
||||||
|
$_['text_no_parameters'] = 'Без параметрів';
|
||||||
|
$_['text_search_for'] = 'Що знайти';
|
||||||
|
$_['text_replace_with'] = 'На що замінити';
|
||||||
|
$_['text_field_1'] = 'Поле 1';
|
||||||
|
$_['text_field_2'] = 'Поле 2';
|
||||||
|
$_['text_separator'] = 'Розділювач';
|
||||||
|
$_['text_value'] = 'Значення';
|
||||||
|
$_['text_new_field'] = 'Нове поле';
|
||||||
|
$_['text_new_field_name'] = 'Ім\'я нового поля';
|
||||||
|
$_['text_table_select'] = '-- Таблиця --';
|
||||||
|
$_['text_select'] = '-- Оберіть --';
|
||||||
|
$_['text_enter_manually'] = '-- Ввести вручну --';
|
||||||
|
$_['text_virtual'] = '[Вірт] ';
|
||||||
|
$_['error_prefix'] = 'Помилка: ';
|
||||||
|
$_['text_import_finished_cleanup'] = '*** Імпорт завершено! Файл видалено. Для нового завантаження виберіть файл заново. ***';
|
||||||
|
$_['text_fast_buttons'] = 'Швидкі кнопки';
|
||||||
|
$_['text_min'] = 'Мін';
|
||||||
|
$_['text_max'] = 'Макс';
|
||||||
|
$_['text_batch_label'] = 'Батч';
|
||||||
|
$_['text_help_specials_group_title'] = 'Формат акцій по групах: customer_group_id:price;customer_group_id:price';
|
||||||
|
$_['text_help_discounts_group_title'] = 'Формат знижок по групах: customer_group_id:quantity:price;customer_group_id:quantity:price';
|
||||||
|
$_['text_custom_text_label'] = 'Свій текст';
|
||||||
|
$_['text_custom_text_placeholder'] = 'Введіть текст...';
|
||||||
|
$_['text_condition'] = 'Умова';
|
||||||
|
$_['text_cond_always'] = '-- Завжди застосовувати --';
|
||||||
|
$_['text_cond_equals'] = 'Дорівнює (=)';
|
||||||
|
$_['text_cond_not_equals'] = 'Не дорівнює (!=)';
|
||||||
|
$_['text_cond_greater'] = 'Більше (>)';
|
||||||
|
$_['text_cond_less'] = 'Менше (<)';
|
||||||
|
$_['text_cond_contains'] = 'Містить';
|
||||||
|
$_['text_cond_not_contains'] = 'Не містить';
|
||||||
|
$_['text_cond_empty'] = 'Порожньо';
|
||||||
|
$_['text_cond_not_empty'] = 'Не порожньо';
|
||||||
|
$_['text_preview_title'] = 'Попередній перегляд даних файлу (перші 5 рядків)';
|
||||||
|
$_['text_source_api'] = 'REST API (Посилання на каталог постачальника) [BETA]';
|
||||||
|
$_['text_api_settings'] = 'Налаштування REST API';
|
||||||
|
$_['entry_api_endpoint'] = 'URL API Endpoint';
|
||||||
|
$_['help_api_endpoint'] = 'Використовуйте плейсхолдери {page}, {offset}, {limit}, {token}. Приклад: https://api.com/products?page={page}';
|
||||||
|
$_['entry_api_method'] = 'Метод запиту';
|
||||||
|
$_['entry_api_headers'] = 'Заголовки запиту (Headers)';
|
||||||
|
$_['help_api_headers'] = 'Один заголовок на рядок. Приклад:<br>Accept: application/json<br>X-API-Key: {token}';
|
||||||
|
$_['entry_api_body'] = 'Тіло запиту (POST)';
|
||||||
|
$_['help_api_body'] = 'Рядок тіла запиту для POST. Підтримує плейсхолдери.';
|
||||||
|
$_['entry_api_auth_mode'] = 'Режим авторизації';
|
||||||
|
$_['text_auth_none'] = 'Без авторизації';
|
||||||
|
$_['text_auth_basic'] = 'Basic Auth (Логін/Пароль)';
|
||||||
|
$_['text_auth_bearer'] = 'Статичний Bearer Token';
|
||||||
|
$_['text_auth_custom_post'] = 'Динамічний Token через Auth POST запит';
|
||||||
|
$_['entry_api_username'] = 'Ім\'я користувача Auth';
|
||||||
|
$_['entry_api_password'] = 'Пароль Auth';
|
||||||
|
$_['entry_api_bearer_token'] = 'Bearer Token';
|
||||||
|
$_['entry_api_auth_url'] = 'URL запиту авторизації (POST)';
|
||||||
|
$_['entry_api_auth_body'] = 'Тіло запиту авторизації (POST)';
|
||||||
|
$_['help_api_auth_body'] = 'JSON або форма для авторизації. Приклад: {"username": "admin", "password": "123"}';
|
||||||
|
$_['entry_api_auth_token_path'] = 'JSON шлях до токену';
|
||||||
|
$_['help_api_auth_token_path'] = 'Точковий шлях до токену у відповіді. Приклад: data.access_token';
|
||||||
|
$_['entry_api_pagination_mode'] = 'Режим пагінації';
|
||||||
|
$_['text_pagi_none'] = 'Без пагінації (Один запит)';
|
||||||
|
$_['text_pagi_page'] = 'Пагінація по сторінках';
|
||||||
|
$_['text_pagi_offset'] = 'Пагінація зі зміщенням (Offset)';
|
||||||
|
$_['entry_api_page_placeholder'] = 'Плейсхолдер сторінки в URL/Тілі';
|
||||||
|
$_['entry_api_start_page'] = 'Початковий номер сторінки';
|
||||||
|
$_['entry_api_offset_placeholder'] = 'Плейсхолдер зміщення в URL/Тілі';
|
||||||
|
$_['entry_api_start_offset'] = 'Початкове значення зміщення';
|
||||||
|
$_['entry_api_limit_placeholder'] = 'Плейсхолдер ліміту/пачки';
|
||||||
|
$_['entry_api_limit_value'] = 'Елементів на запит (Limit)';
|
||||||
|
$_['entry_api_response_format'] = 'Формат відповіді API';
|
||||||
|
$_['entry_api_json_root_path'] = 'JSON шлях до масиву товарів';
|
||||||
|
$_['help_api_json_root_path'] = 'Точковий шлях до масиву товарів. Залишіть порожнім, якщо корінь — масив.';
|
||||||
|
$_['entry_api_xml_product_tag'] = 'Тег товару XML';
|
||||||
|
$_['help_api_xml_product_tag'] = 'Ім\'я тега елемента, що містить товар. Приклад: offer';
|
||||||
|
// --- Додаткові ключі локалізації (Синхронізація з ru-ru / en-gb) ---
|
||||||
|
$_['text_col_category'] = 'Категорія / Дерево категорій';
|
||||||
|
$_['text_category_bindings'] = 'Зв\'язування категорій';
|
||||||
|
$_['btn_load_categories'] = 'Завантажити унікальні категорії з файлу';
|
||||||
|
$_['text_supplier_category'] = 'Категорія у постачальника (з файлу)';
|
||||||
|
$_['text_store_category'] = 'Категорія в магазині';
|
||||||
|
$_['text_select_category'] = '--- Оберіть категорію ---';
|
||||||
|
|
||||||
|
$_['text_mod_action_markup_table'] = 'Таблиця націнок';
|
||||||
|
$_['text_mod_action_comma_to_dot'] = 'Заміна коми на крапку';
|
||||||
|
|
||||||
|
$_['btn_delete_profile'] = 'Видалити профіль';
|
||||||
|
$_['btn_copy'] = 'Копіювати';
|
||||||
|
$_['text_copied'] = 'Скопійовано в буфер обміну!';
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Step navigation ---
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Hardcoded messages ---
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Placeholders ---
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Profile modal ---
|
||||||
|
$_['text_profile_saved'] = 'Профіль налаштувань успішно збережено!';
|
||||||
|
$_['text_profile_deleted'] = 'Профіль успішно видалено!';
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Mapping & search ---
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Discount format hints ---
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Image mode ---
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Price Guard % ---
|
||||||
|
|
||||||
|
// --- v1.0 Refactor: Category binding modes ---
|
||||||
|
|
||||||
|
// --- Additional keys for currency, rounding, history and licensing ---
|
||||||
|
$_['entry_cron_alert_threshold'] = 'Сповіщати, якщо ціна впала на (%)';
|
||||||
|
$_['help_cron_alert_threshold'] = 'Повідомити, коли ціна впала більше ніж на % (0 = вимкнено).';
|
||||||
|
$_['text_license_invalid'] = 'Ліцензію не активовано!';
|
||||||
|
$_['text_license_help'] = 'Для роботи модуля введіть ліцензійний ключ. Якщо ви придбали модуль на OpenCartForum, ключ надіслано вам на пошту та у Telegram-боті. З питань отримання ключа пишіть на <a href="mailto:info@nat.od.ua">info@nat.od.ua</a> або в особисті повідомлення <strong>NAT</strong> на форумі.';
|
||||||
|
$_['text_if_drops_by'] = 'якщо ціна впала на';
|
||||||
|
$_['text_required'] = 'Обов\'язково';
|
||||||
|
$_['help_cat_binding_mode'] = 'Змішаний = Знайти або створити категорію. Тільки точне = Прив\'язувати тільки при точному збігу. Пропустити = Пропустити прив\'язку категорії, якщо не знайдена.';
|
||||||
|
$_['text_set_for_all'] = '--- Встановити для всіх ---';
|
||||||
|
// New features from Universal Import analysis
|
||||||
|
$_['entry_price_ignore_zero'] = 'Ігнорувати нульові/порожні ціни';
|
||||||
|
$_['help_price_ignore_zero'] = 'Не оновлювати ціну товару, якщо у файлі імпорту вона дорівнює 0 або порожня.';
|
||||||
|
$_['entry_missing_limit_batch'] = 'Обмежити тільки поточною партією';
|
||||||
|
$_['help_missing_limit_batch'] = 'Застосовувати дії до відсутніх товарів тільки якщо вони належать до цієї ж партії імпорту (захищає товари інших постачальників).';
|
||||||
|
$_['entry_option_update_mode'] = 'Режим оновлення опцій';
|
||||||
|
$_['text_option_overwrite'] = 'Перезаписати (видалити старі опції)';
|
||||||
|
$_['text_option_update'] = 'Оновити (оновити кількість/ціну співпалих, додати нові)';
|
||||||
|
$_['entry_image_update_mode'] = 'Додаткові фото';
|
||||||
|
$_['text_image_overwrite'] = 'Перезаписати (видалити старі)';
|
||||||
|
$_['text_image_keep'] = 'Додати нові (зберегти існуючі)';
|
||||||
|
$_['text_missing_zero_brand'] = 'Обнулити кількість для товарів цих виробників';
|
||||||
|
$_['text_missing_disable_brand'] = 'Вимкнути товари цих виробників';
|
||||||
|
|
||||||
|
$_['text_help_custom_fields_info'] = 'Кастомні поля дозволяють співставляти колонки файлу з будь-якими полями БД OpenCart. Популярні приклади: <b>product_description</b> (meta_h1, meta_title, tag), <b>product</b> (jan, isbn, mpn, location, weight, length).';
|
||||||
|
|
||||||
|
$_['text_sim_new_products'] = 'Нових товарів';
|
||||||
|
$_['text_sim_updated_products'] = 'Оновиться товарів';
|
||||||
|
$_['text_sim_price_guarded'] = 'Захищено від падіння ціни';
|
||||||
|
$_['text_sim_skipped_products'] = 'Пропущено рядків';
|
||||||
|
$_['btn_export_profile_json'] = 'Завантажити профіль у JSON';
|
||||||
|
$_['btn_import_profile_json'] = 'Завантажити профіль із JSON';
|
||||||
|
$_['btn_add_currency_rule'] = 'Додати правило конвертації';
|
||||||
|
$_['btn_add_image_col'] = 'Додати колонку фото';
|
||||||
|
$_['btn_filter_all'] = 'Всі';
|
||||||
|
$_['btn_filter_skipped'] = 'Пропущені';
|
||||||
|
$_['btn_filter_updated'] = 'Оновлені';
|
||||||
|
$_['btn_next_advanced_settings'] = 'Далі: Додаткові налаштування';
|
||||||
|
$_['btn_next_category_bindings'] = 'Далі: Зв\'язування категорій';
|
||||||
|
$_['btn_next_custom_fields'] = 'Далі: Кастомні поля';
|
||||||
|
$_['btn_next_mappings'] = 'Далі: Відповідність колонок';
|
||||||
|
$_['btn_show_cron_command'] = 'Показати команди Cron';
|
||||||
|
$_['button_clear_history'] = 'Очистити історію';
|
||||||
|
$_['entry_cat_binding_mode'] = 'Режим прив\'язки категорій';
|
||||||
|
$_['entry_currency_col'] = 'Колонка валюти у файлі';
|
||||||
|
$_['entry_currency_feed'] = 'Валюта прайсу';
|
||||||
|
$_['entry_currency_mode'] = 'Режим конвертації валюти';
|
||||||
|
$_['entry_currency_rate'] = 'Курс конвертації';
|
||||||
|
$_['entry_currency_rate_selector'] = 'Джерело курсу';
|
||||||
|
$_['entry_currency_rules'] = 'Правила конвертації';
|
||||||
|
$_['entry_currency_source'] = 'Джерело курсу';
|
||||||
|
$_['entry_field'] = 'Поле';
|
||||||
|
$_['entry_img_dir'] = 'Папка для зображень';
|
||||||
|
$_['entry_img_overwrite'] = 'Перезаписувати фото';
|
||||||
|
$_['entry_map_additional_images'] = 'Додаткові зображення (галерея)';
|
||||||
|
$_['entry_map_image'] = 'Головне зображення';
|
||||||
|
$_['entry_new_value'] = 'Стане';
|
||||||
|
$_['entry_old_value'] = 'Було';
|
||||||
|
$_['entry_option_quantity_sync'] = 'Синхронізація залишку опцій з товаром';
|
||||||
|
$_['entry_price_guard'] = 'Захист від різкого падіння ціни';
|
||||||
|
$_['entry_price_guard_pct'] = 'Максимально допустиме зниження ціни (%)';
|
||||||
|
$_['entry_rounding_precision'] = 'Точність округлення';
|
||||||
|
$_['entry_rounding_type'] = 'Тип округлення цін';
|
||||||
|
$_['entry_stock_guard'] = 'Захист від масового обнулення залишків';
|
||||||
|
$_['entry_update_content'] = 'Оновлювати вміст';
|
||||||
|
$_['entry_visual_diff'] = 'Візуальний дифф змін';
|
||||||
|
$_['error_ajax_failed'] = 'Помилка передачі даних через AJAX. Перевірте з\'єднання або логи сервера.';
|
||||||
|
$_['error_api_endpoint_required'] = 'Помилка: Не вказано URL кінцевої точки API!';
|
||||||
|
$_['error_load_file_first'] = 'Спочатку завантажте файл для аналізу структури!';
|
||||||
|
$_['error_profile_name_empty'] = 'Помилка: Введіть назву профілю!';
|
||||||
|
$_['error_select_category_first'] = 'Будь ласка, оберіть категорію магазину для зв\'язування!';
|
||||||
|
$_['error_stock_guard'] = 'Увага! Спрацював захист від обнулення залишків.';
|
||||||
|
$_['error_upload_file_first'] = 'Будь ласка, спочатку завантажте файл імпорту!';
|
||||||
|
$_['help_batch_import'] = 'Кількість товарів, що обробляються за один AJAX-запит. Зменшіть, якщо сервер видає помилку 504 Timeout.';
|
||||||
|
$_['help_img_dir'] = 'Підпапка в каталозі image/catalog/, куди зберігатимуться фотографії.';
|
||||||
|
$_['help_img_overwrite'] = 'Завантажувати та замінювати існуючі зображення товару.';
|
||||||
|
$_['help_map_category'] = 'Оберіть колонку з назвою або ієрархією категорії.';
|
||||||
|
$_['help_option_quantity_sync'] = 'Якщо увімкнено, сумарний залишок опцій буде синхронізовано із загальною кількістю товару.';
|
||||||
|
$_['help_price_guard'] = 'Забороняє оновлювати ціну, якщо нова ціна нижча за поточну більше ніж на вказаний відсоток.';
|
||||||
|
$_['help_price_guard_pct'] = 'Якщо ціна падає більше ніж на цей %, товар буде пропущено і зафіксовано в лозі.';
|
||||||
|
$_['help_stock_guard'] = 'Зупиняє імпорт, якщо кількість товарів з нульовим залишком перевищує встановлений ліміт.';
|
||||||
|
$_['help_update_content'] = 'Оберіть, які блоки даних підлягають оновленню при імпорті.';
|
||||||
|
$_['help_visual_diff'] = 'Відображати детальне порівняння старих і нових цін/залишків у процесі імпорту.';
|
||||||
|
$_['placeholder_search_model'] = 'Пошук за моделлю або артикулом...';
|
||||||
|
$_['tab_history'] = 'Історія запусків та логи';
|
||||||
|
$_['text_12_hours'] = 'Кожні 12 годин';
|
||||||
|
$_['text_14_days'] = 'Раз на 2 тижні (14 днів)';
|
||||||
|
$_['text_24_hours'] = 'Раз на добу (24 години)';
|
||||||
|
$_['text_30_days'] = 'Раз на місяць (30 днів)';
|
||||||
|
$_['text_3_days'] = 'Раз на 3 дні';
|
||||||
|
$_['text_7_days'] = 'Раз на тиждень (7 днів)';
|
||||||
|
$_['text_cat_bind_exact'] = 'Тільки точний збіг за назвою';
|
||||||
|
$_['text_cat_bind_mixed'] = 'Змішаний (пошук за назвою або створення)';
|
||||||
|
$_['text_cat_bind_skip_new'] = 'Пропускати товари без відповідної категорії';
|
||||||
|
$_['text_col_discount'] = 'Знижки (оптові)';
|
||||||
|
$_['text_col_identifier'] = 'Колонка ідентифікатора';
|
||||||
|
$_['text_confirm_clear_history'] = 'Ви впевнені, що бажаєте повністю очистити журнал історії та логи?';
|
||||||
|
$_['text_confirm_delete_profile'] = 'Ви впевнені, що бажаєте видалити цей профіль?';
|
||||||
|
$_['text_cron_instructions'] = 'Інструкція з налаштування планувальника завдань (CRON):';
|
||||||
|
$_['text_currency_multi'] = 'Мультивалютний (валюта вказана в кожному рядку)';
|
||||||
|
$_['text_currency_off'] = 'Вимкнено (ціни вже в основній валюті)';
|
||||||
|
$_['text_currency_single'] = 'Фіксована валюта для всього файлу';
|
||||||
|
$_['text_currency_source_custom'] = 'Власний фіксований курс';
|
||||||
|
$_['text_currency_source_store'] = 'Автоматичний курс із налаштувань OpenCart';
|
||||||
|
$_['text_disabled'] = 'Вимкнено';
|
||||||
|
$_['text_enabled'] = 'Увімкнено';
|
||||||
|
$_['text_help_discount_title'] = 'Формат оптових знижок від кількості:';
|
||||||
|
$_['text_help_discounts_group_format'] = 'Формат для груп: <code>id_групи:кількість:ціна;id_групи:кількість:ціна</code>. Наприклад: <code>1:3:120.00;1:5:100.00</code>';
|
||||||
|
$_['text_help_simple_discount_format'] = 'Формат: <code>кількість:ціна</code>. Наприклад: <code>5:150.00</code>';
|
||||||
|
$_['text_history_actions'] = 'Дії';
|
||||||
|
$_['text_history_date'] = 'Дата та час';
|
||||||
|
$_['text_history_not_found'] = 'Не знайдено';
|
||||||
|
$_['text_history_profile'] = 'Профіль / Джерело';
|
||||||
|
$_['text_history_skipped'] = 'Пропущено';
|
||||||
|
$_['text_history_status'] = 'Результат';
|
||||||
|
$_['text_history_type'] = 'Тип операції';
|
||||||
|
$_['text_history_updated'] = 'Оновлено';
|
||||||
|
$_['text_ident_product_id'] = 'ID товару (product_id)';
|
||||||
|
$_['text_images_multi_col'] = 'Зображення в окремих колонках';
|
||||||
|
$_['text_images_single_col'] = 'Всі зображення в одній колонці (через роздільник)';
|
||||||
|
$_['text_loading'] = 'Завантаження...';
|
||||||
|
$_['text_manual_import'] = 'Ручний імпорт із файлу';
|
||||||
|
$_['text_mapping_no_results'] = 'Співпадінь не знайдено';
|
||||||
|
$_['text_missing_disable_batch'] = 'Отключить товары (только для текущей маркировки импорта)';
|
||||||
|
$_['text_missing_zero_batch'] = 'Обнулить остаток (только для текущей маркировки импорта)';
|
||||||
|
$_['text_mod_action_combine_fields'] = 'Об\'єднання колонок';
|
||||||
|
$_['text_mod_action_currency_convert'] = 'Конвертація валюти';
|
||||||
|
$_['text_no_categories_yet'] = 'Категорії постачальника ще не завантажені. Натисніть кнопку вище, щоб зчитати категорії з файлу.';
|
||||||
|
$_['text_no_categories_yet_short'] = 'Немає категорій';
|
||||||
|
$_['text_no_results'] = 'Немає записів для відображення';
|
||||||
|
$_['text_off'] = 'Вимкнено';
|
||||||
|
$_['text_placeholder_currency_from'] = 'Валюта з';
|
||||||
|
$_['text_placeholder_currency_to'] = 'Валюта в';
|
||||||
|
$_['text_placeholder_default'] = 'Значення за замовчуванням';
|
||||||
|
$_['text_placeholder_multiplier'] = '1.0';
|
||||||
|
$_['text_placeholder_price'] = '0.00';
|
||||||
|
$_['text_placeholder_qty'] = '0';
|
||||||
|
$_['text_precision_1dec'] = 'До 1 знака (150.5)';
|
||||||
|
$_['text_precision_2dec'] = 'До 2 знаків (150.55)';
|
||||||
|
$_['text_precision_90'] = 'Маркетингове .90 (149.90)';
|
||||||
|
$_['text_precision_99'] = 'Маркетингове .99 (149.99)';
|
||||||
|
$_['text_precision_hundreds'] = 'До сотень (150 -> 200)';
|
||||||
|
$_['text_precision_int'] = 'До цілих чисел (150)';
|
||||||
|
$_['text_precision_tens'] = 'До десятків (150 -> 150, 154 -> 150)';
|
||||||
|
$_['text_profile_new'] = 'Створити новий профіль';
|
||||||
|
$_['text_profile_select'] = 'Оберіть профіль';
|
||||||
|
$_['text_rounding_ceil'] = 'Завжди вгору (Ceil)';
|
||||||
|
$_['text_rounding_floor'] = 'Завжди вниз (Floor)';
|
||||||
|
$_['text_rounding_math'] = 'Математичне за правилами (Round)';
|
||||||
|
$_['text_rounding_off'] = 'Без додаткового округлення';
|
||||||
|
$_['text_save_profile_target'] = 'Куди зберегти профіль:';
|
||||||
|
$_['text_save_profile_title'] = 'Збереження профілю';
|
||||||
|
$_['text_search_mapping_placeholder'] = 'Пошук поля маппінгу...';
|
||||||
|
$_['text_section_currency_rounding'] = 'Конвертація валюти та округлення цін';
|
||||||
|
$_['text_select_profile_placeholder'] = 'Оберіть профіль зі списку...';
|
||||||
|
$_['text_supplier_currency'] = 'Валюта постачальника';
|
||||||
|
$_['text_visual_diff_title'] = 'Журнал змін у реальному часі';
|
||||||
|
|
||||||
|
$_['text_markup_up_to'] = 'Ціна до';
|
||||||
|
$_['text_markup_multiplier'] = 'Коеф. (напр. 1.25)';
|
||||||
|
$_['text_markup_add_tier'] = 'Додати поріг';
|
||||||
|
$_['text_markup_raw_string'] = 'Рядок';
|
||||||
|
|
||||||
|
$_['text_cron_never_run'] = 'Не запускався';
|
||||||
|
$_['text_cron_status_active'] = 'Активний';
|
||||||
|
$_['text_cron_status_alert'] = 'Увага';
|
||||||
|
$_['text_cron_status_error'] = 'Помилка';
|
||||||
|
$_['text_cron_alert_tooltip'] = 'Увага: немає активності %s днів (поріг: %s)';
|
||||||
|
$_['text_cron_error_tooltip'] = 'Останній запуск завершився з помилкою: %s';
|
||||||
|
|
||||||
|
$_['text_col_manufacturer'] = 'Виробник';
|
||||||
|
$_['help_map_manufacturer'] = 'Прив\'язка виробника. Підтримує пошук за назвою або ID, а також автоматичне створення.';
|
||||||
|
$_['entry_empty_special_action'] = 'При порожній акції у файлі';
|
||||||
|
$_['text_empty_special_skip'] = 'Пропустити (зберегти акції в магазині)';
|
||||||
|
$_['text_empty_special_delete'] = 'Видалити акції у товару';
|
||||||
|
$_['help_empty_special_action'] = 'Визначає, що робити з акціями в магазині, якщо колонка акції у прайсі постачальника порожня.';
|
||||||
|
$_['entry_category_update_mode'] = 'Режим оновлення категорій';
|
||||||
|
$_['text_category_mode_overwrite'] = 'Перезаписати (замінити прив\'язку)';
|
||||||
|
$_['text_category_mode_append'] = 'Додавати (зберегти існуючі категорії)';
|
||||||
|
$_['help_category_update_mode'] = 'Перезаписати — видаляє старі прив\'язки до категорій. Додавати — зберігає товар в існуючих категоріях та додає нову.';
|
||||||
|
$_['entry_man_binding_mode'] = 'Режим прив\'язки виробників';
|
||||||
|
$_['text_man_binding_mixed'] = 'Змішаний (знайти або створити)';
|
||||||
|
$_['text_man_binding_search'] = 'Тільки пов\'язувати з існуючим';
|
||||||
|
$_['text_man_binding_create'] = 'Завжди створювати нового';
|
||||||
|
$_['help_man_binding_mode'] = 'Змішаний = знайти збіг за назвою, інакше створити виробника.';
|
||||||
|
$_['entry_model'] = 'Модель';
|
||||||
|
$_['entry_name'] = 'Назва товару';
|
||||||
|
$_['help_map_image'] = 'Основне зображення товару (прямий URL або локальний шлях в image/catalog/)';
|
||||||
|
$_['text_action_translit'] = 'Транслітерація в ЧПУ (SEO URL)';
|
||||||
|
$_['text_missing_disable_cat'] = 'Вимкнути (лише вибрані категорії)';
|
||||||
|
$_['text_log_real_import'] = 'Реальний імпорт товарів...';
|
||||||
|
$_['error_post_max_size'] = 'Помилка: розмір завантажуваного файлу перевищує ліміт сервера post_max_size (%s)!';
|
||||||
|
|
||||||
|
// --- Лицензирование NAT (Стандарт V5 Final) ---
|
||||||
|
$_['nat_gk_title'] = 'Активація модуля';
|
||||||
|
$_['text_nat_domain_label'] = 'Ваш домен:';
|
||||||
|
$_['text_nat_copy_domain'] = 'Копіювати';
|
||||||
|
$_['text_nat_enter_key'] = 'Введіть ліцензійний ключ:';
|
||||||
|
$_['button_nat_activate'] = 'Активувати';
|
||||||
|
$_['text_nat_bot_btn'] = 'Отримати ключ у Telegram-боті';
|
||||||
|
$_['text_nat_rule_domain'] = '<b>Умови ліцензії:</b> 1 покупка = 1 домен. Ключ прив\'язується до основного домену без префікса www.';
|
||||||
|
$_['text_nat_contacts_title'] = 'Отримання ключа та підтримка:';
|
||||||
|
$_['placeholder_license'] = 'XXXX - XXXX - XXXX - XXXX';
|
||||||
|
$_['text_license_active'] = 'Ліцензія активна';
|
||||||
|
$_['text_nat_domain_copied'] = 'Скопійовано!';
|
||||||
|
$_['text_nat_support'] = 'Підтримка:';
|
||||||
|
$_['entry_license'] = 'Ліцензійний ключ:';
|
||||||
|
|
@ -0,0 +1,877 @@
|
||||||
|
<?php
|
||||||
|
if (!defined('DIR_APPLICATION')) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Opencart\Admin\Model\Extension\EasyImportNat\Module;
|
||||||
|
|
||||||
|
class EasyImportNat extends \Opencart\System\Engine\Model {
|
||||||
|
protected static $category_cache = array();
|
||||||
|
protected static $manufacturer_cache = array();
|
||||||
|
protected static $schema_cache = array();
|
||||||
|
|
||||||
|
public function getImportBatches() {
|
||||||
|
$query = $this->db->query("SELECT DISTINCT import_batch FROM `" . DB_PREFIX . "product` ORDER BY import_batch ASC");
|
||||||
|
$batches = array();
|
||||||
|
foreach ($query->rows as $row) {
|
||||||
|
$batches[] = $row['import_batch'];
|
||||||
|
}
|
||||||
|
return $batches;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getProducts($data = array()) {
|
||||||
|
$lang_id = isset($data['filter_language_id']) && (int)$data['filter_language_id'] > 0
|
||||||
|
? (int)$data['filter_language_id']
|
||||||
|
: ((isset($data['language_id']) && (int)$data['language_id'] > 0)
|
||||||
|
? (int)$data['language_id']
|
||||||
|
: (int)$this->config->get('config_language_id'));
|
||||||
|
if ($lang_id <= 0) {
|
||||||
|
$default_code = $this->config->get('config_language') ?: 'ru-ru';
|
||||||
|
$lang_q = $this->db->query("SELECT language_id FROM `" . DB_PREFIX . "language` WHERE code = '" . $this->db->escape($default_code) . "' AND status = '1' LIMIT 1");
|
||||||
|
if (!$lang_q->num_rows) {
|
||||||
|
$lang_q = $this->db->query("SELECT language_id FROM `" . DB_PREFIX . "language` WHERE status = '1' ORDER BY language_id ASC LIMIT 1");
|
||||||
|
}
|
||||||
|
$lang_id = $lang_q->num_rows ? (int)$lang_q->row['language_id'] : 1;
|
||||||
|
}
|
||||||
|
$sql = "SELECT p.product_id, p.model, p.sku, pd.name, p.price, p.quantity, p.status, p.image, p.import_batch FROM `" . DB_PREFIX . "product` p LEFT JOIN `" . DB_PREFIX . "product_description` pd ON (p.product_id = pd.product_id AND pd.language_id = '" . (int)$lang_id . "')";
|
||||||
|
|
||||||
|
if (!empty($data['filter_category']) && is_array($data['filter_category'])) {
|
||||||
|
$sql .= " LEFT JOIN `" . DB_PREFIX . "product_to_category` p2c ON (p.product_id = p2c.product_id)";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql .= " WHERE 1=1";
|
||||||
|
|
||||||
|
if (!empty($data['filter_category']) && is_array($data['filter_category'])) {
|
||||||
|
$sql .= " AND p2c.category_id IN (" . implode(',', array_map('intval', $data['filter_category'])) . ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($data['filter_manufacturer']) && is_array($data['filter_manufacturer'])) {
|
||||||
|
$sql .= " AND p.manufacturer_id IN (" . implode(',', array_map('intval', $data['filter_manufacturer'])) . ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($data['filter_status']) && $data['filter_status'] !== '') {
|
||||||
|
$sql .= " AND p.status = '" . (int)$data['filter_status'] . "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($data['filter_quantity']) && $data['filter_quantity'] !== '') {
|
||||||
|
$sql .= " AND p.quantity >= '" . (int)$data['filter_quantity'] . "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($data['filter_price_min']) && $data['filter_price_min'] !== '') {
|
||||||
|
$sql .= " AND p.price >= '" . (float)$data['filter_price_min'] . "'";
|
||||||
|
}
|
||||||
|
if (isset($data['filter_price_max']) && $data['filter_price_max'] !== '') {
|
||||||
|
$sql .= " AND p.price <= '" . (float)$data['filter_price_max'] . "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($data['filter_date_min'])) {
|
||||||
|
$sql .= " AND DATE(p.date_modified) >= '" . $this->db->escape($data['filter_date_min']) . "'";
|
||||||
|
}
|
||||||
|
if (!empty($data['filter_date_max'])) {
|
||||||
|
$sql .= " AND DATE(p.date_modified) <= '" . $this->db->escape($data['filter_date_max']) . "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($data['filter_batch']) && is_array($data['filter_batch'])) {
|
||||||
|
$clean_batches = array();
|
||||||
|
$include_empty = false;
|
||||||
|
foreach ($data['filter_batch'] as $b) {
|
||||||
|
if ($b === '') {
|
||||||
|
$include_empty = true;
|
||||||
|
} else {
|
||||||
|
$clean_batches[] = "'" . $this->db->escape($b) . "'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$batch_sql = array();
|
||||||
|
if (!empty($clean_batches)) {
|
||||||
|
$batch_sql[] = "p.import_batch IN (" . implode(',', $clean_batches) . ")";
|
||||||
|
}
|
||||||
|
if ($include_empty) {
|
||||||
|
$batch_sql[] = "p.import_batch = ''";
|
||||||
|
}
|
||||||
|
if (!empty($batch_sql)) {
|
||||||
|
$sql .= " AND (" . implode(' OR ', $batch_sql) . ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($data['filter_identifier']) && $data['filter_identifier']) {
|
||||||
|
$sql .= " AND p.product_id = '" . (int)$data['filter_identifier'] . "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql .= " GROUP BY p.product_id, pd.name ORDER BY p.product_id ASC";
|
||||||
|
|
||||||
|
if (isset($data['start']) || isset($data['limit'])) {
|
||||||
|
if (!isset($data['start']) || $data['start'] < 0) $data['start'] = 0;
|
||||||
|
if (!isset($data['limit']) || $data['limit'] < 1) $data['limit'] = 200;
|
||||||
|
$sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = $this->db->query($sql);
|
||||||
|
return $query->rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTotalProducts($data = array()) {
|
||||||
|
$sql = "SELECT COUNT(DISTINCT p.product_id) AS total FROM `" . DB_PREFIX . "product` p";
|
||||||
|
|
||||||
|
if (!empty($data['filter_category']) && is_array($data['filter_category'])) {
|
||||||
|
$sql .= " LEFT JOIN `" . DB_PREFIX . "product_to_category` p2c ON (p.product_id = p2c.product_id)";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql .= " WHERE 1=1";
|
||||||
|
|
||||||
|
if (isset($data['filter_identifier']) && $data['filter_identifier']) {
|
||||||
|
$sql .= " AND p.product_id = '" . (int)$data['filter_identifier'] . "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($data['filter_category']) && is_array($data['filter_category'])) {
|
||||||
|
$sql .= " AND p2c.category_id IN (" . implode(',', array_map('intval', $data['filter_category'])) . ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($data['filter_manufacturer']) && is_array($data['filter_manufacturer'])) {
|
||||||
|
$sql .= " AND p.manufacturer_id IN (" . implode(',', array_map('intval', $data['filter_manufacturer'])) . ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($data['filter_status']) && $data['filter_status'] !== '') {
|
||||||
|
$sql .= " AND p.status = '" . (int)$data['filter_status'] . "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($data['filter_quantity']) && $data['filter_quantity'] !== '') {
|
||||||
|
$sql .= " AND p.quantity >= '" . (int)$data['filter_quantity'] . "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($data['filter_price_min']) && $data['filter_price_min'] !== '') {
|
||||||
|
$sql .= " AND p.price >= '" . (float)$data['filter_price_min'] . "'";
|
||||||
|
}
|
||||||
|
if (isset($data['filter_price_max']) && $data['filter_price_max'] !== '') {
|
||||||
|
$sql .= " AND p.price <= '" . (float)$data['filter_price_max'] . "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($data['filter_date_min'])) {
|
||||||
|
$sql .= " AND DATE(p.date_modified) >= '" . $this->db->escape($data['filter_date_min']) . "'";
|
||||||
|
}
|
||||||
|
if (!empty($data['filter_date_max'])) {
|
||||||
|
$sql .= " AND DATE(p.date_modified) <= '" . $this->db->escape($data['filter_date_max']) . "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($data['filter_batch']) && is_array($data['filter_batch'])) {
|
||||||
|
$clean_batches = array();
|
||||||
|
$include_empty = false;
|
||||||
|
foreach ($data['filter_batch'] as $b) {
|
||||||
|
if ($b === '') {
|
||||||
|
$include_empty = true;
|
||||||
|
} else {
|
||||||
|
$clean_batches[] = "'" . $this->db->escape($b) . "'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$batch_sql = array();
|
||||||
|
if (!empty($clean_batches)) {
|
||||||
|
$batch_sql[] = "p.import_batch IN (" . implode(',', $clean_batches) . ")";
|
||||||
|
}
|
||||||
|
if ($include_empty) {
|
||||||
|
$batch_sql[] = "p.import_batch = ''";
|
||||||
|
}
|
||||||
|
if (!empty($batch_sql)) {
|
||||||
|
$sql .= " AND (" . implode(' OR ', $batch_sql) . ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = $this->db->query($sql);
|
||||||
|
return $query->row['total'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getProductSpecials($product_id) {
|
||||||
|
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "product_special` WHERE product_id = '" . (int)$product_id . "' ORDER BY priority ASC, price ASC");
|
||||||
|
return $query->rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getProductDiscounts($product_id) {
|
||||||
|
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "product_discount` WHERE product_id = '" . (int)$product_id . "' ORDER BY quantity ASC, priority ASC, price ASC");
|
||||||
|
return $query->rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getProductSpecialsBatch(array $product_ids) {
|
||||||
|
$product_ids = array_filter(array_map('intval', $product_ids));
|
||||||
|
if (empty($product_ids)) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "product_special` WHERE product_id IN (" . implode(',', $product_ids) . ") ORDER BY priority ASC, price ASC");
|
||||||
|
$result = array();
|
||||||
|
foreach ($query->rows as $row) {
|
||||||
|
$pid = (int)$row['product_id'];
|
||||||
|
if (!isset($result[$pid])) {
|
||||||
|
$result[$pid] = array();
|
||||||
|
}
|
||||||
|
$result[$pid][] = $row;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getProductDiscountsBatch(array $product_ids) {
|
||||||
|
$product_ids = array_filter(array_map('intval', $product_ids));
|
||||||
|
if (empty($product_ids)) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "product_discount` WHERE product_id IN (" . implode(',', $product_ids) . ") ORDER BY quantity ASC, priority ASC, price ASC");
|
||||||
|
$result = array();
|
||||||
|
foreach ($query->rows as $row) {
|
||||||
|
$pid = (int)$row['product_id'];
|
||||||
|
if (!isset($result[$pid])) {
|
||||||
|
$result[$pid] = array();
|
||||||
|
}
|
||||||
|
$result[$pid][] = $row;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateProductBasic($product_id, $price, $quantity, $status, $batch) {
|
||||||
|
$sql = "UPDATE `" . DB_PREFIX . "product` SET price = '" . (float)$price . "', quantity = '" . (int)$quantity . "', status = '" . (int)$status . "', import_batch = '" . $this->db->escape($batch) . "'";
|
||||||
|
if ((int)$quantity <= 0) {
|
||||||
|
$stock_status_out = (int)$this->config->get('config_stock_status_id') ?: 5;
|
||||||
|
$sql .= ", stock_status_id = '" . $stock_status_out . "'";
|
||||||
|
}
|
||||||
|
$sql .= ", date_modified = NOW() WHERE product_id = '" . (int)$product_id . "'";
|
||||||
|
$this->db->query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function clearProductSpecials($product_id) {
|
||||||
|
$this->db->query("DELETE FROM `" . DB_PREFIX . "product_special` WHERE product_id = '" . (int)$product_id . "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addProductSpecial($product_id, $customer_group_id, $priority, $price, $date_start = '0000-00-00', $date_end = '0000-00-00') {
|
||||||
|
$this->db->query("INSERT INTO `" . DB_PREFIX . "product_special` SET product_id = '" . (int)$product_id . "', customer_group_id = '" . (int)$customer_group_id . "', priority = '" . (int)$priority . "', price = '" . (float)$price . "', date_start = '" . $this->db->escape($date_start) . "', date_end = '" . $this->db->escape($date_end) . "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function clearProductDiscounts($product_id) {
|
||||||
|
$this->db->query("DELETE FROM `" . DB_PREFIX . "product_discount` WHERE product_id = '" . (int)$product_id . "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addProductDiscount($product_id, $customer_group_id, $quantity, $priority, $price, $date_start = '0000-00-00', $date_end = '0000-00-00') {
|
||||||
|
$this->db->query("INSERT INTO `" . DB_PREFIX . "product_discount` SET product_id = '" . (int)$product_id . "', customer_group_id = '" . (int)$customer_group_id . "', quantity = '" . (int)$quantity . "', priority = '" . (int)$priority . "', price = '" . (float)$price . "', date_start = '" . $this->db->escape($date_start) . "', date_end = '" . $this->db->escape($date_end) . "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getProductIdsByIdentifier($identifier, $value) {
|
||||||
|
if ($identifier === 'product_id') {
|
||||||
|
$query = $this->db->query("SELECT product_id FROM `" . DB_PREFIX . "product` WHERE product_id = '" . (int)$value . "'");
|
||||||
|
} elseif ($identifier === 'sku') {
|
||||||
|
$query = $this->db->query("SELECT product_id FROM `" . DB_PREFIX . "product` WHERE sku = '" . $this->db->escape($value) . "'");
|
||||||
|
} else {
|
||||||
|
$query = $this->db->query("SELECT product_id FROM `" . DB_PREFIX . "product` WHERE model = '" . $this->db->escape($value) . "'");
|
||||||
|
}
|
||||||
|
$ids = array();
|
||||||
|
foreach ($query->rows as $row) {
|
||||||
|
$ids[] = (int)$row['product_id'];
|
||||||
|
}
|
||||||
|
return $ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getProductIdByIdentifier($identifier, $value) {
|
||||||
|
$ids = $this->getProductIdsByIdentifier($identifier, $value);
|
||||||
|
return !empty($ids) ? $ids[0] : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getProductsCategories($product_ids) {
|
||||||
|
if (empty($product_ids)) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
$chunks = array_chunk(array_unique(array_map('intval', $product_ids)), 2000);
|
||||||
|
$categories = array();
|
||||||
|
foreach ($chunks as $chunk) {
|
||||||
|
$ids = implode(',', $chunk);
|
||||||
|
$query = $this->db->query("SELECT DISTINCT category_id FROM `" . DB_PREFIX . "product_to_category` WHERE product_id IN (" . $ids . ")");
|
||||||
|
foreach ($query->rows as $row) {
|
||||||
|
$categories[(int)$row['category_id']] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return array_keys($categories);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getProductsManufacturers($product_ids) {
|
||||||
|
if (empty($product_ids)) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
$chunks = array_chunk(array_unique(array_map('intval', $product_ids)), 2000);
|
||||||
|
$manufacturers = array();
|
||||||
|
foreach ($chunks as $chunk) {
|
||||||
|
$ids = implode(',', $chunk);
|
||||||
|
$query = $this->db->query("SELECT DISTINCT manufacturer_id FROM `" . DB_PREFIX . "product` WHERE product_id IN (" . $ids . ") AND manufacturer_id > 0");
|
||||||
|
foreach ($query->rows as $row) {
|
||||||
|
$manufacturers[(int)$row['manufacturer_id']] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return array_keys($manufacturers);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function zeroMissingProducts($processed_ids, $action, $categories = array(), $batch_name = '', $simulate = false) {
|
||||||
|
if (empty($processed_ids)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$stock_status_out = (int)$this->config->get('config_stock_status_id') ?: 5;
|
||||||
|
$affected = 0;
|
||||||
|
|
||||||
|
$this->db->query("CREATE TEMPORARY TABLE IF NOT EXISTS `" . DB_PREFIX . "tmp_nat_ids` (product_id INT NOT NULL PRIMARY KEY) ENGINE=MEMORY");
|
||||||
|
$this->db->query("TRUNCATE TABLE `" . DB_PREFIX . "tmp_nat_ids`");
|
||||||
|
|
||||||
|
$chunks = array_chunk(array_unique(array_map('intval', $processed_ids)), 1000);
|
||||||
|
foreach ($chunks as $chunk) {
|
||||||
|
$this->db->query("INSERT IGNORE INTO `" . DB_PREFIX . "tmp_nat_ids` (product_id) VALUES (" . implode('),(', $chunk) . ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action === 'zero_all') {
|
||||||
|
if ($simulate) {
|
||||||
|
$q = $this->db->query("SELECT COUNT(product_id) as total FROM `" . DB_PREFIX . "product` WHERE product_id NOT IN (SELECT product_id FROM `" . DB_PREFIX . "tmp_nat_ids`)");
|
||||||
|
return (int)$q->row['total'];
|
||||||
|
}
|
||||||
|
$this->db->query("UPDATE `" . DB_PREFIX . "product` SET quantity = '0', stock_status_id = '" . $stock_status_out . "', date_modified = NOW() WHERE product_id NOT IN (SELECT product_id FROM `" . DB_PREFIX . "tmp_nat_ids`)");
|
||||||
|
$affected = $this->db->countAffected();
|
||||||
|
} elseif ($action === 'disable') {
|
||||||
|
if ($simulate) {
|
||||||
|
$q = $this->db->query("SELECT COUNT(product_id) as total FROM `" . DB_PREFIX . "product` WHERE product_id NOT IN (SELECT product_id FROM `" . DB_PREFIX . "tmp_nat_ids`)");
|
||||||
|
return (int)$q->row['total'];
|
||||||
|
}
|
||||||
|
$this->db->query("UPDATE `" . DB_PREFIX . "product` SET status = '0', date_modified = NOW() WHERE product_id NOT IN (SELECT product_id FROM `" . DB_PREFIX . "tmp_nat_ids`)");
|
||||||
|
$affected = $this->db->countAffected();
|
||||||
|
} elseif ($action === 'zero_cat' && !empty($categories)) {
|
||||||
|
$cat_ids = implode(',', array_map('intval', $categories));
|
||||||
|
$query = $this->db->query("SELECT DISTINCT p.product_id FROM `" . DB_PREFIX . "product` p LEFT JOIN `" . DB_PREFIX . "product_to_category` p2c ON (p.product_id = p2c.product_id) WHERE p.product_id NOT IN (SELECT product_id FROM `" . DB_PREFIX . "tmp_nat_ids`) AND p2c.category_id IN (" . $cat_ids . ")");
|
||||||
|
|
||||||
|
if ($simulate) {
|
||||||
|
return (int)$query->num_rows;
|
||||||
|
}
|
||||||
|
if ($query->num_rows) {
|
||||||
|
$target_ids = array();
|
||||||
|
foreach ($query->rows as $row) {
|
||||||
|
$target_ids[] = (int)$row['product_id'];
|
||||||
|
}
|
||||||
|
$chunks_target = array_chunk($target_ids, 1000);
|
||||||
|
foreach ($chunks_target as $ct) {
|
||||||
|
$this->db->query("UPDATE `" . DB_PREFIX . "product` SET quantity = '0', stock_status_id = '" . $stock_status_out . "', date_modified = NOW() WHERE product_id IN (" . implode(',', $ct) . ")");
|
||||||
|
$affected += $this->db->countAffected();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elseif ($action === 'disable_cat' && !empty($categories)) {
|
||||||
|
$cat_ids = implode(',', array_map('intval', $categories));
|
||||||
|
$query = $this->db->query("SELECT DISTINCT p.product_id FROM `" . DB_PREFIX . "product` p LEFT JOIN `" . DB_PREFIX . "product_to_category` p2c ON (p.product_id = p2c.product_id) WHERE p.product_id NOT IN (SELECT product_id FROM `" . DB_PREFIX . "tmp_nat_ids`) AND p2c.category_id IN (" . $cat_ids . ")");
|
||||||
|
|
||||||
|
if ($simulate) {
|
||||||
|
return (int)$query->num_rows;
|
||||||
|
}
|
||||||
|
if ($query->num_rows) {
|
||||||
|
$target_ids = array();
|
||||||
|
foreach ($query->rows as $row) {
|
||||||
|
$target_ids[] = (int)$row['product_id'];
|
||||||
|
}
|
||||||
|
$chunks_target = array_chunk($target_ids, 1000);
|
||||||
|
foreach ($chunks_target as $ct) {
|
||||||
|
$this->db->query("UPDATE `" . DB_PREFIX . "product` SET status = '0', date_modified = NOW() WHERE product_id IN (" . implode(',', $ct) . ")");
|
||||||
|
$affected += $this->db->countAffected();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elseif ($action === 'zero_brand' && !empty($categories)) {
|
||||||
|
$man_ids = implode(',', array_map('intval', $categories));
|
||||||
|
$query = $this->db->query("SELECT product_id FROM `" . DB_PREFIX . "product` WHERE product_id NOT IN (SELECT product_id FROM `" . DB_PREFIX . "tmp_nat_ids`) AND manufacturer_id IN (" . $man_ids . ")");
|
||||||
|
|
||||||
|
if ($simulate) {
|
||||||
|
return (int)$query->num_rows;
|
||||||
|
}
|
||||||
|
if ($query->num_rows) {
|
||||||
|
$target_ids = array();
|
||||||
|
foreach ($query->rows as $row) {
|
||||||
|
$target_ids[] = (int)$row['product_id'];
|
||||||
|
}
|
||||||
|
$chunks_target = array_chunk($target_ids, 1000);
|
||||||
|
foreach ($chunks_target as $ct) {
|
||||||
|
$this->db->query("UPDATE `" . DB_PREFIX . "product` SET quantity = '0', stock_status_id = '" . $stock_status_out . "', date_modified = NOW() WHERE product_id IN (" . implode(',', $ct) . ")");
|
||||||
|
$affected += $this->db->countAffected();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elseif ($action === 'disable_brand' && !empty($categories)) {
|
||||||
|
$man_ids = implode(',', array_map('intval', $categories));
|
||||||
|
$query = $this->db->query("SELECT product_id FROM `" . DB_PREFIX . "product` WHERE product_id NOT IN (SELECT product_id FROM `" . DB_PREFIX . "tmp_nat_ids`) AND manufacturer_id IN (" . $man_ids . ")");
|
||||||
|
|
||||||
|
if ($simulate) {
|
||||||
|
return (int)$query->num_rows;
|
||||||
|
}
|
||||||
|
if ($query->num_rows) {
|
||||||
|
$target_ids = array();
|
||||||
|
foreach ($query->rows as $row) {
|
||||||
|
$target_ids[] = (int)$row['product_id'];
|
||||||
|
}
|
||||||
|
$chunks_target = array_chunk($target_ids, 1000);
|
||||||
|
foreach ($chunks_target as $ct) {
|
||||||
|
$this->db->query("UPDATE `" . DB_PREFIX . "product` SET status = '0', date_modified = NOW() WHERE product_id IN (" . implode(',', $ct) . ")");
|
||||||
|
$affected += $this->db->countAffected();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elseif ($action === 'zero_batch' && $batch_name !== '') {
|
||||||
|
if ($simulate) {
|
||||||
|
$q = $this->db->query("SELECT COUNT(product_id) as total FROM `" . DB_PREFIX . "product` WHERE product_id NOT IN (SELECT product_id FROM `" . DB_PREFIX . "tmp_nat_ids`) AND import_batch = '" . $this->db->escape($batch_name) . "'");
|
||||||
|
return (int)$q->row['total'];
|
||||||
|
}
|
||||||
|
$this->db->query("UPDATE `" . DB_PREFIX . "product` SET quantity = '0', stock_status_id = '" . $stock_status_out . "', date_modified = NOW() WHERE product_id NOT IN (SELECT product_id FROM `" . DB_PREFIX . "tmp_nat_ids`) AND import_batch = '" . $this->db->escape($batch_name) . "'");
|
||||||
|
$affected = $this->db->countAffected();
|
||||||
|
} elseif ($action === 'disable_batch' && $batch_name !== '') {
|
||||||
|
if ($simulate) {
|
||||||
|
$q = $this->db->query("SELECT COUNT(product_id) as total FROM `" . DB_PREFIX . "product` WHERE product_id NOT IN (SELECT product_id FROM `" . DB_PREFIX . "tmp_nat_ids`) AND import_batch = '" . $this->db->escape($batch_name) . "'");
|
||||||
|
return (int)$q->row['total'];
|
||||||
|
}
|
||||||
|
$this->db->query("UPDATE `" . DB_PREFIX . "product` SET status = '0', date_modified = NOW() WHERE product_id NOT IN (SELECT product_id FROM `" . DB_PREFIX . "tmp_nat_ids`) AND import_batch = '" . $this->db->escape($batch_name) . "'");
|
||||||
|
$affected = $this->db->countAffected();
|
||||||
|
}
|
||||||
|
return $affected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCronProfiles() {
|
||||||
|
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "easy_import_nat_cron` ORDER BY profile_id DESC");
|
||||||
|
return $query->rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCronProfile($profile_id) {
|
||||||
|
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "easy_import_nat_cron` WHERE profile_id = '" . (int)$profile_id . "'");
|
||||||
|
return $query->row;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addCronProfile($data) {
|
||||||
|
$type = isset($data['type']) ? preg_replace('/[^a-zA-Z0-9_]/', '', $data['type']) : 'import';
|
||||||
|
$this->db->query("INSERT INTO `" . DB_PREFIX . "easy_import_nat_cron` SET type = '" . $this->db->escape($type) . "', name = '" . $this->db->escape($data['name']) . "', url = '" . $this->db->escape($data['url']) . "', mapping = '" . $this->db->escape(json_encode($data['mapping'])) . "', settings = '" . $this->db->escape(json_encode($data['settings'])) . "', status = '" . (int)$data['status'] . "', date_added = NOW()");
|
||||||
|
return $this->db->getLastId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function editCronProfile($profile_id, $data) {
|
||||||
|
$type = isset($data['type']) ? preg_replace('/[^a-zA-Z0-9_]/', '', $data['type']) : 'import';
|
||||||
|
$this->db->query("UPDATE `" . DB_PREFIX . "easy_import_nat_cron` SET type = '" . $this->db->escape($type) . "', name = '" . $this->db->escape($data['name']) . "', url = '" . $this->db->escape($data['url']) . "', mapping = '" . $this->db->escape(json_encode($data['mapping'])) . "', settings = '" . $this->db->escape(json_encode($data['settings'])) . "', status = '" . (int)$data['status'] . "' WHERE profile_id = '" . (int)$profile_id . "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteCronProfile($profile_id) {
|
||||||
|
$this->db->query("DELETE FROM `" . DB_PREFIX . "easy_import_nat_cron` WHERE profile_id = '" . (int)$profile_id . "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateCronLastRun($profile_id) {
|
||||||
|
$this->db->query("UPDATE `" . DB_PREFIX . "easy_import_nat_cron` SET date_last_run = NOW() WHERE profile_id = '" . (int)$profile_id . "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNextCronId() {
|
||||||
|
$query = $this->db->query("SHOW TABLE STATUS LIKE '" . DB_PREFIX . "easy_import_nat_cron'");
|
||||||
|
if (isset($query->row['Auto_increment'])) {
|
||||||
|
return (int)$query->row['Auto_increment'];
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function checkColumnExists($table_name, $column_name) {
|
||||||
|
$cache_key = $table_name . '.' . $column_name;
|
||||||
|
if (isset(self::$schema_cache[$cache_key])) {
|
||||||
|
return self::$schema_cache[$cache_key];
|
||||||
|
}
|
||||||
|
|
||||||
|
$check_table = $this->db->query("SHOW TABLES LIKE '" . $table_name . "'");
|
||||||
|
if (!$check_table->num_rows) {
|
||||||
|
self::$schema_cache[$cache_key] = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$check_col = $this->db->query("SHOW COLUMNS FROM `" . $table_name . "` LIKE '" . $column_name . "'");
|
||||||
|
$exists = ($check_col->num_rows > 0);
|
||||||
|
self::$schema_cache[$cache_key] = $exists;
|
||||||
|
return $exists;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateProductSeoUrl($product_id, $keyword, $store_id = null, $language_id = null) {
|
||||||
|
if ($language_id === null || (int)$language_id <= 0) {
|
||||||
|
$language_id = (int)$this->config->get('config_language_id');
|
||||||
|
if ($language_id <= 0) {
|
||||||
|
$lang_q = $this->db->query("SELECT language_id FROM `" . DB_PREFIX . "language` WHERE status = '1' ORDER BY language_id ASC LIMIT 1");
|
||||||
|
$language_id = $lang_q->num_rows ? (int)$lang_q->row['language_id'] : 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$keyword = trim((string)$keyword);
|
||||||
|
$store_ids = ($store_id === null) ? $this->getAllStoreIds() : array((int)$store_id);
|
||||||
|
|
||||||
|
foreach ($store_ids as $sid) {
|
||||||
|
$this->db->query("DELETE FROM `" . DB_PREFIX . "seo_url` WHERE `key` = 'product_id' AND `value` = '" . (int)$product_id . "' AND store_id = '" . (int)$sid . "' AND language_id = '" . (int)$language_id . "'");
|
||||||
|
if ($keyword !== '') {
|
||||||
|
$check = $this->db->query("SELECT seo_url_id FROM `" . DB_PREFIX . "seo_url` WHERE keyword = '" . $this->db->escape($keyword) . "' AND store_id = '" . (int)$sid . "' AND language_id = '" . (int)$language_id . "' AND NOT (`key` = 'product_id' AND `value` = '" . (int)$product_id . "') LIMIT 1");
|
||||||
|
$final_kw = $check->num_rows ? ($keyword . '-' . (int)$product_id) : $keyword;
|
||||||
|
$this->db->query("INSERT INTO `" . DB_PREFIX . "seo_url` SET store_id = '" . (int)$sid . "', language_id = '" . (int)$language_id . "', `key` = 'product_id', `value` = '" . (int)$product_id . "', keyword = '" . $this->db->escape($final_kw) . "', sort_order = 0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCustomFieldValue($product_id, $table_name, $column_name, $language_id = null) {
|
||||||
|
$table_name = preg_replace('/[^a-zA-Z0-9_]/', '', $table_name);
|
||||||
|
$column_name = preg_replace('/[^a-zA-Z0-9_]/', '', $column_name);
|
||||||
|
|
||||||
|
$lang_id = ($language_id !== null && (int)$language_id > 0) ? (int)$language_id : (int)$this->config->get('config_language_id');
|
||||||
|
if ($lang_id <= 0) {
|
||||||
|
$lang_query = $this->db->query("SELECT language_id FROM `" . DB_PREFIX . "language` WHERE status = '1' ORDER BY sort_order ASC, language_id ASC LIMIT 1");
|
||||||
|
$lang_id = $lang_query->num_rows ? (int)$lang_query->row['language_id'] : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($table_name === DB_PREFIX . 'seo_url') {
|
||||||
|
$sql = "SELECT `keyword` FROM `" . DB_PREFIX . "seo_url` WHERE query = 'product_id=" . (int)$product_id . "' AND store_id = 0 AND language_id = '" . (int)$lang_id . "' LIMIT 1";
|
||||||
|
$query = $this->db->query($sql);
|
||||||
|
return $query->num_rows ? $query->row['keyword'] : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strpos($table_name, DB_PREFIX . 'product') !== 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->checkColumnExists($table_name, $column_name)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT `" . $column_name . "` FROM `" . $table_name . "` WHERE product_id = '" . (int)$product_id . "'";
|
||||||
|
if ($table_name === DB_PREFIX . 'product_description') {
|
||||||
|
$sql .= " AND language_id = '" . (int)$lang_id . "'";
|
||||||
|
}
|
||||||
|
$sql .= " LIMIT 1";
|
||||||
|
|
||||||
|
$query = $this->db->query($sql);
|
||||||
|
if ($query->num_rows) {
|
||||||
|
return $query->row[$column_name];
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateCustomField($product_id, $table_name, $column_name, $value, $language_id = null) {
|
||||||
|
$table_name = preg_replace('/[^a-zA-Z0-9_]/', '', $table_name);
|
||||||
|
$column_name = preg_replace('/[^a-zA-Z0-9_]/', '', $column_name);
|
||||||
|
|
||||||
|
if ($table_name === DB_PREFIX . 'seo_url' || $table_name === 'seo_url') {
|
||||||
|
$this->updateProductSeoUrl($product_id, $value, null, $language_id);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strpos($table_name, DB_PREFIX . 'product') !== 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->checkColumnExists($table_name, $column_name)) {
|
||||||
|
try {
|
||||||
|
$this->db->query("ALTER TABLE `" . $table_name . "` ADD `" . $column_name . "` VARCHAR(255) NOT NULL DEFAULT ''");
|
||||||
|
self::$schema_cache[$table_name . '.' . $column_name] = true;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->checkColumnExists($table_name, 'product_id')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$lang_id = ($language_id !== null && (int)$language_id > 0) ? (int)$language_id : (int)$this->config->get('config_language_id');
|
||||||
|
if ($lang_id <= 0) {
|
||||||
|
$lang_query = $this->db->query("SELECT language_id FROM `" . DB_PREFIX . "language` WHERE status = '1' ORDER BY sort_order ASC, language_id ASC LIMIT 1");
|
||||||
|
$lang_id = $lang_query->num_rows ? (int)$lang_query->row['language_id'] : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql_exists = "SELECT product_id FROM `" . $table_name . "` WHERE product_id = '" . (int)$product_id . "'";
|
||||||
|
if ($table_name === DB_PREFIX . 'product_description') {
|
||||||
|
$sql_exists .= " AND language_id = '" . (int)$lang_id . "'";
|
||||||
|
}
|
||||||
|
$exists = $this->db->query($sql_exists);
|
||||||
|
|
||||||
|
if ($exists->num_rows) {
|
||||||
|
if ($table_name === DB_PREFIX . 'product_description') {
|
||||||
|
$this->db->query("UPDATE `" . $table_name . "` SET `" . $column_name . "` = '" . $this->db->escape($value) . "' WHERE product_id = '" . (int)$product_id . "' AND language_id = '" . (int)$lang_id . "'");
|
||||||
|
} else {
|
||||||
|
$this->db->query("UPDATE `" . $table_name . "` SET `" . $column_name . "` = '" . $this->db->escape($value) . "' WHERE product_id = '" . (int)$product_id . "'");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
if ($table_name === DB_PREFIX . 'product_description') {
|
||||||
|
$desc_fields = array(
|
||||||
|
'name' => '',
|
||||||
|
'description' => '',
|
||||||
|
'tag' => '',
|
||||||
|
'meta_title' => '',
|
||||||
|
'meta_description' => '',
|
||||||
|
'meta_keyword' => ''
|
||||||
|
);
|
||||||
|
$desc_fields[$column_name] = $value;
|
||||||
|
if ($column_name === 'name' && empty($desc_fields['meta_title'])) {
|
||||||
|
$desc_fields['meta_title'] = $value;
|
||||||
|
}
|
||||||
|
$insert_parts = array(
|
||||||
|
"product_id = '" . (int)$product_id . "'",
|
||||||
|
"language_id = '" . (int)$lang_id . "'"
|
||||||
|
);
|
||||||
|
foreach ($desc_fields as $df_key => $df_val) {
|
||||||
|
$insert_parts[] = "`" . $df_key . "` = '" . $this->db->escape($df_val) . "'";
|
||||||
|
}
|
||||||
|
$this->db->query("INSERT INTO `" . $table_name . "` SET " . implode(', ', $insert_parts));
|
||||||
|
} else {
|
||||||
|
$this->db->query("INSERT INTO `" . $table_name . "` SET product_id = '" . (int)$product_id . "', `" . $column_name . "` = '" . $this->db->escape($value) . "'");
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateProductCategory($product_id, $category_ids, $mode = 'overwrite') {
|
||||||
|
$category_ids = array_values(array_unique(array_filter(array_map('intval', (array)$category_ids))));
|
||||||
|
if (empty($category_ids)) return false;
|
||||||
|
|
||||||
|
$schema_key = 'product_to_category.main_category';
|
||||||
|
if (!isset(self::$schema_cache[$schema_key])) {
|
||||||
|
self::$schema_cache[$schema_key] = $this->db->query("SHOW COLUMNS FROM `" . DB_PREFIX . "product_to_category` LIKE 'main_category'")->num_rows > 0;
|
||||||
|
}
|
||||||
|
$main_category_exists = self::$schema_cache[$schema_key];
|
||||||
|
|
||||||
|
// Expand with all ancestor categories from oc_category_path
|
||||||
|
$all_category_ids = $category_ids;
|
||||||
|
$cat_ids_str = implode(',', $category_ids);
|
||||||
|
$path_query = $this->db->query("SELECT DISTINCT path_id FROM `" . DB_PREFIX . "category_path` WHERE category_id IN (" . $cat_ids_str . ") LIMIT 100");
|
||||||
|
foreach ($path_query->rows as $prow) {
|
||||||
|
$pid = (int)$prow['path_id'];
|
||||||
|
if ($pid > 0 && !in_array($pid, $all_category_ids)) {
|
||||||
|
$all_category_ids[] = $pid;
|
||||||
|
if (count($all_category_ids) >= 100) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$primary_leaf = $category_ids[0];
|
||||||
|
|
||||||
|
if ($mode === 'overwrite') {
|
||||||
|
$this->db->query("DELETE FROM `" . DB_PREFIX . "product_to_category` WHERE product_id = '" . (int)$product_id . "'");
|
||||||
|
foreach ($all_category_ids as $category_id) {
|
||||||
|
if ($category_id <= 0) continue;
|
||||||
|
$is_main = ($category_id === $primary_leaf) ? 1 : 0;
|
||||||
|
if ($main_category_exists) {
|
||||||
|
$this->db->query("INSERT IGNORE INTO `" . DB_PREFIX . "product_to_category` SET product_id = '" . (int)$product_id . "', category_id = '" . (int)$category_id . "', main_category = '" . (int)$is_main . "'");
|
||||||
|
} else {
|
||||||
|
$this->db->query("INSERT IGNORE INTO `" . DB_PREFIX . "product_to_category` SET product_id = '" . (int)$product_id . "', category_id = '" . (int)$category_id . "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$has_main = false;
|
||||||
|
if ($main_category_exists) {
|
||||||
|
$has_main = $this->db->query("SELECT product_id FROM `" . DB_PREFIX . "product_to_category` WHERE product_id = '" . (int)$product_id . "' AND main_category = '1' LIMIT 1")->num_rows > 0;
|
||||||
|
}
|
||||||
|
foreach ($all_category_ids as $category_id) {
|
||||||
|
if ($category_id <= 0) continue;
|
||||||
|
$check = $this->db->query("SELECT product_id FROM `" . DB_PREFIX . "product_to_category` WHERE product_id = '" . (int)$product_id . "' AND category_id = '" . (int)$category_id . "'");
|
||||||
|
if (!$check->num_rows) {
|
||||||
|
$is_main = (!$has_main && $category_id === $primary_leaf) ? 1 : 0;
|
||||||
|
if ($is_main) $has_main = true;
|
||||||
|
if ($main_category_exists) {
|
||||||
|
$this->db->query("INSERT IGNORE INTO `" . DB_PREFIX . "product_to_category` SET product_id = '" . (int)$product_id . "', category_id = '" . (int)$category_id . "', main_category = '" . (int)$is_main . "'");
|
||||||
|
} else {
|
||||||
|
$this->db->query("INSERT IGNORE INTO `" . DB_PREFIX . "product_to_category` SET product_id = '" . (int)$product_id . "', category_id = '" . (int)$category_id . "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getAllStoreIds() {
|
||||||
|
$stores = array(0);
|
||||||
|
$query = $this->db->query("SELECT store_id FROM `" . DB_PREFIX . "store`");
|
||||||
|
foreach ($query->rows as $r) {
|
||||||
|
$stores[] = (int)$r['store_id'];
|
||||||
|
}
|
||||||
|
return array_unique($stores);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getOrCreateManufacturer($name, $mode = 'mixed') {
|
||||||
|
$name = html_entity_decode(trim((string)$name), ENT_QUOTES, 'UTF-8');
|
||||||
|
if ($name === '') return 0;
|
||||||
|
|
||||||
|
$cache_key = md5(mb_strtolower($name, 'UTF-8') . '_' . $mode);
|
||||||
|
if (isset(self::$manufacturer_cache[$cache_key])) {
|
||||||
|
return self::$manufacturer_cache[$cache_key];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_numeric($name)) {
|
||||||
|
$manufacturer_id = (int)$name;
|
||||||
|
$query = $this->db->query("SELECT manufacturer_id FROM `" . DB_PREFIX . "manufacturer` WHERE manufacturer_id = '" . $manufacturer_id . "'");
|
||||||
|
if ($query->num_rows) {
|
||||||
|
self::$manufacturer_cache[$cache_key] = $manufacturer_id;
|
||||||
|
return $manufacturer_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = $this->db->query("SELECT manufacturer_id FROM `" . DB_PREFIX . "manufacturer` WHERE LCASE(name) = '" . $this->db->escape(mb_strtolower($name, 'UTF-8')) . "' LIMIT 1");
|
||||||
|
if ($query->num_rows) {
|
||||||
|
$manufacturer_id = (int)$query->row['manufacturer_id'];
|
||||||
|
self::$manufacturer_cache[$cache_key] = $manufacturer_id;
|
||||||
|
return $manufacturer_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mode === 'mixed' || $mode === 'create') {
|
||||||
|
$this->db->query("INSERT INTO `" . DB_PREFIX . "manufacturer` SET name = '" . $this->db->escape($name) . "', sort_order = 0");
|
||||||
|
$manufacturer_id = (int)$this->db->getLastId();
|
||||||
|
$store_ids = $this->getAllStoreIds();
|
||||||
|
foreach ($store_ids as $sid) {
|
||||||
|
$this->db->query("INSERT IGNORE INTO `" . DB_PREFIX . "manufacturer_to_store` SET manufacturer_id = '" . $manufacturer_id . "', store_id = '" . (int)$sid . "'");
|
||||||
|
}
|
||||||
|
$man_slug = $this->translitSeoUrl($name);
|
||||||
|
if ($man_slug !== '') {
|
||||||
|
$languages = $this->db->query("SELECT language_id FROM `" . DB_PREFIX . "language` WHERE status = '1'")->rows;
|
||||||
|
foreach ($store_ids as $sid) {
|
||||||
|
foreach ($languages as $lang) {
|
||||||
|
$check = $this->db->query("SELECT seo_url_id FROM `" . DB_PREFIX . "seo_url` WHERE keyword = '" . $this->db->escape($man_slug) . "' AND store_id = '" . (int)$sid . "' AND language_id = '" . (int)$lang['language_id'] . "' AND query != 'manufacturer_id=" . (int)$manufacturer_id . "' LIMIT 1");
|
||||||
|
$final_man_slug = $check->num_rows ? ($man_slug . '-m' . (int)$manufacturer_id) : $man_slug;
|
||||||
|
$this->db->query("INSERT IGNORE INTO `" . DB_PREFIX . "seo_url` SET store_id = '" . (int)$sid . "', language_id = '" . (int)$lang['language_id'] . "', query = 'manufacturer_id=" . (int)$manufacturer_id . "', keyword = '" . $this->db->escape($final_man_slug) . "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self::$manufacturer_cache[$cache_key] = $manufacturer_id;
|
||||||
|
return $manufacturer_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateProductManufacturer($product_id, $manufacturer_id) {
|
||||||
|
$this->db->query("UPDATE `" . DB_PREFIX . "product` SET manufacturer_id = '" . (int)$manufacturer_id . "' WHERE product_id = '" . (int)$product_id . "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function recalculateProductOptionStock($product_id) {
|
||||||
|
$query = $this->db->query("SELECT SUM(quantity) as total FROM `" . DB_PREFIX . "product_option_value` WHERE product_id = '" . (int)$product_id . "' AND subtract = '1'");
|
||||||
|
if ($query->num_rows && $query->row['total'] !== null) {
|
||||||
|
$total = (int)$query->row['total'];
|
||||||
|
$stock_sql = "";
|
||||||
|
if ($total <= 0) {
|
||||||
|
$stock_status_out = (int)$this->config->get('config_stock_status_id') ?: 5;
|
||||||
|
$stock_sql = ", stock_status_id = '" . (int)$stock_status_out . "'";
|
||||||
|
}
|
||||||
|
$this->db->query("UPDATE `" . DB_PREFIX . "product` SET quantity = '" . (int)$total . "'" . $stock_sql . ", date_modified = NOW() WHERE product_id = '" . (int)$product_id . "'");
|
||||||
|
return $total;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getProfilesByType($type) {
|
||||||
|
$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "easy_import_nat_cron` WHERE type = '" . $this->db->escape($type) . "' ORDER BY profile_id DESC");
|
||||||
|
return $query->rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateProductImage($product_id, $image) {
|
||||||
|
$this->db->query("UPDATE `" . DB_PREFIX . "product` SET image = '" . $this->db->escape($image) . "' WHERE product_id = '" . (int)$product_id . "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function clearProductAdditionalImages($product_id) {
|
||||||
|
$this->db->query("DELETE FROM `" . DB_PREFIX . "product_image` WHERE product_id = '" . (int)$product_id . "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addProductAdditionalImage($product_id, $image, $sort_order = 0) {
|
||||||
|
$check = $this->db->query("SELECT product_image_id FROM `" . DB_PREFIX . "product_image` WHERE product_id = '" . (int)$product_id . "' AND image = '" . $this->db->escape($image) . "' LIMIT 1");
|
||||||
|
if (!$check->num_rows) {
|
||||||
|
$this->db->query("INSERT INTO `" . DB_PREFIX . "product_image` SET product_id = '" . (int)$product_id . "', image = '" . $this->db->escape($image) . "', sort_order = '" . (int)$sort_order . "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMaxProductImageSortOrder($product_id) {
|
||||||
|
$query = $this->db->query("SELECT MAX(sort_order) as max_sort FROM `" . DB_PREFIX . "product_image` WHERE product_id = '" . (int)$product_id . "'");
|
||||||
|
if ($query->num_rows && $query->row['max_sort'] !== null) {
|
||||||
|
return (int)$query->row['max_sort'];
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getOrCreateCategory($category_str, $mode = 'mixed') {
|
||||||
|
$category_str = html_entity_decode(trim((string)$category_str), ENT_QUOTES, 'UTF-8');
|
||||||
|
if ($category_str === '') {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$cache_key = md5($category_str . '_' . $mode);
|
||||||
|
if (isset(self::$category_cache[$cache_key])) {
|
||||||
|
return self::$category_cache[$cache_key];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_numeric($category_str)) {
|
||||||
|
$category_id = (int)$category_str;
|
||||||
|
$query = $this->db->query("SELECT category_id FROM `" . DB_PREFIX . "category` WHERE category_id = '" . $category_id . "'");
|
||||||
|
if ($query->num_rows) {
|
||||||
|
self::$category_cache[$cache_key] = $category_id;
|
||||||
|
return $category_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$category_str = str_replace(array('///', '->', ' / '), ' > ', $category_str);
|
||||||
|
$parts = explode('>', $category_str);
|
||||||
|
$parent_id = 0;
|
||||||
|
|
||||||
|
foreach ($parts as $part) {
|
||||||
|
$name = trim($part);
|
||||||
|
if ($name === '') continue;
|
||||||
|
|
||||||
|
$query = $this->db->query("SELECT c.category_id FROM `" . DB_PREFIX . "category` c LEFT JOIN `" . DB_PREFIX . "category_description` cd ON (c.category_id = cd.category_id) WHERE LCASE(cd.name) = '" . $this->db->escape(mb_strtolower($name, 'UTF-8')) . "' AND c.parent_id = '" . (int)$parent_id . "' LIMIT 1");
|
||||||
|
|
||||||
|
if ($query->num_rows) {
|
||||||
|
$parent_id = (int)$query->row['category_id'];
|
||||||
|
} else {
|
||||||
|
if ($mode === 'mixed') {
|
||||||
|
$this->db->query("INSERT INTO `" . DB_PREFIX . "category` SET parent_id = '" . (int)$parent_id . "', `top` = '" . ($parent_id == 0 ? 1 : 0) . "', `column` = 1, sort_order = 0, status = 1, date_added = NOW(), date_modified = NOW()");
|
||||||
|
$category_id = $this->db->getLastId();
|
||||||
|
|
||||||
|
$languages = $this->db->query("SELECT language_id FROM `" . DB_PREFIX . "language` WHERE status = '1'")->rows;
|
||||||
|
foreach ($languages as $lang) {
|
||||||
|
$this->db->query("INSERT INTO `" . DB_PREFIX . "category_description` SET category_id = '" . (int)$category_id . "', language_id = '" . (int)$lang['language_id'] . "', name = '" . $this->db->escape($name) . "', meta_title = '" . $this->db->escape($name) . "', meta_description = '', meta_keyword = '', description = ''");
|
||||||
|
}
|
||||||
|
|
||||||
|
$store_ids = $this->getAllStoreIds();
|
||||||
|
foreach ($store_ids as $sid) {
|
||||||
|
$this->db->query("INSERT IGNORE INTO `" . DB_PREFIX . "category_to_store` SET category_id = '" . (int)$category_id . "', store_id = '" . (int)$sid . "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
$level = 0;
|
||||||
|
$paths = $this->db->query("SELECT * FROM `" . DB_PREFIX . "category_path` WHERE category_id = '" . (int)$parent_id . "' ORDER BY level ASC")->rows;
|
||||||
|
foreach ($paths as $path) {
|
||||||
|
$this->db->query("INSERT INTO `" . DB_PREFIX . "category_path` SET category_id = '" . (int)$category_id . "', path_id = '" . (int)$path['path_id'] . "', level = '" . (int)$level . "'");
|
||||||
|
$level++;
|
||||||
|
}
|
||||||
|
$this->db->query("INSERT INTO `" . DB_PREFIX . "category_path` SET category_id = '" . (int)$category_id . "', path_id = '" . (int)$category_id . "', level = '" . (int)$level . "'");
|
||||||
|
|
||||||
|
foreach ($store_ids as $sid) {
|
||||||
|
$this->db->query("INSERT IGNORE INTO `" . DB_PREFIX . "category_to_layout` SET category_id = '" . (int)$category_id . "', store_id = '" . (int)$sid . "', layout_id = 0");
|
||||||
|
}
|
||||||
|
|
||||||
|
$cat_slug = $this->translitSeoUrl($name);
|
||||||
|
if ($cat_slug !== '') {
|
||||||
|
foreach ($store_ids as $sid) {
|
||||||
|
foreach ($languages as $lang) {
|
||||||
|
$check = $this->db->query("SELECT seo_url_id FROM `" . DB_PREFIX . "seo_url` WHERE keyword = '" . $this->db->escape($cat_slug) . "' AND store_id = '" . (int)$sid . "' AND language_id = '" . (int)$lang['language_id'] . "' AND query != 'category_id=" . (int)$category_id . "' LIMIT 1");
|
||||||
|
$final_cat_slug = $check->num_rows ? ($cat_slug . '-' . (int)$category_id) : $cat_slug;
|
||||||
|
$this->db->query("INSERT IGNORE INTO `" . DB_PREFIX . "seo_url` SET store_id = '" . (int)$sid . "', language_id = '" . (int)$lang['language_id'] . "', query = 'category_id=" . (int)$category_id . "', keyword = '" . $this->db->escape($final_cat_slug) . "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$parent_id = $category_id;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self::$category_cache[$cache_key] = $parent_id;
|
||||||
|
return $parent_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function translitSeoUrl($string) {
|
||||||
|
$cyr = array(
|
||||||
|
'а','б','в','г','д','е','ё','ж','з','и','й','к','л','м','н','о','п',
|
||||||
|
'р','с','т','у','ф','х','ц','ч','ш','щ','ъ','ы','ь','э','ю','я',
|
||||||
|
'А','Б','В','Г','Д','Е','Ё','Ж','З','И','Й','К','Л','М','Н','О','П',
|
||||||
|
'Р','С','Т','У','Ф','Х','Ц','Ч','Ш','Щ','Ъ','Ы','Ь','Э','Ю','Я',
|
||||||
|
'і','ї','є','ґ','І','Ї','Є','Ґ',' '
|
||||||
|
);
|
||||||
|
$lat = array(
|
||||||
|
'a','b','v','g','d','e','yo','zh','z','i','y','k','l','m','n','o','p',
|
||||||
|
'r','s','t','u','f','kh','ts','ch','sh','shch','','y','','e','yu','ya',
|
||||||
|
'a','b','v','g','d','e','yo','zh','z','i','y','k','l','m','n','o','p',
|
||||||
|
'r','s','t','u','f','kh','ts','ch','sh','shch','','y','','e','yu','ya',
|
||||||
|
'i','yi','ye','g','i','yi','ye','g','-'
|
||||||
|
);
|
||||||
|
$string = str_replace($cyr, $lat, (string)$string);
|
||||||
|
$string = preg_replace('/[^a-zA-Z0-9_-]/', '', $string);
|
||||||
|
$string = preg_replace('/-+/', '-', $string);
|
||||||
|
return strtolower(trim($string, '-'));
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,31 @@
|
||||||
|
import zipfile, os, shutil
|
||||||
|
|
||||||
|
src_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
pkg_name = "easy_import_nat.ocmod.zip"
|
||||||
|
zip_path = os.path.join(src_dir, pkg_name)
|
||||||
|
|
||||||
|
if os.path.exists(zip_path):
|
||||||
|
os.remove(zip_path)
|
||||||
|
print("Deleted old zip")
|
||||||
|
|
||||||
|
with zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED) as zipf:
|
||||||
|
# OC 4: root must have install.json, admin, catalog, system directly
|
||||||
|
for fname in ['install.json', 'readme.txt', 'Instruction ru-uk-en.txt']:
|
||||||
|
fpath = os.path.join(src_dir, fname)
|
||||||
|
if os.path.exists(fpath):
|
||||||
|
zipf.write(fpath, fname)
|
||||||
|
print(f"Added {fname}")
|
||||||
|
|
||||||
|
for fldr in ['admin', 'catalog', 'system']:
|
||||||
|
dir_path = os.path.join(src_dir, fldr)
|
||||||
|
if os.path.exists(dir_path):
|
||||||
|
for root, dirs, files in os.walk(dir_path):
|
||||||
|
for file in files:
|
||||||
|
file_path = os.path.join(root, file)
|
||||||
|
arc_name = os.path.relpath(file_path, src_dir).replace('\\', '/')
|
||||||
|
zipf.write(file_path, arc_name)
|
||||||
|
|
||||||
|
# Also create formatted distribution name
|
||||||
|
dist_name = "easy_import_export_nat_OC_40_1_0.ocmod.zip"
|
||||||
|
shutil.copy2(zip_path, os.path.join(src_dir, dist_name))
|
||||||
|
print(f"Created packages: {pkg_name} and {dist_name}")
|
||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"name": "Easy Import/Export [NAT] (OpenCart 4.0.x)",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"author": "NAT",
|
||||||
|
"link": "https://nat.od.ua",
|
||||||
|
"extension": "easy_import_nat"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
=============================================================================
|
||||||
|
Easy Import/Export [NAT]
|
||||||
|
Version: 1.0.0
|
||||||
|
Compatibility: OpenCart 3.0.x / ocStore 3.0.x
|
||||||
|
Author: NAT
|
||||||
|
Support: info@nat.od.ua
|
||||||
|
=============================================================================
|
||||||
|
|
||||||
|
DESCRIPTION:
|
||||||
|
Easy Import/Export [NAT] is a powerful, lightning-fast and flexible module designed to easily import and export product catalog data (prices, stock, statuses, and key attributes) in CSV, XML, JSON, and Excel formats. Supporting background automation (CRON), instant visual verification, and smart field mapping, this tool is essential for maintaining sync with supplier price lists and managing large store databases.
|
||||||
|
|
||||||
|
---------------------------------------------------------
|
||||||
|
KEY FEATURES:
|
||||||
|
---------------------------------------------------------
|
||||||
|
* Smart Auto-mapping: Real-time automatic mapping of CSV/Excel headers to OpenCart fields (Model, SKU, Price, Quantity, Status) using a smart priority system and synonym dictionaries.
|
||||||
|
* File Upload Preview: Instant 5-row interactive preview table upon uploading a file or fetching a URL, allowing you to verify mappings and data structure before importing.
|
||||||
|
* Live Dashboard Metrics: Real-time tracking of import progress with stats on Total Rows, Updated, Not Found, and Skipped products.
|
||||||
|
* Conditional Modifiers: Advanced target condition logic (e.g., "If Price is less than 100, then multiply Qty by 2") using WAF-safe comparison codes (eq, ne, gt, lt) to bypass server security firewalls.
|
||||||
|
* Google Sheets Link Converter: Automatically parses and converts shared Google Sheets links into direct WAF-safe CSV exports for instant sync.
|
||||||
|
* Supplier REST API Client [BETA]: Advanced integrated client supporting GET/POST methods, Basic/Bearer/Custom POST Token authentication, offset/page-based paginations, and memory-safe chunked XML/JSON disk streaming.
|
||||||
|
|
||||||
|
---------------------------------------------------------
|
||||||
|
INSTALLATION:
|
||||||
|
---------------------------------------------------------
|
||||||
|
1. Go to your OpenCart admin panel: "Extensions" -> "Installer".
|
||||||
|
2. Upload the `easy_import_export_nat_OC_30_1_0.ocmod.zip` archive.
|
||||||
|
3. Go to "Extensions" -> "Modifications" and click the blue "Refresh" button.
|
||||||
|
4. Go to "System" -> "Users" -> "User Groups", edit your Top Administrator group, click "Select All" for Access and Modify permissions, then Save.
|
||||||
|
5. Go to "Extensions" -> "Extensions" -> choose "Modules", find "Easy Import/Export [NAT]", click "Install" and then "Edit".
|
||||||
|
|
||||||
|
---------------------------------------------------------
|
||||||
|
UPDATE:
|
||||||
|
---------------------------------------------------------
|
||||||
|
1. Upload the new zip file via Extension Installer over the old one.
|
||||||
|
2. Refresh the modifications cache.
|
||||||
|
3. Hard refresh your browser cache (Ctrl+F5 or Cmd+Shift+R) on the module settings page.
|
||||||
|
|
||||||
|
---------------------------------------------------------
|
||||||
|
UNINSTALLATION:
|
||||||
|
---------------------------------------------------------
|
||||||
|
1. Go to "Extensions" -> "Extensions" -> "Modules", click the red "Uninstall" button next to the module.
|
||||||
|
2. Go to the Extension Installer history and delete the module files.
|
||||||
|
3. Refresh the modifications cache.
|
||||||
|
|
||||||
|
---------------------------------------------------------
|
||||||
|
INSTRUCTIONS & WORKFLOW:
|
||||||
|
---------------------------------------------------------
|
||||||
|
The module is divided into 4 main tabs:
|
||||||
|
|
||||||
|
* Settings Tab: Manage global settings, register your license key, configure fast access buttons display, and set default paths.
|
||||||
|
* Export Tab: Configure identifiers, choose export format (CSV, XML, JSON, Excel), apply price modes, set up filters (categories, manufacturers) and custom modifiers, then export data manually or get the static download URL.
|
||||||
|
* Import Tab: Upload files or paste URLs (including Google Sheets), preview the first 5 rows, map headers to database fields, configure conflict resolution options, and run live import with real-time stats.
|
||||||
|
* Auto Import (CRON) Tab: Set up scheduled automated catalog updates. Create multiple cron tasks with individual source links, settings, mapping presets, and conditional modifiers.
|
||||||
|
|
||||||
|
---------------------------------------------------------
|
||||||
|
TERMS & CONDITIONS (License & Support Policy):
|
||||||
|
---------------------------------------------------------
|
||||||
|
By purchasing and downloading this extension, you strictly agree to the following terms:
|
||||||
|
|
||||||
|
* Single Domain License: One purchase allows you to install and use the extension on exactly one (1) live domain and one (1) local/test environment. You need a separate License Key for each additional live project.
|
||||||
|
* License Activation: The module requires a License Key to function. Please email info@nat.od.ua with your Order ID and Domain Name after purchase to receive your key.
|
||||||
|
* Support: We provide free technical support for bugs and standard installation issues. Support is available via email (info@nat.od.ua). Please allow up to 24-48 hours for a response.
|
||||||
|
* Compatibility: The module is guaranteed to work on standard OpenCart / ocStore installations. We cannot guarantee out-of-the-box compatibility with heavily customized core files or third-party modules, though we will do our best to assist you.
|
||||||
|
* Refund Policy: We offer a 100% refund if the extension is completely non-functional on a standard OpenCart setup and our support team is unable to fix it. We do not issue refunds for "change of mind" or if you have already requested and received a domain license key.
|
||||||
|
* Distribution: The code is open-source (no IonCube), meaning you can modify it for your own needs. However, you may not resell, redistribute, share, or publish this extension in any form.
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload.php @generated by Composer
|
||||||
|
|
||||||
|
if (PHP_VERSION_ID < 50600) {
|
||||||
|
if (!headers_sent()) {
|
||||||
|
header('HTTP/1.1 500 Internal Server Error');
|
||||||
|
}
|
||||||
|
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
|
||||||
|
if (!ini_get('display_errors')) {
|
||||||
|
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
||||||
|
fwrite(STDERR, $err);
|
||||||
|
} elseif (!headers_sent()) {
|
||||||
|
echo $err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
trigger_error(
|
||||||
|
$err,
|
||||||
|
E_USER_ERROR
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once __DIR__ . '/composer/autoload_real.php';
|
||||||
|
|
||||||
|
return ComposerAutoloaderInit5377330e42d2722bfd3ef897e8be6389::getLoader();
|
||||||
|
|
@ -0,0 +1,572 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Composer.
|
||||||
|
*
|
||||||
|
* (c) Nils Adermann <naderman@naderman.de>
|
||||||
|
* Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Composer\Autoload;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
||||||
|
*
|
||||||
|
* $loader = new \Composer\Autoload\ClassLoader();
|
||||||
|
*
|
||||||
|
* // register classes with namespaces
|
||||||
|
* $loader->add('Symfony\Component', __DIR__.'/component');
|
||||||
|
* $loader->add('Symfony', __DIR__.'/framework');
|
||||||
|
*
|
||||||
|
* // activate the autoloader
|
||||||
|
* $loader->register();
|
||||||
|
*
|
||||||
|
* // to enable searching the include path (eg. for PEAR packages)
|
||||||
|
* $loader->setUseIncludePath(true);
|
||||||
|
*
|
||||||
|
* In this example, if you try to use a class in the Symfony\Component
|
||||||
|
* namespace or one of its children (Symfony\Component\Console for instance),
|
||||||
|
* the autoloader will first look for the class under the component/
|
||||||
|
* directory, and it will then fallback to the framework/ directory if not
|
||||||
|
* found before giving up.
|
||||||
|
*
|
||||||
|
* This class is loosely based on the Symfony UniversalClassLoader.
|
||||||
|
*
|
||||||
|
* @author Fabien Potencier <fabien@symfony.com>
|
||||||
|
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
* @see https://www.php-fig.org/psr/psr-0/
|
||||||
|
* @see https://www.php-fig.org/psr/psr-4/
|
||||||
|
*/
|
||||||
|
class ClassLoader
|
||||||
|
{
|
||||||
|
/** @var ?string */
|
||||||
|
private $vendorDir;
|
||||||
|
|
||||||
|
// PSR-4
|
||||||
|
/**
|
||||||
|
* @var array[]
|
||||||
|
* @psalm-var array<string, array<string, int>>
|
||||||
|
*/
|
||||||
|
private $prefixLengthsPsr4 = array();
|
||||||
|
/**
|
||||||
|
* @var array[]
|
||||||
|
* @psalm-var array<string, array<int, string>>
|
||||||
|
*/
|
||||||
|
private $prefixDirsPsr4 = array();
|
||||||
|
/**
|
||||||
|
* @var array[]
|
||||||
|
* @psalm-var array<string, string>
|
||||||
|
*/
|
||||||
|
private $fallbackDirsPsr4 = array();
|
||||||
|
|
||||||
|
// PSR-0
|
||||||
|
/**
|
||||||
|
* @var array[]
|
||||||
|
* @psalm-var array<string, array<string, string[]>>
|
||||||
|
*/
|
||||||
|
private $prefixesPsr0 = array();
|
||||||
|
/**
|
||||||
|
* @var array[]
|
||||||
|
* @psalm-var array<string, string>
|
||||||
|
*/
|
||||||
|
private $fallbackDirsPsr0 = array();
|
||||||
|
|
||||||
|
/** @var bool */
|
||||||
|
private $useIncludePath = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string[]
|
||||||
|
* @psalm-var array<string, string>
|
||||||
|
*/
|
||||||
|
private $classMap = array();
|
||||||
|
|
||||||
|
/** @var bool */
|
||||||
|
private $classMapAuthoritative = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool[]
|
||||||
|
* @psalm-var array<string, bool>
|
||||||
|
*/
|
||||||
|
private $missingClasses = array();
|
||||||
|
|
||||||
|
/** @var ?string */
|
||||||
|
private $apcuPrefix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var self[]
|
||||||
|
*/
|
||||||
|
private static $registeredLoaders = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ?string $vendorDir
|
||||||
|
*/
|
||||||
|
public function __construct($vendorDir = null)
|
||||||
|
{
|
||||||
|
$this->vendorDir = $vendorDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function getPrefixes()
|
||||||
|
{
|
||||||
|
if (!empty($this->prefixesPsr0)) {
|
||||||
|
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
|
||||||
|
}
|
||||||
|
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array[]
|
||||||
|
* @psalm-return array<string, array<int, string>>
|
||||||
|
*/
|
||||||
|
public function getPrefixesPsr4()
|
||||||
|
{
|
||||||
|
return $this->prefixDirsPsr4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array[]
|
||||||
|
* @psalm-return array<string, string>
|
||||||
|
*/
|
||||||
|
public function getFallbackDirs()
|
||||||
|
{
|
||||||
|
return $this->fallbackDirsPsr0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array[]
|
||||||
|
* @psalm-return array<string, string>
|
||||||
|
*/
|
||||||
|
public function getFallbackDirsPsr4()
|
||||||
|
{
|
||||||
|
return $this->fallbackDirsPsr4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string[] Array of classname => path
|
||||||
|
* @psalm-return array<string, string>
|
||||||
|
*/
|
||||||
|
public function getClassMap()
|
||||||
|
{
|
||||||
|
return $this->classMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string[] $classMap Class to filename map
|
||||||
|
* @psalm-param array<string, string> $classMap
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function addClassMap(array $classMap)
|
||||||
|
{
|
||||||
|
if ($this->classMap) {
|
||||||
|
$this->classMap = array_merge($this->classMap, $classMap);
|
||||||
|
} else {
|
||||||
|
$this->classMap = $classMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a set of PSR-0 directories for a given prefix, either
|
||||||
|
* appending or prepending to the ones previously set for this prefix.
|
||||||
|
*
|
||||||
|
* @param string $prefix The prefix
|
||||||
|
* @param string[]|string $paths The PSR-0 root directories
|
||||||
|
* @param bool $prepend Whether to prepend the directories
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function add($prefix, $paths, $prepend = false)
|
||||||
|
{
|
||||||
|
if (!$prefix) {
|
||||||
|
if ($prepend) {
|
||||||
|
$this->fallbackDirsPsr0 = array_merge(
|
||||||
|
(array) $paths,
|
||||||
|
$this->fallbackDirsPsr0
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->fallbackDirsPsr0 = array_merge(
|
||||||
|
$this->fallbackDirsPsr0,
|
||||||
|
(array) $paths
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$first = $prefix[0];
|
||||||
|
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
||||||
|
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($prepend) {
|
||||||
|
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||||
|
(array) $paths,
|
||||||
|
$this->prefixesPsr0[$first][$prefix]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||||
|
$this->prefixesPsr0[$first][$prefix],
|
||||||
|
(array) $paths
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a set of PSR-4 directories for a given namespace, either
|
||||||
|
* appending or prepending to the ones previously set for this namespace.
|
||||||
|
*
|
||||||
|
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||||
|
* @param string[]|string $paths The PSR-4 base directories
|
||||||
|
* @param bool $prepend Whether to prepend the directories
|
||||||
|
*
|
||||||
|
* @throws \InvalidArgumentException
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function addPsr4($prefix, $paths, $prepend = false)
|
||||||
|
{
|
||||||
|
if (!$prefix) {
|
||||||
|
// Register directories for the root namespace.
|
||||||
|
if ($prepend) {
|
||||||
|
$this->fallbackDirsPsr4 = array_merge(
|
||||||
|
(array) $paths,
|
||||||
|
$this->fallbackDirsPsr4
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$this->fallbackDirsPsr4 = array_merge(
|
||||||
|
$this->fallbackDirsPsr4,
|
||||||
|
(array) $paths
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
||||||
|
// Register directories for a new namespace.
|
||||||
|
$length = strlen($prefix);
|
||||||
|
if ('\\' !== $prefix[$length - 1]) {
|
||||||
|
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||||
|
}
|
||||||
|
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||||
|
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||||
|
} elseif ($prepend) {
|
||||||
|
// Prepend directories for an already registered namespace.
|
||||||
|
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||||
|
(array) $paths,
|
||||||
|
$this->prefixDirsPsr4[$prefix]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Append directories for an already registered namespace.
|
||||||
|
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||||
|
$this->prefixDirsPsr4[$prefix],
|
||||||
|
(array) $paths
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a set of PSR-0 directories for a given prefix,
|
||||||
|
* replacing any others previously set for this prefix.
|
||||||
|
*
|
||||||
|
* @param string $prefix The prefix
|
||||||
|
* @param string[]|string $paths The PSR-0 base directories
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function set($prefix, $paths)
|
||||||
|
{
|
||||||
|
if (!$prefix) {
|
||||||
|
$this->fallbackDirsPsr0 = (array) $paths;
|
||||||
|
} else {
|
||||||
|
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a set of PSR-4 directories for a given namespace,
|
||||||
|
* replacing any others previously set for this namespace.
|
||||||
|
*
|
||||||
|
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||||
|
* @param string[]|string $paths The PSR-4 base directories
|
||||||
|
*
|
||||||
|
* @throws \InvalidArgumentException
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setPsr4($prefix, $paths)
|
||||||
|
{
|
||||||
|
if (!$prefix) {
|
||||||
|
$this->fallbackDirsPsr4 = (array) $paths;
|
||||||
|
} else {
|
||||||
|
$length = strlen($prefix);
|
||||||
|
if ('\\' !== $prefix[$length - 1]) {
|
||||||
|
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||||
|
}
|
||||||
|
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||||
|
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turns on searching the include path for class files.
|
||||||
|
*
|
||||||
|
* @param bool $useIncludePath
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setUseIncludePath($useIncludePath)
|
||||||
|
{
|
||||||
|
$this->useIncludePath = $useIncludePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can be used to check if the autoloader uses the include path to check
|
||||||
|
* for classes.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getUseIncludePath()
|
||||||
|
{
|
||||||
|
return $this->useIncludePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turns off searching the prefix and fallback directories for classes
|
||||||
|
* that have not been registered with the class map.
|
||||||
|
*
|
||||||
|
* @param bool $classMapAuthoritative
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setClassMapAuthoritative($classMapAuthoritative)
|
||||||
|
{
|
||||||
|
$this->classMapAuthoritative = $classMapAuthoritative;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should class lookup fail if not found in the current class map?
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isClassMapAuthoritative()
|
||||||
|
{
|
||||||
|
return $this->classMapAuthoritative;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
||||||
|
*
|
||||||
|
* @param string|null $apcuPrefix
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setApcuPrefix($apcuPrefix)
|
||||||
|
{
|
||||||
|
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The APCu prefix in use, or null if APCu caching is not enabled.
|
||||||
|
*
|
||||||
|
* @return string|null
|
||||||
|
*/
|
||||||
|
public function getApcuPrefix()
|
||||||
|
{
|
||||||
|
return $this->apcuPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers this instance as an autoloader.
|
||||||
|
*
|
||||||
|
* @param bool $prepend Whether to prepend the autoloader or not
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register($prepend = false)
|
||||||
|
{
|
||||||
|
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||||
|
|
||||||
|
if (null === $this->vendorDir) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($prepend) {
|
||||||
|
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
|
||||||
|
} else {
|
||||||
|
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||||
|
self::$registeredLoaders[$this->vendorDir] = $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregisters this instance as an autoloader.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function unregister()
|
||||||
|
{
|
||||||
|
spl_autoload_unregister(array($this, 'loadClass'));
|
||||||
|
|
||||||
|
if (null !== $this->vendorDir) {
|
||||||
|
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the given class or interface.
|
||||||
|
*
|
||||||
|
* @param string $class The name of the class
|
||||||
|
* @return true|null True if loaded, null otherwise
|
||||||
|
*/
|
||||||
|
public function loadClass($class)
|
||||||
|
{
|
||||||
|
if ($file = $this->findFile($class)) {
|
||||||
|
includeFile($file);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the path to the file where the class is defined.
|
||||||
|
*
|
||||||
|
* @param string $class The name of the class
|
||||||
|
*
|
||||||
|
* @return string|false The path if found, false otherwise
|
||||||
|
*/
|
||||||
|
public function findFile($class)
|
||||||
|
{
|
||||||
|
// class map lookup
|
||||||
|
if (isset($this->classMap[$class])) {
|
||||||
|
return $this->classMap[$class];
|
||||||
|
}
|
||||||
|
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (null !== $this->apcuPrefix) {
|
||||||
|
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
||||||
|
if ($hit) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$file = $this->findFileWithExtension($class, '.php');
|
||||||
|
|
||||||
|
// Search for Hack files if we are running on HHVM
|
||||||
|
if (false === $file && defined('HHVM_VERSION')) {
|
||||||
|
$file = $this->findFileWithExtension($class, '.hh');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null !== $this->apcuPrefix) {
|
||||||
|
apcu_add($this->apcuPrefix.$class, $file);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (false === $file) {
|
||||||
|
// Remember that this class does not exist.
|
||||||
|
$this->missingClasses[$class] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the currently registered loaders indexed by their corresponding vendor directories.
|
||||||
|
*
|
||||||
|
* @return self[]
|
||||||
|
*/
|
||||||
|
public static function getRegisteredLoaders()
|
||||||
|
{
|
||||||
|
return self::$registeredLoaders;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $class
|
||||||
|
* @param string $ext
|
||||||
|
* @return string|false
|
||||||
|
*/
|
||||||
|
private function findFileWithExtension($class, $ext)
|
||||||
|
{
|
||||||
|
// PSR-4 lookup
|
||||||
|
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
||||||
|
|
||||||
|
$first = $class[0];
|
||||||
|
if (isset($this->prefixLengthsPsr4[$first])) {
|
||||||
|
$subPath = $class;
|
||||||
|
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
||||||
|
$subPath = substr($subPath, 0, $lastPos);
|
||||||
|
$search = $subPath . '\\';
|
||||||
|
if (isset($this->prefixDirsPsr4[$search])) {
|
||||||
|
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
||||||
|
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
||||||
|
if (file_exists($file = $dir . $pathEnd)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PSR-4 fallback dirs
|
||||||
|
foreach ($this->fallbackDirsPsr4 as $dir) {
|
||||||
|
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PSR-0 lookup
|
||||||
|
if (false !== $pos = strrpos($class, '\\')) {
|
||||||
|
// namespaced class name
|
||||||
|
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
||||||
|
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
||||||
|
} else {
|
||||||
|
// PEAR-like class name
|
||||||
|
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->prefixesPsr0[$first])) {
|
||||||
|
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
||||||
|
if (0 === strpos($class, $prefix)) {
|
||||||
|
foreach ($dirs as $dir) {
|
||||||
|
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PSR-0 fallback dirs
|
||||||
|
foreach ($this->fallbackDirsPsr0 as $dir) {
|
||||||
|
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PSR-0 include paths.
|
||||||
|
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scope isolated include.
|
||||||
|
*
|
||||||
|
* Prevents access to $this/self from included files.
|
||||||
|
*
|
||||||
|
* @param string $file
|
||||||
|
* @return void
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
function includeFile($file)
|
||||||
|
{
|
||||||
|
include $file;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,352 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Composer.
|
||||||
|
*
|
||||||
|
* (c) Nils Adermann <naderman@naderman.de>
|
||||||
|
* Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Composer;
|
||||||
|
|
||||||
|
use Composer\Autoload\ClassLoader;
|
||||||
|
use Composer\Semver\VersionParser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class is copied in every Composer installed project and available to all
|
||||||
|
*
|
||||||
|
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
|
||||||
|
*
|
||||||
|
* To require its presence, you can require `composer-runtime-api ^2.0`
|
||||||
|
*
|
||||||
|
* @final
|
||||||
|
*/
|
||||||
|
class InstalledVersions
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var mixed[]|null
|
||||||
|
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
|
||||||
|
*/
|
||||||
|
private static $installed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool|null
|
||||||
|
*/
|
||||||
|
private static $canGetVendors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array[]
|
||||||
|
* @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||||
|
*/
|
||||||
|
private static $installedByVendor = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of all package names which are present, either by being installed, replaced or provided
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
* @psalm-return list<string>
|
||||||
|
*/
|
||||||
|
public static function getInstalledPackages()
|
||||||
|
{
|
||||||
|
$packages = array();
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
$packages[] = array_keys($installed['versions']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (1 === \count($packages)) {
|
||||||
|
return $packages[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of all package names with a specific type e.g. 'library'
|
||||||
|
*
|
||||||
|
* @param string $type
|
||||||
|
* @return string[]
|
||||||
|
* @psalm-return list<string>
|
||||||
|
*/
|
||||||
|
public static function getInstalledPackagesByType($type)
|
||||||
|
{
|
||||||
|
$packagesByType = array();
|
||||||
|
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
foreach ($installed['versions'] as $name => $package) {
|
||||||
|
if (isset($package['type']) && $package['type'] === $type) {
|
||||||
|
$packagesByType[] = $name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $packagesByType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the given package is installed
|
||||||
|
*
|
||||||
|
* This also returns true if the package name is provided or replaced by another package
|
||||||
|
*
|
||||||
|
* @param string $packageName
|
||||||
|
* @param bool $includeDevRequirements
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function isInstalled($packageName, $includeDevRequirements = true)
|
||||||
|
{
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (isset($installed['versions'][$packageName])) {
|
||||||
|
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the given package satisfies a version constraint
|
||||||
|
*
|
||||||
|
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
|
||||||
|
*
|
||||||
|
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
|
||||||
|
*
|
||||||
|
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
|
||||||
|
* @param string $packageName
|
||||||
|
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function satisfies(VersionParser $parser, $packageName, $constraint)
|
||||||
|
{
|
||||||
|
$constraint = $parser->parseConstraints($constraint);
|
||||||
|
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
|
||||||
|
|
||||||
|
return $provided->matches($constraint);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a version constraint representing all the range(s) which are installed for a given package
|
||||||
|
*
|
||||||
|
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
|
||||||
|
* whether a given version of a package is installed, and not just whether it exists
|
||||||
|
*
|
||||||
|
* @param string $packageName
|
||||||
|
* @return string Version constraint usable with composer/semver
|
||||||
|
*/
|
||||||
|
public static function getVersionRanges($packageName)
|
||||||
|
{
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ranges = array();
|
||||||
|
if (isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||||
|
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
|
||||||
|
}
|
||||||
|
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
|
||||||
|
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
|
||||||
|
}
|
||||||
|
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
|
||||||
|
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
|
||||||
|
}
|
||||||
|
if (array_key_exists('provided', $installed['versions'][$packageName])) {
|
||||||
|
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode(' || ', $ranges);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $packageName
|
||||||
|
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
||||||
|
*/
|
||||||
|
public static function getVersion($packageName)
|
||||||
|
{
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($installed['versions'][$packageName]['version'])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $installed['versions'][$packageName]['version'];
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $packageName
|
||||||
|
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
||||||
|
*/
|
||||||
|
public static function getPrettyVersion($packageName)
|
||||||
|
{
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $installed['versions'][$packageName]['pretty_version'];
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $packageName
|
||||||
|
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
|
||||||
|
*/
|
||||||
|
public static function getReference($packageName)
|
||||||
|
{
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($installed['versions'][$packageName]['reference'])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $installed['versions'][$packageName]['reference'];
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $packageName
|
||||||
|
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
|
||||||
|
*/
|
||||||
|
public static function getInstallPath($packageName)
|
||||||
|
{
|
||||||
|
foreach (self::getInstalled() as $installed) {
|
||||||
|
if (!isset($installed['versions'][$packageName])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
* @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
|
||||||
|
*/
|
||||||
|
public static function getRootPackage()
|
||||||
|
{
|
||||||
|
$installed = self::getInstalled();
|
||||||
|
|
||||||
|
return $installed[0]['root'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the raw installed.php data for custom implementations
|
||||||
|
*
|
||||||
|
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
|
||||||
|
* @return array[]
|
||||||
|
* @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
|
||||||
|
*/
|
||||||
|
public static function getRawData()
|
||||||
|
{
|
||||||
|
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
|
||||||
|
|
||||||
|
if (null === self::$installed) {
|
||||||
|
// only require the installed.php file if this file is loaded from its dumped location,
|
||||||
|
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
||||||
|
if (substr(__DIR__, -8, 1) !== 'C') {
|
||||||
|
self::$installed = include __DIR__ . '/installed.php';
|
||||||
|
} else {
|
||||||
|
self::$installed = array();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$installed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the raw data of all installed.php which are currently loaded for custom implementations
|
||||||
|
*
|
||||||
|
* @return array[]
|
||||||
|
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||||
|
*/
|
||||||
|
public static function getAllRawData()
|
||||||
|
{
|
||||||
|
return self::getInstalled();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lets you reload the static array from another file
|
||||||
|
*
|
||||||
|
* This is only useful for complex integrations in which a project needs to use
|
||||||
|
* this class but then also needs to execute another project's autoloader in process,
|
||||||
|
* and wants to ensure both projects have access to their version of installed.php.
|
||||||
|
*
|
||||||
|
* A typical case would be PHPUnit, where it would need to make sure it reads all
|
||||||
|
* the data it needs from this class, then call reload() with
|
||||||
|
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
|
||||||
|
* the project in which it runs can then also use this class safely, without
|
||||||
|
* interference between PHPUnit's dependencies and the project's dependencies.
|
||||||
|
*
|
||||||
|
* @param array[] $data A vendor/composer/installed.php data set
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
|
||||||
|
*/
|
||||||
|
public static function reload($data)
|
||||||
|
{
|
||||||
|
self::$installed = $data;
|
||||||
|
self::$installedByVendor = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array[]
|
||||||
|
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||||
|
*/
|
||||||
|
private static function getInstalled()
|
||||||
|
{
|
||||||
|
if (null === self::$canGetVendors) {
|
||||||
|
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
|
||||||
|
}
|
||||||
|
|
||||||
|
$installed = array();
|
||||||
|
|
||||||
|
if (self::$canGetVendors) {
|
||||||
|
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
|
||||||
|
if (isset(self::$installedByVendor[$vendorDir])) {
|
||||||
|
$installed[] = self::$installedByVendor[$vendorDir];
|
||||||
|
} elseif (is_file($vendorDir.'/composer/installed.php')) {
|
||||||
|
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
|
||||||
|
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
|
||||||
|
self::$installed = $installed[count($installed) - 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null === self::$installed) {
|
||||||
|
// only require the installed.php file if this file is loaded from its dumped location,
|
||||||
|
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
||||||
|
if (substr(__DIR__, -8, 1) !== 'C') {
|
||||||
|
self::$installed = require __DIR__ . '/installed.php';
|
||||||
|
} else {
|
||||||
|
self::$installed = array();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$installed[] = self::$installed;
|
||||||
|
|
||||||
|
return $installed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
Copyright (c) Nils Adermann, Jordi Boggiano
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_classmap.php @generated by Composer
|
||||||
|
|
||||||
|
$vendorDir = dirname(__DIR__);
|
||||||
|
$baseDir = dirname($vendorDir);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
||||||
|
'Stringable' => $vendorDir . '/myclabs/php-enum/stubs/Stringable.php',
|
||||||
|
);
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_files.php @generated by Composer
|
||||||
|
|
||||||
|
$vendorDir = dirname(__DIR__);
|
||||||
|
$baseDir = dirname($vendorDir);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||||
|
'2cffec82183ee1cea088009cef9a6fc3' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
|
||||||
|
);
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_namespaces.php @generated by Composer
|
||||||
|
|
||||||
|
$vendorDir = dirname(__DIR__);
|
||||||
|
$baseDir = dirname($vendorDir);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'HTMLPurifier' => array($vendorDir . '/ezyang/htmlpurifier/library'),
|
||||||
|
);
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_psr4.php @generated by Composer
|
||||||
|
|
||||||
|
$vendorDir = dirname(__DIR__);
|
||||||
|
$baseDir = dirname($vendorDir);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'ZipStream\\' => array($vendorDir . '/maennchen/zipstream-php/src'),
|
||||||
|
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
|
||||||
|
'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
|
||||||
|
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src', $vendorDir . '/psr/http-factory/src'),
|
||||||
|
'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
|
||||||
|
'PhpOffice\\PhpSpreadsheet\\' => array($vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet'),
|
||||||
|
'MyCLabs\\Enum\\' => array($vendorDir . '/myclabs/php-enum/src'),
|
||||||
|
'Matrix\\' => array($vendorDir . '/markbaker/matrix/classes/src'),
|
||||||
|
'Complex\\' => array($vendorDir . '/markbaker/complex/classes/src'),
|
||||||
|
);
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_real.php @generated by Composer
|
||||||
|
|
||||||
|
class ComposerAutoloaderInit5377330e42d2722bfd3ef897e8be6389
|
||||||
|
{
|
||||||
|
private static $loader;
|
||||||
|
|
||||||
|
public static function loadClassLoader($class)
|
||||||
|
{
|
||||||
|
if ('Composer\Autoload\ClassLoader' === $class) {
|
||||||
|
require __DIR__ . '/ClassLoader.php';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Composer\Autoload\ClassLoader
|
||||||
|
*/
|
||||||
|
public static function getLoader()
|
||||||
|
{
|
||||||
|
if (null !== self::$loader) {
|
||||||
|
return self::$loader;
|
||||||
|
}
|
||||||
|
|
||||||
|
require __DIR__ . '/platform_check.php';
|
||||||
|
|
||||||
|
spl_autoload_register(array('ComposerAutoloaderInit5377330e42d2722bfd3ef897e8be6389', 'loadClassLoader'), true, true);
|
||||||
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||||
|
spl_autoload_unregister(array('ComposerAutoloaderInit5377330e42d2722bfd3ef897e8be6389', 'loadClassLoader'));
|
||||||
|
|
||||||
|
require __DIR__ . '/autoload_static.php';
|
||||||
|
call_user_func(\Composer\Autoload\ComposerStaticInit5377330e42d2722bfd3ef897e8be6389::getInitializer($loader));
|
||||||
|
|
||||||
|
$loader->register(true);
|
||||||
|
|
||||||
|
$includeFiles = \Composer\Autoload\ComposerStaticInit5377330e42d2722bfd3ef897e8be6389::$files;
|
||||||
|
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||||
|
composerRequire5377330e42d2722bfd3ef897e8be6389($fileIdentifier, $file);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $loader;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $fileIdentifier
|
||||||
|
* @param string $file
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function composerRequire5377330e42d2722bfd3ef897e8be6389($fileIdentifier, $file)
|
||||||
|
{
|
||||||
|
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||||
|
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||||
|
|
||||||
|
require $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,106 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// autoload_static.php @generated by Composer
|
||||||
|
|
||||||
|
namespace Composer\Autoload;
|
||||||
|
|
||||||
|
class ComposerStaticInit5377330e42d2722bfd3ef897e8be6389
|
||||||
|
{
|
||||||
|
public static $files = array (
|
||||||
|
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||||
|
'2cffec82183ee1cea088009cef9a6fc3' => __DIR__ . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
|
||||||
|
);
|
||||||
|
|
||||||
|
public static $prefixLengthsPsr4 = array (
|
||||||
|
'Z' =>
|
||||||
|
array (
|
||||||
|
'ZipStream\\' => 10,
|
||||||
|
),
|
||||||
|
'S' =>
|
||||||
|
array (
|
||||||
|
'Symfony\\Polyfill\\Mbstring\\' => 26,
|
||||||
|
),
|
||||||
|
'P' =>
|
||||||
|
array (
|
||||||
|
'Psr\\SimpleCache\\' => 16,
|
||||||
|
'Psr\\Http\\Message\\' => 17,
|
||||||
|
'Psr\\Http\\Client\\' => 16,
|
||||||
|
'PhpOffice\\PhpSpreadsheet\\' => 25,
|
||||||
|
),
|
||||||
|
'M' =>
|
||||||
|
array (
|
||||||
|
'MyCLabs\\Enum\\' => 13,
|
||||||
|
'Matrix\\' => 7,
|
||||||
|
),
|
||||||
|
'C' =>
|
||||||
|
array (
|
||||||
|
'Complex\\' => 8,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
public static $prefixDirsPsr4 = array (
|
||||||
|
'ZipStream\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/maennchen/zipstream-php/src',
|
||||||
|
),
|
||||||
|
'Symfony\\Polyfill\\Mbstring\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
|
||||||
|
),
|
||||||
|
'Psr\\SimpleCache\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/psr/simple-cache/src',
|
||||||
|
),
|
||||||
|
'Psr\\Http\\Message\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/psr/http-message/src',
|
||||||
|
1 => __DIR__ . '/..' . '/psr/http-factory/src',
|
||||||
|
),
|
||||||
|
'Psr\\Http\\Client\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/psr/http-client/src',
|
||||||
|
),
|
||||||
|
'PhpOffice\\PhpSpreadsheet\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet',
|
||||||
|
),
|
||||||
|
'MyCLabs\\Enum\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/myclabs/php-enum/src',
|
||||||
|
),
|
||||||
|
'Matrix\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/markbaker/matrix/classes/src',
|
||||||
|
),
|
||||||
|
'Complex\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/markbaker/complex/classes/src',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
public static $prefixesPsr0 = array (
|
||||||
|
'H' =>
|
||||||
|
array (
|
||||||
|
'HTMLPurifier' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/ezyang/htmlpurifier/library',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
public static $classMap = array (
|
||||||
|
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
||||||
|
'Stringable' => __DIR__ . '/..' . '/myclabs/php-enum/stubs/Stringable.php',
|
||||||
|
);
|
||||||
|
|
||||||
|
public static function getInitializer(ClassLoader $loader)
|
||||||
|
{
|
||||||
|
return \Closure::bind(function () use ($loader) {
|
||||||
|
$loader->prefixLengthsPsr4 = ComposerStaticInit5377330e42d2722bfd3ef897e8be6389::$prefixLengthsPsr4;
|
||||||
|
$loader->prefixDirsPsr4 = ComposerStaticInit5377330e42d2722bfd3ef897e8be6389::$prefixDirsPsr4;
|
||||||
|
$loader->prefixesPsr0 = ComposerStaticInit5377330e42d2722bfd3ef897e8be6389::$prefixesPsr0;
|
||||||
|
$loader->classMap = ComposerStaticInit5377330e42d2722bfd3ef897e8be6389::$classMap;
|
||||||
|
|
||||||
|
}, null, ClassLoader::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,744 @@
|
||||||
|
{
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "ezyang/htmlpurifier",
|
||||||
|
"version": "v4.16.0",
|
||||||
|
"version_normalized": "4.16.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/ezyang/htmlpurifier.git",
|
||||||
|
"reference": "523407fb06eb9e5f3d59889b3978d5bfe94299c8"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/523407fb06eb9e5f3d59889b3978d5bfe94299c8",
|
||||||
|
"reference": "523407fb06eb9e5f3d59889b3978d5bfe94299c8",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "~5.6.0 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"cerdic/css-tidy": "^1.7 || ^2.0",
|
||||||
|
"simpletest/simpletest": "dev-master"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"cerdic/css-tidy": "If you want to use the filter 'Filter.ExtractStyleBlocks'.",
|
||||||
|
"ext-bcmath": "Used for unit conversion and imagecrash protection",
|
||||||
|
"ext-iconv": "Converts text to and from non-UTF-8 encodings",
|
||||||
|
"ext-tidy": "Used for pretty-printing HTML"
|
||||||
|
},
|
||||||
|
"time": "2022-09-18T07:06:19+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"library/HTMLPurifier.composer.php"
|
||||||
|
],
|
||||||
|
"psr-0": {
|
||||||
|
"HTMLPurifier": "library/"
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/library/HTMLPurifier/Language/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"LGPL-2.1-or-later"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Edward Z. Yang",
|
||||||
|
"email": "admin@htmlpurifier.org",
|
||||||
|
"homepage": "http://ezyang.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Standards compliant HTML filter written in PHP",
|
||||||
|
"homepage": "http://htmlpurifier.org/",
|
||||||
|
"keywords": [
|
||||||
|
"html"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/ezyang/htmlpurifier/issues",
|
||||||
|
"source": "https://github.com/ezyang/htmlpurifier/tree/v4.16.0"
|
||||||
|
},
|
||||||
|
"install-path": "../ezyang/htmlpurifier"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "maennchen/zipstream-php",
|
||||||
|
"version": "2.1.0",
|
||||||
|
"version_normalized": "2.1.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/maennchen/ZipStream-PHP.git",
|
||||||
|
"reference": "c4c5803cc1f93df3d2448478ef79394a5981cc58"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/c4c5803cc1f93df3d2448478ef79394a5981cc58",
|
||||||
|
"reference": "c4c5803cc1f93df3d2448478ef79394a5981cc58",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"myclabs/php-enum": "^1.5",
|
||||||
|
"php": ">= 7.1",
|
||||||
|
"psr/http-message": "^1.0",
|
||||||
|
"symfony/polyfill-mbstring": "^1.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"ext-zip": "*",
|
||||||
|
"guzzlehttp/guzzle": ">= 6.3",
|
||||||
|
"mikey179/vfsstream": "^1.6",
|
||||||
|
"phpunit/phpunit": ">= 7.5"
|
||||||
|
},
|
||||||
|
"time": "2020-05-30T13:11:16+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"ZipStream\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Paul Duncan",
|
||||||
|
"email": "pabs@pablotron.org"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Jonatan Männchen",
|
||||||
|
"email": "jonatan@maennchen.ch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Jesse Donat",
|
||||||
|
"email": "donatj@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "András Kolesár",
|
||||||
|
"email": "kolesar@kolesar.hu"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.",
|
||||||
|
"keywords": [
|
||||||
|
"stream",
|
||||||
|
"zip"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/maennchen/ZipStream-PHP/issues",
|
||||||
|
"source": "https://github.com/maennchen/ZipStream-PHP/tree/2.1.0"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://github.com/maennchen",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://opencollective.com/zipstream",
|
||||||
|
"type": "open_collective"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"install-path": "../maennchen/zipstream-php"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "markbaker/complex",
|
||||||
|
"version": "3.0.2",
|
||||||
|
"version_normalized": "3.0.2.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/MarkBaker/PHPComplex.git",
|
||||||
|
"reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/95c56caa1cf5c766ad6d65b6344b807c1e8405b9",
|
||||||
|
"reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^7.2 || ^8.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"dealerdirect/phpcodesniffer-composer-installer": "dev-master",
|
||||||
|
"phpcompatibility/php-compatibility": "^9.3",
|
||||||
|
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0",
|
||||||
|
"squizlabs/php_codesniffer": "^3.7"
|
||||||
|
},
|
||||||
|
"time": "2022-12-06T16:21:08+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Complex\\": "classes/src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Mark Baker",
|
||||||
|
"email": "mark@lange.demon.co.uk"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHP Class for working with complex numbers",
|
||||||
|
"homepage": "https://github.com/MarkBaker/PHPComplex",
|
||||||
|
"keywords": [
|
||||||
|
"complex",
|
||||||
|
"mathematics"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/MarkBaker/PHPComplex/issues",
|
||||||
|
"source": "https://github.com/MarkBaker/PHPComplex/tree/3.0.2"
|
||||||
|
},
|
||||||
|
"install-path": "../markbaker/complex"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "markbaker/matrix",
|
||||||
|
"version": "3.0.1",
|
||||||
|
"version_normalized": "3.0.1.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/MarkBaker/PHPMatrix.git",
|
||||||
|
"reference": "728434227fe21be27ff6d86621a1b13107a2562c"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/MarkBaker/PHPMatrix/zipball/728434227fe21be27ff6d86621a1b13107a2562c",
|
||||||
|
"reference": "728434227fe21be27ff6d86621a1b13107a2562c",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^7.1 || ^8.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"dealerdirect/phpcodesniffer-composer-installer": "dev-master",
|
||||||
|
"phpcompatibility/php-compatibility": "^9.3",
|
||||||
|
"phpdocumentor/phpdocumentor": "2.*",
|
||||||
|
"phploc/phploc": "^4.0",
|
||||||
|
"phpmd/phpmd": "2.*",
|
||||||
|
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0",
|
||||||
|
"sebastian/phpcpd": "^4.0",
|
||||||
|
"squizlabs/php_codesniffer": "^3.7"
|
||||||
|
},
|
||||||
|
"time": "2022-12-02T22:17:43+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Matrix\\": "classes/src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Mark Baker",
|
||||||
|
"email": "mark@demon-angel.eu"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHP Class for working with matrices",
|
||||||
|
"homepage": "https://github.com/MarkBaker/PHPMatrix",
|
||||||
|
"keywords": [
|
||||||
|
"mathematics",
|
||||||
|
"matrix",
|
||||||
|
"vector"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/MarkBaker/PHPMatrix/issues",
|
||||||
|
"source": "https://github.com/MarkBaker/PHPMatrix/tree/3.0.1"
|
||||||
|
},
|
||||||
|
"install-path": "../markbaker/matrix"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "myclabs/php-enum",
|
||||||
|
"version": "1.8.4",
|
||||||
|
"version_normalized": "1.8.4.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/myclabs/php-enum.git",
|
||||||
|
"reference": "a867478eae49c9f59ece437ae7f9506bfaa27483"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/myclabs/php-enum/zipball/a867478eae49c9f59ece437ae7f9506bfaa27483",
|
||||||
|
"reference": "a867478eae49c9f59ece437ae7f9506bfaa27483",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-json": "*",
|
||||||
|
"php": "^7.3 || ^8.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^9.5",
|
||||||
|
"squizlabs/php_codesniffer": "1.*",
|
||||||
|
"vimeo/psalm": "^4.6.2"
|
||||||
|
},
|
||||||
|
"time": "2022-08-04T09:53:51+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"MyCLabs\\Enum\\": "src/"
|
||||||
|
},
|
||||||
|
"classmap": [
|
||||||
|
"stubs/Stringable.php"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "PHP Enum contributors",
|
||||||
|
"homepage": "https://github.com/myclabs/php-enum/graphs/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHP Enum implementation",
|
||||||
|
"homepage": "http://github.com/myclabs/php-enum",
|
||||||
|
"keywords": [
|
||||||
|
"enum"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/myclabs/php-enum/issues",
|
||||||
|
"source": "https://github.com/myclabs/php-enum/tree/1.8.4"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://github.com/mnapoli",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/myclabs/php-enum",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"install-path": "../myclabs/php-enum"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "phpoffice/phpspreadsheet",
|
||||||
|
"version": "1.25.2",
|
||||||
|
"version_normalized": "1.25.2.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
|
||||||
|
"reference": "a317a09e7def49852400a4b3eca4a4b0790ceeb5"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/a317a09e7def49852400a4b3eca4a4b0790ceeb5",
|
||||||
|
"reference": "a317a09e7def49852400a4b3eca4a4b0790ceeb5",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-ctype": "*",
|
||||||
|
"ext-dom": "*",
|
||||||
|
"ext-fileinfo": "*",
|
||||||
|
"ext-gd": "*",
|
||||||
|
"ext-iconv": "*",
|
||||||
|
"ext-libxml": "*",
|
||||||
|
"ext-mbstring": "*",
|
||||||
|
"ext-simplexml": "*",
|
||||||
|
"ext-xml": "*",
|
||||||
|
"ext-xmlreader": "*",
|
||||||
|
"ext-xmlwriter": "*",
|
||||||
|
"ext-zip": "*",
|
||||||
|
"ext-zlib": "*",
|
||||||
|
"ezyang/htmlpurifier": "^4.15",
|
||||||
|
"maennchen/zipstream-php": "^2.1",
|
||||||
|
"markbaker/complex": "^3.0",
|
||||||
|
"markbaker/matrix": "^3.0",
|
||||||
|
"php": "^7.3 || ^8.0",
|
||||||
|
"psr/http-client": "^1.0",
|
||||||
|
"psr/http-factory": "^1.0",
|
||||||
|
"psr/simple-cache": "^1.0 || ^2.0 || ^3.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"dealerdirect/phpcodesniffer-composer-installer": "dev-master",
|
||||||
|
"dompdf/dompdf": "^1.0 || ^2.0",
|
||||||
|
"friendsofphp/php-cs-fixer": "^3.2",
|
||||||
|
"mitoteam/jpgraph": "10.2.4",
|
||||||
|
"mpdf/mpdf": "8.1.1",
|
||||||
|
"phpcompatibility/php-compatibility": "^9.3",
|
||||||
|
"phpstan/phpstan": "^1.1",
|
||||||
|
"phpstan/phpstan-phpunit": "^1.0",
|
||||||
|
"phpunit/phpunit": "^8.5 || ^9.0",
|
||||||
|
"squizlabs/php_codesniffer": "^3.7",
|
||||||
|
"tecnickcom/tcpdf": "6.5"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"dompdf/dompdf": "Option for rendering PDF with PDF Writer",
|
||||||
|
"ext-intl": "PHP Internationalization Functions",
|
||||||
|
"mitoteam/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers",
|
||||||
|
"mpdf/mpdf": "Option for rendering PDF with PDF Writer",
|
||||||
|
"tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer"
|
||||||
|
},
|
||||||
|
"time": "2022-09-25T17:21:01+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Maarten Balliauw",
|
||||||
|
"homepage": "https://blog.maartenballiauw.be"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Mark Baker",
|
||||||
|
"homepage": "https://markbakeruk.net"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Franck Lefevre",
|
||||||
|
"homepage": "https://rootslabs.net"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Erik Tilt"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Adrien Crivelli"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
|
||||||
|
"homepage": "https://github.com/PHPOffice/PhpSpreadsheet",
|
||||||
|
"keywords": [
|
||||||
|
"OpenXML",
|
||||||
|
"excel",
|
||||||
|
"gnumeric",
|
||||||
|
"ods",
|
||||||
|
"php",
|
||||||
|
"spreadsheet",
|
||||||
|
"xls",
|
||||||
|
"xlsx"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues",
|
||||||
|
"source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.25.2"
|
||||||
|
},
|
||||||
|
"install-path": "../phpoffice/phpspreadsheet"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "psr/http-client",
|
||||||
|
"version": "1.0.2",
|
||||||
|
"version_normalized": "1.0.2.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/php-fig/http-client.git",
|
||||||
|
"reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/php-fig/http-client/zipball/0955afe48220520692d2d09f7ab7e0f93ffd6a31",
|
||||||
|
"reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^7.0 || ^8.0",
|
||||||
|
"psr/http-message": "^1.0 || ^2.0"
|
||||||
|
},
|
||||||
|
"time": "2023-04-10T20:12:12+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.0.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Psr\\Http\\Client\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "PHP-FIG",
|
||||||
|
"homepage": "https://www.php-fig.org/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Common interface for HTTP clients",
|
||||||
|
"homepage": "https://github.com/php-fig/http-client",
|
||||||
|
"keywords": [
|
||||||
|
"http",
|
||||||
|
"http-client",
|
||||||
|
"psr",
|
||||||
|
"psr-18"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/php-fig/http-client/tree/1.0.2"
|
||||||
|
},
|
||||||
|
"install-path": "../psr/http-client"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "psr/http-factory",
|
||||||
|
"version": "1.0.2",
|
||||||
|
"version_normalized": "1.0.2.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/php-fig/http-factory.git",
|
||||||
|
"reference": "e616d01114759c4c489f93b099585439f795fe35"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35",
|
||||||
|
"reference": "e616d01114759c4c489f93b099585439f795fe35",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=7.0.0",
|
||||||
|
"psr/http-message": "^1.0 || ^2.0"
|
||||||
|
},
|
||||||
|
"time": "2023-04-10T20:10:41+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.0.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Psr\\Http\\Message\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "PHP-FIG",
|
||||||
|
"homepage": "https://www.php-fig.org/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Common interfaces for PSR-7 HTTP message factories",
|
||||||
|
"keywords": [
|
||||||
|
"factory",
|
||||||
|
"http",
|
||||||
|
"message",
|
||||||
|
"psr",
|
||||||
|
"psr-17",
|
||||||
|
"psr-7",
|
||||||
|
"request",
|
||||||
|
"response"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/php-fig/http-factory/tree/1.0.2"
|
||||||
|
},
|
||||||
|
"install-path": "../psr/http-factory"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "psr/http-message",
|
||||||
|
"version": "1.1",
|
||||||
|
"version_normalized": "1.1.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/php-fig/http-message.git",
|
||||||
|
"reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba",
|
||||||
|
"reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^7.2 || ^8.0"
|
||||||
|
},
|
||||||
|
"time": "2023-04-04T09:50:52+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.1.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Psr\\Http\\Message\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "PHP-FIG",
|
||||||
|
"homepage": "http://www.php-fig.org/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Common interface for HTTP messages",
|
||||||
|
"homepage": "https://github.com/php-fig/http-message",
|
||||||
|
"keywords": [
|
||||||
|
"http",
|
||||||
|
"http-message",
|
||||||
|
"psr",
|
||||||
|
"psr-7",
|
||||||
|
"request",
|
||||||
|
"response"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/php-fig/http-message/tree/1.1"
|
||||||
|
},
|
||||||
|
"install-path": "../psr/http-message"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "psr/simple-cache",
|
||||||
|
"version": "1.0.1",
|
||||||
|
"version_normalized": "1.0.1.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/php-fig/simple-cache.git",
|
||||||
|
"reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
|
||||||
|
"reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.0"
|
||||||
|
},
|
||||||
|
"time": "2017-10-23T01:57:42+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.0.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Psr\\SimpleCache\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "PHP-FIG",
|
||||||
|
"homepage": "http://www.php-fig.org/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Common interfaces for simple caching",
|
||||||
|
"keywords": [
|
||||||
|
"cache",
|
||||||
|
"caching",
|
||||||
|
"psr",
|
||||||
|
"psr-16",
|
||||||
|
"simple-cache"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/php-fig/simple-cache/tree/master"
|
||||||
|
},
|
||||||
|
"install-path": "../psr/simple-cache"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/polyfill-mbstring",
|
||||||
|
"version": "v1.27.0",
|
||||||
|
"version_normalized": "1.27.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||||
|
"reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534",
|
||||||
|
"reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=7.1"
|
||||||
|
},
|
||||||
|
"provide": {
|
||||||
|
"ext-mbstring": "*"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"ext-mbstring": "For best performance"
|
||||||
|
},
|
||||||
|
"time": "2022-11-03T14:55:06+00:00",
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-main": "1.27-dev"
|
||||||
|
},
|
||||||
|
"thanks": {
|
||||||
|
"name": "symfony/polyfill",
|
||||||
|
"url": "https://github.com/symfony/polyfill"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"installation-source": "dist",
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"bootstrap.php"
|
||||||
|
],
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Polyfill\\Mbstring\\": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Grekas",
|
||||||
|
"email": "p@tchwork.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Symfony polyfill for the Mbstring extension",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"keywords": [
|
||||||
|
"compatibility",
|
||||||
|
"mbstring",
|
||||||
|
"polyfill",
|
||||||
|
"portable",
|
||||||
|
"shim"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://symfony.com/sponsor",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/fabpot",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"install-path": "../symfony/polyfill-mbstring"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"dev-package-names": []
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,122 @@
|
||||||
|
<?php return array(
|
||||||
|
'root' => array(
|
||||||
|
'name' => '__root__',
|
||||||
|
'pretty_version' => '1.0.0+no-version-set',
|
||||||
|
'version' => '1.0.0.0',
|
||||||
|
'reference' => NULL,
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../../',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev' => true,
|
||||||
|
),
|
||||||
|
'versions' => array(
|
||||||
|
'__root__' => array(
|
||||||
|
'pretty_version' => '1.0.0+no-version-set',
|
||||||
|
'version' => '1.0.0.0',
|
||||||
|
'reference' => NULL,
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../../',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'ezyang/htmlpurifier' => array(
|
||||||
|
'pretty_version' => 'v4.16.0',
|
||||||
|
'version' => '4.16.0.0',
|
||||||
|
'reference' => '523407fb06eb9e5f3d59889b3978d5bfe94299c8',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../ezyang/htmlpurifier',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'maennchen/zipstream-php' => array(
|
||||||
|
'pretty_version' => '2.1.0',
|
||||||
|
'version' => '2.1.0.0',
|
||||||
|
'reference' => 'c4c5803cc1f93df3d2448478ef79394a5981cc58',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../maennchen/zipstream-php',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'markbaker/complex' => array(
|
||||||
|
'pretty_version' => '3.0.2',
|
||||||
|
'version' => '3.0.2.0',
|
||||||
|
'reference' => '95c56caa1cf5c766ad6d65b6344b807c1e8405b9',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../markbaker/complex',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'markbaker/matrix' => array(
|
||||||
|
'pretty_version' => '3.0.1',
|
||||||
|
'version' => '3.0.1.0',
|
||||||
|
'reference' => '728434227fe21be27ff6d86621a1b13107a2562c',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../markbaker/matrix',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'myclabs/php-enum' => array(
|
||||||
|
'pretty_version' => '1.8.4',
|
||||||
|
'version' => '1.8.4.0',
|
||||||
|
'reference' => 'a867478eae49c9f59ece437ae7f9506bfaa27483',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../myclabs/php-enum',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'phpoffice/phpspreadsheet' => array(
|
||||||
|
'pretty_version' => '1.25.2',
|
||||||
|
'version' => '1.25.2.0',
|
||||||
|
'reference' => 'a317a09e7def49852400a4b3eca4a4b0790ceeb5',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../phpoffice/phpspreadsheet',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'psr/http-client' => array(
|
||||||
|
'pretty_version' => '1.0.2',
|
||||||
|
'version' => '1.0.2.0',
|
||||||
|
'reference' => '0955afe48220520692d2d09f7ab7e0f93ffd6a31',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../psr/http-client',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'psr/http-factory' => array(
|
||||||
|
'pretty_version' => '1.0.2',
|
||||||
|
'version' => '1.0.2.0',
|
||||||
|
'reference' => 'e616d01114759c4c489f93b099585439f795fe35',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../psr/http-factory',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'psr/http-message' => array(
|
||||||
|
'pretty_version' => '1.1',
|
||||||
|
'version' => '1.1.0.0',
|
||||||
|
'reference' => 'cb6ce4845ce34a8ad9e68117c10ee90a29919eba',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../psr/http-message',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'psr/simple-cache' => array(
|
||||||
|
'pretty_version' => '1.0.1',
|
||||||
|
'version' => '1.0.1.0',
|
||||||
|
'reference' => '408d5eafb83c57f6365a3ca330ff23aa4a5fa39b',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../psr/simple-cache',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
'symfony/polyfill-mbstring' => array(
|
||||||
|
'pretty_version' => 'v1.27.0',
|
||||||
|
'version' => '1.27.0.0',
|
||||||
|
'reference' => '8ad114f6b39e2c98a8b0e3bd907732c207c2b534',
|
||||||
|
'type' => 'library',
|
||||||
|
'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
|
||||||
|
'aliases' => array(),
|
||||||
|
'dev_requirement' => false,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// platform_check.php @generated by Composer
|
||||||
|
|
||||||
|
$issues = array();
|
||||||
|
|
||||||
|
if (!(PHP_VERSION_ID >= 70300)) {
|
||||||
|
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.3.0". You are running ' . PHP_VERSION . '.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($issues) {
|
||||||
|
if (!headers_sent()) {
|
||||||
|
header('HTTP/1.1 500 Internal Server Error');
|
||||||
|
}
|
||||||
|
if (!ini_get('display_errors')) {
|
||||||
|
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
||||||
|
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
|
||||||
|
} elseif (!headers_sent()) {
|
||||||
|
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
trigger_error(
|
||||||
|
'Composer detected issues in your platform: ' . implode(' ', $issues),
|
||||||
|
E_USER_ERROR
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
# [4.16.0](https://github.com/ezyang/htmlpurifier/compare/v4.15.0...v4.16.0) (2022-09-18)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add semantic release ([#307](https://github.com/ezyang/htmlpurifier/issues/307)) ([db31243](https://github.com/ezyang/htmlpurifier/commit/db312435cb9d8d73395f75f9642a43ba6de5e903)), closes [#322](https://github.com/ezyang/htmlpurifier/issues/322) [#323](https://github.com/ezyang/htmlpurifier/issues/323) [#326](https://github.com/ezyang/htmlpurifier/issues/326) [#327](https://github.com/ezyang/htmlpurifier/issues/327) [#328](https://github.com/ezyang/htmlpurifier/issues/328) [#329](https://github.com/ezyang/htmlpurifier/issues/329) [#330](https://github.com/ezyang/htmlpurifier/issues/330) [#331](https://github.com/ezyang/htmlpurifier/issues/331) [#332](https://github.com/ezyang/htmlpurifier/issues/332) [#333](https://github.com/ezyang/htmlpurifier/issues/333) [#337](https://github.com/ezyang/htmlpurifier/issues/337) [#335](https://github.com/ezyang/htmlpurifier/issues/335) [ezyang/htmlpurifier#334](https://github.com/ezyang/htmlpurifier/issues/334) [#336](https://github.com/ezyang/htmlpurifier/issues/336) [#338](https://github.com/ezyang/htmlpurifier/issues/338)
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
|
||||||
|
CREDITS
|
||||||
|
|
||||||
|
Almost everything written by Edward Z. Yang (Ambush Commander). Lots of thanks
|
||||||
|
to the DevNetwork Community for their help (see docs/ref-devnetwork.html for
|
||||||
|
more details), Feyd especially (namely IPv6 and optimization). Thanks to RSnake
|
||||||
|
for letting me package his fantastic XSS cheatsheet for a smoketest.
|
||||||
|
|
||||||
|
vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,504 @@
|
||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 2.1, February 1999
|
||||||
|
|
||||||
|
Copyright (C) 1991, 1999 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.
|
||||||
|
|
||||||
|
[This is the first released version of the Lesser GPL. It also counts
|
||||||
|
as the successor of the GNU Library Public License, version 2, hence
|
||||||
|
the version number 2.1.]
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
Licenses are intended to guarantee your freedom to share and change
|
||||||
|
free software--to make sure the software is free for all its users.
|
||||||
|
|
||||||
|
This license, the Lesser General Public License, applies to some
|
||||||
|
specially designated software packages--typically libraries--of the
|
||||||
|
Free Software Foundation and other authors who decide to use it. You
|
||||||
|
can use it too, but we suggest you first think carefully about whether
|
||||||
|
this license or the ordinary General Public License is the better
|
||||||
|
strategy to use in any particular case, based on the explanations below.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom of use,
|
||||||
|
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 and use pieces of
|
||||||
|
it in new free programs; and that you are informed that you can do
|
||||||
|
these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
distributors to deny you these rights or to ask you to surrender these
|
||||||
|
rights. These restrictions translate to certain responsibilities for
|
||||||
|
you if you distribute copies of the library or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of the library, whether gratis
|
||||||
|
or for a fee, you must give the recipients all the rights that we gave
|
||||||
|
you. You must make sure that they, too, receive or can get the source
|
||||||
|
code. If you link other code with the library, you must provide
|
||||||
|
complete object files to the recipients, so that they can relink them
|
||||||
|
with the library after making changes to the library and recompiling
|
||||||
|
it. And you must show them these terms so they know their rights.
|
||||||
|
|
||||||
|
We protect your rights with a two-step method: (1) we copyright the
|
||||||
|
library, and (2) we offer you this license, which gives you legal
|
||||||
|
permission to copy, distribute and/or modify the library.
|
||||||
|
|
||||||
|
To protect each distributor, we want to make it very clear that
|
||||||
|
there is no warranty for the free library. Also, if the library is
|
||||||
|
modified by someone else and passed on, the recipients should know
|
||||||
|
that what they have is not the original version, so that the original
|
||||||
|
author's reputation will not be affected by problems that might be
|
||||||
|
introduced by others.
|
||||||
|
|
||||||
|
Finally, software patents pose a constant threat to the existence of
|
||||||
|
any free program. We wish to make sure that a company cannot
|
||||||
|
effectively restrict the users of a free program by obtaining a
|
||||||
|
restrictive license from a patent holder. Therefore, we insist that
|
||||||
|
any patent license obtained for a version of the library must be
|
||||||
|
consistent with the full freedom of use specified in this license.
|
||||||
|
|
||||||
|
Most GNU software, including some libraries, is covered by the
|
||||||
|
ordinary GNU General Public License. This license, the GNU Lesser
|
||||||
|
General Public License, applies to certain designated libraries, and
|
||||||
|
is quite different from the ordinary General Public License. We use
|
||||||
|
this license for certain libraries in order to permit linking those
|
||||||
|
libraries into non-free programs.
|
||||||
|
|
||||||
|
When a program is linked with a library, whether statically or using
|
||||||
|
a shared library, the combination of the two is legally speaking a
|
||||||
|
combined work, a derivative of the original library. The ordinary
|
||||||
|
General Public License therefore permits such linking only if the
|
||||||
|
entire combination fits its criteria of freedom. The Lesser General
|
||||||
|
Public License permits more lax criteria for linking other code with
|
||||||
|
the library.
|
||||||
|
|
||||||
|
We call this license the "Lesser" General Public License because it
|
||||||
|
does Less to protect the user's freedom than the ordinary General
|
||||||
|
Public License. It also provides other free software developers Less
|
||||||
|
of an advantage over competing non-free programs. These disadvantages
|
||||||
|
are the reason we use the ordinary General Public License for many
|
||||||
|
libraries. However, the Lesser license provides advantages in certain
|
||||||
|
special circumstances.
|
||||||
|
|
||||||
|
For example, on rare occasions, there may be a special need to
|
||||||
|
encourage the widest possible use of a certain library, so that it becomes
|
||||||
|
a de-facto standard. To achieve this, non-free programs must be
|
||||||
|
allowed to use the library. A more frequent case is that a free
|
||||||
|
library does the same job as widely used non-free libraries. In this
|
||||||
|
case, there is little to gain by limiting the free library to free
|
||||||
|
software only, so we use the Lesser General Public License.
|
||||||
|
|
||||||
|
In other cases, permission to use a particular library in non-free
|
||||||
|
programs enables a greater number of people to use a large body of
|
||||||
|
free software. For example, permission to use the GNU C Library in
|
||||||
|
non-free programs enables many more people to use the whole GNU
|
||||||
|
operating system, as well as its variant, the GNU/Linux operating
|
||||||
|
system.
|
||||||
|
|
||||||
|
Although the Lesser General Public License is Less protective of the
|
||||||
|
users' freedom, it does ensure that the user of a program that is
|
||||||
|
linked with the Library has the freedom and the wherewithal to run
|
||||||
|
that program using a modified version of the Library.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow. Pay close attention to the difference between a
|
||||||
|
"work based on the library" and a "work that uses the library". The
|
||||||
|
former contains code derived from the library, whereas the latter must
|
||||||
|
be combined with the library in order to run.
|
||||||
|
|
||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License Agreement applies to any software library or other
|
||||||
|
program which contains a notice placed by the copyright holder or
|
||||||
|
other authorized party saying it may be distributed under the terms of
|
||||||
|
this Lesser General Public License (also called "this License").
|
||||||
|
Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
A "library" means a collection of software functions and/or data
|
||||||
|
prepared so as to be conveniently linked with application programs
|
||||||
|
(which use some of those functions and data) to form executables.
|
||||||
|
|
||||||
|
The "Library", below, refers to any such software library or work
|
||||||
|
which has been distributed under these terms. A "work based on the
|
||||||
|
Library" means either the Library or any derivative work under
|
||||||
|
copyright law: that is to say, a work containing the Library or a
|
||||||
|
portion of it, either verbatim or with modifications and/or translated
|
||||||
|
straightforwardly into another language. (Hereinafter, translation is
|
||||||
|
included without limitation in the term "modification".)
|
||||||
|
|
||||||
|
"Source code" for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For a library, 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 library.
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running a program using the Library is not restricted, and output from
|
||||||
|
such a program is covered only if its contents constitute a work based
|
||||||
|
on the Library (independent of the use of the Library in a tool for
|
||||||
|
writing it). Whether that is true depends on what the Library does
|
||||||
|
and what the program that uses the Library does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Library's
|
||||||
|
complete 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 distribute a copy of this License along with the
|
||||||
|
Library.
|
||||||
|
|
||||||
|
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 Library or any portion
|
||||||
|
of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
|
||||||
|
|
||||||
|
b) You must cause the files modified to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
c) You must cause the whole of the work to be licensed at no
|
||||||
|
charge to all third parties under the terms of this License.
|
||||||
|
|
||||||
|
d) If a facility in the modified Library refers to a function or a
|
||||||
|
table of data to be supplied by an application program that uses
|
||||||
|
the facility, other than as an argument passed when the facility
|
||||||
|
is invoked, then you must make a good faith effort to ensure that,
|
||||||
|
in the event an application does not supply such function or
|
||||||
|
table, the facility still operates, and performs whatever part of
|
||||||
|
its purpose remains meaningful.
|
||||||
|
|
||||||
|
(For example, a function in a library to compute square roots has
|
||||||
|
a purpose that is entirely well-defined independent of the
|
||||||
|
application. Therefore, Subsection 2d requires that any
|
||||||
|
application-supplied function or table used by this function must
|
||||||
|
be optional: if the application does not supply it, the square
|
||||||
|
root function must still compute square roots.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Library,
|
||||||
|
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 Library, 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 Library.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Library
|
||||||
|
with the Library (or with a work based on the Library) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||||
|
License instead of this License to a given copy of the Library. To do
|
||||||
|
this, you must alter all the notices that refer to this License, so
|
||||||
|
that they refer to the ordinary GNU General Public License, version 2,
|
||||||
|
instead of to this License. (If a newer version than version 2 of the
|
||||||
|
ordinary GNU General Public License has appeared, then you can specify
|
||||||
|
that version instead if you wish.) Do not make any other change in
|
||||||
|
these notices.
|
||||||
|
|
||||||
|
Once this change is made in a given copy, it is irreversible for
|
||||||
|
that copy, so the ordinary GNU General Public License applies to all
|
||||||
|
subsequent copies and derivative works made from that copy.
|
||||||
|
|
||||||
|
This option is useful when you wish to copy part of the code of
|
||||||
|
the Library into a program that is not a library.
|
||||||
|
|
||||||
|
4. You may copy and distribute the Library (or a portion or
|
||||||
|
derivative of it, under Section 2) in object code or executable form
|
||||||
|
under the terms of Sections 1 and 2 above provided that you 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.
|
||||||
|
|
||||||
|
If distribution of 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 satisfies the requirement to
|
||||||
|
distribute the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
5. A program that contains no derivative of any portion of the
|
||||||
|
Library, but is designed to work with the Library by being compiled or
|
||||||
|
linked with it, is called a "work that uses the Library". Such a
|
||||||
|
work, in isolation, is not a derivative work of the Library, and
|
||||||
|
therefore falls outside the scope of this License.
|
||||||
|
|
||||||
|
However, linking a "work that uses the Library" with the Library
|
||||||
|
creates an executable that is a derivative of the Library (because it
|
||||||
|
contains portions of the Library), rather than a "work that uses the
|
||||||
|
library". The executable is therefore covered by this License.
|
||||||
|
Section 6 states terms for distribution of such executables.
|
||||||
|
|
||||||
|
When a "work that uses the Library" uses material from a header file
|
||||||
|
that is part of the Library, the object code for the work may be a
|
||||||
|
derivative work of the Library even though the source code is not.
|
||||||
|
Whether this is true is especially significant if the work can be
|
||||||
|
linked without the Library, or if the work is itself a library. The
|
||||||
|
threshold for this to be true is not precisely defined by law.
|
||||||
|
|
||||||
|
If such an object file uses only numerical parameters, data
|
||||||
|
structure layouts and accessors, and small macros and small inline
|
||||||
|
functions (ten lines or less in length), then the use of the object
|
||||||
|
file is unrestricted, regardless of whether it is legally a derivative
|
||||||
|
work. (Executables containing this object code plus portions of the
|
||||||
|
Library will still fall under Section 6.)
|
||||||
|
|
||||||
|
Otherwise, if the work is a derivative of the Library, you may
|
||||||
|
distribute the object code for the work under the terms of Section 6.
|
||||||
|
Any executables containing that work also fall under Section 6,
|
||||||
|
whether or not they are linked directly with the Library itself.
|
||||||
|
|
||||||
|
6. As an exception to the Sections above, you may also combine or
|
||||||
|
link a "work that uses the Library" with the Library to produce a
|
||||||
|
work containing portions of the Library, and distribute that work
|
||||||
|
under terms of your choice, provided that the terms permit
|
||||||
|
modification of the work for the customer's own use and reverse
|
||||||
|
engineering for debugging such modifications.
|
||||||
|
|
||||||
|
You must give prominent notice with each copy of the work that the
|
||||||
|
Library is used in it and that the Library and its use are covered by
|
||||||
|
this License. You must supply a copy of this License. If the work
|
||||||
|
during execution displays copyright notices, you must include the
|
||||||
|
copyright notice for the Library among them, as well as a reference
|
||||||
|
directing the user to the copy of this License. Also, you must do one
|
||||||
|
of these things:
|
||||||
|
|
||||||
|
a) Accompany the work with the complete corresponding
|
||||||
|
machine-readable source code for the Library including whatever
|
||||||
|
changes were used in the work (which must be distributed under
|
||||||
|
Sections 1 and 2 above); and, if the work is an executable linked
|
||||||
|
with the Library, with the complete machine-readable "work that
|
||||||
|
uses the Library", as object code and/or source code, so that the
|
||||||
|
user can modify the Library and then relink to produce a modified
|
||||||
|
executable containing the modified Library. (It is understood
|
||||||
|
that the user who changes the contents of definitions files in the
|
||||||
|
Library will not necessarily be able to recompile the application
|
||||||
|
to use the modified definitions.)
|
||||||
|
|
||||||
|
b) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (1) uses at run time a
|
||||||
|
copy of the library already present on the user's computer system,
|
||||||
|
rather than copying library functions into the executable, and (2)
|
||||||
|
will operate properly with a modified version of the library, if
|
||||||
|
the user installs one, as long as the modified version is
|
||||||
|
interface-compatible with the version that the work was made with.
|
||||||
|
|
||||||
|
c) Accompany the work with a written offer, valid for at
|
||||||
|
least three years, to give the same user the materials
|
||||||
|
specified in Subsection 6a, above, for a charge no more
|
||||||
|
than the cost of performing this distribution.
|
||||||
|
|
||||||
|
d) If distribution of the work is made by offering access to copy
|
||||||
|
from a designated place, offer equivalent access to copy the above
|
||||||
|
specified materials from the same place.
|
||||||
|
|
||||||
|
e) Verify that the user has already received a copy of these
|
||||||
|
materials or that you have already sent this user a copy.
|
||||||
|
|
||||||
|
For an executable, the required form of the "work that uses the
|
||||||
|
Library" must include any data and utility programs needed for
|
||||||
|
reproducing the executable from it. However, as a special exception,
|
||||||
|
the materials to be 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.
|
||||||
|
|
||||||
|
It may happen that this requirement contradicts the license
|
||||||
|
restrictions of other proprietary libraries that do not normally
|
||||||
|
accompany the operating system. Such a contradiction means you cannot
|
||||||
|
use both them and the Library together in an executable that you
|
||||||
|
distribute.
|
||||||
|
|
||||||
|
7. You may place library facilities that are a work based on the
|
||||||
|
Library side-by-side in a single library together with other library
|
||||||
|
facilities not covered by this License, and distribute such a combined
|
||||||
|
library, provided that the separate distribution of the work based on
|
||||||
|
the Library and of the other library facilities is otherwise
|
||||||
|
permitted, and provided that you do these two things:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work
|
||||||
|
based on the Library, uncombined with any other library
|
||||||
|
facilities. This must be distributed under the terms of the
|
||||||
|
Sections above.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library of the fact
|
||||||
|
that part of it is a work based on the Library, and explaining
|
||||||
|
where to find the accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
8. You may not copy, modify, sublicense, link with, or distribute
|
||||||
|
the Library except as expressly provided under this License. Any
|
||||||
|
attempt otherwise to copy, modify, sublicense, link with, or
|
||||||
|
distribute the Library 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.
|
||||||
|
|
||||||
|
9. 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 Library or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Library (or any work based on the
|
||||||
|
Library), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Library or works based on it.
|
||||||
|
|
||||||
|
10. Each time you redistribute the Library (or any work based on the
|
||||||
|
Library), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute, link with or modify the Library
|
||||||
|
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 with
|
||||||
|
this License.
|
||||||
|
|
||||||
|
11. 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 Library at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Library 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 Library.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
12. If the distribution and/or use of the Library is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Library 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.
|
||||||
|
|
||||||
|
13. The Free Software Foundation may publish revised and/or new
|
||||||
|
versions of the Lesser 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 Library
|
||||||
|
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 Library does not specify a
|
||||||
|
license version number, you may choose any version ever published by
|
||||||
|
the Free Software Foundation.
|
||||||
|
|
||||||
|
14. If you wish to incorporate parts of the Library into other free
|
||||||
|
programs whose distribution conditions are incompatible with these,
|
||||||
|
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
|
||||||
|
|
||||||
|
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||||
|
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||||
|
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||||
|
OTHER PARTIES PROVIDE THE LIBRARY "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
|
||||||
|
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||||
|
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. 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 LIBRARY 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
|
||||||
|
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), 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 Libraries
|
||||||
|
|
||||||
|
If you develop a new library, and you want it to be of the greatest
|
||||||
|
possible use to the public, we recommend making it free software that
|
||||||
|
everyone can redistribute and change. You can do so by permitting
|
||||||
|
redistribution under these terms (or, alternatively, under the terms of the
|
||||||
|
ordinary General Public License).
|
||||||
|
|
||||||
|
To apply these terms, attach the following notices to the library. 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 library's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library 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
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; 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.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||||
|
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1990
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
That's all there is to it!
|
||||||
|
|
||||||
|
vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
HTML Purifier [](https://github.com/ezyang/htmlpurifier/actions/workflows/ci.yml)
|
||||||
|
=============
|
||||||
|
|
||||||
|
HTML Purifier is an HTML filtering solution that uses a unique combination
|
||||||
|
of robust whitelists and aggressive parsing to ensure that not only are
|
||||||
|
XSS attacks thwarted, but the resulting HTML is standards compliant.
|
||||||
|
|
||||||
|
HTML Purifier is oriented towards richly formatted documents from
|
||||||
|
untrusted sources that require CSS and a full tag-set. This library can
|
||||||
|
be configured to accept a more restrictive set of tags, but it won't be
|
||||||
|
as efficient as more bare-bones parsers. It will, however, do the job
|
||||||
|
right, which may be more important.
|
||||||
|
|
||||||
|
Places to go:
|
||||||
|
|
||||||
|
* See INSTALL for a quick installation guide
|
||||||
|
* See docs/ for developer-oriented documentation, code examples and
|
||||||
|
an in-depth installation guide.
|
||||||
|
* See WYSIWYG for information on editors like TinyMCE and FCKeditor
|
||||||
|
|
||||||
|
HTML Purifier can be found on the web at: [http://htmlpurifier.org/](http://htmlpurifier.org/)
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Package available on [Composer](https://packagist.org/packages/ezyang/htmlpurifier).
|
||||||
|
|
||||||
|
If you're using Composer to manage dependencies, you can use
|
||||||
|
|
||||||
|
$ composer require ezyang/htmlpurifier
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
4.15.0
|
||||||
44
system/library/nat/phpspreadsheet_7/vendor/ezyang/htmlpurifier/composer.json
vendored
Normal file
44
system/library/nat/phpspreadsheet_7/vendor/ezyang/htmlpurifier/composer.json
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
{
|
||||||
|
"name": "ezyang/htmlpurifier",
|
||||||
|
"description": "Standards compliant HTML filter written in PHP",
|
||||||
|
"type": "library",
|
||||||
|
"keywords": ["html"],
|
||||||
|
"homepage": "http://htmlpurifier.org/",
|
||||||
|
"license": "LGPL-2.1-or-later",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Edward Z. Yang",
|
||||||
|
"email": "admin@htmlpurifier.org",
|
||||||
|
"homepage": "http://ezyang.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"require": {
|
||||||
|
"php": "~5.6.0 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"cerdic/css-tidy": "^1.7 || ^2.0",
|
||||||
|
"simpletest/simpletest": "dev-master"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": { "HTMLPurifier": "library/" },
|
||||||
|
"files": ["library/HTMLPurifier.composer.php"],
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/library/HTMLPurifier/Language/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"cerdic/css-tidy": "If you want to use the filter 'Filter.ExtractStyleBlocks'.",
|
||||||
|
"ext-iconv": "Converts text to and from non-UTF-8 encodings",
|
||||||
|
"ext-bcmath": "Used for unit conversion and imagecrash protection",
|
||||||
|
"ext-tidy": "Used for pretty-printing HTML"
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"sort-packages": true
|
||||||
|
},
|
||||||
|
"repositories": [
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://github.com/ezyang/simpletest.git"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
11
system/library/nat/phpspreadsheet_7/vendor/ezyang/htmlpurifier/library/HTMLPurifier.auto.php
vendored
Normal file
11
system/library/nat/phpspreadsheet_7/vendor/ezyang/htmlpurifier/library/HTMLPurifier.auto.php
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a stub include that automatically configures the include path.
|
||||||
|
*/
|
||||||
|
|
||||||
|
set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path() );
|
||||||
|
require_once 'HTMLPurifier/Bootstrap.php';
|
||||||
|
require_once 'HTMLPurifier.autoload.php';
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Legacy autoloader for systems lacking spl_autoload_register
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
spl_autoload_register(function($class)
|
||||||
|
{
|
||||||
|
return HTMLPurifier_Bootstrap::autoload($class);
|
||||||
|
});
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
25
system/library/nat/phpspreadsheet_7/vendor/ezyang/htmlpurifier/library/HTMLPurifier.autoload.php
vendored
Normal file
25
system/library/nat/phpspreadsheet_7/vendor/ezyang/htmlpurifier/library/HTMLPurifier.autoload.php
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Convenience file that registers autoload handler for HTML Purifier.
|
||||||
|
* It also does some sanity checks.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (function_exists('spl_autoload_register') && function_exists('spl_autoload_unregister')) {
|
||||||
|
// We need unregister for our pre-registering functionality
|
||||||
|
HTMLPurifier_Bootstrap::registerAutoload();
|
||||||
|
if (function_exists('__autoload')) {
|
||||||
|
// Be polite and ensure that userland autoload gets retained
|
||||||
|
spl_autoload_register('__autoload');
|
||||||
|
}
|
||||||
|
} elseif (!function_exists('__autoload')) {
|
||||||
|
require dirname(__FILE__) . '/HTMLPurifier.autoload-legacy.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
// phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.zend_ze1_compatibility_modeRemoved
|
||||||
|
if (ini_get('zend.ze1_compatibility_mode')) {
|
||||||
|
trigger_error("HTML Purifier is not compatible with zend.ze1_compatibility_mode; please turn it off", E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?php
|
||||||
|
if (!defined('HTMLPURIFIER_PREFIX')) {
|
||||||
|
define('HTMLPURIFIER_PREFIX', dirname(__FILE__));
|
||||||
|
}
|
||||||
25
system/library/nat/phpspreadsheet_7/vendor/ezyang/htmlpurifier/library/HTMLPurifier.func.php
vendored
Normal file
25
system/library/nat/phpspreadsheet_7/vendor/ezyang/htmlpurifier/library/HTMLPurifier.func.php
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Defines a function wrapper for HTML Purifier for quick use.
|
||||||
|
* @note ''HTMLPurifier()'' is NOT the same as ''new HTMLPurifier()''
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purify HTML.
|
||||||
|
* @param string $html String HTML to purify
|
||||||
|
* @param mixed $config Configuration to use, can be any value accepted by
|
||||||
|
* HTMLPurifier_Config::create()
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function HTMLPurifier($html, $config = null)
|
||||||
|
{
|
||||||
|
static $purifier = false;
|
||||||
|
if (!$purifier) {
|
||||||
|
$purifier = new HTMLPurifier();
|
||||||
|
}
|
||||||
|
return $purifier->purify($html, $config);
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
235
system/library/nat/phpspreadsheet_7/vendor/ezyang/htmlpurifier/library/HTMLPurifier.includes.php
vendored
Normal file
235
system/library/nat/phpspreadsheet_7/vendor/ezyang/htmlpurifier/library/HTMLPurifier.includes.php
vendored
Normal file
|
|
@ -0,0 +1,235 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* This file was auto-generated by generate-includes.php and includes all of
|
||||||
|
* the core files required by HTML Purifier. Use this if performance is a
|
||||||
|
* primary concern and you are using an opcode cache. PLEASE DO NOT EDIT THIS
|
||||||
|
* FILE, changes will be overwritten the next time the script is run.
|
||||||
|
*
|
||||||
|
* @version 4.15.0
|
||||||
|
*
|
||||||
|
* @warning
|
||||||
|
* You must *not* include any other HTML Purifier files before this file,
|
||||||
|
* because 'require' not 'require_once' is used.
|
||||||
|
*
|
||||||
|
* @warning
|
||||||
|
* This file requires that the include path contains the HTML Purifier
|
||||||
|
* library directory; this is not auto-set.
|
||||||
|
*/
|
||||||
|
|
||||||
|
require 'HTMLPurifier.php';
|
||||||
|
require 'HTMLPurifier/Arborize.php';
|
||||||
|
require 'HTMLPurifier/AttrCollections.php';
|
||||||
|
require 'HTMLPurifier/AttrDef.php';
|
||||||
|
require 'HTMLPurifier/AttrTransform.php';
|
||||||
|
require 'HTMLPurifier/AttrTypes.php';
|
||||||
|
require 'HTMLPurifier/AttrValidator.php';
|
||||||
|
require 'HTMLPurifier/Bootstrap.php';
|
||||||
|
require 'HTMLPurifier/Definition.php';
|
||||||
|
require 'HTMLPurifier/CSSDefinition.php';
|
||||||
|
require 'HTMLPurifier/ChildDef.php';
|
||||||
|
require 'HTMLPurifier/Config.php';
|
||||||
|
require 'HTMLPurifier/ConfigSchema.php';
|
||||||
|
require 'HTMLPurifier/ContentSets.php';
|
||||||
|
require 'HTMLPurifier/Context.php';
|
||||||
|
require 'HTMLPurifier/DefinitionCache.php';
|
||||||
|
require 'HTMLPurifier/DefinitionCacheFactory.php';
|
||||||
|
require 'HTMLPurifier/Doctype.php';
|
||||||
|
require 'HTMLPurifier/DoctypeRegistry.php';
|
||||||
|
require 'HTMLPurifier/ElementDef.php';
|
||||||
|
require 'HTMLPurifier/Encoder.php';
|
||||||
|
require 'HTMLPurifier/EntityLookup.php';
|
||||||
|
require 'HTMLPurifier/EntityParser.php';
|
||||||
|
require 'HTMLPurifier/ErrorCollector.php';
|
||||||
|
require 'HTMLPurifier/ErrorStruct.php';
|
||||||
|
require 'HTMLPurifier/Exception.php';
|
||||||
|
require 'HTMLPurifier/Filter.php';
|
||||||
|
require 'HTMLPurifier/Generator.php';
|
||||||
|
require 'HTMLPurifier/HTMLDefinition.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule.php';
|
||||||
|
require 'HTMLPurifier/HTMLModuleManager.php';
|
||||||
|
require 'HTMLPurifier/IDAccumulator.php';
|
||||||
|
require 'HTMLPurifier/Injector.php';
|
||||||
|
require 'HTMLPurifier/Language.php';
|
||||||
|
require 'HTMLPurifier/LanguageFactory.php';
|
||||||
|
require 'HTMLPurifier/Length.php';
|
||||||
|
require 'HTMLPurifier/Lexer.php';
|
||||||
|
require 'HTMLPurifier/Node.php';
|
||||||
|
require 'HTMLPurifier/PercentEncoder.php';
|
||||||
|
require 'HTMLPurifier/PropertyList.php';
|
||||||
|
require 'HTMLPurifier/PropertyListIterator.php';
|
||||||
|
require 'HTMLPurifier/Queue.php';
|
||||||
|
require 'HTMLPurifier/Strategy.php';
|
||||||
|
require 'HTMLPurifier/StringHash.php';
|
||||||
|
require 'HTMLPurifier/StringHashParser.php';
|
||||||
|
require 'HTMLPurifier/TagTransform.php';
|
||||||
|
require 'HTMLPurifier/Token.php';
|
||||||
|
require 'HTMLPurifier/TokenFactory.php';
|
||||||
|
require 'HTMLPurifier/URI.php';
|
||||||
|
require 'HTMLPurifier/URIDefinition.php';
|
||||||
|
require 'HTMLPurifier/URIFilter.php';
|
||||||
|
require 'HTMLPurifier/URIParser.php';
|
||||||
|
require 'HTMLPurifier/URIScheme.php';
|
||||||
|
require 'HTMLPurifier/URISchemeRegistry.php';
|
||||||
|
require 'HTMLPurifier/UnitConverter.php';
|
||||||
|
require 'HTMLPurifier/VarParser.php';
|
||||||
|
require 'HTMLPurifier/VarParserException.php';
|
||||||
|
require 'HTMLPurifier/Zipper.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/CSS.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/Clone.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/Enum.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/Integer.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/Lang.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/Switch.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/Text.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/URI.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/CSS/Number.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/CSS/AlphaValue.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/CSS/Background.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/CSS/BackgroundPosition.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/CSS/Border.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/CSS/Color.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/CSS/Composite.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/CSS/Filter.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/CSS/Font.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/CSS/FontFamily.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/CSS/Ident.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/CSS/ImportantDecorator.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/CSS/Length.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/CSS/ListStyle.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/CSS/Multiple.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/CSS/Percentage.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/CSS/TextDecoration.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/CSS/URI.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/HTML/Bool.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/HTML/Nmtokens.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/HTML/Class.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/HTML/Color.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/HTML/ContentEditable.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/HTML/FrameTarget.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/HTML/ID.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/HTML/Pixels.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/HTML/Length.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/HTML/LinkTypes.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/HTML/MultiLength.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/URI/Email.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/URI/Host.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/URI/IPv4.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/URI/IPv6.php';
|
||||||
|
require 'HTMLPurifier/AttrDef/URI/Email/SimpleCheck.php';
|
||||||
|
require 'HTMLPurifier/AttrTransform/Background.php';
|
||||||
|
require 'HTMLPurifier/AttrTransform/BdoDir.php';
|
||||||
|
require 'HTMLPurifier/AttrTransform/BgColor.php';
|
||||||
|
require 'HTMLPurifier/AttrTransform/BoolToCSS.php';
|
||||||
|
require 'HTMLPurifier/AttrTransform/Border.php';
|
||||||
|
require 'HTMLPurifier/AttrTransform/EnumToCSS.php';
|
||||||
|
require 'HTMLPurifier/AttrTransform/ImgRequired.php';
|
||||||
|
require 'HTMLPurifier/AttrTransform/ImgSpace.php';
|
||||||
|
require 'HTMLPurifier/AttrTransform/Input.php';
|
||||||
|
require 'HTMLPurifier/AttrTransform/Lang.php';
|
||||||
|
require 'HTMLPurifier/AttrTransform/Length.php';
|
||||||
|
require 'HTMLPurifier/AttrTransform/Name.php';
|
||||||
|
require 'HTMLPurifier/AttrTransform/NameSync.php';
|
||||||
|
require 'HTMLPurifier/AttrTransform/Nofollow.php';
|
||||||
|
require 'HTMLPurifier/AttrTransform/SafeEmbed.php';
|
||||||
|
require 'HTMLPurifier/AttrTransform/SafeObject.php';
|
||||||
|
require 'HTMLPurifier/AttrTransform/SafeParam.php';
|
||||||
|
require 'HTMLPurifier/AttrTransform/ScriptRequired.php';
|
||||||
|
require 'HTMLPurifier/AttrTransform/TargetBlank.php';
|
||||||
|
require 'HTMLPurifier/AttrTransform/TargetNoopener.php';
|
||||||
|
require 'HTMLPurifier/AttrTransform/TargetNoreferrer.php';
|
||||||
|
require 'HTMLPurifier/AttrTransform/Textarea.php';
|
||||||
|
require 'HTMLPurifier/ChildDef/Chameleon.php';
|
||||||
|
require 'HTMLPurifier/ChildDef/Custom.php';
|
||||||
|
require 'HTMLPurifier/ChildDef/Empty.php';
|
||||||
|
require 'HTMLPurifier/ChildDef/List.php';
|
||||||
|
require 'HTMLPurifier/ChildDef/Required.php';
|
||||||
|
require 'HTMLPurifier/ChildDef/Optional.php';
|
||||||
|
require 'HTMLPurifier/ChildDef/StrictBlockquote.php';
|
||||||
|
require 'HTMLPurifier/ChildDef/Table.php';
|
||||||
|
require 'HTMLPurifier/DefinitionCache/Decorator.php';
|
||||||
|
require 'HTMLPurifier/DefinitionCache/Null.php';
|
||||||
|
require 'HTMLPurifier/DefinitionCache/Serializer.php';
|
||||||
|
require 'HTMLPurifier/DefinitionCache/Decorator/Cleanup.php';
|
||||||
|
require 'HTMLPurifier/DefinitionCache/Decorator/Memory.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/Bdo.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/CommonAttributes.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/Edit.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/Forms.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/Hypertext.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/Iframe.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/Image.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/Legacy.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/List.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/Name.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/Nofollow.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/NonXMLCommonAttributes.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/Object.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/Presentation.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/Proprietary.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/Ruby.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/SafeEmbed.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/SafeObject.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/SafeScripting.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/Scripting.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/StyleAttribute.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/Tables.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/Target.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/TargetBlank.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/TargetNoopener.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/TargetNoreferrer.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/Text.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/Tidy.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/XMLCommonAttributes.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/Tidy/Name.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/Tidy/Proprietary.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/Tidy/Strict.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/Tidy/Transitional.php';
|
||||||
|
require 'HTMLPurifier/HTMLModule/Tidy/XHTML.php';
|
||||||
|
require 'HTMLPurifier/Injector/AutoParagraph.php';
|
||||||
|
require 'HTMLPurifier/Injector/DisplayLinkURI.php';
|
||||||
|
require 'HTMLPurifier/Injector/Linkify.php';
|
||||||
|
require 'HTMLPurifier/Injector/PurifierLinkify.php';
|
||||||
|
require 'HTMLPurifier/Injector/RemoveEmpty.php';
|
||||||
|
require 'HTMLPurifier/Injector/RemoveSpansWithoutAttributes.php';
|
||||||
|
require 'HTMLPurifier/Injector/SafeObject.php';
|
||||||
|
require 'HTMLPurifier/Lexer/DOMLex.php';
|
||||||
|
require 'HTMLPurifier/Lexer/DirectLex.php';
|
||||||
|
require 'HTMLPurifier/Node/Comment.php';
|
||||||
|
require 'HTMLPurifier/Node/Element.php';
|
||||||
|
require 'HTMLPurifier/Node/Text.php';
|
||||||
|
require 'HTMLPurifier/Strategy/Composite.php';
|
||||||
|
require 'HTMLPurifier/Strategy/Core.php';
|
||||||
|
require 'HTMLPurifier/Strategy/FixNesting.php';
|
||||||
|
require 'HTMLPurifier/Strategy/MakeWellFormed.php';
|
||||||
|
require 'HTMLPurifier/Strategy/RemoveForeignElements.php';
|
||||||
|
require 'HTMLPurifier/Strategy/ValidateAttributes.php';
|
||||||
|
require 'HTMLPurifier/TagTransform/Font.php';
|
||||||
|
require 'HTMLPurifier/TagTransform/Simple.php';
|
||||||
|
require 'HTMLPurifier/Token/Comment.php';
|
||||||
|
require 'HTMLPurifier/Token/Tag.php';
|
||||||
|
require 'HTMLPurifier/Token/Empty.php';
|
||||||
|
require 'HTMLPurifier/Token/End.php';
|
||||||
|
require 'HTMLPurifier/Token/Start.php';
|
||||||
|
require 'HTMLPurifier/Token/Text.php';
|
||||||
|
require 'HTMLPurifier/URIFilter/DisableExternal.php';
|
||||||
|
require 'HTMLPurifier/URIFilter/DisableExternalResources.php';
|
||||||
|
require 'HTMLPurifier/URIFilter/DisableResources.php';
|
||||||
|
require 'HTMLPurifier/URIFilter/HostBlacklist.php';
|
||||||
|
require 'HTMLPurifier/URIFilter/MakeAbsolute.php';
|
||||||
|
require 'HTMLPurifier/URIFilter/Munge.php';
|
||||||
|
require 'HTMLPurifier/URIFilter/SafeIframe.php';
|
||||||
|
require 'HTMLPurifier/URIScheme/data.php';
|
||||||
|
require 'HTMLPurifier/URIScheme/file.php';
|
||||||
|
require 'HTMLPurifier/URIScheme/ftp.php';
|
||||||
|
require 'HTMLPurifier/URIScheme/http.php';
|
||||||
|
require 'HTMLPurifier/URIScheme/https.php';
|
||||||
|
require 'HTMLPurifier/URIScheme/mailto.php';
|
||||||
|
require 'HTMLPurifier/URIScheme/news.php';
|
||||||
|
require 'HTMLPurifier/URIScheme/nntp.php';
|
||||||
|
require 'HTMLPurifier/URIScheme/tel.php';
|
||||||
|
require 'HTMLPurifier/VarParser/Flexible.php';
|
||||||
|
require 'HTMLPurifier/VarParser/Native.php';
|
||||||
30
system/library/nat/phpspreadsheet_7/vendor/ezyang/htmlpurifier/library/HTMLPurifier.kses.php
vendored
Normal file
30
system/library/nat/phpspreadsheet_7/vendor/ezyang/htmlpurifier/library/HTMLPurifier.kses.php
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Emulation layer for code that used kses(), substituting in HTML Purifier.
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once dirname(__FILE__) . '/HTMLPurifier.auto.php';
|
||||||
|
|
||||||
|
function kses($string, $allowed_html, $allowed_protocols = null)
|
||||||
|
{
|
||||||
|
$config = HTMLPurifier_Config::createDefault();
|
||||||
|
$allowed_elements = array();
|
||||||
|
$allowed_attributes = array();
|
||||||
|
foreach ($allowed_html as $element => $attributes) {
|
||||||
|
$allowed_elements[$element] = true;
|
||||||
|
foreach ($attributes as $attribute => $x) {
|
||||||
|
$allowed_attributes["$element.$attribute"] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$config->set('HTML.AllowedElements', $allowed_elements);
|
||||||
|
$config->set('HTML.AllowedAttributes', $allowed_attributes);
|
||||||
|
if ($allowed_protocols !== null) {
|
||||||
|
$config->set('URI.AllowedSchemes', $allowed_protocols);
|
||||||
|
}
|
||||||
|
$purifier = new HTMLPurifier($config);
|
||||||
|
return $purifier->purify($string);
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
11
system/library/nat/phpspreadsheet_7/vendor/ezyang/htmlpurifier/library/HTMLPurifier.path.php
vendored
Normal file
11
system/library/nat/phpspreadsheet_7/vendor/ezyang/htmlpurifier/library/HTMLPurifier.path.php
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Convenience stub file that adds HTML Purifier's library file to the path
|
||||||
|
* without any other side-effects.
|
||||||
|
*/
|
||||||
|
|
||||||
|
set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path() );
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
297
system/library/nat/phpspreadsheet_7/vendor/ezyang/htmlpurifier/library/HTMLPurifier.php
vendored
Normal file
297
system/library/nat/phpspreadsheet_7/vendor/ezyang/htmlpurifier/library/HTMLPurifier.php
vendored
Normal file
|
|
@ -0,0 +1,297 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*! @mainpage
|
||||||
|
*
|
||||||
|
* HTML Purifier is an HTML filter that will take an arbitrary snippet of
|
||||||
|
* HTML and rigorously test, validate and filter it into a version that
|
||||||
|
* is safe for output onto webpages. It achieves this by:
|
||||||
|
*
|
||||||
|
* -# Lexing (parsing into tokens) the document,
|
||||||
|
* -# Executing various strategies on the tokens:
|
||||||
|
* -# Removing all elements not in the whitelist,
|
||||||
|
* -# Making the tokens well-formed,
|
||||||
|
* -# Fixing the nesting of the nodes, and
|
||||||
|
* -# Validating attributes of the nodes; and
|
||||||
|
* -# Generating HTML from the purified tokens.
|
||||||
|
*
|
||||||
|
* However, most users will only need to interface with the HTMLPurifier
|
||||||
|
* and HTMLPurifier_Config.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
HTML Purifier 4.15.0 - Standards Compliant HTML Filtering
|
||||||
|
Copyright (C) 2006-2008 Edward Z. Yang
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library 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
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Facade that coordinates HTML Purifier's subsystems in order to purify HTML.
|
||||||
|
*
|
||||||
|
* @note There are several points in which configuration can be specified
|
||||||
|
* for HTML Purifier. The precedence of these (from lowest to
|
||||||
|
* highest) is as follows:
|
||||||
|
* -# Instance: new HTMLPurifier($config)
|
||||||
|
* -# Invocation: purify($html, $config)
|
||||||
|
* These configurations are entirely independent of each other and
|
||||||
|
* are *not* merged (this behavior may change in the future).
|
||||||
|
*
|
||||||
|
* @todo We need an easier way to inject strategies using the configuration
|
||||||
|
* object.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Version of HTML Purifier.
|
||||||
|
* @type string
|
||||||
|
*/
|
||||||
|
public $version = '4.15.0';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constant with version of HTML Purifier.
|
||||||
|
*/
|
||||||
|
const VERSION = '4.15.0';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Global configuration object.
|
||||||
|
* @type HTMLPurifier_Config
|
||||||
|
*/
|
||||||
|
public $config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of extra filter objects to run on HTML,
|
||||||
|
* for backwards compatibility.
|
||||||
|
* @type HTMLPurifier_Filter[]
|
||||||
|
*/
|
||||||
|
private $filters = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Single instance of HTML Purifier.
|
||||||
|
* @type HTMLPurifier
|
||||||
|
*/
|
||||||
|
private static $instance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type HTMLPurifier_Strategy_Core
|
||||||
|
*/
|
||||||
|
protected $strategy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type HTMLPurifier_Generator
|
||||||
|
*/
|
||||||
|
protected $generator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resultant context of last run purification.
|
||||||
|
* Is an array of contexts if the last called method was purifyArray().
|
||||||
|
* @type HTMLPurifier_Context
|
||||||
|
*/
|
||||||
|
public $context;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the purifier.
|
||||||
|
*
|
||||||
|
* @param HTMLPurifier_Config|mixed $config Optional HTMLPurifier_Config object
|
||||||
|
* for all instances of the purifier, if omitted, a default
|
||||||
|
* configuration is supplied (which can be overridden on a
|
||||||
|
* per-use basis).
|
||||||
|
* The parameter can also be any type that
|
||||||
|
* HTMLPurifier_Config::create() supports.
|
||||||
|
*/
|
||||||
|
public function __construct($config = null)
|
||||||
|
{
|
||||||
|
$this->config = HTMLPurifier_Config::create($config);
|
||||||
|
$this->strategy = new HTMLPurifier_Strategy_Core();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a filter to process the output. First come first serve
|
||||||
|
*
|
||||||
|
* @param HTMLPurifier_Filter $filter HTMLPurifier_Filter object
|
||||||
|
*/
|
||||||
|
public function addFilter($filter)
|
||||||
|
{
|
||||||
|
trigger_error(
|
||||||
|
'HTMLPurifier->addFilter() is deprecated, use configuration directives' .
|
||||||
|
' in the Filter namespace or Filter.Custom',
|
||||||
|
E_USER_WARNING
|
||||||
|
);
|
||||||
|
$this->filters[] = $filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters an HTML snippet/document to be XSS-free and standards-compliant.
|
||||||
|
*
|
||||||
|
* @param string $html String of HTML to purify
|
||||||
|
* @param HTMLPurifier_Config $config Config object for this operation,
|
||||||
|
* if omitted, defaults to the config object specified during this
|
||||||
|
* object's construction. The parameter can also be any type
|
||||||
|
* that HTMLPurifier_Config::create() supports.
|
||||||
|
*
|
||||||
|
* @return string Purified HTML
|
||||||
|
*/
|
||||||
|
public function purify($html, $config = null)
|
||||||
|
{
|
||||||
|
// :TODO: make the config merge in, instead of replace
|
||||||
|
$config = $config ? HTMLPurifier_Config::create($config) : $this->config;
|
||||||
|
|
||||||
|
// implementation is partially environment dependant, partially
|
||||||
|
// configuration dependant
|
||||||
|
$lexer = HTMLPurifier_Lexer::create($config);
|
||||||
|
|
||||||
|
$context = new HTMLPurifier_Context();
|
||||||
|
|
||||||
|
// setup HTML generator
|
||||||
|
$this->generator = new HTMLPurifier_Generator($config, $context);
|
||||||
|
$context->register('Generator', $this->generator);
|
||||||
|
|
||||||
|
// set up global context variables
|
||||||
|
if ($config->get('Core.CollectErrors')) {
|
||||||
|
// may get moved out if other facilities use it
|
||||||
|
$language_factory = HTMLPurifier_LanguageFactory::instance();
|
||||||
|
$language = $language_factory->create($config, $context);
|
||||||
|
$context->register('Locale', $language);
|
||||||
|
|
||||||
|
$error_collector = new HTMLPurifier_ErrorCollector($context);
|
||||||
|
$context->register('ErrorCollector', $error_collector);
|
||||||
|
}
|
||||||
|
|
||||||
|
// setup id_accumulator context, necessary due to the fact that
|
||||||
|
// AttrValidator can be called from many places
|
||||||
|
$id_accumulator = HTMLPurifier_IDAccumulator::build($config, $context);
|
||||||
|
$context->register('IDAccumulator', $id_accumulator);
|
||||||
|
|
||||||
|
$html = HTMLPurifier_Encoder::convertToUTF8($html, $config, $context);
|
||||||
|
|
||||||
|
// setup filters
|
||||||
|
$filter_flags = $config->getBatch('Filter');
|
||||||
|
$custom_filters = $filter_flags['Custom'];
|
||||||
|
unset($filter_flags['Custom']);
|
||||||
|
$filters = array();
|
||||||
|
foreach ($filter_flags as $filter => $flag) {
|
||||||
|
if (!$flag) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (strpos($filter, '.') !== false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$class = "HTMLPurifier_Filter_$filter";
|
||||||
|
$filters[] = new $class;
|
||||||
|
}
|
||||||
|
foreach ($custom_filters as $filter) {
|
||||||
|
// maybe "HTMLPurifier_Filter_$filter", but be consistent with AutoFormat
|
||||||
|
$filters[] = $filter;
|
||||||
|
}
|
||||||
|
$filters = array_merge($filters, $this->filters);
|
||||||
|
// maybe prepare(), but later
|
||||||
|
|
||||||
|
for ($i = 0, $filter_size = count($filters); $i < $filter_size; $i++) {
|
||||||
|
$html = $filters[$i]->preFilter($html, $config, $context);
|
||||||
|
}
|
||||||
|
|
||||||
|
// purified HTML
|
||||||
|
$html =
|
||||||
|
$this->generator->generateFromTokens(
|
||||||
|
// list of tokens
|
||||||
|
$this->strategy->execute(
|
||||||
|
// list of un-purified tokens
|
||||||
|
$lexer->tokenizeHTML(
|
||||||
|
// un-purified HTML
|
||||||
|
$html,
|
||||||
|
$config,
|
||||||
|
$context
|
||||||
|
),
|
||||||
|
$config,
|
||||||
|
$context
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
for ($i = $filter_size - 1; $i >= 0; $i--) {
|
||||||
|
$html = $filters[$i]->postFilter($html, $config, $context);
|
||||||
|
}
|
||||||
|
|
||||||
|
$html = HTMLPurifier_Encoder::convertFromUTF8($html, $config, $context);
|
||||||
|
$this->context =& $context;
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters an array of HTML snippets
|
||||||
|
*
|
||||||
|
* @param string[] $array_of_html Array of html snippets
|
||||||
|
* @param HTMLPurifier_Config $config Optional config object for this operation.
|
||||||
|
* See HTMLPurifier::purify() for more details.
|
||||||
|
*
|
||||||
|
* @return string[] Array of purified HTML
|
||||||
|
*/
|
||||||
|
public function purifyArray($array_of_html, $config = null)
|
||||||
|
{
|
||||||
|
$context_array = array();
|
||||||
|
$array = array();
|
||||||
|
foreach($array_of_html as $key=>$value){
|
||||||
|
if (is_array($value)) {
|
||||||
|
$array[$key] = $this->purifyArray($value, $config);
|
||||||
|
} else {
|
||||||
|
$array[$key] = $this->purify($value, $config);
|
||||||
|
}
|
||||||
|
$context_array[$key] = $this->context;
|
||||||
|
}
|
||||||
|
$this->context = $context_array;
|
||||||
|
return $array;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Singleton for enforcing just one HTML Purifier in your system
|
||||||
|
*
|
||||||
|
* @param HTMLPurifier|HTMLPurifier_Config $prototype Optional prototype
|
||||||
|
* HTMLPurifier instance to overload singleton with,
|
||||||
|
* or HTMLPurifier_Config instance to configure the
|
||||||
|
* generated version with.
|
||||||
|
*
|
||||||
|
* @return HTMLPurifier
|
||||||
|
*/
|
||||||
|
public static function instance($prototype = null)
|
||||||
|
{
|
||||||
|
if (!self::$instance || $prototype) {
|
||||||
|
if ($prototype instanceof HTMLPurifier) {
|
||||||
|
self::$instance = $prototype;
|
||||||
|
} elseif ($prototype) {
|
||||||
|
self::$instance = new HTMLPurifier($prototype);
|
||||||
|
} else {
|
||||||
|
self::$instance = new HTMLPurifier();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Singleton for enforcing just one HTML Purifier in your system
|
||||||
|
*
|
||||||
|
* @param HTMLPurifier|HTMLPurifier_Config $prototype Optional prototype
|
||||||
|
* HTMLPurifier instance to overload singleton with,
|
||||||
|
* or HTMLPurifier_Config instance to configure the
|
||||||
|
* generated version with.
|
||||||
|
*
|
||||||
|
* @return HTMLPurifier
|
||||||
|
* @note Backwards compatibility, see instance()
|
||||||
|
*/
|
||||||
|
public static function getInstance($prototype = null)
|
||||||
|
{
|
||||||
|
return HTMLPurifier::instance($prototype);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,229 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* This file was auto-generated by generate-includes.php and includes all of
|
||||||
|
* the core files required by HTML Purifier. This is a convenience stub that
|
||||||
|
* includes all files using dirname(__FILE__) and require_once. PLEASE DO NOT
|
||||||
|
* EDIT THIS FILE, changes will be overwritten the next time the script is run.
|
||||||
|
*
|
||||||
|
* Changes to include_path are not necessary.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$__dir = dirname(__FILE__);
|
||||||
|
|
||||||
|
require_once $__dir . '/HTMLPurifier.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Arborize.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrCollections.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrTransform.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrTypes.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrValidator.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Bootstrap.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Definition.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/CSSDefinition.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/ChildDef.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Config.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/ConfigSchema.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/ContentSets.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Context.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/DefinitionCache.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/DefinitionCacheFactory.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Doctype.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/DoctypeRegistry.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/ElementDef.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Encoder.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/EntityLookup.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/EntityParser.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/ErrorCollector.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/ErrorStruct.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Exception.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Filter.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Generator.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLDefinition.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModuleManager.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/IDAccumulator.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Injector.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Language.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/LanguageFactory.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Length.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Lexer.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Node.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/PercentEncoder.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/PropertyList.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/PropertyListIterator.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Queue.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Strategy.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/StringHash.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/StringHashParser.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/TagTransform.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Token.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/TokenFactory.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/URI.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/URIDefinition.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/URIFilter.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/URIParser.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/URIScheme.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/URISchemeRegistry.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/UnitConverter.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/VarParser.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/VarParserException.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Zipper.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/CSS.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/Clone.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/Enum.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/Integer.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/Lang.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/Switch.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/Text.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/URI.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Number.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/AlphaValue.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Background.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Border.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Color.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Composite.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Filter.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Font.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/FontFamily.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Ident.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/ImportantDecorator.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Length.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/ListStyle.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Multiple.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Percentage.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/TextDecoration.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/URI.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Bool.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Nmtokens.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Class.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Color.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/ContentEditable.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/FrameTarget.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/ID.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Pixels.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Length.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/LinkTypes.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/MultiLength.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/URI/Email.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/URI/Host.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/URI/IPv4.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/URI/IPv6.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrDef/URI/Email/SimpleCheck.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrTransform/Background.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrTransform/BdoDir.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrTransform/BgColor.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrTransform/BoolToCSS.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrTransform/Border.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrTransform/EnumToCSS.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrTransform/ImgRequired.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrTransform/ImgSpace.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrTransform/Input.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrTransform/Lang.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrTransform/Length.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrTransform/Name.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrTransform/NameSync.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrTransform/Nofollow.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrTransform/SafeEmbed.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrTransform/SafeObject.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrTransform/SafeParam.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrTransform/ScriptRequired.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrTransform/TargetBlank.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrTransform/TargetNoopener.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrTransform/TargetNoreferrer.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/AttrTransform/Textarea.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/ChildDef/Chameleon.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/ChildDef/Custom.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/ChildDef/Empty.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/ChildDef/List.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/ChildDef/Required.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/ChildDef/Optional.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/ChildDef/StrictBlockquote.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/ChildDef/Table.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/DefinitionCache/Decorator.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/DefinitionCache/Null.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/DefinitionCache/Serializer.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/DefinitionCache/Decorator/Cleanup.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/DefinitionCache/Decorator/Memory.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/Bdo.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/CommonAttributes.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/Edit.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/Forms.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/Hypertext.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/Iframe.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/Image.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/Legacy.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/List.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/Name.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/Nofollow.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/NonXMLCommonAttributes.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/Object.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/Presentation.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/Proprietary.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/Ruby.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/SafeEmbed.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/SafeObject.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/SafeScripting.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/Scripting.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/StyleAttribute.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/Tables.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/Target.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/TargetBlank.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/TargetNoopener.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/TargetNoreferrer.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/Text.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/XMLCommonAttributes.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/Name.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/Proprietary.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/Strict.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/Transitional.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/XHTML.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Injector/AutoParagraph.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Injector/DisplayLinkURI.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Injector/Linkify.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Injector/PurifierLinkify.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Injector/RemoveEmpty.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Injector/RemoveSpansWithoutAttributes.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Injector/SafeObject.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Lexer/DOMLex.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Lexer/DirectLex.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Node/Comment.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Node/Element.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Node/Text.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Strategy/Composite.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Strategy/Core.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Strategy/FixNesting.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Strategy/MakeWellFormed.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Strategy/RemoveForeignElements.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Strategy/ValidateAttributes.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/TagTransform/Font.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/TagTransform/Simple.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Token/Comment.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Token/Tag.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Token/Empty.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Token/End.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Token/Start.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/Token/Text.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/URIFilter/DisableExternal.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/URIFilter/DisableExternalResources.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/URIFilter/DisableResources.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/URIFilter/HostBlacklist.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/URIFilter/MakeAbsolute.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/URIFilter/Munge.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/URIFilter/SafeIframe.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/URIScheme/data.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/URIScheme/file.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/URIScheme/ftp.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/URIScheme/http.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/URIScheme/https.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/URIScheme/mailto.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/URIScheme/news.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/URIScheme/nntp.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/URIScheme/tel.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/VarParser/Flexible.php';
|
||||||
|
require_once $__dir . '/HTMLPurifier/VarParser/Native.php';
|
||||||
71
system/library/nat/phpspreadsheet_7/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Arborize.php
vendored
Normal file
71
system/library/nat/phpspreadsheet_7/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Arborize.php
vendored
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a stream of HTMLPurifier_Token into an HTMLPurifier_Node,
|
||||||
|
* and back again.
|
||||||
|
*
|
||||||
|
* @note This transformation is not an equivalence. We mutate the input
|
||||||
|
* token stream to make it so; see all [MUT] markers in code.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_Arborize
|
||||||
|
{
|
||||||
|
public static function arborize($tokens, $config, $context) {
|
||||||
|
$definition = $config->getHTMLDefinition();
|
||||||
|
$parent = new HTMLPurifier_Token_Start($definition->info_parent);
|
||||||
|
$stack = array($parent->toNode());
|
||||||
|
foreach ($tokens as $token) {
|
||||||
|
$token->skip = null; // [MUT]
|
||||||
|
$token->carryover = null; // [MUT]
|
||||||
|
if ($token instanceof HTMLPurifier_Token_End) {
|
||||||
|
$token->start = null; // [MUT]
|
||||||
|
$r = array_pop($stack);
|
||||||
|
//assert($r->name === $token->name);
|
||||||
|
//assert(empty($token->attr));
|
||||||
|
$r->endCol = $token->col;
|
||||||
|
$r->endLine = $token->line;
|
||||||
|
$r->endArmor = $token->armor;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$node = $token->toNode();
|
||||||
|
$stack[count($stack)-1]->children[] = $node;
|
||||||
|
if ($token instanceof HTMLPurifier_Token_Start) {
|
||||||
|
$stack[] = $node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//assert(count($stack) == 1);
|
||||||
|
return $stack[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function flatten($node, $config, $context) {
|
||||||
|
$level = 0;
|
||||||
|
$nodes = array($level => new HTMLPurifier_Queue(array($node)));
|
||||||
|
$closingTokens = array();
|
||||||
|
$tokens = array();
|
||||||
|
do {
|
||||||
|
while (!$nodes[$level]->isEmpty()) {
|
||||||
|
$node = $nodes[$level]->shift(); // FIFO
|
||||||
|
list($start, $end) = $node->toTokenPair();
|
||||||
|
if ($level > 0) {
|
||||||
|
$tokens[] = $start;
|
||||||
|
}
|
||||||
|
if ($end !== NULL) {
|
||||||
|
$closingTokens[$level][] = $end;
|
||||||
|
}
|
||||||
|
if ($node instanceof HTMLPurifier_Node_Element) {
|
||||||
|
$level++;
|
||||||
|
$nodes[$level] = new HTMLPurifier_Queue();
|
||||||
|
foreach ($node->children as $childNode) {
|
||||||
|
$nodes[$level]->push($childNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$level--;
|
||||||
|
if ($level && isset($closingTokens[$level])) {
|
||||||
|
while ($token = array_pop($closingTokens[$level])) {
|
||||||
|
$tokens[] = $token;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while ($level > 0);
|
||||||
|
return $tokens;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,148 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines common attribute collections that modules reference
|
||||||
|
*/
|
||||||
|
|
||||||
|
class HTMLPurifier_AttrCollections
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Associative array of attribute collections, indexed by name.
|
||||||
|
* @type array
|
||||||
|
*/
|
||||||
|
public $info = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs all expansions on internal data for use by other inclusions
|
||||||
|
* It also collects all attribute collection extensions from
|
||||||
|
* modules
|
||||||
|
* @param HTMLPurifier_AttrTypes $attr_types HTMLPurifier_AttrTypes instance
|
||||||
|
* @param HTMLPurifier_HTMLModule[] $modules Hash array of HTMLPurifier_HTMLModule members
|
||||||
|
*/
|
||||||
|
public function __construct($attr_types, $modules)
|
||||||
|
{
|
||||||
|
$this->doConstruct($attr_types, $modules);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function doConstruct($attr_types, $modules)
|
||||||
|
{
|
||||||
|
// load extensions from the modules
|
||||||
|
foreach ($modules as $module) {
|
||||||
|
foreach ($module->attr_collections as $coll_i => $coll) {
|
||||||
|
if (!isset($this->info[$coll_i])) {
|
||||||
|
$this->info[$coll_i] = array();
|
||||||
|
}
|
||||||
|
foreach ($coll as $attr_i => $attr) {
|
||||||
|
if ($attr_i === 0 && isset($this->info[$coll_i][$attr_i])) {
|
||||||
|
// merge in includes
|
||||||
|
$this->info[$coll_i][$attr_i] = array_merge(
|
||||||
|
$this->info[$coll_i][$attr_i],
|
||||||
|
$attr
|
||||||
|
);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$this->info[$coll_i][$attr_i] = $attr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// perform internal expansions and inclusions
|
||||||
|
foreach ($this->info as $name => $attr) {
|
||||||
|
// merge attribute collections that include others
|
||||||
|
$this->performInclusions($this->info[$name]);
|
||||||
|
// replace string identifiers with actual attribute objects
|
||||||
|
$this->expandIdentifiers($this->info[$name], $attr_types);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takes a reference to an attribute associative array and performs
|
||||||
|
* all inclusions specified by the zero index.
|
||||||
|
* @param array &$attr Reference to attribute array
|
||||||
|
*/
|
||||||
|
public function performInclusions(&$attr)
|
||||||
|
{
|
||||||
|
if (!isset($attr[0])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$merge = $attr[0];
|
||||||
|
$seen = array(); // recursion guard
|
||||||
|
// loop through all the inclusions
|
||||||
|
for ($i = 0; isset($merge[$i]); $i++) {
|
||||||
|
if (isset($seen[$merge[$i]])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$seen[$merge[$i]] = true;
|
||||||
|
// foreach attribute of the inclusion, copy it over
|
||||||
|
if (!isset($this->info[$merge[$i]])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
foreach ($this->info[$merge[$i]] as $key => $value) {
|
||||||
|
if (isset($attr[$key])) {
|
||||||
|
continue;
|
||||||
|
} // also catches more inclusions
|
||||||
|
$attr[$key] = $value;
|
||||||
|
}
|
||||||
|
if (isset($this->info[$merge[$i]][0])) {
|
||||||
|
// recursion
|
||||||
|
$merge = array_merge($merge, $this->info[$merge[$i]][0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($attr[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expands all string identifiers in an attribute array by replacing
|
||||||
|
* them with the appropriate values inside HTMLPurifier_AttrTypes
|
||||||
|
* @param array &$attr Reference to attribute array
|
||||||
|
* @param HTMLPurifier_AttrTypes $attr_types HTMLPurifier_AttrTypes instance
|
||||||
|
*/
|
||||||
|
public function expandIdentifiers(&$attr, $attr_types)
|
||||||
|
{
|
||||||
|
// because foreach will process new elements we add, make sure we
|
||||||
|
// skip duplicates
|
||||||
|
$processed = array();
|
||||||
|
|
||||||
|
foreach ($attr as $def_i => $def) {
|
||||||
|
// skip inclusions
|
||||||
|
if ($def_i === 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($processed[$def_i])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// determine whether or not attribute is required
|
||||||
|
if ($required = (strpos($def_i, '*') !== false)) {
|
||||||
|
// rename the definition
|
||||||
|
unset($attr[$def_i]);
|
||||||
|
$def_i = trim($def_i, '*');
|
||||||
|
$attr[$def_i] = $def;
|
||||||
|
}
|
||||||
|
|
||||||
|
$processed[$def_i] = true;
|
||||||
|
|
||||||
|
// if we've already got a literal object, move on
|
||||||
|
if (is_object($def)) {
|
||||||
|
// preserve previous required
|
||||||
|
$attr[$def_i]->required = ($required || $attr[$def_i]->required);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($def === false) {
|
||||||
|
unset($attr[$def_i]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($t = $attr_types->get($def)) {
|
||||||
|
$attr[$def_i] = $t;
|
||||||
|
$attr[$def_i]->required = $required;
|
||||||
|
} else {
|
||||||
|
unset($attr[$def_i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
144
system/library/nat/phpspreadsheet_7/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef.php
vendored
Normal file
144
system/library/nat/phpspreadsheet_7/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef.php
vendored
Normal file
|
|
@ -0,0 +1,144 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class for all validating attribute definitions.
|
||||||
|
*
|
||||||
|
* This family of classes forms the core for not only HTML attribute validation,
|
||||||
|
* but also any sort of string that needs to be validated or cleaned (which
|
||||||
|
* means CSS properties and composite definitions are defined here too).
|
||||||
|
* Besides defining (through code) what precisely makes the string valid,
|
||||||
|
* subclasses are also responsible for cleaning the code if possible.
|
||||||
|
*/
|
||||||
|
|
||||||
|
abstract class HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tells us whether or not an HTML attribute is minimized.
|
||||||
|
* Has no meaning in other contexts.
|
||||||
|
* @type bool
|
||||||
|
*/
|
||||||
|
public $minimized = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tells us whether or not an HTML attribute is required.
|
||||||
|
* Has no meaning in other contexts
|
||||||
|
* @type bool
|
||||||
|
*/
|
||||||
|
public $required = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates and cleans passed string according to a definition.
|
||||||
|
*
|
||||||
|
* @param string $string String to be validated and cleaned.
|
||||||
|
* @param HTMLPurifier_Config $config Mandatory HTMLPurifier_Config object.
|
||||||
|
* @param HTMLPurifier_Context $context Mandatory HTMLPurifier_Context object.
|
||||||
|
*/
|
||||||
|
abstract public function validate($string, $config, $context);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience method that parses a string as if it were CDATA.
|
||||||
|
*
|
||||||
|
* This method process a string in the manner specified at
|
||||||
|
* <http://www.w3.org/TR/html4/types.html#h-6.2> by removing
|
||||||
|
* leading and trailing whitespace, ignoring line feeds, and replacing
|
||||||
|
* carriage returns and tabs with spaces. While most useful for HTML
|
||||||
|
* attributes specified as CDATA, it can also be applied to most CSS
|
||||||
|
* values.
|
||||||
|
*
|
||||||
|
* @note This method is not entirely standards compliant, as trim() removes
|
||||||
|
* more types of whitespace than specified in the spec. In practice,
|
||||||
|
* this is rarely a problem, as those extra characters usually have
|
||||||
|
* already been removed by HTMLPurifier_Encoder.
|
||||||
|
*
|
||||||
|
* @warning This processing is inconsistent with XML's whitespace handling
|
||||||
|
* as specified by section 3.3.3 and referenced XHTML 1.0 section
|
||||||
|
* 4.7. However, note that we are NOT necessarily
|
||||||
|
* parsing XML, thus, this behavior may still be correct. We
|
||||||
|
* assume that newlines have been normalized.
|
||||||
|
*/
|
||||||
|
public function parseCDATA($string)
|
||||||
|
{
|
||||||
|
$string = trim($string);
|
||||||
|
$string = str_replace(array("\n", "\t", "\r"), ' ', $string);
|
||||||
|
return $string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Factory method for creating this class from a string.
|
||||||
|
* @param string $string String construction info
|
||||||
|
* @return HTMLPurifier_AttrDef Created AttrDef object corresponding to $string
|
||||||
|
*/
|
||||||
|
public function make($string)
|
||||||
|
{
|
||||||
|
// default implementation, return a flyweight of this object.
|
||||||
|
// If $string has an effect on the returned object (i.e. you
|
||||||
|
// need to overload this method), it is best
|
||||||
|
// to clone or instantiate new copies. (Instantiation is safer.)
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes spaces from rgb(0, 0, 0) so that shorthand CSS properties work
|
||||||
|
* properly. THIS IS A HACK!
|
||||||
|
* @param string $string a CSS colour definition
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function mungeRgb($string)
|
||||||
|
{
|
||||||
|
$p = '\s*(\d+(\.\d+)?([%]?))\s*';
|
||||||
|
|
||||||
|
if (preg_match('/(rgba|hsla)\(/', $string)) {
|
||||||
|
return preg_replace('/(rgba|hsla)\('.$p.','.$p.','.$p.','.$p.'\)/', '\1(\2,\5,\8,\11)', $string);
|
||||||
|
}
|
||||||
|
|
||||||
|
return preg_replace('/(rgb|hsl)\('.$p.','.$p.','.$p.'\)/', '\1(\2,\5,\8)', $string);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses a possibly escaped CSS string and returns the "pure"
|
||||||
|
* version of it.
|
||||||
|
*/
|
||||||
|
protected function expandCSSEscape($string)
|
||||||
|
{
|
||||||
|
// flexibly parse it
|
||||||
|
$ret = '';
|
||||||
|
for ($i = 0, $c = strlen($string); $i < $c; $i++) {
|
||||||
|
if ($string[$i] === '\\') {
|
||||||
|
$i++;
|
||||||
|
if ($i >= $c) {
|
||||||
|
$ret .= '\\';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (ctype_xdigit($string[$i])) {
|
||||||
|
$code = $string[$i];
|
||||||
|
for ($a = 1, $i++; $i < $c && $a < 6; $i++, $a++) {
|
||||||
|
if (!ctype_xdigit($string[$i])) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$code .= $string[$i];
|
||||||
|
}
|
||||||
|
// We have to be extremely careful when adding
|
||||||
|
// new characters, to make sure we're not breaking
|
||||||
|
// the encoding.
|
||||||
|
$char = HTMLPurifier_Encoder::unichr(hexdec($code));
|
||||||
|
if (HTMLPurifier_Encoder::cleanUTF8($char) === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$ret .= $char;
|
||||||
|
if ($i < $c && trim($string[$i]) !== '') {
|
||||||
|
$i--;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($string[$i] === "\n") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$ret .= $string[$i];
|
||||||
|
}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
136
system/library/nat/phpspreadsheet_7/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS.php
vendored
Normal file
136
system/library/nat/phpspreadsheet_7/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/CSS.php
vendored
Normal file
|
|
@ -0,0 +1,136 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the HTML attribute style, otherwise known as CSS.
|
||||||
|
* @note We don't implement the whole CSS specification, so it might be
|
||||||
|
* difficult to reuse this component in the context of validating
|
||||||
|
* actual stylesheet declarations.
|
||||||
|
* @note If we were really serious about validating the CSS, we would
|
||||||
|
* tokenize the styles and then parse the tokens. Obviously, we
|
||||||
|
* are not doing that. Doing that could seriously harm performance,
|
||||||
|
* but would make these components a lot more viable for a CSS
|
||||||
|
* filtering solution.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_CSS extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $css
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($css, $config, $context)
|
||||||
|
{
|
||||||
|
$css = $this->parseCDATA($css);
|
||||||
|
|
||||||
|
$definition = $config->getCSSDefinition();
|
||||||
|
$allow_duplicates = $config->get("CSS.AllowDuplicates");
|
||||||
|
|
||||||
|
|
||||||
|
// According to the CSS2.1 spec, the places where a
|
||||||
|
// non-delimiting semicolon can appear are in strings
|
||||||
|
// escape sequences. So here is some dumb hack to
|
||||||
|
// handle quotes.
|
||||||
|
$len = strlen($css);
|
||||||
|
$accum = "";
|
||||||
|
$declarations = array();
|
||||||
|
$quoted = false;
|
||||||
|
for ($i = 0; $i < $len; $i++) {
|
||||||
|
$c = strcspn($css, ";'\"", $i);
|
||||||
|
$accum .= substr($css, $i, $c);
|
||||||
|
$i += $c;
|
||||||
|
if ($i == $len) break;
|
||||||
|
$d = $css[$i];
|
||||||
|
if ($quoted) {
|
||||||
|
$accum .= $d;
|
||||||
|
if ($d == $quoted) {
|
||||||
|
$quoted = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($d == ";") {
|
||||||
|
$declarations[] = $accum;
|
||||||
|
$accum = "";
|
||||||
|
} else {
|
||||||
|
$accum .= $d;
|
||||||
|
$quoted = $d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($accum != "") $declarations[] = $accum;
|
||||||
|
|
||||||
|
$propvalues = array();
|
||||||
|
$new_declarations = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the current CSS property being validated.
|
||||||
|
*/
|
||||||
|
$property = false;
|
||||||
|
$context->register('CurrentCSSProperty', $property);
|
||||||
|
|
||||||
|
foreach ($declarations as $declaration) {
|
||||||
|
if (!$declaration) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!strpos($declaration, ':')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
list($property, $value) = explode(':', $declaration, 2);
|
||||||
|
$property = trim($property);
|
||||||
|
$value = trim($value);
|
||||||
|
$ok = false;
|
||||||
|
do {
|
||||||
|
if (isset($definition->info[$property])) {
|
||||||
|
$ok = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (ctype_lower($property)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$property = strtolower($property);
|
||||||
|
if (isset($definition->info[$property])) {
|
||||||
|
$ok = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while (0);
|
||||||
|
if (!$ok) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// inefficient call, since the validator will do this again
|
||||||
|
if (strtolower(trim($value)) !== 'inherit') {
|
||||||
|
// inherit works for everything (but only on the base property)
|
||||||
|
$result = $definition->info[$property]->validate(
|
||||||
|
$value,
|
||||||
|
$config,
|
||||||
|
$context
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$result = 'inherit';
|
||||||
|
}
|
||||||
|
if ($result === false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($allow_duplicates) {
|
||||||
|
$new_declarations .= "$property:$result;";
|
||||||
|
} else {
|
||||||
|
$propvalues[$property] = $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$context->destroy('CurrentCSSProperty');
|
||||||
|
|
||||||
|
// procedure does not write the new CSS simultaneously, so it's
|
||||||
|
// slightly inefficient, but it's the only way of getting rid of
|
||||||
|
// duplicates. Perhaps config to optimize it, but not now.
|
||||||
|
|
||||||
|
foreach ($propvalues as $prop => $value) {
|
||||||
|
$new_declarations .= "$prop:$value;";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $new_declarations ? $new_declarations : false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class HTMLPurifier_AttrDef_CSS_AlphaValue extends HTMLPurifier_AttrDef_CSS_Number
|
||||||
|
{
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct(false); // opacity is non-negative, but we will clamp it
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $number
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function validate($number, $config, $context)
|
||||||
|
{
|
||||||
|
$result = parent::validate($number, $config, $context);
|
||||||
|
if ($result === false) {
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
$float = (float)$result;
|
||||||
|
if ($float < 0.0) {
|
||||||
|
$result = '0';
|
||||||
|
}
|
||||||
|
if ($float > 1.0) {
|
||||||
|
$result = '1';
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates shorthand CSS property background.
|
||||||
|
* @warning Does not support url tokens that have internal spaces.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_CSS_Background extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Local copy of component validators.
|
||||||
|
* @type HTMLPurifier_AttrDef[]
|
||||||
|
* @note See HTMLPurifier_AttrDef_Font::$info for a similar impl.
|
||||||
|
*/
|
||||||
|
protected $info;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
*/
|
||||||
|
public function __construct($config)
|
||||||
|
{
|
||||||
|
$def = $config->getCSSDefinition();
|
||||||
|
$this->info['background-color'] = $def->info['background-color'];
|
||||||
|
$this->info['background-image'] = $def->info['background-image'];
|
||||||
|
$this->info['background-repeat'] = $def->info['background-repeat'];
|
||||||
|
$this->info['background-attachment'] = $def->info['background-attachment'];
|
||||||
|
$this->info['background-position'] = $def->info['background-position'];
|
||||||
|
$this->info['background-size'] = $def->info['background-size'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
// regular pre-processing
|
||||||
|
$string = $this->parseCDATA($string);
|
||||||
|
if ($string === '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// munge rgb() decl if necessary
|
||||||
|
$string = $this->mungeRgb($string);
|
||||||
|
|
||||||
|
// assumes URI doesn't have spaces in it
|
||||||
|
$bits = explode(' ', $string); // bits to process
|
||||||
|
|
||||||
|
$caught = array();
|
||||||
|
$caught['color'] = false;
|
||||||
|
$caught['image'] = false;
|
||||||
|
$caught['repeat'] = false;
|
||||||
|
$caught['attachment'] = false;
|
||||||
|
$caught['position'] = false;
|
||||||
|
$caught['size'] = false;
|
||||||
|
|
||||||
|
$i = 0; // number of catches
|
||||||
|
|
||||||
|
foreach ($bits as $bit) {
|
||||||
|
if ($bit === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
foreach ($caught as $key => $status) {
|
||||||
|
if ($key != 'position') {
|
||||||
|
if ($status !== false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$r = $this->info['background-' . $key]->validate($bit, $config, $context);
|
||||||
|
} else {
|
||||||
|
$r = $bit;
|
||||||
|
}
|
||||||
|
if ($r === false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($key == 'position') {
|
||||||
|
if ($caught[$key] === false) {
|
||||||
|
$caught[$key] = '';
|
||||||
|
}
|
||||||
|
$caught[$key] .= $r . ' ';
|
||||||
|
} else {
|
||||||
|
$caught[$key] = $r;
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$i) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ($caught['position'] !== false) {
|
||||||
|
$caught['position'] = $this->info['background-position']->
|
||||||
|
validate($caught['position'], $config, $context);
|
||||||
|
}
|
||||||
|
|
||||||
|
$ret = array();
|
||||||
|
foreach ($caught as $value) {
|
||||||
|
if ($value === false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$ret[] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($ret)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return implode(' ', $ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,157 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/* W3C says:
|
||||||
|
[ // adjective and number must be in correct order, even if
|
||||||
|
// you could switch them without introducing ambiguity.
|
||||||
|
// some browsers support that syntax
|
||||||
|
[
|
||||||
|
<percentage> | <length> | left | center | right
|
||||||
|
]
|
||||||
|
[
|
||||||
|
<percentage> | <length> | top | center | bottom
|
||||||
|
]?
|
||||||
|
] |
|
||||||
|
[ // this signifies that the vertical and horizontal adjectives
|
||||||
|
// can be arbitrarily ordered, however, there can only be two,
|
||||||
|
// one of each, or none at all
|
||||||
|
[
|
||||||
|
left | center | right
|
||||||
|
] ||
|
||||||
|
[
|
||||||
|
top | center | bottom
|
||||||
|
]
|
||||||
|
]
|
||||||
|
top, left = 0%
|
||||||
|
center, (none) = 50%
|
||||||
|
bottom, right = 100%
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* QuirksMode says:
|
||||||
|
keyword + length/percentage must be ordered correctly, as per W3C
|
||||||
|
|
||||||
|
Internet Explorer and Opera, however, support arbitrary ordering. We
|
||||||
|
should fix it up.
|
||||||
|
|
||||||
|
Minor issue though, not strictly necessary.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// control freaks may appreciate the ability to convert these to
|
||||||
|
// percentages or something, but it's not necessary
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the value of background-position.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_CSS_BackgroundPosition extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type HTMLPurifier_AttrDef_CSS_Length
|
||||||
|
*/
|
||||||
|
protected $length;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type HTMLPurifier_AttrDef_CSS_Percentage
|
||||||
|
*/
|
||||||
|
protected $percentage;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->length = new HTMLPurifier_AttrDef_CSS_Length();
|
||||||
|
$this->percentage = new HTMLPurifier_AttrDef_CSS_Percentage();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
$string = $this->parseCDATA($string);
|
||||||
|
$bits = explode(' ', $string);
|
||||||
|
|
||||||
|
$keywords = array();
|
||||||
|
$keywords['h'] = false; // left, right
|
||||||
|
$keywords['v'] = false; // top, bottom
|
||||||
|
$keywords['ch'] = false; // center (first word)
|
||||||
|
$keywords['cv'] = false; // center (second word)
|
||||||
|
$measures = array();
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
$lookup = array(
|
||||||
|
'top' => 'v',
|
||||||
|
'bottom' => 'v',
|
||||||
|
'left' => 'h',
|
||||||
|
'right' => 'h',
|
||||||
|
'center' => 'c'
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($bits as $bit) {
|
||||||
|
if ($bit === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// test for keyword
|
||||||
|
$lbit = ctype_lower($bit) ? $bit : strtolower($bit);
|
||||||
|
if (isset($lookup[$lbit])) {
|
||||||
|
$status = $lookup[$lbit];
|
||||||
|
if ($status == 'c') {
|
||||||
|
if ($i == 0) {
|
||||||
|
$status = 'ch';
|
||||||
|
} else {
|
||||||
|
$status = 'cv';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$keywords[$status] = $lbit;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// test for length
|
||||||
|
$r = $this->length->validate($bit, $config, $context);
|
||||||
|
if ($r !== false) {
|
||||||
|
$measures[] = $r;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// test for percentage
|
||||||
|
$r = $this->percentage->validate($bit, $config, $context);
|
||||||
|
if ($r !== false) {
|
||||||
|
$measures[] = $r;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$i) {
|
||||||
|
return false;
|
||||||
|
} // no valid values were caught
|
||||||
|
|
||||||
|
$ret = array();
|
||||||
|
|
||||||
|
// first keyword
|
||||||
|
if ($keywords['h']) {
|
||||||
|
$ret[] = $keywords['h'];
|
||||||
|
} elseif ($keywords['ch']) {
|
||||||
|
$ret[] = $keywords['ch'];
|
||||||
|
$keywords['cv'] = false; // prevent re-use: center = center center
|
||||||
|
} elseif (count($measures)) {
|
||||||
|
$ret[] = array_shift($measures);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($keywords['v']) {
|
||||||
|
$ret[] = $keywords['v'];
|
||||||
|
} elseif ($keywords['cv']) {
|
||||||
|
$ret[] = $keywords['cv'];
|
||||||
|
} elseif (count($measures)) {
|
||||||
|
$ret[] = array_shift($measures);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($ret)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return implode(' ', $ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the border property as defined by CSS.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_CSS_Border extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Local copy of properties this property is shorthand for.
|
||||||
|
* @type HTMLPurifier_AttrDef[]
|
||||||
|
*/
|
||||||
|
protected $info = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
*/
|
||||||
|
public function __construct($config)
|
||||||
|
{
|
||||||
|
$def = $config->getCSSDefinition();
|
||||||
|
$this->info['border-width'] = $def->info['border-width'];
|
||||||
|
$this->info['border-style'] = $def->info['border-style'];
|
||||||
|
$this->info['border-top-color'] = $def->info['border-top-color'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
$string = $this->parseCDATA($string);
|
||||||
|
$string = $this->mungeRgb($string);
|
||||||
|
$bits = explode(' ', $string);
|
||||||
|
$done = array(); // segments we've finished
|
||||||
|
$ret = ''; // return value
|
||||||
|
foreach ($bits as $bit) {
|
||||||
|
foreach ($this->info as $propname => $validator) {
|
||||||
|
if (isset($done[$propname])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$r = $validator->validate($bit, $config, $context);
|
||||||
|
if ($r !== false) {
|
||||||
|
$ret .= $r . ' ';
|
||||||
|
$done[$propname] = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rtrim($ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,161 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates Color as defined by CSS.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_CSS_Color extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type HTMLPurifier_AttrDef_CSS_AlphaValue
|
||||||
|
*/
|
||||||
|
protected $alpha;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->alpha = new HTMLPurifier_AttrDef_CSS_AlphaValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $color
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($color, $config, $context)
|
||||||
|
{
|
||||||
|
static $colors = null;
|
||||||
|
if ($colors === null) {
|
||||||
|
$colors = $config->get('Core.ColorKeywords');
|
||||||
|
}
|
||||||
|
|
||||||
|
$color = trim($color);
|
||||||
|
if ($color === '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$lower = strtolower($color);
|
||||||
|
if (isset($colors[$lower])) {
|
||||||
|
return $colors[$lower];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (preg_match('#(rgb|rgba|hsl|hsla)\(#', $color, $matches) === 1) {
|
||||||
|
$length = strlen($color);
|
||||||
|
if (strpos($color, ')') !== $length - 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get used function : rgb, rgba, hsl or hsla
|
||||||
|
$function = $matches[1];
|
||||||
|
|
||||||
|
$parameters_size = 3;
|
||||||
|
$alpha_channel = false;
|
||||||
|
if (substr($function, -1) === 'a') {
|
||||||
|
$parameters_size = 4;
|
||||||
|
$alpha_channel = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Allowed types for values :
|
||||||
|
* parameter_position => [type => max_value]
|
||||||
|
*/
|
||||||
|
$allowed_types = array(
|
||||||
|
1 => array('percentage' => 100, 'integer' => 255),
|
||||||
|
2 => array('percentage' => 100, 'integer' => 255),
|
||||||
|
3 => array('percentage' => 100, 'integer' => 255),
|
||||||
|
);
|
||||||
|
$allow_different_types = false;
|
||||||
|
|
||||||
|
if (strpos($function, 'hsl') !== false) {
|
||||||
|
$allowed_types = array(
|
||||||
|
1 => array('integer' => 360),
|
||||||
|
2 => array('percentage' => 100),
|
||||||
|
3 => array('percentage' => 100),
|
||||||
|
);
|
||||||
|
$allow_different_types = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$values = trim(str_replace($function, '', $color), ' ()');
|
||||||
|
|
||||||
|
$parts = explode(',', $values);
|
||||||
|
if (count($parts) !== $parameters_size) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$type = false;
|
||||||
|
$new_parts = array();
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
foreach ($parts as $part) {
|
||||||
|
$i++;
|
||||||
|
$part = trim($part);
|
||||||
|
|
||||||
|
if ($part === '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// different check for alpha channel
|
||||||
|
if ($alpha_channel === true && $i === count($parts)) {
|
||||||
|
$result = $this->alpha->validate($part, $config, $context);
|
||||||
|
|
||||||
|
if ($result === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$new_parts[] = (string)$result;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (substr($part, -1) === '%') {
|
||||||
|
$current_type = 'percentage';
|
||||||
|
} else {
|
||||||
|
$current_type = 'integer';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!array_key_exists($current_type, $allowed_types[$i])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$type) {
|
||||||
|
$type = $current_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($allow_different_types === false && $type != $current_type) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$max_value = $allowed_types[$i][$current_type];
|
||||||
|
|
||||||
|
if ($current_type == 'integer') {
|
||||||
|
// Return value between range 0 -> $max_value
|
||||||
|
$new_parts[] = (int)max(min($part, $max_value), 0);
|
||||||
|
} elseif ($current_type == 'percentage') {
|
||||||
|
$new_parts[] = (float)max(min(rtrim($part, '%'), $max_value), 0) . '%';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$new_values = implode(',', $new_parts);
|
||||||
|
|
||||||
|
$color = $function . '(' . $new_values . ')';
|
||||||
|
} else {
|
||||||
|
// hexadecimal handling
|
||||||
|
if ($color[0] === '#') {
|
||||||
|
$hex = substr($color, 1);
|
||||||
|
} else {
|
||||||
|
$hex = $color;
|
||||||
|
$color = '#' . $color;
|
||||||
|
}
|
||||||
|
$length = strlen($hex);
|
||||||
|
if ($length !== 3 && $length !== 6) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!ctype_xdigit($hex)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $color;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows multiple validators to attempt to validate attribute.
|
||||||
|
*
|
||||||
|
* Composite is just what it sounds like: a composite of many validators.
|
||||||
|
* This means that multiple HTMLPurifier_AttrDef objects will have a whack
|
||||||
|
* at the string. If one of them passes, that's what is returned. This is
|
||||||
|
* especially useful for CSS values, which often are a choice between
|
||||||
|
* an enumerated set of predefined values or a flexible data type.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_CSS_Composite extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of objects that may process strings.
|
||||||
|
* @type HTMLPurifier_AttrDef[]
|
||||||
|
* @todo Make protected
|
||||||
|
*/
|
||||||
|
public $defs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param HTMLPurifier_AttrDef[] $defs List of HTMLPurifier_AttrDef objects
|
||||||
|
*/
|
||||||
|
public function __construct($defs)
|
||||||
|
{
|
||||||
|
$this->defs = $defs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
foreach ($this->defs as $i => $def) {
|
||||||
|
$result = $this->defs[$i]->validate($string, $config, $context);
|
||||||
|
if ($result !== false) {
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decorator which enables CSS properties to be disabled for specific elements.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_CSS_DenyElementDecorator extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @type HTMLPurifier_AttrDef
|
||||||
|
*/
|
||||||
|
public $def;
|
||||||
|
/**
|
||||||
|
* @type string
|
||||||
|
*/
|
||||||
|
public $element;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param HTMLPurifier_AttrDef $def Definition to wrap
|
||||||
|
* @param string $element Element to deny
|
||||||
|
*/
|
||||||
|
public function __construct($def, $element)
|
||||||
|
{
|
||||||
|
$this->def = $def;
|
||||||
|
$this->element = $element;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if CurrentToken is set and equal to $this->element
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
$token = $context->get('CurrentToken', true);
|
||||||
|
if ($token && $token->name == $this->element) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return $this->def->validate($string, $config, $context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Microsoft's proprietary filter: CSS property
|
||||||
|
* @note Currently supports the alpha filter. In the future, this will
|
||||||
|
* probably need an extensible framework
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_CSS_Filter extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @type HTMLPurifier_AttrDef_Integer
|
||||||
|
*/
|
||||||
|
protected $intValidator;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->intValidator = new HTMLPurifier_AttrDef_Integer();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $value
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($value, $config, $context)
|
||||||
|
{
|
||||||
|
$value = $this->parseCDATA($value);
|
||||||
|
if ($value === 'none') {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
// if we looped this we could support multiple filters
|
||||||
|
$function_length = strcspn($value, '(');
|
||||||
|
$function = trim(substr($value, 0, $function_length));
|
||||||
|
if ($function !== 'alpha' &&
|
||||||
|
$function !== 'Alpha' &&
|
||||||
|
$function !== 'progid:DXImageTransform.Microsoft.Alpha'
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$cursor = $function_length + 1;
|
||||||
|
$parameters_length = strcspn($value, ')', $cursor);
|
||||||
|
$parameters = substr($value, $cursor, $parameters_length);
|
||||||
|
$params = explode(',', $parameters);
|
||||||
|
$ret_params = array();
|
||||||
|
$lookup = array();
|
||||||
|
foreach ($params as $param) {
|
||||||
|
list($key, $value) = explode('=', $param);
|
||||||
|
$key = trim($key);
|
||||||
|
$value = trim($value);
|
||||||
|
if (isset($lookup[$key])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($key !== 'opacity') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$value = $this->intValidator->validate($value, $config, $context);
|
||||||
|
if ($value === false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$int = (int)$value;
|
||||||
|
if ($int > 100) {
|
||||||
|
$value = '100';
|
||||||
|
}
|
||||||
|
if ($int < 0) {
|
||||||
|
$value = '0';
|
||||||
|
}
|
||||||
|
$ret_params[] = "$key=$value";
|
||||||
|
$lookup[$key] = true;
|
||||||
|
}
|
||||||
|
$ret_parameters = implode(',', $ret_params);
|
||||||
|
$ret_function = "$function($ret_parameters)";
|
||||||
|
return $ret_function;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,176 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates shorthand CSS property font.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_CSS_Font extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Local copy of validators
|
||||||
|
* @type HTMLPurifier_AttrDef[]
|
||||||
|
* @note If we moved specific CSS property definitions to their own
|
||||||
|
* classes instead of having them be assembled at run time by
|
||||||
|
* CSSDefinition, this wouldn't be necessary. We'd instantiate
|
||||||
|
* our own copies.
|
||||||
|
*/
|
||||||
|
protected $info = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
*/
|
||||||
|
public function __construct($config)
|
||||||
|
{
|
||||||
|
$def = $config->getCSSDefinition();
|
||||||
|
$this->info['font-style'] = $def->info['font-style'];
|
||||||
|
$this->info['font-variant'] = $def->info['font-variant'];
|
||||||
|
$this->info['font-weight'] = $def->info['font-weight'];
|
||||||
|
$this->info['font-size'] = $def->info['font-size'];
|
||||||
|
$this->info['line-height'] = $def->info['line-height'];
|
||||||
|
$this->info['font-family'] = $def->info['font-family'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
static $system_fonts = array(
|
||||||
|
'caption' => true,
|
||||||
|
'icon' => true,
|
||||||
|
'menu' => true,
|
||||||
|
'message-box' => true,
|
||||||
|
'small-caption' => true,
|
||||||
|
'status-bar' => true
|
||||||
|
);
|
||||||
|
|
||||||
|
// regular pre-processing
|
||||||
|
$string = $this->parseCDATA($string);
|
||||||
|
if ($string === '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if it's one of the keywords
|
||||||
|
$lowercase_string = strtolower($string);
|
||||||
|
if (isset($system_fonts[$lowercase_string])) {
|
||||||
|
return $lowercase_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
$bits = explode(' ', $string); // bits to process
|
||||||
|
$stage = 0; // this indicates what we're looking for
|
||||||
|
$caught = array(); // which stage 0 properties have we caught?
|
||||||
|
$stage_1 = array('font-style', 'font-variant', 'font-weight');
|
||||||
|
$final = ''; // output
|
||||||
|
|
||||||
|
for ($i = 0, $size = count($bits); $i < $size; $i++) {
|
||||||
|
if ($bits[$i] === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
switch ($stage) {
|
||||||
|
case 0: // attempting to catch font-style, font-variant or font-weight
|
||||||
|
foreach ($stage_1 as $validator_name) {
|
||||||
|
if (isset($caught[$validator_name])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$r = $this->info[$validator_name]->validate(
|
||||||
|
$bits[$i],
|
||||||
|
$config,
|
||||||
|
$context
|
||||||
|
);
|
||||||
|
if ($r !== false) {
|
||||||
|
$final .= $r . ' ';
|
||||||
|
$caught[$validator_name] = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// all three caught, continue on
|
||||||
|
if (count($caught) >= 3) {
|
||||||
|
$stage = 1;
|
||||||
|
}
|
||||||
|
if ($r !== false) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 1: // attempting to catch font-size and perhaps line-height
|
||||||
|
$found_slash = false;
|
||||||
|
if (strpos($bits[$i], '/') !== false) {
|
||||||
|
list($font_size, $line_height) =
|
||||||
|
explode('/', $bits[$i]);
|
||||||
|
if ($line_height === '') {
|
||||||
|
// ooh, there's a space after the slash!
|
||||||
|
$line_height = false;
|
||||||
|
$found_slash = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$font_size = $bits[$i];
|
||||||
|
$line_height = false;
|
||||||
|
}
|
||||||
|
$r = $this->info['font-size']->validate(
|
||||||
|
$font_size,
|
||||||
|
$config,
|
||||||
|
$context
|
||||||
|
);
|
||||||
|
if ($r !== false) {
|
||||||
|
$final .= $r;
|
||||||
|
// attempt to catch line-height
|
||||||
|
if ($line_height === false) {
|
||||||
|
// we need to scroll forward
|
||||||
|
for ($j = $i + 1; $j < $size; $j++) {
|
||||||
|
if ($bits[$j] === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($bits[$j] === '/') {
|
||||||
|
if ($found_slash) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
$found_slash = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$line_height = $bits[$j];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// slash already found
|
||||||
|
$found_slash = true;
|
||||||
|
$j = $i;
|
||||||
|
}
|
||||||
|
if ($found_slash) {
|
||||||
|
$i = $j;
|
||||||
|
$r = $this->info['line-height']->validate(
|
||||||
|
$line_height,
|
||||||
|
$config,
|
||||||
|
$context
|
||||||
|
);
|
||||||
|
if ($r !== false) {
|
||||||
|
$final .= '/' . $r;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$final .= ' ';
|
||||||
|
$stage = 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
case 2: // attempting to catch font-family
|
||||||
|
$font_family =
|
||||||
|
implode(' ', array_slice($bits, $i, $size - $i));
|
||||||
|
$r = $this->info['font-family']->validate(
|
||||||
|
$font_family,
|
||||||
|
$config,
|
||||||
|
$context
|
||||||
|
);
|
||||||
|
if ($r !== false) {
|
||||||
|
$final .= $r . ' ';
|
||||||
|
// processing completed successfully
|
||||||
|
return rtrim($final);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,219 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates a font family list according to CSS spec
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_CSS_FontFamily extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $mask = null;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->mask = '_- ';
|
||||||
|
for ($c = 'a'; $c <= 'z'; $c++) {
|
||||||
|
$this->mask .= $c;
|
||||||
|
}
|
||||||
|
for ($c = 'A'; $c <= 'Z'; $c++) {
|
||||||
|
$this->mask .= $c;
|
||||||
|
}
|
||||||
|
for ($c = '0'; $c <= '9'; $c++) {
|
||||||
|
$this->mask .= $c;
|
||||||
|
} // cast-y, but should be fine
|
||||||
|
// special bytes used by UTF-8
|
||||||
|
for ($i = 0x80; $i <= 0xFF; $i++) {
|
||||||
|
// We don't bother excluding invalid bytes in this range,
|
||||||
|
// because the our restriction of well-formed UTF-8 will
|
||||||
|
// prevent these from ever occurring.
|
||||||
|
$this->mask .= chr($i);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
PHP's internal strcspn implementation is
|
||||||
|
O(length of string * length of mask), making it inefficient
|
||||||
|
for large masks. However, it's still faster than
|
||||||
|
preg_match 8)
|
||||||
|
for (p = s1;;) {
|
||||||
|
spanp = s2;
|
||||||
|
do {
|
||||||
|
if (*spanp == c || p == s1_end) {
|
||||||
|
return p - s1;
|
||||||
|
}
|
||||||
|
} while (spanp++ < (s2_end - 1));
|
||||||
|
c = *++p;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
// possible optimization: invert the mask.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
static $generic_names = array(
|
||||||
|
'serif' => true,
|
||||||
|
'sans-serif' => true,
|
||||||
|
'monospace' => true,
|
||||||
|
'fantasy' => true,
|
||||||
|
'cursive' => true
|
||||||
|
);
|
||||||
|
$allowed_fonts = $config->get('CSS.AllowedFonts');
|
||||||
|
|
||||||
|
// assume that no font names contain commas in them
|
||||||
|
$fonts = explode(',', $string);
|
||||||
|
$final = '';
|
||||||
|
foreach ($fonts as $font) {
|
||||||
|
$font = trim($font);
|
||||||
|
if ($font === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// match a generic name
|
||||||
|
if (isset($generic_names[$font])) {
|
||||||
|
if ($allowed_fonts === null || isset($allowed_fonts[$font])) {
|
||||||
|
$final .= $font . ', ';
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// match a quoted name
|
||||||
|
if ($font[0] === '"' || $font[0] === "'") {
|
||||||
|
$length = strlen($font);
|
||||||
|
if ($length <= 2) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$quote = $font[0];
|
||||||
|
if ($font[$length - 1] !== $quote) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$font = substr($font, 1, $length - 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
$font = $this->expandCSSEscape($font);
|
||||||
|
|
||||||
|
// $font is a pure representation of the font name
|
||||||
|
|
||||||
|
if ($allowed_fonts !== null && !isset($allowed_fonts[$font])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctype_alnum($font) && $font !== '') {
|
||||||
|
// very simple font, allow it in unharmed
|
||||||
|
$final .= $font . ', ';
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// bugger out on whitespace. form feed (0C) really
|
||||||
|
// shouldn't show up regardless
|
||||||
|
$font = str_replace(array("\n", "\t", "\r", "\x0C"), ' ', $font);
|
||||||
|
|
||||||
|
// Here, there are various classes of characters which need
|
||||||
|
// to be treated differently:
|
||||||
|
// - Alphanumeric characters are essentially safe. We
|
||||||
|
// handled these above.
|
||||||
|
// - Spaces require quoting, though most parsers will do
|
||||||
|
// the right thing if there aren't any characters that
|
||||||
|
// can be misinterpreted
|
||||||
|
// - Dashes rarely occur, but they fairly unproblematic
|
||||||
|
// for parsing/rendering purposes.
|
||||||
|
// The above characters cover the majority of Western font
|
||||||
|
// names.
|
||||||
|
// - Arbitrary Unicode characters not in ASCII. Because
|
||||||
|
// most parsers give little thought to Unicode, treatment
|
||||||
|
// of these codepoints is basically uniform, even for
|
||||||
|
// punctuation-like codepoints. These characters can
|
||||||
|
// show up in non-Western pages and are supported by most
|
||||||
|
// major browsers, for example: "MS 明朝" is a
|
||||||
|
// legitimate font-name
|
||||||
|
// <http://ja.wikipedia.org/wiki/MS_明朝>. See
|
||||||
|
// the CSS3 spec for more examples:
|
||||||
|
// <http://www.w3.org/TR/2011/WD-css3-fonts-20110324/localizedfamilynames.png>
|
||||||
|
// You can see live samples of these on the Internet:
|
||||||
|
// <http://www.google.co.jp/search?q=font-family+MS+明朝|ゴシック>
|
||||||
|
// However, most of these fonts have ASCII equivalents:
|
||||||
|
// for example, 'MS Mincho', and it's considered
|
||||||
|
// professional to use ASCII font names instead of
|
||||||
|
// Unicode font names. Thanks Takeshi Terada for
|
||||||
|
// providing this information.
|
||||||
|
// The following characters, to my knowledge, have not been
|
||||||
|
// used to name font names.
|
||||||
|
// - Single quote. While theoretically you might find a
|
||||||
|
// font name that has a single quote in its name (serving
|
||||||
|
// as an apostrophe, e.g. Dave's Scribble), I haven't
|
||||||
|
// been able to find any actual examples of this.
|
||||||
|
// Internet Explorer's cssText translation (which I
|
||||||
|
// believe is invoked by innerHTML) normalizes any
|
||||||
|
// quoting to single quotes, and fails to escape single
|
||||||
|
// quotes. (Note that this is not IE's behavior for all
|
||||||
|
// CSS properties, just some sort of special casing for
|
||||||
|
// font-family). So a single quote *cannot* be used
|
||||||
|
// safely in the font-family context if there will be an
|
||||||
|
// innerHTML/cssText translation. Note that Firefox 3.x
|
||||||
|
// does this too.
|
||||||
|
// - Double quote. In IE, these get normalized to
|
||||||
|
// single-quotes, no matter what the encoding. (Fun
|
||||||
|
// fact, in IE8, the 'content' CSS property gained
|
||||||
|
// support, where they special cased to preserve encoded
|
||||||
|
// double quotes, but still translate unadorned double
|
||||||
|
// quotes into single quotes.) So, because their
|
||||||
|
// fixpoint behavior is identical to single quotes, they
|
||||||
|
// cannot be allowed either. Firefox 3.x displays
|
||||||
|
// single-quote style behavior.
|
||||||
|
// - Backslashes are reduced by one (so \\ -> \) every
|
||||||
|
// iteration, so they cannot be used safely. This shows
|
||||||
|
// up in IE7, IE8 and FF3
|
||||||
|
// - Semicolons, commas and backticks are handled properly.
|
||||||
|
// - The rest of the ASCII punctuation is handled properly.
|
||||||
|
// We haven't checked what browsers do to unadorned
|
||||||
|
// versions, but this is not important as long as the
|
||||||
|
// browser doesn't /remove/ surrounding quotes (as IE does
|
||||||
|
// for HTML).
|
||||||
|
//
|
||||||
|
// With these results in hand, we conclude that there are
|
||||||
|
// various levels of safety:
|
||||||
|
// - Paranoid: alphanumeric, spaces and dashes(?)
|
||||||
|
// - International: Paranoid + non-ASCII Unicode
|
||||||
|
// - Edgy: Everything except quotes, backslashes
|
||||||
|
// - NoJS: Standards compliance, e.g. sod IE. Note that
|
||||||
|
// with some judicious character escaping (since certain
|
||||||
|
// types of escaping doesn't work) this is theoretically
|
||||||
|
// OK as long as innerHTML/cssText is not called.
|
||||||
|
// We believe that international is a reasonable default
|
||||||
|
// (that we will implement now), and once we do more
|
||||||
|
// extensive research, we may feel comfortable with dropping
|
||||||
|
// it down to edgy.
|
||||||
|
|
||||||
|
// Edgy: alphanumeric, spaces, dashes, underscores and Unicode. Use of
|
||||||
|
// str(c)spn assumes that the string was already well formed
|
||||||
|
// Unicode (which of course it is).
|
||||||
|
if (strspn($font, $this->mask) !== strlen($font)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Historical:
|
||||||
|
// In the absence of innerHTML/cssText, these ugly
|
||||||
|
// transforms don't pose a security risk (as \\ and \"
|
||||||
|
// might--these escapes are not supported by most browsers).
|
||||||
|
// We could try to be clever and use single-quote wrapping
|
||||||
|
// when there is a double quote present, but I have choosen
|
||||||
|
// not to implement that. (NOTE: you can reduce the amount
|
||||||
|
// of escapes by one depending on what quoting style you use)
|
||||||
|
// $font = str_replace('\\', '\\5C ', $font);
|
||||||
|
// $font = str_replace('"', '\\22 ', $font);
|
||||||
|
// $font = str_replace("'", '\\27 ', $font);
|
||||||
|
|
||||||
|
// font possibly with spaces, requires quoting
|
||||||
|
$final .= "'$font', ";
|
||||||
|
}
|
||||||
|
$final = rtrim($final, ', ');
|
||||||
|
if ($final === '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return $final;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates based on {ident} CSS grammar production
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_CSS_Ident extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
$string = trim($string);
|
||||||
|
|
||||||
|
// early abort: '' and '0' (strings that convert to false) are invalid
|
||||||
|
if (!$string) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pattern = '/^(-?[A-Za-z_][A-Za-z_\-0-9]*)$/';
|
||||||
|
if (!preg_match($pattern, $string)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return $string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decorator which enables !important to be used in CSS values.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_CSS_ImportantDecorator extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @type HTMLPurifier_AttrDef
|
||||||
|
*/
|
||||||
|
public $def;
|
||||||
|
/**
|
||||||
|
* @type bool
|
||||||
|
*/
|
||||||
|
public $allow;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param HTMLPurifier_AttrDef $def Definition to wrap
|
||||||
|
* @param bool $allow Whether or not to allow !important
|
||||||
|
*/
|
||||||
|
public function __construct($def, $allow = false)
|
||||||
|
{
|
||||||
|
$this->def = $def;
|
||||||
|
$this->allow = $allow;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Intercepts and removes !important if necessary
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
// test for ! and important tokens
|
||||||
|
$string = trim($string);
|
||||||
|
$is_important = false;
|
||||||
|
// :TODO: optimization: test directly for !important and ! important
|
||||||
|
if (strlen($string) >= 9 && substr($string, -9) === 'important') {
|
||||||
|
$temp = rtrim(substr($string, 0, -9));
|
||||||
|
// use a temp, because we might want to restore important
|
||||||
|
if (strlen($temp) >= 1 && substr($temp, -1) === '!') {
|
||||||
|
$string = rtrim(substr($temp, 0, -1));
|
||||||
|
$is_important = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$string = $this->def->validate($string, $config, $context);
|
||||||
|
if ($this->allow && $is_important) {
|
||||||
|
$string .= ' !important';
|
||||||
|
}
|
||||||
|
return $string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a Length as defined by CSS.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_CSS_Length extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type HTMLPurifier_Length|string
|
||||||
|
*/
|
||||||
|
protected $min;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type HTMLPurifier_Length|string
|
||||||
|
*/
|
||||||
|
protected $max;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param HTMLPurifier_Length|string $min Minimum length, or null for no bound. String is also acceptable.
|
||||||
|
* @param HTMLPurifier_Length|string $max Maximum length, or null for no bound. String is also acceptable.
|
||||||
|
*/
|
||||||
|
public function __construct($min = null, $max = null)
|
||||||
|
{
|
||||||
|
$this->min = $min !== null ? HTMLPurifier_Length::make($min) : null;
|
||||||
|
$this->max = $max !== null ? HTMLPurifier_Length::make($max) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
$string = $this->parseCDATA($string);
|
||||||
|
|
||||||
|
// Optimizations
|
||||||
|
if ($string === '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ($string === '0') {
|
||||||
|
return '0';
|
||||||
|
}
|
||||||
|
if (strlen($string) === 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$length = HTMLPurifier_Length::make($string);
|
||||||
|
if (!$length->isValid()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->min) {
|
||||||
|
$c = $length->compareTo($this->min);
|
||||||
|
if ($c === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ($c < 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($this->max) {
|
||||||
|
$c = $length->compareTo($this->max);
|
||||||
|
if ($c === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ($c > 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $length->toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,112 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates shorthand CSS property list-style.
|
||||||
|
* @warning Does not support url tokens that have internal spaces.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_CSS_ListStyle extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Local copy of validators.
|
||||||
|
* @type HTMLPurifier_AttrDef[]
|
||||||
|
* @note See HTMLPurifier_AttrDef_CSS_Font::$info for a similar impl.
|
||||||
|
*/
|
||||||
|
protected $info;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
*/
|
||||||
|
public function __construct($config)
|
||||||
|
{
|
||||||
|
$def = $config->getCSSDefinition();
|
||||||
|
$this->info['list-style-type'] = $def->info['list-style-type'];
|
||||||
|
$this->info['list-style-position'] = $def->info['list-style-position'];
|
||||||
|
$this->info['list-style-image'] = $def->info['list-style-image'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
// regular pre-processing
|
||||||
|
$string = $this->parseCDATA($string);
|
||||||
|
if ($string === '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// assumes URI doesn't have spaces in it
|
||||||
|
$bits = explode(' ', strtolower($string)); // bits to process
|
||||||
|
|
||||||
|
$caught = array();
|
||||||
|
$caught['type'] = false;
|
||||||
|
$caught['position'] = false;
|
||||||
|
$caught['image'] = false;
|
||||||
|
|
||||||
|
$i = 0; // number of catches
|
||||||
|
$none = false;
|
||||||
|
|
||||||
|
foreach ($bits as $bit) {
|
||||||
|
if ($i >= 3) {
|
||||||
|
return;
|
||||||
|
} // optimization bit
|
||||||
|
if ($bit === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
foreach ($caught as $key => $status) {
|
||||||
|
if ($status !== false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$r = $this->info['list-style-' . $key]->validate($bit, $config, $context);
|
||||||
|
if ($r === false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($r === 'none') {
|
||||||
|
if ($none) {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
$none = true;
|
||||||
|
}
|
||||||
|
if ($key == 'image') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$caught[$key] = $r;
|
||||||
|
$i++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$i) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ret = array();
|
||||||
|
|
||||||
|
// construct type
|
||||||
|
if ($caught['type']) {
|
||||||
|
$ret[] = $caught['type'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// construct image
|
||||||
|
if ($caught['image']) {
|
||||||
|
$ret[] = $caught['image'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// construct position
|
||||||
|
if ($caught['position']) {
|
||||||
|
$ret[] = $caught['position'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($ret)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return implode(' ', $ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Framework class for strings that involve multiple values.
|
||||||
|
*
|
||||||
|
* Certain CSS properties such as border-width and margin allow multiple
|
||||||
|
* lengths to be specified. This class can take a vanilla border-width
|
||||||
|
* definition and multiply it, usually into a max of four.
|
||||||
|
*
|
||||||
|
* @note Even though the CSS specification isn't clear about it, inherit
|
||||||
|
* can only be used alone: it will never manifest as part of a multi
|
||||||
|
* shorthand declaration. Thus, this class does not allow inherit.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_CSS_Multiple extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Instance of component definition to defer validation to.
|
||||||
|
* @type HTMLPurifier_AttrDef
|
||||||
|
* @todo Make protected
|
||||||
|
*/
|
||||||
|
public $single;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Max number of values allowed.
|
||||||
|
* @todo Make protected
|
||||||
|
*/
|
||||||
|
public $max;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param HTMLPurifier_AttrDef $single HTMLPurifier_AttrDef to multiply
|
||||||
|
* @param int $max Max number of values allowed (usually four)
|
||||||
|
*/
|
||||||
|
public function __construct($single, $max = 4)
|
||||||
|
{
|
||||||
|
$this->single = $single;
|
||||||
|
$this->max = $max;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
$string = $this->mungeRgb($this->parseCDATA($string));
|
||||||
|
if ($string === '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$parts = explode(' ', $string); // parseCDATA replaced \r, \t and \n
|
||||||
|
$length = count($parts);
|
||||||
|
$final = '';
|
||||||
|
for ($i = 0, $num = 0; $i < $length && $num < $this->max; $i++) {
|
||||||
|
if (ctype_space($parts[$i])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$result = $this->single->validate($parts[$i], $config, $context);
|
||||||
|
if ($result !== false) {
|
||||||
|
$final .= $result . ' ';
|
||||||
|
$num++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($final === '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return rtrim($final);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates a number as defined by the CSS spec.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_CSS_Number extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether or not only positive values are allowed.
|
||||||
|
* @type bool
|
||||||
|
*/
|
||||||
|
protected $non_negative = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $non_negative indicates whether negatives are forbidden
|
||||||
|
*/
|
||||||
|
public function __construct($non_negative = false)
|
||||||
|
{
|
||||||
|
$this->non_negative = $non_negative;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $number
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return string|bool
|
||||||
|
* @warning Some contexts do not pass $config, $context. These
|
||||||
|
* variables should not be used without checking HTMLPurifier_Length
|
||||||
|
*/
|
||||||
|
public function validate($number, $config, $context)
|
||||||
|
{
|
||||||
|
$number = $this->parseCDATA($number);
|
||||||
|
|
||||||
|
if ($number === '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ($number === '0') {
|
||||||
|
return '0';
|
||||||
|
}
|
||||||
|
|
||||||
|
$sign = '';
|
||||||
|
switch ($number[0]) {
|
||||||
|
case '-':
|
||||||
|
if ($this->non_negative) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$sign = '-';
|
||||||
|
case '+':
|
||||||
|
$number = substr($number, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctype_digit($number)) {
|
||||||
|
$number = ltrim($number, '0');
|
||||||
|
return $number ? $sign . $number : '0';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Period is the only non-numeric character allowed
|
||||||
|
if (strpos($number, '.') === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
list($left, $right) = explode('.', $number, 2);
|
||||||
|
|
||||||
|
if ($left === '' && $right === '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ($left !== '' && !ctype_digit($left)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove leading zeros until positive number or a zero stays left
|
||||||
|
if (ltrim($left, '0') != '') {
|
||||||
|
$left = ltrim($left, '0');
|
||||||
|
} else {
|
||||||
|
$left = '0';
|
||||||
|
}
|
||||||
|
|
||||||
|
$right = rtrim($right, '0');
|
||||||
|
|
||||||
|
if ($right === '') {
|
||||||
|
return $left ? $sign . $left : '0';
|
||||||
|
} elseif (!ctype_digit($right)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return $sign . $left . '.' . $right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates a Percentage as defined by the CSS spec.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_CSS_Percentage extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instance to defer number validation to.
|
||||||
|
* @type HTMLPurifier_AttrDef_CSS_Number
|
||||||
|
*/
|
||||||
|
protected $number_def;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $non_negative Whether to forbid negative values
|
||||||
|
*/
|
||||||
|
public function __construct($non_negative = false)
|
||||||
|
{
|
||||||
|
$this->number_def = new HTMLPurifier_AttrDef_CSS_Number($non_negative);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
$string = $this->parseCDATA($string);
|
||||||
|
|
||||||
|
if ($string === '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$length = strlen($string);
|
||||||
|
if ($length === 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ($string[$length - 1] !== '%') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$number = substr($string, 0, $length - 1);
|
||||||
|
$number = $this->number_def->validate($number, $config, $context);
|
||||||
|
|
||||||
|
if ($number === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return "$number%";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the value for the CSS property text-decoration
|
||||||
|
* @note This class could be generalized into a version that acts sort of
|
||||||
|
* like Enum except you can compound the allowed values.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_CSS_TextDecoration extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
static $allowed_values = array(
|
||||||
|
'line-through' => true,
|
||||||
|
'overline' => true,
|
||||||
|
'underline' => true,
|
||||||
|
);
|
||||||
|
|
||||||
|
$string = strtolower($this->parseCDATA($string));
|
||||||
|
|
||||||
|
if ($string === 'none') {
|
||||||
|
return $string;
|
||||||
|
}
|
||||||
|
|
||||||
|
$parts = explode(' ', $string);
|
||||||
|
$final = '';
|
||||||
|
foreach ($parts as $part) {
|
||||||
|
if (isset($allowed_values[$part])) {
|
||||||
|
$final .= $part . ' ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$final = rtrim($final);
|
||||||
|
if ($final === '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return $final;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates a URI in CSS syntax, which uses url('http://example.com')
|
||||||
|
* @note While theoretically speaking a URI in a CSS document could
|
||||||
|
* be non-embedded, as of CSS2 there is no such usage so we're
|
||||||
|
* generalizing it. This may need to be changed in the future.
|
||||||
|
* @warning Since HTMLPurifier_AttrDef_CSS blindly uses semicolons as
|
||||||
|
* the separator, you cannot put a literal semicolon in
|
||||||
|
* in the URI. Try percent encoding it, in that case.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_CSS_URI extends HTMLPurifier_AttrDef_URI
|
||||||
|
{
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct(true); // always embedded
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $uri_string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($uri_string, $config, $context)
|
||||||
|
{
|
||||||
|
// parse the URI out of the string and then pass it onto
|
||||||
|
// the parent object
|
||||||
|
|
||||||
|
$uri_string = $this->parseCDATA($uri_string);
|
||||||
|
if (strpos($uri_string, 'url(') !== 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$uri_string = substr($uri_string, 4);
|
||||||
|
if (strlen($uri_string) == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$new_length = strlen($uri_string) - 1;
|
||||||
|
if ($uri_string[$new_length] != ')') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$uri = trim(substr($uri_string, 0, $new_length));
|
||||||
|
|
||||||
|
if (!empty($uri) && ($uri[0] == "'" || $uri[0] == '"')) {
|
||||||
|
$quote = $uri[0];
|
||||||
|
$new_length = strlen($uri) - 1;
|
||||||
|
if ($uri[$new_length] !== $quote) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$uri = substr($uri, 1, $new_length - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$uri = $this->expandCSSEscape($uri);
|
||||||
|
|
||||||
|
$result = parent::validate($uri, $config, $context);
|
||||||
|
|
||||||
|
if ($result === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// extra sanity check; should have been done by URI
|
||||||
|
$result = str_replace(array('"', "\\", "\n", "\x0c", "\r"), "", $result);
|
||||||
|
|
||||||
|
// suspicious characters are ()'; we're going to percent encode
|
||||||
|
// them for safety.
|
||||||
|
$result = str_replace(array('(', ')', "'"), array('%28', '%29', '%27'), $result);
|
||||||
|
|
||||||
|
// there's an extra bug where ampersands lose their escaping on
|
||||||
|
// an innerHTML cycle, so a very unlucky query parameter could
|
||||||
|
// then change the meaning of the URL. Unfortunately, there's
|
||||||
|
// not much we can do about that...
|
||||||
|
return "url(\"$result\")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dummy AttrDef that mimics another AttrDef, BUT it generates clones
|
||||||
|
* with make.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_Clone extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* What we're cloning.
|
||||||
|
* @type HTMLPurifier_AttrDef
|
||||||
|
*/
|
||||||
|
protected $clone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param HTMLPurifier_AttrDef $clone
|
||||||
|
*/
|
||||||
|
public function __construct($clone)
|
||||||
|
{
|
||||||
|
$this->clone = $clone;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $v
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($v, $config, $context)
|
||||||
|
{
|
||||||
|
return $this->clone->validate($v, $config, $context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @return HTMLPurifier_AttrDef
|
||||||
|
*/
|
||||||
|
public function make($string)
|
||||||
|
{
|
||||||
|
return clone $this->clone;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// Enum = Enumerated
|
||||||
|
/**
|
||||||
|
* Validates a keyword against a list of valid values.
|
||||||
|
* @warning The case-insensitive compare of this function uses PHP's
|
||||||
|
* built-in strtolower and ctype_lower functions, which may
|
||||||
|
* cause problems with international comparisons
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_Enum extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lookup table of valid values.
|
||||||
|
* @type array
|
||||||
|
* @todo Make protected
|
||||||
|
*/
|
||||||
|
public $valid_values = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bool indicating whether or not enumeration is case sensitive.
|
||||||
|
* @note In general this is always case insensitive.
|
||||||
|
*/
|
||||||
|
protected $case_sensitive = false; // values according to W3C spec
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $valid_values List of valid values
|
||||||
|
* @param bool $case_sensitive Whether or not case sensitive
|
||||||
|
*/
|
||||||
|
public function __construct($valid_values = array(), $case_sensitive = false)
|
||||||
|
{
|
||||||
|
$this->valid_values = array_flip($valid_values);
|
||||||
|
$this->case_sensitive = $case_sensitive;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
$string = trim($string);
|
||||||
|
if (!$this->case_sensitive) {
|
||||||
|
// we may want to do full case-insensitive libraries
|
||||||
|
$string = ctype_lower($string) ? $string : strtolower($string);
|
||||||
|
}
|
||||||
|
$result = isset($this->valid_values[$string]);
|
||||||
|
|
||||||
|
return $result ? $string : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string In form of comma-delimited list of case-insensitive
|
||||||
|
* valid values. Example: "foo,bar,baz". Prepend "s:" to make
|
||||||
|
* case sensitive
|
||||||
|
* @return HTMLPurifier_AttrDef_Enum
|
||||||
|
*/
|
||||||
|
public function make($string)
|
||||||
|
{
|
||||||
|
if (strlen($string) > 2 && $string[0] == 's' && $string[1] == ':') {
|
||||||
|
$string = substr($string, 2);
|
||||||
|
$sensitive = true;
|
||||||
|
} else {
|
||||||
|
$sensitive = false;
|
||||||
|
}
|
||||||
|
$values = explode(',', $string);
|
||||||
|
return new HTMLPurifier_AttrDef_Enum($values, $sensitive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates a boolean attribute
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_HTML_Bool extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type string
|
||||||
|
*/
|
||||||
|
protected $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type bool
|
||||||
|
*/
|
||||||
|
public $minimized = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool|string $name
|
||||||
|
*/
|
||||||
|
public function __construct($name = false)
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string Name of attribute
|
||||||
|
* @return HTMLPurifier_AttrDef_HTML_Bool
|
||||||
|
*/
|
||||||
|
public function make($string)
|
||||||
|
{
|
||||||
|
return new HTMLPurifier_AttrDef_HTML_Bool($string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements special behavior for class attribute (normally NMTOKENS)
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_HTML_Class extends HTMLPurifier_AttrDef_HTML_Nmtokens
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
protected function split($string, $config, $context)
|
||||||
|
{
|
||||||
|
// really, this twiddle should be lazy loaded
|
||||||
|
$name = $config->getDefinition('HTML')->doctype->name;
|
||||||
|
if ($name == "XHTML 1.1" || $name == "XHTML 2.0") {
|
||||||
|
return parent::split($string, $config, $context);
|
||||||
|
} else {
|
||||||
|
return preg_split('/\s+/', $string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $tokens
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function filter($tokens, $config, $context)
|
||||||
|
{
|
||||||
|
$allowed = $config->get('Attr.AllowedClasses');
|
||||||
|
$forbidden = $config->get('Attr.ForbiddenClasses');
|
||||||
|
$ret = array();
|
||||||
|
foreach ($tokens as $token) {
|
||||||
|
if (($allowed === null || isset($allowed[$token])) &&
|
||||||
|
!isset($forbidden[$token]) &&
|
||||||
|
// We need this O(n) check because of PHP's array
|
||||||
|
// implementation that casts -0 to 0.
|
||||||
|
!in_array($token, $ret, true)
|
||||||
|
) {
|
||||||
|
$ret[] = $token;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates a color according to the HTML spec.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_HTML_Color extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
static $colors = null;
|
||||||
|
if ($colors === null) {
|
||||||
|
$colors = $config->get('Core.ColorKeywords');
|
||||||
|
}
|
||||||
|
|
||||||
|
$string = trim($string);
|
||||||
|
|
||||||
|
if (empty($string)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$lower = strtolower($string);
|
||||||
|
if (isset($colors[$lower])) {
|
||||||
|
return $colors[$lower];
|
||||||
|
}
|
||||||
|
if ($string[0] === '#') {
|
||||||
|
$hex = substr($string, 1);
|
||||||
|
} else {
|
||||||
|
$hex = $string;
|
||||||
|
}
|
||||||
|
|
||||||
|
$length = strlen($hex);
|
||||||
|
if ($length !== 3 && $length !== 6) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!ctype_xdigit($hex)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ($length === 3) {
|
||||||
|
$hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2];
|
||||||
|
}
|
||||||
|
return "#$hex";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class HTMLPurifier_AttrDef_HTML_ContentEditable extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
$allowed = array('false');
|
||||||
|
if ($config->get('HTML.Trusted')) {
|
||||||
|
$allowed = array('', 'true', 'false');
|
||||||
|
}
|
||||||
|
|
||||||
|
$enum = new HTMLPurifier_AttrDef_Enum($allowed);
|
||||||
|
|
||||||
|
return $enum->validate($string, $config, $context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Special-case enum attribute definition that lazy loads allowed frame targets
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_HTML_FrameTarget extends HTMLPurifier_AttrDef_Enum
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type array
|
||||||
|
*/
|
||||||
|
public $valid_values = false; // uninitialized value
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type bool
|
||||||
|
*/
|
||||||
|
protected $case_sensitive = false;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
if ($this->valid_values === false) {
|
||||||
|
$this->valid_values = $config->get('Attr.AllowedFrameTargets');
|
||||||
|
}
|
||||||
|
return parent::validate($string, $config, $context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the HTML attribute ID.
|
||||||
|
* @warning Even though this is the id processor, it
|
||||||
|
* will ignore the directive Attr:IDBlacklist, since it will only
|
||||||
|
* go according to the ID accumulator. Since the accumulator is
|
||||||
|
* automatically generated, it will have already absorbed the
|
||||||
|
* blacklist. If you're hacking around, make sure you use load()!
|
||||||
|
*/
|
||||||
|
|
||||||
|
class HTMLPurifier_AttrDef_HTML_ID extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
// selector is NOT a valid thing to use for IDREFs, because IDREFs
|
||||||
|
// *must* target IDs that exist, whereas selector #ids do not.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether or not we're validating an ID in a CSS
|
||||||
|
* selector context.
|
||||||
|
* @type bool
|
||||||
|
*/
|
||||||
|
protected $selector;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $selector
|
||||||
|
*/
|
||||||
|
public function __construct($selector = false)
|
||||||
|
{
|
||||||
|
$this->selector = $selector;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $id
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($id, $config, $context)
|
||||||
|
{
|
||||||
|
if (!$this->selector && !$config->get('Attr.EnableID')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = trim($id); // trim it first
|
||||||
|
|
||||||
|
if ($id === '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$prefix = $config->get('Attr.IDPrefix');
|
||||||
|
if ($prefix !== '') {
|
||||||
|
$prefix .= $config->get('Attr.IDPrefixLocal');
|
||||||
|
// prevent re-appending the prefix
|
||||||
|
if (strpos($id, $prefix) !== 0) {
|
||||||
|
$id = $prefix . $id;
|
||||||
|
}
|
||||||
|
} elseif ($config->get('Attr.IDPrefixLocal') !== '') {
|
||||||
|
trigger_error(
|
||||||
|
'%Attr.IDPrefixLocal cannot be used unless ' .
|
||||||
|
'%Attr.IDPrefix is set',
|
||||||
|
E_USER_WARNING
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->selector) {
|
||||||
|
$id_accumulator =& $context->get('IDAccumulator');
|
||||||
|
if (isset($id_accumulator->ids[$id])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// we purposely avoid using regex, hopefully this is faster
|
||||||
|
|
||||||
|
if ($config->get('Attr.ID.HTML5') === true) {
|
||||||
|
if (preg_match('/[\t\n\x0b\x0c ]/', $id)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (ctype_alpha($id)) {
|
||||||
|
// OK
|
||||||
|
} else {
|
||||||
|
if (!ctype_alpha(@$id[0])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// primitive style of regexps, I suppose
|
||||||
|
$trim = trim(
|
||||||
|
$id,
|
||||||
|
'A..Za..z0..9:-._'
|
||||||
|
);
|
||||||
|
if ($trim !== '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$regexp = $config->get('Attr.IDBlacklistRegexp');
|
||||||
|
if ($regexp && preg_match($regexp, $id)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->selector) {
|
||||||
|
$id_accumulator->add($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if no change was made to the ID, return the result
|
||||||
|
// else, return the new id if stripping whitespace made it
|
||||||
|
// valid, or return false.
|
||||||
|
return $id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the HTML type length (not to be confused with CSS's length).
|
||||||
|
*
|
||||||
|
* This accepts integer pixels or percentages as lengths for certain
|
||||||
|
* HTML attributes.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class HTMLPurifier_AttrDef_HTML_Length extends HTMLPurifier_AttrDef_HTML_Pixels
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
$string = trim($string);
|
||||||
|
if ($string === '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$parent_result = parent::validate($string, $config, $context);
|
||||||
|
if ($parent_result !== false) {
|
||||||
|
return $parent_result;
|
||||||
|
}
|
||||||
|
|
||||||
|
$length = strlen($string);
|
||||||
|
$last_char = $string[$length - 1];
|
||||||
|
|
||||||
|
if ($last_char !== '%') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$points = substr($string, 0, $length - 1);
|
||||||
|
|
||||||
|
if (!is_numeric($points)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$points = (int)$points;
|
||||||
|
|
||||||
|
if ($points < 0) {
|
||||||
|
return '0%';
|
||||||
|
}
|
||||||
|
if ($points > 100) {
|
||||||
|
return '100%';
|
||||||
|
}
|
||||||
|
return ((string)$points) . '%';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates a rel/rev link attribute against a directive of allowed values
|
||||||
|
* @note We cannot use Enum because link types allow multiple
|
||||||
|
* values.
|
||||||
|
* @note Assumes link types are ASCII text
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_HTML_LinkTypes extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name config attribute to pull.
|
||||||
|
* @type string
|
||||||
|
*/
|
||||||
|
protected $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $name
|
||||||
|
*/
|
||||||
|
public function __construct($name)
|
||||||
|
{
|
||||||
|
$configLookup = array(
|
||||||
|
'rel' => 'AllowedRel',
|
||||||
|
'rev' => 'AllowedRev'
|
||||||
|
);
|
||||||
|
if (!isset($configLookup[$name])) {
|
||||||
|
trigger_error(
|
||||||
|
'Unrecognized attribute name for link ' .
|
||||||
|
'relationship.',
|
||||||
|
E_USER_ERROR
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->name = $configLookup[$name];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
$allowed = $config->get('Attr.' . $this->name);
|
||||||
|
if (empty($allowed)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$string = $this->parseCDATA($string);
|
||||||
|
$parts = explode(' ', $string);
|
||||||
|
|
||||||
|
// lookup to prevent duplicates
|
||||||
|
$ret_lookup = array();
|
||||||
|
foreach ($parts as $part) {
|
||||||
|
$part = strtolower(trim($part));
|
||||||
|
if (!isset($allowed[$part])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$ret_lookup[$part] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($ret_lookup)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$string = implode(' ', array_keys($ret_lookup));
|
||||||
|
return $string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates a MultiLength as defined by the HTML spec.
|
||||||
|
*
|
||||||
|
* A multilength is either a integer (pixel count), a percentage, or
|
||||||
|
* a relative number.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_HTML_MultiLength extends HTMLPurifier_AttrDef_HTML_Length
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
$string = trim($string);
|
||||||
|
if ($string === '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$parent_result = parent::validate($string, $config, $context);
|
||||||
|
if ($parent_result !== false) {
|
||||||
|
return $parent_result;
|
||||||
|
}
|
||||||
|
|
||||||
|
$length = strlen($string);
|
||||||
|
$last_char = $string[$length - 1];
|
||||||
|
|
||||||
|
if ($last_char !== '*') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$int = substr($string, 0, $length - 1);
|
||||||
|
|
||||||
|
if ($int == '') {
|
||||||
|
return '*';
|
||||||
|
}
|
||||||
|
if (!is_numeric($int)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$int = (int)$int;
|
||||||
|
if ($int < 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ($int == 0) {
|
||||||
|
return '0';
|
||||||
|
}
|
||||||
|
if ($int == 1) {
|
||||||
|
return '*';
|
||||||
|
}
|
||||||
|
return ((string)$int) . '*';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates contents based on NMTOKENS attribute type.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_HTML_Nmtokens extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
$string = trim($string);
|
||||||
|
|
||||||
|
// early abort: '' and '0' (strings that convert to false) are invalid
|
||||||
|
if (!$string) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tokens = $this->split($string, $config, $context);
|
||||||
|
$tokens = $this->filter($tokens, $config, $context);
|
||||||
|
if (empty($tokens)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return implode(' ', $tokens);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Splits a space separated list of tokens into its constituent parts.
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function split($string, $config, $context)
|
||||||
|
{
|
||||||
|
// OPTIMIZABLE!
|
||||||
|
// do the preg_match, capture all subpatterns for reformulation
|
||||||
|
|
||||||
|
// we don't support U+00A1 and up codepoints or
|
||||||
|
// escaping because I don't know how to do that with regexps
|
||||||
|
// and plus it would complicate optimization efforts (you never
|
||||||
|
// see that anyway).
|
||||||
|
$pattern = '/(?:(?<=\s)|\A)' . // look behind for space or string start
|
||||||
|
'((?:--|-?[A-Za-z_])[A-Za-z_\-0-9]*)' .
|
||||||
|
'(?:(?=\s)|\z)/'; // look ahead for space or string end
|
||||||
|
preg_match_all($pattern, $string, $matches);
|
||||||
|
return $matches[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Template method for removing certain tokens based on arbitrary criteria.
|
||||||
|
* @note If we wanted to be really functional, we'd do an array_filter
|
||||||
|
* with a callback. But... we're not.
|
||||||
|
* @param array $tokens
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function filter($tokens, $config, $context)
|
||||||
|
{
|
||||||
|
return $tokens;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,76 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates an integer representation of pixels according to the HTML spec.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_HTML_Pixels extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type int
|
||||||
|
*/
|
||||||
|
protected $max;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $max
|
||||||
|
*/
|
||||||
|
public function __construct($max = null)
|
||||||
|
{
|
||||||
|
$this->max = $max;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
$string = trim($string);
|
||||||
|
if ($string === '0') {
|
||||||
|
return $string;
|
||||||
|
}
|
||||||
|
if ($string === '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$length = strlen($string);
|
||||||
|
if (substr($string, $length - 2) == 'px') {
|
||||||
|
$string = substr($string, 0, $length - 2);
|
||||||
|
}
|
||||||
|
if (!is_numeric($string)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$int = (int)$string;
|
||||||
|
|
||||||
|
if ($int < 0) {
|
||||||
|
return '0';
|
||||||
|
}
|
||||||
|
|
||||||
|
// upper-bound value, extremely high values can
|
||||||
|
// crash operating systems, see <http://ha.ckers.org/imagecrash.html>
|
||||||
|
// WARNING, above link WILL crash you if you're using Windows
|
||||||
|
|
||||||
|
if ($this->max !== null && $int > $this->max) {
|
||||||
|
return (string)$this->max;
|
||||||
|
}
|
||||||
|
return (string)$int;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @return HTMLPurifier_AttrDef
|
||||||
|
*/
|
||||||
|
public function make($string)
|
||||||
|
{
|
||||||
|
if ($string === '') {
|
||||||
|
$max = null;
|
||||||
|
} else {
|
||||||
|
$max = (int)$string;
|
||||||
|
}
|
||||||
|
$class = get_class($this);
|
||||||
|
return new $class($max);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates an integer.
|
||||||
|
* @note While this class was modeled off the CSS definition, no currently
|
||||||
|
* allowed CSS uses this type. The properties that do are: widows,
|
||||||
|
* orphans, z-index, counter-increment, counter-reset. Some of the
|
||||||
|
* HTML attributes, however, find use for a non-negative version of this.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_Integer extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether or not negative values are allowed.
|
||||||
|
* @type bool
|
||||||
|
*/
|
||||||
|
protected $negative = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether or not zero is allowed.
|
||||||
|
* @type bool
|
||||||
|
*/
|
||||||
|
protected $zero = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether or not positive values are allowed.
|
||||||
|
* @type bool
|
||||||
|
*/
|
||||||
|
protected $positive = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $negative Bool indicating whether or not negative values are allowed
|
||||||
|
* @param $zero Bool indicating whether or not zero is allowed
|
||||||
|
* @param $positive Bool indicating whether or not positive values are allowed
|
||||||
|
*/
|
||||||
|
public function __construct($negative = true, $zero = true, $positive = true)
|
||||||
|
{
|
||||||
|
$this->negative = $negative;
|
||||||
|
$this->zero = $zero;
|
||||||
|
$this->positive = $positive;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $integer
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($integer, $config, $context)
|
||||||
|
{
|
||||||
|
$integer = $this->parseCDATA($integer);
|
||||||
|
if ($integer === '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// we could possibly simply typecast it to integer, but there are
|
||||||
|
// certain fringe cases that must not return an integer.
|
||||||
|
|
||||||
|
// clip leading sign
|
||||||
|
if ($this->negative && $integer[0] === '-') {
|
||||||
|
$digits = substr($integer, 1);
|
||||||
|
if ($digits === '0') {
|
||||||
|
$integer = '0';
|
||||||
|
} // rm minus sign for zero
|
||||||
|
} elseif ($this->positive && $integer[0] === '+') {
|
||||||
|
$digits = $integer = substr($integer, 1); // rm unnecessary plus
|
||||||
|
} else {
|
||||||
|
$digits = $integer;
|
||||||
|
}
|
||||||
|
|
||||||
|
// test if it's numeric
|
||||||
|
if (!ctype_digit($digits)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// perform scope tests
|
||||||
|
if (!$this->zero && $integer == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!$this->positive && $integer > 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!$this->negative && $integer < 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $integer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,86 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the HTML attribute lang, effectively a language code.
|
||||||
|
* @note Built according to RFC 3066, which obsoleted RFC 1766
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_Lang extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
$string = trim($string);
|
||||||
|
if (!$string) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$subtags = explode('-', $string);
|
||||||
|
$num_subtags = count($subtags);
|
||||||
|
|
||||||
|
if ($num_subtags == 0) { // sanity check
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// process primary subtag : $subtags[0]
|
||||||
|
$length = strlen($subtags[0]);
|
||||||
|
switch ($length) {
|
||||||
|
case 0:
|
||||||
|
return false;
|
||||||
|
case 1:
|
||||||
|
if (!($subtags[0] == 'x' || $subtags[0] == 'i')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
case 3:
|
||||||
|
if (!ctype_alpha($subtags[0])) {
|
||||||
|
return false;
|
||||||
|
} elseif (!ctype_lower($subtags[0])) {
|
||||||
|
$subtags[0] = strtolower($subtags[0]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$new_string = $subtags[0];
|
||||||
|
if ($num_subtags == 1) {
|
||||||
|
return $new_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// process second subtag : $subtags[1]
|
||||||
|
$length = strlen($subtags[1]);
|
||||||
|
if ($length == 0 || ($length == 1 && $subtags[1] != 'x') || $length > 8 || !ctype_alnum($subtags[1])) {
|
||||||
|
return $new_string;
|
||||||
|
}
|
||||||
|
if (!ctype_lower($subtags[1])) {
|
||||||
|
$subtags[1] = strtolower($subtags[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$new_string .= '-' . $subtags[1];
|
||||||
|
if ($num_subtags == 2) {
|
||||||
|
return $new_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// process all other subtags, index 2 and up
|
||||||
|
for ($i = 2; $i < $num_subtags; $i++) {
|
||||||
|
$length = strlen($subtags[$i]);
|
||||||
|
if ($length == 0 || $length > 8 || !ctype_alnum($subtags[$i])) {
|
||||||
|
return $new_string;
|
||||||
|
}
|
||||||
|
if (!ctype_lower($subtags[$i])) {
|
||||||
|
$subtags[$i] = strtolower($subtags[$i]);
|
||||||
|
}
|
||||||
|
$new_string .= '-' . $subtags[$i];
|
||||||
|
}
|
||||||
|
return $new_string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decorator that, depending on a token, switches between two definitions.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_Switch
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type string
|
||||||
|
*/
|
||||||
|
protected $tag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type HTMLPurifier_AttrDef
|
||||||
|
*/
|
||||||
|
protected $withTag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type HTMLPurifier_AttrDef
|
||||||
|
*/
|
||||||
|
protected $withoutTag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $tag Tag name to switch upon
|
||||||
|
* @param HTMLPurifier_AttrDef $with_tag Call if token matches tag
|
||||||
|
* @param HTMLPurifier_AttrDef $without_tag Call if token doesn't match, or there is no token
|
||||||
|
*/
|
||||||
|
public function __construct($tag, $with_tag, $without_tag)
|
||||||
|
{
|
||||||
|
$this->tag = $tag;
|
||||||
|
$this->withTag = $with_tag;
|
||||||
|
$this->withoutTag = $without_tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
$token = $context->get('CurrentToken', true);
|
||||||
|
if (!$token || $token->name !== $this->tag) {
|
||||||
|
return $this->withoutTag->validate($string, $config, $context);
|
||||||
|
} else {
|
||||||
|
return $this->withTag->validate($string, $config, $context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates arbitrary text according to the HTML spec.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_Text extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
return $this->parseCDATA($string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
111
system/library/nat/phpspreadsheet_7/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI.php
vendored
Normal file
111
system/library/nat/phpspreadsheet_7/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI.php
vendored
Normal file
|
|
@ -0,0 +1,111 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates a URI as defined by RFC 3986.
|
||||||
|
* @note Scheme-specific mechanics deferred to HTMLPurifier_URIScheme
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_URI extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type HTMLPurifier_URIParser
|
||||||
|
*/
|
||||||
|
protected $parser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type bool
|
||||||
|
*/
|
||||||
|
protected $embedsResource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $embeds_resource Does the URI here result in an extra HTTP request?
|
||||||
|
*/
|
||||||
|
public function __construct($embeds_resource = false)
|
||||||
|
{
|
||||||
|
$this->parser = new HTMLPurifier_URIParser();
|
||||||
|
$this->embedsResource = (bool)$embeds_resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @return HTMLPurifier_AttrDef_URI
|
||||||
|
*/
|
||||||
|
public function make($string)
|
||||||
|
{
|
||||||
|
$embeds = ($string === 'embedded');
|
||||||
|
return new HTMLPurifier_AttrDef_URI($embeds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $uri
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($uri, $config, $context)
|
||||||
|
{
|
||||||
|
if ($config->get('URI.Disable')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$uri = $this->parseCDATA($uri);
|
||||||
|
|
||||||
|
// parse the URI
|
||||||
|
$uri = $this->parser->parse($uri);
|
||||||
|
if ($uri === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// add embedded flag to context for validators
|
||||||
|
$context->register('EmbeddedURI', $this->embedsResource);
|
||||||
|
|
||||||
|
$ok = false;
|
||||||
|
do {
|
||||||
|
|
||||||
|
// generic validation
|
||||||
|
$result = $uri->validate($config, $context);
|
||||||
|
if (!$result) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// chained filtering
|
||||||
|
$uri_def = $config->getDefinition('URI');
|
||||||
|
$result = $uri_def->filter($uri, $config, $context);
|
||||||
|
if (!$result) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// scheme-specific validation
|
||||||
|
$scheme_obj = $uri->getSchemeObj($config, $context);
|
||||||
|
if (!$scheme_obj) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ($this->embedsResource && !$scheme_obj->browsable) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$result = $scheme_obj->validate($uri, $config, $context);
|
||||||
|
if (!$result) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Post chained filtering
|
||||||
|
$result = $uri_def->postFilter($uri, $config, $context);
|
||||||
|
if (!$result) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// survived gauntlet
|
||||||
|
$ok = true;
|
||||||
|
|
||||||
|
} while (false);
|
||||||
|
|
||||||
|
$context->destroy('EmbeddedURI');
|
||||||
|
if (!$ok) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// back to string
|
||||||
|
return $uri->toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
abstract class HTMLPurifier_AttrDef_URI_Email extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unpacks a mailbox into its display-name and address
|
||||||
|
* @param string $string
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function unpack($string)
|
||||||
|
{
|
||||||
|
// needs to be implemented
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// sub-implementations
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primitive email validation class based on the regexp found at
|
||||||
|
* http://www.regular-expressions.info/email.html
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_URI_Email_SimpleCheck extends HTMLPurifier_AttrDef_URI_Email
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
// no support for named mailboxes i.e. "Bob <bob@example.com>"
|
||||||
|
// that needs more percent encoding to be done
|
||||||
|
if ($string == '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$string = trim($string);
|
||||||
|
$result = preg_match('/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i', $string);
|
||||||
|
return $result ? $string : false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,142 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates a host according to the IPv4, IPv6 and DNS (future) specifications.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_URI_Host extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IPv4 sub-validator.
|
||||||
|
* @type HTMLPurifier_AttrDef_URI_IPv4
|
||||||
|
*/
|
||||||
|
protected $ipv4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IPv6 sub-validator.
|
||||||
|
* @type HTMLPurifier_AttrDef_URI_IPv6
|
||||||
|
*/
|
||||||
|
protected $ipv6;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->ipv4 = new HTMLPurifier_AttrDef_URI_IPv4();
|
||||||
|
$this->ipv6 = new HTMLPurifier_AttrDef_URI_IPv6();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $string
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($string, $config, $context)
|
||||||
|
{
|
||||||
|
$length = strlen($string);
|
||||||
|
// empty hostname is OK; it's usually semantically equivalent:
|
||||||
|
// the default host as defined by a URI scheme is used:
|
||||||
|
//
|
||||||
|
// If the URI scheme defines a default for host, then that
|
||||||
|
// default applies when the host subcomponent is undefined
|
||||||
|
// or when the registered name is empty (zero length).
|
||||||
|
if ($string === '') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
if ($length > 1 && $string[0] === '[' && $string[$length - 1] === ']') {
|
||||||
|
//IPv6
|
||||||
|
$ip = substr($string, 1, $length - 2);
|
||||||
|
$valid = $this->ipv6->validate($ip, $config, $context);
|
||||||
|
if ($valid === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return '[' . $valid . ']';
|
||||||
|
}
|
||||||
|
|
||||||
|
// need to do checks on unusual encodings too
|
||||||
|
$ipv4 = $this->ipv4->validate($string, $config, $context);
|
||||||
|
if ($ipv4 !== false) {
|
||||||
|
return $ipv4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A regular domain name.
|
||||||
|
|
||||||
|
// This doesn't match I18N domain names, but we don't have proper IRI support,
|
||||||
|
// so force users to insert Punycode.
|
||||||
|
|
||||||
|
// There is not a good sense in which underscores should be
|
||||||
|
// allowed, since it's technically not! (And if you go as
|
||||||
|
// far to allow everything as specified by the DNS spec...
|
||||||
|
// well, that's literally everything, modulo some space limits
|
||||||
|
// for the components and the overall name (which, by the way,
|
||||||
|
// we are NOT checking!). So we (arbitrarily) decide this:
|
||||||
|
// let's allow underscores wherever we would have allowed
|
||||||
|
// hyphens, if they are enabled. This is a pretty good match
|
||||||
|
// for browser behavior, for example, a large number of browsers
|
||||||
|
// cannot handle foo_.example.com, but foo_bar.example.com is
|
||||||
|
// fairly well supported.
|
||||||
|
$underscore = $config->get('Core.AllowHostnameUnderscore') ? '_' : '';
|
||||||
|
|
||||||
|
// Based off of RFC 1738, but amended so that
|
||||||
|
// as per RFC 3696, the top label need only not be all numeric.
|
||||||
|
// The productions describing this are:
|
||||||
|
$a = '[a-z]'; // alpha
|
||||||
|
$an = '[a-z0-9]'; // alphanum
|
||||||
|
$and = "[a-z0-9-$underscore]"; // alphanum | "-"
|
||||||
|
// domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum
|
||||||
|
$domainlabel = "$an(?:$and*$an)?";
|
||||||
|
// AMENDED as per RFC 3696
|
||||||
|
// toplabel = alphanum | alphanum *( alphanum | "-" ) alphanum
|
||||||
|
// side condition: not all numeric
|
||||||
|
$toplabel = "$an(?:$and*$an)?";
|
||||||
|
// hostname = *( domainlabel "." ) toplabel [ "." ]
|
||||||
|
if (preg_match("/^(?:$domainlabel\.)*($toplabel)\.?$/i", $string, $matches)) {
|
||||||
|
if (!ctype_digit($matches[1])) {
|
||||||
|
return $string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PHP 5.3 and later support this functionality natively
|
||||||
|
if (function_exists('idn_to_ascii')) {
|
||||||
|
if (defined('IDNA_NONTRANSITIONAL_TO_ASCII') && defined('INTL_IDNA_VARIANT_UTS46')) {
|
||||||
|
$string = idn_to_ascii($string, IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46);
|
||||||
|
} else {
|
||||||
|
$string = idn_to_ascii($string);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we have Net_IDNA2 support, we can support IRIs by
|
||||||
|
// punycoding them. (This is the most portable thing to do,
|
||||||
|
// since otherwise we have to assume browsers support
|
||||||
|
} elseif ($config->get('Core.EnableIDNA')) {
|
||||||
|
$idna = new Net_IDNA2(array('encoding' => 'utf8', 'overlong' => false, 'strict' => true));
|
||||||
|
// we need to encode each period separately
|
||||||
|
$parts = explode('.', $string);
|
||||||
|
try {
|
||||||
|
$new_parts = array();
|
||||||
|
foreach ($parts as $part) {
|
||||||
|
$encodable = false;
|
||||||
|
for ($i = 0, $c = strlen($part); $i < $c; $i++) {
|
||||||
|
if (ord($part[$i]) > 0x7a) {
|
||||||
|
$encodable = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$encodable) {
|
||||||
|
$new_parts[] = $part;
|
||||||
|
} else {
|
||||||
|
$new_parts[] = $idna->encode($part);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$string = implode('.', $new_parts);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
// XXX error reporting
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Try again
|
||||||
|
if (preg_match("/^($domainlabel\.)*$toplabel\.?$/i", $string)) {
|
||||||
|
return $string;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates an IPv4 address
|
||||||
|
* @author Feyd @ forums.devnetwork.net (public domain)
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_URI_IPv4 extends HTMLPurifier_AttrDef
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IPv4 regex, protected so that IPv6 can reuse it.
|
||||||
|
* @type string
|
||||||
|
*/
|
||||||
|
protected $ip4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $aIP
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($aIP, $config, $context)
|
||||||
|
{
|
||||||
|
if (!$this->ip4) {
|
||||||
|
$this->_loadRegex();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (preg_match('#^' . $this->ip4 . '$#s', $aIP)) {
|
||||||
|
return $aIP;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lazy load function to prevent regex from being stuffed in
|
||||||
|
* cache.
|
||||||
|
*/
|
||||||
|
protected function _loadRegex()
|
||||||
|
{
|
||||||
|
$oct = '(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])'; // 0-255
|
||||||
|
$this->ip4 = "(?:{$oct}\\.{$oct}\\.{$oct}\\.{$oct})";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates an IPv6 address.
|
||||||
|
* @author Feyd @ forums.devnetwork.net (public domain)
|
||||||
|
* @note This function requires brackets to have been removed from address
|
||||||
|
* in URI.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrDef_URI_IPv6 extends HTMLPurifier_AttrDef_URI_IPv4
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $aIP
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return bool|string
|
||||||
|
*/
|
||||||
|
public function validate($aIP, $config, $context)
|
||||||
|
{
|
||||||
|
if (!$this->ip4) {
|
||||||
|
$this->_loadRegex();
|
||||||
|
}
|
||||||
|
|
||||||
|
$original = $aIP;
|
||||||
|
|
||||||
|
$hex = '[0-9a-fA-F]';
|
||||||
|
$blk = '(?:' . $hex . '{1,4})';
|
||||||
|
$pre = '(?:/(?:12[0-8]|1[0-1][0-9]|[1-9][0-9]|[0-9]))'; // /0 - /128
|
||||||
|
|
||||||
|
// prefix check
|
||||||
|
if (strpos($aIP, '/') !== false) {
|
||||||
|
if (preg_match('#' . $pre . '$#s', $aIP, $find)) {
|
||||||
|
$aIP = substr($aIP, 0, 0 - strlen($find[0]));
|
||||||
|
unset($find);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// IPv4-compatiblity check
|
||||||
|
if (preg_match('#(?<=:' . ')' . $this->ip4 . '$#s', $aIP, $find)) {
|
||||||
|
$aIP = substr($aIP, 0, 0 - strlen($find[0]));
|
||||||
|
$ip = explode('.', $find[0]);
|
||||||
|
$ip = array_map('dechex', $ip);
|
||||||
|
$aIP .= $ip[0] . $ip[1] . ':' . $ip[2] . $ip[3];
|
||||||
|
unset($find, $ip);
|
||||||
|
}
|
||||||
|
|
||||||
|
// compression check
|
||||||
|
$aIP = explode('::', $aIP);
|
||||||
|
$c = count($aIP);
|
||||||
|
if ($c > 2) {
|
||||||
|
return false;
|
||||||
|
} elseif ($c == 2) {
|
||||||
|
list($first, $second) = $aIP;
|
||||||
|
$first = explode(':', $first);
|
||||||
|
$second = explode(':', $second);
|
||||||
|
|
||||||
|
if (count($first) + count($second) > 8) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (count($first) < 8) {
|
||||||
|
array_push($first, '0');
|
||||||
|
}
|
||||||
|
|
||||||
|
array_splice($first, 8 - count($second), 8, $second);
|
||||||
|
$aIP = $first;
|
||||||
|
unset($first, $second);
|
||||||
|
} else {
|
||||||
|
$aIP = explode(':', $aIP[0]);
|
||||||
|
}
|
||||||
|
$c = count($aIP);
|
||||||
|
|
||||||
|
if ($c != 8) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// All the pieces should be 16-bit hex strings. Are they?
|
||||||
|
foreach ($aIP as $piece) {
|
||||||
|
if (!preg_match('#^[0-9a-fA-F]{4}$#s', sprintf('%04s', $piece))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $original;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes an entire attribute array for corrections needing multiple values.
|
||||||
|
*
|
||||||
|
* Occasionally, a certain attribute will need to be removed and popped onto
|
||||||
|
* another value. Instead of creating a complex return syntax for
|
||||||
|
* HTMLPurifier_AttrDef, we just pass the whole attribute array to a
|
||||||
|
* specialized object and have that do the special work. That is the
|
||||||
|
* family of HTMLPurifier_AttrTransform.
|
||||||
|
*
|
||||||
|
* An attribute transformation can be assigned to run before or after
|
||||||
|
* HTMLPurifier_AttrDef validation. See HTMLPurifier_HTMLDefinition for
|
||||||
|
* more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
abstract class HTMLPurifier_AttrTransform
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract: makes changes to the attributes dependent on multiple values.
|
||||||
|
*
|
||||||
|
* @param array $attr Assoc array of attributes, usually from
|
||||||
|
* HTMLPurifier_Token_Tag::$attr
|
||||||
|
* @param HTMLPurifier_Config $config Mandatory HTMLPurifier_Config object.
|
||||||
|
* @param HTMLPurifier_Context $context Mandatory HTMLPurifier_Context object
|
||||||
|
* @return array Processed attribute array.
|
||||||
|
*/
|
||||||
|
abstract public function transform($attr, $config, $context);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepends CSS properties to the style attribute, creating the
|
||||||
|
* attribute if it doesn't exist.
|
||||||
|
* @param array &$attr Attribute array to process (passed by reference)
|
||||||
|
* @param string $css CSS to prepend
|
||||||
|
*/
|
||||||
|
public function prependCSS(&$attr, $css)
|
||||||
|
{
|
||||||
|
$attr['style'] = isset($attr['style']) ? $attr['style'] : '';
|
||||||
|
$attr['style'] = $css . $attr['style'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves and removes an attribute
|
||||||
|
* @param array &$attr Attribute array to process (passed by reference)
|
||||||
|
* @param mixed $key Key of attribute to confiscate
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function confiscateAttr(&$attr, $key)
|
||||||
|
{
|
||||||
|
if (!isset($attr[$key])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
$value = $attr[$key];
|
||||||
|
unset($attr[$key]);
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pre-transform that changes proprietary background attribute to CSS.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrTransform_Background extends HTMLPurifier_AttrTransform
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param array $attr
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function transform($attr, $config, $context)
|
||||||
|
{
|
||||||
|
if (!isset($attr['background'])) {
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
|
||||||
|
$background = $this->confiscateAttr($attr, 'background');
|
||||||
|
// some validation should happen here
|
||||||
|
|
||||||
|
$this->prependCSS($attr, "background-image:url($background);");
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// this MUST be placed in post, as it assumes that any value in dir is valid
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Post-trasnform that ensures that bdo tags have the dir attribute set.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrTransform_BdoDir extends HTMLPurifier_AttrTransform
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $attr
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function transform($attr, $config, $context)
|
||||||
|
{
|
||||||
|
if (isset($attr['dir'])) {
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
$attr['dir'] = $config->get('Attr.DefaultTextDir');
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pre-transform that changes deprecated bgcolor attribute to CSS.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrTransform_BgColor extends HTMLPurifier_AttrTransform
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param array $attr
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function transform($attr, $config, $context)
|
||||||
|
{
|
||||||
|
if (!isset($attr['bgcolor'])) {
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
|
||||||
|
$bgcolor = $this->confiscateAttr($attr, 'bgcolor');
|
||||||
|
// some validation should happen here
|
||||||
|
|
||||||
|
$this->prependCSS($attr, "background-color:$bgcolor;");
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pre-transform that changes converts a boolean attribute to fixed CSS
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrTransform_BoolToCSS extends HTMLPurifier_AttrTransform
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Name of boolean attribute that is trigger.
|
||||||
|
* @type string
|
||||||
|
*/
|
||||||
|
protected $attr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CSS declarations to add to style, needs trailing semicolon.
|
||||||
|
* @type string
|
||||||
|
*/
|
||||||
|
protected $css;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $attr attribute name to convert from
|
||||||
|
* @param string $css CSS declarations to add to style (needs semicolon)
|
||||||
|
*/
|
||||||
|
public function __construct($attr, $css)
|
||||||
|
{
|
||||||
|
$this->attr = $attr;
|
||||||
|
$this->css = $css;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $attr
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function transform($attr, $config, $context)
|
||||||
|
{
|
||||||
|
if (!isset($attr[$this->attr])) {
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
unset($attr[$this->attr]);
|
||||||
|
$this->prependCSS($attr, $this->css);
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pre-transform that changes deprecated border attribute to CSS.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrTransform_Border extends HTMLPurifier_AttrTransform
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param array $attr
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function transform($attr, $config, $context)
|
||||||
|
{
|
||||||
|
if (!isset($attr['border'])) {
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
$border_width = $this->confiscateAttr($attr, 'border');
|
||||||
|
// some validation should happen here
|
||||||
|
$this->prependCSS($attr, "border:{$border_width}px solid;");
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic pre-transform that converts an attribute with a fixed number of
|
||||||
|
* values (enumerated) to CSS.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrTransform_EnumToCSS extends HTMLPurifier_AttrTransform
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Name of attribute to transform from.
|
||||||
|
* @type string
|
||||||
|
*/
|
||||||
|
protected $attr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lookup array of attribute values to CSS.
|
||||||
|
* @type array
|
||||||
|
*/
|
||||||
|
protected $enumToCSS = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Case sensitivity of the matching.
|
||||||
|
* @type bool
|
||||||
|
* @warning Currently can only be guaranteed to work with ASCII
|
||||||
|
* values.
|
||||||
|
*/
|
||||||
|
protected $caseSensitive = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $attr Attribute name to transform from
|
||||||
|
* @param array $enum_to_css Lookup array of attribute values to CSS
|
||||||
|
* @param bool $case_sensitive Case sensitivity indicator, default false
|
||||||
|
*/
|
||||||
|
public function __construct($attr, $enum_to_css, $case_sensitive = false)
|
||||||
|
{
|
||||||
|
$this->attr = $attr;
|
||||||
|
$this->enumToCSS = $enum_to_css;
|
||||||
|
$this->caseSensitive = (bool)$case_sensitive;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $attr
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function transform($attr, $config, $context)
|
||||||
|
{
|
||||||
|
if (!isset($attr[$this->attr])) {
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
|
||||||
|
$value = trim($attr[$this->attr]);
|
||||||
|
unset($attr[$this->attr]);
|
||||||
|
|
||||||
|
if (!$this->caseSensitive) {
|
||||||
|
$value = strtolower($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($this->enumToCSS[$value])) {
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
$this->prependCSS($attr, $this->enumToCSS[$value]);
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// must be called POST validation
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transform that supplies default values for the src and alt attributes
|
||||||
|
* in img tags, as well as prevents the img tag from being removed
|
||||||
|
* because of a missing alt tag. This needs to be registered as both
|
||||||
|
* a pre and post attribute transform.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrTransform_ImgRequired extends HTMLPurifier_AttrTransform
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $attr
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function transform($attr, $config, $context)
|
||||||
|
{
|
||||||
|
$src = true;
|
||||||
|
if (!isset($attr['src'])) {
|
||||||
|
if ($config->get('Core.RemoveInvalidImg')) {
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
$attr['src'] = $config->get('Attr.DefaultInvalidImage');
|
||||||
|
$src = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($attr['alt'])) {
|
||||||
|
if ($src) {
|
||||||
|
$alt = $config->get('Attr.DefaultImageAlt');
|
||||||
|
if ($alt === null) {
|
||||||
|
$attr['alt'] = basename($attr['src']);
|
||||||
|
} else {
|
||||||
|
$attr['alt'] = $alt;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$attr['alt'] = $config->get('Attr.DefaultInvalidImageAlt');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pre-transform that changes deprecated hspace and vspace attributes to CSS
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrTransform_ImgSpace extends HTMLPurifier_AttrTransform
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @type string
|
||||||
|
*/
|
||||||
|
protected $attr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type array
|
||||||
|
*/
|
||||||
|
protected $css = array(
|
||||||
|
'hspace' => array('left', 'right'),
|
||||||
|
'vspace' => array('top', 'bottom')
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $attr
|
||||||
|
*/
|
||||||
|
public function __construct($attr)
|
||||||
|
{
|
||||||
|
$this->attr = $attr;
|
||||||
|
if (!isset($this->css[$attr])) {
|
||||||
|
trigger_error(htmlspecialchars($attr) . ' is not valid space attribute');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $attr
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function transform($attr, $config, $context)
|
||||||
|
{
|
||||||
|
if (!isset($attr[$this->attr])) {
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
|
||||||
|
$width = $this->confiscateAttr($attr, $this->attr);
|
||||||
|
// some validation could happen here
|
||||||
|
|
||||||
|
if (!isset($this->css[$this->attr])) {
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
|
||||||
|
$style = '';
|
||||||
|
foreach ($this->css[$this->attr] as $suffix) {
|
||||||
|
$property = "margin-$suffix";
|
||||||
|
$style .= "$property:{$width}px;";
|
||||||
|
}
|
||||||
|
$this->prependCSS($attr, $style);
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs miscellaneous cross attribute validation and filtering for
|
||||||
|
* input elements. This is meant to be a post-transform.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrTransform_Input extends HTMLPurifier_AttrTransform
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @type HTMLPurifier_AttrDef_HTML_Pixels
|
||||||
|
*/
|
||||||
|
protected $pixels;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->pixels = new HTMLPurifier_AttrDef_HTML_Pixels();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $attr
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function transform($attr, $config, $context)
|
||||||
|
{
|
||||||
|
if (!isset($attr['type'])) {
|
||||||
|
$t = 'text';
|
||||||
|
} else {
|
||||||
|
$t = strtolower($attr['type']);
|
||||||
|
}
|
||||||
|
if (isset($attr['checked']) && $t !== 'radio' && $t !== 'checkbox') {
|
||||||
|
unset($attr['checked']);
|
||||||
|
}
|
||||||
|
if (isset($attr['maxlength']) && $t !== 'text' && $t !== 'password') {
|
||||||
|
unset($attr['maxlength']);
|
||||||
|
}
|
||||||
|
if (isset($attr['size']) && $t !== 'text' && $t !== 'password') {
|
||||||
|
$result = $this->pixels->validate($attr['size'], $config, $context);
|
||||||
|
if ($result === false) {
|
||||||
|
unset($attr['size']);
|
||||||
|
} else {
|
||||||
|
$attr['size'] = $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isset($attr['src']) && $t !== 'image') {
|
||||||
|
unset($attr['src']);
|
||||||
|
}
|
||||||
|
if (!isset($attr['value']) && ($t === 'radio' || $t === 'checkbox')) {
|
||||||
|
$attr['value'] = '';
|
||||||
|
}
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Post-transform that copies lang's value to xml:lang (and vice-versa)
|
||||||
|
* @note Theoretically speaking, this could be a pre-transform, but putting
|
||||||
|
* post is more efficient.
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrTransform_Lang extends HTMLPurifier_AttrTransform
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $attr
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function transform($attr, $config, $context)
|
||||||
|
{
|
||||||
|
$lang = isset($attr['lang']) ? $attr['lang'] : false;
|
||||||
|
$xml_lang = isset($attr['xml:lang']) ? $attr['xml:lang'] : false;
|
||||||
|
|
||||||
|
if ($lang !== false && $xml_lang === false) {
|
||||||
|
$attr['xml:lang'] = $lang;
|
||||||
|
} elseif ($xml_lang !== false) {
|
||||||
|
$attr['lang'] = $xml_lang;
|
||||||
|
}
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class for handling width/height length attribute transformations to CSS
|
||||||
|
*/
|
||||||
|
class HTMLPurifier_AttrTransform_Length extends HTMLPurifier_AttrTransform
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type string
|
||||||
|
*/
|
||||||
|
protected $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type string
|
||||||
|
*/
|
||||||
|
protected $cssName;
|
||||||
|
|
||||||
|
public function __construct($name, $css_name = null)
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
$this->cssName = $css_name ? $css_name : $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $attr
|
||||||
|
* @param HTMLPurifier_Config $config
|
||||||
|
* @param HTMLPurifier_Context $context
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function transform($attr, $config, $context)
|
||||||
|
{
|
||||||
|
if (!isset($attr[$this->name])) {
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
$length = $this->confiscateAttr($attr, $this->name);
|
||||||
|
if (ctype_digit($length)) {
|
||||||
|
$length .= 'px';
|
||||||
|
}
|
||||||
|
$this->prependCSS($attr, $this->cssName . ":$length;");
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: et sw=4 sts=4
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue