当前位置: 首页>>代码示例>>PHP>>正文


PHP Newsletter::getInstance方法代码示例

本文整理汇总了PHP中Newsletter::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Newsletter::getInstance方法的具体用法?PHP Newsletter::getInstance怎么用?PHP Newsletter::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Newsletter的用法示例。


在下文中一共展示了Newsletter::getInstance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 protected final function __construct()
 {
     //If there is a login attempt
     if (isset($_POST['username']) && isset($_POST['password']) && !empty($_POST['username']) && !empty($_POST['password'])) {
         //Did they check the remember me box
         $remember = isset($_POST['remember']) && !empty($_POST['remember']) ? true : false;
         $this->authenticate($_POST['username'], $_POST['password'], $remember);
     } else {
         //If there is a cookie for the username and they are not logged in
         if (isset($_COOKIE['username']) && !empty($_COOKIE['username']) && !$this->is()) {
             //If we haven't pushed the user to the login
             if (!$GLOBALS['session']->get('login_push')) {
                 $GLOBALS['session']->set('login_push', true);
                 //Try to have them login
                 if (!isset($_GET['_a']) || $_GET['_a'] != 'login') {
                     httpredir('index.php?_a=login');
                 }
             }
         }
         $this->_load();
         //IS_USER defines if a the user is a valid user on the template
         $GLOBALS['smarty']->assign('IS_USER', $this->is());
         if ($this->is() && isset($_POST['mailing_list'])) {
             Newsletter::getInstance()->subscribe($this->get('email'), $this->getId());
         }
         $this->isBot();
     }
 }
开发者ID:Dirty-Butter,项目名称:v6,代码行数:28,代码来源:user.class.php

