PageRenderTime 44ms CodeModel.GetById 13ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-content/plugins/wordpress-seo/inc/wpseo-non-ajax-functions.php

https://gitlab.com/ngochuynh1991/cuacuon
PHP | 564 lines | 376 code | 66 blank | 122 comment | 84 complexity | 9e6a436b719c4f50f0ca28d668be8e22 MD5 | raw file
  1. <?php
  2. /**
  3. * @package WPSEO\Internals
  4. */
  5. if ( ! defined( 'WPSEO_VERSION' ) ) {
  6. header( 'Status: 403 Forbidden' );
  7. header( 'HTTP/1.1 403 Forbidden' );
  8. exit();
  9. }
  10. /**
  11. * Test whether force rewrite should be enabled or not.
  12. */
  13. function wpseo_title_test() {
  14. $options = get_option( 'wpseo_titles' );
  15. $options['forcerewritetitle'] = false;
  16. $options['title_test'] = 1;
  17. update_option( 'wpseo_titles', $options );
  18. // Setting title_test to > 0 forces the plugin to output the title below through a filter in class-frontend.php.
  19. $expected_title = 'This is a Yoast Test Title';
  20. WPSEO_Utils::clear_cache();
  21. $args = array(
  22. 'user-agent' => sprintf( 'WordPress/%1$s; %2$s - Yoast', $GLOBALS['wp_version'], get_site_url() ),
  23. );
  24. $resp = wp_remote_get( get_bloginfo( 'url' ), $args );
  25. if ( ( $resp && ! is_wp_error( $resp ) ) && ( 200 == $resp['response']['code'] && isset( $resp['body'] ) ) ) {
  26. $res = preg_match( '`<title>([^<]+)</title>`im', $resp['body'], $matches );
  27. if ( $res && strcmp( $matches[1], $expected_title ) !== 0 ) {
  28. $options['forcerewritetitle'] = true;
  29. $resp = wp_remote_get( get_bloginfo( 'url' ), $args );
  30. $res = false;
  31. if ( ( $resp && ! is_wp_error( $resp ) ) && ( 200 == $resp['response']['code'] && isset( $resp['body'] ) ) ) {
  32. $res = preg_match( '`/<title>([^>]+)</title>`im', $resp['body'], $matches );
  33. }
  34. }
  35. if ( ! $res || $matches[1] != $expected_title ) {
  36. $options['forcerewritetitle'] = false;
  37. }
  38. }
  39. else {
  40. // If that dies, let's make sure the titles are correct and force the output.
  41. $options['forcerewritetitle'] = true;
  42. }
  43. $options['title_test'] = 0;
  44. update_option( 'wpseo_titles', $options );
  45. }
  46. // Commented out? add_filter( 'switch_theme', 'wpseo_title_test', 0 ); R.
  47. /**
  48. * Test whether the active theme contains a <meta> description tag.
  49. *
  50. * @since 1.4.14 Moved from dashboard.php and adjusted - see changelog
  51. *
  52. * @return void
  53. */
  54. function wpseo_description_test() {
  55. $options = get_option( 'wpseo' );
  56. // Reset any related options - dirty way of getting the default to make sure it works on activation.
  57. $options['theme_has_description'] = WPSEO_Option_Wpseo::$desc_defaults['theme_has_description'];
  58. $options['theme_description_found'] = WPSEO_Option_Wpseo::$desc_defaults['theme_description_found'];
  59. /**
  60. * @internal Should this be reset too ? Best to do so as test is done on re-activate and switch_theme
  61. * as well and new warning would be warranted then. Only might give irritation on theme upgrade.
  62. */
  63. $options['ignore_meta_description_warning'] = WPSEO_Option_Wpseo::$desc_defaults['ignore_meta_description_warning'];
  64. $file = false;
  65. if ( file_exists( get_stylesheet_directory() . '/header.php' ) ) {
  66. // Theme or child theme.
  67. $file = get_stylesheet_directory() . '/header.php';
  68. }
  69. elseif ( file_exists( get_template_directory() . '/header.php' ) ) {
  70. // Parent theme in case of a child theme.
  71. $file = get_template_directory() . '/header.php';
  72. }
  73. if ( is_string( $file ) && $file !== '' ) {
  74. $header_file = file_get_contents( $file );
  75. $issue = preg_match_all( '#<\s*meta\s*(name|content)\s*=\s*("|\')(.*)("|\')\s*(name|content)\s*=\s*("|\')(.*)("|\')(\s+)?/?>#i', $header_file, $matches, PREG_SET_ORDER );
  76. if ( $issue === false || $issue === 0 ) {
  77. $options['theme_has_description'] = false;
  78. }
  79. else {
  80. foreach ( $matches as $meta ) {
  81. if ( ( strtolower( $meta[1] ) == 'name' && strtolower( $meta[3] ) == 'description' ) || ( strtolower( $meta[5] ) == 'name' && strtolower( $meta[7] ) == 'description' ) ) {
  82. $options['theme_description_found'] = $meta[0];
  83. $options['ignore_meta_description_warning'] = false;
  84. break; // No need to run through the rest of the meta's.
  85. }
  86. }
  87. if ( $options['theme_description_found'] !== '' ) {
  88. $options['theme_has_description'] = true;
  89. }
  90. else {
  91. $options['theme_has_description'] = false;
  92. }
  93. }
  94. }
  95. update_option( 'wpseo', $options );
  96. }
  97. add_filter( 'after_switch_theme', 'wpseo_description_test', 0 );
  98. if ( version_compare( $GLOBALS['wp_version'], '3.6.99', '>' ) ) {
  99. // Use the new and *sigh* adjusted action hook WP 3.7+.
  100. add_action( 'upgrader_process_complete', 'wpseo_upgrader_process_complete', 10, 2 );
  101. }
  102. elseif ( version_compare( $GLOBALS['wp_version'], '3.5.99', '>' ) ) {
  103. // Use the new action hook WP 3.6+.
  104. add_action( 'upgrader_process_complete', 'wpseo_upgrader_process_complete', 10, 3 );
  105. }
  106. else {
  107. // Abuse filters to do our action.
  108. add_filter( 'update_theme_complete_actions', 'wpseo_update_theme_complete_actions', 10, 2 );
  109. add_filter( 'update_bulk_theme_complete_actions', 'wpseo_update_theme_complete_actions', 10, 2 );
  110. }
  111. /**
  112. * Check if the current theme was updated and if so, test the updated theme
  113. * for the title and meta description tag
  114. *
  115. * @since 1.4.14
  116. *
  117. * @param WP_Upgrader $upgrader_object Upgrader object instance.
  118. * @param array $context_array Context data array.
  119. * @param mixed $themes Optional themes set.
  120. *
  121. * @return void
  122. */
  123. function wpseo_upgrader_process_complete( $upgrader_object, $context_array, $themes = null ) {
  124. $options = get_option( 'wpseo' );
  125. // Break if admin_notice already in place.
  126. if ( ( ( isset( $options['theme_has_description'] ) && $options['theme_has_description'] === true ) || $options['theme_description_found'] !== '' ) && $options['ignore_meta_description_warning'] !== true ) {
  127. return;
  128. }
  129. // Break if this is not a theme update, not interested in installs as after_switch_theme would still be called.
  130. if ( ! isset( $context_array['type'] ) || $context_array['type'] !== 'theme' || ! isset( $context_array['action'] ) || $context_array['action'] !== 'update' ) {
  131. return;
  132. }
  133. $theme = get_stylesheet();
  134. if ( ! isset( $themes ) ) {
  135. // WP 3.7+.
  136. $themes = array();
  137. if ( isset( $context_array['themes'] ) && $context_array['themes'] !== array() ) {
  138. $themes = $context_array['themes'];
  139. }
  140. elseif ( isset( $context_array['theme'] ) && $context_array['theme'] !== '' ) {
  141. $themes = $context_array['theme'];
  142. }
  143. }
  144. if ( ( isset( $context_array['bulk'] ) && $context_array['bulk'] === true ) && ( is_array( $themes ) && count( $themes ) > 0 ) ) {
  145. if ( in_array( $theme, $themes ) ) {
  146. // Commented out? wpseo_title_test(); R.
  147. wpseo_description_test();
  148. }
  149. }
  150. elseif ( is_string( $themes ) && $themes === $theme ) {
  151. // Commented out? wpseo_title_test(); R.
  152. wpseo_description_test();
  153. }
  154. return;
  155. }
  156. /**
  157. * Abuse a filter to check if the current theme was updated and if so, test the updated theme
  158. * for the title and meta description tag
  159. *
  160. * @since 1.4.14
  161. *
  162. * @param array $update_actions Updated actions set.
  163. * @param WP_Theme|string $updated_theme Theme object instance or stylesheet name.
  164. *
  165. * @return array $update_actions Unchanged array
  166. */
  167. function wpseo_update_theme_complete_actions( $update_actions, $updated_theme ) {
  168. $options = get_option( 'wpseo' );
  169. // Break if admin_notice already in place.
  170. if ( ( ( isset( $options['theme_has_description'] ) && $options['theme_has_description'] === true ) || $options['theme_description_found'] !== '' ) && $options['ignore_meta_description_warning'] !== true ) {
  171. return $update_actions;
  172. }
  173. $theme = get_stylesheet();
  174. if ( is_object( $updated_theme ) ) {
  175. /*
  176. Bulk update and $updated_theme only contains info on which theme was last in the list
  177. of updated themes, so go & test
  178. */
  179. // Commented out? wpseo_title_test(); R.
  180. wpseo_description_test();
  181. }
  182. elseif ( $updated_theme === $theme ) {
  183. /*
  184. Single theme update for the active theme
  185. */
  186. // Commented out? wpseo_title_test(); R.
  187. wpseo_description_test();
  188. }
  189. return $update_actions;
  190. }
  191. /**
  192. * Adds an SEO admin bar menu with several options. If the current user is an admin he can also go straight to several settings menu's from here.
  193. */
  194. function wpseo_admin_bar_menu() {
  195. // If the current user can't write posts, this is all of no use, so let's not output an admin menu.
  196. if ( ! current_user_can( 'edit_posts' ) ) {
  197. return;
  198. }
  199. global $wp_admin_bar, $post;
  200. $focuskw = '';
  201. $score = '';
  202. $seo_url = get_admin_url( null, 'admin.php?page=wpseo_dashboard' );
  203. if ( ( is_singular() || ( is_admin() && in_array( $GLOBALS['pagenow'], array(
  204. 'post.php',
  205. 'post-new.php',
  206. ), true ) ) ) && isset( $post ) && is_object( $post ) && apply_filters( 'wpseo_use_page_analysis', true ) === true
  207. ) {
  208. $focuskw = WPSEO_Meta::get_value( 'focuskw', $post->ID );
  209. $perc_score = WPSEO_Meta::get_value( 'linkdex', $post->ID );
  210. $txtscore = WPSEO_Utils::translate_score( $perc_score );
  211. $title = WPSEO_Utils::translate_score( $perc_score, false );
  212. $score = '<div title="' . esc_attr( $title ) . '" class="' . esc_attr( 'wpseo-score-icon ' . $txtscore . ' ' . $perc_score ) .
  213. ' adminbar-seo-score' . '"></div>';
  214. $seo_url = get_edit_post_link( $post->ID );
  215. }
  216. $wp_admin_bar->add_menu( array(
  217. 'id' => 'wpseo-menu',
  218. 'title' => __( 'SEO', 'wordpress-seo' ) . $score,
  219. 'href' => $seo_url,
  220. ) );
  221. $wp_admin_bar->add_menu( array(
  222. 'parent' => 'wpseo-menu',
  223. 'id' => 'wpseo-kwresearch',
  224. 'title' => __( 'Keyword Research', 'wordpress-seo' ),
  225. '#',
  226. ) );
  227. $wp_admin_bar->add_menu( array(
  228. 'parent' => 'wpseo-kwresearch',
  229. 'id' => 'wpseo-adwordsexternal',
  230. 'title' => __( 'AdWords External', 'wordpress-seo' ),
  231. 'href' => 'http://adwords.google.com/keywordplanner',
  232. 'meta' => array( 'target' => '_blank' ),
  233. ) );
  234. $wp_admin_bar->add_menu( array(
  235. 'parent' => 'wpseo-kwresearch',
  236. 'id' => 'wpseo-googleinsights',
  237. 'title' => __( 'Google Insights', 'wordpress-seo' ),
  238. 'href' => 'http://www.google.com/insights/search/#q=' . urlencode( $focuskw ) . '&cmpt=q',
  239. 'meta' => array( 'target' => '_blank' ),
  240. ) );
  241. $wp_admin_bar->add_menu( array(
  242. 'parent' => 'wpseo-kwresearch',
  243. 'id' => 'wpseo-wordtracker',
  244. 'title' => __( 'SEO Book', 'wordpress-seo' ),
  245. 'href' => 'http://tools.seobook.com/keyword-tools/seobook/?keyword=' . urlencode( $focuskw ),
  246. 'meta' => array( 'target' => '_blank' ),
  247. ) );
  248. if ( ! is_admin() ) {
  249. $url = WPSEO_Frontend::get_instance()->canonical( false );
  250. if ( is_string( $url ) ) {
  251. $wp_admin_bar->add_menu( array(
  252. 'parent' => 'wpseo-menu',
  253. 'id' => 'wpseo-analysis',
  254. 'title' => __( 'Analyze this page', 'wordpress-seo' ),
  255. '#',
  256. ) );
  257. $wp_admin_bar->add_menu( array(
  258. 'parent' => 'wpseo-analysis',
  259. 'id' => 'wpseo-inlinks-ose',
  260. 'title' => __( 'Check Inlinks (OSE)', 'wordpress-seo' ),
  261. 'href' => '//moz.com/researchtools/ose/links?site=' . urlencode( $url ),
  262. 'meta' => array( 'target' => '_blank' ),
  263. ) );
  264. $wp_admin_bar->add_menu( array(
  265. 'parent' => 'wpseo-analysis',
  266. 'id' => 'wpseo-kwdensity',
  267. 'title' => __( 'Check Keyword Density', 'wordpress-seo' ),
  268. 'href' => '//www.zippy.co.uk/keyworddensity/index.php?url=' . urlencode( $url ) . '&keyword=' . urlencode( $focuskw ),
  269. 'meta' => array( 'target' => '_blank' ),
  270. ) );
  271. $wp_admin_bar->add_menu( array(
  272. 'parent' => 'wpseo-analysis',
  273. 'id' => 'wpseo-cache',
  274. 'title' => __( 'Check Google Cache', 'wordpress-seo' ),
  275. 'href' => '//webcache.googleusercontent.com/search?strip=1&q=cache:' . urlencode( $url ),
  276. 'meta' => array( 'target' => '_blank' ),
  277. ) );
  278. $wp_admin_bar->add_menu( array(
  279. 'parent' => 'wpseo-analysis',
  280. 'id' => 'wpseo-header',
  281. 'title' => __( 'Check Headers', 'wordpress-seo' ),
  282. 'href' => '//quixapp.com/headers/?r=' . urlencode( $url ),
  283. 'meta' => array( 'target' => '_blank' ),
  284. ) );
  285. $wp_admin_bar->add_menu( array(
  286. 'parent' => 'wpseo-analysis',
  287. 'id' => 'wpseo-richsnippets',
  288. 'title' => __( 'Check Rich Snippets', 'wordpress-seo' ),
  289. 'href' => '//www.google.com/webmasters/tools/richsnippets?q=' . urlencode( $url ),
  290. 'meta' => array( 'target' => '_blank' ),
  291. ) );
  292. $wp_admin_bar->add_menu( array(
  293. 'parent' => 'wpseo-analysis',
  294. 'id' => 'wpseo-facebookdebug',
  295. 'title' => __( 'Facebook Debugger', 'wordpress-seo' ),
  296. 'href' => '//developers.facebook.com/tools/debug/og/object?q=' . urlencode( $url ),
  297. 'meta' => array( 'target' => '_blank' ),
  298. ) );
  299. $wp_admin_bar->add_menu( array(
  300. 'parent' => 'wpseo-analysis',
  301. 'id' => 'wpseo-pinterestvalidator',
  302. 'title' => __( 'Pinterest Rich Pins Validator', 'wordpress-seo' ),
  303. 'href' => '//developers.pinterest.com/rich_pins/validator/?link=' . urlencode( $url ),
  304. 'meta' => array( 'target' => '_blank' ),
  305. ) );
  306. $wp_admin_bar->add_menu( array(
  307. 'parent' => 'wpseo-analysis',
  308. 'id' => 'wpseo-htmlvalidation',
  309. 'title' => __( 'HTML Validator', 'wordpress-seo' ),
  310. 'href' => '//validator.w3.org/check?uri=' . urlencode( $url ),
  311. 'meta' => array( 'target' => '_blank' ),
  312. ) );
  313. $wp_admin_bar->add_menu( array(
  314. 'parent' => 'wpseo-analysis',
  315. 'id' => 'wpseo-cssvalidation',
  316. 'title' => __( 'CSS Validator', 'wordpress-seo' ),
  317. 'href' => '//jigsaw.w3.org/css-validator/validator?uri=' . urlencode( $url ),
  318. 'meta' => array( 'target' => '_blank' ),
  319. ) );
  320. $wp_admin_bar->add_menu( array(
  321. 'parent' => 'wpseo-analysis',
  322. 'id' => 'wpseo-pagespeed',
  323. 'title' => __( 'Google Page Speed Test', 'wordpress-seo' ),
  324. 'href' => '//developers.google.com/speed/pagespeed/insights/?url=' . urlencode( $url ),
  325. 'meta' => array( 'target' => '_blank' ),
  326. ) );
  327. $wp_admin_bar->add_menu( array(
  328. 'parent' => 'wpseo-analysis',
  329. 'id' => 'wpseo-modernie',
  330. 'title' => __( 'Modern IE Site Scan', 'wordpress-seo' ),
  331. 'href' => '//www.modern.ie/en-us/report#' . urlencode( $url ),
  332. 'meta' => array( 'target' => '_blank' ),
  333. ) );
  334. $wp_admin_bar->add_menu( array(
  335. 'parent' => 'wpseo-analysis',
  336. 'id' => 'wpseo-google-mobile-friendly',
  337. 'title' => __( 'Mobile-Friendly Test', 'wordpress-seo' ),
  338. 'href' => 'https://www.google.com/webmasters/tools/mobile-friendly/?url=' . urlencode( $url ),
  339. 'meta' => array( 'target' => '_blank' ),
  340. ) );
  341. }
  342. }
  343. $admin_menu = current_user_can( 'manage_options' );
  344. if ( ! $admin_menu && is_multisite() ) {
  345. $options = get_site_option( 'wpseo_ms' );
  346. $admin_menu = ( $options['access'] === 'superadmin' && is_super_admin() );
  347. }
  348. // @todo: add links to bulk title and bulk description edit pages.
  349. if ( $admin_menu ) {
  350. $wp_admin_bar->add_menu( array(
  351. 'parent' => 'wpseo-menu',
  352. 'id' => 'wpseo-settings',
  353. 'title' => __( 'SEO Settings', 'wordpress-seo' ),
  354. ) );
  355. $wp_admin_bar->add_menu( array(
  356. 'parent' => 'wpseo-settings',
  357. 'id' => 'wpseo-general',
  358. 'title' => __( 'General', 'wordpress-seo' ),
  359. 'href' => admin_url( 'admin.php?page=wpseo_dashboard' ),
  360. ) );
  361. $wp_admin_bar->add_menu( array(
  362. 'parent' => 'wpseo-settings',
  363. 'id' => 'wpseo-titles',
  364. 'title' => __( 'Titles &amp; Metas', 'wordpress-seo' ),
  365. 'href' => admin_url( 'admin.php?page=wpseo_titles' ),
  366. ) );
  367. $wp_admin_bar->add_menu( array(
  368. 'parent' => 'wpseo-settings',
  369. 'id' => 'wpseo-social',
  370. 'title' => __( 'Social', 'wordpress-seo' ),
  371. 'href' => admin_url( 'admin.php?page=wpseo_social' ),
  372. ) );
  373. $wp_admin_bar->add_menu( array(
  374. 'parent' => 'wpseo-settings',
  375. 'id' => 'wpseo-xml',
  376. 'title' => __( 'XML Sitemaps', 'wordpress-seo' ),
  377. 'href' => admin_url( 'admin.php?page=wpseo_xml' ),
  378. ) );
  379. $wp_admin_bar->add_menu( array(
  380. 'parent' => 'wpseo-settings',
  381. 'id' => 'wpseo-wpseo-advanced',
  382. 'title' => __( 'Advanced', 'wordpress-seo' ),
  383. 'href' => admin_url( 'admin.php?page=wpseo_advanced' ),
  384. ) );
  385. $wp_admin_bar->add_menu( array(
  386. 'parent' => 'wpseo-settings',
  387. 'id' => 'wpseo-tools',
  388. 'title' => __( 'Tools', 'wordpress-seo' ),
  389. 'href' => admin_url( 'admin.php?page=wpseo_tools' ),
  390. ) );
  391. $wp_admin_bar->add_menu( array(
  392. 'parent' => 'wpseo-settings',
  393. 'id' => 'wpseo-search-console',
  394. 'title' => __( 'Search Console', 'wordpress-seo' ),
  395. 'href' => admin_url( 'admin.php?page=wpseo_search_console' ),
  396. ) );
  397. $wp_admin_bar->add_menu( array(
  398. 'parent' => 'wpseo-settings',
  399. 'id' => 'wpseo-licenses',
  400. 'title' => '<span style="color:#f18500">' . __( 'Extensions', 'wordpress-seo' ) . '</span>',
  401. 'href' => admin_url( 'admin.php?page=wpseo_licenses' ),
  402. ) );
  403. }
  404. }
  405. add_action( 'admin_bar_menu', 'wpseo_admin_bar_menu', 95 );
  406. /**
  407. * Enqueue a tiny bit of CSS to show so the adminbar shows right.
  408. */
  409. function wpseo_admin_bar_style() {
  410. $enqueue_style = false;
  411. // Single post in the frontend.
  412. if ( ! is_admin() && is_admin_bar_showing() ) {
  413. $enqueue_style = ( is_singular() || is_category() );
  414. }
  415. // Single post in the backend.
  416. if ( is_admin() ) {
  417. $screen = get_current_screen();
  418. // Post (every post_type) or category page.
  419. if ( 'post' === $screen->base || 'edit-tags' === $screen->base ) {
  420. $enqueue_style = true;
  421. }
  422. }
  423. if ( $enqueue_style ) {
  424. $asset_manager = new WPSEO_Admin_Asset_Manager();
  425. $asset_manager->register_assets();
  426. $asset_manager->enqueue_style( 'adminbar' );
  427. }
  428. }
  429. add_action( 'wp_enqueue_scripts', 'wpseo_admin_bar_style' );
  430. add_action( 'admin_enqueue_scripts', 'wpseo_admin_bar_style' );
  431. /**
  432. * Allows editing of the meta fields through weblog editors like Marsedit.
  433. *
  434. * @param array $allcaps Capabilities that must all be true to allow action.
  435. * @param array $cap Array of capabilities to be checked, unused here.
  436. * @param array $args List of arguments for the specific cap to be checked.
  437. *
  438. * @return array $allcaps
  439. */
  440. function allow_custom_field_edits( $allcaps, $cap, $args ) {
  441. // $args[0] holds the capability.
  442. // $args[2] holds the post ID.
  443. // $args[3] holds the custom field.
  444. // Make sure the request is to edit or add a post meta (this is usually also the second value in $cap,
  445. // but this is safer to check).
  446. if ( in_array( $args[0], array( 'edit_post_meta', 'add_post_meta' ) ) ) {
  447. // Only allow editing rights for users who have the rights to edit this post and make sure
  448. // the meta value starts with _yoast_wpseo (WPSEO_Meta::$meta_prefix).
  449. if ( ( isset( $args[2] ) && current_user_can( 'edit_post', $args[2] ) ) && ( ( isset( $args[3] ) && $args[3] !== '' ) && strpos( $args[3], WPSEO_Meta::$meta_prefix ) === 0 ) ) {
  450. $allcaps[ $args[0] ] = true;
  451. }
  452. }
  453. return $allcaps;
  454. }
  455. add_filter( 'user_has_cap', 'allow_custom_field_edits', 0, 3 );
  456. /********************** DEPRECATED FUNCTIONS **********************/
  457. /**
  458. * Set the default settings.
  459. *
  460. * @deprecated 1.5.0
  461. * @deprecated use WPSEO_Options::initialize()
  462. * @see WPSEO_Options::initialize()
  463. */
  464. function wpseo_defaults() {
  465. _deprecated_function( __FUNCTION__, 'WPSEO 1.5.0', 'WPSEO_Options::initialize()' );
  466. WPSEO_Options::initialize();
  467. }
  468. /**
  469. * Translates a decimal analysis score into a textual one.
  470. *
  471. * @deprecated 1.5.6.1
  472. * @deprecated use WPSEO_Utils::translate_score()
  473. * @see WPSEO_Utils::translate_score()
  474. *
  475. * @param int $val The decimal score to translate.
  476. * @param bool $css_value Whether to return the i18n translated score or the CSS class value.
  477. *
  478. * @return string
  479. */
  480. function wpseo_translate_score( $val, $css_value = true ) {
  481. _deprecated_function( __FUNCTION__, 'WPSEO 1.5.6.1', 'WPSEO_Utils::translate_score()' );
  482. return WPSEO_Utils::translate_score();
  483. }
  484. /**
  485. * Check whether file editing is allowed for the .htaccess and robots.txt files
  486. *
  487. * @deprecated 1.5.6.1
  488. * @deprecated use WPSEO_Utils::allow_system_file_edit()
  489. * @see WPSEO_Utils::allow_system_file_edit()
  490. *
  491. * @internal current_user_can() checks internally whether a user is on wp-ms and adjusts accordingly.
  492. *
  493. * @return bool
  494. */
  495. function wpseo_allow_system_file_edit() {
  496. _deprecated_function( __FUNCTION__, 'WPSEO 1.5.6.1', 'WPSEO_Utils::allow_system_file_edit()' );
  497. return WPSEO_Utils::allow_system_file_edit();
  498. }