/**
 * PageLines Option
 *
 * Uses controls to find and retrieve the appropriate option value
 *
 * @package PageLines Framework
 *
 * @since   ...
 *
 * @link    http://www.pagelines.com/wiki/Ploption
 *
 * @param   'key' the id of the option
 * @param   array $args
 *
 * @uses    is_pagelines_special
 * @uses    plspecial
 * @uses    plmeta
 * @uses    pldefault
 * @uses    get_ploption
 * @uses    plnewkey
 *
 * @return  bool|mixed
 */
function ploption($key, $args = array())
{
    $d = array('subkey' => null, 'post_id' => null, 'setting' => null, 'clone_id' => null, 'type' => '', 'translate' => false, 'key' => $key);
    $o = wp_parse_args($args, $d);
    if (has_filter("ploption_{$key}")) {
        return apply_filters("ploption_{$key}", $key, $o);
    }
    if (is_pagelines_special($o) && plspecial($key, $o)) {
        return pagelines_magic_parse(plspecial($key, $o), $o);
    } elseif (isset($o['post_id']) && plmeta($key, $args)) {
        return pagelines_magic_parse(plmeta($key, $o), $o);
    } elseif (pldefault($key, $o)) {
        return pldefault($key, $o);
    } elseif (get_ploption($key, $o)) {
        return pagelines_magic_parse(get_ploption($key, $o), $o);
    } elseif (get_ploption($key, $o) === null) {
        if ($newkey = plnewkey($key)) {
            return $newkey;
        } else {
            return false;
        }
    }
}
/**
 * PageLines Option
 *
 * Uses controls to find and retrieve the appropriate option value
 *
 * @package PageLines DMS
 *
 * @since   ...
 *
 * @link    http://www.pagelines.com/wiki/Ploption
 *
 * @param   'key' the id of the option
 * @param   array $args
 *
 * @uses    is_pagelines_special
 * @uses    plspecial
 * @uses    plmeta
 * @uses    pldefault
 * @uses    get_ploption
 * @uses    plnewkey
 *
 * @return  bool|mixed
 */
function ploption($key, $args = array())
{
    _pl_deprecated_function(__FUNCTION__, '1.1', 'pl_setting()');
    $d = array('subkey' => null, 'post_id' => null, 'setting' => null, 'clone_id' => null, 'type' => '', 'translate' => false, 'key' => $key);
    $o = wp_parse_args($args, $d);
    if (has_filter("ploption_{$key}")) {
        return apply_filters("ploption_{$key}", $key, $o);
    }
    if (class_exists('PageLinesTemplateHandler') && pl_setting($key, $o)) {
        return pagelines_magic_parse(pl_setting($key, $o), $o);
    } elseif (is_pagelines_special($o) && plspecial($key, $o)) {
        return pagelines_magic_parse(plspecial($key, $o), $o);
    } elseif (isset($o['post_id']) && plmeta($key, $args)) {
        return pagelines_magic_parse(plmeta($key, $o), $o);
    } elseif (pldefault($key, $o)) {
        return pldefault($key, $o);
    } elseif (get_ploption($key, $o)) {
        return pagelines_magic_parse(get_ploption($key, $o), $o);
    } elseif (get_ploption($key, $o) === null) {
        if ($newkey = plnewkey($key)) {
            return $newkey;
        } else {
            return false;
        }
    }
}