Skip to content

Commit

Permalink
Merge branch 'hotfix/1.1.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmilner committed Nov 9, 2017
2 parents 2a61af3 + a90a6a4 commit 4e0d124
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 44 deletions.
66 changes: 33 additions & 33 deletions ccbpress-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: CCBPress Core
* Plugin URI: https://ccbpress.com/
* Description: Display information from Church Community Builder on your WordPress site.
* Version: 1.1.7
* Version: 1.1.8
* Author: CCBPress <info@ccbpress.com>
* Author URI: https://ccbpress.com/
* Text Domain: ccbpress-core
Expand Down Expand Up @@ -66,7 +66,7 @@ class CCBPress_Core {
* @var string
* @since 1.0.0
*/
public $version = '1.1.7';
public $version = '1.1.8';

/**
* Main CCBPress_Core Instance
Expand All @@ -91,11 +91,11 @@ public static function instance() {

self::$instance->transients = new CCBPress_Transients();
self::$instance->ccb = new CCBPress_Connection();
self::$instance->get = new CCBPress_Background_Get();
self::$instance->get = new CCBPress_Background_Get();

self::$instance->init();
self::$instance->transients->init();
self::$instance->ccb->init();
self::$instance->init();
self::$instance->transients->init();
self::$instance->ccb->init();

}

Expand All @@ -112,22 +112,22 @@ public static function instance() {
*/
private function setup_constants() {

// Plugin Database Version.
if ( ! defined( 'CCBPRESS_CORE_DB_VERSION' ) ) {
define( 'CCBPRESS_CORE_DB_VERSION', '1.0.0' );
}
// Plugin Database Version.
if ( ! defined( 'CCBPRESS_CORE_DB_VERSION' ) ) {
define( 'CCBPRESS_CORE_DB_VERSION', '1.0.0' );
}

// Plugin File.
if ( ! defined( 'CCBPRESS_CORE_PLUGIN_FILE' ) ) {
define( 'CCBPRESS_CORE_PLUGIN_FILE', __FILE__ );
}
if ( ! defined( 'CCBPRESS_CORE_PLUGIN_FILE' ) ) {
define( 'CCBPRESS_CORE_PLUGIN_FILE', __FILE__ );
}

// Plugin Folder Path.
if ( ! defined( 'CCBPRESS_CORE_PLUGIN_DIR' ) ) {
define( 'CCBPRESS_CORE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
}
// Plugin Folder Path.
if ( ! defined( 'CCBPRESS_CORE_PLUGIN_DIR' ) ) {
define( 'CCBPRESS_CORE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
}

// Plugin Folder URL.
// Plugin Folder URL.
if ( ! defined( 'CCBPRESS_CORE_PLUGIN_URL' ) ) {
define( 'CCBPRESS_CORE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
}
Expand All @@ -143,24 +143,24 @@ private function setup_constants() {
*/
private function includes() {

require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/class-ccbpress-transients.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/class-ccbpress-connection.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/class-ccbpress-transients.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/class-ccbpress-connection.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/class-ccbpress-licenses.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/class-ccbpress-addon.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/class-ccbpress-options.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/class-ccbpress-template.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/class-ccbpress-customizer.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/ccb-services.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/schedule-get.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/styles.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/ccb-services.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/schedule-get.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/styles.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/helpers.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/admin/admin-settings.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/admin/settings/settings-ccb.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/admin/admin-settings.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/admin/settings/settings-ccb.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/admin/settings/settings-import.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/admin/settings/settings-ccbpress.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/admin/settings/settings-ccbpress.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/admin/settings/settings-licenses.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/admin/admin-bar-menu.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/admin/admin-purge-cache.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/admin/admin-bar-menu.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/admin/admin-purge-cache.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/admin/admin-ajax.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/widgets/widget-login.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/widgets/widget-online-giving.php';
Expand All @@ -170,15 +170,15 @@ private function includes() {
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/class-ccbpress-background-get.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/import.php';

if ( is_admin() ) {
if ( is_admin() ) {
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/admin/admin-page-tabs.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/admin/admin-scripts.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/admin/admin-styles.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/admin/admin-scripts.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/admin/admin-styles.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/admin/admin-dashboard.php';
}
}

}
}

/**
* Initialize the class
Expand Down
37 changes: 28 additions & 9 deletions includes/class-ccbpress-connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,22 +273,34 @@ public function get( $args = array() ) {
*
* @since 1.0.0
*
* @param string $post_url The API URL to request the data from.
* @param array $body The array of data to send to the service.
* @param array $args Arguments.
*
* @return string An XML string containing the data.
*/
public function post( $post_url, $body ) {
public function post( $args = array() ) {

$defaults = array(
'query_string' => array(),
'body' => array(),
);
$args = wp_parse_args( $args, $defaults );

$args = array(
// Construct the URL.
$post_url = $this->build_url( $args['query_string'] );

if ( false === $post_url ) {
return false;
}

$post_args = array(
'headers' => array(
'Authorization' => 'Basic ' . base64_encode( $this->api_user . ':' . $this->api_pass ),
),
'timeout' => 300,
'body' => $body,
'body' => $args['body'],
);

$response = wp_remote_post( $post_url, $args );
$response = wp_remote_post( $post_url, $post_args );

if ( ! is_wp_error( $response ) ) {

Expand All @@ -299,13 +311,20 @@ public function post( $post_url, $body ) {
unset( $response );

// Convert the XML into an Object.
$ccb_data = simplexml_load_string( $ccb_data );
$ccb_data = @simplexml_load_string( $ccb_data );

if ( ! $this->is_valid( $ccb_data ) ) {
return false;
}

$srv = strtolower( $args['query_string']['srv'] );
do_action( "ccbpress_after_post_{$srv}", $ccb_data, $args );

return $ccb_data;

} else {

return '';
return false;

}

Expand Down Expand Up @@ -505,7 +524,7 @@ public function is_valid( $ccb_data ) {
if ( 'count' !== (string) $attr_key ) {
continue;
}
if ( '0' === (string) $attr_value ) {
if ( '0' === (string) $attr_value && 'individual_search' !== (string) $ccb_data->response->service ) {
return false;
}
}
Expand Down
8 changes: 6 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Contributors: firetree, danielmilner
Tags: church, ccb, church community builder, chms
Requires at least: 4.3
Tested up to: 4.8.1
Tested up to: 4.9
Requires PHP: 5.3
Stable tag: 1.1.7
Stable tag: 1.1.8
License: GPLv2 or later
License URI: http://ww.gnu.org/licenses/gpl-2.0.html

Expand All @@ -29,6 +29,7 @@ Requires a [Church Community Builder](http://churchcommunitybuilder.com/) accoun
Extend the capabilities of CCBPress with these add-ons:

* [Events](https://ccbpress.com/downloads/events/) - Display event data from Church Community Builder.
* [Gravity Forms](https://ccbpress.com/downloads/gravityforms/) - Add people to group, events, and process queues.
* [Groups](https://ccbpress.com/downloads/groups/) - Display group data from Church Community Builder.

== Installation ==
Expand All @@ -44,6 +45,9 @@ Extend the capabilities of CCBPress with these add-ons:

== Changelog ==

= 1.1.8 =
* Fixed an issue with a currently unused function in preparation for an upcoming add-on.

= 1.1.7 =
* Improved some backend interface elements.
* Added more translatable strings to the `.pot` file.
Expand Down

0 comments on commit 4e0d124

Please sign in to comment.