本文整理汇总了PHP中Newsletter::whetherNewsletterIDExists方法的典型用法代码示例。如果您正苦于以下问题:PHP Newsletter::whetherNewsletterIDExists方法的具体用法?PHP Newsletter::whetherNewsletterIDExists怎么用?PHP Newsletter::whetherNewsletterIDExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Newsletter
的用法示例。
在下文中一共展示了Newsletter::whetherNewsletterIDExists方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testWhetherNewsletterExists
public function testWhetherNewsletterExists()
{
global $wpdb;
$whetherNewsletterExists = Newsletter::whetherNewsletterIDExists(9801);
$this->assertFalse($whetherNewsletterExists);
$newsletter = array("name" => md5(microtime()), "reply_to" => 'flarecore@' . md5(microtime()) . '.com', "fromname" => 'Test', "fromemail" => 'flare@' . md5(microtime()) . '.com');
$addNewsletterQuery = sprintf("INSERT INTO %swpr_newsletters (`name`, `reply_to`, `fromname`, `fromemail`) VALUES ('%s','%s', '%s', '%s')", $wpdb->prefix, $newsletter['name'], $newsletter['reply_to'], $newsletter['fromname'], $newsletter['fromemail']);
$wpdb->query($addNewsletterQuery);
$newsletter_id = $wpdb->insert_id;
$this->assertTrue(Newsletter::whetherNewsletterIDExists($newsletter_id));
}
示例2: validateAddFormPostData
public static function validateAddFormPostData($post_data, &$errors)
{
$name = $post_data['name'];
if (!Autoresponder::whetherValidAutoresponderName(array('name' => $name))) {
$errors[] = __("The name for the autoresponder you've entered is invalid");
}
if (!Newsletter::whetherNewsletterIDExists($post_data['nid'])) {
$errors[] = __("The newsletter you've selected doesn't exist");
return $errors;
}
}
示例3: addAutoresponder
public static function addAutoresponder($nid, $name)
{
global $wpdb;
if (!Newsletter::whetherNewsletterIDExists($nid)) {
throw new NonExistentNewsletterAutoresponderAdditionException();
}
if (!Autoresponder::whetherValidAutoresponderName(array("nid" => $nid, "name" => $name))) {
throw new InvalidArgumentException("Invalid autoresponder arguments");
}
$createAutoresponderQuery = sprintf("INSERT INTO `{$wpdb->prefix}wpr_autoresponders` (`nid`, `name`) VALUES (%d, '%s');", $nid, $name);
$wpdb->query($createAutoresponderQuery);
$autoresponder_id = $wpdb->insert_id;
return new Autoresponder($autoresponder_id);
}
示例4: getSubscribersOfNewsletter
public static function getSubscribersOfNewsletter($nid)
{
if (false == Newsletter::whetherNewsletterIDExists($nid)) {
throw new NewsletterNotFoundException();
}
throw new BadMethodCallException("Subscribers of newsletter get yet to be implemented ");
}