ACF to REST API - Version 2.0.5

Version Description

changing how to check dependencies

Download this release

Release Info

Developer airesvsg
Plugin Icon 128x128 ACF to REST API
Version 2.0.5
Comparing to
See all releases

Code changes from version 2.0.4 to 2.0.5

Files changed (3) hide show
  1. class-acf-to-rest-api.php +7 -7
  2. readme.md +12 -0
  3. readme.txt +4 -1
class-acf-to-rest-api.php CHANGED
@@ -4,7 +4,7 @@
4
  * Description: Edit, Get and Puts ACF fields in WordPress REST API.
5
  * Author: Aires Gonçalves
6
  * Author URI: http://github.com/airesvsg
7
- * Version: 2.0.4
8
  * Plugin URI: http://github.com/airesvsg/acf-to-rest-api
9
  */
10
 
@@ -16,7 +16,7 @@ if ( ! class_exists( 'ACF_To_REST_API' ) ) {
16
 
17
  class ACF_To_REST_API {
18
 
19
- const VERSION = '2.0.4';
20
 
21
  public static function init() {
22
  self::includes();
@@ -81,11 +81,11 @@ if ( ! class_exists( 'ACF_To_REST_API' ) ) {
81
  }
82
 
83
  if ( 'rest-api' == $plugin ) {
84
- return is_plugin_active( 'rest-api/plugin.php' );
85
  } elseif ( 'acf' == $plugin ) {
86
- return is_plugin_active( 'advanced-custom-fields/acf.php' ) || is_plugin_active( 'advanced-custom-fields-pro/acf.php' ) || is_plugin_active( 'acf-pro/acf.php' );
87
  } elseif ( 'all' == $plugin ) {
88
- return self::is_plugin_active( 'rest-api' ) && self::is_plugin_active( 'acf' );
89
  }
90
 
91
  return false;
@@ -105,9 +105,9 @@ if ( ! class_exists( 'ACF_To_REST_API' ) ) {
105
 
106
  if ( $paths ) {
107
  $plugins = get_plugins();
108
- if ( $plugins ) {
109
  foreach ( $paths as $path ) {
110
- if ( ! empty( $plugins[$path] ) ) {
111
  return $path;
112
  }
113
  }
4
  * Description: Edit, Get and Puts ACF fields in WordPress REST API.
5
  * Author: Aires Gonçalves
6
  * Author URI: http://github.com/airesvsg
7
+ * Version: 2.0.5
8
  * Plugin URI: http://github.com/airesvsg/acf-to-rest-api
9
  */
10
 
16
 
17
  class ACF_To_REST_API {
18
 
19
+ const VERSION = '2.0.5';
20
 
21
  public static function init() {
22
  self::includes();
81
  }
82
 
83
  if ( 'rest-api' == $plugin ) {
84
+ return class_exists( 'WP_REST_Controller' );
85
  } elseif ( 'acf' == $plugin ) {
86
+ return class_exists( 'acf' );
87
  } elseif ( 'all' == $plugin ) {
88
+ return class_exists( 'WP_REST_Controller' ) && class_exists( 'acf' );
89
  }
90
 
91
  return false;
105
 
106
  if ( $paths ) {
107
  $plugins = get_plugins();
108
+ if ( is_array( $plugins ) && count( $plugins ) > 0 ) {
109
  foreach ( $paths as $path ) {
110
+ if ( isset( $plugins[$path] ) && ! empty( $plugins[$path] ) ) {
111
  return $path;
112
  }
113
  }
readme.md CHANGED
@@ -2,6 +2,12 @@ ACF to REST API
2
  ====
3
  Edit, Get and Puts [ACF](https://wordpress.org/plugins/advanced-custom-fields/) data into [WordPress REST API ( WP-API )](https://wordpress.org/plugins/rest-api/)
4
 
 
 
 
 
 
 
5
  Installation
6
  ====
7
  1. Copy the `acf-to-rest-api` folder into your `wp-content/plugins` folder
@@ -101,3 +107,9 @@ Now, the fields should be sent into the key `acf_fields`
101
  <button type="submit">Save</button>
102
  </form>
103
  ```
 
 
 
 
 
 
2
  ====
3
  Edit, Get and Puts [ACF](https://wordpress.org/plugins/advanced-custom-fields/) data into [WordPress REST API ( WP-API )](https://wordpress.org/plugins/rest-api/)
4
 
5
+ - [Installation](#installation)
6
+ - [Endpoints](#endpoints)
7
+ - [Filters](#filters)
8
+ - [Editing the fields](#editing-the-fields)
9
+ - [Example](#example)
10
+
11
  Installation
12
  ====
13
  1. Copy the `acf-to-rest-api` folder into your `wp-content/plugins` folder
107
  <button type="submit">Save</button>
108
  </form>
109
  ```
110
+
111
+ Example
112
+ ====
113
+ Sample theme to edit the ACF Fields.
114
+
115
+ https://github.com/airesvsg/acf-to-rest-api-example
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: airesvsg
3
  Tags: acf, api, rest, wp-api, wp-rest-api, json, wp, wordpress, wp-rest-api
4
  Requires at least: 4.3
5
  Tested up to: 4.4
6
- Stable tag: 2.0.4
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -22,6 +22,9 @@ http://github.com/airesvsg/acf-to-rest-api
22
 
23
  == Changelog ==
24
 
 
 
 
25
  = 2.0.4 =
26
  fixed error when you register new fields ( via php ) and try save them
27
 
3
  Tags: acf, api, rest, wp-api, wp-rest-api, json, wp, wordpress, wp-rest-api
4
  Requires at least: 4.3
5
  Tested up to: 4.4
6
+ Stable tag: 2.0.5
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
22
 
23
  == Changelog ==
24
 
25
+ = 2.0.5 =
26
+ changing how to check dependencies
27
+
28
  = 2.0.4 =
29
  fixed error when you register new fields ( via php ) and try save them
30