Site cover image

Site icon imagehtrkwn.dat

Just a htrkwn's personal hobby scrapbook.

🐶BluditのPremium Postで使用するファイル名をtitleからuuidに変更

Bludit使ってて個別にパスワード設定できるといいんだけどなと思ってたらプラグインがあったので使わせてもらう。

(デフォルトブランチではなく2.0ブランチの方が新しいのでそちらを使う)

https://github.com/multicolor-rgb/premium-post

サポートフォーラムの方にも書き込みがあったので参考にしながら作業。

で、パスワードを保存するのがファイルベースらしく、記事タイトルを使用しているらしいので、日本語タイトルなのでちょっと変更しただけでパスワードのファイルも乱立する。それはちょっと……と思ったので、ちょっと変更しておく。

具体的にはplugin.phpの次を変更した。

// line 32, $page->title() => $page->uuid()

- $filec = $folder . $page->title();
+ $filec = $folder . $page->uuid();

// line 47

- $filename = $folder . $_POST['title'];
+ $filename = $folder . $_POST['uuid'];

// line 94

- $filec = $folder . $page->title();
+ $filec = $folder . $page->uuid();

とりあえず動いているみたい。一意の値の方がいいかなって思ったんだけど……。どうだろ~。ちなみにパスワード入力間違えると再入力は促されないのでページ更新するっぽい。

テーマを複製してカスタマイズするときのベストプラクティスもメモ。多分使う。

The "best practice" is:
  1. Make a copy for example of the theme Blog X.
  2. Modify the file metadata.json and use for example "plugin": "blogx2" instead of "plugin": "blogx" (line 10).
  3. Load the theme in a directory for example blogx2 on the server.
  4. Copy the plugin blogx and give it the name blogx2.
  5. Modify the file plugin.php and use class blogx2 extends Plugin instead of class blogx extends Plugin (line 3).
Don't forget to rename the Theme-Name in

/languages/xx_XX.json