Skip to content
Merged

Release #1400

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
15d30c3
Sync branch [skip ci]
pirate-bot Oct 26, 2026
c1759fc
Sync branch [skip ci]
pirate-bot Oct 26, 2026
995c9e0
chore(deps): bump codeinwp/themeisle-sdk from 3.3.67 to 3.3.68 (#1399)
dependabot[bot] Oct 27, 2026
2ec5b49
feat: opt into the ThemeIsle SDK Support Hub
HardeepAsrani Nov 2, 2026
054efd7
fix: clarify support hub metadata types
HardeepAsrani Nov 2, 2026
0883f84
chore(deps): bump codeinwp/themeisle-sdk from 3.3.68 to 3.3.69 (#1402)
dependabot[bot] Nov 2, 2026
fb76fba
chore(deps-dev): bump phpstan/phpstan from 2.3.1 to 2.3.2 (#1401)
dependabot[bot] Nov 2, 2026
93b02aa
fix: point docs links to current pages and track them with UTMs
poonam279 Nov 3, 2026
095acf7
fix(black-friday): treat active_expired licenses as expired (#1398)
Soare-Robert-Daniel Nov 3, 2026
5191d4b
fix: drop the support hub setup nudge for now
vytisbulkevicius Nov 3, 2026
4e871a5
chore(deps-dev): bump phpstan/phpstan from 2.3.2 to 2.3.3 (#1406)
dependabot[bot] Nov 3, 2026
7963adf
chore(deps): bump codeinwp/themeisle-sdk from 3.3.69 to 3.3.70 (#1405)
dependabot[bot] Nov 3, 2026
a4eff75
chore(deps): bump codeinwp/themeisle-sdk from 3.3.70 to 3.3.71 (#1408)
dependabot[bot] Nov 5, 2026
ab6afe6
chore(deps-dev): bump phpstan/phpstan from 2.3.3 to 2.3.4 (#1407)
dependabot[bot] Nov 5, 2026
c7d4322
chore(deps): bump codeinwp/themeisle-sdk from 3.3.71 to 3.3.72
dependabot[bot] Nov 6, 2026
c7de35c
Merge pull request #1409 from Codeinwp/dependabot/composer/developmen…
vytisbulkevicius Nov 6, 2026
a7af6d1
fix: stop the chart type rewrite from breaking the Common Snippets link
poonam279 Nov 9, 2026
dfa6aef
Merge pull request #1404 from Codeinwp/fix/docs-links-utm
poonam279 Nov 9, 2026
f2470bf
chore(deps-dev): bump phpstan/phpstan from 2.3.4 to 2.3.5 (#1410)
dependabot[bot] Nov 10, 2026
6ee5e65
fix: normalize table rendering inputs
selul Nov 11, 2026
396d469
fix: scope chart data access boundaries
selul Nov 12, 2026
6f43769
test: cover chart data sanitization in the block editor
vytisbulkevicius Nov 13, 2026
f407907
fix: apply the chart cell boundary to previews and keep report data o…
vytisbulkevicius Nov 14, 2026
765ab3b
fix: keep stored values in editing paths and escape editor output
vytisbulkevicius Nov 14, 2026
7f99490
Merge pull request #1411 from Codeinwp/codex/security-review
vytisbulkevicius Nov 15, 2026
25ab208
Merge pull request #1403 from Codeinwp/feat/support-hub
vytisbulkevicius Nov 15, 2026
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
9 changes: 8 additions & 1 deletion classes/Visualizer/Gutenberg/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,14 @@ public function get_visualizer_data( $post ) {
$data['visualizer-settings'] = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_SETTINGS, $data['visualizer-settings'], $post_id, $data['visualizer-chart-type'] );

// handle data filter hooks
$data['visualizer-data'] = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_DATA, Visualizer_Module::decode_content( html_entity_decode( get_post_field( 'post_content', $post_id, 'raw' ) ) ), $post_id, $data['visualizer-chart-type'] );
$data['visualizer-data'] = Visualizer_Module::sanitize_chart_data(
apply_filters(
Visualizer_Plugin::FILTER_GET_CHART_DATA,
Visualizer_Module::decode_content( html_entity_decode( get_post_field( 'post_content', $post_id, 'raw' ) ) ),
$post_id,
$data['visualizer-chart-type']
)
);

// we are going to format only for tabular charts, because we are not sure of the effect on others.
// this is to solve the case where boolean data shows up as all-ticks on gutenberg.
Expand Down
52 changes: 48 additions & 4 deletions classes/Visualizer/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function _getDataAs( $chart_id, $type ) {
$settings = get_post_meta( $chart_id, Visualizer_Plugin::CF_SETTINGS, true );
$rows = array();
$series = get_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, true );
$data = self::get_chart_data( $chart, $type, false );
$data = self::get_chart_data( $chart, $type, false, 'print' === $type );
if ( ! empty( $series ) ) {
$row = array();
foreach ( $series as $array ) {
Expand Down Expand Up @@ -880,8 +880,14 @@ public static function maybe_decode_content( $value ) {

/**
* Gets the chart content after common manipulations.
*
* @param WP_Post|object $chart The chart post.
* @param string $type The chart type passed to the data filter.
* @param bool $run_filter Whether to run the chart data filter.
* @param bool $sanitize Whether to prepare the cells for HTML-capable renderers; exports and editors need the stored values.
* @return mixed The chart data.
*/
public static function get_chart_data( $chart, $type, $run_filter = true ) {
public static function get_chart_data( $chart, $type, $run_filter = true, $sanitize = true ) {
// change HTML entities
$post_content = html_entity_decode( htmlentities( $chart->post_content ) );
$post_content = preg_replace_callback(
Expand Down Expand Up @@ -912,9 +918,47 @@ function ( $matches ) {
$altered = $data;
}
if ( $run_filter ) {
return apply_filters( Visualizer_Plugin::FILTER_GET_CHART_DATA, $altered, $chart->ID, $type );
$altered = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_DATA, $altered, $chart->ID, $type );
}

return $sanitize ? self::sanitize_chart_data( $altered ) : $altered;
}

/**
* Saves a chart's JSON endpoint, recording the user who changes it as the WooCommerce report user.
*
* A scheduled refresh of the endpoint then uses this user's report access,
* not the access of whoever authorized an earlier endpoint.
*
* @param int $chart_id The chart ID.
* @param string $url The JSON endpoint.
* @return void
*/
public static function update_json_url( $chart_id, $url ) {
if ( get_post_meta( $chart_id, Visualizer_Plugin::CF_JSON_URL, true ) !== $url ) {
update_post_meta( $chart_id, Visualizer_Plugin::CF_WOOCOMMERCE_REPORT_USER, get_current_user_id() );
}
return $altered;
update_post_meta( $chart_id, Visualizer_Plugin::CF_JSON_URL, $url );
}

/**
* Sanitize chart data before passing it to HTML-capable renderers.
*
* @param mixed $data Chart data.
* @return mixed Sanitized chart data.
*/
public static function sanitize_chart_data( $data ) {
// Preserve normal text and supported formatting while removing active
// markup from imports, scheduled remote sources, and filtered data.
return map_deep(
$data,
static function ( $value ) {
if ( ! is_string( $value ) || ! preg_match( '/<\s*\/?\s*[a-zA-Z!]/', $value ) ) {
return $value;
}
return wp_kses_post( $value );
}
);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions classes/Visualizer/Module/AIBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public function fetchChart(): void {
$this->_verify_chart_access( $chart_id );

$series = get_post_meta( $chart_id, Visualizer_Plugin::CF_SERIES, true );
$data = Visualizer_Module::get_chart_data( $chart, '', false );
$data = Visualizer_Module::get_chart_data( $chart, '', false, false );
$code = get_post_meta( $chart_id, self::CF_D3_CODE, true );
$settings = get_post_meta( $chart_id, Visualizer_Plugin::CF_SETTINGS, true );
$title = ( is_array( $settings ) && ! empty( $settings['backend-title'] ) )
Expand Down Expand Up @@ -360,7 +360,7 @@ public function uploadData(): void {
$source = new Visualizer_Source_Json( $params );

// Store config for sync
update_post_meta( $chart_id, Visualizer_Plugin::CF_JSON_URL, $params['url'] );
Visualizer_Module::update_json_url( $chart_id, $params['url'] );
update_post_meta( $chart_id, Visualizer_Plugin::CF_JSON_ROOT, $params['root'] );
if ( ! empty( $_POST['json_schedule'] ) ) {
update_post_meta( $chart_id, Visualizer_Plugin::CF_JSON_SCHEDULE, intval( $_POST['json_schedule'] ) );
Expand Down
4 changes: 2 additions & 2 deletions classes/Visualizer/Module/Abilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ public function executeGetChart( $input = array() ) {

$type = (string) get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true );
$series = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_SERIES, get_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, true ), $chart->ID, $type );
$data = self::get_chart_data( $chart, $type );
$data = self::get_chart_data( $chart, $type, true, false );
$settings = get_post_meta( $chart->ID, Visualizer_Plugin::CF_SETTINGS, true );
$settings = apply_filters( Visualizer_Plugin::FILTER_GET_CHART_SETTINGS, $settings, $chart->ID, $type );
if ( ! is_array( $settings ) ) {
Expand Down Expand Up @@ -1048,7 +1048,7 @@ private function setJsonSource( $chart, $input, $hours, $dry_run ) {
$this->clearSourceMeta( $chart->ID, true );
update_post_meta( $chart->ID, Visualizer_Plugin::CF_EDITABLE_TABLE, true );
$this->persistSource( $chart->ID, $source );
update_post_meta( $chart->ID, Visualizer_Plugin::CF_JSON_URL, $params['url'] );
self::update_json_url( $chart->ID, $params['url'] );
update_post_meta( $chart->ID, Visualizer_Plugin::CF_JSON_ROOT, $params['root'] );

$headers = array( 'method' => $params['method'] );
Expand Down
6 changes: 4 additions & 2 deletions classes/Visualizer/Module/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,8 @@ public function enqueueSettingsScripts( string $hook_suffix ): void {
}
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_script( 'wp-color-picker' );

do_action( 'themeisle_internal_page', VISUALIZER_DIRNAME, 'settings' );
}

/**
Expand Down Expand Up @@ -1409,7 +1411,7 @@ public function getPluginMetaLinks( $plugin_meta, $plugin_file ) {
$is_black_friday = apply_filters( 'themeisle_sdk_is_black_friday_sale', false );
// knowledge base link
$plugin_meta[] = sprintf(
'<a href="' . VISUALIZER_MAIN_DOC . '" target="_blank">%s</a>',
'<a href="' . esc_url( tsdk_utmify( VISUALIZER_MAIN_DOC, 'documentation', 'pluginrow' ) ) . '" target="_blank">%s</a>',
esc_html__( 'Docs', 'visualizer' )
);
if ( ! $is_black_friday ) {
Expand Down Expand Up @@ -1609,7 +1611,7 @@ public function add_black_friday_data( $configs ) {
$pro_product_slug = defined( 'VISUALIZER_PRO_BASEFILE' ) ? basename( dirname( VISUALIZER_PRO_BASEFILE ) ) : '';

$is_pro = 'valid' === $status;
$is_expired = 'expired' === $status || 'active-expired' === $status;
$is_expired = in_array( $status, array( 'expired', 'active_expired', 'active-expired' ), true );

if ( $is_pro ) {
// translators: %s is the discount percentage.
Expand Down
26 changes: 14 additions & 12 deletions classes/Visualizer/Module/Chart.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ public function setJsonSchedule() {
);

if ( Visualizer_Module::is_pro() ) {
$is_woocommerce_report = filter_input(
INPUT_POST,
'is_woocommerce_report',
FILTER_VALIDATE_BOOLEAN
);
$is_woocommerce_report = isset( $_POST['is_woocommerce_report'] ) ? filter_var( wp_unslash( $_POST['is_woocommerce_report'] ), FILTER_VALIDATE_BOOLEAN ) : false;

if ( $is_woocommerce_report ) {
if ( ! current_user_can( 'view_woocommerce_reports' ) ) {
wp_send_json_error( array( 'msg' => esc_html__( 'You do not have permission to access WooCommerce reports.', 'visualizer' ) ), 403 );
}
update_post_meta( $chart_id, Visualizer_Plugin::CF_IS_WOOCOMMERCE_SOURCE, true );
update_post_meta( $chart_id, Visualizer_Plugin::CF_WOOCOMMERCE_REPORT_USER, get_current_user_id() );
} else {
delete_post_meta( $chart_id, Visualizer_Plugin::CF_IS_WOOCOMMERCE_SOURCE );
}
Expand Down Expand Up @@ -220,7 +220,7 @@ public function getJsonData() {
wp_send_json_error( array( 'msg' => esc_html__( 'Unable to fetch data from the endpoint. Please try again.', 'visualizer' ) ) );
}

$data = Visualizer_Render_Layout::show( 'editor-table', $data, $chart_id, 'viz-json-table', false, false );
$data = Visualizer_Render_Layout::show( 'editor-table', self::sanitize_chart_data( $data ), $chart_id, 'viz-json-table', false, false );
wp_send_json_success( array( 'table' => $data, 'root' => $params['root'], 'url' => $params['url'], 'paging' => $source->getPaginationElements() ) );
}

Expand Down Expand Up @@ -253,7 +253,7 @@ public function setJsonData() {
update_post_meta( $chart->ID, Visualizer_Plugin::CF_SERIES, $source->getSeries() );
update_post_meta( $chart->ID, Visualizer_Plugin::CF_SOURCE, $source->getSourceName() );
update_post_meta( $chart->ID, Visualizer_Plugin::CF_DEFAULT_DATA, 0 );
update_post_meta( $chart->ID, Visualizer_Plugin::CF_JSON_URL, $params['url'] );
self::update_json_url( $chart->ID, $params['url'] );
update_post_meta( $chart->ID, Visualizer_Plugin::CF_JSON_ROOT, $params['root'] );

delete_post_meta( $chart->ID, Visualizer_Plugin::CF_JSON_HEADERS );
Expand Down Expand Up @@ -304,7 +304,7 @@ public function setJsonData() {

$render = new Visualizer_Render_Page_Update();
$render->id = $chart->ID;
$render->data = json_encode( $source->getRawData( get_post_meta( $chart_id, Visualizer_Plugin::CF_EDITABLE_TABLE, true ) ) );
$render->data = json_encode( self::sanitize_chart_data( $source->getRawData( get_post_meta( $chart_id, Visualizer_Plugin::CF_EDITABLE_TABLE, true ) ) ) );
$render->series = json_encode( $source->getSeries() );
$render->render();

Expand Down Expand Up @@ -631,7 +631,8 @@ public function renderChartPages() {
$post_meta = get_post_meta( $parent_chart_id );
$chart_id = $new_chart_id;
foreach ( $post_meta as $key => $value ) {
if ( strpos( $key, 'visualizer-' ) !== false ) {
// A copy refreshes reports with its own author's access.
if ( strpos( $key, 'visualizer-' ) !== false && Visualizer_Plugin::CF_WOOCOMMERCE_REPORT_USER !== $key ) {
add_post_meta( $new_chart_id, $key, self::maybe_decode_content( $value[0] ) );
}
}
Expand Down Expand Up @@ -1420,7 +1421,7 @@ public function uploadData() {
}

$render->id = $chart->ID;
$render->data = json_encode( $source->getRawData( get_post_meta( $chart->ID, Visualizer_Plugin::CF_EDITABLE_TABLE, true ) ) );
$render->data = json_encode( self::sanitize_chart_data( $source->getRawData( get_post_meta( $chart->ID, Visualizer_Plugin::CF_EDITABLE_TABLE, true ) ) ) );
$render->series = json_encode( $source->getSeries() );
$render->settings = json_encode( $settings );
} else {
Expand Down Expand Up @@ -1475,7 +1476,8 @@ public function cloneChart() {
} else {
$post_meta = get_post_meta( $chart_id );
foreach ( $post_meta as $key => $value ) {
if ( strpos( $key, 'visualizer-' ) !== false ) {
// A copy refreshes reports with its own author's access.
if ( strpos( $key, 'visualizer-' ) !== false && Visualizer_Plugin::CF_WOOCOMMERCE_REPORT_USER !== $key ) {
add_post_meta( $new_chart_id, $key, self::maybe_decode_content( $value[0] ) );
}
}
Expand Down Expand Up @@ -1682,7 +1684,7 @@ public function saveQuery() {
'post_content' => $source->getData( get_post_meta( $chart_id, Visualizer_Plugin::CF_EDITABLE_TABLE, true ) ),
)
);
$render->data = json_encode( $source->getRawData( get_post_meta( $chart_id, Visualizer_Plugin::CF_EDITABLE_TABLE, true ) ) );
$render->data = json_encode( self::sanitize_chart_data( $source->getRawData( get_post_meta( $chart_id, Visualizer_Plugin::CF_EDITABLE_TABLE, true ) ) ) );
$render->series = json_encode( $source->getSeries() );
$render->id = $chart_id;
} else {
Expand Down
4 changes: 3 additions & 1 deletion classes/Visualizer/Module/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,8 @@ public function refresh_db_for_chart( $chart, $chart_id, $force = false ) {
return $chart;
}

// Editable-table charts fetch again here, so check the error after this read.
$content = $source->getData( get_post_meta( $chart_id, Visualizer_Plugin::CF_EDITABLE_TABLE, true ) );
$error = $source->get_error();
if ( empty( $error ) ) {
$this->disableRevisionsTemporarily();
Expand All @@ -406,7 +408,7 @@ public function refresh_db_for_chart( $chart, $chart_id, $force = false ) {
wp_update_post(
array(
'ID' => $chart_id,
'post_content' => $source->getData( get_post_meta( $chart_id, Visualizer_Plugin::CF_EDITABLE_TABLE, true ) ),
'post_content' => $content,
)
);

Expand Down
1 change: 1 addition & 0 deletions classes/Visualizer/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class Visualizer_Plugin {
const CF_CHART_CACHE = 'visualizer-chart-cache';
const CF_JSON_WOOCOMMERCE_SOURCE = 'visualizer-woocommerce-source';
const CF_IS_WOOCOMMERCE_SOURCE = 'visualizer-is-woocommerce-source';
const CF_WOOCOMMERCE_REPORT_USER = 'visualizer-woocommerce-report-user';

/**
* Name of the option for WordPress DB.
Expand Down
Loading
Loading