protected function initializeIterator()
 {
     $apiRecipe = new Recipe(API_KEY, API_SECRET, API_URL);
     //Limit the fields retrieved.
     $apiRecipe->setFields(array('id', '_id', 'status', 'title', 'photos'));
     //$rows = $apiRecipe->getAllRecipes();
     $apiRecipe->setLimit(50);
     $rows = $apiRecipe->getRecipesModifiedSince(strtotime('-240 month'));
     // Return all the images for all the rows.
     $uri_array = array();
     foreach ($rows as $row) {
         $status = $row['status'];
         if ($status == "Published") {
             foreach ($row['photos'] as $photo) {
                 $filename = basename($photo['url']);
                 $uri_array[] = array('uri' => $photo['url'], 'filename_with_path' => 'public://recipe_hero_images/' . $filename);
                 //$uri_array += array('uri' => $row['photos']['url']);
                 break;
                 //Bail after the first image.
             }
         }
     }
     $uri_it = new \ArrayIterator($uri_array);
     return $uri_it;
 }
 protected function initializeIterator()
 {
     $apiRecipe = new Recipe(API_KEY, API_SECRET, API_URL);
     $apiRecipe->setLimit(50);
     $rows = $apiRecipe->getRecipesModifiedSince(strtotime('-240 month'));
     //$rows = $apiRecipe->getAllRecipes();
     $it = new \ArrayIterator($rows);
     return $it;
 }
Example #3
0
 protected function initializeIterator()
 {
     $apiRecipe = new Recipe(API_KEY, API_SECRET, API_URL);
     // using getAllRecipes is the easiest, but might need to use getAllRecipeIds
     // or possibly recipeIterator
     $apiRecipe->setLimit(5);
     //$rows = $apiRecipe->getAllRecipes();
     $rows = $apiRecipe->getRecipesModifiedSince(strtotime('-1 month'));
     // $rows must be an array or Traversable which yields arrays. That's all!
     $it = new \ArrayIterator($rows);
     return $it;
 }
Example #4
0
 protected function initializeIterator()
 {
     $apiRecipe = new Recipe(API_KEY, API_SECRET, API_URL);
     // using getAllRecipes is the easiest, but might need to use getAllRecipeIds
     // or possibly recipeIterator
     $apiRecipe->setLimit(10);
     //$rows = $apiRecipe->getAllRecipes();
     $rows = $apiRecipe->getRecipesModifiedSince(strtotime('-1 month'));
     // $rows must be an array or Traversable which yields arrays. That's all!
     //$it = new \ArrayIterator($rows);
     // Return all the images for all the rows.
     $uri_array = array();
     foreach ($rows as $row) {
         $status = $row['status'];
         if ($status == "Published") {
             foreach ($row['photos'] as $photo) {
                 $uri_array[] = array('uri' => $photo['url']);
                 //$uri_array += array('uri' => $row['photos']['url']);
             }
         }
     }
     $uri_it = new \ArrayIterator($uri_array);
     return $uri_it;
 }