ced with the post/page author\'s userid', 'wordpress-seo' ), 'currenttime' => __( 'Replaced with the current time', 'wordpress-seo' ), 'currentdate' => __( 'Replaced with the current date', 'wordpress-seo' ), 'currentday' => __( 'Replaced with the current day', 'wordpress-seo' ), 'currentmonth' => __( 'Replaced with the current month', 'wordpress-seo' ), 'currentyear' => __( 'Replaced with the current year', 'wordpress-seo' ), 'page' => __( 'Replaced with the current page number with context (i.e. page 2 of 4)', 'wordpress-seo' ), 'pagetotal' => __( 'Replaced with the current page total', 'wordpress-seo' ), 'pagenumber' => __( 'Replaced with the current page number', 'wordpress-seo' ), 'caption' => __( 'Attachment caption', 'wordpress-seo' ), 'focuskw' => __( 'Replaced with the posts focus keyword', 'wordpress-seo' ), 'term404' => __( 'Replaced with the slug which caused the 404', 'wordpress-seo' ), 'cf_' => __( 'Replaced with a posts custom field value', 'wordpress-seo' ), 'ct_' => __( 'Replaced with a posts custom taxonomies, comma separated.', 'wordpress-seo' ), 'ct_desc_' => __( 'Replaced with a custom taxonomies description', 'wordpress-seo' ), ); } /* *********************** GENERAL HELPER METHODS ************************** */ /** * Remove the '%%' delimiters from a variable string. * * @param string $string Variable string to be cleaned. * * @return string */ private static function remove_var_delimiter( $string ) { return trim( $string, '%' ); } /** * Add the '%%' delimiters to a variable string. * * @param string $string Variable string to be delimited. * * @return string */ private static function add_var_delimiter( $string ) { return '%%' . $string . '%%'; } /** * Retrieve a post's terms, comma delimited. * * @param int $id ID of the post to get the terms for. * @param string $taxonomy The taxonomy to get the terms for this post from. * @param bool $return_single If true, return the first term. * * @return string Either a single term or a comma delimited string of terms. */ public function get_terms( $id, $taxonomy, $return_single = false ) { $output = ''; // If we're on a specific tag, category or taxonomy page, use that. if ( is_category() || is_tag() || is_tax() ) { $term = $GLOBALS['wp_query']->get_queried_object(); $output = $term->name; } elseif ( ! empty( $id ) && ! empty( $taxonomy ) ) { $terms = get_the_terms( $id, $taxonomy ); if ( is_array( $terms ) && $terms !== array() ) { foreach ( $terms as $term ) { if ( $return_single ) { $output = $term->name; break; } else { $output .= $term->name . ', '; } } $output = rtrim( trim( $output ), ',' ); } } unset( $terms, $term ); /** * Allows filtering of the terms list used to replace %%category%%, %%tag%% and %%ct_%% variables. * * @api string $output Comma-delimited string containing the terms. */ return apply_filters( 'wpseo_terms', $output ); } } /* End of class WPSEO_Replace_Vars */ /** * Setup the class statics when the file is first loaded. */ WPSEO_Replace_Vars::setup_statics_once();