| @@ -20,9 +20,9 @@ | ||
| 20 | 20 | include $field_view_path; |
| 21 | 21 | } |
| 22 | 22 | else |
| 23 | 23 | { |
| 24 | - echo __('Missing VIEW file:', 'wpdirectorykit').' '.esc_html($field_type).'.php'; | |
| 24 | + echo esc_html__('Missing VIEW file:', 'wpdirectorykit').' '.esc_html($field_type).'.php'; | |
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | |
| @@ -190,8 +190,9 @@ | ||
| 190 | 190 | |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | if($print){ |
| 194 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped, WordPress.WP.I18n.NonSingularStringLiteralText | |
| 194 | 195 | echo $output; |
| 195 | 196 | return FALSE; |
| 196 | 197 | } |
| 197 | 198 | |
| @@ -359,8 +360,9 @@ | ||
| 359 | 360 | } |
| 360 | 361 | } |
| 361 | 362 | |
| 362 | 363 | if($print){ |
| 364 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped, WordPress.WP.I18n.NonSingularStringLiteralText | |
| 363 | 365 | echo $output; |
| 364 | 366 | return FALSE; |
| 365 | 367 | } |
| 366 | 368 | |
| @@ -1191,9 +1193,8 @@ | ||
| 1191 | 1193 | $lang_term_id = pll_current_language('term_id'); |
| 1192 | 1194 | |
| 1193 | 1195 | if(is_numeric($lang_term_id)) |
| 1194 | 1196 | { |
| 1195 | - //echo $lang_term_id.'<br />'; | |
| 1196 | 1197 | $WMVC->db->join($WMVC->db->prefix.'term_relationships ON '.$WMVC->db->prefix.'posts.ID = '.$WMVC->db->prefix.'term_relationships.object_id', NULL, NULL); |
| 1197 | 1198 | $WMVC->db->where("({$WMVC->db->prefix}term_relationships.term_taxonomy_id = $lang_term_id)"); |
| 1198 | 1199 | } |
| 1199 | 1200 | } |
| @@ -1630,9 +1631,9 @@ | ||
| 1630 | 1631 | $detect_date = strtotime($gen_search); |
| 1631 | 1632 | |
| 1632 | 1633 | if(wdk_payments_is_date($val) && $detect_date > 1000) |
| 1633 | 1634 | { |
| 1634 | - $gen_search = date('Y-m-d H:i:s', $detect_date); | |
| 1635 | + $gen_search = gmdate('Y-m-d H:i:s', $detect_date); | |
| 1635 | 1636 | $gen_q.=$col_name." > '".$gen_search."' AND "; |
| 1636 | 1637 | } |
| 1637 | 1638 | else |
| 1638 | 1639 | { |
| @@ -1679,9 +1680,9 @@ | ||
| 1679 | 1680 | |
| 1680 | 1681 | function wdk_date() { |
| 1681 | 1682 | $date_format = get_option('date_format'); |
| 1682 | 1683 | $time_format = get_option('time_format'); |
| 1683 | - $date = date("{$date_format} {$time_format}", current_time('timestamp')); | |
| 1684 | + $date = gmdate("{$date_format} {$time_format}", current_time('timestamp')); | |
| 1684 | 1685 | return $date; |
| 1685 | 1686 | } |
| 1686 | 1687 | |
| 1687 | 1688 | if(!function_exists('wdk_placeholder_image_src')) { |
| @@ -1851,9 +1852,9 @@ | ||
| 1851 | 1852 | <button title="<?php echo esc_attr__('Search','wpdirectorykit');?>" id="wdk-start-primary" type="submit" class="wdk-search-start wdk-click-load-animation"> <?php echo esc_html($wdk_text_search_button);?> <i class="fa fa-spinner fa-spin fa-ajax-indicator" style="display: none;"></i> </button> |
| 1852 | 1853 | |
| 1853 | 1854 | <?php if(function_exists('run_wdk_save_search') && get_option('wdk_save_search_show_on_searchform')):?> |
| 1854 | 1855 | <div class="section-widget-control right"> |
| 1855 | - <a class="wdk-c-btn wdk-c-edit wdk-save-search-button" href="#" data-url="<?php echo esc_url(admin_url('admin-ajax.php')); ?>" title="<?php echo esc_attr_e('Save Search', 'selio'); ?>" target="_blank"> | |
| 1856 | + <a class="wdk-c-btn wdk-c-edit wdk-save-search-button" href="#" data-url="<?php echo esc_url(admin_url('admin-ajax.php')); ?>" title="<?php echo esc_attr__('Save Search', 'wpdirectorykit'); ?>" target="_blank"> | |
| 1856 | 1857 | <i class="fas fa-save" aria-hidden="true"></i> |
| 1857 | 1858 | <i class="fa fa-spinner fa-spin fa-ajax-indicator"></i> |
| 1858 | 1859 | </a> |
| 1859 | 1860 | </div> |
| @@ -1903,9 +1904,9 @@ | ||
| 1903 | 1904 | |
| 1904 | 1905 | if(empty($selected)) |
| 1905 | 1906 | $selected=''; |
| 1906 | 1907 | |
| 1907 | - $form = '<input name="'.$name.'" value="'.$selected.'" class="wdk-hidden" type="text" id="wdktreeelem'.$counter.'" readonly/>'; | |
| 1908 | + $form = '<input name="'.esc_attr($name).'" value="'.esc_attr($selected).'" class="wdk-hidden" type="text" id="wdktreeelem'.esc_attr($counter).'" readonly/>'; | |
| 1908 | 1909 | |
| 1909 | 1910 | $skip_id = ''; |
| 1910 | 1911 | //load javascript library |
| 1911 | 1912 | if($counter==0) |
| @@ -1912,40 +1913,39 @@ | ||
| 1912 | 1913 | { |
| 1913 | 1914 | wp_enqueue_script('wdk-treefield'); |
| 1914 | 1915 | wp_enqueue_style('wdk-treefield'); |
| 1915 | 1916 | } |
| 1916 | - ?> | |
| 1917 | - <script> | |
| 1918 | - jQuery(document).ready(function($) { | |
| 1919 | - $('#wdktreeelem<?php echo esc_js($counter);?>:not(.init)').wdkTreefield({ | |
| 1920 | - ajax_url: '<?php echo admin_url('admin-ajax.php'); ?>', | |
| 1917 | + wp_add_inline_script( | |
| 1918 | + 'wdk-treefield', | |
| 1919 | + "jQuery(document).ready(function($) { | |
| 1920 | + $('#wdktreeelem" . esc_js($counter) . ":not(.init)').wdkTreefield({ | |
| 1921 | + ajax_url: '" . esc_js(admin_url('admin-ajax.php')) . "', | |
| 1921 | 1922 | ajax_param: { |
| 1922 | - "page": 'wdk_frontendajax', | |
| 1923 | - "function": 'treefieldid', | |
| 1924 | - "action": 'wdk_public_action', | |
| 1925 | - "wdk_secure": '<?php echo wp_create_nonce( 'wdk_secure_treefieldid' );?>', | |
| 1926 | - "table": '<?php echo esc_js($table); ?>', | |
| 1927 | - "filter_ids": '<?php echo esc_js($filter_ids); ?>', | |
| 1928 | - "start_id": '<?php if(!empty($filter_ids)) esc_js($selected); else echo ""; ?>', | |
| 1929 | - "empty_value": '<?php echo esc_js($empty_value); ?>', | |
| 1930 | - "user_check": '<?php echo esc_js($user_check); ?>', | |
| 1931 | - "sql_where": '<?php echo esc_js($sql_where); ?>', | |
| 1932 | - "hide_fields": '<?php echo esc_js($hide_fields); ?>' | |
| 1933 | - }, | |
| 1934 | - attribute_id: '<?php echo esc_js($attribute_id); ?>', | |
| 1935 | - language_id: '<?php echo esc_js($language_id); ?>', | |
| 1936 | - attribute_value: '<?php echo esc_js($column); ?>', | |
| 1937 | - skip_id: '<?php echo esc_js($skip_id); ?>', | |
| 1923 | + page: 'wdk_frontendajax', | |
| 1924 | + function: 'treefieldid', | |
| 1925 | + action: 'wdk_public_action', | |
| 1926 | + wdk_secure: '" . esc_js(wp_create_nonce('wdk_secure_treefieldid')) . "', | |
| 1927 | + table: '" . esc_js($table) . "', | |
| 1928 | + filter_ids: '" . esc_js($filter_ids) . "', | |
| 1929 | + start_id: '" . (!empty($filter_ids) ? esc_js($selected) : "") . "', | |
| 1930 | + empty_value: '" . esc_js($empty_value) . "', | |
| 1931 | + user_check: '" . esc_js($user_check) . "', | |
| 1932 | + sql_where: '" . esc_js($sql_where) . "', | |
| 1933 | + hide_fields: '" . esc_js($hide_fields) . "' | |
| 1934 | + }, | |
| 1935 | + attribute_id: '" . esc_js($attribute_id) . "', | |
| 1936 | + language_id: '" . esc_js($language_id) . "', | |
| 1937 | + attribute_value: '" . esc_js($column) . "', | |
| 1938 | + skip_id: '', | |
| 1938 | 1939 | empty_value: ' - ', |
| 1939 | - text_search: '<?php esc_html_e('Search term', 'wpdirectorykit');?>', | |
| 1940 | - text_no_results: '<?php esc_html_e('No results found', 'wpdirectorykit');?>', | |
| 1940 | + text_search: '" . esc_html__('Search term', 'wpdirectorykit') . "', | |
| 1941 | + text_no_results: '" . esc_html__('No results found', 'wpdirectorykit') . "', | |
| 1941 | 1942 | callback_selected: function(key) { |
| 1942 | - $('#wdktreeelem<?php echo esc_js($counter);?>').trigger("change"); | |
| 1943 | + $('#wdktreeelem" . esc_js($counter) . "').trigger('change'); | |
| 1943 | 1944 | } |
| 1944 | 1945 | }).addClass('init'); |
| 1945 | - }); | |
| 1946 | - </script> | |
| 1947 | - <?php | |
| 1946 | + });" | |
| 1947 | + ); | |
| 1948 | 1948 | $counter++; |
| 1949 | 1949 | return $form; |
| 1950 | 1950 | } |
| 1951 | 1951 | } |
| @@ -2013,9 +2013,9 @@ | ||
| 2013 | 2013 | if(empty($values)) { |
| 2014 | 2014 | $values = $empty_value; |
| 2015 | 2015 | } |
| 2016 | 2016 | |
| 2017 | - $form = '<input name="'.$name.'" value="'.esc_html($selected).'" data-placehoder="'.esc_html($values).'" class="wdk-hidden" type="text" id="wdktreeelem_checkbox'.$counter.'" readonly/>'; | |
| 2017 | + $form = '<input name="'.esc_attr($name).'" value="'.esc_html($selected).'" data-placehoder="'.esc_html($values).'" class="wdk-hidden" type="text" id="wdktreeelem_checkbox'.esc_attr($counter).'" readonly/>'; | |
| 2018 | 2018 | |
| 2019 | 2019 | $skip_id = ''; |
| 2020 | 2020 | //load javascript library |
| 2021 | 2021 | if($counter==0) |
| @@ -2026,14 +2026,14 @@ | ||
| 2026 | 2026 | ?> |
| 2027 | 2027 | <script> |
| 2028 | 2028 | jQuery(document).ready(function($) { |
| 2029 | 2029 | $('#wdktreeelem_checkbox<?php echo esc_js($counter);?>:not(.init)').wdkTreefieldCheckboxes({ |
| 2030 | - ajax_url: '<?php echo admin_url('admin-ajax.php'); ?>', | |
| 2030 | + ajax_url: '<?php echo esc_url(admin_url('admin-ajax.php')); ?>', | |
| 2031 | 2031 | ajax_param: { |
| 2032 | 2032 | "page": 'wdk_frontendajax', |
| 2033 | 2033 | "function": 'treefieldid_checkboxes', |
| 2034 | 2034 | "action": 'wdk_public_action', |
| 2035 | - "wdk_secure": '<?php echo wp_create_nonce( 'wdk_secure_treefieldid_checkboxes' );?>', | |
| 2035 | + "wdk_secure": '<?php echo esc_js(wp_create_nonce( 'wdk_secure_treefieldid_checkboxes' ));?>', | |
| 2036 | 2036 | "table": '<?php echo esc_js($table); ?>', |
| 2037 | 2037 | "filter_ids": '<?php echo esc_js($filter_ids); ?>', |
| 2038 | 2038 | "empty_value": '<?php echo esc_js($empty_value); ?>', |
| 2039 | 2039 | "user_check": '<?php echo esc_js($user_check); ?>', |
| @@ -2202,9 +2202,9 @@ | ||
| 2202 | 2202 | } |
| 2203 | 2203 | |
| 2204 | 2204 | /* check is date on strtotime */ |
| 2205 | 2205 | if((bool)strtotime($date)){ |
| 2206 | - return date($return_format, strtotime($date)); | |
| 2206 | + return gmdate($return_format, strtotime($date)); | |
| 2207 | 2207 | } |
| 2208 | 2208 | |
| 2209 | 2209 | return false; |
| 2210 | 2210 | } |
| @@ -2258,9 +2258,9 @@ | ||
| 2258 | 2258 | return false; |
| 2259 | 2259 | } |
| 2260 | 2260 | |
| 2261 | 2261 | // Try to get filename from URL or headers |
| 2262 | - $filename = basename(parse_url($url, PHP_URL_PATH)); | |
| 2262 | + $filename = basename(wp_parse_url($url, PHP_URL_PATH)); | |
| 2263 | 2263 | |
| 2264 | 2264 | // If filename empty (Google Drive case) |
| 2265 | 2265 | if (!$filename || strpos($filename, '.') === false) { |
| 2266 | 2266 | // Try content-disposition header |
| @@ -2344,9 +2344,9 @@ | ||
| 2344 | 2344 | $data = getimagesizefromstring($response['body']); |
| 2345 | 2345 | if(!$data) return false; |
| 2346 | 2346 | if(empty($data['mime'])) return false; |
| 2347 | 2347 | |
| 2348 | - $filename = time().rand(0000,9999).'.'.wdk_mime2ext($data['mime']); | |
| 2348 | + $filename = time().wp_rand(0000,9999).'.'.wdk_mime2ext($data['mime']); | |
| 2349 | 2349 | } |
| 2350 | 2350 | $upload = wp_upload_bits( $filename, null, $response['body'] ); |
| 2351 | 2351 | |
| 2352 | 2352 | if( !empty( $upload['error'] ) ) { |
| @@ -2710,13 +2710,13 @@ | ||
| 2710 | 2710 | <!-- Your add & remove file links --> |
| 2711 | 2711 | <p class="hide-if-no-js"> |
| 2712 | 2712 | <a class="upload-custom-img <?php if ( $you_have_file ) { echo 'hidden'; } ?>" |
| 2713 | 2713 | href="<?php echo esc_url($upload_link) ?>"> |
| 2714 | - <?php echo esc_html__('Select file','wmvc_win') ?> | |
| 2714 | + <?php echo esc_html__('Select file','wpdirectorykit') ?> | |
| 2715 | 2715 | </a> |
| 2716 | 2716 | <a class="delete-custom-img <?php if ( ! $you_have_file ) { echo 'hidden'; } ?>" |
| 2717 | 2717 | href="#"> |
| 2718 | - <?php echo esc_html__('Remove all files','wmvc_win') ?> | |
| 2718 | + <?php echo esc_html__('Remove all files','wpdirectorykit') ?> | |
| 2719 | 2719 | </a> |
| 2720 | 2720 | </p> |
| 2721 | 2721 | <?php //endif; ?> |
| 2722 | 2722 | |
| @@ -2730,8 +2730,9 @@ | ||
| 2730 | 2730 | if( typeof jQuery.fn.wpMediaElementFile == 'function') |
| 2731 | 2731 | $('#".esc_js($field_name)."meta-box-id.postbox-upload').wpMediaElementFile(); |
| 2732 | 2732 | });"; |
| 2733 | 2733 | |
| 2734 | +// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped, WordPress.WP.I18n.NonSingularStringLiteralText | |
| 2734 | 2735 | echo "<script>".$custom_js."</script>"; |
| 2735 | 2736 | |
| 2736 | 2737 | ?> |
| 2737 | 2738 | |
| @@ -2782,10 +2783,10 @@ | ||
| 2782 | 2783 | function wdk_upload_multi_files($field_name, $image_ids='', $texts = array()) |
| 2783 | 2784 | { |
| 2784 | 2785 | static $media_element_counter = 0; |
| 2785 | 2786 | |
| 2786 | - if(!isset($texts['file_select']))$texts['file_select'] = esc_html__('Select file','wmvc_win'); | |
| 2787 | - if(!isset($texts['file_remove']))$texts['file_remove'] = esc_html__('Remove all files','wmvc_win'); | |
| 2787 | + if(!isset($texts['file_select']))$texts['file_select'] = esc_html__('Select file','wpdirectorykit'); | |
| 2788 | + if(!isset($texts['file_remove']))$texts['file_remove'] = esc_html__('Remove all files','wpdirectorykit'); | |
| 2788 | 2789 | |
| 2789 | 2790 | $media_element_counter++; |
| 2790 | 2791 | |
| 2791 | 2792 | $img_field = $field_name.'_'.$media_element_counter; |
| @@ -2827,9 +2828,9 @@ | ||
| 2827 | 2828 | <!-- Your image container, which can be manipulated with js --> |
| 2828 | 2829 | <div class="custom-img-container winter_mvc-media"> |
| 2829 | 2830 | <?php if($you_have_img)foreach($your_img_src as $image_id => $img_src) : ?> |
| 2830 | 2831 | <div class="winter_mvc-media-card" data-media-id="<?php echo esc_attr($image_id);?>"> |
| 2831 | - <img src="<?php echo esc_attr($img_src); ?>" style="object-fit: contain;" alt="<?php echo esc_attr__('thumb', 'wmvc_win');?>" style="max-width:100%;" class="thumbnail"/> | |
| 2832 | + <img src="<?php echo esc_attr($img_src); ?>" style="object-fit: contain;" alt="<?php echo esc_attr__('thumb', 'wpdirectorykit');?>" style="max-width:100%;" class="thumbnail"/> | |
| 2832 | 2833 | <a href="#" class="remove"></a> |
| 2833 | 2834 | </div> |
| 2834 | 2835 | <?php endforeach; ?> |
| 2835 | 2836 | </div> |
| @@ -2891,8 +2892,9 @@ | ||
| 2891 | 2892 | }) |
| 2892 | 2893 | }); |
| 2893 | 2894 | "; |
| 2894 | 2895 | |
| 2896 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped, WordPress.WP.I18n.NonSingularStringLiteralText | |
| 2895 | 2897 | echo "<script>".$custom_js."</script>"; |
| 2896 | 2898 | |
| 2897 | 2899 | ?> |
| 2898 | 2900 | |
| @@ -2988,9 +2990,16 @@ | ||
| 2988 | 2990 | if($wdk_recaptcha_site_key && $wdk_recaptcha_secret_key) |
| 2989 | 2991 | { |
| 2990 | 2992 | if($load_script && $counter===0) |
| 2991 | 2993 | { |
| 2992 | - echo "<script src='https://www.google.com/recaptcha/api.js?render=".esc_attr(trim($wdk_recaptcha_site_key))."'></script>"; | |
| 2994 | + wp_enqueue_script( | |
| 2995 | + 'google-recaptcha-v3', | |
| 2996 | + 'https://www.google.com/recaptcha/api.js?render=' . esc_attr(trim($wdk_recaptcha_site_key)), | |
| 2997 | + array(), | |
| 2998 | + null, | |
| 2999 | + true | |
| 3000 | + ); | |
| 3001 | + | |
| 2993 | 3002 | } |
| 2994 | 3003 | $counter++; |
| 2995 | 3004 | ?> |
| 2996 | 3005 | <input type="hidden" name="g-recaptcha-response" id="recaptcha_called_v3_count_<?php echo esc_html($counter);?>"> |
| @@ -3028,9 +3037,16 @@ | ||
| 3028 | 3037 | if(get_option('wdk_recaptcha_site_key') !== FALSE && get_option('wdk_recaptcha_secret_key') !== NULL) |
| 3029 | 3038 | { |
| 3030 | 3039 | if($load_script && $counter===0) |
| 3031 | 3040 | { |
| 3032 | - echo "<script src='https://www.google.com/recaptcha/api.js?onload=CaptchaCallback&render=explicit'></script>"; | |
| 3041 | + wp_enqueue_script( | |
| 3042 | + 'google-recaptcha-v2', | |
| 3043 | + 'https://www.google.com/recaptcha/api.js?onload=CaptchaCallback&render=explicit', | |
| 3044 | + array(), | |
| 3045 | + null, | |
| 3046 | + true | |
| 3047 | + ); | |
| 3048 | + | |
| 3033 | 3049 | } |
| 3034 | 3050 | $counter++; |
| 3035 | 3051 | |
| 3036 | 3052 | $compact_tag=''; |
| @@ -3042,15 +3058,15 @@ | ||
| 3042 | 3058 | } |
| 3043 | 3059 | |
| 3044 | 3060 | $recaptcha_array[$counter] = array('size'=>$size_tag); |
| 3045 | 3061 | |
| 3046 | - echo '<div id="recaptcha_called_'.$counter.'" class="g-recaptcha" style="'.$style.'" '.$compact_tag.' data-sitekey="'.esc_attr(get_option('wdk_recaptcha_site_key')).'"></div>'; | |
| 3062 | + echo '<div id="recaptcha_called_'.esc_attr($counter).'" class="g-recaptcha" style="'.esc_attr($style).'" '.esc_attr($compact_tag).' data-sitekey="'.esc_attr(get_option('wdk_recaptcha_site_key')).'"></div>'; | |
| 3047 | 3063 | ?> |
| 3048 | 3064 | |
| 3049 | 3065 | <script> |
| 3050 | 3066 | <?php if($counter===1)echo 'var ';?>CaptchaCallback = function(){ |
| 3051 | 3067 | <?php for($j=1;$j<=$counter;$j++): ?> |
| 3052 | - grecaptcha.render(document.getElementById('recaptcha_called_<?php echo $j;?>'), {'size' : '<?php echo esc_attr($recaptcha_array[$j]['size']); ?>', 'sitekey' : '<?php echo esc_attr(get_option('wdk_recaptcha_site_key')); ?>'}); | |
| 3068 | + grecaptcha.render(document.getElementById('recaptcha_called_<?php echo esc_attr($j);?>'), {'size' : '<?php echo esc_attr($recaptcha_array[$j]['size']); ?>', 'sitekey' : '<?php echo esc_attr(get_option('wdk_recaptcha_site_key')); ?>'}); | |
| 3053 | 3069 | <?php endfor; ?> |
| 3054 | 3070 | }; |
| 3055 | 3071 | </script> |
| 3056 | 3072 | |
| @@ -3273,9 +3289,9 @@ | ||
| 3273 | 3289 | |
| 3274 | 3290 | if(is_array($filter_ids)) $filter_ids = implode(',', $filter_ids); |
| 3275 | 3291 | |
| 3276 | 3292 | static $counter = 0; |
| 3277 | - $form = '<select data-ajax="'.admin_url('admin-ajax.php').'" name="'.$name.'" data-table="'.$table.'" '.$attr.' data-placeholder="'.$empty_value.'" class="form-control select_ajax" id="wdk_select2_'.$counter.'" multiple="">'; | |
| 3293 | + $form = '<select data-ajax="'.admin_url('admin-ajax.php').'" name="'.esc_attr($name).'" data-table="'.esc_attr($table).'" '.esc_attr($attr).' data-placeholder="'.esc_attr($empty_value).'" class="form-control select_ajax" id="wdk_select2_'.esc_attr($counter).'" multiple="">'; | |
| 3278 | 3294 | |
| 3279 | 3295 | |
| 3280 | 3296 | if(false) |
| 3281 | 3297 | if( $column_key == 'idcategory') { |
| @@ -3302,8 +3318,10 @@ | ||
| 3302 | 3318 | |
| 3303 | 3319 | $results = $WMVC->$table->get(); |
| 3304 | 3320 | foreach ($results as $item) { |
| 3305 | 3321 | if($item) |
| 3322 | + // Dynamic field values are registered in the translation catalog separately. | |
| 3323 | + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText | |
| 3306 | 3324 | $form .= '<option selected="selected" value="'.esc_attr(wmvc_show_data($column_key, $item, false, TRUE, TRUE)).'">'.esc_html__(wmvc_show_data($column_print, $item, false, TRUE, TRUE),'wpdirectorykit').'</option>'; |
| 3307 | 3325 | } |
| 3308 | 3326 | } |
| 3309 | 3327 | } elseif(is_intval($selected)) { |
| @@ -3308,8 +3326,10 @@ | ||
| 3308 | 3326 | } |
| 3309 | 3327 | } elseif(is_intval($selected)) { |
| 3310 | 3328 | $db_item = $WMVC->$table->get($selected, TRUE); |
| 3311 | 3329 | if($db_item) |
| 3330 | + // Dynamic field values are registered in the translation catalog separately. | |
| 3331 | + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText | |
| 3312 | 3332 | $form .= '<option selected="selected" value="'.esc_attr(wmvc_show_data($column_key, $db_item, false, TRUE, TRUE)).'">'.esc_html__(wmvc_show_data($column_print, $db_item, false, TRUE, TRUE),'wpdirectorykit').'</option>'; |
| 3313 | 3333 | } |
| 3314 | 3334 | } else { |
| 3315 | 3335 | //$form .= '<option value="" selected="selected">'.esc_html__('Not selected', 'wpdirectorykit').'</option>'; |
| @@ -4359,11 +4379,11 @@ | ||
| 4359 | 4379 | $page_title, |
| 4360 | 4380 | $post_type |
| 4361 | 4381 | ); |
| 4362 | 4382 | } |
| 4363 | - | |
| 4364 | - $page = $wpdb->get_var( $sql ); | |
| 4365 | - | |
| 4383 | + $page = $wpdb->get_var( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared | |
| 4384 | + | |
| 4385 | + | |
| 4366 | 4386 | if ( $page ) { |
| 4367 | 4387 | return get_post( $page, $output ); |
| 4368 | 4388 | } |
| 4369 | 4389 | |
| @@ -4427,9 +4447,9 @@ | ||
| 4427 | 4447 | $output .= '<tr>'; |
| 4428 | 4448 | foreach($var as $k => $v) { |
| 4429 | 4449 | if(count($columns) > 0 && !in_array($k, $columns))continue; |
| 4430 | 4450 | |
| 4431 | - $output .= '<td><strong>' . $k . '</strong></td>'; | |
| 4451 | + $output .= '<td><strong>' . esc_html($k) . '</strong></td>'; | |
| 4432 | 4452 | } |
| 4433 | 4453 | $output .= '</tr>'; |
| 4434 | 4454 | } |
| 4435 | 4455 | |
| @@ -4436,13 +4456,14 @@ | ||
| 4436 | 4456 | $output .= '<tr>'; |
| 4437 | 4457 | foreach($var as $k => $v) { |
| 4438 | 4458 | if(count($columns) > 0 && !in_array($k, $columns))continue; |
| 4439 | 4459 | |
| 4440 | - $output .= '<td>' . $v . '</td>'; | |
| 4460 | + $output .= '<td>' . esc_html($v) . '</td>'; | |
| 4441 | 4461 | } |
| 4442 | 4462 | $output .= '</tr>'; |
| 4443 | 4463 | } |
| 4444 | 4464 | $output .= '</table>'; |
| 4465 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped, WordPress.WP.I18n.NonSingularStringLiteralText | |
| 4445 | 4466 | echo $output; |
| 4446 | 4467 | } |
| 4447 | 4468 | } |
| 4448 | 4469 | |
| @@ -4448,9 +4469,9 @@ | ||
| 4448 | 4469 | |
| 4449 | 4470 | if ( ! function_exists('wdk_move_gps')) |
| 4450 | 4471 | { |
| 4451 | 4472 | function wdk_move_gps($value) { |
| 4452 | - return $value+0.001 * rand(1, 9); | |
| 4473 | + return $value+0.001 * wp_rand(1, 9); | |
| 4453 | 4474 | } |
| 4454 | 4475 | } |
| 4455 | 4476 | |
| 4456 | 4477 | if ( ! function_exists('wdk_get_near_location')) |
| @@ -4458,10 +4479,10 @@ | ||
| 4458 | 4479 | function wdk_get_near_location($latitude, $longitude, $radius = 10000) { |
| 4459 | 4480 | // Convert radius from meters to degrees |
| 4460 | 4481 | $radiusInDegrees = $radius / 111000; |
| 4461 | 4482 | |
| 4462 | - $u = mt_rand() / mt_getrandmax(); | |
| 4463 | - $v = mt_rand() / mt_getrandmax(); | |
| 4483 | + $u = wp_rand() / mt_getrandmax(); | |
| 4484 | + $v = wp_rand() / mt_getrandmax(); | |
| 4464 | 4485 | $w = $radiusInDegrees * sqrt($u); |
| 4465 | 4486 | $t = 2 * M_PI * $v; |
| 4466 | 4487 | $x = $w * cos($t); |
| 4467 | 4488 | $y = $w * sin($t); |
| @@ -4587,9 +4608,9 @@ | ||
| 4587 | 4608 | // For french |
| 4588 | 4609 | $str = str_replace(array('â','é','è','û','ê', 'à ','Â','ç','ï','î','ä','î'), |
| 4589 | 4610 | array('a','e','e','u','e', 'a','c','c','i','î','a','î'), $str); |
| 4590 | 4611 | |
| 4591 | - $str = strip_tags(strtolower($str)); | |
| 4612 | + $str = wp_strip_all_tags(strtolower($str)); | |
| 4592 | 4613 | |
| 4593 | 4614 | |
| 4594 | 4615 | foreach ($trans as $key => $val) |
| 4595 | 4616 | { |
| @@ -5049,9 +5070,9 @@ | ||
| 5049 | 5070 | { |
| 5050 | 5071 | $WMVC = &wdk_get_instance(); |
| 5051 | 5072 | |
| 5052 | 5073 | static $counter = 0; |
| 5053 | - $form = '<select data-ajax="'.admin_url('admin-ajax.php').'" name="'.$name.'" data-id="'.$filter_id.'" data-placeholder="'.$empty_value.'" class="form-control wdk_select2_field_suggestion" id="wdk_select2_field_'.$filter_id.'_'.$counter.'" multiple="">'; | |
| 5074 | + $form = '<select data-ajax="'.esc_url(admin_url('admin-ajax.php')).'" name="'.$name.'" data-id="'.$filter_id.'" data-placeholder="'.$empty_value.'" class="form-control wdk_select2_field_suggestion" id="wdk_select2_field_'.$filter_id.'_'.$counter.'" multiple="">'; | |
| 5054 | 5075 | if($selected) { |
| 5055 | 5076 | if(is_array($selected)) { |
| 5056 | 5077 | /* where in */ |
| 5057 | 5078 | foreach ($selected as $item) { |
| @@ -5090,10 +5111,10 @@ | ||
| 5090 | 5111 | */ |
| 5091 | 5112 | function wdk_next_month_payment_day($currentDate, $time = false, $wanted_day = NULL) { |
| 5092 | 5113 | $nextDate = null; |
| 5093 | 5114 | $timestamp = strtotime($currentDate); |
| 5094 | - $daysInNextMonth = date('t', strtotime('+1 month', strtotime(date('Y-m', $timestamp)))); | |
| 5095 | - $currentDay = (int)date('d', $timestamp); | |
| 5115 | + $daysInNextMonth = gmdate('t', strtotime('+1 month', strtotime(gmdate('Y-m', $timestamp)))); | |
| 5116 | + $currentDay = (int)gmdate('d', $timestamp); | |
| 5096 | 5117 | |
| 5097 | 5118 | $timeFormat = $time ? "H:i:s" : "00:00:00"; |
| 5098 | 5119 | |
| 5099 | 5120 | |
| @@ -5098,15 +5119,15 @@ | ||
| 5098 | 5119 | |
| 5099 | 5120 | |
| 5100 | 5121 | // Determine the wanted day |
| 5101 | 5122 | if ($wanted_day !== NULL) { |
| 5102 | - $wanted_day = (int)date('d', strtotime($wanted_day)); | |
| 5123 | + $wanted_day = (int)gmdate('d', strtotime($wanted_day)); | |
| 5103 | 5124 | } else { |
| 5104 | - $wanted_day = (int)date('d', $timestamp); | |
| 5125 | + $wanted_day = (int)gmdate('d', $timestamp); | |
| 5105 | 5126 | } |
| 5106 | 5127 | |
| 5107 | 5128 | $nextMonth = strtotime('first day of next month', $timestamp); |
| 5108 | - $daysInNextMonth = date('t', $nextMonth); | |
| 5129 | + $daysInNextMonth = gmdate('t', $nextMonth); | |
| 5109 | 5130 | |
| 5110 | 5131 | // Adjust for the wanted day |
| 5111 | 5132 | if ($wanted_day > $daysInNextMonth || |
| 5112 | 5133 | ( |
| @@ -5112,17 +5133,17 @@ | ||
| 5112 | 5133 | ( |
| 5113 | 5134 | get_option('wdk_membership_next_month_calculation_with_last_day') |
| 5114 | 5135 | |
| 5115 | 5136 | && ( |
| 5116 | - $currentDay >= 30 || $currentDay == date('t', $timestamp) | |
| 5137 | + $currentDay >= 30 || $currentDay == gmdate('t', $timestamp) | |
| 5117 | 5138 | ) |
| 5118 | 5139 | ) |
| 5119 | 5140 | ) { |
| 5120 | 5141 | // If the wanted day exceeds the max days of the next month, use the last day of the month |
| 5121 | - $nextDate = date("Y-m-{$daysInNextMonth} {$timeFormat}", $nextMonth); | |
| 5142 | + $nextDate = gmdate("Y-m-{$daysInNextMonth} {$timeFormat}", $nextMonth); | |
| 5122 | 5143 | } else { |
| 5123 | 5144 | // Otherwise, set the exact wanted day |
| 5124 | - $nextDate = date("Y-m-{$wanted_day} {$timeFormat}", $nextMonth); | |
| 5145 | + $nextDate = gmdate("Y-m-{$wanted_day} {$timeFormat}", $nextMonth); | |
| 5125 | 5146 | } |
| 5126 | 5147 | |
| 5127 | 5148 | return ($nextDate) ? $nextDate : false; |
| 5128 | 5149 | } |
| @@ -5139,19 +5160,19 @@ | ||
| 5139 | 5160 | |
| 5140 | 5161 | function wdk_next_year_payment_day($currentDate, $time = false) { |
| 5141 | 5162 | $nextDate = null; |
| 5142 | 5163 | $timestamp = strtotime($currentDate); |
| 5143 | - $nextYearTimestamp = strtotime('+1 year', strtotime(date('Y-m', $timestamp))); | |
| 5144 | - $daysInNextMonth = date('t', $nextYearTimestamp); | |
| 5145 | - $currentDay = date('j', $timestamp); | |
| 5164 | + $nextYearTimestamp = strtotime('+1 year', strtotime(gmdate('Y-m', $timestamp))); | |
| 5165 | + $daysInNextMonth = gmdate('t', $nextYearTimestamp); | |
| 5166 | + $currentDay = gmdate('j', $timestamp); | |
| 5146 | 5167 | $timeFormat = "00:00:00"; |
| 5147 | 5168 | if($time) { |
| 5148 | 5169 | $timeFormat = "H:i:s"; |
| 5149 | 5170 | } |
| 5150 | 5171 | if ($currentDay > $daysInNextMonth) { |
| 5151 | - $nextDate = date('Y-m-d '.$timeFormat, strtotime('last day of this month', $nextYearTimestamp)); | |
| 5172 | + $nextDate = gmdate('Y-m-d '.$timeFormat, strtotime('last day of this month', $nextYearTimestamp)); | |
| 5152 | 5173 | } else { |
| 5153 | - $nextDate = date('Y-m-d '.$timeFormat, strtotime('+1 year', $timestamp)); | |
| 5174 | + $nextDate = gmdate('Y-m-d '.$timeFormat, strtotime('+1 year', $timestamp)); | |
| 5154 | 5175 | } |
| 5155 | 5176 | |
| 5156 | 5177 | return ($nextDate) ? $nextDate : false; |
| 5157 | 5178 | } |