-
Notifications
You must be signed in to change notification settings - Fork 3
/
wp-simple-spreadsheet-fetcher-for-google.php
executable file
·41 lines (36 loc) · 1.44 KB
/
wp-simple-spreadsheet-fetcher-for-google.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/**
* Plugin Name: WP Simple Spreadsheet Fetcher for Google
* Plugin URI: https://github.com/naogify/wp-simple-google-sheets-fetcher
* Description: This is the simple plugin to fetch data from Google Sheets and display it on your website. Please go to "Plugins" > "WP-Simple-Spreadsheet-Fetcher-for-Google" for initial setting.
* Author: Naoki Ohashi
* Author URI: https://naoki-is-me
* Text Domain: wp-simple-spreadsheet-fetcher-for-google
* Version: 0.7.9
*
* @package Wp_Simple_Spreadsheet_Fetcher_for_Google
* @version 0.7.9
*/
defined( 'ABSPATH' ) || exit;
require('vendor/autoload.php');
use Fetcher\App\Setup\ApiSettingScreen;
use Fetcher\App\Setup\BlockRegistration;
use Fetcher\App\Utils\ApiManipulation;
use Fetcher\App\RestAPI\sheets\EntryPoint;
define( "PLUGIN_ROOT_DIR", plugin_dir_path( __FILE__ ));
define( "PLUGIN_URL", plugins_url());
define( "BUILD_DIR", PLUGIN_ROOT_DIR . 'build/' );
define( "ASSETS_DIR", PLUGIN_ROOT_DIR . 'src/assets/' );
$ApiSettingScreen = new ApiSettingScreen();
$ApiSettingScreen->init();
$ApiManipulation = new ApiManipulation();
$client = new Google_Client();
$api_key = sanitize_text_field($ApiManipulation->get_api_key());
$service="";
if($api_key){
$client->setDeveloperKey( $api_key );
$service = new Google_Service_Sheets( $client );
}
$BlockRegistration = new BlockRegistration($service,$api_key);
$BlockRegistration->init();
new EntryPoint($service);