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


PHP Channel类代码示例

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


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

示例1: addChannel

 /**
  * Add a channel to the bouquet.
  * @param Channel $pChannel
  */
 public function addChannel(Channel $pChannel)
 {
     if ($pChannel->getID() != 'none') {
         $this->lChannels[] = $pChannel;
         $this->lChannelCount++;
     }
 }
开发者ID:theyosh,项目名称:DreamboxReStream,代码行数:11,代码来源:Bouquet.class.php

示例2: send

 /**
  * Send an message on a channel for an event
  *
  * @param $channel
  * @param $event
  * @param $data
  * @throws SockinException
  * @return string
  */
 public function send($channel, $event, $data)
 {
     $this->route = "send";
     $codedChannel = $this->channel->verify($channel, $this->appId);
     $jsonData = $this->getJson($data);
     $hashedData = $this->hashData($jsonData, $codedChannel, $event);
     return $this->dispatchMessage($jsonData, $codedChannel, $event, $hashedData);
 }
开发者ID:divergentsoft,项目名称:sockin-php,代码行数:17,代码来源:Sockin.php

示例3: parseWrite

 private function parseWrite(Channel $channel, $message)
 {
     return [$channel, null, function () use($channel, $message) {
         return $channel->write($message);
     }, function ($current) use($channel) {
         $channel->cancelWrite($current);
     }];
 }
开发者ID:crystalplanet,项目名称:redshift,代码行数:8,代码来源:ChannelSelector.php

示例4: testPubsubhubbub

 public function testPubsubhubbub()
 {
     $channel = new Channel();
     $channel->pubsubhubbub('http://example.com/feed.xml', 'http://pubsubhubbub.appspot.com');
     $xml = $channel->asXML()->asXML();
     $this->assertContains('<atom:link rel="self" href="http://example.com/feed.xml" type="application/rss+xml"/>', $xml);
     $this->assertContains('<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/>', $xml);
 }
开发者ID:suin,项目名称:php-rss-writer,代码行数:8,代码来源:ChannelTest.php

示例5: start

 static function start()
 {
     # CREATE GENOSAGE
     $genosage = new Core();
     # CREATE CHANNEL
     $channel = new Channel();
     $channel->channel();
 }
开发者ID:noevil,项目名称:genosage,代码行数:8,代码来源:Core.core.php

示例6: addChannel

 public function addChannel(Channel $channel)
 {
     if (isset($this->channelNames[$channel->getName()])) {
         return;
     }
     $this->channelNames[$channel->getName()] = true;
     $this->collection->attach($channel);
 }
开发者ID:nesquick,项目名称:trafficcophp,代码行数:8,代码来源:ChannelCollection.php

示例7: add

 /**
  * @param Channel $channel
  */
 public function add(Channel $channel)
 {
     $name = $this->normalizeName($channel->getName());
     // prevent channel overwrites
     if ($this->exists($name)) {
         return;
     }
     $this->channels[$name] = $channel;
 }
开发者ID:helmutschneider,项目名称:websocket-chat,代码行数:12,代码来源:ChannelCollection.php

示例8: findChannelParameter

 private function findChannelParameter(Channel $channel, $key)
 {
     $parameters = $channel->getParameters();
     foreach ($parameters as $parameter) {
         if ($parameter->getKey() == $key) {
             return $parameter;
         }
     }
     return null;
 }
开发者ID:stdtabs,项目名称:phptabs,代码行数:10,代码来源:ChannelRouterConfigurator.php

示例9: getJsonTags

	function getJsonTags(){
		if ( (empty($this->idchannel) || $this->idchannel<=0) ) {
			if (isset($_GET['channel']) && !empty($_GET['channel'])) { 
				require_once("class/Channel.php");
				$tmp = new Channel(); $tmp->setUrlname($_GET['channel']);
				$this->idchannel=$tmp->getId();
				if (empty($this->idchannel)) $this->idchannel=-1;
			}
		}
		if ($this->listType=='cloneUFLast')
			$query = Topic::cloneUFLast($this->qtd, $this->lastorderid, $this->idchannel);
		elseif ($this->listType=='cloneFollowed')
			$query = Topic::cloneFollowed($this->qtd, $this->lastorderid, $this->idchannel);
		elseif ($this->listType=='cloneSearch')
			$query = Topic::cloneSearch($this->search, $this->qtd, $this->orderid);
		elseif ($this->listType=='cloneUpdated')
			$query = Topic::cloneUpdated($this->ids, $this->counters, $this->qtd, $this->orderid, $this->idchannel);
		elseif ($this->listType=='cloneNew')
			$query = Topic::cloneNew($this->lastid, $this->qtd, $this->orderid, $this->idchannel);
		elseif ($this->listType=='cloneByUser')
			$query = Topic::cloneByUser($this->user, $this->qtd, $this->orderid, $this->sorting, $this->idchannel);
		elseif ($this->listType=='cloneByUserPost')
			$query = Topic::cloneByUserPost($this->user, $this->qtd, $this->orderid, $this->sorting, $this->idchannel);
		elseif ($this->listType=='cloneByDate')
			$query = Topic::cloneByDate($this->user, $this->year, $this->month, $this->day);
		elseif ($this->listType=='cloneChannelFollowed')
			$query = Topic::cloneChannelFollowed($this->qtd, $this->orderid, $this->lastorderid, $this->sorting);
		else
			$query = Topic::cloneLast($this->qtd, $this->orderid, $this->sorting, $this->idchannel);

		$result = array();

		if ($query!=null){
			global $CONF;
			if ($this->with_posts){
				require_once('template/TListPost.php');
				foreach ($query as $topic){
					$tlistpost = new TListPost(); $tlistpost->setTopic($topic);
					$ttopic = new TTopic(); $ttopic->setTopic($topic);
					array_push($result, array('topic'=>$ttopic->getJsonTags(), "posts"=>$tlistpost->getJsonTags()) );
				}
			} else {
				foreach ($query as $topic){
					$tmp=$topic->getJsonTags();
					if ($this->onlysubsumed)
						unset($tmp['msg']);
					array_push($result, $tmp);
				}
			}
		}

		return $result;
	}
