first commit

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

View File

@ -0,0 +1,865 @@
/*-----------------------------------------------------------------------------------
/* Admin styles
/*-----------------------------------------------------------------------------------*/
.updated, .error {
display:none!important
} /* disable the admin notices */
#of_container {
margin: 15px;
width: 785px;
position:relative;
z-index: 0
}
#of_container #header {
height: 70px;
background:#f1f1f1;
border: 1px solid #ccc;
-webkit-border-radius: 6px 6px 0 0;
-moz-border-radius: 6px 6px 0 0;
border-radius: 6px 6px 0 0;
background-image: -ms-linear-gradient(top,#f9f9f9,#ececec);
background-image: -moz-linear-gradient(top,#f9f9f9,#ececec);
background-image: -o-linear-gradient(top,#f9f9f9,#ececec);
background-image: -webkit-gradient(linear,left top,left bottom,from(#f9f9f9),to(#ececec));
background-image: -webkit-linear-gradient(top,#f9f9f9,#ececec);
background-image: linear-gradient(top,#f9f9f9,#ececec);
-moz-box-shadow: inset 0 1px 0 #fff;
-webkit-box-shadow: inset 0 1px 0 #fff;
box-shadow: inset 0 1px 0 #fff;
}
#of_container #header .logo {
float: left;
margin:10px 20px;
}
#of_container #js-warning {
color: red;
float: left;
margin: 20px 10px;
width: 330px;
}
#of_container ul,#of_container ol {margin: 0;}
.js #of_container #js-warning {
display: none;
}
#of_container #header .logo h2 {
display:inline-block;
font-style:normal;
padding-right:5px;
}
#of_container #header .logo span {
color:#888888;
}
#of_container #header .icon-option {
float: right;
height: 32px;
width: 32px;
background: url(../images/icon_option.png) no-repeat;
margin:20px 30px 0;
}
#of_container #info_bar {
background: #f3f3f3;
border:solid #d8d8d8;
border-bottom:1px solid #D8D8D8;
border-width:0px 1px 1px 1px;
padding: 6px 20px 0px 6px;
height: 31px;
text-align: right;
-moz-box-shadow: inset 0 1px 0 #fcfcfc;
-webkit-box-shadow: inset 0 1px 0 #fcfcfc;
box-shadow: inset 0 1px 0 #fcfcfc;
}
#of_container #expand_options{
cursor: pointer;
display: block;
height: 22px;
width: 21px;
float: left;
font-size:0px;
text-indent: -9999px;
margin: 0 0 0 10px;
border: 1px solid #bbb;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
}
#of_container #info_bar .expand { background: url(../images/toggle_tabs.png) no-repeat -2px -1px; }
#of_container #info_bar .close { background: url(../images/toggle_tabs.png) no-repeat -2px -26px; }
#of_container #expand_options:hover {
cursor: pointer;
border-color: #888;
}
#of_container #main {
background-color: #f1f1f1;
border-left: 1px solid #d8d8d8;
border-right: 1px solid #d8d8d8;
border-bottom: 1px solid #d8d8d8;
}
#of_container #of-nav {
float: left;
position: relative;
z-index: 9999;
width: 160px;
}
#of_container #of-nav ul {
margin:0;
}
#of_container #of-nav li {
margin-bottom:0;
-moz-box-shadow: inset 0 1px 0 #f9f9f9;
-webkit-box-shadow: inset 0 1px 0 #f9f9f9;
box-shadow: inset 0 1px 0 #f9f9f9;
margin-right: 1px;
border-bottom: 1px solid #d8d8d8;
}
#of_container #of-nav li:last-child {
-moz-box-shadow: inset 0 1px 0 #f9f9f9, 0 1px 0 #f9f9f9;
-webkit-box-shadow: inset 0 1px 0 #f9f9f9, 0 1px 0 #f9f9f9;
box-shadow: inset 0 1px 0 #f9f9f9, 0 1px 0 #f9f9f9;
}
#of_container #of-nav li.current {
margin-right: 0;
}
#of_container #of-nav li a, #of_container #of-nav ul li a:link, #of-nav ul li a:visited {
display: block;
padding: 10px 10px 10px 40px;
background-repeat: no-repeat;
background-position: 13px 10px;
font-weight:bold;
font-size: 12px;
text-decoration: none;
color: #555;
opacity: 0.5;
}
#of_container #of-nav ul li.current a {
background-color: #fcfcfc;
color: #797979;
opacity: 1;
}
#of_container #of-nav ul li a:hover {
color: #d54e21;
opacity: 1;
}
/*menu icons - customize to your liking*/
#of_container #of-nav li.general a{ background-image:url(../images/general.png);}
#of_container #of-nav li.additional a{ background-image:url(../images/icon-settings.png);}
#of_container #of-nav li.headerandfooter a{ background-image:url(../images/header-and-footer.png);}
#of_container #of-nav li.colorsandstyling a{ background-image:url(../images/color.png);}
#of_container #of-nav li.typography a{ background-image:url(../images/typography.png);}
#of_container #of-nav li.socialicons a{ background-image:url(../images/social.png);}
#of_container #of-nav li.fbtwitterapi a{ background-image:url(../images/comments-facebook-icon.png);}
#of_container #of-nav li.customcss a {background: url(../images/custom-css.png) no-repeat;}
#of_container #of-nav li.backupoptions a {background: url(../images/backup.png) no-repeat;}
#of_container #content {
float: left;
min-height: 500px;
width: 595px;
margin-left: -1px;
padding: 0 14px;
font-family: "Lucida Grande", Sans-serif;
background-color: #FCFCFC;
border-left: 1px solid #d8d8d8;
-moz-box-shadow: inset 0 1px 0 #fff;
-webkit-box-shadow: inset 0 1px 0 #fff;
box-shadow: inset 0 1px 0 #fff;
}
#of_container #content .section {
margin-bottom: 10px;
}
#of_container #content .section h3.heading {
font-family:;
margin: 10px 0 10px 0;
padding: 7px 0px;
border-bottom: 1px solid #e7e7e7;
}
#of_container #content .section .controls {
float: left;
width: 345px;
margin: 0 15px 0 0;
}
#of_container #content .section .explain {
float: left;
width: 225px;
padding: 0 10px 0 0;
font-size: 11px;
color: #999999;
}
#of_container #content .section-checkbox .controls {
width:25px
}
#of_container #content .section-multicheck .controls input.checkbox {
}
#of_container #content .section-checkbox .explain {
max-width:93%;
}
#of_container #content .section-color .controls {
width:105px
}
#of_container #content .section-color .explain {
width:440px
}
#of_container #content .section-info h3.heading {
display:none;
}
#of_container #content .section-info .controls {
margin: 20px 0 0;
float:none;
width: auto;
}
#of_container #content .section-info .controls .of-info{
padding: 6px 10px;
font-size: 10px;
background-color: #757575;
border-radius: 3px;
color: #fff;
}
#of_container #content .section-info .controls .of-info ._icon {
height:16px; width:16px;
margin: 0 10px 0 0;
float: left;
}
#of_container #content .section-info .controls small {
font-size: 12px
}
#of_container #content .section-info h3.heading {
-webkit-border-radius: 3px 3px 0 0;
-moz-border-radius: 3px 3px 0 0;
border-radius: 3px 3px 0 0;
}
#of_container #content .section-info .controls {
-webkit-border-radius: 0 0 3px 3px;
-moz-border-radius: 0 0 3px 3px;
border-radius: 0 0 3px 3px;
}
#of_container .sorter {margin-right: -20px;}
#of_container .sorter ul {
background: #F9F9F9;
border: 1px dashed #E3E3E3;
min-height: 40px;
padding: 10px 10px 0;
width: 145px;
float: left;
margin: 0 15px 0 0;
}
#of_container .sorter ul h3 {
margin: 0 0 10px;
text-align: center;
color: #777;
text-transform: capitalize;
}
#of_container .sorter ul li {
border: 1px solid #DFDFDF;
cursor: move;
font-weight: bold;
margin-bottom:10px;
padding:0 10px;
height: 40px;
line-height: 40px;
background-color: #F1F1F1;
background-image: -ms-linear-gradient(top,#f9f9f9,#ececec);
background-image: -moz-linear-gradient(top,#f9f9f9,#ececec);
background-image: -o-linear-gradient(top,#f9f9f9,#ececec);
background-image: -webkit-gradient(linear,left top,left bottom,from(#f9f9f9),to(#ececec));
background-image: -webkit-linear-gradient(top,#f9f9f9,#ececec);
background-image: linear-gradient(top,#f9f9f9,#ececec);
overflow: hidden;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
-moz-box-shadow: inset 0 1px 0 #fff;
-webkit-box-shadow: inset 0 1px 0 #fff;
box-shadow: inset 0 1px 0 #fff;
text-align:center;
}
#of_container #content .section-sorter li.placeholder {
background:#f9f9f9;
border-width:1px;
border-style:dashed;
height:40px;}
#of_container #content .section-slider li.placeholder {
background:#f9f9f9;
border-width:1px;
border-style:dashed;
height:33px;}
#of_container textarea, #of_container input, #of_container select, #of_container button{
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
border-style:solid;
border-width:1px;
}
#of_container .controls input, #of_container .controls select, #of_container .controls textarea {
margin-bottom: 9px !important;
background-color: #f1f1f1;
border: 1px solid;
border-color: #ccc #e6e6e6 #e6e6e6 #ccc;
width: 340px;
padding: 4px;
font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, Verdana, sans-serif;
font-size: 12px;
}
#of_container .controls input:hover, #of_container .controls textarea:hover {
background-color: #f9f9f9;
}
#of_container .controls input:focus, #of_container .controls textarea:focus {
background-color: #fff;
border-color: #ccc #e6e6e6 #e6e6e6 #ccc;
outline:0;
}
#of_container .controls .upload {
width: 340px;
}
#of_container .controls select {
height: 28px;
padding: 4px 5px;
width: 340px
}
#of_container .controls textarea {
width: 345px;
}
#of_container input[type=text] {
width: 340px;
}
#of_container input.checkbox {
width: 30px;
}
#of_container input.of-radio {
width: 30px;
}
label.radio, label.multicheck {
position: relative;
}
#of_container .controls .input-text-small {
width: 60px;
margin-right:10px
}
#of_container .meta-two {
margin-right:10px
}
#of_container .controls .of-color {
float:left;
width: 70px;
margin-left:5px; /* font-size:20px; height:34px;*/
}
#of_container #content .section-typography .controls {
width:440px
}
#of_container #content .section-typography .explain {
width:130px
}
#of_container .controls .of-typography-size {
width:70px;
float:left
}
#of_container .controls .of-typography-unit {
width:60px;
float:left
}
#of_container .controls .of-typography-face {
width:145px;
float:left
}
#of_container .controls .of-typography-style {
width:95px;
float:left
}
#of_container .controls .of-radio-img-img {
border:3px solid #fff;
margin:0 5px 10px 0;
display:none;
cursor:pointer;
float:left;
}
#of_container .controls .of-radio-img-selected {
border:3px solid #ccc
}
#of_container .controls .of-radio-img-img:hover {
opacity:.8;
}
#of_container .controls .of-radio-tile-img {
width:50px;
height:50px;
border:3px solid #f9f9f9;
margin:0 5px 10px 0;
display:none;
cursor:pointer;
float:left;
}
#of_container .controls .of-radio-tile-selected {
border:3px solid #ccc
}
#of_container .controls .of-radio-tile-img:hover {
opacity:.8;
}
#of_container .controls .of-border-width {
width:70px;
float:left
}
#of_container .controls .of-border-style {
width:95px;
float:left
}
#of_container .group {
display:none;
padding-bottom:20px;
}
#of_container .group h2 {
display:none;
border-bottom:3px solid #e7e7e7
}
#of_container .controls input:focus, #of_container select:focus, #of_container textarea:focus {
background:#fff;
}
#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:absolute;
background:rgba(0, 0, 0, 0.5);
color:#fff;
font-size:24px;
text-align:center;
display:none;
-webkit-border-radius: 12px;
-moz-border-radius: 12px;
border-radius: 12px;
}
#of_container .of-save-popup div{
background-repeat: no-repeat;
background-position: 20px 50%;
padding:30px 30px 30px 60px;
}
#of_container .of-save-save {
background-image: url(../images/button_check.png);
}
#of_container .of-save-reset {
background-image: url(../images/sign_warning.png);
}
#of_container .of-save-fail {
background-image:url(../images/stop.png);
}
#of_container .accept,
#of_container .warning,
#of_container .update_available,
#of_container .of-save-popup {
z-index: 9999;
}
#of_container .upload_button_div {
margin-top:7px;
margin-bottom: 15px;
}
#of_container .button {
border-width: 1px;
border-style: solid;
-moz-border-radius: 3px;
-khtml-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
border-color: #dfdfdf;
background-color: #fff;
margin:4px 0 4px;
}
#of_container .button:hover,#of_container .button_hover {
border-color: #bbb;
color: #464646;
}
#of_container .button_active {
background:#eee url(../../images/white-grad-active.png) repeat-x scroll left top;
}
#of_container .image_reset_button, #of_container .mlu_remove_button {
margin-left:10px;
color:#ef521d;
}
#of_container .image_reset_button:hover, #of_container .mlu_remove_button: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;
float:left;
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 {
background: #f3f3f3;
border:solid #ccc;
border-width:0px 1px 1px 1px;
padding: 10px 20px 0px 20px;
height: 35px;
text-align: right;
-webkit-border-radius: 0 0 3px 3px;
-moz-border-radius: 0 0 3px 3px;
border-radius: 0 0 3px 3px;
-moz-box-shadow: inset 0 1px 0 #fff;
-webkit-box-shadow: inset 0 1px 0 #fff;
box-shadow: inset 0 1px 0 #fff;
}
#of_save {
font-family: Arial,Verdana,sans-serif;
float:right;
}
#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: 5px 4px 0;
}
#of_container .ajax-reset-loading-img {
display: block;
margin-left: 100px;
}
#of_container .screenshot {
max-width:340px;
margin-bottom:9px;
}
#of_container .of-uploaded-image {
}
#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 .select_wrapper {
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
font-family: "Lucida Grande","Lucida Sans Unicode",Arial,Verdana,sans-serif;
font-size: 12px;
background: #F1F1F1 url(../images/select.png) no-repeat right center;
border-color: #CCC #E6E6E6 #E6E6E6 #CCC;
border-style: solid;
border-width: 1px;
float: left;
height: 26px;
width: 344px;
margin: 0;
margin-bottom: 9px !important;
width: 340px;
display: block;
color: #888;
position:relative;
}
#of_container .select_wrapper:hover {background-color:#f9f9f9;}
#of_container .mini .controls select, #of_container #content .section .mini .controls, #of_container .controls .typography-size, #of_container .controls .border-width,#of_container .controls .mini,#of_container .mini .controls input, #of_container #content .mini .controls {width: 70px;}
#of_container .controls .typography-face {width: 145px;}
#of_container .controls .typography-style, #of_container .controls .border-style {width: 95px;}
#of_container .controls .typography-size,#of_container .controls .typography-face,#of_container .controls .typography-style, #of_container .controls .border-width, #of_container .controls .border-style {margin-right:5px;}
#of_container #content .mini .explain {
width:500px;
}
#of_container .of-notice {
background: #ffd1d1;
border:1px solid #DFDFDF;
-moz-border-radius:8px;
text-align: center;
margin-bottom: 15px
}
#of_container .slider li {
width: 345px;
border: 1px solid #dfdfdf;
background:#f9f9f9;
overflow:hidden;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
-moz-box-shadow: inset 0 1px 0 #fff;
-webkit-box-shadow: inset 0 1px 0 #fff;
box-shadow: inset 0 1px 0 #fff;
}
#of_container .slide_header {
cursor:move;
height:32px;
padding-left:10px;
padding-right:20px;
line-height:32px;
background-color: #F1F1F1;
margin: 1px 0 -1px 0;
border-bottom: 1px solid #dfdfdf;
background-image: -ms-linear-gradient(top,#f9f9f9,#ececec);
background-image: -moz-linear-gradient(top,#f9f9f9,#ececec);
background-image: -o-linear-gradient(top,#f9f9f9,#ececec);
background-image: -webkit-gradient(linear,left top,left bottom,from(#f9f9f9),to(#ececec));
background-image: -webkit-linear-gradient(top,#f9f9f9,#ececec);
background-image: linear-gradient(top,#f9f9f9,#ececec);
overflow:hidden;
position: relative;
}
#of_container .slide_body {
display:none;
padding:10px 10px 10px 11px;
}
#of_container .slider li input,#of_container .slider li textarea,#of_container .slider li .screenshot,#of_container .slider li .of-option-image {
width:311px;
}
#of_container a.slide_edit_button, #of_container a.slide_delete_button {
text-indent:-9999px;
font-size:0;
}
#of_container a.slide_edit_button {
position: absolute;
right: 0;
top: 0;
width:32px;
height:32px;
background: url(../images/dropdown-arrow.png) no-repeat 9px -28px;
}
#of_container a:hover.slide_edit_button {
background: url(../images/dropdown-arrow.png) no-repeat 9px 11px;}
#of_container a.slide_delete_button {
float: right;
margin: 0 0 0 7px;
width:16px;
height:16px;
background: url(../images/icon-delete.png) no-repeat
}
#of_container .select_wrapper span {
height: 26px;
line-height: 26px;
z-index: 2;
padding-left: 6px;
position:absolute;
left:0;
}
#of_container .select_wrapper .select {
cursor: pointer;
height: 28px;
margin: 0;
-moz-opacity: 0;
filter: alpha(opacity: 0);
opacity: 0;
padding: 0;
position: relative;
width: inherit;
z-index: 4;
}
#of_backup {
margin: 40px 20px;
width: 600px;
}
#of_backup textarea {
margin-bottom: 9px !important;
background-color: #F1F1F1;
border: 1px solid;
width: 100%;
padding: 4px;
font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, Verdana, sans-serif;
font-size: 12px;
border-color: #CCC #E6E6E6 #E6E6E6 #CCC;
}
#of_container #content .section-backup .controls { width: 80%}
#of_container #content .section-backup .explain {
display:none
}
#of_container #content .section-backup .backup-box {
margin: 0 0 20px;
}
#of_container #content .section-backup .instructions {
margin: 0 0 10px;
color: #777;
}
#of_container #content .section-backup .button, #of_container #content .section-transfer .button {
margin: 0 25px 0 0;
}
/* 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;
}
.temphide {display:none;}
/*-------------------------------------------------------------------------------------------*/
/* GENERAL STYLES */
/*-------------------------------------------------------------------------------------------*/
/* http://sonspring.com/journal/clearing-floats */
html body * span.clear, html body * div.clear, html body * li.clear, html body * dd.clear {
background: none;
border: 0;
clear: both;
display: block;
float: none;
font-size: 0;
list-style: none;
margin: 0;
padding: 0;
overflow: hidden;
visibility: hidden;
width: 0;
height: 0;
}
/*-------------------------------------------------------------------------------------------*/
/* 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; }
/*-------------------------------------------------------------------------------------------*/
/* Switch
/*-------------------------------------------------------------------------------------------*/
/*p.switch-options{ margin: 0; }*/
.cb-enable, .cb-disable, .cb-enable span, .cb-disable span { background: url(../images/switch.gif) repeat-x; display: block; float: left; }
.cb-enable span, .cb-disable span { line-height: 30px; display: block; background-repeat: no-repeat; font-weight: bold; }
.cb-enable span { background-position: left -90px; padding: 0 10px; }
.cb-disable span { background-position: right -180px;padding: 0 10px; }
.cb-disable.selected { background-position: 0 -30px; }
.cb-disable.selected span { background-position: right -210px; color: #fff; }
.cb-enable.selected { background-position: 0 -60px; }
.cb-enable.selected span { background-position: left -150px; color: #fff; }
.switch-options label { cursor: pointer; }
.switch-options input { display: none; }
.cb-enable span, .cb-disable span{
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-o-user-select: none;
-ms-user-select: none;
user-select: none;
}/*disable text selection*/

View File

@ -0,0 +1,177 @@
.colorpicker {
width: 356px;
height: 176px;
overflow: hidden;
position: absolute;
background: url(../images/colorpicker/colorpicker_background.png);
font-family: Arial, Helvetica, sans-serif;
display: none;
}
.colorpicker_color {
width: 150px;
height: 150px;
left: 14px;
top: 13px;
position: absolute;
background: #f00;
overflow: hidden;
cursor: crosshair;
}
.colorpicker_color div {
position: absolute;
top: 0;
left: 0;
width: 150px;
height: 150px;
background: url(../images/colorpicker/colorpicker_overlay.png);
}
.colorpicker_color div div {
position: absolute;
top: 0;
left: 0;
width: 11px;
height: 11px;
overflow: hidden;
background: url(../images/colorpicker/colorpicker_select.gif);
margin: -5px 0 0 -5px;
}
.colorpicker_hue {
position: absolute;
top: 13px;
left: 171px;
width: 35px;
height: 150px;
cursor: n-resize;
}
.colorpicker_hue div {
position: absolute;
width: 35px;
height: 9px;
overflow: hidden;
background: url(../images/colorpicker/colorpicker_indic.gif) left top;
margin: -4px 0 0 0;
left: 0px;
}
.colorpicker_new_color {
position: absolute;
width: 60px;
height: 30px;
left: 213px;
top: 13px;
background: #f00;
}
.colorpicker_current_color {
position: absolute;
width: 60px;
height: 30px;
left: 283px;
top: 13px;
background: #f00;
}
.colorpicker input {
background-color: transparent;
border: 1px solid transparent;
position: absolute;
font-size: 10px;
font-family: Arial, Helvetica, sans-serif;
color: #898989;
top: 4px;
right: 11px;
text-align: right;
margin: 0;
padding: 0;
height: 12px;
}
.colorpicker_hex {
position: absolute;
width: 72px;
height: 22px;
background: url(../images/colorpicker/colorpicker_hex.png) top;
left: 212px;
top: 142px;
}
.colorpicker_hex input {
right: 6px;
}
.colorpicker_field {
height: 22px;
width: 62px;
background-position: top;
position: absolute;
}
.colorpicker_field span {
position: absolute;
width: 12px;
height: 22px;
overflow: hidden;
top: 0;
right: 0;
cursor: n-resize;
}
.colorpicker_rgb_r {
background-image: url(../images/colorpicker/colorpicker_rgb_r.png);
top: 52px;
left: 212px;
}
.colorpicker_rgb_g {
background-image: url(../images/colorpicker/colorpicker_rgb_g.png);
top: 82px;
left: 212px;
}
.colorpicker_rgb_b {
background-image: url(../images/colorpicker/colorpicker_rgb_b.png);
top: 112px;
left: 212px;
}
.colorpicker_hsb_h {
background-image: url(../images/colorpicker/colorpicker_hsb_h.png);
top: 52px;
left: 282px;
}
.colorpicker_hsb_s {
background-image: url(../images/colorpicker/colorpicker_hsb_s.png);
top: 82px;
left: 282px;
}
.colorpicker_hsb_b {
background-image: url(../images/colorpicker/colorpicker_hsb_b.png);
top: 112px;
left: 282px;
}
.colorpicker_submit {
position: absolute;
width: 22px;
height: 22px;
background: url(../images/colorpicker/colorpicker_submit.png) top;
left: 322px;
top: 142px;
overflow: hidden;
}
.colorpicker_focus {
background-position: center;
}
.colorpicker_hex.colorpicker_focus {
background-position: bottom;
}
.colorpicker_submit.colorpicker_focus {
background-position: bottom;
}
.colorpicker_slider {
background-position: bottom;
}
.colorSelector {
position: relative;
width: 27px;
height: 27px;
background: url(../images/colorpicker/select.png);
float:left;
}
.colorSelector div {
position: absolute;
top: 4px;
left: 3px;
width: 21px;
height: 19px;
background: url(../images/colorpicker/select.png) center;
}

View File

@ -0,0 +1,85 @@
/*
* 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:#ccc; 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: 28px; height: 28px; cursor: pointer; background:url(../images/handle.png) no-repeat center center; border:0; }
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
.ui-slider-horizontal {
height: .8em;
background: #8fc4ef; /* Old browsers */
background: -moz-linear-gradient(top, #8fc4ef 0%, #629bd2 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#8fc4ef), color-stop(100%,#629bd2)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #8fc4ef 0%,#629bd2 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #8fc4ef 0%,#629bd2 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #8fc4ef 0%,#629bd2 100%); /* IE10+ */
background: linear-gradient(top, #8fc4ef 0%,#629bd2 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#8fc4ef', endColorstr='#629bd2',GradientType=0 ); /* IE6-9 */
border:1px solid #0088F7;
border-color:#0088F7 #0088F7 #2B5893;
-webkit-box-shadow: 0 1px 0 rgba(0,0,0,.1), inset 0 1px 0 rgba(255,255,255,.3), inset 0 -1px 0 rgba(255,255,255,.2);
-moz-box-shadow: 0 1px 0 rgba(0,0,0,.1), inset 0 1px 0 rgba(255,255,255,.3), inset 0 -1px 0 rgba(255,255,255,.2);
box-shadow: 0 1px 0 rgba(0,0,0,.1), inset 0 1px 0 rgba(255,255,255,.3), inset 0 -1px 0 rgba(255,255,255,.2);
}
.ui-slider-horizontal .ui-slider-handle { top: -9px; margin-left: -12px; }
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
.ui-slider-horizontal .ui-slider-range-min { left: 0; }
.ui-slider-horizontal .ui-slider-range-max { right: 0; }
.ui-slider-vertical { width: .8em; height: 100px; }
.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
.ui-slider-vertical .ui-slider-range-max { top: 0; }

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 745 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 902 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 970 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1012 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 970 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 984 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 727 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 734 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 664 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 805 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 687 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 989 B

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: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 788 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 689 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 533 B

View File

@ -0,0 +1,606 @@
/**
* AJAX Upload
* Project page - http://valums.com/ajax-upload/
* Copyright (c) 2008 Andris Valums, http://valums.com
* Licensed under the MIT license (http://valums.com/mit-license/)
*/
(function(){
var d = document, w = window;
/**
* Get element by id
*/
function get(element){
if (typeof element == "string")
element = d.getElementById(element);
return element;
}
/**
* Attaches event to a dom element
*/
function addEvent(el, type, fn){
if (w.addEventListener){
el.addEventListener(type, fn, false);
} else if (w.attachEvent){
var f = function(){
fn.call(el, w.event);
};
el.attachEvent('on' + type, f)
}
}
/**
* Creates and returns element from html chunk
*/
var toElement = function(){
var div = d.createElement('div');
return function(html){
div.innerHTML = html;
var el = div.childNodes[0];
div.removeChild(el);
return el;
}
}();
function hasClass(ele,cls){
return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}
function addClass(ele,cls) {
if (!hasClass(ele,cls)) ele.className += " "+cls;
}
function removeClass(ele,cls) {
var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
ele.className=ele.className.replace(reg,' ');
}
// getOffset function copied from jQuery lib (http://jquery.com/)
if (document.documentElement["getBoundingClientRect"]){
// Get Offset using getBoundingClientRect
// http://ejohn.org/blog/getboundingclientrect-is-awesome/
var getOffset = function(el){
var box = el.getBoundingClientRect(),
doc = el.ownerDocument,
body = doc.body,
docElem = doc.documentElement,
// for ie
clientTop = docElem.clientTop || body.clientTop || 0,
clientLeft = docElem.clientLeft || body.clientLeft || 0,
// In Internet Explorer 7 getBoundingClientRect property is treated as physical,
// while others are logical. Make all logical, like in IE8.
zoom = 1;
if (body.getBoundingClientRect) {
var bound = body.getBoundingClientRect();
zoom = (bound.right - bound.left)/body.clientWidth;
}
if (zoom > 1){
clientTop = 0;
clientLeft = 0;
}
var top = box.top/zoom + (window.pageYOffset || docElem && docElem.scrollTop/zoom || body.scrollTop/zoom) - clientTop,
left = box.left/zoom + (window.pageXOffset|| docElem && docElem.scrollLeft/zoom || body.scrollLeft/zoom) - clientLeft;
return {
top: top,
left: left
};
}
} else {
// Get offset adding all offsets
var getOffset = function(el){
if (w.jQuery){
return jQuery(el).offset();
}
var top = 0, left = 0;
do {
top += el.offsetTop || 0;
left += el.offsetLeft || 0;
}
while (el = el.offsetParent);
return {
left: left,
top: top
};
}
}
function getBox(el){
var left, right, top, bottom;
var offset = getOffset(el);
left = offset.left;
top = offset.top;
right = left + el.offsetWidth;
bottom = top + el.offsetHeight;
return {
left: left,
right: right,
top: top,
bottom: bottom
};
}
/**
* Crossbrowser mouse coordinates
*/
function getMouseCoords(e){
// pageX/Y is not supported in IE
// http://www.quirksmode.org/dom/w3c_cssom.html
if (!e.pageX && e.clientX){
// In Internet Explorer 7 some properties (mouse coordinates) are treated as physical,
// while others are logical (offset).
var zoom = 1;
var body = document.body;
if (body.getBoundingClientRect) {
var bound = body.getBoundingClientRect();
zoom = (bound.right - bound.left)/body.clientWidth;
}
return {
x: e.clientX / zoom + d.body.scrollLeft + d.documentElement.scrollLeft,
y: e.clientY / zoom + d.body.scrollTop + d.documentElement.scrollTop
};
}
return {
x: e.pageX,
y: e.pageY
};
}
/**
* Function generates unique id
*/
var getUID = function(){
var id = 0;
return function(){
return 'ValumsAjaxUpload' + id++;
}
}();
function fileFromPath(file){
return file.replace(/.*(\/|\\)/, "");
}
function getExt(file){
return (/[.]/.exec(file)) ? /[^.]+$/.exec(file.toLowerCase()) : '';
}
/**
* Cross-browser way to get xhr object
*/
var getXhr = function(){
var xhr;
return function(){
if (xhr) return xhr;
if (typeof XMLHttpRequest !== 'undefined') {
xhr = new XMLHttpRequest();
} else {
var v = [
"Microsoft.XmlHttp",
"MSXML2.XmlHttp.5.0",
"MSXML2.XmlHttp.4.0",
"MSXML2.XmlHttp.3.0",
"MSXML2.XmlHttp.2.0"
];
for (var i=0; i < v.length; i++){
try {
xhr = new ActiveXObject(v[i]);
break;
} catch (e){}
}
}
return xhr;
}
}();
// Please use AjaxUpload , Ajax_upload will be removed in the next version
Ajax_upload = AjaxUpload = function(button, options){
if (button.jquery){
// jquery object was passed
button = button[0];
} else if (typeof button == "string" && /^#.*/.test(button)){
button = button.slice(1);
}
button = get(button);
this._input = null;
this._button = button;
this._disabled = false;
this._submitting = false;
// Variable changes to true if the button was clicked
// 3 seconds ago (requred to fix Safari on Mac error)
this._justClicked = false;
this._parentDialog = d.body;
if (window.jQuery && jQuery.ui && jQuery.ui.dialog){
var parentDialog = jQuery(this._button).parents('.ui-dialog');
if (parentDialog.length){
this._parentDialog = parentDialog[0];
}
}
this._settings = {
// Location of the server-side upload script
action: 'upload.php',
// File upload name
name: 'userfile',
// Additional data to send
data: {},
// Submit file as soon as it's selected
autoSubmit: true,
// The type of data that you're expecting back from the server.
// Html and xml are detected automatically.
// Only useful when you are using json data as a response.
// Set to "json" in that case.
responseType: false,
// Location of the server-side script that fixes Safari
// hanging problem returning "Connection: close" header
closeConnection: '',
// Class applied to button when mouse is hovered
hoverClass: 'button_hover',
// When user selects a file, useful with autoSubmit disabled
onChange: function(file, extension){},
// Callback to fire before file is uploaded
// You can return false to cancel upload
onSubmit: function(file, extension){},
// Fired when file upload is completed
// WARNING! DO NOT USE "FALSE" STRING AS A RESPONSE!
onComplete: function(file, response) {}
};
// Merge the users options with our defaults
for (var i in options) {
this._settings[i] = options[i];
}
this._createInput();
this._rerouteClicks();
}
// assigning methods to our class
AjaxUpload.prototype = {
setData : function(data){
this._settings.data = data;
},
disable : function(){
this._disabled = true;
},
enable : function(){
this._disabled = false;
},
// removes instance
destroy : function(){
if(this._input){
if(this._input.parentNode){
this._input.parentNode.removeChild(this._input);
}
this._input = null;
}
},
/**
* Creates invisible file input above the button
*/
_createInput : function(){
var self = this;
var input = d.createElement("input");
input.setAttribute('type', 'file');
input.setAttribute('name', this._settings.name);
var styles = {
'position' : 'absolute'
,'margin': '-5px 0 0 -175px'
,'padding': 0
,'width': '220px'
,'height': '30px'
,'fontSize': '14px'
,'opacity': 0
,'cursor': 'pointer'
,'display' : 'none'
,'zIndex' : 2147483583 //Max zIndex supported by Opera 9.0-9.2x
// Strange, I expected 2147483647
// Doesn't work in IE :(
//,'direction' : 'ltr'
};
for (var i in styles){
input.style[i] = styles[i];
}
// Make sure that element opacity exists
// (IE uses filter instead)
if ( ! (input.style.opacity === "0")){
input.style.filter = "alpha(opacity=0)";
}
this._parentDialog.appendChild(input);
addEvent(input, 'change', function(){
// get filename from input
var file = fileFromPath(this.value);
if(self._settings.onChange.call(self, file, getExt(file)) == false ){
return;
}
// Submit form when value is changed
if (self._settings.autoSubmit){
self.submit();
}
});
// Fixing problem with Safari
// The problem is that if you leave input before the file select dialog opens
// it does not upload the file.
// As dialog opens slowly (it is a sheet dialog which takes some time to open)
// there is some time while you can leave the button.
// So we should not change display to none immediately
addEvent(input, 'click', function(){
self.justClicked = true;
setTimeout(function(){
// we will wait 3 seconds for dialog to open
self.justClicked = false;
}, 2500);
});
this._input = input;
},
_rerouteClicks : function (){
var self = this;
// IE displays 'access denied' error when using this method
// other browsers just ignore click()
// addEvent(this._button, 'click', function(e){
// self._input.click();
// });
var box, dialogOffset = {top:0, left:0}, over = false;
addEvent(self._button, 'mouseover', function(e){
if (!self._input || over) return;
over = true;
box = getBox(self._button);
if (self._parentDialog != d.body){
dialogOffset = getOffset(self._parentDialog);
}
});
// We can't use mouseout on the button,
// because invisible input is over it
addEvent(document, 'mousemove', function(e){
var input = self._input;
if (!input || !over) return;
if (self._disabled){
removeClass(self._button, self._settings.hoverClass);
input.style.display = 'none';
return;
}
var c = getMouseCoords(e);
if ((c.x >= box.left) && (c.x <= box.right) &&
(c.y >= box.top) && (c.y <= box.bottom)){
input.style.top = c.y - dialogOffset.top + 'px';
input.style.left = c.x - dialogOffset.left + 'px';
input.style.display = 'block';
addClass(self._button, self._settings.hoverClass);
} else {
// mouse left the button
over = false;
var check = setInterval(function(){
// if input was just clicked do not hide it
// to prevent safari bug
if (self.justClicked){
return;
}
if ( !over ){
input.style.display = 'none';
}
clearInterval(check);
}, 25);
removeClass(self._button, self._settings.hoverClass);
}
});
},
/**
* Creates iframe with unique name
*/
_createIframe : function(){
// unique name
// We cannot use getTime, because it sometimes return
// same value in safari :(
var id = getUID();
// Remove ie6 "This page contains both secure and nonsecure items" prompt
// http://tinyurl.com/77w9wh
var iframe = toElement('<iframe src="javascript:false;" name="' + id + '" />');
iframe.id = id;
iframe.style.display = 'none';
d.body.appendChild(iframe);
return iframe;
},
/**
* Upload file without refreshing the page
*/
submit : function(){
var self = this, settings = this._settings;
if (this._input.value === ''){
// there is no file
return;
}
// get filename from input
var file = fileFromPath(this._input.value);
// execute user event
if (! (settings.onSubmit.call(this, file, getExt(file)) == false)) {
// Create new iframe for this submission
var iframe = this._createIframe();
// Do not submit if user function returns false
var form = this._createForm(iframe);
form.appendChild(this._input);
// A pretty little hack to make uploads not hang in Safari. Just call this
// immediately before the upload is submitted. This does an Ajax call to
// the server, which returns an empty document with the "Connection: close"
// header, telling Safari to close the active connection.
// http://blog.airbladesoftware.com/2007/8/17/note-to-self-prevent-uploads-hanging-in-safari
if (settings.closeConnection && /AppleWebKit|MSIE/.test(navigator.userAgent)){
var xhr = getXhr();
// Open synhronous connection
xhr.open('GET', settings.closeConnection, false);
xhr.send('');
}
form.submit();
d.body.removeChild(form);
form = null;
this._input = null;
// create new input
this._createInput();
var toDeleteFlag = false;
addEvent(iframe, 'load', function(e){
if (// For Safari
iframe.src == "javascript:'%3Chtml%3E%3C/html%3E';" ||
// For FF, IE
iframe.src == "javascript:'<html></html>';"){
// First time around, do not delete.
if( toDeleteFlag ){
// Fix busy state in FF3
setTimeout( function() {
d.body.removeChild(iframe);
}, 0);
}
return;
}
var doc = iframe.contentDocument ? iframe.contentDocument : frames[iframe.id].document;
// fixing Opera 9.26
if (doc.readyState && doc.readyState != 'complete'){
// Opera fires load event multiple times
// Even when the DOM is not ready yet
// this fix should not affect other browsers
return;
}
// fixing Opera 9.64
if (doc.body && doc.body.innerHTML == "false"){
// In Opera 9.64 event was fired second time
// when body.innerHTML changed from false
// to server response approx. after 1 sec
return;
}
var response;
if (doc.XMLDocument){
// response is a xml document IE property
response = doc.XMLDocument;
} else if (doc.body){
// response is html document or plain text
response = doc.body.innerHTML;
if (settings.responseType && settings.responseType.toLowerCase() == 'json'){
// If the document was sent as 'application/javascript' or
// 'text/javascript', then the browser wraps the text in a <pre>
// tag and performs html encoding on the contents. In this case,
// we need to pull the original text content from the text node's
// nodeValue property to retrieve the unmangled content.
// Note that IE6 only understands text/html
if (doc.body.firstChild && doc.body.firstChild.nodeName.toUpperCase() == 'PRE'){
response = doc.body.firstChild.firstChild.nodeValue;
}
if (response) {
response = window["eval"]("(" + response + ")");
} else {
response = {};
}
}
} else {
// response is a xml document
var response = doc;
}
settings.onComplete.call(self, file, response);
// Reload blank page, so that reloading main page
// does not re-submit the post. Also, remember to
// delete the frame
toDeleteFlag = true;
// Fix IE mixed content issue
iframe.src = "javascript:'<html></html>';";
});
} else {
// clear input to allow user to select same file
// Doesn't work in IE6
// this._input.value = '';
d.body.removeChild(this._input);
this._input = null;
// create new input
this._createInput();
}
},
/**
* Creates form, that will be submitted to iframe
*/
_createForm : function(iframe){
var settings = this._settings;
// method, enctype must be specified here
// because changing this attr on the fly is not allowed in IE 6/7
var form = toElement('<form method="post" enctype="multipart/form-data"></form>');
form.style.display = 'none';
form.action = settings.action;
form.target = iframe.name;
d.body.appendChild(form);
// Create hidden input element for each data key
for (var prop in settings.data){
var el = d.createElement("input");
el.type = 'hidden';
el.name = prop;
el.value = settings.data[prop];
form.appendChild(el);
}
return form;
}
};
})();

View File

@ -0,0 +1,455 @@
/**
*
* Color picker
* Author: Stefan Petre www.eyecon.ro
*
* Dependencies: jQuery
*
*/
(function ($) {
var ColorPicker = function () {
var
ids = {},
inAction,
charMin = 65,
visible,
tpl = '<div class="colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_submit"></div></div>',
defaults = {
eventName: 'click',
onShow: function () {},
onBeforeShow: function(){},
onHide: function () {},
onChange: function () {},
onSubmit: function () {},
color: 'ff0000',
livePreview: true,
flat: false
},
fillRGBFields = function (hsb, cal) {
var rgb = HSBToRGB(hsb);
$(cal).data('colorpicker').fields
.eq(1).val(rgb.r).end()
.eq(2).val(rgb.g).end()
.eq(3).val(rgb.b).end();
},
fillHSBFields = function (hsb, cal) {
$(cal).data('colorpicker').fields
.eq(4).val(hsb.h).end()
.eq(5).val(hsb.s).end()
.eq(6).val(hsb.b).end();
},
fillHexFields = function (hsb, cal) {
$(cal).data('colorpicker').fields
.eq(0).val(HSBToHex(hsb)).end();
},
setSelector = function (hsb, cal) {
$(cal).data('colorpicker').selector.css('backgroundColor', '#' + HSBToHex({h: hsb.h, s: 100, b: 100}));
$(cal).data('colorpicker').selectorIndic.css({
left: parseInt(150 * hsb.s/100, 10),
top: parseInt(150 * (100-hsb.b)/100, 10)
});
},
setHue = function (hsb, cal) {
$(cal).data('colorpicker').hue.css('top', parseInt(150 - 150 * hsb.h/360, 10));
},
setCurrentColor = function (hsb, cal) {
$(cal).data('colorpicker').currentColor.css('backgroundColor', '#' + HSBToHex(hsb));
},
setNewColor = function (hsb, cal) {
$(cal).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(hsb));
},
keyDown = function (ev) {
var pressedKey = ev.charCode || ev.keyCode || -1;
if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) {
return false;
}
var cal = $(this).parent().parent();
if (cal.data('colorpicker').livePreview === true) {
change.apply(this);
}
},
change = function (ev) {
var cal = $(this).parent().parent(), col;
if (this.parentNode.className.indexOf('_hex') > 0) {
cal.data('colorpicker').color = col = HexToHSB(fixHex(this.value));
} else if (this.parentNode.className.indexOf('_hsb') > 0) {
cal.data('colorpicker').color = col = fixHSB({
h: parseInt(cal.data('colorpicker').fields.eq(4).val(), 10),
s: parseInt(cal.data('colorpicker').fields.eq(5).val(), 10),
b: parseInt(cal.data('colorpicker').fields.eq(6).val(), 10)
});
} else {
cal.data('colorpicker').color = col = RGBToHSB(fixRGB({
r: parseInt(cal.data('colorpicker').fields.eq(1).val(), 10),
g: parseInt(cal.data('colorpicker').fields.eq(2).val(), 10),
b: parseInt(cal.data('colorpicker').fields.eq(3).val(), 10)
}));
}
if (ev) {
fillRGBFields(col, cal.get(0));
fillHexFields(col, cal.get(0));
fillHSBFields(col, cal.get(0));
}
setSelector(col, cal.get(0));
setHue(col, cal.get(0));
setNewColor(col, cal.get(0));
cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]);
},
blur = function (ev) {
var cal = $(this).parent().parent();
cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus')
},
focus = function () {
charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65;
$(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus');
$(this).parent().addClass('colorpicker_focus');
},
downIncrement = function (ev) {
var field = $(this).parent().find('input').focus();
var current = {
el: $(this).parent().addClass('colorpicker_slider'),
max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
y: ev.pageY,
field: field,
val: parseInt(field.val(), 10),
preview: $(this).parent().parent().data('colorpicker').livePreview
};
$(document).bind('mouseup', current, upIncrement);
$(document).bind('mousemove', current, moveIncrement);
},
moveIncrement = function (ev) {
ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10))));
if (ev.data.preview) {
change.apply(ev.data.field.get(0), [true]);
}
return false;
},
upIncrement = function (ev) {
change.apply(ev.data.field.get(0), [true]);
ev.data.el.removeClass('colorpicker_slider').find('input').focus();
$(document).unbind('mouseup', upIncrement);
$(document).unbind('mousemove', moveIncrement);
return false;
},
downHue = function (ev) {
var current = {
cal: $(this).parent(),
y: $(this).offset().top
};
current.preview = current.cal.data('colorpicker').livePreview;
$(document).bind('mouseup', current, upHue);
$(document).bind('mousemove', current, moveHue);
},
moveHue = function (ev) {
change.apply(
ev.data.cal.data('colorpicker')
.fields
.eq(4)
.val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.y))))/150, 10))
.get(0),
[ev.data.preview]
);
return false;
},
upHue = function (ev) {
fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
$(document).unbind('mouseup', upHue);
$(document).unbind('mousemove', moveHue);
return false;
},
downSelector = function (ev) {
var current = {
cal: $(this).parent(),
pos: $(this).offset()
};
current.preview = current.cal.data('colorpicker').livePreview;
$(document).bind('mouseup', current, upSelector);
$(document).bind('mousemove', current, moveSelector);
},
moveSelector = function (ev) {
change.apply(
ev.data.cal.data('colorpicker')
.fields
.eq(6)
.val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.pos.top))))/150, 10))
.end()
.eq(5)
.val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - ev.data.pos.left))))/150, 10))
.get(0),
[ev.data.preview]
);
return false;
},
upSelector = function (ev) {
fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0));
$(document).unbind('mouseup', upSelector);
$(document).unbind('mousemove', moveSelector);
return false;
},
enterSubmit = function (ev) {
$(this).addClass('colorpicker_focus');
},
leaveSubmit = function (ev) {
$(this).removeClass('colorpicker_focus');
},
clickSubmit = function (ev) {
var cal = $(this).parent();
var col = cal.data('colorpicker').color;
cal.data('colorpicker').origColor = col;
setCurrentColor(col, cal.get(0));
cal.data('colorpicker').onSubmit(col, HSBToHex(col), HSBToRGB(col));
cal.hide();
},
show = function (ev) {
var cal = $('#' + $(this).data('colorpickerId'));
cal.data('colorpicker').onBeforeShow.apply(this, [cal.get(0)]);
var pos = $(this).offset();
var viewPort = getViewport();
var top = pos.top + this.offsetHeight;
var left = pos.left;
if (top + 176 > viewPort.t + viewPort.h) {
top -= this.offsetHeight + 176;
} else {
top += 5;
}
if (left + 356 > viewPort.l + viewPort.w) {
left -= 356;
}
cal.css({left: left + 'px', top: top + 'px'});
if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) {
cal.show();
}
$(document).bind('mousedown', {cal: cal}, hide);
return false;
},
hide = function (ev) {
if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) {
if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
ev.data.cal.hide();
}
$(document).unbind('mousedown', hide);
}
},
isChildOf = function(parentEl, el, container) {
if (parentEl == el) {
return true;
}
if (parentEl.contains) {
return parentEl.contains(el);
}
if ( parentEl.compareDocumentPosition ) {
return !!(parentEl.compareDocumentPosition(el) & 16);
}
var prEl = el.parentNode;
while(prEl && prEl != container) {
if (prEl == parentEl)
return true;
prEl = prEl.parentNode;
}
return false;
},
getViewport = function () {
var m = document.compatMode == 'CSS1Compat';
return {
l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop),
w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth),
h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight)
};
},
fixHSB = function (hsb) {
return {
h: Math.min(360, Math.max(0, hsb.h)),
s: Math.min(100, Math.max(0, hsb.s)),
b: Math.min(100, Math.max(0, hsb.b))
};
},
fixRGB = function (rgb) {
return {
r: Math.min(255, Math.max(0, rgb.r)),
g: Math.min(255, Math.max(0, rgb.g)),
b: Math.min(255, Math.max(0, rgb.b))
};
},
fixHex = function (hex) {
var len = 6 - hex.length;
if (len > 0) {
var o = [];
for (var i=0; i<len; i++) {
o.push('0');
}
o.push(hex);
hex = o.join('');
}
return hex;
},
HexToRGB = function (hex) {
var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
},
HexToHSB = function (hex) {
return RGBToHSB(HexToRGB(hex));
},
RGBToHSB = function (rgb) {
var hsb = {};
hsb.b = Math.max(Math.max(rgb.r,rgb.g),rgb.b);
hsb.s = (hsb.b <= 0) ? 0 : Math.round(100*(hsb.b - Math.min(Math.min(rgb.r,rgb.g),rgb.b))/hsb.b);
hsb.b = Math.round((hsb.b /255)*100);
if((rgb.r==rgb.g) && (rgb.g==rgb.b)) hsb.h = 0;
else if(rgb.r>=rgb.g && rgb.g>=rgb.b) hsb.h = 60*(rgb.g-rgb.b)/(rgb.r-rgb.b);
else if(rgb.g>=rgb.r && rgb.r>=rgb.b) hsb.h = 60 + 60*(rgb.g-rgb.r)/(rgb.g-rgb.b);
else if(rgb.g>=rgb.b && rgb.b>=rgb.r) hsb.h = 120 + 60*(rgb.b-rgb.r)/(rgb.g-rgb.r);
else if(rgb.b>=rgb.g && rgb.g>=rgb.r) hsb.h = 180 + 60*(rgb.b-rgb.g)/(rgb.b-rgb.r);
else if(rgb.b>=rgb.r && rgb.r>=rgb.g) hsb.h = 240 + 60*(rgb.r-rgb.g)/(rgb.b-rgb.g);
else if(rgb.r>=rgb.b && rgb.b>=rgb.g) hsb.h = 300 + 60*(rgb.r-rgb.b)/(rgb.r-rgb.g);
else hsb.h = 0;
hsb.h = Math.round(hsb.h);
return hsb;
},
HSBToRGB = function (hsb) {
var rgb = {};
var h = Math.round(hsb.h);
var s = Math.round(hsb.s*255/100);
var v = Math.round(hsb.b*255/100);
if(s == 0) {
rgb.r = rgb.g = rgb.b = v;
} else {
var t1 = v;
var t2 = (255-s)*v/255;
var t3 = (t1-t2)*(h%60)/60;
if(h==360) h = 0;
if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3}
else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3}
else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3}
else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3}
else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3}
else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3}
else {rgb.r=0; rgb.g=0; rgb.b=0}
}
return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)};
},
RGBToHex = function (rgb) {
var hex = [
rgb.r.toString(16),
rgb.g.toString(16),
rgb.b.toString(16)
];
$.each(hex, function (nr, val) {
if (val.length == 1) {
hex[nr] = '0' + val;
}
});
return hex.join('');
},
HSBToHex = function (hsb) {
return RGBToHex(HSBToRGB(hsb));
};
return {
init: function (options) {
options = $.extend({}, defaults, options||{});
if (typeof options.color == 'string') {
options.color = HexToHSB(options.color);
} else if (options.color.r != undefined && options.color.g != undefined && options.color.b != undefined) {
options.color = RGBToHSB(options.color);
} else if (options.color.h != undefined && options.color.s != undefined && options.color.b != undefined) {
options.color = fixHSB(options.color);
} else {
return this;
}
options.origColor = options.color;
return this.each(function () {
if (!$(this).data('colorpickerId')) {
var id = 'collorpicker_' + parseInt(Math.random() * 1000);
$(this).data('colorpickerId', id);
var cal = $(tpl).attr('id', id);
if (options.flat) {
cal.appendTo(this).show();
} else {
cal.appendTo(document.body);
}
options.fields = cal
.find('input')
.bind('keydown', keyDown)
.bind('change', change)
.bind('blur', blur)
.bind('focus', focus);
cal.find('span').bind('mousedown', downIncrement);
options.selector = cal.find('div.colorpicker_color').bind('mousedown', downSelector);
options.selectorIndic = options.selector.find('div div');
options.hue = cal.find('div.colorpicker_hue div');
cal.find('div.colorpicker_hue').bind('mousedown', downHue);
options.newColor = cal.find('div.colorpicker_new_color');
options.currentColor = cal.find('div.colorpicker_current_color');
cal.data('colorpicker', options);
cal.find('div.colorpicker_submit')
.bind('mouseenter', enterSubmit)
.bind('mouseleave', leaveSubmit)
.bind('click', clickSubmit);
fillRGBFields(options.color, cal.get(0));
fillHSBFields(options.color, cal.get(0));
fillHexFields(options.color, cal.get(0));
setHue(options.color, cal.get(0));
setSelector(options.color, cal.get(0));
setCurrentColor(options.color, cal.get(0));
setNewColor(options.color, cal.get(0));
if (options.flat) {
cal.css({
position: 'relative',
display: 'block'
});
} else {
$(this).bind(options.eventName, show);
}
}
});
},
showPicker: function() {
return this.each( function () {
if ($(this).data('colorpickerId')) {
show.apply(this);
}
});
},
hidePicker: function() {
return this.each( function () {
if ($(this).data('colorpickerId')) {
$('#' + $(this).data('colorpickerId')).hide();
}
});
},
setColor: function(col) {
if (typeof col == 'string') {
col = HexToHSB(col);
} else if (col.r != undefined && col.g != undefined && col.b != undefined) {
col = RGBToHSB(col);
} else if (col.h != undefined && col.s != undefined && col.b != undefined) {
col = fixHSB(col);
} else {
return this;
}
return this.each(function(){
if ($(this).data('colorpickerId')) {
var cal = $('#' + $(this).data('colorpickerId'));
cal.data('colorpicker').color = col;
cal.data('colorpicker').origColor = col;
fillRGBFields(col, cal.get(0));
fillHSBFields(col, cal.get(0));
fillHexFields(col, cal.get(0));
setHue(col, cal.get(0));
setSelector(col, cal.get(0));
setCurrentColor(col, cal.get(0));
setNewColor(col, cal.get(0));
}
});
}
};
}();
$.fn.extend({
ColorPicker: ColorPicker.init,
ColorPickerHide: ColorPicker.hide,
ColorPickerShow: ColorPicker.show,
ColorPickerSetColor: ColorPicker.setColor
});
})(jQuery)

