Visit Website'); // Signature data
add_option('ddsig_data2', 'Written by %FIRST% %LAST% - Visit Website'); // Signature data
add_option('ddsig_data3', 'Written by %FIRST% %LAST% - Visit Website'); // Signature data
add_option('ddsig_data4', 'Written by %FIRST% %LAST% - Visit Website'); // Signature data
add_option('ddsig_data5', 'Written by %FIRST% %LAST% - Visit Website'); // Signature data
add_option('ddsig_data6', 'Written by %FIRST% %LAST% - Visit Website'); // Signature data
add_option('ddsig_data7', 'Written by %FIRST% %LAST% - Visit Website'); // Signature data
add_option('ddsig_sindex', FALSE); // Show on index
add_option('ddsig_sposts', FALSE); // Show on posts
add_option('ddsig_spages', FALSE); // Show on pages
add_option('ddsig_sarc', FALSE); // Show on archives
add_option('ddsig_ssearch', FALSE); // Show on search
function ddsig_add_option_pages() {
if (function_exists('add_options_page')) {
add_options_page("Add Sig", 'DDAddSig', 8, __FILE__, 'ddsig_options_page');
}
}
function ddsig_trim_sig($sig) {
return trim($sig, "*");
}
function ddsig_options_page() {
global $ddsig_version;
if (isset($_POST['set_defaults'])) {
echo '
';
update_option('ddsig_data', 'Written by %FIRST% %LAST% - Visit Website'); // Signature data
update_option('ddsig_data2', 'Written by %FIRST% %LAST% - Visit Website'); // Signature data
update_option('ddsig_data3', 'Written by %FIRST% %LAST% - Visit Website'); // Signature data
update_option('ddsig_data4', 'Written by %FIRST% %LAST% - Visit Website'); // Signature data
update_option('ddsig_data5', 'Written by %FIRST% %LAST% - Visit Website'); // Signature data
update_option('ddsig_data6', 'Written by %FIRST% %LAST% - Visit Website'); // Signature data
update_option('ddsig_data7', 'Written by %FIRST% %LAST% - Visit Website'); // Signature data
update_option('ddsig_sindex', FALSE); // Show on index
update_option('ddsig_sposts', FALSE); // Show on posts
update_option('ddsig_spages', FALSE); // Show on pages
update_option('ddsig_sarc', FALSE); // Show on archives
update_option('ddsig_ssearch', FALSE); // Show on search
echo 'Default Options Loaded!';
echo '
';
} else if (isset($_POST['info_update'])) {
echo '';
update_option('ddsig_data', '*' . (string)$_POST["ddsig_data"] . '*');
update_option('ddsig_data2', '*' . (string)$_POST["ddsig_data2"] . '*');
update_option('ddsig_data3', '*' . (string)$_POST["ddsig_data3"] . '*');
update_option('ddsig_data4', '*' . (string)$_POST["ddsig_data4"] . '*');
update_option('ddsig_data5', '*' . (string)$_POST["ddsig_data5"] . '*');
update_option('ddsig_data6', '*' . (string)$_POST["ddsig_data6"] . '*');
update_option('ddsig_data7', '*' . (string)$_POST["ddsig_data7"] . '*');
update_option('ddsig_sindex', (bool)$_POST["ddsig_sindex"]);
update_option('ddsig_sposts', (bool)$_POST["ddsig_sposts"]);
update_option('ddsig_spages', (bool)$_POST["ddsig_spages"]);
update_option('ddsig_sarc', (bool)$_POST["ddsig_sarc"]);
update_option('ddsig_ssearch', (bool)$_POST["ddsig_ssearch"]);
echo 'Configuration Updated!';
echo '
';
} ?>
\s*\s*<\/p>/i', "", $content);
// Load options
$ddsig_data = get_option('ddsig_data');
$ddsig_data2 = get_option('ddsig_data2');
$ddsig_data3 = get_option('ddsig_data3');
$ddsig_data4 = get_option('ddsig_data4');
$ddsig_data5 = get_option('ddsig_data5');
$ddsig_data6 = get_option('ddsig_data6');
$ddsig_data7 = get_option('ddsig_data7');
$ddsig_sindex = get_option('ddsig_sindex');
$ddsig_sposts = get_option('ddsig_sposts');
$ddsig_spages = get_option('ddsig_spages');
$ddsig_sarc = get_option('ddsig_sarc');
$ddsig_ssearch = get_option('ddsig_ssearch');
// Check page type
$show_sig = FALSE;
if (is_home() && $ddsig_sindex) {
$show_sig = TRUE;
}
if (is_single() && $ddsig_sposts) {
$show_sig = TRUE;
}
if (is_page() && $ddsig_spages) {
$show_sig = TRUE;
}
if (is_archive() && $ddsig_sarc) {
$show_sig = TRUE;
}
if (is_search() && $ddsig_ssearch) {
$show_sig = TRUE;
}
$found = strpos ($content, '');
if ($found) {
$show_sig = TRUE;
}
if ($show_sig) {
// Get author information
$a_login = get_the_author_login(); // %LOGIN%
$a_first = get_the_author_firstname(); // %FIRST%
$a_last = get_the_author_lastname(); // %LAST%
$a_nick = get_the_author_nickname(); // %NICK%
$a_email = get_the_author_email(); // %EMAIL%
$a_url = get_the_author_url(); // %URL%
$a_desc = get_the_author_description(); // %DESC%
// Process signature
$the_sig = stripslashes(nl2br(ddsig_trim_sig($ddsig_data)));
$the_sig = str_replace("%LOGIN%", $a_login, $the_sig);
$the_sig = str_replace("%FIRST%", $a_first, $the_sig);
$the_sig = str_replace("%LAST%", $a_last, $the_sig);
$the_sig = str_replace("%NICK%", $a_nick, $the_sig);
$the_sig = str_replace("%EMAIL%", $a_email, $the_sig);
$the_sig = str_replace("%URL%", $a_url, $the_sig);
$the_sig = str_replace("%DESC%", $a_desc, $the_sig);
$the_sig = '' . $the_sig . '
';
// Look for trigger
if ($found_trigger) { // If trigger found, process
$content = str_replace('', $the_sig, $content);
} else {
$content .= $the_sig;
}
}
$the_sig2 = stripslashes(nl2br(ddsig_trim_sig($ddsig_data2)));
$the_sig2 = str_replace("%LOGIN%", $a_login, $the_sig2);
$the_sig2 = str_replace("%FIRST%", $a_first, $the_sig2);
$the_sig2 = str_replace("%LAST%", $a_last, $the_sig2);
$the_sig2 = str_replace("%NICK%", $a_nick, $the_sig2);
$the_sig2 = str_replace("%EMAIL%", $a_email, $the_sig2);
$the_sig2 = str_replace("%URL%", $a_url, $the_sig2);
$the_sig2 = str_replace("%DESC%", $a_desc, $the_sig2);
$the_sig3 = stripslashes(nl2br(ddsig_trim_sig($ddsig_data3)));
$the_sig3 = str_replace("%LOGIN%", $a_login, $the_sig3);
$the_sig3 = str_replace("%FIRST%", $a_first, $the_sig3);
$the_sig3 = str_replace("%LAST%", $a_last, $the_sig3);
$the_sig3 = str_replace("%NICK%", $a_nick, $the_sig3);
$the_sig3 = str_replace("%EMAIL%", $a_email, $the_sig3);
$the_sig3 = str_replace("%URL%", $a_url, $the_sig3);
$the_sig3 = str_replace("%DESC%", $a_desc, $the_sig3);
$the_sig4 = stripslashes(nl2br(ddsig_trim_sig($ddsig_data4)));
$the_sig4 = str_replace("%LOGIN%", $a_login, $the_sig4);
$the_sig4 = str_replace("%FIRST%", $a_first, $the_sig4);
$the_sig4 = str_replace("%LAST%", $a_last, $the_sig4);
$the_sig4 = str_replace("%NICK%", $a_nick, $the_sig4);
$the_sig4 = str_replace("%EMAIL%", $a_email, $the_sig4);
$the_sig4 = str_replace("%URL%", $a_url, $the_sig4);
$the_sig4 = str_replace("%DESC%", $a_desc, $the_sig4);
$the_sig5 = stripslashes(nl2br(ddsig_trim_sig($ddsig_data5)));
$the_sig5 = str_replace("%LOGIN%", $a_login, $the_sig5);
$the_sig5 = str_replace("%FIRST%", $a_first, $the_sig5);
$the_sig5 = str_replace("%LAST%", $a_last, $the_sig5);
$the_sig5 = str_replace("%NICK%", $a_nick, $the_sig5);
$the_sig5 = str_replace("%EMAIL%", $a_email, $the_sig5);
$the_sig5 = str_replace("%URL%", $a_url, $the_sig5);
$the_sig5 = str_replace("%DESC%", $a_desc, $the_sig5);
$the_sig6 = stripslashes(nl2br(ddsig_trim_sig($ddsig_data6)));
$the_sig6 = str_replace("%LOGIN%", $a_login, $the_sig6);
$the_sig6 = str_replace("%FIRST%", $a_first, $the_sig6);
$the_sig6 = str_replace("%LAST%", $a_last, $the_sig6);
$the_sig6 = str_replace("%NICK%", $a_nick, $the_sig6);
$the_sig6 = str_replace("%EMAIL%", $a_email, $the_sig6);
$the_sig6 = str_replace("%URL%", $a_url, $the_sig6);
$the_sig6 = str_replace("%DESC%", $a_desc, $the_sig6);
$the_sig7 = stripslashes(nl2br(ddsig_trim_sig($ddsig_data7)));
$the_sig7 = str_replace("%LOGIN%", $a_login, $the_sig7);
$the_sig7 = str_replace("%FIRST%", $a_first, $the_sig7);
$the_sig7 = str_replace("%LAST%", $a_last, $the_sig7);
$the_sig7 = str_replace("%NICK%", $a_nick, $the_sig7);
$the_sig7 = str_replace("%EMAIL%", $a_email, $the_sig7);
$the_sig7 = str_replace("%URL%", $a_url, $the_sig7);
$the_sig7 = str_replace("%DESC%", $a_desc, $the_sig7);
$the_sig2 = '' . $the_sig2 . '
';
$the_sig3 = '' . $the_sig3 . '
';
$the_sig4 = '' . $the_sig4 . '
';
$the_sig5 = '' . $the_sig5 . '
';
$the_sig6 = '' . $the_sig6 . '
';
$the_sig7 = '' . $the_sig7 . '
';
$content = str_replace('', $the_sig2, $content);
$content = str_replace('', $the_sig3, $content);
$content = str_replace('', $the_sig4, $content);
$content = str_replace('', $the_sig5, $content);
$content = str_replace('', $the_sig6, $content);
$content = str_replace('', $the_sig7, $content);
return $content;
}
add_filter('the_content', 'ddsig_generate');
add_action('admin_menu', 'ddsig_add_option_pages');
?>