Repository navigation
Show a saved chart image only for the chart it was saved for #1429
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
Changes from all commits
35d8e82
73e94c5
19b1284
2407951
37c1ded
f6ed9f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1752,11 +1752,11 @@ public function saveFilter() { | |
| * @return int Attachment ID, or 0 when no attachment was saved. | ||
| */ | ||
| public function save_chart_image( $base64_img, $chart_id, $save_attachment = true ) { | ||
| $filename = 'visualization-' . $chart_id . '.png'; | ||
| $filename = self::chart_image_filename( $chart_id ); | ||
|
|
||
| // Delete the old chart image, but only a file with the name that this method gives to the image of this chart. | ||
| $old_attachment_id = (int) get_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_IMAGE, true ); | ||
| if ( $old_attachment_id && basename( (string) get_attached_file( $old_attachment_id ) ) === $filename ) { | ||
| // Delete the old chart image, but only the image of this chart. | ||
| $old_attachment_id = self::get_chart_image_id( $chart_id ); | ||
| if ( $old_attachment_id ) { | ||
| wp_delete_attachment( $old_attachment_id, true ); | ||
| } | ||
|
Comment on lines
+1757
to
1761
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added in 37c1ded:
Comment on lines
+1757
to
1761
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only |
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noteThe new ownership check covers the shortcode, the image export and the default AMP output. Thevisualizer_amp_viewfilter receives the chart before that check. If a Visualizer Pro callback reads the rawvisualizer-chart-imagemeta, a chart copied by an older version still shows the image of its source chart there. If Pro reads the image throughget_chart_image_id()or_getImage(), it is safe.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked: Visualizer Pro does not read
visualizer-chart-imageor thechart-imgsetting in any file.