Changeset 34056

Show
Ignore:
Timestamp:
03/07/08 03:24:47 (4 months ago)
Author:
midrangeman
Message:

update setup panel, no longer need to echo tag function

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • wp-tags-to-technorati/trunk/readme.txt

    r27113 r34056  
    3030wordpress loop. 
    3131 
     32NOTE: In previous versions of the plug-in the tags2tech_get_tags_links()  
     33call needed to be echo'ed.  This is no longer required, although the old 
     34functionality will still work. 
     35 
    3236== Frequently Asked Questions ==  
    3337 
  • wp-tags-to-technorati/trunk/wp-tags-to-technorati.php

    r27114 r34056  
    44Plugin URI: http://www.geekyramblings.org/plugins/wp-tags-to-technorati/ 
    55Description: Simple plugin to convert Wordpress 2.3's tags to Technorati ('http://technorati.com') links. 
    6 Version: 0.7 
     6Version: 0.8 
    77Author: David Gibbs 
    88Author URI: http://www.geekyramblings.org 
     
    1111/* 
    1212 
    13     Copyright 2007 by David Gibbs <david@midrange.com> 
     13    Copyright 2007,2008 by David Gibbs <david@midrange.com> 
    1414 
    1515    This program is free software: you can redistribute it and/or modify 
     
    4141                  a new window.  Also added version identifier to 
    4242                  comment. 
    43  
     4302/27/08    0.8   Reformatted setup panel. 
     44                  tags2tech_get_tags_links() no longer needs to be 
     45                  echo'ed.  When invoked directly, it will output 
     46                  the links directly.  It will still work with the 
     47                  echo method though. 
     48                   
    4449*/ 
    4550 
    46 $tags2tech_version = "0.7"
     51$tags2tech_version = 0.8
    4752 
    4853$tag_url = "http://technorati.com/tag"; 
     
    7378      $tags = get_the_tags(); 
    7479 
    75       $tag_text = get_option('tags2tech_label').": "; 
     80      $tag_text = get_option('tags2tech_label')." "; 
    7681       
    7782      $count=0; 
     
    9196            $tag_links = ""; 
    9297      } 
    93       return $tag_start.$tag_links.$tag_end; 
     98 
     99      echo $tag_start.$tag_links.$tag_end; 
     100      return ""; 
    94101} 
    95102 
     
    115122      <?php wp_nonce_field('update-options'); ?> 
    116123 
     124<table class="form-table"> 
     125 <tr> 
     126      <th scope="row" valign="top">Technorati Tags label:</th> 
     127      <td> 
     128      <input id="tags2tech_label" type="text" name="tags2tech_label" value="<?php echo get_option('tags2tech_label'); ?>" /> 
     129            <label for="inputid">Text that will display in front of the tags</label> 
     130      </td> 
     131 </tr> 
     132 <tr> 
     133      <th scope="row" valign="top">Open Technorati links in a new window?</th> 
     134      <td> 
     135      <input id=tags2tech_new_window" type="checkbox" name="tags2tech_new_window" <?php echo get_option('tags2tech_new_window')?'checked=checked':''; ?> />  
     136            <label for="tags2tech_new_window">Check this box to open links to Technorati in a new window.</label> 
     137      </td> 
     138 </tr> 
     139 <tr> 
     140      <th scope="row" valign="top">Include tags in post footer?</th> 
     141      <td> 
     142      <input id="tags2tech_footer" type="checkbox" name="tags2tech_footer" <?php echo get_option('tags2tech_footer')?'checked=checked':''; ?> />  
     143            <label for="tags2tech_footer">If you want to include the links in any other location on the page than the footer, disable this checkbox and add a call to <code>tags2tech_get_tags_links()</code> somewhere in the main wordpress 'loop'.</label> 
     144      </td> 
     145 </tr> 
     146</table> 
     147 
     148 
    117149        <p class="submit"> 
    118         <input type="submit" name="Submit" value="<?php _e('Update Options �') ?>" /> 
    119         </p> 
    120  
    121       Technorati Tags label: <input type="text" name="tags2tech_label" value="<?php echo get_option('tags2tech_label'); ?>" /> <p/> 
    122       Open Technorati Link in new window?  <input type="checkbox" name="tags2tech_new_window" <?php echo get_option('tags2tech_new_window')?'checked=checked':''; ?> /> <p/> 
    123       Include tags in post footer? <input type="checkbox" name="tags2tech_footer" <?php echo get_option('tags2tech_footer')?'checked=checked':''; ?> /> <p/> 
    124  
    125         <p class="submit"> 
    126         <input type="submit" name="Submit" value="<?php _e('Update Options �') ?>" /> 
     150        <input type="submit" name="Submit" value="Save Changes" /> 
    127151        </p> 
    128152      <input type="hidden" name="action" value="update" /> 
     
    138162} 
    139163 
     164function tags2tech_checkupgrade() { 
     165      global $tags2tech_version; 
     166 
     167      $last_version = get_option('tags2tech_version'); 
     168      $current_version = $tags2tech_version; 
     169      echo "<!-- last_version = $last_version, current_version = $current_version -->\n"; 
     170      if ($current_version > $last_version) { 
     171            echo "<!-- upgrading to $tags2tech_version -->\n"; 
     172            $label = get_option('tags2tech_label'); 
     173            echo "<!-- oldlabel = $label -->\n"; 
     174            if (substr($label,-1) <> ":") { 
     175                  $newlabel = $label.":"; 
     176                  update_option('tags2tech_label',$newlabel); 
     177                  echo "<!-- newlabel = $newlabel -->\n"; 
     178            } 
     179            update_option('tags2tech_version',$tags2tech_version); 
     180      } 
     181 
     182} 
     183 
    140184function tags2tech_activate() 
    141185{ 
    142186        // Let's add some options 
    143187      // add_option('tags2tech_label', 'Technorati Tags'); 
    144  
    145188} 
    146189 
     
    153196} 
    154197 
    155 add_option('tags2tech_label', 'Technorati Tags'); 
     198add_option('tags2tech_version', 0.01); 
     199add_option('tags2tech_label', 'Technorati Tags:'); 
    156200add_option('tags2tech_footer', true); 
    157201add_option('tags2tech_new_window', false); 
     
    159203add_action('admin_menu', 'tags2tech_menu'); 
    160204 
     205// register_activation_hook( __FILE__, 'tags2tech_activate' ); 
     206 
    161207add_action('activate_wp-tags-to-technorati/wp-tags-to-technorati.php', 
    162208      'tags2tech_activate'); 
     
    164210      'tags2tech_deactivate'); 
    165211 
     212// add_action('wp_head','tags2tech_checkupgrade'); 
     213add_action('plugins_loaded','tags2tech_checkupgrade'); 
     214 
    166215?>