{"id":799,"date":"2007-01-20T03:53:59","date_gmt":"2007-01-19T18:53:59","guid":{"rendered":"http:\/\/zone.maple4ever.net\/blog\/archives\/799\/"},"modified":"2007-01-20T03:57:17","modified_gmt":"2007-01-19T18:57:17","slug":"%e7%ae%a1%e7%90%86%e7%94%bb%e9%9d%a2%e3%81%ae%e3%81%82%e3%82%8b-wordpress-%e3%83%97%e3%83%a9%e3%82%b0%e3%82%a4%e3%83%b3%e3%81%ae%e4%bd%9c%e6%88%90%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"http:\/\/zone.maple4ever.net\/blog\/archives\/799\/","title":{"rendered":"\u7ba1\u7406\u753b\u9762\u306e\u3042\u308b WordPress \u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u4f5c\u6210\u65b9\u6cd5"},"content":{"rendered":"<p>\u6700\u8fd1\u65e5\u672c\u306e\u65b9\u306e WordPress \u30d7\u30e9\u30b0\u30a4\u30f3\u3082\u305a\u3044\u3076\u3093\u5897\u3048\u3066\u304d\u3066\u3001\u540c\u3058\u3053\u3068\u3092\u3057\u3066\u3044\u308b\u4eba\u9593\u3068\u3057\u3066\u306f\u5b09\u3057\u3044\u9650\u308a\u3067\u3059\u3002 \ud83d\ude42<\/p>\n<p>\u307c\u304f\u3082\u4f55\u672c\u304b\u66f8\u3044\u3066\u304d\u3066\u3001\u3088\u3046\u3084\u304f\u52d8\u6240\u306e\u3088\u3046\u306a\u3082\u306e\u304c\u3064\u304b\u3081\u3066\u304d\u305f\u306e\u3067\u3061\u3087\u3063\u3068\u30d7\u30e9\u30b0\u30a4\u30f3\u4f5c\u6210\u306e\u30ce\u30a6\u30cf\u30a6\u306a\u3093\u304b\u3092\u30a8\u30f3\u30c8\u30ea\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3044\u3084\u3001\u6700\u521d\u306e\u3053\u308d\u306f\u305a\u3044\u3076\u3093\u82e6\u52b4\u3057\u305f\u3093\u3067\u3059\u3002\u3002\u3000\u306a\u306b\u304c\u3067\u304d\u306a\u304b\u3063\u305f\u3063\u3066\u3001PHP \u3092\u77e5\u3089\u306a\u304b\u3063\u305f\u3002\u3000\u6700\u8fd1\u3060\u3044\u3076&#8221;\u30bd\u30e9&#8221;\u3067\u304b\u3051\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u304d\u307e\u3057\u305f\u304c\u3001\u307e\u3060\u307e\u3060\u8a9e\u5f59\u304c\u5c11\u306a\u304f\u3001\u3067\u304d\u308b\u65b9\u304b\u3089\u898b\u308c\u3070\u306a\u3093\u3060\u3053\u308a\u3083\u3001\u306a\u3093\u3060\u3068\u601d\u3046\u3093\u3067\u3059\u304c&#8230;\u3002<\/p>\n<p>\u3067\u307e\u3041\u3001\u77e5\u3089\u306a\u304f\u3066\u3082\u30ce\u30ea\u3067\u3067\u304d\u3061\u3083\u3046\u306e\u304c\u30b9\u30af\u30ea\u30d7\u30c8\u8a00\u8a9e\u306e\u826f\u3044\u3068\u3053\u308d\u3002\u3000\u3053\u3053\u3067\u306f\u3001\u300c\u7ba1\u7406\u753b\u9762\u306e\u3042\u308b WordPress \u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u4f5c\u6210\u65b9\u6cd5\u300d\u3092\u66f8\u3044\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u7ba1\u7406\u753b\u9762\u306e\u8ffd\u52a0\u306e\u65b9\u6cd5\u306f\u5206\u304b\u308b\u3068\u3057\u3066\u3001\u554f\u984c\u306f\u30c7\u30fc\u30bf\u306e\u4fdd\u5b58\u3068\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u69cb\u9020\u3002\u3000\u7d4c\u9a13\u7684\u306b\u4ee5\u4e0b\u306e\u69cb\u9020\u306b\u3059\u308b\u3068\u3001\u30b9\u30c8\u30ec\u30b9\u7121\u304f\u30b3\u30fc\u30c9\u3092\u304b\u3051\u308b\u3088\u3046\u306a\u6c17\u304c\u3057\u307e\u3059\u3002\u3000\u307e\u305a\u306f\u30af\u30e9\u30b9\u3092 3 \u3064\u3064\u304f\u308a\u307e\u3059\u3002<\/p>\n<ol>\n<li>WordPress \u3068\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3059\u308b\u30af\u30e9\u30b9 (ex. class WpHoge)<\/li>\n<li>\u30c7\u30fc\u30bf\u3092\u51e6\u7406\u3059\u308b\u30af\u30e9\u30b9 (ex. class WpHogeModel)<\/li>\n<li>\u7ba1\u7406\u753b\u9762\u306e HTML \u3092\u51fa\u529b\u3059\u308b\u30af\u30e9\u30b9 (ex. class WpHogeView)<\/li>\n<\/ol>\n<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u69cb\u9020\u306f\u3044\u308f\u3086\u308b MVC \u306e\u69cb\u9020\u3092\u3068\u308b\u308f\u3051\u3067\u3059\u304c\u3001\u3042\u3093\u307e\u308a\u53b3\u683c\u306b\u3084\u308b\u3068\u3001\u4e00\u822c\u7684\u306a WP \u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u898f\u6a21\u304f\u3089\u3044\u3067\u306f\u9006\u306b\u9762\u5012\u306b\u306a\u308a\u307e\u3059\u306e\u3067\u305d\u306e\u8fba\u306f\u9069\u5f53\u306b&#8230; \ud83d\ude1b<\/p>\n<p>class WpHoge \u306f\u3001WordPress \u3068\u306e\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3092\u66f8\u304d\u307e\u3059\u3002\u3000\u30d7\u30e9\u30b0\u30a4\u30f3\u30e1\u30a4\u30f3\u30ed\u30b8\u30c3\u30af\u3068 WordPress \u306e\u4ef2\u4ecb\u3092\u3059\u308b\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30af\u30e9\u30b9\u3067\u3059\u304c\u3001\u8981\u306f WordPress \u306e\u30b3\u30a2\u95a2\u6570\u3092\u547c\u3076\u306e\u306f\u306a\u308b\u3079\u304f\u3053\u3053\u3060\u3051\u306b\u3057\u307e\u3059\u3002(\u305f\u3068\u3048\u3070\u3001\u591a\u56fd\u8a9e\u5316\u3059\u308b\u3068 WpHogeView \u306b __\u3001_e \u3092\u304b\u304b\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u306e\u3068\u304b\u306f\u611b\u656c\u3002\u3000WpHoge \u3067\u30e9\u30c3\u30d7\u3057\u3066\u3082\u3044\u3044\u3051\u3069\u3001\u305d\u3053\u307e\u3067\u306f&#8230;\uff09<\/p>\n<p>\u4eca\u56de\u66f8\u304d\u305f\u304b\u3063\u305f\u306e\u306f\u3001\u4ee5\u4e0b\u304b\u3089\u3002\u3000\u7ba1\u7406\u753b\u9762\u3067\u8a2d\u5b9a\u3059\u308b\u30aa\u30d7\u30b7\u30e7\u30f3\u30c7\u30fc\u30bf\u306e\u4fdd\u5b58\u51e6\u7406\u306e\u65b9\u6cd5\u306e\u30ce\u30a6\u30cf\u30a6\u3067\u3059\u3002<\/p>\n<p>class WpHogeModel \u306b\u306f\u3001\u30e1\u30a4\u30f3\u51e6\u7406\u3001\u3044\u308f\u3086\u308b\u30d3\u30b8\u30cd\u30b9\u30ed\u30b8\u30c3\u30af\u3092\u66f8\u304d\u307e\u3059\u3002<\/p>\n<p>\u30c7\u30fc\u30bf\u4fdd\u5b58\u3092\u3059\u308b\u3068\u304d\u306e\u30dd\u30a4\u30f3\u30c8\u306f\u3001\u3053\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u72b6\u614b\u3092\u305d\u306e\u307e\u3093\u307e WP \u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u4fdd\u5b58\u3059\u308b\u3053\u3068\u3002\u3000\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u5fa9\u5143\u3059\u308c\u3070\u3001\u6b21\u56de\u540c\u3058\u72b6\u614b\uff08\u8a2d\u5b9a\u3057\u305f\u30aa\u30d7\u30b7\u30e7\u30f3\u5024\u306a\u3069\uff09\u3092\u3046\u307e\u304f\u518d\u73fe\u3067\u304d\u308b\u308f\u3051\u3067\u3059\u3002\u3000\u3067\u306f\u4eee\u306b WpHogeModel \u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5b9a\u7fa9\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hl-surround\" ><ol class=\"hl-main\" start=1><li>&nbsp;<span class=\"hl-identifier\">class WpHogeModel <\/span><span class=\"hl-brackets\">{\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; \r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp;  <\/span><span class=\"hl-quotes\"> \/\/<\/span><span class=\"hl-code\"> \u30e1\u30f3\u30d0\u5909\u6570\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; <\/span><span class=\"hl-var\">$oprion<\/span><span class=\"hl-code\"> = <\/span><span class=\"hl-identifier\">array<\/span><span class=\"hl-brackets\">()<\/span><span class=\"hl-code\">;\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; \r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp;  <\/span><span class=\"hl-quotes\"> \/\/<\/span><span class=\"hl-code\"> \u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; <\/span><span class=\"hl-identifier\">function WpHogeModel<\/span><span class=\"hl-brackets\">() {\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; &nbsp; &nbsp; <\/span><span class=\"hl-var\">$option<\/span><span class=\"hl-brackets\">[<\/span><span class=\"hl-quotes\">'<\/span><span class=\"hl-string\">\u4fdd\u5b58\u3057\u305f\u3044\u30aa\u30d7\u30b7\u30e7\u30f31<\/span><span class=\"hl-quotes\">'<\/span><span class=\"hl-brackets\">]<\/span><span class=\"hl-code\"> = \u521d\u671f\u5024;\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; &nbsp; &nbsp; <\/span><span class=\"hl-var\">$option<\/span><span class=\"hl-brackets\">[<\/span><span class=\"hl-quotes\">'<\/span><span class=\"hl-string\">\u4fdd\u5b58\u3057\u305f\u3044\u30aa\u30d7\u30b7\u30e7\u30f32<\/span><span class=\"hl-quotes\">'<\/span><span class=\"hl-brackets\">]<\/span><span class=\"hl-code\"> = \u521d\u671f\u5024;\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; &nbsp; &nbsp; <\/span><span class=\"hl-var\">$option<\/span><span class=\"hl-brackets\">[<\/span><span class=\"hl-quotes\">'<\/span><span class=\"hl-string\">\u4fdd\u5b58\u3057\u305f\u3044\u30aa\u30d7\u30b7\u30e7\u30f33<\/span><span class=\"hl-quotes\">'<\/span><span class=\"hl-brackets\">]<\/span><span class=\"hl-code\"> = \u521d\u671f\u5024;\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; <\/span><span class=\"hl-brackets\">}\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; \r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp;  <\/span><span class=\"hl-quotes\"> \/\/<\/span><span class=\"hl-code\"> \u51e6\u7406\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; <\/span><span class=\"hl-identifier\">function syori<\/span><span class=\"hl-brackets\">() {\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; &nbsp; &nbsp;  <\/span><span class=\"hl-var\">$this<\/span><span class=\"hl-code\">-&gt;<\/span><span class=\"hl-var\">$option<\/span><span class=\"hl-brackets\">[<\/span><span class=\"hl-quotes\">'<\/span><span class=\"hl-string\">\u4fdd\u5b58\u3057\u305f\u3044\u30aa\u30d7\u30b7\u30e7\u30f31<\/span><span class=\"hl-quotes\">'<\/span><span class=\"hl-brackets\">]<\/span><span class=\"hl-code\"> = \u66f4\u65b0\u5024;\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; <\/span><span class=\"hl-brackets\">}\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; \r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">}<\/span><\/li><\/ol><\/div>\n<p>\u4fdd\u5b58\u3057\u305f\u3044\u30aa\u30d7\u30b7\u30e7\u30f3\u5024\u3092\u30e1\u30f3\u30d0\u5909\u6570\u306b\u3057\u3066\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092 new \u3057\u305f\u6642\u552f\u4e00\u5b9f\u884c\u3055\u308c\u308b\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306b\u306f\u3001\u4fdd\u5b58\u3057\u305f\u3044\u30aa\u30d7\u30b7\u30e7\u30f3\u5024\u306e\u521d\u671f\u5024\u3092\u66f8\u3044\u3066\u304a\u304d\u307e\u3059\u3002\u3000\u3067\u3001\u3042\u3068\u306f\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u30e1\u30f3\u30d0\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3064\u3064\u9069\u5f53\u306b\u51e6\u7406\u3092\u66f8\u304d\u307e\u3059\u3002<\/p>\n<p>\u6b21\u306b WP \u306e\u9818\u57df\u3067\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5316\u3059\u308b\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9 class WpHoge \u306e\u4e2d\u3067\u3001\u3053\u306e class WpHogeModel \u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u3064\u304f\u308a\u307e\u3059\u3002<\/p>\n<p>\u3067\u3082\u3063\u3066\u3001\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5316\u3057\u305f class WpHogeModel \u3092&#8221;\u3054\u3063\u305d\u308a&#8221;\u30b7\u30ea\u30a2\u30e9\u30a4\u30ba\u3057\u3066 WP \u306b\u767b\u9332\u3057\u3066\u3057\u307e\u3044\u307e\u3059\u3002\uff08\u521d\u56de\uff09\u3000\u3082\u3057\u3001\u3059\u3067\u306b WP \u306b\u767b\u9332\u304c\u3042\u308b\u3088\u3046\u3067\u3042\u308c\u3070\u3001\u30b7\u30ea\u30a2\u30e9\u30a4\u30ba\u3055\u308c\u305f\u30c7\u30fc\u30bf\u304b\u3089\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u5fa9\u5143\u3057\u307e\u3059\u3002\uff08\uff12\u56de\u76ee\u4ee5\u964d\uff09<\/p>\n<p>\uff12\u56de\u76ee\u4ee5\u964d\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u5fa9\u5143\u6642\u306f\u3001new \u3055\u308c\u308b\u308f\u3051\u3067\u306f\u306a\u3044\u306e\u3067 class WpHogeModel \u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306f\u50cd\u304b\u305a\u3001\u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u521d\u671f\u5316\u3055\u308c\u305a\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u30e1\u30f3\u30d0\u5909\u6570\u304c WP \u306b\u767b\u9332\u3055\u308c\u305f\u6642\u70b9\u306e\u3082\u306e\u306b\u5fa9\u5143\u3055\u308c\u308b\u308f\u3051\u3067\u3059\u3002\u3000\u3042\u3068\u306f\u3001\u307e\u305f\u901a\u5e38\u901a\u308a Model \u306e\u51e6\u7406\u95a2\u6570\u3092\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u304b\u3089\u547c\u3073\u51fa\u3057\u3066\u51e6\u7406\u3092\u7d9a\u884c\u3059\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<p>class WpHoge \u306e\u30c7\u30fc\u30bf\u53d6\u5f97\u7cfb\u306e\u51e6\u7406\u306f\u305f\u3068\u3048\u3070\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n<div class=\"hl-surround\" style=\"height:280px;\"><ol class=\"hl-main\" start=1><li>&nbsp;<span class=\"hl-identifier\">class WpHoge <\/span><span class=\"hl-brackets\">{\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; \r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; <\/span><span class=\"hl-identifier\">var <\/span><span class=\"hl-var\">$model<\/span><span class=\"hl-code\">;\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; \r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp;  <\/span><span class=\"hl-quotes\"> \/\/<\/span><span class=\"hl-code\"> \u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; <\/span><span class=\"hl-identifier\">function WpHoge<\/span><span class=\"hl-brackets\">() {\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; &nbsp; &nbsp; \r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; &nbsp; &nbsp; <\/span><span class=\"hl-var\">$this<\/span><span class=\"hl-code\">-&gt;<\/span><span class=\"hl-identifier\">model<\/span><span class=\"hl-code\"> = <\/span><span class=\"hl-var\">$this<\/span><span class=\"hl-code\">-&gt;<\/span><span class=\"hl-identifier\">getModelObject<\/span><span class=\"hl-brackets\">()<\/span><span class=\"hl-code\">;\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; &nbsp; &nbsp; <\/span><span class=\"hl-var\">$this<\/span><span class=\"hl-code\">-&gt;<\/span><span class=\"hl-identifier\">model<\/span><span class=\"hl-code\">-&gt;<\/span><span class=\"hl-identifier\">syori<\/span><span class=\"hl-brackets\">()<\/span><span class=\"hl-code\">;\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; &nbsp; &nbsp; \r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; <\/span><span class=\"hl-brackets\">}\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; \r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; <\/span><span class=\"hl-quotes\"> \/\/<\/span><span class=\"hl-code\"> \u30e2\u30c7\u30eb\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u4f5c\u6210\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; <\/span><span class=\"hl-identifier\">function getModelObject<\/span><span class=\"hl-brackets\">() {\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; &nbsp; &nbsp; \r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; &nbsp;  <\/span><span class=\"hl-quotes\"> \/\/ <\/span><span class=\"hl-identifier\">WP<\/span><span class=\"hl-code\"> \u304b\u3089\u30aa\u30d7\u30b7\u30e7\u30f3\u6240\u5f97\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; &nbsp; &nbsp; <\/span><span class=\"hl-var\">$option<\/span><span class=\"hl-code\"> = <\/span><span class=\"hl-var\">$this<\/span><span class=\"hl-code\">-&gt;<\/span><span class=\"hl-identifier\">getWpOption<\/span><span class=\"hl-brackets\">()<\/span><span class=\"hl-code\">;\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; &nbsp; &nbsp; \r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; &nbsp;  <\/span><span class=\"hl-quotes\"> \/\/ <\/span><span class=\"hl-identifier\">Model<\/span><span class=\"hl-code\"> \u306e\u30af\u30e9\u30b9\u304c\u767b\u9332\u3055\u308c\u3066\u3044\u305f\u3089\u305d\u308c\u3092\u5fa9\u5143\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; &nbsp; &nbsp; <\/span><span class=\"hl-reserved\">if<\/span><span class=\"hl-brackets\">(<\/span><span class=\"hl-identifier\">strtolower<\/span><span class=\"hl-brackets\">(<\/span><span class=\"hl-identifier\">get_class<\/span><span class=\"hl-brackets\">(<\/span><span class=\"hl-var\">$option<\/span><span class=\"hl-brackets\">))<\/span><span class=\"hl-code\"> == <\/span><span class=\"hl-identifier\">strtolower<\/span><span class=\"hl-brackets\">(<\/span><span class=\"hl-quotes\">'<\/span><span class=\"hl-string\">WpHoge<\/span><span class=\"hl-quotes\">'<\/span><span class=\"hl-brackets\">)) {\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <\/span><span class=\"hl-var\">$model<\/span><span class=\"hl-code\"> = <\/span><span class=\"hl-var\">$option<\/span><span class=\"hl-code\">;\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; &nbsp; &nbsp; <\/span><span class=\"hl-brackets\">}\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; &nbsp;  <\/span><span class=\"hl-quotes\"> \/\/<\/span><span class=\"hl-code\"> \u306a\u304b\u3063\u305f\u3089<\/span><span class=\"hl-brackets\">(<\/span><span class=\"hl-code\">\u521d\u56de<\/span><span class=\"hl-brackets\">)<\/span><span class=\"hl-code\"> \u65b0\u3057\u304f <\/span><span class=\"hl-identifier\">Model<\/span><span class=\"hl-code\"> \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3064\u304f\u3063\u3066 <\/span><span class=\"hl-identifier\">WP<\/span><span class=\"hl-code\"> \u306b\u767b\u9332<\/span><span class=\"hl-brackets\">(<\/span><span class=\"hl-identifier\">writeWpOption<\/span><span class=\"hl-code\">\u306f\u7701\u7565<\/span><span class=\"hl-brackets\">)\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; &nbsp; &nbsp; <\/span><span class=\"hl-reserved\">else <\/span><span class=\"hl-brackets\">{\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <\/span><span class=\"hl-var\">$model<\/span><span class=\"hl-code\"> = <\/span><span class=\"hl-reserved\">new <\/span><span class=\"hl-identifier\">WpHoge<\/span><span class=\"hl-brackets\">()<\/span><span class=\"hl-code\">;\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <\/span><span class=\"hl-var\">$this<\/span><span class=\"hl-code\">-&gt;<\/span><span class=\"hl-identifier\">writeWpOption<\/span><span class=\"hl-brackets\">(<\/span><span class=\"hl-var\">$model<\/span><span class=\"hl-brackets\">)<\/span><span class=\"hl-code\">;\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; &nbsp; &nbsp; <\/span><span class=\"hl-brackets\">}\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; &nbsp; &nbsp; \r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; &nbsp; &nbsp; <\/span><span class=\"hl-reserved\">return <\/span><span class=\"hl-var\">$model<\/span><span class=\"hl-code\">;\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; &nbsp; &nbsp; \r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; <\/span><span class=\"hl-brackets\">}\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; \r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; <\/span><span class=\"hl-identifier\">function getWpOption<\/span><span class=\"hl-brackets\">() {\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; &nbsp; &nbsp; \r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; &nbsp; &nbsp; <\/span><span class=\"hl-var\">$option<\/span><span class=\"hl-code\"> = <\/span><span class=\"hl-identifier\">get_option<\/span><span class=\"hl-brackets\">(<\/span><span class=\"hl-quotes\">'<\/span><span class=\"hl-string\">\u30aa\u30d7\u30b7\u30e7\u30f3\u767b\u9332\u540d<\/span><span class=\"hl-quotes\">'<\/span><span class=\"hl-brackets\">)<\/span><span class=\"hl-code\">;\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; &nbsp; &nbsp; \r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; &nbsp; &nbsp; <\/span><span class=\"hl-reserved\">if<\/span><span class=\"hl-brackets\">(<\/span><span class=\"hl-code\">!<\/span><span class=\"hl-var\">$option<\/span><span class=\"hl-code\"> == <\/span><span class=\"hl-identifier\">false<\/span><span class=\"hl-brackets\">) {\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <\/span><span class=\"hl-var\">$OptionValue<\/span><span class=\"hl-code\"> = <\/span><span class=\"hl-var\">$option<\/span><span class=\"hl-code\">;\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; &nbsp; &nbsp; <\/span><span class=\"hl-brackets\">} <\/span><span class=\"hl-reserved\">else <\/span><span class=\"hl-brackets\">{\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <\/span><span class=\"hl-var\">$OptionValue<\/span><span class=\"hl-code\"> = <\/span><span class=\"hl-identifier\">false<\/span><span class=\"hl-code\">;\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; &nbsp; &nbsp; <\/span><span class=\"hl-brackets\">}\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; &nbsp; &nbsp; \r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">&nbsp; &nbsp; &nbsp; &nbsp; <\/span><span class=\"hl-reserved\">return <\/span><span class=\"hl-var\">$OptionValue<\/span><span class=\"hl-code\">;\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; &nbsp; &nbsp; \r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-code\">&nbsp; &nbsp; <\/span><span class=\"hl-brackets\">}\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">\r<\/span><\/li>\n<li>&nbsp;<span class=\"hl-brackets\">}<\/span><\/li><\/ol><\/div>\n<p>\u3042\u3068\u306f\u3001\u7ba1\u7406\u753b\u9762\u304b\u3089\u306e\u66f4\u65b0\u306a\u3069\u3092\u304d\u3063\u304b\u3051\u3068\u3057\u3066\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u304c Model \u3092\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u3057\u3064\u3064\u9069\u5207\u306a\u30bf\u30a4\u30df\u30f3\u30b0\u3067 WP \u306b add_option\u3001update_option \u3059\u308c\u3070 OK \u3067\u3059\u3002\u3000\u3053\u308c\u3089\u306e\u95a2\u6570\u306f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u5f15\u6570\u306b\u6e21\u3055\u308c\u308b\u3068\u52dd\u624b\u306b\u30b7\u30ea\u30a2\u30e9\u30a4\u30ba\u3057\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u65b9\u5f0f\u3092\u3064\u304b\u3046\u3068\u3001\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u4fdd\u5b58\/\u53d6\u5f97\u304c 1 query \u306b\u306a\u308a\u307e\u3059\u3057\u3001\u306a\u306b\u3088\u308a &#8220;\u697d&#8221; \u3067\u3059\u3002\u3000<a href=\"http:\/\/wppluginsj.sourceforge.jp\/wp-kumonosu\/\">wp-kumonosu<\/a> \u304c\u3053\u306e\u65b9\u5f0f\u3067\u52d5\u3044\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u8208\u5473\u304c\u3042\u308b\u65b9\u306f\u30b3\u30fc\u30c9\u3092\u307f\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>wp-kumonosu \u3067\u306f\u7ba1\u7406\u753b\u9762\u304b\u3089\u306e http \u30ea\u30af\u30a8\u30b9\u30c8\u3092\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3067 Model \u306b\u632f\u308a\u5206\u3051\u51e6\u7406\u3092\u9032\u3081\u3066\u3044\u3063\u3066\u3044\u307e\u3059\u3002\u3000Model \u3067\u76f4\u63a5 WordPress \u306e DB \u306b SQL \u767a\u884c\u3057\u3061\u3083\u3063\u305f\u308a\u3057\u3066\u3001\u53b3\u5bc6\u306b\u8a00\u3046\u3068\u3061\u3083\u3093\u3068 MVC \u306b\u306a\u3063\u3066\u3044\u306a\u3044\u306e\u3067\u3059\u304c\u3001\u307e\u3041\u3072\u3068\u308a\u3067\u4f5c\u308b\u304f\u3089\u3044\u306e\u898f\u6a21\u306a\u306e\u3067\u3044\u3044\u3093\u3058\u3083\u306a\u3044\u3063\u3059\u304b \ud83d\ude1b<\/p>\n<p>\u307f\u306a\u3055\u3093\u305d\u308c\u305e\u308c\u306e\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u30b9\u30bf\u30a4\u30eb\u304c\u3042\u308b\u3068\u601d\u3046\u306e\u3067\u3001\u3053\u308c\u304c\u3044\u3044\u3063\u3066\u308f\u3051\u3067\u3082\u306a\u3044\u306e\u3067\u3059\u304c\u3001\u3082\u3057\u7ba1\u7406\u753b\u9762\u4ed8\u304d\u30d7\u30e9\u30b0\u30a4\u30f3\u3067\u30b3\u30fc\u30c9\u304c\u7169\u96d1\u306b\u306a\u3063\u3066\u56f0\u3063\u3066\u3044\u308b\u65b9\u306e\u3054\u53c2\u8003\u306b\u306a\u3063\u305f\u3089\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u65e5\u672c\u306e\u65b9\u306e WordPress \u30d7\u30e9\u30b0\u30a4\u30f3\u3082\u305a\u3044\u3076\u3093\u5897\u3048\u3066\u304d\u3066\u3001\u540c\u3058\u3053\u3068\u3092\u3057\u3066\u3044\u308b\u4eba\u9593\u3068\u3057\u3066\u306f\u5b09\u3057\u3044\u9650\u308a\u3067\u3059\u3002 \ud83d\ude42 \u307c\u304f\u3082\u4f55\u672c\u304b\u66f8\u3044\u3066\u304d\u3066\u3001\u3088\u3046\u3084\u304f\u52d8\u6240\u306e\u3088\u3046\u306a\u3082\u306e\u304c\u3064\u304b\u3081\u3066\u304d\u305f\u306e\u3067\u3061\u3087\u3063\u3068\u30d7\u30e9\u30b0\u30a4\u30f3\u4f5c\u6210\u306e\u30ce\u30a6\u30cf\u30a6\u306a\u3093\u304b\u3092\u30a8\u30f3\u30c8\u30ea\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002 \u3044\u3084\u3001\u6700\u521d\u306e\u3053\u308d\u306f\u305a\u3044\u3076\u3093\u82e6\u52b4\u3057\u305f\u3093\u3067\u3059\u3002\u3002\u3000\u306a\u306b\u304c\u3067\u304d\u306a\u304b\u3063\u305f\u3063\u3066\u3001PHP \u3092\u77e5\u3089\u306a\u304b\u3063\u305f\u3002\u3000\u6700\u8fd1\u3060\u3044\u3076&#8221;\u30bd\u30e9&#8221;\u3067\u304b\u3051\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u304d\u307e\u3057\u305f\u304c\u3001\u307e\u3060\u307e\u3060\u8a9e\u5f59\u304c\u5c11\u306a\u304f\u3001\u3067\u304d\u308b\u65b9\u304b\u3089\u898b\u308c\u3070\u306a\u3093\u3060\u3053\u308a\u3083\u3001\u306a\u3093\u3060\u3068\u601d\u3046\u3093\u3067\u3059\u304c&#8230;\u3002 \u3067\u307e\u3041\u3001\u77e5\u3089\u306a\u304f\u3066\u3082\u30ce\u30ea\u3067\u3067\u304d\u3061\u3083\u3046\u306e\u304c\u30b9\u30af\u30ea\u30d7\u30c8\u8a00\u8a9e\u306e\u826f\u3044\u3068\u3053\u308d\u3002\u3000\u3053\u3053\u3067\u306f\u3001\u300c\u7ba1\u7406\u753b\u9762\u306e\u3042\u308b WordPress \u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u4f5c\u6210\u65b9\u6cd5\u300d\u3092\u66f8\u3044\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002 \u7ba1\u7406\u753b\u9762\u306e\u8ffd\u52a0\u306e\u65b9\u6cd5\u306f\u5206\u304b\u308b\u3068\u3057\u3066\u3001\u554f\u984c\u306f\u30c7\u30fc\u30bf\u306e\u4fdd\u5b58\u3068\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u69cb\u9020\u3002\u3000\u7d4c\u9a13\u7684\u306b\u4ee5\u4e0b\u306e\u69cb\u9020\u306b\u3059\u308b\u3068\u3001\u30b9\u30c8\u30ec\u30b9\u7121\u304f\u30b3\u30fc\u30c9\u3092\u304b\u3051\u308b\u3088\u3046\u306a\u6c17\u304c\u3057\u307e\u3059\u3002\u3000\u307e\u305a\u306f\u30af\u30e9\u30b9\u3092 3 \u3064\u3064\u304f\u308a\u307e\u3059\u3002 WordPress \u3068\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3059\u308b\u30af\u30e9\u30b9 (ex. class WpHoge) \u30c7\u30fc\u30bf\u3092\u51e6\u7406\u3059\u308b\u30af\u30e9\u30b9 (ex. class WpHogeModel) \u7ba1\u7406\u753b\u9762\u306e HTML \u3092\u51fa\u529b\u3059\u308b\u30af\u30e9\u30b9 (ex. class WpHogeView) \u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u69cb\u9020\u306f\u3044\u308f\u3086\u308b MVC \u306e\u69cb\u9020\u3092\u3068\u308b\u308f\u3051\u3067\u3059\u304c\u3001\u3042\u3093\u307e\u308a\u53b3\u683c\u306b\u3084\u308b\u3068\u3001\u4e00\u822c\u7684\u306a WP \u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u898f\u6a21\u304f\u3089\u3044\u3067\u306f\u9006\u306b\u9762\u5012\u306b\u306a\u308a\u307e\u3059\u306e\u3067\u305d\u306e\u8fba\u306f\u9069\u5f53\u306b&#8230; \ud83d\ude1b class WpHoge \u306f\u3001WordPress \u3068\u306e\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3092\u66f8\u304d\u307e\u3059\u3002\u3000\u30d7\u30e9\u30b0\u30a4\u30f3\u30e1\u30a4\u30f3\u30ed\u30b8\u30c3\u30af\u3068 WordPress \u306e\u4ef2\u4ecb\u3092\u3059\u308b\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30af\u30e9\u30b9\u3067\u3059\u304c\u3001\u8981\u306f WordPress \u306e\u30b3\u30a2\u95a2\u6570\u3092\u547c\u3076\u306e\u306f\u306a\u308b\u3079\u304f\u3053\u3053\u3060\u3051\u306b\u3057\u307e\u3059\u3002(\u305f\u3068\u3048\u3070\u3001\u591a\u56fd\u8a9e\u5316\u3059\u308b\u3068 WpHogeView \u306b __\u3001_e \u3092\u304b\u304b\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u306e\u3068\u304b\u306f\u611b\u656c\u3002\u3000WpHoge \u3067\u30e9\u30c3\u30d7\u3057\u3066\u3082\u3044\u3044\u3051\u3069\u3001\u305d\u3053\u307e\u3067\u306f&#8230;\uff09 \u4eca\u56de\u66f8\u304d\u305f\u304b\u3063\u305f\u306e\u306f\u3001\u4ee5\u4e0b\u304b\u3089\u3002\u3000\u7ba1\u7406\u753b\u9762\u3067\u8a2d\u5b9a\u3059\u308b\u30aa\u30d7\u30b7\u30e7\u30f3\u30c7\u30fc\u30bf\u306e\u4fdd\u5b58\u51e6\u7406\u306e\u65b9\u6cd5\u306e\u30ce\u30a6\u30cf\u30a6\u3067\u3059\u3002 class WpHogeModel \u306b\u306f\u3001\u30e1\u30a4\u30f3\u51e6\u7406\u3001\u3044\u308f\u3086\u308b\u30d3\u30b8\u30cd\u30b9\u30ed\u30b8\u30c3\u30af\u3092\u66f8\u304d\u307e\u3059\u3002 \u30c7\u30fc\u30bf\u4fdd\u5b58\u3092\u3059\u308b\u3068\u304d\u306e\u30dd\u30a4\u30f3\u30c8\u306f\u3001\u3053\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u72b6\u614b\u3092\u305d\u306e\u307e\u3093\u307e WP \u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u4fdd\u5b58\u3059\u308b\u3053\u3068\u3002\u3000\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u5fa9\u5143\u3059\u308c\u3070\u3001\u6b21\u56de\u540c\u3058\u72b6\u614b\uff08\u8a2d\u5b9a\u3057\u305f\u30aa\u30d7\u30b7\u30e7\u30f3\u5024\u306a\u3069\uff09\u3092\u3046\u307e\u304f\u518d\u73fe\u3067\u304d\u308b\u308f\u3051\u3067\u3059\u3002\u3000\u3067\u306f\u4eee\u306b WpHogeModel [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/zone.maple4ever.net\/blog\/wp-json\/wp\/v2\/posts\/799"}],"collection":[{"href":"http:\/\/zone.maple4ever.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/zone.maple4ever.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/zone.maple4ever.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/zone.maple4ever.net\/blog\/wp-json\/wp\/v2\/comments?post=799"}],"version-history":[{"count":0,"href":"http:\/\/zone.maple4ever.net\/blog\/wp-json\/wp\/v2\/posts\/799\/revisions"}],"wp:attachment":[{"href":"http:\/\/zone.maple4ever.net\/blog\/wp-json\/wp\/v2\/media?parent=799"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/zone.maple4ever.net\/blog\/wp-json\/wp\/v2\/categories?post=799"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/zone.maple4ever.net\/blog\/wp-json\/wp\/v2\/tags?post=799"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}