<?php
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// WebSite: http://www.rvglobalsoft.com
// Unauthorized copying is strictly forbidden and may result in severe legal action.
// Copyright (c) 2006 RV Global Soft Co.,Ltd. All rights reserved.
//
// =====YOU MUST KEEP THIS COPYRIGHTS NOTICE INTACT AND CAN NOT BE REMOVE =======
// Copyright (c) 2006 RV Global Soft Co.,Ltd. All rights reserved.
// This Agreement is a legal contract, which specifies the terms of the license
// and warranty limitation between you and RV Global Soft Co.,Ltd. and RV Site Builder.
// You should carefully read the following terms and conditions before
// installing or using this software. Unless you have a different license
// agreement obtained from RV Global Soft Co.,Ltd., installation or use of this software
// indicates your acceptance of the license and warranty limitation terms
// contained in this Agreement. If you do not agree to the terms of this
// Agreement, promptly delete and destroy all copies of the Software.
//
// ===== Grant of License =======
// The Software may only be installed and used on a single host machine.
//
// ===== Disclaimer of Warranty =======
// THIS SOFTWARE AND ACCOMPANYING DOCUMENTATION ARE PROVIDED "AS IS" AND
// WITHOUT WARRANTIES AS TO PERFORMANCE OF MERCHANTABILITY OR ANY OTHER
// WARRANTIES WHETHER EXPRESSED OR IMPLIED. BECAUSE OF THE VARIOUS HARDWARE
// AND SOFTWARE ENVIRONMENTS INTO WHICH RV SITE BUILDER MAY BE USED, NO WARRANTY OF
// FITNESS FOR A PARTICULAR PURPOSE IS OFFERED. THE USER MUST ASSUME THE
// ENTIRE RISK OF USING THIS PROGRAM. ANY LIABILITY OF RV GLOBAL SOFT CO.,LTD. WILL BE
// LIMITED EXCLUSIVELY TO PRODUCT REPLACEMENT OR REFUND OF PURCHASE PRICE.
// IN NO CASE SHALL RV GLOBAL SOFT CO.,LTD. BE LIABLE FOR ANY INCIDENTAL, SPECIAL OR
// CONSEQUENTIAL DAMAGES OR LOSS, INCLUDING, WITHOUT LIMITATION, LOST PROFITS
// OR THE INABILITY TO USE EQUIPMENT OR ACCESS DATA, WHETHER SUCH DAMAGES ARE
// BASED UPON A BREACH OF EXPRESS OR IMPLIED WARRANTIES, BREACH OF CONTRACT,
// NEGLIGENCE, STRICT TORT, OR ANY OTHER LEGAL THEORY. THIS IS TRUE EVEN IF
// RV GLOBAL SOFT CO.,LTD. IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO CASE WILL
// RV GLOBAL SOFT CO.,LTD.'S LIABILITY EXCEED THE AMOUNT OF THE LICENSE FEE ACTUALLY PAID
// BY LICENSEE TO RV GLOBAL SOFT CO.,LTD.
// +---------------------------------------------------------------------------+
// $Id$
// +---------------------------------------------------------------------------+
/**
* RvSiteBuilder navigator libary
*
* @package RvsLibs
* @author Pairote Manunphol <pairote@rvglobalsoft.com>
* @version $Revision$
* @since PHP 5.1
*/
if (class_exists('RvsLibs_Scripts') === false) {
class RvsLibs_Scripts
{
/**
* This function return code JavaScript to openCustomSize()
* @author Apiruk <apiruk@rvglobalsoft.com>
* ๏ฟฝัง๏ฟฝ๏ฟฝ๏ฟฝ่นน๏ฟฝ๏ฟฝ ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ code java open new window
* ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝยก๏ฟฝัง๏ฟฝ๏ฟฝ๏ฟฝ้นจะต๏ฟฝอง ๏ฟฝ่งค๏ฟฝ๏ฟฝ Link option ๏ฟฝ๏ฟฝาง๏ฟฝ ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝรบ๏ฟฝ๏ฟฝ่งฟ๏ฟฝ้งก๏ฟฝ๏ฟฝ่นน๏ฟฝ๏ฟฝะถูก๏ฟฝ๏ฟฝ๏ฟฝยก๏ฟฝอน complierSource(
* ๏ฟฝ๏ฟฝ๏ฟฝวน replace {HEAD} ๏ฟฝะน๏ฟฝ code java ๏ฟฝ๏ฟฝ๏ฟฝไปต๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝวน๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ head_data ๏ฟฝอง page ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ
* full size ๏ฟฝ๏ฟฝ๏ฟฝ fullscreen=1 ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ custom size ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ๏ฟฝ width=xxx, height=xxx
*/
public static function appendCodeOpenCustomSize()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
//Comment for return code include js file
//<script language="JavaScript" type="text/javascript">
//</script>
$code ='
/**
* select option responsive jumpmenu
*/
function res_jumpmenu(targ,selObj,restore){ //v3.0
eval(targ+".location=\'"+selObj.options[selObj.selectedIndex].value+"\'");
//if (restore) selObj.selectedIndex= 0;
}
function iFrameHeight() {
console.log(\'Onload() call iFrameHeight()\');
if(document.getElementById && !(document.all)) {
h = document.getElementById(\'iframename\').contentDocument.body.scrollHeight;
document.getElementById(\'iframename\').style.height = h;
w = document.getElementById(\'iframename\').contentDocument.body.scrollHeight;
document.getElementById(\'iframename\').style.height = w;
} else if (document.all) {
h = document.frames(\'iframename\').document.body.scrollHeight;
document.all.iframename.style.height = h;
w = document.getElementById(\'iframename\').contentDocument.body.scrollHeight;
document.getElementById(\'iframename\').style.height = w;
}
}
/********************************
* obj : - string:md5
* - obj:{"autoopen":true} (case:wysi)
* url : - string:"www.kapook.com"
- obj:this (case:wysi)
*********************************/
function openDialogOption(obj,url) {
if (typeof obj == \'string\') {
eval("var obj=opt_"+obj);
var sideUrl = url;
} else {
//=== case wysi
if (typeof url == \'string\') {
var sideUrl = url;
} else {
if (url.getAttribute(\'goUrl\')){
var sideUrl = url.getAttribute(\'goUrl\');
} else {
var sideUrl=url.href;
url.setAttribute(\'goUrl\',sideUrl);
}
url.href="javascript::void(0)";
url.target="";
}
//case fullscreen
if (obj.height == undefined && obj.width == undefined) {
SiteWindow = window.open(sideUrl,"_blank", "fullscreen=yes,toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, directories=no, status=no");
return true;
}
}
obj.autoOpen = true;
obj.height = (obj.height == undefined || obj.height == "auto") ? window.innerHeight-100 : parseInt(obj.height);
obj.width = (obj.width == undefined || obj.width == "auto") ? window.innerWidth-100 : parseInt(obj.width);
if(obj.zIndex) obj.zIndex = parseInt(obj.zIndex);
var divDialog = jQuery("<div/>").attr("style","width:"+obj.width+";height:"+obj.height+";");
jQuery("<iframe/>").attr({
"id":"iframename",
"overflow":"scroll",
"style":"width:100%;height:100%;border:none;",
"src": sideUrl,
"onload":"iFrameHeight();"
}).appendTo(divDialog);
divDialog.dialog(obj);
console.log(\'sideUrl::\' + sideUrl);
jQuery(\'#iframename\').load(function() {
console.log(\'#iframename .load()\');
});
}
function openCustomSize(PageURL, Width, Height, ToolBar, Location, StatusBar, MenuBar, Resizeable, ScrollBars) {
if (Width > 0 && Height > 0) {
var setTop = (screen.height - Height) / 2;
var setLeft = (screen.width - Width) / 2;
var siteOpen = \'width=\'+Width+\', height=\'+Height+\', left=\'+setLeft+\', top=\'+setTop+\', \';
} else {
//var siteOpen = \'fullscreen=yes, \';
var siteOpen = \'width=\'+window.screen.availWidth+\', height=\'+window.screen.availHeight+\', left=0, top=0, \';
}
var siteOption = siteOpen+\'toolbar=\'+ToolBar+\', location=\'+Location+\', status=\'+StatusBar+\', menubar=\'+MenuBar+\', resizable=\'+Resizeable+\', scrollbars=\'+ScrollBars;
SiteWindow = window.open(PageURL , "_blank", ""+siteOption+"");
}
';
$scriptRunCarousel = RvsLibs_Scripts::getScriptRunCarousel();
$code .= <<<EOF
jQuery(document).ready(function() {
page = document.location.href ? document.location.href : document.location;
var poiont = jQuery('.rvnavigator a[href="' + page + '"]').parents("li").length;
if (poiont > 0) {
for (i=0;i<=poiont;i++) {
if (page != '') {
jQuery('.rvnavigator a[href="' + page + '"]').parents("li").eq(i).find('a:first').attr('class', 'current');
}
}
}
{$scriptRunCarousel}
});
EOF;
return $code;
}
public static function getIncludeFileReplace($isMember = 0, $fileName = null)
{
SGL::logMessage("getIncludeFileReplace ======> " . $fileName, PEAR_LOG_DEBUG);
$ckMember = '';
if ($isMember == 1) {
$ckMember = <<<EOF
if (class_exists('SGL_Session')) {
if (!SGL_Session::getUid()) {
\$aUrl = array(
'managerName' => 'memberpage',
'moduleName' => 'default',
'page' => urlencode('$fileName')
);
SGL_HTTP::redirect(\$aUrl);
}
}
EOF;
}
$codeInclude = '<?php
if ( is_file( dirname(__FILE__) . "/rvsStaticWeb.php") ) {
include( (dirname(__FILE__) . "/rvsStaticWeb.php") );
}
$_SESSION[\'current_page\'] = basename(__FILE__);
' . $ckMember . '
?>' . "\n";
return $codeInclude;
}
public static function getIncludeSocialNetworkSDK()
{
//get locate เพื่อ set ให้ facebook เรียกได้ตามภาษา ที่ set locale
$langLocale = RvsLibs_Util::getLangLocale($_SESSION['aPrefs']['locale']);
$str = <<<EOF
<div id="fb-root"></div>
<!-- {literal} -->
<script id="scriptBuildFacebook" type="text/javascript">
//<![CDATA[
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.8&appId=362039017157260";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
//]]>
function getFrameFacebook() {
if($('.fb-like-box').find('iframe').get(0) == undefined)
{
recursiveTimeout = setTimeout(function(){getFrameFacebook();},100);
//console.log('undefined')
} else {
//console.log('sucess'+$('.fb-like-box').find('iframe').width()+'='+ fbWidth )
if ($('.fb-like-box').find('iframe').width() != 0) {
$('.fb-like-box').find('iframe').attr('width',fbWidth+'px').css('width',fbWidth);
recursiveTimeout = setTimeout(function(){getFrameFacebook();},100);
$('.fb-like-box').find('iframe').load(function(){
clearTimeout(recursiveTimeout); })
} else {
$('.fb-like-box').find('iframe').attr('width',fbWidth+'px').css('width',fbWidth);
}
}
}
$(document).ready(function(){
var recursiveDetectWidth = setTimeout(function(){
detectWidthFacebook();
},500);
function detectWidthFacebook(){
if($('div.fbFanPageBlock').find('iframe').prop('tagName') == undefined){
recursiveDetectWidth = setTimeout(function(){
detectWidthFacebook();
},500);
}else{
var fbWidth = $('div.fbFanPageBlock').find('div[data-width]').attr('data-width');
var fBody = $('div.fbFanPageBlock').find('iframe');
fBody.load(function(){
$(this).css('width',fbWidth);
})
}
}
});
</script>
<!-- {/literal} -->
EOF;
return $str;
}
public static function getLikeBoxScript($aOption, $scriptType='HTML')
{
$str = '';
switch ($scriptType)
{
case 'HTML':
$str = <<<EOF
<div class="fb-like-box" data-href="{$aOption['pageurl']}" data-width="{$aOption['width']}"
data-height="{$aOption['height']}" data-show-faces="{$aOption['showfaces']}"
data-colorscheme="{$aOption['colorscheme']}" data-stream="{$aOption['stream']}"
data-header="{$aOption['header']}"></div>
EOF;
break;
case 'IMG':
$id = RvsLibs_String::genUniqueId();
$src = PUBLIC_IMG_V5_URL . "/spacer.gif";
$bgColor = $aOption['colorscheme'] == 'light' ? '#ffffff' : '#333333';
$str = <<<EOF
<img alt="facebook fanpage box" id="fblikebox_{$id}" name="fblikebox_{$id}"
src="{$src}" width="292" height="450" border="1" class="fbLikebox"
data-href="{$aOption['pageurl']}" data-width="{$aOption['width']}"
data-height="{$aOption['height']}" data-show-faces="{$aOption['showfaces']}"
data-colorscheme="{$aOption['colorscheme']}" data-stream="{$aOption['stream']}"
data-header="{$aOption['header']}" style="background-color: {$bgColor}"/>
EOF;
break;
}
return $str;
}
public static function getLikeScript($aOption, $scriptType='HTML')
{
$str = '';
switch ($scriptType)
{
case 'HTML':
$str = <<<EOF
<div class="fb-like" data-send="true" data-layout="{$aOption['layout']}"
data-width="450" data-show-faces="true"
data-colorscheme="{$aOption['colorscheme']}" data-font="verdana"></div>
EOF;
break;
case 'IMG':
$id = RvsLibs_String::genUniqueId();
$src = PUBLIC_IMG_V5_URL . "/spacer.gif";
$str = <<<EOF
<img alt="facebook like" id="fblike_{$id}" name="fblike_{$id}"
src="{$src}" border="1" class="fbLikebutton fb_{$aOption['colorscheme']}_{$aOption['layout']}"
data-send="true" data-layout="{$aOption['layout']}" data-width="450" data-show-faces="true"
data-colorscheme="{$aOption['colorscheme']}" data-font="verdana" />
EOF;
break;
}
return $str;
}
public static function getFbCommentScript($aOption, $scriptType='HTML')
{
$str = '';
switch ($scriptType)
{
case 'HTML':
$str = <<<EOF
<div class="fb-comments" data-href="http://example.com" data-num-posts="{$aOption['commentpost']}"
data-width="{$aOption['width']}" data-colorscheme="{$aOption['colorscheme']}"></div>
EOF;
break;
case 'IMG':
$id = RvsLibs_String::genUniqueId();
$src = PUBLIC_IMG_V5_URL . "/spacer.gif";
$imgClass = 'fbComment';
$bgColor = $aOption['colorscheme'] == 'light' ? '#ffffff' : '#333333';
//$imgClass = $aOption['colorscheme'] == 'light' ? 'fbCommentLight' : 'fbCommentDark';
$str = <<<EOF
<img alt="facebook comment" id="fbcomment_{$id}" name="fbcomment_{$id}" data-pageid="{$aOption['pageId']}"
src="{$src}" width="470" height="300" border="1" class="{$imgClass}"
data-num-posts="{$aOption['commentpost']}" data-width="{$aOption['width']}" data-colorscheme="{$aOption['colorscheme']}" style="background-color: {$bgColor};" />
EOF;
break;
}
return $str;
}
/**
* get call scripts carousel onready
$(document).ready(function() {
{$header}
});
without open/end <script></script>
<script type="text/javascript">
</script>
* @return unknown_type
*/
public static function getScriptRunCarousel()
{return '';
$header = '';
$isRunCarousel = RvsLibs_Template::isRunCarousel();
SGL::logMessage("SB== getScriptRunCarousel =" . $isRunCarousel, PEAR_LOG_DEBUG);
if ($isRunCarousel) {
$effect = RvsLibs_Config::getHeaderBannerEffect('effect');
$effecttime = RvsLibs_Config::getHeaderBannerEffect('effecttime')*1000;
$header = <<<EOF
$('.rslides').responsiveSlides({
speed: {$effecttime},
pause: true
});
EOF;
}
return $header;
}
}
}
?>
Copyright 2K16 - 2K18 Indonesian Hacker Rulez