first commit

This commit is contained in:
alazhar
2020-01-02 23:15:16 +07:00
commit eda9661806
3433 changed files with 595883 additions and 0 deletions

BIN
wp-content/plugins/revslider/.DS_Store vendored Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,615 @@
.edit_slide_wrapper .timeline {
width:410px;
height:10px;
background:url(../images/timeline.png) repeat-x 0px 0px;
position:relative;
margin:20px 20px 40px;
z-index:10;
}
.slide_layer .icon_cross{
background-image:url(../images/cross.png);
width:24px;
height:24px;
background-repeat:no-repeat;
position:absolute;
top:0px;
left:0px;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
-moz-opacity: 0.0;
-khtml-opacity: 0.0;
opacity: 0.0;
}
.layer_selected .icon_cross {
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=8)";
filter: alpha(opacity=8);
-moz-opacity: 0.8;
-khtml-opacity: 0.8;
opacity: 0.8;
}
.edit_slide_wrapper .timeline .mintime {
font-color:#777;
font-size:10px;
position:absolute;
top:20px;
left:-20px;
white-space:no-wrap;
width:40px; text-align:center;
}
.edit_slide_wrapper .layertime {
position:absolute;
top:1px;
height:9px;
background:rgba(60,147,154,0.4);
xwidth:300px;left:10px;
display:none;
}
.edit_slide_wrapper .layertime.layertime-error{
background:rgba(157,23,23,0.4);
}
.edit_slide_wrapper .timeline .maxtime {
font-color:#777;
font-size:10px;
position:absolute;
top:20px;
white-space:no-wrap;
width:40px; text-align:center;
right:-20px;
}
.list-settings hr { width:100%;
clear:both;
border-top: 1px solid #DDD;
border-bottom: 1px solid white;
margin-bottom:0px;
}
span.setting_text { line-height:24px;}
span.setting_text_2 { color:#ACA899;
line-height: 10px;
font-size: 11px;
}
.edit_slide_wrapper .attribute_title {
clear:both;padding-bottom:0px !important;
}
/************************************************************/
.edit_layers_left{
width:450px;
float:left;
}
.edit_layers_right{
width:450px;
float:left;
margin-left:20px;
}
#link_slider_settings{
font-size:18px;
padding-left:50px;
}
.edit_slide_wrapper .slide_layers{
border:1px solid black;
overflow:hidden;
background-position:center center;
background-repeat:no-repeat;
position:relative;
float:left;
background-size:cover;
}
.slide_layers.trans_bg{
background-image:url(../images/trans_tile2.png) !important;
background-repeat:repeat !important;
background-size:cover;
background-size:auto !important;
}
.edit_slide_wrapper .caption{
font-weight:bold;
}
.slide_layers .slide_layer{
position:absolute;
white-space:nowrap;
}
/* video layer */
.slide_layer .slide_layer_video{
background-color:black;
position:relative;
background-repeat:no-repeat;
background-position:center center;
}
.slide_layer .video-layer-inner{
height:100%;
width:100%;
background-repeat:no-repeat;
background-position:right bottom;
}
.slide_layer .video-icon-youtube{
background-image:url(../images/icon_youtube.png);
}
.slide_layer .video-icon-vimeo{
background-image:url(../images/icon_vimeo.png);
}
.slide_layer .video-icon-html5{
background-image:url(../images/icon_html5.png);
}
.slide_layer_video .layer-video-title{
color:white;
padding:10px;
text-align:center;
}
.ui-draggable{
cursor:move;
}
.edit_layers_left .area-layer-params{
width:415px;
height:80px;
}
.edit_layers_left .textbox-caption{
width:170px;
}
#layer_captions_down{
margin-top:1px;
width:26px;
height:21px;
float:left;
cursor:pointer;
}
#layer_captions_down span{
margin-top:2px;
margin-left:5px;
}
#button_edit_css{
float:right;
margin-right:10px;
}
.edit_layers_left .setting_text{
min-width:60px;
}
.edit_layers_left .text-disabled{
color:#ACA899;
}
#divLayers .layer_selected{
/* glow on selected */
box-shadow: 0 0 8px #DDE573;
-webkit-box-shadow: 0 0 8px #DDE573;
-moz-box-shadow: 0 0 8px #DDE573;
}
.layer_sortbox{
width:460px;
min-height:266px;
}
.layer_sortbox input.sortbox_time, /* sortbox inputboxes */
.layer_sortbox input.sortbox_depth
{
float:right;
width:40px;
background-color:#EBEBEB;
border:1px solid #E0E0E0;
color:#04076A;
}
.layer_sortbox input.sortbox_depth{
width:28px;
cursor:default;
}
.layer_sortbox .sortbox_eye{
width:20px;
height:14px;
background:url(../images/eyes.png) no-repeat;
float:right;
margin-top:5px;
margin-left:3px;
margin-right:3px;
cursor:pointer;
}
.sortlist li.sortitem-hidden .sortbox_eye{
/* IE 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
/* IE 5-7 */
filter: alpha(opacity=50);
/* Netscape */
-moz-opacity: 0.5;
/* Safari 1.x */
-khtml-opacity: 0.5;
/* Good browsers */
opacity: 0.5;
}
.sortlist li.sortitem-hidden .sortbox_text{
color:#B9A8B9;
}
.sortlist li.sortitem-hidden{
background-image:none;
background-color:#FFF0E6;
}
.sortlist{
padding:0px;
margin:0px;
}
.sortlist li span.ui-icon{
float:right;
margin-top:4px;
}
.sortlist li{
padding-left:4px;
cursor:move;
min-height:17px;
}
.sortlist li .sortbox_text{
display:block;
float:left;
padding-top:4px;
padding-bottom:4px;
}
/* ------ Layer Sorting Button ---- */
#button_sort_visibility{
width:20px;
height:14px;
background:url(../images/eyes.png) no-repeat;
cursor:pointer;
float:right;
margin-top:5px;
margin-right:5px;
margin-left:3px;
}
#button_sort_visibility.e-disabled {
/* IE 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
/* IE 5-7 */
filter: alpha(opacity=50);
/* Netscape */
-moz-opacity: 0.5;
/* Safari 1.x */
-khtml-opacity: 0.5;
/* Good browsers */
opacity: 0.5;
}
.layer_sortbox .button_sorttype{
width:70px;
float:right;
height:20px;
text-align:center;
margin-right:10px;
margin-top:2px;
}
.layer_sortbox .button_sorttype.ui-state-hover{
cursor:pointer;
}
.layer_sortbox .button_sorttype.ui-state-active{
cursor:default;
}
.layer_sortbox .button_sorttype span{
display:block;
padding:0px;
margin:0px;
float:none;
margin-top:3px;
text-align:center;
}
.slide_update_button_wrapper{
float:left;
width:110px;
}
.slider_update_button_wrapper{
float:left;
width:115px;
margin-top:2px;
}
.slide_update_button_wrapper div{
float:left;
}
#button_save_slide{
display:block;
width:73px;
margin:0px;
float:left;
}
#button_close_slide{
display:block;
float:left;
}
.edit_layers_left .list_settings li .setting_text{
min-width:70px;
}
.setting-disabled{
color:#B9A8B9;
}
#layer_caption.setting-disabled{
color:#B9A8B9;
}
/* ============================================= */
/* Layer Form Position */
/* ============================================= */
#layer_left_row{
float:left;
}
#layer_left_row .setting_text,
#layer_top_row .setting_text{
min-width:10px;
width:10px;
}
#layer_top_row{
float:left;
margin-left:15px;
}
#button_edit_video_row{
float:left;
margin-right:10px;
clear:left;
}
#button_change_image_source_row{
float:left;
margin-right:10px;
clear:both;
}
#button_edit_video{
cursor:pointer;
}
#layer_animation_row{
clear:both;
float:left;
}
#layer_easing_row{
float:right;
margin-right:10px;
}
#layer_easing_row .setting_text{
min-width:50px;
width:50px;
}
#layer_hidden_row{
float:left;
margin-left:0px;
}
#layer_speed_row{
clear:left;
float:left;
}
#layer_slide_link_row{
clear:both;
}
#linkInsertButton{
float:right;
margin-right:8px;
padding:0px;
padding-bottom:2px;
font-size:11px;
text-decoration:none;
cursor:pointer;
}
#linkInsertButton.disabled{
color:#ACA899;
cursor:default;
}
.list-buttons li{
float:left;
margin-left:10px;
}
/* ============================================= */
/* End Params Layer Form Part */
/* ============================================= */
.link_show_params{
margin-left:70px;
}
.link_show_advanced_params{
margin-left:20px;
}
.link_show_params.button-selected{
color:green;
}
#layer_endtime_row{
}
#layer_endanimation_row{
float:left;
}
#layer_endeasing_row{
float:right;
xmargin-right:10px;
}
#layer_endeasing_row .setting_text{
width:50px;
min-width:50px;
}
#layer_endtime_row{
float:left;
margin-left: 78px;
}
#layer_endspeed_row{
float:left;
clear:left;
}
#layer_cornerleft_row{
float:left;
}
#layer_cornerright_row{
float:right;
margin-right:10px;
}
/* ============================================= */
/* Align Table */
/* ============================================= */
.align_table_wrapper{
clear:both;
float:left;
margin-right:20px;
}
.align_table{
table-collapse:collapse;
}
.align_table td{
border:1px solid black;
padding:2px;
}
.align_table td a{
text-decoration:none;
display:block;
width:20px;
height:20px;
background-color:#888;
}
.align_table td a:hover{
background-color:#cfcfcf;
}
.align_table td a.selected{
background-color:#cfcfcf;
cursor:default;
}
.align_table td a.selected:hover{
cursor:default;
background-color:#cfcfcf;
}
.align_table.table_disabled td{
border:1px solid #ACACAC;
}
.align_table.table_disabled td a{
background-color:#ACACAC;
cursor:default;
}
.align_table.table_disabled td a:hover{
background-color:#ACACAC;
}
/******************************
- SPECIALS -
********************************/
.tp-closedatstart { display:none;}
#layer_link_open_in_row { float:left;}
.depthselected .sortbox_time { -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
filter: alpha(opacity=50);
-moz-opacity: 0.5;
-khtml-opacity: 0.5;
opacity: 0.5;
}
.timeselected .sortbox_depth { -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
filter: alpha(opacity=50);
-moz-opacity: 0.5;
-khtml-opacity: 0.5;
opacity: 0.5;
}
.timeselected .sortbox_time,
.depthselected .sortbox_depth { background:#fff !important;}

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -0,0 +1,462 @@
/*! jQuery UI - v1.9.2 - 2012-12-05
* http://jqueryui.com
* Includes: jquery.ui.core.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
* Copyright (c) 2012 jQuery Foundation and other contributors Licensed MIT */
/* Layout helpers
----------------------------------*/
.ui-helper-hidden { display: none; }
.ui-helper-hidden-accessible { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
.ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; }
.ui-helper-clearfix:after { clear: both; }
.ui-helper-clearfix { zoom: 1; }
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
/* Interaction Cues
----------------------------------*/
.ui-state-disabled { cursor: default !important; }
/* Icons
----------------------------------*/
/* states and images */
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
/* Misc visuals
----------------------------------*/
/* Overlays */
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.ui-resizable { position: relative;}
.ui-resizable-handle { position: absolute;font-size: 0.1px; display: block; }
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
.ui-accordion .ui-accordion-header { display: block; cursor: pointer; position: relative; margin-top: 2px; padding: .5em .5em .5em .7em; zoom: 1; }
.ui-accordion .ui-accordion-icons { padding-left: 2.2em; }
.ui-accordion .ui-accordion-noicons { padding-left: .7em; }
.ui-accordion .ui-accordion-icons .ui-accordion-icons { padding-left: 2.2em; }
.ui-accordion .ui-accordion-header .ui-accordion-header-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; overflow: auto; zoom: 1; }
.ui-autocomplete {
position: absolute;
top: 0;
left: 0;
cursor: default;
}
/* workarounds */
* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
.ui-button, .ui-button:link, .ui-button:visited, .ui-button:hover, .ui-button:active { text-decoration: none; }
.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
.ui-button-icons-only { width: 3.4em; }
button.ui-button-icons-only { width: 3.7em; }
/*button text element */
.ui-button .ui-button-text { display: block; line-height: 1.4; }
.ui-button-text-only .ui-button-text { padding: .4em 1em; }
.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
/* no icon support for input elements, provide padding by default */
input.ui-button { padding: .4em 1em; }
/*button icon element(s) */
.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
/*button sets*/
.ui-buttonset { margin-right: 7px; }
.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
/* workarounds */
button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
.ui-datepicker .ui-datepicker-prev { left:2px; }
.ui-datepicker .ui-datepicker-next { right:2px; }
.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
.ui-datepicker .ui-datepicker-next-hover { right:1px; }
.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
.ui-datepicker select.ui-datepicker-month,
.ui-datepicker select.ui-datepicker-year { width: 49%;}
.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
.ui-datepicker td { border: 0; padding: 1px; }
.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
/* with multiple calendars */
.ui-datepicker.ui-datepicker-multi { width:auto; }
.ui-datepicker-multi .ui-datepicker-group { float:left; }
.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
/* RTL support */
.ui-datepicker-rtl { direction: rtl; }
.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
.ui-datepicker-rtl .ui-datepicker-group { float:right; }
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
.ui-datepicker-cover {
position: absolute; /*must have*/
z-index: -1; /*must have*/
filter: mask(); /*must have*/
top: -4px; /*must have*/
left: -4px; /*must have*/
width: 200px; /*must have*/
height: 200px; /*must have*/
}.ui-dialog { position: absolute; top: 0; left: 0; padding: .2em; width: 300px; overflow: hidden; }
.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
.ui-draggable .ui-dialog-titlebar { cursor: move; }
.ui-menu { list-style:none; padding: 2px; margin: 0; display:block; outline: none; }
.ui-menu .ui-menu { margin-top: -3px; position: absolute; }
.ui-menu .ui-menu-item { margin: 0; padding: 0; zoom: 1; width: 100%; }
.ui-menu .ui-menu-divider { margin: 5px -2px 5px -2px; height: 0; font-size: 0; line-height: 0; border-width: 1px 0 0 0; }
.ui-menu .ui-menu-item a { text-decoration: none; display: block; padding: 2px .4em; line-height: 1.5; zoom: 1; font-weight: normal; }
.ui-menu .ui-menu-item a.ui-state-focus,
.ui-menu .ui-menu-item a.ui-state-active { font-weight: normal; margin: -1px; }
.ui-menu .ui-state-disabled { font-weight: normal; margin: .4em 0 .2em; line-height: 1.5; }
.ui-menu .ui-state-disabled a { cursor: default; }
/* icon support */
.ui-menu-icons { position: relative; }
.ui-menu-icons .ui-menu-item a { position: relative; padding-left: 2em; }
/* left-aligned */
.ui-menu .ui-icon { position: absolute; top: .2em; left: .2em; }
/* right-aligned */
.ui-menu .ui-menu-icon { position: static; float: right; }
.ui-progressbar { height:2em; text-align: left; overflow: hidden; }
.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }.ui-slider { position: relative; text-align: left; }
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
.ui-slider-horizontal { height: .8em; }
.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
.ui-slider-horizontal .ui-slider-range-min { left: 0; }
.ui-slider-horizontal .ui-slider-range-max { right: 0; }
.ui-slider-vertical { width: .8em; height: 100px; }
.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
.ui-slider-vertical .ui-slider-range-max { top: 0; }.ui-spinner { position:relative; display: inline-block; overflow: hidden; padding: 0; vertical-align: middle; }
.ui-spinner-input { border: none; background: none; padding: 0; margin: .2em 0; vertical-align: middle; margin-left: .4em; margin-right: 22px; }
.ui-spinner-button { width: 16px; height: 50%; font-size: .5em; padding: 0; margin: 0; text-align: center; position: absolute; cursor: default; display: block; overflow: hidden; right: 0; }
.ui-spinner a.ui-spinner-button { border-top: none; border-bottom: none; border-right: none; } /* more specificity required here to overide default borders */
.ui-spinner .ui-icon { position: absolute; margin-top: -8px; top: 50%; left: 0; } /* vertical centre icon */
.ui-spinner-up { top: 0; }
.ui-spinner-down { bottom: 0; }
/* TR overrides */
.ui-spinner .ui-icon-triangle-1-s {
/* need to fix icons sprite */
background-position:-65px -16px;
}
.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 0; margin: 1px .2em 0 0; border-bottom: 0; padding: 0; white-space: nowrap; }
.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
.ui-tabs .ui-tabs-nav li.ui-tabs-active { margin-bottom: -1px; padding-bottom: 1px; }
.ui-tabs .ui-tabs-nav li.ui-tabs-active a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-tabs-loading a { cursor: text; }
.ui-tabs .ui-tabs-nav li a, .ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
.ui-tooltip {
padding: 8px;
position: absolute;
z-index: 9999;
max-width: 300px;
-webkit-box-shadow: 0 0 5px #aaa;
box-shadow: 0 0 5px #aaa;
}
/* Fades and background-images don't work well together in IE6, drop the image */
* html .ui-tooltip {
background-image: none;
}
body .ui-tooltip { border-width: 2px; }
/* Component containers
----------------------------------*/
.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
.ui-widget .ui-widget { font-size: 1em; }
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
.ui-widget-content a { color: #222222; }
.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
.ui-widget-header a { color: #222222; }
/* Interaction states
----------------------------------*/
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
.ui-state-hover a, .ui-state-hover a:hover, .ui-state-hover a:link, .ui-state-hover a:visited { color: #212121; text-decoration: none; }
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
/* Interaction Cues
----------------------------------*/
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
.ui-state-disabled .ui-icon { filter:Alpha(Opacity=35); } /* For IE8 - See #6059 */
/* Icons
----------------------------------*/
/* states and images */
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); }
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
/* positioning */
.ui-icon-carat-1-n { background-position: 0 0; }
.ui-icon-carat-1-ne { background-position: -16px 0; }
.ui-icon-carat-1-e { background-position: -32px 0; }
.ui-icon-carat-1-se { background-position: -48px 0; }
.ui-icon-carat-1-s { background-position: -64px 0; }
.ui-icon-carat-1-sw { background-position: -80px 0; }
.ui-icon-carat-1-w { background-position: -96px 0; }
.ui-icon-carat-1-nw { background-position: -112px 0; }
.ui-icon-carat-2-n-s { background-position: -128px 0; }
.ui-icon-carat-2-e-w { background-position: -144px 0; }
.ui-icon-triangle-1-n { background-position: 0 -16px; }
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
.ui-icon-triangle-1-e { background-position: -32px -16px; }
.ui-icon-triangle-1-se { background-position: -48px -16px; }
.ui-icon-triangle-1-s { background-position: -64px -16px; }
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
.ui-icon-triangle-1-w { background-position: -96px -16px; }
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
.ui-icon-arrow-1-n { background-position: 0 -32px; }
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
.ui-icon-arrow-1-e { background-position: -32px -32px; }
.ui-icon-arrow-1-se { background-position: -48px -32px; }
.ui-icon-arrow-1-s { background-position: -64px -32px; }
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
.ui-icon-arrow-1-w { background-position: -96px -32px; }
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
.ui-icon-arrow-4 { background-position: 0 -80px; }
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
.ui-icon-extlink { background-position: -32px -80px; }
.ui-icon-newwin { background-position: -48px -80px; }
.ui-icon-refresh { background-position: -64px -80px; }
.ui-icon-shuffle { background-position: -80px -80px; }
.ui-icon-transfer-e-w { background-position: -96px -80px; }
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
.ui-icon-folder-collapsed { background-position: 0 -96px; }
.ui-icon-folder-open { background-position: -16px -96px; }
.ui-icon-document { background-position: -32px -96px; }
.ui-icon-document-b { background-position: -48px -96px; }
.ui-icon-note { background-position: -64px -96px; }
.ui-icon-mail-closed { background-position: -80px -96px; }
.ui-icon-mail-open { background-position: -96px -96px; }
.ui-icon-suitcase { background-position: -112px -96px; }
.ui-icon-comment { background-position: -128px -96px; }
.ui-icon-person { background-position: -144px -96px; }
.ui-icon-print { background-position: -160px -96px; }
.ui-icon-trash { background-position: -176px -96px; }
.ui-icon-locked { background-position: -192px -96px; }
.ui-icon-unlocked { background-position: -208px -96px; }
.ui-icon-bookmark { background-position: -224px -96px; }
.ui-icon-tag { background-position: -240px -96px; }
.ui-icon-home { background-position: 0 -112px; }
.ui-icon-flag { background-position: -16px -112px; }
.ui-icon-calendar { background-position: -32px -112px; }
.ui-icon-cart { background-position: -48px -112px; }
.ui-icon-pencil { background-position: -64px -112px; }
.ui-icon-clock { background-position: -80px -112px; }
.ui-icon-disk { background-position: -96px -112px; }
.ui-icon-calculator { background-position: -112px -112px; }
.ui-icon-zoomin { background-position: -128px -112px; }
.ui-icon-zoomout { background-position: -144px -112px; }
.ui-icon-search { background-position: -160px -112px; }
.ui-icon-wrench { background-position: -176px -112px; }
.ui-icon-gear { background-position: -192px -112px; }
.ui-icon-heart { background-position: -208px -112px; }
.ui-icon-star { background-position: -224px -112px; }
.ui-icon-link { background-position: -240px -112px; }
.ui-icon-cancel { background-position: 0 -128px; }
.ui-icon-plus { background-position: -16px -128px; }
.ui-icon-plusthick { background-position: -32px -128px; }
.ui-icon-minus { background-position: -48px -128px; }
.ui-icon-minusthick { background-position: -64px -128px; }
.ui-icon-close { background-position: -80px -128px; }
.ui-icon-closethick { background-position: -96px -128px; }
.ui-icon-key { background-position: -112px -128px; }
.ui-icon-lightbulb { background-position: -128px -128px; }
.ui-icon-scissors { background-position: -144px -128px; }
.ui-icon-clipboard { background-position: -160px -128px; }
.ui-icon-copy { background-position: -176px -128px; }
.ui-icon-contact { background-position: -192px -128px; }
.ui-icon-image { background-position: -208px -128px; }
.ui-icon-video { background-position: -224px -128px; }
.ui-icon-script { background-position: -240px -128px; }
.ui-icon-alert { background-position: 0 -144px; }
.ui-icon-info { background-position: -16px -144px; }
.ui-icon-notice { background-position: -32px -144px; }
.ui-icon-help { background-position: -48px -144px; }
.ui-icon-check { background-position: -64px -144px; }
.ui-icon-bullet { background-position: -80px -144px; }
.ui-icon-radio-on { background-position: -96px -144px; }
.ui-icon-radio-off { background-position: -112px -144px; }
.ui-icon-pin-w { background-position: -128px -144px; }
.ui-icon-pin-s { background-position: -144px -144px; }
.ui-icon-play { background-position: 0 -160px; }
.ui-icon-pause { background-position: -16px -160px; }
.ui-icon-seek-next { background-position: -32px -160px; }
.ui-icon-seek-prev { background-position: -48px -160px; }
.ui-icon-seek-end { background-position: -64px -160px; }
.ui-icon-seek-start { background-position: -80px -160px; }
/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
.ui-icon-seek-first { background-position: -80px -160px; }
.ui-icon-stop { background-position: -96px -160px; }
.ui-icon-eject { background-position: -112px -160px; }
.ui-icon-volume-off { background-position: -128px -160px; }
.ui-icon-volume-on { background-position: -144px -160px; }
.ui-icon-power { background-position: 0 -176px; }
.ui-icon-signal-diag { background-position: -16px -176px; }
.ui-icon-signal { background-position: -32px -176px; }
.ui-icon-battery-0 { background-position: -48px -176px; }
.ui-icon-battery-1 { background-position: -64px -176px; }
.ui-icon-battery-2 { background-position: -80px -176px; }
.ui-icon-battery-3 { background-position: -96px -176px; }
.ui-icon-circle-plus { background-position: 0 -192px; }
.ui-icon-circle-minus { background-position: -16px -192px; }
.ui-icon-circle-close { background-position: -32px -192px; }
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
.ui-icon-circle-zoomin { background-position: -176px -192px; }
.ui-icon-circle-zoomout { background-position: -192px -192px; }
.ui-icon-circle-check { background-position: -208px -192px; }
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
.ui-icon-circlesmall-close { background-position: -32px -208px; }
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
.ui-icon-squaresmall-close { background-position: -80px -208px; }
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
/* Misc visuals
----------------------------------*/
/* Corner radius */
.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; }
.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; }
.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
/* Overlays */
.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .3;filter:Alpha(Opacity=30); }
.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .3;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -0,0 +1,565 @@
/*
* jQuery UI CSS Framework 1.8.18
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Theming/API
*/
/* Layout helpers
----------------------------------*/
.ui-helper-hidden { display: none; }
.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
.ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; }
.ui-helper-clearfix:after { clear: both; }
.ui-helper-clearfix { zoom: 1; }
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
/* Interaction Cues
----------------------------------*/
.ui-state-disabled { cursor: default !important; }
/* Icons
----------------------------------*/
/* states and images */
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
/* Misc visuals
----------------------------------*/
/* Overlays */
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
/*
* jQuery UI CSS Framework 1.8.18
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Theming/API
*
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
*/
/* Component containers
----------------------------------*/
.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
.ui-widget .ui-widget { font-size: 1em; }
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
.ui-widget-content a { color: #222222; }
.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
.ui-widget-header a { color: #222222; }
/* Interaction states
----------------------------------*/
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; }
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
.ui-widget :active { outline: none; }
/* Interaction Cues
----------------------------------*/
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
/* Icons
----------------------------------*/
/* states and images */
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); }
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
/* positioning */
.ui-icon-carat-1-n { background-position: 0 0; }
.ui-icon-carat-1-ne { background-position: -16px 0; }
.ui-icon-carat-1-e { background-position: -32px 0; }
.ui-icon-carat-1-se { background-position: -48px 0; }
.ui-icon-carat-1-s { background-position: -64px 0; }
.ui-icon-carat-1-sw { background-position: -80px 0; }
.ui-icon-carat-1-w { background-position: -96px 0; }
.ui-icon-carat-1-nw { background-position: -112px 0; }
.ui-icon-carat-2-n-s { background-position: -128px 0; }
.ui-icon-carat-2-e-w { background-position: -144px 0; }
.ui-icon-triangle-1-n { background-position: 0 -16px; }
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
.ui-icon-triangle-1-e { background-position: -32px -16px; }
.ui-icon-triangle-1-se { background-position: -48px -16px; }
.ui-icon-triangle-1-s { background-position: -64px -16px; }
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
.ui-icon-triangle-1-w { background-position: -96px -16px; }
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
.ui-icon-arrow-1-n { background-position: 0 -32px; }
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
.ui-icon-arrow-1-e { background-position: -32px -32px; }
.ui-icon-arrow-1-se { background-position: -48px -32px; }
.ui-icon-arrow-1-s { background-position: -64px -32px; }
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
.ui-icon-arrow-1-w { background-position: -96px -32px; }
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
.ui-icon-arrow-4 { background-position: 0 -80px; }
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
.ui-icon-extlink { background-position: -32px -80px; }
.ui-icon-newwin { background-position: -48px -80px; }
.ui-icon-refresh { background-position: -64px -80px; }
.ui-icon-shuffle { background-position: -80px -80px; }
.ui-icon-transfer-e-w { background-position: -96px -80px; }
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
.ui-icon-folder-collapsed { background-position: 0 -96px; }
.ui-icon-folder-open { background-position: -16px -96px; }
.ui-icon-document { background-position: -32px -96px; }
.ui-icon-document-b { background-position: -48px -96px; }
.ui-icon-note { background-position: -64px -96px; }
.ui-icon-mail-closed { background-position: -80px -96px; }
.ui-icon-mail-open { background-position: -96px -96px; }
.ui-icon-suitcase { background-position: -112px -96px; }
.ui-icon-comment { background-position: -128px -96px; }
.ui-icon-person { background-position: -144px -96px; }
.ui-icon-print { background-position: -160px -96px; }
.ui-icon-trash { background-position: -176px -96px; }
.ui-icon-locked { background-position: -192px -96px; }
.ui-icon-unlocked { background-position: -208px -96px; }
.ui-icon-bookmark { background-position: -224px -96px; }
.ui-icon-tag { background-position: -240px -96px; }
.ui-icon-home { background-position: 0 -112px; }
.ui-icon-flag { background-position: -16px -112px; }
.ui-icon-calendar { background-position: -32px -112px; }
.ui-icon-cart { background-position: -48px -112px; }
.ui-icon-pencil { background-position: -64px -112px; }
.ui-icon-clock { background-position: -80px -112px; }
.ui-icon-disk { background-position: -96px -112px; }
.ui-icon-calculator { background-position: -112px -112px; }
.ui-icon-zoomin { background-position: -128px -112px; }
.ui-icon-zoomout { background-position: -144px -112px; }
.ui-icon-search { background-position: -160px -112px; }
.ui-icon-wrench { background-position: -176px -112px; }
.ui-icon-gear { background-position: -192px -112px; }
.ui-icon-heart { background-position: -208px -112px; }
.ui-icon-star { background-position: -224px -112px; }
.ui-icon-link { background-position: -240px -112px; }
.ui-icon-cancel { background-position: 0 -128px; }
.ui-icon-plus { background-position: -16px -128px; }
.ui-icon-plusthick { background-position: -32px -128px; }
.ui-icon-minus { background-position: -48px -128px; }
.ui-icon-minusthick { background-position: -64px -128px; }
.ui-icon-close { background-position: -80px -128px; }
.ui-icon-closethick { background-position: -96px -128px; }
.ui-icon-key { background-position: -112px -128px; }
.ui-icon-lightbulb { background-position: -128px -128px; }
.ui-icon-scissors { background-position: -144px -128px; }
.ui-icon-clipboard { background-position: -160px -128px; }
.ui-icon-copy { background-position: -176px -128px; }
.ui-icon-contact { background-position: -192px -128px; }
.ui-icon-image { background-position: -208px -128px; }
.ui-icon-video { background-position: -224px -128px; }
.ui-icon-script { background-position: -240px -128px; }
.ui-icon-alert { background-position: 0 -144px; }
.ui-icon-info { background-position: -16px -144px; }
.ui-icon-notice { background-position: -32px -144px; }
.ui-icon-help { background-position: -48px -144px; }
.ui-icon-check { background-position: -64px -144px; }
.ui-icon-bullet { background-position: -80px -144px; }
.ui-icon-radio-off { background-position: -96px -144px; }
.ui-icon-radio-on { background-position: -112px -144px; }
.ui-icon-pin-w { background-position: -128px -144px; }
.ui-icon-pin-s { background-position: -144px -144px; }
.ui-icon-play { background-position: 0 -160px; }
.ui-icon-pause { background-position: -16px -160px; }
.ui-icon-seek-next { background-position: -32px -160px; }
.ui-icon-seek-prev { background-position: -48px -160px; }
.ui-icon-seek-end { background-position: -64px -160px; }
.ui-icon-seek-start { background-position: -80px -160px; }
/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
.ui-icon-seek-first { background-position: -80px -160px; }
.ui-icon-stop { background-position: -96px -160px; }
.ui-icon-eject { background-position: -112px -160px; }
.ui-icon-volume-off { background-position: -128px -160px; }
.ui-icon-volume-on { background-position: -144px -160px; }
.ui-icon-power { background-position: 0 -176px; }
.ui-icon-signal-diag { background-position: -16px -176px; }
.ui-icon-signal { background-position: -32px -176px; }
.ui-icon-battery-0 { background-position: -48px -176px; }
.ui-icon-battery-1 { background-position: -64px -176px; }
.ui-icon-battery-2 { background-position: -80px -176px; }
.ui-icon-battery-3 { background-position: -96px -176px; }
.ui-icon-circle-plus { background-position: 0 -192px; }
.ui-icon-circle-minus { background-position: -16px -192px; }
.ui-icon-circle-close { background-position: -32px -192px; }
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
.ui-icon-circle-zoomin { background-position: -176px -192px; }
.ui-icon-circle-zoomout { background-position: -192px -192px; }
.ui-icon-circle-check { background-position: -208px -192px; }
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
.ui-icon-circlesmall-close { background-position: -32px -208px; }
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
.ui-icon-squaresmall-close { background-position: -80px -208px; }
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
/* Misc visuals
----------------------------------*/
/* Corner radius */
.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; }
.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; }
.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
/* Overlays */
.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*
* jQuery UI Resizable 1.8.18
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Resizable#theming
*/
.ui-resizable { position: relative;}
.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; }
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*
* jQuery UI Selectable 1.8.18
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Selectable#theming
*/
.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
/*
* jQuery UI Accordion 1.8.18
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Accordion#theming
*/
/* IE/Win - Fix animation bug - #4615 */
.ui-accordion { width: 100%; }
.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
.ui-accordion .ui-accordion-li-fix { display: inline; }
.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
.ui-accordion .ui-accordion-content-active { display: block; }
/*
* jQuery UI Autocomplete 1.8.18
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Autocomplete#theming
*/
.ui-autocomplete { position: absolute; cursor: default; }
/* workarounds */
* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
/*
* jQuery UI Menu 1.8.18
*
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Menu#theming
*/
.ui-menu {
list-style:none;
padding: 2px;
margin: 0;
display:block;
float: left;
}
.ui-menu .ui-menu {
margin-top: -3px;
}
.ui-menu .ui-menu-item {
margin:0;
padding: 0;
zoom: 1;
float: left;
clear: left;
width: 100%;
}
.ui-menu .ui-menu-item a {
text-decoration:none;
display:block;
padding:.2em .4em;
line-height:1.5;
zoom:1;
}
.ui-menu .ui-menu-item a.ui-state-hover,
.ui-menu .ui-menu-item a.ui-state-active {
font-weight: normal;
margin: -1px;
}
/*
* jQuery UI Button 1.8.18
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Button#theming
*/
.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: hidden; *overflow: visible; } /* the overflow property removes extra width in IE */
.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
.ui-button-icons-only { width: 3.4em; }
button.ui-button-icons-only { width: 3.7em; }
/*button text element */
.ui-button .ui-button-text { display: block; line-height: 1.4; }
.ui-button-text-only .ui-button-text { padding: .4em 1em; }
.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
/* no icon support for input elements, provide padding by default */
input.ui-button { padding: .4em 1em; }
/*button icon element(s) */
.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
/*button sets*/
.ui-buttonset { margin-right: 7px; }
.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
/* workarounds */
button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
/*
* jQuery UI Dialog 1.8.18
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Dialog#theming
*/
.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
.ui-draggable .ui-dialog-titlebar { cursor: move; }
/*
* jQuery UI Slider 1.8.18
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Slider#theming
*/
.ui-slider { position: relative; text-align: left; }
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
.ui-slider-horizontal { height: .8em; }
.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
.ui-slider-horizontal .ui-slider-range-min { left: 0; }
.ui-slider-horizontal .ui-slider-range-max { right: 0; }
.ui-slider-vertical { width: .8em; height: 100px; }
.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
.ui-slider-vertical .ui-slider-range-max { top: 0; }/*
* jQuery UI Tabs 1.8.18
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Tabs#theming
*/
.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
.ui-tabs .ui-tabs-hide { display: none !important; }
/*
* jQuery UI Datepicker 1.8.18
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Datepicker#theming
*/
.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
.ui-datepicker .ui-datepicker-prev { left:2px; }
.ui-datepicker .ui-datepicker-next { right:2px; }
.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
.ui-datepicker .ui-datepicker-next-hover { right:1px; }
.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
.ui-datepicker select.ui-datepicker-month,
.ui-datepicker select.ui-datepicker-year { width: 49%;}
.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
.ui-datepicker td { border: 0; padding: 1px; }
.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
/* with multiple calendars */
.ui-datepicker.ui-datepicker-multi { width:auto; }
.ui-datepicker-multi .ui-datepicker-group { float:left; }
.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
/* RTL support */
.ui-datepicker-rtl { direction: rtl; }
.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
.ui-datepicker-rtl .ui-datepicker-group { float:right; }
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
.ui-datepicker-cover {
display: none; /*sorry for IE5*/
display/**/: block; /*sorry for IE5*/
position: absolute; /*must have*/
z-index: -1; /*must have*/
filter: mask(); /*must have*/
top: -4px; /*must have*/
left: -4px; /*must have*/
width: 200px; /*must have*/
height: 200px; /*must have*/
}/*
* jQuery UI Progressbar 1.8.18
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Progressbar#theming
*/
.ui-progressbar { height:2em; text-align: left; overflow: hidden; }
.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }

View File

@ -0,0 +1,12 @@
.tipsy { padding: 5px; font-size: 10px; position: absolute; z-index: 100000; }
.tipsy-inner { padding: 5px 8px 4px 8px; background-color: black; color: white; max-width: 200px; text-align: center; }
.tipsy-inner { border-radius: 3px; -moz-border-radius:3px; -webkit-border-radius:3px; }
.tipsy-arrow { position: absolute; background: url('../images/tipsy.gif') no-repeat top left; width: 9px; height: 5px; }
.tipsy-n .tipsy-arrow { top: 0; left: 50%; margin-left: -4px; }
.tipsy-nw .tipsy-arrow { top: 0; left: 10px; }
.tipsy-ne .tipsy-arrow { top: 0; right: 10px; }
.tipsy-s .tipsy-arrow { bottom: 0; left: 50%; margin-left: -4px; background-position: bottom left; }
.tipsy-sw .tipsy-arrow { bottom: 0; left: 10px; background-position: bottom left; }
.tipsy-se .tipsy-arrow { bottom: 0; right: 10px; background-position: bottom left; }
.tipsy-e .tipsy-arrow { top: 50%; margin-top: -4px; right: 0; width: 5px; height: 9px; background-position: top right; }
.tipsy-w .tipsy-arrow { top: 50%; margin-top: -4px; left: 0; width: 5px; height: 9px; }

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 690 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 691 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 772 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 951 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 B

View File

@ -0,0 +1,308 @@
<?php
class UniteBaseClassRev{
protected static $wpdb;
protected static $table_prefix;
protected static $mainFile;
protected static $t;
protected static $dir_plugin;
protected static $dir_languages;
public static $url_plugin;
protected static $url_ajax;
public static $url_ajax_actions;
protected static $url_ajax_showimage;
protected static $path_settings;
protected static $path_plugin;
protected static $path_languages;
protected static $path_temp;
protected static $path_views;
protected static $path_templates;
protected static $path_cache;
protected static $path_base;
protected static $is_multisite;
protected static $debugMode = false;
/**
*
* the constructor
*/
public function __construct($mainFile,$t){
global $wpdb;
self::$is_multisite = UniteFunctionsWPRev::isMultisite();
self::$wpdb = $wpdb;
self::$table_prefix = self::$wpdb->base_prefix;
if(UniteFunctionsWPRev::isMultisite()){
$blogID = UniteFunctionsWPRev::getBlogID();
if($blogID != 1){
self::$table_prefix .= $blogID."_";
}
}
self::$mainFile = $mainFile;
self::$t = $t;
//set plugin dirname (as the main filename)
$info = pathinfo($mainFile);
$baseName = $info["basename"];
$filename = str_replace(".php","",$baseName);
self::$dir_plugin = $filename;
self::$url_plugin = plugins_url(self::$dir_plugin)."/";
self::$url_ajax = admin_url("admin-ajax.php");
self::$url_ajax_actions = self::$url_ajax . "?action=".self::$dir_plugin."_ajax_action";
self::$url_ajax_showimage = self::$url_ajax . "?action=".self::$dir_plugin."_show_image";
self::$path_plugin = dirname(self::$mainFile)."/";
self::$path_settings = self::$path_plugin."settings/";
self::$path_temp = self::$path_plugin."temp/";
//set cache path:
self::setPathCache();
self::$path_views = self::$path_plugin."views/";
self::$path_templates = self::$path_views."/templates/";
self::$path_base = ABSPATH;
self::$path_languages = self::$path_plugin."languages/";
self::$dir_languages = self::$dir_plugin."/languages/";
load_plugin_textdomain(self::$dir_plugin,false,self::$dir_languages);
//update globals oldversion flag
GlobalsRevSlider::$isNewVersion = false;
$version = get_bloginfo("version");
$version = (double)$version;
if($version >= 3.5)
GlobalsRevSlider::$isNewVersion = true;
}
/**
*
* set cache path for images. for multisite it will be current blog content folder
*/
private static function setPathCache(){
self::$path_cache = self::$path_plugin."cache/";
if(self::$is_multisite){
if(!defined("BLOGUPLOADDIR") || !is_dir(BLOGUPLOADDIR))
return(false);
$path = BLOGUPLOADDIR.self::$dir_plugin."-cache/";
if(!is_dir($path))
mkdir($path);
if(is_dir($path))
self::$path_cache = $path;
}
}
/**
*
* set debug mode.
*/
public static function setDebugMode(){
self::$debugMode = true;
}
/**
*
* add some wordpress action
*/
protected static function addAction($action,$eventFunction){
add_action( $action, array(self::$t, $eventFunction) );
}
/**
*
* register script helper function
* @param $scriptFilename
*/
protected static function addScriptAbsoluteUrl($scriptPath,$handle){
wp_register_script($handle , $scriptPath);
wp_enqueue_script($handle);
}
/**
*
* register script helper function
* @param $scriptFilename
*/
protected static function addScript($scriptName,$folder="js",$handle=null){
if($handle == null)
$handle = self::$dir_plugin."-".$scriptName;
wp_register_script($handle , self::$url_plugin .$folder."/".$scriptName.".js" );
wp_enqueue_script($handle);
}
/**
*
* register common script helper function
* the handle for the common script is coming without plugin name
*/
protected static function addScriptCommon($scriptName,$handle=null, $folder="js"){
if($handle == null)
$handle = $scriptName;
self::addScript($scriptName,$folder,$handle);
}
/**
*
* simple enqueue script
*/
protected static function addWPScript($scriptName){
wp_enqueue_script($scriptName);
}
/**
*
* register style helper function
* @param $styleFilename
*/
protected static function addStyle($styleName,$handle=null,$folder="css"){
if($handle == null)
$handle = self::$dir_plugin."-".$styleName;
wp_register_style($handle , self::$url_plugin .$folder."/".$styleName.".css" );
wp_enqueue_style($handle);
}
/**
*
* register common script helper function
* the handle for the common script is coming without plugin name
*/
protected static function addStyleCommon($styleName,$handle=null,$folder="css"){
if($handle == null)
$handle = $styleName;
self::addStyle($styleName,$handle,$folder);
}
/**
*
* register style absolute url helper function
*/
protected static function addStyleAbsoluteUrl($styleUrl,$handle){
wp_register_style($handle , $styleUrl);
wp_enqueue_style($handle);
}
/**
*
* simple enqueue style
*/
protected static function addWPStyle($styleName){
wp_enqueue_style($styleName);
}
/**
*
* get image url to be shown via thumb making script.
*/
public static function getImageUrl($filepath, $width=null,$height=null,$exact=false,$effect=null,$effect_param=null){
$urlImage = UniteImageViewRev::getUrlThumb(self::$url_ajax_showimage, $filepath,$width ,$height ,$exact ,$effect ,$effect_param);
return($urlImage);
}
/**
*
* on show image ajax event. outputs image with parameters
*/
public static function onShowImage(){
$pathImages = UniteFunctionsWPRev::getPathContent();
$urlImages = UniteFunctionsWPRev::getUrlContent();
try{
$imageView = new UniteImageViewRev(self::$path_cache,$pathImages,$urlImages);
$imageView->showImageFromGet();
}catch (Exception $e){
header("status: 500");
echo $e->getMessage();
exit();
}
}
/**
*
* get POST var
*/
protected static function getPostVar($key,$defaultValue = ""){
$val = self::getVar($_POST, $key, $defaultValue);
return($val);
}
/**
*
* get GET var
*/
protected static function getGetVar($key,$defaultValue = ""){
$val = self::getVar($_GET, $key, $defaultValue);
return($val);
}
/**
*
* get post or get variable
*/
protected static function getPostGetVar($key,$defaultValue = ""){
if(array_key_exists($key, $_POST))
$val = self::getVar($_POST, $key, $defaultValue);
else
$val = self::getVar($_GET, $key, $defaultValue);
return($val);
}
/**
*
* get some var from array
*/
protected static function getVar($arr,$key,$defaultValue = ""){
$val = $defaultValue;
if(isset($arr[$key])) $val = $arr[$key];
return($val);
}
/**
*
* make config file of all the text in the settings for the .mo and .po creation
*/
protected static function updateSettingsText(){
$filelist = UniteFunctionsRev::getFileList(self::$path_settings,"xml");
foreach($filelist as $file){
$filepath = self::$path_settings.$file;
UniteFunctionsWPRev::writeSettingLanguageFile($filepath);
}
}
}
?>

View File

@ -0,0 +1,526 @@
<?php
class UniteBaseAdminClassRev extends UniteBaseClassRev{
const ACTION_ADMIN_MENU = "admin_menu";
const ACTION_ADMIN_INIT = "admin_init";
const ACTION_ADD_SCRIPTS = "admin_enqueue_scripts";
const ROLE_ADMIN = "admin";
const ROLE_EDITOR = "editor";
const ROLE_AUTHOR = "author";
protected static $master_view;
protected static $view;
private static $arrSettings = array();
private static $arrMenuPages = array();
private static $tempVars = array();
private static $startupError = "";
private static $menuRole = self::ROLE_ADMIN;
/**
*
* main constructor
*/
public function __construct($mainFile,$t,$defaultView){
parent::__construct($mainFile,$t);
//set view
self::$view = self::getGetVar("view");
if(empty(self::$view))
self::$view = $defaultView;
//add internal hook for adding a menu in arrMenus
self::addAction(self::ACTION_ADMIN_MENU, "addAdminMenu");
//if not inside plugin don't continue
if($this->isInsidePlugin() == true){
self::addAction(self::ACTION_ADD_SCRIPTS, "addCommonScripts");
self::addAction(self::ACTION_ADD_SCRIPTS, "onAddScripts");
}
//a must event for any admin. call onActivate function.
$this->addEvent_onActivate();
self::addActionAjax("show_image", "onShowImage");
}
/**
*
* set the menu role - for viewing menus
*/
public static function setMenuRole($menuRole){
self::$menuRole = $menuRole;
}
/**
*
* set startup error to be shown in master view
*/
public static function setStartupError($errorMessage){
self::$startupError = $errorMessage;
}
/**
*
* tells if the the current plugin opened is this plugin or not
* in the admin side.
*/
private function isInsidePlugin(){
$page = self::getGetVar("page");
if($page == self::$dir_plugin)
return(true);
return(false);
}
/**
*
* add common used scripts
*/
public static function addCommonScripts(){
//include jquery ui
if(GlobalsRevSlider::$isNewVersion){ //load new jquery ui library
$urlJqueryUI = "https://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js";
self::addScriptAbsoluteUrl($urlJqueryUI,"jquery-ui");
self::addStyle("jquery-ui-1.9.2.custom.min","jui-smoothness","css/jui/new");
if(function_exists("wp_enqueue_media"))
wp_enqueue_media();
}else{ //load old jquery ui library
$urlJqueryUI = "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js";
self::addScriptAbsoluteUrl($urlJqueryUI,"jquery-ui");
self::addStyle("jquery-ui-1.8.18.custom","jui-smoothness","css/jui/old");
}
self::addScriptCommon("settings","unite_settings");
self::addScriptCommon("admin","unite_admin");
self::addScriptCommon("jquery.tipsy","tipsy");
//--- add styles
self::addStyleCommon("admin","unite_admin");
//add tipsy
self::addStyleCommon("tipsy","tipsy");
//include farbtastic
self::addScriptCommon("my-farbtastic","my-farbtastic","js/farbtastic");
self::addStyleCommon("farbtastic","farbtastic","js/farbtastic");
//include codemirror
self::addScriptCommon("codemirror","codemirror_js","js/codemirror");
self::addScriptCommon("css","codemirror_js_css","js/codemirror");
self::addStyleCommon("codemirror","codemirror_css","js/codemirror");
//include dropdown checklist
self::addScriptCommon("ui.dropdownchecklist-1.4-min","dropdownchecklist_js","js/dropdownchecklist");
//self::addScriptCommon("ui.dropdownchecklist","dropdownchecklist_js","js/dropdownchecklist");
//self::addStyleCommon("ui.dropdownchecklist.standalone","dropdownchecklist_css","js/dropdownchecklist");
}
/**
*
* admin pages parent, includes all the admin files by default
*/
public static function adminPages(){
self::validateAdminPermissions();
}
/**
*
* validate permission that the user is admin, and can manage options.
*/
protected static function isAdminPermissions(){
if( is_admin() && current_user_can("manage_options") )
return(true);
return(false);
}
/**
*
* validate admin permissions, if no pemissions - exit
*/
protected static function validateAdminPermissions(){
if(!self::isAdminPermissions()){
echo "access denied";
return(false);
}
}
/**
*
* set view that will be the master
*/
protected static function setMasterView($masterView){
self::$master_view = $masterView;
}
/**
*
* inlcude some view file
*/
protected static function requireView($view){
try{
//require master view file, and
if(!empty(self::$master_view) && !isset(self::$tempVars["is_masterView"]) ){
$masterViewFilepath = self::$path_views.self::$master_view.".php";
UniteFunctionsRev::validateFilepath($masterViewFilepath,"Master View");
self::$tempVars["is_masterView"] = true;
require $masterViewFilepath;
}
else{ //simple require the view file.
$viewFilepath = self::$path_views.$view.".php";
UniteFunctionsRev::validateFilepath($viewFilepath,"View");
require $viewFilepath;
}
}catch (Exception $e){
echo "<br><br>View ($view) Error: <b>".$e->getMessage()."</b>";
if(self::$debugMode == true)
dmp($e->getTraceAsString());
}
}
/**
* require some template from "templates" folder
*/
protected static function getPathTemplate($templateName){
$pathTemplate = self::$path_templates.$templateName.".php";
UniteFunctionsRev::validateFilepath($pathTemplate,"Template");
return($pathTemplate);
}
/**
*
* require settings file, the filename without .php
*/
protected static function requireSettings($settingsFile){
try{
require self::$path_plugin."settings/$settingsFile.php";
}catch (Exception $e){
echo "<br><br>Settings ($settingsFile) Error: <b>".$e->getMessage()."</b>";
dmp($e->getTraceAsString());
}
}
/**
*
* get path to settings file
* @param $settingsFile
*/
protected static function getSettingsFilePath($settingsFile){
$filepath = self::$path_plugin."settings/$settingsFile.php";
return($filepath);
}
/**
*
* add all js and css needed for media upload
*/
protected static function addMediaUploadIncludes(){
self::addWPScript("thickbox");
self::addWPStyle("thickbox");
self::addWPScript("media-upload");
}
/**
* add admin menus from the list.
*/
public static function addAdminMenu(){
$role = "manage_options";
switch(self::$menuRole){
case self::ROLE_AUTHOR:
$role = "edit_published_posts";
break;
case self::ROLE_EDITOR:
$role = "edit_pages";
break;
default:
case self::ROLE_ADMIN:
$role = "manage_options";
break;
}
foreach(self::$arrMenuPages as $menu){
$title = $menu["title"];
$pageFunctionName = $menu["pageFunction"];
add_menu_page( $title, $title, $role, self::$dir_plugin, array(self::$t, $pageFunctionName) );
}
}
/**
*
* add menu page
*/
protected static function addMenuPage($title,$pageFunctionName){
self::$arrMenuPages[] = array("title"=>$title,"pageFunction"=>$pageFunctionName);
}
/**
*
* get url to some view.
*/
public static function getViewUrl($viewName,$urlParams=""){
$params = "&view=".$viewName;
if(!empty($urlParams))
$params .= "&".$urlParams;
$link = admin_url( "admin.php?page=".self::$dir_plugin.$params);
return($link);
}
/**
*
* register the "onActivate" event
*/
protected function addEvent_onActivate($eventFunc = "onActivate"){
register_activation_hook( self::$mainFile, array(self::$t, $eventFunc) );
}
/**
*
* store settings in the object
*/
protected static function storeSettings($key,$settings){
self::$arrSettings[$key] = $settings;
}
/**
*
* get settings object
*/
protected static function getSettings($key){
if(!isset(self::$arrSettings[$key]))
UniteFunctionsRev::throwError("Settings $key not found");
$settings = self::$arrSettings[$key];
return($settings);
}
/**
*
* add ajax back end callback, on some action to some function.
*/
protected static function addActionAjax($ajaxAction,$eventFunction){
self::addAction('wp_ajax_'.self::$dir_plugin."_".$ajaxAction, $eventFunction);
self::addAction('wp_ajax_nopriv_'.self::$dir_plugin."_".$ajaxAction, $eventFunction);
}
/**
*
* echo json ajax response
*/
private static function ajaxResponse($success,$message,$arrData = null){
$response = array();
$response["success"] = $success;
$response["message"] = $message;
if(!empty($arrData)){
if(gettype($arrData) == "string")
$arrData = array("data"=>$arrData);
$response = array_merge($response,$arrData);
}
$json = json_encode($response);
echo $json;
exit();
}
/**
*
* echo json ajax response, without message, only data
*/
protected static function ajaxResponseData($arrData){
if(gettype($arrData) == "string")
$arrData = array("data"=>$arrData);
self::ajaxResponse(true,"",$arrData);
}
/**
*
* echo json ajax response
*/
protected static function ajaxResponseError($message,$arrData = null){
self::ajaxResponse(false,$message,$arrData,true);
}
/**
* echo ajax success response
*/
protected static function ajaxResponseSuccess($message,$arrData = null){
self::ajaxResponse(true,$message,$arrData,true);
}
/**
* echo ajax success response
*/
protected static function ajaxResponseSuccessRedirect($message,$url){
$arrData = array("is_redirect"=>true,"redirect_url"=>$url);
self::ajaxResponse(true,$message,$arrData,true);
}
/**
*
* Enter description here ...
*/
protected static function updatePlugin($viewBack = false){
$linkBack = self::getViewUrl($viewBack);
$htmlLinkBack = UniteFunctionsRev::getHtmlLink($linkBack, "Go Back");
$zip = new UniteZipRev();
try{
if(function_exists("unzip_file") == false){
if( UniteZipRev::isZipExists() == false)
UniteFunctionsRev::throwError("The ZipArchive php extension not exists, can't extract the update file. Please turn it on in php ini.");
}
dmp("Update in progress...");
$arrFiles = UniteFunctionsRev::getVal($_FILES, "update_file");
if(empty($arrFiles))
UniteFunctionsRev::throwError("Update file don't found.");
$filename = UniteFunctionsRev::getVal($arrFiles, "name");
if(empty($filename))
UniteFunctionsRev::throwError("Update filename not found.");
$fileType = UniteFunctionsRev::getVal($arrFiles, "type");
/*
$fileType = strtolower($fileType);
if($fileType != "application/zip")
UniteFunctionsRev::throwError("The file uploaded is not zip.");
*/
$filepathTemp = UniteFunctionsRev::getVal($arrFiles, "tmp_name");
if(file_exists($filepathTemp) == false)
UniteFunctionsRev::throwError("Can't find the uploaded file.");
//crate temp folder
UniteFunctionsRev::checkCreateDir(self::$path_temp);
//create the update folder
$pathUpdate = self::$path_temp."update_extract/";
UniteFunctionsRev::checkCreateDir($pathUpdate);
//remove all files in the update folder
if(is_dir($pathUpdate)){
$arrNotDeleted = UniteFunctionsRev::deleteDir($pathUpdate,false);
if(!empty($arrNotDeleted)){
$strNotDeleted = print_r($arrNotDeleted,true);
UniteFunctionsRev::throwError("Could not delete those files from the update folder: $strNotDeleted");
}
}
//copy the zip file.
$filepathZip = $pathUpdate.$filename;
$success = move_uploaded_file($filepathTemp, $filepathZip);
if($success == false)
UniteFunctionsRev::throwError("Can't move the uploaded file here: {$filepathZip}.");
if(function_exists("unzip_file") == true){
WP_Filesystem();
$response = unzip_file($filepathZip, $pathUpdate);
}
else
$zip->extract($filepathZip, $pathUpdate);
//get extracted folder
$arrFolders = UniteFunctionsRev::getFoldersList($pathUpdate);
if(empty($arrFolders))
UniteFunctionsRev::throwError("The update folder is not extracted");
if(count($arrFolders) > 1)
UniteFunctionsRev::throwError("Extracted folders are more then 1. Please check the update file.");
//get product folder
$productFolder = $arrFolders[0];
if(empty($productFolder))
UniteFunctionsRev::throwError("Wrong product folder.");
if($productFolder != self::$dir_plugin)
UniteFunctionsRev::throwError("The update folder don't match the product folder, please check the update file.");
$pathUpdateProduct = $pathUpdate.$productFolder."/";
//check some file in folder to validate it's the real one:
$checkFilepath = $pathUpdateProduct.$productFolder.".php";
if(file_exists($checkFilepath) == false)
UniteFunctionsRev::throwError("Wrong update extracted folder. The file: {$checkFilepath} not found.");
//copy the plugin without the captions file.
//$pathOriginalPlugin = $pathUpdate."copy/";
$pathOriginalPlugin = self::$path_plugin;
$arrBlackList = array();
$arrBlackList[] = "rs-plugin/css/captions.css";
UniteFunctionsRev::copyDir($pathUpdateProduct, $pathOriginalPlugin,"",$arrBlackList);
//delete the update
UniteFunctionsRev::deleteDir($pathUpdate);
dmp("Updated Successfully, redirecting...");
echo "<script>location.href='$linkBack'</script>";
}catch(Exception $e){
$message = $e->getMessage();
$message .= " <br> Please update the plugin manually via the ftp";
echo "<div style='color:#B80A0A;font-size:18px;'><b>Update Error: </b> $message</div><br>";
echo $htmlLinkBack;
exit();
}
}
}
?>

View File

@ -0,0 +1,19 @@
<?php
class UniteBaseFrontClassRev extends UniteBaseClassRev{
const ACTION_ENQUEUE_SCRIPTS = "wp_enqueue_scripts";
/**
*
* main constructor
*/
public function __construct($mainFile,$t){
parent::__construct($mainFile,$t);
self::addAction(self::ACTION_ENQUEUE_SCRIPTS, "onAddScripts");
}
}
?>

View File

@ -0,0 +1,83 @@
<?php
class UniteCssParserRev{
private $cssContent;
public function __construct(){
}
/**
*
* init the parser, set css content
*/
public function initContent($cssContent){
$this->cssContent = $cssContent;
}
/**
*
* get array of slide classes, between two sections.
*/
public function getArrClasses($startText = "",$endText=""){
$content = $this->cssContent;
//trim from top
if(!empty($startText)){
$posStart = strpos($content, $startText);
if($posStart !== false)
$content = substr($content, $posStart,strlen($content)-$posStart);
}
//trim from bottom
if(!empty($endText)){
$posEnd = strpos($content, $endText);
if($posEnd !== false)
$content = substr($content,0,$posEnd);
}
//get styles
$lines = explode("\n",$content);
$arrClasses = array();
foreach($lines as $key=>$line){
$line = trim($line);
if(strpos($line, "{") === false)
continue;
//skip unnessasary links
if(strpos($line, ".caption a") !== false)
continue;
if(strpos($line, ".tp-caption a") !== false)
continue;
//get style out of the line
$class = str_replace("{", "", $line);
$class = trim($class);
//skip captions like this: .tp-caption.imageclass img
if(strpos($class," ") !== false)
continue;
$class = str_replace(".caption.", ".", $class);
$class = str_replace(".tp-caption.", ".", $class);
$class = str_replace(".", "", $class);
$class = trim($class);
$arrWords = explode(" ", $class);
$class = $arrWords[count($arrWords)-1];
$class = trim($class);
$arrClasses[] = $class;
}
return($arrClasses);
}
}
?>

View File

@ -0,0 +1,151 @@
<?php
class UniteDBRev{
private $wpdb;
private $lastRowID;
/**
*
* constructor - set database object
*/
public function __construct(){
global $wpdb;
$this->wpdb = $wpdb;
}
/**
*
* throw error
*/
private function throwError($message,$code=-1){
UniteFunctionsRev::throwError($message,$code);
}
//------------------------------------------------------------
// validate for errors
private function checkForErrors($prefix = ""){
if(mysql_error()){
$query = $this->wpdb->last_query;
$message = $this->wpdb->last_error;
if($prefix) $message = $prefix.' - <b>'.$message.'</b>';
if($query) $message .= '<br>---<br> Query: ' . $query;
$this->throwError($message);
}
}
/**
*
* insert variables to some table
*/
public function insert($table,$arrItems){
$this->wpdb->insert($table, $arrItems);
$this->checkForErrors("Insert query error");
$this->lastRowID = mysql_insert_id();
return($this->lastRowID);
}
/**
*
* get last insert id
*/
public function getLastInsertID(){
$this->lastRowID = mysql_insert_id();
return($this->lastRowID);
}
/**
*
* delete rows
*/
public function delete($table,$where){
UniteFunctionsRev::validateNotEmpty($table,"table name");
UniteFunctionsRev::validateNotEmpty($where,"where");
$query = "delete from $table where $where";
$this->wpdb->query($query);
$this->checkForErrors("Delete query error");
}
/**
*
* run some sql query
*/
public function runSql($query){
$this->wpdb->query($query);
$this->checkForErrors("Regular query error");
}
/**
*
* insert variables to some table
*/
public function update($table,$arrItems,$where){
$response = $this->wpdb->update($table, $arrItems, $where);
if($response === false)
UniteFunctionsRev::throwError("no update action taken!");
$this->checkForErrors("Update query error");
return($this->wpdb->num_rows);
}
/**
*
* get data array from the database
*
*/
public function fetch($tableName,$where="",$orderField="",$groupByField="",$sqlAddon=""){
$query = "select * from $tableName";
if($where) $query .= " where $where";
if($orderField) $query .= " order by $orderField";
if($groupByField) $query .= " group by $groupByField";
if($sqlAddon) $query .= " ".$sqlAddon;
$response = $this->wpdb->get_results($query,ARRAY_A);
$this->checkForErrors("fetch");
return($response);
}
/**
*
* fetch only one item. if not found - throw error
*/
public function fetchSingle($tableName,$where="",$orderField="",$groupByField="",$sqlAddon=""){
$response = $this->fetch($tableName, $where, $orderField, $groupByField, $sqlAddon);
if(empty($response))
$this->throwError("Record not found");
$record = $response[0];
return($record);
}
/**
*
* escape data to avoid sql errors and injections.
*/
public function escape($string){
return($this->wpdb->escape($string));
}
}
?>

View File

@ -0,0 +1,14 @@
<?php
class UniteElementsBaseRev{
protected $db;
public function __construct(){
$this->db = new UniteDBRev();
}
}
?>

View File

