add_menu( array( 'id' => 'aiosrs', 'title' => 'Test Rich Snippets', 'href' => 'https://search.google.com/structured-data/testing-tool#url='. $actual_link, 'meta' => array('target' => '_blank'), ) ); } } function register_custom_menu_page() { require_once(plugin_dir_path( __FILE__ ).'admin/index.php'); $page = add_menu_page('All in One Rich Snippets Dashboard', 'Rich Snippets', 'administrator', 'rich_snippet_dashboard', 'rich_snippet_dashboard', 'div'); //Call the function to print the stylesheets and javascripts in only this plugins admin area add_action( 'admin_print_styles-' . $page, 'bsf_admin_styles' ); add_action('admin_print_scripts-' . $page, array( $this, 'iris_enqueue_scripts' ) ); } // Add settings link on plugin page function bsf_settings_link($links) { $settings_link = 'Settings'; array_unshift($links, $settings_link); return $links; } //print the star rating style on post edit page function post_enqueue($hook) { if( 'post.php' != $hook ) return; $current_admin_screen = get_current_screen(); $exclude_custom_post_type = apply_filters( 'bsf_exclude_custom_post_type', array() ); if ( in_array( $current_admin_screen->post_type, $exclude_custom_post_type ) ) return; wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'bsf_jquery_star' ); wp_enqueue_script( 'bsf_toggle' ); wp_enqueue_style( 'star_style' ); wp_register_script( 'bsf-scripts', BSF_META_BOX_URL . 'js/cmb.js','', '0.9.1' ); wp_enqueue_script( 'bsf-scripts' ); wp_enqueue_media(); wp_register_script( 'bsf-scripts-media', BSF_META_BOX_URL . 'js/media.js', array( 'jquery' ), '1.0' ); wp_enqueue_script( 'bsf-scripts-media' ); wp_enqueue_script('jquery-ui-datepicker'); if(!function_exists('vc_map')) wp_enqueue_style('jquery-style', '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css'); } function post_new_enqueue($hook) { if('post-new.php' != $hook ) return; $current_admin_screen = get_current_screen(); $exclude_custom_post_type = apply_filters( 'bsf_exclude_custom_post_type', array() ); if ( in_array( $current_admin_screen->post_type, $exclude_custom_post_type ) ) return; wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'bsf_jquery_star' ); wp_enqueue_script( 'bsf_toggle' ); wp_enqueue_style( 'star_style' ); wp_register_script( 'bsf-scripts', BSF_META_BOX_URL . 'js/cmb.js', '', '0.9.1' ); wp_enqueue_script( 'bsf-scripts' ); wp_enqueue_media(); wp_register_script( 'bsf-scripts-media', BSF_META_BOX_URL . 'js/media.js', array( 'jquery' ), '1.0' ); wp_enqueue_script( 'bsf-scripts-media' ); wp_enqueue_script('jquery-ui-datepicker'); if(!function_exists('vc_map')) wp_enqueue_style('jquery-style', '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css'); } //Initialize the metabox class function wp_initialize_bsf_meta_boxes() { if ( ! class_exists( 'bsf_Meta_Box' ) ) require_once(plugin_dir_path( __FILE__ ) . 'init.php'); } function set_styles() { wp_register_style( 'star_style', plugins_url('/css/jquery.rating.css', __FILE__) ); wp_register_style( 'meta_style', plugins_url('admin/css/style.css', __FILE__) ); wp_register_style( 'admin_style', plugins_url('admin/css/admin.css', __FILE__) ); wp_register_script( 'bsf_jquery_star', plugins_url('/js/jquery.rating.min.js', __FILE__) ); wp_register_script( 'bsf_toggle', plugins_url('/js/toggle.js', __FILE__) ); } // Define icon styles for the custom post type function star_icons() { ?> "; $from = sanitize_email( $_POST['email'] ); $site = esc_url( $_POST['site_url'] ); $sub = sanitize_text_field( $_POST['subject'] ); $message = esc_html( $_POST['message'] ); $name = sanitize_text_field( $_POST['name'] ); $post_url = esc_url( $_POST['post_url'] ); if($sub == "question") $subject = "[AIOSRS] New question received from ".$name; else if($sub == "bug") $subject = "[AIOSRS] New bug found by ".$name; else if($sub == "help") $subject = "[AIOSRS] New help request received from ".$name; else if($sub == "professional") $subject = "[AIOSRS] New service quote request received from ".$name; else if($sub == "contribute") $subject = "[AIOSRS] New development contribution request by ".$name; else if($sub == "other") $subject = "[AIOSRS] New contact request received from ".$name; $html = ' All in One Schema.org Rich Snippets
All in One Schema.org Rich Snippets Support
Name : '.$name.'
Email : '.$from.'
Website : '.$site.'
Ref. Post URL : '.$post_url.'
Message :
'.$message.'
'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From:'.$name.'<'.$from.'>' . "\r\n"; echo mail($to,$subject,$html,$headers) ? _e( "Thank you!", 'rich-snippets') : _e( "Something went wrong!", 'rich-snippets'); die(); } function submit_color() { if ( ! current_user_can( 'manage_options' ) ) { // return if current user is not allowed to manage options. return; } else { if ( ! isset( $_POST['snippet_color_nonce_field'] ) || ! wp_verify_nonce( $_POST['snippet_color_nonce_field'], 'snippet_color_form_action' ) ) { print 'Sorry, your nonce did not verify.'; exit; } else { $snippet_box_bg = esc_attr( $_POST['snippet_box_bg'] ); $snippet_title_bg = esc_attr( $_POST['snippet_title_bg'] ); $border_color = esc_attr( $_POST['snippet_border'] ); $title_color = esc_attr( $_POST['snippet_title_color'] ); $box_color = esc_attr( $_POST['snippet_box_color'] ); $color_opt = array( 'snippet_box_bg' => $snippet_box_bg, 'snippet_title_bg' => $snippet_title_bg, 'snippet_border' => $border_color, 'snippet_title_color' => $title_color, 'snippet_box_color' => $box_color, ); echo update_option('bsf_custom',$color_opt) ? _e( 'Settings saved !', 'rich-snippets') : _e( 'Error occured. Satings were not saved !', 'rich-snippets' ); die(); } } } function iris_enqueue_scripts() { wp_enqueue_script( 'wp-color-picker' ); // load the minified version of custom script wp_enqueue_script( 'cp_custom', plugins_url( 'js/cp-script.min.js', __FILE__ ), array( 'jquery', 'wp-color-picker' ), '1.1', true ); wp_enqueue_style( 'wp-color-picker' ); } function bsf_color_scripts() { global $wp_version; $bsf_script_array = array( 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker', 'media-upload', 'thickbox' ); // styles required for cmb $bsf_style_array = array( 'thickbox' ); // if we're 3.5 or later, user wp-color-picker if ( 3.5 <= $wp_version ) { $bsf_script_array[] = 'wp-color-picker'; $bsf_style_array[] = 'wp-color-picker'; } else { // otherwise use the older 'farbtastic' $bsf_script_array[] = 'farbtastic'; $bsf_style_array[] = 'farbtastic'; } } } } require_once(plugin_dir_path( __FILE__ ).'functions.php'); add_filter( 'bsf_meta_boxes', 'bsf_metaboxes' ); // Instantiating the Class if (class_exists("RichSnippets")) { $RichSnippets= new RichSnippets(); } ?>