mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 20:57:26 +02:00
SEF UURL Warning added to NewsPost
This commit is contained in:
@@ -509,6 +509,9 @@ class news_admin_ui extends e_admin_ui
|
|||||||
|
|
||||||
$new_data['news_sef'] = empty($new_data['news_sef']) ? eHelper::title2sef($new_data['news_title']) : eHelper::secureSef($new_data['news_sef']);
|
$new_data['news_sef'] = empty($new_data['news_sef']) ? eHelper::title2sef($new_data['news_title']) : eHelper::secureSef($new_data['news_sef']);
|
||||||
|
|
||||||
|
$this->checkSEFSimilarity($new_data);
|
||||||
|
|
||||||
|
|
||||||
$tmp = explode(chr(35), $new_data['news_author']);
|
$tmp = explode(chr(35), $new_data['news_author']);
|
||||||
$new_data['news_author'] = intval($tmp[0]);
|
$new_data['news_author'] = intval($tmp[0]);
|
||||||
|
|
||||||
@@ -566,6 +569,9 @@ class news_admin_ui extends e_admin_ui
|
|||||||
$new_data['news_sef'] = eHelper::title2sef($new_data['news_title']);
|
$new_data['news_sef'] = eHelper::title2sef($new_data['news_title']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$this->checkSEFSimilarity($new_data);
|
||||||
|
|
||||||
if(!empty($new_data['news_author']))
|
if(!empty($new_data['news_author']))
|
||||||
{
|
{
|
||||||
$tmp = explode(chr(35), $new_data['news_author']);
|
$tmp = explode(chr(35), $new_data['news_author']);
|
||||||
@@ -581,6 +587,24 @@ class news_admin_ui extends e_admin_ui
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a warning if there is a mismatch with the SEF Url.
|
||||||
|
* @param $new_data
|
||||||
|
*/
|
||||||
|
private function checkSEFSimilarity($new_data)
|
||||||
|
{
|
||||||
|
$expectedSEF = eHelper::title2sef($new_data['news_title']);
|
||||||
|
similar_text($expectedSEF,$new_data['news_sef'],$percSimilar);
|
||||||
|
|
||||||
|
if($percSimilar < 60)
|
||||||
|
{
|
||||||
|
e107::getMessage()->addWarning(LAN_NEWS_108); // The SEF URL is unlike the title of your news item.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function afterCreate($new_data, $old_data, $id)
|
public function afterCreate($new_data, $old_data, $id)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@@ -232,4 +232,7 @@ define("LAN_NEWS_105", "Email notification triggered!");
|
|||||||
define("LAN_NEWS_106", "News item visibility must include 'everyone' for email notifications to work.");
|
define("LAN_NEWS_106", "News item visibility must include 'everyone' for email notifications to work.");
|
||||||
define("LAN_NEWS_107", "Checking for Ping Status");
|
define("LAN_NEWS_107", "Checking for Ping Status");
|
||||||
|
|
||||||
?>
|
//v2.1.4
|
||||||
|
define("LAN_NEWS_108", "The SEF URL is unlike the title of your news item.");
|
||||||
|
|
||||||
|
?>
|
Reference in New Issue
Block a user