Example #1
0
 /**
  * Load and output a css link tag from array
  *
  * @param array $array
  * @param array $params
  * @return string
  * @throws \Exception
  */
 public static function css(array $array, $params = array('attributes' => [], 'secure' => null))
 {
     Arr::mergeWithDefaultParams($params);
     $out = "\n";
     foreach ($array as $key => $item) {
         if (is_array($item)) {
             $out .= Html::style($item[0], $item[1], $item[2]) . "\n";
         } else {
             $out .= Html::style($item, $params['attributes'], $params['secure']) . "\n";
         }
     }
     return $out;
 }
Example #2
0
 /**
  * Fetch structure by index
  *
  * @param null $index
  * @param array $params
  * @return bool
  */
 public function fetch($index = null, $params = array('index' => true, 'overview' => true, 'structure' => true, 'header' => true, 'body' => true, 'plain' => true, 'attachments' => true))
 {
     $params = Arr::mergeWithDefaultParams($params);
     $this->attachments = [];
     if (!$index) {
         $index = 1;
     }
     $this->messageNumber = $index;
     $structure = @imap_fetchstructure($this->conn, $index);
     if (!$structure) {
         return false;
     } else {
         $data = [];
         if ($params['index']) {
             $data['index'] = $index;
         }
         if ($params['overview']) {
             $data['overview'] = @imap_fetch_overview($this->conn, $index);
         }
         if ($params['structure']) {
             $data['structure'] = $structure;
         }
         if ($params['header']) {
             $data['header'] = @imap_header($this->conn, $index);
         }
         if ($params['body']) {
             $this->bodyHTML = $data['body'] = @imap_body($this->conn, $index);
         }
         if ($params['plain']) {
             $data['plain'] = @imap_fetchbody($this->conn, $index, 1.2);
         }
         if ($params['attachments']) {
             $this->recurse($structure->parts);
             $data['attachments'] = $this->attachments;
         }
         return $data;
     }
 }