Skip to content

Commit

Permalink
Merge pull request #11 from bootscore/Update-checker-v5
Browse files Browse the repository at this point in the history
Update checker v5
  • Loading branch information
crftwrk authored Dec 15, 2023
2 parents 5dd72c5 + d407ed2 commit 1842d21
Show file tree
Hide file tree
Showing 69 changed files with 1,816 additions and 2,377 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

[![Packagist Prerelease](https://img.shields.io/packagist/vpre/bootscore/bs-cookie-settings?logo=packagist&logoColor=fff)](https://packagist.org/packages/bootscore/bs-cookie-settings)

WordPress plugin to add a GDPR-ready cookie consent to bootScore theme. Based on the [cookieconsent](https://orestbida.com/demo-projects/cookieconsent/) script by [Orest Bida](https://github.com/orestbida/cookieconsent).
WordPress plugin to add a GDPR-ready cookie consent to Bootscore theme. Based on the [cookieconsent](https://orestbida.com/demo-projects/cookieconsent/) script by [Orest Bida](https://github.com/orestbida/cookieconsent).

<img src="https://lh3.googleusercontent.com/pw/AM-JKLVzgrDgCd68uGMaxBPYAMYB4wg6cg7orzuNU5sr41XOkGFuxueA9eEgkHRCp1HfoxTghl5giVRdnewa8-Lx7GmDyNeastxvBKpvjRNQ0saP5vspSRGCRP7N0-pLkyJqtcltBR32ZsbWfZjCBvOzvRjIHA=w1200-h954-no" alt="bS Cookie Settings">


## Installation

1. Download latest release [bs-cookie-settings-main.zip](https://github.com/bootscore/bs-cookie-settings/releases)
1. Download latest release [bs-cookie-settings-main.zip](https://github.com/bootscore/bs-cookie-settings/releases/latest/download/bs-cookie-settings-main.zip).
2. In your admin panel, go to Plugins > and click the Add New button.
3. Click Upload Plugin and Choose File, then select the Plugin's .zip file. Click Install Now.
4. Click Activate to use your new Plugin right away.
Expand Down
42 changes: 29 additions & 13 deletions main.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,40 @@
<?php
/*Plugin Name: bS Cookie Settings
Plugin URI: https://bootscore.me/plugins/bs-cookie-settings/
Description: This plugin adds a cookie modal to bootScore
Version: 5.3.0
Author: bootScore
Description: Plugin adds a cookie modal to Bootscore theme. <a href="https://bootscore.me/documentation/plugin/bs-cookie-settings/">Documentation</a> | <a href="https://bootscore.me/documentation/plugin/bs-cookie-settings/#Changelog">Changelog</a>
Version: 5.4.0
Tested up to: 6.4.2
Requires at least: 5.0
Requires PHP: 7.4
Author: Bootscore
Author URI: https://bootscore.me
License: MIT License
*/


// Register Styles and Scripts
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;


/**
* Update checker
*/
require 'update/plugin-update-checker.php';
use YahnisElsts\PluginUpdateChecker\v5\PucFactory;

$myUpdateChecker = PucFactory::buildUpdateChecker(
'https://github.com/bootscore/bs-cookie-settings/',
__FILE__,
'bs-cookie-settings'
);

//Set the branch that contains the stable release.
$myUpdateChecker->setBranch('main');


/**
* Register styles and scripts
*/
function bs_cookie_settings() {

wp_enqueue_script( 'cookie-settings-js', plugins_url( '/js/cookie-settings.min.js' , __FILE__ ), array(), false, true );
Expand All @@ -20,12 +45,3 @@ function bs_cookie_settings() {
}

add_action('wp_enqueue_scripts','bs_cookie_settings');


// Update checker
require 'update/update-checker.php';
$myUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
'https://bootscore.me/wp-content/plugins/bs-cookie-settings-main/update/plugin.json',
__FILE__, //Full path to the main plugin file or functions.php.
'bs-cookie-settings-main'
);
63 changes: 34 additions & 29 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@

=== bS Cookie Settings ===

Contributors: The bootScore contributors
Contributors: The Bootscore contributors

Stable tag: 5.4.0
Tested up to: 6.4.2
Requires at least: 5.0
Requires PHP: 7.4
Requires at least: 4.5
Tested up to: 6.2.2
Requires PHP: 5.6
Stable tag: 5.3.0
License: MIT License
License URI: https://github.com/bootscore/bs-cookie-settings/blob/main/LICENSE

This plugin adds a GDPR-ready cookie consent to bootScore theme, Copyright 2022 The bootScore Contributors.
Plugin adds a GDPR-ready cookie consent to Bootscore theme, Copyright 2022 - 2023 The Bootscore Contributors.


== Credits ==

- cookieconsent https://github.com/orestbida/cookieconsent/blob/master/LICENSE, Copyright 2020, Orest Bida.
- cookieconsent https://github.com/orestbida/cookieconsent/blob/master/LICENSE, Copyright 2020, Orest Bida.


== Installation ==
Expand All @@ -31,32 +31,37 @@ Read documentation https://bootscore.me/documentation/plugin/bs-cookie-settings/

== Changelog ==

= 5.3.0 - June 09 2023 =

* [FEATURE] Add composer.json
* [FEATURE] Add plugin update checker
* [IMPROVEMENT] Change btn-outline-secondary to btn-outline-primary
* [UPDATE] Bootstrap 5.3 color classes
= 5.4.0 - December 15 2023 =

* [IMPROVEMENT] Deny direct access
* [UPDATE] Update checker v5

= 5.3.0 - June 09 2023 =

* [FEATURE] Add composer.json
* [FEATURE] Add plugin update checker
* [IMPROVEMENT] Change btn-outline-secondary to btn-outline-primary
* [UPDATE] Bootstrap 5.3 color classes

= 5.2.1.0 - August 24 2022 =

= 5.2.1.0 - August 24 2022 =
* Refactored modal
* Removed plugin's backdrop and uses Bootstrap modal backdrop instead
* Settings link triggers now modal instead modal-dialog
* Changed settings link to data-bs-toggle="modal" [Breaking]
* Hide banner if modal is open
* Changed id's
* Updated to FA6 Chevron

* Refactored modal
* Removed plugin's backdrop and uses Bootstrap modal backdrop instead
* Settings link triggers now modal instead modal-dialog
* Changed settings link to data-bs-toggle="modal" [Breaking]
* Hide banner if modal is open
* Changed id's
* Updated to FA6 Chevron
= 5.2.0.0 - August 20 2022 =

= 5.2.0.0 - August 20 2022 =
* Added missing modal class

* Added missing modal class
= 5.1.3.2 - June 03 2022 =

= 5.1.3.2 - June 03 2022 =
* Fix modal backdrop in Chrome/Edge. Used rgba instead of opacity.
* Switched to FA5 icons

* Fix modal backdrop in Chrome/Edge. Used rgba instead of opacity.
* Switched to FA5 icons
= 5.0.0.0 - January 03 2022 =

= 5.0.0.0 - January 03 2022 =

* Initial release
* Initial release
6 changes: 0 additions & 6 deletions update/Puc/v4/Factory.php

This file was deleted.

63 changes: 0 additions & 63 deletions update/Puc/v4p11/Autoloader.php

This file was deleted.

33 changes: 0 additions & 33 deletions update/Puc/v4p11/DebugBar/PluginExtension.php

This file was deleted.

10 changes: 10 additions & 0 deletions update/Puc/v5/PucFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace YahnisElsts\PluginUpdateChecker\v5;

if ( !class_exists(PucFactory::class, false) ):

class PucFactory extends \YahnisElsts\PluginUpdateChecker\v5p2\PucFactory {
}

endif;
86 changes: 86 additions & 0 deletions update/Puc/v5p2/Autoloader.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?php

namespace YahnisElsts\PluginUpdateChecker\v5p2;

if ( !class_exists(Autoloader::class, false) ):

class Autoloader {
const DEFAULT_NS_PREFIX = 'YahnisElsts\\PluginUpdateChecker\\';

private $prefix;
private $rootDir;
private $libraryDir;

private $staticMap;

public function __construct() {
$this->rootDir = dirname(__FILE__) . '/';

$namespaceWithSlash = __NAMESPACE__ . '\\';
$this->prefix = $namespaceWithSlash;

$this->libraryDir = $this->rootDir . '../..';
if ( !self::isPhar() ) {
$this->libraryDir = realpath($this->libraryDir);
}
$this->libraryDir = $this->libraryDir . '/';

//Usually, dependencies like Parsedown are in the global namespace,
//but if someone adds a custom namespace to the entire library, they
//will be in the same namespace as this class.
$isCustomNamespace = (
substr($namespaceWithSlash, 0, strlen(self::DEFAULT_NS_PREFIX)) !== self::DEFAULT_NS_PREFIX
);
$libraryPrefix = $isCustomNamespace ? $namespaceWithSlash : '';

$this->staticMap = array(
$libraryPrefix . 'PucReadmeParser' => 'vendor/PucReadmeParser.php',
$libraryPrefix . 'Parsedown' => 'vendor/Parsedown.php',
);

//Add the generic, major-version-only factory class to the static map.
$versionSeparatorPos = strrpos(__NAMESPACE__, '\\v');
if ( $versionSeparatorPos !== false ) {
$versionSegment = substr(__NAMESPACE__, $versionSeparatorPos + 1);
$pointPos = strpos($versionSegment, 'p');
if ( ($pointPos !== false) && ($pointPos > 1) ) {
$majorVersionSegment = substr($versionSegment, 0, $pointPos);
$majorVersionNs = __NAMESPACE__ . '\\' . $majorVersionSegment;
$this->staticMap[$majorVersionNs . '\\PucFactory'] =
'Puc/' . $majorVersionSegment . '/Factory.php';
}
}

spl_autoload_register(array($this, 'autoload'));
}

/**
* Determine if this file is running as part of a Phar archive.
*
* @return bool
*/
private static function isPhar() {
//Check if the current file path starts with "phar://".
static $pharProtocol = 'phar://';
return (substr(__FILE__, 0, strlen($pharProtocol)) === $pharProtocol);
}

public function autoload($className) {
if ( isset($this->staticMap[$className]) && file_exists($this->libraryDir . $this->staticMap[$className]) ) {
include($this->libraryDir . $this->staticMap[$className]);
return;
}

if ( strpos($className, $this->prefix) === 0 ) {
$path = substr($className, strlen($this->prefix));
$path = str_replace(array('_', '\\'), '/', $path);
$path = $this->rootDir . $path . '.php';

if ( file_exists($path) ) {
include $path;
}
}
}
}

endif;
Loading

0 comments on commit 1842d21

Please sign in to comment.