@ -0,0 +1,770 @@
<?php
class UniteFunctionsRev{
public static function throwError($message,$code=null){
if(!empty($code))
throw new Exception($message,$code);
else
throw new Exception($message);
}
/**
*
* set output for download
*/
public static function downloadFile($str,$filename="output.txt"){
//output for download
header('Content-Description: File Transfer');
header('Content-Type: text/html; charset=UTF-8');
header("Content-Disposition: attachment; filename=".$filename.";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".strlen($str));
echo $str;
exit();
}
/**
*
* turn boolean to string
*/
public static function boolToStr($bool){
if(gettype($bool) == "string")
return($bool);
if($bool == true)
return("true");
else
return("false");
}
/**
*
* convert string to boolean
*/
public static function strToBool($str){
if(is_bool($str))
return($str);
if(empty($str))
return(false);
if(is_numeric($str))
return($str != 0);
$str = strtolower($str);
if($str == "true")
return(true);
return(false);
}
//------------------------------------------------------------
// get black value from rgb value
public static function yiq($r,$g,$b){
return (($r*0.299)+($g*0.587)+($b*0.114));
}
//------------------------------------------------------------
// convert colors to rgb
public static function html2rgb($color){
if ($color[0] == '#')
$color = substr($color, 1);
if (strlen($color) == 6)
list($r, $g, $b) = array($color[0].$color[1],
$color[2].$color[3],
$color[4].$color[5]);
elseif (strlen($color) == 3)
list($r, $g, $b) = array($color[0].$color[0], $color[1].$color[1], $color[2].$color[2]);
else
return false;
$r = hexdec($r); $g = hexdec($g); $b = hexdec($b);
return array($r, $g, $b);
}
//---------------------------------------------------------------------------------------------------
// convert timestamp to time string
public static function timestamp2Time($stamp){
$strTime = date("H:i",$stamp);
return($strTime);
}
//---------------------------------------------------------------------------------------------------
// convert timestamp to date and time string
public static function timestamp2DateTime($stamp){
$strDateTime = date("d M Y, H:i",$stamp);
return($strDateTime);
}
//---------------------------------------------------------------------------------------------------
// convert timestamp to date string
public static function timestamp2Date($stamp){
$strDate = date("d M Y",$stamp); //27 Jun 2009
return($strDate);
}
/**
* get value from array. if not - return alternative
*/
public static function getVal($arr,$key,$altVal=""){
if(isset($arr[$key])) return($arr[$key]);
return($altVal);
}
/**
*
* convert object to string.
*/
public static function toString($obj){
return(trim((string)$obj));
}
/**
* remove utf8 bom sign
*/
public static function remove_utf8_bom($content){
$content = str_replace(chr(239),"",$content);
$content = str_replace(chr(187),"",$content);
$content = str_replace(chr(191),"",$content);
$content = trim($content);
return($content);
}
//------------------------------------------------------------
// get variable from post or from get. get wins.
public static function getPostGetVariable($name,$initVar = ""){
$var = $initVar;
if(isset($_POST[$name])) $var = $_POST[$name];
else if(isset($_GET[$name])) $var = $_GET[$name];
return($var);
}
//------------------------------------------------------------
public static function getPostVariable($name,$initVar = ""){
$var = $initVar;
if(isset($_POST[$name])) $var = $_POST[$name];
return($var);
}
//------------------------------------------------------------
public static function getGetVar($name,$initVar = ""){
$var = $initVar;
if(isset($_GET[$name])) $var = $_GET[$name];
return($var);
}
/**
*
* validate that some file exists, if not - throw error
*/
public static function validateFilepath($filepath,$errorPrefix=null){
if(file_exists($filepath) == true)
return(false);
if($errorPrefix == null)
$errorPrefix = "File";
$message = $errorPrefix." $filepath not exists!";
self::throwError($message);
}
/**
*
* validate that some value is numeric
*/
public static function validateNumeric($val,$fieldName=""){
self::validateNotEmpty($val,$fieldName);
if(empty($fieldName))
$fieldName = "Field";
if(!is_numeric($val))
self::throwError("$fieldName should be numeric ");
}
/**
*
* validate that some variable not empty
*/
public static function validateNotEmpty($val,$fieldName=""){
if(empty($fieldName))
$fieldName = "Field";
if(empty($val) && is_numeric($val) == false)
self::throwError("Field <b>$fieldName</b> should not be empty");
}
/**
*
* if directory not exists - create it
* @param $dir
*/
public static function checkCreateDir($dir){
if(!is_dir($dir))
mkdir($dir);
if(!is_dir($dir))
self::throwError("Could not create directory: $dir");
}
/**
*
* delete file, validate if deleted
*/
public static function checkDeleteFile($filepath){
if(file_exists($filepath) == false)
return(false);
$success = @unlink($filepath);
if($success == false)
self::throwError("Failed to delete the file: $filepath");
}
//------------------------------------------------------------
//filter array, leaving only needed fields - also array
public static function filterArrFields($arr,$fields){
$arrNew = array();
foreach($fields as $field){
if(isset($arr[$field]))
$arrNew[$field] = $arr[$field];
}
return($arrNew);
}
//------------------------------------------------------------
//get path info of certain path with all needed fields
public static function getPathInfo($filepath){
$info = pathinfo($filepath);
//fix the filename problem
if(!isset($info["filename"])){
$filename = $info["basename"];
if(isset($info["extension"]))
$filename = substr($info["basename"],0,(-strlen($info["extension"])-1));
$info["filename"] = $filename;
}
return($info);
}
/**
* Convert std class to array, with all sons
* @param unknown_type $arr
*/
public static function convertStdClassToArray($arr){
$arr = (array)$arr;
$arrNew = array();
foreach($arr as $key=>$item){
$item = (array)$item;
$arrNew[$key] = $item;
}
return($arrNew);
}
//------------------------------------------------------------
//save some file to the filesystem with some text
public static function writeFile($str,$filepath){
$fp = fopen($filepath,"w+");
fwrite($fp,$str);
fclose($fp);
}
//------------------------------------------------------------
//save some file to the filesystem with some text
public static function writeDebug($str,$filepath="debug.txt",$showInputs = true){
$post = print_r($_POST,true);
$server = print_r($_SERVER,true);
if(getType($str) == "array")
$str = print_r($str,true);
if($showInputs == true){
$output = "--------------------"."\n";
$output .= $str."\n";
$output .= "Post: ".$post."\n";
}else{
$output = "---"."\n";
$output .= $str . "\n";
}
if(!empty($_GET)){
$get = print_r($_GET,true);
$output .= "Get: ".$get."\n";
}
//$output .= "Server: ".$server."\n";
$fp = fopen($filepath,"a+");
fwrite($fp,$output);
fclose($fp);
}
/**
*
* clear debug file
*/
public static function clearDebug($filepath = "debug.txt"){
if(file_exists($filepath))
unlink($filepath);
}
/**
*
* save to filesystem the error
*/
public static function writeDebugError(Exception $e,$filepath = "debug.txt"){
$message = $e->getMessage();
$trace = $e->getTraceAsString();
$output = $message."\n";
$output .= $trace."\n";
$fp = fopen($filepath,"a+");
fwrite($fp,$output);
fclose($fp);
}
//------------------------------------------------------------
//save some file to the filesystem with some text
public static function addToFile($str,$filepath){
$fp = fopen($filepath,"a+");
fwrite($fp,"---------------------\n");
fwrite($fp,$str."\n");
fclose($fp);
}
//--------------------------------------------------------------
//check the php version. throw exception if the version beneath 5
private static function checkPHPVersion(){
$strVersion = phpversion();
$version = (float)$strVersion;
if($version < 5) throw new Exception("You must have php5 and higher in order to run the application. Your php version is: $version");
}
//--------------------------------------------------------------
// valiadte if gd exists. if not - throw exception
private static function validateGD(){
if(function_exists('gd_info') == false)
throw new Exception("You need GD library to be available in order to run this application. Please turn it on in php.ini");
}
//--------------------------------------------------------------
//return if the json library is activated
public static function isJsonActivated(){
return(function_exists('json_encode'));
}
/**
*
* encode array into json for client side
*/
public static function jsonEncodeForClientSide($arr){
$json = "";
if(!empty($arr)){
$json = json_encode($arr);
$json = addslashes($json);
}
$json = "'".$json."'";
return($json);
}
/**
*
* decode json from the client side
*/
public static function jsonDecodeFromClientSide($data){
$data = stripslashes($data);
$data = str_replace('&#092;"','\"',$data);
$data = json_decode($data);
$data = (array)$data;
return($data);
}
//--------------------------------------------------------------
//validate if some directory is writable, if not - throw a exception
private static function validateWritable($name,$path,$strList,$validateExists = true){
if($validateExists == true){
//if the file/directory doesn't exists - throw an error.
if(file_exists($path) == false)
throw new Exception("$name doesn't exists");
}
else{
//if the file not exists - don't check. it will be created.
if(file_exists($path) == false) return(false);
}
if(is_writable($path) == false){
chmod($path,0755); //try to change the permissions
if(is_writable($path) == false){
$strType = "Folder";
if(is_file($path)) $strType = "File";
$message = "$strType $name is doesn't have a write permissions. Those folders/files must have a write permissions in order that this application will work properly: $strList";
throw new Exception($message);
}
}
}
//--------------------------------------------------------------
//validate presets for identical keys
public static function validatePresets(){
global $g_presets;
if(empty($g_presets)) return(false);
//check for duplicates
$assoc = array();
foreach($g_presets as $preset){
$id = $preset["id"];
if(isset($assoc[$id]))
throw new Exception("Double preset ID detected: $id");
$assoc[$id] = true;
}
}
//--------------------------------------------------------------
//Get url of image for output
public static function getImageOutputUrl($filename,$width=0,$height=0,$exact=false){
//exact validation:
if($exact == "true" && (empty($width) || empty($height) ))
self::throwError("Exact must have both - width and height");
$url = CMGlobals::$URL_GALLERY."?img=".$filename;
if(!empty($width))
$url .= "&w=".$width;
if(!empty($height))
$url .= "&h=".$height;
if($exact == true)
$url .= "&t=exact";
return($url);
}
/**
*
* get list of all files in the directory
* ext - filter by his extension only
*/
public static function getFileList($path,$ext=""){
$dir = scandir($path);
$arrFiles = array();
foreach($dir as $file){
if($file == "." || $file == "..") continue;
if(!empty($ext)){
$info = pathinfo($file);
$extension = UniteFunctionsRev::getVal($info, "extension");
if($ext != strtolower($extension))
continue;
}
$filepath = $path . "/" . $file;
if(is_file($filepath)) $arrFiles[] = $file;
}
return($arrFiles);
}
/**
*
* get list of all files in the directory
*/
public static function getFoldersList($path){
$dir = scandir($path);
$arrFiles = array();
foreach($dir as $file){
if($file == "." || $file == "..") continue;
$filepath = $path . "/" . $file;
if(is_dir($filepath)) $arrFiles[] = $file;
}
return($arrFiles);
}
/**
*
* do "trim" operation on all array items.
*/
public static function trimArrayItems($arr){
if(gettype($arr) != "array")
UniteFunctionsRev::throwError("trimArrayItems error: The type must be array");
foreach ($arr as $key=>$item)
$arr[$key] = trim($item);
return($arr);
}
/**
*
* get url contents
*/
public static function getUrlContents($url,$arrPost=array(),$method = "post",$debug=false){
$ch = curl_init();
$timeout = 0;
$strPost = '';
foreach($arrPost as $key=>$value){
if(!empty($strPost))
$strPost .= "&";
$value = urlencode($value);
$strPost .= "$key=$value";
}
//set curl options
if(strtolower($method) == "post"){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$strPost);
}
else //get
$url .= "?".$strPost;
//remove me
//Functions::addToLogFile(SERVICE_LOG_SERVICE, "url", $url);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$headers = array();
$headers[] = "User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8";
$headers[] = "Accept-Charset:utf-8;q=0.7,*;q=0.7";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
if($debug == true){
dmp($url);
dmp($response);
exit();
}
if($response == false)
throw new Exception("getUrlContents Request failed");
curl_close($ch);
return($response);
}
/**
*
* get link html
*/
public static function getHtmlLink($link,$text,$id="",$class=""){
if(!empty($class))
$class = " class='$class'";
if(!empty($id))
$id = " id='$id'";
$html = "<a href=\"$link\"".$id.$class.">$text</a>";
return($html);
}
/**
*
* get select from array
*/
public static function getHTMLSelect($arr,$default="",$htmlParams="",$assoc = false){
$html = "<select $htmlParams>";
foreach($arr as $key=>$item){
$selected = "";
if($assoc == false){
if($item == $default) $selected = " selected ";
}
else{
if(trim($key) == trim($default))
$selected = " selected ";
}
if($assoc == true)
$html .= "<option $selected value='$key'>$item</option>";
else
$html .= "<option $selected value='$item'>$item</option>";
}
$html.= "</select>";
return($html);
}
/**
*
* Convert array to assoc array by some field
*/
public static function arrayToAssoc($arr,$field=null){
$arrAssoc = array();
foreach($arr as $item){
if(empty($field))
$arrAssoc[$item] = $item;
else
$arrAssoc[$item[$field]] = $item;
}
return($arrAssoc);
}
/**
*
* convert assoc array to array
*/
public static function assocToArray($assoc){
$arr = array();
foreach($assoc as $item)
$arr[] = $item;
return($arr);
}
/**
*
* strip slashes from textarea content after ajax request to server
*/
public static function normalizeTextareaContent($content){
if(empty($content))
return($content);
$content = stripslashes($content);
$content = trim($content);
return($content);
}
/**
*
* get random array item
*/
public static function getRandomArrayItem($arr){
$numItems = count($arr);
$rand = rand(0, $numItems-1);
$item = $arr[$rand];
return($item);
}
/**
*
* recursive delete directory or file
*/
public static function deleteDir($path,$deleteOriginal = true, $arrNotDeleted = array(),$originalPath = ""){
if(empty($originalPath))
$originalPath = $path;
//in case of paths array
if(getType($path) == "array"){
$arrPaths = $path;
foreach($path as $singlePath)
$arrNotDeleted = self::deleteDir($singlePath,$deleteOriginal,$arrNotDeleted,$originalPath);
return($arrNotDeleted);
}
if(!file_exists($path))
return($arrNotDeleted);
if(is_file($path)){ // delete file
$deleted = unlink($path);
if(!$deleted)
$arrNotDeleted[] = $path;
}
else{ //delete directory
$arrPaths = scandir($path);
foreach($arrPaths as $file){
if($file == "." || $file == "..")
continue;
$filepath = realpath($path."/".$file);
$arrNotDeleted = self::deleteDir($filepath,$deleteOriginal,$arrNotDeleted,$originalPath);
}
if($deleteOriginal == true || $originalPath != $path){
$deleted = @rmdir($path);
if(!$deleted)
$arrNotDeleted[] = $path;
}
}
return($arrNotDeleted);
}
/**
* copy folder to another location.
*
*/
public static function copyDir($source,$dest,$rel_path = "",$blackList = null){
$full_source = $source;
if(!empty($rel_path))
$full_source = $source."/".$rel_path;
$full_dest = $dest;
if(!empty($full_dest))
$full_dest = $dest."/".$rel_path;
if(!is_dir($full_source))
self::throwError("The source directroy: '$full_source' not exists.");
if(!is_dir($full_dest))
mkdir($full_dest);
$files = scandir($full_source);
foreach($files as $file){
if($file == "." || $file == "..")
continue;
$path_source = $full_source."/".$file;
$path_dest = $full_dest."/".$file;
//validate black list
$rel_path_file = $file;
if(!empty($rel_path))
$rel_path_file = $rel_path."/".$file;
//if the file or folder is in black list - pass it
if(array_search($rel_path_file, $blackList) !== false)
continue;
//if file - copy file
if(is_file($path_source)){
copy($path_source,$path_dest);
}
else{ //if directory - recursive copy directory
if(empty($rel_path))
$rel_path_new = $file;
else
$rel_path_new = $rel_path."/".$file;
self::copyDir($source,$dest,$rel_path_new,$blackList);
}
}
}
}
?>

View File

@ -0,0 +1,17 @@
<?php
//---------------------------------------------------------------------------------------------------------------------
if(!function_exists("dmp")){
function dmp($str){
echo "<div align='left'>";
echo "<pre>";
print_r($str);
echo "</pre>";
echo "</div>";
}
}
?>

View File

@ -0,0 +1,256 @@
<?php
class UniteFunctionsWPRev{
const THUMB_SMALL = "thumbnail";
const THUMB_MEDIUM = "medium";
const THUMB_LARGE = "large";
const THUMB_FULL = "full";
/**
* get blog id
*/
public static function getBlogID(){
global $blog_id;
return($blog_id);
}
/**
*
* get blog id
*/
public static function isMultisite(){
$isMultisite = is_multisite();
return($isMultisite);
}
/**
*
* check if some db table exists
*/
public static function isDBTableExists($tableName){
global $wpdb;
if(empty($tableName))
UniteFunctionsRev::throwError("Empty table name!!!");
$sql = "show tables like '$tableName'";
$table = $wpdb->get_var($sql);
if($table == $tableName)
return(true);
return(false);
}
/**
*
* get wordpress base path
*/
public static function getPathBase(){
return ABSPATH;
}
/**
*
* get wp-content path
*/
public static function getPathContent(){
if(self::isMultisite()){
if(!defined("BLOGUPLOADDIR")){
$pathBase = self::getPathBase();
$pathContent = $pathBase."wp-content/";
}else
$pathContent = BLOGUPLOADDIR;
}else{
$pathContent = WP_CONTENT_DIR;
if(!empty($pathContent)){
$pathContent .= "/";
}
else{
$pathBase = self::getPathBase();
$pathContent = $pathBase."wp-content/";
}
}
return($pathContent);
}
/**
*
* get content url
*/
public static function getUrlContent(){
if(self::isMultisite() == false){ //without multisite
$baseUrl = content_url()."/";
}
else{ //for multisite
$arrUploadData = wp_upload_dir();
$baseUrl = $arrUploadData["baseurl"]."/";
}
return($baseUrl);
}
/**
*
* register widget (must be class)
*/
public static function registerWidget($widgetName){
add_action('widgets_init', create_function('', 'return register_widget("'.$widgetName.'");'));
}
/**
* get image relative path from image url (from upload)
*/
public static function getImagePathFromURL($urlImage){
$baseUrl = self::getUrlContent();
$pathImage = str_replace($baseUrl, "", $urlImage);
return($pathImage);
}
/**
* get image real path phisical on disk from url
*/
public static function getImageRealPathFromUrl($urlImage){
$filepath = self::getImagePathFromURL($urlImage);
$realPath = UniteFunctionsWPRev::getPathContent().$filepath;
return($realPath);
}
/**
*
* get image url from image path.
*/
public static function getImageUrlFromPath($pathImage){
//protect from absolute url
$pathLower = strtolower($pathImage);
if(strpos($pathLower, "http://") !== false || strpos($pathLower, "www.") === 0)
return($pathImage);
$urlImage = self::getUrlContent().$pathImage;
return($urlImage);
}
/**
*
* write settings language file for wp automatic scanning
*/
public static function writeSettingLanguageFile($filepath){
$info = pathinfo($filepath);
$path = UniteFunctionsRev::getVal($info, "dirname")."/";
$filename = UniteFunctionsRev::getVal($info, "filename");
$ext = UniteFunctionsRev::getVal($info, "extension");
$filenameOutput = "{$filename}_{$ext}_lang.php";
$filepathOutput = $path.$filenameOutput;
//load settings
$settings = new UniteSettingsAdvancedRev();
$settings->loadXMLFile($filepath);
$arrText = $settings->getArrTextFromAllSettings();
$str = "";
$str .= "<?php \n";
foreach($arrText as $text){
$text = str_replace('"', '\\"', $text);
$str .= "_e(\"$text\",\"".REVSLIDER_TEXTDOMAIN."\"); \n";
}
$str .= "?>";
UniteFunctionsRev::writeFile($str, $filepathOutput);
}
/**
*
* check the current post for the existence of a short code
*/
public static function hasShortcode($shortcode = '') {
$post = get_post(get_the_ID());
if (empty($shortcode))
return $found;
$found = false;
if (stripos($post->post_content, '[' . $shortcode) !== false )
$found = true;
return $found;
}
/**
*
* get attachment image url
*/
public static function getUrlAttachmentImage($thumbID,$size = self::THUMB_FULL){
$arrImage = wp_get_attachment_image_src($thumbID,$size);
if(empty($arrImage))
return(false);
$url = UniteFunctionsRev::getVal($arrImage, 0);
return($url);
}
/**
*
* get attachment image array by id and size
*/
public static function getAttachmentImage($thumbID,$size = self::THUMB_FULL){
$arrImage = wp_get_attachment_image_src($thumbID,$size);
if(empty($arrImage))
return(false);
$output = array();
$output["url"] = UniteFunctionsRev::getVal($arrImage, 0);
$output["width"] = UniteFunctionsRev::getVal($arrImage, 1);
$output["height"] = UniteFunctionsRev::getVal($arrImage, 2);
return($output);
}
/**
*
* get post thumb id from post id
*/
public static function getPostThumbID($postID){
$thumbID = get_post_thumbnail_id( $postID );
return($thumbID);
}
/**
*
* get url of post thumbnail
*/
public static function getUrlPostImage($postID,$size = self::THUMB_FULL){
$post_thumbnail_id = get_post_thumbnail_id( $postID );
if(empty($post_thumbnail_id))
return("");
$arrImage = wp_get_attachment_image_src($post_thumbnail_id,$size);
if(empty($arrImage))
return("");
$urlImage = $arrImage[0];
return($urlImage);
}
}
?>

View File

@ -0,0 +1,610 @@
<?php
class UniteImageViewRev{
private $pathCache;
private $pathImages;
private $urlImages;
private $filename = null;
private $maxWidth = null;
private $maxHeight = null;
private $type = null;
private $effect = null;
private $effect_arg1 = null;
private $effect_arg2 = null;
const EFFECT_BW = "bw";
const EFFECT_BRIGHTNESS = "bright";
const EFFECT_CONTRAST = "contrast";
const EFFECT_EDGE = "edge";
const EFFECT_EMBOSS = "emboss";
const EFFECT_BLUR = "blur";
const EFFECT_BLUR3 = "blur3";
const EFFECT_MEAN = "mean";
const EFFECT_SMOOTH = "smooth";
const EFFECT_DARK = "dark";
const TYPE_EXACT = "exact";
const TYPE_EXACT_TOP = "exacttop";
private $jpg_quality = 81;
public function __construct($pathCache,$pathImages,$urlImages){
$this->pathCache = $pathCache;
$this->pathImages = $pathImages;
$this->urlImages = $urlImages;
}
/**
*
* set jpg quality output
*/
public function setJPGQuality($quality){
$this->jpg_quality = $quality;
}
/**
*
* get thumb url
*/
public static function getUrlThumb($urlBase, $filename,$width=null,$height=null,$exact=false,$effect=null,$effect_param=null){
$filename = urlencode($filename);
$url = $urlBase."&img=$filename";
if(!empty($width))
$url .= "&w=".$width;
if(!empty($height))
$url .= "&h=".$height;
if($exact == true){
$url .= "&t=".self::TYPE_EXACT;
}
if(!empty($effect)){
$url .= "&e=".$effect;
if(!empty($effect_param))
$url .= "&ea1=".$effect_param;
}
return($url);
}
/**
*
* throw error
*/
private function throwError($message,$code=null){
UniteFunctionsRev::throwError($message,$code);
}
/**
*
* get filename for thumbnail save / retrieve
* TODO: do input validations - security measures
*/
private function getThumbFilename(){
$info = pathInfo($this->filename);
//add dirname as postfix (if exists)
$postfix = "";
$dirname = UniteFunctionsRev::getVal($info, "dirname");
if(!empty($dirname)){
$postfix = str_replace("/", "-", $dirname);
}
$ext = $info["extension"];
$name = $info["filename"];
$width = ceil($this->maxWidth);
$height = ceil($this->maxHeight);
$thumbFilename = $name."_".$width."x".$height;
if(!empty($this->type))
$thumbFilename .= "_" . $this->type;
if(!empty($this->effect)){
$thumbFilename .= "_e" . $this->effect;
if(!empty($this->effect_arg1)){
$thumbFilename .= "x" . $this->effect_arg1;
}
}
//add postfix
if(!empty($postfix))
$thumbFilename .= "_".$postfix;
$thumbFilename .= ".".$ext;
return($thumbFilename);
}
//------------------------------------------------------------------------------------------
// get thumbnail fielpath by parameters.
private function getThumbFilepath(){
$filename = $this->getThumbFilename();
$filepath = $this->pathCache .$filename;
return($filepath);
}
//------------------------------------------------------------------------------------------
// ouptput emtpy image code.
private function outputEmptyImageCode(){
echo "empty image";
exit();
}
//------------------------------------------------------------------------------------------
// outputs image and exit.
private function outputImage($filepath){
$info = UniteFunctionsRev::getPathInfo($filepath);
$ext = $info["extension"];
$filetime = filemtime($filepath);
$ext = strtolower($ext);
if($ext == "jpg")
$ext = "jpeg";
$numExpires = 31536000; //one year
$strExpires = @date('D, d M Y H:i:s',time()+$numExpires);
$strModified = @date('D, d M Y H:i:s',$filetime);
$contents = file_get_contents($filepath);
$filesize = strlen($contents);
header("Last-Modified: $strModified GMT");
header("Expires: $strExpires GMT");
header("Cache-Control: public");
header("Content-Type: image/$ext");
header("Content-Length: $filesize");
echo $contents;
exit();
}
//------------------------------------------------------------------------------------------
// get src image from filepath according the image type
private function getGdSrcImage($filepath,$type){
// create the image
$src_img = false;
switch($type){
case IMAGETYPE_JPEG:
$src_img = @imagecreatefromjpeg($filepath);
break;
case IMAGETYPE_PNG:
$src_img = @imagecreatefrompng($filepath);
break;
case IMAGETYPE_GIF:
$src_img = @imagecreatefromgif($filepath);
break;
case IMAGETYPE_BMP:
$src_img = @imagecreatefromwbmp($filepath);
break;
default:
$this->throwError("wrong image format, can't resize");
break;
}
if($src_img == false){
$this->throwError("Can't resize image");
}
return($src_img);
}
//------------------------------------------------------------------------------------------
// save gd image to some filepath. return if success or not
private function saveGdImage($dst_img,$filepath,$type){
$successSaving = false;
switch($type){
case IMAGETYPE_JPEG:
$successSaving = imagejpeg($dst_img,$filepath,$this->jpg_quality);
break;
case IMAGETYPE_PNG:
$successSaving = imagepng($dst_img,$filepath);
break;
case IMAGETYPE_GIF:
$successSaving = imagegif($dst_img,$filepath);
break;
case IMAGETYPE_BMP:
$successSaving = imagewbmp($dst_img,$filepath);
break;
}
return($successSaving);
}
//------------------------------------------------------------------------------------------
// crop image to specifix height and width , and save it to new path
private function cropImageSaveNew($filepath,$filepathNew){
$imgInfo = getimagesize($filepath);
$imgType = $imgInfo[2];
$src_img = $this->getGdSrcImage($filepath,$imgType);
$width = imageSX($src_img);
$height = imageSY($src_img);
//crop the image from the top
$startx = 0;
$starty = 0;
//find precrop width and height:
$percent = $this->maxWidth / $width;
$newWidth = $this->maxWidth;
$newHeight = ceil($percent * $height);
if($this->type == "exact"){ //crop the image from the middle
$startx = 0;
$starty = ($newHeight-$this->maxHeight)/2 / $percent;
}
if($newHeight < $this->maxHeight){ //by width
$percent = $this->maxHeight / $height;
$newHeight = $this->maxHeight;
$newWidth = ceil($percent * $width);
if($this->type == "exact"){ //crop the image from the middle
$startx = ($newWidth - $this->maxWidth) /2 / $percent; //the startx is related to big image
$starty = 0;
}
}
//resize the picture:
$tmp_img = ImageCreateTrueColor($newWidth,$newHeight);
$this->handleTransparency($tmp_img,$imgType,$newWidth,$newHeight);
imagecopyresampled($tmp_img,$src_img,0,0,$startx,$starty,$newWidth,$newHeight,$width,$height);
$this->handleImageEffects($tmp_img);
//crop the picture:
$dst_img = ImageCreateTrueColor($this->maxWidth,$this->maxHeight);
$this->handleTransparency($dst_img,$imgType,$this->maxWidth,$this->maxHeight);
imagecopy($dst_img, $tmp_img, 0, 0, 0, 0, $newWidth, $newHeight);
//save the picture
$is_saved = $this->saveGdImage($dst_img,$filepathNew,$imgType);
imagedestroy($dst_img);
imagedestroy($src_img);
imagedestroy($tmp_img);
return($is_saved);
}
//------------------------------------------------------------------------------------------
// if the images are png or gif - handle image transparency
private function handleTransparency(&$dst_img,$imgType,$newWidth,$newHeight){
//handle transparency:
if($imgType == IMAGETYPE_PNG || $imgType == IMAGETYPE_GIF){
imagealphablending($dst_img, false);
imagesavealpha($dst_img,true);
$transparent = imagecolorallocatealpha($dst_img, 255, 255, 255, 127);
imagefilledrectangle($dst_img, 0, 0, $newWidth, $newHeight, $transparent);
}
}
//------------------------------------------------------------------------------------------
// handle image effects
private function handleImageEffects(&$imgHandle){
if(empty($this->effect))
return(false);
switch($this->effect){
case self::EFFECT_BW:
if(defined("IMG_FILTER_GRAYSCALE"))
imagefilter($imgHandle,IMG_FILTER_GRAYSCALE);
break;
case self::EFFECT_BRIGHTNESS:
if(defined("IMG_FILTER_BRIGHTNESS")){
if(!is_numeric($this->effect_arg1))
$this->effect_arg1 = 50; //set default value
UniteFunctionsRev::validateNumeric($this->effect_arg1,"'ea1' argument");
imagefilter($imgHandle,IMG_FILTER_BRIGHTNESS,$this->effect_arg1);
}
break;
case self::EFFECT_DARK:
if(defined("IMG_FILTER_BRIGHTNESS")){
if(!is_numeric($this->effect_arg1))
$this->effect_arg1 = -50; //set default value
UniteFunctionsRev::validateNumeric($this->effect_arg1,"'ea1' argument");
imagefilter($imgHandle,IMG_FILTER_BRIGHTNESS,$this->effect_arg1);
}
break;
case self::EFFECT_CONTRAST:
if(defined("IMG_FILTER_CONTRAST")){
if(!is_numeric($this->effect_arg1))
$this->effect_arg1 = -5; //set default value
imagefilter($imgHandle,IMG_FILTER_CONTRAST,$this->effect_arg1);
}
break;
case self::EFFECT_EDGE:
if(defined("IMG_FILTER_EDGEDETECT"))
imagefilter($imgHandle,IMG_FILTER_EDGEDETECT);
break;
case self::EFFECT_EMBOSS:
if(defined("IMG_FILTER_EMBOSS"))
imagefilter($imgHandle,IMG_FILTER_EMBOSS);
break;
case self::EFFECT_BLUR:
$this->effect_Blur($imgHandle,5);
/*
if(defined("IMG_FILTER_GAUSSIAN_BLUR"))
imagefilter($imgHandle,IMG_FILTER_GAUSSIAN_BLUR);
*/
break;
case self::EFFECT_MEAN:
if(defined("IMG_FILTER_MEAN_REMOVAL"))
imagefilter($imgHandle,IMG_FILTER_MEAN_REMOVAL);
break;
case self::EFFECT_SMOOTH:
if(defined("IMG_FILTER_SMOOTH")){
if(!is_numeric($this->effect_arg1))
$this->effect_arg1 = 15; //set default value
imagefilter($imgHandle,IMG_FILTER_SMOOTH,$this->effect_arg1);
}
break;
case self::EFFECT_BLUR3:
$this->effect_Blur($imgHandle,5);
break;
default:
$this->throwError("Effect not supported: <b>{$this->effect}</b>");
break;
}
}
private function effect_Blur(&$gdimg, $radius=0.5) {
// Taken from Torstein Hרnsi's phpUnsharpMask (see phpthumb.unsharp.php)
$radius = round(max(0, min($radius, 50)) * 2);
if (!$radius) {
return false;
}
$w = ImageSX($gdimg);
$h = ImageSY($gdimg);
if ($imgBlur = ImageCreateTrueColor($w, $h)) {
// Gaussian blur matrix:
// 1 2 1
// 2 4 2
// 1 2 1
// Move copies of the image around one pixel at the time and merge them with weight
// according to the matrix. The same matrix is simply repeated for higher radii.
for ($i = 0; $i < $radius; $i++) {
ImageCopy ($imgBlur, $gdimg, 0, 0, 1, 1, $w - 1, $h - 1); // up left
ImageCopyMerge($imgBlur, $gdimg, 1, 1, 0, 0, $w, $h, 50.00000); // down right
ImageCopyMerge($imgBlur, $gdimg, 0, 1, 1, 0, $w - 1, $h, 33.33333); // down left
ImageCopyMerge($imgBlur, $gdimg, 1, 0, 0, 1, $w, $h - 1, 25.00000); // up right
ImageCopyMerge($imgBlur, $gdimg, 0, 0, 1, 0, $w - 1, $h, 33.33333); // left
ImageCopyMerge($imgBlur, $gdimg, 1, 0, 0, 0, $w, $h, 25.00000); // right
ImageCopyMerge($imgBlur, $gdimg, 0, 0, 0, 1, $w, $h - 1, 20.00000); // up
ImageCopyMerge($imgBlur, $gdimg, 0, 1, 0, 0, $w, $h, 16.666667); // down
ImageCopyMerge($imgBlur, $gdimg, 0, 0, 0, 0, $w, $h, 50.000000); // center
ImageCopy ($gdimg, $imgBlur, 0, 0, 0, 0, $w, $h);
}
return true;
}
return false;
}
//------------------------------------------------------------------------------------------
// resize image and save it to new path
private function resizeImageSaveNew($filepath,$filepathNew){
$imgInfo = getimagesize($filepath);
$imgType = $imgInfo[2];
$src_img = $this->getGdSrcImage($filepath,$imgType);
$width = imageSX($src_img);
$height = imageSY($src_img);
$newWidth = $width;
$newHeight = $height;
//find new width
if($height > $this->maxHeight){
$procent = $this->maxHeight / $height;
$newWidth = ceil($width * $procent);
$newHeight = $this->maxHeight;
}
//if the new width is grater than max width, find new height, and remain the width.
if($newWidth > $this->maxWidth){
$procent = $this->maxWidth / $newWidth;
$newHeight = ceil($newHeight * $procent);
$newWidth = $this->maxWidth;
}
//if the image don't need to be resized, just copy it from source to destanation.
if($newWidth == $width && $newHeight == $height && empty($this->effect)){
$success = copy($filepath,$filepathNew);
if($success == false)
$this->throwError("can't copy the image from one path to another");
}
else{ //else create the resized image, and save it to new path:
$dst_img = ImageCreateTrueColor($newWidth,$newHeight);
$this->handleTransparency($dst_img,$imgType,$newWidth,$newHeight);
//copy the new resampled image:
imagecopyresampled($dst_img,$src_img,0,0,0,0,$newWidth,$newHeight,$width,$height);
$this->handleImageEffects($dst_img);
$is_saved = $this->saveGdImage($dst_img,$filepathNew,$imgType);
imagedestroy($dst_img);
}
imagedestroy($src_img);
return(true);
}
/**
*
* set image effect
*/
public function setEffect($effect,$arg1 = ""){
$this->effect = $effect;
$this->effect_arg1 = $arg1;
}
//------------------------------------------------------------------------------------------
//return image
private function showImage($filename,$maxWidth=-1,$maxHeight=-1,$type=""){
if(empty($filename))
$this->throwError("image filename not found");
//validate input
if($type == self::TYPE_EXACT || $type == self::TYPE_EXACT_TOP){
if($maxHeight == -1)
$this->throwError("image with exact type must have height!");
if($maxWidth == -1)
$this->throwError("image with exact type must have width!");
}
$filepath = $this->pathImages.$filename;
if(!is_file($filepath)) $this->outputEmptyImageCode();
//if gd library doesn't exists - output normal image without resizing.
if(function_exists("gd_info") == false)
$this->throwError("php must support GD Library");
//check conditions for output original image
if(empty($this->effect)){
if((is_numeric($maxWidth) == false || is_numeric($maxHeight) == false)) outputImage($filepath);
if($maxWidth == -1 && $maxHeight == -1)
$this->outputImage($filepath);
}
if($maxWidth == -1) $maxWidth = 1000000;
if($maxHeight == -1) $maxHeight = 100000;
//init variables
$this->filename = $filename;
$this->maxWidth = $maxWidth;
$this->maxHeight = $maxHeight;
$this->type = $type;
$filepathNew = $this->getThumbFilepath();
if(is_file($filepathNew)){
$this->outputImage($filepathNew);
exit();
}
try{
if($type == self::TYPE_EXACT || $type == self::TYPE_EXACT_TOP){
$isSaved = $this->cropImageSaveNew($filepath,$filepathNew);
}
else
$isSaved = $this->resizeImageSaveNew($filepath,$filepathNew);
if($isSaved == false){
$this->outputImage($filepath);
exit();
}
}catch(Exception $e){
$this->outputImage($filepath);
}
if(is_file($filepathNew))
$this->outputImage($filepathNew);
else
$this->outputImage($filepath);
exit();
}
/**
*
* show image from get params
*/
public function showImageFromGet(){
$imageFilename = UniteFunctionsRev::getGetVar("img");
$maxWidth = UniteFunctionsRev::getGetVar("w",-1);
$maxHeight = UniteFunctionsRev::getGetVar("h",-1);
$type = UniteFunctionsRev::getGetVar("t","");
//set effect
$effect = UniteFunctionsRev::getGetVar("e");
$effectArgument1 = UniteFunctionsRev::getGetVar("ea1");
if(!empty($effect))
$this->setEffect($effect,$effectArgument1);
$this->showImage($imageFilename,$maxWidth,$maxHeight,$type);
}
//------------------------------------------------------------------------------------------
// download image, change size and name if needed.
public function downloadImage($filename){
$filepath = $this->urlImages."/".$filename;
if(!is_file($filepath)) {
echo "file doesn't exists";
exit();
}
$this->outputImageForDownload($filepath,$filename);
}
//------------------------------------------------------------------------------------------
// output image for downloading
private function outputImageForDownload($filepath,$filename,$mimeType=""){
$contents = file_get_contents($filepath);
$filesize = strlen($contents);
if($mimeType == ""){
$info = UniteFunctionsRev::getPathInfo($filepath);
$ext = $info["extension"];
$mimeType = "image/$ext";
}
header("Content-Type: $mimeType");
header("Content-Disposition: attachment; filename=\"$filename\"");
header("Content-Length: $filesize");
echo $contents;
exit();
}
/**
*
* validate type
* @param unknown_type $type
*/
public function validateType($type){
switch($type){
case self::TYPE_EXACT:
case self::TYPE_EXACT_TOP:
break;
default:
$this->throwError("Wrong image type: ".$type);
break;
}
}
}
?>

