Exemplo n.º 1
0
function echo_comment($array)
{
    foreach ($array as $item) {
        echo \Yii::$app->view->renderFile('@app/components/views/comments/comment.php', ['item' => $item['object'], 'tree_deep' => $item['deep']]);
        if ($item['childs']) {
            echo_comment($item['childs']);
        }
    }
}
Exemplo n.º 2
0
// the contents of each file in the group.
//
// Usage:
// 	php cat.php [build-key]
//	php cat.php js-lib|js-app|css-app
$root = dirname(dirname(__FILE__));
$build = (require $root . DIRECTORY_SEPARATOR . 'build' . DIRECTORY_SEPARATOR . 'build.php');
$key = $argv[1];
if (isset($build[$key])) {
    list($asset_type, $asset_group) = explode('-', $key, 2);
} else {
    die("Invalid build key: {$key}");
}
echo_comment("### build: {$key} ###");
foreach ($build[$key] as $file_name) {
    echo_comment("### file ### {$file_name}");
    $file_path = $root . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'webroot' . DIRECTORY_SEPARATOR . $asset_type . DIRECTORY_SEPARATOR . $file_name;
    if (readfile($file_path) === FALSE) {
        die("*** BUILD ERROR: file [{$file_name}] ***");
    }
}
function echo_comment($str = '')
{
    global $asset_type;
    if ($asset_type === 'css') {
        echo "\n/* {$str} */\n";
    } else {
        if ($asset_type === 'js') {
            echo "\n// {$str}\n";
        } else {
            die("Unknown asset type for printing comment");
Exemplo n.º 3
0
/**
 * @var CommentList
 */
global $CommentList;
global $current_User;
global $dispatcher;
// If rediret_to was not set, create new redirect
$redirect_to = param('redirect_to', 'url', regenerate_url('', 'filter=restore', '', '&'));
$redirect_to = rawurlencode($redirect_to);
$save_context = param('save_context', 'boolean', 'true');
$show_comments = param('show_comments', 'string', 'all');
$item_id = param('item_id', 'integer', 0);
$currentpage = param('currentpage', 'integer', 0);
$comments_number = param('comments_number', 'integer', 0);
if ($item_id != 0 && $comments_number > 0) {
    echo_pages($item_id, $currentpage, $comments_number);
}
while ($Comment =& $CommentList->get_next()) {
    // Loop through comments:
    if ($show_comments == 'draft' && $Comment->get('status') != 'draft') {
        // if show only draft comments, and current comment status isn't draft, then continue with the next comment
        continue;
    }
    echo '<div id="comment_' . $Comment->ID . '">';
    echo_comment($Comment->ID, $redirect_to, $save_context);
    echo '</div>';
}
//end of the loop, don't delete
if ($item_id != 0 && $comments_number > 0) {
    echo_pages($item_id, $currentpage, $comments_number);
}
Exemplo n.º 4
0
$save_context = param('save_context', 'boolean', 'true');
$show_comments = param('show_comments', 'string', 'all');
$item_id = param('item_id', 'integer', 0);
if (empty($item_id)) {
    // Try to get an item ID from param "p" that is used on edit post page
    $item_id = param('p', 'integer', 0);
}
$currentpage = param('currentpage', 'integer', 0);
$comments_number = param('comments_number', 'integer', 0);
if ($item_id != 0 && $comments_number > 0) {
    // Display a pagination:
    $comment_params = array_merge($AdminUI->get_template('pagination'), array('page_size' => $CommentList->limit));
    echo_comment_pages($item_id, $currentpage, $comments_number, $comment_params);
}
// Calculate index of first comment:
$comment_index = $comments_number - $CommentList->limit * ($currentpage - 1);
while ($Comment =& $CommentList->get_next()) {
    // Loop through comments:
    if ($show_comments == 'draft' && $Comment->get('status') != 'draft') {
        // if show only draft comments, and current comment status isn't draft, then continue with the next comment
        continue;
    }
    echo_comment($Comment->ID, $redirect_to, $save_context, $comment_index);
    $comment_index--;
}
//end of the loop, don't delete
if ($item_id != 0 && $comments_number > 0) {
    // Display a pagination:
    $comment_params = array_merge($AdminUI->get_template('pagination'), array('page_size' => $CommentList->limit));
    echo_comment_pages($item_id, $currentpage, $comments_number, $comment_params);
}