My First Look at WordPress Plugins

As I mentioned the post just before this, I want to learn a bit more about Wordpress, specifically plugins (no, I won't be doing any theme designs!). As it happened, someone had read my post about generating Numly tags and they happened to have a non-working plugin that was supposed to get Numly tags automatically. As the plugin was published under a GNU license, I agreed to take a look at it.

That offer was somehat brazen. At that moment I knew nothing whatsoever about WordPress plugins other than that they existed and were written in Php. My Php skills are weak - I prefer Perl.

But hey, Php is very similar to Perl - if you can write Perl you can surely read Php - and while I may not know much about WordPress, I had a pretty good idea how plugins would be likely to work. So I said, sure, go ahead and send me the code.

The code is two files - I've added both of them to the bottom of this post so that you can read the whole thing if you like.

The first thing I noticed is that it looked like the code would go out and get a tag from Numly. I noticed this line:

add_action('publish_post','numly_publish_post');
 

I assumed that this would call "numly_publish_post" when WordPress published a post. That function looked like it checked to see if it already had acquired a Numly ESN and would go get one if it had not. I didn't know if it would make that call before, during or just after publishing, but it looked reasonable to me.

So I went ahead and installed the plugin, set its administrative parameters and created a new post. I got email from Numly instantly, which told me that it had indeed generated to ESN. I then dropped back to the command line and dumped the WordPress database to see if it had stored the data correctly:

$ mysqldump wordpress -p | grep numly_key
Enter password: 
INSERT INTO `wp_postmeta` VALUES
(1,3,'_edit_lock','1231683620'),(2,3,'_edit_last','1'),(5,6,
'_edit_lock','1231691097'),(6,6,'_edit_last','1'),
(8,6,'numly_key','9374309011185456164');
 

("wordpress" is the name I chose for the database)

So that looks good, and it has the right data, you can go to Numly.com with that "9374309011185456164" and look up the copyright. So that's all good.. but what makes it appear on the page?

Well, it looks like the "numly_output" function will do that; it just needs to be passed a page id. But what calls it? I saw nothing that would cause this code to run. Possibly I misunderstand plugins - maybe that function gets called automagically, but I doubt it. So I tried adding a new line: "add_action('comment_form','numly_output');" (shown in bold in the code below) and yes, that worked.

See the comments for how it was probably supposed to work.

Well, "worked", but I'm not happy with it. It plops a link below the comments and doesn't seem to want to show the barcode. I'm confident I can fix all that and make it look better, so there is more to do but I was happy to find that WordPress plugins are as simple as I expected.

Here's the code:

blogbling_functions.php
<?php if (!function_exists('blogbling_version_check')) {

function blogbling_version_check
($plugin_name='',$last_check_time,$interval=7) {
  /*
   * Version Check code.  * This is a bit verbose. I'd
   like to cut it down a bit. I know this works * in
   almost all cases. Some places may not have curl
   installed. I could do * it in AJAX calling the plugin
   itself with a parameter and firing off a * call but
   that's basically the same as what I'm doing here. So
   why bother.  */ $interval        = intval($interval);
  $current_version = -1; if
  (($last_check_time+(86400*$interval))<mktime()) {

  $current_version =
  blogbling_url_get('http://blog.calevans.com/plugin_version_checker.php?plugin='.$plugin_name);
  } else {
  $current_version = -1; }// if
  (($notable_settings['last_version_check']+(86400*7))<mktime())
return $current_version; } // function blogbling_version_check
($plugin_name)


// depricated. Code moved back into wp-alexadex because it's
too specific.  function blogbling_url_get($url) {
  // user send_to_host whenever possible, it's better.
  $return_value = ''; $elements = parse_url($url); if
  ($fp = @fsockopen($elements['host'],80)) {
  fputs($fp, sprintf("GET %s HTTP/1.0\r\n" .
  "Host: %s\r\n\r\n", $elements['path'] . (isset
  ($elements['query']) ? '?'. $elements['query']
  : ''), $elements['host'])); while (!feof($fp))
  $line .= fgets($fp, 4096); fclose($fp); $line
  = urldecode(trim(strtr($line,"\n\r\t ","
  "))); $work_array = explode("  ",$line); /*
   * This does not allow for any additional
   messages to be passed. It * assumes that the
   last time coming in is the version #.  */
  $return_value = $work_array[count($work_array)-1];
  } // if ($fp) return $return_value; } // function
blogbling_url_fetch($url)


function blogbling_get_version($file_name) {
  if (!empty($file_name)) {
  /*
   * Ripped out of WordPress Not sure if I'll
   ever use any more of this but I'll * leave
   them in just for fun.  */ $plugin_data =
  implode('', file($file_name)); if
  (preg_match("|Version:(.*)|i", $plugin_data,
  $version)) {
  $version = $version[1];
  } // if (preg_match("|Version:(.*)|i",
  $plugin_data, $version)) } // if (!empty($filename))
  return $version; } // function blogbling_get_version($file_name)


function
blogbling_send_to_host($host,$method,$path,$data,$return_full_headers=false)
{

    $method = empty($method)?'GET':strtoupper($method); if
    ($method == 'GET') $path .= '?' . $data; $output  = '';
    $output .= $method." ".$path." HTTP/1.1\r\n"; $output .=
    "Host: ".$host."\r\n"; $output .= "Content-type:
    application/x-www-form-urlencoded\r\n"; $output .=
    "Content-length: ".strlen($data)."\r\n"; $output .=
    "Connection: close\r\n\r\n"; $output .=
    ($method=='POST'?$data:'')."\n";

    $fp = fsockopen($host, 80);
  $switch = false; fputs($fp,$output); /*
   * Change this to store headers in one array and lines
   in another. If * return full headers is true then
   concat before returning.  */ while (!feof($fp)) {
  $line =
  strtr(fgets($fp,128),array("\n"=>"","\r"=>""));
  if (!$switch and empty($line)) {
  $switch = (!$switch); } else if
  ($switch) {
  $buf .= $line; } // if (!$switch and
  empty($line)) } // while (!feof($fp)) fclose($fp);
    return $buf; } // function
blogbling_sendToHost($host,$method,$path,$data,$useragent=0)


function blogbling_fetch_options($prefix='blogbling') {
  $output = array(); $output=get_option($prefix.'_options');
  return $output; } // function
blogbling_fetch_options($prefix='blogbling')


function blogbling_post_options($prefix='blogbling',$source_array)
{
  update_option($prefix.'_options',$source_array);
  return; } // if (!function_exists('blogbling_version_check'))
} // if (!function_exists('blogbling_version_check')) ?>
 
wp-numly.php
<?PHP /* Plugin Name:wp-numly Plugin URI:
http://www.calevans.com/view.php/page/numly Description:
Electronic Standard Book Number (numly) is the unique identifier
of electronic content and media. numlys are recognized worldwide
by electronic publishing companies and electronic content
providers. They serve as branded identifier or copyright for
individuals or companies developing electronic content and
media. numlys are assigned and managed by <a
href="http://www.numly.org">numly.ORG</a>.  This plugin
automatically grnerates an numly for each new post. This plugin
requires Wordpress 2.0+ Version: 1.5 Author: Cal Evans
<[email protected]> Author URI: http://blog.calevans.com/ */

/*
 *  Copyright 2005  Cal Evans  (email: [email protected]) * *
 This program is free software; you can redistribute it and/or
 modify *  it under the terms of the GNU General Public License
 as published by *  the Free Software Foundation; either
 version 2 of the License, or *  (at your option) any later
 version.  * *  This program is distributed in the hope that
 it will be useful, *  but WITHOUT ANY WARRANTY; without even
 the implied warranty of *  MERCHANTABILITY or FITNESS FOR A
 PARTICULAR PURPOSE.  See the *  GNU General Public License
 for more details.  * *  You should have received a copy of
 the GNU General Public License *  along with this program;
 if not, write to the Free Software *  Foundation, Inc., 59
 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

/*
 * History * 1.0 03/02/2006 - Cal * Initial Coding * * 1.1
 03/04/2006 - Cal * Initial Release * * 1.1 03/04/2006 - Cal
 * receoded the options into a single database hit.  * * 1.5
 04/18/2006 - Cal * Changed name to numly.  */

require_once('blogbling_functions.php');

function numly_output($id=0) {
  $numly_settings = blogbling_fetch_options('numly');
  $numly_current_key = get_post_meta($id,'numly_key'); $output
  = ''; $license_array = numly_prepare_license_array(); if
  (is_array($numly_current_key)) $numly_current_key =
  $numly_current_key[0];

  if (!empty($numly_current_key)) { $output  = '<div
  class="numly-output">'; $output .= '<a
  href="http://www.numly.com/numly/verify.asp?id='.$numly_current_key.'"
  target="_blank">';



  $output .= '<center><img alt="numly"
  src="http://numly.com/numly/numicon.gif" border="0"/>';
  $output .= ''.$numly_current_key.' </center>';



  if ($numly_settings['show_barcode']=='yes') { $output .=
  '<br /><img
  src="http://numly.org/numly/barcode.asp?code='.$numly_current_key.'&height=20&width=1&mode=code39"/>';
  } // if ($numly_settings['show_barcode']=='yes') $output .=
  '</a></div>';

  if ($numly_settings['cc_license']!='reserved') { $output .=
  '<div ><!--Creative Commons License--><a rel="license"
  href="http://creativecommons.org/licenses/'.$numly_settings['cc_license'].'/3.0/">




<!--<img alt="Creative Commons License"
border="0"src="http://creativecommons.org/images/public/somerights20.png"/></a><br/>-->

<!--This work is licensed under a <a rel="license"
href="http://creativecommons.org/licenses/'.$numly_settings['cc_license'].'/3.0/">Creative
Commons '.$license_array[$numly_settings['cc_license']].' 3.0
License</a>.--> <hr color="blue" size="2"> <br> </br> <br>
</br> <br> </br>


<!--/Creative Commons License--><!-- <rdf:RDF
xmlns="http://web.resource.org/cc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><Work
rdf:about=""><license
rdf:resource="http://creativecommons.org/licenses/'.$numly_settings['cc_license'].'/3.0/"
/></Work><License
rdf:about="http://creativecommons.org/licenses/by-nd/3.0/"><permits
rdf:resource="http://web.resource.org/cc/Reproduction"/><permits
rdf:resource="http://web.resource.org/cc/Distribution"/><requires
rdf:resource="http://web.resource.org/cc/Notice"/><requires
rdf:resource="http://web.resource.org/cc/Attribution"/></License></rdf:RDF>
--></div>';
  } // if ($numly_settings['cc_license']!='reserved')

  } // if (!empty($numly_current_key)) echo $output; return;
} // function numly_output()


function numly_prepare_license_array() {
  $license_array = array(); $license_array["reserved"] = "All
  Rights Reserved"; $license_array["by"]       = "Attribution";
  $license_array["by-nc"]    = "Attribution-NonCommercial";
  $license_array["by-nc-nd"] = "Attribution-NonCommercial-NoDerivs";
  $license_array["by-nc-sa"] = "Attribution-NonCommercial-ShareAlike";
  $license_array["by-nd"]    = "Attribution-NoDerivs";
  $license_array["by-sa"]    = "Attribution-ShareAlike";

  return $license_array;

} // function numly_prepare_license_array()


/*
 * The options Page */ function numly_options_page() {
  $version = blogbling_get_version(__file__);

  /*
   * Process a POSTED form.  */ if (isset($_POST['info_update']))
  { blogbling_post_options('numly',$_POST['numly_settings']);
  } // if (isset($_POST['info_update']))


  $numly_settings = blogbling_fetch_options('numly');
  $license_array = numly_prepare_license_array() ?>

<?PHP if (isset($_POST['info_update'])) {?><div id="message"
class="updated fade"><p><strong>Options Saved</strong></p></div><?PHP
} ?>

<div class=wrap>
  <form method="post">
    <h2>numly Configuration Options</h2> <input type = "hidden"
	 name = "numly_settings[numly_last_version_check]"
	       value="<?=$numly_settings['numly_last_version_check'];?>"
	       />

    <fieldset name="user_name"> <legend>Your numly User Name<br
  />(Note: The plugin will not operate without it.)</legend>
  <input type="text"
	       name="numly_settings[username]"
	       value="<?=$numly_settings['username'];?>"
	       size="75" />
  </fieldset>

    <fieldset name="publisher"> <legend>Your Name or the name
  of the publisher of the content.</legend> <input type="text"
	       name="numly_settings[publisher]"
	       value="<?=$numly_settings['publisher'];?>"
	       size="75" />
  </fieldset>

    <fieldset name="show_barcode"> <input type  = "checkbox"
	 name  = "numly_settings[show_barcode]" value = "yes"
     <?=$numly_settings['show_barcode']=='yes'?'CHECKED':'';?>
     /> <label>Display the barcode?</label> </fieldset>
    <fieldset name="cc_license"> <legend>What Creative Commons
  License would you like to use?</legend>

  <select name="numly_settings[cc_license]"> <?PHP
foreach($license_array as $key=>$value) { ?>
  <option value="<?=$key?>"
  <?=($numly_settings['cc_license']==$key)?'SELECTED':''?>
  ><?=$value;?></option> <?PHP } // foreach($license_array as
$key=>$value) ?>
  <option value="publicdomain">Public Domain</option> </select>
    </fieldset>

  <!-- Standard BlogBling stuff --> <fieldset
  name="version_check_interval"> <legend>Days Between Version
  Checks</legend> <input type      = "text"
	 name      = "numly_settings[version_check_interval]"
     value     = "<?=$numly_settings['version_check_interval'];?>"
     size      = "2" maxlength = "2" /> </fieldset>

<div class="submit">
  <input type="submit" name="info_update" value="<?php
  _e('Update', 'Localization name')?>" /> </div>
  </form> </div> <?PHP
  if ($numly_settings['version_check_interval']>0) {
  $current_version =
  blogbling_version_check(basename(__FILE__,'.php'),$numly_settings['last_version_check'],$numly_settings['version_check_interval']);
  if ($current_version!=-1) { if ($version!=$current_version)
  { ?>
  <div class="wrap" style="border:solid 1px red;">This is
  version <?=$version;?>. The current version of the plugin
  is <?=$current_version;?>. Click <a
  href="http://www.calevans.com/view.php/page/numly" target="_NEW"
  title="Opens a new window.">here</a> to go to the project
  page to find out more. </div> <?PHP
  } else { ?>
  <div class="wrap" >This is version is up to date. </div>
<?PHP
  } // if ($version!=$current_version)
  $numly_settings['last_version_check']=mktime();
  blogbling_post_options('numly',$numly_settings); } // if
  ($current_version!=-1) } // if
  ($numly_settings['version_check_interval']>0) ?>
  <div class="wrap" > <?PHP ?> <table border="0" width="100%">
  <tr> <td alignt="left" width="50%">Contact the <a
  href="mailto:[email protected]">Author</a> if you are having
  problems or read his <a href="http://blog.calevans.com"
  target="_NEW" title="Postcards From My Life">blog</a><br
  /><a href="http://blog.calevans.com/blog-bling" target="_NEW"
  style="border:none;"><image
  src="/wp-content/plugins/blogbling/images/blogbling.gif"
  alt="Blog Bling"></a></td><td align="right" width="50%">Get
  an numly account or manage the one you have.<br /><a
  href="http://www.numly.org" target="_BLANK"><img
  src="/wp-content/plugins/blogbling/images/numlyicon.gif"
  alt="numly" /></a></td> </tr> </table> </div> <?PHP }


function numly_publish_post($id = 0) {
  $numly_current_key = get_post_meta($id,'numly_key');

  if (strlen($_POST['post_password'])<1 and empty($numly_current_key))
  { // get the options $numly_settings = blogbling_fetch_options('numly');
  $user_info = get_userdata($_POST['post_author']);

  if (is_object($user_info)) { $numly_data = array();
  $numly_data['username']  = $numly_settings['username'];
  $numly_data['docname']   = $_POST['post_title'];
  $numly_data['docdesc']   = $_POST['content']; $numly_data['author']
  = $user_info->display_name; $numly_data['publisher'] =
  $numly_settings ['publisher']; $numly_data['licensee']  =
  $user_info->display_name; $numly_data['licemail']  =
  $user_info->user_email; $numly_data['url']       =
  get_settings('siteurl').'/index.php?p='.$id; $numly_data['idonly']
  = 'true';

  $numly_query = ''; foreach ($numly_data as $key=>$value) {
  $numly_query .= urlencode(trim($key))."=".urlencode(trim($value))."&";
  }  // foreach ($numly_data as $key=>$value)

  // call the site $numly_id =
  blogbling_send_to_host('www.numly.com','POST','/numly/generate.asp',$numly_query);
  } // if (is_array($user_info)) // save off the meta.  if
  (is_array($numly_id)) $numly_id = $numly_id[0]; if
  (is_numeric($numly_id)) { add_post_meta($id,'numly_key',$numly_id,true);
  } // if (is_numeric($numly_id)) } // if (empty($numly_current_key))


} // function numly_publish_post()


function numly_add_option_page() {
  add_options_page("numly Configurator", 'numly', 7, __FILE__,
  'numly_options_page'); } // function numly_add_option_page()


/*
 * Undo the damage we may have done. if this plugin has alreayd
 been installed * then let's hit the database, grab the options,
 store them all in one array * then write the back out.  */
function numly_install() {
  $output = array(); $output['username']               =
  get_option('numly_username'); $output['publisher']
  = get_option('numly_publisher'); $output['show_barcode']
  = get_option('numly_show_barcode'); $output['last_version_check']
  = get_option('numly_last_version_check');
  $output['version_check_interval'] =
  get_option('numly_version_check_interval');

  delete_option('numly_username'); delete_option('numly_publisher');
  delete_option('numly_show_barcode');
  delete_option('numly_last_version_check');
  delete_option('numly_version_check_interval');

  /*
   * Set Defaults */ $output['username']               =
  empty($output['username'])?'':$output['username'];
  $output['publisher']              =
  empty($output['publisher'])?'':$output['publisher'];
  $output['show_barcode']           =
  ($output['show_barcode']=='yes')?'yes':'no';
  $output['last_version_check']     =
  empty($output['last_version_check'])?0:$output['last_version_check'];
  $output['version_check_interval'] =
  empty($output['version_check_interval'])?7:$output['version_check_interval'];
  $output['cc_license']             =
  empty($output['cc_license'])?'reserved':$output['cc_license'];

  blogbling_post_options('numly',$output);

  return; } // function numly_install()


/*
 * Register our intentions with WordPress.  */ if (isset($wp_version))
{
  add_action('admin_menu', 'numly_add_option_page');
  add_action('publish_post','numly_publish_post');
  add_action('comment_form','numly_output');
  register_activation_hook(__file__, 'numly_install'); } //
if (isset($wp_version)) /*


<!--Creative Commons License--><a rel="license"
href="http://creativecommons.org/licenses/by-nc/3.0/"><img
alt="Creative Commons License" border="0"
src="http://creativecommons.org/images/public/somerights20.png"/></a><br/>

<!-- <rdf:RDF xmlns="http://web.resource.org/cc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <Work rdf:about=""> <license
  rdf:resource="http://creativecommons.org/licenses/by-nc/3.0/"
  /> </Work> <License
  rdf:about="http://creativecommons.org/licenses/by-nc/3.0/"><permits
  rdf:resource="http://web.resource.org/cc/Reproduction"/><permits
  rdf:resource="http://web.resource.org/cc/Distribution"/><requires
  rdf:resource="http://web.resource.org/cc/Notice"/><requires
  rdf:resource="http://web.resource.org/cc/Attribution"/><prohibits
  rdf:resource="http://web.resource.org/cc/CommercialUse"/><permits
  rdf:resource="http://web.resource.org/cc/DerivativeWorks"/></License></rdf:RDF>
  -->


<!--Creative Commons License--><a rel="license"
href="http://creativecommons.org/licenses/by-nd/3.0/"><img
alt="Creative Commons License" border="0"
src="http://creativecommons.org/images/public/somerights20.png"/></a><br/>








<!--/Creative Commons License--><!-- <rdf:RDF
xmlns="http://web.resource.org/cc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <Work rdf:about=""> <license
  rdf:resource="http://creativecommons.org/licenses/by-nd/3.0/"
  /> </Work> <License
  rdf:about="http://creativecommons.org/licenses/by-nd/3.0/"><permits
  rdf:resource="http://web.resource.org/cc/Reproduction"/><permits
  rdf:resource="http://web.resource.org/cc/Distribution"/><requires
  rdf:resource="http://web.resource.org/cc/Notice"/><requires
  rdf:resource="http://web.resource.org/cc/Attribution"/></License></rdf:RDF>
  --> */

?>
 


Got something to add? Send me email.





(OLDER) <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> -> My First Look at WordPress Plugins


19 comments



Increase ad revenue 50-250% with Ezoic


More Articles by

Find me on Google+

© Anthony Lawrence







Sun Jan 11 21:29:14 2009: 5146   TonyLawrence

gravatar
OK, after a little more reading I understand more.

This plugin creates the field "numly_key" but your Theme has to be told to use it if you don't make the changes I did. Originally there were probably more instructions with this plugin; see
(link) for the basic idea.

So - the way I did it just does it - as long as you don't mind it below the comments. By adding the right tag to your theme, it works that way..



Sun Jan 11 22:04:26 2009: 5147   TonyLawrence

gravatar
Specifically, you'd probably add

<?php numly_output($id); ?>

to your "single.php" file. If you do it that way, do NOT use the "add_action('comment_form','numly_output');" that I added to the plugin.

I still haven't figured out why it doesn't do the barcode..





Mon Jan 12 01:51:56 2009: 5148   BruceGarlock


Yes, you have to add that code to your theme file, in my case, I put it in these two files.

single.php:

<?php get_header() ?>

<div id="container">
<div id="content">

<?php the_post() ?> <?php adsensem_ad(); ?>
<div id="post-<?php the_ID(); ?>" class="<?php sandbox_post_class() ?>">
<h1 class="entry-title"><?php the_title(); ?>


<div class="entry-content">
<?php the_content() ?>

<?php wp_link_pages("\t\t\t\t\t<div class='page-link'>".__('Pages: ', 'sandbox'), "</div>\n", 'number'); ?>

<?php edit_post_link(__('Edit', 'sandbox'),'<span class="edit-link">','</span>') ?>
<?php if (function_exists('numly_output')) numly_output($id); ?>
</div>
</div><!-- .post -->
</div><!-- #content -->
</div><!-- #container -->
<?php get_sidebar() ?>
<?php get_footer() ?>


and in index.php:


<?php get_header() ?>

<div id="container">
<div id="content">

<?php while ( have_posts() ) : the_post() ?>
<div id="post-<?php the_ID() ?>" class="<?php sandbox_post_class() ?>">
<h2 class="entry-title">"<?php the_permalink() ? " title="<?php printf(__('Permalink to %s', 'sandbox'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark"><?php the_title() ?>


<div class="top-meta">
<small class="metadata">
<span class="comments-link"><?php comments_popup_link('0', '1', '%', 'commentslink', 'Closed'); ?></span>
<span class="meta-sep">|</span>
<span class="chronodata"><?php the_time('F jS, Y') ?></span>
<span class="meta-sep">|</span>
<span class="cat-links"><?php printf(__('Posted in %s', 'sandbox'), get_the_category_list(', ')) ?></span>
<?php edit_post_link(__('Edit', 'sandbox'), "\t\t\t\t\t<span class=\"meta-sep\">|</span><span class=\"edit-link\">", "</span>\n"); ?>

</small>
</div>
<div class="entry-content">
<?php the_content(''.__('Read More <span class="meta-nav">&raquo;</span>', 'sandbox').''); ?>

<?php wp_link_pages('before=<div class="page-link">' .__('Pages:', 'sandbox') . '&after=</div>') ?>
</div>
<div class="bottom-meta"> <?php adsensem_ad(); ?>
<?php if (function_exists('numly_output')) numly_output($id); ?>
<small class="metadata"><?php the_tags(__('<span class="tag-links">Tagged in: ', 'sandbox'), ", ", "</span>\n") ?></small>
</div>
</div><!-- .post -->

<?php comments_template() ?>
<?php endwhile ?>

<div id="nav-below" class="navigation">
<div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">&laquo;</span> Older posts', 'sandbox')) ?></div>
<div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">&raquo;</span>', 'sandbox')) ?></div>
</div>

</div><!-- #content -->
</div><!-- #container -->

<?php get_sidebar() ?>
<?php get_footer() ?>



Everything seems to work fine for me. I remember reading some docs somewhere, but the author seemed to totally remove everything about numly from his site/blog. Has anyone been able to get in touch with him?








Mon Jan 12 01:57:53 2009: 5149   BruceGarlock


Oh, and the barcode can be turned on/off in the configuration, in the settings section named 'numly'. If I check the checkbox, then the barcode is shown. Because of my theme, it doesn't look good, so I don't display it.

I think a lot requires that you are familiar with what theme you are using, and placing the code in the correct <DIV> section.

I'm still a little confused as to exactly what is, and what is not working for everyone. Everything seems to just work for me, and I never had any trouble with it. Maybe the people having trouble with it, don't have it in the right spot in the theme files?

- Bruce







Mon Jan 12 02:02:47 2009: 5150   TonyLawrence

gravatar
I think that might be it, Bruce. Or they may not know to put it in as the documentation is not available.

They can use my ""add_action('comment_form','numly_output');" hack if they don't mind it below the comments.



Mon Jan 12 02:03:52 2009: 5151   TonyLawrence

gravatar
No, there's something more wrong with the barcode code.. I'll figure it out another day.



Mon Jan 12 02:24:45 2009: 5152   BruceGarlock


I used the "Wayback" Internet archive site to get this (hope it helps)

WP-NUMLY


Current Version 1.5
Copyright 2006 Cal Evans
License GPL 2.0
Download tarball
Download zip file

This is a WordPress plugin to automatically request an Electronic Standard Book Number (ESBN) from www.esbn.org.

Numly.com assigns Numly Numbers (Electronic Serial Numbers / ESNs) for all things digital. These unique identifiers provide digital rights management capabilities as well as third-party, non-repudiation measures for proof of copyright via real-time verifications. Numly Numbers are simple and quick to generate. They act as an electronic timestamp for copyright purposes. They can also be used to digitally certify email. They also allow you to track content viewership, monitor ratings, and can be used as permalinks.


UPGRADE INSTRUCTIONS

View the options panel, write down your numly, userID. Upgrading to 1.5 will erase all of your options.
Deactive the plugin before attempting to install the new one.
Remove the existing plugin
Follow the instructions below.
INSTALLATION INSTRUCTIONS

Download and uncompress the plugin. This will create a blogbling directory with all the files needed for the plugin.
Upload the blogbling directory to your blog's plugins directory. The final destination on most systems should be /wp-content/plugins/.
Go to the Wordpress Admin Plugin menu. If installed correctly, you should see the deactivated plugin ready to activate. Activate the plugin
Go to Options/Numly. Enter your Numly login name. You also need to enter a Publisher name. If you don't have a publisher, enter your name. Check the box if you want the barcode displayed with each ESN.
Finally, you need to place this code where you want the ESN to appear. This needs to be within the_loop.

<?php if (function_exists('numly_output')) numly_output($id); ?>


That's it. The next post you publish or save that does not have an ESN will request one.



Mon Jan 12 12:23:19 2009: 5153   TonyLawrence

gravatar
OK, I finally understand what the original complaint was:

When the numly plugin runs, it sends $_POST['post_title']; to numly. That's in the format
(link)

But if your Permalink settings ae different, you want Numly to get the right Permalink that might be
(link)

But isn't Wordpress supposed to put in rewrite rules to take care of that??



Mon Jan 12 12:38:56 2009: 5154   TonyLawrence

gravatar
Correction, it sends this:

$numly_data['url'] = get_settings('siteurl').'/index.php?p='.$id;

You could adjust that to send whatever you want. For this case, he's want

$numly_data['url'] = get_settings('siteurl') . '/' . $_POST['post_title'];

Though you'd want to put dashes in for spaces in post title



Mon Jan 12 13:02:29 2009: 5155   TonyLawrence

gravatar
But you wouldn't want to do that unless you plan on keeping the same permalink structure forever.

Your .htaccess and WP rewrite should always translate index.php?p=xyz correctly so I don�t think you want to change it - if you did, the old Permalinks you gave to numly would be broken if you ever changed Permalink rules.

But leaving Numly at index.php?p=xyz should work forever.







Mon Jan 12 16:26:33 2009: 5165   BruceGarlock

gravatar
Thanks for digging into this, Tony. Very useful. I see the issue now as well. I don't have permalinks turned on, which is why I didn't even see this problem. I still can't decide on a permalink 'style', since you would have to keep that style forever. Maybe this plugin was just never coded to handle the permalink feature.

I still think it is strange that the author removed all traces of the plugin from his site. I wonder why? I bet someone will pick this project up. Maybe even you will, Tony :-) That would be a great way for you to get even more familiar with WP.

- Bruce



Mon Jan 12 16:28:51 2009: 5166   TonyLawrence

gravatar
I suppose so - but what more needs to be done?



Thu Mar 19 05:41:40 2009: 5763   Scott

gravatar
No matter what I do I can't get the numly output to work on my single.php page.

I have no clue why either when other functions work just fine. Anyone have a clue ?



Thu Mar 19 10:59:06 2009: 5764   TonyLawrence

gravatar
I can only suggest adding some debugging to see where things go wrong.



Mon Sep 20 02:50:10 2010: 8985   ChrisMatthieu

gravatar


Thanks to Scott Grayban, the Numly Number Wordpress plugin is now working again! You can automatically submit your WordPress blog posts to Numly in exchange for a barcoded Numly Number that gets added to your page.

Here's the link to the new plugin -
(link)



Thu Sep 23 13:21:44 2010: 8991   BruceGarlock

gravatar


Thanks for the new link for the plugin. Looks like numly has done a makeover on their site as well. Either my subscription is messed up (just saw $$ taken out for it a few weeks ago, and it was working) or this plugin still needs a little work, because none of my ESN's are being generated when I modify my posts anymore.







Thu Sep 23 13:28:15 2010: 8992   TonyLawrence

gravatar


Yes, I noticed that Numly stopped working here too. It was one of the things I put on my "investigate" list for next week.



Thu Sep 23 13:53:26 2010: 8993   ChrisMatthieu

gravatar


We just corrected the issue with Bruce's subscription.

------------------------
Kerio Samepage


Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us





Always do right. This will gratify some people, and astonish the rest. (Mark Twain)

The object-oriented model makes it easy to build up programs by accretion. What this often means, in practice, is that it provides a structured way to write spaghetti code. (Paul Graham)








This post tagged: