Esempio n. 1
0
function apms_widget($wname, $wid = '', $opt = '', $mopt = '', $wdir = '', $addon = '')
{
    global $is_admin, $is_demo, $is_wdir;
    if ($wdir) {
        $widget_path = $wdir . '/' . $wname;
        $widget_url = str_replace(G5_PATH, G5_URL, $wdir) . '/' . $wname;
        $wdir = str_replace(G5_PATH, '', $wdir);
    } else {
        if ($is_wdir) {
            $widget_url = G5_URL . $is_wdir . '/' . $wname;
            $widget_path = G5_PATH . $is_wdir . '/' . $wname;
            $wdir = $is_dir;
        } else {
            if ($addon) {
                // 애드온
                $widget_url = G5_SKIN_URL . '/addon/' . $wname;
                $widget_path = G5_SKIN_PATH . '/addon/' . $wname;
            } else {
                $widget_url = THEMA_URL . '/widget/' . $wname;
                $widget_path = THEMA_PATH . '/widget/' . $wname;
            }
        }
    }
    if (!is_file($widget_path . '/widget.php')) {
        return;
    }
    $wid = apms_escape_string($wid);
    if ($wid) {
        $wset = apms_widget_config($wid, $opt, $mopt, $addon);
        $setup_href = '';
        if ($is_demo || $is_wdir || $is_admin == 'super') {
            $setup_href = G5_BBS_URL . '/widget.setup.php?wid=' . urlencode($wid) . '&wname=' . urlencode($wname) . '&thema=' . urlencode(THEMA);
            if ($addon) {
                $setup_href .= '&add=' . $addon;
            }
            if ($opt) {
                $setup_href .= '&opt=' . urlencode($opt);
            }
            if ($mopt) {
                $setup_href .= '&mopt=' . urlencode($mopt);
            }
            if ($wdir) {
                $setup_href .= '&wdir=' . urlencode($wdir);
            }
            if ($is_demo) {
                $setup_href .= '&wdemo=1';
            }
        }
    } else {
        if ($opt) {
            $wset = apms_query($opt);
            if (G5_IS_MOBILE && $wset && $mopt) {
                $wset = array_merge($wset, apms_query($mopt));
            }
        }
    }
    // 초기값
    $wset['new'] = isset($wset['new']) && $wset['new'] ? $wset['new'] : 'red';
    $wset['cache'] = isset($wset['cache']) && $wset['cache'] > 0 ? $wset['cache'] : 0;
    ob_start();
    @(include $widget_path . '/widget.php');
    $widget = ob_get_contents();
    ob_end_clean();
    return $widget;
}
Esempio n. 2
0
} else {
    if ($add) {
        // 애드온
        $widget_url = G5_SKIN_URL . '/addon/' . $wname;
        $widget_path = G5_SKIN_PATH . '/addon/' . $wname;
    } else {
        $widget_url = THEMA_URL . '/widget/' . $wname;
        $widget_path = THEMA_PATH . '/widget/' . $wname;
    }
}
if (!file_exists($widget_path . '/widget.php')) {
    die('정상적인 접근이 아닙니다.');
}
// 데모
if ($is_demo) {
    if (file_exists(THEMA_PATH . '/assets/demo.php')) {
        include_once THEMA_PATH . '/assets/demo.php';
    }
}
// 위젯설정값
$wset = apms_widget_config($wid, $opt, $mopt, $add);
// 기본값 정리
$wset['cache'] = isset($wset['cache']) && $wset['cache'] > 0 ? $wset['cache'] : 0;
$wset['comment'] = isset($wset['comment']) && $wset['comment'] ? $wset['comment'] : '';
$wset['shadow'] = isset($wset['shadow']) && $wset['shadow'] ? $wset['shadow'] : '';
$wset['rows'] = isset($wset['rows']) && $wset['rows'] ? $wset['rows'] : '';
$wset['page'] = isset($wset['page']) && $wset['page'] ? $wset['page'] : '';
$wset['mode'] = isset($wset['mode']) && $wset['mode'] ? $wset['mode'] : '';
$wset['rank'] = isset($wset['rank']) && $wset['rank'] ? $wset['rank'] : '';
$wset['new'] = isset($wset['new']) && $wset['new'] ? $wset['new'] : 'red';
$wset['page'] = $page;