Ejemplo n.º 1
0
 /**
  * generatelorim function evaluate the conditions selected by the user and generate the text.
  * 
  */
 public static function generatelorim($howMany, $generate, $ckArticle, $ckItalic, $ckBold)
 {
     $lipsum = new joshtronic\LoremIpsum();
     if ($generate == 'Words') {
         if ($ckArticle == 1 && $ckItalic == 1 && $ckBold == 1) {
             $result1 = $lipsum->words($howMany, ['article', 'p', 'i', 'b']);
         }
         if ($ckArticle == 1 && $ckItalic == 1 && $ckBold == 0) {
             $result1 = $lipsum->words($howMany, ['article', 'p', 'i']);
         }
         if ($ckArticle == 1 && $ckItalic == 0 && $ckBold == 0) {
             $result1 = $lipsum->words($howMany, ['article', 'p']);
         }
         if ($ckArticle == 0 && $ckItalic == 1 && $ckBold == 1) {
             $result1 = $lipsum->words($howMany, ['i', 'b']);
         }
         if ($ckArticle == 0 && $ckItalic == 1 && $ckBold == 0) {
             $result1 = $lipsum->words($howMany, ['i']);
         }
         if ($ckArticle == 0 && $ckItalic == 0 && $ckBold == 1) {
             $result1 = $lipsum->words($howMany, ['b']);
         }
         if ($ckArticle == 0 && $ckItalic == 0 && $ckBold == 0) {
             $result1 = $lipsum->words($howMany);
         }
     } elseif ($generate == 'Sentences') {
         if ($ckArticle == 1 && $ckItalic == 1 && $ckBold == 1) {
             $result1 = $lipsum->sentences($howMany, ['article', 'p', 'i', 'b']);
         }
         if ($ckArticle == 1 && $ckItalic == 1 && $ckBold == 0) {
             $result1 = $lipsum->sentences($howMany, ['article', 'p', 'i']);
         }
         if ($ckArticle == 1 && $ckItalic == 0 && $ckBold == 0) {
             $result1 = $lipsum->sentences($howMany, ['article', 'p']);
         }
         if ($ckArticle == 0 && $ckItalic == 1 && $ckBold == 1) {
             $result1 = $lipsum->sentences($howMany, ['i', 'b']);
         }
         if ($ckArticle == 0 && $ckItalic == 1 && $ckBold == 0) {
             $result1 = $lipsum->sentences($howMany, ['i']);
         }
         if ($ckArticle == 0 && $ckItalic == 0 && $ckBold == 1) {
             $result1 = $lipsum->sentences($howMany, ['b']);
         }
         if ($ckArticle == 0 && $ckItalic == 0 && $ckBold == 0) {
             $result1 = $lipsum->sentences($howMany);
         }
     } elseif ($generate == 'Paragraphs') {
         if ($ckArticle == 1 && $ckItalic == 1 && $ckBold == 1) {
             $result1 = $lipsum->paragraphs($howMany, ['article', 'p', 'i', 'b']);
         }
         if ($ckArticle == 1 && $ckItalic == 1 && $ckBold == 0) {
             $result1 = $lipsum->paragraphs($howMany, ['article', 'p', 'i']);
         }
         if ($ckArticle == 1 && $ckItalic == 0 && $ckBold == 0) {
             $result1 = $lipsum->paragraphs($howMany, ['article', 'p']);
         }
         if ($ckArticle == 0 && $ckItalic == 1 && $ckBold == 1) {
             $result1 = $lipsum->paragraphs($howMany, ['i', 'b']);
         }
         if ($ckArticle == 0 && $ckItalic == 1 && $ckBold == 0) {
             $result1 = $lipsum->paragraphs($howMany, ['i']);
         }
         if ($ckArticle == 0 && $ckItalic == 0 && $ckBold == 1) {
             $result1 = $lipsum->paragraphs($howMany, ['b']);
         }
         if ($ckArticle == 0 && $ckItalic == 0 && $ckBold == 0) {
             $result1 = $lipsum->paragraphs($howMany);
         }
     } else {
         $result1 = $lipsum->words($howMany, '<li><a href="$1">$1</a></li>');
     }
     return $result1;
 }