Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release #1152

Merged
merged 21 commits into from
May 23, 2024
Merged

Release #1152

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
b856b84
Sync branch [skip ci]
pirate-bot May 14, 2024
468c3c8
Sync branch [skip ci]
pirate-bot May 14, 2024
c50062e
Update index.php
vytisbulkevicius May 16, 2024
2e20fdb
chore: replaced favicons with dashicons
GrigoreMihai May 17, 2024
1ea938f
chore: added renew notice dom cleanup on close
GrigoreMihai May 17, 2024
874cf97
chore: added proper links for license renew on lock notice
GrigoreMihai May 17, 2024
7c53f00
chore: optimized feature lock notice rendering
GrigoreMihai May 20, 2024
94c9181
removed leftover testing code
GrigoreMihai May 20, 2024
565348d
lint code
GrigoreMihai May 20, 2024
378fa1a
chore: mode the pro popup blocker to separate function
GrigoreMihai May 20, 2024
064c73b
lint code
GrigoreMihai May 20, 2024
7b5d823
fix: sql for subscriber
preda-bogdan May 20, 2024
cedcd06
chore: code style
preda-bogdan May 20, 2024
e6e85fb
chore(deps): bump codeinwp/themeisle-sdk from 3.3.21 to 3.3.22
dependabot[bot] May 20, 2024
106789c
Merge pull request #1155 from Codeinwp/dependabot/composer/developmen…
vytisbulkevicius May 21, 2024
7a58250
chore: addresed pr review changes
GrigoreMihai May 22, 2024
ebe416e
fix: widget not loading
preda-bogdan May 23, 2024
7ae84d2
Merge pull request #1154 from Codeinwp/fix/sql_data_save
vytisbulkevicius May 23, 2024
b94a05b
Merge pull request #1157 from Codeinwp/fix/widgets
vytisbulkevicius May 23, 2024
187c7f6
chore: added e2e test for pro chart lock
GrigoreMihai May 23, 2024
f131320
Merge pull request #1153 from Codeinwp/fix/470
vytisbulkevicius May 23, 2024
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
Prev Previous commit
Next Next commit
chore: optimized feature lock notice rendering
  • Loading branch information
GrigoreMihai committed May 20, 2024
commit 7c53f0021aa3d88e097fd34320c1f81bbc4c3410
10 changes: 1 addition & 9 deletions classes/Visualizer/Module/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -1019,13 +1019,7 @@ public function renderLibraryPage() {
}
// enqueue charts array
$ajaxurl = admin_url( 'admin-ajax.php' );
$license = get_option( 'visualizer_pro_license_data', 'free' );
$license_key = '';
$download_id = '';
if ( ! empty( $license ) && is_object( $license ) ) {
$license_key = $license->key;
$download_id = $license->download_id;
}

