Ejemplo n.º 1
0
function get_url($id = 0)
{
    $app = Slim\Slim::getInstance();
    if ($lang = $app->config('language') != '') {
        return $app->request()->getUrl() . $app->request()->getScriptName() . '/' . $lang . '/' . get_relative($id);
    }
}
Ejemplo n.º 2
0
function urlHandler_bapidefaultpages()
{
    header('Access-Control-Allow-Origin: *');
    $url = get_relative($_SERVER['REQUEST_URI']);
    //echo $_SERVER['REQUEST_URI']; exit();
    if (strtolower($url) != "/bapi.init") {
        return;
    }
    header("Cache-Control: no-cache, must-revalidate");
    $menuname = "Main Navigation Menu";
    $menu_id = initmenu($menuname);
    $change_logs = array();
    foreach (get_default_pages_def() as $pagedef) {
        $change_logs[] = addpage($pagedef, $menu_id);
    }
    $qs = $_SERVER['QUERY_STRING'];
    if (strtolower($qs) == 'mode=initial-setup') {
        if (defined('KIGO_SELF_HOSTED') && !KIGO_SELF_HOSTED) {
            switch_theme(WP_DEFAULT_THEME);
        } else {
            switch_theme('instatheme01');
            $toptions = get_option('instaparent_theme_options');
            $toptions['presetStyle'] = 'style01';
            update_option('instaparent_theme_options', $toptions);
            setSlideshowImages();
        }
        bapi_wp_site_options();
        $blog_url = get_site_url();
        update_option('bapi_first_look', 0);
        header("HTTP/1.1 307 Temporary Redirect");
        header("Location: {$blog_url}");
        exit;
    }
    foreach ($change_logs as $log) {
        if (is_array($log['add_to_nav'])) {
            echo "PageID=" . $log['add_to_nav']['page_id'] . ", Parent=" . $log['add_to_nav']['parent'] . ", navParentID=" . $log['add_to_nav']['nav_parent_id'] . "<br/>";
        }
        echo '<div>' . $log['action'] . ' menu item <b>' . $log['post_title'] . '</b> post_id=' . $log['post_id'] . ', miid=' . $log['miid'] . ', menu_id=' . $log['menu_id'] . '</div>';
    }
    exit;
}
Ejemplo n.º 3
0
function save_seo_meta($postid)
{
    $bapisync = new BAPISync();
    $bapisync->init();
    $perma = get_permalink();
    $permaPath = parse_url($perma);
    $relativePerma = get_relative($perma);
    $pageID = get_post_meta(get_the_ID(), 'bapi_page_id');
    if ($relativePerma == '/' && $pageID[0] != 'bapi_home') {
        return;
    }
    $seo = $bapisync->getSEOFromUrl($relativePerma);
    $meta_words = get_post_custom($post->ID, '', true);
    $myPageId = $seo['ID'];
    $myType = $seo['entity'];
    $myPkId = $seo['pkid'];
    if ($myType === null) {
        $myType = 0;
    }
    if ($myPageId === null) {
        $myPageId = 0;
    }
    if ($myPkId === null) {
        $myPkId = 0;
    }
    $apiKey = getbapiapikey();
    $bapi = getBAPIObj();
    if (!$bapi->isvalid()) {
        return;
    }
    $keywor = sanitize_text_field($_POST['bapi_meta_keywords']);
    $metle = sanitize_text_field($_POST['bapi_meta_title']);
    $meta_desc = sanitize_text_field($_POST['bapi_meta_description']);
    // save old value if keyword empty or null
    if ($metle === null || empty($metle)) {
        $metle = $meta_words['bapi_meta_title'][0];
    }
    if ($meta_desc === null || empty($meta_desc)) {
        $meta_desc = $meta_words['bapi_meta_description'][0];
    }
    if ($keywor === null || empty($keywor)) {
        $keywor = $meta_words['bapi_meta_keywords'][0];
    }
    //saves to wordpress database
    if (isset($_POST['bapi_meta_keywords'])) {
        if ($_POST['bapi_meta_keywords'] !== $meta_words['bapi_meta_keywords'][0]) {
        }
        update_post_meta($postid, 'bapi_meta_keywords', sanitize_text_field($_POST['bapi_meta_keywords']));
    }
    if (isset($_POST['bapi_meta_title']) && $_POST['bapi_meta_title'] !== $meta_words['bapi_meta_title'][0]) {
        update_post_meta($postid, 'bapi_meta_title', sanitize_text_field($_POST['bapi_meta_title']));
    }
    if (isset($_POST['bapi_meta_description']) && $_POST['bapi_meta_description'] !== $meta_words['bapi_meta_description'][0]) {
        update_post_meta($postid, 'bapi_meta_description', sanitize_text_field($_POST['bapi_meta_description']));
    }
    $metaArr = array('MetaKeywords' => $keywor, 'PageTitle' => $metle, 'MetaDescrip' => $meta_desc, 'ID' => $myPageId, 'pkid' => $myPkId, 'Keyword' => $relativePerma, 'entity' => $myType);
    $jsify = json_encode($metaArr);
    $jsonObj = 'data=' . (string) $jsify;
    // entety: tyoe and language  needs to be
    //print_r($jsonObj);exit();
    $bapi->save($jsonObj, $apiKey);
    update_option('bapi_keywords_lastmod', 0);
    bapi_sync_coredata();
}
Ejemplo n.º 4
0
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    update_option('bapi_slideshow_image1', $_POST['bapi_slideshow_image1']);
    update_option('bapi_slideshow_image2', $_POST['bapi_slideshow_image2']);
    update_option('bapi_slideshow_image3', $_POST['bapi_slideshow_image3']);
    update_option('bapi_slideshow_image4', $_POST['bapi_slideshow_image4']);
    update_option('bapi_slideshow_image5', $_POST['bapi_slideshow_image5']);
    update_option('bapi_slideshow_image6', $_POST['bapi_slideshow_image6']);
    update_option('bapi_slideshow_caption1', $_POST['bapi_slideshow_caption1']);
    update_option('bapi_slideshow_caption2', $_POST['bapi_slideshow_caption2']);
    update_option('bapi_slideshow_caption3', $_POST['bapi_slideshow_caption3']);
    update_option('bapi_slideshow_caption4', $_POST['bapi_slideshow_caption4']);
    update_option('bapi_slideshow_caption5', $_POST['bapi_slideshow_caption5']);
    update_option('bapi_slideshow_caption6', $_POST['bapi_slideshow_caption6']);
    echo '<div id="message" class="updated"><p><strong>Settings saved.</strong></p></div>';
}
define('WPIS_URL', get_relative(plugins_url('', __FILE__)));
?>
<script type="text/javascript">
	jQuery(document).ready(function($){
		$('input#bapi_slideshow_image1,input#image-pick1').click(function(){
			//alert('test');
			wp.media.editor.send.attachment = function(props, attachment){
				$('input#bapi_slideshow_image1').val(attachment.url);
			}
			wp.media.editor.open(this);
			return false;
		});
		$('input#bapi_slideshow_image2,input#image-pick2').click(function(){
			//alert('test');
			wp.media.editor.send.attachment = function(props, attachment){
				$('input#bapi_slideshow_image2').val(attachment.url);
Ejemplo n.º 5
0
 /**
  * 支付完成返回页面
  */
 function paymentConfirm()
 {
     $notify_verify = file_get_contents('https://mapi.alipay.com/gateway.do?service=notify_verify&partner=' . $this->company->config('alipay_partner_id') . '&notify_id=' . $this->input->get('notify_id'));
     if ($notify_verify !== 'true') {
         throw new Exception('支付校验失败', 400);
     }
     $order_id = $this->input->get('out_trade_no');
     $order = $this->object->fetch($order_id);
     $this->object->addMeta('支付宝流水号', $this->input->get('trade_no'));
     $this->object->addStatus('支付完成');
     // 如果是卡,那么拿一张卡并写入订单信息
     if (get_meta($order, '是否卡片') === '是') {
         $card = $this->object->getRow(array('type' => 'card', 'meta' => array('已绑定套餐' => '否')));
         if (!$card) {
             throw new Exception('获得卡片错误,请联系客服处理', 500);
         }
         $this->object->id = $card['id'];
         $this->object->authorize(array('read' => true, 'write' => true), null, false);
         $this->object->updateMeta('已绑定套餐', '是');
         $this->object->addMeta(array('套餐' => get_meta($order, '套餐'), '价格档次' => get_meta($order, '价格档次'), '内容分类' => get_meta($order, '内容分类'), '次数' => get_meta($order, '次数')));
         $this->object->addRelative('package', get_relative($order, 'package', 'id'));
         $this->object->authorize('public', null, false);
         $this->object->id = $order['id'];
         $this->object->addRelative('card', $card['id']);
         // 购买的卡并不立即充入用户账户,最终用户拿到卡,导入到自己的账号,才完成关联(直接导入“餐”,并不关联“卡”本身)
     } else {
         $this->user->getMeta();
         $bought = isset($this->user->meta['已购']) ? json_decode($this->user->meta['已购'][0], JSON_OBJECT_AS_ARRAY) : false;
         if (!$bought) {
             $bought = array();
         }
         if (array_key_exists(get_meta($order, '价格档次'), $bought)) {
             $bought[get_meta($order, '价格档次')] += get_meta($order, '次数');
         } else {
             $bought[get_meta($order, '价格档次')] = get_meta($order, '次数');
         }
         $this->user->updateMeta('已购', json_encode($bought));
         $this->user->updateMeta('套餐', get_meta($order, '套餐'));
         $this->user->updateMeta('下次送餐日期', get_meta($order, '首次送货日期'));
     }
     redirect('user/order');
 }
Ejemplo n.º 6
0
    echo $relative[0]['name'];
    ?>
</td>
						</tr>
						<?php 
}
?>
					</tbody>
				</table>
			</div>
			
			<?php 
if (get_meta($order, '是否卡片') === '是') {
    ?>
			<?php 
    if (!get_relative($order, 'card')) {
        ?>
			<div class="well well-small">
				该订单尚未关联到卡片
			</div>
			<?php 
    } else {
        ?>
			卡片发送信息:<input type="text" name="card_delivery_comment">
			<button type="submit" name="deliver_card" class="btn">发卡</button>
			<?php 
    }
    ?>
			<?php 
}
?>
Ejemplo n.º 7
0
							<th>下单时间</th>
							<th>状态</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
						<?php 
foreach ($orders['data'] as $order) {
    ?>
						<tr>
							<td><?php 
    echo $order['id'];
    ?>
</td>
							<td><?php 
    echo get_relative($order, 'package', 'name');
    ?>
</td>
							<td><?php 
    echo get_meta($order, '次数');
    ?>
</td>
							<td><?php 
    echo get_status($order, '下单');
    ?>
</td>
							<td><?php 
    echo get_status($order);
    ?>
</td>
							<td><a href="/user/order/<?php 
Ejemplo n.º 8
0
foreach ($meals['data'] as $meal) {
    ?>
						<tr>
							<td>
								<input type="checkbox" name="checked[]" value="<?php 
    echo $meal['id'];
    ?>
">
								<a href="/admin/logistic/<?php 
    echo $meal['id'];
    ?>
"><?php 
    echo get_relative($meal, 'user', 'name');
    ?>
 的 <?php 
    echo get_relative($meal, 'package', 'name');
    ?>
</a>
							</td>
							<td><?php 
    echo get_meta($meal, '送货日期');
    ?>
</td>
							<td><?php 
    echo get_status($meal);
    ?>
</td>
							<td>
							  <?php 
    if (get_meta($meal, '物流供应商')) {
        ?>
</table>

<?php 
submit_button();
?>
</form>
</div>



<script type="text/javascript" src="<?php 
echo get_relative(plugins_url('/js/jquery.ibutton.min.js', __FILE__));
?>
" ></script>
<link type="text/css" href="<?php 
echo get_relative(plugins_url('/css/jquery.ibutton.min.css', __FILE__));
?>
" rel="stylesheet" media="all" />
<script type="text/javascript">
<?php 
/* the sort options map:
			ByCategory = 0
            ByBedrooms = 1
            ByPriceLoHi = 2
            ByPriceHiLo = 3
            ByLocation = 4
            ByRandom = 5
            ByHeadline = 6
            ByImages = 7*/
if (!empty($sitesettings)) {
    echo 'var settings=' . stripslashes($sitesettings) . ';';
Ejemplo n.º 10
0
function kigo_login_logo()
{
    ?>
    <style type="text/css">
        body.login div#login h1 a {
            background-image: url(<?php 
    echo is_newapp_website() ? get_relative(plugins_url('img/logo_kigo.png', __FILE__)) : get_relative(plugins_url('img/wp-login-im-logo.png', __FILE__));
    ?>
);
			background-size:auto auto;
            width:auto;
        }
    </style>
<?php 
}
Ejemplo n.º 11
0
					<input type="text" name="code">
				</div>
			</div>
			<?php 
}
?>
			<?php 
if (!isset($card) || get_meta($card, '已激活') !== '是') {
    ?>
			<div class="control-group">
				<label class="control-label">
					绑定套餐:
				</label>
				<div class="controls">
					<select name="package"><?php 
    echo options(array_column($packages['data'], 'name', 'id'), isset($card) ? get_relative($card, 'package', 'id') : '', '未绑定', true, false, false);
    ?>
</select>
					数量:
					<input type="number" name="amount" value="<?php 
    echo set_value('amount', isset($card) ? get_meta($card, '次数') : '');
    ?>
">
				</div>
			</div>
			<?php 
}
?>
			<div class="control-group">
				<div class="controls">
					<button type="submit" name="submit" class="btn">保存</button>