You are here

secure_cookie_data_tree_two.module in Secure Cookie Data 7.2

secure_cookie_data_tree_two.module @author António P. P. Almeida <appa@perusio.net> @date Wed Dec 11 17:03:52 2013

@brief Module for implementing the secure cookie data system for trees two level deep.

File

modules/secure_cookie_data_tree_two.module
View source
<?php

/**
 * @file   secure_cookie_data_tree_two.module
 * @author António P. P. Almeida <appa@perusio.net>
 * @date   Wed Dec 11 17:03:52 2013
 *
 * @brief  Module for implementing the secure cookie
 *         data system for trees two level deep.
 *
 */

/**
 * Encode the data and set the cookie with the configuration data.
 *
 * @param object|array $data
 *   The data to be stored as an object or as a keyed array with the labels
 *   for levels 0 and 1 of the tree nodes and leafs. E.g:
 *
 *   array('label_level0' => 'nid', 'nid' => 123,
 *         'label_level1' => 'support', 'value' = 'xxx')
 *
 *
 *                         nid => 123
 *                                / \
 *                               /   \
 *                         support  format
 *                             /       \
 *                            /         \
 *                 (array) [xxx]    [big, small]
 *
 * @return nothing.
 *   Side effects only.
 */
function secure_cookie_data_tree_two_put($data) {
  return secureCookieTreeTwo::set_tree($data);
}

/**
 * Obtain the data stored in a secure cookie.
 *
 * @param string $data
 *   The JSON data to be stored in the cookie.
 * @return object
 *   The stored data or NULL if the cookie is missing
 *   or the HMAC doesn't validate.
 */
function secure_cookie_data_tree_two_get() {
  return secureCookieTreeTwo::get();
}

/**
 * Delete the node of a tree.
 *
 * @param array $e
 *   The element specification.
 * @param data
 *   The data, i.e., the tree;
 * @return boolean
 *   TRUE if the node was deleted, false if not.
 */
function secure_cookie_data_tree_two_delete($e, $data = NULL) {
  return secureCookieTreeTwo::delete_node($e, $data);
}

Functions

Namesort descending Description
secure_cookie_data_tree_two_delete Delete the node of a tree.
secure_cookie_data_tree_two_get Obtain the data stored in a secure cookie.
secure_cookie_data_tree_two_put Encode the data and set the cookie with the configuration data.