Example #1
0
 function upload_form()
 {
     $this->data['title'] .= ' - Upload';
     $this->data['small_upload_size'] = $this->config->item('small_upload_size');
     $this->data['max_upload_size'] = $this->config->item('upload_max_size');
     $this->data['upload_max_age'] = $this->config->item('upload_max_age') / 60 / 60 / 24;
     $this->data['username'] = $this->muser->get_username();
     $repaste_id = $this->input->get("repaste");
     if ($repaste_id) {
         $filedata = $this->mfile->get_filedata($repaste_id);
         $pygments = new \libraries\Pygments($this->mfile->file($filedata["data_id"]), $filedata["mimetype"], $filedata["filename"]);
         if ($filedata !== false && $pygments->can_highlight()) {
             $this->data["textarea_content"] = file_get_contents($this->mfile->file($filedata["data_id"]));
         }
     }
     $this->load->view('header', $this->data);
     $this->load->view($this->var->view_dir . '/upload_form', $this->data);
     if (is_cli_client()) {
         $this->client();
     }
     $this->load->view('footer', $this->data);
 }
 public function test_can_highlight_canButShouldntHighlight()
 {
     $p = new \libraries\Pygments('/invalid/filepath', 'image/svg+xml', 'foo.svg');
     $this->t->is($p->can_highlight(), true, "image/svg+xml can highlight");
 }