PageRenderTime 56ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/docroot/wp-content/plugins/post-notification/admin_settings.php

https://bitbucket.org/greg_gallant/cd-blog
PHP | 742 lines | 650 code | 65 blank | 27 comment | 117 complexity | f998f6a1fee3fde030e3e2bfbafee072 MD5 | raw file
Possible License(s): LGPL-2.1, GPL-3.0, GPL-2.0, BSD-3-Clause
  1. <?php
  2. #------------------------------------------------------
  3. # INFO
  4. #------------------------------------------------------
  5. # This is part of the Post Notification Plugin for
  6. # Wordpress. Please see the readme.txt for details.
  7. #------------------------------------------------------
  8. function post_notification_is_file($path, $file){
  9. if(!is_file($path . '/' . $file)){
  10. echo '<div class="error">'. __('File missing in profile folder.', 'post_notification') . '<br />';
  11. echo __('Folder', 'post_notification') . ': <b>' . $path . '</b><br />';
  12. echo __('File', 'post_notification') . ': <b>' . $file. '</b></div>';
  13. return false;
  14. }
  15. return true;
  16. }
  17. function post_notification_check_string($path, $string){
  18. require($path . '/strings.php');
  19. if(!array_key_exists($string, $post_notification_strings)){
  20. echo '<div class="error">'. __('Missing string in string file.', 'post_notification') .'<br />';
  21. echo __('File', 'post_notification') . ': <b>' . $path . '/strings.php </b><br />';
  22. echo __('String', 'post_notification') . ': <b>' . $string . '</b></div>';
  23. return false;
  24. }
  25. return true;
  26. }
  27. function post_notification_is_profile($path){
  28. if(!(
  29. post_notification_is_file($path , 'confirm.tmpl') &&
  30. post_notification_is_file($path , 'reg_success.tmpl') &&
  31. post_notification_is_file($path , 'select.tmpl') &&
  32. post_notification_is_file($path , 'subscribe.tmpl') &&
  33. post_notification_is_file($path , 'unsubscribe.tmpl') &&
  34. post_notification_is_file($path , 'strings.php'))) return false;
  35. if(!(
  36. post_notification_check_string($path, 'error') &&
  37. post_notification_check_string($path, 'already_subscribed') &&
  38. post_notification_check_string($path, 'activation_faild') &&
  39. post_notification_check_string($path, 'address_not_in_database') &&
  40. post_notification_check_string($path, 'sign_up_again') &&
  41. post_notification_check_string($path, 'deaktivated') &&
  42. post_notification_check_string($path, 'no_longer_activated') &&
  43. post_notification_check_string($path, 'check_email') &&
  44. post_notification_check_string($path, 'wrong_captcha') &&
  45. post_notification_check_string($path, 'all') &&
  46. post_notification_check_string($path, 'saved')
  47. )) return false;
  48. return true;
  49. }
  50. function post_notification_select($var, $comp){
  51. if(get_option('post_notification_' . $var) == $comp) return ' selected="selected" ';
  52. else return '';
  53. }
  54. function post_notification_select_yesno($var){
  55. echo '<select name="' . $var . '" >';
  56. echo '<option value="no" ' . post_notification_select( $var,'no') . ' >' . __('No', 'post_notification') . '</option>';
  57. echo '<option value="yes" ' . post_notification_select($var,'yes') . ' >' . __('Yes', 'post_notification') . '</option>';
  58. echo '</select>';
  59. }
  60. function post_notification_admin_sub(){
  61. echo '<h3>' . __('Settings', 'post_notification') . '</h3>';
  62. if (isset($_POST['updateSettings'])){
  63. if(!isset($_POST['the_content'])) $_POST['the_content'] = array();
  64. //simple things first
  65. update_option('post_notification_read_more', $_POST['read_more']);
  66. update_option('post_notification_show_content', $_POST['show_content']);
  67. update_option('post_notification_send_default', $_POST['send_default']);
  68. update_option('post_notification_send_private', $_POST['send_private']);
  69. update_option('post_notification_send_page', $_POST['send_page']);
  70. update_option('post_notification_subject', $_POST['subject']);
  71. update_option('post_notification_from_name', $_POST['from_name']);
  72. update_option('post_notification_from_email', $_POST['from_email']);
  73. update_option('post_notification_page_name', $_POST['page_name']);
  74. update_option('post_notification_url', $_POST['pn_url']);
  75. update_option('post_notification_page_meta', $_POST['page_meta']);
  76. update_option('post_notification_filter_include', $_POST['filter_include']);
  77. update_option('post_notification_uninstall',$_POST['uninstall']);
  78. update_option('post_notification_debug',$_POST['debug']);
  79. update_option('post_notification_lock', $_POST['lock']);
  80. update_option('post_notification_the_content_exclude', serialize($_POST['the_content']));
  81. update_option('post_notification_empty_cats', $_POST['empty_cats']);
  82. update_option('post_notification_show_cats', $_POST['show_cats']);
  83. update_option('post_notification_sendcheck', $_POST['sendcheck']);
  84. update_option('post_notification_saved_tmpl', $_POST['saved_tmpl']);
  85. update_option('post_notification_auto_subscribe', $_POST['auto_subscribe']);
  86. $p_captcha = $_POST['captcha'];
  87. if(is_numeric($p_captcha)){
  88. if($p_captcha >= 0){
  89. update_option('post_notification_captcha', $p_captcha );
  90. } else {
  91. echo '<div class="error">' . __('Number of captcha-chars must be 0 or greater.', 'post_notification') . '</div>';
  92. }
  93. } else {
  94. echo '<div class="error">' . __('Number of captcha-chars must be a number.', 'post_notification') . '</div>';
  95. }
  96. $p_pause = $_POST['pause'];
  97. if(is_numeric($p_pause)){
  98. if($p_pause >= 0){
  99. update_option('post_notification_pause', $p_pause );
  100. } else {
  101. echo '<div class="error">' . __('Pause must be zero or greater.', 'post_notification') . '</div>';
  102. }
  103. } else {
  104. echo '<div class="error">' . __('Pause must be a number.', 'post_notification') . '</div>';
  105. }
  106. $p_nervous = $_POST['nervous'];
  107. if(is_numeric($p_nervous)){
  108. if($p_nervous >= 0){
  109. update_option('post_notification_nervous', $p_nervous);
  110. } else {
  111. echo '<div class="error">' . __('Nervous Finger must be zero or greater.', 'post_notification') . '</div>';
  112. }
  113. } else {
  114. echo '<div class="error">' . __('Nervous Finger must be a number.', 'post_notification') . '</div>';
  115. }
  116. $p_maxmail = $_POST['maxmails'];
  117. if(is_numeric($p_maxmail)){
  118. if($p_maxmail > 0){
  119. update_option('post_notification_maxsend', $p_maxmail );
  120. } else {
  121. echo '<div class="error">' . __('Number of mails must be greater then zero.', 'post_notification') .'</div>';
  122. }
  123. } else {
  124. echo '<div class="error">' . __('Number of mails must be a number', 'post_notification') . '</div>';
  125. }
  126. if($_POST['hdr_nl'] == "rn")
  127. update_option('post_notification_hdr_nl', "rn");
  128. else
  129. update_option('post_notification_hdr_nl', "n");
  130. // Check wheather the template exists in the Profile
  131. if( is_file(POST_NOTIFICATION_PATH . $_POST['en_profile'] .'/' . $_POST['en_template']) ||
  132. is_file(POST_NOTIFICATION_DATA . $_POST['en_profile'] .'/' . $_POST['en_template']) ){
  133. update_option('post_notification_profile', $_POST['en_profile']);
  134. update_option('post_notification_template', $_POST['en_template']);
  135. } else {
  136. // Don't save any Profile / Template-inforamtion so we don't get in to an inconsisten state;
  137. echo '<div class="error">' . __('Could not find the template in this profile. Please select a template and save again.', 'post_notification') . '</diV>';
  138. $profile = $_POST['en_profile'];
  139. }
  140. // Update default categories
  141. $categories = $_POST['pn_cats'];
  142. if (empty($categories)) {
  143. update_option('post_notification_selected_cats', '');
  144. } else {
  145. $categoryList = '';
  146. foreach ($categories as $category) {
  147. if (is_numeric($category)) {
  148. $categoryList .= ',' . $category;
  149. }
  150. }
  151. update_option('post_notification_selected_cats', substr($categoryList, 1));
  152. }
  153. //Add the page
  154. if(isset($_POST['add_page'])=="add"){
  155. //Database change in 2.1
  156. if(get_option('db_version')< 4772){
  157. $post_status = "static";
  158. } else {
  159. $post_type = "page";
  160. $post_status = "publish";
  161. }
  162. //Collect the Data
  163. if(get_option('post_notification_filter_include') == 'no'){
  164. $post_title = $_POST['page_name'];
  165. $post_content = __('If you can read this, something went wrong. :-(', 'post_notification');
  166. } else {
  167. $post_title = '@@post_notification_header';
  168. $post_content = '@@post_notification_body';
  169. }
  170. $post_data = compact('post_content','post_title', 'post_status', 'post_type');
  171. $post_data = add_magic_quotes($post_data);
  172. //Post
  173. $post_ID = wp_insert_post($post_data);
  174. //Add meta if we are using the Template.
  175. if(get_option('post_notification_filter_include') == 'no'){
  176. add_post_meta($post_ID, '_wp_page_template', 'post_notification_template.php', true);
  177. }
  178. //Add the ID to the URL
  179. update_option('post_notification_url', $post_ID);
  180. }
  181. echo '<H4>' . __('Data was updated.', 'post_notification') . '</H4>';
  182. }
  183. //Try to install the theme in case we need it. There be no warning. Warnings are only on the info-page.
  184. post_notification_installtheme();
  185. $selected = 'selected="selected"';
  186. /**
  187. * @todo Move all this stuff down to where it is displayed,
  188. * having all this stuff up here was a good Idea while there were few settings.
  189. */
  190. if(get_option('post_notification_hdr_nl') == 'rn')
  191. $hdr_rn = $selected;
  192. else
  193. $hdr_n = $selected;
  194. if(get_option('post_notification_show_content') == 'no')
  195. $contentN = $selected;
  196. else
  197. $contentY = $selected;
  198. if(get_option('post_notification_send_default') == 'no')
  199. $sendN = $selected;
  200. else
  201. $sendY = $selected;
  202. if(get_option('post_notification_send_private') == 'no')
  203. $privateN = $selected;
  204. else
  205. $privateY = $selected;
  206. if(get_option('post_notification_send_page') == 'no')
  207. $pageN = $selected;
  208. else
  209. $pageY = $selected;
  210. if(get_option('post_notification_page_meta') == 'no')
  211. $metaN = $selected;
  212. else
  213. $metaY = $selected;
  214. if(get_option('post_notification_filter_include') == 'no')
  215. $filter_includeN = $selected;
  216. else
  217. $filter_includeY = $selected;
  218. if(get_option('post_notification_uninstall') == 'yes') //rather have No
  219. $uninstallY = $selected;
  220. else
  221. $uninstallN = $selected;
  222. //Find Profiles
  223. if(!isset($profile)) //If the profile is already set, dont change.
  224. $profile = get_option('post_notification_profile');
  225. $profile_list = array();
  226. if(file_exists(POST_NOTIFICATION_DATA)){
  227. $dir_handle=opendir(POST_NOTIFICATION_DATA);
  228. while (false !== ($file = readdir ($dir_handle))) {
  229. if(@is_dir(POST_NOTIFICATION_DATA . $file) && $file[0] != '.' && $file[0] != '_') {
  230. if(post_notification_is_profile(POST_NOTIFICATION_DATA . $file)){
  231. $profile_list[] = $file;
  232. }
  233. }
  234. }
  235. closedir($dir_handle);
  236. } else {
  237. echo '<div class = "error">' . __('Please save own Profiles in: ', 'post_notification') .' '. POST_NOTIFICATION_DATA . '<br/>';
  238. echo __('Otherwise they may be deleted using autoupdate. ', 'post_notification') . '</div>';
  239. }
  240. ?>
  241. <form id="update" method="post" action="admin.php?page=post_notification/admin.php&amp;action=settings">
  242. <h4> <?php _e('When to send', 'post_notification'); ?></h4>
  243. <table width="100%">
  244. <tr class="alternate">
  245. <th style="text-align:right;padding-right:10px;"><?php _e('Send normal posts by default:', 'post_notification'); ?></th>
  246. <td>
  247. <select name="send_default" >
  248. <option value="no" <?php echo $sendN; ?> > <?php _e('No', 'post_notification'); ?></option>
  249. <option value="yes" <?php echo $sendY; ?> > <?php _e('Yes', 'post_notification'); ?></option>
  250. </select>
  251. </td>
  252. </tr>
  253. <tr class="alternate">
  254. <th style="text-align:right;padding-right:10px;"><?php _e('Send private posts by default:', 'post_notification'); ?></th>
  255. <td><select name="send_private">
  256. <option value="no" <?php echo $privateN; ?>><?php _e('No', 'post_notification'); ?></option>
  257. <option value="yes" <?php echo $privateY; ?>><?php _e('Yes', 'post_notification'); ?></option>
  258. </select></td>
  259. </tr>
  260. <tr class="alternate">
  261. <th style="text-align:right;padding-right:10px;"><?php _e('Send pages by default:', 'post_notification'); ?></th>
  262. <td>
  263. <select name="send_page">
  264. <option value="no" <?php echo $pageN; ?>><?php _e('No', 'post_notification'); ?></option>
  265. <option value="yes" <?php echo $pageY; ?>><?php _e('Yes', 'post_notification'); ?></option>
  266. </select>
  267. </td>
  268. </tr>
  269. <tr class="alternate">
  270. <th style="text-align:right;padding-right:10px;"><?php _e('Note:', 'post_notification'); ?></th>
  271. <td>
  272. <?php echo '<b>' . __('You can always override the settings above when writing a post. There is a Post Notification box somewhere near the upload box when writing or editing a post.', 'post_notification') . '</b>'; ?>
  273. </td>
  274. </tr>
  275. <tr class="alternate">
  276. <th style="text-align:right;padding-right:10px;"><?php _e('Nervous finger wait:', 'post_notification'); ?></th>
  277. <td>
  278. <input name="nervous" type="text" id="nervous" size="35" value="<?php echo get_option('post_notification_nervous'); ?>" /> <?php _e('seconds.', 'post_notification'); ?>
  279. </td>
  280. </tr>
  281. <tr class="alternate">
  282. <td />
  283. <td>
  284. <?php _e('This option sets the time to wait before sending an Email. So if you have an nervous finger you can unpublish your post quickly and no mails are sent.', 'post_notification'); ?>
  285. </td>
  286. </tr>
  287. </table>
  288. <h4> <?php _e('Look', 'post_notification'); ?></h4>
  289. <table width="100%">
  290. <tr class="alternate">
  291. <th style="text-align:right;padding-right:10px;"><?php _e('Copy complete post in to the mail:', 'post_notification') ?></th>
  292. <td>
  293. <select name="show_content" >
  294. <option value="no" <?php if(get_option('post_notification_show_content') == 'no') echo $selected; ?>><?php _e('No', 'post_notification'); ?></option>
  295. <option value="yes" <?php if(get_option('post_notification_show_content') == 'yes') echo $selected; ?>><?php _e('Yes', 'post_notification'); ?></option>
  296. <option value="more" <?php if(get_option('post_notification_show_content') == 'more') echo $selected; ?>><?php _e('Up to the more-tag.', 'post_notification'); ?></option>
  297. <option value="excerpt" <?php if(get_option('post_notification_show_content') == 'excerpt') echo $selected; ?>><?php _e('The excerpt', 'post_notification'); ?></option>
  298. </select>
  299. </td>
  300. </tr>
  301. <tr class="alternate">
  302. <th style="text-align:right;padding-right:10px;"><?php _e('Read-more-text:', 'post_notification'); ?></th>
  303. <td><input name="read_more" type="text" size="35" value="<?php echo get_option('post_notification_read_more'); ?>" /></td>
  304. </tr>
  305. <tr class="alternate">
  306. <td />
  307. <td><?php _e('This text is put behind the content in case the mail is truncated. E.g. because of the more-tag.', 'post_notification'); ?>
  308. </td>
  309. </tr>
  310. <tr class="alternate">
  311. <th style="text-align:right;padding-right:10px;"><?php _e('Profile:', 'post_notification'); ?></th>
  312. <td>
  313. <select name="en_profile" >
  314. <?php
  315. $dir_handle=opendir(POST_NOTIFICATION_PATH);
  316. while (false !== ($file = readdir ($dir_handle))) {
  317. if(is_dir(POST_NOTIFICATION_PATH . $file) && $file[0] != '.' && $file[0] != '_') {
  318. if(post_notification_is_profile(POST_NOTIFICATION_PATH . $file)){
  319. if(!in_array($file, $profile_list)) $profile_list[] = $file;
  320. }
  321. }
  322. }
  323. closedir($dir_handle);
  324. foreach($profile_list as $profile_list_el){
  325. $en_profiles = "<option value=\"$profile_list_el\" ";
  326. if($profile_list_el == $profile) $en_profiles .= ' selected="selected"';
  327. $en_profiles .= ">$profile_list_el</option>";
  328. echo $en_profiles;
  329. }
  330. ?>
  331. </select>
  332. </td>
  333. </tr>
  334. <tr class="alternate">
  335. <th style="text-align:right;padding-right:10px;"><?php _e('Template:', 'post_notification'); ?></th>
  336. <td>
  337. <select name="en_template" >
  338. <?php
  339. //Find templates
  340. $template = get_option('post_notification_template');
  341. $dir_handle=opendir( post_notification_get_profile_dir($profile ));
  342. while (false !== ($file = readdir ($dir_handle))) {
  343. if(substr($file, -5) == '.html' or substr($file, -4) == '.txt') {
  344. $en_templates = "<option value=\"$file\" ";
  345. if($file == $template) $en_templates .= ' selected="selected"';
  346. $en_templates .= ">$file</option>";
  347. echo $en_templates;
  348. }
  349. }
  350. closedir($dir_handle);
  351. ?>
  352. </select>
  353. </td>
  354. </tr>
  355. <tr class="alternate">
  356. <td />
  357. <td>
  358. <?php _e('Templates with the extension .txt are sent as text-mails. Templates with the extension .html are sent as HTML-mails', 'post_notification'); ?>
  359. </td>
  360. </tr>
  361. <tr class="alternate">
  362. <th style="text-align:right;padding-right:10px;"><?php _e('Subject:', 'post_notification'); ?></th>
  363. <td><input name="subject" type="text" size="35" value="<?php echo get_option('post_notification_subject'); ?>" /></td>
  364. </tr>
  365. <tr class="alternate">
  366. <td />
  367. <td><?php _e('Use @@blogname as placeholder for the blog name.', 'post_notification'); ?>
  368. <?php _e('Use @@title as placeholder for the title of the post.', 'post_notification'); ?>
  369. </td>
  370. </tr>
  371. <tr class="alternate">
  372. <th style="text-align:right;padding-right:10px;"><?php _e('Sender-Name:', 'post_notification'); ?></th>
  373. <td><input name="from_name" type="text" size="35" value="<?php echo get_option('post_notification_from_name'); ?>" /></td>
  374. </tr>
  375. <tr class="alternate">
  376. <td />
  377. <td><?php _e('Use @@blogname as placeholder for the blog name.', 'post_notification'); ?>
  378. </td>
  379. </tr>
  380. <tr class="alternate">
  381. <th style="text-align:right;padding-right:10px;"><?php _e('Sender-Email:', 'post_notification'); ?></th>
  382. <td><input name="from_email" type="text" size="35" value="<?php echo get_option('post_notification_from_email'); ?>" /></td>
  383. </tr>
  384. <tr class="alternate">
  385. <th style="text-align:right;padding-right:10px;"><?php _e('Show "saved.tmpl" when saving frontend settings.', 'post_notification'); ?></th>
  386. <?php
  387. if(get_option('post_notification_saved_tmpl') == 'yes'){
  388. $savedTmplY = $selected;
  389. } else {
  390. $savedTmplN = $selected;
  391. }
  392. ?>
  393. <td>
  394. <select name="saved_tmpl">
  395. <option value="no" <?php echo $savedTmplN; ?>><?php _e('No', 'post_notification'); ?></option>
  396. <option value="yes" <?php echo $savedTmplY; ?>><?php _e('Yes', 'post_notification'); ?></option>
  397. </select>
  398. </td>
  399. </tr>
  400. <tr class="alternate">
  401. <td />
  402. <td>
  403. <?php _e('You can add an additional saved.tmpl file to your profile. If you select this option this file will be shown to the subscriber when he saves his settings.', 'post_notification'); ?>
  404. </td>
  405. </tr>
  406. </table>
  407. <h4> <?php _e('Technical', 'post_notification'); ?></h4>
  408. <table width="100%">
  409. <tr class="alternate">
  410. <th style="text-align:right;padding-right:10px;"><?php _e('Number of mails to be sent in a burst:', 'post_notification'); ?></th>
  411. <td><input name="maxmails" type="text" id="maxmail" size="35" value="<?php echo get_option('post_notification_maxsend'); ?>" /></td>
  412. </tr>
  413. <tr class="alternate">
  414. <th style="text-align:right;padding-right:10px;"><?php _e('Pause between transmission:', 'post_notification'); ?></th>
  415. <td><input name="pause" type="text" id="pause" size="35" value="<?php echo get_option('post_notification_pause'); ?>" /> <?php _e('seconds.', 'post_notification'); ?></td>
  416. </tr>
  417. <tr class="alternate">
  418. <th style="text-align:right;padding-right:10px;"><?php _e('Type of header line break:', 'post_notification'); ?></th>
  419. <td>
  420. <select name="hdr_nl" >
  421. <option value="rn" <?php echo $hdr_rn; ?>>\r\n</option>
  422. <option value="n" <?php echo $hdr_n; ?>>\n</option>
  423. </select>
  424. </td>
  425. </tr>
  426. <tr class="alternate">
  427. <td />
  428. <td>
  429. <?php _e('According to the PHP-specification \r\n must be used. Never the less quite a few servers have trouble if they get a \r\n instead of \n. You\'ll see part of the header in your mail if you have the wrong selection.', 'post_notification') ?>
  430. </td>
  431. </tr>
  432. <tr class="alternate">
  433. <th style="text-align:right;padding-right:10px;"><?php _e('Locking:', 'post_notification') ?></th>
  434. <?php
  435. if(get_option('post_notification_lock') == 'db')
  436. $lockDB= $selected;
  437. else
  438. $lockFILE = $selected;
  439. ?>
  440. <td>
  441. <select name="lock" >
  442. <option value="file" <?php echo $lockFILE; ?>><?php _e('File', 'post_notification'); ?></option>
  443. <option value="db" <?php echo $lockDB; ?>><?php _e('Database', 'post_notification'); ?></option>
  444. </select>
  445. </td>
  446. </tr>
  447. <tr class="alternate">
  448. <td />
  449. <td>
  450. <?php _e('Try using database locking if you are geting duplicate messages.', 'post_notification') ;
  451. echo ' ' . '<a href="http://php.net/manual/function.flock.php">' . __('More information.', 'post_notification') . '</a>';
  452. ?>
  453. </td>
  454. </tr>
  455. <tr class="alternate">
  456. <th style="text-align:right;padding-right:10px;"><?php _e('Filters to exclude from filtering "the_content":', 'post_notification') ?></th>
  457. <td>
  458. <?php
  459. global $wp_filter;
  460. $rem_filters = get_option('post_notification_the_content_exclude');
  461. if(is_string($rem_filters) && strlen($rem_filters)){
  462. $rem_filters = unserialize($rem_filters);
  463. }
  464. if(!is_array($rem_filters)){
  465. $rem_filters = array();
  466. }
  467. foreach($wp_filter['the_content'] as $filter_level => $filters_in_level ){
  468. foreach($filters_in_level as $filter){
  469. if(function_exists('_wp_filter_build_unique_id')){
  470. // If a function is passed the unique_id will return the function name.
  471. // Therefore there should be no problem with backward compatibilty
  472. // priority may/must be false as all functions should get an Id when being registered
  473. // As prio = false, $tag is not needed at all!
  474. $fn_name = _wp_filter_build_unique_id('the_content', $filter['function'], $filter_level);
  475. } else {
  476. $fn_name = $filter['function'];
  477. }
  478. if(!($fn_name === false)){
  479. echo '<input type="checkbox" name="the_content[]" value="' . $fn_name . '" ';
  480. if(in_array($fn_name, $rem_filters)) echo ' checked="checked" ';
  481. echo '>' . $fn_name . '</input><br />';
  482. }
  483. }
  484. }
  485. ?>
  486. </td>
  487. </tr>
  488. <tr class="alternate">
  489. <td />
  490. <td>
  491. <?php
  492. _e('Some plugins use filters to modify the content of a post. You might not want some of them modifying your mails. Finding the right filters might need some playing around.', 'post_notification') ;
  493. ?>
  494. </td>
  495. </tr>
  496. </tr>
  497. <tr class="alternate">
  498. <th style="text-align:right;padding-right:10px;"><?php _e('When to send:', 'post_notification') ?></th>
  499. <?php
  500. if(get_option('post_notification_sendcheck') == 'head') {
  501. $sendhead= $selected;
  502. } else if(get_option('post_notification_sendcheck') == 'footer'){
  503. $sendfoot = $selected;
  504. } else {
  505. $sendshutdown = $selected;
  506. }
  507. ?>
  508. <td>
  509. <select name="sendcheck" >
  510. <option value="head" <?php echo $sendhead; ?>><?php _e('Header', 'post_notification'); ?></option>
  511. <option value="footer" <?php echo $sendfoot; ?>><?php _e('Footer', 'post_notification'); ?></option>
  512. <option value="shutdown" <?php echo $sendshutdown; ?>><?php _e('Shutdown', 'post_notification'); ?></option>
  513. </select>
  514. </td>
  515. </tr>
  516. <tr class="alternate">
  517. <td />
  518. <td>
  519. <?php _e('By default PN sends mails after the page has been rendered and sent to the user (shutdown).' .
  520. ' Some hosters kill all scripts after the connection has been closed. ' .
  521. 'You can try sending mails before the page is rendered (header) or before creating the footer of the ' .
  522. 'page (footer).', 'post_notification') ;
  523. ?>
  524. </td>
  525. </tr>
  526. <?php
  527. if(get_option('post_notification_auto_subscribe') == 'yes') //rather have No
  528. $auto_subscribeY = $selected;
  529. else
  530. $auto_subscribeN = $selected;
  531. ?>
  532. <tr class="alternate">
  533. <th style="text-align:right;padding-right:10px;"><?php _e('Add user to PN when registering to WP:', 'post_notification'); ?></th>
  534. <td>
  535. <select name="auto_subscribe" >
  536. <option value="no" <?php echo $auto_subscribeN; ?> > <?php _e('No', 'post_notification'); ?></option>
  537. <option value="yes" <?php echo $auto_subscribeY; ?> > <?php _e('Yes', 'post_notification'); ?></option>
  538. </select>
  539. </td>
  540. </tr>
  541. </table>
  542. <h4> <?php _e('Frontend', 'post_notification'); ?></h4>
  543. <table width="100%">
  544. <tr class="alternate">
  545. <th style="text-align:right;padding-right:10px;"><?php _e('Name of the Post Notification page:', 'post_notification'); ?></th>
  546. <td><input name="page_name" type="text" id="page_name" size="60" value="<?php echo get_option('post_notification_page_name'); ?>" /></td>
  547. </tr>
  548. <tr class="alternate">
  549. <th style="text-align:right;padding-right:10px;"><?php _e('Allow selection of categories:', 'post_notification'); ?></th>
  550. <td>
  551. <?php post_notification_select_yesno('show_cats'); ?>
  552. </td>
  553. </tr>
  554. <tr class="alternate">
  555. <th style="text-align:right;padding-right:10px;"><?php _e('Show empty categories:', 'post_notification'); ?></th>
  556. <td>
  557. <?php post_notification_select_yesno('empty_cats'); ?>
  558. </td>
  559. </tr>
  560. <?
  561. $selected_cats_list = get_option('post_notification_selected_cats');
  562. $selected_cats = explode(',', $selected_cats_list);
  563. ?>
  564. <tr class="alternate">
  565. <th style="text-align:right;padding-right:10px;"><?php _e('Default categories:', 'post_notification'); ?></th>
  566. <td><?php echo post_notification_get_catselect('', $selected_cats); ?></td>
  567. </tr>
  568. <tr class="alternate">
  569. <td />
  570. <td><?php _e('The categories which will be automatically selected when a user subscribes, and which is also default for the Manage Addresses dialog. Choosing a category includes all subcategories.', 'post_notification'); ?>
  571. </td>
  572. </tr>
  573. <tr class="alternate">
  574. <th style="text-align:right;padding-right:10px;">
  575. <a href="<?php _e('http://en.wikipedia.org/wiki/Captcha', 'post_notification'); ?>"><?php _e('Captcha-chars:', 'post_notification'); ?></a></th>
  576. <td><input name="captcha" type="text" size="60" value="<?php echo get_option('post_notification_captcha'); ?>" /></td>
  577. </tr>
  578. <tr class="alternate">
  579. <td />
  580. <td>
  581. <?php _e('Number of Captcha-chars. 0 is no Captcha', 'post_notification'); ?><br />
  582. <b><?php _e('Warning:', 'post_notification'); ?></b>
  583. <?php _e('Your template must support Captchas.', 'post_notification'); ?>
  584. </td>
  585. </tr>
  586. <tr class="alternate">
  587. <th style="text-align:right;padding-right:10px;"><?php _e('Post Notification link in the meta-section:', 'post_notification'); ?></th>
  588. <td>
  589. <select name="page_meta" >
  590. <option value="no" <?php echo $metaN; ?>><?php _e('No', 'post_notification'); ?></option>
  591. <option value="yes" <?php echo $metaY; ?>><?php _e('Yes', 'post_notification'); ?></option>
  592. </select>
  593. </td>
  594. </tr>
  595. <tr class="alternate">
  596. <th style="text-align:right;padding-right:10px;"><?php _e('Replacement in Posts:', 'post_notification'); ?></th>
  597. <td>
  598. <select name="filter_include" >
  599. <option value="no" <?php echo $filter_includeN; ?>><?php _e('No', 'post_notification'); ?></option>
  600. <option value="yes" <?php echo $filter_includeY; ?>><?php _e('Yes', 'post_notification'); ?></option>
  601. </select>
  602. </td>
  603. </tr>
  604. <tr class="alternate">
  605. <td />
  606. <td>
  607. <?php _e('The Stings @@post_notification_header and @@post_notification_body will be replaced in your post.', 'post_notification'); ?><br />
  608. <?php _e('Also see the Instructions for this.', 'post_notification'); ?>
  609. </td>
  610. </tr>
  611. <tr class="alternate">
  612. <th style="text-align:right;padding-right:10px;"><?php _e('Add Post Notification page:', 'post_notification'); ?></th>
  613. <td><input name="add_page" type="checkbox" id="add_page" value="add" /></td>
  614. </tr>
  615. <tr class="alternate">
  616. <td />
  617. <td>
  618. <?php _e('Adds a Post Notification page to your pages.', 'post_notification') . ' ';
  619. _e('The file "post_notification_template.php" has been copied into the active theme. You may want to edit this file to fit your needs. ', 'post_notification');?><br />
  620. <?php _e('This checkbox is cleared after execution.', 'post_notification');?><br />
  621. <?php _e('Also see the Instructions for this.', 'post_notification'); ?>
  622. </td>
  623. </tr>
  624. <tr class="alternate">
  625. <th style="text-align:right;padding-right:10px;"><?php _e('Link to the Post Notification page:', 'post_notification'); ?></th>
  626. <td><input name="pn_url" type="text" id="pn_url" size="60" value="<?php echo get_option('post_notification_url'); ?>" /></td>
  627. </tr>
  628. <tr class="alternate">
  629. <td />
  630. <td>
  631. <?php _e('This must be the URL or the ID of the page on which you subscribe.', 'post_notification') . ' ';
  632. _e('If you pick "Add Post Notification page" this will be compleated automaticly.', 'post_notification') . ' ';
  633. _e('Also see the Instructions for this.', 'post_notification'); ?>
  634. </td>
  635. </tr>
  636. </table>
  637. <h4> <?php _e('Miscellaneous', 'post_notification'); ?></h4>
  638. <table width="100%">
  639. <tr class="alternate">
  640. <th style="text-align:right;padding-right:10px;"><?php _e('Debug:', 'post_notification') ?></th>
  641. <?php
  642. if(get_option('post_notification_debug') != 'yes')
  643. $debugN = $selected;
  644. else
  645. $debugY = $selected;
  646. ?>
  647. <td>
  648. <select name="debug" >
  649. <option value="no" <?php echo $debugN; ?>><?php _e('No', 'post_notification'); ?></option>
  650. <option value="yes" <?php echo $debugY; ?>><?php _e('Yes', 'post_notification'); ?></option>
  651. </select>
  652. </td>
  653. </tr>
  654. <tr class="alternate">
  655. <th style="text-align:right;padding-right:10px;"><?php _e('Uninstall:', 'post_notification') ?></th>
  656. <td>
  657. <select name="uninstall" >
  658. <option value="no" <?php echo $uninstallN; ?>><?php _e('No', 'post_notification'); ?></option>
  659. <option value="yes" <?php echo $uninstallY; ?>><?php _e('Yes', 'post_notification'); ?></option>
  660. </select>
  661. </td>
  662. </tr>
  663. <tr class="alternate">
  664. <td />
  665. <td>
  666. <?php _e('WARNING: If this option is set, all database entries are deleted upon deactivation. Of course all data is lost.', 'post_notification'); ?>
  667. </td>
  668. </tr>
  669. <tr class="alternate">
  670. <td>&nbsp;</td>
  671. <td><input type="submit" name="updateSettings" value="<?php _e('save', 'post_notification'); ?>" /></td>
  672. </tr>
  673. </table>
  674. </form>
  675. <?php
  676. }
  677. ?>