JSON::parse(100, 'negative', '<i class="fa fa-exclamation-triangle"></i> Access denied: you\'re not logged in.', null, true);
        break;
        # No post data
    # No post data
    case !is_form_data():
        JSON::parse(100, 'negative', '<i class="fa fa-exclamation-triangle"></i> There was a problem saving your changes. (Error: No data received)', null, true);
        break;
}
# Saved Posts
$saved = 0;
# Unsaved
$unsaved = 0;
# New GUMP Object
$form = new GUMP();
# Get Input
$data = form_data();
# Run GUMP
$response = $form->run($data);
# Get Response
if ($response === false) {
    JSON::parse(100, 'negative', $form->get_readable_errors(true));
} else {
    # Loop through each of the submitted fields and
    # if a an html file exists, then we will update
    # the file with the newly uploaded content.
    foreach ($data['data'] as $field) {
        # Set Filename
        $filename = ROOT_DIR . '/' . PUBLIC_ROOT . '/content/field-' . $field['ID'] . '.html';
        # Check for file
        if (!file_exists($filename)) {
            $unsaved++;
<?php

use CCK\Content;
# Create Content Object
$content = new Content($_cck_types, $_cck_config);
# Create Content
$content->create(form_data());
# Get Response
$response = $content->getResponse();
# Create Response Type
switch (true) {
    # Negative
    case $response['code'] === 100:
        $response['type'] = 'negative';
        break;
        # Positive
    # Positive
    case $response['code'] === 200:
        $response['type'] = 'positive';
        break;
}
# JSON
JSON::parse($response['code'], $response['type'], $response['message'], $response, true);
# Check Method is Post
if (!is_form_data()) {
    JSON::parse(100, 'negative', 'Invalid request. Requests to ' . $path . ' must be POST', null, true);
}
# Actions
$actions = array(1, 0, -1);
# Sanitize form data
$data = Helpers::sanitizeInput(form_data());
# Check for post IDs
if (!isset($data['posts']) || !isset($data['action'])) {
    JSON::parse(100, 'negative', 'Missing data.', $data, true);
}
# Get Post IDs
$posts = json_decode($data['posts'], true);
# Typecast Action
$action = (int) $data['action'];
# Check Action is Valid
if (!in_array($action, $actions)) {
    JSON::parse(100, 'negative', 'Invalid action.', null, true);
}
# Create new Content Object
$content = new Content($_cck_types, $_cck_config);
# Update each post
foreach ($posts as $post) {
    if (!$content->update($post, array('status' => $action))) {
        JSON::parse(100, 'negative', 'Post ID: ' . $post . ' was not updated.', null, true);
    }
}
# Return result
JSON::parse(200, 'positive', 'Posts updated', form_data(), true);
/**
 * Form Field
 */
function form_field($field)
{
    $fields = form_data();
    return form_field_exists($field) ? $fields[$field] : false;
}
<?php

use CCK\Helpers;
# Check Method is Post
if (!is_form_data()) {
    JSON::parse(100, 'negative', 'Invalid request. Requests to ' . $path . ' must be POST', null, true);
}
# Sanitize form data
$data = Helpers::sanitizeInput(form_data());
# Check 'alias' is present
if (!isset($data['alias']) || !is_string($data['alias'])) {
    JSON::parse(100, 'negative', 'Alias input is not valid.', null, true);
}
# Generate Alias
$alias = cck_url_alias($data['alias']);
# Return result
JSON::parse(200, 'positive', 'Alias generate', array('alias' => $alias), true);