本文整理汇总了PHP中Sanitizer::sanitize_title_with_dashes方法的典型用法代码示例。如果您正苦于以下问题:PHP Sanitizer::sanitize_title_with_dashes方法的具体用法?PHP Sanitizer::sanitize_title_with_dashes怎么用?PHP Sanitizer::sanitize_title_with_dashes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sanitizer
的用法示例。
在下文中一共展示了Sanitizer::sanitize_title_with_dashes方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Sanitizer
function __construct($job_id = false)
{
global $db;
if (is_numeric($job_id)) {
$sanitizer = new Sanitizer();
$sql = 'SELECT a.type_id AS type_id, a.category_id AS category_id, a.title AS title, a.summary AS summary,
a.description AS description, a.company AS company, a.url AS url, a.apply AS apply,
DATE_FORMAT(a.created_on, "' . DATE_FORMAT . '") AS created_on, a.created_on AS mysql_date,
a.is_temp AS is_temp, a.is_active AS is_active, a.spotlight AS spotlight,
a.views_count AS views_count, a.auth AS auth, a.city_id AS city_id, a.outside_location AS outside_location,
a.poster_email AS poster_email, a.apply_online AS apply_online, b.name AS category_name,
c.var_name as type_var_name, c.name as type_name,
DATE_ADD(created_on, INTERVAL 30 DAY) AS closed_on, DATEDIFF(NOW(), created_on) AS days_old, cit.name AS city_name
FROM ' . DB_PREFIX . 'jobs a LEFT JOIN ' . DB_PREFIX . 'cities cit on a.city_id = cit.id, ' . DB_PREFIX . 'categories b, ' . DB_PREFIX . 'types c
WHERE a.category_id = b.id AND c.id = a.type_id AND a.id = ' . $job_id;
$result = $db->query($sql);
$row = $result->fetch_assoc();
if (!empty($row)) {
$this->mId = $job_id;
$this->mTypeId = $row['type_id'];
$this->mCategoryId = $row['category_id'];
$this->mCategoryName = $row['category_name'];
$this->mTitle = str_replace('&', '&', $row['title']);
$this->mSummary = str_replace('&', '&', $row['summary']);
$this->mDescription = $row['description'];
$this->mCompany = $row['company'];
$this->mUrl = $row['url'];
$this->mApply = $row['apply'];
$this->mCreatedOn = $row['created_on'];
$this->mClosedOn = $row['closed_on'];
$this->mIsTemp = $row['is_temp'];
$this->mIsActive = $row['is_active'];
$this->mViewsCount = $row['views_count'];
$this->mAuth = $row['auth'];
$this->mCityId = $row['city_id'];
$this->mMySqlDate = $row['mysql_date'];
$this->mLocation = $this->GetLocation($row);
$this->mLocationOutsideRo = $row['outside_location'];
$this->mPosterEmail = $row['poster_email'];
$this->mUrlTitle = $sanitizer->sanitize_title_with_dashes($this->mTitle . ' at ' . $this->mCompany);
$this->mApplyOnline = $row['apply_online'];
$this->mDaysOld = $row['days_old'];
$this->mIsSpotlight = $row['spotlight'];
$this->mTypeName = $row['type_name'];
$this->mTypeVarName = $row['type_var_name'];
}
}
}
示例2: Sanitizer
<?php
$sanitizer = new Sanitizer();
$sql = 'SELECT DISTINCT company FROM ' . DB_PREFIX . 'jobs';
$comps = $db->QueryArray($sql);
if ($id === 'undisclosed') {
$company = '';
} else {
$company = false;
foreach ($comps as $comp) {
if ($sanitizer->sanitize_title_with_dashes($comp['company']) === $id) {
$company = $comp['company'];
break;
}
}
}
if ($company !== false) {
$smarty->assign('jobs', $job->ApiGetJobsByCompany($company, false, false));
$smarty->assign('current_company', $company);
$html_title = $translations['companies']['are_you_looking'] . ' ' . $company . '?';
$meta_description = $translations['companies']['meta_part1'] . ' ' . $company . '! ' . $translations['companies']['meta_part2'];
$template = 'company.tpl';
} else {
// Copied from index.php
header("HTTP/1.1 404 Not Found");
// TO-DO: add suggestion if no trailing slash supplied
$html_title = 'Page unavailable / ' . SITE_NAME;
$template = 'error.tpl';
}
示例3: generate_sitemap
function generate_sitemap($type)
{
global $db;
$sanitizer = new Sanitizer();
// Get all links
$result = $db->query('SELECT url FROM ' . DB_PREFIX . 'links');
while ($row = $result->fetch_assoc()) {
if (!strstr($row['url'], 'http://')) {
$sitemap[BASE_URL . $row['url'] . '/'] = 1;
}
}
// Get all custom pages
$result = $db->query('SELECT url FROM ' . DB_PREFIX . 'pages');
while ($row = $result->fetch_assoc()) {
$sitemap[BASE_URL . $row['url'] . '/'] = 1;
}
// Get all categories
$categories = get_categories();
$i = 0;
while ($i < count($categories)) {
$sitemap[BASE_URL . URL_JOBS . '/' . $categories[$i]['var_name'] . '/'] = 1;
$i++;
}
// Get all cities
$cities = get_cities();
$i = 0;
while ($i < count($cities)) {
$sitemap[BASE_URL . URL_JOBS_IN_CITY . '/' . $cities[$i]['ascii_name'] . '/'] = 1;
$i++;
}
// Get all companies
$result = $db->query('SELECT company FROM ' . DB_PREFIX . 'jobs WHERE is_temp = 0 AND is_active = 1 GROUP BY company');
while ($row = $result->fetch_assoc()) {
$sitemap[BASE_URL . URL_JOBS_AT_COMPANY . '/' . $sanitizer->sanitize_title_with_dashes($row['company']) . '/'] = 1;
}
// Get all active Jobs
$result = $db->query('SELECT id, title, company FROM ' . DB_PREFIX . 'jobs WHERE is_active = 1 AND is_temp = 0');
while ($row = $result->fetch_assoc()) {
$sitemap[BASE_URL . URL_JOB . '/' . $row['id'] . '/' . $sanitizer->sanitize_title_with_dashes($row['title'])] = 1;
}
// Generate output
if ($type == 'xml') {
header('Content-Type: text/xml; charset="utf-8"');
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
foreach ($sitemap as $url => $value) {
echo '<url><loc>' . $url . '</loc></url>';
}
echo '</urlset>';
} else {
foreach ($sitemap as $url => $value) {
echo $url . '<br />';
}
}
}
示例4: array
<?php
$companies = array();
$sanitizer = new Sanitizer();
$sql = 'SELECT company, count(id) AS nr
FROM ' . DB_PREFIX . 'jobs
WHERE is_temp = 0 AND is_active = 1
GROUP BY company
ORDER BY company ASC';
$comps = $db->QueryArray($sql);
foreach ($comps as $company) {
$nr = $company['nr'];
$tag_height = get_cloud_tag_height($nr);
$companies[] = array('name' => $company['company'], 'varname' => $sanitizer->sanitize_title_with_dashes($company['company']), 'count' => $nr, 'tag_height' => $tag_height);
}
$smarty->assign('companies', $companies);
$smarty->assign('companies_count', count($comps));
$html_title = $translations['companies']['page_title'];
$template = 'companies.tpl';
示例5: prepare_job_for_export
private function prepare_job_for_export($job)
{
$sanitizer = new Sanitizer();
$url_title = $sanitizer->sanitize_title_with_dashes($job['title'] . ' at ' . $job['company']);
$job['city'] = !empty($job['city']) ? $job['city'] : 'Any city';
$job['detail_url'] = JOBBER_URL . URL_JOB . '/' . $job['id'] . '/' . $url_title . '/';
return $job;
}
示例6: array
if ($item['url'] == $url) {
$job_flag = false;
}
}
} else {
$_SESSION['last_viewed_jobs'] = array();
}
if ($job_flag) {
array_unshift($_SESSION['last_viewed_jobs'], array('url' => $url, 'title' => stripslashes($job->mTitle)));
}
if (count($_SESSION['last_viewed_jobs']) > 10) {
array_pop($_SESSION['last_viewed_jobs']);
}
$app = new JobApplication($id);
$info['applied_count'] = $app->Count();
// ######### list other jobs by the same company #########
$compjobs = $job->ApiGetJobsByCompany($info['company'], 5, false);
$sanitizedcomp = $sanitizer->sanitize_title_with_dashes($info['company']);
$smarty->assign('compjobs', $compjobs);
$smarty->assign('jobsat', $sanitizedcomp);
// ######### list other jobs by the same company #########
$smarty->assign('job', $info);
$category = get_category_by_id($info['category_id']);
$smarty->assign('seo_title', $translator->translate("jobs.html_title", stripslashes($info['title']), stripslashes($info['company']), SITE_NAME));
$smarty->assign('current_category', $category['var_name']);
$smarty->assign('back_link', BASE_URL . URL_JOBS . '/' . $category['var_name'] . '/');
$template = 'job.tpl';
} else {
redirect_to(BASE_URL . 'job-unavailable/');
exit;
}
示例7: array
<?php
$companies = array();
$sanitizer = new Sanitizer();
$sql = 'SELECT company, count(id) AS nr
FROM ' . DB_PREFIX . 'jobs
WHERE is_temp = 0 AND is_active = 1
GROUP BY company
ORDER BY company ASC';
$comps = $db->QueryArray($sql);
foreach ($comps as $company) {
$nr = $company['nr'];
$tag_height = get_cloud_tag_height($nr);
$varname = $sanitizer->sanitize_title_with_dashes($company['company']);
if ($varname == '') {
$varname = 'undisclosed';
}
$companies[] = array('name' => $company['company'], 'varname' => $varname, 'count' => $nr, 'tag_height' => $tag_height);
}
$smarty->assign('companies', $companies);
$smarty->assign('companies_count', count($comps));
$html_title = $translations['companies']['page_title'];
$template = 'companies.tpl';