示例#1
0
<?php

zbase_view_plugin_load('jquery');
zbase_view_plugin_load('bootstrap');
zbase_view_plugin_load('zbase');
//ob_start('zbase_view_compile');
?>
<!DOCTYPE html>
<html lang="en" zbase-package="<?php 
echo zbase_view_template_package();
?>
">
	<head>
		{!! zbase_view_render_head() !!}
		<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
		<meta name="apple-mobile-web-app-capable" content="yes"/>
		<meta name="robots" content="INDEX,FOLLOW" />
		<meta name="HandheldFriendly" content="True" />
		<meta name="MobileOptimized" content="320" />
		<link href="/zbase/assets/zivsluck/img/favicon.ico" rel="shortcut icon" type="image/x-icon">
		<link href="/zbase/assets/zivsluck/css/zivsluck.css" rel="stylesheet" />

		<meta property="og:url" content="http://zivsluck.com" />
		<meta property="og:type" content="website" />
		<meta property="og:title" content="Create your own necklace" />
		<meta property="og:site_name" content="Personalized Necklace by ZivsLuck" />
		<meta property="og:description" content="Personalized Necklaces by Zivsluck made from High Quality Stainless, Silver and Gold! Customized design, create now!" />
		<meta property="og:image" content="http://zivsluck.com/zbase/assets/zivsluck/img/zivsluckOg.png" />
		<meta property="fb:app_id" content="1020997414620227" />

示例#2
0
/**
 * Return the Response
 * @param mixed $response
 * @return mixed
 */
function zbase_response($response)
{
    // HTTP/1.1 204 No Content
    //	$apiResponse = zbase()->json()->getVariable('api');
    //	if(!empty($apiResponse) && $apiResponse instanceof \Zbase\Exceptions\HttpException && $apiResponse->getStatusCode() == 204)
    //	{
    //		$response->header('HTTP/1.1 204 No Content');
    //		return $response;
    //	}
    $returnNoContent = '';
    $errorResponse = false;
    $xmlResponse = false;
    $responseFormat = zbase_response_format();
    if (zbase_is_json()) {
        $responseFormat = 'json';
    }
    if ($responseFormat == 'json' || zbase_request_is_ajax()) {
        $jsonResponse = true;
    }
    if ($responseFormat == 'xml') {
        $xmlResponse = true;
    }
    if (zbase_is_angular_template()) {
        $responseFormat = 'html';
        $jsonResponse = false;
    }
    if (!empty($jsonResponse)) {
        $formId = zbase_request_input('_formId', null);
        if (!empty($formId)) {
            zbase()->json()->setVariable('_formId', $formId);
        }
        zbase()->json()->setVariable('_route', zbase_route_name());
        zbase()->json()->setVariable('_package', zbase_view_template_package());
        $code = 200;
        if ($response instanceof \RuntimeException) {
            $code = $response->getStatusCode();
            zbase()->json()->setVariable('statusCode', $code);
            if ($code !== 200) {
                $errorResponse = true;
                zbase()->json()->setVariable('statusMessage', $response->getStatusMessage());
            }
        }
        /**
         * its ajax, but method is GET
         */
        if (empty($errorResponse)) {
            $tokenResponse = zbase_request_input('token', zbase_request_query_input('token', false));
            if (!$tokenResponse) {
                zbase()->json()->setVariable('_token', zbase_csrf_token());
            }
        }
        zbase()->json()->setVariable('_alerts', ['errors' => zbase_alerts('error'), 'messages' => zbase_alerts('success'), 'info' => zbase_alerts('info'), 'warning' => zbase_alerts('warning')]);
        $jsonScripts = zbase()->json()->getVariable('_html_script');
        $jsonScriptReturn = '';
        if (!empty($jsonScripts)) {
            foreach ($jsonScripts as $jScripts) {
                if (!empty($jScripts[0])) {
                    $jScripts[0] = str_replace(array('<script type="text/javascript">', '</script>'), '', $jScripts[0]);
                    $jsonScriptReturn .= $jScripts[0] . ';';
                }
            }
        }
        zbase()->json()->setVariable('_html_script', str_replace(';;', ';', $jsonScriptReturn));
        $forceResponse = zbase_request_input('forceResponse', zbase_request_query_input('forceResponse', false));
        /**
         * JSONP Callback
         */
        $jsonCallback = zbase_request_query_input('callback', zbase_request_query_input('jsonp', false));
        if (!$forceResponse) {
            zbase_alerts_render();
            if (!empty($jsonCallback)) {
                return response()->json(zbase()->json()->getVariables(), $code)->setCallback($jsonCallback);
            } else {
                return response()->json(zbase()->json()->getVariables(), $code);
            }
        }
    }
    if ($response instanceof \RuntimeException) {
        if ($response->getStatusCode() == '302') {
            if (zbase_is_json()) {
                zbase_alerts_render();
                if (!empty($jsonCallback)) {
                    return response()->json(zbase()->json()->getVariables(), 302)->setCallback($jsonCallback);
                } else {
                    return response()->json(zbase()->json()->getVariables(), 302);
                }
            }
        }
        return $response->render(zbase_request(), $response);
    }
    /**
     * REsponse with a javascript code
     */
    if ($responseFormat == 'javascript') {
        $response = \Response::make($response, 200);
        $response->header('Content-Type', 'application/javascript');
    }
    return $response;
}
示例#3
0
/**
 * Return the Main Template Layout
 *
 * 	The main template configuration:
 * 		view.templates.front.package = The package to use
 * 		view.templates.front.theme = The theme to use
 * 		view.templates.$tag.front.package = Tag a package to use
 * 		view.templates.$tag.front.theme = Tag a package to use
 *
 * @param string $tag
 * @param string $tpl The template file to use
 * @return string
 */
function zbase_view_template_layout($tag = null, $tpl = 'layout', $section = null)
{
    $section = is_null($section) ? zbase_section() : $section;
    $package = zbase_view_template_package($tag);
    $theme = zbase_view_template_theme($tag);
    $viewFile = $package . '::templates.' . $section . '.' . $theme . '.' . $tpl;
    // dd('Section: ' . $section, 'Package: ' . $package, 'Theme: ' . $theme);
    if (\View::exists($viewFile)) {
        return $viewFile;
    }
    return zbase_tag() . '::templates.' . $section . '.default.' . $tpl;
}