View File

@ -0,0 +1,18 @@
<?php
$folderIncludes = dirname(__FILE__)."/";
require_once $folderIncludes . 'functions.php';
require_once $folderIncludes . 'functions.class.php';
require_once $folderIncludes . 'functions_wordpress.class.php';
require_once $folderIncludes . 'db.class.php';
require_once $folderIncludes . 'settings.class.php';
require_once $folderIncludes . 'cssparser.class.php';
require_once $folderIncludes . 'settings_advances.class.php';
require_once $folderIncludes . 'settings_output.class.php';
require_once $folderIncludes . 'settings_product.class.php';
require_once $folderIncludes . 'settings_product_sidebar.class.php';
require_once $folderIncludes . 'image_view.class.php';
require_once $folderIncludes . 'zip.class.php';
?>

View File

@ -0,0 +1,961 @@
<?php
/**
*
* unite settings class.
* @version 1.1
*
*/
class UniteSettingsRev{
const COLOR_OUTPUT_FLASH = "flash";
const COLOR_OUTPUT_HTML = "html";
//------------------------------------------------------------
const RELATED_NONE = "";
const TYPE_TEXT = "text";
const TYPE_COLOR = "color";
const TYPE_SELECT = "list";
const TYPE_CHECKBOX = "checkbox";
const TYPE_RADIO = "radio";
const TYPE_TEXTAREA = "textarea";
const TYPE_STATIC_TEXT = "statictext";
const TYPE_HR = "hr";
const TYPE_CUSTOM = "custom";
const ID_PREFIX = "";
const TYPE_CONTROL = "control";
const TYPE_BUTTON = "button";
const TYPE_IMAGE = "image";
const TYPE_CHECKLIST = "checklist";
//------------------------------------------------------------
//set data types
const DATATYPE_NUMBER = "number";
const DATATYPE_STRING = "string";
const DATATYPE_BOOLEAN = "boolean";
const CONTROL_TYPE_ENABLE = "enable";
const CONTROL_TYPE_DISABLE = "disable";
const CONTROL_TYPE_SHOW = "show";
const CONTROL_TYPE_HIDE = "hide";
//additional parameters that can be added to settings.
const PARAM_TEXTSTYLE = "textStyle";
const PARAM_ADDPARAMS = "addparams"; //additional text after the field
const PARAM_ADDTEXT = "addtext"; //additional text after the field
const PARAM_ADDTEXT_BEFORE_ELEMENT = "addtext_before_element"; //additional text after the field
const PARAM_CELLSTYLE = "cellStyle"; //additional text after the field
//view defaults:
protected $defaultText = "Enter value";
protected $sap_size = 5;
//other variables:
protected $HRIdCounter = 0; //counter of hr id
protected $arrSettings = array();
protected $arrSections = array();
protected $arrIndex = array(); //index of name->index of the settings.
protected $arrSaps = array();
//controls:
protected $arrControls = array(); //array of items that controlling others (hide/show or enabled/disabled)
protected $arrBulkControl = array(); //bulk cotnrol array. if not empty, every settings will be connected with control.
//custom functions:
protected $customFunction_afterSections = null;
protected $colorOutputType = self::COLOR_OUTPUT_HTML;
//-----------------------------------------------------------------------------------------------
// constructor
public function __construct(){
}
//-----------------------------------------------------------------------------------------------
// get where query according relatedTo and relatedID.
private function getWhereQuery(){
$where = "relatedTo='".$this->relatedTo."' and relatedID='".$this->relatedID."'";
return($where);
}
//-----------------------------------------------------------------------------------------------
//set type of color output
public function setColorOutputType($type){
$this->colorOutputType = $type;
}
//-----------------------------------------------------------------------------------------------
//set the related to/id for saving/restoring settings.
public function setRelated($relatedTo,$relatedID){
$this->relatedTo = $relatedTo;
$this->relatedID = $relatedID;
}
//-----------------------------------------------------------------------------------------------
//modify the data before save
private function modifySettingsData($arrSettings){
foreach($arrSettings as $key=>$content){
switch(getType($content)){
case "string":
//replace the unicode line break (sometimes left after json)
$content = str_replace("u000a","\n",$content);
$content = str_replace("u000d","",$content);
break;
case "object":
case "array":
$content = UniteFunctionsRev::convertStdClassToArray($content);
break;
}
$arrSettings[$key] = $content;
}
return($arrSettings);
}
//-----------------------------------------------------------------------------------------------
// add the section value to the setting
private function checkAndAddSectionAndSap($setting){
//add section
if(!empty($this->arrSections)){
$sectionKey = count($this->arrSections)-1;
$setting["section"] = $sectionKey;
$section = $this->arrSections[$sectionKey];
$sapKey = count($section["arrSaps"])-1;
$setting["sap"] = $sapKey;
}
else{
//please impliment add sap normal!!! - without sections
}
return($setting);
}
//-----------------------------------------------------------------------------------------------
// validate items parameter. throw exception on error
private function validateParamItems($arrParams){
if(!isset($arrParams["items"])) throw new Exception("no select items presented");
if(!is_array($arrParams["items"])) throw new Exception("the items parameter should be array");
if(empty($arrParams["items"])) throw new Exception("the items array should not be empty");
}
//-----------------------------------------------------------------------------------------------
//add this setting to index
private function addSettingToIndex($name){
$this->arrIndex[$name] = count($this->arrSettings)-1;
}
//-----------------------------------------------------------------------------------------------
//get types array from all the settings:
protected function getArrTypes(){
$arrTypesAssoc = array();
$arrTypes = array();
foreach($this->arrSettings as $setting){
$type = $setting["type"];
if(!isset($arrTypesAssoc[$type])) $arrTypes[] = $type;
$arrTypesAssoc[$type] = "";
}
return($arrTypes);
}
//-----------------------------------------------------------------------------------------------
// get json client object for javascript
public function getJsonClientString(){
$arrSettingTypes = array();
foreach($this->arrSettings as $setting){
if(isset($setting["name"]))
$arrSettingTypes[$setting["name"]] = $setting["datatype"];
}
$strJson = json_encode($arrSettingTypes);
return($strJson);
}
/**
*
* get settings array
*/
public function getArrSettings(){
return($this->arrSettings);
}
/**
*
* get sections
*/
public function getArrSections(){
return($this->arrSections);
}
/**
*
* get controls
*/
public function getArrControls(){
return($this->arrControls);
}
/**
*
* set settings array
*/
public function setArrSettings($arrSettings){
$this->arrSettings = $arrSettings;
}
//-----------------------------------------------------------------------------------------------
//get number of settings
public function getNumSettings(){
$counter = 0;
foreach($this->arrSettings as $setting){
switch($setting["type"]){
case self::TYPE_HR:
case self::TYPE_STATIC_TEXT:
break;
default:
$counter++;
break;
}
}
return($counter);
}
//private function
//-----------------------------------------------------------------------------------------------
// add radio group
public function addRadio($name,$arrItems,$text = "",$defaultItem="",$arrParams = array()){
$params = array("items"=>$arrItems);
$params = array_merge($params,$arrParams);
$this->add($name,$defaultItem,$text,self::TYPE_RADIO,$params);
}
//-----------------------------------------------------------------------------------------------
//add text area control
public function addTextArea($name,$defaultValue,$text,$arrParams = array()){
$this->add($name,$defaultValue,$text,self::TYPE_TEXTAREA,$arrParams);
}
//-----------------------------------------------------------------------------------------------
//add button control
public function addButton($name,$value,$arrParams = array()){
$this->add($name,$value,"",self::TYPE_BUTTON,$arrParams);
}
//-----------------------------------------------------------------------------------------------
// add checkbox element
public function addCheckbox($name,$defaultValue = false,$text = "",$arrParams = array()){
$this->add($name,$defaultValue,$text,self::TYPE_CHECKBOX,$arrParams);
}
//-----------------------------------------------------------------------------------------------
//add text box element
public function addTextBox($name,$defaultValue = "",$text = "",$arrParams = array()){
$this->add($name,$defaultValue,$text,self::TYPE_TEXT,$arrParams);
}
//-----------------------------------------------------------------------------------------------
//add image selector
public function addImage($name,$defaultValue = "",$text = "",$arrParams = array()){
$this->add($name,$defaultValue,$text,self::TYPE_IMAGE,$arrParams);
}
//-----------------------------------------------------------------------------------------------
//add color picker setting
public function addColorPicker($name,$defaultValue = "",$text = "",$arrParams = array()){
$this->add($name,$defaultValue,$text,self::TYPE_COLOR,$arrParams);
}
/**
*
* add custom setting
*/
public function addCustom($customType,$name,$defaultValue = "",$text = "",$arrParams = array()){
$params = array();
$params["custom_type"] = $customType;
$params = array_merge($params,$arrParams);
$this->add($name,$defaultValue,$text,self::TYPE_CUSTOM,$params);
}
//-----------------------------------------------------------------------------------------------
//add horezontal sap
public function addHr($name="",$params=array()){
$setting = array();
$setting["type"] = self::TYPE_HR;
//set item name
$itemName = "";
if($name != "") $itemName = $name;
else{ //generate hr id
$this->HRIdCounter++;
$itemName = "hr".$this->HRIdCounter;
}
$setting["id"] = self::ID_PREFIX.$itemName;
$setting["id_row"] = $setting["id"]."_row";
//addsection and sap keys
$setting = $this->checkAndAddSectionAndSap($setting);
$this->checkAddBulkControl($itemName);
$setting = array_merge($params,$setting);
$this->arrSettings[] = $setting;
//add to settings index
$this->addSettingToIndex($itemName);
}
//-----------------------------------------------------------------------------------------------
//add static text
public function addStaticText($text,$name="",$params=array()){
$setting = array();
$setting["type"] = self::TYPE_STATIC_TEXT;
//set item name
$itemName = "";
if($name != "") $itemName = $name;
else{ //generate hr id
$this->HRIdCounter++;
$itemName = "textitem".$this->HRIdCounter;
}
$setting["id"] = self::ID_PREFIX.$itemName;
$setting["id_row"] = $setting["id"]."_row";
$setting["text"] = $text;
$this->checkAddBulkControl($itemName);
$params = array_merge($params,$setting);
//addsection and sap keys
$setting = $this->checkAndAddSectionAndSap($setting);
$this->arrSettings[] = $setting;
//add to settings index
$this->addSettingToIndex($itemName);
}
/**
* add select setting
*/
public function addSelect($name,$arrItems,$text,$defaultItem="",$arrParams=array()){
$params = array("items"=>$arrItems);
$params = array_merge($params,$arrParams);
$this->add($name,$defaultItem,$text,self::TYPE_SELECT,$params);
}
/**
* add select setting
*/
public function addChecklist($name,$arrItems,$text,$defaultItem="",$arrParams=array()){
$params = array("items"=>$arrItems);
$params = array_merge($params,$arrParams);
$this->add($name,$defaultItem,$text,self::TYPE_CHECKLIST,$params);
}
/**
*
* add saporator
*/
public function addSap($text, $name="", $opened = false){
if(empty($text))
UniteFunctionsRev::throwError("sap $name must have a text");
//create sap array
$sap = array();
$sap["name"] = $name;
$sap["text"] = $text;
if($opened == true) $sap["opened"] = true;
//add sap to current section
if(!empty($this->arrSections)){
$lastSection = end($this->arrSections);
$section_keys = array_keys($this->arrSections);
$lastSectionKey = end($section_keys);
$arrSaps = $lastSection["arrSaps"];
$arrSaps[] = $sap;
$this->arrSections[$lastSectionKey]["arrSaps"] = $arrSaps;
$sap_keys = array_keys($arrSaps);
$sapKey = end($sap_keys);
}
else{
$this->arrSaps[] = $sap;
}
}
//-----------------------------------------------------------------------------------------------
//get sap data:
public function getSap($sapKey,$sectionKey=-1){
//get sap without sections:
if($sectionKey == -1) return($this->arrSaps[$sapKey]);
if(!isset($this->arrSections[$sectionKey])) throw new Exception("Sap on section:".$sectionKey." doesn't exists");
$arrSaps = $this->arrSections[$sectionKey]["arrSaps"];
if(!isset($arrSaps[$sapKey])) throw new Exception("Sap with key:".$sapKey." doesn't exists");
$sap = $arrSaps[$sapKey];
return($sap);
}
//-----------------------------------------------------------------------------------------------
// add a new section. Every settings from now on will be related to this section
public function addSection($label,$name=""){
if(!empty($this->arrSettings) && empty($this->arrSections))
UniteFunctionsRev::throwError("You should add first section before begin to add settings. (section: $text)");
if(empty($label))
UniteFunctionsRev::throwError("You have some section without text");
$arrSection = array(
"text"=>$label,
"arrSaps"=>array(),
"name"=>$name
);
$this->arrSections[] = $arrSection;
}
//-----------------------------------------------------------------------------------------------
//add setting, may be in different type, of values
protected function add($name,$defaultValue = "",$text = "",$type = self::TYPE_TEXT,$arrParams = array()){
//validation:
if(empty($name)) throw new Exception("Every setting should have a name!");
switch($type){
case self::TYPE_RADIO:
case self::TYPE_SELECT:
$this->validateParamItems($arrParams);
break;
case self::TYPE_CHECKBOX:
if(!is_bool($defaultValue)) throw new Exception("The checkbox value should be boolean");
break;
}
//validate name:
if(isset($this->arrIndex[$name])) throw new Exception("Duplicate setting name:".$name);
$this->checkAddBulkControl($name);
//set defaults:
if($text == "") $text = $this->defaultText;
$setting = array();
$setting["name"] = $name;
$setting["id"] = self::ID_PREFIX.$name;
$setting["id_service"] = $setting["id"]."_service";
$setting["id_row"] = $setting["id"]."_row";
$setting["type"] = $type;
$setting["text"] = $text;
$setting["value"] = $defaultValue;
//set data type:
switch($setting["type"]){
case self::TYPE_COLOR:
$dataType = self::DATATYPE_STRING;
break;
default:
switch(getType($defaultValue)){
case "integer":
case "double":
$dataType = self::DATATYPE_NUMBER;
break;
case "boolean":
$dataType = self::DATATYPE_BOOLEAN;
break;
case "string":
default:
$dataType = self::DATATYPE_STRING;
break;
}
break;
}
$setting["datatype"] = $dataType;
$setting = array_merge($setting,$arrParams);
//addsection and sap keys
$setting = $this->checkAndAddSectionAndSap($setting);
$this->arrSettings[] = $setting;
//add to settings index
$this->addSettingToIndex($name);
}
//-----------------------------------------------------------------------------------------------
//add a item that controlling visibility of enabled/disabled of other.
public function addControl($control_item_name,$controlled_item_name,$control_type,$value){
UniteFunctionsRev::validateNotEmpty($control_item_name,"control parent");
UniteFunctionsRev::validateNotEmpty($controlled_item_name,"control child");
UniteFunctionsRev::validateNotEmpty($control_type,"control type");
UniteFunctionsRev::validateNotEmpty($value,"control value");
$arrControl = array();
if(isset($this->arrControls[$control_item_name]))
$arrControl = $this->arrControls[$control_item_name];
$arrControl[] = array("name"=>$controlled_item_name,"type"=>$control_type,"value"=>$value);
$this->arrControls[$control_item_name] = $arrControl;
}
//-----------------------------------------------------------------------------------------------
//start control of all settings that comes after this function (between startBulkControl and endBulkControl)
public function startBulkControl($control_item_name,$control_type,$value){
$this->arrBulkControl = array("control_name"=>$control_item_name,"type"=>$control_type,"value"=>$value);
}
//-----------------------------------------------------------------------------------------------
//end bulk control
public function endBulkControl(){
$this->arrBulkControl = array();
}
//-----------------------------------------------------------------------------------------------
//build name->(array index) of the settings.
private function buildArrSettingsIndex(){
$this->arrIndex = array();
foreach($this->arrSettings as $key=>$value)
if(isset($value["name"])) $this->arrIndex[$value["name"]] = $key;
}
//-----------------------------------------------------------------------------------------------
// set sattes of the settings (enabled/disabled, visible/invisible) by controls
public function setSettingsStateByControls(){
foreach($this->arrControls as $control_name => $arrControlled){
//take the control value
if(!isset($this->arrIndex[$control_name])) throw new Exception("There is not sutch control setting: '$control_name'");
$index = $this->arrIndex[$control_name];
$parentValue = strtolower($this->arrSettings[$index]["value"]);
//set child (controlled) attributes
foreach($arrControlled as $controlled){
if(!isset($this->arrIndex[$controlled["name"]])) throw new Exception("There is not sutch controlled setting: '".$controlled["name"]."'");
$indexChild = $this->arrIndex[$controlled["name"]];
$child = $this->arrSettings[$indexChild];
$value = strtolower($controlled["value"]);
switch($controlled["type"]){
case self::CONTROL_TYPE_ENABLE:
if($value != $parentValue) $child["disabled"] = true;
break;
case self::CONTROL_TYPE_DISABLE:
if($value == $parentValue) $child["disabled"] = true;
break;
case self::CONTROL_TYPE_SHOW:
if($value != $parentValue) $child["hidden"] = true;
break;
case self::CONTROL_TYPE_HIDE:
if($value == $parentValue) $child["hidden"] = true;
break;
}
$this->arrSettings[$indexChild] = $child;
}
}//end foreach
}
//-----------------------------------------------------------------------------------------------
//check that bulk control is available , and add some element to it.
private function checkAddBulkControl($name){
//add control
if(!empty($this->arrBulkControl))
$this->addControl($this->arrBulkControl["control_name"],$name,$this->arrBulkControl["type"],$this->arrBulkControl["value"]);
}
//-----------------------------------------------------------------------------------------------
//set custom function that will be run after sections will be drawen
public function setCustomDrawFunction_afterSections($func){
$this->customFunction_afterSections = $func;
}
/**
*
* parse options from xml field
* @param $field
*/
private function getOptionsFromXMLField($field,$fieldName){
$arrOptions = array();
$arrField = (array)$field;
$options = UniteFunctionsRev::getVal($arrField, "option");
if(empty($options))
return($arrOptions);
foreach($options as $option){
if(gettype($option) == "string")
UniteFunctionsRev::throwError("Wrong options type: ".$option." in field: $fieldName");
$attribs = $option->attributes();
$optionValue = (string)UniteFunctionsRev::getVal($attribs, "value");
$optionText = (string)UniteFunctionsRev::getVal($attribs, "text");
//validate options:
UniteFunctionsRev::validateNotEmpty($optionValue,"option value");
UniteFunctionsRev::validateNotEmpty($optionText,"option text");
$arrOptions[$optionValue] = $optionText;
}
return($arrOptions);
}
/**
*
* load settings from xml file
*/
public function loadXMLFile($filepath){
if(!file_exists($filepath))
UniteFunctionsRev::throwError("File: '$filepath' not exists!!!");
$obj = simplexml_load_file($filepath);
if(empty($obj))
UniteFunctionsRev::throwError("Wrong xml file format: $filepath");
$fieldsets = $obj->fieldset;
if(!@count($obj->fieldset)){
$fieldsets = array($fieldsets);
}
$this->addSection("Xml Settings");
foreach($fieldsets as $fieldset){
//Add Section
$attribs = $fieldset->attributes();
$sapName = (string)UniteFunctionsRev::getVal($attribs, "name");
$sapLabel = (string)UniteFunctionsRev::getVal($attribs, "label");
UniteFunctionsRev::validateNotEmpty($sapName,"sapName");
UniteFunctionsRev::validateNotEmpty($sapLabel,"sapLabel");
$this->addSap($sapLabel,$sapName);
//--- add fields
$fieldset = (array)$fieldset;
$fields = $fieldset["field"];
if(is_array($fields) == false)
$fields = array($fields);
foreach($fields as $field){
$attribs = $field->attributes();
$fieldType = (string)UniteFunctionsRev::getVal($attribs, "type");
$fieldName = (string)UniteFunctionsRev::getVal($attribs, "name");
$fieldLabel = (string)UniteFunctionsRev::getVal($attribs, "label");
$fieldDefaultValue = (string)UniteFunctionsRev::getVal($attribs, "default");
//all other params will be added to "params array".
$arrMustParams = array("type","name","label","default");
$arrParams = array();
foreach($attribs as $key=>$value){
$key = (string)$key;
$value = (string)$value;
//skip must params:
if(in_array($key, $arrMustParams))
continue;
$arrParams[$key] = $value;
}
$options = $this->getOptionsFromXMLField($field,$fieldName);
//validate must fields:
UniteFunctionsRev::validateNotEmpty($fieldType,"type");
//validate name
if($fieldType != self::TYPE_HR && $fieldType != self::TYPE_CONTROL &&
$fieldType != "bulk_control_start" && $fieldType != "bulk_control_end")
UniteFunctionsRev::validateNotEmpty($fieldName,"name");
switch ($fieldType){
case self::TYPE_CHECKBOX:
$fieldDefaultValue = UniteFunctionsRev::strToBool($fieldDefaultValue);
$this->addCheckbox($fieldName,$fieldDefaultValue,$fieldLabel,$arrParams);
break;
case self::TYPE_COLOR:
$this->addColorPicker($fieldName,$fieldDefaultValue,$fieldLabel,$arrParams);
break;
case self::TYPE_HR:
$this->addHr();
break;
case self::TYPE_TEXT:
$this->addTextBox($fieldName,$fieldDefaultValue,$fieldLabel,$arrParams);
break;
case self::TYPE_STATIC_TEXT:
$this->addStaticText($fieldLabel, $fieldName, $arrParams);
break;
case self::TYPE_IMAGE:
$this->addImage($fieldName,$fieldDefaultValue,$fieldLabel,$arrParams);
break;
case self::TYPE_SELECT:
$this->addSelect($fieldName, $options, $fieldLabel,$fieldDefaultValue,$arrParams);
break;
case self::TYPE_CHECKBOX:
$this->addChecklist($fieldName, $options, $fieldLabel,$fieldDefaultValue,$arrParams);
break;
case self::TYPE_RADIO:
$this->addRadio($fieldName, $options, $fieldLabel,$fieldDefaultValue,$arrParams);
break;
case self::TYPE_TEXTAREA:
$this->addTextArea($fieldName, $fieldDefaultValue, $fieldLabel, $arrParams);
break;
case self::TYPE_CUSTOM:
$this->add($fieldName, $fieldDefaultValue, $fieldLabel, self::TYPE_CUSTOM, $arrParams);
break;
case self::TYPE_CONTROL:
$parent = UniteFunctionsRev::getVal($arrParams, "parent");
$child = UniteFunctionsRev::getVal($arrParams, "child");
$ctype = UniteFunctionsRev::getVal($arrParams, "ctype");
$value = UniteFunctionsRev::getVal($arrParams, "value");
$this->addControl($parent, $child, $ctype, $value);
break;
case "bulk_control_start":
$parent = UniteFunctionsRev::getVal($arrParams, "parent");
$ctype = UniteFunctionsRev::getVal($arrParams, "ctype");
$value = UniteFunctionsRev::getVal($arrParams, "value");
$this->startBulkControl($parent, $ctype, $value);
break;
case "bulk_control_end":
$this->endBulkControl();
break;
default:
UniteFunctionsRev::throwError("wrong type: $fieldType");
break;
}
}
}
}
/**
*
* get titles and descriptions array
*/
public function getArrTextFromAllSettings(){
$arr = array();
$arrUnits = array();
//get saps array:
foreach($this->arrSections as $section){
$arrSaps = UniteFunctionsRev::getVal($section, "arrSaps");
if(empty($arrSaps))
continue;
foreach($arrSaps as $sap){
$text = $sap["text"];
if(!empty($text))
$arr[] = $text;
}
}
foreach($this->arrSettings as $setting){
$text = UniteFunctionsRev::getVal($setting, "text");
$desc = UniteFunctionsRev::getVal($setting, "description");
$unit = UniteFunctionsRev::getVal($setting, "unit");
if(!empty($text))
$arr[] = $text;
if(!empty($desc))
$arr[] = $desc;
if(!empty($unit)){
if(!isset($arrUnits[$unit]))
$arr[] = $unit;
$arrUnits[$unit] = true;
}
$items = UniteFunctionsRev::getVal($setting, "items");
if(!empty($items)){
foreach($items as $item){
if(!isset($arrUnits[$item]))
$arr[] = $item;
$arrUnits[$item] = true;
}
}
}
return($arr);
}
/**
*
* get setting array by name
*/
public function getSettingByName($name){
//if index present
if(!empty($this->arrIndex)){
if(array_key_exists($name, $this->arrIndex) == false)
UniteFunctionsRev::throwError("setting $name not found");
$index = $this->arrIndex[$name];
$setting = $this->arrSettings[$index];
return($setting);
}
//if no index
foreach($this->arrSettings as $setting){
$settingName = UniteFunctionsRev::getVal($setting, "name");
if($settingName == $name)
return($setting);
}
UniteFunctionsRev::throwError("Setting with name: $name don't exists");
}
/**
*
* get value of some setting
* @param $name
*/
public function getSettingValue($name,$default=""){
$setting = $this->getSettingByName($name);
$value = UniteFunctionsRev::getVal($setting, "value",$default);
return($value);
}
/**
*
* update setting array by name
*/
public function updateArrSettingByName($name,$setting){
foreach($this->arrSettings as $key => $settingExisting){
$settingName = UniteFunctionsRev::getVal($settingExisting,"name");
if($settingName == $name){
$this->arrSettings[$key] = $setting;
return(false);
}
}
UniteFunctionsRev::throwError("Setting with name: $name don't exists");
}
/**
*
* update default value in the setting
*/
public function updateSettingValue($name,$value){
$setting = $this->getSettingByName($name);
$setting["value"] = $value;
$this->updateArrSettingByName($name, $setting);
}
/**
*
* set values from array of stored settings elsewhere.
*/
public function setStoredValues($arrValues){
foreach($this->arrSettings as $key=>$setting){
$name = UniteFunctionsRev::getVal($setting, "name");
//type consolidation
$type = UniteFunctionsRev::getVal($setting, "type");
$customType = UniteFunctionsRev::getVal($setting, "custom_type");
if(!empty($customType))
$type .= ".".$customType;
switch($type){
case "custom.kenburns_position":
$name = $setting["name"];
if(array_key_exists($name."_hor", $arrValues)){
$value_vert = UniteFunctionsRev::getVal($arrValues, $name."_vert","random");
$value_hor = UniteFunctionsRev::getVal($arrValues, $name."_hor","random");
$this->arrSettings[$key]["value"] = "$value_vert,$value_hor";
}
break;
default:
if(array_key_exists($name, $arrValues)){
$this->arrSettings[$key]["value"] = $arrValues[$name];
}
break;
}
}
}
/**
* get setting values. replace from stored ones if given
*/
public function getArrValues(){
$arrSettingsOutput = array();
//modify settings by type
foreach($this->arrSettings as $setting){
if($setting["type"] == self::TYPE_HR
||$setting["type"] == self::TYPE_STATIC_TEXT)
continue;
$value = $setting["value"];
//modify value by type
switch($setting["type"]){
case self::TYPE_COLOR:
$value = strtolower($value);
//set color output type
if($this->colorOutputType == self::COLOR_OUTPUT_FLASH)
$value = str_replace("#","0x",$value);
break;
case self::TYPE_CHECKBOX:
if($value == true) $value = "true";
else $value = "false";
break;
}
//remove lf
if(isset($setting["remove_lf"])){
$value = str_replace("\n","",$value);
$value = str_replace("\r\n","",$value);
}
$arrSettingsOutput[$setting["name"]] = $value;
}
return($arrSettingsOutput);
}
}
?>

