'Send message about this page to your friend!', 'af_tf_email_title_message' => 'Please see this page on >>website name<<', 'af_tf_form_content_message' => 'Hello, I think this page is interesting: ', 'af_tf_windowURL' => $thewindowURL, 'af_tf_email_greetings' => 'best regards', 'af_tf_button_text' => 'Tell a Friend', 'af_tf_text_visual' => 'Tell a Friend', 'af_tf_window_height' => 380, 'af_tf_window_width' => 500, 'af_tf_font_size' => '12px' ); update_option( 'af_tf_plugin_options', $af_tf_options_array ); //=== end of options zone register_uninstall_hook( __FILE__, ‘af_tf_uninstall’ ); } function af_tf_deactivation() { // deactivation } function af_tf_uninstall() { // uninstall } //====== plugin menu zone === add_action( 'admin_menu', 'af_tf_menu_create_menu' ); function af_tf_menu_create_menu() { //create a submenu under Settings add_options_page( 'AF TellaFriend Settings Page Title Tag', 'AF Tell a Friend', 'manage_options', __FILE__, 'af_tf_menu_settings_page' ); } function af_tf_menu_settings_page() { $af_tf_temporary_array = get_option('af_tf_plugin_options'); $var_af_tf_admin_popwindow_title = $af_tf_temporary_array['af_tf_form_title']; $var_af_tf_admin_email_subject = $af_tf_temporary_array['af_tf_email_title_message'];//"Please see page on "; $var_af_tf_admin_inside_email_title = $af_tf_temporary_array['af_tf_form_content_message']; $var_af_tf_admin_content_greetings = $af_tf_temporary_array['af_tf_email_greetings']; $var_af_tf_admin_button_text = $af_tf_temporary_array['af_tf_button_text']; $var_af_tf_admin_window_width = $af_tf_temporary_array['af_tf_window_width']; $var_af_tf_admin_window_height = $af_tf_temporary_array['af_tf_window_height']; $var_af_tf_admin_text_visual = $af_tf_temporary_array['af_tf_text_visual']; $var_af_tf_admin_font_size = $af_tf_temporary_array['af_tf_font_size']; if (@$_POST['af_tf_admin_setting']) { $var_af_tf_admin_popwindow_title = stripslashes($_POST['af_tf_admin_popwindowtitle']); $var_af_tf_admin_email_subject = stripslashes($_POST['af_tf_admin_email_subject']); $var_af_tf_admin_inside_email_title = stripslashes($_POST['af_tf_admin_inside_email']); $var_af_tf_admin_content_greetings = stripslashes($_POST['af_tf_admin_email_greetings']); $var_af_tf_admin_button_text = stripslashes($_POST['af_tf_admin_button_text']); $var_af_tf_admin_window_width = stripslashes($_POST['var_af_tf_admin_window_width']); $var_af_tf_admin_window_height = stripslashes($_POST['var_af_tf_admin_window_height']); $var_af_tf_admin_text_visual = stripslashes($_POST['af_tf_admin_text_visual']); $var_af_tf_admin_font_size = stripslashes($_POST['af_tf_admin_font_size']); $af_tf_options_array = array( 'af_tf_form_title' => $var_af_tf_admin_popwindow_title, 'af_tf_email_title_message' => $var_af_tf_admin_email_subject, 'af_tf_form_content_message' => $var_af_tf_admin_inside_email_title, 'af_tf_email_greetings' => $var_af_tf_admin_content_greetings, 'af_tf_button_text' => $var_af_tf_admin_button_text, 'af_tf_text_visual' => $var_af_tf_admin_text_visual, 'af_tf_window_width' => $var_af_tf_admin_window_width, 'af_tf_window_height' => $var_af_tf_admin_window_height, 'af_tf_font_size' => $var_af_tf_admin_font_size ); update_option( 'af_tf_plugin_options', $af_tf_options_array ); } echo '
'; echo '

AF Tell a Friend Form Settings

'."\n\n"; echo '
'; echo '

Popup Window Title:

'; echo '

Email Subject:

'; echo '

Inside-email Title:

'; echo '

Email Greetings:

'; echo '

Button Text:

'; echo '

Widget/Shortcode Text:

'; echo '

Window\'s Width:

'; echo '

Window\'s Height:

'; echo '

Link Font Size (ie. 14px):

'; ?> '; echo '

'; echo '
'; echo '
New advanced version AF Tell a Friend v. 1.5 available here
'; } //=== plugin menu zone end === //=== registering scripts and styles === function af_tf_javascript_files() { //$plugins_url = plugins_url(); if (!is_admin()) { wp_enqueue_script( 'af_tf_js', plugins_url().'/af-tell-a-friend/af-tf-js/af-tf-js.js'); } } //========== registering scripts and styles end === //====== widgets zone function af_TellaFriend() { $temporaryholder = get_option('siteurl').'/wp-content/plugins/af-tell-a-friend/af-tf-window.php'; $af_tmp_array = get_option('af_tf_plugin_options'); if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) { echo ''; echo ''; echo $af_tmp_array['af_tf_text_visual']; echo ''; } else { echo ''; echo ''; echo $af_tmp_array['af_tf_text_visual']; echo ''; } } function af_TellaFriend_widget($args) { extract($args); echo $before_widget; af_TellaFriend(); echo $after_widget; } function af_TellaFriend_control() { } function af_tf_widget_init() { if(function_exists('wp_register_sidebar_widget')) { wp_register_sidebar_widget('AF Tell a Friend', 'AF Tell a Friend', 'af_TellaFriend_widget'); } if(function_exists('wp_register_widget_control')) { wp_register_widget_control('AF Tell a Friend', array('AF Tell a Friend', 'widgets'), 'af_TellaFriend_control'); } } //======= end of widgets zone // ======== shortcode zone === function af_tf_shortcode() { $temporaryholder = plugins_url().'/af-tell-a-friend/af-tf-window.php'; $af_tmp_array_sc = get_option('af_tf_plugin_options'); $af_tf_sh=''; if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) { $af_tf_sh = ''; $af_tf_sh .= ''; $af_tf_sh .= $af_tmp_array_sc['af_tf_text_visual']; $af_tf_sh .= ''; } else { $af_tf_sh = ''; $af_tf_sh .= ''; $af_tf_sh .= $af_tmp_array_sc['af_tf_text_visual']; $af_tf_sh .= ''; } return $af_tf_sh; } // shortcode in widgets add_filter('widget_text', 'do_shortcode'); // === end of shortcode zone === add_shortcode( 'af_tf_form', 'af_tf_shortcode' ); add_action('wp_enqueue_scripts', 'af_tf_javascript_files'); add_action("plugins_loaded", "af_tf_widget_init"); register_activation_hook(__FILE__,'af_tf_activation'); register_deactivation_hook(__FILE__,'af_tf_deactivation'); register_deactivation_hook(__FILE__,'af_tf_deactivation'); add_action('init', 'af_tf_widget_init'); ?>