function LCZ_for_SAE() { if (LCZ_IS_SAE()) { ?> <h3>SAE环境:</h3> <p>提醒:如果是用SAE平台,打开网站根目录下的config.yaml加入两行代码</p> <pre> - rewrite: if ( path ~ "sitemap_baidu.xml" ) goto "wp-content/plugins/baidu-sitemap-generator/SAE_xml.php" - rewrite: if ( path ~ "sitemap.html" ) goto "wp-content/plugins/baidu-sitemap-generator/SAE_html.php" </pre> <?php } }
function LCZ_IsFileWritable($filename) { if (LCZ_IS_SAE()) { return true; } ## SAE环境 clearstatcache(); //can we write? if (!is_writable($filename)) { //no we can't. if (!@chmod($filename, 0666)) { $pathtofilename = dirname($filename); //Lets check if parent directory is writable. if (!is_writable($pathtofilename)) { //it's not writeable too. if (!@chmod($pathtoffilename, 0666)) { //darn couldn't fix up parrent directory this hosting is foobar. //Lets error because of the permissions problems. return false; } } } } //we can write, return 1/true/happy dance. return true; }