| @@ -58,9 +58,9 @@ | ||
| 58 | 58 | $this->_library = 'google'; |
| 59 | 59 | parent::__construct( $data ); |
| 60 | 60 | |
| 61 | 61 | $this->_legendPositions = array( |
| 62 | - '' => '', | |
| 62 | + '' => esc_html__( 'Default', 'visualizer' ), | |
| 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' ), |
| @@ -81,9 +81,8 @@ | ||
| 81 | 81 | 'start' => esc_html__( 'Aligned to the start of the allocated area', 'visualizer' ), |
| 82 | 82 | 'center' => esc_html__( 'Centered in the allocated area', 'visualizer' ), |
| 83 | 83 | 'end' => esc_html__( 'Aligned to the end of the allocated area', 'visualizer' ), |
| 84 | 84 | ); |
| 85 | - | |
| 86 | 85 | } |
| 87 | 86 | |
| 88 | 87 | /** |
| 89 | 88 | * Registers additional hooks. |
| @@ -98,9 +97,9 @@ | ||
| 98 | 97 | |
| 99 | 98 | /** |
| 100 | 99 | * Loads the assets. |
| 101 | 100 | */ |
| 102 | - function load_google_assets( $deps, $is_frontend ) { | |
| 101 | + public function load_google_assets( $deps, $is_frontend ) { | |
| 103 | 102 | wp_register_script( 'google-jsapi', '//www.gstatic.com/charts/loader.js', array(), null, true ); |
| 104 | 103 | wp_register_script( 'dom-to-image', VISUALIZER_ABSURL . 'js/lib/dom-to-image.min.js', array(), null, true ); |
| 105 | 104 | wp_register_script( |
| 106 | 105 | 'visualizer-render-google-lib', |
| @@ -116,9 +115,8 @@ | ||
| 116 | 115 | return array_merge( |
| 117 | 116 | $deps, |
| 118 | 117 | array( 'visualizer-render-google-lib' ) |
| 119 | 118 | ); |
| 120 | - | |
| 121 | 119 | } |
| 122 | 120 | |
| 123 | 121 | /** |
| 124 | 122 | * Enqueue assets. |
| @@ -151,9 +149,16 @@ | ||
| 151 | 149 | 'style' => esc_html__( 'Style', 'visualizer' ), |
| 152 | 150 | 'tooltip' => esc_html__( 'Tooltip', 'visualizer' ), |
| 153 | 151 | 'interval' => esc_html__( 'Interval', 'visualizer' ), |
| 154 | 152 | ), |
| 155 | - 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>' ) | |
| 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 | + ) | |
| 156 | 161 | ); |
| 157 | 162 | } |
| 158 | 163 | |
| 159 | 164 | /** |
| @@ -175,9 +180,9 @@ | ||
| 175 | 180 | |
| 176 | 181 | self::_renderSectionStart( esc_html__( 'Font Styles', 'visualizer' ), false ); |
| 177 | 182 | echo '<div class="viz-section-item">'; |
| 178 | 183 | echo '<a class="more-info" href="javascript:;">[?]</a>'; |
| 179 | - echo '<b>', esc_html__( 'Family And Size', 'visualizer' ), '</b>'; | |
| 184 | + echo '<b>', esc_html__( 'Font Family And Size', 'visualizer' ), '</b>'; | |
| 180 | 185 | |
| 181 | 186 | echo '<table class="viz-section-table" cellspacing="0" cellpadding="0" border="0">'; |
| 182 | 187 | echo '<tr>'; |
| 183 | 188 | echo '<td class="viz-section-table-column">'; |
| @@ -212,9 +217,9 @@ | ||
| 212 | 217 | esc_html__( 'Position', 'visualizer' ), |
| 213 | 218 | 'legend[position]', |
| 214 | 219 | isset( $this->legend['position'] ) ? $this->legend['position'] : '', |
| 215 | 220 | $this->_legendPositions, |
| 216 | - esc_html__( 'Determines where to place the legend, compared to the chart area.', 'visualizer' ) | |
| 221 | + esc_html__( 'Sets the legend position relative to the chart.', 'visualizer' ) | |
| 217 | 222 | ); |
| 218 | 223 | |
| 219 | 224 | self::_renderSelectItem( |
| 220 | 225 | esc_html__( 'Alignment', 'visualizer' ), |
| @@ -301,9 +306,8 @@ | ||
| 301 | 306 | esc_html__( 'The easing function applied to the animation.', 'visualizer' ) |
| 302 | 307 | ); |
| 303 | 308 | |
| 304 | 309 | self::_renderSectionEnd(); |
| 305 | - | |
| 306 | 310 | } |
| 307 | 311 | |
| 308 | 312 | /** |
| 309 | 313 | * Renders tooltip settings section. |
| @@ -317,14 +321,14 @@ | ||
| 317 | 321 | esc_html__( 'Trigger', 'visualizer' ), |
| 318 | 322 | 'tooltip[trigger]', |
| 319 | 323 | isset( $this->tooltip['trigger'] ) ? $this->tooltip['trigger'] : null, |
| 320 | 324 | array( |
| 321 | - '' => '', | |
| 325 | + '' => esc_html__( 'Default', 'visualizer' ), | |
| 322 | 326 | 'focus' => esc_html__( 'The tooltip will be displayed when the user hovers over an element', 'visualizer' ), |
| 323 | - 'selection' => esc_html__( 'The tooltip will be displayed when the user selects an element', 'visualizer' ), | |
| 327 | + 'selection' => esc_html__( 'The tooltip will be displayed when the user selects an element.', 'visualizer' ), | |
| 324 | 328 | 'none' => esc_html__( 'The tooltip will not be displayed', 'visualizer' ), |
| 325 | 329 | ), |
| 326 | - esc_html__( 'Determines the user interaction that causes the tooltip to be displayed.', 'visualizer' ) | |
| 330 | + esc_html__( 'Controls when the tooltip appears.', 'visualizer' ) | |
| 327 | 331 | ); |
| 328 | 332 | |
| 329 | 333 | self::_renderSelectItem( |
| 330 | 334 | esc_html__( 'Show Color Code', 'visualizer' ), |
| @@ -368,9 +372,9 @@ | ||
| 368 | 372 | echo '</div>'; |
| 369 | 373 | |
| 370 | 374 | echo '<div class="viz-section-delimiter"></div>'; |
| 371 | 375 | |
| 372 | - self::_renderSectionDescription( esc_html__( 'Configure the background color for the main area of the chart and the chart border width and color.', 'visualizer' ) ); | |
| 376 | + self::_renderSectionDescription( esc_html__( 'Set the chart\'s background color, border width, and border color.', 'visualizer' ) ); | |
| 373 | 377 | |
| 374 | 378 | self::_renderTextItem( |
| 375 | 379 | esc_html__( 'Stroke Width', 'visualizer' ), |
| 376 | 380 | 'backgroundColor[strokeWidth]', |
| @@ -442,11 +446,29 @@ | ||
| 442 | 446 | echo '</tr>'; |
| 443 | 447 | echo '</table>'; |
| 444 | 448 | |
| 445 | 449 | echo '<p class="viz-section-description">'; |
| 446 | - esc_html_e( 'Determines the width and hight of the chart area.', 'visualizer' ); | |
| 450 | + esc_html_e( 'Determines the width and height of the chart area.', 'visualizer' ); | |
| 447 | 451 | echo '</p>'; |
| 448 | 452 | echo '</div>'; |
| 449 | 453 | self::_renderSectionEnd(); |
| 450 | 454 | 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 | + } | |
| 451 | 473 | } |
| 452 | 474 | } |