Exemplo n.º 1
0
function xt_design_syspages()
{
    global $wpdb;
    $SHARE_ID = $wpdb->get_var('SELECT id FROM ' . XT_TABLE_SHARE . ' ORDER BY id DESC LIMIT 1');
    $USER_ID = $wpdb->get_var("SELECT id FROM {$wpdb->users} ORDER BY id DESC LIMIT 1");
    $ALBUM_ID = $wpdb->get_var('SELECT id FROM ' . XT_TABLE_ALBUM . ' ORDER BY id DESC LIMIT 1');
    $DAOGOU_ID = $wpdb->get_var("SELECT id FROM {$wpdb->posts} WHERE post_status='publish' AND post_type='daogou' ORDER BY id DESC LIMIT 1");
    $HELP_ID = $wpdb->get_var("SELECT id FROM {$wpdb->posts} WHERE post_status='publish' AND post_type='help' ORDER BY id DESC LIMIT 1");
    $_sys_pages = xt_design_pages();
    if (!empty($SHARE_ID)) {
        $_sys_pages['share']['preview'] = str_replace('SHAREID', $SHARE_ID, $_sys_pages['share']['preview']);
    } else {
        $_sys_pages['share']['preview'] = 'null';
    }
    if (!empty($ALBUM_ID)) {
        $_sys_pages['album']['preview'] = str_replace('ALBUMID', $ALBUM_ID, $_sys_pages['album']['preview']);
    } else {
        $_sys_pages['album']['preview'] = 'null';
    }
    if (!empty($DAOGOU_ID)) {
        $_sys_pages['daogou']['preview'] = get_permalink($DAOGOU_ID);
    } else {
        $_sys_pages['daogou']['preview'] = 'null';
    }
    if (!empty($HELP_ID)) {
        $_sys_pages['help']['preview'] = get_permalink($HELP_ID);
    } else {
        $_sys_pages['help']['preview'] = 'null';
    }
    if (!empty($USER_ID)) {
        $_sys_pages['user']['preview'] = str_replace('USERID', $USER_ID, $_sys_pages['user']['preview']);
        $_sys_pages['invite']['preview'] = str_replace('USERID', $USER_ID, $_sys_pages['invite']['preview']);
    } else {
        $_sys_pages['user']['preview'] = 'null';
        $_sys_pages['invite']['preview'] = 'null';
    }
    return $_sys_pages;
}
Exemplo n.º 2
0
<style type="text/css">
.widget-content label.key{width:80px;display:inline-block;text-align:right;}
.widget-content small{padding-left:80px;display:block;}
</style>
<?php 
define('XT_PAGE_EDIT', true);
wp_enqueue_script('xt-admin-widgets');
$_sys_pages = xt_design_pages();
$__page = 'home';
$__page_name = '首页';
$__page_preview = home_url();
if (isset($_GET['xt-page']) && !empty($_GET['xt-page'])) {
    if (isset($_sys_pages[$_GET['xt-page']])) {
        $__page = $_GET['xt-page'];
        $__page_name = $_sys_pages[$_GET['xt-page']]['title'];
        $__page_preview = $_sys_pages[$_GET['xt-page']]['preview'];
    } else {
        $pages = get_option(XT_OPTION_PAGES);
        if (isset($pages[$_GET['xt-page']])) {
            $__page = intval($_GET['xt-page']);
            $_page = get_post($__page);
            if (!empty($_page)) {
                $__page_name = $_page->post_title;
                $__page_preview = get_permalink($__page);
            } else {
                exit('<h1>指定的页面不存在</h1>');
            }
        } else {
            exit('<h1>指定的页面不存在</h1>');
        }
    }
Exemplo n.º 3
0
function xt_dynamic_layout()
{
    global $xt_page_layouts, $xt_current_page, $xt_current_page_setting;
    $isEdit = defined('XT_PAGE_EDIT') && XT_PAGE_EDIT;
    $xt_current_page_setting = array('layouts_edit' => 1, 'widgets_edit' => 1);
    if ($isEdit) {
        $_sys_pages = xt_design_pages();
        if (isset($_sys_pages[$xt_current_page])) {
            $xt_current_page_setting = array_merge($xt_current_page_setting, $_sys_pages[$xt_current_page]);
        }
    }
    if (xt_is_headerOrfooter($xt_current_page)) {
        $xt_current_page_setting['layouts_edit'] = 0;
        if (empty($xt_page_layouts)) {
            $xt_page_layouts = array(array('name' => 'row-12', 'delete' => 1, 'layout' => array('span12' => array())));
        }
    }
    if (!empty($xt_page_layouts)) {
        $_count = 0;
        foreach ($xt_page_layouts as $layout) {
            if (is_array($layout) && strstr($layout['name'], 'row')) {
                if ($isEdit) {
                    _xt_dynamic_layout_edit($layout);
                } else {
                    _xt_dynamic_layout($layout, $_count);
                }
                $_count++;
            }
        }
    }
    if ($isEdit && $xt_current_page_setting['layouts_edit']) {
        echo '<div class="row"><a id="X_AddLayout" class="add-row" href="javascript:;">添加布局单元</a></div>';
    }
}