-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimple-google-spreadsheets.php
73 lines (60 loc) · 2.16 KB
/
simple-google-spreadsheets.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
/**
* Plugin Name: Simple Google Spreadsheets
* Plugin URI: https://github.com/mattoperry/simple-google-spreadsheets
* Integrates live data from Google spreadsheets into your WordPress templates.
* Author: Matt Perry
* Author URI: http://www.stkywll.com
* Version: 0.1
*/
/** Include the PEAR JSON library. We'll use it instead of internal JSON because a) we don't really need to do much except decode and b) we want this to work even in situations without native JSON support (like old PHP or times when JSON is disabled.) **/
if ( !class_exists( 'Services_JSON' ) ) {
include_once( plugin_dir_path(__FILE__) . 'lib/Services_JSON.php' );
}
/***
*
* Simple Google Spreadsheets
*
* @package Simple_Google_Spreadsheets
* @author Matt Perry [email protected]
* @license GPL-2.0+
* @link http://stkywll.com
* @copyright Matt Perry
*
* @wordpress-plugin
* Plugin Name: Simple Google Spreadsheets
* Plugin URI: http://stkywll.com
* Description: Integrates live data from Google spreadsheets into your WordPress templates.
* Version: 1.0.0
* Author: Matt Perry
* Author URI: http://stkywll.com
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
require_once( plugin_dir_path( __FILE__ ) . 'class-simple-google-spreadsheets.php' );
// Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively.
register_activation_hook( __FILE__, array( 'Simple_Google_Spreadsheets', 'activate' ) );
register_deactivation_hook( __FILE__, array( 'Simple_Google_Spreadsheets', 'deactivate' ) );
$SGS = Simple_Google_Spreadsheets::get_instance();
//some WordPress-style wrapper functions to retrieve data:
function sgs_get_cell( $sheet, $col, $row ) {
global $SGS;
return $SGS->fetch( $sheet, $col, $row, false );
}
function sgs_cell( $sheet, $col, $row ) {
global $SGS;
$SGS->fetch( $sheet, $col, $row );
}
function sgs_get_row( $sheet, $row ) {
global $SGS;
return $SGS->fetch( $sheet, null, $row );
}
function sgs_get_col( $sheet, $col ) {
global $SGS;
return $SGS->fetch( $sheet, $col, null );
}
?>