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


PHP CRM_Core_BAO_Email::getFromEmail方法代码示例

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


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

示例1: preProcess

 public function preProcess()
 {
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
     $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
     $this->_component = CRM_Utils_Request::retrieve('component', 'String', $this, TRUE);
     $this->_view = CRM_Utils_Request::retrieve('view', 'String', $this, FALSE);
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE);
     $this->assign('component', $this->_component);
     $this->assign('id', $this->_id);
     $this->assign('suppressPaymentFormButtons', $this->isBeingCalledFromSelectorContext());
     if ($this->_view == 'transaction' && $this->_action & CRM_Core_Action::BROWSE) {
         $paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_id, $this->_component, TRUE);
         $transactionRows = $paymentInfo['transaction'];
         $title = ts('View Payment');
         if ($this->_component == 'event') {
             $info = CRM_Event_BAO_Participant::participantDetails($this->_id);
             $title .= " - {$info['title']}";
         }
         CRM_Utils_System::setTitle($title);
         $this->assign('transaction', TRUE);
         $this->assign('rows', $transactionRows);
         return;
     }
     $this->_fromEmails = CRM_Core_BAO_Email::getFromEmail();
     $this->_formType = CRM_Utils_Array::value('formType', $_GET);
     $enitityType = NULL;
     if ($this->_component == 'event') {
         $enitityType = 'participant';
         $this->_contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $this->_id, 'contribution_id', 'participant_id');
     }
     $eventId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_id, 'event_id', 'id');
     $this->_fromEmails = CRM_Event_BAO_Event::getFromEmailIds($eventId);
     $paymentInfo = CRM_Core_BAO_FinancialTrxn::getPartialPaymentWithType($this->_id, $enitityType);
     $paymentDetails = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_id, $this->_component, FALSE, TRUE);
     $this->_amtPaid = $paymentDetails['paid'];
     $this->_amtTotal = $paymentDetails['total'];
     if (!empty($paymentInfo['refund_due'])) {
         $paymentAmt = $this->_refund = $paymentInfo['refund_due'];
         $this->_paymentType = 'refund';
     } elseif (!empty($paymentInfo['amount_owed'])) {
         $paymentAmt = $this->_owed = $paymentInfo['amount_owed'];
         $this->_paymentType = 'owed';
     } else {
         CRM_Core_Error::fatal(ts('No payment information found for this record'));
     }
     //set the payment mode - _mode property is defined in parent class
     $this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
     if (!empty($this->_mode) && $this->_paymentType == 'refund') {
         CRM_Core_Error::fatal(ts('Credit card payment is not for Refund payments use'));
     }
     list($this->_contributorDisplayName, $this->_contributorEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactId);
     $this->assignPaymentRelatedVariables();
     $this->assign('contributionMode', $this->_mode);
     $this->assign('contactId', $this->_contactId);
     $this->assign('paymentType', $this->_paymentType);
     $this->assign('paymentAmt', abs($paymentAmt));
     $this->setPageTitle($this->_refund ? ts('Refund') : ts('Payment'));
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:58,代码来源:AdditionalPayment.php

示例2: preProcess

 public function preProcess()
 {
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
     $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
     $this->_component = CRM_Utils_Request::retrieve('component', 'String', $this, TRUE);
     $this->_fromEmails = CRM_Core_BAO_Email::getFromEmail();
     $this->_formType = CRM_Utils_Array::value('formType', $_GET);
     $enitityType = NULL;
     if ($this->_component == 'event') {
         $enitityType = 'participant';
         $this->_contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $this->_id, 'contribution_id', 'participant_id');
     }
     $eventId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $this->_id, 'event_id', 'id');
     $this->_fromEmails = CRM_Event_BAO_Event::getFromEmailIds($eventId);
     $paymentInfo = CRM_Core_BAO_FinancialTrxn::getPartialPaymentWithType($this->_id, $enitityType);
     $paymentDetails = CRM_Contribute_BAO_Contribution::getPaymentInfo($this->_id, $this->_component);
     $this->_amtPaid = $paymentDetails['paid'];
     $this->_amtTotal = $paymentDetails['total'];
     if (!empty($paymentInfo['refund_due'])) {
         $paymentAmt = $this->_refund = $paymentInfo['refund_due'];
         $this->_paymentType = 'refund';
     } elseif (!empty($paymentInfo['amount_owed'])) {
         $paymentAmt = $this->_owed = $paymentInfo['amount_owed'];
         $this->_paymentType = 'owed';
     } else {
         CRM_Core_Error::fatal(ts('No payment information found for this record'));
     }
     //set the payment mode - _mode property is defined in parent class
     $this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
     if (!empty($this->_mode) && $this->_paymentType == 'refund') {
         CRM_Core_Error::fatal(ts('Credit card payment is not for Refund payments use'));
     }
     list($this->_contributorDisplayName, $this->_contributorEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactId);
     if (!$this->_refund) {
         $this->assignProcessors();
         // also check for billing information
         // get the billing location type
         $this->assignBillingType();
     }
     $this->assign('contributionMode', $this->_mode);
     $this->assign('contactId', $this->_contactId);
     $this->assign('component', $this->_component);
     $this->assign('id', $this->_id);
     $this->assign('paymentType', $this->_paymentType);
     $this->assign('paymentAmt', abs($paymentAmt));
     $this->_paymentProcessor = array('billing_mode' => 1);
     $title = $this->_refund ? "Refund for {$this->_contributorDisplayName}" : "Payment from {$this->_contributorDisplayName}";
     if ($title) {
         CRM_Utils_System::setTitle(ts('%1', array(1 => $title)));
     }
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:51,代码来源:AdditionalPayment.php

