PluginProbe
Timetics – Appointment Booking Calendar & Scheduling / trunk
Timetics – Appointment Booking Calendar & Scheduling vtrunk
1.0.61 1.0.60 1.0.59 1.0.58 1.0.57 1.0.56 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 1.0.22 1.0.23 1.0.24 All 62 releases
timetics / base / json-reader.php

json-reader.php in Timetics – Appointment Booking Calendar & Scheduling trunk, at base/json-reader.php

52 lines 854 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Read CSV file
4 *
5 * @package Timetics
6 */
7 namespace Timetics\Base;
8
9 defined( 'ABSPATH' ) || exit;
10
11 /**
12 * JSON Reader Class
13 */
14 class JsonReader implements FileReaderInterface {
15 /**
16 * Store file
17 *
18 * @var string
19 */
20 private static $file;
21
22 /**
23 * Get data that will be read from json file
24 *
25 * @param file $file
26 *
27 * @return array
28 */
29 public static function get_data( $file ) {
30 self::$file = $file;
31
32 return self::read_file();
33 }
34
35 /**
36 * Get from file
37 *
38 * @return array
39 */
40 private static function read_file() {
41 $file = self::$file;
42 $data = [];
43 $content = file_get_contents( $file );
44
45 if ( $content ) {
46 $data = json_decode( $content, true );
47 }
48
49 return $data;
50 }
51 }
52