Initial code import based on Amine's email 6/28/2016
commit
8a81066ae0
@ -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;
|
||||
}
|
||||
?>
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
@ -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%;
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
ins{
|
||||
background: transparent !important;
|
||||
color: inherit !important;
|
||||
}
|
||||
.diffins{
|
||||
background:#4DB1FB !important;
|
||||
}
|
||||
.diffmod{
|
||||
background:#4DFB74 !important;
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 261 B |
Binary file not shown.
After Width: | Height: | Size: 629 B |
Binary file not shown.
After Width: | Height: | Size: 546 B |
Binary file not shown.
After Width: | Height: | Size: 484 B |
Binary file not shown.
After Width: | Height: | Size: 336 B |
@ -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;
|
||||
}
|
@ -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
|
||||
}
|
||||
?>
|
@ -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;
|
||||
}
|
||||
}
|
||||
?>
|
@ -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"> </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"> </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"> </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"> </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"> </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"> </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"> </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"> </td></tr></tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td height="30" style="font-size:30px; line-height:30px"> </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"> </td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
@ -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"> </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"> </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"> </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"> </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"> </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"> </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"> </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"> </td></tr></tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td height="30" style="font-size:30px; line-height:30px"> </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"> </td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
@ -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"> </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"> </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"> </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"> </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"> </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"> </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"> </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"> </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"> </td></tr></tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td height="30" style="font-size:30px; line-height:30px"> </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"> </td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
@ -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>
|
||||