prefix . "AnythingPopup"); define('AnythingPopup_FAV', 'http://www.gopiplus.com/work/2012/05/25/wordpress-popup-plugin-anything-popup/'); if ( ! defined( 'ANYTHGPOPUP_PLUGIN_BASENAME' ) ) define( 'ANYTHGPOPUP_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); if ( ! defined( 'ANYTHGPOPUP_PLUGIN_NAME' ) ) define( 'ANYTHGPOPUP_PLUGIN_NAME', trim( dirname( ANYTHGPOPUP_PLUGIN_BASENAME ), '/' ) ); if ( ! defined( 'ANYTHGPOPUP_PLUGIN_DIR' ) ) define( 'ANYTHGPOPUP_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . ANYTHGPOPUP_PLUGIN_NAME ); if ( ! defined( 'ANYTHGPOPUP_PLUGIN_URL' ) ) define( 'ANYTHGPOPUP_PLUGIN_URL', WP_PLUGIN_URL . '/' . ANYTHGPOPUP_PLUGIN_NAME ); if ( ! defined( 'ANYTHGPOPUP_ADMIN_URL' ) ) define( 'ANYTHGPOPUP_ADMIN_URL', get_option('siteurl') . '/wp-admin/options-general.php?page=anything-popup' ); function AnythingPopup( $pop_id = "1" ) { global $wpdb, $wp_version; $ArrInput = array(); $ArrInput["id"] = $pop_id; echo AnythingPopup_shortcode( $ArrInput ); } function AnythingPopup_shortcode( $atts ) { global $wpdb; $scode = ""; // [AnythingPopup id="1"] if ( ! is_array( $atts ) ) { return ''; } $pop_id = $atts['id']; $sSql = "select * from ".AnythingPopupTable." where 1=1"; if($pop_id == "RANDOM" || $pop_id == "") { $sSql = $sSql . " Order by rand()"; } else { if(is_numeric($pop_id)) { $sSql = $sSql . " and pop_id=$pop_id"; } } $sSql = $sSql . " LIMIT 0,1"; $pop = ""; $data = $wpdb->get_results($sSql); if ( ! empty($data) ) { $data = $data[0]; $pop_content_id = $data->pop_id; $pop_width = stripslashes($data->pop_width); $pop_height = stripslashes($data->pop_height); $pop_headercolor = stripslashes($data->pop_headercolor); $pop_bordercolor = stripslashes($data->pop_bordercolor); $pop_header_fontcolor = stripslashes($data->pop_header_fontcolor); $pop_title = stripslashes($data->pop_title); $pop_Temp = stripslashes($data->pop_content); $pop_Temp = do_shortcode($pop_Temp); $pop_content = $pop_Temp; $pop_content = str_replace("\n", "
", $pop_content); $pop_caption = stripslashes($data->pop_caption); $pop_content_height = $pop_height - 60; //echo $pop_content; $pop = $pop . ''; $HrefOpen = 'javascript:AnythingPopup_OpenForm("AnythingPopup_BoxContainer'.$pop_content_id.'","AnythingPopup_BoxContainerBody'.$pop_content_id.'","AnythingPopup_BoxContainerFooter'.$pop_content_id.'","'.$pop_width.'","'.$pop_height.'");'; $HrefClose = "javascript:AnythingPopup_HideForm('AnythingPopup_BoxContainer".$pop_content_id."','AnythingPopup_BoxContainerFooter".$pop_content_id."');"; $pop = $pop . "".$pop_caption.""; $pop = $pop . ''; $pop = $pop . ''; } else { $pop = __('No record found.', 'anything-popup'); } return $pop; } function AnythingPopup_install() { global $wpdb, $wp_version; if($wpdb->get_var("show tables like '". AnythingPopupTable . "'") != AnythingPopupTable) { $sSql = "CREATE TABLE IF NOT EXISTS `". AnythingPopupTable . "` ("; $sSql = $sSql . "`pop_id` INT NOT NULL AUTO_INCREMENT ,"; $sSql = $sSql . "`pop_width` int(11) NOT NULL default '450' ,"; $sSql = $sSql . "`pop_height` int(11) NOT NULL default '300' ,"; $sSql = $sSql . "`pop_headercolor` VARCHAR( 10 ) NOT NULL default '#4D4D4D' ,"; $sSql = $sSql . "`pop_bordercolor` VARCHAR( 10 ) NOT NULL default '#4D4D4D',"; $sSql = $sSql . "`pop_header_fontcolor` VARCHAR( 10 ) NOT NULL default '#FFFFFF' ,"; $sSql = $sSql . "`pop_title` VARCHAR( 1024 ) NOT NULL default 'Anything Popup' ,"; $sSql = $sSql . "`pop_content`TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL ,"; $sSql = $sSql . "`pop_caption` VARCHAR( 2024 ) NOT NULL default 'Click to open popup' ,"; $sSql = $sSql . "PRIMARY KEY ( `pop_id` )"; $sSql = $sSql . ") ENGINE=MyISAM DEFAULT CHARSET=utf8;"; $wpdb->query($sSql); $sSql = ""; $con = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s,"; $con = $con . " when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap"; $con = $con . " into electronic typesetting, remaining essentially unchanged."; $IsSql = "INSERT INTO `". AnythingPopupTable . "` (`pop_content`)"; $sSql = $IsSql . " VALUES ('".$con."');"; $wpdb->query($sSql); } add_option('pop_id', "RANDOM"); } function AnythingPopup_widget($args) { extract($args); echo $before_widget; $pop_id = get_option('pop_id'); AnythingPopup($pop_id = $pop_id); echo $after_widget; } function AnythingPopup_control() { $pop_id = get_option('pop_id'); if (isset($_POST['pop_submit'])) { $pop_id = stripslashes(trim(sanitize_text_field($_POST['pop_id']))); update_option('pop_id', $pop_id ); } echo '

'.__('Popup ID', 'anything-popup').'
'; echo '

'; echo ''; echo '

'; _e('Check official website for more information', 'anything-popup'); ?>

__( 'Please enter the popup window width, only number.', 'anything-popup-select', 'anything-popup' ), 'pop_height' => __( 'Please enter the popup window height, only number.', 'anything-popup-select', 'anything-popup' ), 'pop_headercolor' => __( 'Please enter the header color.', 'anything-popup-select', 'anything-popup' ), 'pop_bordercolor' => __( 'Please enter the border color.', 'anything-popup-select', 'anything-popup' ), 'pop_header_fontcolor' => __( 'Please enter the heder font color.', 'anything-popup-select', 'anything-popup' ), 'pop_title' => __( 'Please enter the popup title.', 'anything-popup-select', 'anything-popup' ), 'pop_caption' => __( 'Please enter the popup link text/image.', 'anything-popup-select', 'anything-popup' ), 'pop_content' => __( 'Please enter the popup content.', 'anything-popup-select', 'anything-popup' ), 'pop_delete' => __( 'Do you want to delete this record?', 'anything-popup-select', 'anything-popup' ), ); wp_localize_script( 'anything-popup-adminscripts', 'pop_adminscripts', $popup_select_params ); break; } } } function AnythingPopup_textdomain() { load_plugin_textdomain( 'anything-popup', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); } add_action('plugins_loaded', 'AnythingPopup_textdomain'); add_shortcode( 'AnythingPopup', 'AnythingPopup_shortcode' ); add_action('wp_enqueue_scripts', 'AnythingPopup_add_javascript_files'); add_action("plugins_loaded", "AnythingPopup_widget_init"); register_activation_hook(__FILE__, 'AnythingPopup_install'); register_deactivation_hook(__FILE__, 'AnythingPopup_deactivation'); add_action('init', 'AnythingPopup_widget_init'); add_action('admin_enqueue_scripts', 'AnythingPopup_adminscripts'); ?>