Changeset 3017144
- Timestamp:
- 01/03/2024 06:22:12 PM (2 years ago)
- Location:
- lct-useful-shortcodes-functions/trunk
- Files:
-
- 18 edited
-
assets/css/plugins/acf/main.css (modified) (1 diff)
-
assets/css/plugins/acf/main.min.css (modified) (1 diff)
-
assets/css/plugins/acf/main.scss (modified) (1 diff)
-
code/__init.php (modified) (1 diff)
-
code/admin/lct.php (modified) (2 diffs)
-
code/admin/time.php (modified) (8 diffs)
-
code/features/shortcodes/sort.php (modified) (1 diff)
-
code/features/theme_chunk.php (modified) (1 diff)
-
code/plugins/acf/_admin.php (modified) (4 diffs)
-
code/plugins/acf/_loaded.php (modified) (7 diffs)
-
code/plugins/acf/api/form.php (modified) (2 diffs)
-
code/plugins/acf/api/get.php (modified) (2 diffs)
-
code/plugins/acf/api/is.php (modified) (1 diff)
-
code/plugins/acf/dev_checks.php (modified) (1 diff)
-
code/plugins/acf/filters_load_field.php (modified) (1 diff)
-
code/plugins/acf/form.php (modified) (4 diffs)
-
lct-useful-shortcodes-functions.php (modified) (3 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lct-useful-shortcodes-functions/trunk/assets/css/plugins/acf/main.css
r2827914 r3017144 267 267 /* copy to dompdf */ 268 268 /* copy to dompdf */ 269 .hide_label div.acf-label, 269 .hide_label:not(.acf-field-repeater) div.acf-label, 270 .hide_label.acf-field-repeater > div.acf-label, 270 271 .hide_label .acf-label label, 271 272 .hide_label_maintain_height div.acf-label, -
lct-useful-shortcodes-functions/trunk/assets/css/plugins/acf/main.min.css
r2827914 r3017144 1 .select2-container.-acf .select2-choice{text-decoration:none !important}.acf-field.acf-c0.alignright{clear:none !important}.lct_acf_display_form .hidden-by-conditional-logic{display:inherit !important}.lct_acf_display_form .acf-field-date-picker.hidden-by-conditional-logic{display:block !important}.lct_instant .acf-form-submit{display:none !important}.lct_instant.show_submit .acf-form-submit{display:block !important}.submit_center .acf-form-submit{text-align:center}.submit_right .acf-form-submit{text-align:right}.acf-form .show_on_pdf{display:none !important}.dompdf_right{border-left:none !important}.dompdf_inline_left{border-left:none !important}.lct_ol_start{padding-bottom:0 !important}.lct_ol_start ol{margin-bottom:0}.lct_ol_continued{padding-top:0 !important;padding-bottom:0 !important;border-top:none !important;min-height:1px !important}.lct_ol_continued ol{margin-top:0;margin-bottom:0}.lct_ol_end{padding-top:0 !important;border-top:none !important}.lct_ol_end ol{margin-top:0}.lct_float_right_initial{padding-top:0 !important;padding-bottom:0 !important;border-top:none !important;border-left:none !important;border-right:none !important;min-height:1px !important}.lct_float_right_initial .acf-label,.lct_float_right_initial .acf-label label{margin-bottom:0 !important}.lct_float_right_initial .acf-input input{height:28px !important;padding-top:0 !important;padding-bottom:0 !important}.lct_acf_display_form .lct_acf_checkbox_column{display:inline-block;float:none;vertical-align:top}.lct_acf_display_form .lct_acf_checkbox_column p{margin-bottom:0}.lct_large_checkbox ul.acf-checkbox-list li input[type="checkbox"]{zoom:1.7;transform:scale(1.7);-ms-transform:scale(1.7);-webkit-transform:scale(1.7);-o-transform:scale(1.7);-moz-transform:scale(1.7);transform-origin:0 0;-ms-transform-origin:0 0;-webkit-transform-origin:0 0;-o-transform-origin:0 0;-moz-transform-origin:0 0;margin:-7px 10px 0 0}.ua-mobile-iphone .lct_large_checkbox ul.acf-checkbox-list li input[type="checkbox"],.ua-mobile-ipad .lct_large_checkbox ul.acf-checkbox-list li input[type="checkbox"]{zoom:1.5 !important;transform:scale(1.5) !important;-ms-transform:scale(1.5) !important;-webkit-transform:scale(1.5) !important;-o-transform:scale(1.5) !important;-moz-transform:scale(1.5) !important;margin:-10px 15px 0 0 !important}.lct_large_checkbox ul.acf-checkbox-list li label{font-size:20px;line-height:42px}.lct_nomp_top{margin-top:0 !important;padding-top:0 !important;border-top:none !important}.lct_nomp_bottom{margin-bottom:0 !important;padding-bottom:0 !important}.lct_nomp_top_n_bottom{margin-top:0 !important;margin-bottom:0 !important;padding-top:0 !important;padding-bottom:0 !important;border-top:none !important}.lct_acf_viewonly .acf-form-submit,.lct_acf_viewonly.lct_instant.show_submit .acf-form-submit,.lct_acf_viewonly.acf-field .acf-input select,.lct_acf_viewonly .acf-field:not(.show-imp) .acf-input select,.lct_acf_viewonly.acf-field .acf-input textarea,.lct_acf_viewonly .acf-field:not(.show-imp) .acf-input textarea,.lct_acf_viewonly.acf-field .acf-input .acf-input-wrap,.lct_acf_viewonly .acf-field:not(.show-imp) .acf-input .acf-input-wrap,.lct_acf_viewonly.acf-field:not(.lct_type_repeater) .acf-input .select2-container,.lct_acf_viewonly:not(.lct_type_repeater) .acf-field:not(.show-imp) .acf-input .select2-container,.lct_acf_viewonly.acf-field .acf-input .acf-true-false,.lct_acf_viewonly .acf-field:not(.show-imp) .acf-input .acf-true-false,.lct_acf_viewonly.acf-field .acf-input .acf-radio-list,.lct_acf_viewonly .acf-field:not(.show-imp) .acf-input .acf-radio-list,.lct_acf_viewonly.acf-field .acf-input .acf-repeater .acf-row-handle.remove,.lct_acf_viewonly .acf-field:not(.show-imp) .acf-input .acf-repeater .acf-row-handle.remove,.lct_acf_viewonly.acf-field .acf-input .acf-repeater .acf-actions,.lct_acf_viewonly .acf-field:not(.show-imp) .acf-input .acf-repeater .acf-actions,.lct_acf_viewonly.acf-field .acf-input .acf-taxonomy-field input,.lct_acf_viewonly.acf-field .acf-input .acf-taxonomy-field select,.lct_acf_viewonly .acf-field:not(.show-imp) .acf-input .acf-taxonomy-field input,.lct_acf_viewonly .acf-field:not(.show-imp) .acf-input .acf-taxonomy-field select,.lct_acf_viewonly.acf-field.acf-field-checkbox .acf-input .acf-checkbox-list,.lct_acf_viewonly .acf-field.acf-field-checkbox:not(.show-imp) .acf-input .acf-checkbox-list,.lct_acf_new_post .lct_acf_viewonly{display:none !important}.lct_acf_viewonly.acf-field .acf-input .acf-checkbox-list ul,.lct_acf_viewonly .acf-field:not(.show-imp) .acf-input .acf-checkbox-list ul{padding-left:20px}.lct_acf_viewonly.acf-field.acf-field-checkbox .acf-input ul,.lct_acf_viewonly .acf-field.acf-field-checkbox:not(.show-imp) .acf-input ul{padding-left:20px}.hide_label div.acf-label,.hide_label .acf-label label,.hide_label_maintain_height div.acf-label,.hide_label_maintain_height .acf-label label{display:none}.hide_but_save{display:none}.hide_input div.acf-input,.hide_input .acf-input input{display:none}.hide_label_show_desc .acf-label label{display:none}.lct_acf_display_form .hide_on_pdf{display:none !important}1 .select2-container.-acf .select2-choice{text-decoration:none !important}.acf-field.acf-c0.alignright{clear:none !important}.lct_acf_display_form .hidden-by-conditional-logic{display:inherit !important}.lct_acf_display_form .acf-field-date-picker.hidden-by-conditional-logic{display:block !important}.lct_instant .acf-form-submit{display:none !important}.lct_instant.show_submit .acf-form-submit{display:block !important}.submit_center .acf-form-submit{text-align:center}.submit_right .acf-form-submit{text-align:right}.acf-form .show_on_pdf{display:none !important}.dompdf_right{border-left:none !important}.dompdf_inline_left{border-left:none !important}.lct_ol_start{padding-bottom:0 !important}.lct_ol_start ol{margin-bottom:0}.lct_ol_continued{padding-top:0 !important;padding-bottom:0 !important;border-top:none !important;min-height:1px !important}.lct_ol_continued ol{margin-top:0;margin-bottom:0}.lct_ol_end{padding-top:0 !important;border-top:none !important}.lct_ol_end ol{margin-top:0}.lct_float_right_initial{padding-top:0 !important;padding-bottom:0 !important;border-top:none !important;border-left:none !important;border-right:none !important;min-height:1px !important}.lct_float_right_initial .acf-label,.lct_float_right_initial .acf-label label{margin-bottom:0 !important}.lct_float_right_initial .acf-input input{height:28px !important;padding-top:0 !important;padding-bottom:0 !important}.lct_acf_display_form .lct_acf_checkbox_column{display:inline-block;float:none;vertical-align:top}.lct_acf_display_form .lct_acf_checkbox_column p{margin-bottom:0}.lct_large_checkbox ul.acf-checkbox-list li input[type="checkbox"]{zoom:1.7;transform:scale(1.7);-ms-transform:scale(1.7);-webkit-transform:scale(1.7);-o-transform:scale(1.7);-moz-transform:scale(1.7);transform-origin:0 0;-ms-transform-origin:0 0;-webkit-transform-origin:0 0;-o-transform-origin:0 0;-moz-transform-origin:0 0;margin:-7px 10px 0 0}.ua-mobile-iphone .lct_large_checkbox ul.acf-checkbox-list li input[type="checkbox"],.ua-mobile-ipad .lct_large_checkbox ul.acf-checkbox-list li input[type="checkbox"]{zoom:1.5 !important;transform:scale(1.5) !important;-ms-transform:scale(1.5) !important;-webkit-transform:scale(1.5) !important;-o-transform:scale(1.5) !important;-moz-transform:scale(1.5) !important;margin:-10px 15px 0 0 !important}.lct_large_checkbox ul.acf-checkbox-list li label{font-size:20px;line-height:42px}.lct_nomp_top{margin-top:0 !important;padding-top:0 !important;border-top:none !important}.lct_nomp_bottom{margin-bottom:0 !important;padding-bottom:0 !important}.lct_nomp_top_n_bottom{margin-top:0 !important;margin-bottom:0 !important;padding-top:0 !important;padding-bottom:0 !important;border-top:none !important}.lct_acf_viewonly .acf-form-submit,.lct_acf_viewonly.lct_instant.show_submit .acf-form-submit,.lct_acf_viewonly.acf-field .acf-input select,.lct_acf_viewonly .acf-field:not(.show-imp) .acf-input select,.lct_acf_viewonly.acf-field .acf-input textarea,.lct_acf_viewonly .acf-field:not(.show-imp) .acf-input textarea,.lct_acf_viewonly.acf-field .acf-input .acf-input-wrap,.lct_acf_viewonly .acf-field:not(.show-imp) .acf-input .acf-input-wrap,.lct_acf_viewonly.acf-field:not(.lct_type_repeater) .acf-input .select2-container,.lct_acf_viewonly:not(.lct_type_repeater) .acf-field:not(.show-imp) .acf-input .select2-container,.lct_acf_viewonly.acf-field .acf-input .acf-true-false,.lct_acf_viewonly .acf-field:not(.show-imp) .acf-input .acf-true-false,.lct_acf_viewonly.acf-field .acf-input .acf-radio-list,.lct_acf_viewonly .acf-field:not(.show-imp) .acf-input .acf-radio-list,.lct_acf_viewonly.acf-field .acf-input .acf-repeater .acf-row-handle.remove,.lct_acf_viewonly .acf-field:not(.show-imp) .acf-input .acf-repeater .acf-row-handle.remove,.lct_acf_viewonly.acf-field .acf-input .acf-repeater .acf-actions,.lct_acf_viewonly .acf-field:not(.show-imp) .acf-input .acf-repeater .acf-actions,.lct_acf_viewonly.acf-field .acf-input .acf-taxonomy-field input,.lct_acf_viewonly.acf-field .acf-input .acf-taxonomy-field select,.lct_acf_viewonly .acf-field:not(.show-imp) .acf-input .acf-taxonomy-field input,.lct_acf_viewonly .acf-field:not(.show-imp) .acf-input .acf-taxonomy-field select,.lct_acf_viewonly.acf-field.acf-field-checkbox .acf-input .acf-checkbox-list,.lct_acf_viewonly .acf-field.acf-field-checkbox:not(.show-imp) .acf-input .acf-checkbox-list,.lct_acf_new_post .lct_acf_viewonly{display:none !important}.lct_acf_viewonly.acf-field .acf-input .acf-checkbox-list ul,.lct_acf_viewonly .acf-field:not(.show-imp) .acf-input .acf-checkbox-list ul{padding-left:20px}.lct_acf_viewonly.acf-field.acf-field-checkbox .acf-input ul,.lct_acf_viewonly .acf-field.acf-field-checkbox:not(.show-imp) .acf-input ul{padding-left:20px}.hide_label:not(.acf-field-repeater) div.acf-label,.hide_label.acf-field-repeater>div.acf-label,.hide_label .acf-label label,.hide_label_maintain_height div.acf-label,.hide_label_maintain_height .acf-label label{display:none}.hide_but_save{display:none}.hide_input div.acf-input,.hide_input .acf-input input{display:none}.hide_label_show_desc .acf-label label{display:none}.lct_acf_display_form .hide_on_pdf{display:none !important} -
lct-useful-shortcodes-functions/trunk/assets/css/plugins/acf/main.scss
r2827914 r3017144 245 245 /* copy to dompdf *//* copy to dompdf *//* copy to dompdf *//* copy to dompdf *//* copy to dompdf *//* copy to dompdf */ 246 246 /* copy to dompdf *//* copy to dompdf *//* copy to dompdf *//* copy to dompdf *//* copy to dompdf *//* copy to dompdf */ 247 .hide_label div.acf-label, 247 .hide_label:not(.acf-field-repeater) div.acf-label, 248 .hide_label.acf-field-repeater > div.acf-label, 248 249 .hide_label .acf-label label, 249 250 .hide_label_maintain_height div.acf-label, -
lct-useful-shortcodes-functions/trunk/code/__init.php
r2894473 r3017144 837 837 if ( lct_plugin_active( $plugin ) ) { 838 838 lct_include( "{$dir}/ajax.php" ); 839 840 lct_load_class( "{$dir}/_admin.php", 'admin', [ 'plugin' => $plugin ] ); 839 lct_include( "{$dir}/_admin.php" ); 840 841 841 lct_load_class( "{$dir}/_shortcodes.php", 'shortcodes', [ 'plugin' => $plugin ] ); 842 842 -
lct-useful-shortcodes-functions/trunk/code/admin/lct.php
r2991310 r3017144 263 263 * 264 264 * @since 2017.2 265 * @verified 2023.1 1.01265 * @verified 2023.12.20 266 266 */ 267 267 function init() … … 386 386 * Is a core action running? 387 387 */ 388 if ( in_array( $this->action, $this->core_actions_post_exclude ) ) { 389 $this->action = 'core_action_exclude'; 390 } 391 388 392 if ( $this->do_core_action_check ) { 389 if ( in_array( $this->action, $this->core_actions_post_exclude ) ) { 390 $this->action = 'core_action_exclude'; 391 } elseif ( in_array( $this->action, $this->core_actions_post ) ) { 393 if ( in_array( $this->action, $this->core_actions_post ) ) { 392 394 $this->action = 'core_action'; 393 395 } elseif ( in_array( $this->action, $this->wpdiscuz_actions ) ) { -
lct-useful-shortcodes-functions/trunk/code/admin/time.php
r2894473 r3017144 109 109 if ( 110 110 $tz_user 111 && $tz_user !== $this->timezone_wp111 //&& $tz_user !== $this->timezone_wp 112 112 ) { 113 113 global $pagenow; … … 124 124 add_filter( 'pre_option_gmt_offset', [ $this, 'gmt_offset' ], 99, 3 ); 125 125 126 //add_filter( 'get_post_time', [ $this, 'get_post_time' ], 99, 3 ); //Do not create a filter for this, it will cause CHAOS, don't even use the function 127 126 128 add_filter( 'get_the_date', [ $this, 'get_the_date' ], 99, 3 ); 127 129 130 add_filter( 'get_the_time', [ $this, 'get_the_time' ], 99, 3 ); 131 132 //add_filter( 'get_post_modified_time', [ $this, 'get_post_modified_time' ], 99, 3 ); //Do not create a filter for this, it will cause CHAOS, don't even use the function 133 134 add_filter( 'get_the_modified_date', [ $this, 'get_the_modified_date' ], 99, 3 ); 135 128 136 add_filter( 'get_the_modified_time', [ $this, 'get_the_modified_time' ], 99, 3 ); 129 137 130 add_filter( 'get_post_modified_time', [ $this, 'get_post_modified_time' ], 99, 3 ); 138 add_filter( 'post_date_column_status', [ $this, 'post_date_column_status' ], 99, 4 ); 139 140 add_filter( 'post_date_column_time', [ $this, 'post_date_column_time' ], 99, 4 ); 131 141 132 142 //TODO: cs - Add filters for other's e.g., users - 12/21/2016 10:59 PM … … 189 199 190 200 /** 191 * Use the logged in user's time zone, to adjust the time accordingly192 * 193 * @param $the_date194 * @param $format195 * @param $post196 * 197 * @return string 198 * @since 7.58 199 * @verified 20 19.02.11201 * Use the logged-in user's time zone, to adjust the time accordingly 202 * 203 * @param string|int $the_date Formatted date string or Unix timestamp if `$format` is 'U' or 'G'. 204 * @param string $format PHP date format. 205 * @param WP_Post $post The post object. 206 * 207 * @return string|int|false Date the current post was written. False on failure. 208 * @since 7.58 209 * @verified 2023.12.21 200 210 */ 201 211 function get_the_date( $the_date, $format, $post ) 202 212 { 203 if ( ! lct_is_wp_error( $post ) ) { 204 if ( ! $format ) { 205 $format = get_option( 'date_format' ); 206 } 207 208 209 if ( $not_gmt = get_date_from_gmt( $post->post_date_gmt, $format ) ) { 213 if ( $post ) { 214 $_format = ! empty( $format ) ? $format : get_option( 'date_format' ); 215 216 217 if ( $not_gmt = get_date_from_gmt( $post->post_date_gmt, $_format ) ) { 210 218 $the_date = $not_gmt; 211 219 } … … 218 226 219 227 /** 220 * Use the logged in user's time zone, to adjust the time accordingly 221 * 222 * @param $the_time 223 * @param $format 224 * @param $post 225 * 226 * @return string 227 * @since 7.58 228 * @verified 2018.10.08 228 * Use the logged-in user's time zone, to adjust the time accordingly 229 * 230 * @param string|int|false $the_time The formatted time or false if no post is found. 231 * @param string $format Format to use for retrieving the time the post 232 * was modified. Accepts 'G', 'U', or PHP date format. 233 * @param WP_Post|null $post WP_Post object or null if no post is found. 234 * 235 * @return string|int|false Formatted date string or Unix timestamp. False on failure. 236 * @since 7.58 237 * @verified 2023.12.21 229 238 */ 230 239 function get_the_modified_time( $the_time, $format, $post ) 231 240 { 232 if ( 233 ! $the_time 234 && ( $post = get_post( $post ) ) 235 && ! lct_is_wp_error( $post ) 236 ) { 237 if ( $format == '' ) { 238 $format = get_option( 'time_format' ); 239 } 240 241 242 $the_time = get_post_modified_time( $format, false, $post, true ); 241 if ( $post ) { 242 $_format = ! empty( $format ) ? $format : get_option( 'time_format' ); 243 244 245 if ( $not_gmt = get_date_from_gmt( $post->post_modified_gmt, $_format ) ) { 246 $the_time = $not_gmt; 247 } 243 248 } 244 249 … … 249 254 250 255 /** 251 * Use the logged in user's time zone, to adjust the time accordingly 256 * Use the logged-in user's time zone, to adjust the time accordingly 257 * //TODO: cs - Do not create a filter for this, it will cause CHAOS - 12/21/2023 2:42 PM 252 258 * 253 259 * @param $time … … 257 263 * @return string 258 264 * @since 7.58 259 * @verified 20 19.02.11265 * @verified 2023.12.19 260 266 */ 261 267 function get_post_modified_time( $time, $format, $gmt ) … … 263 269 if ( 264 270 ! $gmt 271 && ! lct_doing_api() 265 272 && ( $post = get_post() ) 266 273 && ! lct_is_wp_error( $post ) … … 279 286 return $time; 280 287 } 288 289 290 /** 291 * Use the logged-in user's time zone, to adjust the time accordingly 292 * 293 * @param string|int|false $the_time The formatted date or false if no post is found. 294 * @param string $format PHP date format. 295 * @param WP_Post|null $post WP_Post object or null if no post is found. 296 * 297 * @return string|int|false Date the current post was modified. False on failure. 298 * @date 2023.12.21 299 * @since 2023.04 300 * @verified 2023.12.21 301 */ 302 function get_the_modified_date( $the_time, $format, $post ) 303 { 304 if ( $post ) { 305 $_format = ! empty( $format ) ? $format : get_option( 'date_format' ); 306 307 308 if ( $not_gmt = get_date_from_gmt( $post->post_modified_gmt, $_format ) ) { 309 $the_time = $not_gmt; 310 } 311 } 312 313 314 return $the_time; 315 } 316 317 318 /** 319 * Use the logged-in user's time zone, to adjust the time accordingly 320 * 321 * @param string|int $the_time Formatted date string or Unix timestamp if `$format` is 'U' or 'G'. 322 * @param string $format Format to use for retrieving the time the post 323 * was written. Accepts 'G', 'U', or PHP date format. 324 * @param WP_Post $post Post object. 325 * 326 * @return string|int|false Formatted date string or Unix timestamp if `$format` is 'U' or 'G'. 327 * False on failure. 328 * @date 2023.12.21 329 * @since 2023.04 330 * @verified 2023.12.21 331 */ 332 function get_the_time( $the_time, $format, $post ) 333 { 334 if ( $post ) { 335 $_format = ! empty( $format ) ? $format : get_option( 'time_format' ); 336 337 338 if ( $not_gmt = get_date_from_gmt( $post->post_date_gmt, $_format ) ) { 339 $the_time = $not_gmt; 340 } 341 } 342 343 344 return $the_time; 345 } 346 347 348 /** 349 * Adjust for custom statuses 350 * 351 * @param string $status The status text. 352 * @param WP_Post $post Post object. 353 * @param string $column_name The column name. 354 * @param string $mode The list display mode ('excerpt' or 'list'). 355 * 356 * @return string 357 * @date 2023.12.21 358 * @since 2023.04 359 * @verified 2023.12.21 360 */ 361 function post_date_column_status( $status, $post, $column_name, $mode ) 362 { 363 if ( in_array( $post->post_status, [ 'publish', 'future' ] ) ) { 364 return $status; 365 } elseif ( $tmp = lct_get_status_obj_from_status_slug( $post->post_status ) ) { 366 return '<em>' . $tmp->name . '</em> as of'; 367 } 368 369 370 return $status; 371 } 372 373 374 /** 375 * Adjust for timezones 376 * 377 * @param string $t_time The published time. 378 * @param WP_Post $post Post object. 379 * @param string $column_name The column name. 380 * @param string $mode The list display mode ('excerpt' or 'list'). 381 * 382 * @return string 383 * @date 2023.12.21 384 * @since 2023.04 385 * @verified 2023.12.21 386 */ 387 function post_date_column_time( $t_time, $post, $column_name, $mode ) 388 { 389 $format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' ); 390 391 392 if ( in_array( $post->post_status, [ 'publish', 'future' ] ) ) { 393 return get_the_date( $format, $post ); 394 } else { 395 return get_the_modified_date( $format, $post ); 396 } 397 } 281 398 } -
lct-useful-shortcodes-functions/trunk/code/features/shortcodes/sort.php
r2894473 r3017144 543 543 544 544 if ( $post_id ) { 545 $a['r'] = get_ post_modified_time( $a['format'], false, $post_id );545 $a['r'] = get_the_modified_date( $a['format'], $post_id ); 546 546 } 547 547 -
lct-useful-shortcodes-functions/trunk/code/features/theme_chunk.php
r2991310 r3017144 429 429 } 430 430 } else { 431 $r['content'] = $this->theme_chunk( [ 'id' => $theme_chunk_id ] ); 431 $args = [ 'id' => $theme_chunk_id ]; 432 if ( in_array( $theme_chunk_id, [ 1533165 ] ) ) { //XBS 433 $args['dont_decode'] = true; 434 } 435 $r['content'] = $this->theme_chunk( $args ); 432 436 } 433 437 -
lct-useful-shortcodes-functions/trunk/code/plugins/acf/_admin.php
r2894473 r3017144 6 6 7 7 8 /** 9 * @property array args 10 * @property lct zxzp 11 * @verified 2016.11.28 12 */ 13 class lct_acf_admin 14 { 8 if ( ! class_exists( 'lct_acf_admin' ) ) : 9 10 15 11 /** 16 * Start up the class12 * lct_acf_admin 17 13 * 18 * @param $args 19 * 20 * @verified 2016.11.28 14 * @verified 2023.11.27 21 15 */ 22 function __construct( $args = [] )16 class lct_acf_admin 23 17 { 24 //Store $args 25 $this->args = $args; 26 27 28 //Store parent class, maybe 29 if ( $this->args['load_parent'] ) { 30 $this->zxzp = lct(); 31 } 32 33 34 //Setup WordPress action and filter hooks 35 $this->load_hooks(); 36 } 37 38 39 /** 40 * Setup WordPress action and filter hooks 41 * 42 * @since 7.39 43 * @verified 2017.06.08 44 */ 45 function load_hooks() 46 { 47 //bail early if already ran 48 if ( lct_did() ) { 49 return; 50 } 51 52 53 /** 54 * everytime 55 */ 56 /** 57 * actions 58 */ 59 add_action( 'init', [ $this, 'maintenance_mode' ], 6 ); 60 61 add_action( 'init', [ $this, 'lock_site_edits' ], 6 ); 62 63 add_action( 'init', [ $this, 'disable_connection_services' ] ); 64 65 add_action( 'acf/render_fields', [ $this, 'unset_new_post_setting' ] ); 66 67 68 /** 69 * filters 70 */ 71 add_filter( 'acf/location/rule_match/options_page', [ $this, 'register_rule_match_options_page' ], 10, 3 ); 72 73 add_filter( 'acf/location/rule_match/post_type', [ $this, 'register_rule_match_post_type' ], 999, 3 ); 74 75 add_filter( 'acf/location/rule_match/comment', [ $this, 'register_rule_match_comment' ], 999, 3 ); 76 77 add_filter( 'acf/location/rule_match/' . lct_org(), [ $this, 'register_rule_match_lct_org' ], 10, 3 ); 78 79 add_filter( 'acf/validate_form', [ $this, 'set_new_post_setting' ] ); 80 81 add_filter( 'acf/fields/post_object/query', [ $this, 'update_status_filter' ], 10, 3 ); 82 83 add_filter( 'acf/fields/post_object/query', [ $this, 'update_posts_per_page' ], 10, 3 ); 84 85 add_filter( 'acf/prepare_field_group_for_export', [ $this, 'add_menu_order_to_fields' ] ); 86 87 add_filter( 'acf/acf_get_hidden_input/attrs', [ $this, 'unique_id' ] ); 88 89 90 if ( lct_frontend() ) { 18 /** 19 * __construct 20 * This function will set up the class functionality 21 * 22 * @verified 2023.11.27 23 */ 24 function __construct() 25 { 26 /** 27 * Setup WordPress action and filter hooks 28 */ 29 $this->load_hooks(); 30 } 31 32 33 /** 34 * load_hooks 35 * Setup WordPress action and filter hooks 36 * 37 * @since 7.39 38 * @verified 2017.06.08 39 */ 40 function load_hooks() 41 { 42 //bail early if already ran 43 if ( lct_did() ) { 44 return; 45 } 46 47 48 /** 49 * everytime 50 */ 91 51 /** 92 52 * actions 93 53 */ 94 add_action( 'wp_enqueue_scripts', [ $this, 'wp_enqueue_styles' ] ); 95 add_action( 'wp_enqueue_scripts', [ $this, 'wp_enqueue_scripts' ] ); 96 add_action( 'wp_enqueue_scripts', [ $this, 'always_load_google_fonts' ] ); 97 add_action( 'wp_enqueue_scripts', [ $this, 'always_load_typekit' ] ); 98 99 add_action( 'lct_acf_single_load_google_fonts', [ $this, 'single_load_google_fonts' ], 10, 1 ); 100 101 add_action( 'lct_acf_single_load_typekit', [ $this, 'single_load_typekit' ], 10, 1 ); 102 103 add_action( 'wp_footer', [ $this, 'wp_footer_get_user_agent_info' ], 99999 ); 104 105 add_action( 'acf/fields/google_map/api', [ $this, 'set_google_map_api' ] ); 106 107 add_action( 'get_header', [ $this, 'acf_form_head' ] ); 108 109 add_action( 'lct_get_user_agent_info', [ $this, 'get_user_agent_info' ], 10, 2 ); 54 add_action( 'init', [ $this, 'maintenance_mode' ], 6 ); 55 56 add_action( 'init', [ $this, 'lock_site_edits' ], 6 ); 57 58 add_action( 'init', [ $this, 'disable_connection_services' ] ); 59 60 add_action( 'acf/render_fields', [ $this, 'unset_new_post_setting' ] ); 110 61 111 62 … … 113 64 * filters 114 65 */ 115 add_filter( 'script_loader_src', [ $this, 'remove_script_version' ], 15, 1 ); 116 117 add_filter( 'style_loader_src', [ $this, 'remove_script_version' ], 15, 1 ); 118 119 add_filter( 'show_admin_bar', [ $this, 'show_admin_bar' ], 11 ); 120 121 add_filter( 'avada_blog_read_more_excerpt', [ $this, 'avada_blog_read_more_excerpt' ] ); 122 } 123 124 125 //if ( lct_wp_admin_all() ) {} 126 127 128 if ( lct_wp_admin_non_ajax() ) { 129 /** 130 * actions 131 */ 132 add_action( 'admin_enqueue_scripts', [ $this, 'admin_enqueue_styles' ] ); 133 134 //load-{$pagenow} 135 add_action( 'load-update-core.php', [ $this, 'activate_license' ] ); 136 add_action( 'load-custom-fields_page_acf-settings-updates', [ $this, 'activate_license' ] ); 137 138 add_action( 'acf/update_field_group', [ $this, 'import_cleanup' ] ); 139 } 140 141 142 if ( lct_ajax_only() ) { 143 add_action( 'init', [ $this, 'set_force_yes_fields' ] ); 144 } 145 } 146 147 148 /** 149 * Set the google_map API for ACF with our saved value if it exists 150 * 151 * @param $api 152 * 153 * @return mixed 154 * @since 7.49 155 * @verified 2018.08.30 156 */ 157 function set_google_map_api( $api ) 158 { 159 if ( 160 ! $api['key'] 161 && ( $saved_api = lct_acf_get_option_raw( 'google_map_api' ) ) 66 add_filter( 'acf/location/rule_match/options_page', [ $this, 'register_rule_match_options_page' ], 10, 3 ); 67 68 add_filter( 'acf/location/rule_match/post_type', [ $this, 'register_rule_match_post_type' ], 999, 3 ); 69 70 add_filter( 'acf/location/rule_match/comment', [ $this, 'register_rule_match_comment' ], 999, 3 ); 71 72 add_filter( 'acf/location/rule_match/' . lct_org(), [ $this, 'register_rule_match_lct_org' ], 10, 3 ); 73 74 add_filter( 'acf/validate_form', [ $this, 'set_new_post_setting' ] ); 75 76 add_filter( 'acf/fields/post_object/query', [ $this, 'update_status_filter' ], 10, 3 ); 77 78 add_filter( 'acf/fields/post_object/query', [ $this, 'update_posts_per_page' ], 10, 3 ); 79 80 add_filter( 'acf/prepare_field_group_for_export', [ $this, 'add_menu_order_to_fields' ] ); 81 82 add_filter( 'acf/acf_get_hidden_input/attrs', [ $this, 'unique_id' ] ); 83 84 85 if ( lct_frontend() ) { 86 /** 87 * actions 88 */ 89 add_action( 'wp_enqueue_scripts', [ $this, 'wp_enqueue_styles' ] ); 90 add_action( 'wp_enqueue_scripts', [ $this, 'wp_enqueue_scripts' ] ); 91 add_action( 'wp_enqueue_scripts', [ $this, 'always_load_google_fonts' ] ); 92 add_action( 'wp_enqueue_scripts', [ $this, 'always_load_typekit' ] ); 93 94 add_action( 'lct_acf_single_load_google_fonts', [ $this, 'single_load_google_fonts' ], 10, 1 ); 95 96 add_action( 'lct_acf_single_load_typekit', [ $this, 'single_load_typekit' ], 10, 1 ); 97 98 add_action( 'wp_footer', [ $this, 'wp_footer_get_user_agent_info' ], 99999 ); 99 100 add_action( 'acf/fields/google_map/api', [ $this, 'set_google_map_api' ] ); 101 102 add_action( 'get_header', [ $this, 'acf_form_head' ] ); 103 104 add_action( 'lct_get_user_agent_info', [ $this, 'get_user_agent_info' ], 10, 2 ); 105 106 107 /** 108 * filters 109 */ 110 add_filter( 'script_loader_src', [ $this, 'remove_script_version' ], 15, 1 ); 111 112 add_filter( 'style_loader_src', [ $this, 'remove_script_version' ], 15, 1 ); 113 114 add_filter( 'show_admin_bar', [ $this, 'show_admin_bar' ], 11 ); 115 116 add_filter( 'avada_blog_read_more_excerpt', [ $this, 'avada_blog_read_more_excerpt' ] ); 117 } 118 119 120 //if ( lct_wp_admin_all() ) {} 121 122 123 if ( lct_wp_admin_non_ajax() ) { 124 /** 125 * actions 126 */ 127 add_action( 'admin_enqueue_scripts', [ $this, 'admin_enqueue_styles' ] ); 128 129 //load-{$pagenow} 130 add_action( 'load-update-core.php', [ $this, 'activate_license' ] ); 131 add_action( 'load-custom-fields_page_acf-settings-updates', [ $this, 'activate_license' ] ); 132 133 add_action( 'acf/update_field_group', [ $this, 'import_cleanup' ] ); 134 } 135 136 137 if ( lct_ajax_only() ) { 138 add_action( 'init', [ $this, 'set_force_yes_fields' ] ); 139 } 140 } 141 142 143 /** 144 * Set the google_map API for ACF with our saved value if it exists 145 * 146 * @param $api 147 * 148 * @return mixed 149 * @since 7.49 150 * @verified 2018.08.30 151 */ 152 function set_google_map_api( $api ) 153 { 154 if ( 155 ! $api['key'] 156 && ( $saved_api = lct_acf_get_option_raw( 'google_map_api' ) ) 157 ) { 158 $api['key'] = $saved_api; 159 } 160 161 162 return $api; 163 } 164 165 166 /** 167 * Load our custom fields 168 * 169 * @since 7.53 170 * @verified 2017.01.16 171 */ 172 function set_force_yes_fields() 173 { 174 if ( 175 ( $tmp = zxzacf( 'field_key' ) ) 176 && isset( $_POST[ $tmp ] ) 177 && strpos( $_POST[ $tmp ], 'force_yes_field' ) !== false 178 ) { 179 $fields = lct_get_option( 'force_yes_fields' ); 180 181 182 if ( $fields ) { 183 foreach ( $fields as $field ) { 184 acf_add_local_field( $field ); 185 } 186 } 187 } 188 } 189 190 191 /** 192 * Strip out the ver query var that shows the WP version, on all enqueued scripts and styles 193 * 194 * @param $src 195 * 196 * @return mixed 197 * @since 7.50 198 * @verified 2018.08.30 199 */ 200 function remove_script_version( $src ) 201 { 202 $type = str_replace( '_loader_src', '', current_filter() ); 203 204 205 /** 206 * Remove the version var from the URL 207 */ 208 if ( lct_acf_get_option_raw( 'remove_script_version_' . $type ) ) { 209 $url_parts = parse_url( $src ); 210 211 212 if ( ! empty( $url_parts['query'] ) ) { 213 $vars = parse_query( $url_parts['query'] ); 214 215 if ( isset( $vars['ver'] ) ) { 216 unset( $vars['ver'] ); 217 } 218 219 220 $url_parts['query'] = unparse_query( $vars ); 221 222 if ( empty( $url_parts['query'] ) ) { 223 unset ( $url_parts['query'] ); 224 } 225 } 226 227 228 $src = unparse_url( $url_parts ); 229 } 230 231 232 return $src; 233 } 234 235 236 /** 237 * If we set the options_page arg to true we want to force a match 238 * 239 * @param $match 240 * @param $rule 241 * @param $screen 242 * 243 * @return bool 244 * @since 7.50 245 * @verified 2019.04.01 246 */ 247 function register_rule_match_options_page( 248 $match, 249 /** @noinspection PhpUnusedParameterInspection */ 250 $rule, 251 $screen 162 252 ) { 163 $api['key'] = $saved_api; 164 } 165 166 167 return $api; 168 } 169 170 171 /** 172 * Load our custom fields 173 * 174 * @since 7.53 175 * @verified 2017.01.16 176 */ 177 function set_force_yes_fields() 178 { 179 if ( 180 ( $tmp = zxzacf( 'field_key' ) ) 181 && isset( $_POST[ $tmp ] ) 182 && strpos( $_POST[ $tmp ], 'force_yes_field' ) !== false 183 ) { 184 $fields = lct_get_option( 'force_yes_fields' ); 185 186 187 if ( $fields ) { 188 foreach ( $fields as $field ) { 189 acf_add_local_field( $field ); 190 } 191 } 192 } 193 } 194 195 196 /** 197 * Strip out the ver query var that shows the WP version, on all enqueued scripts and styles 198 * 199 * @param $src 200 * 201 * @return mixed 202 * @since 7.50 203 * @verified 2018.08.30 204 */ 205 function remove_script_version( $src ) 206 { 207 $type = str_replace( '_loader_src', '', current_filter() ); 208 209 210 /** 211 * Remove the version var from the URL 212 */ 213 if ( lct_acf_get_option_raw( 'remove_script_version_' . $type ) ) { 214 $url_parts = parse_url( $src ); 215 216 217 if ( ! empty( $url_parts['query'] ) ) { 218 $vars = parse_query( $url_parts['query'] ); 219 220 if ( isset( $vars['ver'] ) ) { 221 unset( $vars['ver'] ); 222 } 223 224 225 $url_parts['query'] = unparse_query( $vars ); 226 227 if ( empty( $url_parts['query'] ) ) { 228 unset ( $url_parts['query'] ); 229 } 230 } 231 232 233 $src = unparse_url( $url_parts ); 234 } 235 236 237 return $src; 238 } 239 240 241 /** 242 * If we set the options_page arg to true we want to force a match 243 * 244 * @param $match 245 * @param $rule 246 * @param $screen 247 * 248 * @return bool 249 * @since 7.50 250 * @verified 2019.04.01 251 */ 252 function register_rule_match_options_page( 253 $match, 254 /** @noinspection PhpUnusedParameterInspection */ 255 $rule, 256 $screen 257 ) { 258 if ( 259 isset( $screen['options_page'] ) 260 && $screen['options_page'] === true 261 ) { 262 $match = true; 263 264 265 //This is to fix a bug when you are on an options page 266 } elseif ( 267 $match === true 268 && ! isset( $screen['options_page'] ) 269 ) { 270 $match = false; 271 } 272 273 274 return $match; 275 } 276 277 278 /** 279 * If we set the options_page arg to true we want to force a match 280 * 281 * @param $match 282 * @param $rule 283 * @param $screen 284 * 285 * @return bool 286 * @since 2019.8 287 * @verified 2019.04.10 288 */ 289 function register_rule_match_post_type( $match, $rule, $screen ) 290 { 291 if ( 292 ! isset( $screen['param'] ) 293 || $screen['param'] !== 'comment' 294 || ! isset( $screen['post_type'] ) 295 || ! isset( $rule['value'] ) 296 || $screen['post_type'] !== $rule['value'] 297 ) { 253 if ( 254 isset( $screen['options_page'] ) 255 && $screen['options_page'] === true 256 ) { 257 $match = true; 258 259 260 //This is to fix a bug when you are on an options page 261 } elseif ( 262 $match === true 263 && ! isset( $screen['options_page'] ) 264 ) { 265 $match = false; 266 } 267 268 298 269 return $match; 299 270 } 300 271 301 272 302 if (303 $match === true304 && isset( $rule['param'] )305 && $rule['param'] !== 'comment'306 ) {307 $match = false;308 }309 310 311 return $match;312 }313 314 315 /**316 * If we set the options_page arg to true we want to force a match317 *318 * @param $match319 * @param $rule320 * @param $screen321 *322 * @return bool323 * @since 2019.8324 * @verified 2019.04.10 325 */ 326 function register_rule_match_comment( $match, $rule, $screen )327 {328 if (329 ! isset( $screen['param'] )330 || $screen['param'] !== 'comment'331 || ! isset( $screen['post_type'] )332 || ! isset( $rule['value'] )333 || $screen['post_type'] !== $rule['value'] 334 ) { 273 /** 274 * If we set the options_page arg to true we want to force a match 275 * 276 * @param $match 277 * @param $rule 278 * @param $screen 279 * 280 * @return bool 281 * @since 2019.8 282 * @verified 2019.04.10 283 */ 284 function register_rule_match_post_type( $match, $rule, $screen ) 285 { 286 if ( 287 ! isset( $screen['param'] ) 288 || $screen['param'] !== 'comment' 289 || ! isset( $screen['post_type'] ) 290 || ! isset( $rule['value'] ) 291 || $screen['post_type'] !== $rule['value'] 292 ) { 293 return $match; 294 } 295 296 297 if ( 298 $match === true 299 && isset( $rule['param'] ) 300 && $rule['param'] !== 'comment' 301 ) { 302 $match = false; 303 } 304 305 335 306 return $match; 336 307 } 337 308 338 309 339 if ( 340 ! $match 341 && isset( $rule['param'] ) 342 && $rule['param'] === 'comment' 343 ) { 344 $match = true; 345 } 346 347 348 return $match; 349 } 350 351 352 /** 353 * Activate our ACF license, but only if we are allowed to 354 * 355 * @since 7.54 356 * @verified 2022.01.06 357 */ 358 function activate_license() 359 { 360 $url = lct_url_site(); 361 $license = acf_pro_get_license(); 362 363 364 /** 365 * We have a key saved but for the wrong URL 366 */ 367 if ( 368 isset( $license['key'] ) 369 && $license['url'] !== $url 370 ) { 371 $url = lct_get_api_url( 'acf_key.php?key=' . lct_acf_get_option_raw( 'api' ) ); 372 373 374 if ( $acf_key = file_get_contents( $url ) ) { 375 $_POST['acf_pro_licence'] = $acf_key; 376 } else { 377 $_POST['acf_pro_licence'] = $license['key']; 378 } 379 380 381 delete_option( 'acf_pro_license' ); 382 383 384 if ( version_compare( lct_plugin_version( 'acf' ), '5.11', '<' ) ) { //ACF older than v5.11 385 $acf = new ACF_Admin_Updates(); 386 $acf->activate_pro_licence(); 387 } else { 388 acf_pro_activate_license( $license['key'], true ); 389 } 390 391 392 /** 393 * Nothing is saved yet 394 */ 395 } elseif ( ! $license ) { 396 $url = lct_get_api_url( 'acf_key.php?key=' . lct_acf_get_option_raw( 'api' ) ); 397 398 399 if ( $acf_key = file_get_contents( $url ) ) { 400 $_POST['acf_pro_licence'] = $acf_key; 310 /** 311 * If we set the options_page arg to true we want to force a match 312 * 313 * @param $match 314 * @param $rule 315 * @param $screen 316 * 317 * @return bool 318 * @since 2019.8 319 * @verified 2019.04.10 320 */ 321 function register_rule_match_comment( $match, $rule, $screen ) 322 { 323 if ( 324 ! isset( $screen['param'] ) 325 || $screen['param'] !== 'comment' 326 || ! isset( $screen['post_type'] ) 327 || ! isset( $rule['value'] ) 328 || $screen['post_type'] !== $rule['value'] 329 ) { 330 return $match; 331 } 332 333 334 if ( 335 ! $match 336 && isset( $rule['param'] ) 337 && $rule['param'] === 'comment' 338 ) { 339 $match = true; 340 } 341 342 343 return $match; 344 } 345 346 347 /** 348 * Activate our ACF license, but only if we are allowed to 349 * 350 * @since 7.54 351 * @verified 2022.01.06 352 */ 353 function activate_license() 354 { 355 $url = lct_url_site(); 356 $license = acf_pro_get_license(); 357 358 359 /** 360 * We have a key saved but for the wrong URL 361 */ 362 if ( 363 isset( $license['key'] ) 364 && $license['url'] !== $url 365 ) { 366 $url = lct_get_api_url( 'acf_key.php?key=' . lct_acf_get_option_raw( 'api' ) ); 367 368 369 if ( $acf_key = file_get_contents( $url ) ) { 370 $_POST['acf_pro_licence'] = $acf_key; 371 } else { 372 $_POST['acf_pro_licence'] = $license['key']; 373 } 374 375 376 delete_option( 'acf_pro_license' ); 401 377 402 378 … … 405 381 $acf->activate_pro_licence(); 406 382 } else { 407 acf_pro_activate_license( $acf_key, true ); 408 } 409 } 410 } 411 } 412 413 414 /** 415 * Register Styles 416 * 417 * @since 0.0 418 * @verified 2018.08.30 419 */ 420 function wp_enqueue_styles() 421 { 422 $post_id = lct_get_post_id(); 423 424 425 /** 426 * The old front CSS 427 */ 428 if ( lct_acf_get_option_raw( 'enable_front_css' ) ) { 429 lct_enqueue_style( zxzu( 'front' ), lct_get_root_url( 'assets/css/front.min.css' ) ); 430 } 431 432 433 /** 434 * The main CSS 435 */ 436 lct_enqueue_style( zxzu( 'acf' ), lct_get_root_url( 'assets/css/plugins/acf/main.min.css' ) ); 437 438 439 /** 440 * Media specific CSS 441 */ 442 switch ( lct_acf_get_option_raw( 'tablet_threshold' ) ) { 443 case '800': 444 lct_enqueue_style( zxzu( 'acf_media' ), lct_get_root_url( 'assets/css/plugins/acf/main-media-tablet-800.min.css' ) ); 445 break; 446 447 448 case '1024': 449 lct_enqueue_style( zxzu( 'acf_media' ), lct_get_root_url( 'assets/css/plugins/acf/main-media-tablet-1024.min.css' ) ); 450 break; 451 452 453 default: 454 } 455 456 457 /** 458 * #3 459 * Inline CSS 460 * 461 * @date 0.0 383 acf_pro_activate_license( $license['key'], true ); 384 } 385 386 387 /** 388 * Nothing is saved yet 389 */ 390 } elseif ( ! $license ) { 391 $url = lct_get_api_url( 'acf_key.php?key=' . lct_acf_get_option_raw( 'api' ) ); 392 393 394 if ( $acf_key = file_get_contents( $url ) ) { 395 $_POST['acf_pro_licence'] = $acf_key; 396 397 398 if ( version_compare( lct_plugin_version( 'acf' ), '5.11', '<' ) ) { //ACF older than v5.11 399 $acf = new ACF_Admin_Updates(); 400 $acf->activate_pro_licence(); 401 } else { 402 acf_pro_activate_license( $acf_key, true ); 403 } 404 } 405 } 406 } 407 408 409 /** 410 * Register Styles 411 * 462 412 * @since 0.0 463 * @verified 2021.08.27 464 */ 465 do_action( 'lct_wp_footer_style_add', '.acf-field textarea{min-height: 50px;}' ); 466 467 468 /** 469 * Any user added custom CSS files 470 */ 471 if ( 472 get_post_meta( $post_id, zxzacf( 'is_css_file' ), true ) 473 && //Don't use get_field() 474 ( $files = get_field( zxzacf( 'css_files' ), $post_id ) ) 475 ) { 476 foreach ( $files as $file ) { 477 if ( file_exists( lct_path_theme( '/custom/css/' . $file ) ) ) { 478 lct_enqueue_style( zxzu( 'css_files_' . sanitize_title( $file ) ), lct_url_theme( '/custom/css/' . $file ), false, [], lct_active_theme_version() ); 479 } 480 } 481 } 482 } 483 484 485 /** 486 * Register Scripts 487 * 488 * @since 0.0 489 * @verified 2019.02.14 490 */ 491 function wp_enqueue_scripts() 492 { 493 $post_id = lct_get_post_id(); 494 495 496 /** 497 * Add textarea autosize to acf 498 */ 499 $jq = 'jQuery( \'body\' ).on( \'focus\', \'.acf-field textarea\', function( e ) { 413 * @verified 2018.08.30 414 */ 415 function wp_enqueue_styles() 416 { 417 $post_id = lct_get_post_id(); 418 419 420 /** 421 * The old front CSS 422 */ 423 if ( lct_acf_get_option_raw( 'enable_front_css' ) ) { 424 lct_enqueue_style( zxzu( 'front' ), lct_get_root_url( 'assets/css/front.min.css' ) ); 425 } 426 427 428 /** 429 * The main CSS 430 */ 431 lct_enqueue_style( zxzu( 'acf' ), lct_get_root_url( 'assets/css/plugins/acf/main.min.css' ) ); 432 433 434 /** 435 * Media specific CSS 436 */ 437 switch ( lct_acf_get_option_raw( 'tablet_threshold' ) ) { 438 case '800': 439 lct_enqueue_style( zxzu( 'acf_media' ), lct_get_root_url( 'assets/css/plugins/acf/main-media-tablet-800.min.css' ) ); 440 break; 441 442 443 case '1024': 444 lct_enqueue_style( zxzu( 'acf_media' ), lct_get_root_url( 'assets/css/plugins/acf/main-media-tablet-1024.min.css' ) ); 445 break; 446 447 448 default: 449 } 450 451 452 /** 453 * #3 454 * Inline CSS 455 * 456 * @date 0.0 457 * @since 0.0 458 * @verified 2021.08.27 459 */ 460 do_action( 'lct_wp_footer_style_add', '.acf-field textarea{min-height: 50px;}' ); 461 462 463 /** 464 * Any user added custom CSS files 465 */ 466 if ( 467 get_post_meta( $post_id, zxzacf( 'is_css_file' ), true ) 468 && //Don't use get_field() 469 ( $files = get_field( zxzacf( 'css_files' ), $post_id ) ) 470 ) { 471 foreach ( $files as $file ) { 472 if ( file_exists( lct_path_theme( '/custom/css/' . $file ) ) ) { 473 lct_enqueue_style( zxzu( 'css_files_' . sanitize_title( $file ) ), lct_url_theme( '/custom/css/' . $file ), false, [], lct_active_theme_version() ); 474 } 475 } 476 } 477 } 478 479 480 /** 481 * Register Scripts 482 * 483 * @since 0.0 484 * @verified 2019.02.14 485 */ 486 function wp_enqueue_scripts() 487 { 488 $post_id = lct_get_post_id(); 489 490 491 /** 492 * Add textarea autosize to acf 493 */ 494 $jq = 'jQuery( \'body\' ).on( \'focus\', \'.acf-field textarea\', function( e ) { 500 495 autosize( jQuery( e.target ) ); 501 496 } );'; 502 497 503 498 504 /** 505 * If you want to update size on page load 506 */ 507 /* 508 $jq = 'jQuery( \'textarea\' ).each( function( e ) { 509 autosize( jQuery( this ) ); 510 } );'; 511 */ 512 513 514 /** 515 * #1 516 * @date 0.0 499 /** 500 * If you want to update size on page load 501 */ 502 /* 503 $jq = 'jQuery( \'textarea\' ).each( function( e ) { 504 autosize( jQuery( this ) ); 505 } );'; 506 */ 507 508 509 /** 510 * #1 511 * @date 0.0 512 * @since 0.0 513 * @verified 2021.08.27 514 */ 515 do_action( 'lct_jq_autosize' ); 516 517 518 /** 519 * #5 520 * @date 0.0 521 * @since 0.0 522 * @verified 2021.08.27 523 */ 524 do_action( 'lct_jq_doc_ready_add', $jq ); 525 526 527 /** 528 * Any user added custom JS files 529 */ 530 if ( 531 get_post_meta( $post_id, zxzacf( 'is_js_file' ), true ) 532 && //Don't use get_field() 533 ( $files = get_field( zxzacf( 'js_files' ), $post_id ) ) 534 ) { 535 foreach ( $files as $file ) { 536 if ( file_exists( lct_path_theme( '/custom/js/' . $file ) ) ) { 537 lct_enqueue_script( zxzu( 'js_files_' . sanitize_title( $file ) ), lct_url_theme( '/custom/js/' . $file ), false, [ 'jquery' ], lct_active_theme_version() ); 538 } 539 } 540 } 541 } 542 543 544 /** 545 * ADD Google Font stylesheets 546 * 547 * @since 5.40 548 * @verified 2018.08.24 549 */ 550 function always_load_google_fonts() 551 { 552 if ( lct_acf_option_repeater_empty( zxzacf( 'load_google_fonts' ) ) ) { 553 $row = 1; 554 555 556 while( have_rows( zxzacf( 'load_google_fonts' ), lct_o() ) ) { 557 the_row(); 558 559 560 wp_register_style( zxzu( 'gfont-' . $row ), '//fonts.googleapis.com/css?family=' . str_replace( ' ', '+', get_sub_field( 'name' ) ) . get_sub_field( 'additional' ), [], lct_get_setting( 'version' ) ); 561 562 if ( get_sub_field( 'always_load' ) ) { 563 wp_enqueue_style( zxzu( 'gfont-' . $row ) ); 564 } 565 566 567 $row ++; 568 } 569 } 570 } 571 572 573 /** 574 * ADD Adobe Typekit script 575 * 576 * @since 5.40 577 * @verified 2018.08.24 578 */ 579 function always_load_typekit() 580 { 581 if ( lct_acf_option_repeater_empty( zxzacf( 'load_typekit' ) ) ) { 582 $row = 1; 583 584 585 while( have_rows( zxzacf( 'load_typekit' ), lct_o() ) ) { 586 the_row(); 587 588 589 wp_register_script( zxzu( 'typekit-' . $row ), 'https://use.typekit.net/' . get_sub_field( 'name' ) . '.js', [], lct_get_setting( 'version' ) ); 590 591 if ( get_sub_field( 'always_load' ) ) { 592 wp_enqueue_script( zxzu( 'typekit-' . $row ) ); 593 } 594 595 596 $row ++; 597 } 598 599 600 lct_enqueue_script( zxzu( 'typekit-' . $row ), 'try{Typekit.load({ async: true });}catch(e){};' ); 601 } 602 } 603 604 605 /** 606 * ADD a single Google Font stylesheet 607 * 608 * @param $font_id 609 * 610 * @since 5.40 611 * @verified 2016.09.29 612 */ 613 function single_load_google_fonts( $font_id ) 614 { 615 wp_print_styles( zxzu( 'gfont-' . $font_id ) ); 616 } 617 618 619 /** 620 * ADD a single Adobe Typekit script 621 * 622 * @param $font_id 623 * 624 * @since 5.40 625 * @verified 2016.09.29 626 */ 627 function single_load_typekit( $font_id ) 628 { 629 wp_print_scripts( zxzu( 'typekit-' . $font_id ) ); 630 wp_add_inline_script( zxzu( 'typekit-' . $font_id ), 'try{Typekit.load({ async: true });}catch(e){}' ); 631 } 632 633 634 /** 635 * Add some stuff to wp_footer action 636 * 517 637 * @since 0.0 518 * @verified 2021.08.27 519 */ 520 do_action( 'lct_jq_autosize' ); 521 522 523 /** 524 * #5 525 * @date 0.0 638 * @verified 2018.08.30 639 */ 640 function wp_footer_get_user_agent_info() 641 { 642 if ( lct_acf_get_option_raw( 'print_user_agent_in_footer' ) ) /** 643 * @date 0.0 644 * @since 0.0 645 * @verified 2021.08.30 646 */ { 647 do_action( 'lct_get_user_agent_info', true, true ); 648 } 649 } 650 651 652 /** 653 * Register Styles 654 * 526 655 * @since 0.0 527 * @verified 2021.08.27 528 */ 529 do_action( 'lct_jq_doc_ready_add', $jq ); 530 531 532 /** 533 * Any user added custom JS files 534 */ 535 if ( 536 get_post_meta( $post_id, zxzacf( 'is_js_file' ), true ) 537 && //Don't use get_field() 538 ( $files = get_field( zxzacf( 'js_files' ), $post_id ) ) 539 ) { 540 foreach ( $files as $file ) { 541 if ( file_exists( lct_path_theme( '/custom/js/' . $file ) ) ) { 542 lct_enqueue_script( zxzu( 'js_files_' . sanitize_title( $file ) ), lct_url_theme( '/custom/js/' . $file ), false, [ 'jquery' ], lct_active_theme_version() ); 543 } 544 } 545 } 546 } 547 548 549 /** 550 * ADD Google Font stylesheets 551 * 552 * @since 5.40 553 * @verified 2018.08.24 554 */ 555 function always_load_google_fonts() 556 { 557 if ( lct_acf_option_repeater_empty( zxzacf( 'load_google_fonts' ) ) ) { 558 $row = 1; 559 560 561 while( have_rows( zxzacf( 'load_google_fonts' ), lct_o() ) ) { 562 the_row(); 563 564 565 wp_register_style( zxzu( 'gfont-' . $row ), '//fonts.googleapis.com/css?family=' . str_replace( ' ', '+', get_sub_field( 'name' ) ) . get_sub_field( 'additional' ), [], lct_get_setting( 'version' ) ); 566 567 if ( get_sub_field( 'always_load' ) ) { 568 wp_enqueue_style( zxzu( 'gfont-' . $row ) ); 569 } 570 571 572 $row ++; 573 } 574 } 575 } 576 577 578 /** 579 * ADD Adobe Typekit script 580 * 581 * @since 5.40 582 * @verified 2018.08.24 583 */ 584 function always_load_typekit() 585 { 586 if ( lct_acf_option_repeater_empty( zxzacf( 'load_typekit' ) ) ) { 587 $row = 1; 588 589 590 while( have_rows( zxzacf( 'load_typekit' ), lct_o() ) ) { 591 the_row(); 592 593 594 wp_register_script( zxzu( 'typekit-' . $row ), 'https://use.typekit.net/' . get_sub_field( 'name' ) . '.js', [], lct_get_setting( 'version' ) ); 595 596 if ( get_sub_field( 'always_load' ) ) { 597 wp_enqueue_script( zxzu( 'typekit-' . $row ) ); 598 } 599 600 601 $row ++; 602 } 603 604 605 lct_enqueue_script( zxzu( 'typekit-' . $row ), 'try{Typekit.load({ async: true });}catch(e){};' ); 606 } 607 } 608 609 610 /** 611 * ADD a single Google Font stylesheet 612 * 613 * @param $font_id 614 * 615 * @since 5.40 616 * @verified 2016.09.29 617 */ 618 function single_load_google_fonts( $font_id ) 619 { 620 wp_print_styles( zxzu( 'gfont-' . $font_id ) ); 621 } 622 623 624 /** 625 * ADD a single Adobe Typekit script 626 * 627 * @param $font_id 628 * 629 * @since 5.40 630 * @verified 2016.09.29 631 */ 632 function single_load_typekit( $font_id ) 633 { 634 wp_print_scripts( zxzu( 'typekit-' . $font_id ) ); 635 wp_add_inline_script( zxzu( 'typekit-' . $font_id ), 'try{Typekit.load({ async: true });}catch(e){}' ); 636 } 637 638 639 /** 640 * Add some stuff to wp_footer action 641 * 642 * @since 0.0 643 * @verified 2018.08.30 644 */ 645 function wp_footer_get_user_agent_info() 646 { 647 if ( lct_acf_get_option_raw( 'print_user_agent_in_footer' ) ) /** 648 * @date 0.0 649 * @since 0.0 650 * @verified 2021.08.30 651 */ { 652 do_action( 'lct_get_user_agent_info', true, true ); 653 } 654 } 655 656 657 /** 658 * Register Styles 659 * 660 * @since 0.0 661 * @verified 2016.09.29 662 */ 663 function admin_enqueue_styles() 664 { 665 lct_admin_enqueue_style( zxzu( 'acf' ), lct_get_root_url( 'assets/wp-admin/css/plugins/acf/main.min.css' ) ); 666 } 667 668 669 /** 670 * Help out our iframe by 'auto' loading this 671 * 672 * @since 2017.6 673 * @verified 2017.02.02 674 */ 675 function acf_form_head() 676 { 677 if ( 678 isset( $_GET['acf_form_head'] ) 679 && $_GET['acf_form_head'] 680 ) { 681 acf_form_head(); 682 } 683 } 684 685 686 /** 687 * This will put the site in maintenance mode, when we check an ACF setting 688 * 689 * @since 7.16 690 * @verified 2018.08.30 691 */ 692 function maintenance_mode() 693 { 694 if ( $maintenance_mode = lct_acf_get_option_raw( 'maintenance_mode' ) ) { 695 add_action( 'admin_bar_menu', [ $this, 'maintenance_mode_in_admin_bar_menu' ], 999999 ); 696 } 697 698 699 if ( 700 $maintenance_mode 701 && ! lct_doing() 702 && ! is_admin() 703 && ! lct_is_user_a_dev() 704 ) { 705 echo '<h1 style="text-align: center;">Site is down for maintenance. Please check back in a few minutes.</h1>'; 706 exit; 707 } 708 } 709 710 711 /** 712 * Added a note about the site being in maintenance mode into the wp_admin_bar 713 * 714 * @param WP_Admin_Bar $wp_admin_bar 715 * 716 * @since 7.16 717 * @verified 2018.08.27 718 * @noinspection PhpMissingParamTypeInspection 719 */ 720 function maintenance_mode_in_admin_bar_menu( $wp_admin_bar ) 721 { 722 $args = [ 723 'id' => lct_pre_us( zxzu( 'maintenance_mode' ) ), 724 'title' => '<span style="color:#FF0000 !important;">' . zxzb( ' Maintenance On' ) . '</span>', 725 ]; 726 727 728 $wp_admin_bar->add_menu( $args ); 729 } 730 731 732 /** 733 * This will prevent people from accessing the wp-admin back-end while this ACF setting is active 734 * 735 * @since 2017.18 736 * @verified 2018.08.30 737 */ 738 function lock_site_edits() 739 { 740 if ( $lock_site = lct_acf_get_option_raw( 'lock_site_edits' ) ) { 741 add_action( 'admin_bar_menu', [ $this, 'lock_site_edits_in_admin_bar_menu' ], 999999 ); 742 } 743 744 745 if ( 746 $lock_site 747 && ! lct_doing() 748 && is_admin() 749 && is_user_logged_in() 750 ) { 751 $allowed = false; 656 * @verified 2016.09.29 657 */ 658 function admin_enqueue_styles() 659 { 660 lct_admin_enqueue_style( zxzu( 'acf' ), lct_get_root_url( 'assets/wp-admin/css/plugins/acf/main.min.css' ) ); 661 } 662 663 664 /** 665 * Help out our iframe by 'auto' loading this 666 * 667 * @since 2017.6 668 * @verified 2017.02.02 669 */ 670 function acf_form_head() 671 { 672 if ( 673 isset( $_GET['acf_form_head'] ) 674 && $_GET['acf_form_head'] 675 ) { 676 acf_form_head(); 677 } 678 } 679 680 681 /** 682 * This will put the site in maintenance mode, when we check an ACF setting 683 * 684 * @since 7.16 685 * @verified 2018.08.30 686 */ 687 function maintenance_mode() 688 { 689 if ( $maintenance_mode = lct_acf_get_option_raw( 'maintenance_mode' ) ) { 690 add_action( 'admin_bar_menu', [ $this, 'maintenance_mode_in_admin_bar_menu' ], 999999 ); 691 } 692 693 694 if ( 695 $maintenance_mode 696 && ! lct_doing() 697 && ! is_admin() 698 && ! lct_is_user_a_dev() 699 ) { 700 echo '<h1 style="text-align: center;">Site is down for maintenance. Please check back in a few minutes.</h1>'; 701 exit; 702 } 703 } 704 705 706 /** 707 * Added a note about the site being in maintenance mode into the wp_admin_bar 708 * 709 * @param WP_Admin_Bar $wp_admin_bar 710 * 711 * @since 7.16 712 * @verified 2018.08.27 713 * @noinspection PhpMissingParamTypeInspection 714 */ 715 function maintenance_mode_in_admin_bar_menu( $wp_admin_bar ) 716 { 717 $args = [ 718 'id' => lct_pre_us( zxzu( 'maintenance_mode' ) ), 719 'title' => '<span style="color:#FF0000 !important;">' . zxzb( ' Maintenance On' ) . '</span>', 720 ]; 721 722 723 $wp_admin_bar->add_menu( $args ); 724 } 725 726 727 /** 728 * This will prevent people from accessing the wp-admin back-end while this ACF setting is active 729 * 730 * @since 2017.18 731 * @verified 2018.08.30 732 */ 733 function lock_site_edits() 734 { 735 if ( $lock_site = lct_acf_get_option_raw( 'lock_site_edits' ) ) { 736 add_action( 'admin_bar_menu', [ $this, 'lock_site_edits_in_admin_bar_menu' ], 999999 ); 737 } 738 739 740 if ( 741 $lock_site 742 && ! lct_doing() 743 && is_admin() 744 && is_user_logged_in() 745 ) { 746 $allowed = false; 747 $allowed_users = lct_acf_get_option_raw( 'lock_site_edits_allow' ); 748 $allowed_primary_user = get_userdata( $allowed_users[0] ); 749 750 751 if ( is_user_logged_in() ) { 752 $current_user = wp_get_current_user(); 753 754 755 if ( in_array( $current_user->ID, $allowed_users ) ) { 756 $allowed = true; 757 } 758 } 759 760 761 if ( ! $allowed ) { 762 echo sprintf( 763 '<h1 style="text-align: center;">wp-admin has been temporarily locked by:<br />%1$s</h1> 764 <h2 style="text-align: center;">If you need to make an immediate edit please contact <span style="color:#FF0000 !important;">%1$s</span> via Slack.<br />Otherwise check back around</h2> 765 <h1 style="text-align: center;color:#006400 !important;">%2$s</h1>', 766 $allowed_primary_user->display_name, 767 lct_acf_get_option( 'lock_site_edits_unlock_time' ) 768 ); 769 exit; 770 } 771 } 772 } 773 774 775 /** 776 * Adds a note about the site back-end not being accessible into the wp_admin_bar 777 * 778 * @param WP_Admin_Bar $wp_admin_bar 779 * 780 * @since 2017.18 781 * @verified 2018.08.30 782 * @noinspection PhpMissingParamTypeInspection 783 */ 784 function lock_site_edits_in_admin_bar_menu( $wp_admin_bar ) 785 { 752 786 $allowed_users = lct_acf_get_option_raw( 'lock_site_edits_allow' ); 753 787 $allowed_primary_user = get_userdata( $allowed_users[0] ); 754 788 755 789 756 if ( is_user_logged_in() ) { 790 $args = [ 791 'id' => '_lock_site_edits', 792 'title' => sprintf( '<span style="color:#FF0000 !important;">%s temporarily locked wp-admin</span>', $allowed_primary_user->display_name ) 793 ]; 794 795 796 $wp_admin_bar->add_menu( $args ); 797 } 798 799 800 /** 801 * Display all the browscap data for a particular page 802 * Alias to: lct_get_user_agent_info() 803 * 804 * @param null $print 805 * @param null $hide 806 * 807 * @return bool|Browscap 808 * @since 4.1.11 809 * @verified 2017.09.14 810 */ 811 function get_user_agent_info( $print = null, $hide = null ) 812 { 813 return lct_get_user_agent_info( $print, $hide ); 814 } 815 816 817 /** 818 * Check if the field group matches lct_org() 819 * //TODO: cs - Need to clean this up - 2016.10.11 09:53 PM 820 * 821 * @param $match 822 * @param $rule 823 * @param $screen 824 * 825 * @return bool 826 * @since 7.17 827 * @verified 2019.04.01 828 */ 829 function register_rule_match_lct_org( $match, $rule, $screen ) 830 { 831 if ( 832 ( $tmp = $screen[ lct_org() ] ) 833 && ! empty( $tmp ) 834 ) { 835 if ( ! is_array( $screen[ lct_org() ] ) ) { 836 $screen[ lct_org() ] = [ $screen[ lct_org() ] ]; 837 } 838 839 840 if ( $rule['value'] == 'all' ) { 841 $match = true; 842 } else { 843 $selected_org = (int) $rule['value']; 844 845 846 if ( $rule['operator'] == "==" ) { 847 $match = in_array( $selected_org, $screen[ lct_org() ] ); 848 } elseif ( $rule['operator'] == "!=" ) { 849 $match = ! in_array( $selected_org, $screen[ lct_org() ] ); 850 } 851 } 852 } 853 854 855 return $match; 856 } 857 858 859 /** 860 * Remove the front-end admin bar from selected users in the Useful Settings 861 * 862 * @return bool 863 * @since 0.0 864 * @verified 2018.08.30 865 */ 866 function show_admin_bar() 867 { 868 //always show in wp-admin 869 if ( is_admin() ) { 870 return true; 871 } 872 873 //always hide if no one is logged in 874 if ( ! is_user_logged_in() ) { 875 return false; 876 } 877 878 //hide it if the profile says so 879 if ( get_user_meta( get_current_user_id(), 'show_admin_bar_front', true ) == 'false' ) { 880 return false; 881 } 882 883 884 //get the roles that are to be hidden 885 $roles_to_hide = lct_acf_get_option_raw( 'hide_admin_bar__by_role' ); 886 887 888 //compare those roles to what this user's roles are 889 if ( ! empty( $roles_to_hide ) ) { 757 890 $current_user = wp_get_current_user(); 758 891 759 892 760 if ( in_array( $current_user->ID, $allowed_users ) ) { 761 $allowed = true; 762 } 763 } 764 765 766 if ( ! $allowed ) { 767 echo sprintf( 768 '<h1 style="text-align: center;">wp-admin has been temporarily locked by:<br />%1$s</h1> 769 <h2 style="text-align: center;">If you need to make an immediate edit please contact <span style="color:#FF0000 !important;">%1$s</span> via Slack.<br />Otherwise check back around</h2> 770 <h1 style="text-align: center;color:#006400 !important;">%2$s</h1>', 771 $allowed_primary_user->display_name, 772 lct_acf_get_option( 'lock_site_edits_unlock_time' ) 773 ); 774 exit; 775 } 893 foreach ( $current_user->roles as $role ) { 894 //if there is a match, hide the admin bar 895 if ( in_array( $role, $roles_to_hide ) ) { 896 return false; 897 } 898 } 899 } 900 901 902 //if we made it through all that show the dang the admin bar 903 return true; 904 } 905 906 907 /** 908 * Replace the default read more text with an ACF value 909 * 910 * @param $read_more_text 911 * 912 * @return bool|mixed|null 913 * @since 4.3.1 914 * @verified 2018.08.30 915 */ 916 function avada_blog_read_more_excerpt( $read_more_text ) 917 { 918 if ( lct_acf_get_option_raw( 'avada::is_post_excerpt_read_more' ) ) { 919 $change = true; 920 921 922 if ( lct_acf_get_option_raw( 'avada::is_post_excerpt_read_more_certain_pages' ) ) { 923 $page = get_queried_object_id(); 924 925 926 if ( 927 ( 928 $page 929 && ! in_array( get_queried_object_id(), lct_acf_get_option_raw( 'avada::post_excerpt_read_more_certain_pages' ) ) 930 ) 931 || ! $page 932 ) { 933 $change = false; 934 } 935 } 936 937 938 if ( $change ) { 939 $read_more_text = lct_acf_get_option( 'avada::post_excerpt_read_more' ); 940 } 941 } 942 943 944 return $read_more_text; 945 } 946 947 948 /** 949 * ACF sets a 'local' key to 'php' 950 * I don't know why, but it messes crap up real bad. 951 * 952 * @param $field_group 953 * 954 * @since 7.26 955 * @verified 2017.07.18 956 */ 957 function import_cleanup( $field_group ) 958 { 959 if ( 960 $field_group['ID'] 961 && isset( $field_group['local'] ) 962 && in_array( $field_group['local'], [ 'php', 'json' ] ) 963 ) { 964 unset( $field_group['local'] ); 965 unset( $field_group['modified'] ); 966 967 968 acf_update_field_group( $field_group ); 969 } 970 } 971 972 973 /** 974 * Disable Services 975 * xmlrpc 976 * wlwmanifest 977 * WP REST API 978 * 979 * @since 2017.90 980 * @verified 2018.08.30 981 */ 982 function disable_connection_services() 983 { 984 /** 985 * Disable xmlrpc 986 */ 987 if ( ! lct_acf_get_option_raw( 'use_xmlrpc' ) ) { 988 add_filter( 'xmlrpc_enabled', '__return_false' ); 989 990 remove_action( 'wp_head', 'rsd_link' ); 991 } 992 993 994 /** 995 * Disable wlwmanifest 996 */ 997 if ( ! lct_acf_get_option_raw( 'use_wlwmanifest' ) ) { 998 remove_action( 'wp_head', 'wlwmanifest_link' ); 999 } 1000 1001 1002 /** 1003 * Disable WP REST API 1004 * Only disables the links, use this plugin if you actually want to disable REST API 1005 * https://wordpress.org/plugins/disable-json-api/ 1006 */ 1007 if ( 1008 ! lct_plugin_active( 'disable-json-api' ) 1009 && ! lct_acf_get_option_raw( 'use_wp_rest_api' ) 1010 ) { 1011 // Remove REST API info from head and headers 1012 remove_action( 'xmlrpc_rsd_apis', 'rest_output_rsd' ); 1013 remove_action( 'wp_head', 'rest_output_link_wp_head' ); 1014 remove_action( 'template_redirect', 'rest_output_link_header', 11 ); 1015 } 1016 } 1017 1018 1019 /** 1020 * Create a setting so that we can know when we are in the middle of rendering a new_post form 1021 * 1022 * @param $args 1023 * 1024 * @return mixed 1025 * @since 2018.62 1026 * @verified 2018.08.27 1027 */ 1028 function set_new_post_setting( $args ) 1029 { 1030 if ( $args['post_id'] === 'new_post' ) { 1031 lct_update_setting( 'acf/render_form/new_post', $args['new_post']['post_type'] ); 1032 } 1033 1034 1035 return $args; 1036 } 1037 1038 1039 /** 1040 * Create a setting so that we can know when we are in the middle of rendering a new_post form 1041 * 1042 * @since 2018.62 1043 * @verified 2018.08.27 1044 */ 1045 function unset_new_post_setting() 1046 { 1047 lct_update_setting( 'acf/render_form/new_post', null ); 1048 } 1049 1050 1051 /** 1052 * Update the tax filter to a status filter 1053 * 1054 * @param array $args 1055 * 1056 * @unused param $field 1057 * @unused param $post_id 1058 * @return array 1059 * @since 2019.26 1060 * @verified 2019.11.22 1061 * @noinspection PhpMissingParamTypeInspection 1062 */ 1063 function update_status_filter( $args ) 1064 { 1065 if ( empty( $args['tax_query'] ) ) { 1066 return $args; 1067 } 1068 1069 1070 foreach ( $args['tax_query'] as $k => $tax ) { 1071 if ( 1072 ( $taxonomy = get_taxonomy( $tax['taxonomy'] ) ) 1073 && ( $tmp = get_cnst( 'tax_status_slugs' ) ) 1074 && ! empty( $taxonomy->{$tmp} ) 1075 ) { 1076 if ( empty( $args['post_status'] ) ) { 1077 $args['post_status'] = []; 1078 } 1079 1080 1081 foreach ( $tax['terms'] as $term ) { 1082 $args['post_status'][] = lct_make_status_slug( get_term_by( 'slug', $term, $tax['taxonomy'] ) ); 1083 } 1084 1085 1086 unset( $args['tax_query'][ $k ] ); 1087 } 1088 } 1089 1090 1091 return $args; 1092 } 1093 1094 1095 /** 1096 * Add the menu order back into fields when they are exported 1097 * 1098 * @param array $field_group 1099 * 1100 * @return array 1101 * @since 2019.29 1102 * @verified 2019.12.05 1103 * @noinspection PhpMissingParamTypeInspection 1104 */ 1105 function add_menu_order_to_fields( $field_group ) 1106 { 1107 if ( ! empty( $field_group['fields'] ) ) { 1108 $field_group['fields'] = $this->add_menu_order_loop_fields( $field_group['fields'] ); 1109 } 1110 1111 1112 return $field_group; 1113 } 1114 1115 1116 /** 1117 * Add the menu order back into fields when they are exported 1118 * 1119 * @param array $fields 1120 * 1121 * @return array 1122 * @since 2019.29 1123 * @verified 2019.12.05 1124 * @noinspection PhpMissingParamTypeInspection 1125 */ 1126 function add_menu_order_loop_fields( $fields ) 1127 { 1128 $menu_order = 0; 1129 1130 1131 foreach ( $fields as $key => $field ) { 1132 if ( ! empty( $field['sub_fields'] ) ) { 1133 $fields[ $key ]['sub_fields'] = $this->add_menu_order_loop_fields( $field['sub_fields'] ); 1134 } 1135 1136 1137 $fields[ $key ]['menu_order'] = $menu_order; 1138 1139 1140 $menu_order ++; 1141 } 1142 1143 1144 return $fields; 1145 } 1146 1147 1148 /** 1149 * Allow all the posts to be returned 1150 * 1151 * @param array $args 1152 * 1153 * @unused param $field 1154 * @unused param $post_id 1155 * @return array 1156 * @since 2020.3 1157 * @verified 2020.01.22 1158 * @noinspection PhpMissingParamTypeInspection 1159 */ 1160 function update_posts_per_page( $args ) 1161 { 1162 if ( ! isset( $args['paged'] ) ) { 1163 return $args; 1164 } 1165 1166 1167 $paged = $args['paged']; 1168 1169 1170 if ( 1171 is_numeric( $paged ) 1172 && (int) $paged > 1 1173 ) { 1174 $paged = true; 1175 } 1176 1177 1178 if ( filter_var( $paged, FILTER_VALIDATE_BOOLEAN ) === false ) { 1179 $args['posts_per_page'] = - 1; 1180 } 1181 1182 1183 return $args; 1184 } 1185 1186 1187 /** 1188 * Prevent duplicate field elements 1189 * 1190 * @param array $attrs 1191 * 1192 * @return array 1193 * @since 2020.3 1194 * @verified 2020.10.01 1195 * @noinspection PhpMissingParamTypeInspection 1196 */ 1197 function unique_id( $attrs ) 1198 { 1199 if ( 1200 ! empty( $attrs['id'] ) 1201 && $attrs['id'] !== '_acf_delete_fields' 1202 && strpos( $attrs['id'], '_acf' ) === 0 1203 ) { 1204 $attrs['id'] .= '_' . lct_rand_short(); 1205 } 1206 1207 1208 return $attrs; 776 1209 } 777 1210 } … … 779 1212 780 1213 /** 781 * Adds a note about the site back-end not being accessible into the wp_admin_bar 782 * 783 * @param WP_Admin_Bar $wp_admin_bar 784 * 785 * @since 2017.18 786 * @verified 2018.08.30 787 * @noinspection PhpMissingParamTypeInspection 1214 * Instantiate. 788 1215 */ 789 function lock_site_edits_in_admin_bar_menu( $wp_admin_bar ) 790 { 791 $allowed_users = lct_acf_get_option_raw( 'lock_site_edits_allow' ); 792 $allowed_primary_user = get_userdata( $allowed_users[0] ); 793 794 795 $args = [ 796 'id' => '_lock_site_edits', 797 'title' => sprintf( '<span style="color:#FF0000 !important;">%s temporarily locked wp-admin</span>', $allowed_primary_user->display_name ) 798 ]; 799 800 801 $wp_admin_bar->add_menu( $args ); 802 } 803 804 1216 acf_new_instance( 'lct_acf_admin' ); 1217 1218 1219 endif; // class_exists check 1220 1221 1222 /** 1223 * @return lct_acf_admin 1224 * @date 2023.11.27 1225 * @since 2023.04 1226 * @verified 2023.11.27 1227 */ 1228 function lct_acf_admin() 1229 { 805 1230 /** 806 * Display all the browscap data for a particular page 807 * Alias to: lct_get_user_agent_info() 808 * 809 * @param null $print 810 * @param null $hide 811 * 812 * @return bool|Browscap 813 * @since 4.1.11 814 * @verified 2017.09.14 1231 * @var lct_acf_admin $ins 815 1232 */ 816 function get_user_agent_info( $print = null, $hide = null ) 817 { 818 return lct_get_user_agent_info( $print, $hide ); 819 } 820 821 822 /** 823 * Check if the field group matches lct_org() 824 * //TODO: cs - Need to clean this up - 2016.10.11 09:53 PM 825 * 826 * @param $match 827 * @param $rule 828 * @param $screen 829 * 830 * @return bool 831 * @since 7.17 832 * @verified 2019.04.01 833 */ 834 function register_rule_match_lct_org( $match, $rule, $screen ) 835 { 836 if ( 837 ( $tmp = $screen[ lct_org() ] ) 838 && ! empty( $tmp ) 839 ) { 840 if ( ! is_array( $screen[ lct_org() ] ) ) { 841 $screen[ lct_org() ] = [ $screen[ lct_org() ] ]; 842 } 843 844 845 if ( $rule['value'] == 'all' ) { 846 $match = true; 847 } else { 848 $selected_org = (int) $rule['value']; 849 850 851 if ( $rule['operator'] == "==" ) { 852 $match = in_array( $selected_org, $screen[ lct_org() ] ); 853 } elseif ( $rule['operator'] == "!=" ) { 854 $match = ! in_array( $selected_org, $screen[ lct_org() ] ); 855 } 856 } 857 } 858 859 860 return $match; 861 } 862 863 864 /** 865 * Remove the front-end admin bar from selected users in the Useful Settings 866 * 867 * @return bool 868 * @since 0.0 869 * @verified 2018.08.30 870 */ 871 function show_admin_bar() 872 { 873 //always show in wp-admin 874 if ( is_admin() ) { 875 return true; 876 } 877 878 //always hide if no one is logged in 879 if ( ! is_user_logged_in() ) { 880 return false; 881 } 882 883 //hide it if the profile says so 884 if ( get_user_meta( get_current_user_id(), 'show_admin_bar_front', true ) == 'false' ) { 885 return false; 886 } 887 888 889 //get the roles that are to be hidden 890 $roles_to_hide = lct_acf_get_option_raw( 'hide_admin_bar__by_role' ); 891 892 893 //compare those roles to what this user's roles are 894 if ( ! empty( $roles_to_hide ) ) { 895 $current_user = wp_get_current_user(); 896 897 898 foreach ( $current_user->roles as $role ) { 899 //if there is a match, hide the admin bar 900 if ( in_array( $role, $roles_to_hide ) ) { 901 return false; 902 } 903 } 904 } 905 906 907 //if we made it through all that show the dang the admin bar 908 return true; 909 } 910 911 912 /** 913 * Replace the default read more text with an ACF value 914 * 915 * @param $read_more_text 916 * 917 * @return bool|mixed|null 918 * @since 4.3.1 919 * @verified 2018.08.30 920 */ 921 function avada_blog_read_more_excerpt( $read_more_text ) 922 { 923 if ( lct_acf_get_option_raw( 'avada::is_post_excerpt_read_more' ) ) { 924 $change = true; 925 926 927 if ( lct_acf_get_option_raw( 'avada::is_post_excerpt_read_more_certain_pages' ) ) { 928 $page = get_queried_object_id(); 929 930 931 if ( 932 ( 933 $page 934 && ! in_array( get_queried_object_id(), lct_acf_get_option_raw( 'avada::post_excerpt_read_more_certain_pages' ) ) 935 ) 936 || ! $page 937 ) { 938 $change = false; 939 } 940 } 941 942 943 if ( $change ) { 944 $read_more_text = lct_acf_get_option( 'avada::post_excerpt_read_more' ); 945 } 946 } 947 948 949 return $read_more_text; 950 } 951 952 953 /** 954 * ACF sets a 'local' key to 'php' 955 * I don't know why, but it messes crap up real bad. 956 * 957 * @param $field_group 958 * 959 * @since 7.26 960 * @verified 2017.07.18 961 */ 962 function import_cleanup( $field_group ) 963 { 964 if ( 965 $field_group['ID'] 966 && isset( $field_group['local'] ) 967 && in_array( $field_group['local'], [ 'php', 'json' ] ) 968 ) { 969 unset( $field_group['local'] ); 970 unset( $field_group['modified'] ); 971 972 973 acf_update_field_group( $field_group ); 974 } 975 } 976 977 978 /** 979 * Disable Services 980 * xmlrpc 981 * wlwmanifest 982 * WP REST API 983 * 984 * @since 2017.90 985 * @verified 2018.08.30 986 */ 987 function disable_connection_services() 988 { 989 /** 990 * Disable xmlrpc 991 */ 992 if ( ! lct_acf_get_option_raw( 'use_xmlrpc' ) ) { 993 add_filter( 'xmlrpc_enabled', '__return_false' ); 994 995 remove_action( 'wp_head', 'rsd_link' ); 996 } 997 998 999 /** 1000 * Disable wlwmanifest 1001 */ 1002 if ( ! lct_acf_get_option_raw( 'use_wlwmanifest' ) ) { 1003 remove_action( 'wp_head', 'wlwmanifest_link' ); 1004 } 1005 1006 1007 /** 1008 * Disable WP REST API 1009 * Only disables the links, use this plugin if you actually want to disable REST API 1010 * https://wordpress.org/plugins/disable-json-api/ 1011 */ 1012 if ( 1013 ! lct_plugin_active( 'disable-json-api' ) 1014 && ! lct_acf_get_option_raw( 'use_wp_rest_api' ) 1015 ) { 1016 // Remove REST API info from head and headers 1017 remove_action( 'xmlrpc_rsd_apis', 'rest_output_rsd' ); 1018 remove_action( 'wp_head', 'rest_output_link_wp_head' ); 1019 remove_action( 'template_redirect', 'rest_output_link_header', 11 ); 1020 } 1021 } 1022 1023 1024 /** 1025 * Create a setting so that we can know when we are in the middle of rendering a new_post form 1026 * 1027 * @param $args 1028 * 1029 * @return mixed 1030 * @since 2018.62 1031 * @verified 2018.08.27 1032 */ 1033 function set_new_post_setting( $args ) 1034 { 1035 if ( $args['post_id'] === 'new_post' ) { 1036 lct_update_setting( 'acf/render_form/new_post', $args['new_post']['post_type'] ); 1037 } 1038 1039 1040 return $args; 1041 } 1042 1043 1044 /** 1045 * Create a setting so that we can know when we are in the middle of rendering a new_post form 1046 * 1047 * @since 2018.62 1048 * @verified 2018.08.27 1049 */ 1050 function unset_new_post_setting() 1051 { 1052 lct_update_setting( 'acf/render_form/new_post', null ); 1053 } 1054 1055 1056 /** 1057 * Update the tax filter to a status filter 1058 * 1059 * @param array $args 1060 * 1061 * @unused param $field 1062 * @unused param $post_id 1063 * @return array 1064 * @since 2019.26 1065 * @verified 2019.11.22 1066 * @noinspection PhpMissingParamTypeInspection 1067 */ 1068 function update_status_filter( $args ) 1069 { 1070 if ( empty( $args['tax_query'] ) ) { 1071 return $args; 1072 } 1073 1074 1075 foreach ( $args['tax_query'] as $k => $tax ) { 1076 if ( 1077 ( $taxonomy = get_taxonomy( $tax['taxonomy'] ) ) 1078 && ( $tmp = get_cnst( 'tax_status_slugs' ) ) 1079 && ! empty( $taxonomy->{$tmp} ) 1080 ) { 1081 if ( empty( $args['post_status'] ) ) { 1082 $args['post_status'] = []; 1083 } 1084 1085 1086 foreach ( $tax['terms'] as $term ) { 1087 $args['post_status'][] = lct_make_status_slug( get_term_by( 'slug', $term, $tax['taxonomy'] ) ); 1088 } 1089 1090 1091 unset( $args['tax_query'][ $k ] ); 1092 } 1093 } 1094 1095 1096 return $args; 1097 } 1098 1099 1100 /** 1101 * Add the menu order back into fields when they are exported 1102 * 1103 * @param array $field_group 1104 * 1105 * @return array 1106 * @since 2019.29 1107 * @verified 2019.12.05 1108 * @noinspection PhpMissingParamTypeInspection 1109 */ 1110 function add_menu_order_to_fields( $field_group ) 1111 { 1112 if ( ! empty( $field_group['fields'] ) ) { 1113 $field_group['fields'] = $this->add_menu_order_loop_fields( $field_group['fields'] ); 1114 } 1115 1116 1117 return $field_group; 1118 } 1119 1120 1121 /** 1122 * Add the menu order back into fields when they are exported 1123 * 1124 * @param array $fields 1125 * 1126 * @return array 1127 * @since 2019.29 1128 * @verified 2019.12.05 1129 * @noinspection PhpMissingParamTypeInspection 1130 */ 1131 function add_menu_order_loop_fields( $fields ) 1132 { 1133 $menu_order = 0; 1134 1135 1136 foreach ( $fields as $key => $field ) { 1137 if ( ! empty( $field['sub_fields'] ) ) { 1138 $fields[ $key ]['sub_fields'] = $this->add_menu_order_loop_fields( $field['sub_fields'] ); 1139 } 1140 1141 1142 $fields[ $key ]['menu_order'] = $menu_order; 1143 1144 1145 $menu_order ++; 1146 } 1147 1148 1149 return $fields; 1150 } 1151 1152 1153 /** 1154 * Allow all the posts to be returned 1155 * 1156 * @param array $args 1157 * 1158 * @unused param $field 1159 * @unused param $post_id 1160 * @return array 1161 * @since 2020.3 1162 * @verified 2020.01.22 1163 * @noinspection PhpMissingParamTypeInspection 1164 */ 1165 function update_posts_per_page( $args ) 1166 { 1167 if ( ! isset( $args['paged'] ) ) { 1168 return $args; 1169 } 1170 1171 1172 $paged = $args['paged']; 1173 1174 1175 if ( 1176 is_numeric( $paged ) 1177 && (int) $paged > 1 1178 ) { 1179 $paged = true; 1180 } 1181 1182 1183 if ( filter_var( $paged, FILTER_VALIDATE_BOOLEAN ) === false ) { 1184 $args['posts_per_page'] = - 1; 1185 } 1186 1187 1188 return $args; 1189 } 1190 1191 1192 /** 1193 * Prevent duplicate field elements 1194 * 1195 * @param array $attrs 1196 * 1197 * @return array 1198 * @since 2020.3 1199 * @verified 2020.10.01 1200 * @noinspection PhpMissingParamTypeInspection 1201 */ 1202 function unique_id( $attrs ) 1203 { 1204 if ( 1205 ! empty( $attrs['id'] ) 1206 && $attrs['id'] !== '_acf_delete_fields' 1207 && strpos( $attrs['id'], '_acf' ) === 0 1208 ) { 1209 $attrs['id'] .= '_' . lct_rand_short(); 1210 } 1211 1212 1213 return $attrs; 1214 } 1233 $ins = acf_get_instance( 'lct_acf_admin' ); 1234 1235 1236 return $ins; 1215 1237 } -
lct-useful-shortcodes-functions/trunk/code/plugins/acf/_loaded.php
r2991310 r3017144 116 116 117 117 add_filter( 'acf/load_field_group', [ $this, 'load_field_group' ], 9 ); 118 119 add_filter( 'lct/acf_loaded/load_reference/show_error_log', [ $this, 'show_error_log' ], 10, 2 ); 118 120 } 119 121 … … 764 766 * @return string 765 767 * @since 2018.0 766 * @verified 2023. 08.31768 * @verified 2023.12.07 767 769 */ 768 770 function pre_load_reference( $reference, $field_name, $post_id ) … … 824 826 && apply_filters( 'lct/acf_loaded/pre_load_reference/show_error_log', true, $field_name ) 825 827 ) { 826 lct_debug_to_error_log( sprintf( 'Something is wrong with: %s :: %s', __FUNCTION__, '#1' ) );828 lct_debug_to_error_log( sprintf( 'Something is wrong with: %s() :: field %s :: %s', __FUNCTION__, $field_name, '#1' ) ); 827 829 } 828 830 … … 910 912 * @return string 911 913 * @since 2018.0 912 * @verified 202 3.09.21914 * @verified 2024.01.03 913 915 */ 914 916 function load_reference( $reference, $field_name, $post_id ) … … 1037 1039 && ! empty( $tmp['form_data'] ) 1038 1040 && str_contains( $tmp['form_data'], 'milestone_id : ' ) 1041 && ( 1042 empty( $decoded['post_type'] ) 1043 || $decoded['post_type'] !== 'afwp_comms' 1044 ) 1039 1045 ) { 1040 1046 $tmp = explode( 'milestone_id : ', $tmp['form_data'] ); … … 1207 1213 */ 1208 1214 } else { 1209 $debug = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 6 );1210 lct_debug_to_error_log( 'Check reference for ACF field: ' . $field_name . ' :: ' . $debug[5]['file'] . ':' . $debug[5]['line'] );1215 //$debug = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 6 ); 1216 //lct_debug_to_error_log( 'Check reference for ACF field: ' . $field_name . ' :: ' . $debug[5]['file'] . ':' . $debug[5]['line'] ); 1211 1217 } 1212 1218 } … … 1232 1238 1233 1239 /** 1240 * Don't check some of our bad fields 1241 * 1242 * @param bool $show_error 1243 * @param string $field_name 1244 * 1245 * @return bool 1246 * @date 2024.01.03 1247 * @since 2023.04 1248 * @verified 2024.01.03 1249 */ 1250 function show_error_log( $show_error, $field_name ) 1251 { 1252 if ( $show_error ) { 1253 $dont_show_error = [ 1254 'lct:::is_allowed_login', 1255 'lct:::is_allowed_role', 1256 'lct:::is_allowed_cap', 1257 ]; 1258 1259 1260 foreach ( $dont_show_error as $dont ) { 1261 if ( str_starts_with( $field_name, $dont ) ) { 1262 return false; 1263 } 1264 } 1265 } 1266 1267 1268 return $show_error; 1269 } 1270 1271 1272 /** 1234 1273 * Add any DB group fiends to the key_reference store 1235 1274 * -
lct-useful-shortcodes-functions/trunk/code/plugins/acf/api/form.php
r2991310 r3017144 84 84 * @return bool|string 85 85 * @since 7.49 86 * @verified 2023. 09.1586 * @verified 2023.12.06 87 87 */ 88 88 function lct_acf_form2( $a ) … … 234 234 if ( ! empty( $a['field_groups'] ) ) { 235 235 $a['field_groups'] = array_values( $a['field_groups'] ); 236 237 238 if ( 239 count( $a['field_groups'] ) === 1 240 && ( $group_obj = acf_get_field_group( $a['field_groups'][0] ) ) 241 ) { 236 $tmp = reset( $a['field_groups'] ); 237 238 239 if ( ( $group_obj = acf_get_field_group( $tmp ) ) ) { 242 240 if ( 243 241 $a['label_placement'] === null -
lct-useful-shortcodes-functions/trunk/code/plugins/acf/api/get.php
r2991310 r3017144 1381 1381 * @return array 1382 1382 * @since 2019.6 1383 * @verified 2023. 09.111383 * @verified 2023.12.19 1384 1384 */ 1385 1385 function lct_acf_get_POST_values_w_selector_key( $post = null, $return_field = false, $special_process = false ) … … 1417 1417 && is_array( $v ) 1418 1418 && $k !== $repeater_key 1419 && ( $tmp = array_key_first( $v ) )1420 && acf_is_field_key( $tmp )1421 && ! acf_get_field( $tmp )1422 1419 ) { 1423 $new_v = []; 1424 1425 1426 foreach ( $v as $clone_k => $clone_v ) { 1427 $explode_k = explode( 'field_', $clone_k ); 1428 $clone_parent_k = $clone_k; 1429 1430 1420 $has_clones = false; 1421 1422 foreach ( $v as $tmp => $not_needed ) { 1431 1423 if ( 1432 count( $explode_k ) >= 3 1433 && ( $tmp = 'field_' . rtrim( $explode_k[1], '_' ) ) 1434 && lct_acf_is_field_clone( $tmp ) 1424 acf_is_field_key( $tmp ) 1425 && ! acf_get_field( $tmp ) 1435 1426 ) { 1436 $clone_parent_k = $tmp; 1437 } 1438 1439 1440 if ( 1441 ! lct_acf_is_field_clone( $tmp ) 1442 || count( $explode_k ) < 3 1443 ) { 1444 $new_v[ $clone_parent_k ] = $clone_v; 1445 } else { 1446 $new_v[ $clone_parent_k ][ $clone_k ] = $clone_v; 1427 $has_clones = true; 1447 1428 } 1448 1429 } 1449 1430 1450 1431 1451 $v = $new_v; 1432 if ( $has_clones ) { 1433 $new_v = []; 1434 1435 1436 foreach ( $v as $clone_k => $clone_v ) { 1437 $explode_k = explode( 'field_', $clone_k ); 1438 $clone_parent_k = $clone_k; 1439 1440 1441 if ( 1442 count( $explode_k ) >= 3 1443 && ( $tmp = 'field_' . rtrim( $explode_k[1], '_' ) ) 1444 && lct_acf_is_field_clone( $tmp ) 1445 ) { 1446 $clone_parent_k = $tmp; 1447 } 1448 1449 1450 if ( 1451 ! lct_acf_is_field_clone( $tmp ) 1452 || count( $explode_k ) < 3 1453 ) { 1454 $new_v[ $clone_parent_k ] = $clone_v; 1455 } else { 1456 $new_v[ $clone_parent_k ][ $clone_k ] = $clone_v; 1457 } 1458 } 1459 1460 1461 $v = $new_v; 1462 } 1452 1463 } 1453 1464 -
lct-useful-shortcodes-functions/trunk/code/plugins/acf/api/is.php
r2991310 r3017144 146 146 return $r; 147 147 } 148 149 150 /** 151 * Check if the request you are running is allowed 152 * 153 * @return bool 154 * @date 2023.12.15 155 * @since 2023.04 156 * @verified 2023.12.15 157 */ 158 function lct_acf_is_process_shortcodes_needed() 159 { 160 if ( ( $r = lct_get_setting( 'acf_is_process_shortcodes_allowed' ) ) === null ) { 161 $r = true; 162 163 164 lct_update_setting( 'acf_is_process_shortcodes_allowed', $r ); 165 } 166 167 168 return $r; 169 } -
lct-useful-shortcodes-functions/trunk/code/plugins/acf/dev_checks.php
r2894473 r3017144 267 267 function plugins_n_files( array $field ) 268 268 { 269 //TODO: cs - Improve this before using it again - 12/14/2023 4:55 PM 270 return; 271 272 269 273 if ( $field['key'] !== lct_raw_setting( 'acf_dev_report_plugins' ) ) { 270 274 return; -
lct-useful-shortcodes-functions/trunk/code/plugins/acf/filters_load_field.php
r2894473 r3017144 179 179 * @return mixed 180 180 * @since 2017.68 181 * @verified 202 2.01.06181 * @verified 2023.12.15 182 182 */ 183 183 function process_shortcodes( $field ) 184 184 { 185 if ( lct_acf_is_field_group_editing_page() ) { //Don't load on ACf edit pages 185 if ( 186 lct_acf_is_field_group_editing_page() //Don't load on ACf edit pages 187 || ! lct_acf_is_process_shortcodes_needed() 188 ) { 186 189 return $field; 187 190 } -
lct-useful-shortcodes-functions/trunk/code/plugins/acf/form.php
r2991310 r3017144 75 75 76 76 77 if ( lct_wp_admin_non_ajax() ) { 78 add_action( 'acf/input/form_data', [ $this, 'form_data_nested_field_check' ], 15 ); 79 } 77 //if ( lct_wp_admin_non_ajax() ) {} 80 78 81 79 … … 385 383 386 384 /** 387 * Fields will not save if the nonce is set twice. We have to work around that with this action, because there is not a filter in ACF we can hook into388 * This originally occurred on the LCT op_main_dev in wp-admin389 *390 * @param $a391 *392 * @since 2017.70393 * @verified 2019.02.11394 */395 function form_data_nested_field_check( $a )396 {397 $field_check = lct_get_setting( 'form_data_nested_field_check' );398 399 400 /**401 * Is ACF Options Page and the first form402 */403 if (404 is_admin()405 && ! $field_check406 && ! empty( $a['post_id'] )407 && $a['post_id'] === lct_o()408 ) {409 lct_update_setting( 'form_data_nested_field_check', $a['nonce'] );410 411 412 /**413 * Is ACF Options Page and a nested form/form field414 */415 } elseif (416 $field_check417 && ! empty( $a['nonce'] )418 && $field_check !== $a['nonce']419 ) {420 echo sprintf(421 '<input type="hidden" name="%1$s" id="%1$s">422 <script>423 jQuery(document).ready( function() {424 jQuery(\'#%1$s\').closest( "#acf-form-data" ).remove();425 });426 </script>',427 lct_rand()428 );429 }430 }431 432 433 /**434 385 * Set the form that we are currently rendering, so we can reference it when it is needed. 435 386 * … … 613 564 614 565 /** 615 * Print our custom form_data as hidden inputs566 * Print our custom form_data into the acf-form-data element 616 567 * 617 568 * @param array $data The form data. … … 619 570 * @date 2022.01.07 620 571 * @since 2022.1 621 * @verified 202 2.01.21572 * @verified 2023.12.14 622 573 */ 623 574 function add_custom_form_data( $data ) 624 575 { 576 $prefix = '_lct'; 577 $data_prefix = '_form_data' . $prefix; 578 $input_prefix = $prefix . '_'; 579 580 625 581 if ( 626 582 isset( $data['form'] ) 627 && ( $form_arr = afwp_acf_maybe_json_decode( acf_decrypt( $data['form'] ) ) ) 628 && isset( $form_arr['_form_data_lct'] ) 629 && is_array( $form_arr['_form_data_lct'] ) 583 && ( $form_arr = acf_decrypt( $data['form'] ) ) 584 && ! empty( $form_arr ) 585 && ( $form_arr = afwp_acf_maybe_json_decode( $form_arr ) ) 586 && isset( $form_arr[ $data_prefix ] ) 587 && ( $data = $form_arr[ $data_prefix ] ) 588 && is_array( $data ) 630 589 ) { 631 /** 632 * Create hidden inputs from $data 633 */ 634 foreach ( $form_arr['_form_data_lct'] as $name => $value ) { 590 foreach ( $data as $name => $value ) { 635 591 acf_hidden_input( 636 592 [ 637 'id' => '_lct_' . $name, 638 'name' => '_lct_' . $name, 593 'id' => $input_prefix . $name, 639 594 'value' => $value, 595 'name' => $input_prefix . $name, 640 596 ] 641 597 ); -
lct-useful-shortcodes-functions/trunk/lct-useful-shortcodes-functions.php
r2991310 r3017144 4 4 * Plugin URI: https://www.simplesmithmedia.com 5 5 * Description: Shortcodes & Functions that will help make your life easier. 6 * Version: 2023.0 36 * Version: 2023.04 7 7 * Author: SimpleSmithMedia 8 8 * Author URI: https://www.simplesmithmedia.com … … 10 10 * Domain Path: /lang 11 11 * License: GPLv2 or later (https://www.gnu.org/licenses/gpl-2.0.html) 12 * Copyright 202 3SimpleSmithMedia (email : info@simplesmithmedia.com)12 * Copyright 2024 SimpleSmithMedia (email : info@simplesmithmedia.com) 13 13 * 14 * @copyright 202 314 * @copyright 2024 15 15 * @license GPLv2 16 16 * @since 1.0 … … 18 18 19 19 /** 20 * Copyright (C) 202 3SimpleSmithMedia20 * Copyright (C) 2024 SimpleSmithMedia 21 21 * * 22 22 * This program is distributed in the hope that it will be useful, -
lct-useful-shortcodes-functions/trunk/readme.txt
r2991310 r3017144 3 3 Tags: Functions, Shortcodes 4 4 Requires at least: 5.0 5 Tested up to: 6. 3.25 Tested up to: 6.4.2 6 6 Requires PHP: 7.4 7 7 License: GPLv2 or later … … 33 33 34 34 == Changelog == 35 = 2023.04 = 36 *Release Date - 03 January 2024* 37 38 * WP v6.4.2 Ready 39 * Avada v7.11.3 Ready 40 * CSS Tweaks 41 * Added 42 * add_filter( 'lct/acf_loaded/load_reference/show_error_log', [ $this, 'show_error_log' ], 10, 2 ); 43 * lct_acf_is_process_shortcodes_needed() 44 * lct_acf_admin() 45 * Improved: 46 * timezone_settings() 47 * Removed: 48 * add_action( 'acf/input/form_data', [ $this, 'form_data_nested_field_check' ], 15 ); 49 35 50 = 2023.03 = 36 51 *Release Date - 07 November 2023* … … 45 60 * Added: 46 61 * add_filter( 'acf/init', [ $this, 'prepare_fields_for_import_store' ], 9 ); 62 * lct_acf_is_process_shortcodes_needed() 63 * Removed: 64 * add_action( 'acf/input/form_data', [ $this, 'form_data_nested_field_check' ], 15 ); 47 65 48 66 = 2023.01 =
Note: See TracChangeset
for help on using the changeset viewer.