The description of the plugin on this line.
Version: 1.0.0 Framework: SL_Framework Author: The name of the author Author URI: http://www.yourdomain.com/ Author Email: youremail@yourdomain.com Framework Email: sedlex@sedlex.fr Plugin URI: http://wordpress.org/plugins/my-plugin/ License: GPL3 */ //Including the framework in order to make the plugin work require_once('core.php') ; /** ==================================================================================================================================================== * This class has to be extended from the pluginSedLex class which is defined in the framework */ class my_plugin extends pluginSedLex { /** ==================================================================================================================================================== * Plugin initialization * * @return void */ static $instance = false; protected function _init() { global $wpdb ; // Name of the plugin (Please modify) $this->pluginName = 'My Plugin' ; // Name of the upper level of menu (Please modify, ex. "Your upper menu") $this->upper_level_menu = '' ; // The structure of the SQL table if needed (for instance, 'id_post mediumint(9) NOT NULL, short_url TEXT DEFAULT '', UNIQUE KEY id_post (id_post)') $this->tableSQL = "" ; // If you want a plurality of table //$this->tableSQL = array() ; //$this->tableSQL[] = "" ; //$this->tableSQL[] = "" ; // The name of the SQL table (Do no modify except if you know what you do) $this->table_name = $wpdb->prefix . "pluginSL_" . get_class() ; // If you want a plurality of table //$this->table_name = array() ; //$this->table_name[] = $wpdb->prefix . "pluginSL_" . "table1" ; //$this->table_name[] = $wpdb->prefix . "pluginSL_" . "table2" ; //Initilisation of plugin variables if needed (Please modify) $this->your_var1 = 1 ; $this->your_var2 = array() ; $this->your_varn = "n" ; //Configuration of callbacks, shortcode, ... (Please modify) // For instance, see // - add_shortcode (http://codex.wordpress.org/Function_Reference/add_shortcode) // - add_action // - http://codex.wordpress.org/Function_Reference/add_action // - http://codex.wordpress.org/Plugin_API/Action_Reference // - add_filter // - http://codex.wordpress.org/Function_Reference/add_filter // - http://codex.wordpress.org/Plugin_API/Filter_Reference // Be aware that the second argument should be of the form of array($this,"the_function") // For instance add_action( "wp_ajax_foo", array($this,"bar")) : this function will call the method 'bar' when the ajax action 'foo' is called // Important variables initialisation (Do not modify) $this->path = __FILE__ ; $this->pluginID = get_class() ; // activation and deactivation functions (Do not modify) register_activation_hook(__FILE__, array($this,'install')); register_deactivation_hook(__FILE__, array($this,'deactivate')); register_uninstall_hook(__FILE__, array('my_plugin','uninstall_removedata')); } /** ==================================================================================================================================================== * In order to uninstall the plugin, few things are to be done ... * (do not modify this function) * * @return void */ static public function uninstall_removedata () { global $wpdb ; // DELETE OPTIONS delete_option('my_plugin'.'_options') ; if (is_multisite()) { delete_site_option('my_plugin'.'_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_" . 'my_plugin')) ; } switch_to_blog($old_blog); } else { $wpdb->query("DROP TABLE ".$wpdb->prefix . "pluginSL_" . 'my_plugin' ) ; } // DELETE FILES if needed //SLFramework_Utils::rm_rec(WP_CONTENT_DIR."/sedlex/my_plugin/"); $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']=="sedlex@sedlex.fr"){ $nb_SL++ ; } } if ($nb_SL==1) { SLFramework_Utils::rm_rec(WP_CONTENT_DIR."/sedlex/"); } } /**==================================================================================================================================================== * Function called when the plugin is activated * For instance, you can do stuff regarding the update of the format of the database if needed * If you do not need this function, you may delete it. * * @return void */ public function _update() { SLFramework_Debug::log(get_class(), "Update the plugin." , 4) ; } /**==================================================================================================================================================== * Function called to return a number of notification of this plugin * This number will be displayed in the admin menu * * @return int the number of notifications available */ public function _notify() { return 0 ; } /** ==================================================================================================================================================== * Init javascript for the public side * If you want to load a script, please type : *wp_enqueue_script( 'jsapi', 'https://www.google.com/jsapi'); or
* wp_enqueue_script('my_plugin_script', plugins_url('/script.js', __FILE__));
* $this->add_inline_js($js_text);
* $this->add_js($js_url_file);
*
* @return void
*/
function _public_js_load() {
return ;
}
/** ====================================================================================================================================================
* Init css for the public side
* If you want to load a style sheet, please type :
* $this->add_inline_css($css_text);
* $this->add_css($css_url_file);
*
* @return void
*/
function _public_css_load() {
return ;
}
/** ====================================================================================================================================================
* Init javascript for the admin side
* If you want to load a script, please type :
* wp_enqueue_script( 'jsapi', 'https://www.google.com/jsapi'); or
* wp_enqueue_script('my_plugin_script', plugins_url('/script.js', __FILE__));
* $this->add_inline_js($js_text);
* $this->add_js($js_url_file);
*
* @return void
*/
function _admin_js_load() {
return ;
}
/** ====================================================================================================================================================
* Init css for the admin side
* If you want to load a style sheet, please type :
* $this->add_inline_css($css_text);
* $this->add_css($css_url_file);
*
* @return void
*/
function _admin_css_load() {
return ;
}
/** ====================================================================================================================================================
* Called when the content is displayed
*
* @param string $content the content which will be displayed
* @param string $type the type of the article (e.g. post, page, custom_type1, etc.)
* @param boolean $excerpt if the display is performed during the loop
* @return string the new content
*/
function _modify_content($content, $type, $excerpt) {
return $content;
}
/** ====================================================================================================================================================
* Add a button in the TinyMCE Editor
*
* To add a new button, copy the commented lines a plurality of times (and uncomment them)
*
* @return array of buttons
*/
function add_tinymce_buttons() {
$buttons = array() ;
//$buttons[] = array(__('title', $this->pluginID), '[tag]', '[/tag]', plugin_dir_url("/").'/'.str_replace(basename( __FILE__),"",plugin_basename( __FILE__)).'img/img_button.png') ;
return $buttons ;
}
/**====================================================================================================================================================
* Function to instantiate the class and make it a singleton
* This function is not supposed to be modified or called (the only call is declared at the end of this file)
*
* @return void
*/
public static function getInstance() {
if ( !self::$instance ) {
self::$instance = new self;
}
return self::$instance;
}
/** ====================================================================================================================================================
* Define the default option values of the plugin
* This function is called when the $this->get_param function do not find any value fo the given option
* Please note that the default return value will define the type of input form: if the default return value is a:
* - string, the input form will be an input text
* - integer, the input form will be an input text accepting only integer
* - string beggining with a '*', the input form will be a textarea
* - boolean, the input form will be a checkbox
* - array, the input form will be a list, the entry beginning with a * will be the default one
* - "[file]", an upload of file may be possible (prefer the media tag)
* - "[password]" the entry will be a password field
* - "[media]" you can select a media in the media library
* - "[page]" you may selected a page
*
* @param string $option the name of the option
* @return variant of the option
*/
public function get_default_option($option) {
switch ($option) {
// Alternative default return values (Please modify)
case 'opt1' : return "Default" ; break ;
case 'opt2' : return false ; break ;
case 'opt3' : return 1 ; break ;
case 'opt4' : return "*Hi everyone !" ; break ;
}
return null ;
}
/** ====================================================================================================================================================
* The admin configuration page
* This function will be called when you select the plugin in the admin backend
*
* @return void
*/
public function configuration_page() {
global $wpdb;
global $blog_id ;
SLFramework_Debug::log(get_class(), "Print the configuration page." , 4) ;
?>
pluginID) ;?>
check_folder_rights( array(array(WP_CONTENT_DIR."/sedlex/test/", "rwx")) ) ; $tabs = new SLFramework_Tabs() ; ob_start() ; // Examples for creating tables //---------------------------------- echo "