定制 level51/silverstripe-tripadvisor 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

level51/silverstripe-tripadvisor

最新稳定版本:0.1.0

Composer 安装命令:

composer require level51/silverstripe-tripadvisor

包简介

Simple integration of TripAdvisor location profiles and reviews for SilverStripe.

README 文档

README

This module provides a simple integration of TripAdvisor location profiles including awards, reviews, etc. Basically it is a wrapper for the Content API of TripAdvisor.

Official API documentation: https://developer-tripadvisor.com/content-api/

Maintainer

Installation

composer require level51/silverstripe-tripadvisor

If you don't like composer you can just download and unpack it to the root of your SilverStripe project.

Prerequisites

  1. Obtain a valid TripAdvisor API key at: https://developer-tripadvisor.com/content-api/request-api-access/
  2. Get the ID of your location. You won't find it anywhere on the location profile's page, just check the URL.

Setup

  1. Provide your API key and location profile ID in the "Trip Advisor" tab of systems settings section.
  2. Execute the "Sync TripAdvisor profile" action. This will create one TripAdvisorLocationProfile and three TripAdvisorReview records. Caution: This will drop the current profile data if already loaded.
  3. Go ahead and use it in your code (example snippets):
// Fetch location profile and output number of visits
$profile = TripAdvisorLocationProfile::current();
echo $profile->NumVisits;

// Fetch reviews and render with custom template
return TripAdvisorReview::get()->renderWith('ReviewGrid');

Notes

The logic uses the RestfulService class and hence does API calls via cURL. It follows the API guidelines in terms of caching so you don't have to worry about that.

If you like to set up some continuous integration you can use the TripAdvisorRefreshTask. Crontab in combination with the sake module could be a neat approach.

0 0 * * * cd /your/silverstripe/dir && sake dev/tasks/TripAdvisorRefreshTask > /dev/null 2>&1

统计信息

  • 总下载量: 8
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-08-11