本文整理汇总了PHP中GoogleSitemapGenerator::InitOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP GoogleSitemapGenerator::InitOptions方法的具体用法?PHP GoogleSitemapGenerator::InitOptions怎么用?PHP GoogleSitemapGenerator::InitOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GoogleSitemapGenerator
的用法示例。
在下文中一共展示了GoogleSitemapGenerator::InitOptions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: HtmlShowOptionsPage
//.........这里部分代码省略.........
//Options of the category "Priorities" are float
} else {
if (substr($k, 0, 6) == "sm_pr_") {
$this->sg->_options[$k] = (double) $_POST[$k];
}
}
}
}
}
//No Mysql unbuffered query for WP < 2.2
if (floatval($wp_version) < 2.2) {
$this->sg->SetOption('b_safemode', true);
}
//No Wp-Cron for WP < 2.1
if (floatval($wp_version) < 2.1) {
$this->sg->SetOption('b_auto_delay', false);
}
//Apply page changes from POST
$this->sg->_pages = $this->sg->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');
}
}
}
//Print out the message to the user, if any
if ($message != "") {
?>
<div class="updated"><strong><p><?php
echo $message;
?>
</p></strong></div><?php
}
?>
<style type="text/css">
li.sm_hint {
color:green;
}
li.sm_optimize {
color:orange;
}
li.sm_error {
color:red;
}
input.sm_warning:hover {
background: #ce0000;
color: #fff;
示例2: HtmlShowOptionsPage
//.........这里部分代码省略.........
} 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");
}
}
}
}
}
//Print out the message to the user, if any
if ($message != "") {
?>
<div class="updated"><strong><p><?php
echo $message;
?>
</p></strong></div><?php
}
if (!$snl) {
if (isset($_GET['sm_hidedonate'])) {
$this->sg->SetOption('i_hide_donated', true);
$this->sg->SaveOptions();