XPressME Integration Kit のサイトで WordPress Download Monitorプラグインを利用しているのですが、
最新のVer3.3.3.10にアップグレードしたところ、タグが正しく処理されなくなってしまいました。
カスタムフォーマットで
{date,"Y-m-d"} <a title="Downloaded {hits} times" href="{url}">{title}</a> ({size}) ({hits} Downloads)
みたいなフォーマットを書いているのですが最初のタグ{date,”Y-m-d”} がタグとして処理されず、そのまま出力されてしまいます。
で、コードを参照してみたのですが
classes/downloadable_file.class.php line 497
if (strpos($format, '{date,')) : preg_match("/{date,\s*\"([^\"]*?)\"}/", $format, $match); if ($match) { $fpatts[] = $match[0]; if ($this->postDate) $fsubs[] = date_i18n($match[1],strtotime($this->postDate)); else $fsubs[] = ""; } endif;
の部分でstrpos($format, ‘{date,’)が値0を返すために処理されないようです。
if (strpos($format, '{date,')) :
は
if (strpos($format, '{date,') !== false) :
に変更することで修正が可能です。
あるいは
if (strpos($format, '{date,')) : preg_match("/{date,\s*\"([^\"]*?)\"}/", $format, $match); if ($match) { $fpatts[] = $match[0]; if ($this->postDate) $fsubs[] = date_i18n($match[1],strtotime($this->postDate)); else $fsubs[] = ""; } endif;
を
if(preg_match("/{date,\s*\"([^\"]*?)\"}/", $format, $match)){ $fpatts[] = $match[0]; if ($this->postDate) $fsubs[] = date_i18n($match[1],strtotime($this->postDate)); else $fsubs[] = ""; }
としてもOKかな
ほかのタグについても同様です。
こちらは、作者のフォーラムにバグとして報告させていただきました。
作者さんによりVer3.3.4.1で修正が行われました。