| @@ -37,9 +37,8 @@ | ||
| 37 | 37 | 'bottom' => esc_html__( 'Below the chart', 'visualizer' ), |
| 38 | 38 | 'bottom' => esc_html__( 'Below the chart', 'visualizer' ), |
| 39 | 39 | 'none' => esc_html__( 'Omit the legend', 'visualizer' ), |
| 40 | 40 | ); |
| 41 | - | |
| 42 | 41 | } |
| 43 | 42 | |
| 44 | 43 | /** |
| 45 | 44 | * Renders concrete series settings for the Bar chart. |
| @@ -77,9 +76,9 @@ | ||
| 77 | 76 | |
| 78 | 77 | /** |
| 79 | 78 | * Loads the assets. |
| 80 | 79 | */ |
| 81 | - function load_chartjs_assets( $deps, $is_frontend ) { | |
| 80 | + public function load_chartjs_assets( $deps, $is_frontend ) { | |
| 82 | 81 | $this->load_dependent_assets( array( 'moment', 'numeral' ) ); |
| 83 | 82 | |
| 84 | 83 | wp_register_script( 'chartjs', VISUALIZER_ABSURL . 'js/lib/chartjs.min.js', array( 'numeral', 'moment' ), null, true ); |
| 85 | 84 | wp_register_script( |
| @@ -95,9 +94,8 @@ | ||
| 95 | 94 | return array_merge( |
| 96 | 95 | $deps, |
| 97 | 96 | array( 'visualizer-render-chartjs-lib' ) |
| 98 | 97 | ); |
| 99 | - | |
| 100 | 98 | } |
| 101 | 99 | |
| 102 | 100 | /** |
| 103 | 101 | * Renders series settings group. |
| @@ -132,9 +130,8 @@ | ||
| 132 | 130 | */ |
| 133 | 131 | protected function _renderSeries( $index ) { |
| 134 | 132 | $this->_renderFormatField( $index ); |
| 135 | 133 | $this->_renderChartTypeSeries( $index ); |
| 136 | - | |
| 137 | 134 | } |
| 138 | 135 | |
| 139 | 136 | /** |
| 140 | 137 | * Renders template. |
| @@ -179,11 +176,15 @@ | ||
| 179 | 176 | self::_renderTextAreaItem( |
| 180 | 177 | esc_html__( 'Chart Description', 'visualizer' ), |
| 181 | 178 | 'description', |
| 182 | 179 | $this->description, |
| 183 | - sprintf( esc_html__( 'Description to display in the structured data schema as explained %1$shere%2$s', 'visualizer' ), '<a href="https://developers.google.com/search/docs/data-types/dataset#dataset" target="_blank">', '</a>' ) | |
| 180 | + sprintf( | |
| 181 | + // translators: %1$s - HTML link tag, %2$s - HTML closing link tag. | |
| 182 | + esc_html__( 'Description to display in the structured data schema as explained %1$shere%2$s', 'visualizer' ), | |
| 183 | + '<a href="https://developers.google.com/search/docs/data-types/dataset#dataset" target="_blank">', | |
| 184 | + '</a>' | |
| 185 | + ) | |
| 184 | 186 | ); |
| 185 | - | |
| 186 | 187 | } |
| 187 | 188 | |
| 188 | 189 | /** |
| 189 | 190 | * Renders chart general settings group. |
| @@ -204,9 +205,9 @@ | ||
| 204 | 205 | |
| 205 | 206 | self::_renderSectionStart( esc_html__( 'Font Styles', 'visualizer' ), false ); |
| 206 | 207 | echo '<div class="viz-section-item">'; |
| 207 | 208 | echo '<a class="more-info" href="javascript:;">[?]</a>'; |
| 208 | - echo '<b>', esc_html__( 'Family And Size', 'visualizer' ), '</b>'; | |
| 209 | + echo '<b>', esc_html__( 'Font Family And Size', 'visualizer' ), '</b>'; | |
| 209 | 210 | |
| 210 | 211 | echo '<table class="viz-section-table" cellspacing="0" cellpadding="0" border="0">'; |
| 211 | 212 | echo '<tr>'; |
| 212 | 213 | echo '<td class="viz-section-table-column">'; |
| @@ -242,9 +243,9 @@ | ||
| 242 | 243 | 'legend[position]', |
| 243 | 244 | // let's have a default otherwise the chart behaves weird when hovering in edit mode |
| 244 | 245 | isset( $this->legend['position'] ) ? $this->legend['position'] : 'top', |
| 245 | 246 | $this->_legendPositions, |
| 246 | - esc_html__( 'Determines where to place the legend, compared to the chart area.', 'visualizer' ) | |
| 247 | + esc_html__( 'Sets the legend position relative to the chart.', 'visualizer' ) | |
| 247 | 248 | ); |
| 248 | 249 | |
| 249 | 250 | self::_renderCheckboxItem( |
| 250 | 251 | esc_html__( 'Show datasets in reverse order', 'visualizer' ), |
| @@ -255,9 +256,9 @@ | ||
| 255 | 256 | ); |
| 256 | 257 | |
| 257 | 258 | echo '<div class="viz-section-item">'; |
| 258 | 259 | echo '<a class="more-info" href="javascript:;">[?]</a>'; |
| 259 | - echo '<b>', esc_html__( 'Family And Size', 'visualizer' ), '</b>'; | |
| 260 | + echo '<b>', esc_html__( 'Font Family And Size', 'visualizer' ), '</b>'; | |
| 260 | 261 | |
| 261 | 262 | echo '<table class="viz-section-table" cellspacing="0" cellpadding="0" border="0">'; |
| 262 | 263 | echo '<tr>'; |
| 263 | 264 | echo '<td class="viz-section-table-column">'; |
| @@ -361,9 +362,8 @@ | ||
| 361 | 362 | esc_html__( 'The easing function applied to the animation.', 'visualizer' ) |
| 362 | 363 | ); |
| 363 | 364 | |
| 364 | 365 | self::_renderSectionEnd(); |
| 365 | - | |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | /** |
| 369 | 369 | * Renders tooltip settings section. |
| @@ -386,9 +386,18 @@ | ||
| 386 | 386 | * Add the correct description for the manual configuration box. |
| 387 | 387 | */ |
| 388 | 388 | protected function _renderManualConfigDescription() { |
| 389 | 389 | self::_renderSectionStart(); |
| 390 | - self::_renderSectionDescription( '<span class="viz-gvlink">' . sprintf( __( 'Configure the graph by providing configuration variables right from the %1$sChartJS API%2$s. You can refer to to some examples %3$shere%4$s.', 'visualizer' ), '<a href="https://www.chartjs.org/docs/latest/configuration/" target="_blank">', '</a>', '<a href="https://docs.themeisle.com/article/728-manual-configuration" target="_blank">', '</a>' ) . '</span>' ); | |
| 390 | + self::_renderSectionDescription( | |
| 391 | + '<span class="viz-gvlink">' . sprintf( | |
| 392 | + // translators: %1$s - HTML link tag, %2$s - HTML closing link tag, %3$s - HTML link tag, %4$s - HTML closing link tag. | |
| 393 | + __( 'Configure the graph by providing configuration variables right from the %1$sChartJS API%2$s. You can refer to %3$sCommon Snippets%4$s for examples.', 'visualizer' ), | |
| 394 | + '<a href="https://www.chartjs.org/docs/latest/configuration/" target="_blank">', | |
| 395 | + '</a>', | |
| 396 | + '<a href="https://docs.themeisle.com/article/728-manual-configuration" target="_blank">', | |
| 397 | + '</a>' | |
| 398 | + ) . '</span>' | |
| 399 | + ); | |
| 391 | 400 | } |
| 392 | 401 | |
| 393 | 402 | /** |
| 394 | 403 | * Add the correct example for the manual configuration box. |
| @@ -393,12 +402,15 @@ | ||
| 393 | 402 | /** |
| 394 | 403 | * Add the correct example for the manual configuration box. |
| 395 | 404 | */ |
| 396 | 405 | protected function _renderManualConfigExample() { |
| 397 | - return '{ | |
| 398 | - "cutoutPercentage": 5, | |
| 399 | - "rotation": 60 | |
| 400 | - }'; | |
| 406 | + return json_encode( | |
| 407 | + array( | |
| 408 | + 'cutoutPercentage' => 5, | |
| 409 | + 'rotation' => 60, | |
| 410 | + ), | |
| 411 | + JSON_PRETTY_PRINT | |
| 412 | + ); | |
| 401 | 413 | } |
| 402 | 414 | |
| 403 | 415 | /** |
| 404 | 416 | * Renders chart view settings group. |