Skip to content

Commit

Permalink
Merge pull request #21 from pierre-dargham/develop
Browse files Browse the repository at this point in the history
Feature compat 4.7
  • Loading branch information
pierre-dargham authored Dec 20, 2016
2 parents c7e1325 + 554148e commit 42b64f7
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 14 deletions.
6 changes: 3 additions & 3 deletions include/option.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class MUCD_Option {
* @since 0.2.0
*/
public static function init_duplicable_option($blogs_value = "no", $network_value = "all") {
$network_blogs = wp_get_sites(array('limit' => MUCD_MAX_NUMBER_OF_SITE));
$network_blogs = MUCD_Functions::get_sites(array('limit' => MUCD_MAX_NUMBER_OF_SITE));
foreach( $network_blogs as $blog ){
$blog_id = $blog['blog_id'];
add_blog_option( $blog_id, 'mucd_duplicable', $blogs_value);
Expand All @@ -26,7 +26,7 @@ public static function init_duplicable_option($blogs_value = "no", $network_valu
* @since 0.2.0
*/
public static function delete_duplicable_option() {
$network_blogs = wp_get_sites(array('limit' => MUCD_MAX_NUMBER_OF_SITE));
$network_blogs = MUCD_Functions::get_sites(array('limit' => MUCD_MAX_NUMBER_OF_SITE));
foreach( $network_blogs as $blog ){
$blog_id = $blog['blog_id'];
delete_blog_option( $blog_id, 'mucd_duplicable');
Expand All @@ -40,7 +40,7 @@ public static function delete_duplicable_option() {
* @param array $blogs list of blogs we want the option set to "yes"
*/
public static function set_duplicable_option($blogs) {
$network_blogs = wp_get_sites(array('limit' => MUCD_MAX_NUMBER_OF_SITE));
$network_blogs = MUCD_Functions::get_sites(array('limit' => MUCD_MAX_NUMBER_OF_SITE));
foreach( $network_blogs as $blog ){
if(in_array($blog['blog_id'], $blogs)) {
update_blog_option( $blog['blog_id'], 'mucd_duplicable', "yes");
Expand Down
15 changes: 13 additions & 2 deletions lib/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ public static function is_duplicable($blog_id) {
*/
public static function get_site_list() {
$site_list = array();

$network_blogs = wp_get_sites(array('limit' => MUCD_MAX_NUMBER_OF_SITE));
$network_blogs = MUCD_Functions::get_sites(array('limit' => MUCD_MAX_NUMBER_OF_SITE));
foreach( $network_blogs as $blog ){
if (MUCD_Functions::is_duplicable($blog['blog_id']) && MUCD_SITE_DUPLICATION_EXCLUDE != $blog['blog_id']) {
$site_list[] = $blog;
Expand Down Expand Up @@ -173,5 +172,17 @@ public static function get_network( $network_id ) {
return false;
}

public static function get_sites( $args = array() ) {
if(version_compare(get_bloginfo('version'), '4.6', '>=')) {
$sites = get_sites($args);
foreach($sites as $key => $site) {
$sites[$key] = (array) $site;
}
return $sites;
} else {
return wp_get_sites( $args );
}
}

}
}
Empty file added logs/.gitkeep
Empty file.
8 changes: 4 additions & 4 deletions multisite-clone-duplicator.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
* Plugin Name: MultiSite Clone Duplicator
* Plugin URI: http://wordpress.org/plugins/multisite-clone-duplicator/
* Description: Clones an existing site into a new one in a multisite installation : copies all the posts, settings and files
* Author: Julien OGER, Pierre DARGHAM, GLOBALIS media systems
* Author: Julien OGER, Pierre DARGHAM, David DAUGREILH, GLOBALIS media systems
* Author URI: https://github.com/pierre-dargham/multisite-clone-duplicator
*
* Version: 1.3.2
* Requires at least: 3.5.0
* Tested up to: 4.1.2
* Version: 1.3.3
* Requires at least: 4.0.0
* Tested up to: 4.7.0
*/

// Block direct requests
Expand Down
11 changes: 7 additions & 4 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
=== MultiSite Clone Duplicator ===
Contributors: pdargham, julienog, globalis
Contributors: pdargham, julienog, daviddaug, globalis
Tags: duplicate, clone, copy, duplication, duplicator, factory, multisite, site, blog, network, wpmu, new blog
Requires at least: 3.5.0
Tested up to: 4.1.2
Stable tag: 1.3.2
Requires at least: 4.0.0
Tested up to: 4.7.0
Stable tag: 1.3.3
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -91,6 +91,9 @@ As of now, following languages are supported : English (en_US), French (fr_FR),

== Changelog ==

= 1.3.3 =
* Bugfix : Compatibility : WordPress 4.7 (wp_get_sites was deprecated)

= 1.3.2 =
* Bugfix : Check on admin referer broke some admin page

Expand Down
2 changes: 1 addition & 1 deletion template/network_admin_network_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


<?php
$network_blogs = wp_get_sites(array('limit' => MUCD_MAX_NUMBER_OF_SITE));
$network_blogs = MUCD_Functions::get_sites(array('limit' => MUCD_MAX_NUMBER_OF_SITE));
echo '<div class="multiselect" id="site-select-box">';
foreach( $network_blogs as $blog ) {
echo ' <label><input ' . checked(get_blog_option( $blog['blog_id'], 'mucd_duplicable', "no"), 'yes', false) . ' class="duplicables-list" type="checkbox" name="duplicables-list[]" value="'.$blog['blog_id'].'" />' . substr($blog['domain'] . $blog['path'], 0, -1) . '</label>';
Expand Down

0 comments on commit 42b64f7

Please sign in to comment.