Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.

Commit 411c068

Browse files
authored
Merge pull request #129 from creativecommons/fix-multisite-issue
fix multisite issue retrieving license information
2 parents ae520c0 + 2fbee3e commit 411c068

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

includes/class-creativecommons.php

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ public function get_license( $location = null ) {
494494
$this->_logger( 'called network' );
495495
$license = ( $network_license = get_site_option( 'license' ) )
496496
? $network_license : $this->plugin_default_license();
497+
497498
break;
498499

499500
case 'site':
@@ -525,22 +526,16 @@ public function get_license( $location = null ) {
525526
// since this can cause way too many calls for the right license.
526527
case 'frontend':
527528
$this->_logger( 'get license for the frontend' );
528-
if ( is_multisite() ) {
529-
$this->_logger( 'get license: multisite' );
530-
$license = $this->get_license( 'network' );
531-
$this->_logger( 'got network license' );
532-
} else {
533-
$license = $this->get_license( 'site' );
534-
if ( array_key_exists( 'user_override_license', $license )
535-
&& 'true' == $license['user_override_license']
536-
) {
537-
$license = $this->get_license( 'profile' );
538-
}
539-
if ( array_key_exists( 'content_override_license', $license )
540-
&& 'true' == $license['content_override_license']
541-
) {
542-
$license = $this->get_license( 'post-page' );
543-
}
529+
$license = $this->get_license( 'site' );
530+
if ( array_key_exists( 'user_override_license', $license )
531+
&& 'true' == $license['user_override_license']
532+
) {
533+
$license = $this->get_license( 'profile' );
534+
}
535+
if ( array_key_exists( 'content_override_license', $license )
536+
&& 'true' == $license['content_override_license']
537+
) {
538+
$license = $this->get_license( 'post-page' );
544539
}
545540
break;
546541
}
@@ -769,7 +764,6 @@ private function _verify_license_data( $from, $data = null ) {
769764
) {
770765
$data = sanitize_text_field( wp_unslash( $_POST['license'] ) );
771766
}
772-
773767
// Saves the license attribution information. MAke sure to save the current version.
774768
$license['version'] = self::VERSION;
775769
$license['attribute_to'] = ( isset( $data['attribute_to'] ) ) ? esc_attr( $data['attribute_to'] ) : '';
@@ -1061,7 +1055,6 @@ public function print_license_html( $location = 'frontend', $echo = true ) {
10611055
* Add a filter to include the license with the excerpt & content
10621056
* filter allow an option to switch this off
10631057
*/
1064-
10651058
$license = $this->get_license( $location );
10661059
$html = '';
10671060
if ( is_array( $license ) && count( $license ) > 0 ) {

0 commit comments

Comments
 (0)