`n鵖U@=鵖U0PA鵖U<`n鵖U=鵖UPA鵖U<`n鵖Up=鵖UPA鵖U<`n鵖Up=鵖UpPA鵖U<`n鵖Up@ =鵖U0PA鵖U<`n鵖Up(=鵖UPA鵖U<`n鵖Up0=鵖UPA鵖U<`n鵖Up8=鵖UpPA鵖U<`n鵖Up@@=鵖U0PA鵖U<`n鵖UpH=鵖UPA鵖U<`n鵖UpP=鵖UPA鵖U<Ы鵖U>dAPpdA0p(ydAp(ydAp(ydAp(ydAp(ydA8Gp(ydA Fp(ydA@p(ydA8@p(ydAp@p`eUpj@XAjj pj p赖U@P&UP&?U`0' ~鵖U'*鵖U )q 굖U `)굖UP)A鵖U`)AЋ鵖U)<4굖U)`U굖U@)+ ~鵖U`** 굖U``-Up-`n鵖U0(/= 굖U p /0n굖U 0/굖U0P/AЋ鵖U@/<U@/`n鵖U00= 굖Up`00n굖U`p0굖UpP0AЋ鵖U0<U0鵖U081qUP1uU`1u鵖U1<쵖U`'"굖U`P'"@W굖U',Ы鵖Up3>pp/pp`/ppp p7ApNAp>QApp>QApphppp`eUȺ8p*p*pPARAp+p赖U@P&UP&?U`0' ~鵖U'*鵖U (q 굖U `(굖UP(A鵖U`(AЋ鵖U(<4굖U(`U굖U@(+ ~鵖U`)* 굖U``,Up,`n鵖U0(.= 굖U p .0n굖U 0.굖U0P.AЋ鵖U@.<U@.`n鵖U0/= 굖Up`/0n굖U`p/굖UpP/AЋ鵖U/<U/鵖U080qUP0uU`0u鵖U0<쵖U`'"굖U`P'"ivate function get_woo_product_data() { global $post; $data = []; $product = \wc_get_product( $post ); $data[ __( 'Price', 'rank-math' ) ] = $this->get_product_price( $product ); $data[ __( 'Availability', 'rank-math' ) ] = $this->get_product_availability( $product ); return $data; } /** * Get Slack data for EDD download. * * @return array */ private function get_edd_product_data() { global $post; $data = []; $data[ __( 'Price', 'rank-math' ) ] = wp_strip_all_tags( \edd_price( $post->ID, false ) ); return $data; } /** * Get availability of product. * * @param object $product Product object. * * @return string */ private function get_product_availability( $product ) { $product_availability = $product->get_availability(); $availability_text = isset( $product_availability['availability'] ) ? $product_availability['availability'] : ''; if ( ! $availability_text ) { return __( 'In stock', 'rank-math' ); } return $availability_text; } /** * Get price of WooCommerce product. * Gets price range for variable products. * * @param object $product Product object. * * @return string */ private function get_product_price( $product ) { $price = wp_strip_all_tags( \wc_price( $product->get_price() ) ); if ( $product->is_type( 'variable' ) ) { $lowest = \wc_format_decimal( $product->get_variation_price( 'min', false ), \wc_get_price_decimals() ); $highest = \wc_format_decimal( $product->get_variation_price( 'max', false ), \wc_get_price_decimals() ); $price = wp_strip_all_tags( \wc_price( $lowest ) . ' - ' . \wc_price( $highest ) ); if ( $lowest === $highest ) { $price = wp_strip_all_tags( \wc_price( $lowest ) ); } } return $price; } /** * Get Slack data for post. * * @return array */ private function get_post_data() { global $post; $data = []; $data[ __( 'Written by', 'rank-math' ) ] = get_the_author(); $data[ __( 'Time to read', 'rank-math' ) ] = $this->calculate_time_to_read( $post ); return $data; } /** * Get Slack data for page. * * @return array */ private function get_page_data() { global $post; $data = []; $data[ __( 'Time to read', 'rank-math' ) ] = $this->calculate_time_to_read( $post ); return $data; } /** * Calculate the time to read for the post. * * @param object $post Post object. * * @return string */ private function calculate_time_to_read( $post ) { /** * Filter: 'rank_math/frontend/time_to_read_content' - Change the text to calculate the time to read. * * Note: Avoid using `do_shortcode()` or `the_content` here, as running complex * shortcodes (PHP logic, scripts, styles) can break the site. If shortcode * parsing is needed, handle it via a filter instead. */ $content = $this->do_filter( 'frontend/time_to_read_content', wp_strip_all_tags( $post->post_content ) ); /** * Filter: 'rank_math/frontend/time_to_read_wpm' - Change the words per minute to calculate the time to read. */ $words_per_minute = absint( $this->do_filter( 'frontend/time_to_read_wpm', 200 ) ); $words = preg_match_all( '/\p{L}+/u', $content ); $minutes = floor( $words / $words_per_minute ); if ( $minutes > 0 ) { return sprintf( /* translators: %d: minutes */ _n( '%d minute', '%d minutes', $minutes, 'rank-math' ), $minutes ); } return __( 'Less than a minute', 'rank-math' ); } /** * Get Slack data for term. * * @return array */ private function get_term_data() { global $wp_query; $data = []; $term = $wp_query->get_queried_object(); if ( ! $term ) { return $data; } $label = __( 'Items', 'rank-math' ); $post_type_object = get_post_type_object( get_post_type() ); if ( is_object( $post_type_object ) && isset( $post_type_object->labels->name ) ) { $label = $post_type_object->labels->name; } $data[ $label ] = ( ! empty( $term->category_count ) ? $term->category_count : $term->count ); return $data; } /** * Get Slack data for author. * * @return array */ private function get_author_data() { global $wp_query; $data = []; $author = $wp_query->get_queried_object(); if ( ! $author || ! is_object( $author ) || ! isset( $author->ID ) ) { return $data; } // Check with get_userdata() to avoid issues with guest authors. $userdata = get_userdata( $author->ID ); if ( ! $userdata || ! is_object( $userdata ) || ! isset( $userdata->ID ) ) { return $data; } $data[ __( 'Name', 'rank-math' ) ] = $author->display_name; $data[ __( 'Posts', 'rank-math' ) ] = count_user_posts( $author->ID ); return $data; } }