| @@ -58,9 +58,9 @@ | ||
| 58 | 58 | $this->_library = 'google'; |
| 59 | 59 | parent::__construct( $data ); |
| 60 | 60 | |
| 61 | 61 | $this->_legendPositions = array( |
| 62 | - '' => esc_html__( 'Default', 'visualizer' ), | |
| 62 | + '' => '', | |
| 63 | 63 | 'left' => esc_html__( 'Left of the chart', 'visualizer' ), |
| 64 | 64 | 'right' => esc_html__( 'Right of the chart', 'visualizer' ), |
| 65 | 65 | 'top' => esc_html__( 'Above the chart', 'visualizer' ), |
| 66 | 66 | 'bottom' => esc_html__( 'Below the chart', 'visualizer' ), |
| @@ -66,17 +66,12 @@ | ||
| 66 | 66 | 'bottom' => esc_html__( 'Below the chart', 'visualizer' ), |
| 67 | 67 | 'none' => esc_html__( 'Omit the legend', 'visualizer' ), |
| 68 | 68 | ); |
| 69 | 69 | |
| 70 | - $chart_type = $this->get_chart_type( false ); | |
| 71 | - if ( ! in_array( $chart_type, array( 'Pie' ), true ) ) { | |
| 70 | + if ( ! in_array( $this->get_chart_type( false ), array( 'Pie' ), true ) ) { | |
| 72 | 71 | $this->_legendPositions['in'] = esc_html__( 'Inside the chart', 'visualizer' ); |
| 73 | 72 | } |
| 74 | 73 | |
| 75 | - if ( in_array( $chart_type, array( 'Bubble' ), true ) ) { | |
| 76 | - unset( $this->_legendPositions['left'] ); | |
| 77 | - } | |
| 78 | - | |
| 79 | 74 | $this->_alignments = array( |
| 80 | 75 | '' => '', |
| 81 | 76 | 'start' => esc_html__( 'Aligned to the start of the allocated area', 'visualizer' ), |
| 82 | 77 | 'center' => esc_html__( 'Centered in the allocated area', 'visualizer' ), |
| @@ -81,8 +76,9 @@ | ||
| 81 | 76 | 'start' => esc_html__( 'Aligned to the start of the allocated area', 'visualizer' ), |
| 82 | 77 | 'center' => esc_html__( 'Centered in the allocated area', 'visualizer' ), |
| 83 | 78 | 'end' => esc_html__( 'Aligned to the end of the allocated area', 'visualizer' ), |
| 84 | 79 | ); |
| 80 | + | |
| 85 | 81 | } |
| 86 | 82 | |
| 87 | 83 | /** |
| 88 | 84 | * Registers additional hooks. |
| @@ -97,17 +93,15 @@ | ||
| 97 | 93 | |
| 98 | 94 | /** |
| 99 | 95 | * Loads the assets. |
| 100 | 96 | */ |
| 101 | - public function load_google_assets( $deps, $is_frontend ) { | |
| 97 | + function load_google_assets( $deps, $is_frontend ) { | |
| 102 | 98 | wp_register_script( 'google-jsapi', '//www.gstatic.com/charts/loader.js', array(), null, true ); |
| 103 | - wp_register_script( 'dom-to-image', VISUALIZER_ABSURL . 'js/lib/dom-to-image.min.js', array(), null, true ); | |
| 104 | 99 | wp_register_script( |
| 105 | 100 | 'visualizer-render-google-lib', |
| 106 | 101 | VISUALIZER_ABSURL . 'js/render-google.js', |
| 107 | 102 | array( |
| 108 | 103 | 'google-jsapi', |
| 109 | - 'dom-to-image', | |
| 110 | 104 | ), |
| 111 | 105 | Visualizer_Plugin::VERSION, |
| 112 | 106 | true |
| 113 | 107 | ); |
| @@ -115,8 +109,9 @@ | ||
| 115 | 109 | return array_merge( |
| 116 | 110 | $deps, |
| 117 | 111 | array( 'visualizer-render-google-lib' ) |
| 118 | 112 | ); |
| 113 | + | |
| 119 | 114 | } |
| 120 | 115 | |
| 121 | 116 | /** |
| 122 | 117 | * Enqueue assets. |
| @@ -147,18 +142,10 @@ | ||
| 147 | 142 | 'emphasis' => esc_html__( 'Emphasis', 'visualizer' ), |
| 148 | 143 | 'scope' => esc_html__( 'Scope', 'visualizer' ), |
| 149 | 144 | 'style' => esc_html__( 'Style', 'visualizer' ), |
| 150 | 145 | 'tooltip' => esc_html__( 'Tooltip', 'visualizer' ), |
| 151 | - 'interval' => esc_html__( 'Interval', 'visualizer' ), | |
| 152 | 146 | ), |
| 153 | - sprintf( | |
| 154 | - // translators: %1$s - HTML link tag, %2$s - HTML closing link tag, %3$s - HTML link tag, %4$s - HTML closing link tag | |
| 155 | - esc_html__( 'Determines whether the series has to be used for a special role as mentioned in %1$shere%2$s. You can view a few examples %3$shere%4$s.', 'visualizer' ), | |
| 156 | - '<a href="https://developers.google.com/chart/interactive/docs/roles#what-roles-are-available" target="_blank">', | |
| 157 | - '</a>', | |
| 158 | - '<a href="https://docs.themeisle.com/article/1160-roles-for-series-visualizer" target="_blank">', | |
| 159 | - '</a>' | |
| 160 | - ) | |
| 147 | + sprintf( esc_html__( 'Determines whether the series has to be used for a special role as mentioned in %1$shere%2$s. You can view a few examples %3$shere%4$s.', 'visualizer' ), '<a href="https://developers.google.com/chart/interactive/docs/roles#what-roles-are-available" target="_blank">', '</a>', '<a href="https://docs.themeisle.com/article/1160-roles-for-series-visualizer" target="_blank">', '</a>' ) | |
| 161 | 148 | ); |
| 162 | 149 | } |
| 163 | 150 | |
| 164 | 151 | /** |
| @@ -180,9 +167,9 @@ | ||
| 180 | 167 | |
| 181 | 168 | self::_renderSectionStart( esc_html__( 'Font Styles', 'visualizer' ), false ); |
| 182 | 169 | echo '<div class="viz-section-item">'; |
| 183 | 170 | echo '<a class="more-info" href="javascript:;">[?]</a>'; |
| 184 | - echo '<b>', esc_html__( 'Font Family And Size', 'visualizer' ), '</b>'; | |
| 171 | + echo '<b>', esc_html__( 'Family And Size', 'visualizer' ), '</b>'; | |
| 185 | 172 | |
| 186 | 173 | echo '<table class="viz-section-table" cellspacing="0" cellpadding="0" border="0">'; |
| 187 | 174 | echo '<tr>'; |
| 188 | 175 | echo '<td class="viz-section-table-column">'; |
| @@ -215,17 +202,17 @@ | ||
| 215 | 202 | self::_renderSectionStart( esc_html__( 'Legend', 'visualizer' ), false ); |
| 216 | 203 | self::_renderSelectItem( |
| 217 | 204 | esc_html__( 'Position', 'visualizer' ), |
| 218 | 205 | 'legend[position]', |
| 219 | - isset( $this->legend['position'] ) ? $this->legend['position'] : '', | |
| 206 | + $this->legend['position'], | |
| 220 | 207 | $this->_legendPositions, |
| 221 | - esc_html__( 'Sets the legend position relative to the chart.', 'visualizer' ) | |
| 208 | + esc_html__( 'Determines where to place the legend, compared to the chart area.', 'visualizer' ) | |
| 222 | 209 | ); |
| 223 | 210 | |
| 224 | 211 | self::_renderSelectItem( |
| 225 | 212 | esc_html__( 'Alignment', 'visualizer' ), |
| 226 | 213 | 'legend[alignment]', |
| 227 | - isset( $this->legend['alignment'] ) ? $this->legend['alignment'] : '', | |
| 214 | + $this->legend['alignment'], | |
| 228 | 215 | $this->_alignments, |
| 229 | 216 | esc_html__( 'Determines the alignment of the legend.', 'visualizer' ) |
| 230 | 217 | ); |
| 231 | 218 | |
| @@ -241,25 +228,9 @@ | ||
| 241 | 228 | $this->_renderTooltipSettigns(); |
| 242 | 229 | self::_renderSectionEnd(); |
| 243 | 230 | |
| 244 | 231 | $this->_renderAnimationSettings(); |
| 245 | - self::_renderSectionStart( esc_html__( 'License & Creator', 'visualizer' ), false ); | |
| 246 | - self::_renderTextItem( | |
| 247 | - esc_html__( 'License', 'visualizer' ), | |
| 248 | - 'license', | |
| 249 | - $this->license, | |
| 250 | - '' | |
| 251 | - ); | |
| 252 | - self::_renderTextItem( | |
| 253 | - esc_html__( 'Creator', 'visualizer' ), | |
| 254 | - 'creator', | |
| 255 | - $this->creator, | |
| 256 | - '' | |
| 257 | - ); | |
| 258 | - self::_renderSectionEnd(); | |
| 259 | 232 | |
| 260 | - self::_renderChartImageSettings(); | |
| 261 | - | |
| 262 | 233 | do_action( 'visualizer_chart_settings', get_class( $this ), $this->_data, 'general', array( 'generic' => true ) ); |
| 263 | 234 | |
| 264 | 235 | self::_renderGroupEnd(); |
| 265 | 236 | } |
| @@ -306,8 +277,9 @@ | ||
| 306 | 277 | esc_html__( 'The easing function applied to the animation.', 'visualizer' ) |
| 307 | 278 | ); |
| 308 | 279 | |
| 309 | 280 | self::_renderSectionEnd(); |
| 281 | + | |
| 310 | 282 | } |
| 311 | 283 | |
| 312 | 284 | /** |
| 313 | 285 | * Renders tooltip settings section. |
| @@ -321,14 +293,14 @@ | ||
| 321 | 293 | esc_html__( 'Trigger', 'visualizer' ), |
| 322 | 294 | 'tooltip[trigger]', |
| 323 | 295 | isset( $this->tooltip['trigger'] ) ? $this->tooltip['trigger'] : null, |
| 324 | 296 | array( |
| 325 | - '' => esc_html__( 'Default', 'visualizer' ), | |
| 297 | + '' => '', | |
| 326 | 298 | 'focus' => esc_html__( 'The tooltip will be displayed when the user hovers over an element', 'visualizer' ), |
| 327 | - 'selection' => esc_html__( 'The tooltip will be displayed when the user selects an element.', 'visualizer' ), | |
| 299 | + 'selection' => esc_html__( 'The tooltip will be displayed when the user selects an element', 'visualizer' ), | |
| 328 | 300 | 'none' => esc_html__( 'The tooltip will not be displayed', 'visualizer' ), |
| 329 | 301 | ), |
| 330 | - esc_html__( 'Controls when the tooltip appears.', 'visualizer' ) | |
| 302 | + esc_html__( 'Determines the user interaction that causes the tooltip to be displayed.', 'visualizer' ) | |
| 331 | 303 | ); |
| 332 | 304 | |
| 333 | 305 | self::_renderSelectItem( |
| 334 | 306 | esc_html__( 'Show Color Code', 'visualizer' ), |
| @@ -372,9 +344,9 @@ | ||
| 372 | 344 | echo '</div>'; |
| 373 | 345 | |
| 374 | 346 | echo '<div class="viz-section-delimiter"></div>'; |
| 375 | 347 | |
| 376 | - self::_renderSectionDescription( esc_html__( 'Set the chart\'s background color, border width, and border color.', 'visualizer' ) ); | |
| 348 | + self::_renderSectionDescription( esc_html__( 'Configure the background color for the main area of the chart and the chart border width and color.', 'visualizer' ) ); | |
| 377 | 349 | |
| 378 | 350 | self::_renderTextItem( |
| 379 | 351 | esc_html__( 'Stroke Width', 'visualizer' ), |
| 380 | 352 | 'backgroundColor[strokeWidth]', |
| @@ -415,14 +387,12 @@ | ||
| 415 | 387 | |
| 416 | 388 | echo '<table class="viz-section-table" cellspacing="0" cellpadding="0" border="0">'; |
| 417 | 389 | echo '<tr>'; |
| 418 | 390 | echo '<td class="viz-section-table-column">'; |
| 419 | - $chartarea_left = isset( $this->chartArea['left'] ) ? $this->chartArea['left'] : ''; | |
| 420 | - echo '<input type="text" name="chartArea[left]" class="control-text" value="', $chartarea_left || '0' === $chartarea_left ? esc_attr( $chartarea_left ) : '', '" placeholder="20%">'; | |
| 391 | + echo '<input type="text" name="chartArea[left]" class="control-text" value="', $this->chartArea['left'] || $this->chartArea['left'] === '0' ? esc_attr( $this->chartArea['left'] ) : '', '" placeholder="20%">'; | |
| 421 | 392 | echo '</td>'; |
| 422 | 393 | echo '<td class="viz-section-table-column">'; |
| 423 | - $chartarea_top = isset( $this->chartArea['top'] ) ? $this->chartArea['top'] : ''; | |
| 424 | - echo '<input type="text" name="chartArea[top]" class="control-text" value="', $chartarea_top || '0' === $chartarea_top ? esc_attr( $chartarea_top ) : '', '" placeholder="20%">'; | |
| 394 | + echo '<input type="text" name="chartArea[top]" class="control-text" value="', $this->chartArea['top'] || $this->chartArea['top'] === '0' ? esc_attr( $this->chartArea['top'] ) : '', '" placeholder="20%">'; | |
| 425 | 395 | echo '</td>'; |
| 426 | 396 | echo '</tr>'; |
| 427 | 397 | echo '</table>'; |
| 428 | 398 | |
| @@ -446,29 +416,11 @@ | ||
| 446 | 416 | echo '</tr>'; |
| 447 | 417 | echo '</table>'; |
| 448 | 418 | |
| 449 | 419 | echo '<p class="viz-section-description">'; |
| 450 | - esc_html_e( 'Determines the width and height of the chart area.', 'visualizer' ); | |
| 420 | + esc_html_e( 'Determines the width and hight of the chart area.', 'visualizer' ); | |
| 451 | 421 | echo '</p>'; |
| 452 | 422 | echo '</div>'; |
| 453 | 423 | self::_renderSectionEnd(); |
| 454 | 424 | self::_renderGroupEnd(); |
| 455 | - } | |
| 456 | - | |
| 457 | - /** | |
| 458 | - * Renders advanced settings and hidden inputs for programmatically-set keys | |
| 459 | - * (e.g. the global-preset colors palette) that have no visible sidebar control. | |
| 460 | - * | |
| 461 | - * @access protected | |
| 462 | - */ | |
| 463 | - protected function _renderAdvancedSettings(): void { | |
| 464 | - parent::_renderAdvancedSettings(); | |
| 465 | - | |
| 466 | - // @phpstan-ignore-next-line (property accessed via magic __get from _data array) | |
| 467 | - $colors = $this->colors; | |
| 468 | - if ( ! empty( $colors ) && is_array( $colors ) ) { | |
| 469 | - foreach ( $colors as $color ) { | |
| 470 | - echo '<input type="hidden" name="colors[]" value="', esc_attr( $color ), '">'; | |
| 471 | - } | |
| 472 | - } | |
| 473 | 425 | } |
| 474 | 426 | } |