[JavaScript]trim
trim(str){ return str.replace(/^[\s]+|[\s]+$/g,''); }
$this->output->set_header('X-Frame-Options: SAMEORIGIN'); $this->output->set_header('Cache-control: no-cache, no-store, post-check=0, pre-check=0'); $this->output->set_header('Pragma: no-cache'); $this->output->set_header('Expires: Thu, 01 Dec 1994 16:00:00 GMT');
AmazonRDSは仕様上FILE権限は付与出来ない。
故に
LOAD DATA INFILE xxxx.csv INTO TABLE wp_names FIELDS TERMINATED BY ',' ENCLOSED BY '\"' IGNORE 1 LINES;
を
LOAD DATA LOCAL INFILE xxxx.csv INTO TABLE wp_names FIELDS TERMINATED BY ',' ENCLOSED BY '\"' IGNORE 1 LINES;
へ変更するとよい
※余談
windows上ではパスのセパレータを/に変換しないと動かないことも
$filepath = preg_replace('/\\\\/','/',$filepath);
functions.php
function my_shortcode($attr) { $tmp = isset($_GET[$attr[0]]) ? (is_array($_GET[$attr[0]]) ? implode(',',$_GET[$attr[0]]) : $_GET[$attr[0]]) : ""; return esc_html($tmp); } add_shortcode('getq', 'my_shortcode');
GETクエリxxxの値を出力
[getq xxx]
function echo_json($data) { header("Content-Type: application/json; charset=utf-8"); echo json_encode($data); }
public function is_https() { if(!empty($_SERVER["HTTPS"])) return true; //AWS if(!empty($_SERVER["HTTP_X_FORWARDED_PROTO"]) && strtolower($_SERVER["HTTP_X_FORWARDED_PROTO"])==="https") return true; return false; }
SQLのGROUP BYの様な処理を配列に行う
public function array_group_by($arr,$keys = array(array('id','address'),array('name') ),$index = 0) { if(empty($arr)) return null; $results = array(); $children = array(); $_vkey = $keys[$index][0]; $_keys = array_slice($keys,0,$index+1); $is_final = count($keys) <= $index + 1; $id = null; array_push($arr,null); foreach ($arr as $i => $data){ $current_id = $this->get_values_by_keys($data,$_keys,''); if($id != $current_id){ if(!is_null($id)) { if(!empty($children)) { $tmp = $this->get_std_by_array($children[0], $keys[$index]); $tmp->value = $children[0]->$_vkey; }else{ $tmp = new stdClass(); } $tmp->children = $is_final ? $children : $this->array_group_by($children,$keys,$index+1); $results[] = $tmp; $children = array(); } $id = $current_id; } $children[] = $data; } return $results; } public function get_std_by_array($arr,$include_keys = null) { $tmp = new stdClass(); foreach ($arr as $key => $v){ if(empty($include_keys) || (!empty($include_keys) && in_array($key,$include_keys))) $tmp->$key = $v; } return $tmp; } public function get_values_by_keys($data,$keys,$glue = null) { if(empty($data)) return null; $tmp = array(); foreach ($keys as $key){ if(is_array($key)) $key = array_shift(array_values($key)); $tmp[] = $data->$key; } return is_null($glue) ? $tmp : implode($glue,$tmp); }
x
同じ日付の記事1つ目:1
同じ日付の記事2つ目:2
<mt:For regex_replace="/[\ \t\r\n]/mg",""> <mt:EntryDate format="%Y%m%d" setvar="current_entry_date" /> <mt:EntryID setvar="current_entry_id" /> <mt:EntryBlogID setvar="blog_id"/> <mt:Blogs blog_ids="$blog_id"> <mt:Var name="count" value="1"/> <mt:Var name="no" value="1"/> <mt:Entries lastn="0" sort_by="authored_on" sort_order="ascend"> <mt:EntryDate format="%Y%m%d" setvar="entry_date" /> <mt:EntryID setvar="entry_id" /> <mt:If name="entry_date" eq="$current_entry_date"> <mt:If name="entry_id" eq="$current_entry_id"><mt:Var name="no" value="$count"/></mt:If> <mt:SetVar name="count" op="++"/> </mt:If> </mt:Entries> </mt:Blogs> <mt:Var name="current_entry_date"/>_<mt:Var name="no"/>.html</mt:For>
・wp-config.php
$table_prefix = 'dev_wp_';
を
$table_prefix = 'wp_';
へ変更
・下記を実行
ALTER TABLE dev_wp_commentmeta RENAME TO wp_commentmeta; ALTER TABLE dev_wp_comments RENAME TO wp_comments; ALTER TABLE dev_wp_links RENAME TO wp_links; ALTER TABLE dev_wp_options RENAME TO wp_options; ALTER TABLE dev_wp_postmeta RENAME TO wp_postmeta; ALTER TABLE dev_wp_posts RENAME TO wp_posts; ALTER TABLE dev_wp_term_relationships RENAME TO wp_term_relationships; ALTER TABLE dev_wp_term_taxonomy RENAME TO wp_term_taxonomy; ALTER TABLE dev_wp_usermeta RENAME TO wp_usermeta; ALTER TABLE dev_wp_users RENAME TO wp_users; ALTER TABLE dev_wp_terms RENAME TO wp_terms; UPDATE wp_options SET option_name = 'wp_user_roles' WHERE option_name = 'dev_wp_user_roles'; UPDATE wp_usermeta SET meta_key = 'wp_capabilities' WHERE meta_key = 'dev_wp_capabilities'; UPDATE wp_usermeta SET meta_key = 'wp_user_level' WHERE meta_key = 'dev_wp_user_level';