-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5050724
Showing
111 changed files
with
12,080 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Plugin Name: Inhalts-Passwortschutz | ||
Author: DerN3rd | ||
|
||
Change Log: | ||
---------------------------------------------------------------------- | ||
---------------------------------------------------------------------- | ||
|
||
1.2 - 8/31/2017 | ||
---------------------------------------------------------------------- | ||
- In the WP editor plugin replaced hardcoded ajax URL | ||
|
||
1.1 - 7/18/2014 | ||
---------------------------------------------------------------------- | ||
- Fix various PHP notices | ||
- Update dashboard notification | ||
|
||
1.0.0 - 3/04/2011 | ||
---------------------------------------------------------------------- | ||
Initial Release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,227 @@ | ||
<?php | ||
/* | ||
Plugin Name: Inhalts-Passwortschutz | ||
Plugin URI: https://n3rds.work/docs/inhalts-passwortschutz-handbuch/ | ||
Description: Ermöglicht es Dir, ausgewählte Inhalte innerhalb eines Beitrags oder einer Seite mit einem Passwort zu schützen, während der Rest der Inhalte öffentlich bleibt. | ||
Author: WMS N@W | ||
Version: 1.2.3 | ||
Author URI: http://n3rds.work/ | ||
Textdomain: psc | ||
*/ | ||
|
||
/* | ||
Copyright 2007-2014 Incsub (http://incsub.com) | ||
Author - Aaron Edwards | ||
Contributors - | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License (Version 2 - GPLv2) as published by | ||
the Free Software Foundation. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
*/ | ||
|
||
require 'psource/psource-plugin-update/plugin-update-checker.php'; | ||
$MyUpdateChecker = Puc_v4_Factory::buildUpdateChecker( | ||
'https://n3rds.work//wp-update-server/?action=get_metadata&slug=protect-selected-content', | ||
__FILE__, | ||
'protect-selected-content' | ||
); | ||
|
||
|
||
class PartialPostPassword { | ||
|
||
function __construct() { | ||
|
||
//shortcodes | ||
add_shortcode( 'protect', array(&$this, 'shortcode') ); | ||
|
||
//localize the plugin | ||
add_action( 'plugins_loaded', array(&$this, 'localization') ); | ||
|
||
//handle cookie | ||
add_action( 'wp_ajax_nopriv_psc-set', array(&$this, 'set_password') ); | ||
add_action( 'wp_ajax_psc-set', array(&$this, 'set_password') ); | ||
|
||
// TinyMCE options | ||
add_action( 'wp_ajax_protectTinymceOptions', array(&$this, 'tinymce_options') ); | ||
add_action( 'admin_init', array(&$this, 'load_tinymce') ); | ||
|
||
//load dashboard notice | ||
//include_once( 'dash-notice/wpmudev-dash-notification.php' ); | ||
} | ||
|
||
function localization() { | ||
// Load up the localization file if we're using WordPress in a different language | ||
// Place it in this plugin's "languages" folder and name it "psc-[value in wp-config].mo" | ||
load_plugin_textdomain('psc', false, dirname(plugin_basename(__FILE__)) . '/languages'); | ||
} | ||
|
||
function shortcode( $atts, $content = null ) { | ||
extract( shortcode_atts( array( | ||
'password' => false | ||
), $atts ) ); | ||
|
||
//skip check for no content | ||
if ( is_null( $content ) ) | ||
return; | ||
|
||
//if no pass set don't protect | ||
if ( !$password ) | ||
return do_shortcode( $content ); | ||
|
||
//check cookie for password | ||
if ( isset( $_COOKIE['psc-postpass_' . COOKIEHASH] ) && $_COOKIE['psc-postpass_' . COOKIEHASH] == sha1( $password ) ) { | ||
return do_shortcode( $content ); | ||
} else { | ||
$label = 'pwbox-' . rand(); | ||
return '<form action="' . admin_url('admin-ajax.php') . '" method="post"><input type="hidden" name="action" value="psc-set" /> | ||
<p>' . __("Dieser Inhalt ist passwortgeschützt. Um es anzuzeigen, gib bitte unten Dein Passwort ein:", 'psc') . '</p> | ||
<p><label for="' . $label . '">' . __("Passwort:", 'psc') . ' <input name="post_password" id="' . $label . '" type="password" size="20" /></label> <input type="submit" name="Submit" value="' . esc_attr__("Entsperren", 'psc') . '" /></p> | ||
</form> | ||
'; | ||
} | ||
} | ||
|
||
function set_password() { | ||
|
||
if ( get_magic_quotes_gpc() ) | ||
$_POST['post_password'] = stripslashes( $_POST['post_password'] ); | ||
|
||
//set cookie for 10 days | ||
setcookie( 'psc-postpass_' . COOKIEHASH, sha1( $_POST['post_password'] ), time() + 864000, COOKIEPATH ); | ||
|
||
//jump back to post | ||
wp_safe_redirect( wp_get_referer() ); | ||
exit; | ||
} | ||
|
||
function load_tinymce() { | ||
if ( (current_user_can('edit_posts') || current_user_can('edit_pages')) && get_user_option('rich_editing') == 'true') { | ||
add_filter( 'mce_external_plugins', array(&$this, 'tinymce_add_plugin') ); | ||
add_filter( 'mce_buttons', array(&$this,'tinymce_register_button') ); | ||
add_filter( 'mce_external_languages', array(&$this,'tinymce_load_langs') ); | ||
} | ||
} | ||
|
||
/** | ||
* TinyMCE dialog content | ||
*/ | ||
function tinymce_options() { | ||
?> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | ||
<?php | ||
/** | ||
* TODO: We are including our own copy of tiny_mce_popup.js until this issue is resolved in the core file: https://core.trac.wordpress.org/ticket/41124 | ||
*/ | ||
?> | ||
<script type="text/javascript" | ||
src="<?php echo plugins_url(dirname(plugin_basename(__FILE__)) . '/tinymce/tiny_mce_popup.js'); ?>"> | ||
</script> | ||
<script type="text/javascript" src="../wp-includes/js/tinymce/utils/form_utils.js?ver=327-1235"></script> | ||
<script type="text/javascript" src="../wp-includes/js/tinymce/utils/editable_selects.js?ver=327-1235"></script> | ||
|
||
<script type="text/javascript" src="../wp-includes/js/jquery/jquery.js"></script> | ||
|
||
<script type="text/javascript"> | ||
|
||
tinyMCEPopup.storeSelection(); | ||
|
||
var insertProtect = function (ed) { | ||
var password = jQuery.trim(jQuery('#psc-password').val()); | ||
if (!password) { | ||
jQuery('#psc-error').show(); | ||
jQuery('#psc-password').focus(); | ||
return false; | ||
} | ||
tinyMCEPopup.restoreSelection(); | ||
output = '[protect password="'+password+'"]'+tinyMCEPopup.editor.selection.getContent()+'[/protect]'; | ||
|
||
tinyMCEPopup.execCommand('mceInsertContent', 0, output); | ||
tinyMCEPopup.editor.execCommand('mceRepaint'); | ||
tinyMCEPopup.editor.focus(); | ||
// Return | ||
tinyMCEPopup.close(); | ||
}; | ||
</script> | ||
<style type="text/css"> | ||
td.info { | ||
vertical-align: top; | ||
color: #777; | ||
} | ||
</style> | ||
|
||
<title><?php _e("Inhalt mit Passwort schützen", 'psc'); ?></title> | ||
</head> | ||
<body style="display: none"> | ||
<form onsubmit="insertProtect();return false;" action="#"> | ||
|
||
<div id="general_panel" class="panel current"> | ||
<div id="psc-error" style="display: none;color:#C00;padding: 2px 0;"><?php _e("Bitte Passwort eingeben!", 'psc'); ?></div> | ||
<fieldset> | ||
<table border="0" cellpadding="4" cellspacing="0"> | ||
<tr> | ||
<td><label for="chat_width"><?php _e("Passwort", 'psc'); ?></label></td> | ||
<td> | ||
<input type="text" id="psc-password" name="psc-password" value="" class="size" size="15" /> | ||
</td> | ||
<td class="info"><?php _e("Gib ein Passwort ein, das auf den ausgewählten Inhalt angewendet werden soll.", 'psc'); ?></td> | ||
</tr> | ||
</table> | ||
</fieldset> | ||
</div> | ||
|
||
<div class="mceActionPanel"> | ||
<div style="float: left"> | ||
<input type="button" id="cancel" name="cancel" value="<?php _e("Abbrechen", 'psc'); ?>" onclick="tinyMCEPopup.close();" /> | ||
</div> | ||
|
||
<div style="float: right"> | ||
<input type="submit" id="insert" name="insert" value="<?php _e("Einfügen", 'psc'); ?>" /> | ||
</div> | ||
</div> | ||
</form> | ||
</body> | ||
</html> | ||
<?php | ||
exit(0); | ||
} | ||
|
||
/** | ||
* @see http://codex.wordpress.org/TinyMCE_Custom_Buttons | ||
*/ | ||
function tinymce_register_button($buttons) { | ||
array_push($buttons, "separator", "protect"); | ||
return $buttons; | ||
} | ||
|
||
/** | ||
* @see http://codex.wordpress.org/TinyMCE_Custom_Buttons | ||
*/ | ||
function tinymce_load_langs($langs) { | ||
$langs["protect"] = plugins_url(dirname(plugin_basename(__FILE__)) . '/tinymce/langs/langs.php'); | ||
return $langs; | ||
} | ||
|
||
/** | ||
* @see http://codex.wordpress.org/TinyMCE_Custom_Buttons | ||
*/ | ||
function tinymce_add_plugin($plugin_array) { | ||
$plugin_array['protect'] = plugins_url(dirname(plugin_basename(__FILE__)) . '/tinymce/editor_plugin.js'); | ||
return $plugin_array; | ||
} | ||
|
||
} //end class | ||
|
||
//load class | ||
$psc = new PartialPostPassword(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[*] | ||
charset=utf-8 | ||
end_of_line=lf | ||
insert_final_newline=false | ||
indent_style=tab | ||
tab_width=4 | ||
|
||
[{phpunit.xml.dist,*.jhm,*.xslt,*.xul,*.rng,*.xsl,*.xsd,*.ant,*.tld,*.fxml,*.jrxml,*.xml,*.jnlp,*.wsdl}] | ||
indent_style=space | ||
indent_size=4 | ||
|
||
[*.svg] | ||
indent_style=space | ||
indent_size=4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Created by .ignore support plugin (hsz.mobi) | ||
### JetBrains template | ||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider | ||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
|
||
# The entire IDEA/PhpStorm directory | ||
.idea/ | ||
|
||
# CMake | ||
cmake-build-*/ | ||
|
||
# Mongo Explorer plugin | ||
.idea/**/mongoSettings.xml | ||
|
||
# File-based project format | ||
*.iws | ||
|
||
# IntelliJ | ||
out/ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# Cursive Clojure plugin | ||
.idea/replstate.xml | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
com_crashlytics_export_strings.xml | ||
crashlytics.properties | ||
crashlytics-build.properties | ||
fabric.properties | ||
|
||
# Editor-based Rest Client | ||
.idea/httpRequests | ||
|
||
# Android studio 3.1+ serialized cache file | ||
.idea/caches/build_file_checksums.ser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
if ( !class_exists('Puc_v4_Factory', false) ): | ||
|
||
class Puc_v4_Factory extends Puc_v4p10_Factory { } | ||
|
||
endif; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
if ( !class_exists('Puc_v4p10_Autoloader', false) ): | ||
|
||
class Puc_v4p10_Autoloader { | ||
private $prefix = ''; | ||
private $rootDir = ''; | ||
private $libraryDir = ''; | ||
|
||
private $staticMap; | ||
|
||
public function __construct() { | ||
$this->rootDir = dirname(__FILE__) . '/'; | ||
$nameParts = explode('_', __CLASS__, 3); | ||
$this->prefix = $nameParts[0] . '_' . $nameParts[1] . '_'; | ||
|
||
$this->libraryDir = $this->rootDir . '../..'; | ||
if ( !self::isPhar() ) { | ||
$this->libraryDir = realpath($this->libraryDir); | ||
} | ||
$this->libraryDir = $this->libraryDir . '/'; | ||
|
||
$this->staticMap = array( | ||
'PucReadmeParser' => 'vendor/PucReadmeParser.php', | ||
'Parsedown' => 'vendor/Parsedown.php', | ||
'Puc_v4_Factory' => 'Puc/v4/Factory.php', | ||
); | ||
|
||
spl_autoload_register(array($this, 'autoload')); | ||
} | ||
|
||
/** | ||
* Determine if this file is running as part of a Phar archive. | ||
* | ||
* @return bool | ||
*/ | ||
private static function isPhar() { | ||
//Check if the current file path starts with "phar://". | ||
static $pharProtocol = 'phar://'; | ||
return (substr(__FILE__, 0, strlen($pharProtocol)) === $pharProtocol); | ||
} | ||
|
||
public function autoload($className) { | ||
if ( isset($this->staticMap[$className]) && file_exists($this->libraryDir . $this->staticMap[$className]) ) { | ||
/** @noinspection PhpIncludeInspection */ | ||
include ($this->libraryDir . $this->staticMap[$className]); | ||
return; | ||
} | ||
|
||
if (strpos($className, $this->prefix) === 0) { | ||
$path = substr($className, strlen($this->prefix)); | ||
$path = str_replace('_', '/', $path); | ||
$path = $this->rootDir . $path . '.php'; | ||
|
||
if (file_exists($path)) { | ||
/** @noinspection PhpIncludeInspection */ | ||
include $path; | ||
} | ||
} | ||
} | ||
} | ||
|
||
endif; |
Oops, something went wrong.