function snp_wp_nav_menu_objects($items)
{
    $parents = array();
    foreach ($items as $item) {
        if (strpos($item->url, '#ninja-popup-') !== FALSE) {
            $ID = str_replace('#ninja-popup-', '', $item->url);
            if (intval($ID)) {
                snp_run_popup(intval($ID), 'content');
            }
        }
    }
    return $items;
}
Пример #2
0
function snp_page_preview()
{
    global $snp_ignore_cookies, $PREVIEW_POPUP_META;
    global $snp_ignore_cookies;
    $snp_ignore_cookies = true;
    snp_run_popup($POST_META['snp_camp_popup'], $POST_META['snp_camp_use']);
    snp_init();
    if (!empty($_GET['action']) && $_GET['action'] == 'snp_preview_popup' && !$_GET['popup_ID']) {
        die('-1');
    } elseif (isset($_GET['popup_ID'])) {
        $POST_META['snp_camp_popup'] = $_GET['popup_ID'];
    }
    if (count($_POST)) {
        $PREVIEW_POPUP_META = array();
        foreach ((array) $_POST['snp'] as $k => $v) {
            if (strpos($k, 'cf') !== FALSE) {
                $elements = array();
                foreach ($v['fields'] as $k2 => $v2) {
                    if ($v2 != 'RAND') {
                        $elements[] = $v[$v2];
                    }
                }
                $PREVIEW_POPUP_META['snp_' . $k] = $elements;
            } else {
                $PREVIEW_POPUP_META['snp_' . $k] = $v;
            }
        }
        $POST_META['snp_camp_popup'] = -1;
    }
    $POST_META['snp_camp_dest_url'] = site_url() . '/wp-admin/index.php';
    $POST_META['snp_camp_use'] = 'welcome';
    add_action('wp_enqueue_scripts', 'snp_enqueue_social_script');
}