diff --git a/.gitignore b/.gitignore index 61d10f4..e851a20 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ Release*/ *.app/ *.pyc .svn/ +.idea/ ################################### # IDE specific diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 73f69e0..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml -# Editor-based HTTP Client requests -/httpRequests/ diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 639900d..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 6e8debc..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 929a539..bb35ae3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,36 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +## [1.4.0] - 2024-01-19 + +### Documentation + +- :memo: added changelog entry + +### Features + +- :memo: update some text and assets + +### Refactor + +- :recycle: updated release script +- :recycle: updated release script +- :recycle: updated copyright +- :recycle: updates from Jan based on WordPress feedback +- :wrench: added Wink-Version to API request +- :wrench: added Wink-Version to API request +- :fire: removed .idea directory from repo + +### Build + +- :wrench: updated release script +- :wrench: updated release script +- :wrench: updated release script +- Arrow_up: bumping version and merging to master +- :bookmark: updated Wink plugin version +- :wrench: updated text file for Wordpress re-submission + # wink-wordpress-plugin changelog Changelog of wink-wordpress-plugin. diff --git a/README.md b/README.md index 779d6a8..47dc67a 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ * Summary: Integrates WordPress with your Wink account at [https://sell.wink.travel](https://sell.wink.travel) ### Setup ### -Once you've created an account with Wink, you can install this WordPress plugin on your site. Once installed, the plugin will ask you for your clientId and secretKey to connect with your account on WINK. +Once you've created an account with Wink, you can install this WordPress plugin on your site. Once installed, the plugin will ask you for your clientId and secretKey to connect with your account on Wink. Once you've entered your credentials, you can go to your Gutenberg editor and start embedding our web components into your site. diff --git a/README.txt b/README.txt index 93a4504..c30765a 100644 --- a/README.txt +++ b/README.txt @@ -1,10 +1,10 @@ -=== iko.travel Affiliate === -Contributors: MB-Jan, wink -Tags: wink2travel, travel, wink, booking +=== wink2travel === +Contributors: MB-Jan, bjornharvold +Tags: wink2travel, travel, hotel, booking, affiliate network Requires at least: 4.7 -Tested up to: 6.3.1 -Stable tag: 1.3.1 -Version: 1.3.1 +Tested up to: 6.4 +Stable tag: $versionNumber +Version: $versionNumber Requires PHP: 7.4 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -25,6 +25,10 @@ Available components: * [winkitinerary]Itinerary: Same as search button, only it contains itinerary information as button text. * [winkcontent]: Lets you embed the inventory you've selected on Wink directly into a page or post. +== External Services == + +This plugin requires a Wink account. It uses the Wink API to retrieve travel inventory data from your Wink account. You can find more information about Wink at [https://wink.travel](https://wink.travel "Influencer-driven travel booking"). + == Options == There are multiple ways to use our components: @@ -53,94 +57,4 @@ No. It is not yet compatible with PHP 8.x == Changelog == -= 1.3.1 = -* Migrating over to new WordPress repo. - -= 1.3.0 = -* Migrating over to new WordPress repo. - -= 1.2.23 = -* Updated release script. - -= 1.2.22 = -* Updated release script. - -= 1.2.21 = -* Updated release script. - -= 1.2.20 = -* Updated release script. - -= 1.2.19 = -* Updated readme and tested with latest version of WordPress. - -= 1.2.18 = -* Rebrand to Wink. - -= 1.2.17 = -* Includes multiple fixes + notice if permalinks have not been set in WordPress. - -= 1.2.16 = -* Disabled sslverify in development environment. - -= 1.2.15 = -* Build related. - -= 1.2.14 = -* Build related. - -= 1.2.13 = -* Build related. - -= 1.2.12 = -* Build related. - -= 1.2.11 = -* Build related. - -= 1.2.10 = -* Build related. - -= 1.2.9 = -* Build related. - -= 1.2.8 = -* Build related. - -= 1.2.7 = -* Build related. - -= 1.2.6 = -* Build related. - -= 1.2.5 = -* Build related. - -= 1.2.4 = -* Removed references to old scripts.js. - -= 1.2.3 = -* Minor fix for silent-refresh endpoint. - -= 1.2.2 = -* Added further security features. - -= 1.2.1 = -* Updates to add compliance with WordPress codex. - -= 1.1.2 = -* silent-refresh.html Support - -= 1.1.1 = -* Added dynamic version to static resources - -= 1.1.0 = -* Accommodated API changes - -= 1.0.19 = -* Initial Launch - -== Upgrade Notice == - -= 1.2.1 = -This version is now fully compliant with the WordPress codex and has increased compatibility with different server environments. \ No newline at end of file +See CHANGELOG.md for details diff --git a/img/logo.png b/img/logo.png index badd8a0..bee15ed 100644 Binary files a/img/logo.png and b/img/logo.png differ diff --git a/includes/elementHandler.php b/includes/elementHandler.php index fddb40b..899733b 100644 --- a/includes/elementHandler.php +++ b/includes/elementHandler.php @@ -6,11 +6,9 @@ } class winkElements { - protected $namespace = 'wink'; protected $clientIdKey = 'winkClientId'; protected $clientSecretKey = 'winkSecret'; function __construct() { - // $this->namespace = 'wink'; $this->pluginURL = trailingslashit( plugin_dir_url( __FILE__ ) ); $this->imgURL = trailingslashit( dirname( plugin_dir_url( __FILE__ ) ) ) . 'img/'; $this->environmentVal = get_option('winkEnvironment', 'production'); diff --git a/includes/elements/avada/fusionElements.php b/includes/elements/avada/fusionElements.php index 756fd30..73e7b5c 100644 --- a/includes/elements/avada/fusionElements.php +++ b/includes/elements/avada/fusionElements.php @@ -27,7 +27,7 @@ function initElements() { "name" => $shortcodeData['name'], "shortcode" => $shortcodeData['code'], "class" => "", - "category" => esc_html__( "Content", $this->namespace), + "category" => esc_html__( "Content", "wink"), "icon" => 'fusion-module-icon fusiona-widget', "params" => $params )); diff --git a/includes/elements/elementor/elementorControls.php b/includes/elements/elementor/elementorControls.php index 628f509..f26db0b 100644 --- a/includes/elements/elementor/elementorControls.php +++ b/includes/elements/elementor/elementorControls.php @@ -2,19 +2,17 @@ if ( ! defined( 'ABSPATH' ) ) exit; class winkDefault extends \Elementor\Base_Control { - public $namespace; public function get_type() { return 'winkDefault'; } public function content_template() { - $this->namespace = 'wink'; ?>
-
namespace ); ?>
+
-
namespace ) . ' '.esc_html(__('here',$this->namespace)).''; ?>
+
'.esc_html(__('here',"wink")).''; ?>
namespace ); + return esc_html__( 'wink Account', "wink" ); } public function get_icon() { return 'eicon-external-link-square'; @@ -20,7 +19,7 @@ protected function _register_controls() { $this->start_controls_section( 'content_section', [ - 'label' => esc_html__( 'wink Options', $this->namespace ) + 'label' => esc_html__( 'wink Options', "wink" ) ] ); @@ -39,7 +38,7 @@ protected function _register_controls() { protected function render() { $settings = $this->get_settings_for_display(); - echo do_shortcode('[winkaccount]'); + echo wp_kses(do_shortcode('[winkaccount]')); } } diff --git a/includes/elements/elementor/winkcontent.php b/includes/elements/elementor/winkcontent.php index 4ecff94..7c6384e 100644 --- a/includes/elements/elementor/winkcontent.php +++ b/includes/elements/elementor/winkcontent.php @@ -2,12 +2,11 @@ if ( ! defined( 'ABSPATH' ) ) exit; class elementorWinkContent extends \Elementor\Widget_Base { - protected $namespace = 'wink'; public function get_name() { return 'winkcontent'; } public function get_title() { - return __( 'wink Content', $this->namespace ); + return __( 'wink Content', "wink" ); } public function get_icon() { return 'eicon-external-link-square'; @@ -20,7 +19,7 @@ protected function _register_controls() { $this->start_controls_section( 'content_section', [ - 'label' => esc_html__( 'wink Options', $this->namespace ) + 'label' => esc_html__( 'wink Options', "wink" ) ] ); $shortcodes = array(); @@ -38,7 +37,7 @@ protected function _register_controls() { 'type' => \Elementor\Controls_Manager::SELECT, 'placeholder' => '', 'options' => $options, - 'description' => esc_html__('Select any of your saved inventories. We strongly recommend to use this block only in full-width content areas and not in columns.', $this->namespace ), + 'description' => esc_html__('Select any of your saved inventories. We strongly recommend to use this block only in full-width content areas and not in columns.', "wink" ), ] ); } @@ -48,7 +47,7 @@ protected function _register_controls() { } protected function render() { $settings = $this->get_settings_for_display(); - echo do_shortcode('[winkcontent layoutid="'.esc_html($settings['layoutid']).'"]'); + echo wp_kses(do_shortcode('[winkcontent layoutid="'.esc_html($settings['layoutid']).'"]')); } } diff --git a/includes/elements/elementor/winkitinerary.php b/includes/elements/elementor/winkitinerary.php index ac14a09..18743bd 100644 --- a/includes/elements/elementor/winkitinerary.php +++ b/includes/elements/elementor/winkitinerary.php @@ -2,12 +2,11 @@ if ( ! defined( 'ABSPATH' ) ) exit; class elementorWinkItinerary extends \Elementor\Widget_Base { - protected $namespace = 'wink'; public function get_name() { return 'winkitinerary'; } public function get_title() { - return esc_html__( 'wink Itinerary Button', $this->namespace ); + return esc_html__( 'wink Itinerary Button', "wink" ); } public function get_icon() { return 'eicon-external-link-square'; @@ -20,7 +19,7 @@ protected function _register_controls() { $this->start_controls_section( 'content_section', [ - 'label' => esc_html__( 'wink Options', $this->namespace ) + 'label' => esc_html__( 'wink Options', "wink" ) ] ); @@ -39,7 +38,7 @@ protected function _register_controls() { protected function render() { $settings = $this->get_settings_for_display(); - echo do_shortcode('[winkitinerary]'); + echo wp_kses(do_shortcode('[winkitinerary]')); } } diff --git a/includes/elements/elementor/winkitineraryform.php b/includes/elements/elementor/winkitineraryform.php index 54e46b7..3f37a10 100644 --- a/includes/elements/elementor/winkitineraryform.php +++ b/includes/elements/elementor/winkitineraryform.php @@ -2,12 +2,11 @@ if ( ! defined( 'ABSPATH' ) ) exit; class elementorWinkItineraryForm extends \Elementor\Widget_Base { - protected $namespace = 'wink'; public function get_name() { return 'winkitineraryform'; } public function get_title() { - return esc_html__( 'wink Itinerary Form', $this->namespace ); + return esc_html__( 'wink Itinerary Form', "wink" ); } public function get_icon() { return 'eicon-external-link-square'; @@ -20,7 +19,7 @@ protected function _register_controls() { $this->start_controls_section( 'content_section', [ - 'label' => esc_html__( 'wink Options', $this->namespace ) + 'label' => esc_html__( 'wink Options', "wink" ) ] ); @@ -39,7 +38,7 @@ protected function _register_controls() { protected function render() { $settings = $this->get_settings_for_display(); - echo do_shortcode('[winkitineraryform]'); + echo wp_kses(do_shortcode('[winkitineraryform]')); } } diff --git a/includes/elements/elementor/winklookup.php b/includes/elements/elementor/winklookup.php index 2d96a41..e878ccc 100644 --- a/includes/elements/elementor/winklookup.php +++ b/includes/elements/elementor/winklookup.php @@ -2,12 +2,11 @@ if ( ! defined( 'ABSPATH' ) ) exit; class elementorWinkLookup extends \Elementor\Widget_Base { - protected $namespace = 'wink'; public function get_name() { return 'winklookup'; } public function get_title() { - return esc_html__( 'wink Lookup', $this->namespace ); + return esc_html__( 'wink Lookup', "wink" ); } public function get_icon() { return 'eicon-external-link-square'; @@ -20,7 +19,7 @@ protected function _register_controls() { $this->start_controls_section( 'content_section', [ - 'label' => esc_html__( 'wink Options', $this->namespace ) + 'label' => esc_html__( 'wink Options', "wink" ) ] ); @@ -39,7 +38,7 @@ protected function _register_controls() { protected function render() { $settings = $this->get_settings_for_display(); - echo do_shortcode('[winklookup]'); + echo wp_kses(do_shortcode('[winklookup]')); } } diff --git a/includes/elements/elementor/winksearch.php b/includes/elements/elementor/winksearch.php index 5f38dd9..f486546 100644 --- a/includes/elements/elementor/winksearch.php +++ b/includes/elements/elementor/winksearch.php @@ -2,12 +2,11 @@ if ( ! defined( 'ABSPATH' ) ) exit; class elementorWinkSearch extends \Elementor\Widget_Base { - protected $namespace = 'wink'; public function get_name() { return 'winksearch'; } public function get_title() { - return esc_html__( 'wink Search', $this->namespace ); + return esc_html__( 'wink Search', "wink" ); } public function get_icon() { return 'eicon-external-link-square'; @@ -20,7 +19,7 @@ protected function _register_controls() { $this->start_controls_section( 'content_section', [ - 'label' => esc_html__( 'wink Options', $this->namespace ) + 'label' => esc_html__( 'wink Options', "wink" ) ] ); @@ -39,7 +38,7 @@ protected function _register_controls() { protected function render() { $settings = $this->get_settings_for_display(); - echo do_shortcode('[winksearch]'); + echo wp_kses(do_shortcode('[winksearch]')); } } diff --git a/includes/elements/winkaccount.php b/includes/elements/winkaccount.php index fb62da8..fc173d8 100644 --- a/includes/elements/winkaccount.php +++ b/includes/elements/winkaccount.php @@ -5,7 +5,7 @@ class winkAccount extends winkElements { function __construct() { parent::__construct(); $this->blockCode = 'winkaccount'; - $this->blockName = esc_html__( "wink Account", $this->namespace ); + $this->blockName = esc_html__( "wink Account", "wink" ); add_action('init', array( $this,'gutenbergBlockRegistration' ) ); // Adding Gutenberg Block add_shortcode( $this->blockCode, array( $this,'blockHandler') ); add_filter('winkShortcodes',array( $this, 'shortcodeData') ); @@ -61,7 +61,7 @@ function gutenbergBlockRegistration() { ); $jsData = array( - 'blockCat' => $this->namespace.'-blocks', + 'blockCat' => "wink".'-blocks', 'imgURL' => $this->imgURL, 'mode' => $this->environmentVal ); @@ -72,7 +72,7 @@ function gutenbergBlockRegistration() { 'editor_script' => 'winkBlockRenderer_'.$this->blockCode, 'render_callback' => array($this,'blockHandler'), 'attributes' => [], - 'category' => $this->namespace.'-blocks' + 'category' => "wink".'-blocks' )); } } diff --git a/includes/elements/winkcontent.php b/includes/elements/winkcontent.php index 88c2251..13938a9 100644 --- a/includes/elements/winkcontent.php +++ b/includes/elements/winkcontent.php @@ -5,7 +5,7 @@ class winkContent extends winkElements { function __construct() { parent::__construct(); $this->blockCode = 'winkcontent'; - $this->blockName = esc_html__( "wink Content", $this->namespace ); + $this->blockName = esc_html__( "wink Content", "wink" ); $this->attributes = [ 'layout' => [ 'default' => '', @@ -27,7 +27,7 @@ function __construct() { function shortcodeData($shortcodes) { $winkContentData = $this->getwinkBearerToken(); $values = array( - esc_html__( 'Select...', $this->namespace ) => '' + esc_html__( 'Select...', "wink" ) => '' ); foreach($winkContentData as $key => $localValue) { @@ -41,10 +41,10 @@ function shortcodeData($shortcodes) { "type" => "dropdown", "holder" => "div", "class" => "", - "heading" => __( "Inventory", $this->namespace ), + "heading" => __( "Inventory", "wink" ), "param_name" => "layoutid", 'value' => $values, - "description" => __('Select any of your saved layouts. We strongly recommend to use this block only in full-width content areas and not in columns.', $this->namespace ) + "description" => __('Select any of your saved layouts. We strongly recommend to use this block only in full-width content areas and not in columns.', "wink" ) ), ) ); @@ -147,31 +147,31 @@ function getwinkBearerToken() 'sslverify' => true, ); if ($this->environmentVal == 'development') { - error_log('WINK - Development environment. Ignoring self-signed certificates'); + error_log('Wink - Development environment. Ignoring self-signed certificates'); $postArgs['sslverify'] = false; } $url = $env . '/oauth2/token'; $response = wp_remote_post($url,$postArgs); if ( is_wp_error( $response ) ) { // print out any error - error_log('WINK - Empty response when trying to retrieve token. Details below:'); + error_log('Wink - Empty response when trying to retrieve token. Details below:'); error_log($response->get_error_message()); } else { if (!empty($response['body'])) { $data = json_decode($response['body'], true); if (!empty($data)) { - // error_log('WINK - token $data' . $data); + // error_log('Wink - token $data' . $data); if (!empty($data['access_token']) && !empty($data['expires_in'])) { update_option('winkcontentBearer', $data['access_token']); update_option('winkcontentTime', $data['expires_in'] + current_time('timestamp')); $bearerToken = $data['access_token']; } } else { - error_log('WINK - Empty response body when trying to retrieve token.'); + error_log('Wink - Empty response body when trying to retrieve token.'); } } else { - error_log('WINK - Unable to get response body content while retrieving token. Response array below:'); + error_log('Wink - Unable to get response body content while retrieving token. Response array below:'); error_log(print_r($response,true)); } } @@ -183,7 +183,7 @@ function getwinkBearerToken() if (!empty($bearerToken)) { return $this->getwinkLayouts($bearerToken); } else { - error_log('WINK - Bearer token empty'); + error_log('Wink - Bearer token empty'); } return array(); @@ -199,22 +199,24 @@ function getwinkLayouts($bearerToken) { $url = $env . '/api/inventory/campaign/list'; $options = array('http' => array( 'method' => 'GET', + 'Wink-Version' => '2.0', 'header' => 'Authorization: Bearer '.$bearerToken )); $context = stream_context_create($options); $getArgs = array( 'headers' => array( + 'Wink-Version' => '2.0', 'Authorization' => 'Bearer '.$bearerToken ) ); if ($this->environmentVal == 'development') { - error_log('WINK - Development environment. Ignoring self-signed certificates'); + error_log('Wink - Development environment. Ignoring self-signed certificates'); $getArgs['sslverify'] = false; } $response = wp_remote_get($url,$getArgs); if ( is_wp_error( $response ) ) { // print out any error - error_log('WINK - Empty response when trying to retrieve layouts. Details below:'); + error_log('Wink - Empty response when trying to retrieve layouts. Details below:'); error_log($response->get_error_message()); } else { if (!empty($response['body'])) { @@ -223,15 +225,15 @@ function getwinkLayouts($bearerToken) { if (!empty($data['status']) && $data['error'] == 404) { delete_option( 'winkData' ); delete_option( 'winkdataTime' ); - error_log('WINK - Unable to retrieve layout data.'); + error_log('Wink - Unable to retrieve layout data.'); } else { - // error_log('WINK - layout $data' . $data); + // error_log('Wink - layout $data' . $data); update_option('winkData', $data); update_option('winkdataTime', 60 * 2 + current_time('timestamp')); // 2 minutes return $data; } } else { - error_log('WINK - Unable to get response body content while retrieving layouts. Response array below:'); + error_log('Wink - Unable to get response body content while retrieving layouts. Response array below:'); error_log(print_r($response,true)); } } @@ -265,7 +267,7 @@ function gutenbergBlockRegistration() ); $jsData = array( - 'blockCat' => $this->namespace . '-blocks', + 'blockCat' => "wink" . '-blocks', 'imgURL' => $this->imgURL, 'mode' => $this->environmentVal ); @@ -280,7 +282,7 @@ function gutenbergBlockRegistration() 'editor_script' => 'winkBlockRenderer_' . $this->blockCode, 'render_callback' => array($this, 'blockHandler'), 'attributes' => $this->attributes, - 'category' => $this->namespace . '-blocks' + 'category' => "wink" . '-blocks' )); } } diff --git a/includes/elements/winkitinerary.php b/includes/elements/winkitinerary.php index 9d8539a..23faf61 100644 --- a/includes/elements/winkitinerary.php +++ b/includes/elements/winkitinerary.php @@ -5,7 +5,7 @@ class winkItinerary extends winkElements { function __construct() { parent::__construct(); $this->blockCode = 'winkitinerary'; - $this->blockName = esc_html__( "wink Itinerary Button", $this->namespace ); + $this->blockName = esc_html__( "wink Itinerary Button", "wink" ); add_action('init', array( $this,'gutenbergBlockRegistration' ) ); // Adding Gutenberg Block add_shortcode( $this->blockCode, array( $this,'blockHandler') ); add_filter('winkShortcodes',array( $this, 'shortcodeData') ); @@ -61,7 +61,7 @@ function gutenbergBlockRegistration() { ); $jsData = array( - 'blockCat' => $this->namespace.'-blocks', + 'blockCat' => "wink".'-blocks', 'imgURL' => $this->imgURL, 'mode' => $this->environmentVal ); @@ -77,7 +77,7 @@ function gutenbergBlockRegistration() { // 'type' => 'string' // ] ], - 'category' => $this->namespace.'-blocks' + 'category' => "wink".'-blocks' )); } } diff --git a/includes/elements/winkitineraryform.php b/includes/elements/winkitineraryform.php index 242ecd0..199ddba 100644 --- a/includes/elements/winkitineraryform.php +++ b/includes/elements/winkitineraryform.php @@ -5,7 +5,7 @@ class winkItineraryForm extends winkElements { function __construct() { parent::__construct(); $this->blockCode = 'winkitineraryform'; - $this->blockName = esc_html__( "wink Itinerary Form", $this->namespace ); + $this->blockName = esc_html__( "wink Itinerary Form", "wink" ); add_action('init', array( $this,'gutenbergBlockRegistration' ) ); // Adding Gutenberg Block add_shortcode( $this->blockCode, array( $this,'blockHandler') ); add_filter('winkShortcodes',array( $this, 'shortcodeData') ); @@ -61,7 +61,7 @@ function gutenbergBlockRegistration() { ); $jsData = array( - 'blockCat' => $this->namespace.'-blocks', + 'blockCat' => "wink".'-blocks', 'imgURL' => $this->imgURL, 'mode' => $this->environmentVal ); @@ -77,7 +77,7 @@ function gutenbergBlockRegistration() { // 'type' => 'string' // ] ], - 'category' => $this->namespace.'-blocks' + 'category' => "wink".'-blocks' )); } } diff --git a/includes/elements/winklookup.php b/includes/elements/winklookup.php index c349fea..514123a 100644 --- a/includes/elements/winklookup.php +++ b/includes/elements/winklookup.php @@ -5,7 +5,7 @@ class winkLookup extends winkElements { function __construct() { parent::__construct(); $this->blockCode = 'winklookup'; - $this->blockName = esc_html__( "wink Lookup", $this->namespace ); + $this->blockName = esc_html__( "wink Lookup", "wink" ); add_action('init', array( $this,'gutenbergBlockRegistration' ) ); // Adding Gutenberg Block add_shortcode( $this->blockCode, array( $this,'blockHandler') ); add_filter('winkShortcodes',array( $this, 'shortcodeData') ); @@ -61,7 +61,7 @@ function gutenbergBlockRegistration() { ); $jsData = array( - 'blockCat' => $this->namespace.'-blocks', + 'blockCat' => "wink".'-blocks', 'imgURL' => $this->imgURL, 'mode' => $this->environmentVal ); @@ -77,7 +77,7 @@ function gutenbergBlockRegistration() { // 'type' => 'string' // ] ], - 'category' => $this->namespace.'-blocks' + 'category' => "wink".'-blocks' )); } } diff --git a/includes/elements/winksearch.php b/includes/elements/winksearch.php index 6ef072a..bccfc46 100644 --- a/includes/elements/winksearch.php +++ b/includes/elements/winksearch.php @@ -5,7 +5,7 @@ class winkSearch extends winkElements { function __construct() { parent::__construct(); $this->blockCode = 'winksearch'; - $this->blockName = esc_html__( "wink Search", $this->namespace ); + $this->blockName = esc_html__( "wink Search", "wink" ); add_action('init', array( $this,'gutenbergBlockRegistration' ) ); // Adding Gutenberg Block add_shortcode( $this->blockCode, array( $this,'blockHandler') ); add_filter('winkShortcodes',array( $this, 'shortcodeData') ); @@ -62,7 +62,7 @@ function gutenbergBlockRegistration() { $jsData = array( - 'blockCat' => $this->namespace.'-blocks', + 'blockCat' => "wink".'-blocks', 'imgURL' => $this->imgURL, 'mode' => $this->environmentVal ); @@ -80,7 +80,7 @@ function gutenbergBlockRegistration() { // 'type' => 'string' // ] ], - 'category' => $this->namespace.'-blocks' + 'category' => "wink".'-blocks' )); } } diff --git a/includes/elements/wpbakery/vcElements.php b/includes/elements/wpbakery/vcElements.php index 3bd525b..d1f7ef4 100644 --- a/includes/elements/wpbakery/vcElements.php +++ b/includes/elements/wpbakery/vcElements.php @@ -33,9 +33,9 @@ function initElements() { "class" => "", "param_name" => "placeholder", "value" => 1, - "heading" => esc_html__( "This component does not require any configuration.", $this->namespace ), - "description" => esc_html__( "Simply ensure that you have entered the correct Client-ID and Client-Secret ", $this->namespace ) . ' '. - esc_html__('here',$this->namespace).' ' + "heading" => esc_html__( "This component does not require any configuration.", "wink" ), + "description" => esc_html__( "Simply ensure that you have entered the correct Client-ID and Client-Secret ", "wink" ) . ' '. + esc_html__('here',"wink").' ' ) ); } @@ -43,7 +43,7 @@ function initElements() { "name" => $shortcodeData['name'], "base" => $shortcodeData['code'], "class" => "", - "category" => esc_html__( "Content", $this->namespace), + "category" => esc_html__( "Content", "wink"), "icon" => $this->imgURL.'logo.png', "params" => $params )); diff --git a/releaseToMaster.bash b/releaseToMaster.bash index b63d4a8..2083bbe 100755 --- a/releaseToMaster.bash +++ b/releaseToMaster.bash @@ -1,68 +1,83 @@ #!/bin/bash # -# Copyright (c) iko.travel 2022. +# Copyright (c) wink.travel 2022. # -echo "Disabling git messages for a release" -export GIT_MERGE_AUTOEDIT=no - echo "Releasing new version of Wink Affiliate WordPress plugin with git flow..." -echo "Enter version number. E.g. 1.2.3"; -read versionNumber +versionNumber=$(npx git-changelog-command-line --print-next-version --major-version-pattern BREAKING --minor-version-pattern feat) + +read -p "Do you want to proceed with version $versionNumber? (y/n) " yn + +case $yn in +[yY]) + echo "Disabling git messages for a release" + export GIT_MERGE_AUTOEDIT=no -versionNumber="v${versionNumber}"; + git cliff --unreleased --tag $versionNumber --sort newest --prepend CHANGELOG.md -git cliff --unreleased --tag $versionNumber --sort newest --prepend CHANGELOG.md + echo "Committing version changes for $versionNumber" + sed -i '' 's/Version.*/Version: $versionNumber/g' README.txt + sed -i '' 's/Stable tag.*/Stable tag: $versionNumber/g' README.txt + sed -i '' 's/Version.*/Version: $versionNumber/g' wink.php -echo "Committing version changes for $versionNumber" -git commit -a -m "build: bookmark: merge to master + git commit -a -m "build: arrow_up: bumping version and merging to master -Version bump to $versionNumber registered + Version bump to $versionNumber registered -Ops: $USER -" + Ops: $USER + " -git push --follow-tags origin develop + git push --follow-tags origin develop -echo "Calling 'git flow release $versionNumber'" -git flow release start $versionNumber + echo "Calling 'git flow release $versionNumber'" + git flow release start $versionNumber -echo "Calling 'git flow finish -m $versionNumber $versionNumber'" -git flow release finish -m $versionNumber $versionNumber + echo "Calling 'git flow finish -m $versionNumber $versionNumber'" + git flow release finish -m $versionNumber $versionNumber -echo "Checking out master..." -git checkout master + echo "Checking out master..." + git checkout master -echo "Updating CHANGELOG.md..." -npx git-changelog-command-line -of CHANGELOG.md -git commit -a -m ":memo: doc: Updated CHANGELOG.md..." + echo "Updating CHANGELOG.md..." + npx git-changelog-command-line -of CHANGELOG.md + git commit -a -m ":memo: doc: Updated CHANGELOG.md..." -git push origin master:refs/heads/master + git push origin master:refs/heads/master -echo "Creating GitHub release..." -gh release create $versionNumber --notes "See CHANGELOG.md for release notes" --target master + echo "Creating GitHub release..." + gh release create $versionNumber --notes "See CHANGELOG.md for release notes" --target master -echo "Pulling ORIGIN master into local branch..." -git pull origin + echo "Pulling ORIGIN master into local branch..." + git pull origin -echo "Pushing master (+ tags) to ORIGIN..." -git push + echo "Pushing master (+ tags) to ORIGIN..." + git push -echo "Checking out local develop branch..." -git checkout develop + echo "Checking out local develop branch..." + git checkout develop -echo "Pulling ORIGIN develop into local branch..." -git pull origin + echo "Pulling ORIGIN develop into local branch..." + git pull origin -echo "Merging CHANGELOG.md from master into develop..." -git merge master --no-edit -m ":twisted_rightwards_arrows: doc: merged CHANGELOG.md from master into develop branch" --strategy-option theirs + echo "Merging CHANGELOG.md from master into develop..." + git merge master --no-edit -m ":twisted_rightwards_arrows: doc: merged CHANGELOG.md from master into develop branch" --strategy-option theirs -echo "Pushing develop to ORIGIN..." -git push + echo "Pushing develop to ORIGIN..." + git push -echo "Enabling git messages for a release again" -export GIT_MERGE_AUTOEDIT=yes + echo "Enabling git messages for a release again" + export GIT_MERGE_AUTOEDIT=yes -echo "Wink Affiliate WordPress plugin $versionNumber has been successfully released" + echo "Wink Affiliate WordPress plugin $versionNumber has been successfully released" + ;; +[nN]) + echo "Exiting..." + exit + ;; +*) + echo "Invalid response" + exit 1 + ;; +esac diff --git a/wink.php b/wink.php index 7da3f4d..7f4b57d 100644 --- a/wink.php +++ b/wink.php @@ -1,15 +1,15 @@ version = current_time('Y-m-d'); - $this->namespace = 'wink'; $this->section = 'wink'; // Customizer Section Name $this->clientIdKey = 'winkClientId'; $this->clientSecretKey = 'winkSecret'; $this->environment = 'winkEnvironment'; $this->environmentVal = get_option($this->environment, 'production'); - $this->pluginURL = trailingslashit( plugin_dir_url( __FILE__ ) ); - $this->settingsURL = admin_url( '/customize.php?autofocus[section]='.$this->section); + $this->pluginURL = wp_kses(trailingslashit( plugin_dir_url( __FILE__ ) ) ); + $this->settingsURL = wp_kses(admin_url( '/customize.php?autofocus[section]='.$this->section)); add_action( 'customize_register', array( $this,'addSettings' ) ); // adding plugin settings to WP Customizer add_action('admin_notices', array( $this,'adminNotice' ) ); // adding admin notice if client id has not been entered //add_shortcode('wink', array( $this,'blockHandler' ) ); // Adding Shortcode add_filter( 'block_categories_all', array( $this,'gutenbergBlockCategory' ), 10, 2); // Adding custom Gutenberg Block Category //add_action('init', array( $this,'gutenbergBlockRegistration' ) ); // Adding Gutenberg Block - add_action( 'wp_enqueue_scripts', array($this, 'loadScripts' )); // too resource intensive to search all pages for WINK elements. Scripts need to be added all the time. + add_action( 'wp_enqueue_scripts', array($this, 'loadScripts' )); // too resource intensive to search all pages for Wink elements. Scripts need to be added all the time. add_filter( 'clean_url', array($this,'jsHelper'), 11, 1 ); // Helper to add attribute to js tag add_action( 'admin_enqueue_scripts', array($this,'customizeScripts')); @@ -57,7 +56,7 @@ function settingsLink( $links ) { get_admin_url() . 'admin.php' ) ); // Create the link. - $settings_link = '' . esc_html__( 'Settings',$this->namespace ) . ''; + $settings_link = '' . esc_html__( 'Settings',"wink" ) . ''; // Adds the link to the end of the array. array_push( $links, @@ -91,27 +90,27 @@ function adminNotice() { if (is_admin() && !get_option($this->clientIdKey, false)) { if ( current_user_can( 'manage_options' ) ) { // let's only show this to admin users echo '
- '.esc_html__('WINK logo',$this->namespace).'

'. - esc_html__('Congratulations', $this->namespace). + '.esc_html__('Wink logo',

'. + esc_html__('Congratulations', "wink"). ' '. - esc_html__('on installing the official WINK WordPress plugin.',$this->namespace). - ' '. - esc_html__('Click here',$this->namespace). + esc_html__('on installing the official Wink Affiliate WordPress plugin.',"wink"). + ' '. + esc_html__('Click here',"wink"). ' '. - esc_html__('to add your WINK Client-ID and your Client-Secret',$this->namespace). + esc_html__('to add your Wink Client-ID and your Client-Secret',"wink"). '.

'; } } else if (is_admin() && empty(get_option('permalink_structure'))) { echo '
- '.esc_html__('WINK logo',$this->namespace).'

'. - esc_html__('Attention!', $this->namespace). + '.esc_html__('Wink logo',

'. + esc_html__('Attention!', "wink"). ' '. - esc_html__('the WINK plugin requires permalinks. Please disable plain permalinks',$this->namespace). - ' '. - esc_html__('here',$this->namespace). + esc_html__('the Wink plugin requires permalinks. Please disable plain permalinks',"wink"). + ' '. + esc_html__('here',"wink"). ' '. - esc_html__('and start using the plugin.',$this->namespace). + esc_html__('and start using the plugin.',"wink"). '.

'; } @@ -127,9 +126,9 @@ function addSettings( $wp_customize ) { } } $wp_customize->add_section( $this->section, array( - 'title' => esc_html__( 'WINK Settings', $this->namespace ), + 'title' => esc_html__( 'Wink Settings', "wink" ), 'priority' => 30, - 'description' => '

'.__('WINK logo',$this->namespace).'

'.esc_html__('This plugin connects your site to your WINK account. Once you entered your Client-ID, you can start using the WINK elements either as a Gutenberg block or via the shortcodes below', $this->namespace ).'
'.implode('
',$shortcodes) + 'description' => '

'.__('Wink logo',

'.esc_html__('This plugin connects your site to your Wink account. Once you entered your Client-ID, you can start using the Wink elements either as a Gutenberg block or via the shortcodes below', "wink" ).'
'.implode('
',$shortcodes) ) ); @@ -137,8 +136,8 @@ function addSettings( $wp_customize ) { 'type' => 'option' )); $wp_customize->add_control( $this->clientIdKey, array( - 'label' => esc_html__( 'Client-ID', $this->namespace ), - 'description' => esc_html__('You can find your WINK Client-ID in your WINK account. After entering your Client-ID start using WINK by adding the WINK Gutenberg blocks to your website.', $this->namespace), + 'label' => esc_html__( 'Client-ID', "wink" ), + 'description' => esc_html__('You can find your Wink Client-ID in your Wink account. After entering your Client-ID start using Wink by adding the Wink Gutenberg blocks to your website.', "wink"), 'section' => $this->section, ) ); @@ -146,8 +145,8 @@ function addSettings( $wp_customize ) { 'type' => 'option' )); $wp_customize->add_control( $this->clientSecretKey, array( - 'label' => esc_html__( 'Client-Secret', $this->namespace ), - 'description' => esc_html__('You can find your WINK Client-Secret in your WINK account. After entering your Client-Secret and your Client-ID start using WINK by adding the WINK Gutenberg blocks to your website.', $this->namespace), + 'label' => esc_html__( 'Client-Secret', "wink" ), + 'description' => esc_html__('You can find your Wink Client-Secret in your Wink account. After entering your Client-Secret and your Client-ID start using Wink by adding the Wink Gutenberg blocks to your website.', "wink"), 'section' => $this->section, ) ); @@ -157,8 +156,8 @@ function addSettings( $wp_customize ) { )); $wp_customize->add_control( $this->environment, array( 'type' => 'select', - 'label' => esc_html__( 'Environment', $this->namespace ), - 'description' => esc_html__('Switch between environments. Use with caution and only if instructed by the WINK team.', $this->namespace), + 'label' => esc_html__( 'Environment', "wink" ), + 'description' => esc_html__('Switch between environments. Use with caution and only if instructed by the Wink team.', "wink"), 'section' => $this->section, 'choices' => array( 'production' => esc_html__( 'Live' ), @@ -181,8 +180,8 @@ function gutenbergBlockCategory($categories, $post) { $categories, array( array( - 'slug' => $this->namespace.'-blocks', - 'title' => esc_html__( 'WINK Blocks', $this->namespace ), + 'slug' => "wink".'-blocks', + 'title' => esc_html__( 'Wink Blocks', "wink" ), ), ) ); @@ -196,8 +195,8 @@ function __construct() { } static function environmentURL($target, $environment) { - // error_log('WINK - target: '.$target); - // error_log('WINK - environment: '.$environment); + // error_log('Wink - target: '.$target); + // error_log('Wink - environment: '.$environment); $environments = array( 'js' => array( 'staging' => 'https://staging-elements.wink.travel', @@ -220,7 +219,7 @@ static function environmentURL($target, $environment) { } if (!empty(get_option('winkClientId', false))) { - require_once('includes/elementHandler.php'); // Handles all WINK Elements (Only load it if the client id is present) + require_once('includes/elementHandler.php'); // Handles all Wink Elements (Only load it if the client id is present) } @@ -244,7 +243,7 @@ function winkRenderSilentRefresh( $atts ){ header('Content-type: text/html'); //$dir = plugin_dir_path( __FILE__ ); if (file_exists(dirname(realpath(__FILE__)).'/includes/silent-refresh.html')) { - echo file_get_contents(dirname(realpath(__FILE__)).'/includes/silent-refresh.html'); + echo wp_kses(file_get_contents(dirname(realpath(__FILE__)).'/includes/silent-refresh.html')); } die(); }