/**
  * beforeSave is called before a model is saved. Returning false from a beforeSave callback
  * will abort the save operation.
  *
  * @param Model $model Model using this behavior
  * @return mixed False if the operation should abort. Any other result will continue.
  */
 public function beforeSave(Model $model)
 {
     $settings = $this->settings[$model->alias];
     foreach (array_keys($settings) as $field) {
         $options = $this->settings[$model->alias][$field] + array('show-body-only' => true);
         $model->data[$model->alias][$field] = LibTidy::execute($model->data[$model->alias][$field], $options);
     }
     return true;
 }
예제 #2
0
 public static function execute($content, $options = array())
 {
     $tidy = $options += array('minify' => false);
     unset($tidy['minify'], $tidy['js'], $tidy['css']);
     $content = LibTidy::tidy($content, $tidy);
     if ($options['minify'] === true) {
         $content = LibTidy::minify($content, $options);
     }
     return $content;
 }
 /**
  * Generate tided HTML code
  *
  * @param string $content
  * @return string modified content if avaible, otherwise origin content
  */
 public function execute($content, $options = array())
 {
     $options += $this->settings;
     return LibTidy::execute($content, $options);
 }