elementor
1 year ago
logs
1 month ago
strong-testimonials-beaver-block
1 year ago
submodules
8 months ago
class-strong-gutemberg.php
1 year ago
class-strong-log.php
1 year ago
class-strong-mail.php
1 year ago
class-strong-testimonials-average-shortcode.php
1 year ago
class-strong-testimonials-count-shortcode.php
1 year ago
class-strong-testimonials-defaults.php
1 month ago
class-strong-testimonials-form.php
1 month ago
class-strong-testimonials-order.php
1 year ago
class-strong-testimonials-privacy.php
1 year ago
class-strong-testimonials-render.php
1 month ago
class-strong-testimonials-templates.php
1 year ago
class-strong-testimonials-view-shortcode.php
2 days ago
class-strong-testimonials-view-widget.php
1 year ago
class-strong-view-display.php
1 month ago
class-strong-view-form.php
2 days ago
class-strong-view-slideshow.php
1 month ago
class-strong-view.php
11 months ago
class-walker-strong-category-checklist-front.php
1 year ago
deprecated.php
1 year ago
filters.php
1 month ago
functions-activation.php
1 month ago
functions-content.php
11 months ago
functions-image.php
5 months ago
functions-rating.php
1 year ago
functions-template-form.php
2 days ago
functions-template.php
4 months ago
functions-views.php
1 year ago
functions.php
1 month ago
l10n-polylang.php
1 year ago
l10n-wpml.php
1 year ago
post-types.php
2 days ago
retro.php
1 year ago
scripts.php
1 month ago
retro.php
139 lines
| 1 | <?php |
| 2 | |
| 3 | if ( ! function_exists( 'get_preview_post_link' ) ) : |
| 4 | |
| 5 | /** |
| 6 | * Retrieves the URL used for the post preview. |
| 7 | * |
| 8 | * Allows additional query args to be appended. |
| 9 | * |
| 10 | * @since 4.4.0 |
| 11 | * |
| 12 | * @param int|WP_Post $post Optional. Post ID or `WP_Post` object. Defaults to global `$post`. |
| 13 | * @param array $query_args Optional. Array of additional query args to be appended to the link. |
| 14 | * Default empty array. |
| 15 | * @param string $preview_link Optional. Base preview link to be used if it should differ from the |
| 16 | * post permalink. Default empty. |
| 17 | * @return string|null URL used for the post preview, or null if the post does not exist. |
| 18 | */ |
| 19 | function get_preview_post_link( $post = null, $query_args = array(), $preview_link = '' ) { |
| 20 | $post = get_post( $post ); |
| 21 | if ( ! $post ) { |
| 22 | return; |
| 23 | } |
| 24 | |
| 25 | $post_type_object = get_post_type_object( $post->post_type ); |
| 26 | if ( is_post_type_viewable( $post_type_object ) ) { |
| 27 | if ( ! $preview_link ) { |
| 28 | $preview_link = set_url_scheme( get_permalink( $post ) ); |
| 29 | } |
| 30 | |
| 31 | $query_args['preview'] = 'true'; |
| 32 | $preview_link = add_query_arg( $query_args, $preview_link ); |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Filters the URL used for a post preview. |
| 37 | * |
| 38 | * @since 2.0.5 |
| 39 | * @since 4.0.0 Added the `$post` parameter. |
| 40 | * |
| 41 | * @param string $preview_link URL used for the post preview. |
| 42 | * @param WP_Post $post Post object. |
| 43 | */ |
| 44 | return apply_filters( 'preview_post_link', $preview_link, $post ); |
| 45 | } |
| 46 | |
| 47 | endif; |
| 48 | |
| 49 | |
| 50 | if ( ! function_exists( 'is_post_type_viewable' ) ) : |
| 51 | |
| 52 | /** |
| 53 | * Determines whether a post type is considered "viewable". |
| 54 | * |
| 55 | * For built-in post types such as posts and pages, the 'public' value will be evaluated. |
| 56 | * For all others, the 'publicly_queryable' value will be used. |
| 57 | * |
| 58 | * @since 4.4.0 |
| 59 | * @since 4.5.0 Added the ability to pass a post type name in addition to object. |
| 60 | * @since 4.6.0 Converted the `$post_type` parameter to accept a WP_Post_Type object. |
| 61 | * |
| 62 | * @param string|WP_Post_Type $post_type Post type name or object. |
| 63 | * @return bool Whether the post type should be considered viewable. |
| 64 | */ |
| 65 | function is_post_type_viewable( $post_type ) { |
| 66 | if ( is_scalar( $post_type ) ) { |
| 67 | $post_type = get_post_type_object( $post_type ); |
| 68 | if ( ! $post_type ) { |
| 69 | return false; |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | return $post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public ); |
| 74 | } |
| 75 | |
| 76 | endif; |
| 77 | |
| 78 | |
| 79 | /** |
| 80 | * wp_make_content_images_responsive in WP 4.4.0+ |
| 81 | */ |
| 82 | if ( ! function_exists( 'wp_make_content_images_responsive' ) ) : |
| 83 | |
| 84 | function wp_make_content_images_responsive( $content ) { |
| 85 | return $content; |
| 86 | } |
| 87 | |
| 88 | endif; |
| 89 | |
| 90 | |
| 91 | if ( ! function_exists( 'wp_doing_ajax' ) ) : |
| 92 | |
| 93 | /** |
| 94 | * Determines whether the current request is a WordPress Ajax request. |
| 95 | * |
| 96 | * @since 4.7.0 |
| 97 | * |
| 98 | * @return bool True if it's a WordPress Ajax request, false otherwise. |
| 99 | */ |
| 100 | function wp_doing_ajax() { |
| 101 | /** |
| 102 | * Filters whether the current request is a WordPress Ajax request. |
| 103 | * |
| 104 | * @since 4.7.0 |
| 105 | * |
| 106 | * @param bool $wp_doing_ajax Whether the current request is a WordPress Ajax request. |
| 107 | */ |
| 108 | return apply_filters( 'wp_doing_ajax', defined( 'DOING_AJAX' ) && DOING_AJAX ); |
| 109 | } |
| 110 | |
| 111 | endif; |
| 112 | |
| 113 | |
| 114 | if ( ! function_exists( 'sanitize_hex_color' ) ) : |
| 115 | |
| 116 | /** |
| 117 | * Sanitizes a hex color. |
| 118 | * |
| 119 | * Returns either '', a 3 or 6 digit hex color (with #), or nothing. |
| 120 | * For sanitizing values without a #, see sanitize_hex_color_no_hash(). |
| 121 | * |
| 122 | * @since 3.4.0 |
| 123 | * |
| 124 | * @param string $color |
| 125 | * @return string|void |
| 126 | */ |
| 127 | function sanitize_hex_color( $color ) { |
| 128 | if ( '' === $color ) { |
| 129 | return ''; |
| 130 | } |
| 131 | |
| 132 | // 3 or 6 hex digits, or the empty string. |
| 133 | if ( preg_match( '|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) { |
| 134 | return $color; |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | endif; |
| 139 |