function capa_global_page() { // Check if POST isnt empty $_POST ? capa_handle_action() : NULL; $private_message = capa_protect::get_private_message(); echo '<div class="wrap">'; // For WP < 27 echo function_exists('screen_icon') ? screen_icon('options-general') : NULL; echo '<h2 style="margin-bottom:15px;">' . __('CaPa » General settings', 'capa') . '<br><span class="description">' . __('These settings define the display of the CaPa protected content on your blog.', 'capa') . '</span></h2>'; echo '<form name="capa_protect" method="post">'; wp_nonce_field('update-options'); // -------------------------------------------------------------- echo ' <table class="form-table capa-form-table"> <tr> <th scope="row">' . __('Page display', 'capa') . '</th> <td> <label> <input name="capa_protect_show_private_pages" type="checkbox" onClick="capa_enable_disable_form_elements()"' . (get_option('capa_protect_show_private_pages') ? " checked" : "") . '> ' . __('Show protected pages', 'capa') . ' </label> <br> <span class="description" style="margin-left:10px;">' . __('Checking this option will show links to all the pages.', 'capa') . '</span> <br> <div style="margin-left:10px;"> </div> </td> </tr> <tr> <th scope="row">' . __('The Category List', 'capa') . '</th> <td> <label> <input name="capa_protect_show_private_categories" type="checkbox" onClick="capa_enable_disable_form_elements()"' . (get_option('capa_protect_show_private_categories') ? " checked" : "") . '> ' . __('Show private categories', 'capa') . ' </label> <br> <span class="description" style="margin-left:10px;">' . __('Checking this option will show links to all the Categories.', 'capa') . '</span> <br> <label id="capa_protect_show_padlock_on_private_categories"> <input name="capa_protect_show_padlock_on_private_categories" type="checkbox" ' . (get_option('capa_protect_show_padlock_on_private_categories') ? " checked" : "") . '> ' . __('Show a padlock icon next to private categories', 'capa') . ' </label> </td> </tr> <tr valign="top"> <th scope="row">' . __('Posts and pages display.', 'capa') . ' <br> <span class="description">' . __('How do you want to display a protected post or page?', 'capa') . '</span> </th> <td> <label> <input type="radio" name="capa_protect_post_policy" onClick="capa_enable_disable_form_elements()" value="hide" ' . (get_option('capa_protect_post_policy') == 'hide' || get_option('capa_protect_post_policy') == false && get_option('capa_protect_show_private_message') == false ? ' checked' : '') . '> ' . __('Hide everything', 'capa') . ' </label> <br> <label> <input type="radio" name="capa_protect_post_policy" onClick="capa_enable_disable_form_elements()" value="show message"' . (get_option('capa_protect_post_policy') == 'show message' || get_option('capa_protect_show_private_message') == true ? ' checked' : '') . '> ' . __('Show everything', 'capa') . ' </label> <br> <label> <input type="radio" name="capa_protect_post_policy" onClick="capa_enable_disable_form_elements()" value="show title"' . (get_option('capa_protect_post_policy') == 'show title' ? ' checked' : '') . '> ' . __('Show title and the private message as content', 'capa') . ' </label> </td> </tr> <tr> <th scope="row">' . __('The private message', 'capa') . '</th> <td> <label for="capa_protect_private_message" id="capa_protect_private_message"> <input name="capa_protect_private_message" type="text" size="70"' . ' value="' . $private_message . '" /> </label> </td> </tr> <tr> <th scope="row">' . __('The Comments', 'capa') . '</th> <td style="padding-left:20px;"> <h4 style="margin: 5px 0px 10px -10px;">' . __('Public & Allowed Comments', 'capa') . ':</h4> <label> <input type="radio" name="capa_protect_comment_policy" onClick="capa_enable_disable_form_elements()" value="hide"' . (get_option('capa_protect_comment_policy') == 'hide' || get_option('capa_protect_comment_policy') == false ? ' checked' : '') . '> ' . __('Hide all comments.', 'capa') . ' </label> <br> <label> <input type="radio" name="capa_protect_comment_policy" onClick="capa_enable_disable_form_elements()" value="show name"' . (get_option('capa_protect_comment_policy') == 'show name' ? ' checked' : '') . '> ' . __('Show Author, but the private message for the content.', 'capa') . ' </label> <br> <label> <input type="radio" name="capa_protect_comment_policy" onClick="capa_enable_disable_form_elements()" value="show message"' . (get_option('capa_protect_comment_policy') == 'show message' ? ' checked' : '') . '> ' . __('Show content, but no author.', 'capa') . ' </label> <br> <label> <input type="radio" name="capa_protect_comment_policy" onClick="capa_enable_disable_form_elements()" value="all"' . (get_option('capa_protect_comment_policy') == 'all' ? ' checked' : '') . '> ' . __('Show everything.', 'capa') . ' </label> <h4 style="margin: 15px 0px 10px -10px;">' . __('Private Comments', 'capa') . ':</h4> <label> <input name="capa_protect_show_comment_on_private_posts" type="checkbox" value="1" ' . (get_option('capa_protect_show_comment_on_private_posts') ? " checked" : "") . '> ' . __('Use the Settings for comments from protected Posts.', 'capa') . ' </label> </td> </tr> <tr> <th scope="row">' . __('The Media Library', 'capa') . '</th> <td> <label> <input name="capa_protect_show_only_allowed_attachments" type="checkbox" onClick="capa_enable_disable_form_elements()" ' . (get_option('capa_protect_show_only_allowed_attachments') ? " checked" : "") . '> ' . __('Show only allowed Attachments', 'capa') . ' </label> <br> <span class="description" style="margin-left:10px;">' . __('Checking this option shows only attachments which were uploaded (not inserted) in posts from allowed categories', 'capa') . '</span> <br> <label id="capa_protect_show_unattached_files"> <input name="capa_protect_show_unattached_files" type="checkbox" ' . (get_option('capa_protect_show_unattached_files') ? " checked" : "") . '> ' . __('Show unattached files', 'capa') . ' </label> </td> </tr> <tr> <th scope="row">' . __('Miscellaneous', 'capa') . '</th> <td> <label> <input type="checkbox" name="capa_protect_keep_options" value="on"' . (get_option('capa_protect_keep_options') == '1' ? ' checked' : '') . '> ' . __('Keep CaPa Settings', 'capa') . ' </label><br> <span class="description" style="margin-left:10px;">' . __('In Case CaPa is disabled but you wanna keep the Settings.', 'capa') . '</span> </td> </tr> </table> '; echo ' <p class="submit" style="float:left; margin-right:10px;"> <button type="submit" name="submit" class="button-primary" value="Update general settings" >' . __('Update general settings', 'capa') . '</button> </p> <p class="submit"> <button type="submit" name="submit" class="button-secondary" value="reset defaults" >' . __('Reset defaults', 'capa') . '</button> </p> '; echo '<script type="text/javascript">capa_enable_disable_form_elements();</script>'; echo '</form>'; echo '</div>'; }
/** * To show or not to show the comment body(content) * * @uses current_user * @uses post * @uses capa_protect_comment_policy * @uses capa_protect_show_comment_on_private_posts * * @uses capa_protect::post_should_be_hidden() * @uses capa_protect::get_private_message() * * @param string $param * * @return string */ function filter_comment_body($param) { global $current_user, $post; global $capa_protect_comment_policy, $capa_protect_show_comment_on_private_posts; // Hm, POst oder Comemnt // wird post hier gebraucht? if (!$post) { global $comment; $ID = $comment->ID; } else { $ID = $post->ID; } if ($current_user && isset($current_user->allcaps['manage_categories']) && !isset($current_user->caps['editor'])) { return $param; } if (capa_protect::post_should_be_hidden($ID)) { if (is_numeric($capa_protect_show_comment_on_private_posts)) { if ($capa_protect_comment_policy == 'show message' or $capa_protect_comment_policy == 'all') { return $param; } else { return capa_protect::get_private_message(); } } else { return capa_protect::get_private_message(); } } else { if ($capa_protect_comment_policy == 'show message' or $capa_protect_comment_policy == 'all') { return $param; } else { return capa_protect::get_private_message(); } } }