/**
  * Construct the instruction object.
  *
  * @since 1.3.0
  *
  * @param int|object instruction The instruction item or item ID.
  */
 public function __construct($instruction)
 {
     if (is_numeric($instruction)) {
         $items_api = new Simmer_Recipe_Items();
         $instruction = $items_api->get_item($instruction);
         if (!$instruction) {
             return false;
         }
     }
     $this->id = $instruction->recipe_item_id;
     $this->order = $instruction->recipe_item_order;
     $this->description = $this->get_description(true);
     $this->is_heading = $this->is_heading(true);
 }
예제 #2
0
파일: functions.php 프로젝트: robneu/simmer
/**
 * Get a recipe item by its ID.
 *
 * @since 1.3.0
 *
 * @param  int         $item_id The ID of the desired item.
 * @return object|bool $item    The requested item or false on failure.
 */
function simmer_get_recipe_item($item_id)
{
    $items_api = new Simmer_Recipe_Items();
    $item = $items_api->get_item($item_id);
    return $item;
}