Beispiel #1
0
 public function aTag($tag, $attributes, $content, $Attrval)
 {
     try {
         /*Validate all input values */
         $this->ValidateUserInput($tag, $attributes, $content);
         /*Special Tag Img*/
         if ($tag == 'img') {
             /*check for image file exists */
             $file = new FileOperation();
             try {
                 $file->isFileExists($Attrval);
             } catch (FileNotFoundException $e) {
                 $attributes = 'alt';
                 $Attrval = "No image";
             }
         }
         $html = '<' . $tag;
         $html .= ' ' . $attributes . '="' . $Attrval . '"';
         $html .= '>' . $content . "</" . $tag . "><br>\n";
         /*Display Created Tag*/
         echo "\nTag Created :" . $html . '<br>';
     } catch (InvalidAttributeException $e) {
         echo 'Invalid Attribute.';
     } catch (InvalidContentException $e) {
         echo 'Invalid Content.';
     } catch (InvalidTagNameException $e) {
         echo 'Invalid Tag Name.';
     }
 }
Beispiel #2
0
 public function __construct()
 {
     if (empty($_GET["FileName"])) {
         echo 'Please Enter file name to check.<br>';
     } else {
         $fileop = new FileOperation();
         $this->thisdir = getcwd();
         $path = $this->thisdir . '\\' . $_GET["FileName"];
         try {
             $fileop->isFileExists($path);
             $fileop->readFileintoArray($path);
             $fileop->readLineByLineFromFile($path);
             $fileop->AppendtoFile($path);
             $fileop->DelelteFile($_GET["DelFile"]);
             $fileop->getAllfilesFromDirectory($_GET["DirName"]);
             $fileop->CreateDirectory($_GET["NewDirName"]);
             $fileop->ReadCSVFile($path);
             $fileop->readXMLFile($path);
         } catch (FileNotFoundException $e) {
             echo 'Severe Error Occured : File not Found.';
         } catch (FileLoadException $e) {
             echo 'Error in loading file..';
         } catch (DirectoryExistsException $e) {
             echo 'Directory already exists..';
         } catch (FileAlreadyExistsException $e) {
             echo 'File already exists..';
         } catch (FileNotReadble $e) {
             echo 'File is not readble..';
         } catch (FileAlreadyExistsException $e) {
             echo 'File is not writable...';
         } catch (GeneralException $e) {
             echo 'Error occured in Processing request...';
         } catch (DirectoryNotFoundException $e) {
             echo 'Directory not found..';
         }
     }
 }