本文整理汇总了PHP中Topic::getSubject方法的典型用法代码示例。如果您正苦于以下问题:PHP Topic::getSubject方法的具体用法?PHP Topic::getSubject怎么用?PHP Topic::getSubject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Topic
的用法示例。
在下文中一共展示了Topic::getSubject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Topic
//require_once("class/Addthis.php");
global $CONF;
$user=$_SESSION['user'];
if (isset($_GET['topicid']))
{
$topic = new Topic();
$topic->setId($_GET['topicid']);
$channel = $topic->getChannel();
$channel->load();
$OG['topic_title'] = $topic->getSubject();
$OG['topic_msg'] = $topic->getSubsumedMsg();
if ($channel->getId()>0)
{
$OG['request'] = 'openchannel';
$OG['channel_name'] = $channel->getName();
$OG['channel_desc'] = $channel->getDescription();
$OG['channel_logo'] = $CONF['url_path'] . $channel->getLogoFile('big');
}
if (isset($_GET['sms_ss'])){
$db = clone $GLOBALS['maindb'];
$_anon=($user->isAnon())?'true':'false';
$_channelid=($channel->getId()>0)?$channel->getId():0;
示例2: getUsername
$this->username = $username;
}
public function getUsername()
{
return $this->username;
}
}
class Topic
{
private $member;
private $subject;
public function __construct($member, $subject)
{
$this->member = $member;
$this->subject = $subject;
}
public function getSubject()
{
return $this->subject;
}
public function __call($method, $arguments)
{
return $this->member->{$method}($arguments);
}
}
$aMember = new Member("fred");
$aTopic = new Topic($aMember, "Hello everybody!");
echo $aTopic->getSubject() . "<br>";
// отобразит "Hello everybody!"
echo $aTopic->getUsername() . "<br>";
// отобразит "fred"
示例3: add_topic
function add_topic()
{
global $CONF;
$user = $_SESSION['user'];
if ($user->getBanned()>0){
return array('ok'=>false, 'error'=>'banned '.$user->getBanned());
}
if (isset($_SESSION['topic_last_flood_time'])){
if ((time() - $_SESSION['topic_last_flood_time']) < $CONF['topic_time_to_wait_flood']){
$time_to_wait = $CONF['topic_time_to_wait_flood'] - (time() - $_SESSION['topic_last_flood_time']);
return array('ok'=>false, 'error'=>'flood '.$time_to_wait);
}
}
$user = $_SESSION['user'];
$topic = new Topic();
if (isset($_GET['channelid_add_topic'])){
$channel = new Channel();
$channel->setId($_GET['channelid_add_topic']);
if (!$channel->canITopic())
return array('ok'=>false, 'error'=>'you cant create topic in this channel');
$topic->setChannel($channel);
}
$topic->setUser($user);
$subject = strip_tags($_POST['subject']);
if (strlen(str_replace(' ', '', $subject)) < $CONF['min_msg_chars'])
return array('ok'=>false, 'error'=>'too short subject');
$topic->setSubject($subject);
$msg = $_POST['msg'];
if (strlen(str_replace(' ', '', strip_tags($msg))) < $CONF['min_msg_chars'])
return array('ok'=>false, 'error'=>'too short message');
$msg = strip_tags($msg, $CONF['permitted_tags_msg']);
//$msg = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a target=\"_BLANK\" href=\"\\0\">\\0</a>", $msg); //detectando URLs
$msg = text_linkify($msg);
$msg = str_replace(' ',' ',$msg);
$topic->setMsg($msg);
if ($topic->save()=='ok'){
$_SESSION['topic_last_flood_time']=time();
$topic->follow();
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=UTF-8\r\n";
$headers .= "From: {$CONF['email_from']}\r\n";
$headers .= "To: YOU <you>\r\n";
$_pretty=Topic::prettyUrl($topic->getSubject());
$body='Acesse: <a href="http://rapidcoffee.com//'.$topic->getId().'/'.$_pretty.'">http://rapidcoffee.com//'.$topic->getId().'/'.$_pretty.'</a>';
//system("echo \"".$body."\" > email.html");
//mail('lucasvendramin85@gmail.com, danilo.horta@gmail.com', "Rapidcoffee-NOVO TOPICO", $body, $headers);
return array('ok'=>true, 'error'=>'');
}
else
return array('ok'=>false, 'error'=>'Problems with this topic.');
}