wp_localize_script(
'visualizer-library',
'visualizer',
Expand Down Expand Up @@ -1065,8 +1059,6 @@ public function renderLibraryPage() {
'conflict' => __( 'We have detected a potential conflict with another component that prevents Visualizer from functioning properly. Please disable any of the following components if they are activated on your instance: Modern Events Calendar plugin, Acronix plugin. In case the aforementioned components are not activated or you continue to see this error message, please disable all other plugins and enable them one by one to find out the component that is causing the conflict.', 'visualizer' ),
),
'is_pro_user' => Visualizer_Module::is_pro(),
'admin_license_url' => admin_url('options-general.php#visualizer_pro_license'),
'renew_license_url' => tsdk_utmify( Visualizer_Plugin::STORE_URL . '?edd_license_key=' . $license_key . '&download_id=' .$download_id, 'visualizer_license_block' ),
)
);
// render library page
Expand Down
58 changes: 58 additions & 0 deletions classes/Visualizer/Render/Library.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,48 @@ private function getDisplayForm() {
* @access private
*/
private function _renderLibrary() {
$license = get_option( 'visualizer_pro_license_data', 'free' );
$license_key = '';
$download_id = '';
if ( ! empty( $license ) && is_object( $license ) ) {
$license_key = $license->key;
$download_id = $license->download_id;
}
$admin_license_url = admin_url('options-general.php#visualizer_pro_license');
$renew_license_url = tsdk_utmify( Visualizer_Plugin::STORE_URL . '?edd_license_key=' . $license_key . '&download_id=' .$download_id, 'visualizer_license_block' );
// Added by Ash/Upwork
$filterBy = ! empty( $_GET['s'] ) ? sanitize_text_field( wp_unslash( $_GET['s'] ) ) : null; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
// Added by Ash/Upwork
echo $this->custom_css;
if ( ! Visualizer_Module::is_pro() ) {
echo '
<div class="vizualizer-renew-notice-overlay" id="overlay-visualizer"></div>
<div class="vizualizer-renew-notice-popup">
<h1 class="vizualizer-renew-notice-heading">Alert!</h1>
<p class="vizualizer-renew-notice-message">' . esc_html__( 'In order to edit premium charts, benefit from updates and support for Visualizer Premium plugin, please renew your license code or activate it.', 'visualizer' ) . ' </p>
<div class="vizualizer-renew-notice-buttons-container">
<a href="' . esc_url($renew_license_url) . '" target="_blank">
<button class="vizualizer-renew-notice-button vizualizer-renew-notice-renew-button">
<span class="dashicons dashicons-cart"></span>' . esc_html__( 'Renew License', 'visualizer' ) . '
</button>
</a>
<a href="' . esc_url($admin_license_url) . '">
<button class="vizualizer-renew-notice-button vizualizer-renew-notice-activate-button">
<span class="dashicons dashicons-unlock"></span> ' . esc_html__( 'Activate License', 'visualizer' ) . '
</button>
</a>
</div>
<i class="dashicons dashicons-no vizualizer-renew-notice-close-icon"></i>
</div>
<script>
jQuery(document).ready(function($) {
$(".vizualizer-renew-notice-close-icon").on("click", function() {
$("#overlay-visualizer").css("display", "none");
$(".vizualizer-renew-notice-popup").css("display", "none");
});
});
</script>';
}
echo '<div id="visualizer-types" class="visualizer-clearfix">';
echo '<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"><symbol id="list-icon" fill="currentColor"><path d="M8 0C3.58 0 0 3.58 0 8C0 12.42 3.58 16 8 16C12.42 16 16 12.42 16 8C16 3.58 12.42 0 8 0ZM7.385 12.66H6.045L2.805 8.12L4.146 6.87L6.715 9.27L11.856 3.339L13.196 4.279L7.385 12.66Z"/></symbol></svg>';
$this->getDisplayForm();
Expand Down Expand Up @@ -251,6 +289,26 @@ private function _renderLibrary() {
$this->_renderSidebar();
}
echo '</div>';

// echo '
//
// <h1 class="vizualizer-renew-notice-heading">Alert!</h1>
// <p class="vizualizer-renew-notice-message">
// In order to edit premium charts, benefit from updates and support for Visualizer Premium plugin, please renew your license code or activate it.
// </p>
// <div class="vizualizer-renew-notice-buttons-container">
// <a href="${visualizer.renew_license_url}" target="_blank">
// <button class="vizualizer-renew-notice-button vizualizer-renew-notice-renew-button">
// <span class="dashicons dashicons-cart"></span> Renew License
// </button>
// </a>
// <a href="${visualizer.admin_license_url}">
// <button class="vizualizer-renew-notice-button vizualizer-renew-notice-activate-button">
// <span class="dashicons dashicons-unlock"></span> Activate License
// </button>
// </a>
// </div>
// <i class="dashicons dashicons-no vizualizer-renew-notice-close-icon"></i> ';
} else {
echo '<div id="visualizer-library" class="visualizer-clearfix">';
echo '<div class="items"><div class="visualizer-chart">';
Expand Down
3 changes: 2 additions & 1 deletion css/library.css
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ div#visualizer-types ul, div#visualizer-types form p {


.vizualizer-renew-notice-overlay {
display: none;
position: fixed;
top: 0;
left: 0;
Expand All @@ -532,7 +533,7 @@ div#visualizer-types ul, div#visualizer-types form p {
}

.vizualizer-renew-notice-popup {
display: block;
display: none;
position: fixed;
top: 50%;
left: 50%;
Expand Down
77 changes: 12 additions & 65 deletions js/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,61 +33,13 @@
});
})(wp.media.view);

