| @@ -150,71 +150,5 @@ | ||
| 150 | 150 | public function render() { |
| 151 | 151 | $this->_toHTML(); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - /** | |
| 155 | - * Checks if the request is from Gutenberg. | |
| 156 | - * | |
| 157 | - * This happens when the chart is being added to a gutenberg block by inserting a visualizer block. | |
| 158 | - * | |
| 159 | - * @since ? | |
| 160 | - * | |
| 161 | - * @access protected | |
| 162 | - * @return bool | |
| 163 | - */ | |
| 164 | - protected function is_request_from_gutenberg() { | |
| 165 | - global $post; | |
| 166 | - require_once ABSPATH . 'wp-admin/includes/post.php'; | |
| 167 | - if ( $post && function_exists( 'use_block_editor_for_post' ) && use_block_editor_for_post( $post ) ) { | |
| 168 | - do_action( 'themeisle_log_event', Visualizer_Plugin::NAME, sprintf( 'This request appears to be from Gutenberg block. Ignoring for chart %d', $post->ID ), 'debug', __FILE__, __LINE__ ); | |
| 169 | - return true; | |
| 170 | - } | |
| 171 | - return false; | |
| 172 | - } | |
| 173 | - | |
| 174 | - /** | |
| 175 | - * Gets the type of chart that is being rendered. | |
| 176 | - * | |
| 177 | - * This is useful if some type-specific functionality needs to be added. | |
| 178 | - * | |
| 179 | - * @since ? | |
| 180 | - * | |
| 181 | - * @access protected | |
| 182 | - * @return string | |
| 183 | - */ | |
| 184 | - protected function get_chart_type( $with_library = false ) { | |
| 185 | - $lib_type = str_replace( 'Visualizer_Render_Sidebar_Type_', '', get_class( $this ) ); | |
| 186 | - if ( $with_library ) { | |
| 187 | - return $lib_type; | |
| 188 | - } | |
| 189 | - | |
| 190 | - $array = explode( '_', $lib_type ); | |
| 191 | - return end( $array ); | |
| 192 | - } | |
| 193 | - | |
| 194 | - /** | |
| 195 | - * Determines if the type of chart can have a particular action. | |
| 196 | - * | |
| 197 | - * @since ? | |
| 198 | - * | |
| 199 | - * @access protected | |
| 200 | - * @return bool | |
| 201 | - */ | |
| 202 | - protected function can_chart_have_action( $action, $chart_id = null ) { | |
| 203 | - $type = null; | |
| 204 | - if ( ! $chart_id ) { | |
| 205 | - $type = $this->get_chart_type( false ); | |
| 206 | - } else { | |
| 207 | - $type = get_post_meta( $chart_id, Visualizer_Plugin::CF_CHART_TYPE, true ); | |
| 208 | - $type = ucwords( $type ); | |
| 209 | - } | |
| 210 | - | |
| 211 | - switch ( $action ) { | |
| 212 | - case 'image': | |
| 213 | - return ! in_array( $type, array( 'Gauge', 'Tabular', 'DataTable', 'Table' ), true ); | |
| 214 | - } | |
| 215 | - | |
| 216 | - return true; | |
| 217 | - } | |
| 218 | - | |
| 219 | - | |
| 220 | 154 | } |