function generate_seo_link($input, $replace = '-', $remove_words = true, $words_array = array()) { //make it lowercase, remove punctuation, remove multiple/leading/ending spaces $return = trim(ereg_replace(' +', ' ', preg_replace('/[^a-zA-Z0-9\\s]/', '', strtolower($input)))); //remove words, if not helpful to seo //i like my defaults list in remove_words(), so I wont pass that array if ($remove_words) { $return = remove_words($return, $replace, $words_array); } //convert the spaces to whatever the user wants //usually a dash or underscore.. //...then return the value. return str_replace(' ', $replace, $return); }
function generate_seo_link($input, $replace = '-', $remove_words = true, $words_array = array()) { $words_array = array('un', 'una', 'el', 'la', 'es', 'esta', 'con', 'de', 'a', 'y', 'su', 'del'); $unPretty = array('/á/', '/é/', '/í/', '/ó/', '/ú/', '/ü/', '/ñ/', '/Á/', '/É/', '/Í/', '/Ó/', '/Ú/', '/Ü/', '/Ñ/'); $pretty = array('a', 'e', 'i', 'o', 'u', 'u', 'n', 'A', 'E', 'I', 'O', 'U', 'U', 'N'); $return = preg_replace($unPretty, $pretty, $input); $return = trim(preg_replace('/ +/', ' ', preg_replace('/[^a-zA-Z0-9\\s]/', '', strtolower($return)))); if ($remove_words) { $return = remove_words($return, $replace, $words_array); } return str_replace(' ', $replace, $return); }
</div> </div> <?php if (arg(0) == 'employers' && arg(1) != "" || arg(2) == "jobs") { $image = ""; $key = variable_get('IIUM_Encryption_Key', NULL); if (arg(2) != "jobs") { $jid = ""; $q = arg(2); } else { $jid = (int) decrypt(arg(3), $key); $q = arg(1); } $uid = (int) decrypt($q, $key); $employer = employerdetails($uid); $employer_title = remove_words($employer['company_organization']); $jobinfo = jobinfo($jid); //logo variables $logo_vars = array('path' => $employer['company_logo'], 'alt' => $employer['company_logo_name'], 'title' => $employer['company_logo_name']); /* Title */ if (arg(2) != "jobs") { $job_id = ""; $title = ""; $image = '<div class="emloyer-logo">' . theme('image', $logo_vars) . '</div> <h1>' . $employer['company_organization'] . '</h1>'; } else { $title = '<h2>' . $jobinfo['job_title'] . '</h2> '; $image = '<div class="job-post-logo">' . theme('image', $logo_vars) . ' <h3>' . l($employer['company_organization'], 'employers/' . $employer_title . '/' . encrypt($uid, $key)) . '</h3> </div>'; $job_id = '<div class="job-post-id"><label>Job ID</label><span>' . $jobinfo['jobid'] . '</span></div>';