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 . '
'.__('Popup ID', 'anything-popup').'
';
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'); ?>