• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Subscription类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: prepareSubscription

 protected function prepareSubscription()
 {
     if (!isset($_POST['Subscription'])) {
         new \Error(4, 'Subscription');
     }
     $subs = json_decode($_POST['Subscription'], true);
     //var_dump($subs);
     if ($subs['DepartCity'] == NULL || $subs['ArriveCity'] == NULL || $subs['StartDate'] == NULL || $subs['EndDate'] == NULL) {
         new \Error(4, array('DepartCity', 'ArriveCity', 'StartDate', 'EndDate'));
     }
     $tiSubs = new \Subscription();
     $tiSubs->attributes = $subs;
     $subs_adp = $tiSubs->search();
     if ($subs_adp->itemCount) {
         $this->_subs = $subs_adp->getData()[0];
         $this->_subs->Count = $this->_subs->Count + 1;
     } else {
         /*
         			$lowestPrice = new \D_LowestPrice;
         			$tiSubs->CurrentPrice = (int)$lowestPrice->searchFlight($tiSubs);
         */
         $this->_subs = $tiSubs;
     }
     try {
         if (!$this->_subs->save()) {
             new \Error(5, null, json_encode($this->_subs->getErrors()));
         }
     } catch (Exception $e) {
         new \Error(5, NULL, $e->getMessage());
     }
 }
开发者ID:Yougmark,项目名称:TiCheck_Server,代码行数:31,代码来源:DefaultController.php


示例2: displaySubscriptions

 public function displaySubscriptions($tab, $user, $ui)
 {
     $db = JFactory::getDBO();
     include_once JPATH_SITE . '/components/com_acctexp/acctexp.class.php';
     $dateFormat = $this->params->get('dateFormat', "m/d/Y");
     $meta_user = new metaUser($user->id);
     $html_return = '' . '<table class="aeceventlog_table" style="border-collapse: collapse">' . '<tr class="aeceventlog_row_header">' . '<th width="30%" class="text-center">Plan</th>' . '<th width="10%" class="text-center">Primary</th>' . '<th width="10%" class="text-center">Status</th>' . '<th width="10%" class="text-center">Started</th>' . '<th width="20%" class="text-center">Ends</th>' . '</tr>';
     $subscriptions = $meta_user->getAllSubscriptions();
     $subscr_info = $this->getAllCurrentSubscriptionsInfoComplete($user->id);
     foreach ($subscriptions as $i => $subscriptionid) {
         $subscription = new Subscription();
         $subscription->load($subscriptionid);
         $plan_name = $subscr_info[$i]->name == '' ? "Excluded" : $subscr_info[$i]->name;
         $html_return .= '<tr>' . '<td width="30%" class="text-center">' . $plan_name . '</td>' . '<td width="10%" class="text-center">' . ($subscription->primary ? "Yes" : "No") . '</td>' . '<td width="10%" class="text-center">' . $this->getIconHtml($subscription->status) . ' ' . $subscription->status . '</td>' . '<td width="10%" class="text-center">' . date($dateFormat, strtotime($subscription->signup_date)) . '</td>';
         $html_return .= '<td width="10%" class="text-center">';
         if (!empty($subscription->lifetime)) {
             $html_return .= JText::_('AEC_ISLIFETIME');
         } else {
             if ($subscription->recurring && in_array($subscription->status, array('Active', 'Trial'))) {
                 $html_return .= JText::_('AEC_WILLRENEW') . ': ' . date($dateFormat, strtotime($subscription->expiration));
             } else {
                 $html_return .= date($dateFormat, strtotime($subscription->expiration));
             }
         }
         $html_return .= '</td></tr>';
     }
     $html_return .= '</table>';
     return $html_return;
 }
开发者ID:Ibrahim1,项目名称:aec,代码行数:29,代码来源:cbaecmembershiptab.php


示例3: run

 /**
  * Check stripe data.
  *
  * @access public
  * @return void
  */
 public function run()
 {
     $paymentGateway = Payment_gateways::findOneActiveBySlug('stripe');
     if ($paymentGateway->exists()) {
         \Stripe\Stripe::setApiKey($paymentGateway->getFieldValue('apiKey'));
         $subscriptions = new Subscription();
         $allSubscriptions = $subscriptions->where('status', Subscription::STATUS_ACTIVE)->get();
         /* @var Subscription $_subscription */
         foreach ($allSubscriptions as $_subscription) {
             $end = DateTime::createFromFormat('Y-m-d', $_subscription->end_date);
             if ($end->getTimestamp() > strtotime('now')) {
                 $paymentTransaction = $_subscription->payment_transaction->get();
                 if ($paymentTransaction->system == 'stripe') {
                     $user = new User($_subscription->user_id);
                     try {
                         $customer = \Stripe\Customer::retrieve($user->stripe_id);
                         $subscription = $customer->subscriptions->retrieve($paymentTransaction->payment_id);
                     } catch (Exception $e) {
                         log_message('CRON_ERROR', __FUNCTION__ . ' > ' . $e->getMessage());
                     }
                     if (!isset($subscription) || $subscription->status != 'active') {
                         $_subscription->deactivate();
                         $_subscription->save();
                     }
                 }
             }
         }
         log_message('CRON_SUCCESS', __FUNCTION__);
     }
 }
开发者ID:andrewkrug,项目名称:repucaution,代码行数:36,代码来源:check_subscriptions_cron.php


示例4: get_blocked_subs

/**
 * Fetch subscriptions that should be disallowed by a block
 */
function get_blocked_subs()
{
    $query = "SELECT subscription.* " . "FROM subscription " . "INNER JOIN profile_block " . "ON blocker=subscribed " . "AND blocked=subscriber";
    $subscription = new Subscription();
    $subscription->query($query);
    return $subscription;
}
开发者ID:microcosmx,项目名称:experiments,代码行数:10,代码来源:fixup_blocks.php


示例5: body

 protected function body()
 {
     if (!$this->userHasPrivileges(User::groupsJoinPrivate, User::groupsJoinPublic, User::groupsRequest)) {
         return false;
     }
     if (!$this->isInputValid(array('id' => 'isIndex'))) {
         return false;
     }
     $groupId = $this->getParams('id');
     /**
      * @var $group \Group
      */
     $group = Repositories::findEntity(Repositories::Group, $groupId);
     // Calculate privileges of the user
     $user = User::instance();
     $canJoinPrivate = User::instance()->hasPrivileges(User::groupsJoinPrivate);
     $groupIsPrivate = $group->getType() == \Group::TYPE_PRIVATE;
     $hasSufficientPrivileges = $groupIsPrivate && ($canJoinPrivate || $user->hasPrivileges(User::groupsRequest)) || !$groupIsPrivate && $user->hasPrivileges(User::groupsJoinPublic);
     if (!$hasSufficientPrivileges) {
         return $this->death(StringID::InsufficientPrivileges);
     }
     $status = $canJoinPrivate || !$groupIsPrivate ? \Subscription::STATUS_SUBSCRIBED : \Subscription::STATUS_REQUESTED;
     // Put into database
     $subscription = new \Subscription();
     $subscription->setGroup($group);
     $subscription->setUser(User::instance()->getEntity());
     $subscription->setStatus($status);
     Repositories::persistAndFlush($subscription);
     return true;
 }
开发者ID:pombredanne,项目名称:xmlcheck-public,代码行数:30,代码来源:AddSubscription.php


