Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/Library/Usage.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,30 @@ public function admin_enqueue_scripts() {
date( 'Ymd' )
);

$plugins_data = [];
foreach ( \Boldgrid\Library\Library\Util\Plugin::getFiltered( 'boldgrid' ) as $plugin ) {
$plugins_data[] = [
'plugin' => $plugin['TextDomain'],
'name' => $plugin['Name'],
'version' => $plugin['Version'],
];
}
error_log(serialize(\Boldgrid\Library\Library\Util\Plugin::getFiltered()));
$plugin = '';
$version = '';
foreach ($plugins_data as $plugin_data) {
if (false !== strpos( $_GET['page'], $plugin_data['plugin'] ) ) {
$plugin = $plugin_data['name'];
$version = $plugin_data['version'];
}
}

$translation = [
'page' => ! empty ( $_GET['page'] ) ? $_GET['page'] : '',
'ga_id' => $this->gaId,
'license' => json_encode( $licenseData ),
'plugin' => $plugin,
'version' => $version,
];

wp_localize_script( $handle, 'BglibUsage', $translation );
Expand Down
8 changes: 7 additions & 1 deletion src/assets/js/usage.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,14 @@ BOLDGRID.LIBRARY = BOLDGRID.LIBRARY || {};

// Configure license.
params.license = self.i18n.license;
if ( 'Total Upkeep' === self.i18n.plugin ) {
params.version = self.i18n.version;
} else {
params.version = '';
}
params.custom_map = {
dimension7: 'license'
dimension7: 'license',
dimension8: 'version'
};

// Configure linker. This will add client id, on click, to all boldgrid.com links.
Expand Down