{"id":344,"date":"2020-01-22T11:33:01","date_gmt":"2020-01-22T02:33:01","guid":{"rendered":"https:\/\/beiyan-tool.info\/?p=344"},"modified":"2020-01-22T11:35:45","modified_gmt":"2020-01-22T02:35:45","slug":"wordpress%e3%81%a7%e3%80%8c%e8%87%b4%e5%91%bd%e7%9a%84%e3%81%aa%e3%82%a8%e3%83%a9%e3%83%bc%e3%82%92%e3%83%81%e3%82%a7%e3%83%83%e3%82%af%e3%81%99%e3%82%8b%e3%81%9f%e3%82%81%e3%81%ab%e3%80%8d","status":"publish","type":"post","link":"https:\/\/beiyan-tool.info\/?p=344","title":{"rendered":"WordPress\u3067\u300c\u81f4\u547d\u7684\u306a\u30a8\u30e9\u30fc\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b\u305f\u3081\u306b\u2026\u300d\u30a8\u30e9\u30fc\u304c\u89e3\u6c7a\u3067\u304d\u306a\u3044\u5834\u5408\u306e\u5bfe\u51e6\u6cd5"},"content":{"rendered":"<p>WordPress\u306e\u30c6\u30fc\u30de\u30a8\u30c7\u30a3\u30bf\u3067\u30d5\u30a1\u30a4\u30eb\u306e\u66f4\u65b0\u306b\u5931\u6557\u3059\u308b\u5834\u5408\u306e\u5bfe\u51e6\u6cd5\u3092\u8aad\u3093\u3067\u3082\u554f\u984c\u89e3\u6c7a\u3067\u304d\u306a\u3044\u5834\u5408\u306e\u5bfe\u51e6\u6cd5\u306b\u95a2\u3057\u3066\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n<p>WordPress\u306e\u30c6\u30fc\u30de\u306e\u4f5c\u308a\u65b9\u3092\u5b66\u307c\u3046\u3068\u8003\u3048\u3001Kindle unlimited\u3067\u898b\u3064\u3051\u305f<br \/>\n\u300c<a href=\"http:\/\/kopsystem.azurewebsites.net\/paapi\/linkwtag.aspx?p=beiyan&amp;atag=bujyutsu-suki-22&amp;asin=B07S2HR69C\" target=\"_blank\" rel=\"noopener noreferrer\">\u30b0\u30fc\u30c6\u30f3\u30d9\u30eb\u30af\u6642\u4ee3\u306eWordPress\u30ce\u30fc\u30c8 \u30c6\u30fc\u30de\u306e\u4f5c\u308a\u65b9\uff08\u5165\u9580\u7de8\uff09 (EP NOTE SERIES)<\/a>\u300d\u3068\u3044\u3046\u672c\u3092\u8aad\u3093\u3067\u3044\u307e\u3059\u3002<\/p>\n<p>\u66f8\u7c4d\u306b\u66f8\u3044\u3066\u3042\u308b\u3068\u304a\u308a\u3001\u30c6\u30fc\u30de\u30a8\u30c7\u30a3\u30bf\u3067\u300cindex.php\u300d\u306b\u30b3\u30fc\u30c9\u3092\u66f8\u304d\u3001\u300c\u30d5\u30a1\u30a4\u30eb\u3092\u66f4\u65b0\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u305f\u6240\u3001\u6b21\u306e\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u3066\u66f4\u65b0\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<div class=\"redbox\">\u81f4\u547d\u7684\u306a\u30a8\u30e9\u30fc\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b\u305f\u3081\u306b\u30b5\u30a4\u30c8\u3068\u901a\u4fe1\u3067\u304d\u306a\u3044\u305f\u3081\u3001PHP \u306e\u5909\u66f4\u306f\u53d6\u308a\u6d88\u3055\u308c\u307e\u3057\u305f\u3002SFTP \u3092\u4f7f\u3046\u306a\u3069\u3001\u4ed6\u306e\u624b\u6bb5\u3067 PHP \u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/div>\n<p>\u8abf\u3079\u3066\u307f\u305f\u6240\u3001wp-admin\/includes\/file.php\u306e\u4ee5\u4e0b\u306e\u90e8\u5206\u3092\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3059\u308b\u3068\u554f\u984c\u304c\u89e3\u6c7a\u3059\u308b\u3068\u66f8\u3044\u3066\u3042\u308a\u307e\u3059\u3002<br \/>\n\u591a\u304f\u306e\u30d6\u30ed\u30b0\u3067492\u301c599\u884c\u76ee\u3068\u8a18\u8ff0\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001WordPress\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u3088\u308a\u884c\u756a\u53f7\u306f\u7570\u306a\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n<pre class=\"lang:php decode:true \">\tif ( $is_active &amp;&amp; 'php' === $extension ) {\r\n\r\n\t\t$scrape_key   = md5( rand() );\r\n\t\t$transient    = 'scrape_key_' . $scrape_key;\r\n\t\t$scrape_nonce = strval( rand() );\r\n\t\tset_transient( $transient, $scrape_nonce, 60 ); \/\/ It shouldn't take more than 60 seconds to make the two loopback requests.\r\n\r\n\t\t$cookies       = wp_unslash( $_COOKIE );\r\n\t\t$scrape_params = array(\r\n\t\t\t'wp_scrape_key'   =&gt; $scrape_key,\r\n\t\t\t'wp_scrape_nonce' =&gt; $scrape_nonce,\r\n\t\t);\r\n\t\t$headers       = array(\r\n\t\t\t'Cache-Control' =&gt; 'no-cache',\r\n\t\t);\r\n\r\n\t\t\/** This filter is documented in wp-includes\/class-wp-http-streams.php *\/\r\n\t\t$sslverify = apply_filters( 'https_local_ssl_verify', false );\r\n\r\n\t\t\/\/ Include Basic auth in loopback requests.\r\n\t\tif ( isset( $_SERVER['PHP_AUTH_USER'] ) &amp;&amp; isset( $_SERVER['PHP_AUTH_PW'] ) ) {\r\n\t\t\t$headers['Authorization'] = 'Basic ' . base64_encode( wp_unslash( $_SERVER['PHP_AUTH_USER'] ) . ':' . wp_unslash( $_SERVER['PHP_AUTH_PW'] ) );\r\n\t\t}\r\n\r\n\t\t\/\/ Make sure PHP process doesn't die before loopback requests complete.\r\n\t\tset_time_limit( 300 );\r\n\r\n\t\t\/\/ Time to wait for loopback requests to finish.\r\n\t\t$timeout = 100;\r\n\r\n\t\t$needle_start = \"###### wp_scraping_result_start:$scrape_key ######\";\r\n\t\t$needle_end   = \"###### wp_scraping_result_end:$scrape_key ######\";\r\n\r\n\t\t\/\/ Attempt loopback request to editor to see if user just whitescreened themselves.\r\n\t\tif ( $plugin ) {\r\n\t\t\t$url = add_query_arg( compact( 'plugin', 'file' ), admin_url( 'plugin-editor.php' ) );\r\n\t\t} elseif ( isset( $stylesheet ) ) {\r\n\t\t\t$url = add_query_arg(\r\n\t\t\t\tarray(\r\n\t\t\t\t\t'theme' =&gt; $stylesheet,\r\n\t\t\t\t\t'file'  =&gt; $file,\r\n\t\t\t\t),\r\n\t\t\t\tadmin_url( 'theme-editor.php' )\r\n\t\t\t);\r\n\t\t} else {\r\n\t\t\t$url = admin_url();\r\n\t\t}\r\n\t\t$url                    = add_query_arg( $scrape_params, $url );\r\n\t\t$r                      = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) );\r\n\t\t$body                   = wp_remote_retrieve_body( $r );\r\n\t\t$scrape_result_position = strpos( $body, $needle_start );\r\n\r\n\t\t$loopback_request_failure = array(\r\n\t\t\t'code'    =&gt; 'loopback_request_failed',\r\n\t\t\t'message' =&gt; __( 'Unable to communicate back with site to check for fatal errors, so the PHP change was reverted. You will need to upload your PHP file change by some other means, such as by using SFTP.' ),\r\n\t\t);\r\n\t\t$json_parse_failure       = array(\r\n\t\t\t'code' =&gt; 'json_parse_error',\r\n\t\t);\r\n\r\n\t\t$result = null;\r\n\t\tif ( false === $scrape_result_position ) {\r\n\t\t\t$result = $loopback_request_failure;\r\n\t\t} else {\r\n\t\t\t$error_output = substr( $body, $scrape_result_position + strlen( $needle_start ) );\r\n\t\t\t$error_output = substr( $error_output, 0, strpos( $error_output, $needle_end ) );\r\n\t\t\t$result       = json_decode( trim( $error_output ), true );\r\n\t\t\tif ( empty( $result ) ) {\r\n\t\t\t\t$result = $json_parse_failure;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t\/\/ Try making request to homepage as well to see if visitors have been whitescreened.\r\n\t\tif ( true === $result ) {\r\n\t\t\t$url                    = home_url( '\/' );\r\n\t\t\t$url                    = add_query_arg( $scrape_params, $url );\r\n\t\t\t$r                      = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout' ) );\r\n\t\t\t$body                   = wp_remote_retrieve_body( $r );\r\n\t\t\t$scrape_result_position = strpos( $body, $needle_start );\r\n\r\n\t\t\tif ( false === $scrape_result_position ) {\r\n\t\t\t\t$result = $loopback_request_failure;\r\n\t\t\t} else {\r\n\t\t\t\t$error_output = substr( $body, $scrape_result_position + strlen( $needle_start ) );\r\n\t\t\t\t$error_output = substr( $error_output, 0, strpos( $error_output, $needle_end ) );\r\n\t\t\t\t$result       = json_decode( trim( $error_output ), true );\r\n\t\t\t\tif ( empty( $result ) ) {\r\n\t\t\t\t\t$result = $json_parse_failure;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tdelete_transient( $transient );\r\n\r\n\t\tif ( true !== $result ) {\r\n\r\n\t\t\t\/\/ Roll-back file change.\r\n\t\t\tfile_put_contents( $real_file, $previous_content );\r\n\t\t\tif ( function_exists( 'opcache_invalidate' ) ) {\r\n\t\t\t\topcache_invalidate( $real_file, true );\r\n\t\t\t}\r\n\r\n\t\t\tif ( ! isset( $result['message'] ) ) {\r\n\t\t\t\t$message = __( 'Something went wrong.' );\r\n\t\t\t} else {\r\n\t\t\t\t$message = $result['message'];\r\n\t\t\t\tunset( $result['message'] );\r\n\t\t\t}\r\n\t\t\treturn new WP_Error( 'php_error', $message, $result );\r\n\t\t}\r\n\t}<\/pre>\n<p><strong><span class=\"ymarker\">\u300cif ( $is_active &amp;&amp; &#8216;php&#8217; === $extension ) {\u300d<\/span><\/strong>\u306e\u524d\u306e\u884c\u306b\u300c\/*\u300d\u3001<br \/>\n\u4e00\u756a\u6700\u5f8c\u306e\u884c\u306e\u6b21\uff08<strong><span class=\"ymarker\">\u300cif ( $theme instanceof WP_Theme ) {\u300d<\/span><\/strong>\u306e\u524d\uff09\u306b\u300c*\/\u300d\u3068\u5165\u529b\u3057\u3066\u304b\u3089\u3001\u518d\u5ea6\u3001\u30c6\u30fc\u30de\u30a8\u30c7\u30a3\u30bf\u3067\u300c\u30d5\u30a1\u30a4\u30eb\u306e\u66f4\u65b0\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u305f\u3068\u3053\u308d\u3001<br \/>\n\u6b21\u306e\u30a8\u30e9\u30fc\u306b\u5909\u308f\u308a\u307e\u3057\u305f\u3002<\/p>\n<div class=\"redbox\">\u4f55\u304b\u3046\u307e\u304f\u3044\u304b\u306a\u304b\u3063\u305f\u3088\u3046\u3067\u3059\u3002\u5909\u66f4\u304c\u4fdd\u5b58\u3055\u308c\u3066\u3044\u306a\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002\u624b\u52d5\u3067\u4fee\u6b63\u3057\u3001FTP \u7d4c\u7531\u3067\u30d5\u30a1\u30a4\u30eb\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/div>\n\n\t<p style=\"color:#666;margin-bottom:5px;\">\u30b9\u30dd\u30f3\u30b5\u30fc\u30ea\u30f3\u30af<\/p>\n\t<div class=\"middle-ad\">\n\t\t\t\t\t\t\t<div class=\"textwidget\"><p><script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script><br \/>\n<!-- \u6b66\u8853\u304c\u597d\u304d --><br \/>\n<ins class=\"adsbygoogle\"\n     style=\"display:block\"\n     data-ad-client=\"ca-pub-8986630938426235\"\n     data-ad-slot=\"2584434263\"\n     data-ad-format=\"auto\"\n     data-full-width-responsive=\"true\"><\/ins><br \/>\n<script>\n(adsbygoogle = window.adsbygoogle || []).push({});\n<\/script><\/p>\n<\/div>\n\t\t\t\t\t\t<\/div>\n\n\n<p>\u8a66\u3057\u306b\u3001\u8a72\u5f53\u90e8\u5206\u3092\u5168\u90e8\u524a\u9664\u3057\u3066\u307f\u3066\u304b\u3089\u3084\u3063\u3066\u307f\u305f\u3089\u3001\u3046\u307e\u304f\u3044\u304d\u307e\u3057\u305f\u3002<br \/>\n\u306a\u306e\u3067\u3001\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u304c\u3046\u307e\u304f\u8a00\u3063\u3066\u306a\u3044\u3068\u8a00\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u884c\u304c\u3042\u308b\u305b\u3044\u3067\u3001\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u306b\u5931\u6557\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<div class=\"redbox\">\/** This filter is documented in wp-includes\/class-wp-http-streams.php *\/<\/div>\n<p>\u3053\u306e\u884c\u3092\u6b21\u306e\u3088\u3046\u306b\u66f8\u304d\u63db\u3048\u307e\u3059\u3002<\/p>\n<div class=\"redbox\">\/\/This filter is documented in wp-includes\/class-wp-http-streams.php<\/div>\n<p>\u300c\u30d5\u30a1\u30a4\u30eb\u3092\u66f4\u65b0\u300d\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u3001\u300c\u30d5\u30a1\u30a4\u30eb\u306e\u7de8\u96c6\u306b\u6210\u529f\u3057\u307e\u3057\u305f\u3002\u300d<br \/>\n\u3068\u3044\u3046\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u51fa\u3066\u3001\u3046\u307e\u304f\u3044\u304f\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress\u306e\u30c6\u30fc\u30de\u30a8\u30c7\u30a3\u30bf\u3067\u30d5\u30a1\u30a4\u30eb\u306e\u66f4\u65b0\u306b\u5931\u6557\u3059\u308b\u5834\u5408\u306e\u5bfe\u51e6\u6cd5\u3092\u8aad\u3093\u3067\u3082\u554f\u984c\u89e3\u6c7a\u3067\u304d\u306a\u3044\u5834\u5408\u306e\u5bfe\u51e6\u6cd5\u306b\u95a2\u3057\u3066\u8a18\u8ff0\u3057\u307e\u3059\u3002 WordPress\u306e\u30c6\u30fc\u30de\u306e\u4f5c\u308a\u65b9\u3092\u5b66\u307c\u3046\u3068\u8003\u3048\u3001Kindle un &#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[99],"tags":[],"class_list":["post-344","post","type-post","status-publish","format-standard","hentry","category-misc"],"_links":{"self":[{"href":"https:\/\/beiyan-tool.info\/index.php?rest_route=\/wp\/v2\/posts\/344","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/beiyan-tool.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/beiyan-tool.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/beiyan-tool.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/beiyan-tool.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=344"}],"version-history":[{"count":3,"href":"https:\/\/beiyan-tool.info\/index.php?rest_route=\/wp\/v2\/posts\/344\/revisions"}],"predecessor-version":[{"id":347,"href":"https:\/\/beiyan-tool.info\/index.php?rest_route=\/wp\/v2\/posts\/344\/revisions\/347"}],"wp:attachment":[{"href":"https:\/\/beiyan-tool.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=344"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/beiyan-tool.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=344"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/beiyan-tool.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}