示例6: send

 /**
  * The function sends emails with new articles to subscribers.
  * 
  * @access public
  */
 public function send()
 {
     $Subscription = new Subscription();
     foreach ($Subscription->findList() as $Subscription) {
         $Sent = new Article_Sent();
         $Sent->MailerId = $this->Id;
         $Sent->Email = $Subscription->Email;
         $Email = new Email_Article($Subscription);
         $Email->setArticles($this->getArticles());
         if ($Email->send()) {
             $Sent->Result = 1;
         } else {
             $Sent->Result = 0;
         }
         $Sent->saveNew();
     }
     foreach ($this->getArticles() as $Article) {
         $Article = $Article->findItem(array('Id = ' . $Article->Id));
         if ($Article) {
             $Article->InSubscription = 0;
             $Article->save();
         }
     }
     $this->SentAt = time();
     $this->save();
 }
开发者ID:vosaan,项目名称:ankor.local,代码行数:31,代码来源:mailer.php


示例7: run

 /**
  * Check stripe data.
  *
  * @access public
  * @return void
  */
 public function run()
 {
     try {
         $paymentGateway = Payment_gateways::findOneActiveBySlug('stripe');
         if ($paymentGateway->exists()) {
             \Stripe\Stripe::setApiKey($paymentGateway->getFieldValue('apiKey'));
             $subscriptions = new Subscription();
             $allSubscriptions = $subscriptions->get();
             /* @var Subscription $_subscription */
             foreach ($allSubscriptions as $_subscription) {
                 if ($_subscription->end_date <= strtotime('now')) {
                     $paymentTransaction = $_subscription->payment_transaction->get();
                     if ($paymentTransaction->system == 'stripe') {
                         $user = new User($_subscription->user_id);
                         $customer = \Stripe\Customer::retrieve($user->stripe_id);
                         $subscription = $customer->subscriptions->retrieve($paymentTransaction->payment_id);
                         if ($subscription->status == 'active') {
                             $date = new DateTime();
                             $date->setTimestamp($subscription->current_period_end);
                             $_subscription->end_date = $date->format('Y-m-d');
                             $_subscription->activate();
                             $_subscription->save();
                         }
                     }
                 }
             }
             log_message('CRON_SUCCESS', __FUNCTION__);
         } else {
             log_message('CRON_ERROR', __FUNCTION__ . ' > ' . 'No Stripe Api key.');
         }
     } catch (Exception $e) {
         log_message('CRON_ERROR', __FUNCTION__ . ' > ' . $e->getMessage());
     }
 }
开发者ID:andrewkrug,项目名称:repucaution,代码行数:40,代码来源:stripe_subscriptions_cron.php


示例8: 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


示例9: executeSubscription

 public function executeSubscription(sfWebRequest $request)
 {
     $params = $request->getParameter('email');
     $form = new SubscriptionForm();
     if ($request->isMethod('post')) {
         $email = $params;
         try {
             if (empty($obj)) {
                 $obj = new Subscription();
                 $obj->setEmail($email)->save();
             }
         } catch (Exception $e) {
         }
         $contacts = UserPeer::getAllContact();
         $backEmail = $contacts->getEmail();
         $message = "E-mail: " . $email . "<br/>";
         // почта, на которую придет письмо
         $mail_to = $backEmail;
         // тема письма
         $subject = "Новый подписчик";
         // заголовок письма
         $headers = "Content-type: text/html; charset=utf-8\r\n";
         // кодировка письма
         // отправляем письмо
         mail($mail_to, $subject, $message, $headers);
     }
     $this->form = $form;
 }
开发者ID:alexspark21,项目名称:symfony_bisM,代码行数:28,代码来源:components.class.php


示例10: create

 public function create($data, $save = true)
 {
     $sbc = new Subscription($this, $data);
     if ($save) {
         $sbc->save();
     }
     return $sbc;
 }
开发者ID:bandwidthcom,项目名称:php-bandwidth-iris,代码行数:8,代码来源:SubscriptionsModel.php


