本文整理汇总了PHP中Newsletter::whetherNoNewslettersExist方法的典型用法代码示例。如果您正苦于以下问题:PHP Newsletter::whetherNoNewslettersExist方法的具体用法?PHP Newsletter::whetherNoNewslettersExist怎么用?PHP Newsletter::whetherNoNewslettersExist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Newsletter
的用法示例。
在下文中一共展示了Newsletter::whetherNoNewslettersExist方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wpr_newmail
function wpr_newmail()
{
global $wpdb;
if (isset($_POST['subject'])) {
date_default_timezone_set("UTC");
$subject = $_POST['subject'];
$nid = $_POST['newsletter'];
$textbody = trim($_POST['body']);
$htmlbody = trim($_POST['htmlbody']);
$whentosend = $_POST['whentosend'];
$date = $_POST['date'];
$htmlenabled = $_POST['htmlenabled'] == "on";
$hour = $_POST['hour'];
$timezoneOffset = $_POST['timezoneoffset'];
$min = $_POST['minute'];
if ($whentosend == "now") {
$timeToSend = time();
} else {
if (empty($date)) {
$error = "The date field is required";
} else {
$sections = explode("/", $date);
$timeToSend = mktime($hour, $min, 0, $sections[0], $sections[1], $sections[2]);
$timeToSend = $timeToSend - $timezoneOffset;
}
}
if (!(trim($subject) && trim($textbody))) {
$error = "Subject and the Text Body are mandatory.";
}
if ($timeToSend < time() && !$error) {
$error = "The time mentioned is in the past. Please enter a time in the future.";
if ($htmlenabled && !$error) {
if (empty($htmlbody)) {
$error = "HTML Body is empty. Enter the HTML body of this email";
}
}
}
if (!$htmlenabled) {
$htmlbody = "";
}
if (!$error) {
$query = "insert into " . $wpdb->prefix . "wpr_newsletter_mailouts (nid,subject,textbody,htmlbody,time,status) values ('{$nid}','{$subject}','{$textbody}','{$htmlbody}','{$timeToSend}',0);";
$wpdb->query($query);
_wpr_mail_sending();
return;
}
}
$param = (object) array("nid" => $nid, "textbody" => $textbody, "subject" => $subject, "htmlbody" => $htmlbody, "htmlenabled" => 1, "whentosend" => $whentosend, "date" => $date, "hour" => $hour, "minute" => $min, "title" => "New Mail");
//There are no newsletters. Ask to create one before sending mailouts
if (Newsletter::whetherNoNewslettersExist()) {
?>
<h2>No Newsletters Found</h2>
You need to create a newsletter before you can send a broadcast.
<?php
return;
}
wpr_mail_form($param, "new", $error);
}
示例2: whetherCurrentPathRequiresAtleastOneNewsletterToExistToBeAccessible
public static function whetherCurrentPathRequiresAtleastOneNewsletterToExistToBeAccessible($wpr_routes, $path)
{
return isset($wpr_routes[$path]['require_newsletters']) && $wpr_routes[$path]['require_newsletters'] == true && Newsletter::whetherNoNewslettersExist();
}
示例3: testWhetherNoNewslettersExistChecker
public function testWhetherNoNewslettersExistChecker()
{
$result = Newsletter::whetherNoNewslettersExist();
$this->assertEquals(true, $result);
}