bludit/bl-kernel/ajax/generate-slug.php

27 lines
829 B
PHP
Raw Normal View History

2015-05-05 03:00:01 +02:00
<?php defined('BLUDIT') or die('Bludit CMS.');
header('Content-Type: application/json');
2019-05-27 19:41:46 +02:00
/*
| Generate an slug text for the URL
|
| @_POST['text'] string The text from where is generated the slug
| @_POST['parentKey'] string The parent key if the page has one
| @_POST['currentKey'] string The current page key
|
| @return array
*/
// $_POST
// ----------------------------------------------------------------------------
2015-05-05 03:00:01 +02:00
$text = isset($_POST['text']) ? $_POST['text'] : '';
$parent = isset($_POST['parentKey']) ? $_POST['parentKey'] : '';
2017-07-13 22:39:04 +02:00
$oldKey = isset($_POST['currentKey']) ? $_POST['currentKey'] : '';
2019-05-27 19:41:46 +02:00
// ----------------------------------------------------------------------------
2015-05-05 03:00:01 +02:00
2018-08-03 18:59:23 +02:00
$slug = $pages->generateKey($text, $parent, $returnSlug=true, $oldKey);
2015-05-05 03:00:01 +02:00
2019-01-31 20:07:59 +01:00
ajaxResponse(0, 'Slug generated.', array(
2017-10-06 18:28:06 +02:00
'slug'=>$slug
2019-01-31 20:07:59 +01:00
));
2015-05-05 03:00:01 +02:00
2016-01-21 02:46:13 +01:00
?>