View File

@ -0,0 +1,135 @@
<?php
// advanced settings class. adds some advanced features
class UniteSettingsAdvancedRev extends UniteSettingsRev{
//------------------------------------------------------------------------------
//add boolean true/false select with custom names
public function addSelect_boolean($name,$text,$bValue=true,$firstItem="Enable",$secondItem="Disable",$arrParams=array()){
$arrItems = array("true"=>$firstItem,"false"=>$secondItem);
$defaultText = "true";
if($bValue == false) $defaultText = "false";
$this->addSelect($name,$arrItems,$text,$defaultText,$arrParams);
}
//------------------------------------------------------------------------------
//add float select
public function addSelect_float($name,$defaultValue,$text,$arrParams=array()){
$this->addSelect($name,array("left"=>"Left","right"=>"Right"),$text,$defaultValue,$arrParams);
}
//------------------------------------------------------------------------------
//add align select
public function addSelect_alignX($name,$defaultValue,$text,$arrParams=array()){
$this->addSelect($name,array("left"=>"Left","center"=>"Center","right"=>"Right"),$text,$defaultValue,$arrParams);
}
//------------------------------------------------------------------------------
//add align select
public function addSelect_alignY($name,$defaultValue,$text,$arrParams=array()){
$this->addSelect($name,array("top"=>"Top","middle"=>"Middle","bottom"=>"Bottom"),$text,$defaultValue,$arrParams);
}
//------------------------------------------------------------------------------
//add transitions select
public function addSelect_border($name,$defaultValue,$text,$arrParams=array()){
$arrItems = array();
$arrItems["solid"] = "Solid";
$arrItems["dashed"] = "Dashed";
$arrItems["dotted"] = "Dotted";
$arrItems["double"] = "Double";
$arrItems["groove"] = "Groove";
$arrItems["ridge"] = "Ridge";
$arrItems["inset"] = "Inset";
$arrItems["outset"] = "Outset";
$this->addSelect($name,$arrItems,$text,$defaultValue,$arrParams);
}
//------------------------------------------------------------------------------
//add transitions select
public function addSelect_textDecoration($name,$defaultValue,$text,$arrParams=array()){
$arrItems = array();
$arrItems["none"] = "None";
$arrItems["underline"] = "Underline";
$arrItems["overline"] = "Overline";
$arrItems["line-through"] = "Line-through";
$this->addSelect($name,$arrItems,$text,$defaultValue,$arrParams);
}
//------------------------------------------------------------------------------
//add transitions select - arrExtensions may be string, and lower case
public function addSelect_filescan($name,$path,$arrExtensions,$defaultValue,$text,$arrParams=array()){
if(getType($arrExtensions) == "string")
$arrExtensions = array($arrExtensions);
elseif(getType($arrExtensions) != "array")
$this->throwError("The extensions array is not array and not string in setting: $name, please check.");
//make items array
if(!is_dir($path))
$this->throwError("path: $path not found");
$arrItems = array();
$files = scandir($path);
foreach($files as $file){
//general filter
if($file == ".." || $file == "." || $file == ".svn")
continue;
$info = pathinfo($file);
$ext = UniteFunctionsRev::getVal($info,"extension");
$ext = strtolower($ext);
if(array_search($ext,$arrExtensions) === FALSE)
continue;
$arrItems[$file] = $file;
}
//handle add data array
if(isset($arrParams["addData"])){
foreach($arrParams["addData"] as $key=>$value)
$arrItems[$key] = $value;
}
if(empty($defaultValue) && !empty($arrItems))
$defaultValue = current($arrItems);
$this->addSelect($name,$arrItems,$text,$defaultValue,$arrParams);
}
//------------------------------------------------------------------------------
//add transitions select
public function addSelect_transitions($name,$defaultValue,$text,$arrParams=array()){
$arrItems = array();
$arrItems["linear"] = "Linear";
$arrItems["easeOutQuint"] = "EaseOut";
$arrItems["easeInQuint"] = "EaseIn";
$arrItems["easeInOutQuad"] = "EaseInOut";
$arrItems["easeOutElastic"] = "EaseIn - Elastic";
$arrItems["easeOutBounce"] = "EaseIn - Bounce";
$arrItems["easeOutBack"] = "EaseIn - Back";
$arrItems["easeOutQuart"] = "EaseIn - Quart";
$arrItems["easeOutExpo"] = "EaseIn - Expo";
$arrItems["easeInElastic"] = "EaseOut - Elastic";
$arrItems["easeInBounce"] = "EaseOut - Bounce";
$arrItems["easeInBack"] = "EaseOut - Back";
$arrItems["easeInQuart"] = "EaseOut - Quart";
$arrItems["easeInExpo"] = "EaseOut - Expo";
$arrItems["easeInOutElastic"] = "EaseInOut - Elastic";
$arrItems["easeInOutBounce"] = "EaseInOut - Bounce";
$arrItems["easeInOutBack"] = "EaseInOut - Back";
$arrItems["easeInOutQuart"] = "EaseInOut - Quart";
$arrItems["easeInOutExpo"] = "EaseInOut - Expo";
$this->addSelect($name,$arrItems,$text,$defaultValue,$arrParams);
}
}
?>

View File

@ -0,0 +1,248 @@
<?php
class UniteSettingsOutputRev{
protected $arrSettings = array();
protected $settings;
protected $formID;
/**
*
* init the output settings
*/
public function init(UniteSettingsRev $settings){
$this->settings = new UniteSettingsRev();
$this->settings = $settings;
}
/**
*
* draw order box
* @param $setting
*/
protected function drawOrderbox($setting){
$items = $setting["items"];
//get arrItems by saved value
$arrItems = array();
if(!empty($setting["value"]) &&
getType($setting["value"]) == "array" &&
count($setting["value"]) == count($items)){
$savedItems = $setting["value"];
foreach($savedItems as $value){
$text = $value;
if(isset($items[$value]))
$text = $items[$value];
$arrItems[] = array("value"=>$value,"text"=>$text);
}
} //get arrItems only from original items
else{
foreach($items as $value=>$text)
$arrItems[] = array("value"=>$value,"text"=>$text);
}
?>
<ul class="orderbox" id="<?php echo $setting["id"]?>">
<?php
foreach($arrItems as $item){
$itemKey = $item["value"];
$itemText = $item["text"];
$value = (getType($itemKey) == "string")?$itemKey:$itemText;
?>
<li>
<div class="div_value"><?php echo $value?></div>
<div class="div_text"><?php echo $itemText?></div>
</li>
<?php
}
?>
</ul>
<?php
}
//-----------------------------------------------------------------------------------------------
//draw advanced order box
protected function drawOrderbox_advanced($setting){
$items = $setting["items"];
if(!is_array($items))
$this->throwError("Orderbox error - the items option must be array (items)");
//get arrItems modify items by saved value
if(!empty($setting["value"]) &&
getType($setting["value"]) == "array" &&
count($setting["value"]) == count($items)):
$savedItems = $setting["value"];
//make assoc array by id:
$arrAssoc = array();
foreach($items as $item)
$arrAssoc[$item[0]] = $item[1];
foreach($savedItems as $item){
$value = $item["id"];
$text = $value;
if(isset($arrAssoc[$value]))
$text = $arrAssoc[$value];
$arrItems[] = array($value,$text,$item["enabled"]);
}
else:
$arrItems = $items;
endif;
?>
<ul class="orderbox_advanced" id="<?php echo $setting["id"]?>">
<?php
foreach($arrItems as $arrItem){
switch(getType($arrItem)){
case "string":
$value = $arrItem;
$text = $arrItem;
$enabled = true;
break;
case "array":
$value = $arrItem[0];
$text = (count($arrItem)>1)?$arrItem[1]:$arrItem[0];
$enabled = (count($arrItem)>2)?$arrItem[2]:true;
break;
default:
$this->throwError("Error in setting:".$setting.". unknown item type.");
break;
}
$checkboxClass = $enabled ? "div_checkbox_on" : "div_checkbox_off";
?>
<li>
<div class="div_value"><?php echo $value?></div>
<div class="div_checkbox <?php echo $checkboxClass?>"></div>
<div class="div_text"><?php echo $text?></div>
<div class="div_handle"></div>
</li>
<?php
}
?>
</ul>
<?php
}
/**
*
* draw includes of the settings.
*/
public function drawHeaderIncludes(){
$arrSections = $this->settings->getArrSections();
$arrControls = $this->settings->getArrControls();
$formID = $this->formID;
$arrOnReady = array();
$arrJs = array();
//put json string types
$jsonString = $this->settings->getJsonClientString();
//$arrJs[] = "obj.jsonSettingTypes = '$jsonString'";
//$arrJs[] = "obj.objSettingTypes = JSON.parse(obj.jsonSettingTypes);";
//put sections vars
/*
if(!empty($arrSections)){
$arrJs[] = "obj.sectionsEnabled = true;";
$arrJs[] = "obj.numSections = ".count($arrSections).";";
}
else
$arrJs[] = "obj.sectionsEnabled = false;";
*/
//put the settings into form id
$arrJs[] = "g_settingsObj['$formID'] = {}";
//put controls json object:
if(!empty($arrControls)){
$strControls = json_encode($arrControls);
$arrJs[] = "g_settingsObj['$formID'].jsonControls = '".$strControls."'";
$arrJs[] = "g_settingsObj['$formID'].controls = JSON.parse(g_settingsObj['$formID'].jsonControls);";
}
/*
//put types onready function
$arrTypes = $this->getArrTypes();
//put script includes:
foreach($arrTypes as $type){
switch($type){
case UniteSettingsRev::TYPE_ORDERBOX:
$arrOnReady[] = "$(function() { $( '.orderbox' ).sortable();}); ";
break;
case UniteSettingsRev::TYPE_ORDERBOX_ADVANCED:
$arrOnReady[] = "init_advanced_orderbox();";
break;
}
}
*/
//put js vars and onready func.
echo "<script type='text/javascript'>\n";
//put js
foreach($arrJs as $line){
echo $line."\n";
}
if(!empty($arrOnReady)):
//put onready
echo "$(document).ready(function(){\n";
foreach($arrOnReady as $line){
echo $line."\n";
}
echo "});";
endif;
echo "\n</script>\n";
}
//-----------------------------------------------------------------------------------------------
// draw after body additional settings accesories
public function drawAfterBody(){
$arrTypes = $this->settings->getArrTypes();
foreach($arrTypes as $type){
switch($type){
case self::TYPE_COLOR:
?>
<div id='divPickerWrapper' style='position:absolute;display:none;'><div id='divColorPicker'></div></div>
<?php
break;
}
}
}
/**
*
* do some operation before drawing the settings.
*/
protected function prepareToDraw(){
$this->settings->setSettingsStateByControls();
}
}
?>

View File

@ -0,0 +1,618 @@
<?php
class UniteSettingsRevProductRev extends UniteSettingsOutputRev{
//-----------------------------------------------------------------------------------------------
//draw text as input
protected function drawTextInput($setting) {
$disabled = "";
$style="";
$readonly = "";
if(isset($setting["style"]))
$style = "style='".$setting["style"]."'";
if(isset($setting["disabled"]))
$disabled = 'disabled="disabled"';
if(isset($setting["readonly"])){
$readonly = "readonly='readonly'";
}
$class = "regular-text";
if(isset($setting["class"]) && !empty($setting["class"])){
$class = $setting["class"];
//convert short classes:
switch($class){
case "small":
$class = "small-text";
break;
case "code":
$class = "regular-text code";
break;
}
}
if(!empty($class))
$class = "class='$class'";
?>
<input type="text" <?php echo $class?> <?php echo $style?> <?php echo $disabled?><?php echo $readonly?> id="<?php echo $setting["id"]?>" name="<?php echo $setting["name"]?>" value="<?php echo $setting["value"]?>" />
<?php
}
/**
*
* draw imaeg input:
* @param $setting
*/
protected function drawImageInput($setting){
$class = UniteFunctionsRev::getVal($setting, "class");
if(!empty($class))
$class = "class='$class'";
$settingsID = $setting["id"];
$buttonID = $settingsID."_button";
$spanPreviewID = $buttonID."_preview";
$img = "";
$value = UniteFunctionsRev::getVal($setting, "value");
if(!empty($value)){
$urlImage = $value;
$imagePath = UniteFunctionsWPRev::getImageRealPathFromUrl($urlImage);
if(file_exists($realPath)){
$filepath = UniteFunctionsWPRev::getImagePathFromURL($urlImage);
$urlImage = UniteBaseClassRev::getImageUrl($filepath,100,70,true);
}
$img = "<img width='100' height='70' src='$urlImage'></img>";
}
?>
<span id='<?php echo $spanPreviewID?>' class='setting-image-preview'><?php echo $img?></span>
<input type="hidden" id="<?php echo $setting["id"]?>" name="<?php echo $setting["name"]?>" value="<?php echo $setting["value"]?>" />
<input type="button" id="<?php echo $buttonID?>" class='button-image-select <?php echo $class?>' value="Choose Image"></input>
<?php
}
//-----------------------------------------------------------------------------------------------
//draw a color picker
protected function drawColorPickerInput($setting){
$bgcolor = $setting["value"];
$bgcolor = str_replace("0x","#",$bgcolor);
// set the forent color (by black and white value)
$rgb = UniteFunctionsRev::html2rgb($bgcolor);
$bw = UniteFunctionsRev::yiq($rgb[0],$rgb[1],$rgb[2]);
$color = "#000000";
if($bw<128) $color = "#ffffff";
$disabled = "";
if(isset($setting["disabled"])){
$color = "";
$disabled = 'disabled="disabled"';
}
$style="style='background-color:$bgcolor;color:$color'";
?>
<input type="text" class="inputColorPicker" id="<?php echo $setting["id"]?>" <?php echo $style?> name="<?php echo $setting["name"]?>" value="<?php echo $bgcolor?>" <?php echo $disabled?>></input>
<?php
}
//-----------------------------------------------------------------------------------------------
// draw setting input by type
protected function drawInputs($setting){
switch($setting["type"]){
case UniteSettingsRev::TYPE_TEXT:
$this->drawTextInput($setting);
break;
case UniteSettingsRev::TYPE_COLOR:
$this->drawColorPickerInput($setting);
break;
case UniteSettingsRev::TYPE_SELECT:
$this->drawSelectInput($setting);
break;
case UniteSettingsRev::TYPE_CHECKLIST:
$this->drawChecklistInput($setting);
break;
case UniteSettingsRev::TYPE_CHECKBOX:
$this->drawCheckboxInput($setting);
break;
case UniteSettingsRev::TYPE_RADIO:
$this->drawRadioInput($setting);
break;
case UniteSettingsRev::TYPE_TEXTAREA:
$this->drawTextAreaInput($setting);
break;
case UniteSettingsRev::TYPE_IMAGE:
$this->drawImageInput($setting);
break;
case UniteSettingsRev::TYPE_CUSTOM:
if(method_exists($this,"drawCustomInputs") == false){
UniteFunctionsRev::throwError("Method don't exists: drawCustomInputs, please override the class");
}
$this->drawCustomInputs($setting);
break;
default:
throw new Exception("wrong setting type - ".$setting["type"]);
break;
}
}
//-----------------------------------------------------------------------------------------------
// draw text area input
protected function drawTextAreaInput($setting){
$disabled = "";
if (isset($setting["disabled"])) $disabled = 'disabled="disabled"';
$style = "";
if(isset($setting["style"]))
$style = "style='".$setting["style"]."'";
$rows = UniteFunctionsRev::getVal($setting, "rows");
if(!empty($rows))
$rows = "rows='$rows'";
$cols = UniteFunctionsRev::getVal($setting, "cols");
if(!empty($cols))
$cols = "cols='$cols'";
?>
<textarea id="<?php echo $setting["id"]?>" name="<?php echo $setting["name"]?>" <?php echo $style?> <?php echo $disabled?> <?php echo $rows?> <?php echo $cols?> ><?php echo $setting["value"]?></textarea>
<?php
if(!empty($cols))
echo "<br>"; //break line on big textareas.
}
/**
* draw radio input
*/
protected function drawRadioInput($setting){
$items = $setting["items"];
$settingID = UniteFunctionsRev::getVal($setting, "id");
$wrapperID = $settingID."_wrapper";
$addParams = UniteFunctionsRev::getVal($setting, "addparams");
$counter = 0;
?>
<span id="<?php echo $wrapperID?>" class="radio_settings_wrapper" <?php echo $addParams?>>
<?php
foreach($items as $value=>$text):
$counter++;
$radioID = $setting["id"]."_".$counter;
$checked = "";
if($value == $setting["value"]) $checked = " checked";
?>
<input type="radio" id="<?php echo $radioID?>" value="<?php echo $value?>" name="<?php echo $setting["name"]?>" <?php echo $checked?>/>
<label for="<?php echo $radioID?>" style="cursor:pointer;"><?php echo $text?></label>
&nbsp; &nbsp;
<?php
endforeach;
?>
</span>
<?php
}
/**
* draw checkbox
*/
protected function drawCheckboxInput($setting){
$checked = "";
if($setting["value"] == true) $checked = 'checked="checked"';
?>
<input type="checkbox" id="<?php echo $setting["id"]?>" class="inputCheckbox" name="<?php echo $setting["name"]?>" <?php echo $checked?>/>
<?php
}
/**
* draw select input
*/
protected function drawSelectInput($setting){
$className = "";
if(isset($this->arrControls[$setting["name"]])) $className = "control";
$class = "";
if($className != "") $class = "class='".$className."'";
$disabled = "";
if(isset($setting["disabled"])) $disabled = 'disabled="disabled"';
?>
<select id="<?php echo $setting["id"]?>" name="<?php echo $setting["name"]?>" <?php echo $disabled?> <?php echo $class?>>
<?php
foreach($setting["items"] as $value=>$text):
$text = __($text,REVSLIDER_TEXTDOMAIN);
$selected = "";
if($value == $setting["value"]) $selected = 'selected="selected"';
?>
<option value="<?php echo $value?>" <?php echo $selected?>><?php echo $text?></option>
<?php
endforeach
?>
</select>
<?php
}
/**
*
* draw checklist input
* @param unknown_type $setting
*/
protected function drawChecklistInput($setting){
$className = "input_checklist";
if(isset($this->arrControls[$setting["name"]]))
$className .= " control";
$class = "";
if($className != "") $class = "class='".$className."'";
$disabled = "";
if(isset($setting["disabled"])) $disabled = 'disabled="disabled"';
$args = UniteFunctionsRev::getVal($setting, "args");
$settingValue = $setting["value"];
if(strpos($settingValue,",") !== false)
$settingValue = explode(",", $settingValue);
$style = "z-index:1000;";
$minWidth = UniteFunctionsRev::getVal($setting, "minwidth");
if(!empty($minWidth)){
$style .= "min-width:{$minWidth}px;";
$args .= " data-minwidth='{$minWidth}'";
}
?>
<select id="<?php echo $setting["id"]?>" name="<?php echo $setting["name"]?>" <?php echo $disabled?> multiple <?php echo $class?> <?php echo $args?> size="1" style="<?php echo $style?>">
<?php
foreach($setting["items"] as $value=>$text):
//set selected
$selected = "";
$addition = "";
if(strpos($value,"option_disabled") === 0){
$addition = "disabled";
}else{
if(is_array($settingValue)){
if(array_search($value, $settingValue) !== false)
$selected = 'selected="selected"';
}else{
if($value == $settingValue)
$selected = 'selected="selected"';
}
}
?>
<option <?php echo $addition?> value="<?php echo $value?>" <?php echo $selected?>><?php echo $text?></option>
<?php
endforeach
?>
</select>
<?php
}
//-----------------------------------------------------------------------------------------------
//draw hr row
protected function drawTextRow($setting){
//set cell style
$cellStyle = "";
if(isset($setting["padding"]))
$cellStyle .= "padding-left:".$setting["padding"].";";
if(!empty($cellStyle))
$cellStyle="style='$cellStyle'";
//set style
$rowStyle = "";
if(isset($setting["hidden"]))
$rowStyle .= "display:none;";
if(!empty($rowStyle))
$rowStyle = "style='$rowStyle'";
?>
<tr id="<?php echo $setting["id_row"]?>" <?php echo $rowStyle ?> valign="top">
<td colspan="4" align="right" <?php echo $cellStyle?>>
<span class="spanSettingsStaticText"><?php echo $setting["text"]?></span>
</td>
</tr>
<?php
}
//-----------------------------------------------------------------------------------------------
//draw hr row
protected function drawHrRow($setting){
//set hidden
$rowStyle = "";
if(isset($setting["hidden"])) $rowStyle = "style='display:none;'";
$class = UniteFunctionsRev::getVal($setting, "class");
if(!empty($class))
$class = "class='$class'";
?>
<tr id="<?php echo $setting["id_row"]?>" <?php echo $rowStyle ?>>
<td colspan="4" align="left" style="text-align:left;">
<hr <?php echo $class; ?> />
</td>
</tr>
<?php
}
//-----------------------------------------------------------------------------------------------
//draw settings row
protected function drawSettingRow($setting){
//set cellstyle:
$cellStyle = "";
if(isset($setting[UniteSettingsRev::PARAM_CELLSTYLE])){
$cellStyle .= $setting[UniteSettingsRev::PARAM_CELLSTYLE];
}
//set text style:
$textStyle = $cellStyle;
if(isset($setting[UniteSettingsRev::PARAM_TEXTSTYLE])){
$textStyle .= $setting[UniteSettingsRev::PARAM_TEXTSTYLE];
}
if($textStyle != "") $textStyle = "style='".$textStyle."'";
if($cellStyle != "") $cellStyle = "style='".$cellStyle."'";
//set hidden
$rowStyle = "";
if(isset($setting["hidden"])) $rowStyle = "display:none;";
if(!empty($rowStyle)) $rowStyle = "style='$rowStyle'";
//set text class:
$class = "";
if(isset($setting["disabled"])) $class = "class='disabled'";
//modify text:
$text = UniteFunctionsRev::getVal($setting,"text","");
// prevent line break (convert spaces to nbsp)
$text = str_replace(" ","&nbsp;",$text);
switch($setting["type"]){
case UniteSettingsRev::TYPE_CHECKBOX:
$text = "<label for='".$setting["id"]."' style='cursor:pointer;'>$text</label>";
break;
}
//set settings text width:
$textWidth = "";
if(isset($setting["textWidth"])) $textWidth = 'width="'.$setting["textWidth"].'"';
$description = UniteFunctionsRev::getVal($setting, "description");
$required = UniteFunctionsRev::getVal($setting, "required");
?>
<tr id="<?php echo $setting["id_row"]?>" <?php echo $rowStyle ?> <?php echo $class?> valign="top">
<th <?php echo $textStyle?> scope="row" <?php echo $textWidth ?>>
<?php echo $text?>:
</th>
<td <?php echo $cellStyle?>>
<?php
$this->drawInputs($setting);
?>
<?php if(!empty($required)):?>
<span class='setting_required'>*</span>
<?php endif?>
<?php if(!empty($description)):?>
<span class="description"><?php echo $description?></span>
<?php endif?>
</td>
</tr>
<?php
}
//-----------------------------------------------------------------------------------------------
//draw all settings
public function drawSettings(){
$this->drawHeaderIncludes();
$this->prepareToDraw();
//draw main div
$lastSectionKey = -1;
$visibleSectionKey = 0;
$lastSapKey = -1;
$arrSections = $this->settings->getArrSections();
$arrSettings = $this->settings->getArrSettings();
//draw settings - simple
if(empty($arrSections)):
?><table class='form-table'><?php
foreach($arrSettings as $key=>$setting){
switch($setting["type"]){
case UniteSettingsRev::TYPE_HR:
$this->drawHrRow($setting);
break;
case UniteSettingsRev::TYPE_STATIC_TEXT:
$this->drawTextRow($setting);
break;
default:
$this->drawSettingRow($setting);
break;
}
}
?></table><?php
else:
//draw settings - advanced - with sections
foreach($arrSettings as $key=>$setting):
//operate sections:
if(!empty($arrSections) && isset($setting["section"])){
$sectionKey = $setting["section"];
if($sectionKey != $lastSectionKey): //new section
$arrSaps = $arrSections[$sectionKey]["arrSaps"];
if(!empty($arrSaps)){
//close sap
if($lastSapKey != -1):
?>
</table>
</div>
<?php
endif;
$lastSapKey = -1;
}
$style = ($visibleSectionKey == $sectionKey)?"":"style='display:none'";
//close section
if($sectionKey != 0):
if(empty($arrSaps))
echo "</table>";
echo "</div>\n";
endif;
//if no saps - add table
if(empty($arrSaps)):
?><table class="form-table"><?php
endif;
endif;
$lastSectionKey = $sectionKey;
}//end section manage
//operate saps
if(!empty($arrSaps) && isset($setting["sap"])){
$sapKey = $setting["sap"];
if($sapKey != $lastSapKey){
$sap = $this->settings->getSap($sapKey,$sectionKey);
//draw sap end
if($sapKey != 0): ?>
</table>
<?php endif;
//set opened/closed states:
//$style = "style='display:none;'";
$style = "";
$class = "divSapControl";
if($sapKey == 0 || isset($sap["opened"]) && $sap["opened"] == true){
$style = "";
$class = "divSapControl opened";
}
?>
<div id="divSapControl_<?php echo $sectionKey."_".$sapKey?>" class="<?php echo $class?>">
<h3><?php echo $sap["text"]?></h3>
</div>
<div id="divSap_<?php echo $sectionKey."_".$sapKey?>" class="divSap" <?php echo $style ?>>
<table class="form-table">
<?php
$lastSapKey = $sapKey;
}
}//saps manage
//draw row:
switch($setting["type"]){
case UniteSettingsRev::TYPE_HR:
$this->drawHrRow($setting);
break;
case UniteSettingsRev::TYPE_STATIC_TEXT:
$this->drawTextRow($setting);
break;
default:
$this->drawSettingRow($setting);
break;
}
endforeach;
endif;
?>
</table>
<?php
if(!empty($arrSections)):
if(empty($arrSaps)) //close table settings if no saps
echo "</table>";
echo "</div>\n"; //close last section div
endif;
}
//-----------------------------------------------------------------------------------------------
// draw sections menu
public function drawSections($activeSection=0){
if(!empty($this->arrSections)):
echo "<ul class='listSections' >";
for($i=0;$i<count($this->arrSections);$i++):
$class = "";
if($activeSection == $i) $class="class='selected'";
$text = $this->arrSections[$i]["text"];
echo '<li '.$class.'><a onfocus="this.blur()" href="#'.($i+1).'"><div>'.$text.'</div></a></li>';
endfor;
echo "</ul>";
endif;
//call custom draw function:
if($this->customFunction_afterSections) call_user_func($this->customFunction_afterSections);
}
/**
*
* draw settings function
* @param $drawForm draw the form yes / no
*/
public function draw($formID=null,$drawForm = false){
if(empty($formID))
UniteFunctionsRev::throwError("The form ID can't be empty. you must provide it");
$this->formID = $formID;
?>
<div class="settings_wrapper unite_settings_wide">
<?php
if($drawForm == true){
?>
<form name="<?php echo $formID?>" id="<?php echo $formID?>">
<?php $this->drawSettings() ?>
</form>
<?php
}else
$this->drawSettings();
?>
</div>
<?php
}
}
?>

View File

