| @@ -1,94 +1,73 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -// +----------------------------------------------------------------------+ | |
| 4 | -// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) | | |
| 5 | -// +----------------------------------------------------------------------+ | |
| 6 | -// | This program is free software; you can redistribute it and/or modify | | |
| 7 | -// | it under the terms of the GNU General Public License, version 2, as | | |
| 8 | -// | published by the Free Software Foundation. | | |
| 9 | -// | | | |
| 10 | -// | This program is distributed in the hope that it will be useful, | | |
| 11 | -// | but WITHOUT ANY WARRANTY; without even the implied warranty of | | |
| 12 | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | |
| 13 | -// | GNU General Public License for more details. | | |
| 14 | -// | | | |
| 15 | -// | You should have received a copy of the GNU General Public License | | |
| 16 | -// | along with this program; if not, write to the Free Software | | |
| 17 | -// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, | | |
| 18 | -// | MA 02110-1301 USA | | |
| 19 | -// +----------------------------------------------------------------------+ | |
| 20 | -// | Author: Eugene Manuilov <eugene@manuilov.org> | | |
| 21 | -// +----------------------------------------------------------------------+ | |
| 22 | -/** | |
| 23 | - * Renders data uploading respond. | |
| 24 | - * | |
| 25 | - * @category Visualizer | |
| 26 | - * @package Render | |
| 27 | - * @subpackage Page | |
| 28 | - * | |
| 29 | - * @since 1.0.0 | |
| 30 | - */ | |
| 31 | -class Visualizer_Render_Page_Update extends Visualizer_Render_Page { | |
| 32 | - | |
| 33 | - /** | |
| 34 | - * Renders page template. | |
| 35 | - * | |
| 36 | - * @since 1.0.0 | |
| 37 | - * | |
| 38 | - * @access protected | |
| 39 | - */ | |
| 40 | - protected function _toHTML() { | |
| 41 | - if ( $this->is_request_from_gutenberg() ) { | |
| 42 | - return; | |
| 43 | - } | |
| 44 | - echo '<!DOCTYPE html>'; | |
| 45 | - echo '<html>'; | |
| 46 | - echo '<head>'; | |
| 47 | - echo '<script type="text/javascript">'; | |
| 48 | - echo '(function() {'; | |
| 49 | - if ( empty( $this->message ) ) { | |
| 50 | - echo 'var win = window.dialogArguments || opener || parent || top;'; | |
| 51 | - echo 'if (win.visualizer) {'; | |
| 52 | - echo 'win.visualizer.charts.canvas.series = ', $this->series, ';'; | |
| 53 | - echo 'win.visualizer.charts.canvas.data = ', $this->data, ';'; | |
| 54 | - if ( $this->settings ) { | |
| 55 | - echo 'win.visualizer.charts.canvas.settings = ', $this->settings, ';'; | |
| 56 | - } | |
| 57 | - echo 'win.vizUpdateChartPreview();'; | |
| 58 | - | |
| 59 | - // echo $this->updateEditorAndSettings(); | |
| 60 | - echo '}'; | |
| 61 | - | |
| 62 | - do_action( 'visualizer_add_update_hook', $this->series, $this->data ); | |
| 63 | - | |
| 64 | - if ( Visualizer_Module::is_pro() && Visualizer_Module::is_pro_older_than( '1.9.0' ) ) { | |
| 65 | - global $Visualizer_Pro; | |
| 66 | - $Visualizer_Pro->_addUpdateHook( $this->series, $this->data ); | |
| 67 | - } | |
| 68 | - } else { | |
| 69 | - echo 'alert("', $this->message, '");'; | |
| 70 | - } | |
| 71 | - echo '})();'; | |
| 72 | - echo '</script>'; | |
| 73 | - echo '</head>'; | |
| 74 | - echo '<body></body>'; | |
| 75 | - echo '</html>'; | |
| 76 | - } | |
| 77 | - | |
| 78 | - | |
| 79 | - /** | |
| 80 | - * Update the hidden content in the LHS and the advanced settings | |
| 81 | - */ | |
| 82 | - private function updateEditorAndSettings() { | |
| 83 | - $editor = ''; | |
| 84 | - if ( Visualizer_Module::can_show_feature( 'simple-editor' ) ) { | |
| 85 | - ob_start(); | |
| 86 | - Visualizer_Render_Layout::show( 'simple-editor-screen', $this->id ); | |
| 87 | - $editor = ob_get_clean(); | |
| 88 | - } | |
| 89 | - | |
| 90 | - $sidebar = apply_filters( 'visualizer_get_sidebar', '', $this->id ); | |
| 91 | - | |
| 92 | - return 'win.vizUpdateHTML(' . json_encode( array( 'html' => $editor ) ) . ', ' . json_encode( array( 'html' => $sidebar ) ) . ');'; | |
| 93 | - } | |
| 94 | -} | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +// +----------------------------------------------------------------------+ | |
| 4 | +// | Copyright 2013 Madpixels (email : visualizer@madpixels.net) | | |
| 5 | +// +----------------------------------------------------------------------+ | |
| 6 | +// | This program is free software; you can redistribute it and/or modify | | |
| 7 | +// | it under the terms of the GNU General Public License, version 2, as | | |
| 8 | +// | published by the Free Software Foundation. | | |
| 9 | +// | | | |
| 10 | +// | This program is distributed in the hope that it will be useful, | | |
| 11 | +// | but WITHOUT ANY WARRANTY; without even the implied warranty of | | |
| 12 | +// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | |
| 13 | +// | GNU General Public License for more details. | | |
| 14 | +// | | | |
| 15 | +// | You should have received a copy of the GNU General Public License | | |
| 16 | +// | along with this program; if not, write to the Free Software | | |
| 17 | +// | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, | | |
| 18 | +// | MA 02110-1301 USA | | |
| 19 | +// +----------------------------------------------------------------------+ | |
| 20 | +// | Author: Eugene Manuilov <eugene@manuilov.org> | | |
| 21 | +// +----------------------------------------------------------------------+ | |
| 22 | + | |
| 23 | + | |
| 24 | +/** | |
| 25 | + * Renders data uploading respond. | |
| 26 | + * | |
| 27 | + * @category Visualizer | |
| 28 | + * @package Render | |
| 29 | + * @subpackage Page | |
| 30 | + * | |
| 31 | + * @since 1.0.0 | |
| 32 | + */ | |
| 33 | +class Visualizer_Render_Page_Update extends Visualizer_Render_Page { | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * Renders page template. | |
| 37 | + * | |
| 38 | + * @since 1.0.0 | |
| 39 | + * | |
| 40 | + * @access protected | |
| 41 | + */ | |
| 42 | + protected function _toHTML() { | |
| 43 | + echo '<!DOCTYPE html>'; | |
| 44 | + echo '<html>'; | |
| 45 | + echo '<head>'; | |
| 46 | + echo '<script type="text/javascript">'; | |
| 47 | + echo '(function() {'; | |
| 48 | + if ( empty( $this->message ) ) { | |
| 49 | + echo 'var win = window.dialogArguments || opener || parent || top;'; | |
| 50 | + echo 'if (win.visualizer) {'; | |
| 51 | + echo 'win.visualizer.charts.canvas.series = ', $this->series, ';'; | |
| 52 | + echo 'win.visualizer.charts.canvas.data = ', $this->data, ';'; | |
| 53 | + echo 'win.visualizer.render();'; | |
| 54 | + echo '}'; | |
| 55 | + | |
| 56 | + // added by Ash/Upwork | |
| 57 | + if( defined( 'Visualizer_Pro' ) ){ | |
| 58 | + global $Visualizer_Pro; | |
| 59 | + $Visualizer_Pro->_addUpdateHook($this->series, $this->data); | |
| 60 | + } | |
| 61 | + // Added by Ash/Upwork | |
| 62 | + | |
| 63 | + } else { | |
| 64 | + echo 'alert("', $this->message, '");'; | |
| 65 | + } | |
| 66 | + echo '})();'; | |
| 67 | + echo '</script>'; | |
| 68 | + echo '</head>'; | |
| 69 | + echo '<body></body>'; | |
| 70 | + echo '</html>'; | |
| 71 | + } | |
| 72 | + | |
| 73 | +} | |