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
*
* This is the improved version of "Breukie's Archives Widget" plugin by Arnold Breukhoven
*
*/
$mbpamw_path = preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', __FILE__);
$mbpamw_path = str_replace('\\','/',$mbpamw_path);
$mbpamw_dir = substr($mban_path,0,strrpos($mbpamw_path,'/'));
$mbpamw_siteurl = get_bloginfo('wpurl');
$mbpamw_siteurl = (strpos($mbpamw_siteurl,'http://') === false) ? get_bloginfo('siteurl') : $mbpamw_siteurl;
$mbpamw_fullpath = $mbpamw_siteurl.'/wp-content/plugins/'.$mbpamw_dir.'';
$mbpamw_fullpath = $mbpamw_fullpath.'archive-manage-widget/';
$mbpamw_abspath = str_replace("\\","/",ABSPATH);
define('MBP_AMW_ABSPATH', $mbpamw_path);
define('MBP_AMW_LIBPATH', $mbpamw_fullpath);
define('MBP_AMW_SITEURL', $mbpamw_siteurl);
define('MBP_AMW_NAME', 'Archive Manage Widget');
define('MBP_AMW_VERSION', '1.0');
define('MBP_AMW_LIBPATH', $mbpamw_fullpath);
global $wp_version;
if ($wp_version > '2.3') {
function mbp_amw_options() {
add_options_page('Archive Manage Widget', 'Archive Manage Widget', 10, __FILE__, 'mbp_amw_activate');
}
function mbp_amw_activate() {
$mbp_amw_activate = get_option('mbp_amw_activate');
$reg_msg = '';
$mbp_amw_msg = '';
$form_1 = 'mbp_amw_reg_form_1';
$form_2 = 'mbp_amw_reg_form_2';
// Activate the plugin if email already on list
if ( trim($_GET['mbp_onlist']) == 1 ) {
$mbp_amw_activate = 2;
update_option('mbp_amw_activate', $mbp_amw_activate);
$reg_msg = 'Thank you for registering the plugin. It has been activated';
}
// If registration form is successfully submitted
if ( ((trim($_GET['submit']) != '' && trim($_GET['from']) != '') || trim($_GET['submit_again']) != '') && $mbp_amw_activate != 2 ) {
update_option('mbp_amw_name', $_GET['name']);
update_option('mbp_amw_email', $_GET['from']);
$mbp_amw_activate = 1;
update_option('mbp_amw_activate', $mbp_amw_activate);
}
if ( intval($mbp_amw_activate) == 0 ) { // First step of plugin registration
global $userdata;
mbp_amwRegisterStep1($form_1,$userdata);
} else if ( intval($mbp_amw_activate) == 1 ) { // Second step of plugin registration
$name = get_option('mbp_amw_name');
$email = get_option('mbp_amw_email');
mbp_amwRegisterStep2($form_2,$name,$email);
} else if ( intval($mbp_amw_activate) == 2 ) { // Options page
if ( trim($reg_msg) != '' ) {
echo '
You have already registered. Please go to the Widgets section to enable and configure the widget.
$widget_args );
$widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) );
extract( $widget_args, EXTR_SKIP );
$options = get_option('widget_amw');
if ( !isset($options[$number]) )
return;
//check if registered or not
$mbp_amw_activate = get_option('mbp_amw_activate');
if ($mbp_amw_activate == '') {
echo "Please register in the admin panel to activate the `Archive Manage Widget` widget";
} else {
?>
" . $title . "
";
echo '
';
if ($format == '&format=option') {
?>
';
?>
$widget_args );
$widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) );
extract( $widget_args, EXTR_SKIP );
// Data is stored as array: array( number => data for that instance of the widget, ... )
$options = get_option('widget_amw');
if ( !is_array($options) )
$options = array();
// We need to update the data
if ( !$updated && !empty($_POST['sidebar']) ) {
// Tells us what sidebar to put the data in
$sidebar = (string) $_POST['sidebar'];
$sidebars_widgets = wp_get_sidebars_widgets();
if ( isset($sidebars_widgets[$sidebar]) )
$this_sidebar =& $sidebars_widgets[$sidebar];
else
$this_sidebar = array();
foreach ( $this_sidebar as $_widget_id ) {
if ( 'widget_amw' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) {
$widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number'];
if ( !in_array( "amw-$widget_number", $_POST['widget-id'] ) ) // the widget has been removed
unset($options[$widget_number]);
}
}
foreach ( (array) $_POST['widget-pmw'] as $widget_number => $widget_amw ) {
if ( !isset($widget_amw['title']) && isset($options[$widget_number]) ) // user clicked cancel
continue;
$title = wp_specialchars( $widget_amw['title'] );
$type = $widget_amw['type'] ;
$format = $widget_amw['format'] ;
$limit = $widget_amw['limit'];
$before = $widget_amw['before'];
$after = $widget_amw['after'];
$show_post_count = $widget_amw['show_post_count'];
$image = wp_specialchars( $widget_amw['image'] );
$alt = wp_specialchars( $widget_amw['alt'] );
$link = wp_specialchars( $widget_amw['link'] );
$new_window = isset( $widget_amw['new_window'] );
$options[$widget_number] = compact('image',
'alt',
'link',
'new_window',
'title',
'type',
'format',
'limit',
'before',
'after',
'show_post_count'
);
}
update_option('widget_amw', $options);
$updated = true; // So that we don't go through this more than once
}
//print_r($options);
if ( -1 == $number ) {
$title = '';
$type = '';
$format = '';
$limit = '';
$before = '';
$after = '';
$show_post_count = '';
$image = '';
$alt = '';
$link = '';
$new_window = '';
$number = '%i%';
} else {
$title = attribute_escape($options[$number]['title']);
$type = attribute_escape($options[$number]['type']);
$format = attribute_escape($options[$number]['format']);
$limit = attribute_escape($options[$number]['limit']);
$before = attribute_escape($options[$number]['before']);
$after = attribute_escape($options[$number]['after']);
$show_post_count = attribute_escape($options[$number]['show_post_count']);
$image = attribute_escape($options[$number]['image']);
$alt = attribute_escape($options[$number]['alt']);
$link = attribute_escape($options[$number]['link']);
$new_window = attribute_escape($options[$number]['new_window']);
}
?>
'widget_amw', 'description' => __('Archive Management'));
$control_ops = array( 'id_base' => 'amw');
$name = __(MBP_AMW_NAME);
$registered = false;
foreach ( array_keys($options) as $o ) {
// Old widgets can have null values for some reason
if ( !isset($options[$o]['image']) )
continue;
$id = "amw-$o"; // Never never never translate an id
$registered = true;
wp_register_sidebar_widget( $id, $name, 'widget_amw', $widget_ops, array( 'number' => $o ) );
wp_register_widget_control( $id, $name, 'widget_amw_control', $control_ops, array( 'number' => $o ) );
}
// If there are none, we register the widget's existance with a generic template
if ( !$registered ) {
wp_register_sidebar_widget( 'amw-1', $name, 'widget_amw', $widget_ops, array( 'number' => -1 ) );
wp_register_widget_control( 'amw-1', $name, 'widget_amw_control', $control_ops, array( 'number' => -1 ) );
}
}
// Srart Registration.
/**
* Plugin registration form
*/
function mbp_amwRegistrationForm($form_name, $submit_btn_txt='Register', $name, $email, $hide=0, $submit_again='') {
$wp_url = get_bloginfo('wpurl');
$wp_url = (strpos($wp_url,'http://') === false) ? get_bloginfo('siteurl') : $wp_url;
$plugin_pg = 'options-general.php';
$thankyou_url = $wp_url.'/wp-admin/'.$plugin_pg.'?page='.$_GET['page'];
$onlist_url = $wp_url.'/wp-admin/'.$plugin_pg.'?page='.$_GET['page'].'&mbp_onlist=1';
if ( $hide == 1 ) $align_tbl = 'left';
else $align_tbl = 'center';
?>
'.$msg.'
';
}
?>
Almost Done....
Step 1:
A confirmation email has been sent to your email "". You must click on the link inside the email to activate the plugin.
The confirmation email will look like:
Step 2:
Click on the button below to Verify and Activate the plugin.
Troubleshooting
The confirmation email is not there in my inbox!
Dont panic! CHECK THE JUNK, spam or bulk folder of your email.
It's not there in the junk folder either.
Sometimes the confirmation email takes time to arrive. Please be patient. WAIT FOR 6 HOURS AT MOST. The confirmation email should be there by then.
6 hours and yet no sign of a confirmation email!
Please register again from below:
Help! Still no confirmation email and I have already registered twice
Okay, please register again from the form above using a DIFFERENT EMAIL ADDRESS this time.
Why am I receiving an error similar to the one shown below?
You get that kind of error when you click on "Verify and Activate" button or try to register again.
This error means that you have already subscribed but have not yet clicked on the link inside confirmation email. In order to avoid any spam complain we don't send repeated confirmation emails. If you have not recieved the confirmation email then you need to wait for 12 hours at least before requesting another confirmation email.
But I've still got problems.
Stay calm. Contact us about it and we will get to you ASAP.
Please register the plugin to activate it. (Registration is free)
In addition you'll receive complimentary subscription to MaxBlogPress Newsletter which will give you many tips and tricks to attract lots of visitors to your blog.
Fill the form below to register the plugin:
[ Your contact information will be handled with the strictest confidence and will never be sold or shared with third parties ]