'aio_button', 'default_animation' => 'none', 'default_color' => 'red', 'default_size' => 'small', 'default_text' => __('Download Now','aiobtn') ); update_option('aiobtn_options',$default); } } /** * Runs when the plugin is initialized */ public function init() { // Setup localization load_plugin_textdomain( 'aiobtn', false, dirname( plugin_basename( __FILE__ ) ) . '/lang' ); // Load JavaScript and Stylesheets $this->register_scripts_and_styles(); // Add action links in Plugins page add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'action_links' ) ); // Add meta links in Plugins page add_filter( 'plugin_row_meta', array( $this, 'meta_links' ), 10, 2 ); add_filter('widget_text', 'do_shortcode'); // Allow shortcode in widgets add_filter('comment_text', 'do_shortcode'); // Allow shortcode in comments add_filter('the_excerpt', 'do_shortcode'); // Allow shortcode in excerpt } /** * Registers and enqueues stylesheets for the administration panel and the * public facing site. */ private function register_scripts_and_styles() { if ( is_admin() ) { if (isset($_GET['page']) && $_GET['page'] == 'aiobtn') { $this->load_file( self::slug . '-admin-script', '/js/admin.min.js', true ); } } } // end register_scripts_and_styles /** * Helper function for registering and enqueueing scripts and styles. * * @name The ID to register with WordPress * @file_path The path to the actual file * @is_script Optional argument for if the incoming file_path is a JavaScript source file. */ private function load_file( $name, $file_path, $is_script = false ) { $url = plugins_url($file_path, __FILE__); $file = plugin_dir_path(__FILE__) . $file_path; if( file_exists( $file ) ) { if( $is_script ) { wp_register_script( $name, $url, array('jquery') ); //depends on jquery wp_enqueue_script( $name ); } else { wp_register_style( $name, $url ); wp_enqueue_style( $name ); } // end if } // end if } // end load_file // Add action links in Plugins page public function action_links( $links ) { return array_merge( array( 'settings' => '' . __( 'Settings', 'aiobtn' ) . '' ), $links ); } // Add meta links in Plugins page public function meta_links( $links, $file ) { $plugin = plugin_basename(__FILE__); // create link if ( $file == $plugin ) { return array_merge( $links, array( ''.__('Twitter', 'aiobtn').'' ) ); } return $links; } } // end class new AIOButtons(); ?>