__construct();} /** * PHP 5 Constructor */ function __construct() { add_action('admin_menu', array(&$this,'add_admin_pages')); add_action('publish_post', array(&$this,'wp_title_intercept'), 10, 2); load_textdomain('sequentitle', dirname(__FILE__) . '/languages/sequentitle-.'. get_locale() .'.mo'); } /** * Retrieves the options from the database. Initialize with the defaults if the * option isn't set * * @return array An array of the options. */ function getOptions() { $defaults = array('title' => 'Post #%%', 'index' => 1); $options = array(); foreach ($defaults as $key=>$value) { $options[$key] = get_option( "sequentitle_$key" ); if ( empty($options[$key]) ) { add_option( "sequentitle_$key", $value); $options[$key] = $value; } } return $options; } /** * Registers the options page. */ function add_admin_pages() { add_submenu_page('options-general.php', 'SequenTitle', 'SequenTitle', 'manage_options', 'sequentitle', array(&$this,'output_sub_admin_page_0')); } /** * Outputs the HTML for the admin sub page. */ function output_sub_admin_page_0() { $options = $this->getOptions(); ?>


%%'), 'sequentitle' ); ?>


getOptions(); if ($post->post_title === '') { $post->post_title = str_replace('%%', $options['index'], $options['title']); if ($post->post_name == $postID) { $post->post_name = sanitize_title($post->post_title); } $result = wp_update_post($post); if ($result !== 0 && !is_wp_error($result)) { update_option('sequentitle_index', $options['index'] + 1); } } } } } //instantiate the class if (class_exists('SequenTitle')) { $SequenTitle = new SequenTitle(); } ?>