| @@ -45,9 +45,9 @@ | ||
| 45 | 45 | /** |
| 46 | 46 | * Returns an instance of this class. |
| 47 | 47 | */ |
| 48 | 48 | public static function get_instance() { |
| 49 | - if ( null == self::$instance ) { | |
| 49 | + if ( null === self::$instance ) { | |
| 50 | 50 | self::$instance = new Visualizer_Gutenberg_Block(); |
| 51 | 51 | } |
| 52 | 52 | return self::$instance; |
| 53 | 53 | } |
| @@ -65,15 +65,15 @@ | ||
| 65 | 65 | /** |
| 66 | 66 | * Enqueue front end and editor JavaScript and CSS |
| 67 | 67 | */ |
| 68 | 68 | public function enqueue_gutenberg_scripts() { |
| 69 | - $blockPath = VISUALIZER_ABSURL . '/classes/Visualizer/Gutenberg/build/block.js'; | |
| 70 | - $handsontableJS = VISUALIZER_ABSURL . '/classes/Visualizer/Gutenberg/build/handsontable.js'; | |
| 71 | - $stylePath = VISUALIZER_ABSURL . '/classes/Visualizer/Gutenberg/build/block.css'; | |
| 72 | - $handsontableCSS = VISUALIZER_ABSURL . '/classes/Visualizer/Gutenberg/build/handsontable.css'; | |
| 69 | + $blockPath = VISUALIZER_ABSURL . 'classes/Visualizer/Gutenberg/build/block.js'; | |
| 70 | + $handsontableJS = VISUALIZER_ABSURL . 'classes/Visualizer/Gutenberg/build/handsontable.js'; | |
| 71 | + $stylePath = VISUALIZER_ABSURL . 'classes/Visualizer/Gutenberg/build/block.css'; | |
| 72 | + $handsontableCSS = VISUALIZER_ABSURL . 'classes/Visualizer/Gutenberg/build/handsontable.css'; | |
| 73 | 73 | |
| 74 | 74 | if ( VISUALIZER_TEST_JS_CUSTOMIZATION ) { |
| 75 | - $version = filemtime( VISUALIZER_ABSPATH . '/classes/Visualizer/Gutenberg/build/block.js' ); | |
| 75 | + $version = filemtime( VISUALIZER_ABSPATH . 'classes/Visualizer/Gutenberg/build/block.js' ); | |
| 76 | 76 | } else { |
| 77 | 77 | $version = $this->version; |
| 78 | 78 | } |
| 79 | 79 | |
| @@ -78,9 +78,9 @@ | ||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | // Enqueue the bundled block JS file |
| 81 | 81 | wp_enqueue_script( 'handsontable', $handsontableJS ); |
| 82 | - wp_enqueue_script( 'visualizer-gutenberg-block', $blockPath, array( 'wp-api', 'handsontable' ), $version ); | |
| 82 | + wp_enqueue_script( 'visualizer-gutenberg-block', $blockPath, array( 'wp-api', 'handsontable' ), $version, true ); | |
| 83 | 83 | |
| 84 | 84 | $type = 'community'; |
| 85 | 85 | |
| 86 | 86 | if ( VISUALIZER_PRO ) { |
| @@ -85,9 +85,9 @@ | ||
| 85 | 85 | |
| 86 | 86 | if ( VISUALIZER_PRO ) { |
| 87 | 87 | $type = 'pro'; |
| 88 | 88 | if ( apply_filters( 'visualizer_is_business', false ) ) { |
| 89 | - $type = 'business'; | |
| 89 | + $type = 'developer'; | |
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | $translation_array = array( |
| @@ -120,13 +120,15 @@ | ||
| 120 | 120 | /** |
| 121 | 121 | * Gutenberg Block Callback Function |
| 122 | 122 | */ |
| 123 | 123 | public function gutenberg_block_callback( $attr ) { |
| 124 | - $id = $attr['id']; | |
| 125 | - if ( empty( $id ) || $id === 'none' ) { | |
| 126 | - return ''; // no id = no fun | |
| 124 | + if ( isset( $attr['id'] ) ) { | |
| 125 | + $id = $attr['id']; | |
| 126 | + if ( empty( $id ) || $id === 'none' ) { | |
| 127 | + return ''; // no id = no fun | |
| 128 | + } | |
| 129 | + return '[visualizer id="' . $id . '"]'; | |
| 127 | 130 | } |
| 128 | - return '[visualizer id="' . $id . '"]'; | |
| 129 | 131 | } |
| 130 | 132 | |
| 131 | 133 | /** |
| 132 | 134 | * Hook server side rendering into render callback |
| @@ -294,21 +296,21 @@ | ||
| 294 | 296 | if ( is_null( $series[ $i ] ) ) { |
| 295 | 297 | continue; |
| 296 | 298 | } |
| 297 | 299 | |
| 298 | - if ( $row['type'] == 'number' ) { | |
| 300 | + if ( $row['type'] === 'number' ) { | |
| 299 | 301 | foreach ( $data as $o => $col ) { |
| 300 | 302 | $data[ $o ][ $i ] = ( is_numeric( $col[ $i ] ) ) ? floatval( $col[ $i ] ) : ( is_numeric( str_replace( ',', '', $col[ $i ] ) ) ? floatval( str_replace( ',', '', $col[ $i ] ) ) : null ); |
| 301 | 303 | } |
| 302 | 304 | } |
| 303 | 305 | |
| 304 | - if ( $row['type'] == 'boolean' ) { | |
| 306 | + if ( $row['type'] === 'boolean' ) { | |
| 305 | 307 | foreach ( $data as $o => $col ) { |
| 306 | 308 | $data[ $o ][ $i ] = ! empty( $col[ $i ] ) ? filter_validate( $col[ $i ], FILTER_VALIDATE_BOOLEAN ) : null; |
| 307 | 309 | } |
| 308 | 310 | } |
| 309 | 311 | |
| 310 | - if ( $row['type'] == 'timeofday' ) { | |
| 312 | + if ( $row['type'] === 'timeofday' ) { | |
| 311 | 313 | foreach ( $data as $o => $col ) { |
| 312 | 314 | $date = new DateTime( '1984-03-16T' . $col[ $i ] ); |
| 313 | 315 | if ( $date ) { |
| 314 | 316 | $data[ $o ][ $i ] = array( |
| @@ -320,9 +322,9 @@ | ||
| 320 | 322 | } |
| 321 | 323 | } |
| 322 | 324 | } |
| 323 | 325 | |
| 324 | - if ( $row['type'] == 'string' ) { | |
| 326 | + if ( $row['type'] === 'string' ) { | |
| 325 | 327 | foreach ( $data as $o => $col ) { |
| 326 | 328 | $data[ $o ][ $i ] = $this->toUTF8( $col[ $i ] ); |
| 327 | 329 | } |
| 328 | 330 | } |