Exemplo n.º 1
0
/**
 * This is the core function that actually is called when a shortcode
 * is parsed
 *
 * @param string $atts
 * @return string
 */
function unc_gallery_apply($atts = array())
{
    global $UNC_GALLERY;
    if ($UNC_GALLERY['debug']) {
        XMPP_ERROR_trace(__FUNCTION__, func_get_args());
    }
    $check = unc_gallery_display_var_init($atts);
    if ($check) {
        return unc_gallery_display_page();
    } else {
        $err_text = implode("<br>", $UNC_GALLERY['errors']);
        $UNC_GALLERY['errors'] = array();
        return $err_text;
    }
}
Exemplo n.º 2
0
/**
 * This is the function called by Ajax when the filter dropdown on the website is updated
 *
 * @global type $wpdb
 * @global type $UNC_GALLERY
 * @return type
 */
function unc_filter_update()
{
    global $UNC_GALLERY;
    if ($UNC_GALLERY['debug']) {
        XMPP_ERROR_trace(__FUNCTION__);
    }
    $filter_key = filter_input(INPUT_GET, 'filter_key', FILTER_SANITIZE_STRING);
    $filter_value = filter_input(INPUT_GET, 'filter_value', FILTER_SANITIZE_STRING);
    $filter_group = filter_input(INPUT_GET, 'filter_group', FILTER_SANITIZE_STRING);
    $filter_name = filter_input(INPUT_GET, 'filter_name', FILTER_SANITIZE_STRING);
    $options = filter_input(INPUT_GET, 'options', FILTER_SANITIZE_STRING);
    $filter_str = '';
    if (strlen($filter_group) > 1) {
        // we have a group set
        $filter_str = $filter_group;
    } else {
        if ($filter_key == 'group') {
            // the group was chosen
            $filter_str = $filter_value;
        } else {
            echo "error in filter group!";
        }
    }
    if (strlen($filter_name) > 0) {
        // we have a name set
        $filter_str .= "|{$filter_name}";
    } else {
        if ($filter_key == 'att_name') {
            // the group was chosen
            $filter_str .= "|{$filter_value}";
        }
    }
    if ($filter_key == 'att_value' && $filter_value != 'false') {
        $filter_str .= "|{$filter_value}";
    }
    // the following line has ECHO = FALSE because we do the echo here
    unc_gallery_display_var_init(array('type' => 'filter', 'filter' => $filter_str, 'echo' => false, 'options' => $options));
    ob_clean();
    echo unc_gallery_display_page();
    wp_die();
}