WordPress.org

Plugin Directory


Ignore:
Timestamp:
03/27/12 09:24:15 (6 years ago)
Author:
SriniG
Message:

v1.5.5: security fixes, shortcode pagination fix, doc fix, l10n added in be_BY, el, et_EE, ro_RO

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quotes-collection/trunk/quotes-collection-shortcodes.php

    r420481 r524245  
    7070 
    7171    if($orderby == 'id' || !$orderby) $orderby = 'quote_id'; 
     72    else if ($orderby == 'date_added') $orderby = 'time_added'; 
    7273    else if($orderby == 'random' || $orderby == 'rand') { 
    7374        $orderby = 'RAND()'; 
     
    133134 
    134135 
    135 function quotescollection_displayquote($quote_id = 0) 
     136function quotescollection_displayquote($matches) 
    136137{ 
    137     if($quote_id == 0) 
     138    if(!isset($matches[1]) || (isset($matches[1]) && !$matches[1]) || $matches[0] == "[quote|random]") 
    138139        $atts = array( 'orderby' => 'random', 'limit' => 1 ); 
    139140    else 
    140         $atts = array ( 'id' => $quote_id ); 
     141        $atts = array ( 'id' => $matches[1] ); 
    141142     
    142143    return quotescollection_shortcodes($atts); 
     
    144145 
    145146 
    146 function quotescollection_displayquotes_author($author = "") 
     147function quotescollection_displayquotes_author($matches) 
    147148{ 
    148     return quotescollection_shortcodes(array('author'=>$author)); 
     149    return quotescollection_shortcodes(array('author'=>$matches[1])); 
    149150} 
    150151 
    151152 
    152 function quotescollection_displayquotes_source($source = "") 
     153function quotescollection_displayquotes_source($matches) 
    153154{ 
    154     return quotescollection_shortcodes(array('source'=>$source)); 
     155    return quotescollection_shortcodes(array('source'=>$matches[1])); 
    155156} 
    156157 
    157 function quotescollection_displayquotes_tags($tags = "") 
     158function quotescollection_displayquotes_tags($matches) 
    158159{ 
    159     return quotescollection_shortcodes(array('tags'=>$tags)); 
     160    return quotescollection_shortcodes(array('tags'=>$matches[1])); 
    160161} 
    161162 
     
    164165  $start = strpos($text,"[quote|id="); 
    165166  if ($start !== FALSE) { 
    166     $text = preg_replace( "/\[quote\|id=(\d+)\]/ie", "quotescollection_displayquote('\\1')", $text ); 
     167    $text = preg_replace_callback( "/\[quote\|id=(\d+)\]/i", "quotescollection_displayquote", $text ); 
    167168  } 
    168169  $start = strpos($text,"[quote|random]"); 
    169170  if ($start !== FALSE) { 
    170     $text = preg_replace( "/\[quote\|random\]/ie", "quotescollection_displayquote()", $text ); 
     171    $text = preg_replace_callback( "/\[quote\|random\]/i", "quotescollection_displayquote", $text ); 
    171172  } 
    172173  $start = strpos($text,"[quote|all]"); 
    173174  if ($start !== FALSE) { 
    174     $text = preg_replace( "/\[quote\|all\]/ie", "quotescollection_shortcodes()", $text ); 
     175    $text = preg_replace_callback( "/\[quote\|all\]/i", "quotescollection_shortcodes", $text ); 
    175176  } 
    176177    $start = strpos($text,"[quote|author="); 
    177178    if($start !== FALSE) { 
    178         $text = preg_replace("/\[quote\|author=(.{1,})?\]/ie", "quotescollection_displayquotes_author(\"\\1\")", $text); 
     179        $text = preg_replace_callback("/\[quote\|author=(.{1,})?\]/i", "quotescollection_displayquotes_author", $text); 
    179180    } 
    180181    $start = strpos($text,"[quote|source="); 
    181182    if($start !== FALSE) { 
    182         $text = preg_replace("/\[quote\|source=(.{1,})?\]/ie", "quotescollection_displayquotes_source(\"\\1\")", $text); 
     183        $text = preg_replace_callback("/\[quote\|source=(.{1,})?\]/i", "quotescollection_displayquotes_source", $text); 
    183184    } 
    184185    $start = strpos($text,"[quote|tags="); 
    185186    if($start !== FALSE) { 
    186         $text = preg_replace("/\[quote\|tags=(.{1,})?\]/ie", "quotescollection_displayquotes_tags(\"\\1\")", $text); 
     187        $text = preg_replace_callback("/\[quote\|tags=(.{1,})?\]/i", "quotescollection_displayquotes_tags", $text); 
    187188    }   return $text; 
    188189} 
Note: See TracChangeset for help on using the changeset viewer.