示例2: str_replace

            } else {
                $file_data .= str_replace($find, $replace, $GLOBALS['RAW']['POST']['maillist_format']) . "\n";
            }
            /* End Fixing Bug 2884 */
            unset($customer, $replace, $member, $long_name, $short_name);
        }
        $GLOBALS['debug']->supress(true);
        deliverFile(false, false, $file_data, $lang['email']['export_filename'] . '.' . $_POST['maillist_extension']);
        exit;
    } else {
        $GLOBALS['main']->setACPWarning($lang['email']['error_news_export_empty']);
    }
}
$GLOBALS['gui']->addBreadcrumb($lang['email']['title_newsletters'], currentPage(array('action', 'newsletter_id')));
$seo = SEO::getInstance();
$newsletter = Newsletter::getInstance();
if (isset($_POST['newsletter']) && !empty($_POST['newsletter'])) {
    $redirect = false;
    $proceed = true;
    if (empty($_POST['newsletter']['subject'])) {
        $proceed = false;
        $GLOBALS['main']->setACPWarning($lang['email']['error_no_subject']);
    }
    if (empty($_POST['newsletter']['content_html']) && empty($_POST['newsletter']['content_text'])) {
        $proceed = false;
        $GLOBALS['main']->setACPWarning($lang['email']['error_no_message']);
    }
    if ($proceed) {
        $_POST['newsletter']['content_html'] = $GLOBALS['RAW']['POST']['newsletter']['content_html'];
        if ($newsletter->saveNewsletter($_POST['newsletter'])) {
            $redirect = true;
开发者ID:kblok,项目名称:v6,代码行数:31,代码来源:customers.email.inc.php

示例3: search

 /**
  * Admin search function
  *
  * @param string $type
  * @param string $search_string
  * @return data/false
  */
 public static function search($type, $search_string)
 {
     $data = false;
     if (!empty($type) && !empty($search_string)) {
         switch (strtolower($type)) {
             case 'user':
                 if (($results = $GLOBALS['db']->select('CubeCart_customer', false, array('~' . $search_string => array('last_name', 'first_name', 'email')), false, false, false, false)) !== false) {
                     foreach ($results as $result) {
                         $data[] = array('value' => $result['customer_id'], 'display' => $result['first_name'] . ' ' . $result['last_name'], 'info' => $result['email'], 'data' => $result);
                     }
                 }
                 break;
             case 'address':
                 if (($results = $GLOBALS['db']->select('CubeCart_addressbook', false, array('customer_id' => (int) $search_string), false, false, false, false)) !== false) {
                     foreach ($results as $result) {
                         $result['state'] = getStateFormat($result['state']);
                         $result['country'] = getCountryFormat($result['country']);
                         $data[] = $result;
                     }
                 }
                 break;
             case 'product':
                 // Limited to a maximum of 15 results, in order to prevent it going mental
                 if (($results = $GLOBALS['db']->select('CubeCart_inventory', false, array('~' . $search_string => array('name', 'product_code')), false, 15, false, false)) !== false) {
                     foreach ($results as $result) {
                         $lower_price = Tax::getInstance()->salePrice($result['price'], $result['sale_price'], false);
                         if ($lower_price && $lower_price < $result['price']) {
                             $result['price'] = $lower_price;
                         }
                         $data[] = array('value' => $result['product_id'], 'display' => $result['name'], 'info' => Tax::getInstance()->priceFormat($result['price']), 'data' => $result);
                     }
                 }
                 break;
             case 'newsletter':
                 $newsletter = Newsletter::getInstance();
                 $status = $newsletter->sendNewsletter($_GET['q'], $_GET['page']);
                 if (is_array($status)) {
                     $data = $status;
                 } else {
                     $data = $status ? array('complete' => 'true', 'percent' => 100) : array('error' => 'true');
                 }
                 break;
             case 'files':
                 if ($_GET['dir'] == '/') {
                     $dir = false;
                 } elseif ($_GET['dir'] == '/') {
                     $dir = false;
                 } else {
                     $dir = $_GET['dir'];
                 }
                 $filemanager = new FileManager($_GET['group'], $dir);
                 // Directories
                 if (($dirs = $filemanager->findDirectories()) !== false) {
                     foreach ($dirs[$filemanager->formatPath($dir)] as $parent => $folder) {
                         $path = !empty($dir) ? '/' : '';
                         $json[] = array('type' => 'directory', 'path' => urldecode($dir . basename($folder) . '/'), 'name' => basename($folder));
                     }
                 }
                 if (($files = $filemanager->listFiles()) !== false) {
                     $catalogue = new Catalogue();
                     foreach ($files as $result) {
                         if ($filemanager->getMode() == FileManager::FM_FILETYPE_IMG) {
                             $fetch = $catalogue->imagePath($result['file_id'], 'medium');
                             $path = $name = $fetch;
                         } else {
                             $path = $result['filepath'];
                             $name = $result['filename'];
                         }
                         $json[] = array('type' => 'file', 'path' => dirname($path) . '/', 'file' => basename($result['filename']), 'name' => basename($name), 'id' => $result['file_id'], 'description' => $result['description'], 'mime' => $result['mimetype']);
                     }
                 }
                 $data = isset($json) && is_array($json) ? $json : false;
                 break;
             default:
                 return false;
                 break;
         }
         if (!$data) {
             $data = array();
         }
         return json_encode($data);
     }
     return false;
 }
开发者ID:kblok,项目名称:v6,代码行数:91,代码来源:ajax.class.php

示例4: _displayMailingList

 /**
  * Display mailing list box
  */
 private function _displayMailingList()
 {
     if (!$GLOBALS['smarty']->templateExists('templates/box.newsletter.php')) {
         return false;
     }
     if ($GLOBALS['user']->is()) {
         $GLOBALS['smarty']->assign('CTRL_SUBSCRIBED', (bool) $GLOBALS['db']->select('CubeCart_newsletter_subscriber', false, array('email' => $GLOBALS['user']->get('email')), false, 1));
     }
     if (isset($_POST['subscribe'])) {
         $newsletter = Newsletter::getInstance();
         if ($newsletter->subscribe($_POST['subscribe'])) {
             $GLOBALS['gui']->setNotify($GLOBALS['language']->newsletter['notify_subscribed']);
             httpredir(currentPage(null, array('subscribed' => 'true')));
         } else {
             $GLOBALS['gui']->setNotify($GLOBALS['language']->newsletter['notify_unsubscribed']);
             httpredir(currentPage(null, array('_a' => 'newsletter', 'subscribed' => 'false')));
         }
     }
     foreach ($GLOBALS['hooks']->load('class.gui.display_mailing_list') as $hook) {
         include $hook;
     }
     $content = $GLOBALS['smarty']->fetch('templates/box.newsletter.php');
     $GLOBALS['smarty']->assign('MAIL_LIST', $content);
 }
开发者ID:briansandall,项目名称:v6,代码行数:27,代码来源:gui.class.php

示例5: _newsletter

 /**
  * Newsletter
  */
 private function _newsletter()
 {
     // Newsletters
     $GLOBALS['gui']->addBreadcrumb($GLOBALS['language']->account['your_account'], 'index.php?_a=account');
     $GLOBALS['gui']->addBreadcrumb($GLOBALS['language']->newsletter['newsletters'], '?_a=newsletter');
     $newsletter = Newsletter::getInstance();
     // Display Newsletter archive
     if (isset($_GET['newsletter_id']) && is_numeric($_GET['newsletter_id'])) {
         // Show a newsletter from the archive
         if (($content = $GLOBALS['db']->select('CubeCart_newsletter', false, array('newsletter_id' => (int) $_GET['newsletter_id'], 'status' => 1))) !== false) {
             $GLOBALS['gui']->addBreadcrumb($content[0]['subject'], '?_a=newsletter&newsletter_id=' . (int) $_GET['newsletter_id']);
             $GLOBALS['smarty']->assign('NEWSLETTER', $content[0]);
             $GLOBALS['smarty']->assign('CTRL_VIEW', true);
         } else {
             httpredir(currentPage(array('newsletter_id')));
         }
     } else {
         if (isset($_POST['subscribe'])) {
             if ($newsletter->subscribe($_POST['subscribe'])) {
                 $GLOBALS['gui']->setNotify($GLOBALS['language']->newsletter['notify_subscribed']);
             } else {
                 if ($GLOBALS['user']->is()) {
                     $GLOBALS['gui']->setError($GLOBALS['language']->common['error_email_invalid']);
                 } else {
                     if ($newsletter->unsubscribe($_POST['subscribe'])) {
                         $GLOBALS['gui']->setNotify($GLOBALS['language']->newsletter['notify_unsubscribed']);
                     } else {
                         $GLOBALS['gui']->setError($GLOBALS['language']->common['error_email_invalid']);
                     }
                 }
             }
             httpredir(currentPage());
         }
         if (isset($_GET['unsubscribe']) && filter_var($_GET['unsubscribe'], FILTER_VALIDATE_EMAIL)) {
             if ($newsletter->unsubscribe($_GET['unsubscribe'])) {
                 $GLOBALS['gui']->setNotify($GLOBALS['language']->newsletter['notify_unsubscribed']);
                 httpredir(currentPage(array('unsubscribe')));
             }
         }
         if (isset($_GET['verify'])) {
             if ($newsletter->verify($_GET['verify'])) {
                 $GLOBALS['gui']->setNotify($GLOBALS['language']->newsletter['notify_email_verified']);
             } else {
                 $GLOBALS['gui']->setError($GLOBALS['language']->common['error_email_verified']);
             }
             httpredir(currentPage(array('verify')));
         }
         if ($GLOBALS['user']->is()) {
             if (isset($_GET['action'])) {
                 switch (strtolower($_GET['action'])) {
                     case 'subscribe':
                         $GLOBALS['db']->insert('CubeCart_newsletter_subscriber', array('customer_id' => $GLOBALS['user']->get('customer_id'), 'email' => $GLOBALS['user']->get('email'), 'status' => '1'));
                         $GLOBALS['gui']->setNotify($GLOBALS['language']->newsletter['notify_subscribed']);
                         break;
                     case 'unsubscribe':
                         $GLOBALS['db']->delete('CubeCart_newsletter_subscriber', array('customer_id' => $GLOBALS['user']->get('customer_id')));
                         $GLOBALS['db']->delete('CubeCart_newsletter_subscriber', array('email' => $GLOBALS['user']->get('email')));
                         $GLOBALS['gui']->setNotify($GLOBALS['language']->newsletter['notify_unsubscribed']);
                         break;
                 }
                 httpredir(currentPage(array('action')));
             }
             $GLOBALS['smarty']->assign('URL', array('subscribe' => $GLOBALS['storeURL'] . '/index.php?_a=newsletter&action=subscribe', 'unsubscribe' => $GLOBALS['storeURL'] . '/index.php?_a=newsletter&action=unsubscribe'));
             $GLOBALS['smarty']->assign('SUBSCRIBED', (bool) $GLOBALS['db']->select('CubeCart_newsletter_subscriber', false, array('email' => $GLOBALS['user']->get('email')), false, false, false, false));
         }
         // Show list of publicly visible newsletters
         if (($archive = $GLOBALS['db']->select('CubeCart_newsletter', false, array('status' => 1))) !== false) {
             foreach ($archive as $content) {
                 $content['view'] = currentPage(array('subscribed'), array('newsletter_id' => $content['newsletter_id']));
                 $content['date_sent'] = formatTime(strtotime($content['date_sent']));
                 $vars['newsletters'][] = $content;
             }
             $GLOBALS['smarty']->assign('NEWSLETTERS', $vars['newsletters']);
         }
     }
     $content = $GLOBALS['smarty']->fetch('templates/content.newsletter.php');
     $GLOBALS['smarty']->assign('SECTION_NAME', 'account');
     $GLOBALS['smarty']->assign('PAGE_CONTENT', $content);
 }
开发者ID:digitaldevelopers,项目名称:v6,代码行数:82,代码来源:cubecart.class.php


注:本文中的Newsletter::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。