Apptha | Visit plugin site * @since Wordpress 3.2.1 * @package apptha * @subpackage apptha-banner * @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @abstract The first loading page of the Banner these contain admin setting too. **/ // This is used for setting the Apptha banner link in the admin dashboard settings function banner_page() { add_menu_page('Apptha Banner', 'Apptha Banner', 'manage_options', 'banner_show', 'showbanner_admin',get_bloginfo('url').'/wp-content/plugins/'.dirname(plugin_basename(__FILE__)).'/image/icon.png'); add_submenu_page( 'banner_show', 'Page title', 'Image Upload', 'manage_options', 'banner_img', 'showbanner_admin'); add_submenu_page( 'banner_show', 'Page title', 'Settings', 'manage_options', 'banner_temp', 'showbanner_admin'); } // Include the respective page based of the page request in url function showbanner_admin() { switch ($_GET['page']) { case 'banner_show' : include_once (dirname(__FILE__) . '/admin/banner_show.php'); // admin functions break; case 'banner_temp' : include_once (dirname(__FILE__) .'/banner_temp.php'); // admin functions break; case 'banner_img' : include_once (dirname(__FILE__) . '/admin/banner_img.php'); // admin functions break; } require_once(dirname(__FILE__) . '/apptha_wpinstall.php'); } // The user will call this function to display the banner function apptha_banner() { global $wpdb; $site_url = get_bloginfo('url'); $temp_name = $wpdb->get_var("SELECT bann_tempname FROM " . $wpdb->prefix . "bannerstyles WHERE bann_status='ON'"); if($temp_name == '') { echo ''; } else { include_once (dirname(__FILE__).DIRECTORY_SEPARATOR.$temp_name.DIRECTORY_SEPARATOR.$temp_name.'.php'); // admin functions } } $lookupObj = array(); $chars_str; $chars_array = array(); function appbanner_generate($domain) { $code=appbanner_encrypt($domain); $code = substr($code,0,25)."CONTUS"; return $code; } function appbanner_encrypt($tkey) { $message = "EW-ABMP0EFIL9XEV8YZAL7KCIUQ6NI5OREH4TSEB3TSRIF2SI1ROTAIDALG-JW"; for($i=0;$i=count($key_array)) { $kPos = 0; } } return $enc_message; } function appbanner_getOffset($start, $end) { $chars_str = "WJ-GLADIATOR1IS2FIRST3BEST4HERO5IN6QUICK7LAZY8VEX9LIFEMP0"; for($i=0;$i=0;$i--) { $lookupObj[ord($chars_array[$i])] = $i; } $sNum = $lookupObj[ord($start)]; $eNum = $lookupObj[ord($end)]; $offset = $eNum-$sNum; if ($offset<0) { $offset = count($chars_array)+($offset); } return $offset; } // The common admin CSS and JS will included by checking the admin setted if (is_admin()) { function banner_common_js_css() { $site_url = get_bloginfo('url'); $plugin_name = dirname(plugin_basename(__FILE__)); wp_enqueue_style('banner_style', $site_url . '/wp-content/plugins/'.$plugin_name.'/css/banner_style.css'); wp_register_script('banner_js', '/wp-content/plugins/'.$plugin_name.'/js/banner_js.js'); wp_enqueue_script('banner_js'); } add_action('init', 'banner_common_js_css'); // hook init to call the JS and CSS } function banner_activate_loads() { global $wpdb; $execute_query = $wpdb->query("INSERT INTO " . $wpdb->prefix . "bannerstyles (`bann_tempid`, `bann_tempname`, `bann_tempimg`, `bann_bgcolor`, `bann_border`, `bann_borsize`, `bann_fontcolor`, `bann_hover`, `bann_corner`, `bann_fontfamily`, `bann_fontsize`, `bann_width`, `bann_height`, `bann_status`, `bann_spacing`, `bann_timing`) VALUES (1, 'navo_slider', 'navo_slider.jpg', '#ccc', '#ccc', 5, '#fff,#ae1e1e', '#e6e6e6', 0, 'arial', 12, 'auto', 280, 'ON', 0, 5), (2, 'blinking_navo', 'blinking_navo.jpg', '#ccc', '#666', 3, '#ffffff,#', '#e6e6e6', 0, 'Verdana', 12, 'auto', 270, 'OFF', 0, 4), (3, 'plain_image', 'plain_image.jpg', '#ccc', '#ccc', 5, '#000,#86b120', '#e6e6e6', 0, 'arial', 0, 'auto', 230, 'OFF', 10, 5); "); } /*Function to invoke install player plugin*/ function banners_install() { require_once(dirname(__FILE__) . '/apptha_wpinstall.php'); banner_install(); create_imageupload_foulder(); // for copy images and thumbniles } /*Function to activate player plugin*/ function banner_sharactivate() { banner_activate_loads(); } function banner_sharedeinstall() { global $wpdb; $images_drop = $wpdb->query("DROP TABLE " . $wpdb->prefix . "bannerimages"); $styles_drop = $wpdb->query("DROP TABLE " . $wpdb->prefix . "bannerstyles"); $options_drop = $wpdb->query("DELETE FROM " . $wpdb->prefix . "options WHERE option_name='get_api_key'"); } register_activation_hook(plugin_basename(dirname(__FILE__)) . '/apptha_wpbanner.php', 'banners_install'); register_activation_hook(__FILE__, 'banner_sharactivate'); register_uninstall_hook(__FILE__, 'banner_sharedeinstall'); add_action('admin_menu', 'banner_page'); // OPTIONS MENU ?>