本文整理汇总了PHP中post::create_post方法的典型用法代码示例。如果您正苦于以下问题:PHP post::create_post方法的具体用法?PHP post::create_post怎么用?PHP post::create_post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类post
的用法示例。
在下文中一共展示了post::create_post方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate_post_form
public static function validate_post_form($post_id, $post_title, $post_title, $post_content, $post_image, $post_date, $post_cat_id, $post_user_id, $post_venue, $post_time_stamp, $post_address_1, $post_address_2, $post_state, $post_city, $post_zip)
{
$create_post_ok = 'N';
if (isset($_POST['submit'])) {
if (empty($post_title)) {
echo 'post Name field must not be empty, please enter a name for your post';
} else {
$create_post_ok = 'Y';
}
if (empty($post_date)) {
echo 'Please set a date for your post';
} else {
$create_post_ok = 'Y';
}
if (empty($post_venue)) {
echo 'Please enter a venue for your post';
} else {
$create_post_ok = 'Y';
}
if ($create_post_ok == 'Y') {
$post = new post();
$post->create_post($post_id, $post_title, $post_title, $post_content, $post_image, $post_date, $post_cat_id, $post_user_id, $post_venue, $post_time_stamp, $post_address_1, $post_address_2, $post_state, $post_city, $post_zip);
}
} else {
echo 'Enter post info';
}
}
示例2: catch
} catch (Exception $e) {
//put error message to the client
}
break;
case 'registration':
try {
$register = new registration($_POST['name'], $_POST['email'], $_POST['last_name'], $_POST['first_name'], $_POST['password']);
header("Location: index.php?p=login");
} catch (Exception $e) {
//put error message to the client
}
break;
case 'post':
if (!$_POST["post_id"]) {
$post = new post();
$post_id = $post->create_post($_POST["title"], $_POST["date"], htmlentities($_POST["content_code"]), $_POST["category"], $_POST["status"], $_POST["tag_list"], $_COOKIE['ea_user']);
header('Location: index.php?p=edit_post&id=' . $post_id);
} else {
$post = new post();
post::update_post($_POST["title"], $_POST["date"], htmlentities($_POST["content_code"]), $_POST["category"], $_POST["status"], $_POST["tag_list"], $_POST["post_id"]);
//itt lehet majd bővíteni, kész a többi opció
header('Location: index.php?p=edit_post&id=' . $_POST["post_id"]);
}
break;
case 'category':
if (!isset($_POST['cat_name'])) {
category::update_category_list($_POST);
header('Location: index.php?p=category');
} else {
$category = new category();
$category->create_category($_POST['cat_name']);