本文整理汇总了PHP中comments::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP comments::delete方法的具体用法?PHP comments::delete怎么用?PHP comments::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类comments
的用法示例。
在下文中一共展示了comments::delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* Метод удаления комментария
* @param int $id ID комментария
* @return null
* @throws EngineException
*/
protected function delete($id)
{
check_formkey();
$id = (int) $id;
lang::o()->get('comments');
if (!$id) {
throw new EngineException();
}
$this->comments->delete($id);
}
示例2: clearDuplicates
/**
* Clear duplicate comments
*
* There are times that the system may end up with duplicate comments, like when
* copying content. This function is used to effectively eliminate duplicates.
* <br/>Example:
* <code>
* comments :: clearDuplicates($currentLesson);
* </code>
*
* @param mixed $lesson a lesson id or an EfrontLesson object
* @access public
* @static
* @since 3.6.0
*/
public static function clearDuplicates($lesson)
{
if ($lesson instanceof EfrontLesson) {
$lessonId = $lesson->lesson['id'];
} elseif (eF_checkParameter($lesson, 'id')) {
$lessonId = $lesson;
} else {
throw new EfrontLessonException(_INVALIDID . ": {$lesson}", EfrontLessonException::INVALID_ID);
}
$result = eF_getTableData("comments", "*", "lessons_ID=" . $lessonId, "id");
foreach ($result as $value) {
$commentsTerms[$value['id']] = $value;
$id = $value['id'];
unset($value['id']);
$checksums[$id] = md5(serialize($value));
}
$uniques = array_unique($checksums);
$duplicates = array_diff_key($checksums, $uniques);
foreach ($duplicates as $key => $value) {
$comments = new comments($commentsTerms[$key]);
$comments->delete();
}
}
示例3: json_encode
<?php
// +----------------------------------------------------------------------
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
define('USING_LANGUAGE', false);
require_once '../../../config.php';
require_once $config['root_path'] . '/core/functions.php';
include_once $config['system_core'] . "/initEngine.php";
admin_login();
if (isset($_POST['delete']) && isset($_POST['id']) && isset($_SESSION['user']['access']['items'])) {
require_once ROOT_PATH . "/apps/items/models/items.class.php";
$cms = new items();
$cms->delete(intval($_POST['id']));
die(json_encode(array_merge($_POST, array('status' => 'true'))));
} elseif (isset($_POST['deleteComment']) && isset($_POST['id']) && isset($_SESSION['user']['access']['items'])) {
require_once ROOT_PATH . "/apps/items/models/comments.class.php";
$cms = new comments();
$cms->delete(intval($_POST['id']));
die(json_encode(array_merge($_POST, array('status' => 'true'))));
}
echo json_encode(array_merge($_POST, array('status' => 'unknown error')));
die;