闲聊

fu到啦

今天收到了年初预订的超大miku玩具了!

有一说一,做工堪忧,有好多线头,我剪掉了。

这是在批站会员购买的,所以速度还是可以的,我和媳妇说我要放车里,后座上系好安全带,当孩子放着哈哈!

闲聊

webpack真是个好东西

之前一点也不知道这个玩意,我一直以为min.js是用比较简单去掉注释和空格做的,我真是孤陋寡闻啊!

我在网上查了好多资料,原来js是可以这样进行合并,并组成新的sdk。

通过wp插件真的是学到之前没玩过的东西,有意思!

闲聊

给MI6X MIKU ROOT

好久没用这个手机了,要是说起来,我买回来的时候就没怎么折腾它,卖了IPHONE7 等价换初音这种事情,真的划算吗?

这次更换可Root的开发版,其实是为了可以进行Android Auto的研究,因为在网上看了一下,Android Auto限制非常多,和Carplay一样,你又没有Carplay那么多软件支持,死撑什么呢,也不知道,不过有一说一,国外支持Android Auto的软件其实挺多的,但是用得上不?

为啥折腾Android Auto ,其实要从上个月我自己徒手装车机开始说起

这辆凯迪拉克ATSL被我折腾的够呛啦~

不愧是痛车! 但是装完了原厂车机,又没有Carplay怎么搞呢…

来Android Auto吧!

Android Auto主要需要一个软件进行sqlite3库的改写,我看YouTube上的教程大部分人推荐
AA Phenotype Patcher
,我下载了以后看了一下,这个软件可以改写com.google.android.gms.car的信息

--  Apps which will be added to whitelist: --
  - 虾米音乐 (fm.xiami.main)
  - AA Mirror (com.github.slashmax.aamirror)
  - 高德地图 (com.autonavi.minimap)

--  chmod 775 sqlite3  --
 OutputStream:
  chmod 775 /data/user/0/pl.eselter.aaphenotypepatcher/sqlite3
--  end chmod 775 sqlite3  --

-- Drop Triggers  --
 OutputStream:
  /data/user/0/pl.eselter.aaphenotypepatcher/sqlite3 /data/data/com.google.android.gms/databases/phenotype.db 'DROP TRIGGER after_delete;'

--  DELETE old Flags  --
 OutputStream:
  /data/user/0/pl.eselter.aaphenotypepatcher/sqlite3 /data/data/com.google.android.gms/databases/phenotype.db 'DELETE FROM Flags WHERE name="app_white_list";'

