Compare commits

..

No commits in common. "c2a7360a3dca29724a2439811bb419e9d1479662" and "b765c8a93d21de32fc11b0b502df6a37e1f88820" have entirely different histories.

6 changed files with 16 additions and 10 deletions

@ -55,7 +55,7 @@ class visitors_edits{
]); ]);
global $post; global $post;
$new_content = str_replace("#post_link#", get_site_url().'/'.$post->post_name.'/suggestions', stripcslashes($options["propose_edit_link"])); $new_content = str_replace("#post_link#", get_site_url().'/'.$post->post_name.'/suggestions', stripcslashes($options["propose_edit_link"]));
$content .= $new_content; $content .= $new_content;
} }
return $content; return $content;
} }
@ -83,7 +83,6 @@ class visitors_edits{
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
dbDelta( $sql ); dbDelta( $sql );
flush_rewrite_rules(true);
} }
public function query_vars($query_vars){ public function query_vars($query_vars){
$query_vars[] = 'visitors_edits_post_name'; $query_vars[] = 'visitors_edits_post_name';
@ -95,6 +94,7 @@ class visitors_edits{
'index.php?visitors_edits_post_name=$matches[1]', 'index.php?visitors_edits_post_name=$matches[1]',
'top' 'top'
); );
flush_rewrite_rules(true);
} }
public function parse_request($request){ public function parse_request($request){
if( isset( $request->query_vars['visitors_edits_post_name'] ) ): if( isset( $request->query_vars['visitors_edits_post_name'] ) ):
@ -126,10 +126,10 @@ function visitors_editsDIFF($oldHtml,$newHtml){
require "vendor/autoload.php"; require "vendor/autoload.php";
$htmlDiff = new HtmlDiff($oldHtml, $newHtml); $htmlDiff = new HtmlDiff($oldHtml, $newHtml);
$htmlDiff->getConfig()->setGroupDiffs(false); $htmlDiff->getConfig()->setGroupDiffs(false);
return $htmlDiff->build(); return $htmlDiff->build();
} }
function visitors_editsDOM(){ function visitors_editsDOM(){
return new Dom; return new Dom;
} }
?> ?>

@ -14,8 +14,14 @@ class visitors_edits_EMAIL{
"notify_admin"=>null "notify_admin"=>null
]); ]);
$headers = "Content-Type: text/html; charset=UTF-8\r\n"; $headers= "MIME-Version: 1.0\r\n";
wp_mail($destination, $this->subject, $this->body, $headers); $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){ private function loadTemplate($template){
ob_start(); ob_start();

@ -1,4 +1,4 @@
<?php <?php
$options=[]; $options=[];
if(isset($_POST["save_settings"])){ if(isset($_POST["save_settings"])){
$options=[ $options=[
@ -8,7 +8,7 @@
"admin_notif_message"=>$_POST["admin_notif_message"], "admin_notif_message"=>$_POST["admin_notif_message"],
"visitor_notif_message"=>$_POST["visitor_notif_message"], "visitor_notif_message"=>$_POST["visitor_notif_message"],
"edit_notify_message"=>$_POST["edit_notify_message"], "edit_notify_message"=>$_POST["edit_notify_message"],
"propose_edit_link"=>html_entity_decode($_POST["propose_edit_link"]) "propose_edit_link"=>$_POST["propose_edit_link"]
]; ];
update_option( "visitors_edits_options", $options ); update_option( "visitors_edits_options", $options );
flashMessage("Settings saved.",""); flashMessage("Settings saved.","");
@ -29,7 +29,7 @@
<form action="" method="post"> <form action="" method="post">
<div class="control"> <div class="control">
<label>Propose an edit link</label> <label>Propose an edit link</label>
<input type="text" name="propose_edit_link" value="<?php echo htmlentities(stripcslashes($options['propose_edit_link'])) ?>"> <input type="text" name="propose_edit_link" value="<?php echo stripcslashes($options['propose_edit_link']) ?>">
</div> </div>
<div class="control"> <div class="control">
<label>Admin notification message</label> <label>Admin notification message</label>
@ -68,4 +68,4 @@ function flashMessage($msg,$type){
</div> </div>
<?php <?php
} }
?> ?>