本文整理匯總了PHP中GoogleSitemapGenerator::SetPages方法的典型用法代碼示例。如果您正苦於以下問題:PHP GoogleSitemapGenerator::SetPages方法的具體用法?PHP GoogleSitemapGenerator::SetPages怎麽用?PHP GoogleSitemapGenerator::SetPages使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類GoogleSitemapGenerator
的用法示例。
在下文中一共展示了GoogleSitemapGenerator::SetPages方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: HtmlShowOptionsPage
//.........這裏部分代碼省略.........
continue;
}
$enabledTaxonomies[] = $taxName;
}
$this->sg->SetOption($k, $enabledTaxonomies);
} else {
if ($k == 'sm_in_customtypes') {
$enabledPostTypes = array();
foreach (array_keys((array) $_POST[$k]) as $postTypeName) {
if (empty($postTypeName) || !post_type_exists($postTypeName)) {
continue;
}
$enabledPostTypes[] = $postTypeName;
}
$this->sg->SetOption($k, $enabledPostTypes);
} else {
$this->sg->SetOption($k, (bool) $_POST[$k]);
}
}
//Options of the category "Change frequencies" are string
} else {
if (substr($k, 0, 6) == "sm_cf_") {
$this->sg->SetOption($k, (string) $_POST[$k]);
//Options of the category "Priorities" are float
} else {
if (substr($k, 0, 6) == "sm_pr_") {
$this->sg->SetOption($k, (double) $_POST[$k]);
}
}
}
}
}
//Apply page changes from POST
$this->sg->SetPages($this->HtmlApplyPages());
if ($this->sg->SaveOptions()) {
$message .= __('Configuration updated', 'sitemap') . "<br />";
} else {
$message .= __('Error while saving options', 'sitemap') . "<br />";
}
if ($this->sg->SavePages()) {
$message .= __("Pages saved", 'sitemap') . "<br />";
} else {
$message .= __('Error while saving pages', 'sitemap') . "<br />";
}
} else {
if (!empty($_POST["sm_reset_config"])) {
//Pressed Button: Reset Config
check_admin_referer('sitemap');
$this->sg->InitOptions();
$this->sg->SaveOptions();
$message .= __('The default configuration was restored.', 'sitemap');
} else {
if (!empty($_GET["sm_delete_old"])) {
//Delete old sitemap files
check_admin_referer('sitemap');
//Check again, just for the case that something went wrong before
if (!current_user_can("administrator")) {
echo '<p>Please log in as admin</p>';
return;
}
if (!$this->sg->DeleteOldFiles()) {
$message = __("The old files could NOT be deleted. Please use an FTP program and delete them by yourself.", "sitemap");
} else {
$message = __("The old files were successfully deleted.", "sitemap");
}
}