--  run SQL method #1  --
 OutputStream:
  /data/user/0/pl.eselter.aaphenotypepatcher/sqlite3 /data/data/com.google.android.gms/databases/phenotype.db 'INSERT OR REPLACE INTO Flags (packageName, version, flagType, partitionId, user, name, stringVal, committed) VALUES ("com.google.android.gms.car#car", 234, 0, 0, "", "app_white_list", "fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap",1);
  INSERT OR REPLACE INTO Flags (packageName, version, flagType, partitionId, user, name, stringVal, committed) VALUES ("com.google.android.gms.car#car", 230, 0, 0, "", "app_white_list", "fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap",1);
  INSERT OR REPLACE INTO Flags (packageName, version, flagType, partitionId, user, name, stringVal, committed) VALUES ("com.google.android.gms.car", 234, 0, 0, "", "app_white_list", "fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap",1);
  INSERT OR REPLACE INTO Flags (packageName, version, flagType, partitionId, user, name, stringVal, committed) VALUES ("com.google.android.gms.car", 230, 0, 0, "", "app_white_list", "fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap",1);
  INSERT OR REPLACE INTO Flags (packageName, version, flagType, partitionId, user, name, stringVal, committed) VALUES ("com.google.android.gms.car#car_setup", 234, 0, 0, "", "app_white_list", "fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap",1);
  INSERT OR REPLACE INTO Flags (packageName, version, flagType, partitionId, user, name, stringVal, committed) VALUES ("com.google.android.gms.car#car_setup", 230, 0, 0, "", "app_white_list", "fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap",1);
  INSERT OR REPLACE INTO Flags (packageName, version, flagType, partitionId, user, name, stringVal, committed) VALUES ("com.google.android.gms.car#car", (SELECT version FROM Packages WHERE packageName="com.google.android.gms.car#car"), 0, 0, "", "app_white_list", "fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap",1);
  INSERT OR REPLACE INTO Flags (packageName, version, flagType, partitionId, user, name, stringVal, committed) VALUES ("com.google.android.gms.car", (SELECT version FROM Packages WHERE packageName="com.google.android.gms.car"), 0, 0, "", "app_white_list", "fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap",1);
  INSERT OR REPLACE INTO Flags (packageName, version, flagType, partitionId, user, name, stringVal, committed) VALUES ("com.google.android.gms.car#car_setup", (SELECT version FROM Packages WHERE packageName="com.google.android.gms.car#car"), 0, 0, "", "app_white_list", "fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap",1);'
 OutputStream:
  /data/user/0/pl.eselter.aaphenotypepatcher/sqlite3 /data/data/com.google.android.gms/databases/phenotype.db 'CREATE TRIGGER after_delete AFTER DELETE
  ON Flags
  BEGIN
  INSERT OR REPLACE INTO Flags (packageName, version, flagType, partitionId, user, name, stringVal, committed) VALUES ("com.google.android.gms.car#car", (SELECT version FROM Packages WHERE packageName="com.google.android.gms.car#car"), 0, 0, "", "app_white_list", "fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap",1);
  INSERT OR REPLACE INTO Flags (packageName, version, flagType, partitionId, user, name, stringVal, committed) VALUES ("com.google.android.gms.car#car", 230, 0, 0, "", "app_white_list", "fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap",1);
  INSERT OR REPLACE INTO Flags (packageName, version, flagType, partitionId, user, name, stringVal, committed) VALUES ("com.google.android.gms.car#car", 234, 0, 0, "", "app_white_list", "fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap",1);
  INSERT OR REPLACE INTO Flags (packageName, version, flagType, partitionId, user, name, stringVal, committed) VALUES ("com.google.android.gms.car", (SELECT version FROM Packages WHERE packageName="com.google.android.gms.car"), 0, 0, "", "app_white_list", "fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap",1);
  INSERT OR REPLACE INTO Flags (packageName, version, flagType, partitionId, user, name, stringVal, committed) VALUES ("com.google.android.gms.car", 230, 0, 0, "", "app_white_list", "fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap",1);
  INSERT OR REPLACE INTO Flags (packageName, version, flagType, partitionId, user, name, stringVal, committed) VALUES ("com.google.android.gms.car", 234, 0, 0, "", "app_white_list", "fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap",1);
  INSERT OR REPLACE INTO Flags (packageName, version, flagType, partitionId, user, name, stringVal, committed) VALUES ("com.google.android.gms.car#car_setup", (SELECT version FROM Packages WHERE packageName="com.google.android.gms.car#car"), 0, 0, "", "app_white_list", "fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap",1);
  INSERT OR REPLACE INTO Flags (packageName, version, flagType, partitionId, user, name, stringVal, committed) VALUES ("com.google.android.gms.car#car_setup", 230, 0, 0, "", "app_white_list", "fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap",1);
  INSERT OR REPLACE INTO Flags (packageName, version, flagType, partitionId, user, name, stringVal, committed) VALUES ("com.google.android.gms.car#car_setup", 234, 0, 0, "", "app_white_list", "fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap",1);
  END;'
--  end SQL method #1  --

--  Check (1/3)  --
 OutputStream:
  /data/user/0/pl.eselter.aaphenotypepatcher/sqlite3 /data/data/com.google.android.gms/databases/phenotype.db 'SELECT * FROM Flags WHERE name="app_white_list";'
 InputStream:
  com.google.android.gms.car#car_setup|230|0|0||app_white_list||||fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap||1
  com.google.android.gms.car#car_setup|234|0|0||app_white_list||||fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap||1
  com.google.android.gms.car#car|230|0|0||app_white_list||||fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap||1
  com.google.android.gms.car#car|234|0|0||app_white_list||||fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap||1
  com.google.android.gms.car|230|0|0||app_white_list||||fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap||1
  com.google.android.gms.car|234|0|0||app_white_list||||fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap||1
  com.google.android.gms.car|247|0|0||app_white_list||||fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap||1
