public static function fromPreferenceString( $string ) // {{{ { global $toolbarPickerIndex; $toolbarPickerIndex = -1; $list = new self; $string = preg_replace('/\s+/', '', $string); foreach (explode('/', $string) as $line) { $bits = explode('|', $line); if (count($bits) > 1) { $list->addLine(explode(',', $bits[0]), explode(',', $bits[1])); } else { $list->addLine(explode(',', $bits[0])); } } return $list; } // }}}
public static function fromPreferenceString($string, $params) { global $toolbarPickerIndex; $toolbarPickerIndex = -1; $list = new self(); $list->wysiwyg = isset($params['_wysiwyg']) && $params['_wysiwyg'] === 'y'; $list->is_html = !empty($params['_is_html']); $string = preg_replace('/\\s+/', '', $string); foreach (explode('/', $string) as $line) { $bits = explode('|', $line); if (count($bits) > 1) { $list->addLine(explode(',', $bits[0]), explode(',', $bits[1])); } else { $list->addLine(explode(',', $bits[0])); } } return $list; }
/** * Insertion rapide dans un fichier de log */ public static function log($file, $line) { $csv = new self(); $csv->open($file); $csv->addLine($line); }