{"id":16751,"date":"2014-12-17T08:00:18","date_gmt":"2014-12-16T23:00:18","guid":{"rendered":"http:\/\/www.sssg.org\/blogs\/hiro345\/?p=16751"},"modified":"2014-12-15T17:53:23","modified_gmt":"2014-12-15T08:53:23","slug":"staticpress%e3%81%a7%e7%94%bb%e5%83%8f%e3%81%a4%e3%81%8d%e3%81%ae%e6%8a%95%e7%a8%bf%e3%82%92%e6%96%b0%e8%a6%8f%e4%bd%9c%e6%88%90%e3%81%99%e3%82%8b%e3%81%a8%e3%81%86%e3%81%be%e3%81%8f%e5%8b%95%e3%81%8b","status":"publish","type":"post","link":"https:\/\/www.hiro345.net\/blogs\/hiro345\/archives\/16751.html","title":{"rendered":"StaticPress\u3067\u753b\u50cf\u3064\u304d\u306e\u6295\u7a3f\u3092\u65b0\u898f\u4f5c\u6210\u3059\u308b\u3068\u3046\u307e\u304f\u52d5\u304b\u306a\u3044\u5834\u5408\u306e\u5bfe\u51e6"},"content":{"rendered":"<p>\u300c<a href=\"http:\/\/jushock.hateblo.jp\/entry\/2014\/08\/05\/203840\">WordPress \u306e\u30d7\u30e9\u30b0\u30a4\u30f3 StaticPress \u3067\u30cf\u30de\u3063\u305f\u8a71 &#8211; \u308f\u308a\u3068\u6280\u8853\u7684\u306a\u8a71<\/a>\u300d\u306b\u3042\u308a\u307e\u3059\u304c\u3001StaticPress\u3067\u753b\u50cf\u3064\u304d\u306e\u6295\u7a3f\u3092\u65b0\u898f\u4f5c\u6210\u3059\u308b\u3068\u3046\u307e\u304f\u52d5\u304b\u306a\u3044\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002\u904b\u7528\u3067\u3001\u5148\u306b\u6295\u7a3f\u3092\u4f5c\u6210\u3057\u3066\u304b\u3089\u69cb\u7bc9\u3057\u3066\u3001\u305d\u306e\u5f8c\u306b\u753b\u50cf\u3092\u8ffd\u52a0\u3059\u308c\u3070\u826f\u3044\u3088\u3046\u3067\u3059\u304c\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u5074\u3067\u5bfe\u51e6\u3067\u304d\u306a\u3044\u304b\u8abf\u3079\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n<!--more--><br \/>\n\u624b\u5143\u3067\u306f\u30ab\u30b9\u30bf\u30e0\u30d1\u30fc\u30de\u30ea\u30f3\u30af\u306b\u3057\u3066\u3042\u3063\u3066\u3001\u300c%post_id%.html\u300d\u3068\u306a\u308b\u3088\u3046\u306b\u3057\u3066\u3042\u308b\u306e\u3067\u3001\u305d\u306e\u524d\u63d0\u3067\u8aad\u3093\u3067\u304f\u3060\u3055\u3044\u3002\u8abf\u3079\u3066\u307f\u305f\u3068\u3053\u308d\u3001\u554f\u984c\u306e\u6295\u7a3f\u306b\u5bfe\u3057\u3066\u306f\u300c1.html\/xxxxxx\u300d\u3068\u300c1.html\u300d\u306eURL\u304c\u751f\u6210\u3055\u308c\u3066\u3044\u3066\u3001\u5148\u306b\u300c1.html\/xxxxxx\u300d\u304c\u4f5c\u3089\u308c\u3066\u3057\u307e\u3046\u3068\u30d5\u30a1\u30a4\u30eb\u306e\u300c1.html\u300d\u304c\u751f\u6210\u3067\u304d\u305a\u306b404\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u3066\u3057\u307e\u3046\u3068\u3044\u3046\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3057\u305f\u3002\u300c1.html\/xxxxxx\u300d\u3068\u3044\u3046URL\u304c\u5fc5\u8981\u304b\u3069\u3046\u304b\u304c\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u306e\u3067\u3059\u304c\u3001StaticPress\u3067\u51fa\u529b\u3059\u308b\u30da\u30fc\u30b8\u3067\u3001\u3053\u308c\u306b\u30ea\u30f3\u30af\u3057\u306a\u3051\u308c\u3070\u3044\u3044\u3060\u3051\u306a\u306e\u3067\u3001\u5bfe\u8c61\u5916\u306b\u3059\u308b\u3053\u3068\u3092\u8003\u3048\u307e\u3059\u3002<\/p>\n<p>\u3059\u308b\u3068\u3001\u6b21\u306e\u3088\u3046\u306b staticpress\/includes\/class-static_press.php\u30d5\u30a1\u30a4\u30eb\u306b\u3042\u308bsingle_url()\u95a2\u6570\u306e\u51e6\u7406\u5185\u3067\u9664\u5916\u3057\u3066\u3057\u307e\u3048\u3070\u826f\u3044\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002\u6b63\u898f\u8868\u73fe\u306e\u90e8\u5206\u306f\u30d1\u30fc\u30de\u30ea\u30f3\u30af\u6307\u5b9a\u306e\u5024\u306b\u3088\u3063\u3066\u5909\u308f\u308b\u306f\u305a\u306a\u306e\u3067\u3059\u304c\u3001\u3053\u3053\u3067\u306f\u6c7a\u3081\u6253\u3061\u3092\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; gutter: true\">\r\n        private function single_url($url_type = &#039;single&#039;) {\r\n\uff08\u7565\uff09\r\n                        $permalink = get_permalink($post-&gt;ID);\r\n                        if (is_wp_error($permalink))\r\n                                continue;\r\n\/\/ \u3053\u3053\u304b\u3089\r\nif (preg_match(&#039;\/.*\\.html\\\/.*\/&#039;, $permalink, $m)) {\r\n                                continue;\r\n}\r\n\/\/ \u3053\u3053\u307e\u3067\u8ffd\u52a0\r\n                        $count = 1;\r\n\uff08\u7565\uff09\r\n<\/pre>\n<p>\u3055\u3089\u306b\u8abf\u3079\u3066\u307f\u305f\u3068\u3053\u308d\u3001StaticPress::file_put\u306b\u5bfe\u3057\u3066\u30d5\u30c3\u30af\u304c\u3067\u304d\u308b\u3053\u3068\u3092\u77e5\u308a\u307e\u3057\u305f\u3002\u4e0a\u8a18\u306e\u65b9\u6cd5\u3067\u306f\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3059\u308b\u305f\u3073\u306b\u30d5\u30a1\u30a4\u30eb\u4fee\u6b63\u304c\u5fc5\u8981\u3067\u3059\u3002\u30d5\u30c3\u30af\u3092\u4f7f\u3048\u3070\u3001\u30c6\u30fc\u30de\u5074\u306efunctions.php\u306b\u51e6\u7406\u3092\u8a18\u8ff0\u3067\u304d\u307e\u3059\u3002\u66f8\u304d\u8fbc\u307f\u3092\u3057\u3066\u304b\u3089\u547c\u3073\u51fa\u3055\u308c\u308b\u30d5\u30c3\u30af\u306a\u306e\u3067\u3001\u4e00\u5ea6\u51fa\u529b\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u3068\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u524a\u9664\u3059\u308b\u3068\u3044\u3046\u51e6\u7406\u306b\u306a\u308b\u306e\u304c\u3044\u307e\u3044\u3061\u3067\u3059\u304c\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b\u3059\u308c\u3070\u3001\u3068\u308a\u3042\u3048\u305a\u4f59\u8a08\u306a\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306f\u524a\u9664\u3067\u304d\u308b\u306e\u3067\u3001\u51fa\u529b\u3057\u305f\u3044\u9759\u7684\u30d5\u30a1\u30a4\u30eb\u3092\u66f8\u304d\u51fa\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: php; gutter: true\">\r\nadd_action(&#039;StaticPress::file_put&#039;, &#039;static_press_action01&#039;, 10, 2);\r\nfunction static_press_action01($file_dest, $url){\r\n  if (preg_match(&#039;\/.*\\.html\\\/.*\/&#039;, $file_dest, $m)) {\r\n     unlink($file_dest);\r\n     $pattern = &#039;\/(.*\\.html)\\\/.*\/i&#039;;\r\n     $replacement = &#039;${1}&#039;;\r\n     $d = preg_replace($pattern, $replacement, $file_dest);\r\n     rmdir($d);\r\n  }\r\n} \r\n<\/pre>\n<p>\u672c\u5f53\u306f\u958b\u767a\u8005\u3078\u4f1d\u3048\u3066\u76f4\u3057\u3066\u3082\u3089\u3046\u306e\u304c\u3044\u3044\u306e\u3067\u3059\u304c\u3001\u3082\u3046\u5c11\u3057\u8abf\u3079\u3066\u307f\u3066\u304b\u3089\u304c\u3044\u3044\u304b\u3068\u601d\u3063\u3066\u3044\u307e\u3059\u3002\u3067\u3082\u3001\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u3060\u3068\u3001\u3053\u3046\u3084\u3063\u3066\u66ab\u5b9a\u7684\u306a\u5bfe\u51e6\u3082\u3067\u304d\u308b\u306e\u3067\u3001\u3084\u3063\u3071\u308a\u4f7f\u3044\u3084\u3059\u3044\u3067\u3059\u3088\u306d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u300cWordPress \u306e\u30d7\u30e9\u30b0\u30a4\u30f3 StaticPress \u3067\u30cf\u30de\u3063\u305f\u8a71 &#8211; \u308f\u308a\u3068\u6280\u8853\u7684\u306a\u8a71\u300d\u306b\u3042\u308a\u307e\u3059\u304c\u3001StaticPress\u3067\u753b\u50cf\u3064\u304d\u306e\u6295\u7a3f\u3092\u65b0\u898f\u4f5c\u6210\u3059\u308b\u3068\u3046\u307e\u304f\u52d5\u304b\u306a\u3044\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002\u904b\u7528\u3067\u3001\u5148\u306b\u6295 &hellip; <a href=\"https:\/\/www.hiro345.net\/blogs\/hiro345\/archives\/16751.html\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[1126,70],"class_list":["post-16751","post","type-post","status-publish","format-standard","hentry","category-linux","tag-staticpress","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts\/16751","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/comments?post=16751"}],"version-history":[{"count":4,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts\/16751\/revisions"}],"predecessor-version":[{"id":16764,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/posts\/16751\/revisions\/16764"}],"wp:attachment":[{"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/media?parent=16751"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/categories?post=16751"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hiro345.net\/blogs\/hiro345\/wp-json\/wp\/v2\/tags?post=16751"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}