PluginProbe
Property Hive / 2.2.4
Property Hive v2.2.4
2.3.0 2.2.6 2.2.5 2.2.4 2.2.3 2.2.2 1.4.46 1.4.47 1.4.48 1.4.49 1.4.5 1.4.50 1.4.51 1.4.52 1.4.53 1.4.54 1.4.55 1.4.56 1.4.57 1.4.58 1.4.59 1.4.6 1.4.60 1.4.61 1.4.62 All 260 releases
propertyhive / includes / ph-pro-feature-functions.php

ph-pro-feature-functions.php in Property Hive 2.2.4, at includes/ph-pro-feature-functions.php

52 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 function get_ph_pro_features()
4 {
5 $features = array();
6
7 if ( false === ( $features = get_transient( 'propertyhive_features' ) ) || isset($_GET['ph_force_get_features']) )
8 {
9 // It wasn't there, so regenerate the data and save the transient
10 $response = wp_remote_get(
11 'https://wp-property-hive.com/add-ons-json.php',
12 array(
13 'timeout' => 10
14 )
15 );
16
17 if ( !is_wp_error( $response ) && is_array( $response ) )
18 {
19 $body = $response['body']; // use the content
20
21 $add_ons = json_decode($body, TRUE);
22
23 if ( $add_ons !== FALSE && is_array($add_ons) && !empty($add_ons) )
24 {
25 $features = $add_ons;
26 set_transient( 'propertyhive_features', $features, DAY_IN_SECONDS );
27 }
28 }
29 }
30
31 $features = apply_filters( 'propertyhive_pro_features', $features );
32
33 return $features;
34 }
35
36 function get_ph_pro_feature( $requested_feature )
37 {
38 $features = get_ph_pro_features();
39
40 foreach ( $features as $feature )
41 {
42 $slug = explode("/", $feature['wordpress_plugin_file']);
43 $slug = $slug[0];
44
45 if ( $slug == $requested_feature )
46 {
47 return $feature;
48 }
49 }
50
51 return false;
52 }