Webpad 3.0 Personal > Dialogs / Find Replace.php

Questions? Need Help? Want to share? » PHP Forum
Script Name:
Webpad 3.0 Personal

Download:
webpad-3.0-personal.zip

Category:
Content Management

Archive Content:

Webpad 3.0 Personal

Webpad 3.0 Personal > Admin

Webpad 3.0 Personal > Css

Webpad 3.0 Personal > Dialogs

Webpad 3.0 Personal > Docs

Webpad 3.0 Personal

Webpad 3.0 Personal > Images

Webpad 3.0 Personal

Webpad 3.0 Personal > Js

Webpad 3.0 Personal

Webpad 3.0 Personal > Locations

Webpad 3.0 Personal

Webpad 3.0 Personal > Plugins > Blogging

Webpad 3.0 Personal > Plugins > Blogger

Webpad 3.0 Personal > Plugins > Blosxom

Webpad 3.0 Personal > Plugins > Livejournal

Webpad 3.0 Personal > Plugins > Movabletype

Webpad 3.0 Personal > Plugins > Typepad

Webpad 3.0 Personal > Plugins > Wordpress

Webpad 3.0 Personal

Webpad 3.0 Personal > Templates

Webpad 3.0 Personal

Find Replace.php:


<html>
<head>
<title>Find and Replace</title>
<link rel="stylesheet" href="../css/dialog.css" type="text/css" />
<script language="JavaScript" type="text/javascript">
<!--
function make_regexp_safe(str) {
    str = str.replace(/\\/gi,  '\\\\');
    str = str.replace(/\./gi,  '\\\.');
    str = str.replace(/\[/gi,  '\\\[');
    str = str.replace(/\]/gi,  '\\\]');
    str = str.replace(/\{/gi,  '\\\{');
    str = str.replace(/\}/gi,  '\\\}');
    str = str.replace(/\*/gi,  '\\\*');
    str = str.replace(/\?/gi,  '\\\?');
    str = str.replace(/\+/gi,  '\\\+');
    str = str.replace(/\$/gi,  '\\\$');
    str = str.replace(/\^/gi,  '\\\^');
    str = str.replace(/\|/gi,  '\\\|');
    return str;
}

function do_replace() {
    d = document.dialog;
    r = d.replaceTxt.value;
    f = d.findTxt.value;
    f = make_regexp_safe(f);
    
    if (d.matchCase.checked == true) {
        flags = 'g';
    }
    else {
        flags = 'gi';
    }
    opener.parent.frames.wp_toolbar._find_replace(f,  r,  flags);
    opener.parent.frames.wp_edit.document.edit.modified.value = true;
    opener.parent.frames.wp_edit.document.edit.wp_document.focus();
    self.close();
}
// -->
</script>
</head>

<body onload="this.focus(); document.dialog.findTxt.focus();" onkeypress="if (event.keyCode==27) { window.close(); }">

<h1>Find and Replace</h1>

<form name="dialog">

<table cellpadding="3" cellspacing="0" border="0" width="100%">

<tr>
<td><label for="find">Find:</label></td>
<td><input type="text" name="findTxt" id="find" style="width: 100%;" value="" /></td>
</tr>

<tr>
<td><label for="replace">Replace With:</label></td>
<td><input type="text" name="replaceTxt" id="replace" style="width: 100%;" value="" /></td>
</tr>

<tr>
<td><label for="case">Match Case?</label></td>
<td><input type="checkbox" name="matchCase" id="case" value="i" /></td>
</tr>

<tr>
<td></td>
<td align="center" colspan="2">
<input type="submit" name="submit" value=" Replace All " onclick="do_replace();" />
<input type="button" name="cancel" value="    Cancel    " onclick="self.close();" />
</td>
</tr>

</table>

</form>

</body>
</html>


Other Content Management Scripts:

WebMaster Resources Home

©RingsWorld.com