コード例 #1
0
ファイル: sitemap_fun.php プロジェクト: nilotpal/googlevideo
function wdtgenerate_sitemap()
{
    if (@$_POST['submit_image']) {
        if ($_FILES['upload_file']['name'] == '') {
            echo '<div class="error">Please select a file</div>';
        } else {
            $image_ext = end(explode('.', $_FILES['upload_file']['name']));
            $img_array = array('jpeg', 'jpg', 'gif', 'png');
            if (in_array($image_ext, $img_array)) {
                $upload_dir = dirname(__FILE__);
                if (!CheckFilePermission($upload_dir . '/noimage.gif')) {
                    echo '<div class="error">You have no write permission on ' . dirname(__FILE__) . '/noimage.gif</div>';
                } else {
                    $res = move_uploaded_file($_FILES['upload_file']['tmp_name'], $upload_dir . '/noimage.gif');
                }
            } else {
                echo '<div class="error">Valid allowed file types :jpg,jpeg,gif,png</div>';
            }
        }
    }
    if ($_POST['submit']) {
        $st = createSitemap();
        if (!$st) {
            echo '<br /><div class="error"><h2>Oops!</h2><p>None of your blog posts contain Either YouTube videos Or Self-hosted videos.</p></div>';
            exit;
        }
        ?>
<div class="wrap">
<h2>Sitemap for Videos</h2>
<?php 
        $sitemapurl = get_bloginfo('home') . "/videositemap.xml";
        ?>
<p>The XML Sitemap has been generated successfully. To confirm that there are no errors,Please open the <a target="_blank" href="<?php 
        echo $sitemapurl;
        ?>
">Sitemap file</a> in web browser.</p>
<?php 
    } else {
        ?>
<div class="wrap">
  <h2>Sitemap for Videos</h2>
  
  <h3>Please click on the below button to generate video sitemap :</h3>
  <form id="options_form" method="post" action="">
    <div class="submit">
      <input type="submit" name="submit" id="sb_submit" value="Generate Video Sitemap" />
    </div>
  </form>
 <a style="text-decoration:none;" href="<?php 
        echo get_bloginfo('url');
        ?>
/videositemap.xml" target="_blank">Display Video Sitemap</a>
</div>

<div class="wrap">
<h3>Upload a default thumbnail :</h3>
<form action="" method="post" enctype="multipart/form-data" style="padding-top:20px;">
<input type="file" name="upload_file" />
<input type="submit" value="change" name="submit_image" />
</form>
<a href="#" style="text-decoration:none; padding-top:20px; float:left;" onClick="window.open('<?php 
        echo get_bloginfo('url');
        ?>
/wp-content/plugins/video_sitemap_xml/default.html','mywindow','width=300,height=300')">Preview Default Thumbnail</a>
</div>
<?php 
    }
}
コード例 #2
0
    if ($mod_cnf['export_products_ve']) {
        $xmlList_prod_vendor = getProductsVendor();
    }
    // get manufacturer products
    if ($mod_cnf['export_products_ma']) {
        $xmlList_prod_manufacturer = getProductsManufacturer();
    }
}
// get products (with offset)
if ($mod_cnf['export_products']) {
    $xmlList_prod = getProducts($pcall);
}
// build xml-data and output
$xmlList = array_merge($xmlList_prod, $xmlList_prod_vendor, $xmlList_prod_manufacturer, $xmlList_cat, $xmlList_cms, $xmlList_vendor, $xmlList_manufacturer, $xmlList_tags, $xmlList_static);
// create sitemap
$sitemapdata = createSitemap($xmlList);
$smfile = createXmlFile($sitemapdata);
// compress sitemap
#compressSitemapFile($smfile);
// create global sitemaps-index-file (watch sitemaps.org for more infos..)
createSitemapIndex();
//** RECALL SCRIPT
if ($pcall < $cntCalls) {
    // memory seems to hold list-array-values, maybe depends on local environment
    unset($xmlList, $xmlList_cat, $xmlList_cms, $xmlList_vendor, $xmlList_manufacturer, $xmlList_tags, $xmlList_prod, $xmlList_prod_manufacturer, $xmlList_prod_vendor, $xmlList_static);
    // call itself
    $exec = './googlesitemap.sh -c ' . ($pcall + 1);
    //echo "\n".$exec."\n"; //debug
    system($exec);
    exit(0);
}