Example #1
0
function mt_getCategoryList()
{
    $params = func_get_args();
    $result = api_login($params[1], $params[2]);
    if ($result) {
        return $result;
    }
    $category = new Category();
    $category->open(false);
    $cat = array();
    while (1) {
        array_push($cat, array('categoryName' => $category->label, 'categoryId' => $category->id, 'isPrimary' => true));
        if (!$category->shift()) {
            break;
        }
    }
    $category->close();
    return $cat;
}
Example #2
0
                do {
                    $childCategory->escape();
                    $writer->write('<category>' . '<name>' . $childCategory->name . '</name>' . '<priority>' . $childCategory->priority . '</priority>' . '</category>');
                } while ($childCategory->shift());
                $childCategory->close();
            }
            $writer->write('</category>');
            $writer->write(CRLF);
        } else {
            $category->escape();
            $writer->write('<category>' . '<name>' . $category->name . '</name>' . '<priority>' . $category->priority . '</priority>');
            $writer->write('<root>1</root>');
            $writer->write('</category>');
            $writer->write(CRLF);
        }
    } while ($category->shift());
    $category->close();
}
$post = new Post();
if ($post->open('', '*', 'published, id')) {
    do {
        $writer->write('<post slogan="' . htmlspecialchars($post->slogan) . '"' . $newlineStyle . '>' . '<id>' . $post->id . '</id>');
        if ($post->visibility == 'appointed') {
            // for backward compatibility
            $writer->write('<appointed>true</appointed>');
            $writer->write('<visibility>private</visibility>');
        } else {
            $writer->write('<appointed>false</appointed>');
            $writer->write('<visibility>' . $post->visibility . '</visibility>');
        }
        $writer->write('<starred>' . $post->starred . '</starred>' . '<title>' . htmlspecialchars($post->title) . '</title>' . '<content formatter="' . htmlspecialchars($post->contentformatter) . '" editor="' . htmlspecialchars($post->contenteditor) . '">' . htmlspecialchars(Utils_Unicode::correct($post->content)) . '</content>' . '<location>' . htmlspecialchars($post->location) . '</location>' . (!is_null($post->password) ? '<password>' . htmlspecialchars($post->password) . '</password>' : '') . '<acceptComment>' . $post->acceptcomment . '</acceptComment>' . '<acceptTrackback>' . $post->accepttrackback . '</acceptTrackback>' . '<published>' . $post->published . '</published>' . '<created>' . $post->created . '</created>' . '<modified>' . $post->modified . '</modified>' . '<longitude>' . $post->longitude . '</longitude>' . '<latitude>' . $post->latitude . '</latitude>');