コード例 #1
0
function popmake_get_popup_theme_meta($group, $popup_theme_id = null, $key = null, $default = null)
{
    if (!$popup_theme_id) {
        $popup_theme_id = get_the_ID();
    }
    $values = get_post_meta($popup_theme_id, "popup_theme_{$group}", true);
    if (!$values) {
        $defaults = apply_filters("popmake_popup_theme_{$group}_defaults", array());
        $values = array_merge($defaults, popmake_get_popup_theme_meta_group($group, $popup_theme_id));
    } else {
        $values = array_merge(popmake_get_popup_theme_meta_group($group, $popup_theme_id), $values);
    }
    if ($key) {
        // Check for dot notation key value.
        $test = uniqid();
        $value = popmake_resolve($values, $key, $test);
        if ($value == $test) {
            $key = str_replace('.', '_', $key);
            if (!isset($values[$key])) {
                $value = $default;
            } else {
                $value = $values[$key];
            }
        }
        return apply_filters("popmake_get_popup_theme_{$group}_{$key}", $value, $popup_theme_id);
    } else {
        return apply_filters("popmake_get_popup_theme_{$group}", $values, $popup_theme_id);
    }
}
コード例 #2
0
/**
 * Returns $_POST key.
 *
 * @since 1.0
 * @param string $name is the key you are looking for. Can use dot notation for arrays such as my_meta.field1 which will resolve to $_POST['my_meta']['field1'].
 * @return mixed results of lookup
 */
function popmake_post($name, $do_stripslashes = true)
{
    $value = popmake_resolve($_POST, $name, false);
    return $do_stripslashes ? stripslashes_deep($value) : $value;
}