Skip to content

Commit 515361b

Browse files
release: fixes
- Fixed the lock of PRO features bypass
2 parents e9d6678 + 9c9e59f commit 515361b

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

classes/Visualizer/Module/Admin.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,4 +1174,19 @@ public function addMultilingualSupport( $chart_id ) {
11741174
<?php
11751175
}
11761176
}
1177+
1178+
/**
1179+
* Check chart is enabled or not.
1180+
*
1181+
* @param string $type Chart ID.
1182+
*
1183+
* @return bool Default false
1184+
*/
1185+
public static function checkChartStatus( $type ) {
1186+
$types = self::_getChartTypesLocalized( false, false, false, true );
1187+
if ( isset( $types[ $type ] ) ) {
1188+
return ! empty( $types[ $type ]['enabled'] );
1189+
}
1190+
return false;
1191+
}
11771192
}

classes/Visualizer/Module/Chart.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,10 @@ public function renderChartPages() {
539539
if ( empty( $_GET['lang'] ) || empty( $_GET['parent_chart_id'] ) ) {
540540
$this->deleteOldCharts();
541541
$default_type = isset( $_GET['type'] ) && ! empty( $_GET['type'] ) ? $_GET['type'] : 'line';
542+
$chart_status = Visualizer_Module_Admin::checkChartStatus( $default_type );
543+
if ( ! $chart_status ) {
544+
$default_type = 'line';
545+
}
542546
$source = new Visualizer_Source_Csv( VISUALIZER_ABSPATH . DIRECTORY_SEPARATOR . 'samples' . DIRECTORY_SEPARATOR . $default_type . '.csv' );
543547
$source->fetch();
544548
$chart_id = wp_insert_post(
@@ -949,7 +953,7 @@ private function _handleTypesPage() {
949953
if ( $_SERVER['REQUEST_METHOD'] === 'POST' && wp_verify_nonce( filter_input( INPUT_POST, 'nonce' ) ) ) {
950954
$type = filter_input( INPUT_POST, 'type' );
951955
$library = filter_input( INPUT_POST, 'chart-library' );
952-
if ( in_array( $type, Visualizer_Plugin::getChartTypes(), true ) ) {
956+
if ( Visualizer_Module_Admin::checkChartStatus( $type ) ) {
953957
if ( empty( $library ) ) {
954958
// library cannot be empty.
955959
do_action( 'themeisle_log_event', Visualizer_Plugin::NAME, 'Chart library empty while creating the chart! Aborting...', 'error', __FILE__, __LINE__ );

0 commit comments

Comments
 (0)