Browse Source

Initial code import based on Amine's email 6/28/2016

master
Mahmoud Al-Qudsi 3 years ago
commit
8a81066ae0
100 changed files with 15623 additions and 0 deletions
  1. +135
    -0
      bootstrap.php
  2. +178
    -0
      css/app.css
  3. +156
    -0
      css/editor.css
  4. +230
    -0
      css/grid.css
  5. +10
    -0
      css/tinymce.css
  6. BIN
      img/approve.png
  7. BIN
      img/clean.png
  8. BIN
      img/contribute.png
  9. BIN
      img/original.png
  10. BIN
      img/reject.png
  11. +204
    -0
      inc/approve.php
  12. +152
    -0
      inc/editor.php
  13. +48
    -0
      inc/mail.php
  14. +89
    -0
      inc/mail_templates/admin_submition.html
  15. +84
    -0
      inc/mail_templates/visitor_approval.html
  16. +95
    -0
      inc/mail_templates/visitor_submition.html
  17. +86
    -0
      inc/main.php
  18. +1742
    -0
      inc/parser.php
  19. +71
    -0
      inc/settings.php
  20. +8
    -0
      js/admin.js
  21. +121
    -0
      js/approve.js
  22. +41
    -0
      js/editor.js
  23. +4
    -0
      js/jquery.js
  24. +1532
    -0
      js/jquery.validate.js
  25. +7
    -0
      vendor/autoload.php
  26. +145
    -0
      vendor/caxy/php-htmldiff/CHANGELOG.md
  27. +74
    -0
      vendor/caxy/php-htmldiff/CODE_OF_CONDUCT.md
  28. +33
    -0
      vendor/caxy/php-htmldiff/CONTRIBUTING.md
  29. +130
    -0
      vendor/caxy/php-htmldiff/LICENSE
  30. +201
    -0
      vendor/caxy/php-htmldiff/README.md
  31. +43
    -0
      vendor/caxy/php-htmldiff/composer.json
  32. +1
    -0
      vendor/caxy/php-htmldiff/demo/README.md
  33. +16
    -0
      vendor/caxy/php-htmldiff/demo/bower.json
  34. +276
    -0
      vendor/caxy/php-htmldiff/demo/codes.css
  35. +212
    -0
      vendor/caxy/php-htmldiff/demo/demo.controller.js
  36. +246
    -0
      vendor/caxy/php-htmldiff/demo/demo.html
  37. +9
    -0
      vendor/caxy/php-htmldiff/demo/demo.module.js
  38. +1
    -0
      vendor/caxy/php-htmldiff/demo/demos.json
  39. +1
    -0
      vendor/caxy/php-htmldiff/demo/diff.json
  40. +56
    -0
      vendor/caxy/php-htmldiff/demo/index.php
  41. +22
    -0
      vendor/caxy/php-htmldiff/demo/load_table_diff.php
  42. +46
    -0
      vendor/caxy/php-htmldiff/demo/save_demo.php
  43. +1
    -0
      vendor/caxy/php-htmldiff/demo/tablediffs.json
  44. +116
    -0
      vendor/caxy/php-htmldiff/doc/differences.rst
  45. +490
    -0
      vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/AbstractDiff.php
  46. +112
    -0
      vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/DiffCache.php
  47. +795
    -0
      vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/HtmlDiff.php
  48. +488
    -0
      vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/HtmlDiffConfig.php
  49. +944
    -0
      vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/ListDiff.php
  50. +102
    -0
      vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/ListDiff/DiffList.php
  51. +124
    -0
      vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/ListDiff/DiffListItem.php
  52. +280
    -0
      vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/ListDiffNew.php
  53. +27
    -0
      vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/Match.php
  54. +21
    -0
      vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/Operation.php
  55. +94
    -0
      vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/Table/AbstractTableElement.php
  56. +268
    -0
      vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/Table/DiffRowPosition.php
  57. +133
    -0
      vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/Table/RowMatch.php
  58. +161
    -0
      vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/Table/Table.php
  59. +55
    -0
      vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/Table/TableCell.php
  60. +921
    -0
      vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/Table/TableDiff.php
  61. +75
    -0
      vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/Table/TableMatch.php
  62. +70
    -0
      vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/Table/TablePosition.php
  63. +106
    -0
      vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/Table/TableRow.php
  64. +26
    -0
      vendor/caxy/php-htmldiff/phpunit.xml.dist
  65. +40
    -0
      vendor/caxy/php-htmldiff/tests/Caxy/Tests/HtmlDiff/Functional/HtmlDiffFunctionalTest.php
  66. +103
    -0
      vendor/caxy/php-htmldiff/tests/Caxy/Tests/HtmlDiff/HtmlFileIterator.php
  67. +14
    -0
      vendor/caxy/php-htmldiff/tests/Caxy/Tests/TestInit.php
  68. +13
    -0
      vendor/caxy/php-htmldiff/tests/fixtures/HtmlDiff/ICC-5136.html
  69. +39
    -0
      vendor/caxy/php-htmldiff/tests/fixtures/HtmlDiff/first-and-last.html
  70. +15
    -0
      vendor/caxy/php-htmldiff/tests/fixtures/HtmlDiff/issue-28-link-changes.html
  71. +20
    -0
      vendor/caxy/php-htmldiff/tests/fixtures/HtmlDiff/new-paragraph-and-list.html
  72. +18
    -0
      vendor/caxy/php-htmldiff/tests/fixtures/HtmlDiff/override-2.html
  73. +29
    -0
      vendor/caxy/php-htmldiff/tests/fixtures/HtmlDiff/override-3.html
  74. +28
    -0
      vendor/caxy/php-htmldiff/tests/fixtures/HtmlDiff/override-4.html
  75. +31
    -0
      vendor/caxy/php-htmldiff/tests/fixtures/HtmlDiff/override-5.html
  76. +42
    -0
      vendor/caxy/php-htmldiff/tests/fixtures/HtmlDiff/override-6.html
  77. +11
    -0
      vendor/caxy/php-htmldiff/tests/fixtures/HtmlDiff/override-8.html
  78. +11
    -0
      vendor/caxy/php-htmldiff/tests/fixtures/HtmlDiff/override-9.html
  79. +413
    -0
      vendor/composer/ClassLoader.php
  80. +21
    -0
      vendor/composer/LICENSE
  81. +9
    -0
      vendor/composer/autoload_classmap.php
  82. +10
    -0
      vendor/composer/autoload_files.php
  83. +11
    -0
      vendor/composer/autoload_namespaces.php
  84. +9
    -0
      vendor/composer/autoload_psr4.php
  85. +59
    -0
      vendor/composer/autoload_real.php
  86. +105
    -0
      vendor/composer/installed.json
  87. +9
    -0
      vendor/ezyang/htmlpurifier/CREDITS
  88. +374
    -0
      vendor/ezyang/htmlpurifier/INSTALL
  89. +60
    -0
      vendor/ezyang/htmlpurifier/INSTALL.fr.utf8
  90. +504
    -0
      vendor/ezyang/htmlpurifier/LICENSE
  91. +1094
    -0
      vendor/ezyang/htmlpurifier/NEWS
  92. +24
    -0
      vendor/ezyang/htmlpurifier/README
  93. +150
    -0
      vendor/ezyang/htmlpurifier/TODO
  94. +1
    -0
      vendor/ezyang/htmlpurifier/VERSION
  95. +4
    -0
      vendor/ezyang/htmlpurifier/WHATSNEW
  96. +20
    -0
      vendor/ezyang/htmlpurifier/WYSIWYG
  97. +22
    -0
      vendor/ezyang/htmlpurifier/composer.json
  98. +91
    -0
      vendor/ezyang/htmlpurifier/extras/ConfigDoc/HTMLXSLTProcessor.php
  99. +164
    -0
      vendor/ezyang/htmlpurifier/extras/FSTools.php
  100. +141
    -0
      vendor/ezyang/htmlpurifier/extras/FSTools/File.php

+ 135
- 0
bootstrap.php View File

