本文整理汇总了PHP中GoogleSitemapGenerator::SetOption方法的典型用法代码示例。如果您正苦于以下问题:PHP GoogleSitemapGenerator::SetOption方法的具体用法?PHP GoogleSitemapGenerator::SetOption怎么用?PHP GoogleSitemapGenerator::SetOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GoogleSitemapGenerator
的用法示例。
在下文中一共展示了GoogleSitemapGenerator::SetOption方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: HtmlShowOptionsPage
/**
* Displays the option page
*
* @since 3.0
* @access public
* @author Arne Brachhold
*/
function HtmlShowOptionsPage()
{
global $wp_version;
$this->sg->Initate();
//All output should go in this var which get printed at the end
$message = "";
if (isset($_GET['sm_hidedonate'])) {
$this->sg->SetOption('i_hide_donated', true);
$this->sg->SaveOptions();
}
if (isset($_GET['sm_donated'])) {
$this->sg->SetOption('i_donated', true);
$this->sg->SaveOptions();
}
if (isset($_GET['sm_hide_note'])) {
$this->sg->SetOption('i_hide_note', true);
$this->sg->SaveOptions();
}
if (isset($_GET['sm_hidedonors'])) {
$this->sg->SetOption('i_hide_donors', true);
$this->sg->SaveOptions();
}
if (isset($_GET['sm_donated']) || $this->sg->GetOption('i_donated') === true && $this->sg->GetOption('i_hide_donated') !== true) {
?>
<div class="updated">
<strong><p><?php
_e('Thank you very much for your donation. You help me to continue support and development of this plugin and other free software!', 'sitemap');
?>
<a href="<?php
echo $this->sg->GetBackLink() . "&sm_hidedonate=true";
?>
"><small style="font-weight:normal;"><?php
_e('Hide this notice', 'sitemap');
?>
</small></a></p></strong>
</div>
<?php
} else {
if ($this->sg->GetOption('i_donated') !== true && $this->sg->GetOption('i_install_date') > 0 && $this->sg->GetOption('i_hide_note') !== true && time() > $this->sg->GetOption('i_install_date') + 60 * 60 * 24 * 30) {
?>
<div class="updated">
<strong><p><?php
echo str_replace("%s", $this->sg->GetRedirectLink("sitemap-donate-note"), __('Thanks for using this plugin! You\'ve installed this plugin over a month ago. If it works and your are satisfied with the results, isn\'t it worth at least one dollar? <a href="%s">Donations</a> help me to continue support and development of this <i>free</i> software! <a href="%s">Sure, no problem!</a>', 'sitemap'));
?>
<a href="<?php
echo $this->sg->GetBackLink() . "&sm_hide_note=true";
?>
" style="float:right; display:block; border:none;"><small style="font-weight:normal; "><?php
_e('No thanks, please don\'t bug me anymore!', 'sitemap');
?>
</small></a></p></strong>
<div style="clear:right;"></div>
</div>
<?php
}
}
if (function_exists("wp_next_scheduled")) {
$next = wp_next_scheduled('sm_build_cron');
if ($next) {
$diff = (time() - $next) * -1;
if ($diff <= 0) {
$diffMsg = __('Your sitemap is being refreshed at the moment. Depending on your blog size this might take some time!', 'sitemap');
} else {
$diffMsg = str_replace("%s", $diff, __('Your sitemap will be refreshed in %s seconds. Depending on your blog size this might take some time!', 'sitemap'));
}
?>
<div class="updated">
<strong><p><?php
echo $diffMsg;
?>
</p></strong>
<div style="clear:right;"></div>
</div>
<?php
}
}
if (!empty($_REQUEST["sm_rebuild"]) || !empty($_REQUEST["sm_rebuild"])) {
//Clear any outstanding build cron jobs
if (function_exists('wp_clear_scheduled_hook')) {
wp_clear_scheduled_hook('sm_build_cron');
}
}
if (!empty($_REQUEST["sm_rebuild"])) {
//Pressed Button: Rebuild Sitemap
check_admin_referer('sitemap');
if (isset($_GET["sm_do_debug"]) && $_GET["sm_do_debug"] == "true") {
//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;
}
$oldErr = error_reporting(E_ALL);
$oldIni = ini_set("display_errors", 1);
//.........这里部分代码省略.........
示例2: HtmlShowOptionsPage
//.........这里部分代码省略.........
echo '</div>';
@error_reporting($oldErr);
@ini_set("display_errors", $oldIni);
return;
} else {
$redirURL = $this->sg->GetBackLink() . '&sm_fromrb=true';
//Redirect so the sm_rebuild GET parameter no longer exists.
@header("location: " . $redirURL);
//If there was already any other output, the header redirect will fail
echo '<script type="text/javascript">location.replace("' . $redirURL . '");</script>';
echo '<noscript><a href="' . $redirURL . '">Click here to continue</a></noscript>';
exit;
}
} else {
if (!empty($_POST['sm_update'])) {
//Pressed Button: Update Config
check_admin_referer('sitemap');
if (isset($_POST['sm_b_style']) && $_POST['sm_b_style'] == $this->sg->getDefaultStyle()) {
$_POST['sm_b_style_default'] = true;
$_POST['sm_b_style'] = '';
}
foreach ($this->sg->GetOptions() as $k => $v) {
//Check vor values and convert them into their types, based on the category they are in
if (!isset($_POST[$k])) {
$_POST[$k] = "";
}
// Empty string will get false on 2bool and 0 on 2float
//Options of the category "Basic Settings" are boolean, except the filename and the autoprio provider
if (substr($k, 0, 5) == "sm_b_") {
if ($k == "sm_b_prio_provider" || $k == "sm_b_yahookey" || $k == "sm_b_style" || $k == "sm_b_memory") {
if ($k == "sm_b_filename_manual" && strpos($_POST[$k], "\\") !== false) {
$_POST[$k] = stripslashes($_POST[$k]);
}
$this->sg->SetOption($k, (string) $_POST[$k]);
} else {
if ($k == "sm_b_time") {
if ($_POST[$k] == '') {
$_POST[$k] = -1;
}
$this->sg->SetOption($k, intval($_POST[$k]));
} else {
if ($k == "sm_i_install_date") {
if ($this->sg->GetOption('i_install_date') <= 0) {
$this->sg->SetOption($k, time());
}
} else {
if ($k == "sm_b_exclude") {
$IDss = array();
$IDs = explode(",", $_POST[$k]);
for ($x = 0; $x < count($IDs); $x++) {
$ID = intval(trim($IDs[$x]));
if ($ID > 0) {
$IDss[] = $ID;
}
}
$this->sg->SetOption($k, $IDss);
} else {
if ($k == "sm_b_exclude_cats") {
$exCats = array();
if (isset($_POST["post_category"])) {
foreach ((array) $_POST["post_category"] as $vv) {
if (!empty($vv) && is_numeric($vv)) {
$exCats[] = intval($vv);
}
}
}