load_options(); $this->define_constants(); $this->load_dependencies(); register_activation_hook( plugin_basename( dirname(__FILE__)).'/auto-anchor-list.php', array(&$this, 'activate') ); register_sidebar_widget('MWM Auto Anchor List', array(&$this, 'widget')); } function load_options(){ // Load the options $this->options = get_option('mwm_aal_options'); } function define_constants() { // define URL define('MWMAALFOLDER', plugin_basename( dirname(__FILE__)) ); define('MWMAAL_URLPATH', WP_PLUGIN_URL . '/' . plugin_basename( dirname(__FILE__) ) . '/' ); } function load_dependencies(){ // Load backend libraries if ( is_admin() ) { require_once (dirname (__FILE__) . '/admin/admin.php'); $this->mwm_aalAdminPanel = new mwm_aalAdminPanel(); // Load frontend libraries } else { if($this->options['activatePlugin']){ require_once (dirname (__FILE__) . '/mwm-aal-class.php'); global $mwm_aal; } } } function activate(){ $options = get_option('mwm_aal_options'); if ( empty( $options ) ){ $mwm_aal_options['activatePlugin'] = true; $mwm_aal_options['activateCSS'] = true; $mwm_aal_options['autoDisplayInContent'] = true; $mwm_aal_options['displayTitle'] = "Contents"; $mwm_aal_options['contentColumnCount'] = 2; $mwm_aal_options['is_home'] = true; $mwm_aal_options['is_single'] = true; $mwm_aal_options['is_page'] = true; $mwm_aal_options['is_category'] = true; $mwm_aal_options['is_tag'] = true; $mwm_aal_options['is_date'] = true; $mwm_aal_options['is_author'] = true; $mwm_aal_options['is_search'] = true; update_option('mwm_aal_options', $mwm_aal_options); } } /** * Show a error messages */ function show_error($message) { echo '

' . $message . '

' . "\n"; } /** * Show a system messages */ function show_message($message) { echo '

' . $message . '

' . "\n"; } /** * widget * * The sidebar widget */ function widget($args){ extract($args); //Manditory before widget junk echo $before_widget; echo '
  • '; global $mwm_aal; $mwm_aal->output_sidebar_links(); echo '
  • '; //Manditory after widget junk echo $after_widget; } } //Start Loader global $mwm_aalLoader; $mwm_aalLoader = new mwm_aalLoader(); }