当前位置: 首页>>代码示例>>PHP>>正文


PHP Posts::PostType方法代码示例

本文整理汇总了PHP中Posts::PostType方法的典型用法代码示例。如果您正苦于以下问题:PHP Posts::PostType方法的具体用法?PHP Posts::PostType怎么用?PHP Posts::PostType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Posts的用法示例。


在下文中一共展示了Posts::PostType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: lang

					<td><?php 
echo lang('POST_TYPE');
?>
</td>
					<td><?php 
echo lang('DATE_CREATED');
?>
</td>
					<td></td>
				</tr>
			</thead>
			<?php 
try {
    $posts = new Posts();
    $posts = $posts->get();
} catch (Exception $e) {
    echo "Error : " . $e->GetMessage();
}
if ($posts) {
    $postIcons = array('message' => 'align-left', 'link' => 'link', 'image' => 'picture', 'video' => 'facetime-video');
    foreach ($posts as $post) {
        echo "<tr>\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t\t<input type='checkbox' class='checkbox checkbox-style' name='' id='' value='' />\r\n\t\t\t\t\t\t\t<label for=''></label>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t<td>" . escape($post->post_title) . "</td>\r\n\t\t\t\t\t\t<td><h4><span class='label label-default'><span class='glyphicon glyphicon-" . $postIcons[Posts::PostType($post->content)] . "'> " . ucfirst(Posts::PostType($post->content)) . "</span></span></h4></td>\r\n\t\t\t\t\t\t<td>" . $post->date_created . "</td>\r\n\t\t\t\t\t\t<td>\r\n\t\t\t\t\t\t<a href='posts.php?action=delete&id=" . $post->id . "' title='" . lang('DELETE') . "' class='btn btn-danger delete' id='" . $post->id . "' onclick='return confirm(\"" . lang('POST_DELETE_CONFIRM') . "\");'><span class='glyphicon glyphicon-trash'></span> " . lang('DELETE') . "</a>\r\n\t\t\t\t\t\t<a href='index.php?post_id=" . $post->id . "' title='" . lang('POST') . "' class='btn btn-primary' id='" . $post->id . "'><span class='glyphicon glyphicon-pencil'></span> " . lang('POST') . "</a>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t</tr>";
    }
}
?>
		</table>
	</div>
</div>
			
<?php 
$template->footer();
开发者ID:andersoonluan,项目名称:PHP,代码行数:31,代码来源:posts.php

示例2: escape

        // Set Post type
        if (Posts::PostType($getPost->content) == "link") {
            $_POST['postType'] = "link";
            $_POST['link'] = escape($post->link);
            $_POST['picture'] = escape($post->picture);
            $_POST['name'] = escape($post->name);
            $_POST['caption'] = escape($post->caption);
            $_POST['description'] = escape($post->description);
        }
        // Set Post type
        if (Posts::PostType($getPost->content) == "image") {
            $_POST['postType'] = "image";
            $_POST['image'] = escape($post->image);
        }
        // Set Post type
        if (Posts::PostType($getPost->content) == "video") {
            $_POST['postType'] = "video";
            $_POST['video'] = escape($post->video);
            $_POST['description'] = isset($post->description) ? escape($post->description) : "";
        }
    }
} else {
    $_POST['postType'] = "message";
}
$template->header("Home");
if (Session::exists('home')) {
    foreach (Session::Flash('home') as $error) {
        echo "<div class='alert alert-" . $error['type'] . "' role='alert'>";
        echo "<a href='#' class='close' data-dismiss='alert' aria-label='close'>&times;</a>";
        echo "<span class='glyphicon glyphicon-exclamation-sign' aria-hidden='true'></span>";
        echo "&nbsp;" . $error['message'];
开发者ID:andersoonluan,项目名称:PHP,代码行数:31,代码来源:index.php

示例3: DateTime

 // Check if the post date <= current datetime of the user
 // Get current time
 $currentDateTime = new DateTime();
 $next_post_time = new DateTime($scheduled->next_post_time);
 if (strtotime($currentDateTime->format("Y-m-d H:i")) >= strtotime($next_post_time->format("Y-m-d H:i"))) {
     // get the post
     $post = $posts->GetPost($scheduled->post_id);
     // Post is ready
     if (count($post) == 0) {
         logs::Save($scheduled->id, lang('POST_NOT_FOUND'));
     } else {
         // Send the post
         $params = array();
         // Post param
         $postParam = json_decode($post->content);
         $postType = Posts::PostType($post->content);
         // Get list of groups
         $groups = json_decode($scheduled->targets, true);
         // Check if the current target is the last one
         if ($scheduled->next_target + 1 >= count($groups)) {
             // This was the last target
             DB::GetInstance()->update("scheduledposts", "id", $scheduled->id, array("status" => "1"));
         } else {
             // Update the scheduled
             $currentDateTime->modify("+" . $scheduled->post_interval . " minutes");
             // Set the next target
             DB::GetInstance()->update("scheduledposts", "id", $scheduled->id, array("next_target" => $scheduled->next_target + 1, "next_post_time" => $currentDateTime->format('Y-m-d H:i')));
         }
         $message = $spintax->get($postParam->message);
         // If is unique post enabled
         if (isset($user->Options()->uniquePost)) {
开发者ID:andersoonluan,项目名称:PHP,代码行数:31,代码来源:scheduledposts.php


注:本文中的Posts::PostType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。