示例3: preProcess

 public function preProcess()
 {
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'membership');
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     $this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
     $this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
     $this->assign('context', $this->_context);
     $this->assign('membershipMode', $this->_mode);
     $this->assign('contactID', $this->_contactID);
     if ($this->_mode) {
         $this->assignPaymentRelatedVariables();
     }
     if ($this->_id) {
         $this->_memType = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $this->_id, 'membership_type_id');
         $this->_membershipIDs[] = $this->_id;
     }
     $this->_fromEmails = CRM_Core_BAO_Email::getFromEmail();
 }
开发者ID:kidaa30,项目名称:yes,代码行数:19,代码来源:Form.php

示例4: setContextVariables

 /**
  * Set variables in a way that can be accessed from different places.
  *
  * This is part of refactoring for unit testability on the submit function.
  *
  * @param array $params
  */
 protected function setContextVariables($params)
 {
     $variables = array('action' => '_action', 'context' => '_context', 'id' => '_id', 'cid' => '_contactID', 'mode' => '_mode');
     foreach ($variables as $paramKey => $classVar) {
         if (isset($params[$paramKey]) && !isset($this->{$classVar})) {
             $this->{$classVar} = $params[$paramKey];
         }
     }
     if ($this->_mode) {
         $this->assignPaymentRelatedVariables();
     }
     if ($this->_id) {
         $this->_memType = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $this->_id, 'membership_type_id');
         $this->_membershipIDs[] = $this->_id;
     }
     $this->_fromEmails = CRM_Core_BAO_Email::getFromEmail();
 }
开发者ID:sarehag,项目名称:civicrm-core,代码行数:24,代码来源:Form.php

示例5: preProcess

 /**
  * Set variables up before form is built.
  */
 public function preProcess()
 {
     // Check permission for action.
     if (!CRM_Core_Permission::checkActionPermission('CiviContribute', $this->_action)) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
     }
     parent::preProcess();
     $this->_formType = CRM_Utils_Array::value('formType', $_GET);
     // Get price set id.
     $this->_priceSetId = CRM_Utils_Array::value('priceSetId', $_GET);
     $this->set('priceSetId', $this->_priceSetId);
     $this->assign('priceSetId', $this->_priceSetId);
     // Get the pledge payment id
     $this->_ppID = CRM_Utils_Request::retrieve('ppid', 'Positive', $this);
     $this->assign('action', $this->_action);
     // Get the contribution id if update
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     if (!empty($this->_id)) {
         $this->assign('contribID', $this->_id);
     }
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
     $this->assign('context', $this->_context);
     $this->_compId = CRM_Utils_Request::retrieve('compId', 'Positive', $this);
     $this->_compContext = CRM_Utils_Request::retrieve('compContext', 'String', $this);
     //set the contribution mode.
     $this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
     $this->assign('contributionMode', $this->_mode);
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     $this->assign('showCheckNumber', TRUE);
     $this->_fromEmails = CRM_Core_BAO_Email::getFromEmail();
     $this->assignPaymentRelatedVariables();
     if (in_array('CiviPledge', CRM_Core_Config::singleton()->enableComponents) && !$this->_formType) {
         $this->preProcessPledge();
     }
     if ($this->_id) {
         $this->showRecordLinkMesssage($this->_id);
     }
     $this->_values = array();
     // Current contribution id.
     if ($this->_id) {
         $this->assignPremiumProduct($this->_id);
         $this->buildValuesAndAssignOnline_Note_Type($this->_id, $this->_values);
     }
     // when custom data is included in this page
     if (!empty($_POST['hidden_custom'])) {
         $this->applyCustomData('Contribution', CRM_Utils_Array::value('financial_type_id', $_POST), $this->_id);
     }
     $this->_lineItems = array();
     if ($this->_id) {
         if (!empty($this->_compId) && $this->_compContext == 'participant') {
             $this->assign('compId', $this->_compId);
             $lineItem = CRM_Price_BAO_LineItem::getLineItems($this->_compId);
         } else {
             $lineItem = CRM_Price_BAO_LineItem::getLineItems($this->_id, 'contribution', 1, TRUE, TRUE);
         }
         empty($lineItem) ? NULL : ($this->_lineItems[] = $lineItem);
     }
     $this->assign('lineItem', empty($this->_lineItems) ? FALSE : $this->_lineItems);
     // Set title
     if ($this->_mode) {
         $this->setPageTitle($this->_ppID ? ts('Credit Card Pledge Payment') : ts('Credit Card Contribution'));
     } else {
         $this->setPageTitle($this->_ppID ? ts('Pledge Payment') : ts('Contribution'));
     }
     if ($this->_id) {
         CRM_Contribute_Form_SoftCredit::preprocess($this);
     }
 }
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:73,代码来源:Contribution.php

示例6: preProcess