View File

@ -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};

View File

@ -0,0 +1,252 @@
/// <reference path="../../../lib/jquery-1.2.6.js" />
/*
Masked Input plugin for jQuery
Copyright (c) 2007-2009 Josh Bush (digitalbush.com)
Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
Version: 1.2.2 (03/09/2009 22:39:06)
*/
(function($) {
var pasteEventName = ($.browser.msie ? 'paste' : 'input') + ".mask";
var iPhone = (window.orientation != undefined);
$.mask = {
//Predefined character definitions
definitions: {
'9': "[0-9]",
'a': "[A-Za-z]",
'*': "[A-Za-z0-9]"
}
};
$.fn.extend({
//Helper Function for Caret positioning
caret: function(begin, end) {
if (this.length == 0) return;
if (typeof begin == 'number') {
end = (typeof end == 'number') ? end : begin;
return this.each(function() {
if (this.setSelectionRange) {
this.focus();
this.setSelectionRange(begin, end);
} else if (this.createTextRange) {
var range = this.createTextRange();
range.collapse(true);
range.moveEnd('character', end);
range.moveStart('character', begin);
range.select();
}
});
} else {
if (this[0].setSelectionRange) {
begin = this[0].selectionStart;
end = this[0].selectionEnd;
} else if (document.selection && document.selection.createRange) {
var range = document.selection.createRange();
begin = 0 - range.duplicate().moveStart('character', -100000);
end = begin + range.text.length;
}
return { begin: begin, end: end };
}
},
unmask: function() { return this.trigger("unmask"); },
mask: function(mask, settings) {
if (!mask && this.length > 0) {
var input = $(this[0]);
var tests = input.data("tests");
return $.map(input.data("buffer"), function(c, i) {
return tests[i] ? c : null;
}).join('');
}
settings = $.extend({
placeholder: "_",
completed: null
}, settings);
var defs = $.mask.definitions;
var tests = [];
var partialPosition = mask.length;
var firstNonMaskPos = null;
var len = mask.length;
$.each(mask.split(""), function(i, c) {
if (c == '?') {
len--;
partialPosition = i;
} else if (defs[c]) {
tests.push(new RegExp(defs[c]));
if(firstNonMaskPos==null)
firstNonMaskPos = tests.length - 1;
} else {
tests.push(null);
}
});
return this.each(function() {
var input = $(this);
var buffer = $.map(mask.split(""), function(c, i) { if (c != '?') return defs[c] ? settings.placeholder : c });
var ignore = false; //Variable for ignoring control keys
var focusText = input.val();
input.data("buffer", buffer).data("tests", tests);
function seekNext(pos) {
while (++pos <= len && !tests[pos]);
return pos;
};
function shiftL(pos) {
while (!tests[pos] && --pos >= 0);
for (var i = pos; i < len; i++) {
if (tests[i]) {
buffer[i] = settings.placeholder;
var j = seekNext(i);
if (j < len && tests[i].test(buffer[j])) {
buffer[i] = buffer[j];
} else
break;
}
}
writeBuffer();
input.caret(Math.max(firstNonMaskPos, pos));
};
function shiftR(pos) {
for (var i = pos, c = settings.placeholder; i < len; i++) {
if (tests[i]) {
var j = seekNext(i);
var t = buffer[i];
buffer[i] = c;
if (j < len && tests[j].test(t))
c = t;
else
break;
}
}
};
function keydownEvent(e) {
var pos = $(this).caret();
var k = e.keyCode;
ignore = (k < 16 || (k > 16 && k < 32) || (k > 32 && k < 41));
//delete selection before proceeding
if ((pos.begin - pos.end) != 0 && (!ignore || k == 8 || k == 46))
clearBuffer(pos.begin, pos.end);
//backspace, delete, and escape get special treatment
if (k == 8 || k == 46 || (iPhone && k == 127)) {//backspace/delete
shiftL(pos.begin + (k == 46 ? 0 : -1));
return false;
} else if (k == 27) {//escape
input.val(focusText);
input.caret(0, checkVal());
return false;
}
};
function keypressEvent(e) {
if (ignore) {
ignore = false;
//Fixes Mac FF bug on backspace
return (e.keyCode == 8) ? false : null;
}
e = e || window.event;
var k = e.charCode || e.keyCode || e.which;
var pos = $(this).caret();
if (e.ctrlKey || e.altKey || e.metaKey) {//Ignore
return true;
} else if ((k >= 32 && k <= 125) || k > 186) {//typeable characters
var p = seekNext(pos.begin - 1);
if (p < len) {
var c = String.fromCharCode(k);
if (tests[p].test(c)) {
shiftR(p);
buffer[p] = c;
writeBuffer();
var next = seekNext(p);
$(this).caret(next);
if (settings.completed && next == len)
settings.completed.call(input);
}
}
}
return false;
};
function clearBuffer(start, end) {
for (var i = start; i < end && i < len; i++) {
if (tests[i])
buffer[i] = settings.placeholder;
}
};
function writeBuffer() { return input.val(buffer.join('')).val(); };
function checkVal(allow) {
//try to place characters where they belong
var test = input.val();
var lastMatch = -1;
for (var i = 0, pos = 0; i < len; i++) {
if (tests[i]) {
buffer[i] = settings.placeholder;
while (pos++ < test.length) {
var c = test.charAt(pos - 1);
if (tests[i].test(c)) {
buffer[i] = c;
lastMatch = i;
break;
}
}
if (pos > test.length)
break;
} else if (buffer[i] == test[pos] && i!=partialPosition) {
pos++;
lastMatch = i;
}
}
if (!allow && lastMatch + 1 < partialPosition) {
input.val("");
clearBuffer(0, len);
} else if (allow || lastMatch + 1 >= partialPosition) {
writeBuffer();
if (!allow) input.val(input.val().substring(0, lastMatch + 1));
}
return (partialPosition ? i : firstNonMaskPos);
};
if (!input.attr("readonly"))
input
.one("unmask", function() {
input
.unbind(".mask")
.removeData("buffer")
.removeData("tests");
})
.bind("focus.mask", function() {
focusText = input.val();
var pos = checkVal();
writeBuffer();
setTimeout(function() {
if (pos == mask.length)
input.caret(0, pos);
else
input.caret(pos);
}, 0);
})
.bind("blur.mask", function() {
checkVal();
if (input.val() != focusText)
input.change();
})
.bind("keydown.mask", keydownEvent)
.bind("keypress.mask", keypressEvent)
.bind(pasteEventName, function() {
setTimeout(function() { input.caret(checkVal(true)); }, 0);
});
checkVal(); //Perform initial check for existing values
});
}
});
})(jQuery);