@@ -0,0 +1,135 @@
<?php
/*
Plugin Name: Visitors contributions
Plugin URI: http://codecanyon.net/user/Leavy
Description: A wordpress plugin that gives your visitors the possiblity to develop your website content by submiting new versions to your articles.
Version: 1.07
Author: Leavy
Author URI: http://codecanyon.net/user/Leavy
*/
class visitors_edits{
public function __construct() {
register_activation_hook( __FILE__, array($this,'install'));
add_action( 'admin_menu', array( $this, 'admin_pages' ) );
add_filter('the_content', array($this,'contentFilter'));
add_filter( 'query_vars', array($this,'query_vars') );
add_action( 'init',array($this,'init'));
add_action( 'parse_request',array($this,'parse_request'));
add_filter( 'mce_buttons', array($this,'tinymce_btns') );
add_filter( 'mce_external_plugins', array($this,'tinymce_scripts') );
add_action('admin_head', array($this,'admin_head') );
add_action('admin_init', array($this,'admin_init') );
}
public function admin_pages() {
add_menu_page('Visitors Contributions | Pending reviews','Visitors contributions','read','visitors_edits_main',array($this , 'main'),plugins_url("img/contribute.png",__FILE__),87);
add_submenu_page(null,"Visitors Contributions | Review","Review a contribution","read",'visitors_edits_approve',array($this,'approve'));
add_submenu_page("visitors_edits_main","Visitors Contributions | Settings","Settings","read",'visitors_edits_settings',array($this,'settings'));
}
public function admin_head(){
if(isset($_GET["page"]) && ($_GET["page"]==="visitors_edits_approve" || $_GET["page"]==="visitors_edits_main" || $_GET["page"]==="visitors_edits_settings")){
?>
<link rel="stylesheet" type="text/css" href="<?php echo plugins_url( '/css/app.css',__FILE__ );?>">
<?php
}
}
public function admin_init(){
add_editor_style(plugins_url( './css/tinymce.css',__FILE__ ));
}
public function main(){
require "inc/main.php";
}
public function approve(){
require 'inc/approve.php';
}
public function settings(){
require 'inc/settings.php';
}
public function contentFilter($content){
if(is_single()) {
$options=get_option( "visitors_edits_options", [
"propose_edit_link"=>"<p><a href='#post_link#'>Propose an edit</a></p>"
]);
global $post;
$new_content = str_replace("#post_link#", get_site_url().'/'.$post->post_name.'/suggestions', stripcslashes($options["propose_edit_link"]));
$content .= $new_content;
}
return $content;
}
public function install(){
//General Settings
delete_option("visitors_edits_options");
//Database Settings
global $wpdb;
$wpdb->show_errors();
$charset_collate = $wpdb->get_charset_collate();
$table_name = $wpdb->prefix . 'visitors_edits';
$sql = "CREATE TABLE $table_name (
edit_id bigint(20) NOT NULL AUTO_INCREMENT,
edit_time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
visitor_name text DEFAULT '',
visitor_email text DEFAULT '',
visitor_comment longtext DEFAULT '',
edit_content longtext DEFAULT '',
post_id bigint(20),
post_content longtext DEFAULT '',
UNIQUE KEY (edit_id)
) $charset_collate;";
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
dbDelta( $sql );
}
public function query_vars($query_vars){
$query_vars[] = 'visitors_edits_post_name';
return $query_vars;
}
public function init(){
add_rewrite_rule(
'(.*)?/suggestions/?$',
'index.php?visitors_edits_post_name=$matches[1]',
'top'
);
flush_rewrite_rules(true);
}
public function parse_request($request){
if( isset( $request->query_vars['visitors_edits_post_name'] ) ):
include( plugin_dir_path(__FILE__) . "/inc/editor.php" );
exit();
endif;
return $request;
}
public function tinymce_btns($buttons){
if(isset($_GET["page"]) && $_GET["page"]==="visitors_edits_approve"){
array_push($buttons,'|','visitors_edits_approve','visitors_edits_reject','visitors_edits_clean');
}
return $buttons;
}
public function tinymce_scripts($plugin_array){
$plugin_array['visitors_edits'] = plugins_url( 'js/approve.js',__FILE__ );
return $plugin_array;
}
static function scriptUrl($script){
return plugins_url( 'js/'.$script.'.js',__FILE__);
}
}
new visitors_edits();
use Caxy\HtmlDiff\HtmlDiff;
use PHPHtmlParser\Dom;
function visitors_editsDIFF($oldHtml,$newHtml){
require "vendor/autoload.php";
$htmlDiff = new HtmlDiff($oldHtml, $newHtml);
$htmlDiff->getConfig()->setGroupDiffs(false);
return $htmlDiff->build();
}
function visitors_editsDOM(){
return new Dom;
}
?>

+ 178
- 0
css/app.css View File

@@ -0,0 +1,178 @@
@import url("https://fonts.googleapis.com/css?family=Roboto:100,400,700");
/* line 3, ../sass/app.scss */
.visitors_edits_no_data {
text-align: center;
font-weight: bold;
font-size: 50px;
margin-top: 250px;
opacity: 0.3;
text-transform: uppercase;
display: none;
}
/* line 12, ../sass/app.scss */
.visitors_edits_pending {
padding: 15px;
}
/* line 14, ../sass/app.scss */
.visitors_edits_pending h1 {
font-weight: 100;
font-size: 20px;
}
/* line 22, ../sass/app.scss */
.visitors_flashMessage {
margin: 15px;
background: #fff;
padding: 10px 15px;
border-left: 6px solid #089D08;
color: #089D08;
font-size: 14px;
font-weight: 100;
}
/* line 30, ../sass/app.scss */
.visitors_flashMessage.danger {
color: #F6214E;
border-color: #F6214E;
}
/* line 36, ../sass/app.scss */
.visitors_edits_review_editor {
padding: 15px;
}
/* line 38, ../sass/app.scss */
.visitors_edits_review_editor h1 {
font-weight: 100;
font-size: 25px;
display: inline-block;
margin-right: 15px;
margin-bottom: 10px;
}
/* line 45, ../sass/app.scss */
.visitors_edits_review_editor .delete_edit {
transition-duration: 0.3s;
color: #F6214E;
text-decoration: none;
text-decoration: underline;
font-style: italic;
font-style: 12px;
opacity: 0.6;
}
/* line 53, ../sass/app.scss */
.visitors_edits_review_editor .delete_edit:hover {
opacity: 1;
}
/* line 57, ../sass/app.scss */
.visitors_edits_review_editor .edit_info, .visitors_edits_review_editor .edit_notify {
padding-left: 15px;
font-style: italic;
opacity: 0.8;
font-size: 14px;
}
/* line 62, ../sass/app.scss */
.visitors_edits_review_editor .edit_info .mail, .visitors_edits_review_editor .edit_notify .mail {
opacity: 0.6;
font-size: 12px;
}
/* line 67, ../sass/app.scss */
.visitors_edits_review_editor .edit_notify {
margin: 10px 0;
padding: 0;
}
/* line 70, ../sass/app.scss */
.visitors_edits_review_editor .edit_notify label {
display: block;
margin-bottom: 10px;
}
/* line 74, ../sass/app.scss */
.visitors_edits_review_editor .edit_notify #edit_notify_message {
font-family: "Roboto",sans-serif;
max-height: 100px;
min-height: 100px;
max-width: 100%;
min-width: 100%;
line-height: normal;
border: none;
border-bottom: 1px solid #DFDFDF;
font-size: 18px;
padding: 10px;
display: none;
}
/* line 85, ../sass/app.scss */
.visitors_edits_review_editor .edit_notify #edit_notify_message:focus {
outline: none;
border-bottom-width: 2px;
border-color: rgba(3, 133, 244, 0.7);
}
/* line 93, ../sass/app.scss */
.visitors_edits_review_editor .controls {
margin-top: 20px;
}
/* line 96, ../sass/app.scss */
.visitors_edits_review_editor .comment {
font-size: 14px;
margin: 0;
padding: 10px;
background: #fff;
border: 1px solid #999;
font-style: normal;
opacity: 1;
color: #000;
}
/* line 107, ../sass/app.scss */
.visitors_edits_admin {
font-family: "Roboto",sans-serif;
width: 70%;
margin: 50px auto;
background: #fff;
border: 1px solid #E2E2E2;
padding: 20px;
}
/* line 114, ../sass/app.scss */
.visitors_edits_admin h2 {
font-size: 25px;
font-weight: 100;
}
/* line 120, ../sass/app.scss */
.visitors_edits_admin .control label {
display: block;
font-weight: bold;
margin: 15px 0 0;
opacity: 0.9;
font-size: 13px;
}
/* line 127, ../sass/app.scss */
.visitors_edits_admin .control input[type="text"], .visitors_edits_admin .control .notif_message {
background: #F3F3F3;
outline: none;
padding: 0 10px;
height: 40px;
line-height: normal;
border: none;
border-bottom: 1px solid #DFDFDF;
width: 100%;
}
/* line 136, ../sass/app.scss */
.visitors_edits_admin .control input[type="text"]:focus, .visitors_edits_admin .control .notif_message:focus {
outline: none;
border-bottom-width: 2px;
border-color: rgba(3, 133, 244, 0.7);
}
/* line 142, ../sass/app.scss */
.visitors_edits_admin .control .notif_message {
min-height: 120px;
max-height: 120px;
padding: 10px;
min-width: 100%;
max-width: 100%;
line-height: normal;
}
/* line 150, ../sass/app.scss */
.visitors_edits_admin .control input[type="checkbox"] {
margin-right: 10px;
}
/* line 153, ../sass/app.scss */
.visitors_edits_admin .control .save_btn {
margin-top: 20px;
}