//.........这里部分代码省略.........
         if (empty($validProcessors)) {
             CRM_Core_Error::fatal(ts('Could not find valid payment processor for this page'));
         } else {
             $this->_processors = $validProcessors;
         }
         // also check for billing information
         // get the billing location type
         $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array(), 'validate');
         // CRM-8108 remove ts around Billing location type
         //$this->_bltID = array_search( ts('Billing'),  $locationTypes );
         $this->_bltID = array_search('Billing', $locationTypes);
         if (!$this->_bltID) {
             CRM_Core_Error::fatal(ts('Please set a location type of %1', array(1 => 'Billing')));
         }
         $this->set('bltID', $this->_bltID);
         $this->assign('bltID', $this->_bltID);
         $this->_fields = array();
         CRM_Core_Payment_Form::setCreditCardFields($this);
         // this required to show billing block
         $this->assign_by_ref('paymentProcessor', $paymentProcessor);
         $this->assign('hidePayPalExpress', TRUE);
     }
     if ($this->_action & CRM_Core_Action::ADD) {
         if (!CRM_Member_BAO_Membership::statusAvailabilty($this->_contactID)) {
             // all possible statuses are disabled - redirect back to contact form
             CRM_Core_Error::statusBounce(ts('There are no configured membership statuses. You cannot add this membership until your membership statuses are correctly configured'));
         }
         if ($this->_contactID) {
             //check whether contact has a current membership so we can alert user that they may want to do a renewal instead
             $contactMemberships = array();
             $memParams = array('contact_id' => $this->_contactID);
             CRM_Member_BAO_Membership::getValues($memParams, $contactMemberships, TRUE);
             $cMemTypes = array();
             foreach ($contactMemberships as $mem) {
                 $cMemTypes[] = $mem['membership_type_id'];
             }
             if (count($cMemTypes) > 0) {
                 $memberorgs = CRM_Member_BAO_MembershipType::getMemberOfContactByMemTypes($cMemTypes);
                 $mems_by_org = array();
                 foreach ($contactMemberships as $memid => $mem) {
                     $mem['member_of_contact_id'] = CRM_Utils_Array::value($mem['membership_type_id'], $memberorgs);
                     if (CRM_Utils_Array::value('membership_end_date', $mem)) {
                         $mem['membership_end_date'] = CRM_Utils_Date::customformat($mem['membership_end_date']);
                     }
                     $mem['membership_type'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $mem['membership_type_id'], 'name', 'id');
                     $mem['membership_status'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus', $mem['status_id'], 'label', 'id');
                     if ($this->_mode) {
                         $mem['renewUrl'] = CRM_Utils_System::url('civicrm/contact/view/membership', "reset=1&action=renew&cid={$this->_contactID}&id={$mem['id']}&context=membership&selectedChild=member&mode=live");
                     } else {
                         $mem['renewUrl'] = CRM_Utils_System::url('civicrm/contact/view/membership', "reset=1&action=renew&cid={$this->_contactID}&id={$mem['id']}&context=membership&selectedChild=member");
                     }
                     $mem['membershipTab'] = CRM_Utils_System::url('civicrm/contact/view', "reset=1&force=1&cid={$this->_contactID}&selectedChild=member");
                     $mems_by_org[$mem['member_of_contact_id']] = $mem;
                 }
                 $resources = CRM_Core_Resources::singleton();
                 $resources->addSetting(array('existingMems' => array('memberorgs' => $mems_by_org)));
                 $resources->addScriptFile('civicrm', 'templates/CRM/Member/Form/Membership.js');
             }
         } else {
             $resources = CRM_Core_Resources::singleton();
             $resources->addScriptFile('civicrm', 'templates/CRM/Member/Form/MembershipStandalone.js');
             $statuses = array();
             $membershipStatus = new CRM_Member_DAO_MembershipStatus();
             $membershipStatus->is_current_member = 1;
             $membershipStatus->find();
             $membershipStatus->selectAdd();
             $membershipStatus->selectAdd('id');
             while ($membershipStatus->fetch()) {
                 $statuses[$membershipStatus->id] = $membershipStatus->label;
             }
             $membershipStatus->free();
             $passthru = array('typeorgs' => CRM_Member_BAO_MembershipType::getMembershipTypeOrganization(), 'memtypes' => CRM_Member_BAO_MembershipType::getMembershipTypes(FALSE), 'statuses' => $statuses);
             $resources->addSetting(array('existingMems' => $passthru));
         }
     }
     // when custom data is included in this page
     if (CRM_Utils_Array::value('hidden_custom', $_POST)) {
         CRM_Custom_Form_CustomData::preProcess($this);
         CRM_Custom_Form_CustomData::buildQuickForm($this);
         CRM_Custom_Form_CustomData::setDefaultValues($this);
     }
     // CRM-4395, get the online pending contribution id.
     $this->_onlinePendingContributionId = NULL;
     if (!$this->_mode && $this->_id && $this->_action & CRM_Core_Action::UPDATE) {
         $this->_onlinePendingContributionId = CRM_Contribute_BAO_Contribution::checkOnlinePendingContribution($this->_id, 'Membership');
     }
     $this->assign('onlinePendingContributionId', $this->_onlinePendingContributionId);
     $this->_fromEmails = CRM_Core_BAO_Email::getFromEmail();
     // Set title
     if ($this->_contactID) {
         $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactID);
         // Check if this is default domain contact CRM-10482
         if (CRM_Contact_BAO_Contact::checkDomainContact($this->_contactID)) {
             $displayName .= ' (' . ts('default organization') . ')';
         }
         // omitting contactImage from title for now since the summary overlay css doesn't work outside of our crm-container
         CRM_Utils_System::setTitle(ts('Membership for') . ' ' . $displayName);
     }
     parent::preProcess();
 }
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:101,代码来源:Membership.php