View File

@ -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);

View File

@ -0,0 +1,168 @@
/*-----------------------------------------------------------------------------------*/
/* WooFramework Media Library-driven AJAX File Uploader Module
/* JavaScript Functions (2010-11-05)
/*
/* The code below is designed to work as a part of the WooFramework Media Library-driven
/* AJAX File Uploader Module. It is included only on screens where this module is used.
/*
/* Used with (very) slight modifications for Options Framework.
/*-----------------------------------------------------------------------------------*/
(function ($) {
optionsframeworkMLU = {
/*-----------------------------------------------------------------------------------*/
/* Remove file when the "remove" button is clicked.
/*-----------------------------------------------------------------------------------*/
removeFile: function () {
$('.mlu_remove_button').live('click', function(event) {
var clickedObject = $(this);
var theID = $(this).attr('title');
var image_to_remove = $('#image_' + theID);
var button_to_hide = $('#reset_' + theID);
image_to_remove.fadeOut(500,function(){ $(this).remove(); });
button_to_hide.fadeOut();
clickedObject.parent().prev('input').val('');
return false;
});
// Hide the delete button on the first row
$('a.delete-inline', "#option-1").hide();
}, // End removeFile
/*-----------------------------------------------------------------------------------*/
/* Replace the default file upload field with a customised version.
/*-----------------------------------------------------------------------------------*/
recreateFileField: function () {
$('input.file').each(function(){
var uploadbutton = '<input class="upload_file_button" type="button" value="Upload" />';
$(this).wrap('<div class="file_wrap" />');
$(this).addClass('file').css('opacity', 0); //set to invisible
$(this).parent().append($('<div class="fake_file" />').append($('<input type="text" class="upload" />').attr('id',$(this).attr('id')+'_file')).val( $(this).val() ).append(uploadbutton));
$(this).bind('change', function() {
$('#'+$(this).attr('id')+'_file').val($(this).val());
});
$(this).bind('mouseout', function() {
$('#'+$(this).attr('id')+'_file').val($(this).val());
});
});
}, // End recreateFileField
/*-----------------------------------------------------------------------------------*/
/* Use a custom function when working with the Media Uploads popup.
/* Requires jQuery, Media Upload and Thickbox JavaScripts.
/*-----------------------------------------------------------------------------------*/
mediaUpload: function () {
jQuery.noConflict();
$( '.media_upload_button' ).removeAttr('style');
var formfield,
formID,
btnContent = true,
tbframe_interval;
// On Click
$('.media_upload_button').live("click", function () {
clickedObject = $(this);
formfield = $(this).parent().prev('input').attr('id');
formID = $(this).attr('rel');
imgID = $(this).attr('id');
//Change "insert into post" to "Use this Button"
tbframe_interval = setInterval(function() {jQuery('#TB_iframeContent').contents().find('.savesend .button').val('Use This Image');}, 2000);
// Display a custom title for each Thickbox popup.
var woo_title = '';
if ( $(this).parents('.section').find('.heading') ) { woo_title = $(this).parents('.section').find('.heading').text(); } // End IF Statement
tb_show( woo_title, 'media-upload.php?post_id='+formID+'&TB_iframe=1' );
return false;
});
window.original_send_to_editor = window.send_to_editor;
window.send_to_editor = function(html) {
if (formfield) {
//clear interval for "Use this Button" so button text resets
clearInterval(tbframe_interval);
// itemurl = $(html).attr('href'); // Use the URL to the main image.
if ( $(html).html(html).find('img').length > 0 ) {
itemurl = $(html).html(html).find('img').attr('src'); // Use the URL to the size selected.
} else {
// It's not an image. Get the URL to the file instead.
var htmlBits = html.split("'"); // jQuery seems to strip out XHTML when assigning the string to an object. Use alternate method.
itemurl = htmlBits[1]; // Use the URL to the file.
var itemtitle = htmlBits[2];
itemtitle = itemtitle.replace( '>', '' );
itemtitle = itemtitle.replace( '</a>', '' );
} // End IF Statement
var image = /(^.*\.jpg|jpeg|png|gif|ico*)/gi;
var document = /(^.*\.pdf|doc|docx|ppt|pptx|odt*)/gi;
var audio = /(^.*\.mp3|m4a|ogg|wav*)/gi;
var video = /(^.*\.mp4|m4v|mov|wmv|avi|mpg|ogv|3gp|3g2*)/gi;
if (itemurl.match(image)) {
btnContent = '<a class="of-uploaded-image" href="'+itemurl+'"><img id="image_'+imgID+'" class="of-option-image" src="'+itemurl+'" alt="" /></a>';
} else {
// No output preview if it's not an image.
// btnContent = '';
// Standard generic output if it's not an image.
html = '<a href="'+itemurl+'" target="_blank" rel="external">View File</a>';
btnContent = 'Sorry, but that is not a valid image URL';
}
$('#' + formfield).val(itemurl);
// $('#' + formfield).next().next('div').slideDown().html(btnContent);
$('#' + formfield).siblings('.screenshot').fadeIn().html(btnContent);
clickedObject.next('span').fadeIn();
tb_remove();
} else {
window.original_send_to_editor(html);
}
// Clear the formfield value so the other media library popups can work as they are meant to. - 2010-11-11.
formfield = '';
}
} // End mediaUpload
}; // End optionsframeworkMLU Object // Don't remove this, or the sky will fall on your head.
/*-----------------------------------------------------------------------------------*/
/* Execute the above methods in the optionsframeworkMLU object.
/*-----------------------------------------------------------------------------------*/
$(document).ready(function () {
optionsframeworkMLU.removeFile();
optionsframeworkMLU.recreateFileField();
optionsframeworkMLU.mediaUpload();
});
})(jQuery);

