Skip to content

Commit 2b6e2ce

Browse files
authored
Merge pull request #181 from gigya/develop
6.5.0
2 parents 91730c4 + 22feed0 commit 2b6e2ce

File tree

6 files changed

+50
-28
lines changed

6 files changed

+50
-28
lines changed

GigyaAction.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,16 @@ public function init()
104104
require_once GIGYA__PLUGIN_DIR . 'cms_kit/GigyaUserFactory.php';
105105
require_once GIGYA__PLUGIN_DIR . 'cms_kit/GigyaProfile.php';
106106
require_once GIGYA__PLUGIN_DIR . 'cms_kit/GigyaUser.php';
107-
require_once GIGYA__PLUGIN_DIR . 'cms_kit/GigyaApiRequest.php';
108-
require_once GIGYA__PLUGIN_DIR . 'cms_kit/GigyaAuthRequest.php';
109-
require_once GIGYA__PLUGIN_DIR . 'cms_kit/GSApiException.php';
110-
require_once GIGYA__PLUGIN_DIR . 'cms_kit/GSFactory.php';
111107
require_once GIGYA__PLUGIN_DIR . 'features/GigyaLogger.php';
112108

113-
GSResponse::init();
109+
if ( class_exists( 'Gigya\\PHP\\GSRequest' ) ) {
110+
require_once GIGYA__PLUGIN_DIR . 'cms_kit/GigyaApiRequest.php';
111+
require_once GIGYA__PLUGIN_DIR . 'cms_kit/GigyaAuthRequest.php';
112+
require_once GIGYA__PLUGIN_DIR . 'cms_kit/GSApiException.php';
113+
require_once GIGYA__PLUGIN_DIR . 'cms_kit/GSFactory.php';
114+
115+
GSResponse::init();
116+
}
114117

115118
require_once GIGYA__PLUGIN_DIR . 'cms_kit/GigyaApiHelper.php';
116119
require_once GIGYA__PLUGIN_DIR . 'cms_kit/GigyaCMS.php';
@@ -167,7 +170,7 @@ public function init()
167170

168171
/* Load params to be available to client-side script */
169172
wp_localize_script( 'gigya_js', 'gigyaParams', $params );
170-
wp_localize_script( 'gigya_js', 'gigyaGlobalSettings', array( 'logLevel' => $this->global_options['log_level'] ) );
173+
wp_localize_script( 'gigya_js', 'gigyaGlobalSettings', [ 'logLevel' => GIGYA__LOG_LEVEL ] );
171174

172175
/* Checking that we have an API key and Gigya's plugin is turned on */
173176
$api_key = GIGYA__API_KEY;

