| 1 |
<?php if ( ! defined( 'ABSPATH' ) ) exit; |
| 2 |
|
| 3 |
//* Add page in admin menu |
| 4 |
add_action('admin_menu', 'wow_admin_menu_bmp', 999); |
| 5 |
function wow_admin_menu_bmp() { |
| 6 |
add_menu_page(WOW_BMP_NAME, __( WOW_BMP_NAME, "wow-bmp-lang"), 'manage_options', WOW_BMP_BASENAME, 'wow_admin_bmp', 'dashicons-plus-alt', null); |
| 7 |
} |
| 8 |
|
| 9 |
function wow_admin_bmp() { |
| 10 |
global $wow_plugin_bm; |
| 11 |
$wow_plugin_bm = true; |
| 12 |
include_once( 'partials/main.php' ); |
| 13 |
wp_enqueue_style(WOW_BMP_BASENAME.'-style', plugin_dir_url(__FILE__) . 'css/style.css',false, WOW_BMP_VERSION); |
| 14 |
wp_enqueue_script(WOW_BMP_BASENAME, plugin_dir_url(__FILE__) . 'js/script.js', array('jquery'), WOW_BMP_VERSION); |
| 15 |
wp_enqueue_script('fonticonpicker', plugin_dir_url(__FILE__) . 'fonticonpicker/jquery.fonticonpicker.min.js', array('jquery'),WOW_BMP_VERSION); |
| 16 |
wp_enqueue_style('fonticonpicker', plugin_dir_url(__FILE__) . 'fonticonpicker/css/jquery.fonticonpicker.min.css',false, WOW_BMP_VERSION); |
| 17 |
wp_enqueue_style('fonticonpicker-darkgrey', plugin_dir_url(__FILE__) . 'fonticonpicker/jquery.fonticonpicker.darkgrey.min.css',false, WOW_BMP_VERSION); |
| 18 |
wp_enqueue_style( WOW_BMP_BASENAME.'-fontawesome', WOW_BMP_URL . 'asset/font-awesome/css/font-awesome.min.css', false, '4.7.0' ); |
| 19 |
} |
| 20 |
|
| 21 |
//* Save all parametrs in the database |
| 22 |
if ( ! function_exists ( 'wow_plugin_nonce_check' ) ) { |
| 23 |
|
| 24 |
add_action( 'plugins_loaded', 'wow_plugin_nonce_check' ); |
| 25 |
function wow_plugin_nonce_check() { |
| 26 |
if (isset($_POST['wow_plugin_nonce_field'])) { |
| 27 |
if ( !empty($_POST) && wp_verify_nonce($_POST['wow_plugin_nonce_field'],'wow_plugin_action') && current_user_can('manage_options')){ |
| 28 |
wow_plugin_run_data(); |
| 29 |
} |
| 30 |
} |
| 31 |
} |
| 32 |
function wow_plugin_run_data(){ |
| 33 |
global $wpdb; |
| 34 |
$objItem = new WOW_DATA(); |
| 35 |
$add = (isset($_REQUEST["add"])) ? sanitize_text_field($_REQUEST["add"]) : ''; |
| 36 |
$data = (isset($_REQUEST["data"])) ? sanitize_text_field($_REQUEST["data"]) : ''; |
| 37 |
$page = sanitize_text_field($_REQUEST["page"]); |
| 38 |
$id = sanitize_text_field($_POST['id']); |
| 39 |
$post = array(); |
| 40 |
foreach ($_POST as $key => $value){ |
| 41 |
if (is_array($value) == true){ |
| 42 |
$post[$key] = serialize($value); |
| 43 |
} |
| 44 |
else { |
| 45 |
$post[$key] = $value; |
| 46 |
} |
| 47 |
} |
| 48 |
if (isset($_POST["submit"])) { |
| 49 |
if (sanitize_text_field($_POST["add"]) == "1") { |
| 50 |
$objItem->addNewItem($data, $post); |
| 51 |
header("Location:admin.php?page=".$page."&info=saved"); |
| 52 |
exit; |
| 53 |
} |
| 54 |
else if (sanitize_text_field($_POST["add"]) == "2") { |
| 55 |
$objItem->updItem($data, $post); |
| 56 |
header("Location:admin.php?page=".$page."&tool=add&act=update&id=".$id."&info=update"); |
| 57 |
exit; |
| 58 |
} |
| 59 |
} |
| 60 |
} |
| 61 |
} |
| 62 |
//* Footer text |
| 63 |
|
| 64 |
if ( ! function_exists ( 'wow_plugins_admin_footer_text' ) ) { |
| 65 |
add_filter( 'admin_footer_text', 'wow_plugins_admin_footer_text' ); |
| 66 |
function wow_plugins_admin_footer_text( $footer_text ) { |
| 67 |
global $wow_plugin_bm; |
| 68 |
if ( $wow_plugin_bm == true ) { |
| 69 |
$rate_text = sprintf( '<span id="footer-thankyou">Developed by <a href="http://wow-company.com/" target="_blank">Wow-Company</a> | <a href="https://wordpress.org/support/plugin/bubble-menu" target="_blank">Support </a> | <a href="https://www.facebook.com/wowaffect/" target="_blank">Join us on Facebook</a></span>'); |
| 70 |
return str_replace( '</span>', '', $footer_text ) . ' | ' . $rate_text . '</span>'; |
| 71 |
} |
| 72 |
else { |
| 73 |
return $footer_text; |
| 74 |
} |
| 75 |
} |
| 76 |
} |