--  Check (2/3)  --
 OutputStream:
  /data/user/0/pl.eselter.aaphenotypepatcher/sqlite3 /data/data/com.google.android.gms/databases/phenotype.db 'DELETE FROM Flags WHERE name="app_white_list";'
--  Check (3/3)  --
 OutputStream:
  /data/user/0/pl.eselter.aaphenotypepatcher/sqlite3 /data/data/com.google.android.gms/databases/phenotype.db 'SELECT * FROM Flags WHERE name="app_white_list";'
 InputStream:
  com.google.android.gms.car#car_setup|230|0|0||app_white_list||||fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap||1
  com.google.android.gms.car#car_setup|234|0|0||app_white_list||||fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap||1
  com.google.android.gms.car#car|230|0|0||app_white_list||||fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap||1
  com.google.android.gms.car#car|234|0|0||app_white_list||||fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap||1
  com.google.android.gms.car|230|0|0||app_white_list||||fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap||1
  com.google.android.gms.car|234|0|0||app_white_list||||fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap||1
  com.google.android.gms.car|247|0|0||app_white_list||||fm.xiami.main,com.github.slashmax.aamirror,com.autonavi.minimap||1

--  Check seems OK :)  --

通过这种方式可能会让Android Auto应用中增加指定的APP,网上说AA Phenotype Patcher需要配合AAMirror使用,因为比较晚,明天去车上试试,顺便拍几个照片!

闲聊

WordPress插件开发:为add_settings_field 添加多个input

我在做插件的时候,发现有一些数组型的插件设置,想保存到同一个字段中,但是在国内找了一些文章,没有描述如何活用add_settings_field 。

我这次就尝试如何给一个add_settings_field中放置多个input,

add_settings_field(
    'hour_tips', // id
    '每个小时的提示', // title
    array( $this, 'hour_tips_callback' ), // callback
    'live-2d-advanced-admin', // page
    'live_2d_advanced_setting_section' // section
);

在这里,使用hour_tips_callback 作为此控件的回调方法

public function hour_tips_callback() {
    printf(
        '<input class="regular-text" style="width: 100px" type="text" name="live_2d_advanced_option_name[hour_tips][0][0]" id="hour_tips_1" value="%s"> 时 
         <input class="regular-text" type="text" name="live_2d_advanced_option_name[hour_tips][0][1]" id="hour_tips_2" value="%s"><br />',
        isset( $this->live_2d_advanced_options['hour_tips'][0][0] ) ? esc_attr( $this->live_2d_advanced_options['hour_tips'][0][0]) : '',
        isset( $this->live_2d_advanced_options['hour_tips'][0][1] ) ? esc_attr( $this->live_2d_advanced_options['hour_tips'][0][1]) : ''
    );
}

在options名字中:live_2d_advanced_options 作为一个options的字段,可以存储多维数据,我就把此作为Array,保存成了二维数组,我不知道在PHP中应该怎么描述,应为我一直是做.net的开发,对这个只是刚入门,我从数据库观察,其大致原理为:在wp-options这个标中创建一个新行,其名称为live_2d_advanced_option_name,其中存储一个WP定义的数据组,数据组是字符串,可保存普通字符串或者是一个List。

add_settings_field的sanitize过滤器中,需要传递一个不经过过滤的对象:

if ( isset( $input['hour_tips'] ) ) {
    $sanitary_values['hour_tips'] = $input['hour_tips'];
}

这样数据就会被保存至Wp-api中存储至wp-options内。

闲聊

今天来写第一篇文章

说起来也是逗,很久没折腾这种东西的我,这几天开始折腾WordPress,我也不知道是哪里心血来潮。

之前建WordPress都是改代码,从来没搞过插件,萌豚心态严重,所以我就安装了Live2D 看板娘 ,对于我这个33岁的萌豚来说,这玩意还是挺有意思的,但是我在Fork中没有找到做成插件的,唯一就是作者做了Z-blog的插件,我要不自己做一个吧!

想换工作,但是还是喜欢写代码,作为一个喜欢写代码的产品经理来说,可能还是改错行了~

不说了,先研究明白再写正片。