开发者ID:rczeus,项目名称:Rapid-Coffee,代码行数:53,代码来源:TListTopic.php

示例10: push

 public function push($data)
 {
     require_once DIR_SYSTEM . '/baidu/Channel.class.php';
     // var_dump(BAE_API_KEY);
     $channel = new Channel(BAE_API_KEY, BAE_SECRET_KEY);
     if (array_key_exists('description', $data)) {
         if (mb_strlen($data['description'], 'utf-8') > 39) {
             $data['description'] = mb_substr($data['description'], 0, 37, 'utf-8') . '...';
         }
     }
     //推送类型,1单人(必须指定user_id和channel_id)、2群组(必须指定tag_name)、3所有人
     $push_type = $data['push_type'];
     $message["title"] = array_key_exists('title', $data) ? $data['title'] : '';
     //android必选
     $message["description"] = $data['description'];
     //android必选
     // $message["custom_content"] = array ("jump_id" => array_key_exists('jump_id', $data) ? $data['jump_id'] : '', "url" => array_key_exists('url', $data) ? $data['url'] : '');//android自定义字段
     $message["aps"] = array("alert" => $data['description'], "sound" => "", "badge" => 1);
     //ios特有字段
     if (array_key_exists('custom_content', $data)) {
         if ($data['device_type'] == 3) {
             //android
             $message["custom_content"] = $data['custom_content'];
         } elseif ($data['device_type'] == 4) {
             //ios
             foreach ($data['custom_content'] as $key => $value) {
                 $message[$key] = $value;
             }
         }
     }
     $message_key = "msg_key";
     //不支持ios
     //1:浏览器设备、2:pc设备、3:Android设备、4:ios设备、5:windows phone设备
     $optional[Channel::DEVICE_TYPE] = $data['device_type'];
     //Channel::USER_ID,标识用户的ID,分为百度账号与无账号体系:无账号体系的user_id根据端上属性生成;百度账号体系根据账号生成user_id。
     $optional[Channel::USER_ID] = array_key_exists('user_id', $data) ? $data['user_id'] : '';
     //Channel::MESSAGE_TYPE,消息类型,0:消息(透传),1:通知
     $optional[Channel::MESSAGE_TYPE] = array_key_exists('message_type', $data) ? $data['message_type'] : 1;
     //ios部署状态,1开发状态,默认是2生产状态
     $optional[Channel::DEPLOY_STATUS] = array_key_exists('deploy_status', $data) ? $data['deploy_status'] : '';
     $ret = $channel->pushMessage($push_type, $message, $message_key, $optional);
     if (false === $ret) {
         // $err = 'ERROR NUMBER: ' . $channel->errno() . '; ERROR MESSAGE: ' . $channel->errmsg() . '; REQUEST ID: ' .
         // 	 $channel->getRequestId() . ";";
         // Log::record($err);
         // var_dump( array ("ret" => SYS_RET_ERR, "err" => $err) );
     } else {
         // var_dump( array ("ret" => 0, "err" => "") );
     }
 }
开发者ID:TheTypoMaster,项目名称:ACGStorm,代码行数:50,代码来源:baepush.class.php

示例11: getChannelId

 private function getChannelId($name)
 {
     $name = trim($name);
     static $cache = array();
     if (!isset($cache[$name])) {
         $channel = Channel::model()->findByAttributes(array('name' => $name));
         if ($channel == null) {
             $channel = new Channel();
             $channel->name = $name;
             $channel->save();
         }
         $cache[$name] = $channel->id;
     }
     return $cache[$name];
 }
开发者ID:qyt1988528,项目名称:union,代码行数:15,代码来源:ImportCommand.php

示例12: create_account

