init
This commit is contained in:
@@ -0,0 +1,465 @@
|
||||
/*-----------------------------------------------------------------------------------
|
||||
/* Admin styles
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
.updated, .error {
|
||||
display:none!important
|
||||
} /* disable the admin notices */
|
||||
|
||||
.flatsome-instagram-accounts .theme .theme-screenshot::after {
|
||||
padding-top: 100%;
|
||||
}
|
||||
|
||||
.flatsome-instagram-connect {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
background: rgba(0,0,0,0.3);
|
||||
z-index: 900;
|
||||
}
|
||||
|
||||
.flatsome-instagram-connect-body {
|
||||
margin: 64px auto 32px;
|
||||
padding: 8px 16px 16px;
|
||||
max-width: 450px;
|
||||
background: #fff;
|
||||
box-shadow: 0 5px 5px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
#of_container {
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
position:relative;
|
||||
z-index: 0
|
||||
}
|
||||
|
||||
|
||||
#of_container ul,#of_container ol {margin: 0;}
|
||||
|
||||
#of_container .logo{padding:10px 20px; display: block;}
|
||||
|
||||
#of_container .logo span{font-size: 80%;font-weight: normal;opacity: 0.6;display: block;}
|
||||
|
||||
#of_container #main {
|
||||
display: table;
|
||||
vertical-align: top;
|
||||
margin-left: -20px;
|
||||
}
|
||||
#of_container #of-nav {
|
||||
display: table-cell;
|
||||
z-index: 99;
|
||||
min-width: 200px;
|
||||
max-width: 200px;
|
||||
vertical-align: top;
|
||||
}
|
||||
#of_container #of-nav ul {
|
||||
margin:0;
|
||||
}
|
||||
|
||||
#of_container #of-nav ul li a{
|
||||
color:#666;
|
||||
text-decoration: none;
|
||||
padding:10px 30px 10px 20px;
|
||||
display: block;
|
||||
border-bottom: 1px solid #ddd;
|
||||
font-weight: bold;
|
||||
font-size: 100%;
|
||||
background-repeat: no-repeat;
|
||||
background-position: 90% 50%;
|
||||
transition: all 0.3s;
|
||||
|
||||
}
|
||||
|
||||
#of_container #of-nav ul li{
|
||||
margin: 0;padding:0;
|
||||
}
|
||||
|
||||
#of_container #of-nav ul li.current a, #of_container #of-nav ul li a:hover{
|
||||
color:#000; background-color: #fff;
|
||||
margin-right: -1px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/*menu icons - customize to your liking*/
|
||||
#of_container #content {
|
||||
border-left:1px solid #ddd;
|
||||
display: table-cell;
|
||||
min-height: 500px;
|
||||
min-height: 100%;
|
||||
background-color: #FFF;padding:30px;
|
||||
width: 100%;
|
||||
/*font-family: "Lucida Grande", Sans-serif;*/
|
||||
}
|
||||
#of_container #content .section {
|
||||
margin-bottom: 10px;
|
||||
max-width: 450px;
|
||||
}
|
||||
#of_container #content .section h3.heading {
|
||||
font-size: 13px;
|
||||
text-transform: uppercase;
|
||||
margin: 20px 0 0 0;
|
||||
padding: 15px 0px;
|
||||
border-top: 1px solid #ddd;
|
||||
}
|
||||
#of_container #content .section .controls {
|
||||
position: relative;
|
||||
margin: 0 15px 10px 0;
|
||||
}
|
||||
#of_container #content .section .explain {
|
||||
font-size: 11px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
|
||||
/* Slider ui */
|
||||
|
||||
.section-sliderui .controls > *{display: inline-block;}
|
||||
.section-sliderui .controls input{width:80px!important;}
|
||||
|
||||
/* Checkboxes */
|
||||
|
||||
|
||||
#of_container #content .section-checkbox .option{
|
||||
display: table;
|
||||
}
|
||||
|
||||
#of_container #content .section-checkbox .option > div{
|
||||
display: table-cell;
|
||||
padding-right: 5px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#of_container #content input[type=checkbox] {
|
||||
width: 17px;
|
||||
min-width: 17px;
|
||||
}
|
||||
|
||||
|
||||
#of_container #content .section-multicheck .controls input{
|
||||
display: inline-block;
|
||||
width: 20px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
|
||||
/* Options and select */
|
||||
#of_container select, #of_container input, #of_container textarea{
|
||||
width:100%;
|
||||
background-color: #f9f9f9;
|
||||
border:1px solid #ddd;
|
||||
border-radius: 3px;
|
||||
padding:10px;
|
||||
color:#666;
|
||||
font-size: 12px;
|
||||
line-height: 16px;
|
||||
|
||||
}
|
||||
#of_container select{
|
||||
height: 32px;
|
||||
padding: 0 0 0 10px;
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
#of_container textarea{
|
||||
max-width: 100%;
|
||||
padding: 5px;
|
||||
color:#666;
|
||||
min-height: 150px;
|
||||
}
|
||||
|
||||
|
||||
#of_container .controls .of-radio-img-img {
|
||||
outline:3px solid #fff;
|
||||
margin:0 10px 10px 0;
|
||||
border:1px solid #ccc;
|
||||
display:none;
|
||||
cursor:pointer;
|
||||
float:left;
|
||||
}
|
||||
#of_container .controls .of-radio-img-selected {
|
||||
outline:3px solid #0074a2
|
||||
}
|
||||
#of_container .controls .of-radio-img-img:hover {
|
||||
opacity:.8;
|
||||
}
|
||||
|
||||
|
||||
#of_container .accept {
|
||||
background: #DBF6BE no-repeat 10px center;
|
||||
border: solid #9BBF65;
|
||||
border-width: 0px 1px 1px 1px;
|
||||
color: #060;
|
||||
font-weight: bold;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
#of_container .warning {
|
||||
background: #ffeeee no-repeat 10px center;
|
||||
;
|
||||
border: solid #dfbfbf;
|
||||
border-width: 0px 1px 1px 1px;
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
#of_container .update_available {
|
||||
background: #FFFEEB no-repeat 10px center;
|
||||
border: solid #CCCCCC;
|
||||
border-width: 0px 1px 1px 1px;
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
#of_container .of-save-popup {
|
||||
position:fixed;
|
||||
top:0px!important;
|
||||
left:0!important;right:0!important;
|
||||
background:#55c524;
|
||||
opacity: 0.96;
|
||||
color:#fff;
|
||||
font-size:24px;
|
||||
text-align:center;
|
||||
display:none;
|
||||
}
|
||||
|
||||
#of_container .of-save-popup div{
|
||||
padding:40px 15px 15px;
|
||||
}
|
||||
|
||||
html[data-iframe] #of_container .of-save-popup div{padding-top: 15px;}
|
||||
|
||||
|
||||
#of_container .accept,
|
||||
#of_container .warning,
|
||||
#of_container .update_available,
|
||||
#of_container .of-save-popup {
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
#of_container .upload_button_div {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
#of_backup_button {
|
||||
margin-right: 5px;
|
||||
}
|
||||
#of_import_button {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
#of_container .image_reset_button, #of_container .button.remove-image {
|
||||
margin-left:10px;
|
||||
color:#ef521d;
|
||||
}
|
||||
|
||||
#of_container .image_reset_button:hover, #of_container .button.remove-image:hover {
|
||||
color:red;
|
||||
}
|
||||
|
||||
#of_container .upload-error {
|
||||
float:left;
|
||||
color:#666;
|
||||
font-size:10px;
|
||||
font-weight:bold;
|
||||
text-decoration:none;
|
||||
text-shadow:1px 1px 0 #FFFFFF;
|
||||
margin: 0 10px 0 0;
|
||||
padding:3px 10px;
|
||||
background:#FFDFEC;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
#of_container .reset-button {
|
||||
font-family:Arial,Verdana,sans-serif;
|
||||
margin:0 ;
|
||||
color: #ef521d;
|
||||
border-color: #bbb;
|
||||
}
|
||||
|
||||
#of_container .reset-button:hover { color: #ef521d; border-color: #888}
|
||||
|
||||
#of_container .slide_add_button { float:right; margin-top:10px; }
|
||||
|
||||
|
||||
#of_container .save_bar {
|
||||
padding: 15px 20px;
|
||||
display: block;
|
||||
|
||||
}
|
||||
|
||||
#of_save {
|
||||
font-family: Arial,Verdana,sans-serif;
|
||||
}
|
||||
|
||||
#of_save:hover {
|
||||
border:1px solid #111 !important;
|
||||
}
|
||||
|
||||
#of_container .hide {
|
||||
display:none
|
||||
}
|
||||
#of_container .ajax-loading-img-top {
|
||||
margin: 5px 4px 0;
|
||||
float:left
|
||||
}
|
||||
|
||||
#of_container .ajax-loading-img-bottom {
|
||||
margin: 0 5px;
|
||||
}
|
||||
|
||||
#of_container .ajax-reset-loading-img {
|
||||
display: block;
|
||||
margin-left: 100px;
|
||||
}
|
||||
|
||||
|
||||
#of_container .of-option-image {
|
||||
max-width:340px;
|
||||
padding: 5px;
|
||||
border:1px solid #e3e3e3;
|
||||
background:#f7f7f7;
|
||||
-moz-border-radius: 3px;
|
||||
-khtml-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#of_container .of-notice {
|
||||
background: #ffd1d1;
|
||||
border:1px solid #DFDFDF;
|
||||
-moz-border-radius:8px;
|
||||
text-align: center;
|
||||
margin-bottom: 15px
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* google fonts previewer field style */
|
||||
#of_container p.google_font_preview{
|
||||
display: block;
|
||||
border: 1px dotted lightgray;
|
||||
float: left;
|
||||
padding: 10px;
|
||||
font-size: 10pt;
|
||||
width: 318px;
|
||||
height: auto;
|
||||
margin: 0 0 10px 0;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
/* Option folding */
|
||||
#of_container .temphide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------------------------*/
|
||||
/* Tipsy
|
||||
/*-------------------------------------------------------------------------------------------*/
|
||||
.tipsy { font-size: 10px; position: absolute; padding: 5px; z-index: 100000; }
|
||||
.tipsy-inner { background-color: #000; color: #FFF; max-width: 200px; padding: 5px 8px 4px 8px; text-align: center; }
|
||||
|
||||
/* Rounded corners */
|
||||
.tipsy-inner { border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; }
|
||||
|
||||
/* Uncomment for shadow */
|
||||
/*.tipsy-inner { box-shadow: 0 0 5px #000000; -webkit-box-shadow: 0 0 5px #000000; -moz-box-shadow: 0 0 5px #000000; }*/
|
||||
|
||||
.tipsy-arrow { position: absolute; width: 0; height: 0; line-height: 0; border: 5px dashed #000; }
|
||||
|
||||
/* Rules to colour arrows */
|
||||
.tipsy-arrow-n { border-bottom-color: #000; }
|
||||
.tipsy-arrow-s { border-top-color: #000; }
|
||||
.tipsy-arrow-e { border-left-color: #000; }
|
||||
.tipsy-arrow-w { border-right-color: #000; }
|
||||
|
||||
.tipsy-n .tipsy-arrow { top: 0px; left: 50%; margin-left: -5px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent; }
|
||||
.tipsy-nw .tipsy-arrow { top: 0; left: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;}
|
||||
.tipsy-ne .tipsy-arrow { top: 0; right: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;}
|
||||
.tipsy-s .tipsy-arrow { bottom: 0; left: 50%; margin-left: -5px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
|
||||
.tipsy-sw .tipsy-arrow { bottom: 0; left: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
|
||||
.tipsy-se .tipsy-arrow { bottom: 0; right: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
|
||||
.tipsy-e .tipsy-arrow { right: 0; top: 50%; margin-top: -5px; border-left-style: solid; border-right: none; border-top-color: transparent; border-bottom-color: transparent; }
|
||||
.tipsy-w .tipsy-arrow { left: 0; top: 50%; margin-top: -5px; border-right-style: solid; border-left: none; border-top-color: transparent; border-bottom-color: transparent; }
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------------------------*/
|
||||
/* Color picker overwrite
|
||||
/*-------------------------------------------------------------------------------------------*/
|
||||
#of_container .controls .wp-picker-container input.button{
|
||||
width: auto;
|
||||
height: auto;
|
||||
line-height: 1.5;
|
||||
padding: 2px 8px;
|
||||
margin: 0px 6px 6px 6px;
|
||||
}
|
||||
#of_container .controls .of-color {
|
||||
float: left;
|
||||
width: 70px;
|
||||
margin-left: 5px;
|
||||
margin-top: 0px;
|
||||
padding: 3px;
|
||||
}
|
||||
#of_container .controls .wp-color-result.wp-picker-open {
|
||||
top: -3px;
|
||||
}
|
||||
#of_container #content .section-color .controls {
|
||||
width: 345px;
|
||||
}
|
||||
#of_container #content .section-color .explain {
|
||||
width: 225px;
|
||||
}
|
||||
#of_container #content .iris-picker .iris-strip .ui-slider-handle {
|
||||
position: absolute;
|
||||
background: none!important;
|
||||
right: -3px;
|
||||
left: -3px;
|
||||
border: 4px solid #aaa!important;
|
||||
border-width: 4px 3px;
|
||||
width: auto;
|
||||
height: 6px;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 1px 2px rgba(0,0,0,.2);
|
||||
opacity: .9;
|
||||
z-index: 5;
|
||||
cursor: ns-resize;
|
||||
}
|
||||
#of_container #content .iris-picker .iris-slider-offset {
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 6px;
|
||||
width: 28px;
|
||||
background: none!important;
|
||||
border: 0!important;
|
||||
height: auto;
|
||||
}
|
||||
#of_container .controls .wp-picker-container .wp-color-result {
|
||||
outline: 0;
|
||||
border-color: #dddddd;
|
||||
}
|
||||
|
||||
#section-top_right_text .explain{
|
||||
float:none; width:100%!important;
|
||||
}
|
||||
|
||||
|
||||
/* presets */
|
||||
.pre_select_wrapper{display: none;padding:30px;border-radius:3px;background-color: #ccc;margin-top: 10px; text-align: center;}
|
||||
#of_container #content .section-presets {max-width: 100%;}
|
||||
#of_container #content .section-presets .controls{width:100%;padding-bottom: 30px}
|
||||
#of_container #content .section-presets .cancel{display: block;}
|
||||
#of_container #content .section-presets .controls img{max-width: 900px;border:3px solid #ccc; margin:10px 0}
|
||||
.pre_select_wrapper > a{display: inline-block;}
|
||||
#of_container #content .section-presets .controls img:hover{border-color:#0074a2;}
|
1
wp-content/themes/flatsome/inc/admin/advanced/assets/css/color-picker.min.css
vendored
Normal file
1
wp-content/themes/flatsome/inc/admin/advanced/assets/css/color-picker.min.css
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.wp-color-picker{width:80px}.wp-picker-container .hidden{display:none}.wp-color-result{background-color:#f9f9f9;border:1px solid #bbb;border-radius:2px;cursor:pointer;display:inline-block;height:22px;margin:0 6px 6px 0;position:relative;top:1px;user-select:none;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;vertical-align:bottom;display:inline-block;padding-left:30px}.wp-color-result:after{background:#f3f3f3;background-image:-webkit-gradient(linear,left top,left bottom,from(#fefefe),to(#f4f4f4));background-image:-webkit-linear-gradient(top,#fefefe,#f4f4f4);background-image:-moz-linear-gradient(top,#fefefe,#f4f4f4);background-image:-o-linear-gradient(top,#fefefe,#f4f4f4);background-image:linear-gradient(to bottom,#fefefe,#f4f4f4);color:#333;text-shadow:0 1px 0 #fff;border-radius:0 1px 1px 0;border-left:1px solid #bbb;content:attr(title);display:block;font-size:11px;line-height:22px;padding:0 6px;position:relative;right:0;text-align:center;top:0}.wp-color-result:hover{border-color:#aaa;box-shadow:0 1px 1px rgba(0,0,0,0.1);-moz-box-shadow:0 1px 1px rgba(0,0,0,0.1);-ms-box-shadow:0 1px 1px rgba(0,0,0,0.1);-o-box-shadow:0 1px 1px rgba(0,0,0,0.1);-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.1)}.wp-color-result:hover:after{color:#222;border-color:#aaa;border-left:1px solid #999}.wp-color-result.wp-picker-open{top:0}.wp-color-result.wp-picker-open:after{content:attr(data-current)}.wp-picker-container,.wp-picker-container:active{display:inline-block;outline:0}.wp-color-result:focus{border-color:#888;-moz-box-shadow:0 1px 2px rgba(0,0,0,0.2);-ms-box-shadow:0 1px 2px rgba(0,0,0,0.2);-o-box-shadow:0 1px 2px rgba(0,0,0,0.2);-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.2);box-shadow:0 1px 2px rgba(0,0,0,0.2)}.wp-color-result:focus:after{border-color:#888}.wp-picker-open+.wp-picker-input-wrap{display:inline-block;vertical-align:top}.wp-picker-container .button{margin-left:6px}.wp-picker-container .iris-square-slider .ui-slider-handle:focus{background-color:#555}.wp-picker-container .iris-picker{border-color:#dfdfdf;margin-top:6px}input[type="text"].iris-error{background-color:#ffebe8;border-color:#c00;color:#000}
|
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* jQuery UI CSS Framework 1.8.14
|
||||
*
|
||||
* 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:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
|
||||
.ui-helper-clearfix { display: inline-block; }
|
||||
/* required comment for clearfix to work in Opera \*/
|
||||
* html .ui-helper-clearfix { height:1%; }
|
||||
.ui-helper-clearfix { display:block; }
|
||||
/* end clearfix */
|
||||
.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 Slider 1.8.14
|
||||
*
|
||||
* 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; background:#eee; border-radius:2px; width:200px; display:inline-block; margin-right:10px; border: 1px solid #999;}
|
||||
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 18px; height: 18px; cursor: default; background: url(../images/slider-control.png) no-repeat center center !important; cursor: pointer;}
|
||||
.ui-slider .ui-slider-handle.ui-corner-all { border:0 !important;}
|
||||
.ui-slider .ui-slider-handle.ui-state-focus { border:0 !important; background: url(../images/slider-control.png) no-repeat center center !important;outline: none;}
|
||||
.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: 7px; border-color: #aaa;
|
||||
border-radius: 2px;-webkit-border-radius: 2px;-moz-border-radius: 2px;
|
||||
box-shadow: inset 0px 1px 2px rgba(0, 0, 0, 0.20), 0px 0px 1px rgba(0, 0, 0, 0.20);
|
||||
-moz-box-shadow: inset 0px 1px 2px rgba(0, 0, 0, 0.20), 0px 0px 1px rgba(0, 0, 0, 0.20);
|
||||
-webkit-box-shadow: inset 0px 1px 2px rgba(0, 0, 0, 0.20), 0px 0px 1px rgba(0, 0, 0, 0.20);}
|
||||
.ui-slider-horizontal .ui-slider-handle { top: -5px; margin-left: -9px; }
|
||||
.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-range{border-radius: 2px;-webkit-border-radius: 2px;-moz-border-radius: 2px;
|
||||
box-shadow: inset 0px 1px 2px rgba(0, 0, 0, 0.20), 0px 0px 1px rgba(0, 0, 0, 0.20);
|
||||
-moz-box-shadow: inset 0px 1px 2px rgba(0, 0, 0, 0.20), 0px 0px 1px rgba(0, 0, 0, 0.20);
|
||||
-webkit-box-shadow: inset 0px 1px 2px rgba(0, 0, 0, 0.20), 0px 0px 1px rgba(0, 0, 0, 0.20);}
|
||||
.ui-slider-range.ui-widget-header{border: 1px solid #094B97; margin-top: -1px; margin-left: -1px; background: #0F7FFF;border-radius: 2px;-webkit-border-radius: 2px;-moz-border-radius: 2px;}
|
||||
|
||||
.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; }
|
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
1
wp-content/themes/flatsome/inc/admin/advanced/assets/js/color-picker.min.js
vendored
Normal file
1
wp-content/themes/flatsome/inc/admin/advanced/assets/js/color-picker.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(function(f,e){var a='<a tabindex="0" class="wp-color-result" />',c='<div class="wp-picker-holder" />',b='<div class="wp-picker-container" />',g='<input type="button" class="button button-small hidden" />';var d={options:{defaultColor:false,change:false,clear:false,hide:true,palettes:true},_create:function(){if(f.browser.msie&&parseInt(f.browser.version,10)<8){return}var h=this;var i=h.element;f.extend(h.options,i.data());h.initialValue=i.val();i.addClass("wp-color-picker").hide().wrap(b);h.wrap=i.parent();h.toggler=f(a).insertBefore(i).css({backgroundColor:h.initialValue}).attr("title",wpColorPickerL10n.pick).attr("data-current",wpColorPickerL10n.current);h.pickerContainer=f(c).insertAfter(i);h.button=f(g);if(h.options.defaultColor){h.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString)}else{h.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear)}i.wrap('<span class="wp-picker-input-wrap" />').after(h.button);i.iris({target:h.pickerContainer,hide:true,width:255,mode:"hsv",palettes:h.options.palettes,change:function(j,k){h.toggler.css({backgroundColor:k.color.toString()});if(f.isFunction(h.options.change)){h.options.change.call(this,j,k)}}});i.val(h.initialValue);h._addListeners();if(!h.options.hide){h.toggler.click()}},_addListeners:function(){var h=this;h.toggler.click(function(i){i.stopPropagation();h.element.toggle().iris("toggle");h.button.toggleClass("hidden");h.toggler.toggleClass("wp-picker-open");if(h.toggler.hasClass("wp-picker-open")){f("body").on("click",{wrap:h.wrap,toggler:h.toggler},h._bodyListener)}else{f("body").off("click",h._bodyListener)}});h.element.change(function(j){var i=f(this),k=i.val();if(k===""||k==="#"){h.toggler.css("backgroundColor","");if(f.isFunction(h.options.clear)){h.options.clear.call(this,j)}}});h.toggler.on("keyup",function(i){if(i.keyCode===13||i.keyCode===32){i.preventDefault();h.toggler.trigger("click").next().focus()}});h.button.click(function(j){var i=f(this);if(i.hasClass("wp-picker-clear")){h.element.val("");h.toggler.css("backgroundColor","");if(f.isFunction(h.options.clear)){h.options.clear.call(this,j)}}else{if(i.hasClass("wp-picker-default")){h.element.val(h.options.defaultColor).change()}}})},_bodyListener:function(h){if(!h.data.wrap.find(h.target).length){h.data.toggler.click()}},color:function(h){if(h===e){return this.element.iris("option","color")}this.element.iris("option","color",h)},defaultColor:function(h){if(h===e){return this.options.defaultColor}this.options.defaultColor=h}};f.widget("wp.wpColorPicker",d)}(jQuery));
|
@@ -0,0 +1 @@
|
||||
jQuery.cookie=function(key,value,options){if(arguments.length>1&&String(value)!=="[object Object]"){options=jQuery.extend({},options);if(value===null||value===undefined){options.expires=-1}if(typeof options.expires==='number'){var days=options.expires,t=options.expires=new Date();t.setDate(t.getDate()+days)}value=String(value);return(document.cookie=[encodeURIComponent(key),'=',options.raw?value:encodeURIComponent(value),options.expires?'; expires='+options.expires.toUTCString():'',options.path?'; path='+options.path:'',options.domain?'; domain='+options.domain:'',options.secure?'; secure':''].join(''))}options=value||{};var result,decode=options.raw?function(s){return s}:decodeURIComponent;return(result=new RegExp('(?:^|; )'+encodeURIComponent(key)+'=([^;]*)').exec(document.cookie))?decode(result[1]):null};
|
4
wp-content/themes/flatsome/inc/admin/advanced/assets/js/iris.min.js
vendored
Normal file
4
wp-content/themes/flatsome/inc/admin/advanced/assets/js/iris.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
jQuery Masked Input Plugin
|
||||
Copyright (c) 2007 - 2015 Josh Bush (digitalbush.com)
|
||||
Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
|
||||
Version: 1.4.1
|
||||
*/
|
||||
!function(factory) {
|
||||
"function" == typeof define && define.amd ? define([ "jquery" ], factory) : factory("object" == typeof exports ? require("jquery") : jQuery);
|
||||
}(function($) {
|
||||
var caretTimeoutId, ua = navigator.userAgent, iPhone = /iphone/i.test(ua), chrome = /chrome/i.test(ua), android = /android/i.test(ua);
|
||||
$.mask = {
|
||||
definitions: {
|
||||
"9": "[0-9]",
|
||||
a: "[A-Za-z]",
|
||||
"*": "[A-Za-z0-9]"
|
||||
},
|
||||
autoclear: !0,
|
||||
dataName: "rawMaskFn",
|
||||
placeholder: "_"
|
||||
}, $.fn.extend({
|
||||
caret: function(begin, end) {
|
||||
var range;
|
||||
if (0 !== this.length && !this.is(":hidden")) return "number" == typeof begin ? (end = "number" == typeof end ? end : begin,
|
||||
this.each(function() {
|
||||
this.setSelectionRange ? this.setSelectionRange(begin, end) : this.createTextRange && (range = this.createTextRange(),
|
||||
range.collapse(!0), range.moveEnd("character", end), range.moveStart("character", begin),
|
||||
range.select());
|
||||
})) : (this[0].setSelectionRange ? (begin = this[0].selectionStart, end = this[0].selectionEnd) : document.selection && document.selection.createRange && (range = document.selection.createRange(),
|
||||
begin = 0 - range.duplicate().moveStart("character", -1e5), end = begin + range.text.length),
|
||||
{
|
||||
begin: begin,
|
||||
end: end
|
||||
});
|
||||
},
|
||||
unmask: function() {
|
||||
return this.trigger("unmask");
|
||||
},
|
||||
mask: function(mask, settings) {
|
||||
var input, defs, tests, partialPosition, firstNonMaskPos, lastRequiredNonMaskPos, len, oldVal;
|
||||
if (!mask && this.length > 0) {
|
||||
input = $(this[0]);
|
||||
var fn = input.data($.mask.dataName);
|
||||
return fn ? fn() : void 0;
|
||||
}
|
||||
return settings = $.extend({
|
||||
autoclear: $.mask.autoclear,
|
||||
placeholder: $.mask.placeholder,
|
||||
completed: null
|
||||
}, settings), defs = $.mask.definitions, tests = [], partialPosition = len = mask.length,
|
||||
firstNonMaskPos = null, $.each(mask.split(""), function(i, c) {
|
||||
"?" == c ? (len--, partialPosition = i) : defs[c] ? (tests.push(new RegExp(defs[c])),
|
||||
null === firstNonMaskPos && (firstNonMaskPos = tests.length - 1), partialPosition > i && (lastRequiredNonMaskPos = tests.length - 1)) : tests.push(null);
|
||||
}), this.trigger("unmask").each(function() {
|
||||
function tryFireCompleted() {
|
||||
if (settings.completed) {
|
||||
for (var i = firstNonMaskPos; lastRequiredNonMaskPos >= i; i++) if (tests[i] && buffer[i] === getPlaceholder(i)) return;
|
||||
settings.completed.call(input);
|
||||
}
|
||||
}
|
||||
function getPlaceholder(i) {
|
||||
return settings.placeholder.charAt(i < settings.placeholder.length ? i : 0);
|
||||
}
|
||||
function seekNext(pos) {
|
||||
for (;++pos < len && !tests[pos]; ) ;
|
||||
return pos;
|
||||
}
|
||||
function seekPrev(pos) {
|
||||
for (;--pos >= 0 && !tests[pos]; ) ;
|
||||
return pos;
|
||||
}
|
||||
function shiftL(begin, end) {
|
||||
var i, j;
|
||||
if (!(0 > begin)) {
|
||||
for (i = begin, j = seekNext(end); len > i; i++) if (tests[i]) {
|
||||
if (!(len > j && tests[i].test(buffer[j]))) break;
|
||||
buffer[i] = buffer[j], buffer[j] = getPlaceholder(j), j = seekNext(j);
|
||||
}
|
||||
writeBuffer(), input.caret(Math.max(firstNonMaskPos, begin));
|
||||
}
|
||||
}
|
||||
function shiftR(pos) {
|
||||
var i, c, j, t;
|
||||
for (i = pos, c = getPlaceholder(pos); len > i; i++) if (tests[i]) {
|
||||
if (j = seekNext(i), t = buffer[i], buffer[i] = c, !(len > j && tests[j].test(t))) break;
|
||||
c = t;
|
||||
}
|
||||
}
|
||||
function androidInputEvent() {
|
||||
var curVal = input.val(), pos = input.caret();
|
||||
if (oldVal && oldVal.length && oldVal.length > curVal.length) {
|
||||
for (checkVal(!0); pos.begin > 0 && !tests[pos.begin - 1]; ) pos.begin--;
|
||||
if (0 === pos.begin) for (;pos.begin < firstNonMaskPos && !tests[pos.begin]; ) pos.begin++;
|
||||
input.caret(pos.begin, pos.begin);
|
||||
} else {
|
||||
for (checkVal(!0); pos.begin < len && !tests[pos.begin]; ) pos.begin++;
|
||||
input.caret(pos.begin, pos.begin);
|
||||
}
|
||||
tryFireCompleted();
|
||||
}
|
||||
function blurEvent() {
|
||||
checkVal(), input.val() != focusText && input.change();
|
||||
}
|
||||
function keydownEvent(e) {
|
||||
if (!input.prop("readonly")) {
|
||||
var pos, begin, end, k = e.which || e.keyCode;
|
||||
oldVal = input.val(), 8 === k || 46 === k || iPhone && 127 === k ? (pos = input.caret(),
|
||||
begin = pos.begin, end = pos.end, end - begin === 0 && (begin = 46 !== k ? seekPrev(begin) : end = seekNext(begin - 1),
|
||||
end = 46 === k ? seekNext(end) : end), clearBuffer(begin, end), shiftL(begin, end - 1),
|
||||
e.preventDefault()) : 13 === k ? blurEvent.call(this, e) : 27 === k && (input.val(focusText),
|
||||
input.caret(0, checkVal()), e.preventDefault());
|
||||
}
|
||||
}
|
||||
function keypressEvent(e) {
|
||||
if (!input.prop("readonly")) {
|
||||
var p, c, next, k = e.which || e.keyCode, pos = input.caret();
|
||||
if (!(e.ctrlKey || e.altKey || e.metaKey || 32 > k) && k && 13 !== k) {
|
||||
if (pos.end - pos.begin !== 0 && (clearBuffer(pos.begin, pos.end), shiftL(pos.begin, pos.end - 1)),
|
||||
p = seekNext(pos.begin - 1), len > p && (c = String.fromCharCode(k), tests[p].test(c))) {
|
||||
if (shiftR(p), buffer[p] = c, writeBuffer(), next = seekNext(p), android) {
|
||||
var proxy = function() {
|
||||
$.proxy($.fn.caret, input, next)();
|
||||
};
|
||||
setTimeout(proxy, 0);
|
||||
} else input.caret(next);
|
||||
pos.begin <= lastRequiredNonMaskPos && tryFireCompleted();
|
||||
}
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
function clearBuffer(start, end) {
|
||||
var i;
|
||||
for (i = start; end > i && len > i; i++) tests[i] && (buffer[i] = getPlaceholder(i));
|
||||
}
|
||||
function writeBuffer() {
|
||||
input.val(buffer.join(""));
|
||||
}
|
||||
function checkVal(allow) {
|
||||
var i, c, pos, test = input.val(), lastMatch = -1;
|
||||
for (i = 0, pos = 0; len > i; i++) if (tests[i]) {
|
||||
for (buffer[i] = getPlaceholder(i); pos++ < test.length; ) if (c = test.charAt(pos - 1),
|
||||
tests[i].test(c)) {
|
||||
buffer[i] = c, lastMatch = i;
|
||||
break;
|
||||
}
|
||||
if (pos > test.length) {
|
||||
clearBuffer(i + 1, len);
|
||||
break;
|
||||
}
|
||||
} else buffer[i] === test.charAt(pos) && pos++, partialPosition > i && (lastMatch = i);
|
||||
return allow ? writeBuffer() : partialPosition > lastMatch + 1 ? settings.autoclear || buffer.join("") === defaultBuffer ? (input.val() && input.val(""),
|
||||
clearBuffer(0, len)) : writeBuffer() : (writeBuffer(), input.val(input.val().substring(0, lastMatch + 1))),
|
||||
partialPosition ? i : firstNonMaskPos;
|
||||
}
|
||||
var input = $(this), buffer = $.map(mask.split(""), function(c, i) {
|
||||
return "?" != c ? defs[c] ? getPlaceholder(i) : c : void 0;
|
||||
}), defaultBuffer = buffer.join(""), focusText = input.val();
|
||||
input.data($.mask.dataName, function() {
|
||||
return $.map(buffer, function(c, i) {
|
||||
return tests[i] && c != getPlaceholder(i) ? c : null;
|
||||
}).join("");
|
||||
}), input.one("unmask", function() {
|
||||
input.off(".mask").removeData($.mask.dataName);
|
||||
}).on("focus.mask", function() {
|
||||
if (!input.prop("readonly")) {
|
||||
clearTimeout(caretTimeoutId);
|
||||
var pos;
|
||||
focusText = input.val(), pos = checkVal(), caretTimeoutId = setTimeout(function() {
|
||||
input.get(0) === document.activeElement && (writeBuffer(), pos == mask.replace("?", "").length ? input.caret(0, pos) : input.caret(pos));
|
||||
}, 10);
|
||||
}
|
||||
}).on("blur.mask", blurEvent).on("keydown.mask", keydownEvent).on("keypress.mask", keypressEvent).on("input.mask paste.mask", function() {
|
||||
input.prop("readonly") || setTimeout(function() {
|
||||
var pos = checkVal(!0);
|
||||
input.caret(pos), tryFireCompleted();
|
||||
}, 0);
|
||||
}), chrome && android && input.off("input.mask").on("input.mask", androidInputEvent),
|
||||
checkVal();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
@@ -0,0 +1,241 @@
|
||||
// tipsy, facebook style tooltips for jquery
|
||||
// version 1.0.0a
|
||||
// (c) 2008-2010 jason frame [jason@onehackoranother.com]
|
||||
// released under the MIT license
|
||||
|
||||
(function($) {
|
||||
|
||||
function maybeCall(thing, ctx) {
|
||||
return (typeof thing == 'function') ? (thing.call(ctx)) : thing;
|
||||
};
|
||||
|
||||
function Tipsy(element, options) {
|
||||
this.$element = $(element);
|
||||
this.options = options;
|
||||
this.enabled = true;
|
||||
this.fixTitle();
|
||||
};
|
||||
|
||||
Tipsy.prototype = {
|
||||
show: function() {
|
||||
var title = this.getTitle();
|
||||
if (title && this.enabled) {
|
||||
var $tip = this.tip();
|
||||
|
||||
$tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title);
|
||||
$tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity
|
||||
$tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).prependTo(document.body);
|
||||
|
||||
var pos = $.extend({}, this.$element.offset(), {
|
||||
width: this.$element[0].offsetWidth,
|
||||
height: this.$element[0].offsetHeight
|
||||
});
|
||||
|
||||
var actualWidth = $tip[0].offsetWidth,
|
||||
actualHeight = $tip[0].offsetHeight,
|
||||
gravity = maybeCall(this.options.gravity, this.$element[0]);
|
||||
|
||||
var tp;
|
||||
switch (gravity.charAt(0)) {
|
||||
case 'n':
|
||||
tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
|
||||
break;
|
||||
case 's':
|
||||
tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
|
||||
break;
|
||||
case 'e':
|
||||
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset};
|
||||
break;
|
||||
case 'w':
|
||||
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset};
|
||||
break;
|
||||
}
|
||||
|
||||
if (gravity.length == 2) {
|
||||
if (gravity.charAt(1) == 'w') {
|
||||
tp.left = pos.left + pos.width / 2 - 15;
|
||||
} else {
|
||||
tp.left = pos.left + pos.width / 2 - actualWidth + 15;
|
||||
}
|
||||
}
|
||||
|
||||
$tip.css(tp).addClass('tipsy-' + gravity);
|
||||
$tip.find('.tipsy-arrow')[0].className = 'tipsy-arrow tipsy-arrow-' + gravity.charAt(0);
|
||||
if (this.options.className) {
|
||||
$tip.addClass(maybeCall(this.options.className, this.$element[0]));
|
||||
}
|
||||
|
||||
if (this.options.fade) {
|
||||
$tip.stop().css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: this.options.opacity});
|
||||
} else {
|
||||
$tip.css({visibility: 'visible', opacity: this.options.opacity});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
if (this.options.fade) {
|
||||
this.tip().stop().fadeOut(function() { $(this).remove(); });
|
||||
} else {
|
||||
this.tip().remove();
|
||||
}
|
||||
},
|
||||
|
||||
fixTitle: function() {
|
||||
var $e = this.$element;
|
||||
if ($e.attr('title') || typeof($e.attr('original-title')) != 'string') {
|
||||
$e.attr('original-title', $e.attr('title') || '').removeAttr('title');
|
||||
}
|
||||
},
|
||||
|
||||
getTitle: function() {
|
||||
var title, $e = this.$element, o = this.options;
|
||||
this.fixTitle();
|
||||
var title, o = this.options;
|
||||
if (typeof o.title == 'string') {
|
||||
title = $e.attr(o.title == 'title' ? 'original-title' : o.title);
|
||||
} else if (typeof o.title == 'function') {
|
||||
title = o.title.call($e[0]);
|
||||
}
|
||||
title = ('' + title).replace(/(^\s*|\s*$)/, "");
|
||||
return title || o.fallback;
|
||||
},
|
||||
|
||||
tip: function() {
|
||||
if (!this.$tip) {
|
||||
this.$tip = $('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>');
|
||||
}
|
||||
return this.$tip;
|
||||
},
|
||||
|
||||
validate: function() {
|
||||
if (!this.$element[0].parentNode) {
|
||||
this.hide();
|
||||
this.$element = null;
|
||||
this.options = null;
|
||||
}
|
||||
},
|
||||
|
||||
enable: function() { this.enabled = true; },
|
||||
disable: function() { this.enabled = false; },
|
||||
toggleEnabled: function() { this.enabled = !this.enabled; }
|
||||
};
|
||||
|
||||
$.fn.tipsy = function(options) {
|
||||
|
||||
if (options === true) {
|
||||
return this.data('tipsy');
|
||||
} else if (typeof options == 'string') {
|
||||
var tipsy = this.data('tipsy');
|
||||
if (tipsy) tipsy[options]();
|
||||
return this;
|
||||
}
|
||||
|
||||
options = $.extend({}, $.fn.tipsy.defaults, options);
|
||||
|
||||
function get(ele) {
|
||||
var tipsy = $.data(ele, 'tipsy');
|
||||
if (!tipsy) {
|
||||
tipsy = new Tipsy(ele, $.fn.tipsy.elementOptions(ele, options));
|
||||
$.data(ele, 'tipsy', tipsy);
|
||||
}
|
||||
return tipsy;
|
||||
}
|
||||
|
||||
function enter() {
|
||||
var tipsy = get(this);
|
||||
tipsy.hoverState = 'in';
|
||||
if (options.delayIn == 0) {
|
||||
tipsy.show();
|
||||
} else {
|
||||
tipsy.fixTitle();
|
||||
setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn);
|
||||
}
|
||||
};
|
||||
|
||||
function leave() {
|
||||
var tipsy = get(this);
|
||||
tipsy.hoverState = 'out';
|
||||
if (options.delayOut == 0) {
|
||||
tipsy.hide();
|
||||
} else {
|
||||
setTimeout(function() { if (tipsy.hoverState == 'out') tipsy.hide(); }, options.delayOut);
|
||||
}
|
||||
};
|
||||
|
||||
if (!options.live) this.each(function() { get(this); });
|
||||
|
||||
if (options.trigger != 'manual') {
|
||||
var binder = options.live ? 'live' : 'bind',
|
||||
eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus',
|
||||
eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur';
|
||||
this[binder](eventIn, enter)[binder](eventOut, leave);
|
||||
}
|
||||
|
||||
return this;
|
||||
|
||||
};
|
||||
|
||||
$.fn.tipsy.defaults = {
|
||||
className: null,
|
||||
delayIn: 0,
|
||||
delayOut: 0,
|
||||
fade: false,
|
||||
fallback: '',
|
||||
gravity: 'n',
|
||||
html: false,
|
||||
live: false,
|
||||
offset: 0,
|
||||
opacity: 0.8,
|
||||
title: 'title',
|
||||
trigger: 'hover'
|
||||
};
|
||||
|
||||
// Overwrite this method to provide options on a per-element basis.
|
||||
// For example, you could store the gravity in a 'tipsy-gravity' attribute:
|
||||
// return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
|
||||
// (remember - do not modify 'options' in place!)
|
||||
$.fn.tipsy.elementOptions = function(ele, options) {
|
||||
return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
|
||||
};
|
||||
|
||||
$.fn.tipsy.autoNS = function() {
|
||||
return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
|
||||
};
|
||||
|
||||
$.fn.tipsy.autoWE = function() {
|
||||
return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w';
|
||||
};
|
||||
|
||||
/**
|
||||
* yields a closure of the supplied parameters, producing a function that takes
|
||||
* no arguments and is suitable for use as an autogravity function like so:
|
||||
*
|
||||
* @param margin (int) - distance from the viewable region edge that an
|
||||
* element should be before setting its tooltip's gravity to be away
|
||||
* from that edge.
|
||||
* @param prefer (string, e.g. 'n', 'sw', 'w') - the direction to prefer
|
||||
* if there are no viewable region edges effecting the tooltip's
|
||||
* gravity. It will try to vary from this minimally, for example,
|
||||
* if 'sw' is preferred and an element is near the right viewable
|
||||
* region edge, but not the top edge, it will set the gravity for
|
||||
* that element's tooltip to be 'se', preserving the southern
|
||||
* component.
|
||||
*/
|
||||
$.fn.tipsy.autoBounds = function(margin, prefer) {
|
||||
return function() {
|
||||
var dir = {ns: prefer[0], ew: (prefer.length > 1 ? prefer[1] : false)},
|
||||
boundTop = $(document).scrollTop() + margin,
|
||||
boundLeft = $(document).scrollLeft() + margin,
|
||||
$this = $(this);
|
||||
|
||||
if ($this.offset().top < boundTop) dir.ns = 'n';
|
||||
if ($this.offset().left < boundLeft) dir.ew = 'w';
|
||||
if ($(window).width() + $(document).scrollLeft() - $this.offset().left < margin) dir.ew = 'e';
|
||||
if ($(window).height() + $(document).scrollTop() - $this.offset().top < margin) dir.ns = 's';
|
||||
|
||||
return dir.ns + (dir.ew ? dir.ew : '');
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
1
wp-content/themes/flatsome/inc/admin/advanced/assets/js/min/iris.min-min.js
vendored
Normal file
1
wp-content/themes/flatsome/inc/admin/advanced/assets/js/min/iris.min-min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
wp-content/themes/flatsome/inc/admin/advanced/assets/js/min/smof-min.js
vendored
Normal file
1
wp-content/themes/flatsome/inc/admin/advanced/assets/js/min/smof-min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
673
wp-content/themes/flatsome/inc/admin/advanced/assets/js/smof.js
Normal file
673
wp-content/themes/flatsome/inc/admin/advanced/assets/js/smof.js
Normal file
@@ -0,0 +1,673 @@
|
||||
/**
|
||||
* SMOF js
|
||||
*
|
||||
* contains the core functionalities to be used
|
||||
* inside SMOF
|
||||
*/
|
||||
|
||||
jQuery.noConflict();
|
||||
|
||||
/** Fire up jQuery - let's dance!
|
||||
*/
|
||||
jQuery(document).ready(function($){
|
||||
|
||||
var $ofContainer = $('#of_container');
|
||||
|
||||
//(un)fold options in a checkbox-group
|
||||
jQuery('.fld').click(function() {
|
||||
var $fold='.f_'+this.id;
|
||||
$($fold).slideToggle('normal', "swing");
|
||||
});
|
||||
|
||||
//Color picker
|
||||
$('.of-color').wpColorPicker();
|
||||
|
||||
//hides warning if js is enabled
|
||||
$('#js-warning').hide();
|
||||
|
||||
//Tabify Options
|
||||
$('.group').hide();
|
||||
|
||||
// Get the URL parameter for tab
|
||||
function getURLParameter(name) {
|
||||
return decodeURI(
|
||||
(RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,''])[1]
|
||||
);
|
||||
}
|
||||
|
||||
// If the $_GET param of tab is set, use that for the tab that should be open
|
||||
if (getURLParameter('tab') != "") {
|
||||
$.cookie('of_current_opt', '#'+getURLParameter('tab'), { expires: 7, path: '/' });
|
||||
}
|
||||
|
||||
// Display last current tab
|
||||
if ($.cookie("of_current_opt") === null) {
|
||||
$('.group:first').fadeIn('fast');
|
||||
$('#of-nav li:first').addClass('current');
|
||||
} else {
|
||||
|
||||
var hooks = $('#hooks').html();
|
||||
hooks = jQuery.parseJSON(hooks);
|
||||
|
||||
$.each(hooks, function(key, value) {
|
||||
|
||||
if ($.cookie("of_current_opt") == '#of-option-'+ value) {
|
||||
$('.group#of-option-' + value).fadeIn();
|
||||
$('#of-nav li.' + value).addClass('current');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//Current Menu Class
|
||||
$('#of-nav li a').click(function(evt){
|
||||
// event.preventDefault();
|
||||
|
||||
$('#of-nav li').removeClass('current');
|
||||
$(this).parent().addClass('current');
|
||||
|
||||
var clicked_group = $(this).attr('href');
|
||||
|
||||
$.cookie('of_current_opt', clicked_group, { expires: 7, path: '/' });
|
||||
|
||||
$('.group').hide();
|
||||
|
||||
$(clicked_group).fadeIn('fast');
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
//Masked Inputs (images as radio buttons)
|
||||
$('.of-radio-img-img').click(function(){
|
||||
$(this).parent().parent().find('.of-radio-img-img').removeClass('of-radio-img-selected');
|
||||
$(this).addClass('of-radio-img-selected');
|
||||
});
|
||||
$('.of-radio-img-label').hide();
|
||||
$('.of-radio-img-img').show();
|
||||
$('.of-radio-img-radio').hide();
|
||||
|
||||
//Masked Inputs (background images as radio buttons)
|
||||
$('.of-radio-tile-img').click(function(){
|
||||
$(this).parent().parent().find('.of-radio-tile-img').removeClass('of-radio-tile-selected');
|
||||
$(this).addClass('of-radio-tile-selected');
|
||||
});
|
||||
$('.of-radio-tile-label').hide();
|
||||
$('.of-radio-tile-img').show();
|
||||
$('.of-radio-tile-radio').hide();
|
||||
|
||||
|
||||
|
||||
/** Aquagraphite Slider MOD */
|
||||
|
||||
//Hide (Collapse) the toggle containers on load
|
||||
$(".slide_body").hide();
|
||||
|
||||
//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
|
||||
$ofContainer.on('click', '.slide_edit_button', function () {
|
||||
/*
|
||||
//display as an accordion
|
||||
$(".slide_header").removeClass("active");
|
||||
$(".slide_body").slideUp("fast");
|
||||
*/
|
||||
//toggle for each
|
||||
$(this).parent().toggleClass("active").next().slideToggle("fast");
|
||||
return false; //Prevent the browser jump to the link anchor
|
||||
});
|
||||
|
||||
// Update slide title upon typing
|
||||
function update_slider_title(e) {
|
||||
var element = e;
|
||||
if ( this.timer ) {
|
||||
clearTimeout( element.timer );
|
||||
}
|
||||
this.timer = setTimeout( function() {
|
||||
$(element).parent().prev().find('strong').text( element.value );
|
||||
}, 100);
|
||||
return true;
|
||||
}
|
||||
|
||||
$ofContainer.on('keyup', '.of-slider-title', function () {
|
||||
update_slider_title(this);
|
||||
});
|
||||
|
||||
|
||||
//Remove individual slide
|
||||
$ofContainer.on('click', '.slide_delete_button', function () {
|
||||
// event.preventDefault();
|
||||
var agree = confirm("Are you sure you wish to delete this slide?");
|
||||
if (agree) {
|
||||
var $trash = $(this).parents('li');
|
||||
//$trash.slideUp('slow', function(){ $trash.remove(); }); //chrome + confirm bug made slideUp not working...
|
||||
$trash.animate({
|
||||
opacity: 0.25,
|
||||
height: 0,
|
||||
}, 500, function() {
|
||||
$(this).remove();
|
||||
});
|
||||
return false; //Prevent the browser jump to the link anchor
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
//Add new slide
|
||||
$ofContainer.on('click', '.slide_add_button', function () {
|
||||
var slidesContainer = $(this).prev();
|
||||
var sliderId = slidesContainer.attr('id');
|
||||
|
||||
var numArr = $('#'+sliderId +' li').find('.order').map(function() {
|
||||
var str = this.id;
|
||||
str = str.replace(/\D/g,'');
|
||||
str = parseFloat(str);
|
||||
return str;
|
||||
}).get();
|
||||
|
||||
var maxNum = Math.max.apply(Math, numArr);
|
||||
if (maxNum < 1 ) { maxNum = 0};
|
||||
var newNum = maxNum + 1;
|
||||
|
||||
var newSlide = '<li class="temphide"><div class="slide_header"><strong>Slide ' + newNum + '</strong><input type="hidden" class="slide of-input order" name="' + sliderId + '[' + newNum + '][order]" id="' + sliderId + '_slide_order-' + newNum + '" value="' + newNum + '"><a class="slide_edit_button" href="#">Edit</a></div><div class="slide_body" style="display: none; "><label>Title</label><input class="slide of-input of-slider-title" name="' + sliderId + '[' + newNum + '][title]" id="' + sliderId + '_' + newNum + '_slide_title" value=""><label>Image URL</label><input class="upload slide of-input" name="' + sliderId + '[' + newNum + '][url]" id="' + sliderId + '_' + newNum + '_slide_url" value=""><div class="upload_button_div"><span class="button media_upload_button" id="' + sliderId + '_' + newNum + '">Upload</span><span class="button remove-image hide" id="reset_' + sliderId + '_' + newNum + '" title="' + sliderId + '_' + newNum + '">Remove</span></div><div class="screenshot"></div><label>Link URL (optional)</label><input class="slide of-input" name="' + sliderId + '[' + newNum + '][link]" id="' + sliderId + '_' + newNum + '_slide_link" value=""><label>Description (optional)</label><textarea class="slide of-input" name="' + sliderId + '[' + newNum + '][description]" id="' + sliderId + '_' + newNum + '_slide_description" cols="8" rows="8"></textarea><a class="slide_delete_button" href="#">Delete</a><div class="clear"></div></div></li>';
|
||||
|
||||
slidesContainer.append(newSlide);
|
||||
var nSlide = slidesContainer.find('.temphide');
|
||||
nSlide.fadeIn('fast', function() {
|
||||
$(this).removeClass('temphide');
|
||||
});
|
||||
|
||||
optionsframework_file_bindings(); // re-initialise upload image..
|
||||
|
||||
return false; //prevent jumps, as always..
|
||||
});
|
||||
|
||||
//Sort slides
|
||||
jQuery('.slider').find('ul').each( function() {
|
||||
var id = jQuery(this).attr('id');
|
||||
$('#'+ id).sortable({
|
||||
placeholder: "placeholder",
|
||||
opacity: 0.6,
|
||||
handle: ".slide_header",
|
||||
cancel: "a"
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
/** Sorter (Layout Manager) */
|
||||
jQuery('.sorter').each( function() {
|
||||
var id = jQuery(this).attr('id');
|
||||
$('#'+ id).find('ul').sortable({
|
||||
items: 'li',
|
||||
placeholder: "placeholder",
|
||||
connectWith: '.sortlist_' + id,
|
||||
opacity: 0.6,
|
||||
update: function() {
|
||||
$(this).find('.position').each( function() {
|
||||
|
||||
var listID = $(this).parent().attr('id');
|
||||
var parentID = $(this).parent().parent().attr('id');
|
||||
parentID = parentID.replace(id + '_', '')
|
||||
var optionID = $(this).parent().parent().parent().attr('id');
|
||||
$(this).prop("name", optionID + '[' + parentID + '][' + listID + ']');
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
/** Ajax Backup & Restore MOD */
|
||||
//backup button
|
||||
$ofContainer.on('click', '#of_backup_button', function () {
|
||||
|
||||
var answer = confirm("Click OK to backup your current saved options.")
|
||||
|
||||
if (answer){
|
||||
|
||||
var clickedObject = $(this);
|
||||
var clickedID = $(this).attr('id');
|
||||
|
||||
var nonce = $('#security').val();
|
||||
|
||||
var data = {
|
||||
action: 'of_ajax_post_action',
|
||||
type: 'backup_options',
|
||||
security: nonce
|
||||
};
|
||||
|
||||
$.post(ajaxurl, data, function(response) {
|
||||
|
||||
//check nonce
|
||||
if(response==-1){ //failed
|
||||
|
||||
var fail_popup = $('#of-popup-fail');
|
||||
fail_popup.fadeIn();
|
||||
window.setTimeout(function(){
|
||||
fail_popup.fadeOut();
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
var success_popup = $('#of-popup-save');
|
||||
success_popup.fadeIn();
|
||||
window.setTimeout(function(){
|
||||
location.reload();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
//restore button
|
||||
$ofContainer.on('click', '#of_restore_button', function () {
|
||||
|
||||
var answer = confirm("'Warning: All of your current options will be replaced with the data from your last backup! Proceed?")
|
||||
|
||||
if (answer){
|
||||
|
||||
var clickedObject = $(this);
|
||||
var clickedID = $(this).attr('id');
|
||||
|
||||
var nonce = $('#security').val();
|
||||
|
||||
var data = {
|
||||
action: 'of_ajax_post_action',
|
||||
type: 'restore_options',
|
||||
security: nonce
|
||||
};
|
||||
|
||||
$.post(ajaxurl, data, function(response) {
|
||||
|
||||
//check nonce
|
||||
if(response==-1){ //failed
|
||||
|
||||
var fail_popup = $('#of-popup-fail');
|
||||
fail_popup.fadeIn();
|
||||
window.setTimeout(function(){
|
||||
fail_popup.fadeOut();
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
var success_popup = $('#of-popup-save');
|
||||
success_popup.fadeIn();
|
||||
window.setTimeout(function(){
|
||||
location.reload();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
/** Ajax Transfer (Import/Export) Option */
|
||||
$ofContainer.on('click', '#of_import_button', function () {
|
||||
|
||||
var answer = confirm("Click OK to import options.")
|
||||
|
||||
if (answer){
|
||||
|
||||
var clickedObject = $(this);
|
||||
var clickedID = $(this).attr('id');
|
||||
|
||||
var nonce = $('#security').val();
|
||||
|
||||
var import_data = $('#export_data').val();
|
||||
|
||||
var data = {
|
||||
action: 'of_ajax_post_action',
|
||||
type: 'import_options',
|
||||
security: nonce,
|
||||
data: import_data
|
||||
};
|
||||
|
||||
$.post(ajaxurl, data, function(response) {
|
||||
var fail_popup = $('#of-popup-fail');
|
||||
var success_popup = $('#of-popup-save');
|
||||
|
||||
//check nonce
|
||||
if(response==-1){ //failed
|
||||
fail_popup.fadeIn();
|
||||
window.setTimeout(function(){
|
||||
fail_popup.fadeOut();
|
||||
}, 2000);
|
||||
}
|
||||
else
|
||||
{
|
||||
success_popup.fadeIn();
|
||||
window.setTimeout(function(){
|
||||
location.reload();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
/** AJAX Save Options */
|
||||
$ofContainer.on('click', '#of_save', function () {
|
||||
|
||||
var nonce = $('#security').val();
|
||||
|
||||
$('.ajax-loading-img').fadeIn();
|
||||
|
||||
//get serialized data from all our option fields
|
||||
var serializedReturn = $('#of_form :input[name][name!="security"][name!="of_reset"]').serialize();
|
||||
|
||||
$('#of_form :input[type=checkbox]').each(function() {
|
||||
if (!this.checked) {
|
||||
serializedReturn += '&'+this.name+'=0';
|
||||
}
|
||||
});
|
||||
|
||||
var data = {
|
||||
type: 'save',
|
||||
action: 'of_ajax_post_action',
|
||||
security: nonce,
|
||||
data: serializedReturn
|
||||
};
|
||||
|
||||
|
||||
$.post(ajaxurl, data, function(response) {
|
||||
var success = $('#of-popup-save');
|
||||
var fail = $('#of-popup-fail');
|
||||
var loading = $('.ajax-loading-img');
|
||||
loading.fadeOut();
|
||||
|
||||
if (response==1) {
|
||||
success.fadeIn();
|
||||
} else {
|
||||
fail.fadeIn();
|
||||
}
|
||||
|
||||
window.setTimeout(function(){
|
||||
success.fadeOut();
|
||||
fail.fadeOut();
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
|
||||
/* AJAX Options Reset */
|
||||
$('#of_reset').click(function() {
|
||||
|
||||
//confirm reset
|
||||
var answer = confirm("Click OK to reset. All settings will be lost and replaced with default settings!");
|
||||
|
||||
//ajax reset
|
||||
if (answer){
|
||||
|
||||
var nonce = $('#security').val();
|
||||
|
||||
$('.ajax-reset-loading-img').fadeIn();
|
||||
|
||||
var data = {
|
||||
|
||||
type: 'reset',
|
||||
action: 'of_ajax_post_action',
|
||||
security: nonce,
|
||||
};
|
||||
|
||||
$.post(ajaxurl, data, function(response) {
|
||||
var success = $('#of-popup-reset');
|
||||
var fail = $('#of-popup-fail');
|
||||
var loading = $('.ajax-reset-loading-img');
|
||||
loading.fadeOut();
|
||||
|
||||
if (response==1)
|
||||
{
|
||||
success.fadeIn();
|
||||
window.setTimeout(function(){
|
||||
location.reload();
|
||||
}, 1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
fail.fadeIn();
|
||||
window.setTimeout(function(){
|
||||
fail.fadeOut();
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
|
||||
/** Tipsy @since v1.3 */
|
||||
if (jQuery().tipsy) {
|
||||
$('.tooltip, .typography-size, .typography-height, .typography-face, .typography-style, .of-typography-color').tipsy({
|
||||
fade: true,
|
||||
gravity: 's',
|
||||
opacity: 0.7,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* JQuery UI Slider function
|
||||
* Dependencies : jquery, jquery-ui-slider
|
||||
* Feature added by : Smartik - http://smartik.ws/
|
||||
* Date : 03.17.2013
|
||||
*/
|
||||
jQuery('.smof_sliderui').each(function() {
|
||||
|
||||
var obj = jQuery(this);
|
||||
var sId = "#" + obj.data('id');
|
||||
var val = parseInt(obj.data('val'));
|
||||
var min = parseInt(obj.data('min'));
|
||||
var max = parseInt(obj.data('max'));
|
||||
var step = parseInt(obj.data('step'));
|
||||
|
||||
//slider init
|
||||
obj.slider({
|
||||
value: val,
|
||||
min: min,
|
||||
max: max,
|
||||
step: step,
|
||||
range: "min",
|
||||
slide: function( event, ui ) {
|
||||
jQuery(sId).val( ui.value );
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Switch
|
||||
* Dependencies : jquery
|
||||
* Feature added by : Smartik - http://smartik.ws/
|
||||
* Date : 03.17.2013
|
||||
*/
|
||||
jQuery(".cb-enable").click(function(){
|
||||
var parent = $(this).parents('.switch-options');
|
||||
jQuery('.cb-disable',parent).removeClass('selected');
|
||||
jQuery(this).addClass('selected');
|
||||
jQuery('.main_checkbox',parent).attr('checked', true);
|
||||
|
||||
//fold/unfold related options
|
||||
var obj = jQuery(this);
|
||||
var $fold='.f_'+obj.data('id');
|
||||
jQuery($fold).slideDown('normal', "swing");
|
||||
});
|
||||
jQuery(".cb-disable").click(function(){
|
||||
var parent = $(this).parents('.switch-options');
|
||||
jQuery('.cb-enable',parent).removeClass('selected');
|
||||
jQuery(this).addClass('selected');
|
||||
jQuery('.main_checkbox',parent).attr('checked', false);
|
||||
|
||||
//fold/unfold related options
|
||||
var obj = jQuery(this);
|
||||
var $fold='.f_'+obj.data('id');
|
||||
jQuery($fold).slideUp('normal', "swing");
|
||||
});
|
||||
//disable text select(for modern chrome, safari and firefox is done via CSS)
|
||||
// if (($.browser.msie && $.browser.version < 10) || $.browser.opera) {
|
||||
// $('.cb-enable span, .cb-disable span').find().attr('unselectable', 'on');
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* Google Fonts
|
||||
* Dependencies : google.com, jquery
|
||||
* Feature added by : Smartik - http://smartik.ws/
|
||||
* Date : 03.17.2013
|
||||
*/
|
||||
function GoogleFontSelect( slctr, mainID ){
|
||||
|
||||
var _selected = $(slctr).val(); //get current value - selected and saved
|
||||
var _linkclass = 'style_link_'+ mainID;
|
||||
var _previewer = mainID +'_ggf_previewer';
|
||||
|
||||
if( _selected ){ //if var exists and isset
|
||||
|
||||
$('.'+ _previewer ).fadeIn();
|
||||
|
||||
//Check if selected is not equal with "Select a font" and execute the script.
|
||||
if ( _selected !== 'none' && _selected !== 'Select a font' ) {
|
||||
|
||||
//remove other elements crested in <head>
|
||||
$( '.'+ _linkclass ).remove();
|
||||
|
||||
//replace spaces with "+" sign
|
||||
var the_font = _selected.replace(/\s+/g, '+');
|
||||
|
||||
//add reference to google font family
|
||||
$('head').append('<link href="http://fonts.googleapis.com/css?family='+ the_font +'" rel="stylesheet" type="text/css" class="'+ _linkclass +'">');
|
||||
|
||||
//show in the preview box the font
|
||||
$('.'+ _previewer ).css('font-family', _selected +', sans-serif' );
|
||||
|
||||
}else{
|
||||
|
||||
//if selected is not a font remove style "font-family" at preview box
|
||||
$('.'+ _previewer ).css('font-family', '' );
|
||||
$('.'+ _previewer ).fadeOut();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//init for each element
|
||||
jQuery( '.google_font_select' ).each(function(){
|
||||
var mainID = jQuery(this).attr('id');
|
||||
GoogleFontSelect( this, mainID );
|
||||
});
|
||||
|
||||
//init when value is changed
|
||||
jQuery( '.google_font_select' ).change(function(){
|
||||
var mainID = jQuery(this).attr('id');
|
||||
GoogleFontSelect( this, mainID );
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Media Uploader
|
||||
* Dependencies : jquery, wp media uploader
|
||||
* Feature added by : Smartik - http://smartik.ws/
|
||||
* Date : 05.28.2013
|
||||
*/
|
||||
function optionsframework_add_file(event, selector) {
|
||||
|
||||
var upload = $(".uploaded-file"), frame;
|
||||
var $el = $(this);
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
// If the media frame already exists, reopen it.
|
||||
if ( frame ) {
|
||||
frame.open();
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the media frame.
|
||||
frame = wp.media({
|
||||
// Set the title of the modal.
|
||||
title: $el.data('choose'),
|
||||
|
||||
// Customize the submit button.
|
||||
button: {
|
||||
// Set the text of the button.
|
||||
text: $el.data('update'),
|
||||
// Tell the button not to close the modal, since we're
|
||||
// going to refresh the page when the image is selected.
|
||||
close: false
|
||||
}
|
||||
});
|
||||
|
||||
// When an image is selected, run a callback.
|
||||
frame.on( 'select', function() {
|
||||
// Grab the selected attachment.
|
||||
var attachment = frame.state().get('selection').first();
|
||||
frame.close();
|
||||
selector.find('.upload').val(attachment.attributes.url);
|
||||
if ( attachment.attributes.type == 'image' ) {
|
||||
selector.find('.screenshot').empty().hide().append('<img class="of-option-image" src="' + attachment.attributes.url + '">').slideDown('fast');
|
||||
}
|
||||
selector.find('.media_upload_button').unbind();
|
||||
selector.find('.remove-image').show().removeClass('hide');//show "Remove" button
|
||||
selector.find('.of-background-properties').slideDown();
|
||||
optionsframework_file_bindings();
|
||||
});
|
||||
|
||||
// Finally, open the modal.
|
||||
frame.open();
|
||||
}
|
||||
|
||||
function optionsframework_remove_file(selector) {
|
||||
selector.find('.remove-image').hide().addClass('hide');//hide "Remove" button
|
||||
selector.find('.upload').val('');
|
||||
selector.find('.of-background-properties').hide();
|
||||
selector.find('.screenshot').slideUp();
|
||||
selector.find('.remove-file').unbind();
|
||||
// We don't display the upload button if .upload-notice is present
|
||||
// This means the user doesn't have the WordPress 3.5 Media Library Support
|
||||
if ( $('.section-upload .upload-notice').length > 0 ) {
|
||||
$('.media_upload_button').remove();
|
||||
}
|
||||
optionsframework_file_bindings();
|
||||
}
|
||||
|
||||
function optionsframework_file_bindings() {
|
||||
$('.remove-image, .remove-file').on('click', function() {
|
||||
optionsframework_remove_file( $(this).parents('.section-upload, .section-media, .slide_body') );
|
||||
});
|
||||
|
||||
$('.media_upload_button').unbind('click').click( function( event ) {
|
||||
optionsframework_add_file(event, $(this).parents('.section-upload, .section-media, .slide_body'));
|
||||
});
|
||||
}
|
||||
|
||||
optionsframework_file_bindings();
|
||||
|
||||
|
||||
|
||||
|
||||
}); //end doc ready
|
@@ -0,0 +1,905 @@
|
||||
<?php
|
||||
/**
|
||||
* SMOF Options Machine Class
|
||||
*
|
||||
* @package WordPress
|
||||
* @subpackage SMOF
|
||||
* @since 1.0.0
|
||||
* @author Syamil MJ
|
||||
*/
|
||||
class Options_Machine {
|
||||
|
||||
/**
|
||||
* PHP5 contructor
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function __construct($options) {
|
||||
|
||||
$return = $this->optionsframework_machine($options);
|
||||
|
||||
$this->Inputs = $return[0];
|
||||
$this->Menu = $return[1];
|
||||
$this->Defaults = $return[2];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize option
|
||||
*
|
||||
* Sanitize & returns default values if don't exist
|
||||
*
|
||||
* Notes:
|
||||
- For further uses, you can check for the $value['type'] and performs
|
||||
more speficic sanitization on the option
|
||||
- The ultimate objective of this function is to prevent the "undefined index"
|
||||
errors some authors are having due to malformed options array
|
||||
*/
|
||||
static function sanitize_option( $value ) {
|
||||
$defaults = array(
|
||||
"name" => "",
|
||||
"desc" => "",
|
||||
"id" => "",
|
||||
"std" => "",
|
||||
"mod" => "",
|
||||
"type" => ""
|
||||
);
|
||||
|
||||
$value = wp_parse_args( $value, $defaults );
|
||||
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Process options data and build option fields
|
||||
*
|
||||
* @uses get_theme_mod()
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function optionsframework_machine($options) {
|
||||
global $smof_output, $smof_details, $smof_data;
|
||||
if (empty($options))
|
||||
return;
|
||||
if (empty($smof_data))
|
||||
$smof_data = of_get_options();
|
||||
$data = $smof_data;
|
||||
|
||||
$defaults = array();
|
||||
$counter = 0;
|
||||
$menu = '';
|
||||
$output = '';
|
||||
$update_data = false;
|
||||
|
||||
do_action('optionsframework_machine_before', array(
|
||||
'options' => $options,
|
||||
'smof_data' => $smof_data,
|
||||
));
|
||||
if ($smof_output != "") {
|
||||
$output .= $smof_output;
|
||||
$smof_output = "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach ($options as $value) {
|
||||
|
||||
// sanitize option
|
||||
if ($value['type'] != "heading")
|
||||
$value = self::sanitize_option($value);
|
||||
|
||||
$counter++;
|
||||
$val = '';
|
||||
|
||||
//create array of defaults
|
||||
if ($value['type'] == 'multicheck'){
|
||||
if (is_array($value['std'])){
|
||||
foreach($value['std'] as $i=>$key){
|
||||
$defaults[$value['id']][$key] = true;
|
||||
}
|
||||
} else {
|
||||
$defaults[$value['id']][$value['std']] = true;
|
||||
}
|
||||
} else {
|
||||
if (isset($value['id'])) $defaults[$value['id']] = $value['std'];
|
||||
}
|
||||
|
||||
/* condition start */
|
||||
if(!empty($smof_data) || !empty($data)){
|
||||
|
||||
if (array_key_exists('id', $value) && !isset($smof_data[$value['id']])) {
|
||||
$smof_data[$value['id']] = $value['std'];
|
||||
if ($value['type'] == "checkbox" && $value['std'] == 0) {
|
||||
$smof_data[$value['id']] = 0;
|
||||
} else {
|
||||
$update_data = true;
|
||||
}
|
||||
}
|
||||
if (array_key_exists('id', $value) && !isset($smof_details[$value['id']])) {
|
||||
$smof_details[$value['id']] = $smof_data[$value['id']];
|
||||
}
|
||||
|
||||
//Start Heading
|
||||
if ( $value['type'] != "heading" )
|
||||
{
|
||||
$class = ''; if(isset( $value['class'] )) { $class = $value['class']; }
|
||||
|
||||
//hide items in checkbox group
|
||||
$fold='';
|
||||
if (array_key_exists("fold",$value)) {
|
||||
if (isset($smof_data[$value['fold']]) && $smof_data[$value['fold']]) {
|
||||
$fold="f_".$value['fold']." ";
|
||||
} else {
|
||||
$fold="f_".$value['fold']." temphide ";
|
||||
}
|
||||
}
|
||||
|
||||
$output .= '<div id="section-'.$value['id'].'" class="'.$fold.'section section-'.$value['type'].' '. $class .'">'."\n";
|
||||
|
||||
//only show header if 'name' value exists
|
||||
if($value['name']) $output .= '<h3 class="heading">'. $value['name'] .'</h3>'."\n";
|
||||
|
||||
$output .= '<div class="option">'."\n" . '<div class="controls">'."\n";
|
||||
|
||||
}
|
||||
//End Heading
|
||||
|
||||
//if (!isset($smof_data[$value['id']]) && $value['type'] != "heading")
|
||||
// continue;
|
||||
|
||||
//switch statement to handle various options type
|
||||
switch ( $value['type'] ) {
|
||||
|
||||
|
||||
|
||||
//text input
|
||||
case 'text':
|
||||
$t_value = '';
|
||||
$t_value = stripslashes($smof_data[$value['id']]);
|
||||
$t_value = str_replace('"',"'",$t_value);
|
||||
$mini ='';
|
||||
if(!isset($value['mod'])) $value['mod'] = '';
|
||||
if($value['mod'] == 'mini') { $mini = 'mini';}
|
||||
|
||||
$output .= '<input class="of-input '.$mini.'" name="'.$value['id'].'" id="'. $value['id'] .'" type="'. $value['type'] .'" value="'. $t_value .'" />';
|
||||
break;
|
||||
|
||||
//select option
|
||||
case 'select':
|
||||
$mini ='';
|
||||
if(!isset($value['mod'])) $value['mod'] = '';
|
||||
if($value['mod'] == 'mini') { $mini = 'mini';}
|
||||
$output .= '<div class="select_wrapper ' . $mini . '">';
|
||||
$output .= '<select class="select of-input" name="'.$value['id'].'" id="'. $value['id'] .'">';
|
||||
|
||||
foreach ($value['options'] as $select_ID => $option) {
|
||||
$theValue = $option;
|
||||
if (!is_numeric($select_ID))
|
||||
$theValue = $select_ID;
|
||||
$output .= '<option id="' . $select_ID . '" value="'.$select_ID.'" ' . selected($smof_data[$value['id']], $select_ID, false) . ' />'.$option.'</option>';
|
||||
}
|
||||
$output .= '</select></div>';
|
||||
break;
|
||||
|
||||
|
||||
case 'presets':
|
||||
$output .= '<a href="#" class="button-primary">Select presets</a>';
|
||||
$output .= '<div class="pre_select_wrapper">';
|
||||
foreach ($value['options'] as $select_ID => $option) {
|
||||
$output .= '<a href="#" data-preset="'.$option.'"><img class="pre-select-img" style="width:100%;" src="'.$select_ID.'"/></a>';
|
||||
}
|
||||
$output .= '</div>';
|
||||
break;
|
||||
|
||||
//textarea option
|
||||
case 'textarea':
|
||||
$cols = '8';
|
||||
$ta_value = '';
|
||||
|
||||
if(isset($value['options'])){
|
||||
$ta_options = $value['options'];
|
||||
if(isset($ta_options['cols'])){
|
||||
$cols = $ta_options['cols'];
|
||||
}
|
||||
}
|
||||
|
||||
$ta_value = stripslashes($smof_data[$value['id']]);
|
||||
$output .= '<textarea class="of-input" name="'.$value['id'].'" id="'. $value['id'] .'" cols="'. $cols .'" rows="8">'.$ta_value.'</textarea>';
|
||||
break;
|
||||
|
||||
//radiobox option
|
||||
case "radio":
|
||||
$checked = (isset($smof_data[$value['id']])) ? checked($smof_data[$value['id']], $option, false) : '';
|
||||
foreach($value['options'] as $option=>$name) {
|
||||
$output .= '<input class="of-input of-radio" name="'.$value['id'].'" type="radio" value="'.$option.'" ' . checked($smof_data[$value['id']], $option, false) . ' /><label class="radio">'.$name.'</label><br/>';
|
||||
}
|
||||
break;
|
||||
|
||||
//checkbox option
|
||||
case 'checkbox':
|
||||
if (!isset($smof_data[$value['id']])) {
|
||||
$smof_data[$value['id']] = 0;
|
||||
}
|
||||
|
||||
$fold = '';
|
||||
if (array_key_exists("folds",$value)) $fold="fld ";
|
||||
|
||||
$output .= '<input type="hidden" class="'.$fold.'checkbox of-input" name="'.$value['id'].'" id="'. $value['id'] .'" value="0"/>';
|
||||
$output .= '<input type="checkbox" class="'.$fold.'checkbox of-input" name="'.$value['id'].'" id="'. $value['id'] .'" value="1" '. checked($smof_data[$value['id']], 1, false) .' />';
|
||||
break;
|
||||
|
||||
//multiple checkbox option
|
||||
case 'multicheck':
|
||||
(isset($smof_data[$value['id']]))? $multi_stored = $smof_data[$value['id']] : $multi_stored="";
|
||||
|
||||
foreach ($value['options'] as $key => $option) {
|
||||
if (!isset($multi_stored[$key])) {$multi_stored[$key] = '';}
|
||||
$of_key_string = $value['id'] . '_' . $key;
|
||||
$output .= '<input type="checkbox" class="checkbox of-input" name="'.$value['id'].'['.$key.']'.'" id="'. $of_key_string .'" value="1" '. checked($multi_stored[$key], 1, false) .' /><label class="multicheck" for="'. $of_key_string .'">'. $option .'</label><br />';
|
||||
}
|
||||
break;
|
||||
|
||||
// Color picker
|
||||
case "color":
|
||||
$default_color = '';
|
||||
if ( isset($value['std']) ) {
|
||||
$default_color = ' data-default-color="' .$value['std'] . '" ';
|
||||
}
|
||||
$output .= '<input name="' . $value['id'] . '" id="' . $value['id'] . '" class="of-color" type="text" value="' . $smof_data[$value['id']] . '"' . $default_color .' />';
|
||||
|
||||
break;
|
||||
|
||||
//typography option
|
||||
case 'typography':
|
||||
|
||||
$typography_stored = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
|
||||
|
||||
/* Font Size */
|
||||
|
||||
if(isset($typography_stored['size'])) {
|
||||
$output .= '<div class="select_wrapper typography-size" original-title="Font size">';
|
||||
$output .= '<select class="of-typography of-typography-size select" name="'.$value['id'].'[size]" id="'. $value['id'].'_size">';
|
||||
for ($i = 9; $i < 20; $i++){
|
||||
$test = $i.'px';
|
||||
$output .= '<option value="'. $i .'px" ' . selected($typography_stored['size'], $test, false) . '>'. $i .'px</option>';
|
||||
}
|
||||
|
||||
$output .= '</select></div>';
|
||||
|
||||
}
|
||||
|
||||
/* Line Height */
|
||||
if(isset($typography_stored['height'])) {
|
||||
|
||||
$output .= '<div class="select_wrapper typography-height" original-title="Line height">';
|
||||
$output .= '<select class="of-typography of-typography-height select" name="'.$value['id'].'[height]" id="'. $value['id'].'_height">';
|
||||
for ($i = 20; $i < 38; $i++){
|
||||
$test = $i.'px';
|
||||
$output .= '<option value="'. $i .'px" ' . selected($typography_stored['height'], $test, false) . '>'. $i .'px</option>';
|
||||
}
|
||||
|
||||
$output .= '</select></div>';
|
||||
|
||||
}
|
||||
|
||||
/* Font Face */
|
||||
if(isset($typography_stored['face'])) {
|
||||
|
||||
$output .= '<div class="select_wrapper typography-face" original-title="Font family">';
|
||||
$output .= '<select class="of-typography of-typography-face select" name="'.$value['id'].'[face]" id="'. $value['id'].'_face">';
|
||||
|
||||
$faces = array('arial'=>'Arial',
|
||||
'verdana'=>'Verdana, Geneva',
|
||||
'trebuchet'=>'Trebuchet',
|
||||
'georgia' =>'Georgia',
|
||||
'times'=>'Times New Roman',
|
||||
'tahoma'=>'Tahoma, Geneva',
|
||||
'palatino'=>'Palatino',
|
||||
'helvetica'=>'Helvetica' );
|
||||
foreach ($faces as $i=>$face) {
|
||||
$output .= '<option value="'. $i .'" ' . selected($typography_stored['face'], $i, false) . '>'. $face .'</option>';
|
||||
}
|
||||
|
||||
$output .= '</select></div>';
|
||||
|
||||
}
|
||||
|
||||
/* Font Weight */
|
||||
if(isset($typography_stored['style'])) {
|
||||
|
||||
$output .= '<div class="select_wrapper typography-style" original-title="Font style">';
|
||||
$output .= '<select class="of-typography of-typography-style select" name="'.$value['id'].'[style]" id="'. $value['id'].'_style">';
|
||||
$styles = array('normal'=>'Normal',
|
||||
'italic'=>'Italic',
|
||||
'bold'=>'Bold',
|
||||
'bold italic'=>'Bold Italic');
|
||||
|
||||
foreach ($styles as $i=>$style){
|
||||
|
||||
$output .= '<option value="'. $i .'" ' . selected($typography_stored['style'], $i, false) . '>'. $style .'</option>';
|
||||
}
|
||||
$output .= '</select></div>';
|
||||
|
||||
}
|
||||
|
||||
/* Font Color */
|
||||
if(isset($typography_stored['color'])) {
|
||||
|
||||
$output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector typography-color"><div style="background-color: '.$typography_stored['color'].'"></div></div>';
|
||||
$output .= '<input class="of-color of-typography of-typography-color" original-title="Font color" name="'.$value['id'].'[color]" id="'. $value['id'] .'_color" type="text" value="'. $typography_stored['color'] .'" />';
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
//border option
|
||||
case 'border':
|
||||
|
||||
/* Border Width */
|
||||
$border_stored = $smof_data[$value['id']];
|
||||
|
||||
$output .= '<div class="select_wrapper border-width">';
|
||||
$output .= '<select class="of-border of-border-width select" name="'.$value['id'].'[width]" id="'. $value['id'].'_width">';
|
||||
for ($i = 0; $i < 21; $i++){
|
||||
$output .= '<option value="'. $i .'" ' . selected($border_stored['width'], $i, false) . '>'. $i .'</option>'; }
|
||||
$output .= '</select></div>';
|
||||
|
||||
/* Border Style */
|
||||
$output .= '<div class="select_wrapper border-style">';
|
||||
$output .= '<select class="of-border of-border-style select" name="'.$value['id'].'[style]" id="'. $value['id'].'_style">';
|
||||
|
||||
$styles = array('none'=>'None',
|
||||
'solid'=>'Solid',
|
||||
'dashed'=>'Dashed',
|
||||
'dotted'=>'Dotted');
|
||||
|
||||
foreach ($styles as $i=>$style){
|
||||
$output .= '<option value="'. $i .'" ' . selected($border_stored['style'], $i, false) . '>'. $style .'</option>';
|
||||
}
|
||||
|
||||
$output .= '</select></div>';
|
||||
|
||||
/* Border Color */
|
||||
$output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector"><div style="background-color: '.$border_stored['color'].'"></div></div>';
|
||||
$output .= '<input class="of-color of-border of-border-color" name="'.$value['id'].'[color]" id="'. $value['id'] .'_color" type="text" value="'. $border_stored['color'] .'" />';
|
||||
|
||||
break;
|
||||
|
||||
//images checkbox - use image as checkboxes
|
||||
case 'images':
|
||||
|
||||
$i = 0;
|
||||
|
||||
$select_value = (isset($smof_data[$value['id']])) ? $smof_data[$value['id']] : '';
|
||||
|
||||
foreach ($value['options'] as $key => $option)
|
||||
{
|
||||
$i++;
|
||||
|
||||
$checked = '';
|
||||
$selected = '';
|
||||
if(NULL!=checked($select_value, $key, false)) {
|
||||
$checked = checked($select_value, $key, false);
|
||||
$selected = 'of-radio-img-selected';
|
||||
}
|
||||
$output .= '<span>';
|
||||
$output .= '<input type="radio" id="of-radio-img-' . $value['id'] . $i . '" class="checkbox of-radio-img-radio" value="'.$key.'" name="'.$value['id'].'" '.$checked.' />';
|
||||
$output .= '<div class="of-radio-img-label">'. $key .'</div>';
|
||||
$output .= '<img src="'.$option.'" alt="" class="of-radio-img-img '. $selected .'" onClick="document.getElementById(\'of-radio-img-'. $value['id'] . $i.'\').checked = true;" />';
|
||||
$output .= '</span>';
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
//info (for small intro box etc)
|
||||
case "info":
|
||||
$info_text = $value['std'];
|
||||
$output .= '<div class="of-info">'.$info_text.'</div>';
|
||||
break;
|
||||
|
||||
//display a single image
|
||||
case "image":
|
||||
$src = $value['std'];
|
||||
$output .= '<img src="'.$src.'">';
|
||||
break;
|
||||
|
||||
//tab heading
|
||||
case 'heading':
|
||||
if($counter >= 2){
|
||||
$output .= '</div>'."\n";
|
||||
}
|
||||
//custom icon
|
||||
$icon = '';
|
||||
if(isset($value['icon'])){
|
||||
$icon = ' style="background-image: url('. $value['icon'] .');"';
|
||||
}
|
||||
$header_class = str_replace(' ','',strtolower($value['name']));
|
||||
$jquery_click_hook = str_replace(' ', '', strtolower($value['name']) );
|
||||
$jquery_click_hook = "of-option-" . trim(preg_replace('/ +/', '', preg_replace('/[^A-Za-z0-9 ]/', '', urldecode(html_entity_decode(strip_tags($jquery_click_hook))))));
|
||||
|
||||
$menu .= '<li class="'. $header_class .'"><a title="'. $value['name'] .'" href="#'. $jquery_click_hook .'"'. $icon .'>'. $value['name'] .'</a></li>';
|
||||
$output .= '<div class="group" id="'. $jquery_click_hook .'"><h2>'.$value['name'].'</h2>'."\n";
|
||||
break;
|
||||
|
||||
//drag & drop slide manager
|
||||
case 'slider':
|
||||
$output .= '<div class="slider"><ul id="'.$value['id'].'">';
|
||||
$slides = $smof_data[$value['id']];
|
||||
$count = count($slides);
|
||||
if ($count < 2) {
|
||||
$oldorder = 1;
|
||||
$order = 1;
|
||||
$output .= Options_Machine::optionsframework_slider_function($value['id'],$value['std'],$oldorder,$order);
|
||||
} else {
|
||||
$i = 0;
|
||||
foreach ($slides as $slide) {
|
||||
$oldorder = $slide['order'];
|
||||
$i++;
|
||||
$order = $i;
|
||||
$output .= Options_Machine::optionsframework_slider_function($value['id'],$value['std'],$oldorder,$order);
|
||||
}
|
||||
}
|
||||
$output .= '</ul>';
|
||||
$output .= '<a href="#" class="button slide_add_button">Add New Slide</a></div>';
|
||||
|
||||
break;
|
||||
|
||||
//drag & drop block manager
|
||||
case 'sorter':
|
||||
|
||||
// Make sure to get list of all the default blocks first
|
||||
$all_blocks = $value['std'];
|
||||
|
||||
$temp = array(); // holds default blocks
|
||||
$temp2 = array(); // holds saved blocks
|
||||
|
||||
foreach($all_blocks as $blocks) {
|
||||
$temp = array_merge($temp, $blocks);
|
||||
}
|
||||
|
||||
$sortlists = isset($data[$value['id']]) && !empty($data[$value['id']]) ? $data[$value['id']] : $value['std'];
|
||||
|
||||
foreach( $sortlists as $sortlist ) {
|
||||
$temp2 = array_merge($temp2, $sortlist);
|
||||
}
|
||||
|
||||
// now let's compare if we have anything missing
|
||||
foreach($temp as $k => $v) {
|
||||
if(!array_key_exists($k, $temp2)) {
|
||||
$sortlists['disabled'][$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
// now check if saved blocks has blocks not registered under default blocks
|
||||
foreach( $sortlists as $key => $sortlist ) {
|
||||
foreach($sortlist as $k => $v) {
|
||||
if(!array_key_exists($k, $temp)) {
|
||||
unset($sortlist[$k]);
|
||||
}
|
||||
}
|
||||
$sortlists[$key] = $sortlist;
|
||||
}
|
||||
|
||||
// assuming all sync'ed, now get the correct naming for each block
|
||||
foreach( $sortlists as $key => $sortlist ) {
|
||||
foreach($sortlist as $k => $v) {
|
||||
$sortlist[$k] = $temp[$k];
|
||||
}
|
||||
$sortlists[$key] = $sortlist;
|
||||
}
|
||||
|
||||
$output .= '<div id="'.$value['id'].'" class="sorter">';
|
||||
|
||||
|
||||
if ($sortlists) {
|
||||
|
||||
foreach ($sortlists as $group=>$sortlist) {
|
||||
|
||||
$output .= '<ul id="'.$value['id'].'_'.$group.'" class="sortlist_'.$value['id'].'">';
|
||||
$output .= '<h3>'.$group.'</h3>';
|
||||
|
||||
foreach ($sortlist as $key => $list) {
|
||||
|
||||
$output .= '<input class="sorter-placebo" type="hidden" name="'.$value['id'].'['.$group.'][placebo]" value="placebo">';
|
||||
|
||||
if ($key != "placebo") {
|
||||
|
||||
$output .= '<li id="'.$key.'" class="sortee">';
|
||||
$output .= '<input class="position" type="hidden" name="'.$value['id'].'['.$group.']['.$key.']" value="'.$list.'">';
|
||||
$output .= $list;
|
||||
$output .= '</li>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$output .= '</ul>';
|
||||
}
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
break;
|
||||
|
||||
//background images option
|
||||
case 'tiles':
|
||||
|
||||
$i = 0;
|
||||
$select_value = isset($smof_data[$value['id']]) && !empty($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
|
||||
if (is_array($value['options'])) {
|
||||
foreach ($value['options'] as $key => $option) {
|
||||
$i++;
|
||||
|
||||
$checked = '';
|
||||
$selected = '';
|
||||
if(NULL!=checked($select_value, $option, false)) {
|
||||
$checked = checked($select_value, $option, false);
|
||||
$selected = 'of-radio-tile-selected';
|
||||
}
|
||||
$output .= '<span>';
|
||||
$output .= '<input type="radio" id="of-radio-tile-' . $value['id'] . $i . '" class="checkbox of-radio-tile-radio" value="'.$option.'" name="'.$value['id'].'" '.$checked.' />';
|
||||
$output .= '<div class="of-radio-tile-img '. $selected .'" style="background: url('.$option.')" onClick="document.getElementById(\'of-radio-tile-'. $value['id'] . $i.'\').checked = true;"></div>';
|
||||
$output .= '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
//backup and restore options data
|
||||
case 'backup':
|
||||
|
||||
$instructions = $value['desc'];
|
||||
$backup = of_get_options(BACKUPS);
|
||||
$init = of_get_options('smof_init');
|
||||
|
||||
|
||||
if(!isset($backup['backup_log'])) {
|
||||
$log = 'No backups yet';
|
||||
} else {
|
||||
$log = $backup['backup_log'];
|
||||
}
|
||||
|
||||
$output .= '<div class="backup-box">';
|
||||
$output .= '<div class="instructions">'.$instructions."\n";
|
||||
$output .= '<p><strong>'. __('Last Backup : ', 'flatsome-admin').'<span class="backup-log">'.$log.'</span></strong></p></div>'."\n";
|
||||
$output .= '<a href="#" id="of_backup_button" class="button" title="Backup Options">Backup Options</a>';
|
||||
$output .= '<a href="#" id="of_restore_button" class="button" title="Restore Options">Restore Options</a>';
|
||||
$output .= '</div>';
|
||||
|
||||
break;
|
||||
|
||||
//export or import data between different installs
|
||||
case 'transfer':
|
||||
|
||||
$instructions = $value['desc'];
|
||||
$output .= '<textarea id="export_data" rows="8">'.base64_encode(serialize($smof_data)) /* 100% safe - ignore theme check nag */ .'</textarea>'."\n";
|
||||
$output .= '<a href="#" id="of_import_button" class="button" title="Restore Options">Import Options</a>';
|
||||
|
||||
break;
|
||||
|
||||
// google font field
|
||||
case 'select_google_font':
|
||||
$output .= '<div class="select_wrapper">';
|
||||
$output .= '<select class="select of-input google_font_select" name="'.$value['id'].'" id="'. $value['id'] .'">';
|
||||
foreach ($value['options'] as $select_key => $option) {
|
||||
$output .= '<option value="'.$select_key.'" ' . selected((isset($smof_data[$value['id']]))? $smof_data[$value['id']] : "", $option, false) . ' />'.$option.'</option>';
|
||||
}
|
||||
$output .= '</select></div>';
|
||||
|
||||
if(isset($value['preview']['text'])){
|
||||
$g_text = $value['preview']['text'];
|
||||
} else {
|
||||
$g_text = '0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz';
|
||||
}
|
||||
if(isset($value['preview']['size'])) {
|
||||
$g_size = 'style="font-size: '. $value['preview']['size'] .';"';
|
||||
} else {
|
||||
$g_size = '';
|
||||
}
|
||||
$hide = " hide";
|
||||
if ($smof_data[$value['id']] != "none" && $smof_data[$value['id']] != "")
|
||||
$hide = "";
|
||||
|
||||
$output .= '<p class="'.$value['id'].'_ggf_previewer google_font_preview'.$hide.'" '. $g_size .'>'. $g_text .'</p>';
|
||||
break;
|
||||
|
||||
//JQuery UI Slider
|
||||
case 'sliderui':
|
||||
$s_val = $s_min = $s_max = $s_step = $s_edit = '';//no errors, please
|
||||
|
||||
$s_val = stripslashes($smof_data[$value['id']]);
|
||||
|
||||
if(!isset($value['min'])){ $s_min = '0'; }else{ $s_min = $value['min']; }
|
||||
if(!isset($value['max'])){ $s_max = $s_min + 1; }else{ $s_max = $value['max']; }
|
||||
if(!isset($value['step'])){ $s_step = '1'; }else{ $s_step = $value['step']; }
|
||||
|
||||
if(!isset($value['edit'])){
|
||||
$s_edit = ' readonly="readonly"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$s_edit = '';
|
||||
}
|
||||
|
||||
if ($s_val == '') $s_val = $s_min;
|
||||
|
||||
//values
|
||||
$s_data = 'data-id="'.$value['id'].'" data-val="'.$s_val.'" data-min="'.$s_min.'" data-max="'.$s_max.'" data-step="'.$s_step.'"';
|
||||
|
||||
//html output
|
||||
$output .= '<input type="text" name="'.$value['id'].'" id="'.$value['id'].'" value="'. $s_val .'" class="mini" '. $s_edit .' />';
|
||||
$output .= '<div id="'.$value['id'].'-slider" class="smof_sliderui" style="margin-left: 7px;" '. $s_data .'></div>';
|
||||
|
||||
break;
|
||||
|
||||
|
||||
//Switch option
|
||||
case 'switch':
|
||||
if (!isset($smof_data[$value['id']])) {
|
||||
$smof_data[$value['id']] = 0;
|
||||
}
|
||||
|
||||
$fold = '';
|
||||
if (array_key_exists("folds",$value)) $fold="s_fld ";
|
||||
|
||||
$cb_enabled = $cb_disabled = '';//no errors, please
|
||||
|
||||
//Get selected
|
||||
if ($smof_data[$value['id']] == 1){
|
||||
$cb_enabled = ' selected';
|
||||
$cb_disabled = '';
|
||||
}else{
|
||||
$cb_enabled = '';
|
||||
$cb_disabled = ' selected';
|
||||
}
|
||||
|
||||
//Label ON
|
||||
if(!isset($value['on'])){
|
||||
$on = "On";
|
||||
}else{
|
||||
$on = $value['on'];
|
||||
}
|
||||
|
||||
//Label OFF
|
||||
if(!isset($value['off'])){
|
||||
$off = "Off";
|
||||
}else{
|
||||
$off = $value['off'];
|
||||
}
|
||||
|
||||
$output .= '<p class="switch-options">';
|
||||
$output .= '<label class="'.$fold.'cb-enable'. $cb_enabled .'" data-id="'.$value['id'].'"><span>'. $on .'</span></label>';
|
||||
$output .= '<label class="'.$fold.'cb-disable'. $cb_disabled .'" data-id="'.$value['id'].'"><span>'. $off .'</span></label>';
|
||||
|
||||
$output .= '<input type="hidden" class="'.$fold.'checkbox of-input" name="'.$value['id'].'" id="'. $value['id'] .'" value="0"/>';
|
||||
$output .= '<input type="checkbox" id="'.$value['id'].'" class="'.$fold.'checkbox of-input main_checkbox" name="'.$value['id'].'" value="1" '. checked($smof_data[$value['id']], 1, false) .' />';
|
||||
|
||||
$output .= '</p>';
|
||||
|
||||
break;
|
||||
|
||||
// Uploader 3.5
|
||||
case "upload":
|
||||
case "media":
|
||||
|
||||
if(!isset($value['mod'])) $value['mod'] = '';
|
||||
|
||||
$u_val = '';
|
||||
if($smof_data[$value['id']]){
|
||||
$u_val = stripslashes($smof_data[$value['id']]);
|
||||
}
|
||||
|
||||
$output .= Options_Machine::optionsframework_media_uploader_function($value['id'],$u_val, $value['mod']);
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
do_action('optionsframework_machine_loop', array(
|
||||
'options' => $options,
|
||||
'smof_data' => $smof_data,
|
||||
'defaults' => $defaults,
|
||||
'counter' => $counter,
|
||||
'menu' => $menu,
|
||||
'output' => $output,
|
||||
'value' => $value
|
||||
));
|
||||
if ($smof_output != "") {
|
||||
$output .= $smof_output;
|
||||
$smof_output = "";
|
||||
}
|
||||
|
||||
//description of each option
|
||||
if ( $value['type'] != 'heading') {
|
||||
if(!isset($value['desc'])){ $explain_value = ''; } else{
|
||||
$explain_value = '<div class="explain">'. $value['desc'] .'</div>'."\n";
|
||||
}
|
||||
$output .= '</div>'.$explain_value."\n";
|
||||
$output .= '<div class="clear"> </div></div></div>'."\n";
|
||||
}
|
||||
|
||||
} /* condition empty end */
|
||||
|
||||
}
|
||||
|
||||
if ($update_data == true) {
|
||||
of_save_options($smof_data);
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
|
||||
do_action('optionsframework_machine_after', array(
|
||||
'options' => $options,
|
||||
'smof_data' => $smof_data,
|
||||
'defaults' => $defaults,
|
||||
'counter' => $counter,
|
||||
'menu' => $menu,
|
||||
'output' => $output,
|
||||
'value' => $value
|
||||
));
|
||||
if ($smof_output != "") {
|
||||
$output .= $smof_output;
|
||||
$smof_output = "";
|
||||
}
|
||||
|
||||
return array($output,$menu,$defaults);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Native media library uploader
|
||||
*
|
||||
* @uses get_theme_mod()
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function optionsframework_media_uploader_function($id,$std,$mod){
|
||||
|
||||
$data = of_get_options();
|
||||
$smof_data = of_get_options();
|
||||
|
||||
$uploader = '';
|
||||
$upload = "";
|
||||
if (isset($smof_data[$id]))
|
||||
$upload = $smof_data[$id];
|
||||
$hide = '';
|
||||
|
||||
if ($mod == "min") {$hide ='hide';}
|
||||
|
||||
if ( $upload != "") { $val = $upload; } else {$val = $std;}
|
||||
|
||||
$uploader .= '<input class="'.$hide.' upload of-input" name="'. $id .'" id="'. $id .'_upload" value="'. $val .'" />';
|
||||
|
||||
//Upload controls DIV
|
||||
$uploader .= '<div class="upload_button_div">';
|
||||
//If the user has WP3.5+ show upload/remove button
|
||||
if ( function_exists( 'wp_enqueue_media' ) ) {
|
||||
$uploader .= '<span class="button media_upload_button" id="'.$id.'">Upload</span>';
|
||||
|
||||
if(!empty($upload)) {$hide = '';} else { $hide = 'hide';}
|
||||
$uploader .= '<span class="button remove-image '. $hide.'" id="reset_'. $id .'" title="' . $id . '">Remove</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$output .= '<p class="upload-notice"><i>Upgrade your version of WordPress for full media support.</i></p>';
|
||||
}
|
||||
|
||||
$uploader .='</div>' . "\n";
|
||||
|
||||
// Load custom font
|
||||
if($mod == 'font'){
|
||||
$uploader .= '<style>@font-face{ font-family: customFont; src: url('. $val .'); } </style>';
|
||||
}
|
||||
|
||||
|
||||
//Preview
|
||||
if(!$mod){
|
||||
$uploader .= '<div class="screenshot">';
|
||||
if(!empty($upload)){
|
||||
$uploader .= '<a class="of-uploaded-image" href="'. $upload . '">';
|
||||
$uploader .= '<img class="of-option-image" id="image_'.$id.'" src="'.$upload.'" alt="" />';
|
||||
$uploader .= '</a>';
|
||||
}
|
||||
$uploader .= '</div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
$uploader .= '<div class="clear"></div>' . "\n";
|
||||
|
||||
return $uploader;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Drag and drop slides manager
|
||||
*
|
||||
* @uses get_theme_mod()
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function optionsframework_slider_function($id,$std,$oldorder,$order){
|
||||
|
||||
$data = of_get_options();
|
||||
$smof_data = of_get_options();
|
||||
|
||||
$slider = '';
|
||||
$slide = array();
|
||||
if (isset($smof_data[$id]))
|
||||
$slide = $smof_data[$id];
|
||||
|
||||
if (isset($slide[$oldorder])) { $val = $slide[$oldorder]; } else {$val = $std;}
|
||||
|
||||
//initialize all vars
|
||||
$slidevars = array('title','url','link','description');
|
||||
|
||||
foreach ($slidevars as $slidevar) {
|
||||
if (!isset($val[$slidevar])) {
|
||||
$val[$slidevar] = '';
|
||||
}
|
||||
}
|
||||
|
||||
//begin slider interface
|
||||
if (!empty($val['title'])) {
|
||||
$slider .= '<li><div class="slide_header"><strong>'.stripslashes($val['title']).'</strong>';
|
||||
} else {
|
||||
$slider .= '<li><div class="slide_header"><strong>Slide '.$order.'</strong>';
|
||||
}
|
||||
|
||||
$slider .= '<input type="hidden" class="slide of-input order" name="'. $id .'['.$order.'][order]" id="'. $id.'_'.$order .'_slide_order" value="'.$order.'" />';
|
||||
|
||||
$slider .= '<a class="slide_edit_button" href="#">Edit</a></div>';
|
||||
|
||||
$slider .= '<div class="slide_body">';
|
||||
|
||||
$slider .= '<label>Title</label>';
|
||||
$slider .= '<input class="slide of-input of-slider-title" name="'. $id .'['.$order.'][title]" id="'. $id .'_'.$order .'_slide_title" value="'. stripslashes($val['title']) .'" />';
|
||||
|
||||
$slider .= '<label>Image URL</label>';
|
||||
$slider .= '<input class="upload slide of-input" name="'. $id .'['.$order.'][url]" id="'. $id .'_'.$order .'_slide_url" value="'. $val['url'] .'" />';
|
||||
|
||||
$slider .= '<div class="upload_button_div"><span class="button media_upload_button" id="'.$id.'_'.$order .'">Upload</span>';
|
||||
|
||||
if(!empty($val['url'])) {$hide = '';} else { $hide = 'hide';}
|
||||
$slider .= '<span class="button remove-image '. $hide.'" id="reset_'. $id .'_'.$order .'" title="' . $id . '_'.$order .'">Remove</span>';
|
||||
$slider .='</div>' . "\n";
|
||||
$slider .= '<div class="screenshot">';
|
||||
if(!empty($val['url'])){
|
||||
|
||||
$slider .= '<a class="of-uploaded-image" href="'. $val['url'] . '">';
|
||||
$slider .= '<img class="of-option-image" id="image_'.$id.'_'.$order .'" src="'.$val['url'].'" alt="" />';
|
||||
$slider .= '</a>';
|
||||
|
||||
}
|
||||
$slider .= '</div>';
|
||||
$slider .= '<label>Link URL (optional)</label>';
|
||||
$slider .= '<input class="slide of-input" name="'. $id .'['.$order.'][link]" id="'. $id .'_'.$order .'_slide_link" value="'. $val['link'] .'" />';
|
||||
|
||||
$slider .= '<label>Description (optional)</label>';
|
||||
$slider .= '<textarea class="slide of-input" name="'. $id .'['.$order.'][description]" id="'. $id .'_'.$order .'_slide_description" cols="8" rows="8">'.stripslashes($val['description']).'</textarea>';
|
||||
|
||||
$slider .= '<a class="slide_delete_button" href="#">Delete</a>';
|
||||
$slider .= '<div class="clear"></div>' . "\n";
|
||||
|
||||
$slider .= '</div>';
|
||||
$slider .= '</li>';
|
||||
|
||||
return $slider;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}//end Options Machine class
|
||||
|
||||
?>
|
@@ -0,0 +1,65 @@
|
||||
<div class="wrap" id="of_container">
|
||||
|
||||
<div id="of-popup-save" class="of-save-popup">
|
||||
<div class="of-save-save">Options Updated</div>
|
||||
</div>
|
||||
|
||||
<div id="of-popup-fail" class="of-save-popup">
|
||||
<div class="of-save-fail">Error!</div>
|
||||
</div>
|
||||
|
||||
<span style="display: none;" id="hooks"><?php echo json_encode(of_get_header_classes_array()); ?></span>
|
||||
<input type="hidden" id="security" name="security" value="<?php echo wp_create_nonce('of_ajax_nonce'); ?>" />
|
||||
|
||||
<form id="of_form" method="post" action="<?php echo esc_attr( $_SERVER['REQUEST_URI'] ) ?>" enctype="multipart/form-data" >
|
||||
|
||||
<div id="main">
|
||||
|
||||
<div id="of-nav">
|
||||
|
||||
<div class="logo">
|
||||
<h3>Flatsome <br/>Advanced Options<span><?php echo ('Version: '. THEMEVERSION); ?></span></h3>
|
||||
</div>
|
||||
<div class="save_bar">
|
||||
<button id ="of_save" type="button" class="button-primary"><?php _e('Save All Changes', 'flatsome-admin');?></button>
|
||||
<img style="display:none" src="<?php echo ADMIN_DIR; ?>assets/images/loading-bottom.gif" class="ajax-loading-img ajax-loading-img-bottom" alt="Working..." />
|
||||
|
||||
</div><!--.save_bar-->
|
||||
<ul>
|
||||
<?php echo $options_machine->Menu ?>
|
||||
</ul>
|
||||
|
||||
<div style="padding:18px">
|
||||
<a href="<?php echo get_admin_url().'customize.php'; ?>" class="button-secondary">Theme Options →</a>
|
||||
</div>
|
||||
|
||||
<?php if(function_exists('pll_get_post')) {
|
||||
$url = get_admin_url().'options-general.php?page=mlang&tab=strings';
|
||||
?>
|
||||
<div style="padding:18px">
|
||||
<h3>Translate theme options</h3>
|
||||
<a href="<?php echo $url; ?>">Click here to translate Theme Options Strings</a><br><br>
|
||||
<small>NB: You need to translate Theme Options strings once more if you have changed them.</small>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
<?php echo $options_machine->Inputs /* Settings */ ?>
|
||||
<div class="save_bar" style="padding-left:0;">
|
||||
|
||||
<button id="of_save" type="button" class="button-primary"><?php _e('Save All Changes', 'flatsome-admin');?></button>
|
||||
<img style="display:none" src="<?php echo ADMIN_DIR; ?>assets/images/loading-bottom.gif" class="ajax-loading-img ajax-loading-img-bottom" alt="Working..." />
|
||||
|
||||
</div><!--.save_bar-->
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
</div><!--wrap-->
|
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
/**
|
||||
* SMOF Admin
|
||||
*
|
||||
* @package WordPress
|
||||
* @subpackage SMOF
|
||||
* @since 1.4.0
|
||||
* @author Syamil MJ
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Head Hook
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function of_head() { do_action( 'of_head' ); }
|
||||
|
||||
/**
|
||||
* Add default options upon activation else DB does not exist
|
||||
*
|
||||
* DEPRECATED, Class_options_machine now does this on load to ensure all values are set
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function of_option_setup()
|
||||
{
|
||||
global $of_options, $options_machine;
|
||||
$options_machine = new Options_Machine($of_options);
|
||||
|
||||
if (!of_get_options())
|
||||
{
|
||||
of_save_options($options_machine->Defaults);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get header classes
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function of_get_header_classes_array()
|
||||
{
|
||||
global $of_options;
|
||||
|
||||
foreach ($of_options as $value)
|
||||
{
|
||||
if ($value['type'] == 'heading')
|
||||
$hooks[] = str_replace(' ','',strtolower($value['name']));
|
||||
}
|
||||
|
||||
return $hooks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get options from the database and process them with the load filter hook.
|
||||
*
|
||||
* @author Jonah Dahlquist
|
||||
* @since 1.4.0
|
||||
* @return array
|
||||
*/
|
||||
function of_get_options($key = null, $data = null) {
|
||||
global $smof_data;
|
||||
|
||||
do_action('of_get_options_before', array(
|
||||
'key'=>$key, 'data'=>$data
|
||||
));
|
||||
if ($key != null) { // Get one specific value
|
||||
$data = get_theme_mod($key, $data);
|
||||
} else { // Get all values
|
||||
$data = get_theme_mods();
|
||||
}
|
||||
$data = apply_filters('of_options_after_load', $data);
|
||||
if ($key == null) {
|
||||
$smof_data = $data;
|
||||
} else {
|
||||
$smof_data[$key] = $data;
|
||||
}
|
||||
do_action('of_option_setup_before', array(
|
||||
'key'=>$key, 'data'=>$data
|
||||
));
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Save options to the database after processing them
|
||||
*
|
||||
* @param $data Options array to save
|
||||
* @author Jonah Dahlquist
|
||||
* @since 1.4.0
|
||||
* @uses update_option()
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function of_save_options($data, $key = null) {
|
||||
global $smof_data;
|
||||
if (empty($data))
|
||||
return;
|
||||
do_action('of_save_options_before', array(
|
||||
'key'=>$key, 'data'=>$data
|
||||
));
|
||||
$data = apply_filters('of_options_before_save', $data);
|
||||
if ($key != null) { // Update one specific value
|
||||
if ($key == BACKUPS) {
|
||||
unset($data['smof_init']); // Don't want to change this.
|
||||
}
|
||||
set_theme_mod($key, $data);
|
||||
} else { // Update all values in $data
|
||||
foreach ( $data as $k=>$v ) {
|
||||
if (!isset($smof_data[$k]) || $smof_data[$k] != $v) { // Only write to the DB when we need to
|
||||
set_theme_mod($k, $v);
|
||||
} else if (is_array($v)) {
|
||||
foreach ($v as $key=>$val) {
|
||||
if ($key != $k && $v[$key] == $val) {
|
||||
set_theme_mod($k, $v);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
do_action('of_save_options_after', array(
|
||||
'key'=>$key, 'data'=>$data
|
||||
));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* For use in themes
|
||||
*
|
||||
* @since forever
|
||||
*/
|
||||
|
||||
|
||||
|
||||
$data = of_get_options();
|
||||
if (!isset($smof_details))
|
||||
$smof_details = array();
|
@@ -0,0 +1,272 @@
|
||||
<?php
|
||||
|
||||
function flatsome_facebook_oauth_url() {
|
||||
$api_version = flatsome_facebook_api_version();
|
||||
$uri = get_template_directory_uri();
|
||||
$theme = wp_get_theme( get_template() );
|
||||
$version = $theme->get( 'Version' );
|
||||
$client_id = '380204239234502';
|
||||
$base_url = "https://www.facebook.com/$api_version/dialog/oauth";
|
||||
$redirect_uri = flatsome_api_url() . '/facebook/authorize/';
|
||||
$scope = 'pages_read_engagement,instagram_basic,public_profile';
|
||||
$state = urlencode( admin_url( "admin.php?page=optionsframework&tab=of-option-instagram&ver=$version" ) );
|
||||
$response_type = 'code';
|
||||
|
||||
return "$base_url?client_id=$client_id&response_type=$response_type&scope=$scope&redirect_uri=$redirect_uri&state=$state";
|
||||
}
|
||||
|
||||
function flatsome_facebook_login_button_html() {
|
||||
$url = flatsome_facebook_oauth_url();
|
||||
ob_start(); ?>
|
||||
|
||||
<hr />
|
||||
<p><?php _e('Login with Facebook to connect an Instagram Business account:') ?></p>
|
||||
<a class="button" style="padding: 5px 15px; height: auto; background-color: #4267b2; border-color: #4267b2; color: #ffffff;" href="<?php echo $url ?>">
|
||||
<span class="dashicons dashicons-facebook-alt" style="vertical-align: middle; margin-top: -2px;"></span>
|
||||
<?php _e( 'Login with Facebook', 'flatsome-admin' ) ?>
|
||||
</a>
|
||||
<p>
|
||||
<button class="button" name="flatsome_instagram_clear_cache">
|
||||
<?php _e( 'Clear Instagram cache', 'flatsome-admin' ) ?>
|
||||
</button>
|
||||
</p>
|
||||
<p>
|
||||
<a href="https://docs.uxthemes.com/article/379-how-to-connect-to-instagram-api" target="_blank" rel="noopener noreferrer">
|
||||
<?php _e( 'How to setup an Instagram Business account', 'flatsome-admin' ) ?>
|
||||
</a>
|
||||
</p>
|
||||
<?php return ob_get_clean();
|
||||
}
|
||||
|
||||
function flatsome_facebook_accounts_html() {
|
||||
$accounts = flatsome_facebook_accounts();
|
||||
|
||||
ob_start(); ?>
|
||||
|
||||
<input type="hidden" value="0" name="facebook_accounts[]">
|
||||
|
||||
<div class="flatsome-instagram-accounts theme-browser">
|
||||
<div class="themes wp-clearfix">
|
||||
<?php if ( empty( $accounts ) ) : ?>
|
||||
<div class="notice notice-info inline">
|
||||
<p><?php _e('No accounts connected yet...') ?></p>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php foreach ( $accounts as $username => $account ) : ?>
|
||||
<div class="theme instagram-account instagram-account--<?php echo esc_attr( $username ) ?>" style="width: 46%">
|
||||
<input type="hidden" value="<?php echo esc_attr( $account['id'] ) ?>" name="facebook_accounts[<?php echo esc_attr( $username ) ?>]">
|
||||
<div class="theme-screenshot">
|
||||
<?php if ( ! empty( $account['profile_picture'] ) ) : ?>
|
||||
<img src="<?php echo esc_attr( $account['profile_picture'] ) ?>" alt="<?php echo esc_attr( $username ) ?>">
|
||||
<?php else : ?>
|
||||
<img src="<?php echo get_template_directory_uri() ?>/inc/admin/advanced/assets/images/instagram-profile.png" alt="<?php echo esc_attr( $username ) ?>">
|
||||
<?php endif ?>
|
||||
</div>
|
||||
<!-- <div class="notice inline notice-alt"><p></p></div> -->
|
||||
<div class="theme-id-container">
|
||||
<h2 class="theme-name">
|
||||
<a target="_blank" href="https://www.instagram.com/<?php echo esc_attr( $username ) ?>/">
|
||||
<?php echo esc_html( $username ) ?>
|
||||
</a>
|
||||
</h2>
|
||||
<div class="theme-actions">
|
||||
<button type="button" class="button button-small" onclick="jQuery(this).closest('.instagram-account').remove()">
|
||||
Disconnect
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php return ob_get_clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get accounts that is associated with an access token.
|
||||
*
|
||||
* @param string $access_token An access token for a Facebook user.
|
||||
*
|
||||
* @return WP_Error|array
|
||||
*/
|
||||
function flatsome_facebook_get_accounts( $access_token ) {
|
||||
$api_version = flatsome_facebook_api_version();
|
||||
$fields = 'name,access_token,instagram_business_account{id,name,username,profile_picture_url}';
|
||||
$url = "https://graph.facebook.com/$api_version/me/accounts?limit=100&fields=$fields&access_token=$access_token";
|
||||
$response = wp_remote_get( $url );
|
||||
|
||||
if ( is_wp_error( $response ) ) {
|
||||
return new WP_Error( 'site_down', __( 'Unable to communicate with Instagram.', 'flatsome-admin' ) );
|
||||
} else {
|
||||
$body = json_decode( $response['body'], true );
|
||||
|
||||
if ( array_key_exists( 'error', $body ) ) {
|
||||
return new WP_Error( 'site_down', $body['error']['message'] );
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the popup that shows the accounts that can be connected.
|
||||
*/
|
||||
function flatsome_facebook_connect_admin_footer() {
|
||||
if ( ! is_array( $_GET ) || ! isset( $_GET['flatsome_facebook_access_token'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$access_token = sanitize_text_field( $_GET['flatsome_facebook_access_token'] );
|
||||
$all_accounts = flatsome_facebook_get_accounts( $access_token );
|
||||
$current_accounts = flatsome_facebook_accounts();
|
||||
$accounts = array();
|
||||
|
||||
if ( ! is_wp_error( $all_accounts ) ) {
|
||||
$accounts = array_filter( $all_accounts['data'], function( $account ) {
|
||||
return ! empty( $account['instagram_business_account'] );
|
||||
} );
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
?>
|
||||
|
||||
<div class="flatsome-instagram-connect">
|
||||
<div class="flatsome-instagram-connect-body">
|
||||
<h2 class=""><?php _e( 'Connect Instagram Business accounts', 'flatsome' ); ?></h2>
|
||||
<?php if ( is_wp_error( $accounts ) ) : ?>
|
||||
<div class="notice notice-error inline" style="margin: 0;">
|
||||
<p><?php echo $accounts->get_error_message() ?></p>
|
||||
</div>
|
||||
<div class="tablenav bottom textright">
|
||||
<button type="button" class="button" onclick="jQuery(this).closest('.flatsome-instagram-connect').hide()">
|
||||
<?php esc_html_e( 'Okay', 'flatsome' ); ?>
|
||||
</button>
|
||||
</div>
|
||||
<?php elseif ( empty( $accounts ) ) : ?>
|
||||
<div class="notice notice-info inline" style="margin: 0;">
|
||||
<p><?php esc_html_e( 'No associated Instagram Business account was found for your Facebook user.', 'flatsome' ) ?></p>
|
||||
</div>
|
||||
<div class="tablenav bottom textright">
|
||||
<button type="button" class="button" onclick="jQuery(this).closest('.flatsome-instagram-connect').hide()">
|
||||
<?php esc_html_e( 'Okay', 'flatsome' ); ?>
|
||||
</button>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<form action="<?php echo admin_url( 'admin-post.php' ); ?>" method="POST">
|
||||
<input type="hidden" name="action" value="flatsome_instagram_connect" />
|
||||
<?php wp_nonce_field( 'flatsome_instagram_connect', 'flatsome_instagram_connect_nonce' ); ?>
|
||||
<table class="widefat striped">
|
||||
<tbody>
|
||||
<?php foreach ( $accounts as $account ) : ?>
|
||||
<tr>
|
||||
<th class="check-column">
|
||||
<?php if ( ! array_key_exists( $account['instagram_business_account']['username'], $current_accounts ) ) : ?>
|
||||
<input type="checkbox" name="instagram_accounts[<?php echo esc_attr( $account['id'] ) ?>][id]" value="<?php echo esc_attr( $account['instagram_business_account']['id'] ) ?>">
|
||||
<?php else : ?>
|
||||
<input type="checkbox" disabled checked>
|
||||
<?php endif ?>
|
||||
<?php if ( ! empty( $account['instagram_business_account']['profile_picture_url'] ) ) : ?>
|
||||
<input type="hidden" name="instagram_accounts[<?php echo esc_attr( $account['id'] ) ?>][profile_picture]" value="<?php echo esc_attr( $account['instagram_business_account']['profile_picture_url']) ?>">
|
||||
<?php endif ?>
|
||||
<input type="hidden" name="instagram_accounts[<?php echo esc_attr( $account['id'] ) ?>][username]" value="<?php echo esc_attr( $account['instagram_business_account']['username'] ) ?>">
|
||||
<input type="hidden" name="instagram_accounts[<?php echo esc_attr( $account['id'] ) ?>][account_id]" value="<?php echo esc_attr( $account['id'] ) ?>">
|
||||
<input type="hidden" name="instagram_accounts[<?php echo esc_attr( $account['id'] ) ?>][account_access_token]" value="<?php echo esc_attr( $account['access_token'] ) ?>">
|
||||
<input type="hidden" name="instagram_accounts[<?php echo esc_attr( $account['id'] ) ?>][access_token]" value="<?php echo esc_attr( $access_token ) ?>">
|
||||
</th>
|
||||
<td width="38">
|
||||
<?php if ( ! empty( $account['instagram_business_account']['profile_picture_url'] ) ) : ?>
|
||||
<img src="<?php echo esc_attr( $account['instagram_business_account']['profile_picture_url'] ) ?>" width="38" style="border-radius: 100%" alt="<?php echo esc_attr( $account['instagram_business_account']['username'] ) ?>">
|
||||
<?php else : ?>
|
||||
<img src="<?php echo get_template_directory_uri() ?>/inc/admin/advanced/assets/images/instagram-profile.png" width="38" alt="<?php echo esc_attr( $account['instagram_business_account']['username'] ) ?>">
|
||||
<?php endif ?>
|
||||
</td>
|
||||
<td class="title">
|
||||
<strong class="row-title">
|
||||
<?php if ( ! empty( $account['instagram_business_account']['name'] ) ) : ?>
|
||||
<?php echo esc_html( $account['instagram_business_account']['name'] ) ?>
|
||||
<?php elseif ( ! empty( $account['name'] ) ) : ?>
|
||||
<?php echo esc_html( $account['name'] ) ?>
|
||||
<?php endif ?>
|
||||
</strong>
|
||||
<br>
|
||||
<a target="_blank" href="https://www.instagram.com/<?php echo esc_attr( $account['instagram_business_account']['username'] ) ?>/">
|
||||
<?php echo '@' . esc_html( $account['instagram_business_account']['username'] ) ?>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="tablenav bottom textright">
|
||||
<button type="button" class="button" onclick="jQuery(this).closest('.flatsome-instagram-connect').hide()">
|
||||
<?php esc_html_e( 'Cancel', 'flatsome' ); ?>
|
||||
</button>
|
||||
<button name="flatsome_instagram_connect" class="button button-primary">
|
||||
<?php esc_html_e( 'Connect', 'flatsome' ); ?>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
add_action( 'admin_footer-flatsome_page_optionsframework', 'flatsome_facebook_connect_admin_footer' );
|
||||
|
||||
/**
|
||||
* Saves the connected accounts data.
|
||||
*/
|
||||
function flatsome_facebook_connect_accounts() {
|
||||
check_admin_referer( 'flatsome_instagram_connect', 'flatsome_instagram_connect_nonce' );
|
||||
|
||||
if ( ! empty( $_POST['instagram_accounts'] ) ) {
|
||||
$accounts = flatsome_facebook_accounts();
|
||||
|
||||
foreach ( $_POST['instagram_accounts'] as $values ) {
|
||||
$account = array_map( 'sanitize_text_field', $values );
|
||||
if ( isset( $account['id'] ) ) {
|
||||
$accounts[ $account['username'] ] = $account;
|
||||
}
|
||||
}
|
||||
|
||||
set_theme_mod( 'facebook_accounts', $accounts );
|
||||
}
|
||||
|
||||
wp_safe_redirect( admin_url( 'admin.php?page=optionsframework&tab=of-option-instagram' ) );
|
||||
}
|
||||
add_action( 'admin_post_flatsome_instagram_connect', 'flatsome_facebook_connect_accounts' );
|
||||
|
||||
function flatsome_facebook_set_theme_mod( $values, $old_values ) {
|
||||
$result = array();
|
||||
|
||||
foreach ( $values as $username => $id ) {
|
||||
if ( is_array( $old_values ) && array_key_exists( $username, $old_values ) ) {
|
||||
$result[ $username ] = $old_values[ $username ];
|
||||
} else {
|
||||
$result[ $username ] = $id;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
add_filter( 'pre_set_theme_mod_facebook_accounts', 'flatsome_facebook_set_theme_mod', 10, 2 );
|
||||
|
||||
/**
|
||||
* Deletes the Instagram oEmbed cache and transients.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function flatsome_facebook_clear_cache() {
|
||||
global $wpdb;
|
||||
|
||||
if ( isset( $_POST['flatsome_instagram_clear_cache'] ) ) {
|
||||
delete_option( 'flatsome_instagram_oembed_cache' );
|
||||
$wpdb->query( "DELETE FROM {$wpdb->options} WHERE `option_name` LIKE ('%\_transient\_flatsome\_instagram%');" );
|
||||
$wpdb->query( "DELETE FROM {$wpdb->options} WHERE `option_name` LIKE ('%\_transient\_timeout\_flatsome\_instagram%');" );
|
||||
}
|
||||
}
|
||||
add_action( 'of_save_options_before', 'flatsome_facebook_clear_cache' );
|
@@ -0,0 +1,248 @@
|
||||
<?php
|
||||
/**
|
||||
* SMOF Interface
|
||||
*
|
||||
* @package WordPress
|
||||
* @subpackage SMOF
|
||||
* @since 1.4.0
|
||||
* @author Syamil MJ
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Admin Init
|
||||
*
|
||||
* @uses wp_verify_nonce()
|
||||
* @uses header()
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function optionsframework_admin_init()
|
||||
{
|
||||
// Rev up the Options Machine
|
||||
global $of_options, $options_machine, $smof_data, $smof_details;
|
||||
if (!isset($options_machine))
|
||||
$options_machine = new Options_Machine($of_options);
|
||||
|
||||
do_action('optionsframework_admin_init_before', array(
|
||||
'of_options' => $of_options,
|
||||
'options_machine' => $options_machine,
|
||||
'smof_data' => $smof_data
|
||||
));
|
||||
|
||||
if (empty($smof_data['smof_init'])) { // Let's set the values if the theme's already been active
|
||||
of_save_options($options_machine->Defaults);
|
||||
of_save_options(date('r'), 'smof_init');
|
||||
$smof_data = of_get_options();
|
||||
$options_machine = new Options_Machine($of_options);
|
||||
}
|
||||
|
||||
do_action('optionsframework_admin_init_after', array(
|
||||
'of_options' => $of_options,
|
||||
'options_machine' => $options_machine,
|
||||
'smof_data' => $smof_data
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Options page
|
||||
*
|
||||
* @uses add_theme_page()
|
||||
* @uses add_action()
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function optionsframework_add_admin() {
|
||||
|
||||
$of_page = add_submenu_page('flatsome-panel', '', 'Advanced', 'edit_theme_options', 'optionsframework', 'optionsframework_options_page');
|
||||
|
||||
// Add framework functionaily to the head individually
|
||||
add_action("admin_print_scripts-$of_page", 'of_load_only');
|
||||
add_action("admin_print_styles-$of_page",'of_style_only');
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Build Options page
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function optionsframework_options_page(){
|
||||
|
||||
global $options_machine;
|
||||
|
||||
/*
|
||||
//for debugging
|
||||
|
||||
$smof_data = of_get_options();
|
||||
print_r($smof_data);
|
||||
|
||||
*/
|
||||
|
||||
include_once( ADMIN_PATH . 'front-end/options.php' );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Options page
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function of_style_only() {
|
||||
$theme = wp_get_theme( get_template() );
|
||||
$version = $theme->get( 'Version' );
|
||||
|
||||
wp_enqueue_style( 'admin-style', ADMIN_DIR . 'assets/css/admin-style.css', array(), $version );
|
||||
wp_enqueue_style( 'jquery-ui-custom-admin', ADMIN_DIR . 'assets/css/jquery-ui-custom.css', array(), $version );
|
||||
|
||||
if ( ! wp_style_is( 'wp-color-picker', 'registered' ) ) {
|
||||
wp_register_style( 'wp-color-picker', ADMIN_DIR . 'assets/css/color-picker.min.css', array(), $version );
|
||||
}
|
||||
|
||||
wp_enqueue_style( 'wp-color-picker' );
|
||||
do_action( 'of_style_only_after' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Options page
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function of_load_only() {
|
||||
$theme = wp_get_theme( get_template() );
|
||||
$version = $theme->get( 'Version' );
|
||||
|
||||
wp_enqueue_script( 'jquery-ui-core' );
|
||||
wp_enqueue_script( 'jquery-ui-sortable' );
|
||||
wp_enqueue_script( 'jquery-ui-slider' );
|
||||
wp_enqueue_script( 'jquery-input-mask', ADMIN_DIR . 'assets/js/jquery.maskedinput-1.4.1.js', array( 'jquery' ), $version, true );
|
||||
wp_enqueue_script( 'tipsy', ADMIN_DIR . 'assets/js/jquery.tipsy.js', array( 'jquery' ), $version, true );
|
||||
wp_enqueue_script( 'cookie', ADMIN_DIR . 'assets/js/cookie.js', 'jquery', $version, true );
|
||||
wp_enqueue_script( 'smof', ADMIN_DIR . 'assets/js/smof.js', array( 'jquery' ), $version, true );
|
||||
|
||||
// Enqueue colorpicker scripts for versions below 3.5 for compatibility.
|
||||
if ( ! wp_script_is( 'wp-color-picker', 'registered' ) ) {
|
||||
wp_register_script( 'iris', ADMIN_DIR . 'assets/js/iris.min.js', array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), $version, true );
|
||||
wp_register_script( 'wp-color-picker', ADMIN_DIR . 'assets/js/color-picker.min.js', array( 'jquery', 'iris' ), $version, true );
|
||||
}
|
||||
|
||||
wp_enqueue_script( 'wp-color-picker' );
|
||||
|
||||
/**
|
||||
* Enqueue scripts for file uploader
|
||||
*/
|
||||
if ( function_exists( 'wp_enqueue_media' ) ) {
|
||||
wp_enqueue_media();
|
||||
}
|
||||
|
||||
do_action( 'of_load_only_after' );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ajax Save Options
|
||||
*
|
||||
* @uses get_option()
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function of_ajax_callback()
|
||||
{
|
||||
global $options_machine, $of_options;
|
||||
|
||||
$nonce=$_POST['security'];
|
||||
|
||||
|
||||
if (! wp_verify_nonce($nonce, 'of_ajax_nonce') ) die('-1');
|
||||
|
||||
//get options array from db
|
||||
$all = of_get_options();
|
||||
|
||||
$save_type = $_POST['type'];
|
||||
|
||||
|
||||
//Uploads
|
||||
if($save_type == 'upload')
|
||||
{
|
||||
|
||||
$clickedID = $_POST['data']; // Acts as the name
|
||||
$filename = $_FILES[$clickedID];
|
||||
$filename['name'] = preg_replace('/[^a-zA-Z0-9._\-]/', '', $filename['name']);
|
||||
|
||||
$override['test_form'] = false;
|
||||
$override['action'] = 'wp_handle_upload';
|
||||
$uploaded_file = wp_handle_upload($filename,$override);
|
||||
|
||||
$upload_tracking[] = $clickedID;
|
||||
|
||||
//update $options array w/ image URL
|
||||
$upload_image = $all; //preserve current data
|
||||
|
||||
$upload_image[$clickedID] = $uploaded_file['url'];
|
||||
|
||||
of_save_options($upload_image);
|
||||
|
||||
|
||||
if(!empty($uploaded_file['error'])) {echo 'Upload Error: ' . $uploaded_file['error']; }
|
||||
else { echo $uploaded_file['url']; } // Is the Response
|
||||
|
||||
}
|
||||
elseif($save_type == 'image_reset')
|
||||
{
|
||||
|
||||
$id = $_POST['data']; // Acts as the name
|
||||
|
||||
$delete_image = $all; //preserve rest of data
|
||||
$delete_image[$id] = ''; //update array key with empty value
|
||||
of_save_options($delete_image ) ;
|
||||
|
||||
}
|
||||
elseif($save_type == 'backup_options')
|
||||
{
|
||||
|
||||
$backup = $all;
|
||||
$backup['backup_log'] = date('r');
|
||||
|
||||
of_save_options($backup, BACKUPS) ;
|
||||
|
||||
die('1');
|
||||
}
|
||||
elseif($save_type == 'restore_options')
|
||||
{
|
||||
|
||||
$smof_data = of_get_options(BACKUPS);
|
||||
|
||||
of_save_options($smof_data);
|
||||
|
||||
die('1');
|
||||
}
|
||||
elseif($save_type == 'import_options'){
|
||||
|
||||
|
||||
$smof_data = unserialize(base64_decode($_POST['data'])); //100% safe - ignore theme check nag
|
||||
of_save_options($smof_data);
|
||||
|
||||
|
||||
die('1');
|
||||
}
|
||||
elseif ($save_type == 'save')
|
||||
{
|
||||
wp_parse_str(stripslashes($_POST['data']), $smof_data);
|
||||
unset($smof_data['security']);
|
||||
unset($smof_data['of_save']);
|
||||
of_save_options($smof_data);
|
||||
flush_rewrite_rules();
|
||||
|
||||
die('1');
|
||||
}
|
||||
elseif ($save_type == 'reset')
|
||||
{
|
||||
of_save_options($options_machine->Defaults);
|
||||
|
||||
die('1'); //options reset
|
||||
}
|
||||
|
||||
die();
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Functions Load
|
||||
*
|
||||
* @package WordPress
|
||||
* @subpackage SMOF
|
||||
* @since 1.4.0
|
||||
* @author Syamil MJ
|
||||
*/
|
||||
require_once( ADMIN_PATH . 'functions/functions.php' );
|
||||
require_once( ADMIN_PATH . 'functions/functions.facebook.php' );
|
||||
require_once( ADMIN_PATH . 'functions/functions.interface.php' );
|
||||
require_once( ADMIN_PATH . 'functions/functions.options.php' );
|
||||
require_once( ADMIN_PATH . 'functions/functions.admin.php' );
|
@@ -0,0 +1,692 @@
|
||||
<?php
|
||||
/**
|
||||
* Advanced Theme Options
|
||||
*
|
||||
* @package Flatsome/Admin/Options/Advanced
|
||||
*/
|
||||
|
||||
add_action( 'init', 'of_options' );
|
||||
|
||||
if ( ! function_exists( 'of_options' ) ) {
|
||||
/**
|
||||
* Advance Theme Options.
|
||||
*
|
||||
* @global array $of_options Description.
|
||||
*
|
||||
* @return void.
|
||||
*/
|
||||
function of_options() {
|
||||
// Access the WordPress Categories via an Array.
|
||||
$of_categories = array();
|
||||
$of_categories_obj = get_categories( 'hide_empty=0' );
|
||||
foreach ( $of_categories_obj as $of_cat ) {
|
||||
$of_categories[ $of_cat->cat_ID ] = $of_cat->cat_name;
|
||||
}
|
||||
|
||||
// Access the WordPress Pages via an Array.
|
||||
$of_pages = array();
|
||||
$of_pages_obj = get_pages( 'sort_column=post_parent,menu_order' );
|
||||
$of_pages['0'] = 'Select a page:';
|
||||
foreach ( $of_pages_obj as $of_page ) {
|
||||
$of_pages[ $of_page->ID ] = $of_page->post_title;
|
||||
}
|
||||
|
||||
// Set the Options Array.
|
||||
global $of_options;
|
||||
$of_options = array();
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Global Settings',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Header Scripts',
|
||||
'desc' => 'Add custom scripts inside HEAD tag. You need to have a SCRIPT tag around scripts.',
|
||||
'id' => 'html_scripts_header',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Footer Scripts',
|
||||
'desc' => 'Add custom scripts you might want to be loaded in the footer of your website. You need to have a SCRIPT tag around scripts.',
|
||||
'id' => 'html_scripts_footer',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Body Scripts - Top',
|
||||
'desc' => 'Add custom scripts just after the BODY tag opened. You need to have a SCRIPT tag around scripts.',
|
||||
'id' => 'html_scripts_after_body',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Body Scripts - Bottom',
|
||||
'desc' => 'Add custom scripts just before the BODY tag closed. You need to have a SCRIPT tag around scripts.',
|
||||
'id' => 'html_scripts_before_body',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Flatsome 2.0 Content Support',
|
||||
'id' => 'flatsome_fallback',
|
||||
'desc' => 'Support content made in Flatsome 2.0. Disable to speed up site.',
|
||||
'std' => 1,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Custom CSS',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'All screens',
|
||||
'desc' => 'Add custom CSS here',
|
||||
'id' => 'html_custom_css',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Tablets and down',
|
||||
'desc' => 'Add custom CSS here for tablets and mobile',
|
||||
'id' => 'html_custom_css_tablet',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Mobile only',
|
||||
'desc' => 'Add custom CSS here for mobile view',
|
||||
'id' => 'html_custom_css_mobile',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
);
|
||||
|
||||
// Performance.
|
||||
$of_options[] = array(
|
||||
'name' => 'Performance',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => '',
|
||||
'type' => 'info',
|
||||
'desc' => '<p style="font-size:14px">Use with caution! Disable if you have plugin compatibility problems.</p>',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Preload pages',
|
||||
'id' => 'perf_instant_page',
|
||||
'desc' => 'Preload pages right before a user clicks on it for blazing fast browsing between pages.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Lazy Load Banner and Section backgrounds',
|
||||
'id' => 'lazy_load_backgrounds',
|
||||
'desc' => 'Enable lazy loading of banner and section backgrounds.',
|
||||
'std' => 1,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Lazy Load Images',
|
||||
'id' => 'lazy_load_images',
|
||||
'desc' => 'Enable lazy loading for images. It will generate an inline blank Base64 image with the same aspect ratio as the original image.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Disable theme style.css',
|
||||
'type' => 'checkbox',
|
||||
'id' => 'flatsome_disable_style_css',
|
||||
'std' => 0,
|
||||
'desc' => 'Disable loading of theme style.css. This file is only needed if you have added custom CSS to that file.',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Disable Emoji script',
|
||||
'type' => 'checkbox',
|
||||
'id' => 'disable_emoji',
|
||||
'std' => 0,
|
||||
'desc' => 'Remove WP emoji scripts from front-end.',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Disable Block library css',
|
||||
'type' => 'checkbox',
|
||||
'id' => 'disable_blockcss',
|
||||
'std' => 0,
|
||||
'desc' => 'Remove default block library css coming from WordPress',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Disable jQuery Migrate',
|
||||
'type' => 'checkbox',
|
||||
'id' => 'jquery_migrate',
|
||||
'std' => 0,
|
||||
'desc' => 'Remove jQuery Migrate. Most up-to-date front-end code and plugins don’t require jquery-migrate.min.js. More often than not, keeping this - simply adds unnecessary load to your site.',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Site Loader',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Site Loader',
|
||||
'id' => 'site_loader',
|
||||
'desc' => 'Enable Site Loader overlay when loading the site.',
|
||||
'type' => 'select',
|
||||
'std' => '',
|
||||
'options' => array(
|
||||
'' => 'Disabled',
|
||||
'home' => 'Enable on homepage',
|
||||
'all' => 'Enable on all pages',
|
||||
),
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Color',
|
||||
'id' => 'site_loader_color',
|
||||
'type' => 'select',
|
||||
'std' => 'light',
|
||||
'options' => array(
|
||||
'light' => 'Light',
|
||||
'dark' => 'Dark',
|
||||
),
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Background Color',
|
||||
'id' => 'site_loader_bg',
|
||||
'std' => '',
|
||||
'type' => 'color',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Site Search',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Live Search',
|
||||
'id' => 'live_search',
|
||||
'desc' => 'Enable live search for products, pages and posts.',
|
||||
'std' => 1,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Search placeholder',
|
||||
'desc' => 'Change the search field placeholder.',
|
||||
'id' => 'search_placeholder',
|
||||
'type' => 'text',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Search results latency',
|
||||
'desc' => 'Set the delay for live search results.',
|
||||
'id' => 'search_result_latency',
|
||||
'std' => '0',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'0' => 'Instant',
|
||||
'500' => '500 ms',
|
||||
'1000' => '1000 ms',
|
||||
'1500' => '1500 ms',
|
||||
'2000' => '2000 ms',
|
||||
),
|
||||
);
|
||||
|
||||
if ( is_woocommerce_activated() ) {
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Show Blog and pages in search results',
|
||||
'id' => 'search_result',
|
||||
'desc' => 'Enable blog and pages in search results.',
|
||||
'std' => 1,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Posts and pages list style',
|
||||
'id' => 'search_result_style',
|
||||
'desc' => 'Display results as row, masonry or slider style.',
|
||||
'type' => 'select',
|
||||
'std' => 'slider',
|
||||
'options' => array(
|
||||
'row' => 'Row',
|
||||
'masonry' => 'Masonry',
|
||||
'slider' => 'Slider',
|
||||
),
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Search Products Order By',
|
||||
'id' => 'search_products_order_by',
|
||||
'type' => 'select',
|
||||
'std' => 'relevance',
|
||||
'options' => array(
|
||||
'relevance' => 'Relevance',
|
||||
'title' => 'Title',
|
||||
'price' => 'Price',
|
||||
),
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Search Product SKU',
|
||||
'desc' => 'Allow searching by SKU in live search.',
|
||||
'id' => 'search_by_sku',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Search Product Tag',
|
||||
'desc' => 'Allow searching by product tags in live search.',
|
||||
'id' => 'search_by_product_tag',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
}
|
||||
|
||||
$of_options[] = array(
|
||||
"name" => "Instagram",
|
||||
"type" => "heading",
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
"name" => "Accounts",
|
||||
"std" => flatsome_facebook_accounts_html(),
|
||||
"desc" => flatsome_facebook_login_button_html(),
|
||||
"type" => "info"
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Google APIs',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Google Maps API',
|
||||
'desc' => "Enter Google Maps API key here to enable Maps. You can generate one here: <a target='_blank' href='https://developers.google.com/maps/documentation/javascript/get-api-key'>Google Maps API</a>",
|
||||
'id' => 'google_map_api',
|
||||
'std' => '',
|
||||
'type' => 'text',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Maintenance Mode',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Maintenance Mode',
|
||||
'id' => 'maintenance_mode',
|
||||
'desc' => 'Enable Maintenance Mode for all users except admins.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Admin Notice',
|
||||
'id' => 'maintenance_mode_admin_notice',
|
||||
'desc' => 'Show admin notice when Maintenance Mode is enabled.',
|
||||
'std' => 1,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Custom Maintenance Page',
|
||||
'id' => 'maintenance_mode_page',
|
||||
'desc' => 'Set a custom page as maintenance page. Only this page will be visible for visitors.',
|
||||
'std' => 0,
|
||||
'type' => 'select',
|
||||
'options' => $of_pages,
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Maintenance Mode Text',
|
||||
'desc' => 'The text that will be visible to your customers when accessing maintenance screen.',
|
||||
'id' => 'maintenance_mode_text',
|
||||
'std' => 'Please check back soon..',
|
||||
'type' => 'text',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => '404 Page',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Custom 404 Block',
|
||||
'id' => '404_block',
|
||||
'desc' => 'Replace 404 page content with a Custom Block that you can edit in the Page Builder.',
|
||||
'std' => 0,
|
||||
'type' => 'select',
|
||||
'options' => flatsome_get_block_list_by_id( array( 'option_none' => '-- None --' ) ),
|
||||
);
|
||||
|
||||
if ( is_woocommerce_activated() ) {
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'WooCommerce',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Variation swatches',
|
||||
'id' => 'swatches',
|
||||
'desc' => 'Enable variation swatches.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Disable Reviews Global',
|
||||
'id' => 'disable_reviews',
|
||||
'desc' => 'Disable reviews globally.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Enable default WooCommerce product gallery',
|
||||
'id' => 'product_gallery_woocommerce',
|
||||
'desc' => 'Use the default WooCommerce gallery slider for plugin compatibility, such as "Additional Variation Images".',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Shop header',
|
||||
'desc' => 'Enter HTML that should be placed on top of main shop page. Shortcodes are allowed. ',
|
||||
'id' => 'html_shop_page',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Additional Global tab/section title',
|
||||
'id' => 'tab_title',
|
||||
'std' => '',
|
||||
'type' => 'text',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Additional Global tab/section content',
|
||||
'id' => 'tab_content',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
'desc' => 'Add additional tab content here... Like Size Charts etc.',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'HTML before Add To Cart button (Global)',
|
||||
'desc' => 'Enter HTML and shortcodes that will show before Add to cart selections.',
|
||||
'id' => 'html_before_add_to_cart',
|
||||
'std' => ' ',
|
||||
'type' => 'textarea',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'HTML after Add To Cart button (Global)',
|
||||
'desc' => 'Enter HTML and shortcodes that will show after Add to cart button.',
|
||||
'id' => 'html_after_add_to_cart',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Thank You Page Content / Scripts',
|
||||
'desc' => 'Enter scripts or custom HTML content for the thank you page here',
|
||||
'id' => 'html_thank_you',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Catalog Mode',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Enable catalog mode',
|
||||
'id' => 'catalog_mode',
|
||||
'desc' => 'Enable catalog mode. This will disable Add To Cart buttons / Checkout and Shopping cart.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Disable prices',
|
||||
'id' => 'catalog_mode_prices',
|
||||
'desc' => 'Select to disable prices on category pages and product page.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Remove sale badge',
|
||||
'id' => 'catalog_mode_sale_badge',
|
||||
'desc' => 'Select to remove sale badges.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Cart / Account replacement (header)',
|
||||
'id' => 'catalog_mode_header',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
'desc' => "Enter content you want to display instead of Account / Cart. Shortcodes are allowed. For search box enter <b>[search]</b>. For social icons enter: <b>[follow twitter='http://' facebook='http://' email='post@email.com' pinterest='http://']</b>",
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Add to cart replacement - Product page',
|
||||
'id' => 'catalog_mode_product',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
'desc' => 'Enter contact information or enquiry form shortcode here.',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Add to cart replacement - Product Quick View',
|
||||
'id' => 'catalog_mode_lightbox',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
'desc' => 'Enter text that will show in product quick view',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Infinite Scroll',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Infinite scroll category/products',
|
||||
'id' => 'flatsome_infinite_scroll',
|
||||
'desc' => 'Enable infinite scroll for WooCommerce category/product archive.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Loading type',
|
||||
'id' => 'infinite_scroll_loader_type',
|
||||
'desc' => 'Select loading type animation or on button click.',
|
||||
'std' => 'spinner',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'button' => 'Button (On click)',
|
||||
'spinner' => 'Spinner',
|
||||
'image' => 'Custom Image',
|
||||
),
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Custom loader image',
|
||||
'desc' => "Upload or choose a custom loader image (for loading type 'Custom Image').",
|
||||
'id' => 'infinite_scroll_loader_img',
|
||||
'std' => '',
|
||||
'type' => 'upload',
|
||||
);
|
||||
}
|
||||
|
||||
// Portfolio.
|
||||
$of_options[] = array(
|
||||
'name' => 'Portfolio',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Enable Portfolio',
|
||||
'id' => 'fl_portfolio',
|
||||
'desc' => 'Enable portfolio',
|
||||
'std' => 1,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
// Mobile.
|
||||
$of_options[] = array(
|
||||
'name' => 'Mobile',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Parallax Mobile Support',
|
||||
'id' => 'parallax_mobile',
|
||||
'desc' => 'Enable parallax for mobile devices',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
// Integrations.
|
||||
$of_options[] = array(
|
||||
'name' => 'Integrations',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => '',
|
||||
'type' => 'info',
|
||||
'desc' => '<p style="font-size:14px">Additional options for integrated plugins will be shown here if they are activated.</p>',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Flatsome Studio',
|
||||
'id' => 'flatsome_studio',
|
||||
'desc' => 'Enable access to Flatsome Studio in UX Builder',
|
||||
'std' => 1,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
|
||||
if ( function_exists( 'ubermenu' ) ) {
|
||||
$of_options[] = array(
|
||||
'name' => 'Ubermenu',
|
||||
'id' => 'flatsome_uber_menu',
|
||||
'desc' => 'Enable full width UberMenu. You can also insert this elsewhere by using the UberMenu options.',
|
||||
'std' => 1,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
}
|
||||
|
||||
// Yoast options.
|
||||
if ( class_exists( 'WPSEO_Options' ) ) {
|
||||
$of_options[] = array(
|
||||
'name' => 'Yoast Primary Category',
|
||||
'id' => 'wpseo_primary_term',
|
||||
'desc' => 'Use on product category pages and elements.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => '',
|
||||
'id' => 'wpseo_manages_product_layout_priority',
|
||||
'desc' => 'Manage custom product layout priority.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Yoast Breadcrumbs',
|
||||
'id' => 'wpseo_breadcrumb',
|
||||
'desc' => 'Use on product category pages, single product pages and elements.',
|
||||
'std' => 0,
|
||||
'folds' => 1,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => '',
|
||||
'id' => 'wpseo_breadcrumb_remove_last',
|
||||
'desc' => 'Remove the last static crumb on single product pages (product title).',
|
||||
'std' => 1,
|
||||
'fold' => 'wpseo_breadcrumb',
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
}
|
||||
|
||||
// Rank Math options.
|
||||
if ( class_exists( 'RankMath' ) ) {
|
||||
$of_options[] = array(
|
||||
'name' => 'Rank Math Primary Category',
|
||||
'id' => 'rank_math_primary_term',
|
||||
'desc' => 'Use on product category pages and elements.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => '',
|
||||
'id' => 'rank_math_manages_product_layout_priority',
|
||||
'desc' => 'Manage custom product layout priority.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Rank Math Breadcrumbs',
|
||||
'id' => 'rank_math_breadcrumb',
|
||||
'desc' => 'Use on product category pages, single product pages and elements.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
}
|
||||
|
||||
// Backup Options.
|
||||
$of_options[] = array(
|
||||
'name' => 'Backup and Import',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Backup and Restore Options',
|
||||
'id' => 'of_backup',
|
||||
'std' => '',
|
||||
'type' => 'backup',
|
||||
'desc' => 'You can use the two buttons below to backup your current options, and then restore it back at a later time. This is useful if you want to experiment on the options but would like to keep the old settings in case you need it back.',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Transfer Theme Options Data',
|
||||
'id' => 'of_transfer',
|
||||
'std' => '',
|
||||
'type' => 'transfer',
|
||||
'desc' => 'You can transfer the saved options data between different installs by copying the text inside the text box. To import data from another install, replace the data in the text box with the one from another install and click "Import Options".',
|
||||
);
|
||||
|
||||
} // End of 'of_options()' function.
|
||||
} // End check if function exists: of_options()
|
71
wp-content/themes/flatsome/inc/admin/advanced/index.php
Normal file
71
wp-content/themes/flatsome/inc/admin/advanced/index.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php define( 'SMOF_VERSION', '1.5.2' );
|
||||
|
||||
/**
|
||||
* Definitions
|
||||
*
|
||||
* @since 1.4.0
|
||||
*/
|
||||
$theme_version = '';
|
||||
$smof_output = '';
|
||||
|
||||
if( function_exists( 'wp_get_theme' ) ) {
|
||||
if( is_child_theme() ) {
|
||||
$temp_obj = wp_get_theme();
|
||||
$theme_obj = wp_get_theme( $temp_obj->get('Template') );
|
||||
} else {
|
||||
$theme_obj = wp_get_theme();
|
||||
}
|
||||
|
||||
$theme_version = $theme_obj->get('Version');
|
||||
$theme_name = $theme_obj->get('Name');
|
||||
$theme_uri = $theme_obj->get('ThemeURI');
|
||||
$author_uri = $theme_obj->get('AuthorURI');
|
||||
} else {
|
||||
$theme_data = wp_get_theme( get_template_directory().'/style.css' );
|
||||
$theme_version = $theme_data['Version'];
|
||||
$theme_name = $theme_data['Name'];
|
||||
$theme_uri = $theme_data['ThemeURI'];
|
||||
$author_uri = $theme_data['AuthorURI'];
|
||||
}
|
||||
|
||||
|
||||
if( !defined('ADMIN_PATH') )
|
||||
define( 'ADMIN_PATH', get_template_directory() . '/inc/admin/advanced/' );
|
||||
if( !defined('ADMIN_DIR') )
|
||||
define( 'ADMIN_DIR', get_template_directory_uri() . '/inc/admin/advanced/' );
|
||||
|
||||
define( 'ADMIN_IMAGES', ADMIN_DIR . 'assets/images/' );
|
||||
|
||||
define( 'LAYOUT_PATH', ADMIN_PATH . 'layouts/' );
|
||||
define( 'THEMENAME', $theme_name );
|
||||
/* Theme version, uri, and the author uri are not completely necessary, but may be helpful in adding functionality */
|
||||
define( 'THEMEVERSION', $theme_version );
|
||||
define( 'THEMEURI', $theme_uri );
|
||||
define( 'THEMEAUTHORURI', $author_uri );
|
||||
define( 'BACKUPS','backups' );
|
||||
|
||||
|
||||
/**
|
||||
* Required action filters
|
||||
*
|
||||
* @uses add_action()
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
add_action('admin_init','optionsframework_admin_init');
|
||||
add_action('admin_menu', 'optionsframework_add_admin');
|
||||
|
||||
/**
|
||||
* Required Files
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
require_once ( ADMIN_PATH . 'functions/functions.load.php' );
|
||||
require_once ( ADMIN_PATH . 'classes/class.options_machine.php' );
|
||||
|
||||
/**
|
||||
* AJAX Saving Options
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
add_action('wp_ajax_of_ajax_post_action', 'of_ajax_callback');
|
Reference in New Issue
Block a user