+ 156
- 0
css/editor.css View File

@@ -0,0 +1,156 @@
@import url("https://fonts.googleapis.com/css?family=Roboto:100,400,700");
/* line 7, ../sass/editor.scss */
body {
font-family: "Roboto",sans-serif;
font-size: 18px;
color: #545454;
padding: 0;
margin: 0;
}
/* line 14, ../sass/editor.scss */
a {
text-decoration: none;
color: inherit;
}
/* line 18, ../sass/editor.scss */
* {
transition-duration: 0.3s;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* line 22, ../sass/editor.scss */
.header {
padding: 20px 60px;
background: #0385F4;
}
/* line 25, ../sass/editor.scss */
.header .header-title {
font-size: 50px;
font-weight: 100;
color: #fff;
opacity: 0.5;
}
/* line 31, ../sass/editor.scss */
.header .header-content {
font-weight: 100;
color: #fff;
text-align: right;
font-size: 14px;
opacity: 0.7;
}
/* line 37, ../sass/editor.scss */
.header .header-content:hover {
opacity: 0.9;
}
/* line 42, ../sass/editor.scss */
.editor_form {
padding: 20px 40px;
overflow: hidden;
width: 100%;
}
/* line 46, ../sass/editor.scss */
.editor_form .editor_field {
background: #f5f5f5;
padding: 15px;
}
/* line 50, ../sass/editor.scss */
.editor_form .submit_fields {
padding: 0 20px;
}
/* line 55, ../sass/editor.scss */
label {
display: block;
margin: 30px 0 10px;
}
/* line 59, ../sass/editor.scss */
.text_field, .area_field {
height: 40px;
line-height: 40px;
border: none;
border-bottom: 1px solid #DFDFDF;
width: 100%;
font-size: 18px;
}
/* line 66, ../sass/editor.scss */
.text_field:focus, .area_field:focus {
outline: none;
border-bottom-width: 2px;
border-color: rgba(3, 133, 244, 0.7);
}
/* line 72, ../sass/editor.scss */
.area_field {
font-family: "Roboto",sans-serif;
max-height: 100px;
min-height: 100px;
max-width: 100%;
min-width: 100%;
line-height: normal;
}
/* line 80, ../sass/editor.scss */
.submit_fields_error {
line-height: 20px;
font-style: italic;
font-size: 12px;
opacity: 0.8;
color: #e74c3c;
}
/* line 87, ../sass/editor.scss */
.btn {
height: 40px;
color: #fff;
line-height: 40px;
padding: 0 20px;
text-transform: uppercase;
background: #0385F4;
border: 1px solid #0385F4;
cursor: pointer;
margin: 20px 0;
}
/* line 97, ../sass/editor.scss */
.btn:hover {
color: #0385F4;
background: #fff;
}
/* line 102, ../sass/editor.scss */
.cb {
clear: both;
}
/* line 105, ../sass/editor.scss */
.grey {
background: #f5f5f5;
}
/* line 108, ../sass/editor.scss */
.submit_success {
margin-top: 200px;
background: #0385F4;
padding: 30px;
color: #fff;
}
/* line 113, ../sass/editor.scss */
.submit_success .alert_title {
font-size: 40px;
opacity: 0.4;
}
/* line 117, ../sass/editor.scss */
.submit_success .alert_content {
font-weight: 100;
}
/* line 120, ../sass/editor.scss */
.submit_success .alert_footer {
opacity: 0.7;
font-size: 12px;
font-style: italic;
}

+ 230
- 0
css/grid.css View File

@@ -0,0 +1,230 @@
/* line 2, style.scss */
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
/* line 3, style.scss */
body {
margin: 0;
padding: 0;
font-family: sans-serif;
}
/* line 6, _grid.scss */
.col-1, .col-m-1, .col-l-1, .col-2, .col-m-2, .col-l-2, .col-3, .col-m-3, .col-l-3, .col-4, .col-m-4, .col-l-4, .col-5, .col-m-5, .col-l-5, .col-6, .col-m-6, .col-l-6, .col-7, .col-m-7, .col-l-7, .col-8, .col-m-8, .col-l-8, .col-9, .col-m-9, .col-l-9, .col-10, .col-m-10, .col-l-10, .col-11, .col-m-11, .col-l-11, .col-12, .col-m-12, .col-l-12 {
float: right;
position: relative;
min-height: 1px;
padding: 0 10px;
/*border: 1px solid rgba(255, 0, 0, 0.5);*/
}
/* line 16, _grid.scss */
.col-1 {
width: 8.33333%;
}
/* line 16, _grid.scss */
.col-2 {
width: 16.66667%;
}
/* line 16, _grid.scss */
.col-3 {
width: 25%;
}
/* line 16, _grid.scss */
.col-4 {
width: 33.33333%;
}
/* line 16, _grid.scss */
.col-5 {
width: 41.66667%;
}
/* line 16, _grid.scss */
.col-6 {
width: 50%;
}
/* line 16, _grid.scss */
.col-7 {
width: 58.33333%;
}
/* line 16, _grid.scss */
.col-8 {
width: 66.66667%;
}
/* line 16, _grid.scss */
.col-9 {
width: 75%;
}
/* line 16, _grid.scss */
.col-10 {
width: 83.33333%;
}
/* line 16, _grid.scss */
.col-11 {
width: 91.66667%;
}
/* line 16, _grid.scss */
.col-12 {
width: 100%;
}
/* line 23, _grid.scss */
.row {
margin: 0 -10px;
overflow: hidden;
*zoom: 1;
}
/* line 27, _grid.scss */
.col-center {
margin: 0 auto;
float: none;
}
@media only screen and (min-width: 640px) {
/* line 30, _grid.scss */
.col-m-center {
margin: 0 auto;
float: none;
}
/* line 32, _grid.scss */
.col-m-1 {
width: 8.33333%;
}
/* line 32, _grid.scss */
.col-m-2 {
width: 16.66667%;
}
/* line 32, _grid.scss */
.col-m-3 {
width: 25%;
}
/* line 32, _grid.scss */
.col-m-4 {
width: 33.33333%;
}
/* line 32, _grid.scss */
.col-m-5 {
width: 41.66667%;
}
/* line 32, _grid.scss */
.col-m-6 {
width: 50%;
}
/* line 32, _grid.scss */
.col-m-7 {
width: 58.33333%;
}
/* line 32, _grid.scss */
.col-m-8 {
width: 66.66667%;
}
/* line 32, _grid.scss */
.col-m-9 {
width: 75%;
}
/* line 32, _grid.scss */
.col-m-10 {
width: 83.33333%;
}
/* line 32, _grid.scss */
.col-m-11 {
width: 91.66667%;
}
/* line 32, _grid.scss */
.col-m-12 {
width: 100%;
}
}
@media only screen and (min-width: 1024px) {
/* line 39, _grid.scss */
.col-l-center {
margin: 0 auto;
float: none;
}
/* line 41, _grid.scss */
.col-l-1 {
width: 8.33333%;
}
/* line 41, _grid.scss */
.col-l-2 {
width: 16.66667%;
}
/* line 41, _grid.scss */
.col-l-3 {
width: 25%;
}
/* line 41, _grid.scss */
.col-l-4 {
width: 33.33333%;
}
/* line 41, _grid.scss */
.col-l-5 {
width: 41.66667%;
}
/* line 41, _grid.scss */
.col-l-6 {
width: 50%;
}
/* line 41, _grid.scss */
.col-l-7 {
width: 58.33333%;
}
/* line 41, _grid.scss */
.col-l-8 {
width: 66.66667%;
}
/* line 41, _grid.scss */
.col-l-9 {
width: 75%;
}
/* line 41, _grid.scss */
.col-l-10 {
width: 83.33333%;
}
/* line 41, _grid.scss */
.col-l-11 {
width: 91.66667%;
}
/* line 41, _grid.scss */
.col-l-12 {
width: 100%;
}
}

+ 10
- 0
css/tinymce.css View File

@@ -0,0 +1,10 @@
ins{
background: transparent !important;
color: inherit !important;
}
.diffins{
background:#4DB1FB !important;
}
.diffmod{
background:#4DFB74 !important;
}

BIN
img/approve.png View File

Before After
Width: 24  |  Height: 24  |  Size: 261B

BIN
img/clean.png View File

Before After
Width: 24  |  Height: 24  |  Size: 629B

BIN
img/contribute.png View File

Before After
Width: 16  |  Height: 16  |  Size: 546B

BIN
img/original.png View File

Before After
Width: 24  |  Height: 24  |  Size: 484B

BIN
img/reject.png View File

Before After
Width: 24  |  Height: 24  |  Size: 336B

+ 204
- 0
inc/approve.php View File

@@ -0,0 +1,204 @@
<?php
if(isset($_GET["edit"])){
global $wpdb;
$table_name = $wpdb->prefix . 'visitors_edits';
$edit = $wpdb->get_row("SELECT * FROM ".$table_name." WHERE edit_id=".$_GET["edit"]);
$edit->edit_content=stripcslashes($edit->edit_content);
$edit->post=get_post($edit->post_id);
$options=get_option( "visitors_edits_options", [
"advanced_merge"=>null
]);
//Fix nl
//$edit->post->post_content=str_replace(["\r\n", "\r", "\n"], "<br/>",$edit->post->post_content);
//$edit->post_content=str_replace(["\r\n", "\r", "\n"], "<br/>",$edit->post_content);
//$edit->edit_content=str_replace(["\r\n", "\r", "\n"], "<br/>",$edit->edit_content);
$edit->post->post_content=nl2br($edit->post->post_content);
$edit->post_content=nl2br($edit->post_content);
$edit->edit_content=nl2br($edit->edit_content);
if($options["advanced_merge"]!=null){
$diff1=visitors_editsDIFF($edit->post_content,$edit->edit_content);
$conv_diff1=encodeDiff($diff1);
$diff=visitors_editsDIFF($conv_diff1["html"],$edit->post->post_content);
$diff=cleanEncodedDiff($diff);
$diff=decodeDiff($diff,$conv_diff1["codes"]);
}else{
$diff=visitors_editsDIFF($edit->post->post_content,$edit->edit_content);
}
$diff=cleanDiff($diff);
echo '<div style="display:none" id="visitors_edits_diff">'.$diff.'</div>';
showEditor($edit);
}else{
noData("Select a visitor contribution");
?>
<script type="text/javascript">
setTimeout(function(){
window.location="<?php echo menu_page_url('visitors_edits_main',false);?>";
},2000)
</script>
<?php
}
function showEditor($edit,$editor_content=""){
$options=get_option( "visitors_edits_options", [
"edit_notify_message"=>"Thanks for your contribution to our blog, your contribution was reviewed and approved."
]);
?>
<div class="visitors_edits_review_editor">
<h1>Review a contribution</h1><a class="delete_edit" href="<?php echo menu_page_url('visitors_edits_main',false);?>&delete=<?php echo $edit->edit_id;?>">Delete this contribution</a>
<ul class="edit_info">
<li><a target="_blank" href="<?php echo get_permalink($edit->post->ID);?>">View original post</a></li>
<li>Author : <?php echo $edit->visitor_name; ?> <span class="mail"><?php echo $edit->visitor_email; ?></span></li>
<li>Submited on :
<?php
$creationDate=date_create($edit->edit_time);
echo date_format($creationDate,"m/d/Y")." at ".date_format($creationDate,"h:i a");
?>
</li>
<li>Author comment :</li>
<p class="comment">
<?php echo stripcslashes($edit->visitor_comment); ?>
</p>
</ul>
<div class="cb"></div>
<form action="<?php echo menu_page_url('visitors_edits_main',false);?>" method="POST" onsubmit="return editSubmit()">
<div class="editor">
<?php
wp_editor($editor_content,"diff_editor",[
"media_buttons"=>false,
"quicktags"=>false,
"textarea_name"=>"post_content",
"tinymce"=>[
"mode" => "textareas",
"theme" => "modern"
]
]);
?>
</div>
<style>
.diff_editor ins{
background: #44B3FD !important;
}
</style>
<div class="controls">
<input type="hidden" value="<?php echo $edit->visitor_name; ?>" name="visitor_name">
<input type="hidden" value="<?php echo $edit->visitor_email; ?>" name="visitor_email">
<input type="hidden" value="<?php echo $edit->edit_id; ?>" name="edit_id">
<input type="hidden" value="<?php echo $edit->post_id; ?>" name="ID">
<div class="edit_notify">
<label><input type="checkbox" name="notify_visitor" id="edit_notify_activate"> Notify the author.</label>
<textarea name="admin_message" id="edit_notify_message"><?php echo $options["edit_notify_message"]; ?></textarea>
</div>
<button class="button-primary" type="submit">Save changes</button>
</div>
</form>
<script src="<?php echo visitors_edits::scriptUrl('admin');?>"></script>
</div>
<?php
}
function noData($msg){
?>
<h1 class="visitors_edits_no_data" style="display:block">
<?php echo $msg; ?>
</h1>
<?php
}
function clearTag($tag,$content){
return preg_replace("#<".$tag.".*?>.*?</".$tag.">#i","", $content);
}
function addAttrTag($tag,$attr,$content){
return preg_replace("#<".$tag."(.*?)>#i","<".$tag." ".$attr."='1'$1>", $content);
}
function clearTagName($tag,$content){
return preg_replace("#</*".$tag.".*?>#i", "", $content);
}
function replaceTag($origin,$replace,$content){
return preg_replace("#(<(/*)(".$origin.")(.*?)>)#i", '[$2'.$replace.'$4]', $content);
}
function encodeDiff($diff){
//composer require paquettg/php-html-parser
require_once "parser.php";
$html=str_get_html($diff);
$encoded=[
"html"=>"",
"codes"=>[
"INS"=>[],
"DEL"=>[]
]
];
$id=0;
foreach($html->find('ins') as $ins){
$encoded["codes"]["INS"][$id]=$ins->outertext;
$ins->outertext="%INS".$id."%";
$id++;
}
$id=0;
foreach($html->find('del') as $del){
$encoded["codes"]["DEL"][$id]=$del->outertext;
$del->outertext="%DEL".$id."%";
$id++;
}
$encoded["html"]=$html->outertext;
return $encoded;
}
function cleanDiff($content){
require_once "parser.php";
$html=str_get_html($content);
foreach($html->find('ul') as $ul){
foreach($ul->find("br") as $br){
$br->outertext="";
}
}
foreach($html->find('ol') as $ol){
foreach($ol->find("br") as $br){
$br->outertext="";
}
}
return $html;
}
function cleanEncodedDiff($content){
$html=str_get_html($content);
$delete_next=false;
$diffs = $html->find('ins, del');
for ($i=0; $i < count($diffs); $i++) {
$diff=$diffs[$i];
if($delete_next){
$diff->outertext="";
$delete_next=false;
coutinue;
}else{
$isSpecial=preg_match("#%(INS|DEL)\d*?%#", $diff->innertext);
if ($isSpecial){
//is important
if(preg_match("#diffmod#",$diff->outertext)){
$delete_next=true;
}
$diff->outertext=$diff->innertext;
}else{
if($diff->tag==="ins"){
$diff->outertext=$diff->innertext;
}else{
$diff->outertext="";
}
}
}
}
return $html;
}
function decodeDiff($content,$codes){
foreach ($codes["INS"] as $id => $code) {
$content=str_replace("%INS".$id."%", $code, $content);
}
foreach ($codes["DEL"] as $id => $code) {
$content=str_replace("%DEL".$id."%", $code, $content);
}
return $content;
}

+ 152
- 0
inc/editor.php View File

@@ -0,0 +1,152 @@
<?php
$post=null;
if(!empty($_POST)){
global $wpdb;
$wpdb->show_errors();
$table_name = $wpdb->prefix . 'visitors_edits';
$post_id=$_POST["post_id"];
$visitor_name=$_POST["visitor_name"];
$visitor_email=$_POST["visitor_email"];
$visitor_comment=$_POST["visitor_comment"];
$edit_content=$_POST["edit_content"];
$post = get_post($post_id);
//Check if changed
if(md5($post->post_content)!==md5(stripcslashes($edit_content))){
$wpdb->insert($table_name,[
"edit_time"=>date('Y-m-d H:i:s'),
"visitor_name"=>$visitor_name,
"visitor_email"=>$visitor_email,
"visitor_comment"=>$visitor_comment,
"edit_content"=>$edit_content,
"post_id"=>$post_id,
"post_content"=>$post->post_content
]);
require "mail.php";
$options=get_option( "visitors_edits_options", [
"admin_email"=>"",
"notify_admin"=>null,
"visitor_notif_message"=>"Your suggestion was submitted.",
"admin_notif_message"=>"A new suggestion was submitted."
]);
$mail = [
"post_title"=>$post->post_title,
"post_url"=>get_permalink($post_id),
"visitor_name"=>$visitor_name,
"visitor_email"=>$visitor_email,
"edit_time"=>date('H:i')." - ".date('d/m/y'),
"blog_title" => get_bloginfo("name"),
"visitor_notif_message"=>$options["visitor_notif_message"],
"admin_notif_message"=>$options["admin_notif_message"]
];
$visitor_submitionMail=new visitors_edits_EMAIL($mail,"visitor_submition");
$visitor_submitionMail->send($visitor_email);
if($options["notify_admin"]!=null){
$admin_email=$options["admin_email"];
$admin_submitionMail=new visitors_edits_EMAIL($mail,"admin_submition");
$admin_submitionMail->send($admin_email);
}
}
}else{
global $wp;
global $post;
$post = get_posts([
"name"=> $wp->query_vars['visitors_edits_post_name'],
'post_type' => 'post',
'post_status' => 'publish',
'numberposts' => 1
]);
$post=$post[0];
if($post->post_name!=$wp->query_vars['visitors_edits_post_name']){
header("Location:".get_site_url());
}
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w1.org/1998/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="<?php echo plugins_url( '/../css/grid.css',__FILE__ );?>">
<link rel="stylesheet" type="text/css" href="<?php echo plugins_url( '/../css/editor.css',__FILE__ );?>">
<script src="<?php echo visitors_edits::scriptUrl('jquery');?>"></script>
<title>Submit an edit</title>
</head>
<body <?php if(!empty($_POST)){echo 'class="grey"';} ?>>
<?php
if(!empty($_POST)){
confirmSubmit("Edit Submitted!","Thanks for your contribution you will be notified once the edit reviewed.");
}else{
showForm();
}
?>
</body>
</html>
<?php
function showForm(){
global $post;
?>
<div class="header">
<div class="header-title">Submit a contribution</div>
<p class="header-content">
<a href="<?php echo get_permalink($post->ID) ?>">Original post : <?php echo $post->post_title; ?>.</a>
</p>
</div>
<form action="" method="POST" class="editor_form row" id="editor_form" onsubmit="return validateEdit.run()">
<div class="submit_fields col-12 col-l-4">
<ul class="submit_fields_error" id="submit_fields_error">
</ul>
<label for="name">Name</label>
<input class="text_field" type="text" name="visitor_name" placeholder="Name" id="name">
<label for="email">Email</label>
<input class="text_field" type="email" name="visitor_email" placeholder="Email" id="email">
<label for="comment">Description</label>
<textarea class="area_field" type="text" name="visitor_comment" value=" " id="comment">
</textarea>
<input type="hidden" name="post_id" value="<?php echo $post->ID;?>">
<input type="hidden" name="post_url" value="<?php echo get_permalink($post->ID);?>">
<input type="submit" class="btn" value="Submit for review">
</div>
<div class="editor_field col-12 col-l-8">
<?php
wp_editor($post->post_content,"edit_content",[
"media_buttons"=>false,
"quicktags"=>false,
"textarea_name"=>"edit_content",
"tinymce"=>[
"mode" => "textareas",
"theme" => "modern"
]
]);
_WP_Editors::enqueue_scripts();
print_footer_scripts();
_WP_Editors::editor_js();
?>
</div>
<div class="cb"></div>
</form>
<script src="<?php echo visitors_edits::scriptUrl('editor');?>"></script>
<?php
}
function confirmSubmit($title,$message){
?>
<div class="submit_success col-10 col-l-6 col-center">
<strong class="alert_title">
<?php echo $title;?>
</strong>
<p class="alert_content">
<?php echo $message;?>
</p>
<p class="alert_footer">
<a href="<?php echo $_POST['post_url']?>">Click here to continue back to the post</a>
</p>
</div>
</div>
<?php
}
?>

+ 48
- 0
inc/mail.php View File

@@ -0,0 +1,48 @@
<?php
class visitors_edits_EMAIL{
var $subject;
var $body;
public function __construct($cpts,$template){
$template=$this->loadTemplate($template);
$this->subject=$this->inject($template["subject"],$cpts);
$this->body=$this->inject($template["body"],$cpts);
}
public function send($destination){
$options=get_option( "visitors_edits_options", [
"admin_email"=>"",
"notify_admin"=>null
]);
$headers= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
wp_mail($destination, $this->subject, $this->body,$headers);
/*
subject : $this->subject
body : $this->body
*/
}
private function loadTemplate($template){
ob_start();
require("mail_templates/".$template.".html");
$templateHtml=ob_get_clean();
preg_match("|<subject>(.*)</subject>|",$templateHtml,$subject);
$templateHtml=preg_replace("|<subject>.*</subject>|","",$templateHtml);
return [
"subject"=>$subject[1],
"body"=>$templateHtml
];
}
private function inject($str,$body){
foreach ($body as $key => $value) {
$str=str_replace("#$key#",$value,$str);
}
return $str;
}
public function preview(){
echo $this->subject;
echo $this->body;
}
}
?>

+ 89
- 0
inc/mail_templates/admin_submition.html View File

@@ -0,0 +1,89 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<subject>[#blog_title# | Visitors Contributions] - Contribution submited</subject>
<meta http-equiv="content-type" content="text/html, charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<link href='https://fonts.googleapis.com/css?family=Questrial' rel='stylesheet' type='text/css'>
</head>
<body leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0">
<table bgcolor="#0385F4" width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td>
<table align="center" width="600" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;font-size:50px;color:#fff;mso-line-height-rule:exactly;line-height:28px">#blog_title#</td>
</tr>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;font-size:20px;color:#fff;mso-line-height-rule:exactly;line-height:28px">Contribution submited</td>
</tr>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<table bgcolor="#E3E3E3" width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td>
<table align="center" width="600" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;color:#262626;mso-line-height-rule:exactly;line-height:28px">
#admin_notif_message#
</td>
</tr>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;color:#262626;mso-line-height-rule:exactly;line-height:28px">
Submition details
</td>
</tr>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;color:#262626;mso-line-height-rule:exactly;line-height:28px">
<a href="#post_url#" style="color:#262626">#post_title#</a>
</td>
</tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;color:#262626;mso-line-height-rule:exactly;line-height:28px">
Submited on : #edit_time#
</td>
</tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;color:#262626;mso-line-height-rule:exactly;line-height:28px">
Author : #visitor_name# (#visitor_email#)
</td>
</tr>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;color:#262626;mso-line-height-rule:exactly;line-height:28px">
<table align="center" bgcolor="#0385F4" width="100" border="0" cellpadding="0" cellspacing="0">
<tbody><tr><td height="4" style="font-size:4px; line-height:4px">&nbsp;</td></tr></tbody>
</table>
</td>
</tr>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;color:#262626;mso-line-height-rule:exactly;line-height:28px">
Visitors Contributions
</td>
</tr>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</body>
</html>

+ 84
- 0
inc/mail_templates/visitor_approval.html View File

@@ -0,0 +1,84 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<subject>[#blog_title#] - Contribution reviewed</subject>
<meta http-equiv="content-type" content="text/html, charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<link href='https://fonts.googleapis.com/css?family=Questrial' rel='stylesheet' type='text/css'>
</head>
<body leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0">
<table bgcolor="#0385F4" width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td>
<table align="center" width="600" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;font-size:50px;color:#fff;mso-line-height-rule:exactly;line-height:28px">#blog_title#</td>
</tr>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;font-size:20px;color:#fff;mso-line-height-rule:exactly;line-height:28px">Contribution approved</td>
</tr>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<table bgcolor="#E3E3E3" width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td>
<table align="center" width="600" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;color:#262626;mso-line-height-rule:exactly;line-height:28px">
<strong>Dear #visitor_name#</strong>
</td>
</tr>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;color:#262626;mso-line-height-rule:exactly;line-height:28px">
#admin_message#
</td>
</tr>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;color:#262626;mso-line-height-rule:exactly;line-height:28px">
<a href="#post_url#" style="color:#262626">#post_title#</a>
</td>
</tr>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;color:#262626;mso-line-height-rule:exactly;line-height:28px">
<table align="center" bgcolor="#0385F4" width="100" border="0" cellpadding="0" cellspacing="0">
<tbody><tr><td height="4" style="font-size:4px; line-height:4px">&nbsp;</td></tr></tbody>
</table>
</td>
</tr>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;color:#262626;mso-line-height-rule:exactly;line-height:28px">
#blog_title# team
</td>
</tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;color:#262626;mso-line-height-rule:exactly;line-height:28px">
Regards
</td>
</tr>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</body>
</html>

+ 95
- 0
inc/mail_templates/visitor_submition.html View File

@@ -0,0 +1,95 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<subject>[#blog_title#] - Contribution submited</subject>
<meta http-equiv="content-type" content="text/html, charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<link href='https://fonts.googleapis.com/css?family=Questrial' rel='stylesheet' type='text/css'>
</head>
<body leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0">
<table bgcolor="#0385F4" width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td>
<table align="center" width="600" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;font-size:50px;color:#fff;mso-line-height-rule:exactly;line-height:28px">#blog_title#</td>
</tr>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;font-size:20px;color:#fff;mso-line-height-rule:exactly;line-height:28px">Contribution submited</td>
</tr>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<table bgcolor="#E3E3E3" width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td>
<table align="center" width="600" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;color:#262626;mso-line-height-rule:exactly;line-height:28px">
<strong>Dear #visitor_name#</strong>
</td>
</tr>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;color:#262626;mso-line-height-rule:exactly;line-height:28px">
#visitor_notif_message#
</td>
</tr>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;color:#262626;mso-line-height-rule:exactly;line-height:28px">
Submition details
</td>
</tr>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;color:#262626;mso-line-height-rule:exactly;line-height:28px">
<a href="#post_url#" style="color:#262626">#post_title#</a>
</td>
</tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;color:#262626;mso-line-height-rule:exactly;line-height:28px">
Submited on : #edit_time#
</td>
</tr>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;color:#262626;mso-line-height-rule:exactly;line-height:28px">
<table align="center" bgcolor="#0385F4" width="100" border="0" cellpadding="0" cellspacing="0">
<tbody><tr><td height="4" style="font-size:4px; line-height:4px">&nbsp;</td></tr></tbody>
</table>
</td>
</tr>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;color:#262626;mso-line-height-rule:exactly;line-height:28px">
#blog_title# team
</td>
</tr>
<tr>
<td align="center "style="font-family:'Questrial',Helvetica,sans-serif; text-align:center;color:#262626;mso-line-height-rule:exactly;line-height:28px">
Regards
</td>
</tr>
<tr><td height="30" style="font-size:30px; line-height:30px">&nbsp;</td></tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</body>
</html>

+ 86
- 0
inc/main.php View File

@@ -0,0 +1,86 @@
<?php
global $wpdb;
$table_name = $wpdb->prefix . 'visitors_edits';
if(isset($_GET["delete"])){
$wpdb->delete($table_name, array( 'edit_id' => $_GET["delete"] ) );
flashMessage("The review was deleted","danger");
}
if(!empty($_POST)){
wp_update_post([
"ID"=>$_POST["ID"],
"post_content"=>$_POST["post_content"]
]);
$wpdb->delete($table_name, array( 'edit_id' => $_POST["edit_id"] ) );
flashMessage("The post was updated successfully","");
//Notify visitor
if(isset($_POST["notify_visitor"])){
require 'mail.php';
$post = get_post($_POST["ID"]);
$mail = [
"visitor_name"=>$_POST["visitor_name"],
"post_title"=>$post->post_title,
"post_url"=>get_permalink($_POST["ID"]),
"blog_title" => get_bloginfo("name"),
"admin_message"=>$_POST["admin_message"]
];
$visitor_submitionMail=new visitors_edits_EMAIL($mail,"visitor_approval");
$visitor_submitionMail->send($_POST["visitor_email"]);
}
}
$edits = $wpdb->get_results("SELECT * FROM ".$table_name);
for ($r=0; $r <count($edits); $r++) {
$edits[$r]->post=get_post($edits[$r]->post_id);
}
?>
<h1 class="visitors_edits_no_data" <?php if(count($edits)==0){echo 'style="display:block"';}?>>
Emty pending list
</h1>
<div class="visitors_edits_pending" <?php if(count($edits)==0){echo 'style="display:none"';}?>>
<h1>Pending reviews (<?php echo count($edits);?>)</h1>
<table class="widefat pending">
<thead>
<tr>
<th>Post</th>
<th>Author</th>
<th>Author comment</th>
<th>Date</th>
<th>Options</th>
</tr>
</thead>
<tbody>
<?php
for ($i=0; $i < count($edits); $i++) {
$edit=$edits[$i];
?>
<tr>
<td><?php echo $edit->post->post_title; ?></td>
<td><?php echo $edit->visitor_name?></td>
<td>
<?php echo stripslashes($edit->visitor_comment); ?>
</td>
<td><?php
$creationDate=date_create($edit->edit_time);
echo date_format($creationDate,"m/d/Y")." at ".date_format($creationDate,"h:i a")
?></td>
<td>
<a class="button-primary" href="<?php echo menu_page_url('visitors_edits_approve',false);?>&edit=<?php echo $edit->edit_id;?>">Review</a>
<a class="button-secondary" href="<?php echo menu_page_url('visitors_edits_main',false);?>&delete=<?php echo $edit->edit_id;?>">Delete</a>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php
function flashMessage($msg,$type){
?>
<div class="visitors_flashMessage <?php echo $type ?>">
<p>
<?php echo $msg ;?>
</p>
</div>
<?php
}
?>

+ 1742
- 0
inc/parser.php
File diff suppressed because it is too large
View File


+ 71
- 0
inc/settings.php View File

@@ -0,0 +1,71 @@
<?php
$options=[];
if(isset($_POST["save_settings"])){
$options=[
"admin_email"=>$_POST["admin_email"],
"notify_admin"=>$_POST["notify_admin"],
"advanced_merge"=>$_POST["advanced_merge"],
"admin_notif_message"=>$_POST["admin_notif_message"],
"visitor_notif_message"=>$_POST["visitor_notif_message"],
"edit_notify_message"=>$_POST["edit_notify_message"],
"propose_edit_link"=>$_POST["propose_edit_link"]
];
update_option( "visitors_edits_options", $options );
flashMessage("Settings saved.","");
}else{
$options=get_option( "visitors_edits_options", [
"admin_email"=>"",
"notify_admin"=>null,
"advanced_merge"=>null,
"visitor_notif_message"=>"Your suggestion was submitted.",
"admin_notif_message"=>"A new suggestion was submitted.",
"edit_notify_message"=>"Thanks for your contribution to our blog, your contribution was reviewed and approved.",
"propose_edit_link"=>"<p><a href='#post_link#'>Propose an edit</a></p>"
]);
}
?>
<div class="visitors_edits_admin">
<h2>Settings</h2>
<form action="" method="post">
<div class="control">
<label>Propose an edit link</label>
<input type="text" name="propose_edit_link" value="<?php echo stripcslashes($options['propose_edit_link']) ?>">
</div>
<div class="control">
<label>Admin notification message</label>
<textarea name="admin_notif_message" class="notif_message" value=""><?php echo $options['admin_notif_message'] ?></textarea>
</div>
<div class="control">
<label>Visitor notification message (On Submit)</label>
<textarea name="visitor_notif_message" class="notif_message" value=""><?php echo $options['visitor_notif_message'] ?></textarea>
</div>
<div class="control">
<label>Visitor notification message (On Review)</label>
<textarea name="edit_notify_message" class="notif_message" value=""><?php echo $options['edit_notify_message'] ?></textarea>
</div>
<div class="control">
<label>Admin email</label>
<input type="text" placeholder="Email" name="admin_email" value="<?php echo $options['admin_email'] ?>">
</div>
<div class="control">
<label><input type="checkbox" name="notify_admin" <?php echo (($options['notify_admin']==null) ? "" : "checked")?>>Notify me on new submits.</label>
</div>
<div class="control">
<label><input type="checkbox" name="advanced_merge" <?php echo (($options['advanced_merge']==null) ? "" : "checked")?>>Use deep merging.</label>
</div>
<div class="control">
<input type="submit" class="save_btn button-primary" value="Save settings" name="save_settings">
</div>
</form>
</div>
<?php
function flashMessage($msg,$type){
?>
<div class="visitors_flashMessage <?php echo $type ?>">
<p>
<?php echo $msg ;?>
</p>
</div>
<?php
}
?>

+ 8
- 0
js/admin.js View File

@@ -0,0 +1,8 @@
var $notification=document.querySelector("#edit_notify_message");
document.querySelector("#edit_notify_activate").addEventListener("change",function(){
if(this.checked){
$notification.style.display="block";
}else{
$notification.style.display="none";
}
});

+ 121
- 0
js/approve.js View File

@@ -0,0 +1,121 @@
visitors_edits_tools={
data:{},
clearTag:function(content,tag){
var regexp=RegExp("<"+tag+">.*?<\/"+tag+">", "gi");
var editedContent=content.replace(regexp,"");
return editedContent;
},
clearTag:function(content,tag){
var $contentDiv=jQuery("<div/>").html(content);
$contentDiv.find(tag).each(function(){
$tag=jQuery(this);
$tag.remove();
});
return $contentDiv.html();
},
clearTagName:function(content,tag){
var $contentDiv=jQuery("<div/>").html(content);
$contentDiv.find(tag).each(function(){
$tag=jQuery(this);
$tag.replaceWith($tag.html());
});
return $contentDiv.html();
},
clearClassName:function(content,classname){
var $contentDiv=jQuery("<div/>").html(content);
$contentDiv.find("."+classname).each(function(){
$elm=jQuery(this);
$elm.removeClass(classname);
});
return $contentDiv.html();
},
clear:function(ed){
var elt=ed.selection.getNode();
elt.remove();
},
clean:function(ed){
var elt=ed.selection.getNode();
var eltContent=elt.outerHTML;
eltContent=visitors_edits_tools.clearTagName(eltContent,"ins");
eltContent=visitors_edits_tools.clearTagName(eltContent,"del");
elt.remove();
ed.execCommand('mceInsertContent', 0, eltContent);
}
};
(function($){
//Create plugin
tinymce.create('tinymce.plugins.visitors_edits', {
init : function(ed, url) {
//Add buttons
ed.addButton('visitors_edits_approve', {
title : 'Approve',
cmd : 'visitors_edits_approve',
image : url + '/../img/approve.png'
});
ed.addButton('visitors_edits_reject', {
title : 'Reject',
cmd : 'visitors_edits_reject',
image : url + '/../img/reject.png',
});
ed.addButton('visitors_edits_clean', {
title : 'Clean All',
cmd : 'visitors_edits_clean',
image : url + '/../img/clean.png'
});
//Add Commands
ed.addCommand('visitors_edits_approve', function() {
var elt=ed.selection.getNode();
if(elt.tagName.toLowerCase()=="ins"){
visitors_edits_tools.clean(ed);
}
if(elt.tagName.toLowerCase()=="del"){
visitors_edits_tools.clear(ed);
}
});
ed.addCommand('visitors_edits_reject', function() {
var elt=ed.selection.getNode();
if(elt.tagName.toLowerCase()=="del"){
visitors_edits_tools.clean(ed);
}
if(elt.tagName.toLowerCase()=="ins"){
visitors_edits_tools.clear(ed);
}
});
ed.addCommand('visitors_edits_clean',function(){
var content=ed.getContent();
content=visitors_edits_tools.clearTagName(content,"ins");
content=visitors_edits_tools.clearTag(content,"del");
content=visitors_edits_tools.clearClassName(content,"diffmod");
ed.setContent(content);
});
//Load content
setTimeout(function(){
//Procedce diff Html
var diffDiv=document.querySelector("#visitors_edits_diff");
var $diffDiv=jQuery(diffDiv);
$diffDiv.find("ins").each(function(){
var $ins=$(this);
if([""," "].indexOf($ins.html())>-1){
$ins.remove();
}
});
ed.setContent($diffDiv.html());
//Clean content
var $diffDiv=jQuery("<div/>").html(ed.getContent());
$diffDiv.find("p").each(function(){
var $p=$(this);
if(["&nbsp;"].indexOf($p.html())>-1){
$p.remove();
}
});
ed.setContent($diffDiv.html());
},0);
},
});
// Register plugin
tinymce.PluginManager.add( 'visitors_edits', tinymce.plugins.visitors_edits );
})(jQuery);
function editSubmit(){
tinyMCE.activeEditor.execCommand("visitors_edits_clean");
return true;
}

+ 41
- 0
js/editor.js View File

@@ -0,0 +1,41 @@
var validateEdit={
container:jQuery("#submit_fields_error"),
validateRules:{
name:{
required:true,
msg:"Name field required"
},
email:{
required:true,
msg:"Email field required"
},
comment:{
required:true,
msg:"Please describe your edit to speed up the approval"
}
},
run:function(){
var errors=[];
jQuery.each(this.validateRules, function(id, rule) {
var element=jQuery("#"+id);
if(rule.required && element.val()===""){
errors.push(id);
}
});
if(errors.length){
this.container.html("");
for (var i = 0; i < errors.length; i++) {
this.container.append("<li>"+this.validateRules[errors[i]].msg+"</li>")
}
return false;
}else{
return true;
}
},init:function(){
jQuery.each(this.validateRules, function(id, rule) {
var element=jQuery("#"+id);
element.val("");
});
}
}
validateEdit.init();

+ 4
- 0
js/jquery.js
File diff suppressed because it is too large
View File


+ 1532
- 0
js/jquery.validate.js
File diff suppressed because it is too large
View File


+ 7
- 0
vendor/autoload.php View File

@@ -0,0 +1,7 @@
<?php

// autoload.php @generated by Composer

require_once __DIR__ . '/composer' . '/autoload_real.php';

return ComposerAutoloaderInit8a728e750e2d17f1173f31bda205adec::getLoader();

+ 145
- 0
vendor/caxy/php-htmldiff/CHANGELOG.md View File

@@ -0,0 +1,145 @@
# Change Log
## [v0.1.1](https://github.com/caxy/php-htmldiff/tree/v0.1.1) (2016-03-16)
[Full Changelog](https://github.com/caxy/php-htmldiff/compare/0.1.0...v0.1.1)
**Features and Enhancements:**
- Update TableDiff HTMLPurifier Initialization [\#35](https://github.com/caxy/php-htmldiff/pull/35) ([dbergunder](https://github.com/dbergunder))
**Miscellaneous:**
- Update the README and add additional documentation [\#34](https://github.com/caxy/php-htmldiff/pull/34) ([jschroed91](https://github.com/jschroed91))
## [0.1.0](https://github.com/caxy/php-htmldiff/tree/0.1.0) (2016-03-10)
[Full Changelog](https://github.com/caxy/php-htmldiff/compare/0.0.14...0.1.0)
**Features and Enhancements:**
- Allow caching of the calculated diffs using a doctrine cache provider [\#33](https://github.com/caxy/php-htmldiff/pull/33) ([jschroed91](https://github.com/jschroed91))
- Create configuration class for HtmlDiff config options [\#32](https://github.com/caxy/php-htmldiff/pull/32) ([jschroed91](https://github.com/jschroed91))
- New Feature: Table Diffing [\#31](https://github.com/caxy/php-htmldiff/pull/31) ([jschroed91](https://github.com/jschroed91))
- Detect link changes to resolve [\#28](https://github.com/caxy/php-htmldiff/issues/28) [\#30](https://github.com/caxy/php-htmldiff/pull/30) ([jschroed91](https://github.com/jschroed91))
- Setup PHPUnit testsuite with basic functional test and a few test cases [\#26](https://github.com/caxy/php-htmldiff/pull/26) ([jschroed91](https://github.com/jschroed91))
## [0.1.0-beta.1](https://github.com/caxy/php-htmldiff/tree/0.1.0-beta.1) (2016-02-26)
[Full Changelog](https://github.com/caxy/php-htmldiff/compare/0.0.14...0.1.0-beta.1)
**Features and Enhancements:**
- New Feature: Table Diffing [\#31](https://github.com/caxy/php-htmldiff/pull/31) ([jschroed91](https://github.com/jschroed91))
- Detect link changes to resolve [\#28](https://github.com/caxy/php-htmldiff/issues/28) [\#30](https://github.com/caxy/php-htmldiff/pull/30) ([jschroed91](https://github.com/jschroed91))
- Setup PHPUnit testsuite with basic functional test and a few test cases [\#26](https://github.com/caxy/php-htmldiff/pull/26) ([jschroed91](https://github.com/jschroed91))
## [0.0.14](https://github.com/caxy/php-htmldiff/tree/0.0.14) (2016-02-03)
[Full Changelog](https://github.com/caxy/php-htmldiff/compare/0.0.13...0.0.14)
**Fixed bugs:**
- Fix HtmlDiff matching logic skipping over single word matches [\#25](https://github.com/caxy/php-htmldiff/pull/25) ([jschroed91](https://github.com/jschroed91))
## [0.0.13](https://github.com/caxy/php-htmldiff/tree/0.0.13) (2016-01-12)
[Full Changelog](https://github.com/caxy/php-htmldiff/compare/0.0.12...0.0.13)
**Fixed bugs:**
- Misc. list diffing updates and fixes [\#24](https://github.com/caxy/php-htmldiff/pull/24) ([jschroed91](https://github.com/jschroed91))
- Updated list diff class to maintain the tags on lists. [\#23](https://github.com/caxy/php-htmldiff/pull/23) ([adamCaxy](https://github.com/adamCaxy))
## [0.0.12](https://github.com/caxy/php-htmldiff/tree/0.0.12) (2015-11-11)
[Full Changelog](https://github.com/caxy/php-htmldiff/compare/0.0.11...0.0.12)
**Fixed bugs:**
- feature-list\_diffing-new [\#20](https://github.com/caxy/php-htmldiff/pull/20) ([adamCaxy](https://github.com/adamCaxy))
## [0.0.11](https://github.com/caxy/php-htmldiff/tree/0.0.11) (2015-11-06)
[Full Changelog](https://github.com/caxy/php-htmldiff/compare/0.0.10...0.0.11)
**Features and Enhancements:**
- Feature list diffing new [\#19](https://github.com/caxy/php-htmldiff/pull/19) ([adamCaxy](https://github.com/adamCaxy))
## [0.0.10](https://github.com/caxy/php-htmldiff/tree/0.0.10) (2015-10-21)
[Full Changelog](https://github.com/caxy/php-htmldiff/compare/0.0.9...0.0.10)
**Fixed bugs:**
- Fix: Updated code so that null is not given in list formatting. [\#17](https://github.com/caxy/php-htmldiff/pull/17) ([adamCaxy](https://github.com/adamCaxy))
## [0.0.9](https://github.com/caxy/php-htmldiff/tree/0.0.9) (2015-10-20)
[Full Changelog](https://github.com/caxy/php-htmldiff/compare/0.0.8...0.0.9)
**Fixed bugs:**
- Missed an array\_column in ListDiff. Updated to use ArrayColumn function. [\#16](https://github.com/caxy/php-htmldiff/pull/16) ([jschroed91](https://github.com/jschroed91))
## [0.0.8](https://github.com/caxy/php-htmldiff/tree/0.0.8) (2015-10-20)
[Full Changelog](https://github.com/caxy/php-htmldiff/compare/0.0.7...0.0.8)
**Fixed bugs:**
- Added update for php versions that do not have array\_column as a function. [\#15](https://github.com/caxy/php-htmldiff/pull/15) ([jschroed91](https://github.com/jschroed91))
## [0.0.7](https://github.com/caxy/php-htmldiff/tree/0.0.7) (2015-10-20)
[Full Changelog](https://github.com/caxy/php-htmldiff/compare/0.0.6...0.0.7)
**Features and Enhancements:**
- Created ListDiff class to handle diffing of lists. [\#14](https://github.com/caxy/php-htmldiff/pull/14) ([adamCaxy](https://github.com/adamCaxy))
## [0.0.6](https://github.com/caxy/php-htmldiff/tree/0.0.6) (2015-09-11)
[Full Changelog](https://github.com/caxy/php-htmldiff/compare/0.0.5...0.0.6)
**Features and Enhancements:**
- Feature - html tag isolation [\#12](https://github.com/caxy/php-htmldiff/pull/12) ([jschroed91](https://github.com/jschroed91))
- ICC-4313 | ICC-4314 | Replace Special HTML Elements with placeholder tokens and update diffing logic [\#11](https://github.com/caxy/php-htmldiff/pull/11) ([usaqlain01](https://github.com/usaqlain01))
## [0.0.5](https://github.com/caxy/php-htmldiff/tree/0.0.5) (2015-03-03)
[Full Changelog](https://github.com/caxy/php-htmldiff/compare/0.0.4...0.0.5)
**Features and Enhancements:**
- Support derived classes [\#10](https://github.com/caxy/php-htmldiff/pull/10) ([mkalkbrenner](https://github.com/mkalkbrenner))
## [0.0.4](https://github.com/caxy/php-htmldiff/tree/0.0.4) (2015-01-09)
[Full Changelog](https://github.com/caxy/php-htmldiff/compare/0.0.3...0.0.4)
**Fixed bugs:**
- Check for empty oldText or newText before processing del or ins in processReplaceOperation [\#9](https://github.com/caxy/php-htmldiff/pull/9) ([jschroed91](https://github.com/jschroed91))
## [0.0.3](https://github.com/caxy/php-htmldiff/tree/0.0.3) (2015-01-08)
[Full Changelog](https://github.com/caxy/php-htmldiff/compare/0.0.2...0.0.3)
**Features and Enhancements:**
- Add option to insert a space between del and ins tags [\#8](https://github.com/caxy/php-htmldiff/pull/8) ([jschroed91](https://github.com/jschroed91))
- Updated demo to accept input and diff on the fly [\#5](https://github.com/caxy/php-htmldiff/pull/5) ([jschroed91](https://github.com/jschroed91))
## [0.0.2](https://github.com/caxy/php-htmldiff/tree/0.0.2) (2014-08-12)
[Full Changelog](https://github.com/caxy/php-htmldiff/compare/0.0.1...0.0.2)
**Features and Enhancements:**
- Break out HTML content to individual HTML, CSS, JS files [\#6](https://github.com/caxy/php-htmldiff/pull/6) ([mgersten-caxy](https://github.com/mgersten-caxy))
**Fixed bugs:**
- Fix error caused when passing empty array into setSpecialCaseTags [\#7](https://github.com/caxy/php-htmldiff/pull/7) ([jschroed91](https://github.com/jschroed91))
## [0.0.1](https://github.com/caxy/php-htmldiff/tree/0.0.1) (2014-07-31)
**Features and Enhancements:**
- Added static properties for the default config variables [\#4](https://github.com/caxy/php-htmldiff/pull/4) ([jschroed91](https://github.com/jschroed91))
- Feature nonpartial word diffing [\#3](https://github.com/caxy/php-htmldiff/pull/3) ([jschroed91](https://github.com/jschroed91))
- Added option to group together diffed words in output [\#2](https://github.com/caxy/php-htmldiff/pull/2) ([jschroed91](https://github.com/jschroed91))
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*

+ 74
- 0
vendor/caxy/php-htmldiff/CODE_OF_CONDUCT.md View File

@@ -0,0 +1,74 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at dev@caxy.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

+ 33
- 0
vendor/caxy/php-htmldiff/CONTRIBUTING.md View File

@@ -0,0 +1,33 @@
Contributing
============
First of all, **thank you** for contributing, **you are awesome**!
Here are a few rules to follow in order to ease code reviews, and discussions before
maintainers accept and merge your work.
You MUST follow the [PSR-1](http://www.php-fig.org/psr/1/) and
[PSR-2](http://www.php-fig.org/psr/2/). If you don't know about any of them, you
should really read the recommendations. Can't wait? Use the [PHP-CS-Fixer
tool](http://cs.sensiolabs.org/).
You MUST run the test suite.
You MUST write (or update) unit tests.
You SHOULD write documentation.
Please, write [commit messages that make
sense](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html),
and [rebase your branch](http://git-scm.com/book/en/Git-Branching-Rebasing)
before submitting your Pull Request.
One may ask you to [squash your
commits](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html)
too. This is used to "clean" your Pull Request before merging it (we don't want
commits such as `fix tests`, `fix 2`, `fix 3`, etc.).
Also, while creating your Pull Request on GitHub, you MUST write a description
which gives the context and/or explains why you are creating it.
Thank you!

+ 130
- 0
vendor/caxy/php-htmldiff/LICENSE View File

@@ -0,0 +1,130 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies