options = array(); $this->version = '0.3.1'; global $wp_version; if (version_compare(phpversion(), '5.2.4', '<')) wp_die('ZigDashNote requires PHP 5.2.4 or newer. Please update your server.'); if (version_compare($wp_version, '3.1', '<')) $this->AutoDeactivate('ZigDashNote requires WordPress 3.1 or newer. Please update your installation.'); add_action('wp_dashboard_setup', array($this, 'action_wp_dashboard_setup')); add_filter('plugin_row_meta', array($this, 'filter_plugin_row_meta'), 10, 2 ); } public function activate() { $this->options = $this->get_or_create_options(); update_option('zigdashnote_options', $this->options); } public function deactivate() {} public function action_wp_dashboard_setup() { $this->options = get_option('zigdashnote_options'); wp_add_dashboard_widget('ZigDashNote', $this->options['title'], array($this, 'output'), array($this, 'control')); } public function filter_plugin_row_meta($links, $file) { $plugin = plugin_basename(__FILE__); if ($file == $plugin) return array_merge($links, array('Donate')); return $links; } private function get_or_create_options() { $defaults = array('title'=>'ZigDashNote', 'text'=>'Your text here', 'credit'=>1); if ((!$this->options = get_option('zigdashnote_options')) || !is_array($this->options)) $this->options = array(); return array_merge($defaults, $this->options); } public function output() { echo wpautop($this->options['text']); if ($this->options['credit']) { ?>
Title:
Show credit: options['credit'] == 1) ? 'checked="checked"' : ''?> />