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


PHP Channel::setDescription方法代码示例

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


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

示例1: createFromResponse

 public static function createFromResponse(\SimpleXMLElement $response)
 {
     $channel = new Channel();
     $channel->setTitle((string) $response->title);
     $channel->setLink((string) $response->link);
     $channel->setDescription((string) $response->description);
     $items = array();
     foreach ($response->item as $responseItem) {
         $items[] = array('title' => (string) $responseItem->title, 'guid' => (string) $responseItem->guid, 'itunes_author' => (string) $responseItem->itunes->author, 'enclosure_url' => (string) $responseItem->enclosure->attributes()->url, 'description' => (string) $responseItem->description, 'link' => (string) $responseItem->link);
     }
     $channel->setItems($items);
     return $channel;
 }
开发者ID:kyaroslav,项目名称:BinaryThinkingLastfmBundle,代码行数:13,代码来源:Channel.php

示例2: update_channel

function update_channel()
{
	global $user;
	global $CONF;

	$_SESSION['channel_last_flood_time']=time();

	$user = $_SESSION['user'];	

	$channel = new Channel();
	if (isset($_GET['channelid_update_channel'])){
		$channel->setId($_GET['channelid_update_channel']);
		$channel->load();
		if ( ($user->getId()!=$channel->getUser()->getId()) || ($user->isAnon()) )
			return array('ok'=>false, 'error'=>'you are not the owner');
	} else {
		return array('ok'=>false, 'error'=>'no id');
	}

	$description = unescape_ampersand($_POST['description']);
	$description = strip_tags($description, $CONF['permitted_tags_msg']);
	$description = text_linkify($description);
	$description = str_replace(' ',' ',$description);
	$channel->setDescription($description);

	//system("echo \"$description\" > log.txt");

	if (isset($_POST['lang']) && !empty($_POST['lang']))
		$channel->setLang($_POST['lang']);

	if (isset($_POST['asktofollow'])) $channel->setAsktofollow($_POST['asktofollow']);
	if (isset($_POST['perm_member'])) $channel->setPermMember($_POST['perm_member']);
	if (isset($_POST['perm_reguser'])) $channel->setPermReguser($_POST['perm_reguser']);
	if (isset($_POST['perm_anon'])) $channel->setPermAnon($_POST['perm_anon']);

	if ($channel->save()=='ok'){
		return array('ok'=>true, 'error'=>'');
	}
	else
		return array('ok'=>false, 'error'=>'problems with this channel');
}
开发者ID:rczeus,项目名称:Rapid-Coffee,代码行数:41,代码来源:update_channel.php

示例3: add_channel

function add_channel()
{
	global $CONF;
	global $LANGALL;
	$user = $_SESSION['user'];

	if ($user->getBanned()>0){
		return array('ok'=>false, 'error'=>'banned '.$user->getBanned());
	}

	if (isset($_SESSION['channel_last_flood_time'])){

		if ((time() - $_SESSION['channel_last_flood_time']) < $CONF['channel_time_to_wait_flood']){
			$time_to_wait = $CONF['channel_time_to_wait_flood'] - (time() - $_SESSION['channel_last_flood_time']);
			//return array('ok'=>false, 'error'=>'flood '.$time_to_wait);
		}

	}

	$_SESSION['channel_last_flood_time']=time();

	$user = $_SESSION['user'];	
	if ($user->isAnon())
		return array('ok'=>false, 'error'=>'anonymous cannot create channel');

	$channel = new Channel();
	$channel->setUser($user);

	$name = strip_tags($_POST['name']);
	if (strlen(str_replace(' ', '', $name)) < $CONF['channel_min_name'])
		return array('ok'=>false, 'error'=>'too short name');
	$channel->setName($name);

	$description = $_POST['description'];
	$description = strip_tags($description, $CONF['permitted_tags_msg']);
	$description = text_linkify($description);
	$description = str_replace('&nbsp;',' ',$description);
	$channel->setDescription($description);

	if (isset($_POST['lang']) && !empty($_POST['lang']))
		$channel->setLang($_POST['lang']);

	if (!isset($_POST['urlname']))
		$channel->setUrlname( Channel::prettyUrlAvailable($_POST['name']) );
	else {
		if ($_POST['urlname']!=Channel::prettyUrlAvailable($_POST['urlname']))
			return array('ok'=>false, 'error'=>'invalid urlname');
		else
			$channel->setUrlname($_POST['urlname']);
	}

	if (isset($_POST['asktofollow'])) $channel->setAsktofollow($_POST['asktofollow']);
	if (isset($_POST['perm_member'])) $channel->setPermMember($_POST['perm_member']);
	if (isset($_POST['perm_reguser'])) $channel->setPermReguser($_POST['perm_reguser']);
	if (isset($_POST['perm_anon'])) $channel->setPermAnon($_POST['perm_anon']);

	$result=$channel->save();
	if ($result=='ok'){
		$channel->follow();

		/*if ($channel->getLang()=='pt_br'){
			$title=$LANGALL['pt_br']['addchannel_welcome_title'];
			$message=$LANGALL['pt_br']['addchannel_welcome_message'];
		} else {
			$title=$LANGALL['en_us']['addchannel_welcome_title'];
			$message=$LANGALL['en_us']['addchannel_welcome_message'];
		}
		require_once('class/Topic.php');
		require_once('class/User.php');
		$user=new RegUser();
		$user->setId(1);
		$topic=new Topic();
		$topic->setSubject($title);
		$topic->setMsg($message);
		$topic->setChannel($channel);
		$topic->setUser($user);
		$topic->save();*/
		
		return array('ok'=>true, 'error'=>'', 'id'=>$channel->getId());
	}
	elseif ($result=='error channel already exists'){
		return array('ok'=>false, 'error'=>'error channel already exists','id'=>null);
	} elseif ($result=='error you created many channels'){
		return array('ok'=>false, 'error'=>'error you created many channels','id'=>null);
	} elseif ($result=='error user anon'){
		return array('ok'=>false, 'error'=>'error user anon','id'=>null);
	} else
		return array('ok'=>false, 'error'=>'problems with this channel - '.$result,'id'=>null);
}
开发者ID:rczeus,项目名称:Rapid-Coffee,代码行数:89,代码来源:add_channel.php

