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


PHP Shineisp_Commons_Utilities::getCoordinates方法代码示例

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


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

示例1: saveData

 /**
  * saveData
  * Save the record
  * @param posted var from the form
  * @return Boolean
  */
 public static function saveData($record, $sendemail = false)
 {
     // Set the new values
     if (!empty($record['review_id']) && is_numeric($record['review_id'])) {
         $review = self::getbyId($record['review_id']);
     } else {
         $review = new Reviews();
         $review->ip = $_SERVER['REMOTE_ADDR'];
     }
     // Get the latitude and longitude coordinates
     $coords = Shineisp_Commons_Utilities::getCoordinates($record['city']);
     $review->product_id = $record['product_id'];
     $review->publishedat = date('Y-m-d H:i:s');
     $review->nick = $record['nick'];
     $review->city = !empty($coords['results'][0]['formatted_address']) ? $coords['results'][0]['formatted_address'] : $record['city'];
     $review->referer = $record['referer'];
     $review->subject = $record['subject'];
     $review->latitude = !empty($coords['results'][0]['geometry']['location']['lat']) ? $coords['results'][0]['geometry']['location']['lat'] : $record['latitude'];
     $review->longitude = !empty($coords['results'][0]['geometry']['location']['lng']) ? $coords['results'][0]['geometry']['location']['lng'] : $record['longitude'];
     $review->email = $record['email'];
     $review->stars = $record['stars'];
     $review->active = isset($record['active']) ? $record['active'] : 0;
     $review->review = $record['review'];
     if ($review->trySave()) {
         if ($sendemail) {
             // Send the email to confirm the subscription
             $isp = Isp::getActiveISP();
             $placeholders['review'] = $record['review'];
             $placeholders['nick'] = $record['nick'];
             $placeholders['referer'] = $record['referer'];
             $placeholders['subject'] = $record['subject'];
             $placeholders['email'] = $record['email'];
             $placeholders['stars'] = $record['stars'];
             $placeholders['product'] = products::getAllInfo($record['product_id']);
             // Send a message to the administrator
             Shineisp_Commons_Utilities::sendEmailTemplate($isp['email'], 'review_new', $placeholders);
         }
         return $review->review_id;
     }
     return false;
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:47,代码来源:Reviews.php

示例2: AddNew

 /**
  * Add a new address
  * @param $id
  * @param array $data
  * @return integer address_id
  */
 public static function AddNew(array $data, $id = "")
 {
     if (is_numeric($id)) {
         $address = self::find($id);
     } else {
         $address = new Addresses();
     }
     $address['address'] = $data['address'];
     $address['city'] = $data['city'];
     $address['code'] = $data['code'];
     $address['area'] = $data['area'];
     $region_id = intval($data['region_id']);
     if ($region_id != 0) {
         $address['region_id'] = $region_id;
     }
     // Get the latitude and longitude coordinates
     $coords = Shineisp_Commons_Utilities::getCoordinates($data['city']);
     $address['latitude'] = $coords['results'][0]['geometry']['location']['lat'];
     $address['longitude'] = $coords['results'][0]['geometry']['location']['lng'];
     $address['country_id'] = $data['country_id'];
     $address['customer_id'] = $data['customer_id'];
     $address->save();
     return $address['address_id'];
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:30,代码来源:Addresses.php


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