public static function show() { $msg = Config::get("maintenance.msg"); $bg_color = Config::get("maintenance.bg"); //include 'View.php'; $view = array("bundle_name" => 'maintenance', "view" => 'maintenance.index', "backend" => true, "panel" => false, "roles" => ["Administrateur", "User", "Guest"]); View::make($view, ['msg' => $msg, 'bg_color' => $bg_color]); }
public static function add_shortcode($string) { $shortcode = self::get($string); if (is_array($shortcode)) { if (count($shortcode) === 5) { $view = array("bundle_name" => $shortcode['name'], "view" => $shortcode['view'], "backend" => $shortcode['backend'], "panel" => $shortcode['panel'], "roles" => ["Administrateur", "User", "Guest"]); $content = View::get($view); return $content; } else { return false; } } else { return false; } }
public static function hello() { $view = array("bundle_name" => 'hello', "view" => 'hello.index', "backend" => false, "panel" => false, "roles" => ["Guest"]); return View::make($view); }
public static function send($view, $array, $callback) { // $selfmail = new self(); $callback($selfmail); // //get The View if ($selfmail->type == "text") { $body = $view; $type = "text/plain"; } else { if ($selfmail->type == "html") { $body = View::get($view, $array); $type = "text/html"; } } // if (!self::configured($selfmail)) { $selfmail->host = Config::get("mail.host"); $selfmail->port = Config::get("mail.port"); $selfmail->secure = Config::get("mail.encryption"); $selfmail->type = "html"; $selfmail->username = Config::get("mail.username"); $selfmail->password = Config::get("mail.password"); $selfmail->from['adresse'] = Config::get("mail.from")['adresse']; $selfmail->from['name'] = Config::get("mail.from")['name']; } // self::check($selfmail); // $selfmail->transport = \Swift_SmtpTransport::newInstance($selfmail->host, $selfmail->port, $selfmail->secure)->setUsername($selfmail->username)->setPassword($selfmail->password); $mailer = \Swift_Mailer::newInstance($selfmail->transport); $subject = is_null($selfmail->subject) ? Config::get('mail.subject') : $selfmail->subject; // //The Message $message = \Swift_Message::newInstance($subject); $message->setBody($body, $type); $message->setFrom(array($selfmail->from['adresse'] => $selfmail->from['name'])); // Check to // if (!is_null($selfmail->too) && !empty($selfmail->too)) { $message->setTo($selfmail->too); } else { throw new \InvalidArgumentException("Missing mail to", 1); } // // Attaches if (!is_null($selfmail->attachmnt) && count($selfmail->attachmnt) > 0) { foreach ($selfmail->attachmnt as $key => $value) { $name = ""; $filee = ""; // foreach ($value as $key2 => $value2) { if ($key2 == 0) { $filee = $value2; } else { if ($key2 == 1) { $name = $value2; } } } if (empty($name)) { $message->attach(\Swift_Attachment::fromPath($filee)); } else { $message->attach(\Swift_Attachment::fromPath($filee)->setFilename($name)); } } } // // CC if (!is_null($selfmail->cc) && count($selfmail->cc) > 0) { $r = array(); // foreach ($selfmail->cc as $key => $value) { $name = ""; $mail = ""; // foreach ($value as $key2 => $value2) { if ($key2 == "mail") { $mail = $value2; } else { if ($key2 == "name") { $name = $value2; } } } // if (empty($name)) { $r[] = $mail; } else { $r[$mail] = $name; } } // $message->setCC($r); } // // CCI if (!is_null($selfmail->cci) && count($selfmail->cci) > 0) { $r = array(); // foreach ($selfmail->cci as $key => $value) { $name = ""; $mail = ""; // foreach ($value as $key2 => $value2) { if ($key2 == "mail") { $mail = $value2; } else { if ($key2 == "name") { $name = $value2; } } } // if (empty($name)) { $r[] = $mail; } else { $r[$mail] = $name; } } // $message->setBcc($r); } // // Send $result = $mailer->send($message); return $result; }
/** * Views */ function view($value, $data = null) { return View::make($value, $data); }