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


PHP Newsletter::whetherNoNewslettersExist方法代码示例

本文整理汇总了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);
}
开发者ID:anirut,项目名称:wp-autoresponder,代码行数:58,代码来源:newmail.php

示例2: whetherCurrentPathRequiresAtleastOneNewsletterToExistToBeAccessible

 public static function whetherCurrentPathRequiresAtleastOneNewsletterToExistToBeAccessible($wpr_routes, $path)
 {
     return isset($wpr_routes[$path]['require_newsletters']) && $wpr_routes[$path]['require_newsletters'] == true && Newsletter::whetherNoNewslettersExist();
 }
开发者ID:anirut,项目名称:wp-autoresponder,代码行数:4,代码来源:routing.php

示例3: testWhetherNoNewslettersExistChecker

 public function testWhetherNoNewslettersExistChecker()
 {
     $result = Newsletter::whetherNoNewslettersExist();
     $this->assertEquals(true, $result);
 }
开发者ID:anirut,项目名称:wp-autoresponder,代码行数:5,代码来源:NewslettersModelTest.php


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