示例7: getFromEmailIds

 /**
  * Build From Email as the combination of all the email ids of the logged in user,
  * the domain email id and the email id configured for the event
  *
  * @param int $eventId   the id of the event
  *
  * @return array         an array of email ids
  * @access public
  * @static
  */
 static function getFromEmailIds($eventId = NULL)
 {
     $fromEmailValues['from_email_id'] = CRM_Core_BAO_Email::getFromEmail();
     if ($eventId) {
         // add the email id configured for the event
         $params = array('id' => $eventId);
         $returnProperties = array('confirm_from_name', 'confirm_from_email', 'cc_confirm', 'bcc_confirm');
         $eventEmail = array();
         CRM_Core_DAO::commonRetrieve('CRM_Event_DAO_Event', $params, $eventEmail, $returnProperties);
         if (!empty($eventEmail['confirm_from_name']) && !empty($eventEmail['confirm_from_email'])) {
             $eventEmailId = "{$eventEmail['confirm_from_name']} <{$eventEmail['confirm_from_email']}>";
             $fromEmailValues['from_email_id'][$eventEmailId] = htmlspecialchars($eventEmailId);
             $fromEmailId = array('cc' => CRM_Utils_Array::value('cc_confirm', $eventEmail), 'bcc' => CRM_Utils_Array::value('bcc_confirm', $eventEmail));
             $fromEmailValues = array_merge($fromEmailValues, $fromEmailId);
         }
     }
     return $fromEmailValues;
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:28,代码来源:Event.php

示例8: preProcess

 /**
  * Set variables up before form is built.
  */
 public function preProcess()
 {
     $this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
     // check for action permissions.
     if (!CRM_Core_Permission::checkActionPermission('CiviPledge', $this->_action)) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
     }
     $this->assign('action', $this->_action);
     $this->assign('context', $this->_context);
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     $this->userDisplayName = $this->userEmail = NULL;
     if ($this->_contactID) {
         list($this->userDisplayName, $this->userEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID);
         $this->assign('displayName', $this->userDisplayName);
     }
     $this->setPageTitle(ts('Pledge'));
     // build custom data
     CRM_Custom_Form_CustomData::preProcess($this, NULL, NULL, 1, 'Pledge', $this->_id);
     $this->_values = array();
     // current pledge id
     if ($this->_id) {
         // get the contribution id
         $this->_contributionID = CRM_Core_DAO::getFieldValue('CRM_Pledge_DAO_PledgePayment', $this->_id, 'contribution_id', 'pledge_id');
         $params = array('id' => $this->_id);
         CRM_Pledge_BAO_Pledge::getValues($params, $this->_values);
         $this->_isPending = CRM_Pledge_BAO_Pledge::pledgeHasFinancialTransactions($this->_id, CRM_Utils_Array::value('status_id', $this->_values)) ? FALSE : TRUE;
     }
     // get the pledge frequency units.
     $this->_freqUnits = CRM_Core_OptionGroup::values('recur_frequency_units');
     $this->_fromEmails = CRM_Core_BAO_Email::getFromEmail();
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:39,代码来源:Pledge.php

示例9: emailLetter

 /**
  * Send pdf by email.
  *
  * @param array $contact
  * @param string $html
  *
  * @param $is_pdf
  * @param array $format
  * @param array $params
  *
  * @return bool
  */
 public static function emailLetter($contact, $html, $is_pdf, $format = array(), $params = array())
 {
     try {
         if (empty($contact['email'])) {
             return FALSE;
         }
         $mustBeEmpty = array('do_not_email', 'is_deceased', 'on_hold');
         foreach ($mustBeEmpty as $emptyField) {
             if (!empty($contact[$emptyField])) {
                 return FALSE;
             }
         }
         $defaults = array('toName' => $contact['display_name'], 'toEmail' => $contact['email'], 'text' => '', 'html' => $html);
         if (empty($params['from'])) {
             $emails = CRM_Core_BAO_Email::getFromEmail();
             $emails = array_keys($emails);
             $defaults['from'] = array_pop($emails);
         }
         if (!empty($params['subject'])) {
             $defaults['subject'] = $params['subject'];
         } else {
             $defaults['subject'] = ts('Thank you for your contribution/s');
         }
         if ($is_pdf) {
             $defaults['html'] = ts('Please see attached');
             $defaults['attachments'] = array(CRM_Utils_Mail::appendPDF('ThankYou.pdf', $html, $format));
         }
         $params = array_merge($defaults);
         return CRM_Utils_Mail::send($params);
     } catch (CRM_Core_Exception $e) {
         return FALSE;
     }
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:45,代码来源:PDFLetterCommon.php

示例10: preProcess


//.........这里部分代码省略.........
     // get price set id.
     $this->_priceSetId = CRM_Utils_Array::value('priceSetId', $_GET);
     $this->set('priceSetId', $this->_priceSetId);
     $this->assign('priceSetId', $this->_priceSetId);
     // action
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     $this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
     $this->_processors = array();
     // check for edit permission
     if (!CRM_Core_Permission::checkActionPermission('CiviMember', $this->_action)) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
     }
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
     $this->assign('context', $this->_context);
     if ($this->_id) {
         $this->_memType = CRM_Core_DAO::getFieldValue("CRM_Member_DAO_Membership", $this->_id, "membership_type_id");
         $this->_membershipIDs[] = $this->_id;
     }
     $this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
     $this->assign('membershipMode', $this->_mode);
     if ($this->_mode) {
         $this->_paymentProcessor = array('billing_mode' => 1);
         $validProcessors = array();
         $processors = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, "billing_mode IN ( 1, 3 )");
         foreach ($processors as $ppID => $label) {
             $paymentProcessor = CRM_Core_BAO_PaymentProcessor::getPayment($ppID, $this->_mode);
             if ($paymentProcessor['payment_processor_type'] == 'PayPal' && !$paymentProcessor['user_name']) {
                 continue;
             } elseif ($paymentProcessor['payment_processor_type'] == 'Dummy' && $this->_mode == 'live') {
                 continue;
             } else {
                 $paymentObject = CRM_Core_Payment::singleton($this->_mode, $paymentProcessor, $this);
                 $error = $paymentObject->checkConfig();
                 if (empty($error)) {
                     $validProcessors[$ppID] = $label;
                 }
                 $paymentObject = NULL;
             }
         }
         if (empty($validProcessors)) {
             CRM_Core_Error::fatal(ts('Could not find valid payment processor for this page'));
         } else {
             $this->_processors = $validProcessors;
         }
         // also check for billing information
         // get the billing location type
         $locationTypes = CRM_Core_PseudoConstant::locationType();
         // CRM-8108 remove ts around Billing location type
         //$this->_bltID = array_search( ts('Billing'),  $locationTypes );
         $this->_bltID = array_search('Billing', $locationTypes);
         if (!$this->_bltID) {
             CRM_Core_Error::fatal(ts('Please set a location type of %1', array(1 => 'Billing')));
         }
         $this->set('bltID', $this->_bltID);
         $this->assign('bltID', $this->_bltID);
         $this->_fields = array();
         CRM_Core_Payment_Form::setCreditCardFields($this);
         // this required to show billing block
         $this->assign_by_ref('paymentProcessor', $paymentProcessor);
         $this->assign('hidePayPalExpress', TRUE);
     }
     if ($this->_action & CRM_Core_Action::ADD) {
         //check whether any active membership statuses are available - redirects back to contact summary if not
         CRM_Member_BAO_Membership::statusAvilability($this->_contactID);
         if ($this->_contactID) {
             //check whether contact has a current membership so we can alert user that they may want to do a renewal instead
             $hasMembership = CRM_Member_BAO_Membership::getContactMembership($this->_contactID, NULL, 0);
             if (!empty($hasMembership)) {
                 $hasMembership['membership_type'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $hasMembership['membership_type_id'], 'name', 'id');
                 $hasMembership['membership_status'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus', $hasMembership['status_id'], 'label', 'id');
                 $membershipTab = CRM_Utils_System::url('civicrm/contact/view', "reset=1&force=1&cid={$this->_contactID}&selectedChild=member");
                 if ($this->_mode) {
                     $renewUrl = CRM_Utils_System::url('civicrm/contact/view/membership', "reset=1&action=renew&cid={$this->_contactID}&id={$hasMembership['id']}&context=membership&selectedChild=member&mode=live");
                 } else {
                     $renewUrl = CRM_Utils_System::url('civicrm/contact/view/membership', "reset=1&action=renew&cid={$this->_contactID}&id={$hasMembership['id']}&context=membership&selectedChild=member");
                 }
                 if (CRM_Utils_Array::value('membership_end_date', $hasMembership)) {
                     CRM_Core_Session::setStatus(ts('This contact has an existing %1 membership record with %2 status and end date of %3. <a href="%4">Click here if you want to renew this membership</a> (rather than creating a new membership record). <a href="%5">Click here to view all existing and / or expired memberships for this contact.</a>', array(1 => $hasMembership['membership_type'], 2 => $hasMembership['membership_status'], 3 => CRM_Utils_Date::customformat($hasMembership['membership_end_date']), 4 => $renewUrl, 5 => $membershipTab)));
                 } else {
                     CRM_Core_Session::setStatus(ts('This contact has an existing %1 membership record with %2 status. <a href="%3">Click here if you want to renew this membership</a> (rather than creating a new membership record). <a href="%4">Click here to view all existing and / or expired memberships for this contact.</a>', array(1 => $hasMembership['membership_type'], 2 => $hasMembership['membership_status'], 3 => $renewUrl, 4 => $membershipTab)));
                 }
             }
         }
     }
     // when custom data is included in this page
     if (CRM_Utils_Array::value("hidden_custom", $_POST)) {
         CRM_Custom_Form_CustomData::preProcess($this);
         CRM_Custom_Form_CustomData::buildQuickForm($this);
         CRM_Custom_Form_CustomData::setDefaultValues($this);
     }
     // CRM-4395, get the online pending contribution id.
     $this->_onlinePendingContributionId = NULL;
     if (!$this->_mode && $this->_id && $this->_action & CRM_Core_Action::UPDATE) {
         $this->_onlinePendingContributionId = CRM_Contribute_BAO_Contribution::checkOnlinePendingContribution($this->_id, 'Membership');
     }
     $this->assign('onlinePendingContributionId', $this->_onlinePendingContributionId);
     $this->_fromEmails = CRM_Core_BAO_Email::getFromEmail();
     parent::preProcess();
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:Membership.php

示例11: preProcess

 public function preProcess()
 {
     //custom data related code
     $this->_cdType = CRM_Utils_Array::value('type', $_GET);
     $this->assign('cdType', FALSE);
     if ($this->_cdType) {
         $this->assign('cdType', TRUE);
         return CRM_Custom_Form_CustomData::preProcess($this);
     }
     // check for edit permission
     if (!CRM_Core_Permission::check('edit memberships')) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
     }
     // action
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'membership');
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     $this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
     if ($this->_id) {
         $this->_memType = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $this->_id, 'membership_type_id');
     }
     $this->assign('endDate', CRM_Utils_Date::customFormat(CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $this->_id, 'end_date')));
     $this->assign('membershipStatus', CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus', CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $this->_id, 'status_id'), 'name'));
     //using credit card :: CRM-2759
     $this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
     if ($this->_mode) {
         $membershipFee = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_memType, 'minimum_fee');
         if (!$membershipFee) {
             $statusMsg = ts('Membership Renewal using a credit card requires a Membership fee. Since there is no fee associated with the selected memebership type, you can use the normal renewal mode.');
             CRM_Core_Session::setStatus($statusMsg, '', 'info');
             CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view/membership', "reset=1&action=renew&cid={$this->_contactID}&id={$this->_id}&context=membership"));
         }
         $this->assign('membershipMode', $this->_mode);
         $this->_paymentProcessor = array('billing_mode' => 1);
         $validProcessors = array();
         $processors = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, 'billing_mode IN ( 1, 3 )');
         foreach ($processors as $ppID => $label) {
             $paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($ppID, $this->_mode);
             if ($paymentProcessor['payment_processor_type'] == 'PayPal' && !$paymentProcessor['user_name']) {
                 continue;
             } elseif ($paymentProcessor['payment_processor_type'] == 'Dummy' && $this->_mode == 'live') {
                 continue;
             } else {
                 $paymentObject = CRM_Core_Payment::singleton($this->_mode, $paymentProcessor, $this);
                 $error = $paymentObject->checkConfig();
                 if (empty($error)) {
                     $validProcessors[$ppID] = $label;
                 }
                 $paymentObject = NULL;
             }
         }
         if (empty($validProcessors)) {
             CRM_Core_Error::fatal(ts('Could not find valid payment processor for this page'));
         } else {
             $this->_processors = $validProcessors;
         }
         // also check for billing information
         // get the billing location type
         $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array(), 'validate');
         // CRM-8108 remove ts around Billing location type
         //$this->_bltID = array_search( ts('Billing'),  $locationTypes );
         $this->_bltID = array_search('Billing', $locationTypes);
         if (!$this->_bltID) {
             CRM_Core_Error::fatal(ts('Please set a location type of %1', array(1 => 'Billing')));
         }
         $this->set('bltID', $this->_bltID);
         $this->assign('bltID', $this->_bltID);
         $this->_fields = array();
         CRM_Core_Payment_Form::setCreditCardFields($this);
         // this required to show billing block
         $this->assign_by_ref('paymentProcessor', $paymentProcessor);
         $this->assign('hidePayPalExpress', TRUE);
     } else {
         $this->assign('membershipMode', FALSE);
     }
     // when custom data is included in this page
     if (!empty($_POST['hidden_custom'])) {
         CRM_Custom_Form_CustomData::preProcess($this);
         CRM_Custom_Form_CustomData::buildQuickForm($this);
         CRM_Custom_Form_CustomData::setDefaultValues($this);
     }
     $this->_fromEmails = CRM_Core_BAO_Email::getFromEmail();
     parent::preProcess();
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:84,代码来源:MembershipRenewal.php

