/** * @inheritdoc */ public function flush() { $data = $this->get(self::CONTENT); if (is_array($data) or is_object($data)) { $this->set(self::CONTENT, json_encode($data)); } parent::flush(); }
/** * @inheritdoc */ public function flush() { $data = $this->get(self::CONTENT); if (!is_scalar($data)) { $this->set(self::CONTENT, print_r($data, true)); } parent::flush(); }
/** * @inheritdoc */ public function flush() { if ($this->output_config->get('add_timestamp_to_static_link')) { $t = $this; $content = $this->get(self::CONTENT); $ext_pattern = implode('|', $this->output_config->get('static_file_ext')); $get_mtime_callback = $this->output_config->get('get_mtime_callback'); $add_timestamp_callback = $this->output_config->get('add_timestamp_callback'); $pattern = '@(?<=\\<[^>]+\\s+(href|src)\\s*=\\s*["\']?)([^\'"]+)(?=["\' ])@is'; $content = preg_replace_callback($pattern, function ($match) use($t, $ext_pattern, $get_mtime_callback, $add_timestamp_callback) { if (preg_match("@\\.({$ext_pattern})@is", $match[1])) { $timestamp = call_user_func($get_mtime_callback, $match[1]); return call_user_func($add_timestamp_callback, $match[1], $timestamp); } else { return $match[1]; } }, $content); $this->set(self::CONTENT, $content); } parent::flush(); }