PluginProbe
پارسی دیت – Parsi Date / 6.3
پارسی دیت – Parsi Date v6.3
6.3 6.2.1 6.2 6.1 5.1.6 5.1.7 5.1.8 5.1.8.2 6.0 trunk 1.0 1.1 1.2 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 2.0.0-alpha 2.1 2.1.1 2.1.2 2.1.3 2.1.5 All 49 releases
wp-parsidate / inc / Functions / Old.php
Old.php
149 lines 3.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 use WPParsidate\App\Tools\HookDeactivator;
4 use WPParsidate\Helper\{Date, Number, WooCommerce, WordPress};
5 use WPParsidate\Core\Archive;
6 use WPParsidate\Settings\Settings;
7
8 if ( ! function_exists( 'wp_get_parchives' ) ) {
9 /**
10 * Displays Jalali archive links based on type and format.
11 *
12 * @param string|array $args See Archive::getPostTypeArchives() doc
13 *
14 * @return void|string Void if 'echo' argument is true, archive links if 'echo' is false.
15 *
16 */
17 function wp_get_parchives( $args = '' ) {
18 return Archive::getPostTypeArchives( $args );
19 }
20 }
21
22 if ( ! function_exists( 'wpp_is_active' ) ) {
23 /**
24 * Gets an option name and check that option is active or not
25 *
26 * @param $option_name
27 *
28 * @return bool
29 * @since 4.0.0
30 */
31 function wpp_is_active( $option_name ): bool {
32 return Settings::get( $option_name, false ) === true;
33 }
34 }
35
36 if ( ! function_exists( 'disable_wpp' ) ) {
37 /**
38 * Check hook deactivator enable in current call back trace
39 *
40 * @return bool
41 */
42 function disable_wpp(): bool {
43 return HookDeactivator::checkDisable();
44 }
45 }
46
47 if ( ! function_exists( 'wpp_date_is' ) ) {
48 /**
49 * Validate date string
50 *
51 * @param $dateString
52 * @param $format
53 *
54 * @return array
55 */
56 function wpp_date_is( $dateString, $format = 'Y-m-d\TH:i:sP' ): array {
57 return Date::isDateString( $dateString, $format );
58 }
59 }
60
61 if ( ! function_exists( 'wpp_is_time_validate' ) ) {
62 /**
63 * Validate time string
64 *
65 * @param mixed $time
66 * @param string $default_seconds
67 *
68 * @return false|string
69 */
70 function wpp_is_time_validate( $time, string $default_seconds = '00' ) {
71 return Date::isTimeString( $time, $default_seconds );
72 }
73 }
74
75 if ( ! function_exists( 'wpp_is_postal_code_validate' ) ) {
76 /**
77 * Check value is postal code
78 *
79 * @param mixed $postalCode
80 * @param bool $checkSum
81 *
82 * @return bool
83 */
84 function wpp_is_postal_code_validate( $postalCode, bool $checkSum = false ): bool {
85 return WooCommerce::isPostalCode( $postalCode, $checkSum );
86 }
87 }
88
89 if ( ! function_exists( 'wpp_is_sitemap' ) ) {
90 /**
91 * Checks is WordPress sitemap
92 *
93 * @return boolean
94 */
95 function wpp_is_sitemap(): bool {
96 return WordPress::isSitemap();
97 }
98 }
99
100 if ( ! function_exists( 'fix_number' ) ) {
101 /**
102 * Fix numbers and convert them to Persian digits style
103 *
104 * @param string $content
105 *
106 * @return array|string|string[]|null
107 */
108 function fix_number( string $content ) {
109 return Number::fixNumber( $content );
110 }
111 }
112
113 if ( ! function_exists( 'wpp_is_feed' ) ) {
114 /**
115 * Detects current page is feed or not
116 *
117 * @return bool
118 */
119 function wpp_is_feed(): bool {
120 return WordPress::isFeed();
121 }
122 }
123
124 if ( ! function_exists( 'per_number' ) ) {
125 /**
126 * Converts English digits to Persian digits
127 *
128 * @param string $number Numbers
129 *
130 * @return string Formatted numbers
131 */
132 function per_number( string $number ): string {
133 return Number::toPersian( $number );
134 }
135 }
136
137 if ( ! function_exists( 'eng_number' ) ) {
138 /**
139 * Converts Persian digits to English digits
140 *
141 * @param string $number Numbers
142 *
143 * @return string Formatted numbers
144 */
145 function eng_number( string $number ): string {
146 return Number::toEnglish( $number );
147 }
148 }
149