示例12: preProcess

 /**
  * Function to set variables up before form is built
  *
  * @return void
  * @access public
  */
 public function preProcess()
 {
     $this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
     // check for action permissions.
     if (!CRM_Core_Permission::checkActionPermission('CiviPledge', $this->_action)) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
     }
     $this->assign('action', $this->_action);
     $this->assign('context', $this->_context);
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     $this->userDisplayName = $this->userEmail = NULL;
     if ($this->_contactID) {
         list($this->userDisplayName, $this->userEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID);
         $this->assign('displayName', $this->userDisplayName);
         // set title to "Pledge - "+Contact Name
         $displayName = $this->userDisplayName;
         $pageTitle = 'Pledge - ' . $displayName;
         $this->assign('pageTitle', $pageTitle);
     }
     //build custom data
     CRM_Custom_Form_CustomData::preProcess($this, NULL, NULL, 1, 'Pledge', $this->_id);
     $this->_values = array();
     // current pledge id
     if ($this->_id) {
         //get the contribution id
         $this->_contributionID = CRM_Core_DAO::getFieldValue('CRM_Pledge_DAO_PledgePayment', $this->_id, 'contribution_id', 'pledge_id');
         $params = array('id' => $this->_id);
         CRM_Pledge_BAO_Pledge::getValues($params, $this->_values);
         //get the honorID
         $this->_honorID = CRM_Utils_Array::value('honor_contact_id', $this->_values);
         $paymentStatusTypes = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
         //check for pending pledge.
         if (CRM_Utils_Array::value('status_id', $this->_values) == array_search('Pending', $paymentStatusTypes)) {
             $this->_isPending = TRUE;
         } elseif (CRM_Utils_Array::value('status_id', $this->_values) == array_search('Overdue', $paymentStatusTypes)) {
             $allPledgePayments = array();
             CRM_Core_DAO::commonRetrieveAll('CRM_Pledge_DAO_PledgePayment', 'pledge_id', $this->_id, $allPledgePayments, array('status_id'));
             foreach ($allPledgePayments as $key => $value) {
                 $allStatus[$value['id']] = $paymentStatusTypes[$value['status_id']];
             }
             if (count(array_count_values($allStatus)) <= 2) {
                 if (CRM_Utils_Array::value('Pending', array_count_values($allStatus))) {
                     $this->_isPending = TRUE;
                 }
             }
         }
     }
     //get the pledge frequency units.
     $this->_freqUnits = CRM_Core_OptionGroup::values('recur_frequency_units');
     $this->_fromEmails = CRM_Core_BAO_Email::getFromEmail();
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:62,代码来源:Pledge.php

