Example #1
0
/**
 * Creates the tables needed for proper functioning of the plugin.
 * @return bool TRUE in case of success, FALSE otherwise.
 */
function createTables()
{
    global $wpdb;
    $sql = "CREATE TABLE IF NOT EXISTS `" . \CEOS\Slider\PLUGIN_PREFIX . "sliders` (\n\t\t\t`slid_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,\n\t\t\t`slid_title` TINYTEXT NOT NULL,\n\t\t\t`slid_opt_interval` FLOAT UNSIGNED NOT NULL DEFAULT '8000',\n\t\t\t`slid_opt_transition_duration` FLOAT UNSIGNED NOT NULL DEFAULT '300',\n\t\t\t`slid_opt_transition_name` VARCHAR(64) NOT NULL DEFAULT 'fade crossover',\n\t\t\t`slid_opt_init_delay` FLOAT UNSIGNED NOT NULL DEFAULT '0',\n\t\t\t`slid_opt_mouseover_pause` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1',\n\t\t\t`slid_opt_show_next_prev` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1',\n\t\t\t`slid_opt_show_nav` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1',\n\t\t\t`slid_opt_show_interval` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1',\n\t\t\t`slid_opt_restart` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1',\n\t\t\t`slid_opt_width` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '1920',\n\t\t\t`slid_opt_height` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '640',\n\t\t\t`slid_opt_aspect_ratio` FLOAT UNSIGNED NOT NULL DEFAULT '0.3232',\n\t\t\t`slid_opt_initial_item` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0',\n\t\t\t`slid_opt_adaptative` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1',\n\t\t\tPRIMARY KEY (`slid_id`)\n\t\t) ENGINE=InnoDB;";
    if (!$wpdb->query($sql)) {
        deactivate_plugin(\CEOS\Slider\PLUGIN_FILE);
        wp_die(__('An error occurred while trying to create the necessary resources for CEOS Slider.'));
    }
    $sql = "CREATE TABLE IF NOT EXISTS `" . \CEOS\Slider\PLUGIN_PREFIX . "items` (\n\t\t\t`item_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,\n\t\t\t`item_slider_id` BIGINT(20) UNSIGNED NOT NULL,\n\t\t\t`item_title` TINYTEXT NOT NULL,\n\t\t\t`item_desc` TEXT NOT NULL,\n\t\t\t`item_url` TINYTEXT NOT NULL,\n\t\t\t`item_imgsrc` TEXT NOT NULL,\n\t\t\t`item_transition` CHAR(64) NOT NULL,\n\t\t\t`item_transition_duration` FLOAT UNSIGNED NOT NULL,\n\t\t\t`item_interval` FLOAT UNSIGNED NOT NULL,\n\t\t\tPRIMARY KEY (`item_id`),\n\t\t\tINDEX `parent_slider` (`item_slider_id`)\n\t\t) ENGINE=InnoDB;";
    if (!$wpdb->query($sql)) {
        deactivate_plugin(\CEOS\Slider\PLUGIN_FILE);
        wp_die(__('An error occurred while trying to create the necessary resources for CEOS Slider.'));
    }
}
Example #2
0
    global $current_plugins;
    if (!isset($current_plugins[md5($plugin_file)])) {
        return false;
    }
    if (!validate_plugin($plugin_file)) {
        return false;
    }
    unset($current_plugins[md5($plugin_file)]);
    $data = new DataHandler();
    $data->save('plugins.data', serialize($current_plugins));
    return true;
}
if (isset($_REQUEST['activate_plugin'])) {
    activate_plugin($_REQUEST['activate_plugin']);
} elseif (isset($_REQUEST['deactivate_plugin'])) {
    deactivate_plugin($_REQUEST['deactivate_plugin']);
}
if (!empty($_POST['action']) && $_POST['action'] == 'settings' && !empty($_POST['_nonce'])) {
    if (!check_nonce($_POST['_nonce'])) {
        lilina_nice_die('Nonces do not match.');
    }
    clear_html_cache();
    /** Needs better validation */
    if (!empty($_POST['sitename'])) {
        update_option('sitename', $_REQUEST['sitename']);
    }
    if (!empty($_POST['template'])) {
        update_option('template', $_REQUEST['template']);
    }
    if (!empty($_POST['locale'])) {
        update_option('locale', $_REQUEST['locale']);
Example #3
0
 /**
  * Uninstall
  *
  * Uninstall a plugin
  *
  * @access	public   		 
  */
 function uninstall($plugin_name)
 {
     deactivate_plugin($plugin_name);
     $this->session->set_flashdata('notif', 'Plugin ' . $plugin_name . ' successfully uninstalled');
     redirect('pluginss');
 }
Example #4
0
$plugins_dir = dirname(__FILE__)."/../../plugins/";

$avail_plugins = array();
if (isset($_REQUEST['activate'])){ # Activate a plugin
    $inst_name = trim(getvalescaped('activate',''), '#');
    if ($inst_name!=''){
        activate_plugin($inst_name);   
    }
    redirect($baseurl_short.'pages/team/team_plugins.php');    # Redirect back to the plugin page so plugin is actually activated. 
    
}
elseif (isset($_REQUEST['deactivate'])){ # Deactivate a plugin
    # Strip the leading hash mark added by javascript.
    $remove_name = trim(getvalescaped('deactivate',''), "#");
    if ($remove_name!=''){
        deactivate_plugin($remove_name); 
    }
    redirect($baseurl_short.'pages/team/team_plugins.php');    # Redirect back to the plugin page so plugin is actually deactivated.
}
elseif (isset($_REQUEST['purge'])){ # Purge a plugin's configuration (if stored in DB)
    # Strip the leading hash mark added by javascript.
    $purge_name = trim(getvalescaped('purge',''), '#');
    if ($purge_name!=''){
        purge_plugin_config($purge_name);
    }
    
}
/****
  The delete functionality is commented out of the svn version since it hasn't
  been fully checked to avoid vulnerabilities.  Feel free to add anything to
  help make it more secure.
Example #5
0
      * @param string $pluginName
      *            The plugin's base name.
      */
     $app->hook->do_action('deactivate_plugin', $pluginName);
     /**
      * Fires as a specifig plugin is being deactivated.
      *
      * $pluginName refers to the plugin's
      * name (i.e. moodle.plugin.php).
      *
      * @since 6.1.00
      * @param string $pluginName
      *            The plugin's base name.
      */
     $app->hook->do_action('deactivate_' . $pluginName);
     deactivate_plugin($pluginName);
     /**
      * Fires after a specific plugin has been deactivated.
      *
      * $pluginName refers to the plugin's
      * name (i.e. moodle.plugin.php).
      *
      * @since 6.1.06
      * @param string $pluginName
      *            The plugin's base name.
      */
     $app->hook->do_action('deactivated_plugin', $pluginName);
     redirect($app->req->server['HTTP_REFERER']);
 });
 $app->match('GET|POST', '/options/', function () use($app, $css, $js) {
     $app->view->display('plugins/options', ['title' => _t('Plugin Options'), 'cssArray' => $css, 'jsArray' => $js]);