public function show_settings() { if (!current_user_can('manage_options')) { wp_die(__('You do not have sufficient permissions to access this page.')); } $out = ''; if (!isset($_GET['tab'])) { $_GET['tab'] = 'general'; } // check for changed settings if (isset($_GET['settings-updated'])) { // show "settings saved" message $out .= '<div id="message" class="updated"> <p><strong>' . __('Settings saved.', 'event-list') . '</strong></p> </div>'; // check feed rewrite status and update it if required if ('feed' == $_GET['tab']) { require_once EL_PATH . 'includes/feed.php'; EL_Feed::get_instance()->update_feed_rewrite_status(); } } // normal output $out .= ' <div class="wrap"> <div id="icon-edit-pages" class="icon32"><br /></div><h2>' . __('Event List Settings', 'event-list') . '</h2>'; $out .= $this->show_tabs($_GET['tab']); $out .= '<div id="posttype-page" class="posttypediv">'; $out .= $this->functions->show_option_form($_GET['tab']); $out .= ' </div> </div>'; echo $out; }
/** * Constructor: * Initializes the plugin. */ public function __construct() { $this->shortcode = null; $this->styles_loaded = false; // ALWAYS: // Register shortcodes add_shortcode('event-list', array(&$this, 'shortcode_event_list')); // Register widgets add_action('widgets_init', array(&$this, 'widget_init')); // Add RSS Feed page $options = EL_Options::get_instance(); if ($options->get('el_enable_feed')) { include_once EL_PATH . 'includes/feed.php'; $feed = EL_Feed::get_instance(); } // ADMIN PAGE: if (is_admin()) { // Include required php-files and initialize required objects require_once EL_PATH . 'admin/admin.php'; EL_Admin::get_instance()->init_admin_page(); } else { // Register actions add_action('wp_print_styles', array(&$this, 'print_styles')); } }
public static function &get_instance() { // Create class instance if required if (!isset(self::$instance)) { self::$instance = new self(); } // Return class instance return self::$instance; }
private function html_feed_link(&$a, $pos) { $out = ''; if ($this->options->get('el_enable_feed') && 'true' === $a['add_feed_link'] && $pos === $this->options->get('el_feed_link_pos')) { // prepare url require_once EL_PATH . 'includes/feed.php'; $feed_link = EL_Feed::get_instance()->eventlist_feed_url(); // prepare align $align = $this->options->get('el_feed_link_align'); if ('left' !== $align && 'center' !== $align && 'right' !== $align) { $align = 'left'; } // prepare image $image = ''; if ('' !== $this->options->get('el_feed_link_img')) { $image = '<img src="' . includes_url('images/rss.png') . '" alt="rss" />'; } // prepare text $text = $image . esc_attr($this->options->get('el_feed_link_text')); // create html $out .= '<div class="feed" style="text-align:' . $align . '"> <a href="' . $feed_link . '">' . $text . '</a> </div>'; } return $out; }
public function feed_init() { if ($this->options->get('el_enable_feed')) { include_once EL_PATH . 'includes/feed.php'; EL_Feed::get_instance(); } }