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


PHP FLBuilderModel::update_services方法代码示例

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


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

示例1: connect_service

 /**
  * Save the API connection of a service and retrieve account settings markup.
  *
  * Called via the fl_ajax_fl_builder_connect_service action.
  *
  * @since 1.5.4
  * @return string The JSON encoded response.
  */
 public static function connect_service()
 {
     $saved_services = FLBuilderModel::get_services();
     $post_data = FLBuilderModel::get_post_data();
     $response = array('error' => false, 'html' => '');
     // Validate the service data.
     if (!isset($post_data['service']) || empty($post_data['service'])) {
         $response['error'] = _x('Error: Missing service type.', 'Third party service such as MailChimp.', 'fl-builder');
     } else {
         if (!isset($post_data['fields']) || 0 === count($post_data['fields'])) {
             $response['error'] = _x('Error: Missing service data.', 'Connection data such as an API key.', 'fl-builder');
         } else {
             if (!isset($post_data['fields']['service_account']) || empty($post_data['fields']['service_account'])) {
                 $response['error'] = _x('Error: Missing account name.', 'Account name for a third party service such as MailChimp.', 'fl-builder');
             }
         }
     }
     // Get the service data.
     $service = $post_data['service'];
     $service_account = $post_data['fields']['service_account'];
     // Does this account already exist?
     if (isset($saved_services[$service][$service_account])) {
         $response['error'] = _x('Error: An account with that name already exists.', 'Account name for a third party service such as MailChimp.', 'fl-builder');
     }
     // Try to connect to the service.
     if (!$response['error']) {
         $instance = self::get_service_instance($service);
         $connection = $instance->connect($post_data['fields']);
         if ($connection['error']) {
             $response['error'] = $connection['error'];
         } else {
             FLBuilderModel::update_services($service, $service_account, $connection['data']);
             $response['html'] = self::render_account_settings($service, $service_account);
         }
     }
     // Return the response.
     echo json_encode($response);
     die;
 }
开发者ID:meftasadat,项目名称:DSL_SITE,代码行数:47,代码来源:class-fl-builder-services.php


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