mirror of
https://github.com/e107inc/e107.git
synced 2025-08-23 06:33:22 +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']);
|
||||
|
||||
$this->checkSEFSimilarity($new_data);
|
||||
|
||||
|
||||
$tmp = explode(chr(35), $new_data['news_author']);
|
||||
$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']);
|
||||
}
|
||||
|
||||
|
||||
$this->checkSEFSimilarity($new_data);
|
||||
|
||||
if(!empty($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)
|
||||
{
|
||||
|
||||
|
Reference in New Issue
Block a user