Exemplo n.º 1
0
 /**
  * Constructor function
  *
  * @since 1.2.5
  * @access private
  */
 private function __construct()
 {
     $this->init_vars();
     if (WIKI_DEMO_FOR_NON_SUPPORTER && function_exists('is_supporter') && !is_supporter()) {
         add_action('admin_menu', array(&$this, 'non_suppporter_admin_menu'));
         return;
     }
     add_action('init', array(&$this, 'init'));
     add_action('init', array(&$this, 'maybe_flush_rewrites'), 999);
     //add_action('current_screen', function(){ echo get_current_screen()->id; });
     add_action('wpmu_new_blog', array(&$this, 'new_blog'), 10, 6);
     add_action('admin_print_styles-settings_page_wiki', array(&$this, 'admin_styles'));
     add_action('admin_print_scripts-settings_page_wiki', array(&$this, 'admin_scripts'));
     add_action('add_meta_boxes_incsub_wiki', array(&$this, 'meta_boxes'));
     add_action('wp_insert_post', array(&$this, 'save_wiki_meta'), 10, 2);
     add_filter('get_next_post_where', array(&$this, 'get_next_post_where'));
     add_filter('get_previous_post_where', array(&$this, 'get_previous_post_where'));
     add_filter('get_next_post_sort', array(&$this, 'get_next_post_sort'));
     add_filter('get_previous_post_sort', array(&$this, 'get_previous_post_sort'));
     add_action('widgets_init', array(&$this, 'widgets_init'));
     add_action('pre_post_update', array(&$this, 'send_notifications'), 50, 1);
     add_filter('the_content', array(&$this, 'theme'), 999);
     //set to really low priority. we want this to run after all other filters, otherwise undesired output may result.
     add_action('template_include', array(&$this, 'load_templates'));
     add_filter('name_save_pre', array(&$this, 'name_save'));
     add_filter('role_has_cap', array(&$this, 'role_has_cap'), 10, 3);
     add_filter('user_has_cap', array(&$this, 'user_has_cap'), 10, 3);
     add_filter('get_edit_post_link', array(&$this, 'get_edit_post_link'));
     add_filter('comments_open', array(&$this, 'comments_open'), 10, 1);
     add_filter('user_can_richedit', array(&$this, 'user_can_richedit'));
     add_filter('wp_title', array(&$this, 'wp_title'), 10, 3);
     add_filter('the_title', array(&$this, 'the_title'), 10, 2);
     add_filter('404_template', array(&$this, 'not_found_template'));
     add_action('pre_get_posts', array(&$this, 'pre_get_posts'));
     add_filter('request', array(&$this, 'request'));
     add_filter('body_class', array(&$this, 'body_class'), 10);
     add_action('wp_enqueue_scripts', array(&$this, 'wp_enqueue_scripts'), 10);
 }
Exemplo n.º 2
0
/*
 Plugin Name: Wiki
 Plugin URI: http://premium.wpmudev.org/project/wiki
 Description: Add a wiki to your blog
 Author: S H Mohanjith (Incsub)
 WDP ID: 168
 Version: 1.2.2.8
 Author URI: http://premium.wpmudev.org
 Text Domain: incsub_wiki
*/
/**
 * @global	object	$wiki	Convenient access to the chat object
 */
global $wiki;
define('WIKI_SLUG_TAGS', 'tags');
define('WIKI_SLUG_CATEGORIES', 'categories');
define('WIKI_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . basename(dirname(__FILE__)) . '/');
if (!defined('WIKI_DEMO_FOR_NON_SUPPORTER')) {
    define('WIKI_DEMO_FOR_NON_SUPPORTER', false);
}
if (WIKI_DEMO_FOR_NON_SUPPORTER && function_exists('is_supporter') && !is_supporter()) {
    function wiki_non_suppporter_admin_menu()
    {
        global $psts;
        add_menu_page(__('Wiki', 'incsub_wiki'), __('Wiki', 'incsub_wiki'), 'edit_posts', 'incsub_wiki', array(&$psts, 'feature_notice'), null, 30);
    }
    add_action('admin_menu', 'wiki_non_suppporter_admin_menu');
} else {
    include_once 'wiki-include.php';
}
include_once 'lib/wpmudev-dashboard-notification/wpmudev-dash-notification.php';
Exemplo n.º 3
0
function wdeb_not_supporter()
{
    return function_exists('is_supporter') && current_user_can('manage_options') && !is_supporter();
}
Exemplo n.º 4
0
 /**
  * Add Google Analytics options page.
  *
  * @return void
  */
 function admin_menu()
 {
     $network_settings = $this->get_options('track_settings', 'network');
     /* If Supporter enabled but specific option disabled, disable menu */
     if (!is_super_admin() && function_exists('is_supporter') && !empty($network_settings['supporter_only']) && !is_supporter()) {
         return;
     } else {
         add_submenu_page('options-general.php', 'Google Analytics', 'Google Analytics', 'manage_options', 'google-analytics', array(&$this, 'output_site_settings_page'));
     }
 }
Exemplo n.º 5
0
function ust_blog_spammed($blog_id)
{
    global $wpdb, $current_site;
    //prevent the spamming of supporters if free trial is not enabled
    $free_trial = get_site_option("supporter_free_days");
    if (function_exists('is_supporter') && is_supporter($blog_id) && $free_trial === 0) {
        update_blog_status($blog_id, "spam", '0');
        return;
    }
    //spam blog's users if preference is set
    $ust_settings = get_site_option("ust_settings");
    if ($ust_settings['spam_blog_users']) {
        $blogusers = get_users_of_blog($blog_id);
        if ($blogusers) {
            foreach ($blogusers as $bloguser) {
                if (!is_super_admin($bloguser->user_login)) {
                    update_user_status($bloguser->user_id, "spam", '1');
                }
            }
        }
    }
    $wpdb->query("UPDATE `" . $wpdb->base_prefix . "ust` SET spammed = '" . current_time('mysql', true) . "' WHERE blog_id = '{$blog_id}' LIMIT 1");
    //update spam stat
    $num = get_site_option('ust_spam_count');
    if (!$num) {
        $num = 0;
    }
    update_site_option('ust_spam_count', $num + 1);
    //don't send splog data if it was spammed automatically
    $auto_spammed = get_blog_option($blog_id, 'ust_auto_spammed');
    $post_auto_spammed = get_blog_option($blog_id, 'ust_post_auto_spammed');
    if (!$auto_spammed && !$post_auto_spammed) {
        //collect info
        $api_data = get_blog_option($blog_id, 'ust_signup_data');
        if (!$api_data) {
            $blog = $wpdb->get_row("SELECT * FROM {$wpdb->blogs} WHERE blog_id = '{$blog_id}'", ARRAY_A);
            $api_data['activate_user_ip'] = $wpdb->get_var("SELECT `IP` FROM {$wpdb->registration_log} WHERE blog_id = '{$blog_id}'");
            $api_data['user_email'] = $wpdb->get_var("SELECT `email` FROM {$wpdb->registration_log} WHERE blog_id = '{$blog_id}'");
            $api_data['blog_registered'] = $blog['registered'];
            $api_data['blog_domain'] = is_subdomain_install() ? str_replace('.' . $current_site->domain, '', $blog['domain']) : trim($blog['path'], '/');
            $api_data['blog_title'] = get_blog_option($blog_id, 'blogname');
        }
        $last = $wpdb->get_row("SELECT * FROM {$wpdb->base_prefix}ust WHERE blog_id = '{$blog_id}'");
        $api_data['last_user_id'] = $last->last_user_id;
        $api_data['last_ip'] = $last->last_ip;
        $api_data['last_user_agent'] = $last->last_user_agent;
        //latest post
        $post = $wpdb->get_row("SELECT post_title, post_content FROM `{$wpdb->base_prefix}{$blog_id}_posts` WHERE post_status = 'publish' AND post_type = 'post' AND ID != '1' ORDER BY post_date DESC LIMIT 1");
        if ($post) {
            $api_data['post_content'] = $post->post_title . "\n" . $post->post_content;
        }
        //send blog info to API
        ust_http_post('spam_blog', $api_data);
    }
}
Exemplo n.º 6
0
    function support_page()
    {
        global $current_user, $psts, $blog_id;
        $disabled = '';
        ?>
		<div class="wrap">
		<h2><?php 
        echo $psts->get_setting('ps_name');
        ?>
</h2>

	  <?php 
        if (isset($_POST['support-message']) && is_supporter()) {
            $message = wp_filter_nohtml_kses(stripslashes(trim($_POST['support-message'])));
            $support_email = $psts->get_setting('ps_email');
            $message_headers = "MIME-Version: 1.0\n" . "From: \"{$current_user->display_name}\" <{$current_user->user_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
            $subject = sprintf(__('Premium Support Request: %s', 'psts'), get_bloginfo('url'));
            $message = sprintf(__("%s has submitted a new premium support request for the site %s (%s).\nHere is their message:\n_______________________\n\n%s\n\n_______________________\nYou can reply to this email directly.", 'psts'), $current_user->display_name, get_bloginfo('name'), get_bloginfo('url'), $message);
            $message .= sprintf(__("Site Address: %s\n", 'psts'), site_url());
            $message .= sprintf(__("Site Admin: %s\n", 'psts'), admin_url());
            remove_filter('wp_mail_from', 'bp_core_email_from_address_filter');
            remove_filter('wp_mail_from_name', 'bp_core_email_from_name_filter');
            wp_mail($support_email, $subject, $message, $message_headers);
            echo '<div id="message" class="updated fade"><p>' . __('Your message has been sent! Someone will reply to your email shortly.', 'psts') . '</p></div>';
            $disabled = ' disabled="disabled"';
        }
        ?>
	  <p><?php 
        echo $psts->get_setting('ps_message');
        ?>
</p>
	  <h3><?php 
        _e('Your Support Question:', 'psts');
        ?>
</h3>
	  <?php 
        //show feature message
        if (!is_pro_site(false, $psts->get_setting('ps_level', 1))) {
            $notice = str_replace('LEVEL', $psts->get_level_setting($psts->get_setting('ps_level', 1), 'name'), $psts->get_setting('ps_notice'));
            echo '<div class="error"><p><a href="' . $psts->checkout_url($blog_id) . '">' . $notice . '</a></p></div>';
            $disabled = ' disabled="disabled"';
        }
        ?>
	  <form method="post" action="">
	  <textarea name="support-message" type="text" rows="10" wrap="soft" id="support-message" style="width: 100%"<?php 
        echo $disabled;
        ?>
></textarea>

	  <p class="submit">
	    <input type="submit" value="<?php 
        _e('Submit Request &raquo;', 'psts');
        ?>
"<?php 
        echo $disabled;
        ?>
 />
	  </p>
	  </form>
	  </div>
	  <?php 
    }
 /**
  * Check if current blog is a supporter blog
  *
  **/
 function is_supporter()
 {
     if (function_exists('is_supporter')) {
         return is_supporter();
     }
     return false;
 }