here. * Author: MaxBlogPress * Author URI: http://www.maxblogpress.com * * License: GNU General Public License * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * Copyright (C) 2007 www.maxblogpress.com * */ $mbpapl_path = preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', __FILE__); $mbpapl_path = str_replace('\\','/',$mbpapl_path); $mbpapl_dir = substr($mban_path,0,strrpos($mbpapl_path,'/')); $mbpapl_siteurl = get_bloginfo('wpurl'); $mbpapl_siteurl = (strpos($mbpapl_siteurl,'http://') === false) ? get_bloginfo('siteurl') : $mbpapl_siteurl; $mbpapl_fullpath = $mbpapl_siteurl.'/wp-content/plugins/'.$mbpapl_dir.''; $mbpapl_fullpath = $mbpapl_fullpath.'ajax-post-listing/'; $mbpapl_abspath = str_replace("\\","/",ABSPATH); define('MBP_APL_ABSPATH', $mbpapl_path); define('MBP_APL_LIBPATH', $mbpapl_fullpath); define('MBP_APL_SITEURL', $mbpapl_siteurl); define('MBP_APL_NAME', 'Ajax Post Listing'); define('MBP_APL_VERSION', '1.0'); define('MBP_APL_LIBPATH', $mbpapl_fullpath); //Hooks add_action('wp_print_scripts','mbp_apl_include_jquery'); add_action('admin_menu', 'mbp_apl_setting_page'); add_action('init', 'mbp_apl_register_widget'); if (get_option('mbp_apl_show_single_post') == 1) { add_filter('the_content', 'mbp_apl_post_content'); } /** * include jquery library */ function mbp_apl_include_jquery() { if (!is_admin()) { wp_enqueue_script("jquery"); wp_enqueue_script('my-script', MBP_APL_LIBPATH . 'script.js', array('jquery')); echo ""; } } /** * register widget */ function mbp_apl_register_widget(){ register_sidebar_widget ('Ajax Post List','mbp_apl_widget'); register_widget_control('Ajax Post List', 'mbp_apl_widget_control'); } /** * widget body */ function mbp_apl_widget($args = array()) { extract($args); $options = get_option('mbp_apl_widget_title'); $title = ($options['mbp_apl_widget_title'] == '')?'' : $options['mbp_apl_widget_title']; echo $before_widget . $before_title . $title . $after_title; mbp_apl_widget_content(); echo $after_widget; } /** * widget content */ function mbp_apl_widget_content($single=0) { if ($single == 1) { ob_start(); } //get the config variables global $table_prefix; $category_order = (get_option('mbp_apl_category_order') == '')?'ASC':get_option('mbp_apl_category_order'); $category_orderby = (get_option('mbp_apl_category_orderby') == 'ID')?'a.term_id' : 'a.name'; $post_order = (get_option('mbp_apl_post_order') == 'Random')?"rand()" : "post_date " . get_option('mbp_apl_post_order'); $post_limit = (get_option('mbp_apl_post_limit') == '')?5:get_option('mbp_apl_post_limit'); $categories = get_option('mbp_apl_categories'); $start = ($_GET['start'] == '')?0:$_GET['start']; $show_comment = get_option('mbp_apl_show_comment'); if ($categories != '') { $query = "SELECT a.name as category_name, b.term_id FROM ". $table_prefix ."terms a INNER JOIN ". $table_prefix ."term_taxonomy b ON(a.term_id=b.term_id) WHERE b.taxonomy='category' AND b.count > 0 AND b.term_id IN(". $categories . ")" . " ORDER BY ". $category_orderby . " " . $category_order . " LIMIT " . $start . ",1"; $query_count = "SELECT a.name as category_name, b.term_id FROM ". $table_prefix ."terms a INNER JOIN ". $table_prefix ."term_taxonomy b ON(a.term_id=b.term_id) WHERE b.taxonomy='category' AND b.count > 0 AND b.term_id IN(". $categories . ")"; $sql_count = mysql_query($query_count); $no_count = mysql_num_rows($sql_count); } else { $query = "SELECT a.name as category_name, b.term_id FROM ". $table_prefix ."terms a INNER JOIN ". $table_prefix ."term_taxonomy b ON(a.term_id=b.term_id) WHERE b.taxonomy='category' AND b.count > 0 ORDER BY ". $category_orderby . " " . $category_order . " LIMIT " . $start . ",1"; $query_count = "SELECT a.name as category_name, b.term_id FROM ". $table_prefix ."terms a INNER JOIN ". $table_prefix ."term_taxonomy b ON(a.term_id=b.term_id) WHERE b.taxonomy='category' AND b.count > 0"; $sql_count = mysql_query($query_count); $no_count = mysql_num_rows($sql_count); } $sql = mysql_query($query); $no = mysql_num_rows($sql); $rs = mysql_fetch_array($sql); if ($no > 0) { ?>
Powered by Ajax Post Listing"; } else { return; } } /** * widget control panel */ function mbp_apl_widget_control() { $options = get_option('mbp_apl_widget_title'); if ($_POST['mbp_apl_widget_title_submit']) { $options['mbp_apl_widget_title'] = $_POST['mbp_apl_widget_title']; update_option('mbp_apl_widget_title', $options); } $mbp_apl_widget_title = $options['mbp_apl_widget_title']; ?>
'.$reg_msg.'
'; } $updated = 0; $mbp_apl_categories = get_option('mbp_apl_categories'); $mbp_apl_category_order = (get_option('category_order') == '')?'DESC' : get_option('category_order'); $mbp_apl_category_orderby = (get_option('category_orderby') == '')?'name' : get_option('category_orderby'); $mbp_apl_post_order = (get_option('post_order') == '')?'DESC' : get_option('post_order'); $mbp_apl_post_limit = (get_option('post_limit') == '')?5 : get_option('post_limit'); $mbp_apl_show_comment = (get_option('show_comment') == '')?0 : get_option('show_comment'); $mbp_apl_show_single_post = (get_option('show_single_post') == '')?0 : get_option('show_single_post'); if($_POST['Submit'] == 'Save Configuration') { $mbp_apl_category_order = $_POST['category_order']; $mbp_apl_category_orderby = $_POST['category_orderby']; $mbp_apl_post_order = $_POST['post_order']; $mbp_apl_post_limit = $_POST['post_limit']; $mbp_apl_categories = @implode(",", $_POST['categories']); $mbp_apl_show_comment = $_POST['show_comment']; $mbp_apl_show_single_post = $_POST['show_single_post']; update_option("mbp_apl_category_order", $mbp_apl_category_order); update_option("mbp_apl_post_order", $mbp_apl_post_order); update_option("mbp_apl_categories", $mbp_apl_categories); update_option("mbp_apl_post_limit", $mbp_apl_post_limit); update_option("mbp_apl_show_comment", $mbp_apl_show_comment); update_option("mbp_apl_category_orderby", $mbp_apl_category_orderby); update_option("mbp_apl_show_single_post", $mbp_apl_show_single_post); $updated = 1; } if($_POST['submit'] == "Remove"){ $apl_pwdby = array(''.$_POST['apl_pwdby'].''); update_option('mbp_apl_pwdby_option', $apl_pwdby); $apl_pwdby = get_option('mbp_apl_pwdby_option'); if( $apl_pwdby[0] == 'apl_pwdby' ) $apl_pwdby = 'checked'; $updated = 1; } ?>
How to use it
Community
View our revived plugins
Settting saved
Powered Option:by MaxBlogPress
This plugin is the result of MaxBlogPress Revived project.
'.$msg.'
'; } ?>
|
|
by MaxBlogPress
|
by MaxBlogPress