Came across a line in some Wordpress code I am modifying and just flat out don't know what the $2.$3 is? Maybe it's a PHP thing that I just never learned? Can anyone explain this to me?
Here's the plugin I'm modifying:
<?php
/*
Plugin Name: Pinterest Plugin
Plugin URI: http://www.WordPressPinterestPlugin.com
Description: Display a Pinterest "Pin It" button on top of your images, only when people move their mouse over the image.
Version: 1.0
Author: Promotioner.com
Author URI: http://www.WordPressPinterestPlugin.com
/*============================================================================================================ */
class pin_success
{
function pin_success()
{
add_filter('the_content', array('pin_success', 'nosn_pinterest'));
}
function nosn_pinterest($content) {
global $post;
$posturl = urlencode(get_permalink()); //Get the post URL
$pindiv = '<div class="sn_pinterest">';
$pinurl = '<a href="http://pinterest.com/pin/create/button/?url='.$posturl.'&media=';
$pindescription = '&description='.urlencode(get_the_title());
$pinfinish = '" target="_blank" class="sn_pin"></a>';
$pinend = '</div>';
$pattern = '/<img(.*?)src="(.*?).(bmp|gif|jpeg|jpg|png)"(.*?) \/>/i';
$replacement = $pindiv.$pinurl.'$2.$3'.$pindescription.$pinfinish.'<img$1src="$2.$3" $4 />'.$pinend;
$content = preg_replace( $pattern, $replacement, $content );
return $content;
}
}
$successnexus = new pin_success;
wp_enqueue_style('sn_pinterest', plugins_url('sn_pinterest.css', __FILE__ ));
?>
preg_replace. Also, this isn't a WordPress question. :) – chrisguitarguy Sep 29 '12 at 0:09