Beispiel #1
0
 function mycred_is_site_blocked($blog_id = NULL)
 {
     // Only applicable for multisites
     if (!is_multisite() || !isset($GLOBALS['blog_id'])) {
         return false;
     }
     $reply = false;
     if ($blog_id === NULL) {
         $blog_id = $GLOBALS['blog_id'];
     }
     // Get Network settings
     $network = mycred_get_settings_network();
     // Only applicable if the block is set and this is not the main blog
     if (!empty($network['block']) && $blog_id > 1) {
         // Clean up list to make sure no white spaces are used
         $list = explode(',', $network['block']);
         $clean = array();
         foreach ($list as $blog_id) {
             $clean[] = trim($blog_id);
         }
         // Check if blog is blocked from using myCRED.
         if (in_array($blog_id, $clean)) {
             $reply = true;
         }
     }
     return apply_filters('mycred_is_site_blocked', $reply, $blog_id);
 }
Beispiel #2
0
 function mycred_centralize_log()
 {
     // Not a multisite
     if (!is_multisite()) {
         return true;
     }
     $mycred_network = mycred_get_settings_network();
     if ($mycred_network['central']) {
         return true;
     }
     return false;
 }
Beispiel #3
0
        /**
         * Network Settings Page
         * @since 0.1
         * @version 1.1
         */
        public function admin_page_settings()
        {
            // Security
            if (!current_user_can('manage_network_options')) {
                wp_die(__('Access Denied', 'mycred'));
            }
            global $mycred_network;
            $prefs = mycred_get_settings_network();
            $name = mycred_label();
            ?>

	<div class="wrap" id="myCRED-wrap">
		<div id="icon-myCRED" class="icon32"><br /></div>
		<h2> <?php 
            echo sprintf(__('%s Network', 'mycred'), $name);
            ?>
</h2>
		<?php 
            // Inform user that myCRED has not yet been setup
            $setup = get_blog_option(1, 'mycred_setup_completed', false);
            if ($setup === false) {
                echo '<div class="error"><p>' . sprintf(__('Note! %s has not yet been setup.', 'mycred'), $name) . '</p></div>';
            }
            // Settings Updated
            if (isset($_GET['settings-updated'])) {
                echo '<div class="updated"><p>' . __('Network Settings Updated', 'mycred') . '</p></div>';
            }
            ?>

<p><?php 
            echo sprintf(__('Configure network settings for %s.', 'mycred'), $name);
            ?>
</p>
<form method="post" action="<?php 
            echo admin_url('options.php');
            ?>
" class="">
	<?php 
            settings_fields('mycred_network');
            ?>

	<div class="list-items expandable-li" id="accordion">
		<h4><div class="icon icon-inactive core"></div><?php 
            _e('Settings', 'mycred');
            ?>
</h4>
		<div class="body" style="display:block;">
			<label class="subheader"><?php 
            _e('Master Template', 'mycred');
            ?>
</label>
			<ol id="myCRED-network-settings-enabling">
				<li>
					<input type="radio" name="mycred_network[master]" id="myCRED-network-overwrite-enabled" <?php 
            checked($prefs['master'], 1);
            ?>
 value="1" /> 
					<label for="myCRED-network-"><?php 
            _e('Yes', 'mycred');
            ?>
</label>
				</li>
				<li>
					<input type="radio" name="mycred_network[master]" id="myCRED-network-overwrite-disabled" <?php 
            checked($prefs['master'], 0);
            ?>
 value="0" /> 
					<label for="myCRED-network-"><?php 
            _e('No', 'mycred');
            ?>
</label>
				</li>
				<li>
					<p class="description"><?php 
            echo sprintf(__("If enabled, %s will use your main site's settings for all other sites in your network.", 'mycred'), $name);
            ?>
</p>
				</li>
			</ol>
			<label class="subheader"><?php 
            _e('Central Logging', 'mycred');
            ?>
</label>
			<ol id="myCRED-network-log-enabling">
				<li>
					<input type="radio" name="mycred_network[central]" id="myCRED-network-overwrite-log-enabled" <?php 
            checked($prefs['central'], 1);
            ?>
 value="1" /> 
					<label for="myCRED-network-"><?php 
            _e('Yes', 'mycred');
            ?>
</label>
				</li>
				<li>
					<input type="radio" name="mycred_network[central]" id="myCRED-network-overwrite-log-disabled" <?php 
            checked($prefs['central'], 0);
            ?>
 value="0" /> 
					<label for="myCRED-network-"><?php 
            _e('No', 'mycred');
            ?>
</label>
				</li>
				<li>
					<p class="description"><?php 
            echo sprintf(__("If enabled, %s will log all site actions in your main site's log.", 'mycred'), $name);
            ?>
</p>
				</li>
			</ol>
			<label class="subheader"><?php 
            _e('Site Block', 'mycred');
            ?>
</label>
			<ol id="myCRED-network-site-blocks">
				<li>
					<div class="h2"><input type="text" name="mycred_network[block]" id="myCRED-network-block" value="<?php 
            echo $prefs['block'];
            ?>
" class="long" /></div>
					<span class="description"><?php 
            echo sprintf(__('Comma separated list of blog ids where %s is to be disabled.', 'mycred'), $name);
            ?>
</span>
				</li>
			</ol>
			<?php 
            do_action('mycred_network_prefs', $this);
            ?>

		</div>
		<?php 
            do_action('mycred_after_network_prefs', $this);
            ?>

	</div>
	<p><?php 
            submit_button(__('Save Network Settings', 'mycred'), 'primary large', 'submit', false);
            ?>
</p>
</form>	
<?php 
            do_action('mycred_bottom_network_page', $this);
            ?>

</div>
<?php 
        }
Beispiel #4
0
 function mycred_is_site_blocked($blog_id = NULL)
 {
     // Only applicable for multisites
     if (!is_multisite()) {
         return false;
     }
     // Blog ID
     if ($blog_id === NULL) {
         $blog_id = get_current_blog_id();
     }
     // Get Network settings
     $network = mycred_get_settings_network();
     $blocked = false;
     // Only applicable if the block is set and this is not the main blog
     if (strlen($network['block']) > 0 && $blog_id > 1) {
         // Clean up list to make sure no white spaces are used
         $list = explode(',', $network['block']);
         $clean = array();
         foreach ($list as $blog_id) {
             $blog_id = sanitize_key($blog_id);
             if ($blog_id == '' || $blog_id == 0 || $blog_id == 1) {
                 continue;
             }
             $clean[] = absint($blog_id);
         }
         // Check if blog is blocked from using myCRED.
         if (in_array($blog_id, $clean)) {
             $blocked = true;
         }
     }
     return apply_filters('mycred_is_site_blocked', $blocked, $blog_id);
 }