Exemple #1
0
 /**
  * Driver - plugin to use
  * Data - data to be converted
  * Action - download, print, save
  * Name - file name to use when saving or downloading
  * Ext - file extension
  *
  *
  * @param  string  $driver
  * @param  string  $data
  * @param  string  $action
  * @param  string  $name
  * @param  string  $ext
  * @param  array   $options
  */
 public function __construct($driver, $data, $action = NULL, $name = NULL, $ext = NULL, $options = array())
 {
     // clean driver name replaces _ to space for ucwords then converts back
     $this->driver = str_replace(' ', '', ucwords(strtolower(str_replace('_', ' ', $driver))));
     // set action
     $this->action = $action ? $action : 'download';
     // set ext if null attempt to auto find
     if ($ext) {
         $this->ext = str_replace('.', '', $ext);
     } else {
         $ext = pathinfo($name);
         $this->ext = $ext['extension'];
     }
     // set name
     $this->name = $name ? $name : basename(Router::$current_uri, $this->ext);
     // set options
     $this->options = $options;
     // set vendor folder
     self::$vendor = MODPATH . 'convert/vendor/';
     $this->init($data);
 }