示例11: index

 /**
  * Display subscriptions of user
  */
 public function index()
 {
     $subscription = new Subscription();
     $subscriptions = $subscription->getUserSubscriptions($this->c_user->id, true);
     CssJs::getInst()->add_css('dev/admin.css')->c_js('settings/subscriptions', 'index');
     $this->template->set('subscriptions', $subscriptions);
     $this->template->set('active_subscription', $this->c_user->getLastSubscription());
     $this->template->render();
 }
开发者ID:andrewkrug,项目名称:repucaution,代码行数:12,代码来源:subscriptions.php


示例12: sendAll

 protected function sendAll($IDs)
 {
     $sub = new Subscription();
     foreach ($IDs as $ID) {
         if (!$ID) {
             continue;
         }
         echo "{$ID} sent to " . $sub->send_bulk($ID) . " email(s)\n";
     }
 }
开发者ID:abiliojr,项目名称:digesttrigger,代码行数:10,代码来源:digest.php


示例13: onSuccess

 public function onSuccess(Course $course)
 {
     $this->em->persist($course);
     $subscription = new Subscription();
     $user = $this->container->get('security.context')->getToken()->getUser();
     $subscription->setUser($user);
     $subscription->setCourse($course);
     $this->em->persist($subscription);
     $this->em->flush();
     $this->get('session')->setFlash('notice', 'Your Course is created! & Subscription OK !');
 }
开发者ID:nonoscred,项目名称:Run4Fun,代码行数:11,代码来源:CourseHandler.php


示例14: subscriptionDetailsFromRow

 private function subscriptionDetailsFromRow($row)
 {
     $subscription = new Subscription();
     $subscription->storeId = $row['storeId'];
     $subscription->pss_sp_id = $row['pss_sp_id'];
     $subscription->sp_plan_name = $row['sp_plan_name'];
     $subscription->sp_caption = $row['sp_caption'];
     $subscription->sp_description = $row['sp_description'];
     $subscription->sp_jed_id = $row['sp_jed_id'];
     $subscription->unsetValues(array('storeId', 'created_on', 'updated_on', 'created_by', 'updated_by'));
     return $subscription;
 }
开发者ID:sujata-patne,项目名称:icon_api,代码行数:12,代码来源:SubscriptionDao.php