function createPopupProBlocker() {

var overlay = document.createElement('div');
overlay.classList.add('vizualizer-renew-notice-overlay');
overlay.id = 'overlay-visualizer';
document.body.appendChild(overlay);

var popup = document.createElement('div');
popup.classList.add('vizualizer-renew-notice-popup');

var heading = document.createElement('h1');
heading.textContent = 'Alert!';
heading.classList.add('vizualizer-renew-notice-heading');
popup.appendChild(heading);

var message = document.createElement('p');
message.textContent = 'In order to edit premium charts, benefit from updates and support for Visualizer Premium plugin, please renew your license code or activate it.';
message.classList.add('vizualizer-renew-notice-message');
popup.appendChild(message);

var buttonsContainer = document.createElement('div');
buttonsContainer.classList.add('vizualizer-renew-notice-buttons-container');

var link1 = document.createElement('a');
link1.href = visualizer.renew_license_url;
link1.target = '_blank';
var button1 = document.createElement('button');
button1.innerHTML = '<span class="dashicons dashicons-cart"></span> Renew License';
button1.classList.add('vizualizer-renew-notice-button', 'vizualizer-renew-notice-renew-button');
link1.appendChild(button1);
buttonsContainer.appendChild(link1);

var link2 = document.createElement('a');
link2.href = visualizer.admin_license_url;
var button2 = document.createElement('button');
button2.innerHTML = '<span class="dashicons dashicons-unlock"></span> Activate License';
button2.classList.add('vizualizer-renew-notice-button', 'vizualizer-renew-notice-activate-button');
link2.appendChild(button2);
buttonsContainer.appendChild(link2);

popup.appendChild(buttonsContainer);

var closeIcon = document.createElement('i');

closeIcon.classList.add('dashicons', 'dashicons-no', 'vizualizer-renew-notice-close-icon');

closeIcon.addEventListener('click', function() {
document.body.removeChild(overlay);
document.body.removeChild(popup);
});

popup.appendChild(closeIcon);

document.body.appendChild(popup);

function createPopupProBlocker( $ , e ) {
if ( ! visualizer.is_pro_user && e.target.classList.contains('viz-is-pro-chart') ) {
$("#overlay-visualizer").css("display", "block");
$(".vizualizer-renew-notice-popup").css("display", "block");
return true;
}
return false;
}

(function ($, vmv, vu) {
Expand Down Expand Up @@ -135,8 +87,7 @@ function createPopupProBlocker() {

$('.visualizer-chart-shortcode').click(function (e) {

if ( ! visualizer.is_pro_user && e.target.classList.contains('viz-is-pro-chart') ) {
createPopupProBlocker();
if ( createPopupProBlocker( $, e ) ) {
e.preventDefault();
e.stopPropagation();
return;
Expand Down Expand Up @@ -193,8 +144,7 @@ function createPopupProBlocker() {

$('.visualizer-chart-edit').click(function (event) {

if ( ! visualizer.is_pro_user && event.target.classList.contains('viz-is-pro-chart') ) {
createPopupProBlocker();
if ( createPopupProBlocker( $, event ) ) {
return;
}

Expand All @@ -213,16 +163,14 @@ function createPopupProBlocker() {
return false;
});
$(".visualizer-chart-clone").on("click", function ( event ) {
if ( ! visualizer.is_pro_user && event.target.classList.contains('viz-is-pro-chart') ) {
createPopupProBlocker();
if ( createPopupProBlocker( $, event ) ) {
event.preventDefault();
}
});

$(".visualizer-chart-export").on("click", function (event) {

if ( ! visualizer.is_pro_user && event.target.classList.contains('viz-is-pro-chart') ) {
createPopupProBlocker();
if ( createPopupProBlocker( $, event ) ) {
return;
}

Expand All @@ -247,8 +195,7 @@ function createPopupProBlocker() {
});

$(".visualizer-chart-image").on("click", function (event) {
if ( ! visualizer.is_pro_user && event.target.classList.contains('viz-is-pro-chart') ) {
createPopupProBlocker();
if ( createPopupProBlocker( $, event ) ) {
return;
}
$('body').trigger('visualizer:action:specificchart', {action: 'image', id: $(this).attr("data-chart"), data: null, dataObj: {name: $(this).attr("data-chart-title")}});
Expand Down
Loading