'; echo "\r\n"; echo '(function() {'; echo "\r\n"; echo ' if(!("object"==typeof LI)){'; echo "\r\n"; echo ' console.log("linkedin in.js is not install yet. installing..."); // print into console'; echo "\r\n"; echo ' var o = document.getElementsByTagName("body")[0];'; echo "\r\n"; echo ' o || (o = document.createElement("body"), document.documentElement.appendChild(o));'; echo "\r\n"; echo ' var a = document.createElement("script");'; echo "\r\n"; echo ' console.log("in.js is loading..."); '; echo "\r\n"; echo ' a.src = "//platform.linkedin.com/in.js?async=true";'; echo "\r\n"; echo ' a.type = "text/javascript";'; echo "\r\n"; echo ' a.id = "linkedin_injected_script";'; echo "\r\n"; echo ' a.onload = function(){'; echo "\r\n"; if ( get_option( 'applywithlinkedin_apidebug' ) == 1){ echo ' window.addEventListener("error", function errorHandler(e) {if (confirm("There is an error with your API key configuration. See documentation?") == true) {window.top.location.href="http://www.applymetrics.com/plugin1.html"};window.removeEventListener("error", errorHandler, false)}, false);'; echo "\r\n"; } echo ' IN.init({api_key: "'.stripslashes(strip_tags(get_option( 'applywithlinkedin_apikey' ))).'", extensions: "MobileJobs@//apply.aws.af.cm/api/mobilejobstag.js,LIApply@//apply.aws.af.cm/api/linkedinapplytag.js"});'; echo "\r\n"; echo ' };'; echo "\r\n"; echo ' o.appendChild(a);'; echo "\r\n"; echo ' }'; echo "\r\n"; echo ' else {'; echo "\r\n"; echo ' console.log("linkedin in.js is already installed. No need to inject"); '; echo "\r\n"; echo ' }'; echo "\r\n"; echo '}).call(this);'; echo "\r\n"; echo ''; } // if } // shortcode for adding linkedin buttons to post //[applywithlinkedin jobtitle="Job title" companyname="My Company" email="info@applymetrics.com" logo="http://yoursite.com/yourlogo.png" themecolor="#ff0000" coverletter="required"] function applywithlinkedin_sc_func( $atts ) { extract( shortcode_atts( array( 'jobtitle' => '', 'companyname' => '', 'email' => '', 'reqid' => '', 'phone' => '', 'force' => '', 'coverletter' => '', 'size' => '' ), $atts ) ); // check if set email address is my work email address (author). Some people won't change it so i get spammed if ( $email == 'info@applymetrics.com'){ return 'Please notify website administrator to check the email addresses used in the shortcodes of the "Apply with LinkedIn" plugin. The current address is still set to the authors email address'; } else { // clean vars if (( $coverletter != 'optional' ) && ( $coverletter != 'required' ) ){ $coverletter = 'hidden'; } // optional, required or hidden (default) if (( $phone != 'optional' ) && ( $phone != 'required' ) ){ $phone = 'hidden'; } // optional, required or hidden (default) if (( $size != 'medium' ) ){ $size = ''; } // small, medium or empty (=large=default) if (( $force == 'true' ) ){ $force = 'data-force="true"'; } else { $force = ''; } // force the button to top $jobid = sanitize_text_field( $jobid ); // CI-12 if ($jobid != ''){ $jobid='data-jobid="'.$jobid.'"'; } // build button $result=''; // add div for styling if ( get_option( 'applywithlinkedin_divstyling' ) == 1){ $result='
'.$result.'
'; } // return button return $result; } } add_shortcode( 'applywithlinkedin', 'applywithlinkedin_sc_func' ); /* admin area */ // register plugin options function applywithlinkedin_register_plugin_settings() { // only for users who can manage options if ( current_user_can( 'manage_options' ) ){ // add options with default values (only adds them if they don't exist yet) add_option( 'applywithlinkedin_apikey' ,'' ); add_option( 'applywithlinkedin_divstyling','' ); add_option( 'applywithlinkedin_apidebug','' ); } } // adds page to the admin menu function applywithlinkedin_options(){ $page=add_options_page( 'Apply with LinkedIn button settings', 'Apply with LinkedIn', 'administrator', basename(__FILE__), 'applywithlinkedin_options_page' ); // Using registered $page handle to hook stylesheet loading add_action( 'admin_print_styles-' . $page, 'applywithlinkedin_admin_stylesandscripts' ); } // add js and stylesheet for options page, It will be called only on your plugin admin page, enqueue our stylesheet here function applywithlinkedin_admin_stylesandscripts() { wp_enqueue_style('applywithlinkedinStylesheet'); wp_enqueue_script('applywithlinkedinScript'); } // plugin options page function applywithlinkedin_options_page(){ if ( isset( $_POST ) ){ if ( isset( $_POST['Submit'] ) ){ update_option( 'applywithlinkedin_apikey', $_POST['apikey'] ); update_option( 'applywithlinkedin_divstyling', $_POST['divstyling'] ); update_option( 'applywithlinkedin_apidebug', $_POST['apidebug'] ); } } ?>

(required) here.', 'applywithlinkedin' );?>
name="apidebug" />
name="divstyling" />

After setting up the API key you can use the following shortcode to add buttons to your post:

[applywithlinkedin jobtitle="Job title" companyname="My Company" email="info@applymetrics.com" jobid="2013" phone="required" force="true" coverletter="hidden" size="medium"]
The possible values for cover letter are: optional, required and hidden (default)
The possible values for phone are: optional(default), required and hidden
The possible values for size are: medium and large (default)
The possible values for jobid are: a unique job identifier (optional)
The possible values for force are: true to force the modal to be on top (use if you have a layer content)
Settings' ), $links ); } ?>