Beispiel #1
0
 /**
  * Generate placeholder text.
  * 
  * Using the famous Lorem Ipsum base text, generate a dummy text based on 
  * specified options.
  * 
  * @param int $count
  *   The length in words of the dummy text.
  * @param array $options
  *   (optional) An array of options to manage text generation. Options 
  *   available are:
  *   - html: wheter to build HTML content or plain content. Default to false.
  *   - lorem: if the text must start with "Lorem ipsum..." or not.
  *     Default to true.
  * 
  * @return @e string 
  *   The generated dummy text.
  * 
  * @ingroup helperfunc
  */
 public function placeholder_text($count, $options = array())
 {
     $options = array_merge(array('html' => false, 'lorem' => true), $options);
     $generator = new LoremIpsumGenerator();
     $html_format = $options['html'] ? 'plain' : 'html';
     $start_with_lorem_ipsum = $options['lorem'];
     return ucfirst($generator->getContent($count, $html_format, $start_with_lorem_ipsum));
 }
Beispiel #2
0
 function loremipsum_shortcode($attr, $content = null)
 {
     $words = 100;
     $type = "html";
     $generator = new LoremIpsumGenerator();
     if (isset($attr["words"])) {
         $words = $attr["words"];
     }
     if (isset($attr["type"])) {
         $type = $attr["type"];
     }
     $text = $generator->getContent($words, $type);
     return $text;
 }
Beispiel #3
0
				</div>
			</div> <!-- close .grid -->
		</header> <!-- close header#site-header -->

		<div id="content-wrapper">
			<div id="content-body">
				<div class="grid">

					<div class="g12 listing">
						<article class="post single">
							
							<h1>Article Title</h1>

							<div class="content">
								<p>Intro <?php 
echo $filler->getContent(30, 'plain', false);
?>
</p>
							</div>

							<div id="photo-grid" class="row">

							<?php 
