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


PHP Subscription::delete方法代码示例

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


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

示例1: destroy

 function destroy($args, $apidata)
 {
     parent::handle($args);
     if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
         $this->clientError(_('This method requires a POST or DELETE.'), 400, $apidata['content-type']);
         return;
     }
     $id = $apidata['api_arg'];
     # We can't subscribe to a remote person, but we can unsub
     $other = $this->get_profile($id);
     $user = $apidata['user'];
     $sub = new Subscription();
     $sub->subscriber = $user->id;
     $sub->subscribed = $other->id;
     if ($sub->find(true)) {
         $sub->query('BEGIN');
         $sub->delete();
         $sub->query('COMMIT');
     } else {
         $this->clientError(_('You are not friends with the specified user.'), 403, $apidata['content-type']);
         return;
     }
     $type = $apidata['content-type'];
     $this->init_document($type);
     $this->show_profile($other, $type);
     $this->end_document($type);
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:27,代码来源:twitapifriendships.php

示例2: deleteSubscription

 /**
  * Delete a subscription
  *
  * Deletes the subscription from $subscriber_uri to $subscribed_user_uri.
  * Throws exceptions in case of error.
  *
  * @param string $subscriber_uri      The OMB identifier URI specifying the
  *                                    subscribing profile
  *
  * @param string $subscribed_user_uri The OMB identifier URI specifying the
  *                                    subscribed profile
  *
  * @access public
  **/
 public function deleteSubscription($subscriber_uri, $subscribed_user_uri)
 {
     $sub = new Subscription();
     $subscribed = $this->_getAnyProfile($subscribed_user_uri);
     $subscriber = $this->_getAnyProfile($subscriber_uri);
     $sub->subscribed = $subscribed->id;
     $sub->subscriber = $subscriber->id;
     $sub->delete();
 }
开发者ID:harriewang,项目名称:InnertieWebsite,代码行数:23,代码来源:oauthstore.php

示例3: delete

 public function delete()
 {
     $subids = $this->getAllSubscriptions();
     foreach ($subids as $id) {
         $subscription = new Subscription();
         $subscription->load($id);
         $subscription->delete();
     }
     $this->meta->delete();
 }
开发者ID:Ibrahim1,项目名称:aec,代码行数:10,代码来源:acctexp.user.class.php

