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


PHP SiteStatsUpdate::addLinksEmailed方法代码示例

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


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

示例1: execute


//.........这里部分代码省略.........
             }
         }
         if ($titleObj->getNamespace() != NS_MAIN && $titleObj->getNamespace() != NS_ARTICLE_REQUEST && $titleObj->getNamespace() != NS_PROJECT) {
             $wgOut->errorPage('emaillink', 'emaillink_invalidpage');
             return;
         }
         // for the body of the email
         $titleText = $titleObj->getText();
         if ($titleText != wfMsg('mainpage')) {
             $summary = Article::getSection($articleObj->getContent(true), 0);
             // trip out all MW and HTML tags
             $summary = ereg_replace("<.*>", "", $summary);
             $summary = ereg_replace("\\[\\[.*\\]\\]", "", $summary);
             $summary = ereg_replace("\\{\\{.*\\}\\}", "", $summary);
         }
         $url = $titleObj->getFullURL();
         $from_name = "";
         $validEmail = "";
         if ($wgUser->getID() > 0) {
             $from_name = $wgUser->getName();
             $real_name = $wgUser->getRealName();
             if ($real_name != "") {
                 $from_name = $real_name;
             }
             $email = $wgUser->getEmail();
             if ($email != "") {
                 $validEmail = $email;
                 $from_name .= "<{$email}>";
             } else {
                 $from_name .= "<do_not_reply@wikihow.com>";
             }
         } else {
             $email = $wgRequest->getVal("email");
             $name = $wgRequest->getVal("name");
             if ($email == "") {
                 $email = "do_not_reply@wikihow.com";
             } else {
                 $validEmail = $email;
             }
             $from_name = "{$name} <{$email}>";
         }
         if (strpos($email, "\n") !== false || strpos($recipient1, "\n") !== false || strpos($recipient2, "\n") !== false || strpos($recipient3, "\n") !== false || strpos($title, "\n") !== false) {
             echo "reciep\n";
             exit;
             $this->reject();
             return;
         }
         $r_array = array();
         $num_recipients = 0;
         if ($recipient1 != "") {
             $num_recipients++;
             $x = split(";", $recipient1);
             $r_array[] = $x[0];
         }
         if ($recipient2 != "") {
             $num_recipients++;
             $x = split(";", $recipient2);
             $r_array[] = $x[0];
         }
         if ($recipient3 != "") {
             $num_recipients++;
             $x = split(";", $recipient3);
             $r_array[] = $x[0];
         }
         if ($titleObj->getNamespace() == NS_PROJECT) {
             $r_array[] = 'elizabethwikihowtest@gmail.com';
         }
         if ($validEmail != "" && !in_array($validEmail, $r_array)) {
             $num_recipients++;
             $r_array[] = $validEmail;
         }
         if ($titleObj->getNamespace() == NS_ARTICLE_REQUEST) {
             $body = "{$message}\n\n----------------\n\n\t" . wfMsg('article-request-email', $how_to, "http://www.wikihow.com/index.php?title2={$dbkey}&action=easy&requested={$dbkey}", "http://www.wikihow.com/Request:{$dbkey}", "http://www.wikihow.com/" . wfMsg('writers-guide-url'), "http://www.wikihow.com/" . wfMsg('about-wikihow-url') . "");
         } else {
             if ($titleObj->getText() == wfMsg('mainpage')) {
                 $body = "{$message}\n\n----------------\n\n\t" . wfMsg('friend-sends-article-email-main-page') . "\n\n\t";
             } else {
                 if ($titleObj->getNamespace() == NS_PROJECT) {
                     $body = "{$message}";
                 } else {
                     $body = "{$message}\n\n----------------\n\n" . wfMsg('friend-sends-article-email', $how_to, $summary, $url) . "\n\n\t";
                 }
             }
         }
         $from = new MailAddress($email);
         foreach ($r_array as $address) {
             $address = preg_replace("@,.*@", "", $address);
             $to = new MailAddress($address);
             $sbody = $body;
             if ($address == $validEmail) {
                 $sbody = wfMsg('copy-email-from-yourself') . "\n\n" . $sbody;
             }
             if (!userMailer($to, $from, $subject, $sbody, false)) {
                 //echo "got an en error\n";
             }
         }
         SiteStatsUpdate::addLinksEmailed($num_recipients);
         $this->thanks();
     }
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:101,代码来源:EmailLink.body.php


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