Skip to content

Commit 5cf85cc

Browse files
committed
version 3.1.7 released
1 parent 5149665 commit 5cf85cc

File tree

8 files changed

+161
-92
lines changed

8 files changed

+161
-92
lines changed

README.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: codeboxr, manchumahara
33
Tags: currency converter,currency conversion,currency exchange,currency calculator,bitcoin
44
Requires at least: 5.3
55
Tested up to: 6.7.1
6-
Stable tag: 3.1.6
6+
Stable tag: 3.1.7
77
PHP:7.4.*
88
License: GPLv2 or later
99
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -95,6 +95,9 @@ How to install the plugin and get it working.
9595
== Screenshots ==
9696

9797
== Changelog ==
98+
= 3.1.7 =
99+
* [fixed] Fixed miss spelled function name
100+
98101
= 3.1.6 =
99102
* [fixed] Update notification note icon url fixed
100103

assets/css/cbcurrencyconverter-admin.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/cbcurrencyconverter-setting.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cbcurrencyconverter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Plugin Name: CBX Currency Converter
99
* Plugin URI: https://codeboxr.com/product/cbx-currency-converter-for-wordpress/
1010
* Description: Currency Converter and rate display
11-
* Version: 3.1.6
11+
* Version: 3.1.7
1212
* Author: codeboxr
1313
* Author URI: https://codeboxr.com
1414
* License: GPL-2.0+
@@ -24,7 +24,7 @@
2424
}
2525

2626
defined( 'CBCURRENCYCONVERTER_NAME' ) or define( 'CBCURRENCYCONVERTER_NAME', 'cbcurrencyconverter' );
27-
defined( 'CBCURRENCYCONVERTER_VERSION' ) or define( 'CBCURRENCYCONVERTER_VERSION', '3.1.6' );
27+
defined( 'CBCURRENCYCONVERTER_VERSION' ) or define( 'CBCURRENCYCONVERTER_VERSION', '3.1.7' );
2828
defined( 'CBCURRENCYCONVERTER_ROOT_PATH' ) or define( 'CBCURRENCYCONVERTER_ROOT_PATH', plugin_dir_path( __FILE__ ) );
2929
defined( 'CBCURRENCYCONVERTER_ROOT_URL' ) or define( 'CBCURRENCYCONVERTER_ROOT_URL', plugin_dir_url( __FILE__ ) );
3030
defined( 'CBCURRENCYCONVERTER_BASE_NAME' ) or define( 'CBCURRENCYCONVERTER_BASE_NAME', plugin_basename( __FILE__ ) );

includes/cbcurrencyconverter-functions.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ function cbcurrencyconverter_icon_path() {
179179
* @return string|false The SVG content if found, or false on failure.
180180
* @since 1.0.0
181181
*/
182-
function cbcurrencyconverter_load_svg( $svg_name = '' ) {
182+
function cbcurrencyconverter_load_svg( $svg_name = '', $folder = '' ) {
183183
//note: code partially generated using chatgpt
184184
if ( $svg_name == '' ) {
185185
return '';
@@ -201,8 +201,12 @@ function cbcurrencyconverter_load_svg( $svg_name = '' ) {
201201
// Sanitize the file name to prevent directory traversal attacks.
202202
$svg_name = sanitize_file_name( $svg_name );
203203

204+
if($folder != ''){
205+
$folder = trailingslashit($folder);
206+
}
207+
204208
// Construct the full file path.
205-
$file_path = $directory . $svg_name . '.svg';
209+
$file_path = $directory. $folder . $svg_name . '.svg';
206210
$file_path = apply_filters('cbcurrencyconverter_svg_file_path', $file_path, $svg_name);
207211

208212
// Check if the file exists.

includes/class-cbcurrencyconverter-setting.php

Lines changed: 105 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,40 @@ class CBCurrencyconverterSetting {
3838
*/
3939
private static $_instance;
4040

41+
/**
42+
* Returns class's instance
43+
*
44+
* @return object|self
45+
*/
46+
public static function instance() {
47+
if ( is_null( self::$_instance ) ) {
48+
self::$_instance = new self();
49+
}
50+
51+
return self::$_instance;
52+
}//end method instance
53+
54+
/**
55+
* Cloning is forbidden.
56+
*
57+
* @since 2.1
58+
*/
59+
public function __clone() {
60+
wc_doing_it_wrong( __FUNCTION__, esc_html__( 'Cloning is forbidden.', 'cbcurrencyconverter' ), '2.1' );
61+
}//end method clone
62+
63+
/**
64+
* Unserializing instances of this class is forbidden.
65+
*
66+
* @since 2.1
67+
*/
68+
public function __wakeup() {
69+
wc_doing_it_wrong( __FUNCTION__, esc_html__( 'Unserializing instances of this class is forbidden.', 'cbcurrencyconverter' ), '2.1' );
70+
}//end method wakeup
71+
4172
public function __construct() {
4273

43-
}
74+
}//end constructor
4475

4576

4677
/**
@@ -154,10 +185,12 @@ function admin_init() {
154185
'sanitize_callback' => isset( $option['sanitize_callback'] ) ? $option['sanitize_callback'] : '',
155186
'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : '',
156187
'multi' => isset( $option['multi'] ) ? intval( $option['multi'] ) : 0,
188+
'fields' => isset( $option['fields'] ) ? $option['fields'] : [],
157189
'type' => $type,
158190
'optgroup' => isset( $option['optgroup'] ) ? intval( $option['optgroup'] ) : 0,
159191
'sortable' => isset( $option['sortable'] ) ? intval( $option['sortable'] ) : 0,
160192
'allow_new' => isset( $option['allow_new'] ) ? intval( $option['allow_new'] ) : 0,
193+
'allow_clear' => isset( $option['allow_clear'] ) ? intval( $option['allow_clear'] ) : 0,//for select2
161194
'inline' => isset( $option['inline'] ) ? absint( $option['inline'] ) : 1,
162195
];
163196

@@ -204,7 +237,6 @@ function getMissingDefaultValueBySection( $section_id ) {
204237
if ( ! isset( $section_value[ $field['name'] ] ) ) {
205238
$section_value[ $field['name'] ] = isset( $field['default'] ) ? $field['default'] : '';
206239
}
207-
208240
}
209241

210242
return $section_value;
@@ -215,35 +247,27 @@ function getMissingDefaultValueBySection( $section_id ) {
215247
*
216248
*
217249
* @param array $args
250+
* @param string $element_class
218251
*
219252
* @return string
220253
*/
221-
public function get_field_description( $args ) {
254+
public function get_field_description( $args, $element_class = '' ) {
222255
if ( ! empty( $args['desc'] ) ) {
223-
$desc = sprintf( '<div class="description">%s</div>', $args['desc'] );
256+
$field_id = $args['id'];
257+
$desc_extra_class = ( $element_class != '' ) ? ' description_' . $element_class : '';
258+
$desc = sprintf( '<div class="description description_' . esc_attr( $field_id ) . $desc_extra_class . '">%s</div>', $args['desc'] );
224259
} else {
225260
$desc = '';
226261
}
227262

228263
return $desc;
229264
}//end method get_field_description
230265

231-
/**
232-
* Displays a textarea for a settings field
233-
*
234-
* @param array $args
235-
* @param $value
236-
*
237-
* @return void
238-
*/
239-
function callback_html( $args, $value = null ) {
240-
echo $this->get_field_description( $args );// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
241-
}//end method callback_html
242266

243267
/**
244268
* Displays heading field using h3
245269
*
246-
* @param array $args
270+
* @param array $args
247271
*
248272
* @return string
249273
*/
@@ -269,9 +293,64 @@ function callback_subheading( $args ) {
269293
$html = '<h4 class="setting_subheading">' . $args['name'] . '</h4>';
270294
$html .= $this->get_field_description( $args );
271295

272-
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
296+
echo $html; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
273297
}//end method callback_subheading
274298

299+
/**
300+
* Displays a textarea for a settings field
301+
*
302+
* @param array $args
303+
* @param $value
304+
*
305+
* @return void
306+
*/
307+
function callback_html( $args, $value = null ) {
308+
echo $this->get_field_description( $args );// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
309+
}//end method callback_html
310+
311+
/**
312+
* Displays a text field for a settings field
313+
*
314+
* @param array $args
315+
* @param $value
316+
*
317+
* @return void
318+
*/
319+
function callback_text( $args, $value = null ) {
320+
if ( $value === null ) {
321+
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['default'] ) );
322+
}
323+
$size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
324+
$type = isset( $args['type'] ) ? $args['type'] : 'text';
325+
326+
$html_id = "{$args['section']}_{$args['id']}";
327+
$html_id = $this->settings_clean_label_for( $html_id );
328+
329+
$html = sprintf( '<input autocomplete="none" onfocus="this.removeAttribute(\'readonly\');" readonly type="%1$s" class="%2$s-text" id="%6$s" name="%3$s[%4$s]" value="%5$s"/>', $type, $size, $args['section'], $args['id'], $value, $html_id );
330+
$html .= $this->get_field_description( $args );
331+
332+
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
333+
}//end callback_text
334+
335+
/**
336+
* Displays a email field for a settings field
337+
*
338+
* @param array $args settings field args
339+
*/
340+
function callback_email( $args ) {
341+
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['default'] ) );
342+
$size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
343+
$type = isset( $args['type'] ) ? $args['type'] : 'text';
344+
345+
$html_id = "{$args['section']}_{$args['id']}";
346+
$html_id = $this->settings_clean_label_for( $html_id );
347+
348+
$html = sprintf( '<input autocomplete="none" onfocus="this.removeAttribute(\'readonly\');" readonly type="%1$s" class="%2$s-text" id="%6$s" name="%3$s[%4$s]" value="%5$s"/>', $type, $size, $args['section'], $args['id'], $value, $html_id );
349+
$html .= $this->get_field_description( $args );
350+
351+
echo $html; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
352+
}//end method callback_email
353+
275354
/**
276355
* Displays an url field for a settings field
277356
*
@@ -308,7 +387,7 @@ function callback_number( $args, $value = null ) {
308387
$html = sprintf( '<input type="%1$s" class="%2$s-number" id="%10$s" name="%3$s[%4$s]" value="%5$s"%6$s%7$s%8$s%9$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder, $min, $max, $step, $html_id );
309388
$html .= $this->get_field_description( $args );
310389

311-
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
390+
echo $html; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
312391
}//end method callback_number
313392

314393
/**
@@ -502,7 +581,7 @@ function callback_select( $args ) {
502581

503582
$multi = isset( $args['multi'] ) ? intval( $args['multi'] ) : 0;
504583
$multi_name = ( $multi ) ? '[]' : '';
505-
$multi_attr = ( $multi ) ? 'multiple' : '';
584+
$multi_attr = ( $multi ) ? ' multiple ' : '';
506585

507586
if ( $multi && ! is_array( $value ) ) {
508587
$value = [];
@@ -515,7 +594,7 @@ function callback_select( $args ) {
515594
$size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular selecttwo-select';
516595

517596
if ( $args['placeholder'] == '' ) {
518-
$args['placeholder'] = esc_html__( 'Please Select', 'cbcurrencyconverter' );
597+
$args['placeholder'] = esc_html__( 'Please Select', 'cbxwpbookmark' );
519598
}
520599

521600
$html_id = "{$args['section']}_{$args['id']}";
@@ -526,12 +605,12 @@ function callback_select( $args ) {
526605

527606
if ( isset( $args['optgroup'] ) && $args['optgroup'] ) {
528607
foreach ( $args['options'] as $opt_grouplabel => $option_vals ) {
529-
$html .= '<optgroup label="' . $opt_grouplabel . '">';
608+
$html .= '<optgroup label="' . esc_attr($opt_grouplabel) . '">';
530609

531610
if ( ! is_array( $option_vals ) ) {
532611
$option_vals = [];
533612
} else {
534-
$option_vals = $option_vals;
613+
//$option_vals = $option_vals;
535614
}
536615

537616
foreach ( $option_vals as $key => $val ) {
@@ -556,7 +635,7 @@ function callback_select( $args ) {
556635
$html .= '</select></div>';
557636
$html .= $this->get_field_description( $args );
558637

559-
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
638+
echo $html; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
560639
}//end method callback_select
561640

562641
/**
@@ -593,15 +672,15 @@ function callback_multiselect( $args ) {
593672
if ( ! is_array( $option_vals ) ) {
594673
$option_vals = [];
595674
} else {
596-
$option_vals = $option_vals;
675+
//$option_vals = $option_vals;
597676
}
598677

599678

600679
foreach ( $option_vals as $key => $val ) {
601680
$selected = in_array( $key, $value ) ? ' selected="selected" ' : '';
602681
$html .= sprintf( '<option value="%s" ' . $selected . '>%s</option>', $key, $val );
603682
}
604-
$html .= '<optgroup>';
683+
$html .= '</optgroup>';
605684
}
606685
} else {
607686

@@ -685,7 +764,6 @@ function callback_wysiwyg( $args, $value = null ) {
685764
* @param array $args settings field args
686765
*/
687766
function callback_file( $args ) {
688-
689767
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['default'] ) );
690768
$size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
691769

@@ -705,7 +783,7 @@ function callback_file( $args ) {
705783
$html .= $this->get_field_description( $args );
706784

707785
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
708-
}
786+
}//end method callback_file
709787

710788
/**
711789
* Displays a color picker field for a settings field
@@ -716,7 +794,6 @@ function callback_file( $args ) {
716794
* @return void
717795
*/
718796
function callback_color( $args, $value = null ) {
719-
720797
if ( $value === null ) {
721798
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['default'] ) );
722799
}
@@ -869,29 +946,7 @@ function callback_password( $args, $value = null ) {
869946
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
870947
}//end method callback_password
871948

872-
/**
873-
* Displays a text field for a settings field
874-
*
875-
* @param array $args
876-
* @param $value
877-
*
878-
* @return void
879-
*/
880-
function callback_text( $args, $value = null ) {
881-
if ( $value === null ) {
882-
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['default'] ) );
883-
}
884-
$size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
885-
$type = isset( $args['type'] ) ? $args['type'] : 'text';
886-
887-
$html_id = "{$args['section']}_{$args['id']}";
888-
$html_id = $this->settings_clean_label_for( $html_id );
889-
890-
$html = sprintf( '<input autocomplete="none" onfocus="this.removeAttribute(\'readonly\');" readonly type="%1$s" class="%2$s-text" id="%6$s" name="%3$s[%4$s]" value="%5$s"/>', $type, $size, $args['section'], $args['id'], $value, $html_id );
891-
$html .= $this->get_field_description( $args );
892949

893-
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
894-
}//end callback_text
895950

896951
/**
897952
* Displays a textarea for a settings field

0 commit comments

Comments
 (0)