admin/admin.GigyaSettings.php

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,14 @@ public function adminMenu() {
8181

8282
// Register the sub-menus Gigya setting pages.
8383
foreach ( $this->getSections() as $section ) {
84-
8584
require_once GIGYA__PLUGIN_DIR . 'admin/forms/' . $section['func'] . '.php';
86-
add_submenu_page( 'gigya_global_settings', __( $section['title'], $section['title'] ), __( $section['title'], $section['title'] ), GIGYA__PERMISSION_LEVEL, $section['slug'], array(
87-
$this,
88-
'adminPage'
89-
) );
90-
85+
add_submenu_page( 'gigya_global_settings',
86+
__( $section['title'], $section['title'] ),
87+
__( $section['title'], $section['title'] ),
88+
GIGYA__PERMISSION_LEVEL, $section['slug'], [
89+
$this,
90+
'adminPage',
91+
] );
9192
}
9293
} elseif ( current_user_can( CUSTOM_GIGYA_EDIT ) ) {
9394
// Register the main Gigya setting route page.
@@ -100,11 +101,14 @@ public function adminMenu() {
100101
foreach ( $this->getSections() as $section ) {
101102

102103
require_once GIGYA__PLUGIN_DIR . 'admin/forms/' . $section['func'] . '.php';
103-
add_submenu_page( 'gigya_global_settings', __( $section['title'], $section['title'] ), __( $section['title'], $section['title'] ), CUSTOM_GIGYA_EDIT, $section['slug'], array(
104-
$this,
105-
'adminPage'
106-
) );
107-
104+
add_submenu_page( 'gigya_global_settings',
105+
__( $section['title'], $section['title'] ),
106+
__( $section['title'], $section['title'] ),
107+
CUSTOM_GIGYA_EDIT,
108+
$section['slug'], [
109+
$this,
110+
'adminPage',
111+
] );
108112
}
109113
}
110114
}
@@ -156,10 +160,16 @@ public static function adminPage() {
156160
$page = $_GET['page'];
157161
$render = '';
158162

163+
$are_dependencies_installed = class_exists('Gigya\\PHP\\GSRequest');
164+
$dependencies_missing_message = __('Fatal error: SAP Customer Data Cloud PHP SDK has not been installed. The plugin will not work. Please install Composer dependencies before proceeding.');
165+
159166
echo _gigya_render_tpl( 'admin/tpl/adminPage-wrapper.tpl.php', array(
160167
'sections' => self::getSections(),
161168
'page' => $page,
162169
) );
170+
if (!$are_dependencies_installed) {
171+
add_settings_error($page, 'dependencies-not-installed-error', $dependencies_missing_message, 'error');
172+
}
163173
settings_errors();
164174

165175
echo '<form class="gigya-settings" action="options.php" method="post">' . PHP_EOL;
@@ -168,8 +178,13 @@ public static function adminPage() {
168178
wp_nonce_field( 'update-options', 'update_options_nonce' );
169179
wp_nonce_field( 'wp_rest', 'wp_rest_nonce' );
170180
settings_fields( $page . '-group' );
171-
do_settings_sections( $page );
172-
submit_button();
181+
182+
if ($are_dependencies_installed) {
183+
do_settings_sections( $page );
184+
submit_button();
185+
} else {
186+
echo '<h4>' . $dependencies_missing_message . '</h4>';
187+
}
173188

174189
echo '</form>';
175190

admin/forms/globalSettingsForm.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,16 @@ function globalSettingsForm() {
166166
'label' => __( 'Log Level' ),
167167
);
168168

169-
$file_size = filesize( GIGYA__LOG_FILE );
170169
$end_of_desc = '';
171-
if ( $file_size !== false ) {
170+
if ( file_exists( GIGYA__LOG_FILE ) and ( $file_size = filesize( GIGYA__LOG_FILE ) ) !== false ) {
172171
if ( $file_size < 1024 * 1024 ) {
173172
$file_size = round( $file_size / 1024, 1 ) . __( ' KB.' );
174173
} else {
175174
$file_size = round( $file_size / ( 1024 * 1024 ), 1 ) . __( ' MB.' );
176175

177176
}
178-
$end_of_desc = '<br>' . __( 'The path to the file: ' ) . '<a class="gigya-debug-log" href="#">' . GIGYA__LOG_FILE . '</a>' . ( ( $file_size !== false ) ? ( __( ' and the size is: ' ) . $file_size ) : '' );
177+
$end_of_desc = '<br>' . __( 'The path to the file: ' ) . '<a class="gigya-debug-log" href="#">' . GIGYA__LOG_FILE . '</a>' . ( ( $file_size !== false )
178+
? ( __( ' and the size is: ' ) . $file_size ) : '' );
179179
}
180180

181181
//$end_of_desc .= '<br>' . __( 'for more information click ' ) . '<a href="">here.</a>'; un comment when there is a new documentation link for this feature.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "gigya/wordpress",
2+
"name": "gigya/gigya-wordpress",
33
"description": "Integrate your WordPress site with SAP Customer Data Cloud",
44
"type": "wordpress-plugin",
55
"license": "Apache 2.0",

gigya.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: SAP Customer Data Cloud
44
* Plugin URI: https://www.sap.com/products/crm/customer-data-management.html
55
* Description: Allows sites to utilize the SAP Customer Data Cloud API for authentication and social network updates.
6-
* Version: 6.4.0
6+
* Version: 6.5.0
77
* Author: SAP SE
88
* Author URI: https://www.sap.com/products/crm/customer-data-management.html
99
* License: Apache v2.0
@@ -20,7 +20,7 @@
2020
*/
2121
define( 'GIGYA__MINIMUM_WP_VERSION', '4.7' );
2222
define( 'GIGYA__MINIMUM_PHP_VERSION', '7.0' );
23-
define( 'GIGYA__VERSION', '6.4.0' );
23+
define( 'GIGYA__VERSION', '6.5.0' );
2424
define( 'GIGYA__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
2525
define( 'GIGYA__PLUGIN_URL', plugin_dir_url( __FILE__ ) );
2626
define( 'GIGYA__LOG_FILE', GIGYA__PLUGIN_DIR . 'log/sap_cdc.log' );
@@ -53,7 +53,7 @@
5353
define( 'GIGYA__OFFLINE_SYNC_MAX_USERS', 1000 );
5454
define( 'GIGYA__OFFLINE_SYNC_UPDATE_DELAY', 10 );
5555

56-
/** get out of sync users */
56+
/** Get out of sync user constants */
5757
define( 'GIGYA__ACCOUNT_SEARCH_NUMBER_OF_PAGES', 5 );
5858
define( 'GIGYA__SYNC_REPORT_MAX_PAGE_SIZE', 2000 );
5959
define( 'GIGYA__SEARCH_MAX_QUERY_LENGTH', 30000 );//This number was tested.

readme.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
Contributors: SAP SE/gigya.com konforti, luciodiri, ynhockey, shaharzillber.
44
Tags: CIAM, CIM, Registration, Social Login, Oauth, OpenSocial, Graph API, Facebook Connect, Linkedin, Twitter, authentication, OpenID, newsfeed, tweet, status update, registration, social APIs, sharing, plugin, social bookmark, social network, Facebook, community, comments, reactions, game mechanics, register, SAP Customer Data Cloud, Social Infrastructure, feed
55
Requires at least: 4.2
6-
Tested up to: 4.9
7-
Stable tag: 6.4.0
6+
Tested up to: 5.8
7+
Stable tag: 6.5.0
88
License: Apache v2.0
99

1010
Integrate your WordPress site with SAP Customer Data Cloud.
@@ -221,6 +221,10 @@ For question about installations or configuration, please contact your account m
221221
= 6.4.0 =
222222
* It is now possible to control internal SAP CDC plugin logging, regardless of the debug level set in WordPress. Logs are written to a separate internal log file.
223223

224+
= 6.5.0 =
225+
* Changed package name to gigya/gigya-wordpress (!) for more practical automated installation
226+
* Graceful failure when Composer dependencies have not been installed
227+
224228
== FAQ ==
225229

226230
Can I configure the design of the SAP Customer Data Cloud component?

0 commit comments

Comments
 (0)