{"id":417,"date":"2012-05-07T21:24:14","date_gmt":"2012-05-07T12:24:14","guid":{"rendered":"https:\/\/deskplate.net\/blog\/2012\/05\/07\/wordpress-ktai-style-%e3%83%ad%e3%82%b0%e3%82%a4%e3%83%b3\/"},"modified":"2012-05-07T21:24:14","modified_gmt":"2012-05-07T12:24:14","slug":"wordpress-ktai-style-%e3%83%ad%e3%82%b0%e3%82%a4%e3%83%b3","status":"publish","type":"post","link":"https:\/\/deskplate.net\/blog\/archives\/417","title":{"rendered":"WordPress Ktai Style \u30ed\u30b0\u30a4\u30f3"},"content":{"rendered":"<p>WordPress\u306eKetai Style\u3067\u4f1a\u54e1\u5236\u30b5\u30a4\u30c8\u3092\u4f5c\u6210\u3059\u308b\u5834\u5408<br \/>\nWP-Members\u3068\u304b\u3068\u7d44\u307f\u5408\u308f\u305b\u308b<br \/>\nKtai Style\u3067\u306f\u72ec\u81ea\u306e\u30bb\u30c3\u30b7\u30e7\u30f3\u3067\u5b9f\u88c5\u3055\u308c\u3066\u304a\u308a\u3001\u30bb\u30c3\u30b7\u30e7\u30f3\u306e\u5f15\u304d\u7d99\u304e\u304c\u96e3\u3057\u3044\u5834\u5408\u3082\u3042\u308a\u3002<br \/>\n\u643a\u5e2f\u306eID\u3092\u5229\u7528\u3057\u305f\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u306e\u4f8b<br \/>\nindex.php \u306b\u8ffd\u52a0<br \/>\nset_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . PATH_SEPARATOR . dirname(__FILE__) .&#8217;\/lib&#8217;);<br \/>\nlib\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u3063\u3066 Net_UseAgent_Mobile\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br \/>\nktai-style\/ktai_style.php \u306e\u753b\u9762\u51fa\u529b\u524d\u306b\u8ffd\u52a0<br \/>\n\u3000output_add_rewrite_var(&#8216;guid&#8217;, &#8216;ON&#8217;);<br \/>\nktai-style\/admin\/class.php \u306b\u8ffd\u52a0<br \/>\n&#8212;&#8212;-<br \/>\npublic  function setHash($dir, $id, $val){<br \/>\n\/\/ \u30d5\u30a1\u30a4\u30eb\u3092\u66f8\u304d\u51fa\u3059\u30c7\u30a3\u30ec\u30af\u30c8\u30ea<br \/>\n$_dir = $dir;<br \/>\n\/\/ \u65e2\u306b\u30d5\u30a1\u30a4\u30eb\u304c\u5b58\u5728\u3059\u308c\u3070\u524a\u9664\u3059\u308b<br \/>\n@unlink(&#8220;{$_dir}\/{$id}&#8221;);<br \/>\n\/\/ \u66f8\u304d\u51fa\u3057<br \/>\n$fp = fopen(&#8220;{$_dir}\/{$id}&#8221;, &#8220;a+&#8221;);<br \/>\nif (!(empty($fp))) {<br \/>\nflock($fp, LOCK_EX);<br \/>\nfputs($fp, $val);<br \/>\nflock($fp, LOCK_UN);<br \/>\nfclose($fp);<br \/>\n}<br \/>\n}<br \/>\n\/**<br \/>\n* SESpreID\u3092\u30d5\u30a1\u30a4\u30eb\u540d\u3068\u3057\u3066 hash\u306e\u5024\u3092\u53d6\u5f97\u3059\u308b\u30e1\u30bd\u30c3\u30c9<br \/>\n*\/<br \/>\npublic  function getHash($dir, $id){<br \/>\nreturn file_get_contents(&#8220;{$dir}\/{$id}&#8221;);<br \/>\n}<br \/>\n&#8212;&#8212;-<br \/>\n\u30bb\u30c3\u30b7\u30e7\u30f3\u958b\u59cb\u30e1\u30bd\u30c3\u30c9\u306e\u6700\u5f8c\u306b\u7aef\u672bID\u3092\u30d5\u30a1\u30a4\u30eb\u540d\u3068\u3057\u3066sid\u3092\u66f8\u304d\u51fa\u3059\u3088\u3046\u306b<br \/>\npublic function set_session($user_id, $sid = NULL, $data = NULL, $remember = false) {<br \/>\n# \u7565<br \/>\n\u3000\u3000\u3000\/\/ \u7aef\u672bID\u3092\u53d6\u5f97\u3057\u3066hash\u306e\u5024\u3092\u53d6\u5f97<br \/>\n\u3000\u3000\u3000$agent = Net_UserAgent_Mobile::singleton();<br \/>\n\u3000\u3000\u3000$this->setHash(dirname(dirname(__FILE__)) . &#8216;\/tmp&#8217; , $agent->getUID(), $sid);<br \/>\n}<br \/>\n&#8212;&#8212;-<br \/>\n\u30bb\u30c3\u30b7\u30e7\u30f3\u53d6\u5f97\u30e1\u30bd\u30c3\u30c9\u306e\u6700\u5f8c\u306b\u8ffd\u52a0<br \/>\npublic function get_sid() {<br \/>\n# \u7565<br \/>\n\u3000\u3000\u3000if (! is_string($sid) &#038;&#038; ! is_numeric($sid)) {<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000\/\/ \u7aef\u672bID\u3092\u53d6\u5f97\u3057\u3066hash\u306e\u5024\u3092\u53d6\u5f97<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000$agent = Net_UserAgent_Mobile::singleton();<br \/>\n\u3000\u3000\u3000\u3000\u3000\u3000$sid = $this->getHash(dirname(dirname(__FILE__)) . &#8216;\/tmp&#8217; , $agent->getUID());<br \/>\n\u3000\u3000\u3000}<br \/>\n}<br \/>\nsid\u3092\u5f15\u304d\u7d99\u3052\u307e\u3059\u3002<br \/>\n\u643a\u5e2f\u7aef\u672bID\u3092\u305d\u306e\u307e\u307e\u5229\u7528\u3059\u308b\u306e\u3067\u306f\u306a\u304f\u3001\u5185\u90e8\u3067\u6587\u5b57\u5217\u3092\u8db3\u3059\u7b49\u306e\u51e6\u7406\u3092\u884c\u3063\u305f\u307b\u3046\u304c\u3044\u3044\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress\u306eKetai Styl<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,7],"tags":[],"class_list":["post-417","post","type-post","status-publish","format-standard","hentry","category-cms","category-php"],"_links":{"self":[{"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/posts\/417","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/comments?post=417"}],"version-history":[{"count":0,"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/posts\/417\/revisions"}],"wp:attachment":[{"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/media?parent=417"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/categories?post=417"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/tags?post=417"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}