Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support OnPrem, Wordpress 3.6 #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DBezemer
Copy link

@DBezemer DBezemer commented May 18, 2017

Support OnPrem and CE
Wordpress 3.6 (by using json_encode instead of wp_json_encode which was introduced only in WP 4.1)
Support WP multisite

Resolves #57

$serverUrl = KalturaHelpers::getRequestPostParam( 'server_url' );

// Pre-Save Server URL
update_option( 'kaltura_server_url', sanitize_text_field((string)$serverUrl) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to fix indents (there are a few additional lines that are not indented with tabs)

@@ -40,10 +40,10 @@ public function init() {
}

public function adminWarning() {
$kalturaOptionsPageUrl = admin_url('options-general.php?page=kaltura_options');
$kalturaOptionsPageUrl = admin_url('options-general.php?page=kaltura_options&partner_login=true');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a change in behavior, originally the plugin defined to allow users to register for new Kaltura accounts.
We need to keep the registration link. Can be discussed with ZoharG.

@@ -223,7 +223,7 @@ private function addUserPermissionsToEntry( array $entries ) {

public function getplayersAction() {
$players = KalturaHelpers::getAllowedPlayers();
wp_send_json( array_values( $players ) );
echo json_encode( array_values( $players ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to keep wp_send_json, this method is available since WP 3.5.0

update_site_option( 'kaltura_admin_secret', $adminSecret );
update_site_option( 'kaltura_cms_user', $cmsUser );
// save partner details
update_site_option( 'kaltura_partner_id', sanitize_text_field((string)$partnerId) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that casting to int would be better in this case.

@@ -11,7 +11,7 @@ public static function getKalturaConfiguration() {
}

public static function getServerUrl($path = null) {
$url = KalturaHelpers::getOption( 'server_url' );
$url = KalturaHelpers::getOption( 'kaltura_server_url' );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change is correct, but unfortunately it is not backward compatible.
The issue is here: https://github.com/kaltura/all-in-one-video-pack.wordpress/blob/master/lib/KalturaHelpers.php#L181
If someone changed his WP option to return a different server URL, he will lose the value with new plugin version.
Maybe add an upgrade process? (https://wordpress.stackexchange.com/questions/144870/wordpress-update-plugin-hook-action-since-3-9)

@@ -4,8 +4,6 @@
}

return array(
'server_url' => ( is_ssl() ) ? 'https://www.kaltura.com' : 'http://www.kaltura.com',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove default values?

@@ -65,7 +70,7 @@
<td><label for="root_category">Root Category:</label></td>
<td>
<select name="root_category" id="root_category" size="1">
<option id="root_category_default" value="0" <?php echo selected( KalturaHelpers::getOption( 'kaltura_root_category' ), 0 ); ?>>Root (default)</option>
<option id="root_category_default" value="0" <?php echo selected( KalturaHelpers::getOption( 'kaltura_root_category' ), 0 ); ?>>Undefined (default)</option>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why "Undefined"?

@@ -51,6 +51,10 @@

<table class="form-table">
<tr valign="top">
<th scope="row"><label for="server_url">Server URL:</label></th>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Server URL should also be added to register.php for completeness

@@ -61,9 +61,9 @@
<?php endif; ?>
<script>
kWidget.embed({
"targetId": <?php echo wp_json_encode($playerId); ?>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the minimal version of the plugin (e612e48), we need to keep wp_json_encode for VIP certification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants