Changeset 3209389
- Timestamp:
- 12/17/2024 05:04:47 PM (13 months ago)
- Location:
- pcrecruiter-extensions/trunk
- Files:
-
- 2 edited
-
PCRecruiter-Extensions.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pcrecruiter-extensions/trunk/PCRecruiter-Extensions.php
r2953988 r3209389 21 21 function pcr_frame($atts) 22 22 { 23 $a = shortcode_atts( array(23 $a = shortcode_atts([ 24 24 'link' => 'about:blank', 25 25 'background' => 'transparent', 26 26 'initialheight' => '640', 27 'analytics' => '',28 27 'form' => '' 29 ), $atts); 30 // If the link was empty and the formnumber is numeric insert the custom form 31 $sid = $a['form']; 32 $loadurl = $a['link']; 33 $analytics = $a['analytics']; 34 if ($a['analytics'] != '') { 35 $analytics = ' analytics="true" '; 36 }; 28 ], $atts); 29 30 $sid = intval($a['form']); 31 $loadurl = $a['link']; 32 function sanitize_loadurl($urlparam) 33 { 34 // Allow only letters, numbers, periods, equals, colons, question marks, forward slashes, percent signs, and spaces 35 return preg_replace('/[^a-zA-Z0-9\.\=\:\?\/%\s]/', '', $urlparam); 36 37 } 38 $loadurl = sanitize_loadurl($loadurl); 39 $initialheight = intval($a['initialheight']); 40 $background = preg_match('/^#[a-fA-F0-9]{3,6}$|^transparent$/', $a['background']) ? $a['background'] : 'transparent'; 37 41 $pcrframecss = '<link rel="stylesheet" href="https://www2.pcrecruiter.net/pcrimg/inc/pcrframehost.css">'; 38 // If the link doesn't contain a specific module, append jobboard.aspx 39 if (strpos($loadurl, '.asp?') === false && strpos($loadurl, '.exe?') === false && strpos($loadurl, '.aspx?') === false) { 40 $loadurl = 'jobboard.aspx?uid=' . $loadurl; 41 $pcrframecss = ''; 42 }; 43 // If the link has a form number, load customform script instead of job board 44 if (is_numeric($sid) && $loadurl !== "about:blank") { 45 return '<!-- Start PCRecruiter Form --><script src="https://www2.pcrecruiter.net/pcrbin/' . $loadurl . '&action=opencustomform&sid=' . $sid . '"></script><!-- End PCRecruiter Form -->'; 46 } else { 47 // If the link doesn't start with http and doesn't start with jobboard, prepend the Classic ASP URL and add CSS link 48 if (substr($loadurl, 0, 4) !== "http" && substr($loadurl, 0, 8) !== "jobboard") { 49 $aspurl = 'https://www2.pcrecruiter.net/pcrbin/' . $loadurl; 50 $loadurl = $aspurl; 51 } 52 ; 53 // If the link doesn't start with http and starts with jobboard, prepend the Job Board URL 54 if (substr($loadurl, 0, 4) !== "http" && substr($loadurl, 0, 8) == "jobboard") { 55 $pcrframecss = ''; 56 $aspurl = 'https://host.pcrecruiter.net/pcrbin/' . $loadurl; 57 $loadurl = $aspurl; 58 }; 59 return "<!-- Start PCRecruiter WP 1.4.10-->" . $pcrframecss . "<iframe frameborder=\"0\" host=\"{$loadurl}\" id=\"pcrframe\" name=\"pcrframe\" src=\"about:blank\" style=\"height:{$a['initialheight']}px;width:100%;background-color:{$a['background']};border:0;margin:0;padding:0\" {$analytics} onload=\"pcrframeurl();\"></iframe><!-- End PCRecruiter WP -->"; 60 } 61 } 42 43 // Modify the URL when needed 44 if ($sid === '' && strpos($loadurl, '.asp?') === false && strpos($loadurl, '.exe?') === false && strpos($loadurl, '.aspx?') === false) { 45 $loadurl = 'jobboard.aspx?uid=' . $loadurl; 46 $pcrframecss = ''; 47 } 48 49 // If a custom form is specified 50 if ($sid && $loadurl !== "about:blank") { 51 // Create the <script> tag with DOMDocument 52 $doc = new DOMDocument('1.0', 'UTF-8'); 53 $script = $doc->createElement('script'); 54 $loadurl = urldecode($loadurl); 55 $loadurl = urlencode($loadurl); 56 $script->setAttribute('src', "https://host.pcrecruiter.net/pcrbin/jobboard.aspx?uid={$loadurl}&action=opencustomform&sid={$sid}"); 57 $doc->appendChild($script); 58 59 return "<!-- Start PCRecruiter Form -->" 60 . $doc->saveHTML() 61 . "<!-- End PCRecruiter Form -->"; 62 } 63 64 // Prepend URL based on the link 65 if (substr($loadurl, 0, 4) !== "http") { 66 $loadurl = 'jobboard.aspx?uid=' . $loadurl; 67 $prefix = (substr($loadurl, 0, 8) === "jobboard") 68 ? 'https://host.pcrecruiter.net/pcrbin/' 69 : 'https://www2.pcrecruiter.net/pcrbin/'; 70 $loadurl = $prefix . $loadurl; 71 } 72 73 // Create iframe with DOMDocument 74 $doc = new DOMDocument('1.0', 'UTF-8'); 75 $iframe = $doc->createElement('iframe'); 76 $iframe->setAttribute('frameborder', '0'); 77 $iframe->setAttribute('host', $loadurl); 78 $iframe->setAttribute('id', 'pcrframe'); 79 $iframe->setAttribute('name', 'pcrframe'); 80 $iframe->setAttribute('src', 'about:blank'); 81 $iframe->setAttribute('style', "height:{$a['initialheight']}px;width:100%;background-color:{$a['background']};border:0;margin:0;padding:0"); 82 $iframe->setAttribute('onload', 'pcrframeurl();'); 83 84 $doc->appendChild($iframe); 85 86 return "<!-- Start PCRecruiter WP 1.4.2-->" 87 . $pcrframecss 88 . $doc->saveHTML() 89 . "<!-- End PCRecruiter WP -->"; 90 } 91 62 92 add_shortcode('PCRecruiter', 'pcr_frame'); 63 93 -
pcrecruiter-extensions/trunk/readme.txt
r3118598 r3209389 1 1 === PCRecruiter Extensions === 2 Contributors: Main Sequence Technology, Inc.2 Contributors: arothman 3 3 Tags: Recruiting, Staffing, Applicant Tracking 4 4 Requires at least: 3.0 5 Tested up to: 6. 6.05 Tested up to: 6.7.1 6 6 Stable tag: trunk 7 7 … … 27 27 * background="" (defaults to transparent if omitted) 28 28 * form="" (insert the 15-digit ID of a custom form) 29 * analytics="" (set to on if integrating Google Analytics with PCR)30 29 31 30 == XML Feed Setup ==
Note: See TracChangeset
for help on using the changeset viewer.