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


PHP MCAPI::ping方法代码示例

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


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

示例1: MCAPI

 function validate_cfg()
 {
     $OSCOM_Db = Registry::get('Db');
     $this->valid_cfg = false;
     if (empty($this->apikey)) {
         $this->complain('You have not entered your API key. Please read the installation instructions.');
         return;
     }
     if (!$this->key_valid) {
         $GLOBALS["mc_api_key"] = $this->apikey;
         $api = new MCAPI('notused', 'notused');
         $res = $api->ping();
         if ($api->errorMessage != '') {
             $this->complain('Server said: "' . $api->errorMessage . '". Your API key is likely invalid. Please read the installation instructions.');
             return;
         } else {
             $this->key_valid = true;
             $OSCOM_Db->save('configuration', ['configuration_value' => 'true'], ['configuration_key' => 'MODULE_HEADER_TAGS_MAILCHIMP_360_KEY_VALID']);
             if (empty($this->store_id)) {
                 $this->store_id = md5(uniqid(rand(), true));
                 $OSCOM_Db->save('configuration', ['configuration_value' => $this->store_id], ['configuration_key' => 'MODULE_HEADER_TAGS_MAILCHIMP_360_STORE_ID']);
             }
         }
     }
     if (empty($this->store_id)) {
         $this->complain('Your Store ID has not been set. This is not good. Contact support.');
     } else {
         $this->valid_cfg = true;
     }
 }
开发者ID:haraldpdl,项目名称:oscommerce2,代码行数:30,代码来源:mc360.php

示例2: MCAPI

 function validate_cfg()
 {
     $this->valid_cfg = false;
     if (empty($this->apikey)) {
         $this->complain('You have not entered your API key. Please read the installation instructions.');
         return;
     }
     if (!$this->key_valid) {
         $GLOBALS["mc_api_key"] = $this->apikey;
         $api = new MCAPI('notused', 'notused');
         $res = $api->ping();
         if ($api->errorMessage != '') {
             $this->complain('Server said: "' . $api->errorMessage . '". Your API key is likely invalid. Please read the installation instructions.');
             return;
         } else {
             $this->key_valid = true;
             tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = 'true' where configuration_key = 'MODULE_HEADER_TAGS_MAILCHIMP_360_KEY_VALID'");
             if (empty($this->store_id)) {
                 $this->store_id = md5(uniqid(rand(), true));
                 tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . $this->store_id . "' where configuration_key = 'MODULE_HEADER_TAGS_MAILCHIMP_360_STORE_ID'");
             }
         }
     }
     if (empty($this->store_id)) {
         $this->complain('Your Store ID has not been set. This is not good. Contact support.');
     } else {
         $this->valid_cfg = true;
     }
 }
开发者ID:othreed,项目名称:osCommerce-234-bootstrap-wADDONS,代码行数:29,代码来源:mc360.php

示例3: MCauth

 function MCauth()
 {
     if (!isset($_SESSION['MCping'])) {
         jimport('joomla.html.parameter');
         jimport('joomla.application.component.helper');
         $params =& JComponentHelper::getParams('com_joomailermailchimpintegration');
         $paramsPrefix = version_compare(JVERSION, '1.6.0', 'ge') ? 'params.' : '';
         $MCapi = $params->get($paramsPrefix . 'MCapi');
         $MC = new MCAPI($MCapi);
         $ping = $MC->ping();
         $_SESSION['MCping'] = $ping;
     } else {
         $ping = $_SESSION['MCping'];
     }
     return $ping;
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:16,代码来源:MCauth.php

示例4: MCAPI

 function validate_mailchimp_key($key)
 {
     require_once PREMISE_LIB_DIR . 'mailchimp_api/MCAPI.class.php';
     $mailchimp = new MCAPI($key);
     if (!$mailchimp->ping()) {
         return array('error' => __('Invalid MailChimp API key.', 'premise'));
     }
     return true;
 }
开发者ID:juslee,项目名称:e27,代码行数:9,代码来源:premise.php

示例5: dirname

 function tfuse_ajax_newsletter_save_mailchimp_api_key()
 {
     #MailChimp
     tf_can_ajax();
     require_once dirname(__FILE__) . '/library/MCAPI.class.php';
     $api_key = $this->request->POST('api_key');
     $api = new MCAPI($api_key);
     $api->ping();
     if ($api->errorCode) {
         tfjecho(array('status' => -1, 'message' => __('API key is invalid.', 'tfuse')));
     } else {
         $this->model->set_mc_key($api_key);
         tfjecho(array('status' => 1));
     }
     die;
 }
开发者ID:shimion,项目名称:stlucks,代码行数:16,代码来源:TF_NEWSLETTER.php

示例6: updateSettings

 function updateSettings($variables)
 {
     if (!isset($variables["mailchimp_secure"])) {
         $variables["mailchimp_secure"] = 0;
     }
     /**
      *   Check for a valid api key.
      */
     if ($variables["apikey_changed"] == "1" && $variables["mailchimp_apikey"] != "") {
         include_once "include/MCAPI.class.php";
         $api = new MCAPI($variables["mailchimp_apikey"]);
         $api->ping();
         if ($api->errorCode) {
             unset($variables["mailchimp_apikey"]);
             $this->updateErrorMessage = "Unable to change the MailChimp apikey: " . $api->errorMessage . " (" . $api->errorCode . ")";
             return $variables;
         }
         //end if
     }
     //end if
     /**
      *  Check for valid list id
      */
     if ($variables["apilist_changed"] == "1" && $variables["mailchimp_list_id"] != "") {
         include_once "include/MCAPI.class.php";
         /**
          *  Check to see if api is already defined (from a possible api key check)
          *  If not, define it and check the key/connection
          */
         if (!isset($api)) {
             $api = new MCAPI($variables["mailchimp_apikey"]);
             $api->ping();
             if ($api->errorCode) {
                 unset($variables["mailchimp_list_id"]);
                 $this->updateErrorMessage = "Unable to change the MailChimp list id: " . $api->errorMessage . " (" . $api->errorCode . ")";
                 return $variables;
             }
             //end if
         }
         //end if
         /**
          *   Look up the lists
          */
         $lists = $api->lists();
         if ($api->errorCode) {
             unset($variables["mailchimp_list_id"]);
             $this->updateErrorMessage = "Unable to change the MailChimp list id: " . $api->errorMessage . " (" . $api->errorCode . ")";
             return $variables;
         } else {
             /**
              *  Check to see if list id is valid
              */
             $validId = false;
             foreach ($lists as $list) {
                 if ($list["id"] == $variables["mailchimp_list_id"]) {
                     $validId = true;
                     break;
                 }
             }
             //endif
             if (!$validId) {
                 unset($variables["mailchimp_list_id"]);
                 $this->updateErrorMessage = "Unable to change the MailChimp list id: the id does not match a valid id on the account.";
                 return $variables;
             } else {
                 /**
                  *  Check to see if the list has a uuid.
                  */
                 $hasUuid = false;
                 $hasCompany = false;
                 $hasType = false;
                 $mergeVars = $api->listMergeVars($variables["mailchimp_list_id"]);
                 if ($api->errorCode) {
                     unset($variables["mailchimp_list_id"]);
                     $this->updateErrorMessage = "Unable to change the MailChimp list id: " . $api->errorMessage . " (" . $api->errorCode . ")";
                     return $variables;
                 }
                 //end if
                 $req = array();
                 foreach ($mergeVars as $mergeVar) {
                     switch ($mergeVar["tag"]) {
                         case "UUID":
                             $hasUuid = true;
                             break;
                         case "COMPANY":
                             $hasCompany = true;
                             break;
                         case "TYPE":
                             $hasType = true;
                             break;
                     }
                     //end switch
                 }
                 //end foreach
                 /**
                  *  If it doesn't have a uuid field, create it.
                  */
                 if (!$hasUuid) {
                     $req = array("req" => true, "public" => false, "field_type" => "text");
                     $api->listMergeVarAdd($variables["mailchimp_list_id"], "UUID", "phpBMS unique user id", $req);
//.........这里部分代码省略.........
开发者ID:Jacquesvw,项目名称:phpBMS,代码行数:101,代码来源:adminsettings.php

示例7: getMailChimpTimestamp

 public function getMailChimpTimestamp()
 {
     $api = new MCAPI($this->apikey);
     $retval = $api->ping();
     if ($api->errorCode) {
         SS_Log::log("Unable to load lists()! Error Code = " . $api->errorCode . " Error Msg = " . $api->errorMessage, SS_Log::ERR);
         return false;
     } else {
         return gmdate('Y-m-d H:i:s', strtotime($retval['headers']['Date']));
     }
 }
开发者ID:quadra-digital,项目名称:silverstripe-mailchimp-module,代码行数:11,代码来源:MCSync.php


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