. */ class __Ajah_Comments__ { var $comments_per_page = 50; function init() { if(function_exists('load_plugin_textdomain')) { load_plugin_textdomain('ajah_comments', 'wp-content/plugins/ajah-comments'); } $this->comments_per_page = stripcslashes(get_option('ajah_comments_per_page')); } function wp_head() { $home = get_settings('siteurl'); $stylesheet = $home.'/wp-content/plugins' . $this->get_base() . '/css/ajah-comments.css'; echo(''); wp_register_script('ajah-comments', $home.'/wp-content/plugins' . $this->get_base() . '/js/ajah.js', false, '1'); wp_print_scripts(array('ajah', 'ajah-comments')); } function get_base() { return '/'.end(explode('/', str_replace(array('\\','/ajah-comments.php'),array('/',''),__FILE__))); } function template_redirect() { $this->start = $_REQUEST['ajah_start']; } function comments_template($filename) { return dirname(__FILE__) . "/templates/ajah-first-comments.php"; } function comments_popup_template($filename) { return dirname(__FILE__) . "/templates/ajah-all-comments.php"; } function comment_post_redirect($location) { if (preg_match('/\/\?comments_popup=(\d+)#comment-(\d+)/', $location, $matches)) { $post_id = $matches[1]; $comment_id = $matches[2]; return get_permalink($post_id) . "#comment-$comment_id"; } } function comments_per_page() { return $this->comments_per_page; } function admin_menu() { add_submenu_page('options-general.php', __('Ajah Comments', 'ajah_comments'), __('Ajah Comments', 'ajah_comments'), 5, __FILE__, array($this, 'plugin_menu')); } function plugin_menu() { $message = null; $message_updated = __("Ajah Comments Options Updated."); // update options if ($_POST['action'] && $_POST['action'] == 'ajah_update') { $message = $message_updated; update_option('ajah_comments_per_page', $_POST['ajah_comments_per_page']); wp_cache_flush(); } ?>