Пример #1
0
        /** ====================================================================================================================================================
         * This function displays the configuration page of the core 
         * 
         * @access private
         * @return void
         */
        function sedlex_information()
        {
            global $submenu;
            global $blog_id;
            global $SLpluginActivated;
            echo get_option('plugin_error_on_activation');
            update_option('plugin_error_on_activation', "");
            if (is_multisite() && $blog_id == 1 || !is_multisite()) {
                ob_start();
                $params = new SLFramework_Parameters($this->frmk);
                $params->add_title(__('Log options', 'SL_framework'));
                $params->add_param("debug_level", __('What is the debug level:', 'SL_framework'));
                $params->add_comment("<a href='" . str_replace(WP_CONTENT_DIR, content_url(), SLFramework_Debug::get_log_path()) . "' target='_blank'>" . __('See the debug logs', 'SL_framework') . "</a>");
                $params->add_comment(__('1=log only the critical errors;', 'SL_framework'));
                $params->add_comment(__('2=log only the critical errors and the standard errors;', 'SL_framework'));
                $params->add_comment(__('3=log only the critical errors, the standard errors and the warnings;', 'SL_framework'));
                $params->add_comment(__('4=log information;', 'SL_framework'));
                $params->add_comment(__('5=log verbose;', 'SL_framework'));
                if (is_multisite()) {
                    $params->add_title(__('Multisite Management', 'SL_framework'));
                    $params->add_param("global_allow_translation_by_blogs", __('Do you want to allow sub-blogs to modify the translations of the plugins:', 'SL_framework'));
                    $params->add_comment(__("If this option is unchecked, the translation tab won't be displayed in the blog administration panel.", 'SL_framework'));
                }
                $params->add_title(__('Location of the SL plugins', 'SL_framework'));
                $params->add_param("global_location_plugin", __('Where do you want to display the SL plugins:', 'SL_framework'));
                echo $params->flush();
                $paramSave = ob_get_clean();
                echo "<a name='top'></a>";
            }
            //Information about the SL plugins
            ?>
			<div class="wrap">
				<div id="icon-themes" class="icon32"><br/></div>
				<h2><?php 
            echo __('Summary page for the plugins developped with the SL framework', 'SL_framework');
            ?>
</h2>
			</div>
			<div style="padding:20px;">
				<?php 
            echo $this->signature;
            ?>
				<p>&nbsp;</p>
				<?php 
            $plugins = get_plugins();
            $all_nb = 0;
            foreach ($plugins as $url => $data) {
                if (is_plugin_active($url)) {
                    $all_nb++;
                }
            }
            $sl_count = 0;
            foreach ($SLpluginActivated as $ov) {
                $sl_count++;
            }
            ?>
				<p><?php 
            printf(__("For now, you have installed %s plugins including %s plugins developped with the SedLex's framework", 'SL_framework'), $all_nb, $sl_count - 1);
            ?>
<p/>
				<p><?php 
            printf(__("The core plugin is located at %s", 'SL_framework'), "<code>" . str_replace(ABSPATH, "", SL_FRAMEWORK_DIR) . "</code>");
            ?>
<p/>
<?php 
            //======================================================================================
            //= Tab listing all the plugins
            //======================================================================================
            $tabs = new SLFramework_Tabs();
            ob_start();
            $table = new SLFramework_Table();
            $table->title(array(__("Plugin name", 'SL_framework'), __("Description", 'SL_framework')));
            $ligne = 0;
            foreach ($SLpluginActivated as $i => $url) {
                $ligne++;
                $plugin_name = explode("/", $url);
                if (isset($plugin_name[count($plugin_name) - 2])) {
                    $plugin_name = $plugin_name[count($plugin_name) - 2];
                } else {
                    $plugin_name = "?";
                }
                if ($i != 0) {
                    $info = pluginSedlex::get_plugins_data(WP_PLUGIN_DIR . "/" . $url);
                    ob_start();
                    ?>
								<p><b><?php 
                    echo $info['Plugin_Name'];
                    ?>
</b></p>
								<p><a href='admin.php?page=<?php 
                    echo $url;
                    ?>
'><?php 
                    echo __('Settings', 'SL_framework');
                    ?>
</a> | <?php 
                    echo SLFramework_Utils::byteSize(SLFramework_Utils::dirSize(dirname(WP_PLUGIN_DIR . '/' . $url)));
                    ?>
</p>
							<?php 
                    $cel1 = new adminCell(ob_get_clean());
                    ob_start();
                    $database = "";
                    if ($info['Database'] != "") {
                        $database = "<img src='" . plugin_dir_url("/") . '/' . str_replace(basename(__FILE__), "", plugin_basename(__FILE__)) . "core/img/database.png" . "' alt='" . __('There is a SQL database for this plugin', 'SL_framework') . "'/>";
                    }
                    ?>
								<p><?php 
                    echo str_replace("<ul>", "<ul style='list-style-type:circle; padding-left:1cm;'>", $info['Description']);
                    ?>
</p>
								<p><?php 
                    echo sprintf(__('Version: %s by %s', 'SL_framework'), $info['Version'], $info['Author']);
                    ?>
 (<a href='<?php 
                    echo $info['Author_URI'];
                    ?>
'><?php 
                    echo $info['Author_URI'];
                    ?>
</a>)<?php 
                    echo $database;
                    ?>
</p>
								<?php 
                    $cel2 = new adminCell(ob_get_clean());
                    $table->add_line(array($cel1, $cel2), '1');
                }
            }
            echo $table->flush();
            $tabs->add_tab(__('List of SL plugins', 'SL_framework'), ob_get_clean(), plugin_dir_url("/") . '/' . str_replace(basename(__FILE__), "", plugin_basename(__FILE__)) . "core/img/tab_list.png");
            if (is_multisite() && $blog_id == 1 || !is_multisite()) {
                //======================================================================================
                //= Tab for parameters
                //======================================================================================
                $tabs->add_tab(__('Parameters of the framework', 'SL_framework'), $paramSave, plugin_dir_url("/") . '/' . str_replace(basename(__FILE__), "", plugin_basename(__FILE__)) . "core/img/tab_param.png");
            }
            if (is_multisite() && $blog_id == 1 || !is_multisite() || $this->frmk->get_param('global_allow_translation_by_blogs')) {
                //======================================================================================
                //= Tab for the translation
                //======================================================================================
                ob_start();
                $plugin = str_replace("/", "", str_replace(basename(__FILE__), "", plugin_basename(__FILE__)));
                $trans = new SLFramework_Translation("SL_framework", $plugin);
                $trans->enable_translation();
                $tabs->add_tab(__('Manage translation of the framework', 'SL_framework'), ob_get_clean(), plugin_dir_url("/") . '/' . str_replace(basename(__FILE__), "", plugin_basename(__FILE__)) . "core/img/tab_trad.png");
            }
            echo $tabs->flush();
            echo $this->signature;
            ?>
			</div>
			<?php 
        }
Пример #2
0
 /** ====================================================================================================================================================
  * In order to uninstall the plugin, few things are to be done ... 
  * (do not modify this function)
  * 
  * @return void
  */
 public function uninstall_removedata()
 {
     global $wpdb;
     // DELETE OPTIONS
     delete_option('backup_scheduler' . '_options');
     if (is_multisite()) {
         delete_site_option('backup_scheduler' . '_options');
     }
     // DELETE SQL
     if (function_exists('is_multisite') && is_multisite()) {
         $old_blog = $wpdb->blogid;
         $old_prefix = $wpdb->prefix;
         // Get all blog ids
         $blogids = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM " . $wpdb->blogs));
         foreach ($blogids as $blog_id) {
             switch_to_blog($blog_id);
             $wpdb->query("DROP TABLE " . str_replace($old_prefix, $wpdb->prefix, $wpdb->prefix . "pluginSL_" . 'backup_scheduler'));
         }
         switch_to_blog($old_blog);
     } else {
         $wpdb->query("DROP TABLE " . $wpdb->prefix . "pluginSL_" . 'backup_scheduler');
     }
     // DELETE FILES if needed
     SLFramework_Utils::rm_rec(WP_CONTENT_DIR . "/sedlex/backup-scheduler/");
     $plugins_all = get_plugins();
     $nb_SL = 0;
     foreach ($plugins_all as $url => $pa) {
         $info = pluginSedlex::get_plugins_data(WP_PLUGIN_DIR . "/" . $url);
         if ($info['Framework_Email'] == "*****@*****.**") {
             $nb_SL++;
         }
     }
     if ($nb_SL == 1) {
         SLFramework_Utils::rm_rec(WP_CONTENT_DIR . "/sedlex/");
     }
 }