add_menu(); } // Add all the functionalities of the plugin to the plugin admin menu public function add_menu() { // Adding 123privacy stuff to the admin menu add_action( 'admin_menu', array( $this, 'admin_add_menu' ) ); // Adding 123privacy stuff to the frontend right before the
section */ public function data_save_body() { // First validate that the content of the form comes from the location on the current site and not somewhere else if ( wp_verify_nonce( $_POST['form_content_validator'], 'validate_form_content' ) ) { // Process content if valid if ( isset( $_POST['body_submitter'] ) && ( ! empty( $_POST['body_submitter'] ) ) ) { $option_name_body = 'add_to_body'; $options_body['data'][0] = $_POST['body_data']; if ( get_option( $option_name_body ) ) { // Update user information if user information is present update_option( $option_name_body, $options_body ); } else { // Add user information if user information is empty add_option( $option_name_body, $options_body ); } } } } public function body_add_data() { /** * Adding 123privacy information to the section */ $options_body = get_option( 'add_to_body' ); $output_body = $options_body['data'][0]; // Filter out any inserted HTML-code for added security $output_body = wp_filter_nohtml_kses( $output_body ); // Code to output to the frontend $output_body = "\n\n\n\n"; // Echo the code echo stripslashes( $output_body ); } /** * Retrieve 123privacy information to be added to the section */ public function data_save_head() { // First validate that the content of the form comes from the location on the current site and not somewhere else if ( wp_verify_nonce( $_POST['form_content_validator'], 'validate_form_content' ) ) { // Process content if valid if ( isset( $_POST['head_submitter'] ) && ( ! empty( $_POST['head_submitter'] ) ) ) { $option_name_head = 'add_to_head'; $options_head['data'][0] = $_POST['head_data']; if ( get_option($option_name_head) ) { // Update user information if user information is present update_option( $option_name_head, $options_head ); } else { // Add user information if user information is empty add_option( $option_name_head, $options_head ); } } } } public function head_add_data() { /** * Adding 123privacy information to the section */ $options_head = get_option( 'add_to_head' ); $output_head = $options_head['data'][0]; // Filter out any inserted HTML-code for added security $output_head = wp_filter_nohtml_kses( $output_head ); if ( ! isset( $output_head ) || empty( $output_head ) ) { // Do not add anything to the frontend if no information was entered by user return false; } else { // Code to output to the frontend $output_head = "\n\n\n\n\n"; // Echo the code echo stripslashes( $output_head ); } } public function addthis_button_onpost( $post_content ) { /** * Adding 'AddThis' buttons to the posts */ if ( is_single() ) { /* Code to add to the posts */ $output = "\n\n\ntag add_action( 'wp_footer', array( $this, 'body_add_data' ) ); // Adding 123privacy stuff to the front end inside the
add_action( 'wp_head', array( $this, 'head_add_data' ) ); // Adding AddThis stuff to the posts (only if selected by user in the form) if ( get_option( 'addthis_button_show' ) == 1 ) add_action( 'the_content', array( $this, 'addthis_button_onpost' ) ); } public function admin_add_menu() { // Add options page to the admin menu add_options_page( '123privacy', '123privacy', 'administrator', 'privacy_to_wordpress', array( $this, 'options' ) ); } /** * Retrieve 123privacy information to be added to the