Example #1
0
 /**
  * Responds to requests to POST /lorem
  */
 public function postGenerate(Request $request)
 {
     // Validate the request data
     // quantity refers to how many paragraphs/sentences/or words to generate
     $this->validate($request, ['quantity' => 'required|integer|min:1|max:99']);
     $quantity = $request->input('quantity');
     $lorem_type = $request->input('lorem_type');
     //instantiate a new Generator object using the Badcow LoremIpsum pkg
     $generator = new \Badcow\LoremIpsum\Generator();
     //lorem type is a numeric value 1-3 that corresponds with paragraph,
     //sentences, or words
     switch ($lorem_type) {
         case 1:
             $text = $generator->getParagraphs($quantity);
             break;
         case 2:
             $text = $generator->getSentences($quantity);
             break;
         case 3:
             $text = $generator->getRandomWords($quantity);
             break;
         default:
             $text = $generator->getParagraphs($quantity);
             break;
     }
     return view('lorem.generate')->with('quantity', $quantity)->with('lorem_type', $lorem_type)->with('text', $text);
     //return $request;
     //$generator = new Generator();
     //$paragraphs = $generator->getParagraphs($title);
     //echo implode('<p>', $paragraphs);
     //$sentences = $generator->getSentences($title);
     //echo implode('<p>', $sentences);
     //$words = $generator->getRandomWords($title);
     //echo implode('<p>', $words);
 }
Example #2
0
function wp_lorem_ipsum()
{
    $generator = new Badcow\LoremIpsum\Generator();
    $sentences = $generator->getSentences(30);
    $chosen = wptexturize($sentences[mt_rand(0, count($sentences) - 1)]);
    echo "<p id='wp-lorem-ipsum-text'>{$chosen}</p>";
}
Example #3
0
 public function setText()
 {
     $generator = new Badcow\LoremIpsum\Generator();
     switch ($lorem_type) {
         case 1:
             $text = $generator->getParagraphs($quantity);
             break;
         case 2:
             $text = $generator->getSentences($quantity);
             break;
         case 3:
             $text = $generator->getRandomWords($quantity);
             break;
         default:
             $paragraphs = $generator->getParagraphs($quantity);
             break;
     }
 }
Example #4
0
          <label id="text1">
            <img
              src='/images/friendly_dog_2.jpg'
              style=''
              alt='Friendly Dog'>
          Developer's Best Friend
          </label>

    </header>

    <section>
      <?php 
$generator = new Badcow\LoremIpsum\Generator();
$paragraphs = $generator->getParagraphs(5);
echo implode('<p>', $paragraphs);
$sentences = $generator->getSentences(5);
echo implode('<p>', $sentences);
$words = $generator->getRandomWords(5);
echo implode('<p>', $words);
?>
    </section>

    <footer>
        &copy; {{ date('Y') }}
    </footer>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

    {{-- Yield any page specific JS files or anything else you might want at the end of the body --}}
    @yield('body')