-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from brainstormforce/wp-update-readme
chore: updated the tested up to version.
- Loading branch information
Showing
13 changed files
with
1,678 additions
and
551 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
#bsf-optin-notice { | ||
[ID*="-optin-notice"] { | ||
padding: 1px 12px; | ||
border-right-color: #007cba; | ||
} | ||
|
||
#bsf-optin-notice .notice-container { | ||
[ID*="-optin-notice"] .notice-container { | ||
padding-top: 10px; | ||
padding-bottom: 12px; | ||
} | ||
|
||
#bsf-optin-notice .notice-content { | ||
[ID*="-optin-notice"] .notice-content { | ||
margin: 0; | ||
} | ||
|
||
#bsf-optin-notice .notice-heading { | ||
[ID*="-optin-notice"] .notice-heading { | ||
padding: 0 0 12px 20px; | ||
} | ||
|
||
#bsf-optin-notice .button-primary { | ||
[ID*="-optin-notice"] .button-primary { | ||
margin-left: 5px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
#bsf-optin-notice { | ||
[ID*="-optin-notice"] { | ||
padding: 1px 12px; | ||
border-left-color: #007cba; | ||
} | ||
|
||
#bsf-optin-notice .notice-container { | ||
[ID*="-optin-notice"] .notice-container { | ||
padding-top: 10px; | ||
padding-bottom: 12px; | ||
} | ||
|
||
#bsf-optin-notice .notice-content { | ||
[ID*="-optin-notice"] .notice-content { | ||
margin: 0; | ||
} | ||
|
||
#bsf-optin-notice .notice-heading { | ||
[ID*="-optin-notice"] .notice-heading { | ||
padding: 0 20px 12px 0; | ||
} | ||
|
||
#bsf-optin-notice .button-primary { | ||
[ID*="-optin-notice"] .button-primary { | ||
margin-right: 5px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
<?php | ||
/** | ||
* BSF analytics loader file. | ||
* | ||
* @version 1.0.0 | ||
* | ||
* @package bsf-analytics | ||
*/ | ||
|
||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit(); | ||
} | ||
|
||
/** | ||
* Class BSF_Analytics_Loader. | ||
*/ | ||
class BSF_Analytics_Loader { | ||
|
||
/** | ||
* Analytics Entities. | ||
* | ||
* @access private | ||
* @var array Entities array. | ||
*/ | ||
private $entities = array(); | ||
|
||
/** | ||
* Analytics Version. | ||
* | ||
* @access private | ||
* @var float analytics version. | ||
*/ | ||
private $analytics_version = ''; | ||
|
||
/** | ||
* Analytics path. | ||
* | ||
* @access private | ||
* @var string path array. | ||
*/ | ||
private $analytics_path = ''; | ||
|
||
/** | ||
* Instance | ||
* | ||
* @access private | ||
* @var object Class object. | ||
*/ | ||
private static $instance = null; | ||
|
||
/** | ||
* Get instace of class. | ||
* | ||
* @return object | ||
*/ | ||
public static function get_instance() { | ||
if ( null === self::$instance ) { | ||
self::$instance = new self(); | ||
} | ||
|
||
return self::$instance; | ||
} | ||
|
||
/** | ||
* Constructor | ||
*/ | ||
public function __construct() { | ||
add_action( 'init', array( $this, 'load_analytics' ) ); | ||
} | ||
|
||
/** | ||
* Set entity for analytics. | ||
* | ||
* @param string $data Entity attributes data. | ||
* @return void | ||
*/ | ||
public function set_entity( $data ) { | ||
array_push( $this->entities, $data ); | ||
} | ||
|
||
/** | ||
* Load Analytics library. | ||
* | ||
* @return void | ||
*/ | ||
public function load_analytics() { | ||
$unique_entities = array(); | ||
|
||
if ( ! empty( $this->entities ) ) { | ||
foreach ( $this->entities as $entity ) { | ||
foreach ( $entity as $key => $data ) { | ||
|
||
if ( isset( $data['path'] ) ) { | ||
if ( file_exists( $data['path'] . '/version.json' ) ) { | ||
$file_contents = file_get_contents( $data['path'] . '/version.json' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents | ||
$analytics_version = json_decode( $file_contents, 1 ); | ||
$analytics_version = $analytics_version['bsf-analytics-ver']; | ||
|
||
if ( version_compare( $analytics_version, $this->analytics_version, '>' ) ) { | ||
$this->analytics_version = $analytics_version; | ||
$this->analytics_path = $data['path']; | ||
} | ||
} | ||
} | ||
|
||
if ( ! isset( $unique_entities[ $key ] ) ) { | ||
$unique_entities[ $key ] = $data; | ||
} | ||
} | ||
} | ||
|
||
if ( file_exists( $this->analytics_path ) && ! class_exists( 'BSF_Analytics' ) ) { | ||
require_once $this->analytics_path . '/class-bsf-analytics.php'; | ||
new BSF_Analytics( $unique_entities, $this->analytics_path, $this->analytics_version ); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.