示例15: takeAction

 /**
  * Performs the action; returns true on success, false on error.
  *
  * @param $p_context - the current context object
  * @return bool
  */
 public function takeAction(CampContext &$p_context)
 {
     $p_context->default_url->reset_parameter('f_' . $this->m_name);
     $p_context->url->reset_parameter('f_' . $this->m_name);
     if (PEAR::isError($this->m_error)) {
         return false;
     }
     $auth = Zend_Auth::getInstance();
     $user = new User($p_context->user->identifier);
     if ($user->getUserId() != $auth->getIdentity() || $user->getUserId() == 0) {
         $this->m_error = new PEAR_Error('You must be logged in to create or edit your subscription.', ACTION_EDIT_SUBSCRIPTION_ERR_NO_USER);
         return false;
     }
     $subscriptions = Subscription::GetSubscriptions($p_context->publication->identifier, $user->getUserId());
     if (count($subscriptions) == 0) {
         $subscription = new Subscription();
         $created = $subscription->create(array('IdUser' => $user->getUserId(), 'IdPublication' => $p_context->publication->identifier, 'Active' => 'Y', 'Type' => $this->m_subscriptionType == 'trial' ? 'T' : 'P'));
         if (!$created) {
             $this->m_error = new PEAR_Error('Internal error (code 1)', ACTION_EDIT_SUBSCRIPTION_ERR_INTERNAL);
             exit(1);
         }
     } else {
         $subscription = $subscriptions[0];
     }
     $publication = new Publication($p_context->publication->identifier);
     $subscriptionDays = $this->computeSubscriptionDays($publication, $p_context->publication->subscription_time);
     $startDate = new Date();
     $columns = array('StartDate' => $startDate->getDate(), 'Days' => $subscriptionDays, 'PaidDays' => $this->m_subscriptionType == 'trial' ? $subscriptionDays : 0, 'NoticeSent' => 'N');
     if ($this->m_properties['subs_by_type'] == 'publication') {
         $sectionsList = Section::GetUniqueSections($p_context->publication->identifier);
         foreach ($sectionsList as $section) {
             $this->m_sections[] = $section['id'];
         }
     }
     foreach ($this->m_languages as $languageId) {
         foreach ($this->m_sections as $sectionNumber) {
             $subsSection = new SubscriptionSection($subscription->getSubscriptionId(), $sectionNumber, $languageId);
             $subsSection->create($columns);
         }
     }
     $fields = array('SubsType', 'tx_subs', 'nos', 'unitcost', 'unitcostalllang', 'f_substype', 'cb_subs', 'subs_all_languages', 'suma', 'tpl', 'subscription_language');
     foreach (CampRequest::GetInput() as $field => $value) {
         if (strncmp('tx_subs', $field, strlen('tx_subs')) == 0) {
             $fields[] = $field;
         }
     }
     foreach ($fields as $fieldName) {
         $p_context->default_url->reset_parameter($fieldName);
         $p_context->url->reset_parameter($fieldName);
     }
     $this->m_error = ACTION_OK;
     return true;
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:59,代码来源:MetaActionEdit_Subscription.php


示例16: getSubscribers

 function getSubscribers()
 {
     $subs = array();
     $sub = new Subscription();
     $sub->subscribed = $this->user->id;
     if ($sub->find()) {
         while ($sub->fetch()) {
             if ($sub->subscriber != $this->user->id) {
                 $subs[] = clone $sub;
             }
         }
     }
     return $subs;
 }
开发者ID:stevertiqo,项目名称:StatusNet,代码行数:14,代码来源:useractivitystream.php


示例17: actionIndex

 public function actionIndex()
 {
     $subscription = Subscription::model()->findAll();
     $data = UserSubscription::model()->getListUserSub();
     $dataProvider = new CActiveDataProvider('Subscription');
     $this->render('index', array('subscription' => $subscription, 'data' => $data, 'dataProvider' => $dataProvider));
 }
开发者ID:Lucerin,项目名称:Yii-projects,代码行数:7,代码来源:DefaultController.php


示例18: unload

 public function unload()
 {
     $subscriptions = \Subscription::all();
     $columns = ["email", "created_at"];
     $firstRow = ["Email", "Дата создания"];
     return $this->unloadToCsv($subscriptions, ['columns' => $columns, 'firstRow' => $firstRow]);
 }
开发者ID:Khelek,项目名称:ipsol,代码行数:7,代码来源:SubscriptionsController.php


示例19: loadModel

 public function loadModel($id)
 {
     if (($model = Subscription::model()->findByPk($id)) === null) {
         throw new CHttpException(404, 'Страница не найдена');
     }
     return $model;
 }
开发者ID:kuzmina-mariya,项目名称:happy-end,代码行数:7,代码来源:SubscriptionBackendController.php


示例20: subscribe

 public function subscribe()
 {
     $eventId = Utils::lookupEventId(trim(Input::get('event')));
     if (!$eventId) {
         return Response::json('', 500);
     }
     $subscription = Subscription::where('account_id', '=', Auth::user()->account_id)->where('event_id', '=', $eventId)->first();
     if (!$subscription) {
         $subscription = new Subscription();
         $subscription->account_id = Auth::user()->account_id;
         $subscription->event_id = $eventId;
     }
     $subscription->target_url = trim(Input::get('target_url'));
     $subscription->save();
     return Response::json('{"id":' . $subscription->id . '}', 201);
 }
开发者ID:poseidonjm,项目名称:invoice-ninja,代码行数:16,代码来源:IntegrationController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Subsite类代码示例发布时间:2022-05-23
下一篇:
PHP Subscriber类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap