settings(); add_action( 'admin_menu', array( &$this, 'admin_menu' ) ); add_action( 'init', array( &$this, 'init' ), 10 ); add_action( 'wp_enqueue_scripts', array( &$this, 'init_scripts' ) ); add_action( 'admin_enqueue_scripts',array( &$this, 'admin_scripts' ) ); add_filter( 'plugin_action_links', array( &$this, 'settings_link' ), 10, 2); register_uninstall_hook( __FILE__, array( 'AspexiSweetPopups', 'uninstall' ) ); } /* WP init action */ public function init() { /* Internationalization */ load_plugin_textdomain( 'aspexisweetpopups', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); } public function admin_menu() { add_submenu_page( 'themes.php', __( 'Aspexi Sweet Popups', 'aspexisweetpopups' ), __( 'Aspexi Sweet Popups', 'aspexisweetpopups' ), 'manage_options', basename(__FILE__), array( &$this, 'admin_page' ) ); } public function settings() { $config_default = array( 'aspexisweetpopups_version' => ASPEXISWEETPOPUPS_VERSION, 'status' => 'disabled', 'only_frontpage' => 'off', 'title' => 'Your title', 'content' => 'Your content', 'only_once' => 'off', 'only_once_days' => 30, 'icon_type' => 'empty', ); if ( ! get_option( 'aspexisweetpopups_options' ) ) add_option( 'aspexisweetpopups_options', $config_default, '', 'yes' ); $this->config = get_option( 'aspexisweetpopups_options' ); } public function get_content_with_shortcodes() { $content = nl2br( $this->config['content'] ); $matches = array(); preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches ); if ( ! empty( $matches[2] ) ) foreach ( $matches[2] as $key => $shortcode ) $content = str_replace( $matches[0][$key], do_shortcode( $matches[0][$key] ), $content ); return $content; } public function init_scripts() { $disable_maybe = apply_filters( 'aspexisweetpopups_disablemaybe', false ); if( $this->config['status'] != 'enabled' || ( $this->config['only_frontpage'] == 'on' && ! is_front_page() ) || $disable_maybe ) return; wp_enqueue_style( 'sweet-alert', ASPEXISWEETPOPUPS_URL . 'css/sweetalert.css' ); wp_enqueue_script( 'sweet-alert', ASPEXISWEETPOPUPS_URL . 'js/sweetalert.min.js' ); wp_enqueue_script( 'aspexi-sweet-popups', ASPEXISWEETPOPUPS_URL . 'js/asp.js', array( 'sweet-alert', 'jquery') ); wp_localize_script( 'aspexi-sweet-popups', 'asp', array( 'show' => ( isset( $_COOKIE[$this->cookie_name] ) && 'on' == $this->config['only_once'] ) ? false : true, 'title' => $this->config['title'], 'content' => $this->get_content_with_shortcodes(), 'icon_type' => $this->config['icon_type'], 'html' => 'true' ) ); $_expire = 0; if ( $this->config['only_once_days'] != '' ) $_expire = absint( (int)$this->config['only_once_days'] ); if( ! isset( $_COOKIE[$this->cookie_name] ) && 'on' == $this->config['only_once'] ) { if( 0 == $_expire ) $expire = 0; else $expire = time() + ( 60 * 60 * 24 * $_expire ); setcookie( $this->cookie_name, 'false', $expire ); } elseif( isset( $_COOKIE[$this->cookie_name] ) && 'on' != $this->config['only_once'] ) // remove cookie setcookie( $this->cookie_name, '', time() - 360 ); } public function admin_scripts( $hook_suffix ) { if( 'appearance_page_'.basename(__FILE__, '.php') != $hook_suffix ) return; wp_enqueue_style( 'sweet-alert', ASPEXISWEETPOPUPS_URL . 'css/sweetalert.css' ); wp_enqueue_style( 'sweet-popups', ASPEXISWEETPOPUPS_URL . 'css/sweet-popups.css' ); wp_enqueue_script( 'sweet-alert', ASPEXISWEETPOPUPS_URL . 'js/sweetalert.min.js' ); wp_enqueue_script( 'aspexi-sweet-popups', ASPEXISWEETPOPUPS_URL . 'js/asp-admin.js', array( 'sweet-alert', 'jquery') ); wp_localize_script( 'aspexi-sweet-popups', 'asp', array( 'show' => ( isset( $_COOKIE[$this->cookie_name] ) && 'on' == $this->config['only_once'] ) ? false : true, 'title' => $this->config['title'], 'content' => nl2br( $this->config['content'] ), 'icon_type' => $this->config['icon_type'], 'html' => 'true', 'aspexisweetpopups_url' => ASPEXISWEETPOPUPS_URL, 'nav_tab_changed_title' => __( 'Unsaved changes!', 'aspexisweetpopups' ), 'nav_tab_changed_text' => __( 'If you leave this page now the changes you have made may be lost.', 'aspexisweetpopups' ), 'nav_tab_changed_yes' => __( 'Stay and continue', 'aspexisweetpopups' ), 'nav_tab_changed_no' => __( 'Drop changes and leave', 'aspexisweetpopups' ), ) ); } public function get_pro_url() { return 'http://aspexi.com/downloads/aspexi-sweet-popups/?src=free_plugin'; } public function get_pro_link() { return ''.__( 'Get PRO version', 'aspexisweetpopups' ).''; } public function settings_link( $action_links, $plugin_file ) { if( $plugin_file == plugin_basename(__FILE__) ) { $pro_link = $this->get_pro_link(); array_unshift( $action_links, $pro_link ); $settings_link = '' . __("Settings") . ''; array_unshift( $action_links, $settings_link ); } return $action_links; } public static function uninstall() { delete_option( 'aspexisweetpopups_options' ); } public function display_admin_notices( $echo = false ) { $ret = ''; foreach( (array)$this->errors as $error ) $ret .= '
'.$error.'
'.$message.'
|
get_pro_link(); ?> [aspexi_sweet_popups theme="facebook" close_button_button="on" close_button_icon="on" close_button_color="#8cd4f5" like_box="on" like_box_protocol="http" like_box_option_url="any" like_box_url="www.facebook.com/facebook" like_box_layout="box_count" only_home="on" only_bottom="on" auto_open="on" auto_open_time="3000" auto_open_on_element="off" auto_open_on_element_name="#element_name" title="Your Title" only_once="on" only_once_days="30" icon_type="success"]Your Content[/aspexi_sweet_popups] :
: [aspexi_sweet_popups]Your Content[/aspexi_sweet_popups] : [aspexi_sweet_popups close_button_button="off" close_button_icon="on" title="custom title"]Your Content[/aspexi_sweet_popups] : [aspexi_sweet_popups theme="facebook" close_button_button="on" close_button_icon="on" like_box="on" like_box_protocol="http" like_box_url="www.facebook.com/facebook" like_box_layout="standard" auto_open="on" auto_open_time="3000" title="Your Title" icon_type="info" ]Your Content[/aspexi_sweet_popups] |
|
get_pro_link(); ?> |
|
|
get_pro_link(); ?> |
|
|
get_pro_link(); ?> |
|
[aspexi_newsletter] get_pro_link(); ?> |
|
get_pro_link(); ?> |
|
|
get_pro_link(); ?> |
|
|
get_pro_link(); ?> |