本文整理汇总了PHP中Newsletter::getNewsletter方法的典型用法代码示例。如果您正苦于以下问题:PHP Newsletter::getNewsletter方法的具体用法?PHP Newsletter::getNewsletter怎么用?PHP Newsletter::getNewsletter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Newsletter
的用法示例。
在下文中一共展示了Newsletter::getNewsletter方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createNewsletter
public static function createNewsletter($newsletterInfo = array())
{
global $wpdb;
if (0 == count($newsletterInfo)) {
$newsletterInfo = array('name' => md5(microtime() . "newsletter_name"), 'fromname' => md5(microtime() . "fromname"), 'fromemail' => md5(microtime() . 'somename') . '@' . md5(microtime() . "somedomain") . ".com", 'reply_to' => substr(self::randomString("reply"), 0, 5) . '@' . substr(self::randomString("domain"), 0, 5) . ".com");
}
$createNewsletterQuery = sprintf("INSERT INTO %swpr_newsletters (`name`, `fromname`, `fromemail`, `reply_to`) VALUES ('%s', '%s', '%s', '%s')", $wpdb->prefix, $newsletterInfo['name'], $newsletterInfo['fromname'], $newsletterInfo['fromemail'], $newsletterInfo['reply_to']);
$wpdb->query($createNewsletterQuery);
$newsletterId = $wpdb->insert_id;
return Newsletter::getNewsletter($newsletterId);
}
示例2: wpr_replace_tags
function wpr_replace_tags($sid, &$subject, &$body, $additional = array())
{
global $wpdb;
$query = "SELECT * FROM " . $wpdb->prefix . "wpr_subscribers WHERE id='{$sid}'";
$subscriber = $wpdb->get_results($query);
$subscriber = $subscriber[0];
$nid = $subscriber->nid;
$newsletter = Newsletter::getNewsletter($nid);
$parameters = array();
//newsletter name
$newsletterName = $newsletter->getNewsletterName();
$parameters['newslettername'] = $newsletterName;
$query = "SELECT * FROM " . $wpdb->prefix . "wpr_custom_fields where nid='{$nid}'";
$custom_fields = $wpdb->get_results($query);
//blog name
$parameters['sitename'] = get_bloginfo("name");
//blog url
$parameters['homeurl'] = get_bloginfo("url");
//subscriber name
$parameters['name'] = $subscriber->name;
//the address of the sender (as required by can spam)
$parameters['address'] = get_option("wpr_admin_address");
//the email address
$parameters['email'] = $subscriber->email;
//admin email
$parameters['adminemail'] = get_option('admin_email');
$query = "select * from " . $wpdb->prefix . "wpr_subscribers_{$nid} where id={$id};";
$subscriber = $wpdb->get_results($query);
$subscriber = $subscriber[0];
//custom fields defined by the administrator
foreach ($custom_fields as $custom_field) {
$name = $custom_field->name;
$parameters[$custom_field->name] = $subscriber->{$name};
}
$parameters = array_merge($parameters, $additional);
foreach ($parameters as $name => $value) {
$subject = str_replace("[!{$name}!]", $value, $subject);
$body = str_replace("[!{$name}!]", $value, $body);
}
}
示例3: getAllNewsletters
public static function getAllNewsletters()
{
global $wpdb;
$getAllNewslettersQuery = sprintf("SELECT * FROM {$wpdb->prefix}wpr_newsletters");
$newsletters = $wpdb->get_results($getAllNewslettersQuery);
$result = array();
foreach ($newsletters as $newsletter) {
$result[] = Newsletter::getNewsletter($newsletter->id);
}
return $result;
}
示例4: getNewsletter
public function getNewsletter()
{
$newsletterId = $this->getNewsletterId();
return Newsletter::getNewsletter($newsletterId);
}
示例5: _wpr_newsletter_delete
function _wpr_newsletter_delete()
{
global $wpdb;
$prefix = $wpdb->prefix;
$nid = $_GET['nid'];
try {
$newsletter = Newsletter::getNewsletter($nid);
} catch (Exception $excp) {
_wpr_set("_wpr_view", "newsletter_delete_not_found");
return;
}
if (isset($_GET['confirmed']) && $_GET['confirmed'] == 'true') {
$newsletter->delete();
$newsletter_home = "admin.php?page=_wpr/newsletter";
wp_redirect($newsletter_home);
}
$getEmailsPendingDeliveryQuery = sprintf("SELECT COUNT(*) number FROM %swpr_queue WHERE sid=(SELECT id FROM %swpr_subscribers WHERE nid=%d) AND sent=0;", $prefix, $prefix, $nid);
$emails_pending_count_result = $wpdb->get_results($getEmailsPendingDeliveryQuery);
$number_pending = $emails_pending_count_result[0]->number;
_wpr_set("newsletter_name", $newsletter->getName());
_wpr_set("subscriber_count", $newsletter->getNumberOfActiveSubscribers());
_wpr_set("_wpr_view", "newsletter_delete");
_wpr_set("nid", $nid);
_wpr_set("emailsPendingDelivery", $number_pending);
}
示例6: getNewsletter
function getNewsletter()
{
$newsletter = Newsletter::getNewsletter($this->getNewsletterId());
return $newsletter;
}
示例7: testGetNewsletterFactoryFetchesExistentNewsletters
public function testGetNewsletterFactoryFetchesExistentNewsletters()
{
global $wpdb;
$addNewsletterQuery = sprintf("INSERT INTO %swpr_newsletters (`name`) VALUES ('%s')", $wpdb->prefix, 'Test Newsletter');
$wpdb->query($addNewsletterQuery);
$newsletter = Newsletter::getNewsletter(intval($wpdb->insert_id));
$this->assertEquals($wpdb->insert_id, $newsletter->getId());
}