View File

@ -0,0 +1,741 @@
/**
* SMOF js
*
* contains the core functionalities to be used
* inside SMOF
*/
jQuery.noConflict();
/** Fire up jQuery - let's dance!
*/
jQuery(document).ready(function($){
//(un)fold options in a checkbox-group
jQuery('.fld').click(function() {
var $fold='.f_'+this.id;
$($fold).slideToggle('normal', "swing");
});
//delays until AjaxUpload is finished loading
//fixes bug in Safari and Mac Chrome
if (typeof AjaxUpload != 'function') {
return ++counter < 6 && window.setTimeout(init, counter * 500);
}
//hides warning if js is enabled
$('#js-warning').hide();
//Tabify Options
$('.group').hide();
// 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;
});
//Expand Options
var flip = 0;
$('#expand_options').click(function(){
if(flip == 0){
flip = 1;
$('#of_container #of-nav').hide();
$('#of_container #content').width(755);
$('#of_container .group').add('#of_container .group h2').show();
$(this).removeClass('expand');
$(this).addClass('close');
$(this).text('Close');
} else {
flip = 0;
$('#of_container #of-nav').show();
$('#of_container #content').width(595);
$('#of_container .group').add('#of_container .group h2').hide();
$('#of_container .group:first').show();
$('#of_container #of-nav li').removeClass('current');
$('#of_container #of-nav li:first').addClass('current');
$(this).removeClass('close');
$(this).addClass('expand');
$(this).text('Expand');
}
});
//Update Message popup
$.fn.center = function () {
this.animate({"top":( $(window).height() - this.height() - 200 ) / 2+$(window).scrollTop() + "px"},100);
this.css("left", 250 );
return this;
}
$('#of-popup-save').center();
$('#of-popup-reset').center();
$('#of-popup-fail').center();
$(window).scroll(function() {
$('#of-popup-save').center();
$('#of-popup-reset').center();
$('#of-popup-fail').center();
});
//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();
//AJAX Upload
function of_image_upload() {
$('.image_upload_button').each(function(){
var clickedObject = $(this);
var clickedID = $(this).attr('id');
var nonce = $('#security').val();
new AjaxUpload(clickedID, {
action: ajaxurl,
name: clickedID, // File upload name
data: { // Additional data to send
action: 'of_ajax_post_action',
type: 'upload',
security: nonce,
data: clickedID },
autoSubmit: true, // Submit file after selection
responseType: false,
onChange: function(file, extension){},
onSubmit: function(file, extension){
clickedObject.text('Uploading'); // change button text, when user selects file
this.disable(); // If you want to allow uploading only 1 file at time, you can disable upload button
interval = window.setInterval(function(){
var text = clickedObject.text();
if (text.length < 13){ clickedObject.text(text + '.'); }
else { clickedObject.text('Uploading'); }
}, 200);
},
onComplete: function(file, response) {
window.clearInterval(interval);
clickedObject.text('Upload Image');
this.enable(); // enable upload button
// If nonce fails
if(response==-1){
var fail_popup = $('#of-popup-fail');
fail_popup.fadeIn();
window.setTimeout(function(){
fail_popup.fadeOut();
}, 2000);
}
// If there was an error
else if(response.search('Upload Error') > -1){
var buildReturn = '<span class="upload-error">' + response + '</span>';
$(".upload-error").remove();
clickedObject.parent().after(buildReturn);
}
else{
var buildReturn = '<img class="hide of-option-image" id="image_'+clickedID+'" src="'+response+'" alt="" />';
$(".upload-error").remove();
$("#image_" + clickedID).remove();
clickedObject.parent().after(buildReturn);
$('img#image_'+clickedID).fadeIn();
clickedObject.next('span').fadeIn();
clickedObject.parent().prev('input').val(response);
}
}
});
});
}
of_image_upload();
//AJAX Remove Image (clear option value)
$('.image_reset_button').live('click', function(){
var clickedObject = $(this);
var clickedID = $(this).attr('id');
var theID = $(this).attr('title');
var nonce = $('#security').val();
var data = {
action: 'of_ajax_post_action',
type: 'image_reset',
security: nonce,
data: theID
};
$.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 image_to_remove = $('#image_' + theID);
var button_to_hide = $('#reset_' + theID);
image_to_remove.fadeOut(500,function(){ $(this).remove(); });
button_to_hide.fadeOut();
clickedObject.parent().prev('input').val('');
}
});
});
// Style Select
(function ($) {
styleSelect = {
init: function () {
$('.select_wrapper').each(function () {
$(this).prepend('<span>' + $(this).find('.select option:selected').text() + '</span>');
});
$('.select').live('change', function () {
$(this).prev('span').replaceWith('<span>' + $(this).find('option:selected').text() + '</span>');
});
$('.select').bind($.browser.msie ? 'click' : 'change', function(event) {
$(this).prev('span').replaceWith('<span>' + $(this).find('option:selected').text() + '</span>');
});
}
};
$(document).ready(function () {
styleSelect.init()
})
})(jQuery);
/** 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)
$(".slide_edit_button").live( 'click', function(){
$(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;
}
$('.of-slider-title').live('keyup', function(){
update_slider_title(this);
});
//Remove individual slide
$('.slide_delete_button').live('click', 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
$(".slide_add_button").live('click', function(){
var slidesContainer = $(this).prev();
var sliderId = slidesContainer.attr('id');
var sliderInt = $('#'+sliderId).attr('rel');
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="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 + '" rel="'+sliderInt+'">Upload</span><span class="button mlu_remove_button 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);
$('.temphide').fadeIn('fast', function() {
$(this).removeClass('temphide');
});
of_image_upload(); // 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
});
});
/** 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
$('#of_backup_button').live('click', 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
$('#of_restore_button').live('click', 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 */
$('#of_import_button').live('click', 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 */
$('#of_save').live('click',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();
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) {
$('.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,
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
//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', '' );
}
}
}
//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 );
});
}); //end doc ready

View File

@ -0,0 +1,761 @@
<?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];
}
/**
* Process options data and build option fields
*
* @uses get_option()
*
* @access public
* @since 1.0.0
*
* @return array
*/
public static function optionsframework_machine($options) {
$data = of_get_options();
$smof_data = of_get_options();
$defaults = array();
$counter = 0;
$menu = '';
$output = '';
foreach ($options as $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'];
}
if($smof_data){
//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 ($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
//switch statement to handle various options type
switch ( $value['type'] ) {
//text input
case 'text':
$t_value = '';
$t_value = stripslashes($smof_data[$value['id']]);
$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) {
$output .= '<option id="' . $select_ID . '" value="'.$option.'" ' . selected($smof_data[$value['id']], $option, false) . ' />'.$option.'</option>';
}
$output .= '</select></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;
//ajax image upload option
case 'upload':
if(!isset($value['mod'])) $value['mod'] = '';
$output .= Options_Machine::optionsframework_uploader_function($value['id'],$value['std'],$value['mod']);
break;
// native media library uploader - @uses optionsframework_media_uploader_function()
case 'media':
$_id = strip_tags( strtolower($value['id']) );
$int = '';
$int = optionsframework_mlu_get_silentpost( $_id );
if(!isset($value['mod'])) $value['mod'] = '';
$output .= Options_Machine::optionsframework_media_uploader_function( $value['id'], $value['std'], $int, $value['mod'] ); // New AJAX Uploader using Media Library
break;
//colorpicker option
case 'color':
$output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div style="background-color: '.$smof_data[$value['id']].'"></div></div>';
$output .= '<input class="of-color" name="'.$value['id'].'" id="'. $value['id'] .'" type="text" value="'. $smof_data[$value['id']] .'" />';
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 < 29; $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(
'Helvetica Neue'=>'Helvetica Neue',
'Verdana, Geneva'=>'Verdana, Geneva',
'Trebuchet'=>'Trebuchet',
'Georgia' =>'Georgia',
'Times New Roman'=>'Times New Roman',
'Tahoma, Geneva'=>'Tahoma, Geneva',
'Palatino'=>'Palatino' );
global $tw_googlefonts;
$facess = array_merge($faces, $tw_googlefonts);
foreach ($facess 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";
}
$header_class = str_replace(' ','',strtolower($value['name']));
$jquery_click_hook = str_replace(' ', '', strtolower($value['name']) );
$jquery_click_hook = "of-option-" . $jquery_click_hook;
$menu .= '<li class="'. $header_class .'"><a title="'. $value['name'] .'" href="#'. $jquery_click_hook .'">'. $value['name'] .'</a></li>';
$output .= '<div class="group" id="'. $jquery_click_hook .'"><h2>'.$value['name'].'</h2>'."\n";
break;
//drag & drop slide manager
case 'slider':
$_id = strip_tags( strtolower($value['id']) );
$int = '';
$int = optionsframework_mlu_get_silentpost( $_id );
$output .= '<div class="slider"><ul id="'.$value['id'].'" rel="'.$int.'">';
$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,$int);
} 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,$int);
}
}
$output .= '</ul>';
$output .= '<a href="#" class="button slide_add_button">Add New Slide</a></div>';
break;
//drag & drop block manager
case 'sorter':
$sortlists = isset($smof_data[$value['id']]) && !empty($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
$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']] : '';
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 = get_option(BACKUPS);
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 : ').'<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 = '';
}
$output .= '<p class="'.$value['id'].'_ggf_previewer google_font_preview" '. $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;
}
//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";
}
}
}
$output .= '</div>';
return array($output,$menu,$defaults);
}
/**
* Ajax image uploader - supports various types of image types
*
* @uses get_option()
*
* @access public
* @since 1.0.0
*
* @return string
*/
public static function optionsframework_uploader_function($id,$std,$mod){
$data = of_get_options();
$smof_data = of_get_options();
$uploader = '';
$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 .'" />';
$uploader .= '<div class="upload_button_div"><span class="button image_upload_button" id="'.$id.'">'._('Upload').'</span>';
if(!empty($upload)) {$hide = '';} else { $hide = 'hide';}
$uploader .= '<span class="button image_reset_button '. $hide.'" id="reset_'. $id .'" title="' . $id . '">Remove</span>';
$uploader .='</div>' . "\n";
$uploader .= '<div class="clear"></div>' . "\n";
if(!empty($upload)){
$uploader .= '<div class="screenshot">';
$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;
}
/**
* Native media library uploader
*
* @uses get_option()
*
* @access public
* @since 1.0.0
*
* @return string
*/
public static function optionsframework_media_uploader_function($id,$std,$int,$mod){
$data = of_get_options();
$smof_data = of_get_options();
$uploader = '';
$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 .'" />';
$uploader .= '<div class="upload_button_div"><span class="button media_upload_button" id="'.$id.'" rel="' . $int . '">Upload</span>';
if(!empty($upload)) {$hide = '';} else { $hide = 'hide';}
$uploader .= '<span class="button mlu_remove_button '. $hide.'" id="reset_'. $id .'" title="' . $id . '">Remove</span>';
$uploader .='</div>' . "\n";
$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_option()
*
* @access public
* @since 1.0.0
*
* @return string
*/
public static function optionsframework_slider_function($id,$std,$oldorder,$order,$int){
$data = of_get_options();
$smof_data = of_get_options();
$slider = '';
$slide = array();
$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="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 .'" rel="' . $int . '">Upload</span>';
if(!empty($val['url'])) {$hide = '';} else { $hide = 'hide';}
$slider .= '<span class="button mlu_remove_button '. $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
?>

View File

@ -0,0 +1,77 @@
<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-reset" class="of-save-popup">
<div class="of-save-reset">Options Reset</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="reset" value="<?php if(isset($_REQUEST['reset'])) echo $_REQUEST['reset']; ?>" />
<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="header">
<div class="logo">
<h2><?php echo THEMENAME; ?></h2>
<span><?php echo ('v'. THEMEVERSION); ?></span>
</div>
<div id="js-warning">Warning- This options panel will not work properly without javascript!</div>
<div class="icon-option"></div>
<div class="clear"></div>
</div>
<div id="info_bar">
<a>
<div id="expand_options" class="expand">Expand</div>
</a>
<img style="display:none" src="<?php echo ADMIN_DIR; ?>assets/images/loading-bottom.gif" class="ajax-loading-img ajax-loading-img-bottom" alt="Working..." />
<button id="of_save" type="button" class="button-primary">
<?php _e('Save All Changes');?>
</button>
</div><!--.info_bar-->
<div id="main">
<div id="of-nav">
<ul>
<?php echo $options_machine->Menu ?>
</ul>
</div>
<div id="content">
<?php echo $options_machine->Inputs /* Settings */ ?>
</div>
<div class="clear"></div>
</div>
<div class="save_bar">
<img style="display:none" src="<?php echo ADMIN_DIR; ?>assets/images/loading-bottom.gif" class="ajax-loading-img ajax-loading-img-bottom" alt="Working..." />
<button id ="of_save" type="button" class="button-primary"><?php _e('Save All Changes');?></button>
<button id ="of_reset" type="button" class="button submit-button reset-button" ><?php _e('Options Reset');?></button>
<img style="display:none" src="<?php echo ADMIN_DIR; ?>assets/images/loading-bottom.gif" class="ajax-reset-loading-img ajax-loading-img-bottom" alt="Working..." />
</div><!--.save_bar-->
</form>
<div style="clear:both;"></div>
</div><!--wrap-->

View File

@ -0,0 +1,113 @@
<?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
*
* @since 1.0.0
*/
function of_option_setup()
{
if (!of_get_options())
{
global $of_options, $options_machine;
$options_machine = new Options_Machine($of_options);
of_save_options($options_machine->Defaults);
}
}
/**
* Change activation message
*
* @since 1.0.0
*/
function optionsframework_admin_message() {
//Tweaked the message on theme activate
?>
<script type="text/javascript">
jQuery(function(){
var message = '<p>This theme comes with an <a href="<?php echo admin_url('admin.php?page=optionsframework'); ?>">options panel</a> to configure settings. This theme also supports widgets, please visit the <a href="<?php echo admin_url('widgets.php'); ?>">widgets settings page</a> to configure them.</p>';
jQuery('.themes-php #message2').html(message);
});
</script>
<?php
}
/**
* 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 = OPTIONS) {
$data = get_option($key);
$data = apply_filters('of_options_after_load', $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=OPTIONS)
{
$data = apply_filters('of_options_before_save', $data);
update_option($key, $data);
}
/**
* For use in themes
*
* @since forever
*/
$data = of_get_options();
$smof_data = of_get_options();

View File

@ -0,0 +1,71 @@
<?php
/**
* SMOF Option filters
*
* @package WordPress
* @subpackage SMOF
* @since 1.4.0
* @author Jonah Dahlquist
*/
/**
* Filter URLs from uploaded media fields and replaces them with keywords.
* This is to keep from storing the site URL in the database to make
* migrations easier.
*
* @since 1.4.0
* @param $data Options array
* @return array
*/
function of_filter_save_media_upload($data) {
foreach ($data as $key => $value) {
if (is_string($value)) {
$data[$key] = str_replace(
array(
site_url('', 'http'),
site_url('', 'https'),
),
array(
'[site_url]',
'[site_url_secure]',
),
$value
);
}
}
return $data;
}
add_filter('of_options_before_save', 'of_filter_save_media_upload');
/**
* Filter URLs from uploaded media fields and replaces the site URL keywords
* with the actual site URL.
*
* @since 1.4.0
* @param $data Options array
* @return array
*/
function of_filter_load_media_upload($data) {
if(!empty($data)) {
foreach ($data as $key => $value) {
if (is_string($value)) {
$data[$key] = str_replace(
array(
'[site_url]',
'[site_url_secure]',
),
array(
site_url('', 'http'),
site_url('', 'https'),
),
$value
);
}
}
}
return $data;
}
add_filter('of_options_after_load', 'of_filter_load_media_upload');

View File

@ -0,0 +1,253 @@
<?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;
$options_machine = new Options_Machine($of_options);
}
/**
* Create Options page
*
* @uses add_theme_page()
* @uses add_action()
*
* @since 1.0.0
*/
function optionsframework_add_admin() {
$of_page = add_menu_page( THEMENAME, 'Theme Options', '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');
add_action( "admin_print_styles-$of_page", 'optionsframework_mlu_css', 0 );
add_action( "admin_print_scripts-$of_page", 'optionsframework_mlu_js', 0 );
}
/**
* 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
*
* @uses wp_enqueue_style()
*
* @since 1.0.0
*/
function of_style_only(){
wp_enqueue_style('admin-style', ADMIN_DIR . 'assets/css/admin-style.css');
wp_enqueue_style('color-picker', ADMIN_DIR . 'assets/css/colorpicker.css');
wp_enqueue_style('jquery-ui-custom-admin', ADMIN_DIR .'assets/css/jquery-ui-custom.css');
}
/**
* Create Options page
*
* @uses add_action()
* @uses wp_enqueue_script()
*
* @since 1.0.0
*/
function of_load_only()
{
add_action('admin_head', 'smof_admin_head');
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.2.2.js', array( 'jquery' ));
wp_enqueue_script('tipsy', ADMIN_DIR .'assets/js/jquery.tipsy.js', array( 'jquery' ));
wp_enqueue_script('color-picker', ADMIN_DIR .'assets/js/colorpicker.js', array('jquery'));
wp_enqueue_script('ajaxupload', ADMIN_DIR .'assets/js/ajaxupload.js', array('jquery'));
wp_enqueue_script('cookie', ADMIN_DIR . 'assets/js/cookie.js', 'jquery');
wp_enqueue_script('smof', ADMIN_DIR .'assets/js/smof.js', array( 'jquery' ));
}
/**
* Front end inline jquery scripts
*
* @since 1.0.0
*/
function smof_admin_head() { ?>
<script type="text/javascript" language="javascript">
jQuery.noConflict();
jQuery(document).ready(function($){
// COLOR Picker
$('.colorSelector').each(function(){
var Othis = this; //cache a copy of the this variable for use inside nested function
$(this).ColorPicker({
color: '<?php if(isset($color)) echo $color; ?>',
onShow: function (colpkr) {
$(colpkr).fadeIn(500);
return false;
},
onHide: function (colpkr) {
$(colpkr).fadeOut(500);
return false;
},
onChange: function (hsb, hex, rgb) {
$(Othis).children('div').css('backgroundColor', '#' + hex);
$(Othis).next('input').attr('value','#' + hex);
}
});
}); //end color picker
}); //end doc ready
</script>
<?php }
/**
* 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'];
//echo $_POST['data'];
//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 = get_option(BACKUPS);
update_option(OPTIONS, $smof_data);
of_save_options($smof_data);
die('1');
}
elseif($save_type == 'import_options'){
$smof_data = unserialize(base64_decode($smof_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);
die('1');
}
elseif ($save_type == 'reset')
{
of_save_options($options_machine->Defaults);
die('1'); //options reset
}
die();
}

View File

@ -0,0 +1,15 @@
<?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.filters.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' );
require_once( ADMIN_PATH . 'functions/functions.mediauploader.php' );

View File

@ -0,0 +1,213 @@
<?php
/**
* WooThemes Media Library-driven AJAX File Uploader Module (2010-11-05)
*
* Slightly modified for use in the Options Framework.
*
* @since 1.0.0
*/
/**
* Sets up a custom post type to attach image to. This allows us to have
* individual galleries for different uploaders.
*/
add_action('init', 'optionsframework_mlu_init');
if ( ! function_exists( 'optionsframework_mlu_init' ) ) {
function optionsframework_mlu_init () {
register_post_type( 'options', array(
'labels' => array(
'name' => __( 'Options' ),
),
'public' => true,
'show_ui' => false,
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => false,
'supports' => array( 'title', 'editor' ),
'query_var' => false,
'can_export' => true,
'show_in_nav_menus' => false
) );
}
}
/**
* Forces insert into post
*/
add_filter( 'get_media_item_args', 'force_send' );
function force_send($args){
$args['send'] = true;
return $args;
}
/**
* Adds the Thickbox CSS file and specific loading and button images to the header
* on the pages where this function is called.
*/
if ( ! function_exists( 'optionsframework_mlu_css' ) ) {
function optionsframework_mlu_css () {
$_html = '';
$_html .= '<link rel="stylesheet" href="' . get_option('siteurl') . '/' . WPINC . '/js/thickbox/thickbox.css" type="text/css" media="screen" />' . "\n";
$_html .= '<script type="text/javascript">
var tb_pathToImage = "' . get_option('siteurl') . '/' . WPINC . '/js/thickbox/loadingAnimation.gif";
var tb_closeImage = "' . get_option('siteurl') . '/' . WPINC . '/js/thickbox/tb-close.png";
</script>' . "\n";
echo $_html;
}
}
/**
* Registers and enqueues (loads) the necessary JavaScript file for working with the
* Media Library-driven AJAX File Uploader Module.
*/
if ( ! function_exists( 'optionsframework_mlu_js' ) ) {
function optionsframework_mlu_js () {
// Registers custom scripts for the Media Library AJAX uploader.
wp_register_script( 'of-medialibrary-uploader', ADMIN_DIR .'assets/js/of-medialibrary-uploader.js', array( 'jquery', 'thickbox' ) );
wp_enqueue_script( 'of-medialibrary-uploader' );
wp_enqueue_script( 'media-upload' );
}
}
/**
* Uses "silent" posts in the database to store relationships for images.
* This also creates the facility to collect galleries of, for example, logo images.
*
* Return: $_postid.
*
* If no "silent" post is present, one will be created with the type "optionsframework"
* and the post_name of "of-$_token".
*
* Example Usage:
* optionsframework_mlu_get_silentpost ( 'of_logo' );
*/
if ( ! function_exists( 'optionsframework_mlu_get_silentpost' ) ) {
function optionsframework_mlu_get_silentpost ( $_token ) {
global $wpdb;
$_id = 0;
// Check if the token is valid against a whitelist.
// $_whitelist = array( 'of_logo', 'of_custom_favicon', 'of_ad_top_image' );
// Sanitise the token.
$_token = strtolower( str_replace( ' ', '_', $_token ) );
// if ( in_array( $_token, $_whitelist ) ) {
if ( $_token ) {
// Tell the function what to look for in a post.
$_args = array( 'post_type' => 'options', 'post_name' => 'of-' . $_token, 'post_status' => 'draft', 'comment_status' => 'closed', 'ping_status' => 'closed' );
// Look in the database for a "silent" post that meets our criteria.
$query = 'SELECT ID FROM ' . $wpdb->posts . ' WHERE post_parent = 0';
foreach ( $_args as $k => $v ) {
$query .= ' AND ' . $k . ' = "' . $v . '"';
} // End FOREACH Loop
$query .= ' LIMIT 1';
$_posts = $wpdb->get_row( $query );
// If we've got a post, loop through and get it's ID.
if ( count( $_posts ) ) {
$_id = $_posts->ID;
} else {
// If no post is present, insert one.
// Prepare some additional data to go with the post insertion.
$_words = explode( '_', $_token );
$_title = join( ' ', $_words );
$_title = ucwords( $_title );
$_post_data = array( 'post_title' => $_title );
$_post_data = array_merge( $_post_data, $_args );
$_id = wp_insert_post( $_post_data );
}
}
return $_id;
}
}
/**
* Trigger code inside the Media Library popup.
*/
if ( ! function_exists( 'optionsframework_mlu_insidepopup' ) ) {
function optionsframework_mlu_insidepopup () {
if ( isset( $_REQUEST['is_optionsframework'] ) && $_REQUEST['is_optionsframework'] == 'yes' ) {
add_action( 'admin_head', 'optionsframework_mlu_js_popup' );
add_filter( 'media_upload_tabs', 'optionsframework_mlu_modify_tabs' );
}
}
}
if ( ! function_exists( 'optionsframework_mlu_js_popup' ) ) {
function optionsframework_mlu_js_popup () {
$_of_title = $_REQUEST['of_title'];
if ( ! $_of_title ) { $_of_title = 'file'; } // End IF Statement
?>
<script type="text/javascript">
jQuery(function($) {
jQuery.noConflict();
// Change the title of each tab to use the custom title text instead of "Media File".
$( 'h3.media-title' ).each ( function () {
var current_title = $( this ).html();
var new_title = current_title.replace( 'media file', '<?php echo $_of_title; ?>' );
$( this ).html( new_title );
} );
// Change the text of the "Insert into Post" buttons to read "Use this File".
$( '.savesend input.button[value*="Insert into Post"], .media-item #go_button' ).attr( 'value', 'Use this File' );
// Hide the "Insert Gallery" settings box on the "Gallery" tab.
$( 'div#gallery-settings' ).hide();
// Preserve the "is_optionsframework" parameter on the "delete" confirmation button.
$( '.savesend a.del-link' ).click ( function () {
var continueButton = $( this ).next( '.del-attachment' ).children( 'a.button[id*="del"]' );
var continueHref = continueButton.attr( 'href' );
continueHref = continueHref + '&is_optionsframework=yes';
continueButton.attr( 'href', continueHref );
} );
});
</script>
<?php
}
}
/**
* Triggered inside the Media Library popup to modify the title of the "Gallery" tab.
*/
if ( ! function_exists( 'optionsframework_mlu_modify_tabs' ) ) {
function optionsframework_mlu_modify_tabs ( $tabs ) {
$tabs['gallery'] = str_replace( __( 'Gallery', 'optionsframework' ), __( 'Previously Uploaded', 'optionsframework' ), $tabs['gallery'] );
return $tabs;
}
}

View File

@ -0,0 +1,887 @@
<?php
add_action('init','of_options');
if (!function_exists('of_options'))
{
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;}
$categories_tmp = array_unshift($of_categories, "Select a category:");
//Access the WordPress Pages via an Array
$of_pages = array();
$of_pages_obj = get_pages('sort_column=post_parent,menu_order');
foreach ($of_pages_obj as $of_page) {
$of_pages[$of_page->ID] = $of_page->post_name; }
$of_pages_tmp = array_unshift($of_pages, "Select a page:");
//Testing
$of_layout_select = array("fullwidth" => "Fullwidth","boxed" => "Boxed Layout");
$of_options_bg_repeat = array("stretch" => "Strech Image","repeat" => "repeat","no-repeat" => "no-repeat","repeat-y" => "repeat-y","repeat-x" => "repeat-x");
$of_options_bg_size = array("auto" => "Auto","cover" => "Cover","contain" => "Contain");
$of_options_radio = array("one" => "One","two" => "Two","three" => "Three","four" => "Four","five" => "Five");
$border_width = array("1px" => "1px","2px" => "2px","3px" => "3px","4px" => "4px","5px" => "5px");
//Sample Homepage blocks for the layout manager (sorter)
$of_options_homepage_blocks = array
(
"disabled" => array (
"placebo" => "placebo", //REQUIRED!
"block_one" => "Block One",
"block_two" => "Block Two",
"block_three" => "Block Three",
),
"enabled" => array (
"placebo" => "placebo", //REQUIRED!
"block_four" => "Block Four",
),
);
//Stylesheets Reader
$alt_stylesheet_path = LAYOUT_PATH;
$alt_stylesheets = array();
if ( is_dir($alt_stylesheet_path) )
{
if ($alt_stylesheet_dir = opendir($alt_stylesheet_path) )
{
while ( ($alt_stylesheet_file = readdir($alt_stylesheet_dir)) !== false )
{
if(stristr($alt_stylesheet_file, ".css") !== false)
{
$alt_stylesheets[] = $alt_stylesheet_file;
}
}
}
}
//Background Images Reader
$bg_images_path = get_stylesheet_directory(). '/images/bg/'; // change this to where you store your bg images
$bg_images_url = get_template_directory_uri().'/images/bg/'; // change this to where you store your bg images
$bg_images = array();
if ( is_dir($bg_images_path) ) {
if ($bg_images_dir = opendir($bg_images_path) ) {
while ( ($bg_images_file = readdir($bg_images_dir)) !== false ) {
if(stristr($bg_images_file, ".png") !== false || stristr($bg_images_file, ".jpg") !== false) {
$bg_images[] = $bg_images_url . $bg_images_file;
}
}
}
}
/*-----------------------------------------------------------------------------------*/
/* TO DO: Add options/functions that use these */
/*-----------------------------------------------------------------------------------*/
//More Options
$uploads_arr = wp_upload_dir();
$all_uploads_path = $uploads_arr['path'];
$all_uploads = get_option('of_uploads');
$other_entries = array("Select a number:","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19");
$body_repeat = array("no-repeat","repeat-x","repeat-y","repeat");
$body_pos = array("top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right");
// Image Alignment radio box
$of_options_thumb_align = array("alignleft" => "Left","alignright" => "Right","aligncenter" => "Center");
// Image Links to Options
$of_options_image_link_to = array("image" => "The Image","post" => "The Post");
/*-----------------------------------------------------------------------------------*/
/* The Options Array */
/*-----------------------------------------------------------------------------------*/
// Set the Options Array
global $of_options,$tw_googlefonts;
$of_options = array();
/* ThemeWaves custom admin section started */
// General TAB
$of_options[] = array( "name" => "General",
"type" => "heading"
);
$of_options[] = array( "name" => "General",
"desc" => "",
"id" => "general_info",
"std" => "<h3 style=\"margin: 3px;\">General Options</h3>",
"icon" => true,
"type" => "info"
);
$of_options[] = array( "name" => "Page builder ?",
"desc" => "This will enable, disable PageBuilder.",
"id" => "pagebuilder",
"std" => 1,
"folds" => 1,
"type" => "switch"
);
$of_options[] = array( "name" => "Theme Layout",
"desc" => "",
"id" => "layout_theme_info",
"std" => "<h3 style=\"margin: 3px;\">Theme Layout</h3>",
"icon" => true,
"type" => "info"
);
$of_options[] = array( "name" => "Theme Layout Style",
"desc" => "Choose the Theme layout style.",
"id" => "theme_layout",
"std" => "Fullwidth",
"type" => "select",
"options" => $of_layout_select
);
$of_options[] = array( "name" => "Layout Options if boxed",
"desc" => "",
"id" => "layout_opt_boxed_info",
"std" => "<h3 style=\"margin: 3px;\">If boxed Theme Layout Style chosen.</h3>",
"icon" => true,
"type" => "info"
);
$of_options[] = array( "name" => "Background Color",
"desc" => "Choose the background color.",
"id" => "background_color",
"std" => "#d1d1d1",
"type" => "color"
);
$of_options[] = array( "name" => "Background Image",
"desc" => "This option will only works under boxed layout chosen.",
"id" => "background_image",
"std" => "",
"mod" => "min",
"type" => "upload"
);
$of_options[] = array( "name" => "Background Image Repeat",
"desc" => "Choose the repeat or stretch image option.",
"id" => "background_repeat",
"std" => "repeat",
"type" => "select",
"options" => $of_options_bg_repeat
);
$of_options[] = array( "name" => "Margin from Top",
"desc" => "Boxed Layout margin top.",
"id" => "margin_top",
"std" => "60",
"type" => "text"
);
$of_options[] = array( "name" => "Margin from Bottom",
"desc" => "Boxed Layout margin bottom.",
"id" => "margin_bottom",
"std" => "60",
"type" => "text"
);
$of_options[] = array( "name" => "Tracking",
"desc" => "",
"id" => "track_code_info",
"std" => "<h3 style=\"margin: 3px;\">Tracking</h3>",
"icon" => true,
"type" => "info"
);
$of_options[] = array( "name" => "Tracking Code",
"desc" => "Paste your Google Analytics (or other) tracking code here. This will be added into the footer template of your theme.",
"id" => "tracking_code",
"std" => "",
"type" => "textarea"
);
$of_options[] = array( "name" => "Consumer key",
"desc" => "",
"id" => "consumerkey",
"std" => "",
"type" => "text");
$of_options[] = array( "name" => "Consumer secret",
"desc" => "",
"id" => "consumersecret",
"std" => "",
"type" => "text");
$of_options[] = array( "name" => "Access token",
"desc" => "",
"id" => "accesstoken",
"std" => "",
"type" => "text");
$of_options[] = array( "name" => "Access token secret",
"desc" => "",
"id" => "accesstokensecret",
"std" => "",
"type" => "text");
// Header and Footer TAB
$of_options[] = array( "name" => "Additional",
"type" => "heading"
);
$of_options[] = array( "name" => "Page Title Background Image",
"desc" => "Inserted picture must be above 1600px width and height is atleast 120px. You can redefine or choose other option to your specific page on meta options.",
"id" => "title_bg_image",
"std" => "",
"mod" => "min",
"type" => "upload"
);
$of_options[] = array( "name" => "Featured Media section on post single?",
"desc" => "If it's On then it will be showed, Off will be hidden.",
"id" => "feature_show",
"std" => 1,
"folds" => 1,
"type" => "switch"
);
$of_options[] = array( "name" => "Post Author section on post single?",
"desc" => "If it's On then it will be showed, Off will be hidden.",
"id" => "post_author",
"std" => 1,
"folds" => 1,
"type" => "switch"
);
$of_options[] = array( "name" => "Breadcrumps?",
"desc" => "This will enable or disable Breadcrumps.",
"id" => "breadcrumps",
"std" => 0,
"folds" => 1,
"type" => "switch"
);
$of_options[] = array( "name" => "Portfolio image height",
"desc" => "Related portfolios height and Default portfolio image height.",
"id" => "port_height",
"std" => "250",
"type" => "text"
);
$of_options[] = array( "name" => "Blog Page Title",
"desc" => "Insert Title of your Blog page.",
"id" => "blog_title",
"std" => "Blog",
"type" => "text"
);
$of_options[] = array( "name" => "Blog Page Subtitle",
"desc" => "Insert Sub Title of your Blog page.",
"id" => "blog_subtitle",
"std" => "",
"type" => "text"
);
// Header and Footer TAB
$of_options[] = array( "name" => "Header and Footer",
"type" => "heading"
);
$of_options[] = array( "name" => "Header layout option",
"desc" => "",
"id" => "header_layout_info",
"std" => "<h3 style=\"margin: 3px;\">Header layout option</h3>",
"icon" => true,
"type" => "info"
);
$of_options[] = array( "name" => "Header style",
"desc" => "Choose header layout.",
"id" => "header_layout",
"std" => "Header style 1",
"type" => "select",
"options" => array(
'header_1' => 'Header style 1',
'header_2' => 'Header style 2',
'header_3' => 'Header style 3'
)
);
$of_options[] = array( "name" => "Logo option heading",
"desc" => "",
"id" => "logo_opt_info",
"std" => "<h3 style=\"margin: 3px;\">Logo options</h3>",
"icon" => true,
"type" => "info"
);
$of_options[] = array( "name" => "Upload Standard Logo",
"desc" => "Please insert your logo.",
"id" => "theme_logo",
"std" => "",
"mod" => "min",
"type" => "upload"
);
$of_options[] = array( "name" => "Logo Margin from Top",
"desc" => "Note: You need to insert only value.",
"id" => "logo_top",
"std" => "0",
"type" => "text"
);
$of_options[] = array( "name" => "Logo Margin from Bottom",
"desc" => "Note: You need to insert only value.",
"id" => "logo_bottom",
"std" => "0",
"type" => "text"
);
$of_options[] = array( "name" => "Retina Logo",
"desc" => "",
"id" => "logo_retina",
"std" => 0,
"folds" => 1,
"type" => "switch"
);
$of_options[] = array( "name" => "Upload Retina Logo (2x)",
"desc" => "Note: You retina logo must be larger than 2x. Example: Main logo 120x200 then Retina must be 240x400.",
"id" => "theme_logo_retina",
"std" => "",
"mod" => "min",
"fold" => "logo_retina", /* the checkbox hook */
"type" => "upload"
);
$of_options[] = array( "name" => "Standard Logo Width",
"desc" => "You need to insert Non retina logo width. Height auto",
"id" => "logo_width",
"std" => "",
"fold" => "logo_retina", /* the checkbox hook */
"type" => "text"
);
$of_options[] = array( "name" => "Favicon option heading",
"desc" => "",
"id" => "favicon_opt_info",
"std" => "<h3 style=\"margin: 3px;\">Favicon options</h3>",
"icon" => true,
"type" => "info"
);
$of_options[] = array( "name" => "Upload Standard Favicon",
"desc" => "Please insert your favicon 16x16 icon. You may use <a href='http://www.favicon.cc/' target='_blank'>favicon.cc</a>",
"id" => "theme_favicon",
"std" => "",
"mod" => "min",
"type" => "upload"
);
$of_options[] = array( "name" => "Retina Favicon",
"desc" => "",
"id" => "favicon_retina",
"std" => 0,
"folds" => 1,
"type" => "switch"
);
$of_options[] = array( "name" => "Favicon for iPhone (57x57)",
"desc" => "Please upload your favicon 57x57.",
"id" => "favicon_iphone",
"std" => "",
"mod" => "min",
"fold" => "favicon_retina", /* the checkbox hook */
"type" => "upload"
);
$of_options[] = array( "name" => "Retina Favicon for iPhone (114x114)",
"desc" => "Please upload your favicon 114x114.",
"id" => "favicon_iphone_retina",
"std" => "",
"mod" => "min",
"fold" => "favicon_retina", /* the checkbox hook */
"type" => "upload"
);
$of_options[] = array( "name" => "Favicon for iPad (72x72)",
"desc" => "Please upload your favicon 72x72.",
"id" => "favicon_ipad",
"std" => "",
"mod" => "min",
"fold" => "favicon_retina", /* the checkbox hook */
"type" => "upload"
);
$of_options[] = array( "name" => "Retina Favicon for iPad (144x144)",
"desc" => "Please upload your favicon 144x144.",
"id" => "favicon_ipad_retina",
"std" => "",
"mod" => "min",
"fold" => "favicon_retina", /* the checkbox hook */
"type" => "upload"
);
$of_options[] = array( "name" => "Top Bar",
"desc" => "",
"id" => "topbar_colors_main",
"std" => "<h3 style=\"margin: 3px;\">Top Bar</h3>",
"icon" => true,
"type" => "info"
);
$of_options[] = array( "name" => "Top bar",
"desc" => "Insert your social icons in Social Icons Tab.",
"id" => "top_bar",
"std" => 0,
"folds" => 1,
"type" => "switch"
);
$of_options[] = array( "name" => "Top bar text",
"desc" => "Insert your text bar content.",
"id" => "top_bar_text",
"std" => "Dynamically target high-payoff intellectual capital for customized",
"fold" => "top_bar",
"type" => "textarea"
);
$of_options[] = array( "name" => "Footer section",
"desc" => "",
"id" => "footer_section_info",
"std" => "<h3 style=\"margin: 3px;\">Footer section</h3>",
"icon" => true,
"type" => "info"
);
$of_options[] = array( "name" => "Footer Widget",
"desc" => "",
"id" => "footer_widget",
"std" => 1,
"folds" => 1,
"type" => "switch"
);
$url = ADMIN_DIR . 'assets/images/footer/';
$of_options[] = array( "name" => "Footer Layout",
"desc" => "Choose footer layout.",
"id" => "footer_layout",
"std" => "3-3-3-3",
"type" => "images",
"fold" => "footer_widget", /* the checkbox hook */
"options" => array(
'12' => $url . '1.png',
'6-6' => $url . '2.png',
'4-4-4' => $url . '3.png',
'3-3-3-3' => $url . '4.png'
)
);
$of_options[] = array( "name" => "Footer Social",
"desc" => "",
"id" => "footer_social",
"std" => 1,
"folds" => 1,
"type" => "switch"
);
$of_options[] = array( "name" => "Copyright Text",
"desc" => "Insert Copyright Text.",
"id" => "copyright_text",
"std" => "NUZI Theme by ThemeWaves.<br/> Proudly Powered by <a href='http://wordpress.org/' title='Wordpress is the Best!'>Wordpress </a>",
"type" => "textarea"
);
// Colors and Styling TAB
$of_options[] = array( "name" => "Colors and Styling",
"type" => "heading"
);
$of_options[] = array( "name" => "General",
"desc" => "",
"id" => "colors_and_styling_info",
"std" => "<h3 style=\"margin: 3px;\">General</h3>",
"icon" => true,
"type" => "info"
);
$of_options[] = array( "name" => "Primary Color",
"desc" => "Theme Primary color has all of accent colors of this theme. Default: #4da4f3",
"id" => "primary_color",
"std" => "#4da4f3",
"type" => "color"
);
$of_options[] = array( "name" => "Link Color",
"desc" => "Pick a tag color (default: #4da4f3).",
"id" => "link_color",
"std" => "#4da4f3",
"type" => "color"
);
$of_options[] = array( "name" => "Link Hover Color",
"desc" => "Pick a tag's hover color (default: #4da4f3).",
"id" => "link_hover_color",
"std" => "#4da4f3",
"type" => "color"
);
$of_options[] = array( "name" => "Header Colors",
"desc" => "",
"id" => "header_colors_info",
"std" => "<h3 style=\"margin: 3px;\">Header</h3>",
"icon" => true,
"type" => "info"
);
$of_options[] = array( "name" => "Header Background Color",
"desc" => "Pick a background color for the header (default: #fff).",
"id" => "header_background",
"std" => "#fff",
"type" => "color"
);
$of_options[] = array( "name" => "Top Bar Color",
"desc" => "",
"id" => "topbar_colors_info",
"std" => "<h3 style=\"margin: 3px;\">Top Bar Color</h3>",
"icon" => true,
"type" => "info"
);
$of_options[] = array( "name" => "Top bar Background Color",
"desc" => "Insert your top bar background color.",
"id" => "top_bar_bg",
"std" => "#fff",
"type" => "color"
);
$of_options[] = array( "name" => "Menu Colors Options",
"desc" => "",
"id" => "menu_colors_info",
"std" => "<h3 style=\"margin: 3px;\">Menu</h3>",
"icon" => true,
"type" => "info"
);
$of_options[] = array( "name" => "Menu Background Color",
"desc" => "Default: #fff",
"id" => "menu_background",
"std" => "#fff",
"type" => "color"
);
$of_options[] = array( "name" => "Menu Link Hover&Active Color",
"desc" => "Default: #282828",
"id" => "menu_hover",
"std" => "#fff",
"type" => "color"
);
$of_options[] = array( "name" => "Menu Link Hover&Active Background Color",
"desc" => "Default: #fff",
"id" => "menu_hover_background",
"std" => "#fff",
"type" => "color"
);
$of_options[] = array( "name" => "Sub Menu Background Color",
"desc" => "Default: #fff",
"id" => "submenu_bg",
"std" => "#282828",
"type" => "color"
);
$of_options[] = array( "name" => "Sub Menu Link Color",
"desc" => "Default: #fff",
"id" => "submenu_link",
"std" => "#fff",
"type" => "color"
);
$of_options[] = array( "name" => "Sub Menu Hover Background Color",
"desc" => "Default: #fff",
"id" => "submenu_hover_background",
"std" => "#282828",
"type" => "color"
);
$of_options[] = array( "name" => "Sub Menu Link Hover Color",
"desc" => "Default: #fff",
"id" => "submenu_hover",
"std" => "#4da4f3",
"type" => "color"
);
$of_options[] = array( "name" => "Body Colors",
"desc" => "",
"id" => "body_colors_info",
"std" => "<h3 style=\"margin: 3px;\">Body</h3>",
"icon" => true,
"type" => "info"
);
$of_options[] = array( "name" => "Body Background Color",
"desc" => "Pick a background color for the body (default: #fff).",
"id" => "body_background",
"std" => "#fff",
"type" => "color"
);
$of_options[] = array( "name" => "Footer Colors",
"desc" => "",
"id" => "footer_colors_info",
"std" => "<h3 style=\"margin: 3px;\">Footer</h3>",
"icon" => true,
"type" => "info"
);
$of_options[] = array( "name" => "Footer Background Color",
"desc" => "Pick a background color for the footer (default: #222222).",
"id" => "footer_background",
"std" => "#222222",
"type" => "color"
);
$of_options[] = array( "name" => "Footer Text Color",
"desc" => "Pick a footers text color (default: #8d8d8d).",
"id" => "footer_text_color",
"std" => "#8d8d8d",
"type" => "color"
);
$of_options[] = array( "name" => "Footer Link Color",
"desc" => "Pick a footers a tag color (default: #4da4f3).",
"id" => "footer_link_color",
"std" => "#4da4f3",
"type" => "color"
);
$of_options[] = array( "name" => "Footer Link Hover Color",
"desc" => "Pick a footers a tag hover color (default: #4da4f3).",
"id" => "footer_link_hover_color",
"std" => "#4da4f3",
"type" => "color"
);
// Typography TAB
$of_options[] = array( "name" => "Typography",
"type" => "heading"
);
$of_options[] = array( "name" => "Body",
"desc" => "",
"id" => "body_info",
"std" => "<h3 style=\"margin: 3px;\">Body</h3>",
"icon" => true,
"type" => "info"
);
$of_options[] = array( "name" => "Body text font",
"desc" => "Specify the body font properties",
"id" => "body_text_font",
"std" => array('size' => '13px','face' => 'Arial','style' => 'normal','color' => '#8d8d8d'),
"type" => "typography"
);
$of_options[] = array( "name" => "Widget",
"desc" => "",
"id" => "menu_link_info",
"std" => "<h3 style=\"margin: 3px;\">Menu</h3>",
"icon" => true,
"type" => "info"
);
$of_options[] = array( "name" => "Menu Link customize",
"desc" => "Specify the body font properties",
"id" => "menu_font",
"std" => array('size' => '13px','face' => 'Noto Sans','style' => 'bold','color' => '#222'),
"type" => "typography"
);
$of_options[] = array( "name" => "Widget",
"desc" => "",
"id" => "widget_info",
"std" => "<h3 style=\"margin: 3px;\">Widget</h3>",
"icon" => true,
"type" => "info"
);
$of_options[] = array( "name" => "Sidebar Widgets Title",
"desc" => "Specify the sidebar headline font properties",
"id" => "sidebar_widgets_title",
"std" => array('size' => '16px','face' => 'Noto Sans','style' => 'normal','color' => '#282828'),
"type" => "typography"
);
$of_options[] = array( "name" => "Footer Widgets Title",
"desc" => "Specify the sidebar headline font properties",
"id" => "footer_widgets_title",
"std" => array('size' => '16px','face' => 'Noto Sans','style' => 'normal','color' => '#fff'),
"type" => "typography"
);
$of_options[] = array( "name" => "Headers font styling",
"desc" => "",
"id" => "header_font_info",
"std" => "<h3 style=\"margin: 3px;\">Headlines</h3>",
"icon" => true,
"type" => "info"
);
$of_options[] = array( "name" => "Heading Font Family",
"desc" => "",
"id" => "heading_font",
"std" => "Noto Sans",
"type" => "select_google_font",
"options" => $tw_googlefonts
);
$of_options[] = array( "name" => "H1 - Specify Font Properties",
"desc" => "",
"id" => "h1_spec_font",
"std" => array('size' => '28px','color' => '#282828'),
"type" => "typography"
);
$of_options[] = array( "name" => "H2 - Specify Font Properties",
"desc" => "",
"id" => "h2_spec_font",
"std" => array('size' => '22px','color' => '#282828'),
"type" => "typography"
);
$of_options[] = array( "name" => "H3 - Specify Font Properties",
"desc" => "",
"id" => "h3_spec_font",
"std" => array('size' => '18px','color' => '#282828'),
"type" => "typography"
);
$of_options[] = array( "name" => "H4 - Specify Font Properties",
"desc" => "",
"id" => "h4_spec_font",
"std" => array('size' => '16px','color' => '#282828'),
"type" => "typography"
);
$of_options[] = array( "name" => "H5 - Specify Font Properties",
"desc" => "",
"id" => "h5_spec_font",
"std" => array('size' => '14px','color' => '#282828'),
"type" => "typography"
);
$of_options[] = array( "name" => "H6 - Specify Font Properties",
"desc" => "",
"id" => "h6_spec_font",
"std" => array('size' => '12px','color' => '#282828'),
"type" => "typography"
);
$of_options[] = array( "name" => "Google Font Subset",
"desc" => "",
"id" => "google_font_subset",
"std" => "<h3 style=\"margin: 3px;\">Google Font Subset</h3>",
"icon" => true,
"type" => "info"
);
$of_options[] = array( "name" => "Google Font Subset",
"desc" => "Some of Google fonts have additional subsets. Please insert those subsets seperated with comma (,). More information <a href='https://developers.google.com/fonts/docs/getting_started' target='_blank'>Google Font Subset</a>",
"id" => "google_font_subset",
"std" => "",
"type" => "text"
);
// Social Icons TAB
$of_options[] = array( "name" => "Social Icons",
"type" => "heading"
);
$of_options[] = array( "name" => "Social Icons heading",
"desc" => "",
"id" => "social_icons_info",
"std" => "<h3 style=\"margin: 3px;\">Inserted Social Icons will be displayed on top Header section.</h3>",
"icon" => true,
"type" => "info"
);
$of_options[] = array( "name" => "Facebook ID",
"desc" => "Enter the Facebook ID.",
"id" => "facebook_username",
"std" => "",
"type" => "text"
);
$of_options[] = array( "name" => "Flickr Username",
"desc" => "Enter the Flickr Username.",
"id" => "flickr_username",
"std" => "",
"type" => "text"
);
$of_options[] = array( "name" => "Google + ID",
"desc" => "Enter the Google + Username.",
"id" => "googleplus_username",
"std" => "",
"type" => "text"
);
$of_options[] = array( "name" => "Twitter Username",
"desc" => "Enter the Twitter Username.",
"id" => "twitter_username",
"std" => "",
"type" => "text"
);
$of_options[] = array( "name" => "Instagram Username",
"desc" => "Enter the Instagram Username.",
"id" => "instagram_username",
"std" => "",
"type" => "text"
);
$of_options[] = array( "name" => "RSS URL",
"desc" => "Enter the RSS URL.",
"id" => "rss_username",
"std" => "",
"type" => "text"
);
$of_options[] = array( "name" => "Pinterest Username",
"desc" => "Enter the Pinterest Username.",
"id" => "pinterest_username",
"std" => "",
"type" => "text"
);
$of_options[] = array( "name" => "Skype Username",
"desc" => "Enter the Skype Username.",
"id" => "skype_username",
"std" => "",
"type" => "text"
);
$of_options[] = array( "name" => "Vimeo Username",
"desc" => "Enter the Vimeo Username.",
"id" => "vimeo_username",
"std" => "",
"type" => "text"
);
$of_options[] = array( "name" => "Youtube Username",
"desc" => "Enter the Youtube Username.",
"id" => "youtube_username",
"std" => "",
"type" => "text"
);
$of_options[] = array( "name" => "Dribbble Username",
"desc" => "Enter the Dribbble Username.",
"id" => "dribbble_username",
"std" => "",
"type" => "text"
);
$of_options[] = array( "name" => "Linkedin Username",
"desc" => "Enter the Linkedin Username.",
"id" => "linkedin_username",
"std" => "",
"type" => "text"
);
// FB Twitter TAB
$of_options[] = array( "name" => "FB Twitter API",
"type" => "heading"
);
$of_options[] = array( "name" => "Facebook & Twitter",
"desc" => "",
"id" => "facebook_twitter_info",
"std" => "<h3 style=\"margin: 3px;\">Facebook Comment API section</h3>",
"icon" => true,
"type" => "info"
);
$of_options[] = array( "name" => "Facebook comment?",
"desc" => "On will be enabling facebook comment, Off will be Wordpress default comment.",
"id" => "facebook_comment",
"std" => 0,
"folds" => 1,
"type" => "switch"
);
$of_options[] = array( "name" => "Facebook api key",
"desc" => "Create your own Facebook Application and <a href='https://developers.facebook.com/apps' target='_blank'>get ID</a>.",
"id" => "facebook_app_id",
"std" => "",
"fold" => "facebook_comment", /* the checkbox hook */
"type" => "text"
);
$of_options[] = array( "name" => "Facebook & Twitter",
"desc" => "",
"id" => "facebook_twitter_info2",
"std" => "<h3 style=\"margin: 3px;\">Twitter API section (Note this will Required!)</h3>",
"icon" => true,
"type" => "info"
);
$of_options[] = array( "name" => "Consumer key",
"desc" => "You need to Create your Twitter APP and <a href='https://dev.twitter.com/apps' target='_blank'>insert the ID</a>.",
"id" => "consumerkey",
"std" => "",
"type" => "text");
$of_options[] = array( "name" => "Consumer secret",
"desc" => "",
"id" => "consumersecret",
"std" => "",
"type" => "text");
$of_options[] = array( "name" => "Access token",
"desc" => "",
"id" => "accesstoken",
"std" => "",
"type" => "text");
$of_options[] = array( "name" => "Access token secret",
"desc" => "",
"id" => "accesstokensecret",
"std" => "",
"type" => "text");
// Custom CSS TAB
$of_options[] = array( "name" => "Custom CSS",
"type" => "heading"
);
$of_options[] = array( "name" => "Custom CSS",
"desc" => "",
"id" => "custom_css_info",
"std" => "<h3 style=\"margin: 3px;\">Enter the Custom CSS of your custom Modify.</h3>",
"icon" => true,
"type" => "info"
);
$of_options[] = array( "name" => "Custom CSS",
"desc" => "Paste your own customized CSS code.",
"id" => "custom_css",
"std" => "",
"type" => "textarea"
);
// Backup Options
$of_options[] = array( "name" => "Backup Options",
"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 tranfer 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 function: of_options()
}//End chack if function exists: of_options()
?>

View File

@ -0,0 +1,84 @@
<?php
/*
Title : SMOF
Description : Slightly Modified Options Framework
Version : 1.4.4
Author : Syamil MJ
Author URI : http://aquagraphite.com
License : GPLv3 - http://www.gnu.org/copyleft/gpl.html
Credits : Thematic Options Panel - http://wptheming.com/2010/11/thematic-options-panel-v2/
KIA Thematic Options Panel - https://github.com/helgatheviking/thematic-options-KIA
Woo Themes - http://woothemes.com/
Option Tree - http://wordpress.org/extend/plugins/option-tree/
*/
/**
* Definitions
*
* @since 1.4.0
*/
$theme_version = '';
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 = get_theme_data( THEME_PATH.'/style.css' );
$theme_version = $theme_data['Version'];
$theme_name = $theme_data['Name'];
$theme_uri = $theme_data['ThemeURI'];
$author_uri = $theme_data['AuthorURI'];
}
define( 'SMOF_VERSION', '1.4.4' );
define( 'ADMIN_PATH', THEME_PATH . '/admin/' );
define( 'ADMIN_DIR', get_template_directory_uri() . '/admin/' );
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( 'OPTIONS', $theme_name.'_options' );
define( 'BACKUPS',$theme_name.'_backups' );
/**
* Required action filters
*
* @uses add_action()
*
* @since 1.0.0
*/
if (is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" ) add_action('admin_head','of_option_setup');
add_action('admin_head', 'optionsframework_admin_message');
add_action('admin_init','optionsframework_admin_init');
add_action('admin_menu', 'optionsframework_add_admin');
add_action( 'init', 'optionsframework_mlu_init');
/**
* 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');
?>