本文整理汇总了PHP中core::generateSlug方法的典型用法代码示例。如果您正苦于以下问题:PHP core::generateSlug方法的具体用法?PHP core::generateSlug怎么用?PHP core::generateSlug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core
的用法示例。
在下文中一共展示了core::generateSlug方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: commentsCount
function commentsCount()
{
if (!isset($_POST) || !$_POST) {
return;
}
$result = array();
foreach ($_POST as $v) {
$v = trim(core::generateSlug($v));
$res = $this->db->query("SELECT COUNT(*) FROM `comments` as co,`content` as c WHERE co.`contentID`=c.`contentID` \n\t\t\t\tAND c.`slug`='?'", $v);
$tmp = $res->fetch();
$result[$v] = array_shift($tmp);
}
if (!$result) {
return;
}
echo json_encode($result);
}
示例2: addPageAjax
function addPageAjax()
{
system::setParam("page", "ajax");
if ($_POST) {
$fill = array();
$slug = "";
$fill = $_POST;
if (!empty($_POST["slug"])) {
$slug = core::generateSlug($_POST["slug"]);
} else {
if (!empty($_POST["title"])) {
$slug = core::generateSlug($_POST["title"]);
}
}
$fill["slug"] = $slug;
$savedPost = video::writePost($fill);
// $this->smarty->assign ("fill", $fill);
return true;
}
}
示例3: addPage
function addPage()
{
system::setParam("page", "addPage");
article::getAllCats();
$fill = array();
$doRedirect = false;
if (!empty($_POST["slug"])) {
$fill["slug"] = core::generateSlug($_POST["slug"]);
} else {
if (!empty($_POST["title"])) {
$fill["slug"] = core::generateSlug($_POST["title"]);
}
}
$fill += $_POST;
if (isset($_POST["picRealUpload"])) {
$uploadedPics = blog::uploadOnePicture($fill["slug"]);
}
$fill["poster"] = "";
if (isset($_FILES["poster"]) && $_FILES["poster"]["error"] == 0) {
$uploadedPics = blog::uploadOnePicture($fill["slug"], "articleImages");
if (isset($uploadedPics["poster"]) && $uploadedPics["poster"]) {
$fill["poster"] = serialize($uploadedPics["poster"]);
}
}
if (isset($_POST["savePost"])) {
$savedPost = blog::writePost($fill, "article");
if ($savedPost) {
$doRedirect = true;
}
}
blog::showAttachedPics($fill);
$this->smarty->assign("fill", $fill);
if ($doRedirect) {
system::redirect(system::param("urlBase") . "listPage");
}
}
示例4: editPost
private function editPost()
{
$id = intval($_GET["contentID"]);
if (!$id) {
return false;
}
$doRedirect = false;
$fill = $_POST;
if (isset($_POST["slug"]) && $_POST["slug"]) {
$fill["slug"] = core::generateSlug($_POST["slug"]);
}
if (isset($_POST["uploadPicture"])) {
$uploadedPics = blog::uploadOnePicture($fill["slug"]);
}
$fill["poster"] = "";
if (isset($_FILES["poster"]) && $_FILES["poster"]["error"] == 0) {
$uploadedPics = blog::uploadOnePicture($fill["slug"], "posterImages");
if (isset($uploadedPics["poster"]) && $uploadedPics["poster"]) {
$fill["poster"] = serialize($uploadedPics["poster"]);
}
}
if (isset($_POST["savePost"])) {
if (blog::updatePost($id, $fill)) {
$doRedirect = true;
}
}
blog::getAllCats($id);
system::setParam("page", "editPost");
$sqlData = blog::buildForm("content", array("AND `contentID`={$id}"));
blog::showAttachedPics($sqlData);
$this->smarty->assign("annotationRestriction", system::param("annotationRestriction"));
if ($doRedirect) {
system::redirect("/adm/blog/posts");
}
}
示例5: add
private function add($fill, $doRedirect = false)
{
$fill['picture'] = photo::UploadImage($_FILES);
if (isset($_POST['x1']) && isset($_POST['y1']) && isset($_POST['w1']) && isset($_POST['h1'])) {
$data = array('x1' => $_POST['x1'], 'y1' => $_POST['y1'], 'w1' => $_POST['w1'], 'h1' => $_POST['h1']);
unset($_POST['x1'], $_POST['y1'], $_POST['w1'], $_POST['h1']);
photo::imageCrop($_POST['picture'], $data, '200x200');
}
if (isset($_POST['x2']) && isset($_POST['y2']) && isset($_POST['w2']) && isset($_POST['h2'])) {
$data = array('x1' => $_POST['x2'], 'y1' => $_POST['y2'], 'w1' => $_POST['w2'], 'h1' => $_POST['h2']);
unset($_POST['x2'], $_POST['y2'], $_POST['w2'], $_POST['h2']);
photo::imageCrop($_POST['picture'], $data, '200x140');
}
if (isset($_POST['width'])) {
unset($_POST['width']);
}
if (isset($_POST['height'])) {
unset($_POST['height']);
}
if (empty($fill["title"])) {
$fill["title"] = time();
}
$fill['type'] = 'news';
// echo '<pre>'.print_r($fill,1).'</pre>'; exit;
if (!empty($fill["slug"])) {
$slug = core::generateSlug($fill["slug"]);
} else {
if (!empty($fill["title"])) {
$slug = core::generateSlug($fill["title"]);
}
}
$fill["slug"] = $slug;
$savedPost = photo::writePost($fill);
$size = getimagesize(CONTENT_PATH . '/photo/resized/' . $fill['picture']);
$fill['width'] = $size[0];
$fill['height'] = $size[1];
return $savedPost;
}
示例6: addCat
public static function addCat($data, $type = "news")
{
if (!isset($data["catSlug"]) || !$data["catSlug"]) {
$data["catSlug"] = core::generateSlug($data["catName"]);
}
return self::$db->query("INSERT INTO `categories` SET `catName`='?', `catSlug`='?', `catType`='{$type}'", $data["catName"], $data["catSlug"]);
}