WordPress.org

Plugin Directory

Changeset 505388


Ignore:
Timestamp:
02/15/12 13:20:23 (2 years ago)
Author:
ramon fincken
Message:

New version

Location:
find-replace
Files:
2 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • find-replace/tags/1.5/find_replace.php

    r394361 r505388  
    44Plugin URI: http://www.websitefreelancers.nl 
    55Description: Lets you find and replace pages and posts with a GUI. 
    6 Version: 1.5 
     6Version: 1.6 
    77Author: Ramon Fincken, Bas Bosman 
    88Author URI: http://www.websitefreelancers.nl 
  • find-replace/tags/1.5/form.php

    r394361 r505388  
    55 * Managing the worpress additonal admin renamer extended operations. 
    66 * 
    7  * @category      Wordpress Plugins 
     7 * @category      WordPress Plugins 
    88 * @package       Plugins 
    9  * @author        Bas Bosman <> 
    10  * @copyright     Yes, Open source, WebsiteFreelancers.nl 
    11  * @version       v 1.0  05-01-2010 Bas$ 
     9 * @author        Bas Bosman, MijnPress DE 
     10 * @copyright     Yes, Open source, MijnPress.nl 
    1211 */ 
    1312if (!defined('ABSPATH')) die("Aren't you supposed to come here via WP-Admin?"); 
     
    2019 * If submiting the form 
    2120 */ 
    22 if (isset($_POST['submitbutton']) && isset($_POST['postorpage'])){ 
     21if (isset($_POST['submitbutton']) && isset($_POST['post_type'])){ 
    2322    if (!isset($_POST['search']) || !$_POST['search']) { 
    2423        echo '<div id="message" class="error">No search string</div>'; 
     
    3433 
    3534        //logic 
    36         $query = ""; 
    37         switch ($_POST['postorpage']) 
    38         { 
    39             case 'post': 
    40                 $query = "WHERE p.post_type = 'post'"; 
    41                 break; 
    42             case 'page': 
    43                 $query = "WHERE p.post_type = 'page'"; 
    44                 break; 
    45             case 'trash': 
    46                 $query = "WHERE p.post_type = 'trash'"; 
    47                 break; 
    48             default: 
    49                 $query = "WHERE p.post_type = 'page' OR p.post_type = 'post' OR p.post_type = 'trash'"; 
    50                 break;                                               
    51         } 
    52  
    53         $field = 'post_content'; 
    54         $search = $_POST['search']; 
    55         $replace = $_POST['replace']; 
    56 $prio = ($_POST['low_priority'] == 'yes') ? ' LOW_PRIORITY ' : ''; 
     35        $query          = ""; 
     36        foreach ($_POST['post_type'] as $type) { 
     37         $query         = $query == '' ? 'WHERE p.post_type IN(' : $query . ', '; 
     38         $query         .= "'" . $type . "'"; 
     39      } 
     40      $query         .= ")"; 
     41       
     42        $field          = 'post_content'; 
     43        $search         = $_POST['search']; 
     44        $replace        = $_POST['replace']; 
     45      $prio           = ($_POST['low_priority'] == 'yes') ? ' LOW_PRIORITY ' : ''; 
    5746 
    5847 
    59 $updatequery = $wpdb->prepare( "UPDATE ".$prio." $wpdb->posts AS p SET p.".$field." = REPLACE(p.".$field.", '%s', '%s') $query",  
    60        $search, $replace ); 
     48      $updatequery = $wpdb->prepare( "UPDATE ".$prio." $wpdb->posts AS p SET p.".$field." = REPLACE(p.".$field.", '%s', '%s') $query", $search, $replace ); 
    6149 
    62             $wpdb->query($updatequery); 
     50      $wpdb->query($updatequery); 
    6351 
    6452        if(isset($_POST['postmeta']) && $_POST['postmeta'] == 'yes') 
     
    6654            $field = 'meta_value'; 
    6755         
    68             $updatequery = $wpdb->prepare( "UPDATE ".$prio." $wpdb->postmeta AS pm, $wpdb->posts AS p SET pm.".$field." = REPLACE(pm.".$field.", '%s', '%s') $query AND pm.post_id = p.ID",  
    69        $search, $replace ); 
     56            $updatequery = $wpdb->prepare( "UPDATE ".$prio." $wpdb->postmeta AS pm, $wpdb->posts AS p SET pm.".$field." = REPLACE(pm.".$field.", '%s', '%s') $query AND pm.post_id = p.ID", $search, $replace ); 
    7057 
    7158            $wpdb->query($updatequery); 
     
    10794    </tr> 
    10895    <tr> 
    109         <td>Post or page:</td> 
    110         <td><select name="postorpage"> 
    111             <option value="post">Post</option> 
    112             <option value="page">Page</option> 
    113             <option value="page">Trash</option> 
    114             <option value="postpage">Post, Page & Trash</option> 
    115         </select></td> 
    116      
    117      
     96        <td valign="top">Post types:</td> 
     97        <td> 
     98         <?php 
     99         //get all 
     100           $post_types           = get_post_types(array('public' => true), 'object'); 
     101           unset($post_types['attachment']); 
     102           foreach ($post_types as $type => $info) { 
     103            echo '<label><input type="checkbox" name="post_type[]" value="' . $type . '"> ' . $info->labels->singular_name . '</label><br>'; 
     104           } 
     105         ?> 
     106         <label><input type="checkbox" name="post_type[]" value="trash"> Trash</label> 
     107      </td> 
    118108    <tr> 
    119  
    120109</table> 
    121110<input type="submit" name="submitbutton" value="Search and replace" 
  • find-replace/tags/1.5/mijnpress_plugin_framework.php

    r491611 r505388  
    133133        if($this->showcredits) 
    134134        { 
    135             echo '<br/><br/>Do you like this plugin? <a href="http://donate.ramonfincken.com/">PayPal Donations</a> (even as small as $1,- or &euro;1,- are welcome!.'; 
     135            echo '<br/><br/>Do you like this plugin? <a href="http://donate.ramonfincken.com/">PayPal Donations</a> (even as small as $1,- or &euro;1,)- are welcome!.'; 
    136136        } 
    137137        echo '</div>'; 
  • find-replace/tags/1.5/readme.txt

    r394361 r505388  
    22Contributors: Bas Bosman, Ramon Fincken 
    33Donate link: http://donate.ramonfincken.com 
    4 Tags: rename,change,post,page,text,content,context,update,replace,change,server,url 
     4Tags: rename,change,post,page,text,content,context,update,replace,change,server,url,cpt 
    55Requires at least: 2.0.2 
    6 Tested up to: 3.1.3 
    7 Stable tag: 1.5 
     6Tested up to: 3.3.1 
     7Stable tag: 1.6 
    88 
    99Lets you find and replace text in pages, posts and trashed items with a GUI. 
     
    3030 
    3131== Changelog == 
     32= 1.6 = 
     33Added: Custom Post Type support (CPT)  
     34 
    3235= 1.5 = 
    3336Bugfix: Framework did not work on multisite, is_admin() problem.<br>If anyone could help me with that ? :) 
  • find-replace/trunk/find_replace.php

    r394361 r505388  
    44Plugin URI: http://www.websitefreelancers.nl 
    55Description: Lets you find and replace pages and posts with a GUI. 
    6 Version: 1.5 
     6Version: 1.6 
    77Author: Ramon Fincken, Bas Bosman 
    88Author URI: http://www.websitefreelancers.nl 
  • find-replace/trunk/form.php

    r319070 r505388  
    55 * Managing the worpress additonal admin renamer extended operations. 
    66 * 
    7  * @category      Wordpress Plugins 
     7 * @category      WordPress Plugins 
    88 * @package       Plugins 
    9  * @author        Bas Bosman <> 
    10  * @copyright     Yes, Open source, WebsiteFreelancers.nl 
    11  * @version       v 1.0  05-01-2010 Bas$ 
     9 * @author        Bas Bosman, MijnPress DE 
     10 * @copyright     Yes, Open source, MijnPress.nl 
    1211 */ 
    1312if (!defined('ABSPATH')) die("Aren't you supposed to come here via WP-Admin?"); 
     
    2019 * If submiting the form 
    2120 */ 
    22 if (isset($_POST['submitbutton']) && isset($_POST['postorpage'])){ 
     21if (isset($_POST['submitbutton']) && isset($_POST['post_type'])){ 
    2322    if (!isset($_POST['search']) || !$_POST['search']) { 
    2423        echo '<div id="message" class="error">No search string</div>'; 
     
    3433 
    3534        //logic 
    36         $query = ""; 
    37         switch ($_POST['postorpage']) 
    38         { 
    39             case 'post': 
    40                 $query = "WHERE p.post_type = 'post'"; 
    41                 break; 
    42             case 'page': 
    43                 $query = "WHERE p.post_type = 'page'"; 
    44                 break; 
    45             case 'trash': 
    46                 $query = "WHERE p.post_type = 'trash'"; 
    47                 break; 
    48             default: 
    49                 $query = "WHERE p.post_type = 'page' OR p.post_type = 'post' OR p.post_type = 'trash'"; 
    50                 break;                                               
    51         } 
    52  
    53         $field = 'post_content'; 
    54         $search = $_POST['search']; 
    55         $replace = $_POST['replace']; 
    56 $prio = ($_POST['low_priority'] == 'yes') ? ' LOW_PRIORITY ' : ''; 
     35        $query          = ""; 
     36        foreach ($_POST['post_type'] as $type) { 
     37         $query         = $query == '' ? 'WHERE p.post_type IN(' : $query . ', '; 
     38         $query         .= "'" . $type . "'"; 
     39      } 
     40      $query         .= ")"; 
     41       
     42        $field          = 'post_content'; 
     43        $search         = $_POST['search']; 
     44        $replace        = $_POST['replace']; 
     45      $prio           = ($_POST['low_priority'] == 'yes') ? ' LOW_PRIORITY ' : ''; 
    5746 
    5847 
    59 $updatequery = $wpdb->prepare( "UPDATE ".$prio." $wpdb->posts AS p SET p.".$field." = REPLACE(p.".$field.", '%s', '%s') $query",  
    60        $search, $replace ); 
     48      $updatequery = $wpdb->prepare( "UPDATE ".$prio." $wpdb->posts AS p SET p.".$field." = REPLACE(p.".$field.", '%s', '%s') $query", $search, $replace ); 
    6149 
    62             $wpdb->query($updatequery); 
     50      $wpdb->query($updatequery); 
    6351 
    6452        if(isset($_POST['postmeta']) && $_POST['postmeta'] == 'yes') 
     
    6654            $field = 'meta_value'; 
    6755         
    68             $updatequery = $wpdb->prepare( "UPDATE ".$prio." $wpdb->postmeta AS pm, $wpdb->posts AS p SET pm.".$field." = REPLACE(pm.".$field.", '%s', '%s') $query AND pm.post_id = p.ID",  
    69        $search, $replace ); 
     56            $updatequery = $wpdb->prepare( "UPDATE ".$prio." $wpdb->postmeta AS pm, $wpdb->posts AS p SET pm.".$field." = REPLACE(pm.".$field.", '%s', '%s') $query AND pm.post_id = p.ID", $search, $replace ); 
    7057 
    7158            $wpdb->query($updatequery); 
     
    10794    </tr> 
    10895    <tr> 
    109         <td>Post or page:</td> 
    110         <td><select name="postorpage"> 
    111             <option value="post">Post</option> 
    112             <option value="page">Page</option> 
    113             <option value="page">Trash</option> 
    114             <option value="postpage">Post, Page & Trash</option> 
    115         </select></td> 
    116      
    117      
     96        <td valign="top">Post types:</td> 
     97        <td> 
     98         <?php 
     99         //get all 
     100           $post_types           = get_post_types(array('public' => true), 'object'); 
     101           unset($post_types['attachment']); 
     102           foreach ($post_types as $type => $info) { 
     103            echo '<label><input type="checkbox" name="post_type[]" value="' . $type . '"> ' . $info->labels->singular_name . '</label><br>'; 
     104           } 
     105         ?> 
     106         <label><input type="checkbox" name="post_type[]" value="trash"> Trash</label> 
     107      </td> 
    118108    <tr> 
    119  
    120109</table> 
    121110<input type="submit" name="submitbutton" value="Search and replace" 
  • find-replace/trunk/mijnpress_plugin_framework.php

    r491611 r505388  
    133133        if($this->showcredits) 
    134134        { 
    135             echo '<br/><br/>Do you like this plugin? <a href="http://donate.ramonfincken.com/">PayPal Donations</a> (even as small as $1,- or &euro;1,- are welcome!.'; 
     135            echo '<br/><br/>Do you like this plugin? <a href="http://donate.ramonfincken.com/">PayPal Donations</a> (even as small as $1,- or &euro;1,)- are welcome!.'; 
    136136        } 
    137137        echo '</div>'; 
  • find-replace/trunk/readme.txt

    r394361 r505388  
    22Contributors: Bas Bosman, Ramon Fincken 
    33Donate link: http://donate.ramonfincken.com 
    4 Tags: rename,change,post,page,text,content,context,update,replace,change,server,url 
     4Tags: rename,change,post,page,text,content,context,update,replace,change,server,url,cpt 
    55Requires at least: 2.0.2 
    6 Tested up to: 3.1.3 
    7 Stable tag: 1.5 
     6Tested up to: 3.3.1 
     7Stable tag: 1.6 
    88 
    99Lets you find and replace text in pages, posts and trashed items with a GUI. 
     
    3030 
    3131== Changelog == 
     32= 1.6 = 
     33Added: Custom Post Type support (CPT)  
     34 
    3235= 1.5 = 
    3336Bugfix: Framework did not work on multisite, is_admin() problem.<br>If anyone could help me with that ? :) 
Note: See TracChangeset for help on using the changeset viewer.