Skip to content

Commit

Permalink
Benefits 6.1.9 release
Browse files Browse the repository at this point in the history
* Fixed compatibility style routing bug
* Refactored time(UTC)
* HTTP changed to HTTPS
* Refactored CSSFile to CSS_File
  • Loading branch information
Marius committed Aug 11, 2019
1 parent 57daae0 commit c78149d
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 66 deletions.
4 changes: 2 additions & 2 deletions Benefits.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Benefits
* Plugin URI: https://wordpress.org/plugins/benefits/
* Description: It’s a high quality, native and responsive WordPress plugin to create and view slider-based benefits
* Version: 6.1.8
* Version: 6.1.9
* Author: KestutisIT
* Author URI: https://profiles.wordpress.org/KestutisIT
* Text Domain: benefits
Expand Down Expand Up @@ -43,7 +43,7 @@ final class Benefits
const REQUIRED_PHP_VERSION = '5.6.0';
const REQUIRED_WP_VERSION = 4.6;
const OLDEST_COMPATIBLE_PLUGIN_SEMVER = '6.0.0';
const PLUGIN_SEMVER = '6.1.8';
const PLUGIN_SEMVER = '6.1.9';

// Settings
/**
Expand Down
24 changes: 12 additions & 12 deletions Controllers/Front/AssetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ public function enqueueMandatoryStyles()
$objStyle->setSitewideStyles();
// Set compatibility styles
$objStyle->setCompatibilityStyles();
$parentThemeCompatibilityCSSFileURL = $objStyle->getParentThemeCompatibilityCSSURL();
$currentThemeCompatibilityCSSFileURL = $objStyle->getCurrentThemeCompatibilityCSSURL();
$sitewideCSSFileURL = $objStyle->getSitewideCSSURL();
$parentThemeCompatibilityCSS_FileURL = $objStyle->getParentThemeCompatibilityCSS_URL();
$currentThemeCompatibilityCSS_FileURL = $objStyle->getCurrentThemeCompatibilityCSS_URL();
$sitewideCSS_FileURL = $objStyle->getSitewideCSS_URL();

if($this->lang->isRTL())
{
Expand All @@ -94,19 +94,19 @@ public function enqueueMandatoryStyles()
}

// Register compatibility styles for further use
if($parentThemeCompatibilityCSSFileURL != '')
if($parentThemeCompatibilityCSS_FileURL != '')
{
wp_register_style($this->conf->getPluginURL_Prefix().'parent-theme-front-compatibility', $parentThemeCompatibilityCSSFileURL);
wp_register_style($this->conf->getPluginURL_Prefix().'parent-theme-front-compatibility', $parentThemeCompatibilityCSS_FileURL);
}
if($currentThemeCompatibilityCSSFileURL != '')
if($currentThemeCompatibilityCSS_FileURL != '')
{
wp_register_style($this->conf->getPluginURL_Prefix().'current-theme-front-compatibility', $currentThemeCompatibilityCSSFileURL);
wp_register_style($this->conf->getPluginURL_Prefix().'current-theme-front-compatibility', $currentThemeCompatibilityCSS_FileURL);
}

// Register plugin sitewide style for further use
if($sitewideCSSFileURL != '')
if($sitewideCSS_FileURL != '')
{
wp_register_style($this->conf->getPluginURL_Prefix().'front-sitewide', $sitewideCSSFileURL);
wp_register_style($this->conf->getPluginURL_Prefix().'front-sitewide', $sitewideCSS_FileURL);
}

// As these styles are mandatory, enqueue them here
Expand Down Expand Up @@ -154,10 +154,10 @@ public function registerStyles()
wp_register_style('slick-theme', $this->conf->getRouting()->get3rdPartyAssetsURL('slick/slick-theme.css'));

// Register plugin local style for further use
$localCSSFileURL = $objStyle->getLocalCSSURL();
if($localCSSFileURL != '')
$localCSS_FileURL = $objStyle->getLocalCSS_URL();
if($localCSS_FileURL != '')
{
wp_register_style($this->conf->getPluginHandlePrefix().'main', $localCSSFileURL);
wp_register_style($this->conf->getPluginHandlePrefix().'main', $localCSS_FileURL);
}
}
}
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

4 changes: 2 additions & 2 deletions Models/Benefit/Benefit.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public function save(array $params)
$validUploadedImageFileName = '';
if($_FILES['benefit_image']['tmp_name'] != '')
{
$uploadedImageFileName = StaticFile::uploadImageFile($_FILES['benefit_image'], $this->conf->getGlobalGalleryPathWithoutEndSlash(), "location_");
$uploadedImageFileName = StaticFile::uploadImageFile($_FILES['benefit_image'], $this->conf->getGlobalGalleryPathWithoutEndSlash(), "benefit_");
StaticFile::makeThumbnail($this->conf->getGlobalGalleryPath(), $uploadedImageFileName, $this->thumbWidth, $this->thumbHeight, "thumb_");
$validUploadedImageFileName = esc_sql(sanitize_file_name($uploadedImageFileName)); // for sql query only
}
Expand Down Expand Up @@ -243,7 +243,7 @@ public function save(array $params)
$validUploadedImageFileName = '';
if($_FILES['benefit_image']['tmp_name'] != '')
{
$uploadedImageFileName = StaticFile::uploadImageFile($_FILES['benefit_image'], $this->conf->getGlobalGalleryPathWithoutEndSlash(), "location_");
$uploadedImageFileName = StaticFile::uploadImageFile($_FILES['benefit_image'], $this->conf->getGlobalGalleryPathWithoutEndSlash(), "benefit_");
StaticFile::makeThumbnail($this->conf->getGlobalGalleryPath(), $uploadedImageFileName, $this->thumbWidth, $this->thumbHeight, "thumb_");
$validUploadedImageFileName = esc_sql(sanitize_file_name($uploadedImageFileName)); // for sql query only
}
Expand Down
2 changes: 1 addition & 1 deletion Models/Configuration/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public function __construct(
// esc_url replaces ' and & chars with ' and & - but because we know that exact path,
// we know it does not contains them, so we don't need to have two versions esc_url and esc_url_raw
// Demo examples (__FILE__ = $this->pluginFolderAndFile):
// 1. plugin_dir_url(__FILE__) => http://nativerental.com/wp-content/plugins/Benefits/
// 1. plugin_dir_url(__FILE__) => https://nativerental.com/wp-content/plugins/Benefits/
$this->pluginURL = esc_url(plugin_dir_url($this->pluginPathWithFilename));


Expand Down
2 changes: 1 addition & 1 deletion Models/Routing/UI_Routing.php
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ public function getFrontLocalDevCSS_URL($paramRelativeURL_AndFile = '', $paramRe

public function getFrontSitewideCSS_URL($paramRelativeURL_AndFile = '', $paramReturnWithFileName = TRUE)
{
$folderURL = $this->getURL('Assets/Front/CSS/Compatibility/'.$paramRelativeURL_AndFile, FALSE).'Assets/Front/CSS/Compatibility/';
$folderURL = $this->getURL('Assets/Front/CSS/Sitewide/'.$paramRelativeURL_AndFile, FALSE).'Assets/Front/CSS/Sitewide/';

return $folderURL.($paramReturnWithFileName === TRUE ? $paramRelativeURL_AndFile : '');
}
Expand Down
39 changes: 23 additions & 16 deletions Models/Style/Style.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final class Style implements StyleInterface
{
private $conf = NULL;
private $lang = NULL;
private $debugMode = 0;
private $debugMode = 0; // 0 - disabled, 1 - regular debug, 2+ - deep debug
private $styleName = "";
private $sitewideStyles = array();
private $compatibilityStyles = array();
Expand Down Expand Up @@ -52,10 +52,12 @@ public function setSitewideStyles()

if($this->debugMode >= 2)
{
echo "<br />CSS FILES:<br />".var_export($cssFiles, TRUE);
echo "<br />COMPATIBILITY STYLES: ".nl2br(print_r($this->compatibilityStyles, TRUE));
echo "<br /><br />GLOBAL STYLES: ".nl2br(print_r($this->sitewideStyles, TRUE));

echo "<br /><br />---------------------------------------------------------------------------------";
echo "<br /><strong>[setSitewideStyles()]</strong> \$cssFolderPath: {$cssFolderPath}</strong>";
echo "<br /><strong>[setSitewideStyles()]</strong> \$cssFolderURL: {$cssFolderURL}</strong>";
echo "<br /><strong>[setSitewideStyles()]</strong> CSS FILES:<br />".var_export($cssFiles, TRUE);
echo "<br /><br /><strong>[setSitewideStyles()]</strong> SITEWIDE STYLES: ".nl2br(print_r($this->sitewideStyles, TRUE));
echo "<br />---------------------------------------------------------------------------------";
}
}

Expand All @@ -79,10 +81,12 @@ public function setCompatibilityStyles()

if($this->debugMode >= 2)
{
echo "<br />CSS FILES:<br />".var_export($cssFiles, TRUE);
echo "<br />COMPATIBILITY STYLES: ".nl2br(print_r($this->compatibilityStyles, TRUE));
echo "<br /><br />GLOBAL STYLES: ".nl2br(print_r($this->sitewideStyles, TRUE));

echo "<br /><br />---------------------------------------------------------------------------------";
echo "<br /><strong>[setCompatibilityStyles()]</strong> \$cssFolderPath: {$cssFolderPath}</strong>";
echo "<br /><strong>[setCompatibilityStyles()]</strong> \$cssFolderURL: {$cssFolderURL}</strong>";
echo "<br /><strong>[setCompatibilityStyles()]</strong> CSS FILES:<br />".var_export($cssFiles, TRUE);
echo "<br /><strong>[setCompatibilityStyles()]</strong> COMPATIBILITY STYLES: ".nl2br(print_r($this->compatibilityStyles, TRUE));
echo "<br />---------------------------------------------------------------------------------";
}
}

Expand All @@ -107,9 +111,12 @@ public function setLocalStyles()

if($this->debugMode >= 2)
{
echo "<br />CSS FILES:<br />".var_export($cssFiles, TRUE);
echo "<br /><br />SYSTEM STYLES: ".nl2br(print_r($this->localStyles, TRUE));

echo "<br /><br />---------------------------------------------------------------------------------";
echo "<br /><strong>[setLocalStyles()]</strong> \$cssFolderPath: {$cssFolderPath}</strong>";
echo "<br /><strong>[setLocalStyles()]</strong> \$cssFolderURL: {$cssFolderURL}</strong>";
echo "<br /><strong>[setLocalStyles()]</strong> CSS FILES:<br />".var_export($cssFiles, TRUE);
echo "<br /><br /><strong>[setLocalStyles()]</strong> LOCAL STYLES: ".nl2br(print_r($this->localStyles, TRUE));
echo "<br />---------------------------------------------------------------------------------";
}
}

Expand All @@ -118,7 +125,7 @@ public function inDebug()
return ($this->debugMode >= 1 ? TRUE : FALSE);
}

public function getParentThemeCompatibilityCSSURL()
public function getParentThemeCompatibilityCSS_URL()
{
// Get parent theme name
$parentThemeName = "";
Expand Down Expand Up @@ -148,7 +155,7 @@ public function getParentThemeCompatibilityCSSURL()
return $compatibilityFileURL;
}

public function getCurrentThemeCompatibilityCSSURL()
public function getCurrentThemeCompatibilityCSS_URL()
{
// Get current theme name
$currentThemeName = "";
Expand Down Expand Up @@ -177,7 +184,7 @@ public function getCurrentThemeCompatibilityCSSURL()
return $compatibilityFileURL;
}

public function getSitewideCSSURL()
public function getSitewideCSS_URL()
{
// Get the stylesheet file and it's path
$selectedFileURL = '';
Expand Down Expand Up @@ -207,7 +214,7 @@ public function getSitewideCSSURL()
return $fileURL;
}

public function getLocalCSSURL()
public function getLocalCSS_URL()
{
// Get the stylesheet file and it's path
$selectedFileURL = '';
Expand Down
8 changes: 4 additions & 4 deletions Models/Style/StyleInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public function setLocalStyles();
public function inDebug();

// Getters
public function getParentThemeCompatibilityCSSURL();
public function getCurrentThemeCompatibilityCSSURL();
public function getSitewideCSSURL();
public function getLocalCSSURL();
public function getParentThemeCompatibilityCSS_URL();
public function getCurrentThemeCompatibilityCSS_URL();
public function getSitewideCSS_URL();
public function getLocalCSS_URL();
}
6 changes: 3 additions & 3 deletions Models/Validation/StaticValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ public static function getUTC_ISO_DateByTimestamp($paramTimestamp)
return $utcISO_Date;
}

public static function getUTCTimestampFromLocalISODateTime($paramDate, $paramTime)
public static function getUTC_TimestampFromLocalISO_DateTime($paramDate, $paramTime)
{
$UTCTimestamp = 0;
$validISODate = static::getValidISO_Date($paramDate, 'Y-m-d');
Expand All @@ -695,9 +695,9 @@ public static function getUTCTimestampFromLocalISODateTime($paramDate, $paramTim
/*
* Appears that this function is useless in the NS and nowhere used
* While my brains still think that I want to add timezone offset, appears that correct way is to subtract it
* via getUTCTimestampFromLocalISODateTime($paramDate, $paramTime)
* via getUTC_TimestampFromLocalISO_DateTime($paramDate, $paramTime)
*/
public static function getLocalTimestampFromUTC_ISODateTime($paramDate, $paramTime)
public static function getLocalTimestampFromUTC_ISO_DateTime($paramDate, $paramTime)
{
$localTimestamp = 0;
$validISODate = static::getValidISO_Date($paramDate, 'Y-m-d');
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ to your website's benefit page and show only desired benefit by following this U

# Changelog

= 6.1.9 =
* Fixed compatibility style routing bug
* Refactored time(UTC)
* HTTP changed to HTTPS
* Refactored CSSFile to CSS_File

= 6.1.8 =
* Initial public release! Based on S.O.L.I.D. MVC Engine, Version 6 (without extensions).

Expand Down
15 changes: 13 additions & 2 deletions UI/Assets/Front/CSS/Compatibility/INFORMATION.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
What is compatibility styles?
Style in this folder will get loaded only if the current active theme folder name
will match the style file name (excl. the file extension).
Compatibility style is a stylesheet that only gets loaded if it's file's name and header's
theme name matches the current active theme on your site, i.e.:

current active theme's folder: AvadaCar-child
current active theme's stylesheet's theme name: Avada Car Child

so the compatible stylesheet should be named: AvadaCar-child.css
and it's theme name in the header should be: Avada Car Child

This style is needed for example, when you are not satisfied
with the plugin's current style and you want to make changes. This is a
good way to keep things organized and your custom style won't get lost
after an update. So basically this is a child-theme for your plugin
10 changes: 8 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
=== Benefits ===
Contributors: KestutisIT
Contributors: KestutisIT, mariusslo
Donate link: https://profiles.wordpress.org/KestutisIT
Website link: https://wordpress.org/plugins/benefits/
Tags: slider, offers, benefits, benefit, offer
Expand Down Expand Up @@ -71,7 +71,7 @@ Finally - the code is poetry - __the better is the web, the happier is the world
* Turkish _(translated by Levent Şane)_

== Live Demo ==
[Benefits (Live Demo)](http://nativerental.com/cars/ "Benefits (Live Demo)")
[Benefits (Live Demo)](https://nativerental.com/cars/ "Benefits (Live Demo)")

== GitHub Repository (for those, who want to contribute via "Pull Requests") ==
[https://github.com/SolidMVC/Benefits](https://github.com/SolidMVC/Benefits "Benefits @GitHub")
Expand Down Expand Up @@ -120,6 +120,12 @@ to your website's benefit page and show only desired benefit by following this U

== Changelog ==

= 6.1.9 =
* Fixed compatibility style routing bug
* Refactored time(UTC)
* HTTP changed to HTTPS
* Refactored CSSFile to CSS_File

= 6.1.8 =
* Initial public release! Based on S.O.L.I.D. MVC Engine, Version 6 (without extensions).

Expand Down

0 comments on commit c78149d

Please sign in to comment.