800, 'popup_height' => 650, 'popup_v_pages' =>'true', 'popup_v_Posts' => 'true', 'popup_v_fpage' => 'true' )); // pull the settings from the db $arty_settings = get_option('arty_settings'); // fallback $arty_settings = wp_parse_args($arty_settings, $arty_defaults); function art_scripts() { //Media Uploader Scripts wp_enqueue_script('media-upload'); wp_enqueue_script('thickbox'); wp_deregister_script( 'my-upload' ); wp_register_script('my-upload',plugins_url('arty-popup/uploader.js') , array('jquery','media-upload','thickbox')); wp_enqueue_script('my-upload'); } function art_styles() { //Media Uploader Style wp_enqueue_style('thickbox'); } add_action( 'admin_enqueue_scripts', 'art_styles' ); add_action( 'admin_enqueue_scripts', 'art_scripts' ); /* /////////////////////////////////////////////// This section hooks the proper functions to the proper actions in WordPress \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ */ // this function registers our settings in the db add_action('admin_init', 'arty_register_settings'); function arty_register_settings() { register_setting('arty_settings', 'arty_settings', 'arty_settings_validate'); } add_action('admin_menu', 'arty_menu'); function arty_menu() { add_menu_page('Arty Popup', 'Arty Popup', 'edit_pages', 'settingspage', 'arty_settings_page', plugin_dir_url( __FILE__ )."icon.png"); } // this function checks to see if we just updated the settings // if so, it displays the "updated" message. function arty_settings_update_check() { global $arty_settings; if(isset($arty_settings['update'])) { echo '

Arty Popup Settings '.$arty_settings['update'].'

'; unset($arty_settings['update']); update_option('arty_settings', $arty_settings); } } // functions function arty_settings_page() { require 'inc/setting_page.php' ; } /* /////////////////////////////////////////////// these two functions sanitize the data before it gets stored in the database via options.php \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ */ // this function sanitizes our settings data for storage function arty_settings_validate($input) { $input['popup_testing'] = $input['popup_testing']; $input['popup_dark_bg'] = $input['popup_dark_bg']; $input['popup_v_pages'] = $input['popup_v_pages']; $input['popup_v_Posts'] = $input['popup_v_Posts']; $input['popup_v_fpage'] = $input['popup_v_fpage']; //$input['popup_cookie_time'] = $input['popup_cookie_time']; $code = $input['contact_form']; $code = str_replace('"',"'",$code); $input['contact_form'] = $code;/*$input['contact_form'];*/ $input['popup_form_code'] = $input['popup_form_code']; $input['st_upload'] = $input['st_upload']; return $input; } /* /////////////////////////////////////////////// this final section generates all the code that is displayed on the front-end of the WP Theme \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ */ function arty_popup($args = array(), $content = null) { require 'inc/popup.php'; } add_action( 'wp_head', 'arty_header' ); function arty_header() { global $arty_settings; $options = $arty_settings; ?> '; }