$tags = array('people', 'abstract', 'fashion', 'nature', 'city', 'animals', 'people', 'technics', 'nature', 'abstract', 'fashion', 'nature');
foreach ($tags as $tag) {
    $width = rand(400, 800);
    $height = rand(400, 800);
    $size = $width . "/" . $height;
    $image_path = 'http://lorempixel.com/' . $size . '/' . $tag;
    $image_tag = ucwords($tag);
    $sample_text = $filler->getContent(rand(5, 15), 'html', false);
Beispiel #4
0
			<div id="content-body">
				<div class="grid">

					<div class="g12 listing">
							
						<h1>Blog</h1>

						<?php 
$tags = array('people', 'abstract', 'fashion', 'nature', 'city', 'animals', 'people', 'technics', 'nature', 'abstract', 'fashion', 'nature');
foreach ($tags as $tag) {
    $width = 1240;
    $height = rand(400, 800);
    $size = $width . "/" . $height;
    $image_path = 'http://lorempixel.com/' . $size . '/' . $tag;
    $image_tag = ucwords($tag);
    $sample_text = $filler->getContent(rand(10, 50), 'html', false);
    // $post_title = ucfirst($filler->getContent(rand(2,8), 'plain', false));
    $post_title = ucfirst($image_tag);
    $show = rand(0, 3);
    ?>
							<article class="post listed">

								<?php 
    if ($show) {
        ?>
								<div class="featured-image">
									<a href="post.php"><img src="<?php 
        echo $image_path;
        ?>
" /></a>
								</div>
 function testSave()
 {
     //First we need to generate some more TestData(tm)
     $loremIpsum = new LoremIpsumGenerator();
     //First in line is some posts 250 Randomly generated ones, some with mentions.
     $mentions = 0;
     $posts = 0;
     for ($i = 0; $i <= 250; $i++) {
         $sender = rand(5, 16);
         $data = $loremIpsum->getContent(17, 'plain');
         $postid = rand(1000, 1000000);
         while (isset($pic[$postid])) {
             $postid = rand(1000, 1000000);
         }
         $pic[$postid] = true;
         $number = rand(1, 8);
         if ($number == 1 or $number == 2) {
             $data = "@jack " . $data;
             $mentions++;
         } elseif ($number == 3) {
             $data = "@jill " . $data;
         }
         $q = "INSERT INTO `tt_posts` (`post_id`, `author_user_id`, `post_text`) ";
         $q .= " VALUES ('" . $postid . "', '" . $sender . "', '" . $data . "');\n";
         PDODAO::$PDO->exec($q);
         if ($sender == 10) {
             $posts++;
         }
     }
     unset($pic);
     //Then generate some follows
     $follows = 0;
     for ($i = 0; $i <= 150; $i++) {
         $follow = array("follower" => rand(5, 25), "following" => rand(5, 25));
         if (!isset($fd[$follow['following'] . "-" . $follow['follower']])) {
             $fd[$follow['following'] . "-" . $follow['follower']] = true;
             $q = "INSERT INTO `tt_follows` (`user_id`, `follower_id`) ";
             $q .= "VALUES ( '" . $follow['following'] . "', '" . $follow['follower'] . "');\n";
             PDODAO::$PDO->exec($q);
             if ($follow['following'] == 10) {
                 $follows++;
             }
         } else {
             $i = $i - 1;
         }
     }
     //Lastly generate some users
     $users = array(array('id' => 10, 'name' => 'jack'), array('id' => 12, 'name' => 'jill'), array('id' => 13, 'name' => 'stuart'), array('id' => 15, 'name' => 'Jillian Dickerson'), array('id' => 16, 'name' => 'Paul Clark'));
     foreach ($users as $user) {
         $q = "INSERT INTO `tt_users` (`user_id`, `user_name`) ";
         $q .= " VALUES ('" . $user['id'] . "', '" . $user['name'] . "') ";
         PDODAO::$PDO->exec($q);
     }
     //Now load the instance in question
     $i = $this->DAO->getByUsername('jack');
     //Edit it.
     $i->last_status_id = 512;
     $i->last_page_fetched_replies = 2;
     $i->last_page_fetched_tweets = 17;
     $i->is_archive_loaded_follows = 1;
     $i->is_archive_loaded_replies = 1;
     //First make sure that last run data is correct before we start.
     $result = $this->DAO->getInstanceOneByLastRun('DESC');
     $this->assertIsA($result, "Instance");
     $this->assertEqual($result->network_username, 'jill');
     $this->assertEqual($result->network_user_id, 12);
     $this->assertEqual($result->network_viewer_id, 12);
     //Save it
     $count = $this->DAO->save($i, 1024);
     $this->assertEqual($count, 1);
     //Load it for testing
     $result = $this->DAO->getByUsername('jack');
     $this->assertEqual($result->total_posts_by_owner, 1024);
     $this->assertEqual($result->last_page_fetched_replies, 2);
     $this->assertEqual($result->last_status_id, 512);
     $this->assertEqual($result->last_page_fetched_tweets, 17);
     $this->assertEqual($result->total_replies_in_system, $mentions);
     $this->assertEqual($result->total_follows_in_system, $follows);
     $this->assertEqual($result->total_posts_in_system, $posts);
     $this->assertEqual($result->total_users_in_system, 5);
     $this->assertTrue($result->is_archive_loaded_follows);
     $this->assertTrue($result->is_archive_loaded_replies);
     //Check if it is the update updated last Run.
     $result = $this->DAO->getInstanceOneByLastRun('DESC');
     $this->assertIsA($result, "Instance");
     $this->assertEqual($result->network_username, 'jack');
     $this->assertEqual($result->network_user_id, 10);
     $this->assertEqual($result->network_viewer_id, 10);
     //Still needs tests for:
     //earliest_reply_in_system
     //earliest_post_in_system
 }
Beispiel #6
0
 /**
  * Generates a random lorem ipsum tet
  *
  * @param     integer    $min       Minimum word count
  * @param     integer    $max       Maximum word count
  * @param     string     $format    Output format. Can be "html" or "plain"
  *
  * @return    string                The generated text
  */
 public static function getRandomText($min = 0, $max = 300, $format = 'html')
 {
     static $class = null;
     if (is_null($class)) {
         $class = new LoremIpsumGenerator();
     }
     $count = rand($min, $max);
     if ($count == 0) {
         return '<p></p>';
     }
     return $class->getContent($count);
 }
Beispiel #7
0
              ),
            ),
          ),
        ),
      ),
    ),
  ),
))) return 'Install Failure: Count not insert example blog pattern.';

//sample posts
require('lib/LoremIpsum.class.php');
$gen = new LoremIpsumGenerator;
$posts=array();
for($i=0;$i<30;++$i){
   $posts['post-'.$i.'-'.random_string()]=array(
	  'pattern:match'=>'/patterns/blog/post',
      'title'=>$gen->getContent(mt_rand(4,15)),
      'content'=>$gen->getContent(mt_rand(40,150)));
}
if(!$node->record_tree2->insert('/',array('myblog'=>
   array('pattern:children'=>'/patterns/blog/',
         'admin:icon'=>'book',
         'node:children'=>array('gen'=>array('pattern:match'=>'/patterns/blog/category',
						         'title'=>'Testing',
						         'node:children'=>$posts)))))) 
	return 'Install Failure: Could not insert sample blog data.';
return true;

};

Beispiel #8
0
 static function lorem_ipsum($num)
 {
     static $lorem_ipsum = null;
     if (!$lorem_ipsum) {
         require_once MODPATH . "gallery_unit_test/vendor/LoremIpsum.class.php";
         $lorem_ipsum = new LoremIpsumGenerator();
     }
     // skip past initial 'lorem ipsum'
     return substr($lorem_ipsum->getContent($num + 2, "txt"), 13);
 }
<?//copy+pasta into terminal for 30 blog posts inserted into category at /myblog/gen/
require('lib/LoremIpsum.class.php');$gen = new LoremIpsumGenerator;for($i=0;$i<30;++$i){$node->record_tree2->insert('/myblog/gen/',array('post-#RAND#'=>array('pattern:match'=>'/patterns/blog/post','title'=>$gen->getContent(mt_rand(4,15)),'content'=>$gen->getContent(100))));}