本文整理汇总了PHP中singleton类的典型用法代码示例。如果您正苦于以下问题:PHP singleton类的具体用法?PHP singleton怎么用?PHP singleton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了singleton类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: singleton
/**
* This function returns a instance (and creates a new one
* if there isnt already one) of a class.
*
* @author Johannes Klose <[email protected]>
* @param string $class Class from where an instance should be returned.
* @return object Instance of $class
**/
function &singleton($class)
{
static $singleton;
if (!is_object($singleton)) {
$singleton = new singleton();
}
return $singleton->instance($class);
}
开发者ID:BackupTheBerlios,项目名称:calitrixwiki,代码行数:16,代码来源:lib_instances.php
示例2: getInstance
public static function getInstance(&$sql, $location, $var, $type)
{
// 确定类型
switch ($type) {
default:
// 默认使用字符串类型
// 默认使用字符串类型
case 'STRING':
$var = addslashes($var);
// 转义
$var = "'" . $var . "'";
// 加上单引号.sql语句中字符串插入必须加单引号
break;
case 'INTEGER':
case 'INT':
$var = (int) $var;
// 强制转换成int
// 还可以增加更多的类型...
}
$pos = 0;
// 判断该类是否是第一次被实例化
if (self::$instance == NULL) {
self::$instance = new singleton();
for ($i = 1; $i <= $location; $i++) {
$pos = strpos($sql, '?', $pos + 1);
}
} else {
for ($i = 1; $i <= $location - 1; $i++) {
$pos = strpos($sql, '?', $pos + 1);
}
}
return $sql = substr($sql, 0, $pos) . $var . substr($sql, $pos + 1);
}
开发者ID:ZSShang,项目名称:mylearn,代码行数:33,代码来源:danli_static.php
示例3: get_instance
public static function get_instance($text)
{
if (!isset(singleton::$singleton)) {
singleton::$singleton = new singleton($text);
}
return singleton::$singleton;
}
开发者ID:GlennWatt,项目名称:personalWebSpace,代码行数:7,代码来源:singleton_pattern.php
示例4: getInstance
public static function getInstance()
{
if (self::$instance == null) {
self::$instance = new singleton();
}
return self::$instance;
}
开发者ID:pengzhengrong,项目名称:account,代码行数:7,代码来源:singleton.php
示例5: update_check
public function update_check()
{
$config =& singleton::get(__NAMESPACE__ . '\\config');
$apptrack =& singleton::get(__NAMESPACE__ . '\\apptrack');
$send_data['application_id'] = 1;
$send_data['version'] = $config->get('program_version');
$data = $apptrack->send($send_data);
if (!empty($data)) {
$config->set('last_update_response', $data);
return true;
} else {
$log =& singleton::get(__NAMESPACE__ . '\\log');
$log_array['event_severity'] = 'warning';
$log_array['event_number'] = E_USER_WARNING;
$log_array['event_description'] = 'Unable to contact update server.';
$log_array['event_file'] = __FILE__;
$log_array['event_file_line'] = __LINE__;
$log_array['event_type'] = 'update_check';
$log_array['event_source'] = 'cron';
$log_array['event_version'] = '1';
$log_array['log_backtrace'] = false;
$log->add($log_array);
return false;
}
}
开发者ID:rnlduadia,项目名称:LAMP-eCommerce-CodeIgniter,代码行数:25,代码来源:cron.class.php
示例6: get
public function get($name)
{
$error =& singleton::get(__NAMESPACE__ . '\\error');
if (isset($this->language_array[$name])) {
//return '試験';
//return '試験' . $this->language_array[$name];
return $this->language_array[$name];
} else {
//$error->create(array('type' => 'language_item_missing', 'message' => 'Unable to find language item "'.$name.'".'));
return $name;
}
}
开发者ID:rnlduadia,项目名称:LAMP-eCommerce-CodeIgniter,代码行数:12,代码来源:language.class.php
示例7: optimise_tables
public function optimise_tables()
{
global $db;
$tables =& singleton::get(__NAMESPACE__ . '\\tables');
$log =& singleton::get(__NAMESPACE__ . '\\log');
$log_array['event_severity'] = 'notice';
$log_array['event_number'] = E_USER_NOTICE;
$log_array['event_description'] = 'Optimising Tables';
$log_array['event_file'] = __FILE__;
$log_array['event_file_line'] = __LINE__;
$log_array['event_type'] = 'optimise_tables';
$log_array['event_source'] = 'db_maintenance';
$log_array['event_version'] = '1';
$log_array['log_backtrace'] = false;
$log->add($log_array);
$optimise_tables = '';
foreach ($tables->get() as $value => $index) {
$optimise_tables .= $index . ',';
}
$optimise_tables = substr($optimise_tables, 0, strlen($optimise_tables) - 1);
$query = 'OPTIMIZE TABLE ' . $optimise_tables;
foreach ($db->query($query, database::FETCH_ASSOC) as $row) {
if ($row['Msg_type'] == 'error') {
$number = E_USER_WARNING;
$type = 'warning';
} else {
$number = E_USER_NOTICE;
$type = 'notice';
}
$log_array['event_severity'] = $type;
$log_array['event_number'] = $number;
$log_array['event_description'] = 'Table "' . $row['Table'] . '"<br />Message "' . $row['Msg_text'] . '"';
$log_array['event_file'] = __FILE__;
$log_array['event_file_line'] = __LINE__;
$log_array['event_type'] = 'optimise_tables';
$log_array['event_source'] = 'db_maintenance';
$log_array['event_version'] = '1';
$log_array['log_backtrace'] = false;
$log->add($log_array);
}
$log_array['event_severity'] = 'notice';
$log_array['event_number'] = E_USER_NOTICE;
$log_array['event_description'] = 'Optimising Tables Complete';
$log_array['event_file'] = __FILE__;
$log_array['event_file_line'] = __LINE__;
$log_array['event_type'] = 'optimise_tables';
$log_array['event_source'] = 'db_maintenance';
$log_array['event_version'] = '1';
$log_array['log_backtrace'] = false;
$log->add($log_array);
}
开发者ID:rnlduadia,项目名称:LAMP-eCommerce-CodeIgniter,代码行数:51,代码来源:db_maintenance.class.php
示例8: send
public function send($array)
{
$log =& singleton::get(__NAMESPACE__ . '\\log');
$array['token'] = $this->app_key;
/*
Limit to 512 chars as per pushover limit.
*/
$remove = 0;
if (isset($array['title'])) {
$remove = (int) strlen($array['title']);
}
if (isset($array['message'])) {
$array['message'] = substr($array['message'], 0, 512 - $remove);
}
$options = array('http' => array('user_agent' => user_agent(), 'timeout' => 5, 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query($array)));
$context = stream_context_create($options);
$result = @file_get_contents($this->api_url, false, $context);
if ($result) {
$return_data = json_decode($result, true);
if ($return_data['status'] == 1) {
return true;
} else {
$larray['event_severity'] = 'error';
$larray['event_number'] = E_USER_ERROR;
$larray['event_description'] = 'Unable to send pushover message.';
$larray['event_file'] = __FILE__;
$larray['event_file_line'] = __LINE__;
$larray['event_type'] = 'send';
$larray['event_source'] = 'pushover';
$larray['event_version'] = '1';
$larray['log_backtrace'] = true;
$log->add($larray);
}
} else {
$larray['event_severity'] = 'error';
$larray['event_number'] = E_USER_ERROR;
$larray['event_description'] = 'Unable to send pushover message.';
$larray['event_file'] = __FILE__;
$larray['event_file_line'] = __LINE__;
$larray['event_type'] = 'send';
$larray['event_source'] = 'pushover';
$larray['event_version'] = '1';
$larray['log_backtrace'] = true;
$log->add($larray);
}
return false;
}
开发者ID:rnlduadia,项目名称:LAMP-eCommerce-CodeIgniter,代码行数:47,代码来源:pushover.class.php
示例9: validateAddPortfolio
/**
* validateAddPortfolio
*
* Validate new portfolio
* @param($_POST)
* @return(boolean)
*/
public function validateAddPortfolio()
{
# get the modal
$oPortfolio = singleton::getInstance('Portfolio');
# the slug
$page_slug = $_POST['page_slug'];
# create empty error
$aErrors = array();
if (strlen($_POST['portfolio_title']) >= 30) {
$aErrors['title'] = true;
}
if (strlen($_POST['portfolio_description']) >= 1000) {
$aErrors['description'] = true;
}
if (strlen($_POST['portfolio_github_link']) >= 100) {
$aErrors['github'] = true;
}
if (strlen($_POST['portfolio_website_link']) >= 100) {
$aErrors['portfolio_website_link'] = true;
}
if (strlen($_POST['portfolio_meta_title']) >= 100) {
$aErrors['portfolio_meta_title'] = true;
}
if (strlen($_POST['portfolio_meta_keyword']) >= 1000) {
$aErrors['portfolio_meta_title'] = true;
}
if (strlen($_POST['portfolio_meta_desc']) >= 2) {
$aErrors['portfolio_meta_desc'] = true;
}
if (strlen($page_slug) >= 25) {
$aErrors['page_slug_too_long'] = true;
}
# check regex
if (!preg_match('/^[a-z0-9-]+$/', $page_slug)) {
$aErrors['not_a_valid_regex'] = true;
}
# check if availble
if (!$oPortfolio->checkSlugAvailable($page_slug)) {
$aErrors['slug_not_available'] = true;
}
if ($aErrors) {
return var_dump($aErrors);
} else {
return true;
}
}
开发者ID:RhenusoneRosalia,项目名称:portfolio,代码行数:53,代码来源:PortfolioController.php
示例10: can_view
private function can_view($array)
{
$auth =& singleton::get(__NAMESPACE__ . '\\auth');
$tickets =& singleton::get(__NAMESPACE__ . '\\tickets');
$user_level = (int) $auth->get('user_level');
switch ($user_level) {
case 6:
//admin
break;
case 5:
//moderator
$get_array['department_or_assigned_or_user_id'] = $auth->get('id');
break;
case 4:
//staff member
$get_array['department_or_assigned_or_user_id'] = $auth->get('id');
break;
case 3:
//user
$get_array['assigned_or_user_id'] = $auth->get('id');
break;
case 2:
//global moderator
break;
default:
//sub
$get_array['user_id'] = $auth->get('id');
break;
}
$get_array['count'] = true;
$get_array['id'] = (int) $array['id'];
$result = $tickets->get($get_array);
if (!empty($result) && $result[0]['count'] != 0) {
return true;
} else {
return false;
}
}
开发者ID:rnlduadia,项目名称:LAMP-eCommerce-CodeIgniter,代码行数:38,代码来源:tickets_support.class.php
示例11: display
function display()
{
$config =& singleton::get(__NAMESPACE__ . '\\config');
$language =& singleton::get(__NAMESPACE__ . '\\language');
header("Content-type: image/png");
if (isset($this->text) && !empty($this->text)) {
$capture_text = $this->text;
} else {
$capture_text = $language->get('Error');
}
$string = strtoupper($capture_text);
$r = rand(0, 150);
$g = rand(0, 150);
$b = rand(0, 150);
$im = imagecreatefrompng(THEMES . '/' . CURRENT_THEME . '/images/captcha_background.png');
$colour = imagecolorallocate($im, $r, $g, $b);
$size = rand(20, 25);
$angle = rand(0, 3);
$left = rand(5, 17);
$bottomleft = 38;
imagettftext($im, $size, $angle, $left, $bottomleft, $colour, SYSTEM . "/fonts/delicious.otf", $string);
imagepng($im);
imagedestroy($im);
}
开发者ID:rnlduadia,项目名称:LAMP-eCommerce-CodeIgniter,代码行数:24,代码来源:captcha.class.php
示例12: html_output
/**
* Returns an HTML string while stripping out bad HTML
*
* @param string $string The HTML to make safe
* @return string The safe HTML
*/
function html_output($string)
{
$purifier =& singleton::get('HTMLPurifier');
return $purifier->purify($string);
}
开发者ID:rnlduadia,项目名称:LAMP-eCommerce-CodeIgniter,代码行数:11,代码来源:html.php
示例13: get
function get($array = NULL)
{
global $db;
$tables =& singleton::get(__NAMESPACE__ . '\\tables');
$error =& singleton::get(__NAMESPACE__ . '\\error');
$site_id = SITE_ID;
$query = "SELECT mn.*, {$tables->users}.name, {$tables->users}.email FROM {$tables->message_notes} mn, {$tables->users} WHERE mn.site_id = :site_id";
if (isset($array['id'])) {
$query .= " AND mn.id = :id";
}
if (isset($array['user_id'])) {
$query .= " AND mn.user_id = :user_id";
}
if (isset($array['message_id'])) {
$query .= " AND mn.message_id = :message_id";
}
$query .= " AND {$tables->users}.id = mn.user_id";
$query .= " ORDER BY mn.id";
try {
$stmt = $db->prepare($query);
} catch (\PDOException $e) {
$error->create(array('type' => 'sql_prepare_error', 'message' => $e->getMessage()));
}
$stmt->bindParam(':site_id', $site_id, database::PARAM_INT);
if (isset($array['id'])) {
$stmt->bindParam(':id', $array['id'], database::PARAM_INT);
}
if (isset($array['user_id'])) {
$stmt->bindParam(':user_id', $array['user_id'], database::PARAM_INT);
}
if (isset($array['message_id'])) {
$stmt->bindParam(':message_id', $array['message_id'], database::PARAM_INT);
}
try {
$stmt->execute();
} catch (\PDOException $e) {
$error->create(array('type' => 'sql_execute_error', 'message' => $e->getMessage()));
}
$items = $stmt->fetchAll(database::FETCH_ASSOC);
return $items;
}
开发者ID:rnlduadia,项目名称:LAMP-eCommerce-CodeIgniter,代码行数:41,代码来源:message_notes.class.php
示例14: delete_group
function delete_group($array = NULL)
{
global $db;
if (!isset($array['id'])) {
return false;
}
$error =& singleton::get(__NAMESPACE__ . '\\error');
$log =& singleton::get(__NAMESPACE__ . '\\log');
$tables =& singleton::get(__NAMESPACE__ . '\\tables');
$auth =& singleton::get(__NAMESPACE__ . '\\auth');
$config =& singleton::get(__NAMESPACE__ . '\\config');
$site_id = SITE_ID;
$query = "DELETE FROM {$tables->ticket_field_values} WHERE site_id = :site_id";
if (isset($array['id'])) {
$query .= " AND ticket_field_group_id = :id";
}
try {
$stmt = $db->prepare($query);
} catch (\Exception $e) {
$error->create(array('type' => 'sql_prepare_error', 'message' => $e->getMessage()));
}
$stmt->bindParam(':site_id', $site_id, database::PARAM_INT);
if (isset($array['id'])) {
$stmt->bindParam(':id', $array['id'], database::PARAM_INT);
}
try {
$stmt->execute();
} catch (\Exception $e) {
$error->create(array('type' => 'sql_execute_error', 'message' => $e->getMessage()));
}
$query = "DELETE FROM {$tables->ticket_fields} WHERE site_id = :site_id";
if (isset($array['id'])) {
$query .= " AND ticket_field_group_id = :id";
}
try {
$stmt = $db->prepare($query);
} catch (\Exception $e) {
$error->create(array('type' => 'sql_prepare_error', 'message' => $e->getMessage()));
}
$stmt->bindParam(':site_id', $site_id, database::PARAM_INT);
if (isset($array['id'])) {
$stmt->bindParam(':id', $array['id'], database::PARAM_INT);
}
try {
$stmt->execute();
} catch (\Exception $e) {
$error->create(array('type' => 'sql_execute_error', 'message' => $e->getMessage()));
}
$query = "DELETE FROM {$tables->ticket_field_group} WHERE site_id = :site_id";
if (isset($array['id'])) {
$query .= " AND id = :id";
}
try {
$stmt = $db->prepare($query);
} catch (\Exception $e) {
$error->create(array('type' => 'sql_prepare_error', 'message' => $e->getMessage()));
}
$stmt->bindParam(':site_id', $site_id, database::PARAM_INT);
if (isset($array['id'])) {
$stmt->bindParam(':id', $array['id'], database::PARAM_INT);
}
try {
$stmt->execute();
} catch (\Exception $e) {
$error->create(array('type' => 'sql_execute_error', 'message' => $e->getMessage()));
}
}
开发者ID:rnlduadia,项目名称:LAMP-eCommerce-CodeIgniter,代码行数:67,代码来源:ticket_custom_fields.class.php
示例15: logout
/**
* Logs out the current user.
*/
public function logout()
{
$plugins =& singleton::get(__NAMESPACE__ . '\\plugins');
$plugins->run('auth_logout_start');
unset($this->current_user);
session_destroy();
}
开发者ID:rnlduadia,项目名称:LAMP-eCommerce-CodeIgniter,代码行数:10,代码来源:auth.class.php
示例16: disable
function disable($plugin_name)
{
$config =& singleton::get(__NAMESPACE__ . '\\config');
$log =& singleton::get(__NAMESPACE__ . '\\log');
if (in_array($plugin_name, $this->installed_plugins)) {
$key = array_search($plugin_name, $this->installed_plugins);
unset($this->installed_plugins[$key]);
$this->installed_plugins = array_values($this->installed_plugins);
$log_array['event_severity'] = 'notice';
$log_array['event_number'] = E_USER_NOTICE;
$log_array['event_description'] = 'Plugin Disabled "' . $plugin_name . '"';
$log_array['event_file'] = __FILE__;
$log_array['event_file_line'] = __LINE__;
$log_array['event_type'] = 'disable';
$log_array['event_source'] = 'plugins';
$log_array['event_version'] = '1';
$log_array['log_backtrace'] = false;
$log->add($log_array);
$config->set('plugin_data', $this->installed_plugins);
}
}
开发者ID:rnlduadia,项目名称:LAMP-eCommerce-CodeIgniter,代码行数:21,代码来源:plugins.class.php
示例17: __construct
Sedan2::what_vehicle();
class singleton
{
public static $instance;
private function __construct()
{
echo 'Contruct of singleton class called' . "\n";
}
public static function get_instance()
{
if (!static::$instance instanceof static) {
static::$instance = new static();
}
return static::$instance;
}
public function test()
{
echo 'test function called' . "\n";
}
}
class B extends singleton
{
public static $instance;
protected function __construct()
{
echo 'Construct of Class B called' . "\n";
}
}
singleton::get_instance()->test();
B::get_instance()->test();
B::get_instance()->test();
开发者ID:jabouzi,项目名称:designpatterns,代码行数:31,代码来源:lateStaticBinding2.php
示例18: delete
function delete($array = NULL)
{
global $db;
$tables =& singleton::get(__NAMESPACE__ . '\\tables');
$error =& singleton::get(__NAMESPACE__ . '\\error');
$log =& singleton::get(__NAMESPACE__ . '\\log');
$site_id = SITE_ID;
//delete user permissions
if (isset($array['id'])) {
$query = "DELETE FROM {$tables->users_to_departments} WHERE site_id = :site_id AND department_id = :department_id";
try {
$stmt = $db->prepare($query);
} catch (\PDOException $e) {
$error->create(array('type' => 'sql_prepare_error', 'message' => $e->getMessage()));
}
$stmt->bindParam(':site_id', $site_id, database::PARAM_INT);
$stmt->bindParam(':department_id', $array['id'], database::PARAM_INT);
try {
$stmt->execute();
} catch (\PDOException $e) {
$error->create(array('type' => 'sql_execute_error', 'message' => $e->getMessage()));
}
}
//delete ticket departments
$query = "DELETE FROM {$tables->ticket_departments} WHERE site_id = :site_id";
if (isset($array['id'])) {
$query .= " AND id = :id";
}
if (isset($array['enabled'])) {
$query .= " AND enabled = :enabled";
}
try {
$stmt = $db->prepare($query);
} catch (\PDOException $e) {
$error->create(array('type' => 'sql_prepare_error', 'message' => $e->getMessage()));
}
$stmt->bindParam(':site_id', $site_id, database::PARAM_INT);
if (isset($array['id'])) {
$stmt->bindParam(':id', $array['id'], database::PARAM_INT);
}
if (isset($array['enabled'])) {
$stmt->bindParam(':enabled', $array['enabled'], database::PARAM_INT);
}
try {
$stmt->execute();
} catch (\PDOException $e) {
$error->create(array('type' => 'sql_execute_error', 'message' => $e->getMessage()));
}
$log_array['event_severity'] = 'notice';
$log_array['event_number'] = E_USER_NOTICE;
$log_array['event_description'] = 'Ticket Department Deleted ID ' . safe_output($array['id']);
$log_array['event_file'] = __FILE__;
$log_array['event_file_line'] = __LINE__;
$log_array['event_type'] = 'delete';
$log_array['event_source'] = 'ticket_departments';
$log_array['event_version'] = '1';
$log_array['log_backtrace'] = false;
$log->add($log_array);
}
开发者ID:rnlduadia,项目名称:LAMP-eCommerce-CodeIgniter,代码行数:59,代码来源:ticket_departments.class.php
示例19: send_email
public function send_email($array)
{
$config =& singleton::get(__NAMESPACE__ . '\\config');
$log =& singleton::get(__NAMESPACE__ . '\\log');
$pop_accounts =& singleton::get(__NAMESPACE__ . '\\pop_accounts');
$smtp_accounts =& singleton::get(__NAMESPACE__ . '\\smtp_accounts');
try {
//clear any current info
$this->phpmailer->ClearAllRecipients();
$this->phpmailer->ClearAttachments();
$this->phpmailer->From = 'do_not_reply@' . $config->get('domain');
$found_smtp_account = false;
if (isset($array['pop_account_id']) && !empty($array['pop_account_id'])) {
$pop_array = $pop_accounts->get(array('id' => $array['pop_account_id'], 'get_other_data' => true));
if (!empty($pop_array) && !empty($pop_array[0]['smtp_hostname']) && $pop_array[0]['smtp_enabled'] == 1) {
$smtp['hostname'] = $pop_array[0]['smtp_hostname'];
$smtp['port'] = $pop_array[0]['smtp_port'];
$smtp['tls'] = $pop_array[0]['smtp_tls'];
$smtp['username'] = $pop_array[0]['smtp_username'];
$smtp['password'] = decode($pop_array[0]['smtp_password']);
$smtp['authentication'] = $pop_array[0]['smtp_authentication'];
$smtp['email_address'] = $pop_array[0]['smtp_email_address'];
$found_smtp_account = true;
}
} else {
if (isset($array['smtp_account_id']) && !empty($array['smtp_account_id'])) {
$smtp_array = $smtp_accounts->get(array('id' => $array['smtp_account_id']));
if (!empty($smtp_array) && !empty($smtp_array[0]['hostname']) && $smtp_array[0]['enabled'] == 1) {
$smtp['hostname'] = $smtp_array[0]['hostname'];
$smtp['port'] = $smtp_array[0]['port'];
$smtp['tls'] = $smtp_array[0]['tls'];
$smtp['username'] = $smtp_array[0]['username'];
$smtp['password'] = decode($smtp_array[0]['password']);
$smtp['authentication'] = $smtp_array[0]['authentication'];
$smtp['email_address'] = $smtp_array[0]['email_address'];
$found_smtp_account = true;
}
}
}
if (!$found_smtp_account) {
$smtp_array = $smtp_accounts->get(array('id' => $config->get('default_smtp_account')));
if (!empty($smtp_array) && !empty($smtp_array[0]['hostname']) && $smtp_array[0]['enabled'] == 1) {
$smtp['hostname'] = $smtp_array[0]['hostname'];
$smtp['port'] = $smtp_array[0]['port'];
$smtp['tls'] = $smtp_array[0]['tls'];
$smtp['username'] = $smtp_array[0]['username'];
$smtp['password'] = decode($smtp_array[0]['password']);
$smtp['authentication'] = $smtp_array[0]['authentication'];
$smtp['email_address'] = $smtp_array[0]['email_address'];
$found_smtp_account = true;
}
}
if ($found_smtp_account) {
//what server to send the email to
$this->phpmailer->Host = $smtp['hostname'];
$this->phpmailer->Mailer = 'smtp';
//setup authentication if required
if ($smtp['authentication']) {
$this->phpmailer->SMTPAuth = true;
// turn on SMTP authentication
$this->phpmailer->Username = $smtp['username'];
$this->phpmailer->Password = $smtp['password'];
}
if ($smtp['tls']) {
$this->phpmailer->SMTPSecure = 'tls';
}
$this->phpmailer->Port = (int) $smtp['port'];
//setup the basic email stuff
if (isset($array['from'])) {
$this->phpmailer->From = $array['from'];
} else {
if (!empty($smtp['email_address'])) {
$this->phpmailer->From = $smtp['email_address'];
}
}
} else {
$this->phpmailer->Mailer = 'mail';
if (isset($array['from'])) {
$this->phpmailer->From = $array['from'];
}
}
//increase the default timeout to 15 seconds
$this->phpmailer->Timeout = 15;
$this->phpmailer->CharSet = 'utf-8';
if (isset($array['html']) && $array['html'] == true) {
$this->phpmailer->IsHTML(true);
}
if (isset($array['from_name'])) {
$this->phpmailer->FromName = $array['from_name'];
} else {
$this->phpmailer->FromName = $config->get('name');
}
$this->phpmailer->Subject = $array['subject'];
$this->phpmailer->Body = $array['body'];
if (isset($array['to']) && is_array($array['to'])) {
if (!empty($array['to']['to'])) {
$this->phpmailer->AddAddress($array['to']['to'], $array['to']['to_name']);
}
}
//add multiple files
//.........这里部分代码省略.........
开发者ID:rnlduadia,项目名称:LAMP-eCommerce-CodeIgniter,代码行数:101,代码来源:mailer.class.php
示例20: array
//message_notes
$ticket_custom_fields =& singleton::get(__NAMESPACE__ . '\\ticket_custom_fields');
//pushover
$pushover =& singleton::get(__NAMESPACE__ . '\\pushover');
//users_to_departments
$users_to_departments =& singleton::get(__NAMESPACE__ . '\\users_to_departments');
//db_maintenance
$db_maintenance =& singleton::get(__NAMESPACE__ . '\\db_maintenance');
require FUNCTIONS . '/default_tasks.php';
/**
*
* URL Handling Code. Everything is redirected with the .htaccess file to index.php?url=
*
*/
if (isset($_GET['url'])) {
$input_url = $_GET['url'];
} else {
$input_url = '';
}
$url =& singleton::get(__NAMESPACE__ . '\\url', array('url' => $input_url));
unset($input_url);
$auth->load();
//html purifier
include LIB . '/htmlpurifier/HTMLPurifier.auto.php';
$htmlpurifier_config = \HTMLPurifier_Config::createDefault();
//default html is set to XHTML 1.1
//$htmlpurifier_config->set('Core.Encoding', 'XHTML 1.1');
//create the class we are going to use.
$purifier =& singleton::get('HTMLPurifier', $htmlpurifier_config);
$plugins->load();
$plugins->run('loader');
开发者ID:rnlduadia,项目名称:LAMP-eCommerce-CodeIgniter,代码行数:31,代码来源:loader.php
注:本文中的singleton类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论