diff --git a/.github/ISSUE_TEMPLATE/0_support-ticket.md b/.github/ISSUE_TEMPLATE/0_support-ticket.md new file mode 100644 index 0000000..3308ed4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/0_support-ticket.md @@ -0,0 +1,19 @@ +--- +name: Support Ticket +about: Get support for an issue you are experiencing +title: "[Support] " +labels: support +assignees: '' + +--- + +## Description of Problem + + + +## Details + +* URL of Page exhibiting problem: +* Browser(s) exhibiting problem (Firefox, Chrome, etc.): +* Version of SLB Installed: +* Other plugins installed: diff --git a/.github/ISSUE_TEMPLATE/1_feature-request.md b/.github/ISSUE_TEMPLATE/1_feature-request.md new file mode 100644 index 0000000..a1c9284 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/1_feature-request.md @@ -0,0 +1,23 @@ +--- +name: Feature request +about: Enhance! Suggest an idea for SLB. +title: "[Request] " +labels: enhancement +assignees: '' + +--- + +## Description of feature + + + +## This feature would be used to + + + +## If you added this feature, I would: + +a) Eat my hat +b) Jump for joy +c) Shave my cat +d) All of the above diff --git a/.github/ISSUE_TEMPLATE/feedback.md b/.github/ISSUE_TEMPLATE/feedback.md new file mode 100644 index 0000000..3bfbebb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feedback.md @@ -0,0 +1,10 @@ +--- +name: Feedback +about: Share your feedback +title: "[Feedback] " +labels: feedback +assignees: '' + +--- + + diff --git a/.gitignore b/.gitignore index 44c26ae..a0e3f08 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .vscode .sass-cache -node_modules/ \ No newline at end of file +node_modules/ +vendor/ \ No newline at end of file diff --git a/changelog.txt b/changelog.txt index ddbd50f..4d2622a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,9 @@ += 2.8.1 = + +* Update: PHP 5.6 Compatibility +* Add: PHPCS configuration +* Add: GitHub Issue templates + = 2.8.0 = * Update: WordPress 5.3+ required. diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..eaa3c3b --- /dev/null +++ b/composer.json @@ -0,0 +1,8 @@ +{ + "require-dev": { + "squizlabs/php_codesniffer": "^3.5", + "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2", + "wp-coding-standards/wpcs": "^2.2", + "phpcompatibility/phpcompatibility-wp": "*" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..a00d60f --- /dev/null +++ b/composer.lock @@ -0,0 +1,340 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "d58ae19bd7c4cf76ada3935405677c26", + "packages": [], + "packages-dev": [ + { + "name": "dealerdirect/phpcodesniffer-composer-installer", + "version": "v0.6.2", + "source": { + "type": "git", + "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", + "reference": "8001af8eb107fbfcedc31a8b51e20b07d85b457a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/8001af8eb107fbfcedc31a8b51e20b07d85b457a", + "reference": "8001af8eb107fbfcedc31a8b51e20b07d85b457a", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0", + "php": "^5.3|^7", + "squizlabs/php_codesniffer": "^2|^3" + }, + "require-dev": { + "composer/composer": "*", + "phpcompatibility/php-compatibility": "^9.0", + "sensiolabs/security-checker": "^4.1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + }, + "autoload": { + "psr-4": { + "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Franck Nijhof", + "email": "franck.nijhof@dealerdirect.com", + "homepage": "http://www.frenck.nl", + "role": "Developer / IT Manager" + } + ], + "description": "PHP_CodeSniffer Standards Composer Installer Plugin", + "homepage": "http://www.dealerdirect.com", + "keywords": [ + "PHPCodeSniffer", + "PHP_CodeSniffer", + "code quality", + "codesniffer", + "composer", + "installer", + "phpcs", + "plugin", + "qa", + "quality", + "standard", + "standards", + "style guide", + "stylecheck", + "tests" + ], + "time": "2020-01-29T20:22:20+00:00" + }, + { + "name": "phpcompatibility/php-compatibility", + "version": "9.3.5", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibility.git", + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243", + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "squizlabs/php_codesniffer": "^2.3 || ^3.0.2" + }, + "conflict": { + "squizlabs/php_codesniffer": "2.6.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "homepage": "https://github.com/wimg", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors" + } + ], + "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.", + "homepage": "http://techblog.wimgodden.be/tag/codesniffer/", + "keywords": [ + "compatibility", + "phpcs", + "standards" + ], + "time": "2019-12-27T09:44:58+00:00" + }, + { + "name": "phpcompatibility/phpcompatibility-paragonie", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git", + "reference": "b862bc32f7e860d0b164b199bd995e690b4b191c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/b862bc32f7e860d0b164b199bd995e690b4b191c", + "reference": "b862bc32f7e860d0b164b199bd995e690b4b191c", + "shasum": "" + }, + "require": { + "phpcompatibility/php-compatibility": "^9.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5", + "paragonie/random_compat": "dev-master", + "paragonie/sodium_compat": "dev-master" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "lead" + } + ], + "description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.", + "homepage": "http://phpcompatibility.com/", + "keywords": [ + "compatibility", + "paragonie", + "phpcs", + "polyfill", + "standards" + ], + "time": "2019-11-04T15:17:54+00:00" + }, + { + "name": "phpcompatibility/phpcompatibility-wp", + "version": "2.1.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", + "reference": "41bef18ba688af638b7310666db28e1ea9158b2f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/41bef18ba688af638b7310666db28e1ea9158b2f", + "reference": "41bef18ba688af638b7310666db28e1ea9158b2f", + "shasum": "" + }, + "require": { + "phpcompatibility/php-compatibility": "^9.0", + "phpcompatibility/phpcompatibility-paragonie": "^1.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "lead" + } + ], + "description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.", + "homepage": "http://phpcompatibility.com/", + "keywords": [ + "compatibility", + "phpcs", + "standards", + "wordpress" + ], + "time": "2019-08-28T14:22:28+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.5.4", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "dceec07328401de6211037abbb18bda423677e26" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dceec07328401de6211037abbb18bda423677e26", + "reference": "dceec07328401de6211037abbb18bda423677e26", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2020-01-30T22:20:29+00:00" + }, + { + "name": "wp-coding-standards/wpcs", + "version": "2.2.1", + "source": { + "type": "git", + "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", + "reference": "b5a453203114cc2284b1a614c4953456fbe4f546" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/b5a453203114cc2284b1a614c4953456fbe4f546", + "reference": "b5a453203114cc2284b1a614c4953456fbe4f546", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "squizlabs/php_codesniffer": "^3.3.1" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || ^0.6", + "phpcompatibility/php-compatibility": "^9.0", + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.6 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Contributors", + "homepage": "https://github.com/WordPress/WordPress-Coding-Standards/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions", + "keywords": [ + "phpcs", + "standards", + "wordpress" + ], + "time": "2020-02-04T02:52:06+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/includes/class-requirements-check.php b/includes/class-requirements-check.php index 63ec797..774a22b 100644 --- a/includes/class-requirements-check.php +++ b/includes/class-requirements-check.php @@ -34,7 +34,7 @@ class SLB_Requirements_Check { * @var array */ private $deps = array( - 'php' => '5.4', + 'php' => '5.6.20', ); /** diff --git a/includes/class.field_base.php b/includes/class.field_base.php index 0f4fa2d..a62c29e 100644 --- a/includes/class.field_base.php +++ b/includes/class.field_base.php @@ -491,9 +491,16 @@ private function init_id_formats() { * @param bool $overwrite Optional. Overwrite existing format. Default false. * @return void */ - protected function add_id_format( string $name, array $options, bool $overwrite = false ) { + protected function add_id_format( $name, array $options, $overwrite = false ) { // Init ID formats before adding new ones. $this->init_id_formats(); + // Validate args. + $name = trim($name); + // Stop if name invalid. + if ( empty( $name ) ) { + return; + } + $overwrite = (bool) $overwrite; // Do not add format if name matches existing format (when overwriting not allowed). if ( ! $overwrite && in_array( $name, array_keys( $this->id_formats ) ) ) { return; diff --git a/includes/class.fields.php b/includes/class.fields.php index 816a08d..4435db5 100644 --- a/includes/class.fields.php +++ b/includes/class.fields.php @@ -390,7 +390,7 @@ function process_placeholder_loop($output, $item, $placeholder, $layout, $data) * * @return string Processed value. */ - function process_placeholder_data_ext( string $output, SLB_Field $item, array $placeholder, string $layout, array $data ) { + function process_placeholder_data_ext( $output, SLB_Field $item, array $placeholder, $layout, array $data ) { $key = ( isset( $placeholder['attributes']['id'] ) ) ? $placeholder['attributes']['id'] : false; if ( !! $key && isset( $data[ $key ] ) && is_scalar( $data[ $key ] ) ) { $output = strval( $data[ $key ] ); diff --git a/main.php b/main.php index bbb8108..898f360 100644 --- a/main.php +++ b/main.php @@ -9,9 +9,9 @@ * Plugin Name: Simple Lightbox * Plugin URI: http://archetyped.com/tools/simple-lightbox/ * Description: The highly customizable lightbox for WordPress - * Version: 2.8.0 + * Version: 2.8.1 * Requires at least: 5.3 - * Requires PHP: 7.2 + * Requires PHP: 5.6.20 * Text Domain: simple-lightbox * Domain Path: /l10n * Author: Archetyped diff --git a/package-lock.json b/package-lock.json index 36e6fdf..472be9c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "simple-lightbox", - "version": "2.8.0", + "version": "2.8.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 1072989..e81a074 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "simple-lightbox", - "version": "2.8.0", + "version": "2.8.1", "title": "Simple Lightbox", "description": "The highly-customizable lightbox for WordPress", "author": "Archetyped ", diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 0000000..667db28 --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,128 @@ + + + + Custom ruleset for AR/WP/Plugins + + + + + + + + + + + /vendor/* + + + /node_modules/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/readme.txt b/readme.txt index ccc87d8..439b766 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ License: GPLv2 Tags: lightbox, gallery, photography, images, theme, template, style Requires at least: 5.3 Tested up to: 5.3 -Requires PHP: 7.2 +Requires PHP: 5.6.20 Stable tag: trunk The highly customizable lightbox for WordPress @@ -64,6 +64,12 @@ Get more information on [Simple Lightbox's official page](http://archetyped.com/ == Changelog == += 2.8.1 = + +* Update: PHP 5.6 Compatibility +* Add: PHPCS configuration +* Add: GitHub Issue templates + = 2.8.0 = * Update: WordPress 5.3+ required.