示例#1
0
function classic_get_static_css_url($device)
{
    if (wptouch_is_multisite_enabled()) {
        global $blog_id;
        return apply_filters('classic_static_css_url', WPTOUCH_TEMP_URL . '/classic-' . $device . '-' . $blog_id . '.css');
    } else {
        return apply_filters('classic_static_css_url', WPTOUCH_TEMP_URL . '/classic-' . $device . '.css');
    }
}
示例#2
0
function wptouch_is_multisite_secondary()
{
    if (wptouch_is_multisite_enabled()) {
        global $blog_id;
        return $blog_id > 1;
    } else {
        return false;
    }
}
function wptouch_should_show_license_nag()
{
    if (wptouch_is_multisite_enabled()) {
        $settings = wptouch_get_settings('bncid');
        if (is_plugin_active_for_network(WPTOUCH_PLUGIN_SLUG)) {
            return !$settings->license_accepted && current_user_can('manage_network_options');
        } else {
            return !$settings->license_accepted;
        }
    } else {
        return wptouch_can_show_license_menu();
    }
}
function wptouch_setup_multisite_tab()
{
    if (wptouch_is_multisite_enabled() && wptouch_is_multisite_primary()) {
        wptouch_add_tab(__('Multisite', 'wptouch-pro'), 'multisite', array(__('General', 'wptouch-pro') => array('multisite-general', array(array('section-start', 'multisite-admin-panel', __('Secondary Admin Panels', 'wptouch-pro')), array('checkbox', 'multisite_disable_theme_browser_tab', __('Disable Theme Browser tab', 'wptouch-pro')), array('checkbox', 'multisite_disable_push_notifications_pane', __('Disable Push Notifications pane', 'wptouch-pro')), array('checkbox', 'multisite_disable_overview_pane', __('Disable Overview pane', 'wptouch-pro')), array('checkbox', 'multisite_disable_advertising_pane', __('Disable Advertising pane', 'wptouch-pro')), array('checkbox', 'multisite_disable_statistics_pane', __('Disable Statistics pane', 'wptouch-pro')), array('checkbox', 'multisite_disable_manage_icons_pane', __('Disable Manage Icons pane', 'wptouch-pro')), array('checkbox', 'multisite_disable_compat_pane', __('Disable Compatability pane', 'wptouch-pro')), array('checkbox', 'multisite_disable_debug_pane', __('Disable Tools and Debug pane', 'wptouch-pro')), array('checkbox', 'multisite_disable_backup_pane', __('Disable Backup/Import pane', 'wptouch-pro')), array('section-end'))), __('Inherited Settings', 'wptouch-pro') => array('multisite-inherited', array(array('section-start', 'multisite-inherit', __('Inherited Settings', 'wptouch-pro')), array('checkbox', 'multisite_inherit_advertising', __('Inherit advertising settings', 'wptouch-pro')), array('checkbox', 'multisite_inherit_prowl', __('Inherit Prowl settings', 'wptouch-pro')), array('checkbox', 'multisite_inherit_statistics', __('Inherit Statistics settings', 'wptouch-pro')), array('checkbox', 'multisite_inherit_theme', __('Inherit active theme', 'wptouch-pro')), array('checkbox', 'multisite_inherit_compat', __('Inherit compatability settings', 'wptouch-pro')), array('section-end')))));
    }
}
示例#5
0
function wptouch_plugins_generate_hook_list($wptouch_pro, $settings)
{
    require_once WPTOUCH_DIR . '/core/file-operations.php';
    $php_files = wptouch_get_all_recursive_files(WP_PLUGIN_DIR, '.php');
    $plugin_whitelist = apply_filters('wptouch_plugin_whitelist', array('hello', 'akismet', 'wptouch', 'wptouch-pro', 'wptouch-pro-image-optimizer', 'wptouch-pro-3'));
    $new_plugin_list = array();
    foreach ($php_files as $plugin_file) {
        $path_info = explode(DIRECTORY_SEPARATOR, $plugin_file);
        if ($path_info[1] != 'index.php') {
            $plugin_slug = $path_info[1];
            if (stristr($plugin_slug, '.php')) {
                $plugin_slug = substr($plugin_slug, 0, strpos($plugin_slug, '.php'));
            }
            if (in_array($plugin_slug, $plugin_whitelist)) {
                continue;
            }
            $plugin_file_path = WP_PLUGIN_DIR . $plugin_file;
            $contents = $wptouch_pro->load_file($plugin_file_path);
            if (!isset($new_plugin_list[$plugin_slug])) {
                $new_plugin_list[$plugin_slug] = new stdClass();
            }
            // Default actions
            if (preg_match_all("#add_action\\([ ]*[\\'\"]+(.*)[\\'\"]+,[ ]*[\\'\"]+(.*)[\\'\"]+[ ]*(\\s*[,]\\s*+(.*))*\\)\\s*;#iU", $contents, $matches)) {
                for ($i = 0; $i < count($matches[0]); $i++) {
                    if (strpos($matches[2][$i], ' ') === false) {
                        $info = new stdClass();
                        $info->hook = $matches[1][$i];
                        $info->hook_function = $matches[2][$i];
                        if (isset($matches[4][$i]) && $matches[4][$i] > 0) {
                            $info->priority = $matches[4][$i];
                        } else {
                            $info->priority = false;
                        }
                        $new_plugin_list[$plugin_slug]->actions[] = $info;
                    }
                }
            }
            // Default filters
            if (preg_match_all("#add_filter\\([ ]*[\\'\"]+(.*)[\\'\"]+,[ ]*[\\'\"]+(.*)[\\'\"]+[ ]*(\\s*[,]\\s*+(.*))*\\)\\s*;#iU", $contents, $matches)) {
                for ($i = 0; $i < count($matches[0]); $i++) {
                    if (strpos($matches[2][$i], ' ') === false) {
                        $info = new stdClass();
                        $info->hook = $matches[1][$i];
                        $info->hook_function = $matches[2][$i];
                        if (isset($matches[4][$i]) && $matches[4][$i] > 0) {
                            $info->priority = $matches[4][$i];
                        } else {
                            $info->priority = false;
                        }
                        $new_plugin_list[$plugin_slug]->filters[] = $info;
                    }
                }
            }
        }
    }
    // Create list of active plugins
    $active_plugins = get_option('active_plugins');
    if (!$active_plugins) {
        $active_plugins = array();
    }
    // Check for network activated plugins
    if (wptouch_is_multisite_enabled()) {
        $active_site_plugins = get_site_option('active_sitewide_plugins');
        if (is_array($active_site_plugins) && count($active_site_plugins)) {
            foreach ($active_site_plugins as $key => $value) {
                if (!in_array($key, $active_plugins)) {
                    $active_plugins[] = $key;
                }
            }
        }
    }
    $active_plugin_names = array();
    if (is_array($active_plugins) && count($active_plugins)) {
        foreach ($active_plugins as $plugin) {
            if (!($name = substr($plugin, 0, strpos($plugin, DIRECTORY_SEPARATOR)))) {
                $name = substr($plugin, 0, strpos($plugin, '.php'));
            }
            $active_plugin_names[] = $name;
        }
    }
    $final_hook_list = array();
    if (count($new_plugin_list)) {
        // Filter based on this list
        $usable_plugins = array();
        foreach ($new_plugin_list as $name => $info) {
            if (in_array($name, $active_plugin_names)) {
                $final_hook_list[$name] = $info;
            }
        }
    }
    $wptouch_pro->plugin_hooks = apply_filters('wptouch_plugin_exclusion_list', $final_hook_list);
    @ksort($wptouch_pro->plugin_hooks);
    $settings->plugin_hooks = $wptouch_pro->plugin_hooks;
    $settings->save();
}
示例#6
0
function wptouch_settings_process($wptouch_pro)
{
    if (isset($wptouch_pro->post['wptouch-reset-3'])) {
        $wptouch_pro->verify_post_nonce();
        // Clear the cookie
        setcookie('wptouch-admin-menu', 0, time() - 3600);
        WPTOUCH_DEBUG(WPTOUCH_INFO, "Settings are being reset");
        $wptouch_pro->erase_all_settings();
        $wptouch_pro->reset_icon_states();
        $wptouch_pro->reload_settings();
        require_once WPTOUCH_DIR . '/core/menu.php';
        // Check for multisite reset
        if (wptouch_is_multisite_enabled() && wptouch_is_multisite_primary()) {
            delete_site_option(WPTOUCH_MULTISITE_LICENSED);
        }
        $wptouch_pro->redirect_to_page(admin_url('admin.php?page=wptouch-admin-touchboard'));
        wptouch_delete_all_transients();
    } else {
        if (isset($wptouch_pro->post['wptouch-submit-3'])) {
            $wptouch_pro->verify_post_nonce();
            if (isset($wptouch_pro->post['wptouch_restore_settings']) && strlen($wptouch_pro->post['wptouch_restore_settings'])) {
                require_once 'admin-backup-restore.php';
                wptouch_restore_settings($wptouch_pro->post['wptouch_restore_settings']);
                return;
            }
            $new_settings = array();
            $modified_domains = array();
            // Search for all the settings to update
            foreach ($wptouch_pro->post as $key => $content) {
                if (preg_match('#^wptouch__(.*)__(.*)#', $key, $match)) {
                    $setting_domain = $match[1];
                    $setting_name = $match[2];
                    // Decode slashes on strings
                    if (is_string($content)) {
                        $content = htmlspecialchars_decode($content);
                    }
                    $new_settings[$setting_domain][$setting_name] = apply_filters('wptouch_modify_setting__' . $setting_domain . '__' . $setting_name, $content);
                    // Flag which domains have been modified
                    $modified_domains[$setting_domain] = 1;
                    if (isset($wptouch_pro->post['hid-wptouch__' . $match[1] . '__' . $match[2]])) {
                        // This is a checkbox
                        $new_settings[$setting_domain][$setting_name] = 1;
                    }
                }
            }
            // Do a loop and find all the checkboxes that should be disabled
            foreach ($wptouch_pro->post as $key => $content) {
                if (preg_match('#^hid-wptouch__(.*)__(.*)#', $key, $match)) {
                    $setting_domain = $match[1];
                    $setting_name = $match[2];
                    $new_settings[$setting_domain][$setting_name] = isset($new_settings[$setting_domain][$setting_name]) ? 1 : 0;
                    $modified_domains[$setting_domain] = 1;
                }
            }
            // Update all the domains that have been modified
            foreach ($modified_domains as $domain => $ignored_value) {
                $settings = $wptouch_pro->get_settings($domain);
                // Update settings with new values
                foreach ($new_settings[$domain] as $key => $value) {
                    if (isset($settings->{$key})) {
                        $settings->{$key} = $value;
                    }
                }
                $settings->save();
            }
            // Handle automatic backup
            $settings = wptouch_get_settings();
            if ($settings->automatically_backup_settings) {
                require_once 'admin-backup-restore.php';
                wptouch_backup_settings();
            }
            wptouch_delete_all_transients();
        }
    }
}
    ?>
	<?php 
} else {
    if (!$settings->admin_client_mode_hide_licenses && !wptouch_is_multisite_secondary()) {
        ?>
	
	<br class="clearer" />
	
	<div id="unlicensed-board" class="round-3">
		<strong><?php 
        echo sprintf(__("This copy of WPtouch Pro %s is unlicensed.", "wptouch-pro"), wptouch_get_bloginfo('version'));
        ?>
</strong>

		<?php 
        if (!wptouch_is_multisite_enabled() || wptouch_is_multisite_enabled() && wptouch_is_multisite_primary()) {
            ?>
			<a href="#pane-5" class="wptouch-admin-switch" rel="account"><?php 
            _e("Get started with Activation &raquo;", "wptouch-pro");
            ?>
</a>
		<?php 
        }
        ?>
	</div>
	<?php 
    }
}
?>

</div><!-- wptouch-setting -->