示例13: preProcess

 /**
  * Function to set variables up before form is built
  *
  * @return void
  * @access public
  */
 public function preProcess()
 {
     //check permission for action.
     if (!CRM_Core_Permission::checkActionPermission('CiviContribute', $this->_action)) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
     }
     $this->_cdType = CRM_Utils_Array::value('type', $_GET);
     $this->assign('cdType', FALSE);
     if ($this->_cdType) {
         $this->assign('cdType', TRUE);
         CRM_Custom_Form_CustomData::preProcess($this);
         return;
     }
     $config = CRM_Core_Config::singleton();
     $resources = CRM_Core_Resources::singleton();
     $resources->addScriptFile('civicrm', 'templates/CRM/Contribute/Form/SoftCredit.js');
     $resources->addSetting(array('monetaryThousandSeparator' => $config->monetaryThousandSeparator));
     $this->_formType = CRM_Utils_Array::value('formType', $_GET);
     // get price set id.
     $this->_priceSetId = CRM_Utils_Array::value('priceSetId', $_GET);
     $this->set('priceSetId', $this->_priceSetId);
     $this->assign('priceSetId', $this->_priceSetId);
     //get the pledge payment id
     $this->_ppID = CRM_Utils_Request::retrieve('ppid', 'Positive', $this);
     //get the contact id
     $this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
     //get the action.
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
     $this->assign('action', $this->_action);
     //get the contribution id if update
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     if (!empty($this->_id)) {
         $this->assign('contribID', $this->_id);
     }
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
     $this->assign('context', $this->_context);
     $this->_compId = CRM_Utils_Request::retrieve('compId', 'Positive', $this);
     $this->_compContext = CRM_Utils_Request::retrieve('compContext', 'String', $this);
     //set the contribution mode.
     $this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
     $this->assign('contributionMode', $this->_mode);
     $this->_paymentProcessor = array('billing_mode' => 1);
     $this->assign('showCheckNumber', TRUE);
     $this->_fromEmails = CRM_Core_BAO_Email::getFromEmail();
     $this->assignProcessors();
     if ($this->_contactID) {
         list($this->userDisplayName, $this->userEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID);
         $this->assign('displayName', $this->userDisplayName);
     }
     // also check for billing information
     // get the billing location type
     $this->assignBillingType();
     $this->_fields = array();
     CRM_Core_Payment_Form::setPaymentFieldsByType(CRM_Utils_Array::value('payment_type', $this->_processors), $this);
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     if (in_array('CiviPledge', $config->enableComponents) && !$this->_formType) {
         $this->preProcessPledge();
     }
     $this->_values = array();
     // current contribution id
     if ($this->_id) {
         $this->assignPremiumProduct($this->_id);
         $this->buildValuesAndAssignOnline_Note_Type($this->_id, $this->_values);
     }
     // when custom data is included in this page
     if (CRM_Utils_Array::value('hidden_custom', $_POST)) {
         $this->applyCustomData('Contribution', CRM_Utils_Array::value('financial_type_id', $_POST), $this->_id);
     }
     $this->_lineItems = array();
     if ($this->_id) {
         if (!empty($this->_compId) && $this->_compContext == 'participant') {
             $this->assign('compId', $this->_compId);
             $lineItem = CRM_Price_BAO_LineItem::getLineItems($this->_compId);
         } else {
             $lineItem = CRM_Price_BAO_LineItem::getLineItems($this->_id, 'contribution', 1);
         }
         empty($lineItem) ? NULL : ($this->_lineItems[] = $lineItem);
     }
     $this->assign('lineItem', empty($this->_lineItems) ? FALSE : $this->_lineItems);
     // Set title
     if ($this->_contactID) {
         $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactID);
         // Check if this is default domain contact CRM-10482
         if (CRM_Contact_BAO_Contact::checkDomainContact($this->_contactID)) {
             $displayName .= ' (' . ts('default organization') . ')';
         }
         // omitting contactImage from title for now since the summary overlay css doesn't work outside of our crm-container
         CRM_Utils_System::setTitle(ts('Contribution from') . ' ' . $displayName);
     }
 }
开发者ID:hguru,项目名称:224Civi,代码行数:98,代码来源:Contribution.php

示例14: preProcess

 /**
  * Function to set variables up before form is built
  *
  * @return void
  * @access public
  */
 public function preProcess()
 {
     //check permission for action.
     if (!CRM_Core_Permission::checkActionPermission('CiviContribute', $this->_action)) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
     }
     $this->_cdType = CRM_Utils_Array::value('type', $_GET);
     $this->assign('cdType', FALSE);
     if ($this->_cdType) {
         $this->assign('cdType', TRUE);
         return CRM_Custom_Form_CustomData::preProcess($this);
     }
     $this->_formType = CRM_Utils_Array::value('formType', $_GET);
     // get price set id.
     $this->_priceSetId = CRM_Utils_Array::value('priceSetId', $_GET);
     $this->set('priceSetId', $this->_priceSetId);
     $this->assign('priceSetId', $this->_priceSetId);
     //get the pledge payment id
     $this->_ppID = CRM_Utils_Request::retrieve('ppid', 'Positive', $this);
     //get the contact id
     $this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
     //get the action.
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
     $this->assign('action', $this->_action);
     //get the contribution id if update
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
     $this->assign('context', $this->_context);
     $this->_compId = CRM_Utils_Request::retrieve('compId', 'Positive', $this);
     //set the contribution mode.
     $this->_mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
     $this->assign('contributionMode', $this->_mode);
     $this->_paymentProcessor = array('billing_mode' => 1);
     $this->assign('showCheckNumber', FALSE);
     $this->_fromEmails = CRM_Core_BAO_Email::getFromEmail();
     //ensure that processor has a valid config
     //only valid processors get display to user
     if ($this->_mode) {
         $validProcessors = array();
         $processors = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, "billing_mode IN ( 1, 3 )");
         foreach ($processors as $ppID => $label) {
             $paymentProcessor = CRM_Core_BAO_PaymentProcessor::getPayment($ppID, $this->_mode);
             // at this stage only Authorize.net has been tested to support future start dates so if it's enabled let the template know
             // to show receive date
             $processorsSupportingFutureStartDate = array('AuthNet');
             if (in_array($paymentProcessor['payment_processor_type'], $processorsSupportingFutureStartDate)) {
                 $this->assign('processorSupportsFutureStartDate', TRUE);
             }
             if ($paymentProcessor['payment_processor_type'] == 'PayPal' && !$paymentProcessor['user_name']) {
                 continue;
             } elseif ($paymentProcessor['payment_processor_type'] == 'Dummy' && $this->_mode == 'live') {
                 continue;
             } else {
                 $paymentObject = CRM_Core_Payment::singleton($this->_mode, $paymentProcessor, $this);
                 $error = $paymentObject->checkConfig();
                 if (empty($error)) {
                     $validProcessors[$ppID] = $label;
                 }
                 $paymentObject = NULL;
             }
         }
         if (empty($validProcessors)) {
             CRM_Core_Error::fatal(ts('You will need to configure the %1 settings for your Payment Processor before you can submit credit card transactions.', array(1 => $this->_mode)));
         } else {
             $this->_processors = $validProcessors;
         }
         //get the valid recurring processors.
         $recurring = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, 'is_recur = 1');
         $this->_recurPaymentProcessors = array_intersect_assoc($this->_processors, $recurring);
     }
     $this->assign('recurringPaymentProcessorIds', empty($this->_recurPaymentProcessors) ? '' : implode(',', array_keys($this->_recurPaymentProcessors)));
     // this required to show billing block
     $this->assign_by_ref('paymentProcessor', $paymentProcessor);
     $this->assign('hidePayPalExpress', TRUE);
     if ($this->_contactID) {
         list($this->userDisplayName, $this->userEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID);
         $this->assign('displayName', $this->userDisplayName);
     }
     // also check for billing information
     // get the billing location type
     $locationTypes = CRM_Core_PseudoConstant::locationType();
     $this->_bltID = array_search('Billing', $locationTypes);
     if (!$this->_bltID) {
         CRM_Core_Error::fatal(ts('Please set a location type of %1', array(1 => 'Billing')));
     }
     $this->set('bltID', $this->_bltID);
     $this->assign('bltID', $this->_bltID);
     $this->_fields = array();
     // payment fields are depending on payment type
     if (CRM_Utils_Array::value('payment_type', $this->_processors) & CRM_Core_Payment::PAYMENT_TYPE_DIRECT_DEBIT) {
         CRM_Core_Payment_Form::setDirectDebitFields($this);
     } else {
         CRM_Core_Payment_Form::setCreditCardFields($this);
     }
//.........这里部分代码省略.........
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:Contribution.php


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