@ -0,0 +1,711 @@
<?php
class UniteSettingsProductSidebarRev extends UniteSettingsOutputRev{
private $addClass = ""; //add class to the main div
private $arrButtons = array();
private $isAccordion = true;
/**
*
* add buggon
*/
public function addButton($title,$id,$class = "button-secondary"){
$button = array(
"title"=>$title,
"id"=>$id,
"class"=>$class
);
$this->arrButtons[] = $button;
}
/**
*
* set add class for the main div
*/
public function setAddClass($addClass){
$this->addClass = $addClass;
}
//-----------------------------------------------------------------------------------------------
//draw text as input
protected function drawTextInput($setting) {
$disabled = "";
$style="";
if(isset($setting["style"]))
$style = "style='".$setting["style"]."'";
if(isset($setting["disabled"]))
$disabled = 'disabled="disabled"';
$class = UniteFunctionsRev::getVal($setting, "class","text-sidebar");
//modify class:
switch($class){
case "normal":
case "regular":
$class = "text-sidebar-normal";
break;
}
if(!empty($class))
$class = "class='$class'";
$attribs = UniteFunctionsRev::getVal($setting, "attribs");
?>
<input type="text" <?php echo $attribs?> <?php echo $class?> <?php echo $style?> <?php echo $disabled?> id="<?php echo $setting["id"]?>" name="<?php echo $setting["name"]?>" value="<?php echo $setting["value"]?>" />
<?php
}
//-----------------------------------------------------------------------------------------------
//draw a color picker
protected function drawColorPickerInput($setting){
$bgcolor = $setting["value"];
$bgcolor = str_replace("0x","#",$bgcolor);
// set the forent color (by black and white value)
$rgb = UniteFunctionsRev::html2rgb($bgcolor);
$bw = UniteFunctionsRev::yiq($rgb[0],$rgb[1],$rgb[2]);
$color = "#000000";
if($bw<128) $color = "#ffffff";
$disabled = "";
if(isset($setting["disabled"])){
$color = "";
$disabled = 'disabled="disabled"';
}
$style="style='background-color:$bgcolor;color:$color'";
?>
<input type="text" class="inputColorPicker" id="<?php echo $setting["id"]?>" <?php echo $style?> name="<?php echo $setting["name"]?>" value="<?php echo $bgcolor?>" <?php echo $disabled?>></input>
<?php
}
//-----------------------------------------------------------------------------------------------
// draw setting input by type
protected function drawInputs($setting){
switch($setting["type"]){
case UniteSettingsRev::TYPE_TEXT:
$this->drawTextInput($setting);
break;
case UniteSettingsRev::TYPE_COLOR:
$this->drawColorPickerInput($setting);
break;
case UniteSettingsRev::TYPE_SELECT:
$this->drawSelectInput($setting);
break;
case UniteSettingsRev::TYPE_CHECKBOX:
$this->drawCheckboxInput($setting);
break;
case UniteSettingsRev::TYPE_RADIO:
$this->drawRadioInput($setting);
break;
case UniteSettingsRev::TYPE_TEXTAREA:
$this->drawTextAreaInput($setting);
break;
case UniteSettingsRev::TYPE_CUSTOM:
$this->drawCustom($setting);
break;
case UniteSettingsRev::TYPE_BUTTON:
$this->drawButtonSetting($setting);
break;
default:
throw new Exception("wrong setting type - ".$setting["type"]);
break;
}
}
//-----------------------------------------------------------------------------------------------
//draw advanced order box
protected function drawOrderbox_advanced($setting){
$items = $setting["items"];
if(!is_array($items))
$this->throwError("Orderbox error - the items option must be array (items)");
//get arrItems modify items by saved value
if(!empty($setting["value"]) &&
getType($setting["value"]) == "array" &&
count($setting["value"]) == count($items)):
$savedItems = $setting["value"];
//make assoc array by id:
$arrAssoc = array();
foreach($items as $item)
$arrAssoc[$item[0]] = $item[1];
foreach($savedItems as $item){
$value = $item["id"];
$text = $value;
if(isset($arrAssoc[$value]))
$text = $arrAssoc[$value];
$arrItems[] = array($value,$text,$item["enabled"]);
}
else:
$arrItems = $items;
endif;
?>
<ul class="orderbox_advanced" id="<?php echo $setting["id"]?>">
<?php
foreach($arrItems as $arrItem){
switch(getType($arrItem)){
case "string":
$value = $arrItem;
$text = $arrItem;
$enabled = true;
break;
case "array":
$value = $arrItem[0];
$text = (count($arrItem)>1)?$arrItem[1]:$arrItem[0];
$enabled = (count($arrItem)>2)?$arrItem[2]:true;
break;
default:
$this->throwError("Error in setting:".$setting.". unknown item type.");
break;
}
$checkboxClass = $enabled ? "div_checkbox_on" : "div_checkbox_off";
?>
<li>
<div class="div_value"><?php echo $value?></div>
<div class="div_checkbox <?php echo $checkboxClass?>"></div>
<div class="div_text"><?php echo $text?></div>
<div class="div_handle"></div>
</li>
<?php
}
?>
</ul>
<?php
}
//-----------------------------------------------------------------------------------------------
//draw order box
protected function drawOrderbox($setting){
$items = $setting["items"];
//get arrItems by saved value
$arrItems = array();
if(!empty($setting["value"]) &&
getType($setting["value"]) == "array" &&
count($setting["value"]) == count($items)){
$savedItems = $setting["value"];
foreach($savedItems as $value){
$text = $value;
if(isset($items[$value]))
$text = $items[$value];
$arrItems[] = array("value"=>$value,"text"=>$text);
}
} //get arrItems only from original items
else{
foreach($items as $value=>$text)
$arrItems[] = array("value"=>$value,"text"=>$text);
}
?>
<ul class="orderbox" id="<?php echo $setting["id"]?>">
<?php
foreach($arrItems as $item){
$itemKey = $item["value"];
$itemText = $item["text"];
$value = (getType($itemKey) == "string")?$itemKey:$itemText;
?>
<li>
<div class="div_value"><?php echo $value?></div>
<div class="div_text"><?php echo $itemText?></div>
</li>
<?php
}
?>
</ul>
<?php
}
/**
*
* draw button
*/
function drawButtonSetting($setting){
//set class
$class = UniteFunctionsRev::getVal($setting, "class");
if(!empty($class))
$class = "class='$class'";
?>
<input type="button" id="<?php echo $setting["id"]?>" value="<?php echo $setting["value"]?>" <?php echo $class?>>
<?php
}
//-----------------------------------------------------------------------------------------------
// draw text area input
protected function drawTextAreaInput($setting){
$disabled = "";
if (isset($setting["disabled"])) $disabled = 'disabled="disabled"';
//set style
$style = UniteFunctionsRev::getVal($setting, "style");
if(!empty($style))
$style = "style='".$style."'";
//set class
$class = UniteFunctionsRev::getVal($setting, "class");
if(!empty($class))
$class = "class='$class'";
?>
<textarea id="<?php echo $setting["id"]?>" <?php echo $class?> name="<?php echo $setting["name"]?>" <?php echo $style?> <?php echo $disabled?>><?php echo $setting["value"]?></textarea>
<?php
}
//-----------------------------------------------------------------------------------------------
// draw radio input
protected function drawRadioInput($setting){
$items = $setting["items"];
$counter = 0;
$id = $setting["id"];
$isDisabled = UniteFunctionsRev::getVal($setting, "disabled",false);
?>
<span id="<?php echo $id?>" class="radio_wrapper">
<?php
foreach($items as $value=>$text):
$counter++;
$radioID = $id."_".$counter;
$checked = "";
if($value == $setting["value"]) $checked = " checked";
$disabled = "";
if($isDisabled == true)
$disabled = 'disabled="disabled"';
?>
<input type="radio" id="<?php echo $radioID?>" value="<?php echo $value?>" name="<?php echo $setting["name"]?>" <?php echo $disabled?> <?php echo $checked?>/>
<label for="<?php echo $radioID?>" style="cursor:pointer;"><?php _e($text)?></label>
&nbsp; &nbsp;
<?php
endforeach;
?>
</span>
<?php
}
//-----------------------------------------------------------------------------------------------
// draw checkbox
protected function drawCheckboxInput($setting){
$checked = "";
if($setting["value"] == true) $checked = 'checked="checked"';
?>
<input type="checkbox" id="<?php echo $setting["id"]?>" class="inputCheckbox" name="<?php echo $setting["name"]?>" <?php echo $checked?>/>
<?php
}
//-----------------------------------------------------------------------------------------------
//draw select input
protected function drawSelectInput($setting){
$className = "";
if(isset($this->arrControls[$setting["name"]])) $className = "control";
$class = "";
if($className != "") $class = "class='".$className."'";
$disabled = "";
if(isset($setting["disabled"]))
$disabled = 'disabled="disabled"';
?>
<select id="<?php echo $setting["id"]?>" name="<?php echo $setting["name"]?>" <?php echo $disabled?> <?php echo $class?>>
<?php
foreach($setting["items"] as $value=>$text):
$text = __($text,REVSLIDER_TEXTDOMAIN);
$selected = "";
if($value == $setting["value"]) $selected = 'selected="selected"';
?>
<option value="<?php echo $value?>" <?php echo $selected?>><?php echo $text?></option>
<?php
endforeach
?>
</select>
<?php
}
/**
*
* draw custom setting
*/
protected function drawCustom($setting){
dmp($setting);
exit();
}
//-----------------------------------------------------------------------------------------------
//draw hr row
protected function drawTextRow($setting){
//set cell style
$cellStyle = "";
if(isset($setting["padding"]))
$cellStyle .= "padding-left:".$setting["padding"].";";
if(!empty($cellStyle))
$cellStyle="style='$cellStyle'";
//set style
$rowStyle = "";
if(isset($setting["hidden"]) && $setting["hidden"] == true)
$rowStyle .= "display:none;";
if(!empty($rowStyle))
$rowStyle = "style='$rowStyle'";
?>
<span class="spanSettingsStaticText"><?php echo __($setting["text"],REVSLIDER_TEXTDOMAIN)?></span>
<?php
}
//-----------------------------------------------------------------------------------------------
//draw hr row
protected function drawHrRow($setting){
//set hidden
$rowStyle = "";
if(isset($setting["hidden"]) && $setting["hidden"] == true) $rowStyle = "style='display:none;'";
?>
<li id="<?php echo $setting["id"]?>_row">
<hr />
</li>
<?php
}
//-----------------------------------------------------------------------------------------------
//draw settings row
protected function drawSettingRow($setting){
//set cellstyle:
$cellStyle = "";
if(isset($setting[UniteSettingsRev::PARAM_CELLSTYLE])){
$cellStyle .= $setting[UniteSettingsRev::PARAM_CELLSTYLE];
}
//set text style:
$textStyle = $cellStyle;
if(isset($setting[UniteSettingsRev::PARAM_TEXTSTYLE])){
$textStyle .= $setting[UniteSettingsRev::PARAM_TEXTSTYLE];
}
if($textStyle != "") $textStyle = "style='".$textStyle."'";
if($cellStyle != "") $cellStyle = "style='".$cellStyle."'";
//set hidden
$rowStyle = "";
if(isset($setting["hidden"]) && $setting["hidden"] == true) $rowStyle = "display:none;";
if(!empty($rowStyle)) $rowStyle = "style='$rowStyle'";
//set row class:
$rowClass = "";
if(isset($setting["disabled"])) $rowClass = "class='disabled'";
//modify text:
$text = UniteFunctionsRev::getVal($setting,"text","");
$text = __($text,REVSLIDER_TEXTDOMAIN);
// prevent line break (convert spaces to nbsp)
$text = str_replace(" ","&nbsp;",$text);
if($setting["type"] == UniteSettingsRev::TYPE_CHECKBOX)
$text = "<label for='{$setting["id"]}'>{$text}</label>";
//set settings text width:
$textWidth = "";
if(isset($setting["textWidth"])) $textWidth = 'width="'.$setting["textWidth"].'"';
$description = UniteFunctionsRev::getVal($setting, "description");
$description = __($description,REVSLIDER_TEXTDOMAIN);
$unit = UniteFunctionsRev::getVal($setting, "unit");
$unit = __($unit,REVSLIDER_TEXTDOMAIN);
$required = UniteFunctionsRev::getVal($setting, "required");
$addHtml = UniteFunctionsRev::getVal($setting, UniteSettingsRev::PARAM_ADDTEXT);
$addHtmlBefore = UniteFunctionsRev::getVal($setting, UniteSettingsRev::PARAM_ADDTEXT_BEFORE_ELEMENT);
//set if draw text or not.
$toDrawText = true;
if($setting["type"] == UniteSettingsRev::TYPE_BUTTON)
$toDrawText = false;
$settingID = $setting["id"];
$attribsText = UniteFunctionsRev::getVal($setting, "attrib_text");
?>
<li id="<?php echo $settingID?>_row" <?php echo $rowStyle." ".$rowClass?>>
<?php if($toDrawText == true):?>
<span id="<?php echo $settingID?>_text" class='setting_text' title="<?php echo $description?>" <?php echo $attribsText?>><?php echo $text ?></span>
<?php endif?>
<?php if(!empty($addHtmlBefore)):?>
<span class="settings_addhtmlbefore"><?php echo $addHtmlBefore?></span>
<?php endif?>
<span class='setting_input'>
<?php $this->drawInputs($setting);?>
</span>
<?php if(!empty($unit)):?>
<span class='setting_unit'><?php echo $unit?></span>
<?php endif?>
<?php if(!empty($required)):?>
<span class='setting_required'>*</span>
<?php endif?>
<?php if(!empty($addHtml)):?>
<span class="settings_addhtml"><?php echo $addHtml?></span>
<?php endif?>
<div class="clear"></div>
</li>
<?php
}
/**
*
* insert settings into saps array
*/
private function groupSettingsIntoSaps(){
$arrSections = $this->settings->getArrSections();
$arrSaps = $arrSections[0]["arrSaps"];
$arrSettings = $this->settings->getArrSettings();
//group settings by saps
foreach($arrSettings as $key=>$setting){
$sapID = $setting["sap"];
if(isset($arrSaps[$sapID]["settings"]))
$arrSaps[$sapID]["settings"][] = $setting;
else
$arrSaps[$sapID]["settings"] = array($setting);
}
return($arrSaps);
}
/**
*
* draw buttons that defined earlier
*/
private function drawButtons(){
foreach($this->arrButtons as $key=>$button){
if($key>0)
echo "<span class='hor_sap'></span>";
echo UniteFunctionsRev::getHtmlLink("#", $button["title"],$button["id"],$button["class"]);
}
}
/**
*
* draw some setting, can be setting array or name
*/
public function drawSetting($setting,$state = null){
if(gettype($setting) == "string")
$setting = $this->settings->getSettingByName($setting);
switch($state){
case "hidden":
$setting["hidden"] = true;
break;
}
switch($setting["type"]){
case UniteSettingsRev::TYPE_HR:
$this->drawHrRow($setting);
break;
case UniteSettingsRev::TYPE_STATIC_TEXT:
$this->drawTextRow($setting);
break;
default:
$this->drawSettingRow($setting);
break;
}
}
/**
*
* draw setting by bulk names
*/
public function drawSettingsByNames($arrSettingNames,$state=null){
if(gettype($arrSettingNames) == "string")
$arrSettingNames = explode(",",$arrSettingNames);
foreach($arrSettingNames as $name)
$this->drawSetting($name,$state);
}
/**
*
* draw all settings
*/
public function drawSettings(){
$this->prepareToDraw();
$this->drawHeaderIncludes();
$arrSaps = $this->groupSettingsIntoSaps();
$class = "postbox unite-postbox";
if(!empty($this->addClass))
$class .= " ".$this->addClass;
//draw wrapper
echo "<div class='settings_wrapper'>";
//draw settings - advanced - with sections
foreach($arrSaps as $key=>$sap):
//set accordion closed
$style = "";
if($this->isAccordion == false){
$h3Class = "class='no-accordion'";
}else{
$h3Class = "";
if($key>0){
$style = "style='display:none;'";
$h3Class = "class='box_closed'";
}
}
$text = $sap["text"];
$text = __($text,REVSLIDER_TEXTDOMAIN);
?>
<div class="<?php echo $class?>">
<h3 <?php echo $h3Class?>>
<?php if($this->isAccordion == true):?>
<div class="postbox-arrow"></div>
<?php endif?>
<span><?php echo $text ?></span>
</h3>
<div class="inside" <?php echo $style?> >
<ul class="list_settings">
<?php
foreach($sap["settings"] as $setting){
$this->drawSetting($setting);
}
?>
</ul>
<?php
if(!empty($this->arrButtons)){
?>
<div class="clear"></div>
<div class="settings_buttons">
<?php
$this->drawButtons();
?>
</div>
<div class="clear"></div>
<?php
}
?>
<div class="clear"></div>
</div>
</div>
<?php
endforeach;
echo "</div>"; //wrapper close
}
//-----------------------------------------------------------------------------------------------
// draw sections menu
public function drawSections($activeSection=0){
if(!empty($this->arrSections)):
echo "<ul class='listSections' >";
for($i=0;$i<count($this->arrSections);$i++):
$class = "";
if($activeSection == $i) $class="class='selected'";
$text = $this->arrSections[$i]["text"];
echo '<li '.$class.'><a onfocus="this.blur()" href="#'.($i+1).'"><div>'.$text.'</div></a></li>';
endfor;
echo "</ul>";
endif;
//call custom draw function:
if($this->customFunction_afterSections) call_user_func($this->customFunction_afterSections);
}
/**
*
* init accordion
*/
private function putAccordionInit(){
?>
<script type="text/javascript">
jQuery(document).ready(function(){
UniteSettingsRev.initAccordion("<?php echo $this->formID?>");
});
</script>
<?php
}
/**
*
* activate the accordion
*/
public function isAccordion($activate){
$this->isAccordion = $activate;
}
/**
*
* draw settings function
*/
public function draw($formID=null){
if(empty($formID))
UniteFunctionsRev::throwError("You must provide formID to side settings.");
$this->formID = $formID;
if(!empty($formID)){
?>
<form name="<?php echo $formID?>" id="<?php echo $formID?>">
<?php $this->drawSettings() ?>
</form>
<?php
}else
$this->drawSettings();
if($this->isAccordion == true)
$this->putAccordionInit();
}
}
?>

View File

@ -0,0 +1,97 @@
<?php
class UniteZipRev{
private $zip;
/**
*
* get true / false if the zip archive exists.
*/
public static function isZipExists(){
$exists = class_exists("ZipArchive");
return $exists;
}
/**
*
* add zip file
*/
private function addItem($basePath,$path){
$rel_path = str_replace($basePath."/", "", $path);
if(is_dir($path)){ //directory
//add dir to zip
if($basePath != $path)
$this->zip->addEmptyDir($rel_path);
$files = scandir($path);
foreach($files as $file){
if($file == "." || $file == ".." || $file == ".svn")
continue;
$filepath = $path."/".$file;
$this->addItem($basePath, $filepath);
}
}
else{ //file
if(!file_exists($path))
throwError("filepath: '$path' don't exists, can't zip");
$this->zip->addFile($path,$rel_path);
}
}
/**
*
* make zip archive
* if exists additional paths, add additional items to the zip
*/
public function makeZip($srcPath, $zipFilepath,$additionPaths = array()){
if(!is_dir($srcPath))
throwError("The path: '$srcPath' don't exists, can't zip");
$this->zip = new ZipArchive;
$success = $this->zip->open($zipFilepath, ZipArchive::CREATE);
if($success == false)
throwError("Can't create zip file: $zipFilepath");
$this->addItem($srcPath,$srcPath);
if(gettype($additionPaths) != "array")
throwError("Wrong additional paths variable.");
//add additional paths
if(!empty($additionPaths))
foreach($additionPaths as $path){
if(!is_dir($path))
throwError("Path: $path not found, can't zip");
$this->addItem($path, $path);
}
$this->zip->close();
}
/**
*
* Extract zip archive
*/
public function extract($src, $dest){
$zip = new ZipArchive;
if ($zip->open($src)===true){
$zip->extractTo($dest);
$zip->close();
return true;
}
return false;
}
}
?>

View File

@ -0,0 +1,32 @@
<?php
define("REVSLIDER_TEXTDOMAIN","revslider");
class GlobalsRevSlider{
const SHOW_DEBUG = false;
const TABLE_SLIDERS_NAME = "revslider_sliders";
const TABLE_SLIDES_NAME = "revslider_slides";
const TABLE_SETTINGS_NAME = "revslider_settings";
const FIELDS_SLIDE = "slider_id,slide_order,params,layers";
const FIELDS_SLIDER = "title,alias,params";
const YOUTUBE_EXAMPLE_ID = "cXwQjHRZieI";
const DEFAULT_YOUTUBE_ARGUMENTS = "hd=1&amp;wmode=opaque&amp;controls=1&amp;showinfo=0;rel=0;";
const DEFAULT_VIMEO_ARGUMENTS = "title=0&amp;byline=0&amp;portrait=0;api=1";
const LINK_HELP_SLIDERS = "http://themepunch.com/codecanyon/revolution_wp/documentation/";
const LINK_HELP_SLIDER = "http://themepunch.com/codecanyon/revolution_wp/documentation/#!/main_settings";
const LINK_HELP_SLIDE_LIST = "http://themepunch.com/codecanyon/revolution_wp/documentation/#!/slides_editor";
const LINK_HELP_SLIDE = "http://themepunch.com/codecanyon/revolution_wp/documentation/#!/slide_general_settings";
public static $table_sliders;
public static $table_slides;
public static $table_settings;
public static $filepath_captions;
public static $filepath_captions_original;
public static $urlCaptionsCSS;
public static $isNewVersion;
}
?>

View File

