Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
simple google and yahoo site verification plugins
#5
Nope. Still can't get it to work.
But in the meantime I wrote this.
Others might not like the messy touch and file_get_contents business but i'm very new to xml and haven't learned how to it with getsimple plugins yet
In the meantime, the works fine for me.
Use and share if you want

Code:
<?php
$thisfile=basename(__FILE__, ".php");
register_plugin(
    $thisfile,
    'Google Verification',
    '',
    '',
    '',
    '',
    'plugins',
    'veri_admin'
);
add_action('theme-header','google_verification');
add_action('plugins-sidebar','createSideMenu',array($thisfile,'Google Verification'));
function google_verification() {
    if (file_exists("./data/other/google-veri.cfg")) {
        if (file_get_contents("./data/other/google-veri.cfg") != "") {
            echo '<meta name="google-site-verification" content="'.file_get_contents("./data/other/google-veri.cfg").'" />'."\n"; }}}
function veri_admin() {
    if (!file_exists("../data")) { echo "Sorry, I couldn't find your /data directory"; }
    else if (!file_exists("../data/other")) { echo "Sorry, I couldn't find your /data/other directory"; }
    else if (!file_exists("../data/other/google-veri.cfg")) { touch("../data/other/google-veri.cfg"); }
    if (file_exists("../data/other/google-veri.cfg")) {
        if (isset($_POST['save_veri'])) {
            if (!file_put_contents("../data/other/google-veri.cfg",$_POST['veri_code'])) {
                $open = fopen("../data/other/google-veri.cfg","w");
                fwrite($open,$_POST['veri_code']);
                fclose($open); }}
    ?>
<form method='post' action='load.php?id=verification'>
If you don't use Google Verification (such as via Webmaster Tools) leave<br>
the field blank. Otherwise enter the content component of the meta tag as<br>
it appears in the details instructed to you Google Webmaster Tools<br><br>
<span style='color: #666666;'><i>&lt;meta name=&quot;google-site-verification&quot; content=&quot;&nbsp;</i></span>
<input type='text' name='veri_code' value='<?php echo file_get_contents("../data/other/google-veri.cfg"); ?>'>
<span style='color: #666666;'><i>&nbsp;&quot; /&gt;</i></span><br><br>
<input type='submit' name='save_veri' value='Update Details'>
</form>
<?php } else {
    echo "Sorry, I failed to create the google-veri.cfg config file.<br>
        Make sure you hae write permissions on the data directories."; }} ?>

PS: I marked the code as CODE, so it will be better to identify, Connie
Reply


Messages In This Thread
simple google and yahoo site verification plugins - by enliven - 2011-10-03, 12:37:26



Users browsing this thread: 1 Guest(s)