示例4: AMPatternValidator

 $form->addValidator(new AMPatternValidator('inputId', true, '/^[a-z0-9][a-z0-9-]+$/', 'Channel Id may only container letters, numbers, or hyphens.  It cannot begin with a hyphen'));
 $form->addValidator(new AMPatternValidator('inputCertificate', true, $pattern_certificate, 'Invalid certificate'));
 $form->addValidator(new ApplicationIdValidator('inputApplicationId', true, 'Invalid application id'));
 if ($form->isValid) {
     // make sure we are authorized to create the channel for this application
     $mongodb = Renegade::database(RenegadeConstants::kDatabaseMongoDB, RenegadeConstants::kDatabaseApplications);
     $redis = Renegade::database(RenegadeConstants::kDatabaseRedis, RenegadeConstants::kDatabaseCertificates);
     $certificate = json_decode($redis->get($form->inputCertificate), true);
     $data = $mongodb->findOne(array('_id' => $form->inputApplicationId));
     if ($data['owner'] == $session->user && $certificate['owner'] == $session->user) {
         // create the channel
         $channel = new Channel($form->inputId);
         $channel->setCertificate($form->inputCertificate);
         $channel->setApplication($form->inputApplicationId);
         $channel->setLabel($form->inputLabel);
         $channel->setDescription($form->inputDescription);
         $channel->setDefaultPermissions((int) $form->inputRead | (int) $form->inputWrite | (int) $form->inputDelete);
         // channel owner gets all permissions by default
         $certificate = $channel->generate_certificate(RenegadeConstants::kPermissionRead | RenegadeConstants::kPermissionWrite | RenegadeConstants::kPermissionDelete);
         $metadata = $channel->generate_metadata();
         $subscription = new Subscription();
         $subscription->setCertificate($certificate['key']);
         $subscription->setApplication($metadata['application']);
         $subscription->setChannel($metadata['_id']);
         $subscription->setMaster(true);
         // place us in the application db context
         $options = array('default' => Renegade::databaseForId($form->inputApplicationId));
         $channels = Renegade::database(RenegadeConstants::kDatabaseMongoDB, RenegadeConstants::kDatabaseChannels, $options);
         $subscriptions = Renegade::database(RenegadeConstants::kDatabaseMongoDB, RenegadeConstants::kDatabaseSubscriptions, $options);
         $redis->set($certificate['key'], $certificate['value']);
         $channels->insert($metadata);
开发者ID:aventurella,项目名称:Galaxy,代码行数:31,代码来源:channelCreate.php

示例5: Channel

 // is subscribing to a subscription channel in another application even possible?
 // I dont think so, since you would need the channel id anyway, which would point you to
 // the origin application.
 /*
 	TODO 
 	We need to add a subscription to the remote subscriptions db for the remote collection
 	We need to add the certificate for this channel
 	We need to add the channel to the local application's channels
 	Send an e-mail requesting extended permissions here if requested
 */
 // we are giving the fully qualified channel id here
 // so we will not need to set the application, it will be done for us
 $channel = new Channel($remote_channel['_id']);
 $channel->setCertificate($application['certificate']);
 $channel->setLabel($remote_channel['label']);
 $channel->setDescription($remote_channel['description']);
 $channel->setDefaultPermissions($remote_channel['defaultPermissions']);
 $certificate = $channel->generate_certificate($remote_channel['defaultPermissions']);
 $metadata = $channel->generate_metadata();
 $metadata['requests'] = $remote_channel['requests'];
 $subscription = new Subscription();
 $subscription->setCertificate($certificate['key']);
 $subscription->setApplication($form->inputApplicationId);
 $subscription->setChannel($metadata['_id']);
 $subscription->setMaster(false);
 $db_remote_options = array('default' => Renegade::databaseForId($remote_application));
 $db_remote_subscriptions = Renegade::database(RenegadeConstants::kDatabaseMongoDB, RenegadeConstants::kDatabaseSubscriptions, $db_remote_options);
 $certificates = Renegade::database(RenegadeConstants::kDatabaseRedis, RenegadeConstants::kDatabaseCertificates);
 $db_remote_subscriptions->insert($subscription->toArray());
 $db_channels->insert($metadata);
 $certificates->set($certificate['key'], $certificate['value']);
开发者ID:aventurella,项目名称:Galaxy,代码行数:31,代码来源:channelSubscribe.php


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