示例4: Subscription

 function _deleteSubscriptions()
 {
     $sub = new Subscription();
     $sub->subscriber = $this->id;
     $sub->find();
     while ($sub->fetch()) {
         $other = Profile::staticGet('id', $sub->subscribed);
         if (empty($other)) {
             continue;
         }
         if ($other->id == $this->id) {
             continue;
         }
         Subscription::cancel($this, $other);
     }
     $subd = new Subscription();
     $subd->subscribed = $this->id;
     $subd->find();
     while ($subd->fetch()) {
         $other = Profile::staticGet('id', $subd->subscriber);
         if (empty($other)) {
             continue;
         }
         if ($other->id == $this->id) {
             continue;
         }
         Subscription::cancel($other, $this);
     }
     $self = new Subscription();
     $self->subscriber = $this->id;
     $self->subscribed = $this->id;
     $self->delete();
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:33,代码来源:Profile.php

示例5: Subscription

 function _deleteSubscriptions()
 {
     $sub = new Subscription();
     $sub->subscriber = $this->getID();
     $sub->find();
     while ($sub->fetch()) {
         try {
             $other = $sub->getSubscribed();
             if (!$other->sameAs($this)) {
                 Subscription::cancel($this, $other);
             }
         } catch (NoResultException $e) {
             // Profile not found
             common_log(LOG_INFO, 'Subscribed profile id==' . $sub->subscribed . ' not found when deleting profile id==' . $this->getID() . ', ignoring...');
         } catch (ServerException $e) {
             // Subscription cancel failed
             common_log(LOG_INFO, 'Subscribed profile id==' . $other->getID() . ' could not be reached for unsubscription notice when deleting profile id==' . $this->getID() . ', ignoring...');
         }
     }
     $sub = new Subscription();
     $sub->subscribed = $this->getID();
     $sub->find();
     while ($sub->fetch()) {
         try {
             $other = $sub->getSubscriber();
             common_log(LOG_INFO, 'Subscriber profile id==' . $sub->subscribed . ' not found when deleting profile id==' . $this->getID() . ', ignoring...');
             if (!$other->sameAs($this)) {
                 Subscription::cancel($other, $this);
             }
         } catch (NoResultException $e) {
             // Profile not found
             common_log(LOG_INFO, 'Subscribed profile id==' . $sub->subscribed . ' not found when deleting profile id==' . $this->getID() . ', ignoring...');
         } catch (ServerException $e) {
             // Subscription cancel failed
             common_log(LOG_INFO, 'Subscriber profile id==' . $other->getID() . ' could not be reached for unsubscription notice when deleting profile id==' . $this->getID() . ', ignoring...');
         }
     }
     // Finally delete self-subscription
     $self = new Subscription();
     $self->subscriber = $this->getID();
     $self->subscribed = $this->getID();
     $self->delete();
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:43,代码来源:Profile.php

示例6: array

$action = fRequest::getValid('action', array('list', 'add', 'edit', 'delete'));
$sort = fCRUD::getSortColumn(array('name', 'status', 'method', 'state'));
$sort_order = fCRUD::getSortDirection('asc');
$subscription_id = fRequest::get('subscription_id', 'integer');
$check_id = fRequest::get('check_id', 'integer');
$manage_url = $_SERVER['SCRIPT_NAME'];
// --------------------------------- //
if ('delete' == $action) {
    $class_name = 'Subscription';
    try {
        $obj = new Subscription($subscription_id);
        $check = new Check($obj->getCheckId());
        $delete_text = 'Are you sure you want to delete your subscription to <strong>' . $check->getName() . '</strong>?';
        if (fRequest::isPost()) {
            fRequest::validateCSRFToken(fRequest::get('token'));
            $obj->delete();
            fMessaging::create('success', $manage_url, 'The subscription for ' . $check->getName() . ' was successfully deleted');
            fURL::redirect($manage_url);
        }
    } catch (fNotFoundException $e) {
        fMessaging::create('error', $manage_url, 'The subscription requested, ' . fHTML::encode($date) . ', could not be found');
        fURL::redirect($manage_url);
    } catch (fExpectedException $e) {
        fMessaging::create('error', fURL::get(), $e->getMessage());
    }
    include VIEW_PATH . '/delete.php';
    // --------------------------------- //
} elseif ('edit' == $action) {
    try {
        $subscription = new Subscription($subscription_id);
        $check = new Check($subscription->getCheckId());
开发者ID:nagyist,项目名称:Tattle,代码行数:31,代码来源:subscription.php

示例7: Check

);

$sort = fCRUD::getSortColumn(array('name','status','method','state'));
$sort_order  = fCRUD::getSortDirection('asc');

$subscription_id = fRequest::get('subscription_id', 'integer');
$check_id = fRequest::get('check_id', 'integer');
$manage_url = $_SERVER['SCRIPT_NAME'];
// --------------------------------- //
if ('delete' == $action) {
  try {
    $check = new Check($check_id);
    $subscription = new Subscription($subscription_id);
    if (fRequest::isPost()) {
      fRequest::validateCSRFToken(fRequest::get('token'));
      $subscription->delete();
      fMessaging::create('success', $manage_url, 
                         'The subscription for ' . $check->getName() . ' was successfully deleted');
      fURL::redirect($manage_url);	
    }
  } catch (fNotFoundException $e) {
    fMessaging::create('error', $manage_url, 
                       'The subscription requested, ' . fHTML::encode($date) . ', could not be found');
    fURL::redirect($manage_url);
  } catch (fExpectedException $e) {
    fMessaging::create('error', fURL::get(), $e->getMessage());	
  }

  include VIEW_PATH . '/delete_subscription.php';	
	
// --------------------------------- // 
开发者ID:rberger,项目名称:Graphite-Tattle,代码行数:31,代码来源:subscription.php

示例8: User

}

if (!$g_user->hasPermission('ManageSubscriptions')) {
	camp_html_display_error(getGS("You do not have the right to delete subscriptions."));
	exit;
}

$f_user_id = Input::Get('f_user_id', 'int', 0);
$f_subscription_id = Input::Get('f_subscription_id', 'int', 0);
$f_publication_id = Input::Get('f_publication_id');

$manageUser = new User($f_user_id);
$subscription = new Subscription($f_subscription_id);
$publication = new Publication($subscription->getPublicationId());

if ($subscription->delete()) {
        $logtext = getGS('Subscription #$1 deleted for user #$2 (Publication: $3)', $f_subscription_id, $f_user_id, $f_publication_id);
        Log::Message($logtext, null, 182);
	$uriPath = strtok($_SERVER['HTTP_REFERER'], "?");
	$inSubscriptions = (strstr($uriPath, '/subscriptions') != '')
						|| !$g_user->hasPermission('ManageUsers');
	if ($inSubscriptions) {
		$location = "/$ADMIN/users/subscriptions/?f_user_id=$f_user_id";
	} else {
		$location = "/$ADMIN/users/edit.php?User=$f_user_id&uType=Subscribers";
	}
	camp_html_goto_page($location);
}

$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
开发者ID:nistormihai,项目名称:Newscoop,代码行数:31,代码来源:do_del.php


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