function create_account()
{
	global $CONF;
	$user = new RegUser();

	if (!preg_match("/^[".$CONF['nickname_chars']."]+$/i", $_POST['nickname_create_account']))
		return array('ok'=>false, 'error'=>'invalid nickname');

	if (trim($_POST['password_create_account'])=='')
		return array('ok'=>false, 'error'=>'no password');

	$user->setEmail($_POST['email_create_account']);
	$user->setNickname($_POST['nickname_create_account']);
	$user->setPassword($_POST['password_create_account']);
	if (isset($_POST['signature_create_account']))
		$user->setSignature($_POST['signature_create_account']);

	if (isset($_POST['camefrom_create_account']))
		$user->setCameFrom($_POST['camefrom_create_account']);

	$r = $user->save();
	if ($r=='ok')
	{
		$channel=new Channel();
		$channel->setId(1);
		$channel->forceFollow($user);
		$r = $user->sendEmail();
		if (!$r)
			return array('ok'=>false, 'error'=>'we could not send the e-mail.');
		else{
			$GLOBALS['user'] = $user;
			$rc = new RegUser();
			$rc->setNickname("RapidCoffee");
			$rc->load();
			$topic = new Topic();
			$topic->setChannel($channel);
			$topic->setUser($rc);
			$topic->setSubject("Dêem boas vindas ao usuário " . $user->getNickname() . "!");
			$msg = "Seja bem-vindo(a), <b>" . $user->getNickname() . "</b>. Criamos este tópico para que você possa se apresentar e conhecer um pouco dos usuários do site. Boa estadia =)<br /><br />Equipe Rapid Coffee.";
			$msg = str_replace('&nbsp;',' ',$msg);
			$topic->setMsg($msg);
			$topic->save();
			$topic->follow();
			return array('ok'=>true, 'error'=>'');
		}
	}
	return array('ok'=>false, 'error'=>$r);
}
开发者ID:rczeus,项目名称:Rapid-Coffee,代码行数:48,代码来源:create_account.php

示例13: followchannel

function followchannel($channelid){

	if ($_SESSION['user']->isAnon())
		return array("ok"=>false, "error"=>"you have to login");

	global $LANGALL;
	global $CONF;

	$channel = new Channel();
	if (!isset($channelid))
		return array("ok"=>false, "error"=>"no id");
	$channel->setId($channelid);
	if ($channel->getAsktofollow()){
		if ($_SESSION['user']->isAnon())
			return array("ok"=>false, "error"=>"anon cant follow");

		require_once('class/Message.php');
		$message = new Message();
		$message->setUserFrom($_SESSION['user']);
		$message->setUserTo($channel->getUser());

		$__ufid = $channel->unconfirmed_follow();
		$check=hash('sha512',"00`Θ^*' ♣  hk".chr(11)."1".$__ufid);

		if ($channel->getUser()->getLang()=='pt_br'){
			$message->setSubject($LANGALL['pt_br']['channel_asktofollow_subject']);
			eval($LANGALL['pt_br']['channel_asktofollow_msg']);
			$msg = '#'.$channel->getName().'\n<br/>'.'@'.$_SESSION['user']->getNickname().'\n<br/>'.$body;
			if (isset($_GET['msg_followchannel']))
				$msg.=$_GET['msg_followchannel'];
			$message->setMsg($msg);
		} else {
			$message->setSubject($LANGALL['en_us']['channel_asktofollow_subject']);
			eval($LANGALL['pt_br']['channel_asktofollow_msg']);
			$msg = '#'.$channel->getName().'\n<br/>'.'@'.$_SESSION['user']->getNickname().'\n<br/>'.$body;
			if (isset($_GET['msg_followchannel']))
				$msg.=$_GET['msg_followchannel'];
			$message->setMsg($msg);
		}
		$result=$message->save();
		if ($result=='ok')
			return array("ok"=>false, "error"=>"asked for permission", "msg"=>"asked for permission");
		else
			return array("ok"=>false, "error"=>"error cant send message: ".$result, "msg"=>"");
		
	} else {
		if ($channel->follow())
			return array("ok"=>true, "error"=>"");
		else
			return array("ok"=>false, "error"=>"cant follow");
	}

}
开发者ID:rczeus,项目名称:Rapid-Coffee,代码行数:53,代码来源:followchannel.php

示例14: getWorkingChannelName

 /**
  * @return string
  */
 public function getWorkingChannelName()
 {
     if (!isset($this->workingChannelName)) {
         $this->workingChannelName = $this->channel->getName() . '_' . spl_object_hash($this) . '_' . uniqid();
     }
     return $this->workingChannelName;
 }
开发者ID:max-voloshin,项目名称:php-redis-mq,代码行数:10,代码来源:Consumer.php

示例15: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Channel::create([]);
     }
 }
开发者ID:jonagoldman,项目名称:channelmanager,代码行数:7,代码来源:ChannelsTableSeeder.php


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