diff --git a/classes/Visualizer/Module/Admin.php b/classes/Visualizer/Module/Admin.php index 02a3f16d..4175a448 100644 --- a/classes/Visualizer/Module/Admin.php +++ b/classes/Visualizer/Module/Admin.php @@ -113,7 +113,7 @@ public function render_review_notice( $footer_text ) { __( 'Enjoying %1$s? %2$s %3$s rating. Thank you for being so supportive!', 'visualizer' ), 'Visualizer', esc_html__( 'You can help us by leaving a', 'visualizer' ), - '★★★★★' + '★★★★★' ); break; } @@ -427,7 +427,7 @@ public static function _getChartTypesLocalized( $enabledOnly = false, $get2Darra ); } - $enabled = self::proFeaturesLocked(); + $enabled = self::proFeaturesEnabled(); $types = array_merge( $additional, @@ -1163,6 +1163,20 @@ public function getPluginActionLinks( $links, $file ) { * @return array Updated array of plugin meta links. */ public function getPluginMetaLinks( $plugin_meta, $plugin_file ) { + if ( Visualizer_Module::is_pro() ) { + return $plugin_meta; + } + + // Also suppress the upsell when Pro is installed but not currently active. + if ( ! function_exists( 'get_plugins' ) ) { + require_once ABSPATH . 'wp-admin/includes/plugin.php'; + } + foreach ( array_keys( get_plugins() ) as $installed_plugin ) { + if ( false !== strpos( $installed_plugin, 'visualizer-pro' ) ) { + return $plugin_meta; + } + } + if ( $plugin_file === plugin_basename( VISUALIZER_BASEFILE ) ) { // knowledge base link $plugin_meta[] = sprintf( @@ -1180,15 +1194,37 @@ public function getPluginMetaLinks( $plugin_meta, $plugin_file ) { } /** - * If check is existing user. + * Returns true when premium chart types should be enabled for the current user. * - * @return bool Default false + * Pro 1.9.0+ hooks the 'visualizer_is_pro' filter and returns true only when + * the license is valid. Pre-1.9.0 Pro defined a Visualizer_Pro class instead; + * we detect that as a fallback so those legacy installs still work. + * + * Passing false as the filter default ensures the constant VISUALIZER_PRO + * (which is set to true whenever the Pro class exists, regardless of license + * state) cannot bypass the license check. + * + * @return bool */ - public static function proFeaturesLocked() { - if ( Visualizer_Module::is_pro() ) { + public static function proFeaturesEnabled() { + $is_pro_filter = apply_filters( 'visualizer_is_pro', false ); + + // Pro 1.9.0+: filter is hooked and returns true only with a valid license. + if ( $is_pro_filter ) { return true; } - return 'yes' === get_option( 'visualizer-new-user', 'yes' ) ? false : true; + + // Pro is installed (active) but the license check above did not pass. + // Do NOT fall through to the legacy "old user" path — that path exists + // only for sites that never had Pro installed. If Pro is present but + // the license is inactive we should lock, regardless of chart history. + if ( class_exists( 'Visualizer_Pro', false ) ) { + return false; + } + + // No Pro installed at all: grant legacy access to existing users so + // their charts are not suddenly broken when they upgrade the free plugin. + return 'yes' === get_option( 'visualizer-new-user' ) ? false : true; } /** diff --git a/classes/Visualizer/Render/Layout.php b/classes/Visualizer/Render/Layout.php index 33df0ee8..01c59ff0 100644 --- a/classes/Visualizer/Render/Layout.php +++ b/classes/Visualizer/Render/Layout.php @@ -1019,7 +1019,7 @@ class="dashicons dashicons-lock"> value="" data-viz-link=""> diff --git a/classes/Visualizer/Render/Library.php b/classes/Visualizer/Render/Library.php index 5a59d7fb..b20b74b6 100644 --- a/classes/Visualizer/Render/Library.php +++ b/classes/Visualizer/Render/Library.php @@ -42,7 +42,7 @@ protected function _toHTML() { esc_html_e( 'Visualizer Library', 'visualizer' ); echo ' ', esc_html__( 'Add New', 'visualizer' ), ''; if ( Visualizer_Module::is_pro() ) { - echo ' ', esc_html__( 'License Settings', 'visualizer' ), ''; + echo ' ', esc_html__( 'License Settings', 'visualizer' ), ''; } echo ''; $this->_renderMessages(); @@ -451,7 +451,7 @@ private function _renderSidebar() { echo '
'; } @@ -602,7 +602,7 @@ protected function _renderChartControlsGroup() { if ( 'google' !== $this->getLibrary() ) { return; } - if ( Visualizer_Module_Admin::proFeaturesLocked() ) { + if ( Visualizer_Module_Admin::proFeaturesEnabled() ) { self::_renderGroupStart( esc_html__( 'Chart Data Filter Configuration', 'visualizer' ) ); } else { self::_renderGroupStart( esc_html__( 'Chart Data Filter Configuration', 'visualizer' ) . '', '', apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'chart-filter-controls' ), 'vz-data-controls' ); @@ -619,7 +619,7 @@ protected function _renderChartControlsGroup() { ); self::_renderSectionEnd(); $this->_renderChartControlsSettings(); - if ( ! Visualizer_Module_Admin::proFeaturesLocked() ) { + if ( ! Visualizer_Module_Admin::proFeaturesEnabled() ) { echo apply_filters( 'visualizer_pro_upsell', '', 'data-filter-configuration' ); echo ''; } diff --git a/css/frame.css b/css/frame.css index 27e48e9b..8b8d9fcd 100644 --- a/css/frame.css +++ b/css/frame.css @@ -174,13 +174,15 @@ width: 100%; height: 100%; margin: 0; + padding-bottom: 60px; } -.viz-group.bottom-fixed { +.viz-group.bottom-fixed { display: block; - position: absolute; - bottom: 0; - width: 100%; + position: fixed; + width: 350px; + padding: 12px; + margin: 0 auto; } .viz-group ul li h2, @@ -1012,8 +1014,10 @@ button#editor-chart-button { } #vz-chart-copyright { - bottom: 10px; + bottom: 60px; text-align: center; + z-index: 999; + background: #f3f3f3; } /* Import steps — stepped data-source + schedule flow */ diff --git a/index.php b/index.php index f38210f6..9ff4677c 100644 --- a/index.php +++ b/index.php @@ -93,7 +93,7 @@ function visualizer_launch() { // the link to pre-build queries. define( 'VISUALIZER_DB_QUERY_DOC_URL', 'https://docs.themeisle.com/article/970-visualizer-sample-queries-to-generate-charts' ); define( 'VISUALIZER_MAIN_DOC', 'https://docs.themeisle.com/category/657-visualizer' ); - define( 'VISUALIZER_DOC_COLLECTION', 'https://docs.themeisle.com/search?collectionId=561ec249c69791452ed4bceb&query=#+visualizer' ); + define( 'VISUALIZER_DOC_COLLECTION', 'https://docs.themeisle.com/visualizer-charts-and-graphs/?query=#' ); define( 'VISUALIZER_DEMO_URL', 'https://demo.themeisle.com/visualizer/#' ); define( 'VISUALIZER_CODE_SNIPPETS_URL', 'https://docs.themeisle.com/category/726-visualizer' ); define( 'VISUALIZER_SUBSCRIBE_API', 'https://api.themeisle.com/tracking/subscribe' );