Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Forum: Plugins
    In reply to: [Plugin: Sociable] NoFollow

    it’s possible and easy.
    But you have to add a few code (that will be overwritten when you update the plugin).

    There are (at least 🙂 two ways:
    – hard coded (nofollow will be output, always)
    – prety cool upgrade (selectable option in the backend)

    [The Hard coded way]
    around line 588, you will find

    $link .= "<a rel=\"nofollow\"";

    replace it with:

    $link .= "<a";

    and you have it! maybe next time you’ll try by yourself! 🙂

    [The pretty cool way]
    do the Hard Coded method, and continues:

    around line 592, after:

    if (get_option('sociable_usetargetblank')) {
    	$link .= " target=\"_blank\"";
    }

    write the following:

    if (get_option('sociable_usenofollow')) {
    	$link .= " rel=\"nofollow\"";
    }

    around line 782, after:

    } else {
    	update_option('sociable_usetargetblank',false);
    }

    add this:

    if (isset($_POST['usenofollow']) && $_POST['usenofollow']) {
    	update_option('sociable_usenofollow',true);
    } else {
    	update_option('sociable_usenofollow',false);
    }

    around line 834, after:
    $usetargetblank = get_option('sociable_usetargetblank');
    write:
    $usenofollow = get_option('sociable_usenofollow');

    and finally, around line 924, after:

    <input type="checkbox" name="usetargetblank" <?php echo (get_option('sociable_usetargetblank')) ? ' checked="checked"' : ''; ?> /> <?php _e("Use <code>target=_blank</code> on links? (Forces links to open a new window)", "sociable"); ?>
    		</td>
    	</tr>

    write:

    <tr>
    		<th scope="row" valign="top">
    			<?php _e("Use 'nofollo' rel tag:", "sociable"); ?>
    		</th>
    		<td>
    			<input type="checkbox" name="usenofollow" <?php echo (get_option('sociable_usenofollow')) ? ' checked="checked"' : ''; ?> /> <?php _e("Use <code>rel=nofollow</code> on links? (Forces search engines to 'not follow this link' because it's outside our site)", "sociable"); ?>
    		</td>
    	</tr>

    and you will have the ‘followed’ 😉 option in your Backend.

    do backups, and let the force be with you 🙂
    t

    Thread Starter tarrero

    (@tarrero)

    other handycap found on this solution:

    you can’t automaticly build the .po for the translation, because “__(” calls are “dinamycly” generated…

    so regex stop working properly…

    if someone follows me, don’t forget to add each $sociable_known_sites[‘description’] to your .po file (if not, they will not be translated, no mayor problem at all).

    d

    Thread Starter tarrero

    (@tarrero)

    i think i know why this happens!
    But if i’m right, nobody is getting Sociable translated in frontend!

    The localization file is loaded on “init” hook, but the array (with the ‘localized’ descriptions) is loaded when the plugin is included (before the localization is loaded).

    Following this guess i’ve modified sociable.php in this way:
    (maybe line numbers are not exact)

    sociable.php:36
    – add_filter(‘init’, ‘sociable_init_locale’);
    + add_action(‘init’, ‘sociable_init_locale’);

    later, in $sociable_known_sites, modify the description NOT to call tranlations (because they are not available yet)
    ej:
    sociable.php:142
    – ‘description’ => __(‘E-mail this story to a friend!’,’sociable’),
    + ‘description’ => ‘E-mail this story to a friend!’),

    oh! but i lost my tranlations that way!!

    yes, but let the next modification to do the magic (translate when output, so the translations are already loaded):

    sociable.php:577
    – $description = $site[‘description’];
    + $description = __($site[‘description’],’sociable’);

    i’m worry about updates…
    i’ll contact the developer to see if he decides to include the patch!

    Regars to the audience 🙂
    Daniel

    Thread Starter tarrero

    (@tarrero)

    I’ve made some progress.

    Possibly it’s not a plugin problem.
    Maybe it’s my theme’s problem.

    I explain why i think that:

    It seems that the following Hook is only executed when I’m on the Backend:
    – add_filter(‘init’, ‘sociable_init_locale’);

    if i override the Hook and “hard code” the function, the translation works in both Backend and Frontend:

    + $sociablei18npath = ‘wp-content/plugins/sociable/i18n/’;
    + load_plugin_textdomain(‘sociable’, $sociablei18npath);

    This “workaround” seems to be a bad idea…
    I would like to use Hooks, they are there for that, but i’m a bit lost.

    Thanks for reading! i’ll be glad reading your suggestions 🙂
    excuse my poor english,
    Daniel

    Thread Starter tarrero

    (@tarrero)

    something interesting:

    The rss specification defines just one enclosure per item.
    It also defines that the different “formats” are intended for be used with the same content (in multiple formats).

    Thread Starter tarrero

    (@tarrero)

    Oops, sorry:

    One month ago cavemonkey50 wrote:
    I’m well aware the RSS spec specifies only one enclosure per item. This has been a heavily debated topic, and I choose to follow WordPress’ native support of multiple enclosures.

    As a rule of thumb, iTunes will pick up the first added file for a given format. So essentially, each post can have multiple files each assigned to a different format and work fine. The problem lies when two or more files are added to the same format. That’s when iTunes (and other podcatchers) will only use the first file.

Viewing 6 replies - 1 through 6 (of 6 total)