'; 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' => '', 'fullprofile' => '', '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 if (( $fullprofile == 'true' ) ){ $fullprofile = 'data-fullprofile="true"'; } else { $fullprofile = ''; } // request fullprofile from LinkedIn (if approved by LinkedIn) $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='