@ -0,0 +1,342 @@
<?php
class RevOperations extends UniteElementsBaseRev{
/**
*
* get button classes
*/
public function getButtonClasses(){
$arrButtons = array(
"red"=>"Red Button",
"green"=>"Green Button",
"blue"=>"Blue Button",
"orange"=>"Orange Button",
"darkgrey"=>"Darkgrey Button",
"lightgrey"=>"Lightgrey Button",
);
return($arrButtons);
}
/**
*
* get easing functions array
*/
public function getArrEasing($toAssoc = true){
$arrEasing = array(
"easeOutBack",
"easeInQuad",
"easeOutQuad",
"easeInOutQuad",
"easeInCubic",
"easeOutCubic",
"easeInOutCubic",
"easeInQuart",
"easeOutQuart",
"easeInOutQuart",
"easeInQuint",
"easeOutQuint",
"easeInOutQuint",
"easeInSine",
"easeOutSine",
"easeInOutSine",
"easeInExpo",
"easeOutExpo",
"easeInOutExpo",
"easeInCirc",
"easeOutCirc",
"easeInOutCirc",
"easeInElastic",
"easeOutElastic",
"easeInOutElastic",
"easeInBack",
"easeOutBack",
"easeInOutBack",
"easeInBounce",
"easeOutBounce",
"easeInOutBounce"
);
if($toAssoc)
$arrEasing = UniteFunctionsRev::arrayToAssoc($arrEasing);
return($arrEasing);
}
/**
*
* get arr end easing
*/
public function getArrEndEasing(){
$arrEasing = $this->getArrEasing(false);
$arrEasing = array_merge(array("nothing"),$arrEasing);
$arrEasing = UniteFunctionsRev::arrayToAssoc($arrEasing);
$arrEasing["nothing"] = "No Change";
return($arrEasing);
}
/**
*
* get transition array
*/
public function getArrTransition(){
$arrTransition = array(
"random"=>"Random",
"fade"=>"Fade",
"slidehorizontal"=>"Slide Horizontal",
"slidevertical"=>"Slide Vertical",
"boxslide"=>"Box Slide",
"boxfade"=>"Box Fade",
"slotzoom-horizontal"=>"SlotZoom Horizontal",
"slotslide-horizontal"=>"SlotSlide Horizontal",
"slotfade-horizontal"=>"SlotFade Horizontal",
"slotzoom-vertical"=>"SlotZoom Vertical",
"slotslide-vertical"=>"SlotSlide Vertical",
"slotfade-vertical"=>"SlotFade Vertical",
"curtain-1"=>"Curtain 1",
"curtain-2"=>"Curtain 2",
"curtain-3"=>"Curtain 3",
"slideleft"=>"Slide Left",
"slideright"=>"Slide Right",
"slideup"=>"Slide Up",
"slidedown"=>"Slide Down",
"papercut"=>"Premium - Paper Cut",
"3dcurtain-horizontal"=>"Premium - 3D Curtain Horizontal",
"3dcurtain-vertical"=>"Premium - 3D Curtain Vertical",
"flyin"=>"Premium - Fly In",
"turnoff"=>"Premium - Turn Off",
"cubic"=>"Premium - Cubic"
);
return($arrTransition);
}
/**
*
* get random transition
*/
public static function getRandomTransition(){
$arrTrans = self::getArrTransition();
unset($arrTrans["random"]);
$trans = array_rand($arrTrans);
return($trans);
}
/**
*
* get animations array
*/
public function getArrAnimations(){
$arrAnimations = array(
"fade"=>"Fade",
"sft"=>"Short from Top",
"sfb"=>"Short from Bottom",
"sfr"=>"Short from Right",
"sfl"=>"Short from Left",
"lft"=>"Long from Top",
"lfb"=>"Long from Bottom",
"lfr"=>"Long from Right",
"lfl"=>"Long from Left",
"randomrotate"=>"Random Rotate"
);
return($arrAnimations);
}
/**
*
* get "end" animations array
*/
public function getArrEndAnimations(){
$arrAnimations = array(
"auto"=>"Choose Automatic",
"fadeout"=>"Fade Out",
"stt"=>"Short to Top",
"stb"=>"Short to Bottom",
"stl"=>"Short to Left",
"str"=>"Short to Right",
"ltt"=>"Long to Top",
"ltb"=>"Long to Bottom",
"ltl"=>"Long to Left",
"ltr"=>"Long to Right",
"randomrotateout"=>"Random Rotate Out"
);
return($arrAnimations);
}
/**
*
* parse css file and get the classes from there.
*/
public function getArrCaptionClasses($contentCSS){
//parse css captions file
$parser = new UniteCssParserRev();
$parser->initContent($contentCSS);
$arrCaptionClasses = $parser->getArrClasses();
return($arrCaptionClasses);
}
/**
*
* get the select classes html for putting in the html by ajax
*/
private function getHtmlSelectCaptionClasses($contentCSS){
$arrCaptions = $this->getArrCaptionClasses($contentCSS);
$htmlSelect = UniteFunctionsRev::getHTMLSelect($arrCaptions,"","id='layer_caption' name='layer_caption'",true);
return($htmlSelect);
}
/**
*
* get contents of the css file
*/
public function getCaptionsContent(){
$contentCSS = file_get_contents(GlobalsRevSlider::$filepath_captions);
return($contentCSS);
}
/**
*
* update captions css file content
* @return new captions html select
*/
public function updateCaptionsContentData($content){
$content = stripslashes($content);
$content = trim($content);
UniteFunctionsRev::writeFile($content, GlobalsRevSlider::$filepath_captions);
//output captions array
$arrCaptions = $this->getArrCaptionClasses($content);
return($arrCaptions);
}
/**
*
* copy from original css file to the captions css.
*/
public function restoreCaptionsCss(){
if(!file_exists(GlobalsRevSlider::$filepath_captions_original))
UniteFunctionsRev::throwError("The original css file: captions_original.css doesn't exists.");
$success = @copy(GlobalsRevSlider::$filepath_captions_original, GlobalsRevSlider::$filepath_captions);
if($success == false)
UniteFunctionsRev::throwError("Failed to restore from the original captions file.");
}
/**
*
* preview slider output
* if output object is null - create object
*/
public function previewOutput($sliderID,$output = null){
if($sliderID == "empty_output"){
$this->loadingMessageOutput();
exit();
}
if($output == null)
$output = new RevSliderOutput();
$output->setPreviewMode();
//put the output html
$urlPlugin = RevSliderAdmin::$url_plugin."rs-plugin/";
?>
<html>
<head>
<link rel='stylesheet' href='<?php echo $urlPlugin?>css/settings.css' type='text/css' media='all' />
<link rel='stylesheet' href='<?php echo $urlPlugin?>css/captions.css' type='text/css' media='all' />
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'></script>
<script type='text/javascript' src='<?php echo $urlPlugin?>js/jquery.themepunch.revolution.min.js'></script>
</head>
<body style="padding:0px;margin:0px;">
<?php
$output->putSliderBase($sliderID);
?>
</body>
</html>
<?php
exit();
}
/**
*
* output loading message
*/
public function loadingMessageOutput(){
?>
<div class="message_loading_preview">Loading Preview...</div>
<?php
}
/**
*
* put slide preview by data
*/
public function putSlidePreviewByData($data){
if($data == "empty_output"){
$this->loadingMessageOutput();
exit();
}
$data = UniteFunctionsRev::jsonDecodeFromClientSide($data);
$slideID = $data["slideid"];
$slide = new RevSlide();
$slide->initByID($slideID);
$sliderID = $slide->getSliderID();
$output = new RevSliderOutput();
$output->setOneSlideMode($data);
$this->previewOutput($sliderID,$output);
}
/**
* update general settings
*/
public function updateGeneralSettings($data){
$strSettings = serialize($data);
$params = new RevSliderParams();
$params->updateFieldInDB("general", $strSettings);
}
/**
*
* get general settigns values.
*/
public function getGeneralSettingsValues(){
$params = new RevSliderParams();
$strSettings = $params->getFieldFromDB("general");
$arrValues = array();
if(!empty($strSettings))
$arrValues = unserialize($strSettings);
return($arrValues);
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,55 @@
<?php
/**
*
* get / update params in db
*
*/
class RevSliderParams extends UniteElementsBaseRev{
/**
*
* update settign in db
*/
public function updateFieldInDB($name,$value){
$arrUpdate = array();
$arrUpdate[$name] = $value;
$arr = $this->db->fetch(GlobalsRevSlider::$table_settings);
if(empty($arr)){ //insert to db
$this->db->insert(GlobalsRevSlider::$table_settings,$arrUpdate);
}else{ //update db
$id = $arr[0]["id"];
$this->db->update(GlobalsRevSlider::$table_settings,$arrUpdate,array("id"=>$id));
}
}
/**
*
* get field from db
*/
public function getFieldFromDB($name){
$arr = $this->db->fetch(GlobalsRevSlider::$table_settings);
if(empty($arr))
return("");
$arr = $arr[0];
if(array_key_exists($name, $arr) == false)
UniteFunctionsRev::throwError("The settings db should cotnain field: $name");
$value = $arr[$name];
return($value);
}
}
?>

View File

@ -0,0 +1,273 @@
<?php
class RevSliderSettingsProduct extends UniteSettingsRevProductRev{
/**
*
* set custom values to settings
*/
public static function setSettingsCustomValues(UniteSettingsRev $settings,$arrValues){
$arrSettings = $settings->getArrSettings();
foreach($arrSettings as $key=>$setting){
$type = UniteFunctionsRev::getVal($setting, "type");
if($type != UniteSettingsRev::TYPE_CUSTOM)
continue;
$customType = UniteFunctionsRev::getVal($setting, "custom_type");
switch($customType){
case "slider_size":
$setting["width"] = UniteFunctionsRev::getVal($arrValues, "width",UniteFunctionsRev::getVal($setting,"width"));
$setting["height"] = UniteFunctionsRev::getVal($arrValues, "height",UniteFunctionsRev::getVal($setting,"height"));
$arrSettings[$key] = $setting;
break;
case "responsitive_settings":
$id = $setting["id"];
$setting["w1"] = UniteFunctionsRev::getVal($arrValues, $id."_w1",UniteFunctionsRev::getVal($setting,"w1"));
$setting["w2"] = UniteFunctionsRev::getVal($arrValues, $id."_w2",UniteFunctionsRev::getVal($setting,"w2"));
$setting["w3"] = UniteFunctionsRev::getVal($arrValues, $id."_w3",UniteFunctionsRev::getVal($setting,"w3"));
$setting["w4"] = UniteFunctionsRev::getVal($arrValues, $id."_w4",UniteFunctionsRev::getVal($setting,"w4"));
$setting["w5"] = UniteFunctionsRev::getVal($arrValues, $id."_w5",UniteFunctionsRev::getVal($setting,"w5"));
$setting["w6"] = UniteFunctionsRev::getVal($arrValues, $id."_w6",UniteFunctionsRev::getVal($setting,"w6"));
$setting["sw1"] = UniteFunctionsRev::getVal($arrValues, $id."_sw1",UniteFunctionsRev::getVal($setting,"sw1"));
$setting["sw2"] = UniteFunctionsRev::getVal($arrValues, $id."_sw2",UniteFunctionsRev::getVal($setting,"sw2"));
$setting["sw3"] = UniteFunctionsRev::getVal($arrValues, $id."_sw3",UniteFunctionsRev::getVal($setting,"sw3"));
$setting["sw4"] = UniteFunctionsRev::getVal($arrValues, $id."_sw4",UniteFunctionsRev::getVal($setting,"sw4"));
$setting["sw5"] = UniteFunctionsRev::getVal($arrValues, $id."_sw5",UniteFunctionsRev::getVal($setting,"sw5"));
$setting["sw6"] = UniteFunctionsRev::getVal($arrValues, $id."_sw6",UniteFunctionsRev::getVal($setting,"sw6"));
$arrSettings[$key] = $setting;
break;
}
}
$settings->setArrSettings($arrSettings);
//disable settings by slider type:
$sliderType = $settings->getSettingValue("slider_type");
switch($sliderType){
case "fixed":
case "fullwidth":
case "fullscreen":
//hide responsive
$settingRes = $settings->getSettingByName("responsitive");
$settingRes["disabled"] = true;
$settings->updateArrSettingByName("responsitive", $settingRes);
break;
}
//change height to max height
$settingSize = $settings->getSettingByName("slider_size");
$settingSize["slider_type"] = $sliderType;
$settings->updateArrSettingByName("slider_size", $settingSize);
return($settings);
}
/**
*
* draw responsitive settings value
*/
protected function drawResponsitiveSettings($setting){
$id = $setting["id"];
$w1 = UniteFunctionsRev::getVal($setting, "w1");
$w2 = UniteFunctionsRev::getVal($setting, "w2");
$w3 = UniteFunctionsRev::getVal($setting, "w3");
$w4 = UniteFunctionsRev::getVal($setting, "w4");
$w5 = UniteFunctionsRev::getVal($setting, "w5");
$w6 = UniteFunctionsRev::getVal($setting, "w6");
$sw1 = UniteFunctionsRev::getVal($setting, "sw1");
$sw2 = UniteFunctionsRev::getVal($setting, "sw2");
$sw3 = UniteFunctionsRev::getVal($setting, "sw3");
$sw4 = UniteFunctionsRev::getVal($setting, "sw4");
$sw5 = UniteFunctionsRev::getVal($setting, "sw5");
$sw6 = UniteFunctionsRev::getVal($setting, "sw6");
$disabled = (UniteFunctionsRev::getVal($setting, "disabled") == true);
$strDisabled = "";
if($disabled == true)
$strDisabled = "disabled='disabled'";
?>
<table>
<tr>
<td>
<?php _e("Screen Width",REVSLIDER_TEXTDOMAIN)?>1:
</td>
<td>
<input id="<?php echo $id?>_w1" name="<?php echo $id?>_w1" type="text" class="textbox-small" <?php echo $strDisabled?> value="<?php echo $w1?>">
</td>
<td>
<?php _e("Slider Width",REVSLIDER_TEXTDOMAIN)?>1:
</td>
<td>
<input id="<?php echo $id?>_sw1" name="<?php echo $id?>_sw1" type="text" class="textbox-small" <?php echo $strDisabled?> value="<?php echo $sw1?>">
</td>
</tr>
<tr>
<td>
<?php _e("Screen Width",REVSLIDER_TEXTDOMAIN)?>2:
</td>
<td>
<input id="<?php echo $id?>_w2" name="<?php echo $id?>_w2" type="text" class="textbox-small" <?php echo $strDisabled?> value="<?php echo $w2?>">
</td>
<td>
<?php _e("Slider Width",REVSLIDER_TEXTDOMAIN)?>2:
</td>
<td>
<input id="<?php echo $id?>_sw2" name="<?php echo $id?>_sw2" type="text" class="textbox-small" <?php echo $strDisabled?> value="<?php echo $sw2?>">
</td>
</tr>
<tr>
<td>
<?php _e("Screen Width",REVSLIDER_TEXTDOMAIN)?>3:
</td>
<td>
<input id="<?php echo $id?>_w3" name="<?php echo $id?>_w3" type="text" class="textbox-small" <?php echo $strDisabled?> value="<?php echo $w3?>">
</td>
<td>
<?php _e("Slider Width",REVSLIDER_TEXTDOMAIN)?>3:
</td>
<td>
<input id="<?php echo $id?>_sw3" name="<?php echo $id?>_sw3" type="text" class="textbox-small" <?php echo $strDisabled?> value="<?php echo $sw3?>">
</td>
</tr>
<tr>
<td>
<?php _e("Screen Width",REVSLIDER_TEXTDOMAIN)?>4:
</td>
<td>
<input type="text" id="<?php echo $id?>_w4" name="<?php echo $id?>_w4" class="textbox-small" <?php echo $strDisabled?> value="<?php echo $w4?>">
</td>
<td>
<?php _e("Slider Width",REVSLIDER_TEXTDOMAIN)?>4:
</td>
<td>
<input type="text" id="<?php echo $id?>_sw4" name="<?php echo $id?>_sw4" class="textbox-small" <?php echo $strDisabled?> value="<?php echo $sw4?>">
</td>
</tr>
<tr>
<td>
<?php _e("Screen Width",REVSLIDER_TEXTDOMAIN)?>5:
</td>
<td>
<input type="text" id="<?php echo $id?>_w5" name="<?php echo $id?>_w5" class="textbox-small" <?php echo $strDisabled?> value="<?php echo $w5?>">
</td>
<td>
<?php _e("Slider Width",REVSLIDER_TEXTDOMAIN)?>5:
</td>
<td>
<input type="text" id="<?php echo $id?>_sw5" name="<?php echo $id?>_sw5" class="textbox-small" <?php echo $strDisabled?> value="<?php echo $sw5?>">
</td>
</tr>
<tr>
<td>
<?php _e("Screen Width",REVSLIDER_TEXTDOMAIN)?>6:
</td>
<td>
<input type="text" id="<?php echo $id?>_w6" name="<?php echo $id?>_w6" class="textbox-small" <?php echo $strDisabled?> value="<?php echo $w6?>">
</td>
<td>
<?php _e("Slider Width",REVSLIDER_TEXTDOMAIN)?>6:
</td>
<td>
<input type="text" id="<?php echo $id?>_sw6" name="<?php echo $id?>_sw6" class="textbox-small" <?php echo $strDisabled?> value="<?php echo $sw6?>">
</td>
</tr>
</table>
<?php
}
/**
*
* draw slider size
*/
protected function drawSliderSize($setting){
$width = UniteFunctionsRev::getVal($setting, "width");
$height = UniteFunctionsRev::getVal($setting, "height");
$sliderType = UniteFunctionsRev::getVal($setting, "slider_type");
$textNormalW = __("Grid Width:",REVSLIDER_TEXTDOMAIN);
$textNormalH = __("Grid Height:",REVSLIDER_TEXTDOMAIN);
$textFullWidthW = __("Grid Width:",REVSLIDER_TEXTDOMAIN);
$textFullWidthH = __("Grid Height:",REVSLIDER_TEXTDOMAIN);
$textFullScreenW = __("Grid Width:",REVSLIDER_TEXTDOMAIN);
$textFullScreenH = __("Grid Height:",REVSLIDER_TEXTDOMAIN);
//set default text (fixed, responsive)
switch($sliderType){
default:
$textDefaultW = $textNormalW;
$textDefaultH = $textNormalH;
break;
case "fullwidth":
$textDefaultW = $textFullWidthW;
$textDefaultH = $textFullWidthH;
break;
case "fullscreen":
$textDefaultW = $textFullScreenW;
$textDefaultH = $textFullScreenH;
break;
}
?>
<table>
<tr>
<td id="cellWidth" data-textnormal="<?php echo $textNormalW?>" data-textfull="<?php echo $textFullWidthW?>" data-textscreen="<?php echo $textFullScreenW?>">
<?php echo $textDefaultW ?>
</td>
<td id="cellWidthInput">
<input id="width" name="width" type="text" class="textbox-small" value="<?php echo $width?>">
</td>
<td id="cellHeight" data-textnormal="<?php echo $textNormalH?>" data-textfull="<?php echo $textFullWidthH?>" data-textscreen="<?php echo $textFullScreenH?>">
<?php echo $textDefaultH ?>
</td>
<td>
<input id="height" name="height" type="text" class="textbox-small" value="<?php echo $height?>">
</td>
</tr>
</table>
<?php
}
/**
*
* draw custom inputs for rev slider
* @param $setting
*/
protected function drawCustomInputs($setting){
$customType = UniteFunctionsRev::getVal($setting, "custom_type");
switch($customType){
case "slider_size":
$this->drawSliderSize($setting);
break;
case "responsitive_settings":
$this->drawResponsitiveSettings($setting);
break;
default:
UniteFunctionsRev::throwError("No handler function for type: $customType");
break;
}
}
}
?>

View File

@ -0,0 +1,503 @@
<?php
class RevSlide extends UniteElementsBaseRev{
private $id;
private $sliderID;
private $slideOrder;
private $imageUrl;
private $imageID;
private $imageThumb;
private $imageFilepath;
private $imageFilename;
private $params;
private $arrLayers;
public function __construct(){
parent::__construct();
}
/**
*
* init slide by db record
*/
public function initByData($record){
$this->id = $record["id"];
$this->sliderID = $record["slider_id"];
$this->slideOrder = $record["slide_order"];
$params = $record["params"];
$params = (array)json_decode($params);
$layers = $record["layers"];
$layers = (array)json_decode($layers);
$layers = UniteFunctionsRev::convertStdClassToArray($layers);
$imageID = UniteFunctionsRev::getVal($params, "image_id");
//get image url and thumb url
if(!empty($imageID)){
$this->imageID = $imageID;
$imageUrl = UniteFunctionsWPRev::getUrlAttachmentImage($imageID);
if(empty($imageUrl))
$imageUrl = UniteFunctionsRev::getVal($params, "image");
$this->imageThumb = UniteFunctionsWPRev::getUrlAttachmentImage($imageID,UniteFunctionsWPRev::THUMB_MEDIUM);
}else{
$imageUrl = UniteFunctionsRev::getVal($params, "image");
}
//set image path, file and url
$this->imageUrl = $imageUrl;
$this->imageFilepath = UniteFunctionsWPRev::getImagePathFromURL($this->imageUrl);
$realPath = UniteFunctionsWPRev::getPathContent().$this->imageFilepath;
if(file_exists($realPath) == false || is_file($realPath) == false)
$this->imageFilepath = "";
$this->imageFilename = basename($this->imageUrl);
$this->params = $params;
$this->arrLayers = $layers;
}
/**
*
* init the slider by id
*/
public function initByID($slideid){
UniteFunctionsRev::validateNumeric($slideid,"Slide ID");
$slideid = $this->db->escape($slideid);
$record = $this->db->fetchSingle(GlobalsRevSlider::$table_slides,"id=$slideid");
$this->initByData($record);
}
/**
*
* get slide ID
*/
public function getID(){
return($this->id);
}
/**
*
* get slide order
*/
public function getOrder(){
$this->validateInited();
return($this->slideOrder);
}
/**
*
* get layers in json format
*/
public function getLayers(){
$this->validateInited();
return($this->arrLayers);
}
/**
*
* modify layer links for export
*/
public function getLayersForExport(){
$this->validateInited();
$arrLayersNew = array();
foreach($this->arrLayers as $key=>$layer){
$imageUrl = UniteFunctionsRev::getVal($layer, "image_url");
if(!empty($imageUrl))
$layer["image_url"] = UniteFunctionsWPRev::getImagePathFromURL($layer["image_url"]);
$arrLayersNew[] = $layer;
}
return($arrLayersNew);
}
/**
*
* get params for export
*/
public function getParamsForExport(){
$arrParams = $this->getParams();
$urlImage = UniteFunctionsRev::getVal($arrParams, "image");
if(!empty($urlImage))
$arrParams["image"] = UniteFunctionsWPRev::getImagePathFromURL($urlImage);
return($arrParams);
}
/**
* normalize layers text, and get layers
*
*/
public function getLayersNormalizeText(){
$arrLayersNew = array();
foreach ($this->arrLayers as $key=>$layer){
$text = $layer["text"];
$text = addslashes($text);
$layer["text"] = $text;
$arrLayersNew[] = $layer;
}
return($arrLayersNew);
}
/**
*
* get slide params
*/
public function getParams(){
$this->validateInited();
return($this->params);
}
/**
*
* get parameter from params array. if no default, then the param is a must!
*/
function getParam($name,$default=null){
if($default === null){
if(!array_key_exists($name, $this->params))
UniteFunctionsRev::throwError("The param <b>$name</b> not found in slide params.");
$default = "";
}
return UniteFunctionsRev::getVal($this->params, $name,$default);
}
/**
*
* get image filename
*/
public function getImageFilename(){
return($this->imageFilename);
}
/**
*
* get image filepath
*/
public function getImageFilepath(){
return($this->imageFilepath);
}
/**
*
* get image url
*/
public function getImageUrl(){
return($this->imageUrl);
}
/**
*
* get image id
*/
public function getImageID(){
return($this->imageID);
}
/**
*
* get thumb url
*/
public function getThumbUrl(){
$thumbUrl = $this->imageUrl;
if(!empty($this->imageThumb))
$thumbUrl = $this->imageThumb;
return($thumbUrl);
}
/**
*
* get the slider id
*/
public function getSliderID(){
return($this->sliderID);
}
/**
*
* validate that the slider exists
*/
private function validateSliderExists($sliderID){
$slider = new RevSlider();
$slider->initByID($sliderID);
}
/**
*
* validate that the slide is inited and the id exists.
*/
private function validateInited(){
if(empty($this->id))
UniteFunctionsRev::throwError("The slide is not inited!!!");
}
/**
*
* create the slide (from image)
*/
public function createSlide($sliderID,$obj=""){
$imageID = null;
if(is_array($obj)){
$urlImage = UniteFunctionsRev::getVal($obj, "url");
$imageID = UniteFunctionsRev::getVal($obj, "id");
}else{
$urlImage = $obj;
}
//get max order
$slider = new RevSlider();
$slider->initByID($sliderID);
$maxOrder = $slider->getMaxOrder();
$order = $maxOrder+1;
$params = array();
if(!empty($urlImage)){
$params["background_type"] = "image";
$params["image"] = $urlImage;
if(!empty($imageID))
$params["image_id"] = $imageID;
}else{ //create transparent slide
$params["background_type"] = "trans";
}
$jsonParams = json_encode($params);
$arrInsert = array("params"=>$jsonParams,
"slider_id"=>$sliderID,
"slide_order"=>$order,
"layers"=>""
);
$slideID = $this->db->insert(GlobalsRevSlider::$table_slides, $arrInsert);
return($slideID);
}
/**
*
* update slide image from data
*/
public function updateSlideImageFromData($data){
$slideID = UniteFunctionsRev::getVal($data, "slide_id");
$this->initByID($slideID);
$urlImage = UniteFunctionsRev::getVal($data, "url_image");
UniteFunctionsRev::validateNotEmpty($urlImage);
$imageID = UniteFunctionsRev::getVal($data, "image_id");
$arrUpdate = array();
$arrUpdate["image"] = $urlImage;
$arrUpdate["image_id"] = $imageID;
$this->updateParamsInDB($arrUpdate);
return($urlImage);
}
/**
*
* update slide parameters in db
*/
private function updateParamsInDB($arrUpdate){
$this->params = array_merge($this->params,$arrUpdate);
$jsonParams = json_encode($this->params);
$arrDBUpdate = array("params"=>$jsonParams);
$this->db->update(GlobalsRevSlider::$table_slides,$arrDBUpdate,array("id"=>$this->id));
}
/**
*
* sort layers by order
*/
private function sortLayersByOrder($layer1,$layer2){
$layer1 = (array)$layer1;
$layer2 = (array)$layer2;
$order1 = UniteFunctionsRev::getVal($layer1, "order",1);
$order2 = UniteFunctionsRev::getVal($layer2, "order",2);
if($order1 == $order2)
return(0);
return($order1 > $order2);
}
/**
*
* go through the layers and fix small bugs if exists
*/
private function normalizeLayers($arrLayers){
usort($arrLayers,array($this,"sortLayersByOrder"));
$arrLayersNew = array();
foreach ($arrLayers as $key=>$layer){
$layer = (array)$layer;
//set type
$type = UniteFunctionsRev::getVal($layer, "type","text");
$layer["type"] = $type;
//normalize position:
$layer["left"] = round($layer["left"]);
$layer["top"] = round($layer["top"]);
//unset order
unset($layer["order"]);
//modify text
$layer["text"] = stripcslashes($layer["text"]);
$arrLayersNew[] = $layer;
}
return($arrLayersNew);
}
/**
*
* normalize params
*/
private function normalizeParams($params){
$urlImage = UniteFunctionsRev::getVal($params, "image_url");
//init the id if absent
$params["image_id"] = UniteFunctionsRev::getVal($params, "image_id");
$params["image"] = $urlImage;
unset($params["image_url"]);
if(isset($params["video_description"]))
$params["video_description"] = UniteFunctionsRev::normalizeTextareaContent($params["video_description"]);
return($params);
}
/**
*
* update slide from data
* @param $data
*/
public function updateSlideFromData($data){
$slideID = UniteFunctionsRev::getVal($data, "slideid");
$this->initByID($slideID);
//treat params
$params = UniteFunctionsRev::getVal($data, "params");
$params = $this->normalizeParams($params);
//treat layers
$layers = UniteFunctionsRev::getVal($data, "layers");
if(gettype($layers) == "string"){
$layers = stripslashes($layers);
$layers = json_decode($layers);
$layers = UniteFunctionsRev::convertStdClassToArray($layers);
}
if(empty($layers) || gettype($layers) != "array")
$layers = array();
$layers = $this->normalizeLayers($layers);
$arrUpdate = array();
$arrUpdate["layers"] = json_encode($layers);
$arrUpdate["params"] = json_encode($params);
$this->db->update(GlobalsRevSlider::$table_slides,$arrUpdate,array("id"=>$this->id));
}
/**
*
* delete slide from data
*/
public function deleteSlideFromData($data){
$slideID = UniteFunctionsRev::getVal($data, "slideID");
$this->initByID($slideID);
$this->db->delete(GlobalsRevSlider::$table_slides,"id='$slideID'");
}
/**
*
* set params from client
*/
public function setParams($params){
$params = $this->normalizeParams($params);
$this->params = $params;
}
/**
*
* set layers from client
*/
public function setLayers($layers){
$layers = $this->normalizeLayers($layers);
$this->arrLayers = $layers;
}
/**
/* toggle slide state from data
*/
public function toggleSlideStatFromData($data){
$slideID = UniteFunctionsRev::getVal($data, "slide_id");
$this->initByID($slideID);
$state = $this->getParam("state","published");
$newState = ($state == "published")?"unpublished":"published";
$arrUpdate = array();
$arrUpdate["state"] = $newState;
$this->updateParamsInDB($arrUpdate);
return($newState);
}
}
?>

View File

@ -0,0 +1,896 @@
<?php
class RevSlider extends UniteElementsBaseRev{
const VALIDATE_NUMERIC = "numeric";
const VALIDATE_EMPTY = "empty";
const FORCE_NUMERIC = "force_numeric";
private $id;
private $title;
private $alias;
private $arrParams;
private $arrSlides = null;
public function __construct(){
parent::__construct();
}
/**
*
* validate that the slider is inited. if not - throw error
*/
private function validateInited(){
if(empty($this->id))
UniteFunctionsRev::throwError("The slider is not inited!");
}
/**
*
* init slider by db data
*
*/
public function initByDBData($arrData){
$this->id = $arrData["id"];
$this->title = $arrData["title"];
$this->alias = $arrData["alias"];
$params = $arrData["params"];
$params = (array)json_decode($params);
$this->arrParams = $params;
}
/**
*
* init the slider object by database id
*/
public function initByID($sliderID){
UniteFunctionsRev::validateNumeric($sliderID,"Slider ID");
$sliderID = $this->db->escape($sliderID);
try{
$sliderData = $this->db->fetchSingle(GlobalsRevSlider::$table_sliders,"id=$sliderID");
}catch(Exception $e){
UniteFunctionsRev::throwError("Slider with ID: $sliderID Not Found");
}
$this->initByDBData($sliderData);
}
/**
*
* init slider by alias
*/
public function initByAlias($alias){
$alias = $this->db->escape($alias);
try{
$where = "alias='$alias'";
$sliderData = $this->db->fetchSingle(GlobalsRevSlider::$table_sliders,$where);
}catch(Exception $e){
$arrAliases = $this->getAllSliderAliases();
$strAliases = "";
if(!empty($arrAliases))
$strAliases = "'".implode("' or '", $arrAliases)."'";
$errorMessage = "Slider with alias <strong>$alias</strong> not found.";
if(!empty($strAliases))
$errorMessage .= " <br><br>Maybe you mean: ".$strAliases;
UniteFunctionsRev::throwError($errorMessage);
}
$this->initByDBData($sliderData);
}
/**
*
* init by id or alias
*/
public function initByMixed($mixed){
if(is_numeric($mixed))
$this->initByID($mixed);
else
$this->initByAlias($mixed);
}
/**
*
* get data functions
*/
public function getTitle(){
return($this->title);
}
public function getID(){
return($this->id);
}
public function getParams(){
return($this->arrParams);
}
/**
*
* set slider params
*/
public function setParams($arrParams){
$this->arrParams = $arrParams;
}
/**
*
* get parameter from params array. if no default, then the param is a must!
*/
function getParam($name,$default=null,$validateType = null,$title=""){
if($default === null){
if(!array_key_exists($name, $this->arrParams))
UniteFunctionsRev::throwError("The param <b>$name</b> not found in slider params.");
$default = "";
}
$value = UniteFunctionsRev::getVal($this->arrParams, $name,$default);
//validation:
switch($validateType){
case self::VALIDATE_NUMERIC:
case self::VALIDATE_EMPTY:
$paramTitle = !empty($title)?$title:$name;
if($value !== "0" && $value !== 0 && empty($value))
UniteFunctionsRev::throwError("The param <strong>$paramTitle</strong> should not be empty.");
break;
case self::VALIDATE_NUMERIC:
$paramTitle = !empty($title)?$title:$name;
if(!is_numeric($value))
UniteFunctionsRev::throwError("The param <strong>$paramTitle</strong> should be numeric. Now it's: $value");
break;
case self::FORCE_NUMERIC:
if(!is_numeric($value)){
$value = 0;
if(!empty($default))
$value = $default;
}
break;
}
return $value;
}
public function getAlias(){
return($this->alias);
}
/**
* get combination of title (alias)
*/
public function getShowTitle(){
$showTitle = $this->title." ($this->alias)";
return($showTitle);
}
/**
*
* get slider shortcode
*/
public function getShortcode(){
$shortCode = "[rev_slider {$this->alias}]";
return($shortCode);
}
/**
*
* check if alias exists in DB
*/
private function isAliasExistsInDB($alias){
$alias = $this->db->escape($alias);
$where = "alias='$alias'";
if(!empty($this->id))
$where .= " and id != '{$this->id}'";
$response = $this->db->fetch(GlobalsRevSlider::$table_sliders,$where);
return(!empty($response));
}
/**
*
* validate settings for add
*/
private function validateInputSettings($title,$alias,$params){
UniteFunctionsRev::validateNotEmpty($title,"title");
UniteFunctionsRev::validateNotEmpty($alias,"alias");
if($this->isAliasExistsInDB($alias))
UniteFunctionsRev::throwError("Some other slider with alias '$alias' already exists");
}
/**
*
* create / update slider from options
*/
private function createUpdateSliderFromOptions($options,$sliderID = null){
$arrMain = UniteFunctionsRev::getVal($options, "main");
$params = UniteFunctionsRev::getVal($options, "params");
//trim all input data
$arrMain = UniteFunctionsRev::trimArrayItems($arrMain);
$params = UniteFunctionsRev::trimArrayItems($params);
$params = array_merge($arrMain,$params);
$title = UniteFunctionsRev::getVal($arrMain, "title");
$alias = UniteFunctionsRev::getVal($arrMain, "alias");
if(!empty($sliderID))
$this->initByID($sliderID);
$this->validateInputSettings($title, $alias, $params);
$jsonParams = json_encode($params);
//insert slider to database
$arrData = array();
$arrData["title"] = $title;
$arrData["alias"] = $alias;
$arrData["params"] = $jsonParams;
if(empty($sliderID)){ //create slider
$sliderID = $this->db->insert(GlobalsRevSlider::$table_sliders,$arrData);
return($sliderID);
}else{ //update slider
$this->initByID($sliderID);
$sliderID = $this->db->update(GlobalsRevSlider::$table_sliders,$arrData,array("id"=>$sliderID));
}
}
/**
*
* delete slider from datatase
*/
private function deleteSlider(){
$this->validateInited();
//delete slider
$this->db->delete(GlobalsRevSlider::$table_sliders,"id=".$this->id);
//delete slides
$this->deleteAllSlides();
}
/**
*
* delete all slides
*/
private function deleteAllSlides(){
$this->validateInited();
$this->db->delete(GlobalsRevSlider::$table_slides,"slider_id=".$this->id);
}
/**
*
* duplicate slider in datatase
*/
private function duplicateSlider(){
$this->validateInited();
//get slider number:
$response = $this->db->fetch(GlobalsRevSlider::$table_sliders);
$numSliders = count($response);
$newSliderSerial = $numSliders+1;
$newSliderTitle = "Slider".$newSliderSerial;
$newSliderAlias = "slider".$newSliderSerial;
//insert a new slider
$sqlSelect = "select ".GlobalsRevSlider::FIELDS_SLIDER." from ".GlobalsRevSlider::$table_sliders." where id={$this->id}";
$sqlInsert = "insert into ".GlobalsRevSlider::$table_sliders." (".GlobalsRevSlider::FIELDS_SLIDER.") ($sqlSelect)";
$this->db->runSql($sqlInsert);
$lastID = $this->db->getLastInsertID();
UniteFunctionsRev::validateNotEmpty($lastID);
//update the new slider with the title and the alias values
$arrUpdate = array();
$arrUpdate["title"] = $newSliderTitle;
$arrUpdate["alias"] = $newSliderAlias;
$this->db->update(GlobalsRevSlider::$table_sliders, $arrUpdate, array("id"=>$lastID));
//duplicate slides
$fields_slide = GlobalsRevSlider::FIELDS_SLIDE;
$fields_slide = str_replace("slider_id", $lastID, $fields_slide);
$sqlSelect = "select ".$fields_slide." from ".GlobalsRevSlider::$table_slides." where slider_id={$this->id}";
$sqlInsert = "insert into ".GlobalsRevSlider::$table_slides." (".GlobalsRevSlider::FIELDS_SLIDE.") ($sqlSelect)";
$this->db->runSql($sqlInsert);
}
/**
*
* duplicate slide
*/
private function duplicateSlide($slideID){
$slide = new RevSlide();
$slide->initByID($slideID);
$order = $slide->getOrder();
$slides = $this->getSlides();
$newOrder = $order+1;
$this->shiftOrder($newOrder);
//do duplication
$sqlSelect = "select ".GlobalsRevSlider::FIELDS_SLIDE." from ".GlobalsRevSlider::$table_slides." where id={$slideID}";
$sqlInsert = "insert into ".GlobalsRevSlider::$table_slides." (".GlobalsRevSlider::FIELDS_SLIDE.") ($sqlSelect)";
$this->db->runSql($sqlInsert);
$lastID = $this->db->getLastInsertID();
UniteFunctionsRev::validateNotEmpty($lastID);
//update order
$arrUpdate = array("slide_order"=>$newOrder);
$this->db->update(GlobalsRevSlider::$table_slides,$arrUpdate, array("id"=>$lastID));
return($lastID);
}
/**
*
* copy / move slide
*/
private function copyMoveSlide($slideID,$targetSliderID,$operation){
if($operation == "move"){
$targetSlider = new RevSlider();
$targetSlider->initByID($targetSliderID);
$maxOrder = $targetSlider->getMaxOrder();
$newOrder = $maxOrder+1;
$arrUpdate = array("slider_id"=>$targetSliderID,"slide_order"=>$newOrder);
$this->db->update(GlobalsRevSlider::$table_slides,$arrUpdate,array("id"=>$slideID));
}else{ //in place of copy
$this->duplicateSlide($slideID);
$this->copyMoveSlide($slideID,$targetSliderID,"move");
}
}
/**
*
* shift order of the slides from specific order
*/
private function shiftOrder($fromOrder){
$where = " slider_id={$this->id} and slide_order >= $fromOrder";
$sql = "update ".GlobalsRevSlider::$table_slides." set slide_order=(slide_order+1) where $where";
$this->db->runSql($sql);
}
/**
*
* create slider in database from options
*/
public function createSliderFromOptions($options){
$sliderID = $this->createUpdateSliderFromOptions($options);
return($sliderID);
}
/**
*
* export slider from data, output a file for download
*/
public function exportSlider(){
$this->validateInited();
$sliderParams = $this->getParamsForExport();
$arrSlides = $this->getSlidesForExport();
$arrSliderExport = array("params"=>$sliderParams,"slides"=>$arrSlides);
$strExport = serialize($arrSliderExport);
if(!empty($this->alias))
$filename = $this->alias.".txt";
else
$filename = "slider_export.txt";
UniteFunctionsRev::downloadFile($strExport,$filename);
}
/**
*
* import slider from multipart form
*/
public function importSliderFromPost(){
try{
$sliderID = UniteFunctionsRev::getPostVariable("sliderid");
$sliderExists = !empty($sliderID);
if($sliderExists)
$this->initByID($sliderID);
$filepath = $_FILES["import_file"]["tmp_name"];
if(file_exists($filepath) == false)
UniteFunctionsRev::throwError("Import file not found!!!");
//get content array
$content = @file_get_contents($filepath);
$arrSlider = @unserialize($content);
if(empty($arrSlider))
UniteFunctionsRev::throwError("Wrong export slider file format!");
//update slider params
$sliderParams = $arrSlider["params"];
if($sliderExists){
$sliderParams["title"] = $this->arrParams["title"];
$sliderParams["alias"] = $this->arrParams["alias"];
$sliderParams["shortcode"] = $this->arrParams["shortcode"];
}
if(isset($sliderParams["background_image"]))
$sliderParams["background_image"] = UniteFunctionsWPRev::getImageUrlFromPath($sliderParams["background_image"]);
$json_params = json_encode($sliderParams);
//update slider or craete new
if($sliderExists){
$arrUpdate = array("params"=>$json_params);
$this->db->update(GlobalsRevSlider::$table_sliders,$arrUpdate,array("id"=>$sliderID));
}
else{ //new slider
$arrInsert = array();
$arrInsert["params"] = $json_params;
$arrInsert["title"] = UniteFunctionsRev::getVal($sliderParams, "title","Slider1");
$arrInsert["alias"] = UniteFunctionsRev::getVal($sliderParams, "alias","slider1");
$sliderID = $this->db->insert(GlobalsRevSlider::$table_sliders,$arrInsert);
}
//-------- Slides Handle -----------
//delete current slides
if($sliderExists)
$this->deleteAllSlides();
//create all slides
$arrSlides = $arrSlider["slides"];
foreach($arrSlides as $slide){
$params = $slide["params"];
$layers = $slide["layers"];
//convert params images:
if(isset($params["image"]))
$params["image"] = UniteFunctionsWPRev::getImageUrlFromPath($params["image"]);
//convert layers images:
foreach($layers as $key=>$layer){
if(isset($layer["image_url"])){
$layer["image_url"] = UniteFunctionsWPRev::getImageUrlFromPath($layer["image_url"]);
$layers[$key] = $layer;
}
}
//create new slide
$arrCreate = array();
$arrCreate["slider_id"] = $sliderID;
$arrCreate["slide_order"] = $slide["slide_order"];
$arrCreate["layers"] = json_encode($layers);
$arrCreate["params"] = json_encode($params);
$this->db->insert(GlobalsRevSlider::$table_slides,$arrCreate);
}
}catch(Exception $e){
$errorMessage = $e->getMessage();
return(array("success"=>false,"error"=>$errorMessage,"sliderID"=>$sliderID));
}
return(array("success"=>true,"sliderID"=>$sliderID));
}
/**
*
* update slider from options
*/
public function updateSliderFromOptions($options){
$sliderID = UniteFunctionsRev::getVal($options, "sliderid");
UniteFunctionsRev::validateNotEmpty($sliderID,"Slider ID");
$this->createUpdateSliderFromOptions($options,$sliderID);
}
/**
*
* delete slider from input data
*/
public function deleteSliderFromData($data){
$sliderID = UniteFunctionsRev::getVal($data, "sliderid");
UniteFunctionsRev::validateNotEmpty($sliderID,"Slider ID");
$this->initByID($sliderID);
$this->deleteSlider();
}
/**
*
* delete slider from input data
*/
public function duplicateSliderFromData($data){
$sliderID = UniteFunctionsRev::getVal($data, "sliderid");
UniteFunctionsRev::validateNotEmpty($sliderID,"Slider ID");
$this->initByID($sliderID);
$this->duplicateSlider();
}
/**
*
* duplicate slide from input data
*/
public function duplicateSlideFromData($data){
//init the slider
$sliderID = UniteFunctionsRev::getVal($data, "sliderID");
UniteFunctionsRev::validateNotEmpty($sliderID,"Slider ID");
$this->initByID($sliderID);
//get the slide id
$slideID = UniteFunctionsRev::getVal($data, "slideID");
UniteFunctionsRev::validateNotEmpty($slideID,"Slide ID");
$this->duplicateSlide($slideID);
return($sliderID);
}
/**
*
* copy / move slide from data
*/
public function copyMoveSlideFromData($data){
$sliderID = UniteFunctionsRev::getVal($data, "sliderID");
UniteFunctionsRev::validateNotEmpty($sliderID,"Slider ID");
$this->initByID($sliderID);
$targetSliderID = UniteFunctionsRev::getVal($data, "targetSliderID");
UniteFunctionsRev::validateNotEmpty($sliderID,"Target Slider ID");
$this->initByID($sliderID);
if($targetSliderID == $sliderID)
UniteFunctionsRev::throwError("The target slider can't be equal to the source slider");
$slideID = UniteFunctionsRev::getVal($data, "slideID");
UniteFunctionsRev::validateNotEmpty($slideID,"Slide ID");
$operation = UniteFunctionsRev::getVal($data, "operation");
$this->copyMoveSlide($slideID,$targetSliderID,$operation);
return($sliderID);
}
/**
*
* create a slide from input data
*/
public function createSlideFromData($data,$returnSlideID = false){
$sliderID = UniteFunctionsRev::getVal($data, "sliderid");
$obj = UniteFunctionsRev::getVal($data, "obj");
UniteFunctionsRev::validateNotEmpty($sliderID,"Slider ID");
$this->initByID($sliderID);
if(is_array($obj)){ //multiple
foreach($obj as $item){
$slide = new RevSlide();
$slideID = $slide->createSlide($sliderID, $item);
}
return(count($obj));
}else{ //signle
$urlImage = $obj;
$slide = new RevSlide();
$slideID = $slide->createSlide($sliderID, $urlImage);
if($returnSlideID == true)
return($slideID);
else
return(1); //num slides -1 slide created
}
}
/**
*
* update slides order from data
*/
public function updateSlidesOrderFromData($data){
$sliderID = UniteFunctionsRev::getVal($data, "sliderID");
$arrIDs = UniteFunctionsRev::getVal($data, "arrIDs");
UniteFunctionsRev::validateNotEmpty($arrIDs,"slides");
$this->initByID($sliderID);
foreach($arrIDs as $index=>$slideID){
$order = $index+1;
$arrUpdate = array("slide_order"=>$order);
$where = array("id"=>$slideID);
$this->db->update(GlobalsRevSlider::$table_slides,$arrUpdate,$where);
}
}
/**
*
* get the "main" and "settings" arrays, for dealing with the settings.
*/
public function getSettingsFields(){
$this->validateInited();
$arrMain = array();
$arrMain["title"] = $this->title;
$arrMain["alias"] = $this->alias;
$arrRespose = array("main"=>$arrMain,
"params"=>$this->arrParams);
return($arrRespose);
}
/**
*
* get slides of the current slider
*/
public function getSlides($publishedOnly = false){
$this->validateInited();
$arrSlides = array();
$arrSlideRecords = $this->db->fetch(GlobalsRevSlider::$table_slides,"slider_id=".$this->id,"slide_order");
foreach ($arrSlideRecords as $record){
$slide = new RevSlide();
$slide->initByData($record);
if($publishedOnly == true){
$state = $slide->getParam("state","published");
if($state == "unpublished")
continue;
}
$arrSlides[] = $slide;
}
$this->arrSlides = $arrSlides;
return($arrSlides);
}
/**
*
* get array of slide names
*/
public function getArrSlideNames(){
if(empty($this->arrSlides))
$this->getSlides();
$arrSlideNames = array();
foreach($this->arrSlides as $number=>$slide){
$slideID = $slide->getID();
$filename = $slide->getImageFilename();
$slideName = "Slide ".($number+1);
if(!empty($filename))
$slideName .= " ($filename)";
$arrSlideNames[$slideID] = $slideName;
}
return($arrSlideNames);
}
/**
*
* get array of slides numbers by id's
*/
public function getSlidesNumbersByIDs($publishedOnly = false){
if(empty($this->arrSlides))
$this->getSlides($publishedOnly);
$arrSlideNumbers = array();
foreach($this->arrSlides as $number=>$slide){
$slideID = $slide->getID();
$arrSlideNumbers[$slideID] = ($number+1);
}
return($arrSlideNumbers);
}
/**
*
* get slider params for export slider
*/
private function getParamsForExport(){
$exportParams = $this->arrParams;
//modify background image
$urlImage = UniteFunctionsRev::getVal($exportParams, "background_image");
if(!empty($urlImage))
$exportParams["background_image"] = $urlImage;
return($exportParams);
}
/**
*
* get slides for export
*/
private function getSlidesForExport(){
$arrSlides = $this->getSlides();
$arrSlidesExport = array();
foreach($arrSlides as $slide){
$slideNew = array();
$slideNew["params"] = $slide->getParamsForExport();
$slideNew["slide_order"] = $slide->getOrder();
$slideNew["layers"] = $slide->getLayersForExport();
$arrSlidesExport[] = $slideNew;
}
return($arrSlidesExport);
}
/**
*
* get slides number
*/
public function getNumSlides($publishedOnly = false){
if($this->arrSlides == null)
$this->getSlides($publishedOnly);
$numSlides = count($this->arrSlides);
return($numSlides);
}
/**
*
* get sliders array - function don't belong to the object!
*/
public function getArrSliders(){
$where = "";
$response = $this->db->fetch(GlobalsRevSlider::$table_sliders,$where,"id");
$arrSliders = array();
foreach($response as $arrData){
$slider = new RevSlider();
$slider->initByDBData($arrData);
$arrSliders[] = $slider;
}
return($arrSliders);
}
/**
*
* get aliasees array
*/
public function getAllSliderAliases(){
$where = "";
$response = $this->db->fetch(GlobalsRevSlider::$table_sliders,$where,"id");
$arrAliases = array();
foreach($response as $arrSlider){
$arrAliases[] = $arrSlider["alias"];
}
return($arrAliases);
}
/**
*
* get array of slider id -> title
*/
public function getArrSlidersShort($exceptID = null){
$arrSliders = $this->getArrSliders();
$arrShort = array();
foreach($arrSliders as $slider){
$id = $slider->getID();
if(!empty($exceptID) && $exceptID == $id)
continue;
$title = $slider->getTitle();
$arrShort[$id] = $title;
}
return($arrShort);
}
/**
*
* get max order
*/
public function getMaxOrder(){
$this->validateInited();
$maxOrder = 0;
$arrSlideRecords = $this->db->fetch(GlobalsRevSlider::$table_slides,"slider_id=".$this->id,"slide_order desc","","limit 1");
if(empty($arrSlideRecords))
return($maxOrder);
$maxOrder = $arrSlideRecords[0]["slide_order"];
return($maxOrder);
}
/**
*
* get setting - start with slide
*/
public function getStartWithSlideSetting(){
$numSlides = $this->getNumSlides();
$startWithSlide = $this->getParam("start_with_slide","1");
if(is_numeric($startWithSlide)){
$startWithSlide = (int)$startWithSlide - 1;
if($startWithSlide < 0)
$startWithSlide = 0;
if($startWithSlide >= $numSlides)
$startWithSlide = 0;
}else
$startWithSlide = 0;
return($startWithSlide);
}
}
?>

View File

@ -0,0 +1,102 @@
<?php
class RevSlider_Widget extends WP_Widget {
public function __construct(){
// widget actual processes
$widget_ops = array('classname' => 'widget_revslider', 'description' => __('Displays a revolution slider on the page') );
parent::__construct('rev-slider-widget', __('Revolution Slider'), $widget_ops);
}
/**
*
* the form
*/
public function form($instance) {
$slider = new RevSlider();
$arrSliders = $slider->getArrSlidersShort();
if(empty($arrSliders))
echo __("No sliders found, Please create a slider");
else{
$field = "rev_slider";
$fieldPages = "rev_slider_pages";
$fieldCheck = "rev_slider_homepage";
$sliderID = UniteFunctionsRev::getVal($instance, $field);
$homepage = UniteFunctionsRev::getVal($instance, $fieldCheck);
$pagesValue = UniteFunctionsRev::getVal($instance, $fieldPages);
$fieldID = $this->get_field_id( $field );
$fieldName = $this->get_field_name( $field );
$select = UniteFunctionsRev::getHTMLSelect($arrSliders,$sliderID,'name="'.$fieldName.'" id="'.$fieldID.'"',true);
$fieldID_check = $this->get_field_id( $fieldCheck );
$fieldName_check = $this->get_field_name( $fieldCheck );
$checked = "";
if($homepage == "on")
$checked = "checked='checked'";
$fieldPages_ID = $this->get_field_id( $fieldPages );
$fieldPages_Name = $this->get_field_name( $fieldPages );
?>
Choose Slider: <?php echo $select?>
<div style="padding-top:10px;"></div>
<label for="<?php echo $fieldID_check?>">Home Page Only:</label>
<input type="checkbox" name="<?php echo $fieldName_check?>" id="<?php echo $fieldID_check?>" <?php echo $checked?> >
<br><br>
<label for="<?php echo $fieldPages_ID?>">Pages: (example: 2,10) </label>
<input type="text" name="<?php echo $fieldPages_Name?>" id="<?php echo $fieldPages_ID?>" value="<?php echo $pagesValue?>">
<div style="padding-top:10px;"></div>
<?php
} //else
}
/**
*
* update
*/
public function update($new_instance, $old_instance) {
return($new_instance);
}
/**
*
* widget output
*/
public function widget($args, $instance) {
$sliderID = UniteFunctionsRev::getVal($instance, "rev_slider");
$homepageCheck = UniteFunctionsRev::getVal($instance, "rev_slider_homepage");
$homepage = "";
if($homepageCheck == "on")
$homepage = "homepage";
$pages = UniteFunctionsRev::getVal($instance, "rev_slider_pages");
if(!empty($pages)){
if(!empty($homepage))
$homepage .= ",";
$homepage .= $pages;
}
if(empty($sliderID))
return(false);
RevSliderOutput::putSlider($sliderID,$homepage);
}
}
?>

View File

@ -0,0 +1,900 @@
var UniteAdminRev = new function(){
var t = this;
var errorMessageID = null;
var successMessageID = null;
var ajaxLoaderID = null;
var ajaxHideButtonID = null;
//video dialog vars:
var lastVideoData = null; //last fetched data
var lastVideoCallback = null; //last callback from video dialog return
var colorPickerCallback = null;
/**
* escape html, turn html to a string
*/
t.htmlspecialchars = function(string){
return string
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#039;");
}
/**
* turn string value ("true", "false") to string
*/
t.strToBool = function(str){
if(str == undefined)
return(false);
if(typeof(str) != "string")
return(false);
str = str.toLowerCase();
var bool = (str == "true")?true:false;
return(bool);
}
/**
* set callback on color picker movement
*/
t.setColorPickerCallback = function(callbackFunc){
colorPickerCallback = callbackFunc;
}
/**
* on color picker event. Pass the event further
*/
t.onColorPickerMoveEvent = function(event){
if(typeof colorPickerCallback == "function")
colorPickerCallback(event);
}
/**
* strip html tags
*/
t.stripTags = function(input, allowed) {
allowed = (((allowed || "") + "").toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join(''); // making sure the allowed arg is a string containing only tags in lowercase (<a><b><c>)
var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,
commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
return input.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) {
return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
});
}
/**
* debug html on the top of the page (from the master view)
*/
t.debug = function(html){
jQuery("#div_debug").show().html(html);
}
/**
* output data to console
*/
t.trace = function(data,clear){
if(clear && clear == true)
console.clear();
console.log(data);
}
/**
* show error message or call once custom handler function
*/
t.showErrorMessage = function(htmlError){
if(errorMessageID !== null){
jQuery("#"+errorMessageID).show().html(htmlError);
}else
jQuery("#error_message").show().html(htmlError);
showAjaxButton();
}
/**
* hide error message
*/
var hideErrorMessage = function(){
if(errorMessageID !== null){
jQuery("#"+errorMessageID).hide();
errorMessageID = null;
}else
jQuery("#error_message").hide();
}
/**
* set error message id
*/
t.setErrorMessageID = function(id){
errorMessageID = id;
}
/**
* set success message id
*/
t.setSuccessMessageID = function(id){
successMessageID = id;
}
/**
* show success message
*/
var showSuccessMessage = function(htmlSuccess){
var id = "#success_message";
var delay = 2000;
if(successMessageID){
id = "#"+successMessageID;
delay = 500;
}
jQuery(id).show().html(htmlSuccess);
setTimeout("UniteAdminRev.hideSuccessMessage()",delay);
}
/**
* hide success message
*/
this.hideSuccessMessage = function(){
if(successMessageID){
jQuery("#"+successMessageID).hide();
successMessageID = null; //can be used only once.
}
else
jQuery("#success_message").slideUp("slow").fadeOut("slow");
showAjaxButton();
}
/**
* set ajax loader id that will be shown, and hidden on ajax request
* this loader will be shown only once, and then need to be sent again.
*/
this.setAjaxLoaderID = function(id){
ajaxLoaderID = id;
}
/**
* show loader on ajax actions
*/
var showAjaxLoader = function(){
if(ajaxLoaderID)
jQuery("#"+ajaxLoaderID).show();
}
/**
* hide and remove ajax loader. next time has to be set again before "ajaxRequest" function.
*/
var hideAjaxLoader = function(){
if(ajaxLoaderID){
jQuery("#"+ajaxLoaderID).hide();
ajaxLoaderID = null;
}
}
/**
* set button to hide / show on ajax operations.
*/
this.setAjaxHideButtonID = function(buttonID){
ajaxHideButtonID = buttonID;
}
/**
* if exist ajax button to hide, hide it.
*/
var hideAjaxButton = function(){
if(ajaxHideButtonID)
jQuery("#"+ajaxHideButtonID).hide();
}
/**
* if exist ajax button, show it, and remove the button id.
*/
var showAjaxButton = function(){
if(ajaxHideButtonID){
jQuery("#"+ajaxHideButtonID).show();
ajaxHideButtonID = null;
}
}
/**
* Ajax request function. call wp ajax, if error - print error message.
* if success, call "success function"
*/
t.ajaxRequest = function(action,data,successFunction){
var objData = {
action:g_uniteDirPlagin+"_ajax_action",
client_action:action,
data:data
}
hideErrorMessage();
showAjaxLoader();
hideAjaxButton();
jQuery.ajax({
type:"post",
url:ajaxurl,
dataType: 'json',
data:objData,
success:function(response){
hideAjaxLoader();
if(!response){
t.showErrorMessage("Empty ajax response!");
return(false);
}
if(response == -1){
t.showErrorMessage("ajax error!!!");
return(false);
}
if(response == 0){
t.showErrorMessage("ajax error, action: <b>"+action+"</b> not found");
return(false);
}
if(response.success == undefined){
t.showErrorMessage("The 'success' param is a must!");
return(false);
}
if(response.success == false){
t.showErrorMessage(response.message);
return(false);
}
//success actions:
//run a success event function
if(typeof successFunction == "function")
successFunction(response);
else{
if(response.message)
showSuccessMessage(response.message);
}
if(response.is_redirect)
location.href=response.redirect_url;
},
error:function(jqXHR, textStatus, errorThrown){
hideAjaxLoader();
if(textStatus == "parsererror")
t.debug(jqXHR.responseText);
t.showErrorMessage("Ajax Error!!! " + textStatus);
}
});
}//ajaxrequest
/**
* open new add image dialog
*/
var openNewImageDialog = function(title,onInsert,isMultiple){
if(isMultiple == undefined)
isMultiple = false;
// Media Library params
var frame = wp.media({
title : title,
multiple : isMultiple,
library : { type : 'image'},
button : { text : 'Insert' }
});
// Runs on select
frame.on('select',function(){
var objSettings = frame.state().get('selection').first().toJSON();
var selection = frame.state().get('selection');
var arrImages = [];
if(isMultiple == true){ //return image object when multiple
selection.map( function( attachment ) {
var objImage = attachment.toJSON();
var obj = {};
obj.url = objImage.url;
obj.id = objImage.id;
arrImages.push(obj);
});
onInsert(arrImages);
}else{ //return image url and id - when single
onInsert(objSettings.url,objSettings.id);
}
});
// Open ML
frame.open();
}
/**
* open old add image dialog
*/
var openOldImageDialog = function(title,onInsert){
var params = "type=image&post_id=0&TB_iframe=true";
params = encodeURI(params);
tb_show(title,'media-upload.php?'+params);
window.send_to_editor = function(html) {
tb_remove();
var urlImage = jQuery(html).attr('src');
if(!urlImage || urlImage == undefined || urlImage == "")
var urlImage = jQuery('img',html).attr('src');
onInsert(urlImage,""); //return empty id, it can be changed
}
}
t.openAddImageDialog = function(title,onInsert,isMultiple){
if(!title)
title = 'Select Image';
if(typeof wp != "undefined" && typeof wp.media != "undefined")
openNewImageDialog(title,onInsert,isMultiple);
else{
openOldImageDialog(title,onInsert);
}
}
/**
* load css file on the fly
* replace current item if exists
*/
t.loadCssFile = function(urlCssFile,replaceID){
var rand = Math.floor((Math.random()*100000)+1);
urlCssFile += "?rand="+rand;
if(replaceID)
jQuery("#"+replaceID).remove();
jQuery("head").append("<link>");
var css = jQuery("head").children(":last");
css.attr({
rel: "stylesheet",
type: "text/css",
href: urlCssFile
});
//replace current element
if(replaceID)
css.attr({id:replaceID});
}
/**
* get show image url
*/
t.getUrlShowImage = function(imageUrl,width,height,exact){
var filepath = imageUrl.replace(g_urlContent,"");
//if not internal image - return normal image url
if(filepath == imageUrl)
return(imageUrl);
var urlImage = g_urlAjaxShowImage+"&img="+filepath;
if(width)
urlImage += "&w="+width;
if(height)
urlImage += "&h="+height;
if(exact && exact == true)
urlImage += "&t=exact";
return(urlImage);
}
/**
* set html to youtube dialog
* if empty data - clear the dialog
*/
var setYoutubeDialogHtml = function(data){
//if empty data - clear the dialog
if(!data){
jQuery("#video_content").html("");
return(false);
}
var thumb = data.thumb_medium;
var html = '<div class="video-content-title">'+data.title+'</div>';
html += '<img src="'+thumb.url+'" width="'+thumb.width+'" height="'+thumb.height+'" alt="thumbnail">';
html += '<div class="video-content-description">'+data.desc_small+'</div>';
jQuery("#video_content").html(html);
}
/**
* pass youtube id or youtube url, and get the id
*/
var getYoutubeIDFromUrl = function(url){
url = jQuery.trim(url);
var video_id = url.split('v=')[1];
if(video_id){
var ampersandPosition = video_id.indexOf('&');
if(ampersandPosition != -1) {
video_id = video_id.substring(0, ampersandPosition);
}
}else{
video_id = url;
}
return(video_id);
}
/**
* get vimeo id from url
*/
var getVimeoIDFromUrl = function(url){
url = jQuery.trim(url);
var video_id = url.replace(/[^0-9]+/g, '');
video_id = jQuery.trim(video_id);
return(video_id);
}
/**
* youtube callback script, set and store youtube data, and add it to dialog
*/
t.onYoutubeCallback = function(obj){
jQuery("#youtube_loader").hide();
var desc_small_size = 200;
//prepare data
var entry = obj.entry;
var data = {};
data.id = jQuery("#youtube_id").val();
data.id = jQuery.trim(data.id);
data.video_type = "youtube";
data.title = entry.title.$t;
data.author = entry.author[0].name.$t;
data.link = entry.link[0].href;
data.description = entry.media$group.media$description.$t;
data.desc_small = data.description;
if(data.description.length > desc_small_size)
data.desc_small = data.description.slice(0,desc_small_size)+"...";
var thumbnails = entry.media$group.media$thumbnail;
data.thumb_small = {url:thumbnails[0].url,width:thumbnails[0].width,height:thumbnails[0].height};
data.thumb_medium = {url:thumbnails[1].url,width:thumbnails[1].width,height:thumbnails[1].height};
data.thumb_big = {url:thumbnails[2].url,width:thumbnails[2].width,height:thumbnails[2].height};
//set html in dialog
setYoutubeDialogHtml(data);
//set the youtube arguments
var objArguments = jQuery("#input_video_arguments");
if(objArguments.val() == "")
objArguments.val(objArguments.data("youtube"));
//store last video data
lastVideoData = data;
//show controls:
jQuery("#video_hidden_controls").show();
}
/**
* vimeo callback script, set and store vimeo data, and add it to dialog
*/
t.onVimeoCallback = function(obj){
jQuery("#vimeo_loader").hide();
var desc_small_size = 200;
obj = obj[0];
var data = {};
data.video_type = "vimeo";
data.id = obj.id;
data.id = jQuery.trim(data.id);
data.title = obj.title;
data.link = obj.url;
data.author = obj.user_name;
data.description = obj.description;
if(data.description.length > desc_small_size)
data.desc_small = data.description.slice(0,desc_small_size)+"...";
data.thumb_large = {url:obj.thumbnail_large,width:640,height:360};
data.thumb_medium = {url:obj.thumbnail_medium,width:200,height:150};
data.thumb_small = {url:obj.thumbnail_small,width:100,height:75};
//set html in dialog
setYoutubeDialogHtml(data);
//set the youtube arguments
var objArguments = jQuery("#input_video_arguments");
objArguments.val(objArguments.data("vimeo"));
//store last video data
lastVideoData = data;
//show controls:
jQuery("#video_hidden_controls").show();
}
/**
* show error message on the dialog
*/
t.videoDialogOnError = function(){
//if ok, don't do nothing
if(jQuery("#video_hidden_controls").is(":visible"))
return(false);
//if error - show message
jQuery("#youtube_loader").hide();
var html = "<div class='video-content-error'>Video Not Found!</div>";
jQuery("#video_content").html(html);
}
/**
* update video size enabled disabled according fullwidth properties
*/
var updateVideoSizeProps = function(){
var isFullwidth = jQuery("#input_video_fullwidth").is(":checked");
if(isFullwidth == true){ //disable
jQuery("#video_size_wrapper").addClass("text-disabled");
jQuery("#input_video_width, #input_video_height").addClass("input-disabled");
}else{ //enable
jQuery("#video_size_wrapper").removeClass("text-disabled");
jQuery("#input_video_width, #input_video_height").removeClass("input-disabled");
}
}
/**
* open dialog for youtube or vimeo import , add / update
*/
t.openVideoDialog = function(callback,objCurrentVideoData){
lastVideoCallback = callback;
var dialogVideo = jQuery("#dialog_video");
//set buttons:
var buttons = {
"Close":function(){
dialogVideo.dialog("close");
}
};
//clear the dialog content
setYoutubeDialogHtml(false);
//clear the fields
jQuery("#input_video_arguments").val("");
jQuery("#input_video_autoplay").prop("checked","");
jQuery("#input_video_nextslide").prop("checked","");
jQuery("#input_video_fullwidth").prop("checked","");
jQuery("#youtube_id").val("");
jQuery("#vimeo_id").val("");
jQuery("#video_hidden_controls").hide();
var buttonVideoAdd = jQuery("#button-video-add");
buttonVideoAdd.text(buttonVideoAdd.data("textadd"));
//open the dialog
dialogVideo.dialog({
buttons:buttons,
minWidth:700,
minHeight:550,
modal:true
});
//if update dialog open:
if(objCurrentVideoData)
setVideoDialogUpdateMode(objCurrentVideoData);
updateVideoSizeProps();
}
/**
* prepare the dialog for video update
*/
var setVideoDialogUpdateMode = function(data){
data.id = jQuery.trim(data.id);
//set mode and video id
switch(data.video_type){
case "youtube":
jQuery("#video_radio_youtube").trigger("click");
jQuery("#youtube_id").val(data.id);
break;
case "vimeo":
jQuery("#video_radio_vimeo").trigger("click");
jQuery("#vimeo_id").val(data.id);
break;
case "html5":
jQuery("#html5_url_poster").val(data.urlPoster);
jQuery("#html5_url_mp4").val(data.urlMp4);
jQuery("#html5_url_webm").val(data.urlWebm);
jQuery("#html5_url_ogv").val(data.urlOgv);
jQuery("#video_radio_html5").trigger("click");
break;
}
//set width and height:
jQuery("#input_video_width").val(data.width);
jQuery("#input_video_height").val(data.height);
jQuery("#input_video_arguments").val(data.args);
if(data.autoplay && data.autoplay == true)
jQuery("#input_video_autoplay").prop("checked","checked");
else
jQuery("#input_video_autoplay").prop("checked","");
if(data.nextslide && data.nextslide == true)
jQuery("#input_video_nextslide").prop("checked","checked");
else
jQuery("#input_video_nextslide").prop("checked","");
if(data.fullwidth && data.fullwidth == true)
jQuery("#input_video_fullwidth").prop("checked","checked");
else
jQuery("#input_video_fullwidth").prop("checked","");
//change button text:
var buttonVideoAdd = jQuery("#button-video-add");
buttonVideoAdd.text(buttonVideoAdd.data("textupdate"));
//search
switch(data.video_type){
case "youtube":
jQuery("#button_youtube_search").trigger("click");
break;
case "vimeo":
jQuery("#button_vimeo_search").trigger("click");
break;
}
}
//add params from textboxes to object
var addTextboxParamsToObj = function(obj){
obj.width = jQuery("#input_video_width").val();
obj.height = jQuery("#input_video_height").val();
obj.args = jQuery("#input_video_arguments").val();
obj.autoplay = jQuery("#input_video_autoplay").is(":checked");
obj.nextslide = jQuery("#input_video_nextslide").is(":checked");
obj.fullwidth = jQuery("#input_video_fullwidth").is(":checked");
return(obj);
}
/**
* init video dialog buttons
*/
var initVideoDialog = function(){
//set youtube radio checked:
jQuery("#video_radio_youtube").prop("checked",true);
//set radio boxes:
jQuery("#video_radio_vimeo").click(function(){
jQuery("#video_block_youtube").hide();
jQuery("#video_block_html5").hide();
jQuery("#video_hidden_controls").hide();
jQuery("#video_content").show();
jQuery("#video_block_vimeo").show();
});
jQuery("#video_radio_youtube").click(function(){
jQuery("#video_block_vimeo").hide();
jQuery("#video_block_html5").hide();
jQuery("#video_hidden_controls").hide();
jQuery("#video_content").show();
jQuery("#video_block_youtube").show();
});
jQuery("#video_radio_html5").click(function(){
jQuery("#video_block_vimeo").hide();
jQuery("#video_block_youtube").hide();
jQuery("#video_block_html5").show();
jQuery("#video_content").hide();
jQuery("#video_hidden_controls").show();
});
//set youtube search action
jQuery("#button_youtube_search").click(function(){
//init data
setYoutubeDialogHtml(false);
jQuery("#video_hidden_controls").hide();
jQuery("#youtube_loader").show();
var youtubeID = jQuery("#youtube_id").val();
youtubeID = jQuery.trim(youtubeID);
youtubeID = getYoutubeIDFromUrl(youtubeID);
var urlAPI = "http://gdata.youtube.com/feeds/api/videos/"+youtubeID+"?v=2&alt=json-in-script&callback=UniteAdminRev.onYoutubeCallback";
jQuery.getScript(urlAPI);
//handle not found:
setTimeout("UniteAdminRev.videoDialogOnError()",2000);
});
//add the selected video to the callback function
jQuery("#button-video-add").click(function(){
var html5Checked = jQuery("#video_radio_html5").prop("checked");
if(html5Checked){ //in case of html5
var obj = {};
obj.video_type = "html5";
obj.urlPoster = jQuery("#html5_url_poster").val();
obj.urlMp4 = jQuery("#html5_url_mp4").val();
obj.urlWebm = jQuery("#html5_url_webm").val();
obj.urlOgv = jQuery("#html5_url_ogv").val();
obj.width = jQuery("#input_video_width").val();
obj.height = jQuery("#input_video_height").val();
obj = addTextboxParamsToObj(obj);
if(typeof lastVideoCallback == "function")
lastVideoCallback(obj);
jQuery("#dialog_video").dialog("close");
}else{ //in case of vimeo and youtube
if(!lastVideoData)
return(false);
lastVideoData = addTextboxParamsToObj(lastVideoData);
if(typeof lastVideoCallback == "function")
lastVideoCallback(lastVideoData);
jQuery("#dialog_video").dialog("close");
}
});
//set vimeo search
jQuery("#button_vimeo_search").click(function(){
//init data
setYoutubeDialogHtml(false);
jQuery("#video_hidden_controls").hide();
jQuery("#vimeo_loader").show();
var vimeoID = jQuery("#vimeo_id").val();
vimeoID = jQuery.trim(vimeoID);
vimeoID = getVimeoIDFromUrl(vimeoID);
var urlAPI = 'http://www.vimeo.com/api/v2/video/' + vimeoID + '.json?callback=UniteAdminRev.onVimeoCallback';
jQuery.getScript(urlAPI);
});
jQuery("#input_video_fullwidth").click(updateVideoSizeProps);
}//end initVideoDialog
/**
* init general settings dialog
*/
var initGeneralSettings = function(){
//button general settings - open dialog
jQuery("#button_general_settings").click(function(){
jQuery("#loader_general_settings").hide();
jQuery("#dialog_general_settings").dialog({
minWidth:800,
minHeight:500,
modal:true
});
});
//button save general settings
jQuery("#button_save_general_settings").click(function(){
var data = UniteSettingsRev.getSettingsObject("form_general_settings");
jQuery("#loader_general_settings").show();
UniteAdminRev.ajaxRequest("update_general_settings",data,function(response){
jQuery("#loader_general_settings").hide();
jQuery("#dialog_general_settings").dialog("close");
});
});
}
//run the init function
jQuery(document).ready(function(){
initVideoDialog();
//init update dialog:
jQuery("#button_upload_plugin").click(function(){
jQuery("#dialog_update_plugin").dialog({
minWidth:600,
minHeight:400,
modal:true
});
});
//update text operation
jQuery("#button_update_text").click(function(){
UniteAdminRev.ajaxRequest("update_text","",function(response){
alert(response.message);
});
});
initGeneralSettings();
});
}
//user functions:
function trace(data,clear){
UniteAdminRev.trace(data,clear);
}
function debug(data){
UniteAdminRev.debug(data);
}

Some files were not shown because too many files have changed in this diff Show More