/** * To translate Yoast columns * @see WPSEO_Meta_Columns::column_content * @scope admin * * @param string $text * * @return string * @todo Yoast said things might change in the next version. See the pull request * @link https://github.com/Yoast/wordpress-seo/pull/1946 */ public static function filter__wpseo_columns($text) { if (WPGlobus_WP::is_filter_called_by('column_content', 'WPSEO_Meta_Columns')) { if (self::$yoastseo_separator && false !== strpos($text, self::$yoastseo_separator)) { $title_arr = explode(self::$yoastseo_separator, $text); foreach ($title_arr as $key => $piece) { if ((int) $key === 0) { $title_arr[$key] = WPGlobus_Core::text_filter($piece, WPGlobus::Config()->language) . ' '; } else { $title_arr[$key] = ' ' . WPGlobus_Core::text_filter($piece, WPGlobus::Config()->language); } } $text = implode(self::$yoastseo_separator, $title_arr); } else { $text = WPGlobus_Core::text_filter($text, WPGlobus::Config()->language, null, WPGlobus::Config()->default_language); } } return $text; }
/** * To translate Yoast columns * @see WPSEO_Metabox::column_content * @scope admin * * @param string $text * * @return string * @todo Yoast said things might change in the next version. See the pull request * @link https://github.com/Yoast/wordpress-seo/pull/1946 */ public static function filter__wpseo_columns($text) { if (WPGlobus_WP::is_filter_called_by('column_content', 'WPSEO_Metabox')) { $text = WPGlobus_Core::text_filter($text, WPGlobus::Config()->language, null, WPGlobus::Config()->default_language); } return $text; }
/** * This filter is needed to build correct permalink (slug, post_name) * using only the main part of the post title (in the default language). * - * Because 'sanitize_title' is a commonly used function, we have to apply our filter * only on very specific calls. Therefore, there are (ugly) debug_backtrace checks. * - * Case 1 * When a draft post is created, * the post title is converted to the slug in the @see get_sample_permalink function, * using the 'sanitize_title' filter. * - * Case 2 * When the draft is published, @see wp_insert_post calls * @see sanitize_title to set the slug * - * @see WPGLobus_QA::_test_post_name * - * @see WPSEO_Metabox::localize_script * @todo Check what's going on in localize_script of WPSEO? * @todo What if there is no EN language? Only ru and kz but - we cannot use 'en' for permalink * @todo check guid * * @param string $title * * @return string */ public static function filter__sanitize_title($title) { if (WPGlobus_WP::is_filter_called_by('get_sample_permalink') || WPGlobus_WP::is_filter_called_by('wp_insert_post') || WPGlobus_WP::is_filter_called_by('wp_update_term')) { /** * @internal_note: the DEFAULT language, not the current one */ $title = WPGlobus_Core::text_filter($title, WPGlobus::Config()->default_language); } return $title; }