first commit

This commit is contained in:
2024-07-15 11:28:08 +02:00
commit f52d538ea5
21891 changed files with 6161164 additions and 0 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,212 @@
@mixin button_base() {
position: relative;
display: inline-block;
font-size: 11px;
line-height: 18px;
text-decoration: none;
padding: 4px 22px;
color: $dark_color;
text-transform: uppercase;
border-radius: $border_radius_small;
border-width: 1px;
border-style: solid;
outline: none;
cursor: pointer;
transition: all 200ms linear;
&:before {
position: absolute;
display: block;
width: 100%;
height: 100%;
top: 0;
left: 0;
border-radius: $border_radius_small;
background-image: linear-gradient(180deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 100%);
content: '';
}
&:hover {
&:before {
background-image: linear-gradient(0deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 100%);
}
}
&:active {
&:before {
opacity: 0;
}
}
}
@mixin button_normal() {
background: $dark_color_2;
&:hover {
background: $dark_color_2_h;
}
}
@mixin button_primary() {
background: $blue_color;
&:hover {
background: $blue_color_h;
}
}
@mixin button_success() {
background: $green_color;
&:hover {
background: $green_color_h;
}
}
@mixin button_danger() {
background: $red_color;
&:hover {
background: $red_color_h;
}
}
@mixin button_warning() {
background: $orange_color;
&:hover {
background: $orange_color_h;
}
}
@mixin secondary_button() {
color: $light_color;
border-color: $secondary_outset_1 $secondary_outset_2 $secondary_outset_2 $secondary_outset_1;
background-color: $secondary_gradint_2;
&:active {
background-color: $secondary_bg_color;
border-color: darken( $secondary_outset_2, 10%) $secondary_outset_1 $secondary_outset_1 darken( $secondary_outset_2, 10%);
}
}
@mixin input() {
font-size: 12px;
line-height: 16px;
color: $dark_color;
background-color: $bg_color;
border-radius: $border_radius_extra_small;
padding: 5px;
min-height: 28px;
border: 1px solid $border_color;
box-shadow: none;
&:focus{
border-color: darken( $border_color, 20% );
box-shadow: none;
}
}
@mixin button_icon( $icon ) {
content: $icon;
display: inline-block;
font-family: dashicons;
font-size: 16px;
font-style: normal;
font-weight: 400;
height: 18px;
line-height: 18px;
text-align: center;
text-decoration: inherit;
transition: all 200ms linear;
vertical-align: middle;
}
@mixin button_icon_before( $icon ) {
&:before {
@include button_icon( $icon );
padding: 0 5px 0 0;
}
}
@mixin button_icon_after( $icon ) {
&:after {
@include button_icon( $icon );
padding: 0 0 0 5px;
}
}
@mixin button_icon_middle( $icon ) {
&:before {
@include button_icon( $icon );
margin: 0 -5px;
}
}
@mixin link() {
display: inline-block;
text-decoration: none;
font-size: 12px;
line-height: 20px;
font-weight: bold;
color: $blue_color;
text-transform: uppercase;
transition: all 200ms linear;
&:hover {
color: $dark_color_1;
box-shadow: none;
}
&:focus,
&:active {
outline: none;
border-color: rgba(41, 143, 252, .6);
box-shadow: 0 0 2px rgba(41, 143, 252, .6);
color: $blue_color;
}
}
@mixin link_icon_before( $icon ) {
&:before {
@include button_icon( $icon );
padding: 0 5px 0 0;
color: $grey_color_4;
}
&:hover {
&:before {
color: $blue_color;
}
}
}
@mixin container() {
padding: 30px;
border: 2px solid $grey_color_2;
background: $grey_color_3;
border-radius: $border_radius_large;
}
@mixin container_heading() {
margin: -30px -30px 30px -30px;
border-radius: $border_radius_large $border_radius_large 0 0;
border-bottom: 1px solid $grey_color_2;
padding: 20px 30px;
font-weight: bold;
font-size: 16px;
line-height: 18px;
text-align: center;
background: #fff;
}
@mixin box() {
margin: 0 0 30px;
padding: 20px;
background: #fff;
box-shadow: $box_shadow_box;
border-radius: $border_radius_small;
}
@mixin box_heading() {
margin: -20px -20px 20px -20px;
border-radius: $border_radius_small $border_radius_small 0 0;
border-bottom: 1px solid $grey_color_2;
padding: 20px 30px;
font-weight: bold;
font-size: 16px;
line-height: 18px;
background: #fff;
}

View File

@@ -0,0 +1,17 @@
.cx-ui-kit{
button{
*{
pointer-events: none;
}
}
}
.cx-component{
&__content{
.cx-settings__content{
display: none;
&.show{
display: inherit;
}
}
}
}

View File

@@ -0,0 +1,86 @@
$bg_color: #f1f1f1;
$border_color: #dcdcdc;
$bg_color_2: #e5e5e5;
$primary_color: #2a90fc;
$blue_color: #298ffc;
$remove_color: #e54343;
$light_color: #ffffff;
$dark_color: #23282d;
$normal_bg_color: #e1e1e1;
$normal_gradint_1: #ffffff;
$normal_gradint_2: #f0f0f0;
$normal_outset_1: #d7d7d7;
$normal_outset_2: #b7b7b7;
$primary_bg_color: #206ff4;
$primary_gradint_1: #5fadff;
$primary_gradint_2: #2a90fc;
$primary_outset_1: #5b9add;
$primary_outset_2: #3e6a99;
$secondary_bg_color: #495159;
$secondary_gradint_1: #4c5054;
$secondary_gradint_2: #495159;
$secondary_outset_1: #777879;
$secondary_outset_2: #41464d;
$success_bg_color: #3ba956;
$success_gradint_1: #71e18f;
$success_gradint_2: #49c66a;
$success_outset_1: #49c56a;
$success_outset_2: #3a9e54;
$danger_bg_color: #c73434;
$danger_gradint_1: #f98888;
$danger_gradint_2: #e64545;
$danger_outset_1: #e54444;
$danger_outset_2: #b83636;
$warning_bg_color: #ee8425;
$warning_gradint_1: #ffcb81;
$warning_gradint_2: #faa832;
$warning_outset_1: #faa832;
$warning_outset_2: #c98627;
$dark_color_1: #23282d;
$dark_color_2: #495159;
$dark_color_2_h: #393f45;
$grey_color_1: #96989a;
$grey_color_2: #e5e5e5;
$grey_color_3: #f1f1f1;
$grey_color_4: #b4b7ba;
$blue_color: #298ffc;
$blue_color_h: #206ff4;
$green_color: #48c569;
$green_color_h: #3ba956;
$red_color: #e54343;
$red_color_h: #c73434;
$orange_color: #faa730;
$orange_color_h: #ee8425;
$border_radius_extra_small: 2px;
$border_radius_small: 4px;
$border_radius_medium: 6px;
$border_radius_large: 8px;
$box_shadow: 0 5px 13px rgba(0,0,0,.18);
$box_shadow_box: 0 8px 21px rgba(0,0,0,.1);
$light_color: #ffffff;
$dark_color: #23282d;
$switcher_bg_color: #f1f1f1;
$switcher_border_color: #dcdcdc;
$true_state_gradint_1: #71e18f;
$true_state_gradint_2: #49c66a;
$true_state_outset_1: #43b05f;
$true_state_outset_2: #3b9b54;
$false_state_gradint_1: #f98888;
$false_state_gradint_2: #e64545;
$false_state_outset_1: #e54545;
$false_state_outset_2: #c13b3b;

View File

@@ -0,0 +1,63 @@
.cx-button{
@include button_base();
&.cx-button-normal-style {
color: $dark_color;
border-color: $normal_outset_1 $normal_outset_2 $normal_outset_2 $normal_outset_1;
background-color: $normal_gradint_2;
&:active {
background-color: $normal_bg_color;
border-color: darken( $normal_outset_2, 10%) $normal_outset_1 $normal_outset_1 darken( $normal_outset_2, 10%);
}
}
&.cx-button-success-style {
color: $light_color;
border-color: $success_outset_1 $success_outset_2 $success_outset_2 $success_outset_1;
background-color: $success_gradint_2;
&:active {
background-color: $success_bg_color;
border-color: darken( $success_outset_2, 10%) $success_outset_1 $success_outset_1 darken( $success_outset_2, 10%);
}
}
&.cx-button-primary-style {
color: $light_color;
border-color: $primary_outset_1 $primary_outset_2 $primary_outset_2 $primary_outset_1;
background-color: $primary_gradint_2;
&:active {
background-color: $primary_bg_color;
border-color: darken( $primary_outset_2, 10%) $primary_outset_1 $primary_outset_1 darken( $primary_outset_2, 10%);
}
}
&.cx-button-secondary-style {
color: $light_color;
border-color: $secondary_outset_1 $secondary_outset_2 $secondary_outset_2 $secondary_outset_1;
background-color: $secondary_gradint_2;
&:active {
background-color: $secondary_bg_color;
border-color: darken( $secondary_outset_2, 10%) $secondary_outset_1 $secondary_outset_1 darken( $secondary_outset_2, 10%);
}
}
&.cx-button-danger-style{
color: $light_color;
border-color: $danger_outset_1 $danger_outset_2 $danger_outset_2 $danger_outset_1;
background-color: $danger_gradint_2;
&:active {
background-color: $danger_bg_color;
border-color: darken( $danger_outset_2, 10%) $danger_outset_1 $danger_outset_1 darken( $danger_outset_2, 10%);
}
}
&.cx-button-warning-style{
color: $light_color;
border-color: $warning_outset_1 $warning_outset_2 $warning_outset_2 $warning_outset_1;
background-color: $warning_gradint_2;
&:active {
background-color: $warning_bg_color;
border-color: darken( $warning_outset_2, 10%) $warning_outset_1 $warning_outset_1 darken( $warning_outset_2, 10%);
}
}
}

View File

@@ -0,0 +1,55 @@
.cx-checkbox-item{
width: 20px;
height: 20px;
display: inline-block;
border-radius: $border_radius_extra_small;
margin-right: 10px;
margin-bottom: 10px;
cursor: pointer;
position: relative;
background-color: $grey_color_3;
user-select: none;
transition: all 0.4s cubic-bezier(0.77, 0, 0.175, 1);
.marker{
position: absolute;
width: 20px;
height: 20px;
top: 0px;
left: 0px;
color: #fff;
font-size: 20px;
transition:inherit;
transform: scale(0);
&:before{
transition:inherit;
position: relative;
left: -1px;
}
}
}
.cx-label-content {
display: flex;
}
.cx-checkbox-input{
&[checked]{
&+.cx-checkbox-item{
background-color: $green_color;
.marker{
transform: scale(1);
}
}
}
}
.cx-checkbox-label{
font-size: 12px;
line-height: 20px;
color: $dark_color_1;
user-select: none;
&:focus{
outline: 1px solid rgba(41, 143, 252, .6);
box-shadow: 0px 0px 2px rgba(41,143,252,0.6);
}
}

View File

@@ -0,0 +1,50 @@
$font_size: 14px;
.cx-ui-colorpicker-wrapper {
.wp-picker-container {
padding: 3px;
border-radius: 3px;
.wp-color-result-text {
line-height: 18px;
text-align: right;
display: none;
}
.wp-color-result {
width: 60px;
height: 26px;
padding: 0;
border: none;
margin: 0;
box-shadow: inset 0 0 0 3px white;
border: 1px solid #d5dadf;
&:focus {
border: 1px solid #9ba7b3;
outline: none;
}
&:after {
display: none;
}
}
.wp-picker-input-wrap {
margin: 1px 0;
}
&.wp-picker-active {
.wp-color-result {
margin-right: 6px;
}
}
.iris-picker {
position: absolute;
z-index: 999;
}
}
}

View File

@@ -0,0 +1,105 @@
.cx-ui-container{
margin: 10px 0 20px 0;
}
label.cx-label{
margin: 0 0 5px 0;
display: block;
}
.cx-ui-dimensions {
max-width: 300px;
&__units {
margin-right: 20%;
display: flex;
justify-content: flex-end;
}
&__unit {
color: #c2cbd2;
cursor: pointer;
font-size: 9px;
text-transform: uppercase;
margin: 0 2px;
&.is-active {
color: #6d7882;
text-decoration: underline;
}
}
&__values {
display: flex;
border: 1px solid #a4afb7;
border-radius: 3px;
}
&__value-item {
position: relative;
width: 20%;
input {
width: 100%;
margin: 0;
border: none;
box-shadow: none;
border-right: 1px solid #a4afb7;
font-size: 12px;
&:first-child {
border-radius: 3px 0 0 3px;
}
&:focus {
border-color: none;
}
}
}
&__value-label {
width: 100%;
display: block;
position: absolute;
bottom: -18px;
font-size: 9px;
text-transform: uppercase;
text-align: center;
color: #d5dadf;
}
&__is-linked {
width: 20%;
height: 28px;
background-color: white;
text-align: center;
color: #a4afb7;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
border-radius: 0 3px 3px 0;
.link-icon {
display: none;
}
.unlink-icon {
display: block;
}
&.is-linked {
color: white;
background-color: #a4afb7;
.link-icon {
display: block;
}
.unlink-icon {
display: none;
}
}
}
}

View File

@@ -0,0 +1,325 @@
.cx-ui-iconpicker-group {
position: relative;
.full &{
max-width: 100%;
}
.fixed &{
max-width: 150px;
}
.input-group-addon {
position: absolute;
width: 20px;
height: 20px;
left: 0px;
top: 0px;
background: $grey_color_3;
font-size: 14px;
line-height: 20px;
text-align: center;
border-radius: 3px 0 0 3px;
border-right: 1px solid #dddcdc;
margin: 3px;
.fa {
line-height: 20px;
}
}
.cx-ui-text{
@include input();
padding: 0px 0px 0px 30px;
}
}
.iconpicker-popover.popover {
position: absolute;
top: 0;
left: 0;
display: none;
max-width: none;
padding: 1px;
text-align: left;
width: 242px;
background: #f0f0f0;
z-index: 999;
}
.iconpicker-popover.popover.top,
.iconpicker-popover.popover.topLeftCorner,
.iconpicker-popover.popover.topLeft,
.iconpicker-popover.popover.topRight,
.iconpicker-popover.popover.topRightCorner {
margin-top: -10px;
}
.iconpicker-popover.popover.right,
.iconpicker-popover.popover.rightTop,
.iconpicker-popover.popover.rightBottom {
margin-left: 10px;
}
.iconpicker-popover.popover.bottom,
.iconpicker-popover.popover.bottomRightCorner,
.iconpicker-popover.popover.bottomRight,
.iconpicker-popover.popover.bottomLeft,
.iconpicker-popover.popover.bottomLeftCorner {
margin-top: 10px;
}
.iconpicker-popover.popover.left,
.iconpicker-popover.popover.leftBottom,
.iconpicker-popover.popover.leftTop {
margin-left: -10px;
}
.iconpicker-popover.popover.inline {
margin: 0 0 14px 0;
position: relative;
display: inline-block;
opacity: 1;
top: auto;
left: auto;
bottom: auto;
right: auto;
max-width: 100%;
box-shadow: none;
z-index: auto;
vertical-align: top;
}
.iconpicker-popover.popover.inline > .arrow {
display: none;
}
.dropdown-menu .iconpicker-popover.inline {
margin: 0;
border: none;
}
.dropdown-menu.iconpicker-container {
padding: 0;
}
.iconpicker-popover.popover .popover-title {
padding: 14px;
font-size: 14px;
line-height: 16px;
border-bottom: 1px solid #ebebeb;
background-color: #f0f0f0;
}
.iconpicker-popover.popover .popover-title input[type=search].iconpicker-search {
margin: 0 0 2px 0;
}
.iconpicker-popover.popover .popover-title-text ~ input[type=search].iconpicker-search {
margin-top: 14px;
}
.iconpicker-popover.popover .popover-content {
padding: 0px;
text-align: center;
}
.iconpicker-popover .popover-footer {
float: none;
clear: both;
padding: 14px;
text-align: right;
margin: 0;
border-top: 1px solid #ebebeb;
background-color: #f0f0f0;
}
.iconpicker-popover .popover-footer:before,
.iconpicker-popover .popover-footer:after {
content: " ";
display: table;
}
.iconpicker-popover .popover-footer:after {
clear: both;
}
.iconpicker-popover .popover-footer .iconpicker-btn {
margin-left: 10px;
}
.iconpicker-popover .popover-footer input[type=search].iconpicker-search {
margin-bottom: 14px;
}
.iconpicker-popover.popover > .arrow,
.iconpicker-popover.popover > .arrow:after {
position: absolute;
display: block;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
}
.iconpicker-popover.popover > .arrow {
border-width: 11px;
}
.iconpicker-popover.popover > .arrow:after {
border-width: 10px;
content: "";
}
.iconpicker-popover.popover.top > .arrow,
.iconpicker-popover.popover.topLeft > .arrow,
.iconpicker-popover.popover.topRight > .arrow {
left: 50%;
margin-left: -11px;
border-bottom-width: 0;
border-top-color: #f0f0f0;
bottom: -11px;
}
.iconpicker-popover.popover.top > .arrow:after,
.iconpicker-popover.popover.topLeft > .arrow:after,
.iconpicker-popover.popover.topRight > .arrow:after {
content: " ";
bottom: 1px;
margin-left: -10px;
border-bottom-width: 0;
border-top-color: #ffffff;
}
.iconpicker-popover.popover.topLeft > .arrow {
left: 14px;
margin-left: 0;
}
.iconpicker-popover.popover.topRight > .arrow {
left: auto;
right: 14px;
margin-left: 0;
}
.iconpicker-popover.popover.right > .arrow,
.iconpicker-popover.popover.rightTop > .arrow,
.iconpicker-popover.popover.rightBottom > .arrow {
top: 50%;
left: -11px;
margin-top: -11px;
border-left-width: 0;
border-right-color: #f0f0f0;
}
.iconpicker-popover.popover.right > .arrow:after,
.iconpicker-popover.popover.rightTop > .arrow:after,
.iconpicker-popover.popover.rightBottom > .arrow:after {
content: " ";
left: 1px;
bottom: -10px;
border-left-width: 0;
border-right-color: #ffffff;
}
.iconpicker-popover.popover.rightTop > .arrow {
top: auto;
bottom: 14px;
margin-top: 0;
}
.iconpicker-popover.popover.rightBottom > .arrow {
top: 14px;
margin-top: 0;
}
.iconpicker-popover.popover.bottom > .arrow,
.iconpicker-popover.popover.bottomRight > .arrow,
.iconpicker-popover.popover.bottomLeft > .arrow {
left: 50%;
margin-left: -11px;
border-top-width: 0;
border-bottom-color: #f0f0f0;
top: -11px;
}
.iconpicker-popover.popover.bottom > .arrow:after,
.iconpicker-popover.popover.bottomRight > .arrow:after,
.iconpicker-popover.popover.bottomLeft > .arrow:after {
content: " ";
top: 1px;
margin-left: -10px;
border-top-width: 0;
border-bottom-color: #f0f0f0;
}
.iconpicker-popover.popover.bottomLeft > .arrow {
left: 14px;
margin-left: 0;
}
.iconpicker-popover.popover.bottomRight > .arrow {
left: auto;
right: 14px;
margin-left: 0;
}
.iconpicker-popover.popover.left > .arrow,
.iconpicker-popover.popover.leftBottom > .arrow,
.iconpicker-popover.popover.leftTop > .arrow {
top: 50%;
right: -11px;
margin-top: -11px;
border-right-width: 0;
border-left-color: #f0f0f0;
}
.iconpicker-popover.popover.left > .arrow:after,
.iconpicker-popover.popover.leftBottom > .arrow:after,
.iconpicker-popover.popover.leftTop > .arrow:after {
content: " ";
right: 1px;
border-right-width: 0;
border-left-color: #ffffff;
bottom: -10px;
}
.iconpicker-popover.popover.leftBottom > .arrow {
top: 14px;
margin-top: 0;
}
.iconpicker-popover.popover.leftTop > .arrow {
top: auto;
bottom: 14px;
margin-top: 0;
}
.iconpicker {
position: relative;
text-align: left;
text-shadow: none;
line-height: 0;
display: block;
margin: 0;
overflow: hidden;
}
.iconpicker * {
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
position: relative;
}
.iconpicker:before,
.iconpicker:after {
content: " ";
display: table;
}
.iconpicker:after {
clear: both;
}
.iconpicker .iconpicker-items {
position: relative;
clear: both;
float: none;
padding: 10px 0 0 10px;
background: #fff;
margin: 0;
overflow: hidden;
overflow-y: auto;
min-height: 55px;
max-height: 275px;
}
.iconpicker .iconpicker-items:before,
.iconpicker .iconpicker-items:after {
content: " ";
display: table;
}
.iconpicker .iconpicker-items:after {
clear: both;
}
.iconpicker .iconpicker-item {
float: left;
width: 28px;
height: 28px;
line-height: 28px;
margin: 0 7px 7px 0;
text-align: center;
cursor: pointer;
border-radius: 3px;
font-size: 18px;
color: #444;
box-shadow: 0 0 0 1px #dddddd;
.fa {
line-height: 28px;
}
}
.iconpicker .iconpicker-item:hover:not(.iconpicker-selected) {
background-color: #eeeeee;
}
.iconpicker .iconpicker-item.iconpicker-selected {
box-shadow: none;
background: #ddd;
}
.iconpicker-component {
cursor: pointer;
}

View File

@@ -0,0 +1,141 @@
.cx-ui-media-wrap {
.cx-upload-preview {
display: block;
margin: 0 0 5px 0;
.cx-image-wrap {
position: relative;
display: inline-block;
vertical-align: top;
width: 128px;
height: 128px;
.inner {
width: 110px;
height: 110px;
margin: 3px;
position: relative;
border: 1px solid #d5dadf;
padding: 5px;
overflow: hidden;
.preview-holder {
width: 100%;
height: 100%;
position: relative;
background: $bg_color;
box-sizing: border-box;
.centered {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
transform: translate(50%,50%);
}
img {
max-width: 100%;
height: auto;
transform: translate(-50%,-50%);
}
span {
width: auto;
height: auto;
font-size: 60px;
transform: translate(-50%,-50%);
}
}
.title {
position: absolute;
display: none;
width: 100px;
padding: 5px;
margin: 5px;
bottom: 0;
left: 0;
color: #fff;
background: #a4afb7;
text-align: center;
font-size: 11px;
overflow: hidden;
}
}
&:hover {
.inner {
border-color: #d5dadf;
}
.title {
display: block;
}
.cx-remove-image {
display: block;
}
}
}
.cx-media-thumb-sortable-placeholder {
width: 120px;
height: 120px;
margin: 3px;
vertical-align: top;
border: 1px dashed $border_color;
display: inline-block;
background-color: $bg_color;
}
}
.upload-button {
float: left;
}
.cx-remove-image {
width: 25px;
height: 25px;
color: $remove_color;
display: block;
position: absolute;
top: 5px;
right: 5px;
cursor: pointer;
text-decoration: none;
outline: 0;
display: none;
i {
width: 25px;
height: 25px;
font-size: 25px;
}
&:hover {
color: darken( $remove_color, 10% );
}
}
.cx-bgsetting {
float: left;
width: 32%;
margin-right: 1%;
&:nth-child(3n+1) {
width: 34%;
margin-right: 0;
}
select {
margin-bottom: 10px;
}
}
}
.button-default_ {
@include button_base();
@include secondary_button();
}

View File

@@ -0,0 +1,91 @@
input.cx-radio-input{
display: none;
}
.cx-radio-item{
margin-bottom: 10px;
&:last-child{
margin-bottom: 0;
}
label {
display: inline-block;
font-size: 12px;
line-height: 14px;
color: $dark_color_1;
}
span.cx-radio-item {
width: 16px;
height: 16px;
border-radius: 25px;
margin-right: 10px;
cursor: pointer;
position: relative;
background-color: white;
display: inline-block;
float: left;
box-shadow: 1px 1px 6px rgba(0, 0, 0, 0.2);
i {
width: 8px;
height: 8px;
background-color: #495159;
margin: 4px;
border-radius: 20px;
display: inline-block;
transform: scale(0);
transition: all 0.4s cubic-bezier(0.77, 0, 0.175, 1);
}
}
}
.cx-radio-item {
.cx-radio-input:checked{
& + label{
span{
i{
transform: scale(1);
}
}
}
}
}
.cx-radio-img {
float: left;
margin: 10px 5px 0 5px;
text-align: center;
max-width: 60px;
font-size: 12px;
position: relative;
.cx-lable-content {
display: flex;
flex-flow: column;
}
label{
display: inline-block;
}
img {
width: 100%;
height: auto;
margin: 0 0 5px 0;
pointer-events: none;
}
}
.cx-radio-img{
.cx-radio-input:checked{
& + label{
font-weight: bold;
.check{
display: block;
}
img{
box-shadow: 0 0 0 2px rgba(255, 254, 255, 1), 0 0 0 5px #49c66a;
}
}
}
}

View File

@@ -0,0 +1,140 @@
.cx-ui-repeater-container {
label.cx-label{
margin: 0 0 5px 0;
display: block;
}
}
.cx-ui-repeater {
&-add {
@include link();
@include link_icon_before( '\f132' );
}
&-item {
padding: 10px 10px 10px 30px;
position: relative;
}
&-remove {
position: absolute;
width: 20px;
height: 20px;
right: 18px;
top: 13px;
border-radius: 50%;
border: 1px solid currentColor;
color: red;
font-size: 18px;
line-height: 20px;
text-align: center;
cursor: pointer;
&:before {
content: "\00D7";
}
&:hover {
color: black;
}
}
}
.cx-ui-kit {
&.cx-ui-repeater-container {
@include container();
}
> label.cx-label {
@include container_heading();
}
.cx-ui-repeater {
&-item {
@include box();
}
&-actions-box {
@include box_heading();
padding: 15px 20px;
cursor: move;
position: relative;
text-align: center;
min-height: 18px;
}
&-toggle {
position: absolute;
color: $grey_color_4;
width: 20px;
height: 20px;
font-size: 22px;
line-height: 20px;
text-align: center;
vertical-align: middle;
cursor: pointer;
text-decoration: none;
box-shadow: none;
outline: none;
top: 13px;
left: 18px;
&:before {
content: "\f142";
transition: all 200ms linear;
font-family: dashicons;
vertical-align: middle;
}
&:hover {
color: $dark_color_1;
}
}
&-remove {
position: absolute;
border: none;
color: $grey_color_4;
font-size: 20px;
line-height: 20px;
width: 20px;
height: 20px;
text-align: center;
vertical-align: middle;
text-decoration: none;
box-shadow: none;
outline: none;
top: 13px;
right: 18px;
&:before {
content: "\f158";
transition: all 200ms linear;
font-family: dashicons;
vertical-align: middle;
}
&:hover {
color: $dark_color_1;
}
}
&-title{
width: 70%;
overflow: hidden;
text-overflow: ellipsis;
display: inline-block;
font-size: 14px;
}
&-add {
&:focus {
outline: none;
box-shadow: none;
}
}
}
.cx-ui-repeater-min {
padding-bottom: 0;
> .cheryr-ui-repeater-content-box {
display: none;
}
> .cx-ui-repeater-actions-box {
margin-bottom: 0;
border-bottom: none;
background: none;
.cx-ui-repeater-toggle {
&:before {
content: "\f140";
}
}
}
}
}

View File

@@ -0,0 +1,134 @@
select.cx-ui-select{
width: 100%;
outline: 0 none;
@include input();
&:focus{
box-shadow: none;
}
}
select.select2-hidden-accessible{
display: none;
}
.cx-ui-select-wrapper {
.select2{
color: $dark_color;
background-color: white;
border-radius: $border_radius_extra_small;
border: 1px solid $border_color;
.selection{
.select2-selection{
&.select2-selection--single{
background-color: transparent;
border: none;
border-radius: $border_radius_extra_small;
height: 28px;
.select2-selection__rendered{
padding: 5px;
font-size: 12px;
line-height: 18px;
}
.select2-selection__arrow{
height: 24px;
}
}
&.select2-selection--multiple{
background-color: transparent;
border: none;
border-radius: $border_radius_extra_small;
min-height: 25px;
.select2-selection__rendered{
font-size: 12px;
line-height: 14px;
padding: 0;
display: block;
&:focus {
outline: none;
}
.select2-selection__choice{
line-height: 14px;
margin: 2px;
border: none;
background-color: #e4e4e4;
border-radius: $border_radius_extra_small;
color: darken( $dark_color, 50% );
padding: 4px;
.select2-selection__choice__remove{
color: $remove_color;
margin-right: 5px;
font-size: 14px;
}
}
.select2-selection__clear{
}
.select2-search{
margin: 0;
.select2-search__field{
padding: 0;
border: none;
box-shadow: none;
line-height: 19px;
}
}
}
}
}
}
}
.select2-container{
.select2-dropdown{
background-color: white;
border: 1px solid $border_color;
border-radius: $border_radius_extra_small;
box-shadow: 0px 5px 21px rgba(0,0,0,0.1);
margin-top: 1px;
z-index: 500001;
.select2-search__field{
border: 1px solid $border_color;
box-shadow: none;
border-radius: $border_radius_extra_small;
margin: 0;
height: 25px;
&:focus{
outline: none;
}
}
.select2-results {
.select2-results__options{
.select2-results__option{
&[aria-selected=true]{
color: darken( $dark_color, 50% );
background-color: $dark_color;
}
&--highlighted{
color: #fff;
background-color: $primary_color;
}
}
.li[aria-disabled=true]{
display: none;
}
}
}
}
}
}

View File

@@ -0,0 +1,106 @@
.cx-slider-wrap{
display: flex;
flex-wrap: wrap;
.cx-slider-input{
flex: 0 1 10%;
min-width: 100px;
max-width: 200px;
}
.cx-slider-holder{
flex: 0 1 90%;
min-width: 200px;
max-width: 300px;
margin-right: 10px;
input[type=range] {
-webkit-appearance: none;
width: 100%;
margin: 10px 0;
}
input[type=range]:focus {
outline: none;
}
input[type=range]::-webkit-slider-runnable-track {
width: 100%;
height: 5px;
cursor: pointer;
box-shadow: none;
background: #a4afb7;
border-radius: 25px;
border: none;
}
input[type=range]::-webkit-slider-thumb {
box-shadow: 1px 1px 6px rgba(0, 0, 0, 0.3);
height: 16px;
width: 16px;
margin-top: -6px;
border-radius: 15px;
background: white;
cursor: pointer;
-webkit-appearance: none;
transition: all 250ms cubic-bezier(0.645, 0.045, 0.355, 1);
}
input[type=range]:focus::-webkit-slider-runnable-track {
background: #a4afb7;
}
input[type=range]::-moz-range-track {
width: 100%;
height: 5px;
cursor: pointer;
box-shadow: none;
background: #a4afb7;
border-radius: 25px;
border: none;
}
input[type=range]::-moz-range-thumb {
box-shadow: none;
border: none;
height: 16px;
width: 16px;
border-radius: 15px;
background: #a4afb7;
cursor: pointer;
}
input[type=range]::-ms-track {
width: 100%;
height: 10px;
cursor: pointer;
background: $grey_color_3;
border-color: transparent;
color: transparent;
}
input[type=range]::-ms-fill-lower {
background: $grey_color_3;
border: none;
border-radius: 50px;
box-shadow: none;
}
input[type=range]::-ms-fill-upper {
background: $green_color;
border: none;
border-radius: 50px;
box-shadow: none;
}
input[type=range]::-ms-thumb {
box-shadow: none;
border: none;
height: 10px;
width: 10px;
border-radius: 15px;
background: #495159;
cursor: pointer;
}
input[type=range]:focus::-ms-fill-lower {
background: $grey_color_3;
}
input[type=range]:focus::-ms-fill-upper {
background: $green_color;
}
}
.cx-input{
margin: 0;
width: 100%;
}
}

View File

@@ -0,0 +1,13 @@
.cx-ui-stepper{
position: relative;
max-width: 100px;
input[type=number]{
@include input();
}
}
.cx-ui-stepper-input{
min-width: 70px;
max-width: 70px;
text-align: left;
}

View File

@@ -0,0 +1,110 @@
.cx-switcher-wrap {
width: 54px;
height: 20px;
position: relative;
cursor: pointer;
user-select: none;
background-color: white;
display: flex;
flex-flow: row nowrap;
justify-content: center;
align-items: center;
transform: translateZ(0);
.bg-cover {
display: block;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #eceeef;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12), inset 0 0 2px rgba(0, 0, 0, 0.15);
pointer-events: none;
border-radius: 25px;
content: '';
z-index: 1;
transition: all 0.4s ease;
transform: translateZ(0);
}
label {
display: block;
z-index: 2;
span {
font-size: 7px;
line-height: 12px;
text-transform: uppercase;
color: #a4afb7;
text-align: center;
display: block;
opacity: 1;
transition: all 0.4s ease;
}
}
.sw-enable {
padding: 4px 4px 5px 12px;
span {
opacity: 0;
}
}
.sw-disable {
padding: 4px 12px 5px 4px;
span {
opacity: 1;
}
}
.state-marker {
background-color: white;
display: block;
position: absolute;
width: 18px;
height: 18px;
margin: 1px;
top: 0;
left: 0;
border-radius: 50%;
transition: all 0.4s cubic-bezier(0.77, 0, 0.175, 1);
box-sizing: border-box;
z-index: 3;
}
.cx-input-switcher {
display: none;
}
.cx-input-switcher-true:checked {
~ .sw-enable{
span{
opacity: 1;
color: white;
text-shadow: 0 1px rgba(0, 0, 0, 0.2);
}
}
~ .sw-disable{
span{
opacity: 0;
}
}
~ .state-marker {
left: 100%;
margin-left: -19px;
}
~ .bg-cover {
background-color: #49c66a;
}
}
}

View File

@@ -0,0 +1,3 @@
input.cx-ui-text{
@include input();
}

View File

@@ -0,0 +1,5 @@
textarea.cx-ui-textarea{
width: 100%;
@include input();
height: 100px;
}

View File

@@ -0,0 +1,548 @@
$color-1: #fff; // Background color.
$widget-bg: #495159; // Background color in widgets.
$color-2: #efefef; // Background color.
$color-3: #96989a; // Description color and tabs button text color.
$color-4: #b4b7ba; //
$color-5: #f1f1f1; // Scrollbar background
$color-6: #e5e5e5; // Hover scrollbar background
$color-7: #206ff4; // Scrollbar track background
$link-color: #298ffc; // link color.
$link-hover-color: #23282d; // link hover color.
$shadow: 0px 5px 21px rgba(0, 0, 0, 0.1); //Shadow.
$border: 1px solid rgba(0, 0, 0, 0.1) ;
$br-radius: 5px; // Border radius.
$padding: 5px;
$margin: 10px;
$max-height: 700px;
@import "components/use-in-js";
@import "components/variables";
@import "components/mixins";
@import "controls/button";
@import "controls/checkbox";
@import "controls/colorpicker";
@import "controls/iconpicker";
@import "controls/media";
@import "controls/radio";
@import "controls/repeater";
@import "controls/select";
@import "controls/slider";
@import "controls/stepper";
@import "controls/switcher";
@import "controls/text";
@import "controls/textarea";
@import "controls/dimensions";
.cherry-ui-container{
margin: 10px 0 20px 0
}
label.cherry-label{
margin: 0 0 5px 0;
display: block;
}
.hide{
display: none !important;
}
.cx-ui-kit{
font-size: 13px;
h1{
font-weight: 700;
line-height: 1.2em;
margin: 0;
.dashicons{
font-size: 3em;
line-height: inherit;
width: 20px;
margin: 0 $margin * 2 0 $margin * -0.5;
}
}
h2{
font-weight: 600;
font-size: 1.538em;
line-height: 1.538em;
.dashicons{
font-size: 2em;
line-height: inherit;
width: 20px;
margin-right: $margin * 2;
}
}
h3{
font-weight: 600;
font-size: 1.231em;
line-height: 1.231em;
.dashicons{
font-size: 1.7em;
line-height: inherit;
margin-right: $margin * 0.5;
}
}
h4{
font-weight: 500;
font-size: 1.077em;
line-height: 1.077em;
}
h5{
font-weight: 500;
font-size: 1.077em;
line-height: 1.077em;
}
h6{
font-weight: 400;
font-size: 1em;
line-height: 1em;
}
a{
color: $link-color;
text-decoration: none;
&:hover{
color: $link-hover-color;
}
&:focus{
outline: 1px solid rgba(41, 143, 252, .6);
box-shadow: 0px 0px 2px rgba(41,143,252,0.6);
}
}
&__description{
font-size: 0.9em;
color: $color-3;
margin: $margin 0;
}
&__title{
margin: $margin*2 0;
}
&.hide{
display: none;
}
}
.cx-control + .cx-control, .cx-settings + .cx-control{
border-top: $border;
}
.cx-section{
padding: $padding;
background-color: $color-1;
margin-left: -10px;
&__title, &__description{
margin: $margin 0 0 0;
}
& + .cx-ui-kit {
border-top: $border;
}
@media ( min-width: 783px ) {
box-shadow:$shadow;
border-radius: $br-radius;
border: $border;
padding: $padding * 1.5;
margin: $margin * 1.5 $margin * 1.5 0 0;
&__holder{
background-color: $color-2;
border-radius: $br-radius;
padding: $padding * 1.5;
}
&__inner{
}
&__info{
background-color: $color-1;
border-radius: $br-radius;
padding: $padding * 1.5;
box-shadow: $shadow;
margin-bottom: $padding * 1.5;
}
.cx-settings{
box-shadow: $shadow;
border-radius: $br-radius;
border: $border;
background-color: $color-1;
margin-top: $padding * 1.5;
&:first-child{
margin-top: 0;
}
}
}
@media ( min-width: 961px ) {
padding: $padding * 3;
margin: $margin * 2 $margin * 2 0 0;
&__info{
padding: $padding * 3;
margin-bottom: $padding * 3;
}
&__holder{
padding: $padding * 3;
}
.cx-settings{
margin-top: $padding * 3;
}
}
}
.cx-component{
padding: $padding * 2 0;
@media ( min-width: 783px ) {
padding: $padding * 1.5;
}
@media ( min-width: 961px ) {
padding: $padding * 3;
}
& + * {
border-top: $border;
}
&__title{
margin-top: 0;
}
& &__content{
.cx-settings{
padding: 0;
border-top: none;
}
}
&__button{
display: block;
min-height: 45px;
.cx-ui-kit__title {
color: inherit;
}
&.active, &:hover{
color: $link-color;
transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
}
&:focus{
outline: none;
box-shadow: inset 0px 0px 10px rgba(41,143,252,0.5);
transition-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
transition: all 300ms cubic-bezier(0.55, 0.055, 0.675, 0.19);
}
&.cx-accordion, &.cx-toggle{
.cx-component__button{
width: 100%;
padding: $padding * 1.5 $padding * 2;
border:0;
background: none;
cursor: pointer;
position: relative;
.widget &{
background-color: $widget-bg;
color: $color-1;
}
.cx-toggle__title {
font-weight: 700;
font-size: 14px;
float: left;
margin: 0;
}
>span[class*="icon"]{
position: absolute;
top: 50%;
right: 5px;
margin-top: -10px;
font-size: 25px;
color: $color-4;
padding: 5px 5px;
width: 10px;
height: 9px;
text-align: left;
overflow: hidden;
.widget &{
color: $color-1;
}
&.hide-icon{
&:before{
position: relative;
top: -8px;
left: -9px;
}
transform:scaleX(1);
transition: all 300ms cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
&.show-icon{
&:before{
position: relative;
top: -7px;
left: -9px;
}
transform:scaleX(0);
transition: all 300ms cubic-bezier(0.215, 0.61, 0.355, 1);
}
}
&.active{
>span[class*="icon"]{
&.show-icon{
transform:scaleX(1);
transition-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
&.hide-icon{
transform:scaleX(0);
transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
}
}
}
}
.cx-component__button + .cx-settings__content{
border-top: $border;
}
> .cx-ui-kit__content{
& > .cx-settings + .cx-settings{
margin-top: $margin;
}
> .cx-settings{
box-shadow:$shadow;
border-radius: $br-radius;
border: $border;
.widget &{
box-shadow:none;
border-radius: 0;
border-left: 0;
border-right: 0;
}
}
}
}
&.cx-tab{
.cx-tab__tabs{
display: flex;
flex-flow: row wrap;
justify-content: flex-start;
align-items: flex-start;
align-content: flex-start;
border-bottom: $border;
.cx-component__button{
order: 0;
flex: 0 1 100%;
align-self: auto;
padding: $padding * 1.5 $padding * 2;
border: 0;
background: none;
cursor: pointer;
&.active{
-ms-box-shadow: inset 0px -3px 0px 0px $link-color;
box-shadow: inset 0px -3px 0px 0px $link-color;
}
.cx-tab__title {
font-weight: 700;
font-size: 14px;
float: left;
margin: 0;
}
& + button{
border-top: $border;
}
}
}
.cx-tab__body{
box-shadow:$shadow;
border-radius: $br-radius;
border: $border;
background-color: $color-1;
.cx-settings{
box-shadow: none;
border-radius: 0;
border: none;
background-color: inherit;
margin: 0;
}
}
@media ( min-width: 783px ) {
.cx-tab__tabs{
border: solid 1px rgba(0,0,0,0.1);
.cx-component__button{
& + button{
border-top: none;
}
}
}
.cx-tab__body{
border: none;
.cx-tab__content{
border: $border;
}
}
&--horizontal{
>.cx-tab__body{
border-radius: none;
>.cx-tab__tabs{
flex-wrap: nowrap;
flex-direction: row;
border-radius:$br-radius $br-radius 0 0;
border-bottom: none;
.cx-component__button{
flex: 0 1 auto;
}
}
>.cx-tab__content{
border-radius: 0 0 $br-radius $br-radius;
}
}
}
&--vertical{
>.cx-tab__body{
display: flex;
border-radius: none;
>.cx-tab__tabs{
flex-direction: row;
-webkit-box-flex: 0;
flex: 0 1 20%;
border-radius:$br-radius 0 0 $br-radius;
border-right: none;
.cx-component__button{
text-align: right;
.cx-tab__title {
width: 100%;
}
&.active{
box-shadow: inset -3px 0px 0px $link-color;
}
}
}
>.cx-tab__content{
-webkit-box-flex: 0;
flex: 0 1 80%;
border-radius: 0 $br-radius $br-radius 0;
}
}
}
}
@media ( min-width: 1200px ) {
&--vertical{
.cx-tab__tabs{
flex: 0 1 20%;
}
.cx-tab__content{
flex: 0 1 80%;
}
}
}
}
.widget &{
padding: 0;
&__content{
margin: 0 $margin * -1.5 $margin * 2;
.cx-control{
padding: $padding * 1.5 $padding * 2;
}
}
}
}
.cx-settings{
& + & {
border-top: $border;
}
& &__title{
margin-bottom: $margin;
}
&__description, & &__title{
margin-left: $margin;
@media ( min-width: 783px ) {
margin-left: $margin * 1.5;
}
@media ( min-width: 961px ) {
margin-left: $margin * 3;
}
}
}
.cx-control {
padding: $padding * 1.5 $padding * 2;
&__title{
margin: 0 0 $margin 0 ;
}
&__description{
margin-top: 0;
}
.cx-ui-container {
margin: 0;
}
@media (min-width: 783px) {
padding: $padding * 1.5;
display: flex;
flex-flow: row nowrap;
&__info{
-webkit-box-flex: 0;
flex: 0 1 30%;
padding-right: $padding * 1.5;
}
&__content{
-webkit-box-flex: 0;
flex: 0 1 70%;
}
}
@media ( min-width: 961px ) {
padding: $padding * 3;
}
.widget & {
padding: $padding * 1.5 0;
flex-direction: column;
&__content{
-webkit-box-flex: 0;
flex: 0 1 100%;
}
&__info{
-webkit-box-flex: 0;
flex: 0 1 100%;
padding-right: 0;
}
}
&-hidden {
display: none;
}
}
.cx-section.cx-scroll > .cx-section__holder > .cx-section__inner,
.cx-tab__content > .cx-scroll,
.cx-accordion__content > .cx-scroll > .cx-settings__content,
.cx-toggle__content > .cx-scroll > .cx-settings__content {
@media ( min-width: 783px ) {
max-height: $max-height;
overflow-y: auto;
position: relative;
&::-webkit-scrollbar {
width: 10px;
height: 10px;
&-button {
width: 0px;
height: 0px;
}
&-thumb {
background-color: $link-color;
border: none;
border-radius: $br-radius;
&:hover, &:active {
background: $color-7;
}
}
&-track {
background-color: $color-1;
border: none;
border-radius: $br-radius;
}
&-corner {
background: transparent;
}
}
}
}

View File

@@ -0,0 +1,589 @@
<?php
/**
* Interface Builder module
*
* Version: 1.1.1
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
if ( ! class_exists( 'CX_Interface_Builder' ) ) {
/**
* Class Cherry Interface Builder.
*
* @since 1.0.0
*/
class CX_Interface_Builder {
/**
* Module directory path.
*
* @since 1.5.0
* @access protected
* @var srting.
*/
protected $path;
/**
* Module directory URL.
*
* @since 1.5.0
* @access protected
* @var srting.
*/
protected $url;
/**
* Module version
*
* @var string
*/
protected $version = '1.1.1';
/**
* Conditions
*
* @var array
*/
public $conditions = array();
/**
* [$conditions description]
* @var array
*/
public $fields_value = array();
/**
* Module settings.
*
* @since 1.0.0
* @access private
* @var array
*/
private $args = array(
'path' => '',
'url' => '',
'views' => array(
'section' => 'views/section.php',
'component-tab-vertical' => 'views/component-tab-vertical.php',
'component-tab-horizontal' => 'views/component-tab-horizontal.php',
'component-toggle' => 'views/component-toggle.php',
'component-accordion' => 'views/component-accordion.php',
'component-repeater' => 'views/component-repeater.php',
'settings' => 'views/settings.php',
'control' => 'views/control.php',
'settings-children-title' => 'views/settings-children-title.php',
'tab-children-title' => 'views/tab-children-title.php',
'toggle-children-title' => 'views/toggle-children-title.php',
'form' => 'views/form.php',
'html' => 'views/html.php',
),
'views_args' => array(
'parent' => '',
'type' => '',
'view' => '',
'view_wrapping' => true,
'html' => '',
'scroll' => false,
'title' => '',
'description' => '',
'condition' => array(),
),
);
/**
* A reference to an instance of this class.
*
* @since 1.0.0
* @access private
* @var object
*/
private static $instance = null;
/**
* UI element instance.
*
* @since 1.0.0
* @access public
* @var object
*/
public $controls = null;
/**
* The structure of the interface elements.
*
* @since 1.0.0
* @access private
* @var array
*/
private $structure = array();
/**
* Dependencies array
* @var array
*/
private $deps = array(
'css' => array(),
'js' => array( 'jquery' ),
);
/**
* Cherry_Interface_Builder constructor.
*
* @since 1.0.0
* @access public
* @return void
*/
public function __construct( array $args = array() ) {
$this->path = $args['path'];
$this->url = $args['url'];
$this->args = array_merge(
$this->args,
$args
);
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );
require trailingslashit( $this->path ) . 'inc/class-cx-controls-manager.php';
$this->controls = new CX_Controls_Manager( $this->path, $this->url );
}
/**
* Register element type section.
*
* @since 1.0.0
* @access public
* @param array $args Options section.
* @return void
*/
public function register_section( array $args = array() ) {
$this->add_new_element( $args, 'section' );
}
/**
* Register element type component.
*
* @since 1.0.0
* @access public
* @param array $args Options component.
* @return void
*/
public function register_component( array $args = array() ) {
$this->add_new_element( $args, 'component' );
}
/**
* Register element type settings.
*
* @since 1.0.0
* @access public
* @param array $args Options settings.
* @return void
*/
public function register_settings( array $args = array() ) {
$this->add_new_element( $args, 'settings' );
}
/**
* Register element type control.
*
* @since 1.0.0
* @access public
* @param array $args Options control.
* @return void
*/
public function register_control( array $args = array() ) {
$this->add_new_element( $args, 'control' );
}
/**
* Register element type form.
*
* @since 1.0.0
* @access public
* @param array $args Options form.
* @return void
*/
public function register_form( array $args = array() ) {
$this->add_new_element( $args, 'form' );
}
/**
* Register element type html.
*
* @since 1.0.0
* @access public
* @param array $args Options control.
* @return void
*/
public function register_html( array $args = array() ) {
$this->add_new_element( $args, 'html' );
}
/**
* This function adds a new element to the structure.
*
* @since 1.0.0
* @access protected
* @param array $args Options new element.
* @param string $type Type new element.
* @return void
*/
protected function add_new_element( array $args = array(), $type = 'section' ) {
if ( ! isset( $args[0] ) && ! is_array( current( $args ) ) ) {
if ( 'control' !== $type && 'component' !== $type ) {
$args['type'] = $type;
}
if ( ! isset( $args['name'] ) && isset( $args['id'] ) ) {
$args['name'] = $args['id'];
}
if ( 'control' === $type ) {
$instance = $this->controls->register_control( $args['type'], $args );
$args['instance'] = $instance;
$this->add_dependencies( $instance );
}
if ( array_key_exists( 'conditions', $args ) ) {
$this->conditions[ $args['id'] ] = $args['conditions'];
}
if ( array_key_exists( 'value', $args ) ) {
$this->fields_value[ $args['id'] ] = $args['value'];
}
$this->structure[ $args['id'] ] = $args;
} else {
foreach ( $args as $key => $value ) {
if ( 'control' !== $type && 'component' !== $type ) {
$value['type'] = $type;
}
if ( ! isset( $value['id'] ) ) {
$value['id'] = $key;
}
if ( ! isset( $value['name'] ) ) {
$value['name'] = $key;
}
if ( 'control' === $type ) {
$instance = $this->controls->register_control( $value['type'], $value );
$value['instance'] = $instance;
$this->add_dependencies( $instance );
}
if ( array_key_exists( 'conditions', $value ) ) {
$this->conditions[ $key ] = $value['conditions'];
}
if ( array_key_exists( 'value', $value ) ) {
$this->fields_value[ $key ] = $value['value'];
}
$this->structure[ $key ] = $value;
}
}
}
/**
* Add control dependencies to global builder deps
*
* @param [type] $control [description]
*/
protected function add_dependencies( $control ) {
if ( ! $control instanceof CX_Controls_Base ) {
return;
}
$this->deps['js'] = array_merge( $this->deps['js'], $control->get_script_depends() );
$this->deps['css'] = array_merge( $this->deps['css'], $control->get_style_depends() );
$constrol_settings = $control->get_settings();
if ( 'repeater' === $constrol_settings['type'] && ! empty( $constrol_settings['fields'] ) ) {
foreach ( $constrol_settings['fields'] as $field ) {
$child_instance = $this->controls->register_control( $field['type'], $field );
if ( $child_instance ) {
$this->deps['js'] = array_merge( $this->deps['js'], $child_instance->get_script_depends() );
$this->deps['css'] = array_merge( $this->deps['css'], $child_instance->get_style_depends() );
}
}
}
}
/**
* Sorts the elements of the structure, adding child items to the parent.
*
* @since 1.0.0
* @access protected
* @param array $structure The original structure of the elements.
* @param string $parent_key The key of the parent element.
* @return array
*/
protected function sort_structure( array $structure = array(), $parent_key = null ) {
$new_array = array();
foreach ( $structure as $key => $value ) {
if (
( null === $parent_key && ! isset( $value['parent'] ) )
|| null === $parent_key && ! isset( $structure[ $value['parent'] ] )
|| ( isset( $value['parent'] ) && $value['parent'] === $parent_key )
) {
$new_array[ $key ] = $value;
$children = $this->sort_structure( $structure, $key );
if ( ! empty( $children ) ) {
$new_array[ $key ]['children'] = $children;
}
}
}
return $new_array;
}
/**
* Reset structure array.
* Call this method only after render.
*
* @since 1.0.1
* @return void
*/
public function reset_structure() {
$this->structure = array();
}
/**
* Get view for interface elements.
*
* @since 1.0.0
* @access protected
* @param string $type View type.
* @param array $args Input data.
* @return string
*/
protected function get_view( $type = 'control', array $args = array() ) {
if ( empty( $args['view'] ) ) {
$path = ( array_key_exists( $type, $this->args['views'] ) ) ? $this->args['views'][ $type ] : $this->args['views']['control'];
$path = is_array( $path ) ? $path[0] : $path;
$path = file_exists( $path ) ? $path : $this->path . $path;
} else {
$path = $args['view'];
}
ob_start();
include $path;
return ob_get_clean();
}
/**
* Render HTML elements.
*
* @since 1.0.0
* @access public
* @param bool $echo Input data.
* @param array $args The original structure of the elements.
* @return string
*/
public function render( $echo = true, array $args = array() ) {
if ( empty( $args ) ) {
$args = $this->structure;
}
if ( empty( $args ) ) {
return false;
}
$sorted_structure = $this->sort_structure( $args );
$output = $this->build( $sorted_structure );
$output = str_replace( array( "\r\n", "\r", "\n", "\t" ), '', $output );
$this->reset_structure();
return $this->output_method( $output, $echo );
}
/**
* Render HTML elements.
*
* @since 1.0.0
* @access protected
* @param array $args Input data.
* @return string
*/
protected function build( array $args = array() ) {
$output = '';
$views = $this->args['views'];
foreach ( $args as $key => $value ) {
$value = wp_parse_args(
$value,
$this->args['views_args']
);
$value['class'] = isset( $value['class'] ) ? $value['class'] . ' ' : '';
$value['class'] .= $value['id'] . ' ';
if ( $value['scroll'] ) {
$value['class'] .= 'cx-scroll ';
}
$type = array_key_exists( $value['type'], $views ) ? $value['type'] : 'field';
$has_child = isset( $value['children'] ) && is_array( $value['children'] ) && ! empty( $value['children'] );
switch ( $type ) {
case 'component-tab-vertical':
case 'component-tab-horizontal':
if ( $has_child ) {
$value['tabs'] = '';
foreach ( $value['children'] as $key_children => $value_children ) {
$value['tabs'] .= $this->get_view( 'tab-children-title', $value_children );
unset( $value['children'][ $key_children ]['title'] );
}
}
break;
case 'component-toggle':
case 'component-accordion':
if ( $has_child ) {
foreach ( $value['children'] as $key_children => $value_children ) {
$value['children'][ $key_children ]['title_in_view'] = $this->get_view( 'toggle-children-title', $value_children );
}
}
break;
case 'settings':
if ( isset( $value['title'] ) && $value['title'] ) {
$value['title'] = isset( $value['title_in_view'] ) ? $value['title_in_view'] : $this->get_view( 'settings-children-title', $value );
}
break;
case 'html':
$value['children'] = $value['html'];
break;
case 'form':
$value['accept-charset'] = isset( $value['accept-charset'] ) ? $value['accept-charset'] : 'utf-8';
$value['action'] = isset( $value['action'] ) ? $value['action'] : '' ;
$value['autocomplete'] = isset( $value['autocomplete'] ) ? $value['autocomplete'] : 'on';
$value['enctype'] = isset( $value['enctype'] ) ? $value['enctype'] : 'application/x-www-form-urlencoded';
$value['method'] = isset( $value['method'] ) ? $value['method'] : 'post';
$value['novalidate'] = ( isset( $value['novalidate'] ) && $value['novalidate'] ) ? 'novalidate' : '';
$value['target'] = isset( $value['target'] ) ? $value['target'] : '';
break;
case 'field':
$ui_args = $value;
$ui_args['class'] = isset( $ui_args['child_class'] ) ? $ui_args['child_class'] : '' ;
$control = isset( $ui_args['instance'] ) ? $ui_args['instance'] : false;
if ( $control ) {
$value['children'] = $control->render();
} else {
$value['children'] = 'Control not found';
}
break;
}
if ( $has_child ) {
$value['children'] = $this->build( $value['children'] );
}
$output .= ( $value['view_wrapping'] ) ? $this->get_view( $type, $value ) : $value['children'];
}
return $output;
}
/**
* Output HTML.
*
* @since 1.0.0
* @access protected
* @param string $output Output HTML.
* @param boolean $echo Output type.
* @return string
*/
protected function output_method( $output = '', $echo = true ) {
if ( ! filter_var( $echo, FILTER_VALIDATE_BOOLEAN ) ) {
return $output;
} else {
echo $output;
}
}
/**
* Enqueue javascript and stylesheet interface builder.
*
* @since 4.0.0
* @access public
* @return void
*/
public function enqueue_assets() {
$suffix = '';
if ( defined( 'SCRIPT_DEBUG' ) && false === SCRIPT_DEBUG ) {
$suffix = '.min';
}
$js_deps = array_unique( $this->deps['js'] );
$css_deps = array_unique( $this->deps['css'] );
wp_enqueue_script(
'cx-interface-builder',
$this->url . 'assets/js/cx-interface-builder' . $suffix . '.js',
$js_deps,
$this->version,
true
);
wp_localize_script( 'cx-interface-builder', 'cxInterfaceBuilder',
array(
'conditions' => $this->conditions,
'fields' => $this->fields_value,
)
);
wp_enqueue_style(
'cx-interface-builder',
$this->url . 'assets/css/cx-interface-builder.css',
$css_deps,
$this->version,
'all'
);
}
}
}

View File

@@ -0,0 +1,180 @@
<?php
/**
* Control base class
*/
/**
* CX_Controls_Base abstract class
*/
if ( ! class_exists( 'CX_Controls_Base' ) ) {
/**
* CX_Controls_Base Abstract Class
*
* @since 1.0.0
*/
abstract class CX_Controls_Base {
/**
* Base URL
*
* @var null
*/
public $base_url = null;
/**
* Settings list
*
* @since 1.0.0
* @var array
*/
protected $settings = array();
/**
* Default settings array
*
* @var array
*/
public $defaults_settings = array();
/**
* Constructor method for the CX_Controls_Base class.
*
* @since 1.0.0
*/
public function __construct( $args = array() ) {
$this->defaults_settings['id'] = 'cx-control-' . uniqid();
$this->settings = wp_parse_args( $args, $this->defaults_settings );
$this->init();
add_action( 'wp_enqueue_scripts', array( $this, 'register_depends' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'register_depends' ) );
}
/**
* Returns control settings
*
* @return array
*/
public function get_settings() {
return $this->settings;
}
/**
* Render methos. Each UI element must implement own method
* @return [type] [description]
*/
abstract public function render();
/**
* Optional additional initializtion for control. Can be overriden from child class if needed.
* @return [type] [description]
*/
public function init() {}
/**
* Retrun scripts dependencies list for current control.
*
* @return array
*/
public function get_script_depends() {
return array();
}
/**
* Register required dependencies
*
* @return void
*/
public function register_depends() {}
/**
* Retrun styles dependencies list for current control.
*
* @return array
*/
public function get_style_depends() {
return array();
}
/**
* Set up base URL for next usage
*
* @param string $url array
*/
public function set_base_url( $url = '' ) {
$this->base_url = $url;
}
/**
* Get control value
*
* @since 1.0.0
* @return string control value.
*/
public function get_value() {
return $this->settings['value'];
}
/**
* Set control value
*
* @since 1.0.0
* @param [type] $value new.
*/
public function set_value( $value ) {
$this->settings['value'] = $value;
}
/**
* Get control name
*
* @since 1.0.0
* @return string control name.
*/
public function get_name() {
return $this->settings['name'];
}
/**
* Set control name
*
* @since 1.0.0
* @param [type] $name new control name.
* @throws Exception Invalid control name.
*/
public function set_name( $name ) {
$name = (string) $name;
if ( '' !== $name ) {
$this->settings['name'] = $name;
} else {
throw new Exception( "Invalid control name '" . $name . "'. Name can't be empty." );
}
}
/**
* Returns attributes string from attributes array
*
* @return string
*/
public function get_attr_string( $attr = array() ) {
$result = array();
foreach ( $attr as $key => $value ) {
if ( $key === $value ) {
$result[] = $key;
} else {
$result[] = sprintf( '%1$s="%2$s"', $key, $value );
}
}
return implode( ' ', $result );
}
}
}

View File

@@ -0,0 +1,79 @@
<?php
/**
* UI controls manager class
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
if ( ! class_exists( 'CX_Controls_Manager' ) ) {
/**
* Define CX_Controls_Manager class
*/
class CX_Controls_Manager {
/**
* Path to controls folder for current Inteface Builder instance
*
* @var string
*/
private $base_path = '';
/**
* Path to controls folder for current Inteface Builder instance
*
* @var string
*/
private $base_url = '';
/**
* Constructor for the class
*/
public function __construct( $base_path = null, $base_url = null ) {
$this->base_path = trailingslashit( $base_path );
$this->base_url = trailingslashit( $base_url );
require $this->base_path . 'inc/class-cx-controls-base.php';
$this->load_controls();
}
/**
* Automatically load found conrols
*
* @return void
*/
public function load_controls() {
foreach ( glob( $this->base_path . 'inc/controls/*.php' ) as $file ) {
require $file;
}
}
/**
* Register new control instance
*
* @return object
*/
public function register_control( $type = 'text', $args = array() ) {
$prefix = 'CX_Control_';
$classname = $prefix . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $type ) ) );
if ( ! class_exists( $classname ) ) {
return false;
}
$instance = new $classname( $args );
$instance->set_base_url( $this->base_url );
return $instance;
}
}
}

View File

@@ -0,0 +1,74 @@
<?php
/**
* Class for the building ui-button elements.
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
if ( ! class_exists( 'CX_Control_Button' ) ) {
/**
* Class for the building ui-button elements.
*/
class CX_Control_Button extends CX_Controls_Base {
/**
* Default settings.
*
* @since 1.0.0
* @var array
*/
public $defaults_settings = array(
'id' => 'cherry-ui-button-id',
'name' => 'cherry-ui-button-name',
'value' => 'button',
'disabled' => false,
'form' => '',
'formaction' => '',
'button_type' => 'button',
'style' => 'normal',
'content' => 'Button',
'class' => '',
);
/**
* Render html UI_Button.
*
* @since 1.0.0
*/
public function render() {
$classes = array(
'cx-button',
'cx-button-' . $this->settings['style'] . '-style',
$this->settings['class'],
);
$classes = array_filter( $classes );
$class = trim( implode( ' ', $classes ) );
$attrs = array(
'type' => esc_attr( $this->settings['button_type'] ),
'id' => esc_attr( $this->settings['id'] ),
'name' => esc_attr( $this->settings['name'] ),
'class' => esc_attr( $class ),
'form' => esc_attr( $this->settings['form'] ),
'formaction' => esc_attr( $this->settings['formaction'] ),
);
if ( filter_var( $this->settings['disabled'], FILTER_VALIDATE_BOOLEAN ) ) {
$attrs['disabled'] = 'disabled';
}
$html = sprintf(
'<button %1$s>%2$s</button>',
$this->get_attr_string( $attrs ),
$this->settings['content']
);
return $html;
}
}
}

View File

@@ -0,0 +1,105 @@
<?php
/**
* Class for the building checkbox elements.
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
if ( ! class_exists( 'CX_Control_Checkbox' ) ) {
/**
* Class for the building CX_Control_Checkbox elements.
*/
class CX_Control_Checkbox extends CX_Controls_Base {
/**
* Default settings.
*
* @since 1.0.0
* @var array
*/
public $defaults_settings = array(
'id' => 'cx-checkbox-id',
'name' => 'cx-checkbox-name',
'value' => array(
'checkbox-1' => 'true',
'checkbox-2' => 'true',
'checkbox-3' => 'true',
),
'options' => array(
'checkbox-1' => 'checkbox 1',
'checkbox-2' => 'checkbox 2',
'checkbox-3' => 'checkbox 3',
),
'label' => '',
'class' => '',
);
/**
* Render html UI_Checkbox.
*
* @since 1.0.0
*/
public function render() {
$html = '';
$class = implode( ' ',
array(
$this->settings['class'],
)
);
$html .= '<div class="cx-ui-control-container ' . esc_attr( $class ) . '">';
$counter = 0;
if ( isset( $this->settings['options_callback'] ) ) {
$this->settings['options'] = call_user_func( $this->settings['options_callback'] );
}
if ( ! empty( $this->settings['options'] ) && is_array( $this->settings['options'] ) ) {
if ( ! is_array( $this->settings['value'] ) ) {
$this->settings['value'] = array( $this->settings['value'] );
}
if ( '' !== $this->settings['label'] ) {
$html .= '<label class="cx-label" for="' . esc_attr( $this->settings['id'] ) . '">' . esc_html( $this->settings['label'] ) . '</label> ';
}
foreach ( $this->settings['options'] as $option => $option_value ) {
if ( ! empty( $this->settings['value'] ) ) {
$option_checked = array_key_exists( $option, $this->settings['value'] ) ? $option : '';
$item_value = ! empty( $option_checked ) ? $this->settings['value'][ $option ] : 'false';
} else {
$option_checked = '';
$item_value = 'false';
}
$checked = ( ! empty( $option_checked ) && filter_var( $item_value, FILTER_VALIDATE_BOOLEAN ) ) ? 'checked' : '';
$item_value = filter_var( $item_value, FILTER_VALIDATE_BOOLEAN ) ? 'true' : 'false';
$option_label = isset( $option_value ) && is_array( $option_value ) ? $option_value['label'] : $option_value;
$html .= '<div class="cx-checkbox-item-wrap">';
$html .= '<span class="cx-label-content">';
$html .= '<input type="hidden" id="' . esc_attr( $this->settings['id'] ) . '-' . $counter . '" class="cx-checkbox-input" name="' . esc_attr( $this->settings['name'] ) . '[' . $option . ']" ' . $checked . ' value="' . $item_value . '">';
$html .= '<span class="cx-checkbox-item"><span class="marker dashicons dashicons-yes"></span></span>';
$html .= '<label class="cx-checkbox-label" for="' . esc_attr( $this->settings['id'] ) . '-' . $counter . '"><span class="cx-label-content">' . esc_html( $option_label ) . '</span></label> ';
$html .= '</span>';
$html .= '</div>';
$counter++;
}
}
$html .= '</div>';
return $html;
}
}
}

View File

@@ -0,0 +1,92 @@
<?php
/**
* Class for the building colorpicker elements.
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
if ( ! class_exists( 'CX_Control_Colorpicker' ) ) {
/**
* Class for the building CX_Control_Colorpicker elements.
*/
class CX_Control_Colorpicker extends CX_Controls_Base {
/**
* Default settings.
*
* @since 1.0.0
* @var array
*/
public $defaults_settings = array(
'id' => 'cx-colorpicker-id',
'name' => 'cx-colorpicker-name',
'value' => '',
'label' => '',
'class' => '',
);
/**
* Register control dependencies
*
* @return [type] [description]
*/
public function register_depends() {
wp_register_script(
'cx-colorpicker-alpha',
$this->base_url . 'assets/lib/colorpicker/wp-color-picker-alpha.min.js',
array( 'wp-color-picker' ),
'1.0.0',
true
);
}
/**
* Retrun scripts dependencies list for current control.
*
* @return array
*/
public function get_script_depends() {
return array( 'cx-colorpicker-alpha' );
}
/**
* Retrun styles dependencies list for current control.
*
* @return array
*/
public function get_style_depends() {
return array( 'wp-color-picker' );
}
/**
* Render html UI_Colorpicker.
*
* @since 1.0.0
*/
public function render() {
$html = '';
$class = implode( ' ',
array(
$this->settings['class'],
)
);
$html .= '<div class="cx-ui-container ' . esc_attr( $class ) . '">';
if ( '' !== $this->settings['label'] ) {
$html .= '<label class="cx-label" for="' . esc_attr( $this->settings['id'] ) . '">' . esc_html( $this->settings['label'] ) . '</label> ';
}
$html .= '<div class="cx-ui-colorpicker-wrapper">';
$html .= '<input type="text" id="' . esc_attr( $this->settings['id'] ) . '" class="cx-ui-colorpicker" name="' . esc_attr( $this->settings['name'] ) . '" value="' . esc_html( $this->settings['value'] ) . '"/>';
$html .= '</div>';
$html .= '</div>';
return $html;
}
}
}

View File

@@ -0,0 +1,200 @@
<?php
/**
* Class for the building dimensions elements.
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
if ( ! class_exists( 'CX_Control_Dimensions' ) ) {
/**
* Class for the building ui-dimensions elements.
*/
class CX_Control_Dimensions extends CX_Controls_Base {
/**
* Default settings.
*
* @since 1.0.0
* @var array
*/
public $defaults_settings = array(
'id' => 'cx-dimensions-id',
'name' => 'cx-dimensions-name',
'value' => array(),
'range' => array(
'px' => array(
'min' => 0,
'max' => 100,
'step' => 1,
),
),
'dimension_labels' => array(
'top' => 'Top',
'right' => 'Right',
'bottom' => 'Bottom',
'left' => 'Left',
),
'label' => '',
'class' => '',
'required' => false,
);
protected $default_value = array(
'units' => 'px',
'is_linked' => true,
'top' => '',
'right' => '',
'bottom' => '',
'left' => '',
);
/**
* Get required attribute.
*
* @since 1.0.0
* @return string
*/
public function get_required() {
if ( $this->settings['required'] ) {
return 'required="required"';
}
return '';
}
/**
* Render html UI_Dimension.
*
* @since 1.0.0
*/
public function render() {
$html = '';
$class = implode( ' ',
array(
$this->settings['class'],
)
);
if ( empty( $this->settings['value'] ) ) {
$this->settings['value'] = $this->default_value;
} else {
$this->settings['value'] = array_merge( $this->default_value, $this->settings['value'] );
}
$html .= '<div class="cx-ui-container ' . esc_attr( $class ) . '">';
if ( '' !== $this->settings['label'] ) {
$html .= '<label class="cx-label" for="' . esc_attr( $this->settings['id'] ) . '">' . esc_html( $this->settings['label'] ) . '</label> ';
}
$html .= $this->get_fields();
$html .= '</div>';
return $html;
}
/**
* Return UI fileds
* @return [type] [description]
*/
public function get_fields() {
$hidden = '<input type="hidden" name="%1$s" id="%3$s" value="%2$s">';
$number = '<div class="cx-ui-dimensions__value-item"><input type="number" name="%1$s" id="%3$s" value="%2$s" min="%4$s" max="%5$s" step="%6$s" class="cx-ui-dimensions__val%7$s"><span class="cx-ui-dimensions__value-label">%8$s</span></div>';
$value = $this->settings['value'];
$value = array_merge( $this->default_value, $value );
$result = sprintf(
'<div class="cx-ui-dimensions" data-range=\'%s\'>',
json_encode( $this->settings['range'] )
);
foreach ( array( 'units', 'is_linked' ) as $field ) {
$result .= sprintf(
$hidden,
$this->get_name_attr( $field ), $value[ $field ], $this->get_id_attr( $field )
);
}
$result .= $this->get_units();
$result .= '<div class="cx-ui-dimensions__values">';
$value['is_linked'] = filter_var( $value['is_linked'], FILTER_VALIDATE_BOOLEAN );
foreach ( array( 'top', 'right', 'bottom', 'left' ) as $field ) {
$result .= sprintf(
$number,
$this->get_name_attr( $field ),
$value[ $field ],
$this->get_id_attr( $field ),
$this->settings['range'][ $value['units'] ]['min'],
$this->settings['range'][ $value['units'] ]['max'],
$this->settings['range'][ $value['units'] ]['step'],
( true === $value['is_linked'] ? ' is-linked' : '' ),
$this->settings['dimension_labels'][ $field ]
);
}
$result .= sprintf(
'<div class="cx-ui-dimensions__is-linked%s"><span class="dashicons dashicons-admin-links link-icon"></span><span class="dashicons dashicons-editor-unlink unlink-icon"></span></div>',
( true === $value['is_linked'] ? ' is-linked' : '' )
);
$result .= '</div>';
$result .= '</div>';
return $result;
}
/**
* Returns units selector
*
* @return string
*/
public function get_units() {
$units = array_keys( $this->settings['range'] );
$switcher = 'can-switch';
if ( 1 === count( $units ) ) {
$switcher = '';
}
$item = '<span class="cx-ui-dimensions__unit%2$s" data-unit="%1$s">%1$s</span>';
$result = '';
foreach ( $units as $unit ) {
$result .= sprintf(
$item,
$unit,
( $this->settings['value']['units'] === $unit ? ' is-active' : '' )
);
}
return sprintf( '<div class="cx-ui-dimensions__units">%s</div>', $result );
}
/**
* Retrurn full name attibute by name
*
* @param [type] $name [description]
* @return [type] [description]
*/
public function get_name_attr( $name = '' ) {
return sprintf( '%s[%s]', esc_attr( $this->settings['name'] ), esc_attr( $name ) );
}
/**
* Retrurn full ID attibute by name
*
* @param [type] $name [description]
* @return [type] [description]
*/
public function get_id_attr( $name = '' ) {
return sprintf( '%s_%s', esc_attr( $this->settings['name'] ), esc_attr( $name ) );
}
}
}

View File

@@ -0,0 +1,352 @@
<?php
/**
* Class for the building iconpicker elements.
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
if ( ! class_exists( 'CX_Control_Iconpicker' ) ) {
/**
* Class for the building ui-iconpicker elements.
*/
class CX_Control_Iconpicker extends CX_Controls_Base {
/**
* Default settings.
*
* @since 1.0.0
* @var array
*/
public $defaults_settings = array(
'type' => 'iconpicker',
'id' => 'cx-iconpicker-id',
'name' => 'cx-iconpicker-name',
'value' => '',
'placeholder' => '',
'icon_data' => array(),
'auto_parse' => false,
'label' => '',
'class' => '',
'master' => '',
'width' => 'fixed',
'required' => false,
);
/**
* Default icon data settings.
*
* @var array
*/
private $default_icon_data = array(
'icon_set' => '',
'icon_css' => '',
'icon_base' => 'icon',
'icon_prefix' => '',
'icons' => '',
);
/**
* Icons sets
*
* @var array
*/
public static $sets = array();
/**
* Check if sets already printed
*
* @var boolean
*/
public static $printed = false;
/**
* Array of already printed sets to check it before printing current
*
* @var array
*/
public static $printed_sets = array();
/**
* Temporary icons holder
*
* @var null
*/
public $temp_icons = null;
/**
* Init
* @return [type] [description]
*/
public function init() {
add_action( 'admin_footer', array( $this, 'print_icon_set' ), 1 );
add_action( 'customize_controls_print_footer_scripts', array( $this, 'print_icon_set' ), 9999 );
add_filter( 'cx_handler_response_data', array( $this, 'send_icon_set' ), 10, 1 );
}
/**
* Register control dependencies
*
* @return [type] [description]
*/
public function register_depends() {
wp_register_script(
'cx-iconpicker',
$this->base_url . 'assets/lib/iconpicker/jquery-iconpicker.js',
array( 'jquery' ),
'1.0.0',
true
);
}
/**
* Retrun scripts dependencies list for current control.
*
* @return array
*/
public function get_script_depends() {
return array( 'cx-iconpicker' );
}
/**
* Get required attribute
*
* @return string required attribute
*/
public function get_required() {
if ( $this->settings['required'] ) {
return 'required="required"';
}
return '';
}
/**
* Render html UI_Iconpicker.
*
* @since 1.0.0
*/
public function render() {
$html = '';
$class = implode( ' ',
array(
$this->settings['class'],
$this->settings['width'],
)
);
$html .= '<div class="cx-ui-container ' . esc_attr( $class ) . '">';
if ( '' !== $this->settings['label'] ) {
$html .= '<label class="cx-label" for="' . esc_attr( $this->settings['id'] ) . '">' . esc_html( $this->settings['label'] ) . '</label> ';
}
$this->settings['icon_data'] = wp_parse_args(
$this->settings['icon_data'],
$this->default_icon_data
);
$html .= '<div class="cx-ui-iconpicker-group">';
if ( $this->validate_icon_data( $this->settings['icon_data'] ) ) {
$html .= $this->render_picker();
} else {
$html .= 'Incorrect Icon Data Settings';
}
$html .= '</div>';
$html .= '</div>';
/**
* Maybe add js repeater template to response
*
* @var bool
*/
$add_js_to_response = apply_filters( 'cx_control/add_data_to_element', false );
if ( $add_js_to_response ) {
ob_start();
$this->print_icon_set();
$icons = ob_get_clean();
$in_repeater = apply_filters( 'cx_control/is_repeater', false );
if ( $in_repeater ) {
$this->temp_icons = $icons;
add_filter( 'cx_control/add_repeater_data', array( $this, 'store_icons' ) );
} else {
$html .= $icons;
}
}
return $html;
}
public function store_icons( $data = array() ) {
if ( ! is_array( $data ) ) {
$data = array();
}
$data[] = $this->temp_icons;
return $data;
}
/**
* Returns iconpicker html markup
*
* @return string
*/
private function render_picker() {
$format = '<span class="input-group-addon"></span><input type="text" name="%1$s" id="%2$s" value="%3$s" class="widefat cx-ui-text cx-ui-iconpicker %4$s" data-set="%5$s">';
$this->prepare_icon_set();
return sprintf(
$format,
$this->settings['name'],
$this->settings['id'],
$this->settings['value'],
$this->settings['class'],
$this->settings['icon_data']['icon_set']
);
}
/**
* Return JS markup for icon set variable.
*
* @return void
*/
public function prepare_icon_set() {
if ( empty( $this->settings['icon_data']['icons'] ) ) {
$this->maybe_parse_set_from_css();
}
if ( ! array_key_exists( $this->settings['icon_data']['icon_set'], self::$sets ) ) {
self::$sets[ $this->settings['icon_data']['icon_set'] ] = array(
'iconCSS' => $this->settings['icon_data']['icon_css'],
'iconBase' => $this->settings['icon_data']['icon_base'],
'iconPrefix' => $this->settings['icon_data']['icon_prefix'],
'icons' => $this->settings['icon_data']['icons'],
);
}
}
/**
* Check if 'parse_set' is true and try to get icons set from CSS file
*
* @return void
*/
private function maybe_parse_set_from_css() {
if ( true !== $this->settings['auto_parse'] || empty( $this->settings['icon_data']['icon_css'] ) ) {
return;
}
ob_start();
$path = str_replace( WP_CONTENT_URL, WP_CONTENT_DIR, $this->settings['icon_data']['icon_css'] );
if ( file_exists( $path ) ) {
include $path;
}
$result = ob_get_clean();
preg_match_all( '/\.([-_a-zA-Z0-9]+):before[, {]/', $result, $matches );
if ( ! is_array( $matches ) || empty( $matches[1] ) ) {
return;
}
if ( is_array( $this->settings['icon_data']['icons'] ) ) {
$this->settings['icon_data']['icons'] = array_merge(
$this->settings['icon_data']['icons'],
$matches[1]
);
} else {
$this->settings['icon_data']['icons'] = $matches[1];
}
}
/**
* Checks if all required icon data fields are passed
*
* @param array $data Icon data.
* @return bool
*/
private function validate_icon_data( $data ) {
$validate = array_diff( $this->default_icon_data, array( 'icon_base', 'icon_prefix' ) );
foreach ( $validate as $key => $field ) {
if ( empty( $data[ $key ] ) ) {
return false;
}
return true;
}
}
/**
* Function sends the icons into ajax response.
*
* @param array $data Icon data.
* @return array
*/
public function send_icon_set( $data ) {
if ( empty( $data['CxIconSets'] ) ) {
$data['CxIconSets'] = array();
}
foreach ( self::$sets as $key => $value ) {
$data['CxIconSets'][ $key ] = $value;
}
return $data;
}
/**
* Print icon sets
*
* @return void
*/
public function print_icon_set() {
if ( empty( self::$sets ) || true === self::$printed ) {
return;
}
self::$printed = true;
foreach ( self::$sets as $set => $data ) {
if ( in_array( $set, self::$printed_sets ) ) {
continue;
}
self::$printed_sets[] = $set;
$json = json_encode( $data );
printf(
'<script> if ( ! window.CxIconSets ) { window.CxIconSets = {} } window.CxIconSets.%1$s = %2$s</script>',
$set,
$json
);
}
}
}
}

View File

@@ -0,0 +1,154 @@
<?php
/**
* Class for the building ui-media elements.
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
if ( ! class_exists( 'CX_Control_Media' ) ) {
/**
* Class for the building CX_Control_Media elements.
*/
class CX_Control_Media extends CX_Controls_Base {
/**
* Default settings.
*
* @since 1.0.0
* @var array
*/
public $defaults_settings = array(
'id' => 'cx-ui-media-id',
'name' => 'cx-ui-media-name',
'value' => '',
'multi_upload' => true,
'library_type' => '', // image, video, sound
'upload_button_text' => 'Choose Media',
'label' => '',
'class' => '',
);
/**
* Register control dependencies
*
* @return [type] [description]
*/
public function register_depends() {
wp_enqueue_media();
}
/**
* Retrun scripts dependencies list for current control.
*
* @return array
*/
public function get_script_depends() {
return array( 'jquery-ui-sortable' );
}
/**
* Render html CX_Control_Media.
*
* @since 1.0.0
*/
public function render() {
$html = '';
if ( ! current_user_can( 'upload_files' ) ) {
return $html;
}
$class = implode( ' ',
array(
$this->settings['class'],
)
);
$html .= '<div class="cx-ui-container ' . esc_attr( $class ) . '">';
if ( '' != $this->settings['value'] ) {
$this->settings['value'] = str_replace( ' ', '', $this->settings['value'] );
$medias = explode( ',', $this->settings['value'] );
} else {
$this->settings['value'] = '';
$medias = array();
}
$img_style = ! $this->settings['value'] ? 'style="display:none;"' : '' ;
if ( '' !== $this->settings['label'] ) {
$html .= '<label class="cx-label" for="' . esc_attr( $this->settings['id'] ) . '">' . esc_html( $this->settings['label'] ) . '</label> ';
}
$html .= '<div class="cx-ui-media-wrap">';
$html .= '<div class="cx-upload-preview" >';
$html .= '<div class="cx-all-images-wrap">';
if ( is_array( $medias ) && ! empty( $medias ) ) {
foreach ( $medias as $medias_key => $medias_value ) {
$media_title = get_the_title( $medias_value );
$mime_type = get_post_mime_type( $medias_value );
$tmp = wp_get_attachment_metadata( $medias_value );
$img_src = '';
$thumb = '';
switch ( $mime_type ) {
case 'image/jpeg':
case 'image/png':
case 'image/gif':
$img_src = wp_get_attachment_image_src( $medias_value, 'thumbnail' );
$img_src = $img_src[0];
$thumb = '<img src="' . esc_html( $img_src ) . '" alt="">';
break;
case 'image/x-icon':
$thumb = '<span class="dashicons dashicons-format-image"></span>';
break;
case 'video/mpeg':
case 'video/mp4':
case 'video/quicktime':
case 'video/webm':
case 'video/ogg':
$thumb = '<span class="dashicons dashicons-format-video"></span>';
break;
case 'audio/mpeg':
case 'audio/wav':
case 'audio/ogg':
$thumb = '<span class="dashicons dashicons-format-audio"></span>';
break;
}
$html .= '<div class="cx-image-wrap">';
$html .= '<div class="inner">';
$html .= '<div class="preview-holder" data-id-attr="' . esc_attr( $medias_value ) . '">';
$html .= '<div class="centered">';
$html .= $thumb;
$html .= '</div>';
$html .= '</div>';
$html .= '<span class="title">' . $media_title . '</span>';
$html .= '<a class="cx-remove-image" href="#" title=""><i class="dashicons dashicons-no"></i></a>';
$html .= '</div>';
$html .= '</div>';
}
}
$html .= '</div>';
$html .= '</div>';
$html .= '<div class="cx-element-wrap">';
$html .= '<input type="hidden" id="' . esc_attr( $this->settings['id'] ) . '" class="cx-upload-input" name="' . esc_attr( $this->settings['name'] ) . '" value="' . esc_html( $this->settings['value'] ) . '">';
$html .= '<button type="button" class="upload-button cx-upload-button button-default_" value="' . esc_attr( $this->settings['upload_button_text'] ) . '" data-title="' . esc_attr( $this->settings['upload_button_text'] ) . '" data-multi-upload="' . esc_attr( $this->settings['multi_upload'] ) . '" data-library-type="' . esc_attr( $this->settings['library_type'] ) . '">' . esc_attr( $this->settings['upload_button_text'] ) . '</button>';
$html .= '<div class="clear"></div>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
return $html;
}
}
}

View File

@@ -0,0 +1,121 @@
<?php
/**
* Class for the building ui-radio elements.
*
* @package Cherry_Framework
* @subpackage Class
* @author Cherry Team <support@cxframework.com>
* @copyright Copyright (c) 2012 - 2015, Cherry Team
* @link http://www.cxframework.com/
* @license http://www.gnu.org/licenses/gpl-3.0.en.html
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
if ( ! class_exists( 'CX_Control_Radio' ) ) {
/**
* Class for the building CX_Control_Radio elements.
*/
class CX_Control_Radio extends CX_Controls_Base {
/**
* Default settings.
*
* @since 1.0.0
* @var array
*/
public $defaults_settings = array(
'id' => 'cx-ui-radio-id',
'name' => 'cx-ui-radio-name',
'value' => 'radio-2',
'options' => array(
'radio-1' => array(
'label' => 'Radio 1',
'img_src' => '',
),
'radio-2' => array(
'label' => 'Radio 2',
'img_src' => '',
),
'radio-3' => array(
'label' => 'Radio 3',
'img_src' => '',
),
),
'label' => '',
'class' => '',
);
/**
* Render html UI_Radio.
*
* @since 1.0.0
*/
public function render() {
$html = '';
$class = implode( ' ',
array(
$this->settings['class'],
)
);
if ( isset( $this->settings['options_callback'] ) ) {
$this->settings['options'] = call_user_func( $this->settings['options_callback'] );
}
$html .= '<div class="cx-ui-container ' . esc_attr( $class ) . '" >';
if ( $this->settings['options'] && ! empty( $this->settings['options'] ) && is_array( $this->settings['options'] ) ) {
if ( '' !== $this->settings['label'] ) {
$html .= '<label class="cx-label" for="' . esc_attr( $this->settings['id'] ) . '">' . $this->settings['label'] . '</label> ';
}
$html .= '<div class="cx-radio-group">';
foreach ( $this->settings['options'] as $option => $option_value ) {
$checked = $option == $this->settings['value'] ? ' checked' : '';
$radio_id = $this->settings['id'] . '-' . $option;
$img = isset( $option_value['img_src'] ) && ! empty( $option_value['img_src'] ) ? '<img src="' . esc_url( $option_value['img_src'] ) . '" alt="' . esc_html( $option_value['label'] ) . '">' : '<span class="cx-radio-item"><i></i></span>';
$class_box = isset( $option_value['img_src'] ) && ! empty( $option_value['img_src'] ) ? 'cx-radio-img' : 'cx-radio-item' ;
$html .= '<div class="' . $class_box . '">';
$html .= '<input type="radio" id="' . esc_attr( $radio_id ) . '" class="cx-radio-input" name="' . esc_attr( $this->settings['name'] ) . '" ' . checked( $option, $this->settings['value'], false ) . ' value="' . esc_attr( $option ) . '"/>';
$label_content = $img . $option_value['label'];
$html .= '<label for="' . esc_attr( $radio_id ) . '"><span class="cx-lable-content">' . $label_content . '</span></label> ';
$html .= '</div>';
}
$html .= '<div class="clear"></div>';
$html .= '</div>';
}
$html .= '</div>';
return $html;
}
/**
* Enqueue javascript and stylesheet UI_Radio.
*
* @since 1.0.0
*/
public static function enqueue_assets() {
wp_enqueue_style(
'ui-radio',
esc_url( Cherry_Core::base_url( 'inc/ui-elements/ui-radio/assets/min/ui-radio.min.css', Cherry_UI_Elements::$module_path ) ),
array(),
Cherry_UI_Elements::$core_version,
'all'
);
wp_enqueue_script(
'ui-radio-min',
esc_url( Cherry_Core::base_url( 'inc/ui-elements/ui-radio/assets/min/ui-radio.min.js', Cherry_UI_Elements::$module_path ) ),
array( 'jquery' ),
Cherry_UI_Elements::$core_version,
true
);
}
}
}

View File

@@ -0,0 +1,372 @@
<?php
/**
* Class for the building ui-repeater elements.
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
if ( ! class_exists( 'CX_Control_Repeater' ) ) {
/**
* Class for the building ui-repeater elements.
*/
class CX_Control_Repeater extends CX_Controls_Base {
/**
* Default settings
*
* @var array
*/
public $defaults_settings = array(
'type' => 'repeater',
'id' => 'cx-ui-repeater-id',
'name' => 'cx-ui-repeater-name',
'value' => array(),
'fields' => array(),
'label' => '',
'add_label' => 'Add Item',
'class' => '',
'ui_kit' => true,
'required' => false,
'title_field' => '',
);
/**
* Stored data to process it while renderinr row
*
* @var array
*/
public $data = array();
/**
* Repeater instances counter
*
* @var integer
*/
public static $instance_id = 0;
/**
* Current onstance TMPL name
*
* @var string
*/
public $tmpl_name = '';
/**
* Holder for templates to print it in bottom of customizer page
*
* @var string
*/
public static $customizer_tmpl_to_print = null;
/**
* Is tmpl scripts already printed in customizer
*
* @var boolean
*/
public static $customizer_tmpl_printed = false;
/**
* Child repeater instances
*
* @var array
*/
private $_childs = array();
/**
* Check if we render template for JS
*
* @var boolean
*/
private $_is_js_row = false;
/**
* Init.
*
* @since 1.0.0
*/
public function init() {
$this->set_tmpl_data();
add_action( 'admin_footer', array( $this, 'print_js_template' ), 0 );
add_action( 'customize_controls_print_footer_scripts', array( $this, 'fix_customizer_tmpl' ), 9999 );
}
/**
* Retrun scripts dependencies list for current control.
*
* @return array
*/
public function get_script_depends() {
return array( 'jquery-ui-sortable', 'wp-util' );
}
/**
* Get required attribute.
*
* @return string required attribute
*/
public function get_required() {
if ( $this->settings['required'] ) {
return 'required="required"';
}
return '';
}
/**
* Render html UI_Repeater.
*
* @since 1.0.1
*/
public function render() {
$html = '';
$class = $this->settings['class'];
$ui_kit = ! empty( $this->settings['ui_kit'] ) ? 'cx-ui-kit' : '';
$value = ! empty( $this->settings['value'] ) ? count( $this->settings['value'] ) : 0 ;
$title_field = ! empty( $this->settings['title_field'] ) ? 'data-title-field="' . $this->settings['title_field'] . '"' : '' ;
add_filter( 'cx_control/is_repeater', '__return_true' );
$html .= sprintf( '<div class="cx-ui-repeater-container cx-ui-container %1$s %2$s">',
$ui_kit,
esc_attr( $class )
);
if ( '' !== $this->settings['label'] ) {
$html .= '<label class="cx-label" for="' . esc_attr( $this->settings['id'] ) . '">' . esc_html( $this->settings['label'] ) . '</label> ';
}
$html .= sprintf(
'<div class="cx-ui-repeater-list" data-name="%1$s" data-index="%2$s" data-widget-id="__i__" %3$s id="%4$s">',
$this->get_tmpl_name(),
$value,
$title_field,
esc_attr( $this->settings['id'] )
);
if ( is_array( $this->settings['value'] ) ) {
$index = 0;
foreach ( $this->settings['value'] as $data ) {
$this->_is_js_row = false;
$html .= $this->render_row( $index, false, $data );
$index++;
}
}
$html .= '</div>';
$html .= sprintf(
'<a href="#" class="cx-ui-repeater-add">%1$s</a>',
esc_html( $this->settings['add_label'] )
);
$html .= '</div>';
/**
* Maybe add js repeater template to response
*
* @var bool
*/
$add_js_to_response = apply_filters( 'cx_control/add_data_to_element', false );
if ( $add_js_to_response ) {
$html .= $this->get_js_template();
}
$html .= $this->get_additional_data();
remove_all_filters( 'cx_control/is_repeater' );
return $html;
}
/**
* Get additional data to return
* @return [type] [description]
*/
public function get_additional_data() {
$data = apply_filters( 'cx_control/add_repeater_data', array() );
if ( ! empty( $data ) ) {
return implode( ' ', $data );
}
}
/**
* Render single row for repeater
*
* @param string $index Current row index.
* @param number $widget_index It contains widget index.
* @param array $data Values to paste.
* @since 1.0.1
*/
public function render_row( $index, $widget_index, $data ) {
$this->data = $data;
$html = '<div class="cx-ui-repeater-item" >';
$html .= '<div class="cx-ui-repeater-actions-box">';
$html .= '<a href="#" class="cx-ui-repeater-remove"></a>';
$html .= '<span class="cx-ui-repeater-title">' . $this->get_row_title() . '</span>';
$html .= '<a href="#" class="cx-ui-repeater-toggle"></a>';
$html .= '</div>';
$html .= '<div class="cheryr-ui-repeater-content-box">';
foreach ( $this->settings['fields'] as $field ) {
$field_classes = array(
$field['id'] . '-wrap',
);
if ( ! empty( $field['class'] ) ) {
$field_classes[] = $field['class'];
}
$field_classes = implode( ' ', $field_classes );
$html .= '<div class="' . $field_classes . '">';
$html .= $this->render_field( $index, $widget_index, $field );
$html .= '</div>';
}
$html .= '</div>';
$html .= '</div>';
$this->data = array();
return $html;
}
/**
* Get repeater item title
*
* @return string
* @since 1.0.1
*/
public function get_row_title() {
if ( empty( $this->settings['title_field'] ) ) {
return '';
}
if ( ! empty( $this->data[ $this->settings['title_field'] ] ) ) {
return $this->data[ $this->settings['title_field'] ];
}
return '';
}
/**
* Render single repeater field
*
* @param string $index Current row index.
* @param number $widget_index It contains widget index.
* @param array $field Values to paste.
* @return string
*/
public function render_field( $index, $widget_index, $field ) {
if ( empty( $field['type'] ) || empty( $field['name'] ) ) {
return '"type" and "name" are required fields for UI_Repeater items';
}
$field = wp_parse_args( $field, array(
'value' => '',
) );
$parent_name = str_replace( '__i__', $widget_index, $this->settings['name'] );
$parent_name = str_replace( '{{{data.index}}}', '{{{data.parentIndex}}}', $parent_name );
$field['id'] = sprintf( '%s-%s', $field['id'], $index );
$field['value'] = isset( $this->data[ $field['name'] ] ) ? $this->data[ $field['name'] ] : $field['value'];
$field['name'] = sprintf( '%1$s[item-%2$s][%3$s]', $parent_name, $index, $field['name'] );
$ui_class_name = 'CX_Control_' . ucwords( $field['type'] );
if ( ! class_exists( $ui_class_name ) ) {
return '<p>Class <b>' . $ui_class_name . '</b> not exist!</p>';
}
$ui_item = new $ui_class_name( $field );
if ( 'repeater' === $ui_item->settings['type'] && true === $this->_is_js_row ) {
$this->_childs[] = $ui_item;
}
return $ui_item->render();
}
/**
* Get TMPL name for current repeater instance.
*
* @return string
*/
public function get_tmpl_name() {
return $this->tmpl_name;
}
/**
* Set current repeater instance ID
*
* @return void
*/
public function set_tmpl_data() {
self::$instance_id++;
$this->tmpl_name = sprintf( 'repeater-template-%s', self::$instance_id );
global $wp_customize;
if ( isset( $wp_customize ) ) {
self::$customizer_tmpl_to_print .= $this->get_js_template();
}
}
/**
* Print JS template for current repeater instance
*
* @return void
*/
public function print_js_template() {
echo $this->get_js_template();
if ( ! empty( $this->_childs ) ) {
foreach ( $this->_childs as $child ) {
echo $child->get_js_template();
}
}
}
/**
* Get JS template to print
*
* @return string
*/
public function get_js_template() {
$this->_is_js_row = true;
return sprintf(
'<script type="text/html" id="tmpl-%1$s">%2$s</script>',
$this->get_tmpl_name(),
$this->render_row( '{{{data.index}}}', '{{{data.widgetId}}}', array() )
);
}
/**
* Outputs JS templates on customizer page
*
* @return void
*/
public function fix_customizer_tmpl() {
if ( true === self::$customizer_tmpl_printed ) {
return;
}
self::$customizer_tmpl_printed = true;
echo self::$customizer_tmpl_to_print;
}
}
}

View File

@@ -0,0 +1,185 @@
<?php
/**
* Class for the building ui-select elements.
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
if ( ! class_exists( 'CX_Control_Select' ) ) {
/**
* Class for the building CX_Control_Select elements.
*/
class CX_Control_Select extends CX_Controls_Base {
/**
* Default settings.
*
* @since 1.0.0
* @var array
*/
public $defaults_settings = array(
'id' => 'cx-ui-select-id',
'name' => 'cx-ui-select-name',
'multiple' => false,
'filter' => false,
'size' => 1,
'inline_style' => 'width: 100%',
'value' => 'select-8',
'placeholder' => null,
'options' => array(
'select-1' => 'select 1',
'select-2' => 'select 2',
'select-3' => 'select 3',
'select-4' => 'select 4',
'select-5' => array(
'label' => 'Group 1',
),
'optgroup-1' => array(
'label' => 'Group 1',
'group_options' => array(
'select-6' => 'select 6',
'select-7' => 'select 7',
'select-8' => 'select 8',
),
),
'optgroup-2' => array(
'label' => 'Group 2',
'group_options' => array(
'select-9' => 'select 9',
'select-10' => 'select 10',
'select-11' => 'select 11',
),
),
),
'label' => '',
'class' => '',
);
/**
* Register control dependencies
*
* @return [type] [description]
*/
public function register_depends() {
wp_register_script(
'cx-select2',
$this->base_url . 'assets/lib/select2/select2.min.js',
array( 'jquery' ),
'4.0.5',
true
);
wp_register_style(
'cx-select2',
$this->base_url . 'assets/lib/select2/select2.min.css',
array(),
'4.0.5',
'all'
);
}
/**
* Retrun scripts dependencies list for current control.
*
* @return array
*/
public function get_script_depends() {
return array( 'cx-select2' );
}
/**
* Retrun styles dependencies list for current control.
*
* @return array
*/
public function get_style_depends() {
return array( 'cx-select2' );
}
/**
* Render html UI_Select.
*
* @since 1.0.0
*/
public function render() {
$html = '';
$class = implode( ' ',
array(
$this->settings['class'],
)
);
if ( isset( $this->settings['options_callback'] ) ) {
$this->settings['options'] = call_user_func( $this->settings['options_callback'] );
}
$html .= '<div class="cx-ui-container ' . esc_attr( $class ) . '">';
$html .= '<div class="cx-ui-select-wrapper">';
( $this->settings['filter'] ) ? $filter_state = 'data-filter="true"' : $filter_state = 'data-filter="false"' ;
( $this->settings['multiple'] ) ? $multi_state = 'multiple="multiple"' : $multi_state = '' ;
( $this->settings['multiple'] ) ? $name = $this->settings['name'] . '[]' : $name = $this->settings['name'] ;
if ( '' !== $this->settings['label'] ) {
$html .= '<label class="cx-label" for="' . esc_attr( $this->settings['id'] ) . '">' . $this->settings['label'] . '</label> ';
}
$inline_style = $this->settings['inline_style'] ? 'style="' . esc_attr( $this->settings['inline_style'] ) . '"' : '' ;
$html .= '<select id="' . esc_attr( $this->settings['id'] ) . '" class="cx-ui-select" name="' . esc_attr( $name ) . '" size="' . esc_attr( $this->settings['size'] ) . '" ' . $multi_state . ' ' . $filter_state . ' data-placeholder="' . esc_attr( $this->settings['placeholder'] ) . '" ' . $inline_style . '>';
if ( $this->settings['options'] && ! empty( $this->settings['options'] ) && is_array( $this->settings['options'] ) ) {
foreach ( $this->settings['options'] as $option => $option_value ) {
if ( ! is_array( $this->settings['value'] ) ) {
$this->settings['value'] = array( $this->settings['value'] );
}
if ( false === strpos( $option, 'optgroup' ) ) {
$selected_state = '';
if ( $this->settings['value'] && ! empty( $this->settings['value'] ) ) {
foreach ( $this->settings['value'] as $key => $value ) {
$selected_state = selected( $value, $option, false );
if ( " selected='selected'" == $selected_state ) {
break;
}
}
}
if ( is_array( $option_value ) ) {
$label = $option_value['label'];
} else {
$label = $option_value;
}
$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected_state . '>' . esc_html( $label ) . '</option>';
} else {
$html .= '<optgroup label="' . esc_attr( $option_value['label'] ) . '">';
$selected_state = '';
foreach ( $option_value['group_options'] as $group_item => $group_value ) {
foreach ( $this->settings['value'] as $key => $value ) {
$selected_state = selected( $value, $group_item, false );
if ( " selected='selected'" == $selected_state ) {
break;
}
}
$html .= '<option value="' . esc_attr( $group_item ) . '" ' . $selected_state . '>' . esc_html( $group_value ) . '</option>';
}
$html .= '</optgroup>';
}
}
}
$html .= '</select>';
$html .= '</div>';
$html .= '</div>';
return $html;
}
}
}

View File

@@ -0,0 +1,104 @@
<?php
/**
* Class for the building ui slider elements .
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
if ( ! class_exists( 'CX_Control_Slider' ) ) {
/**
* Class for the building UI_Slider elements.
*/
class CX_Control_Slider extends CX_Controls_Base {
/**
* Default settings.
*
* @since 1.0.0
* @var array
*/
public $defaults_settings = array(
'id' => 'cx-ui-slider-id',
'name' => 'cx-ui-slider-name',
'max_value' => 100,
'min_value' => 0,
'value' => 50,
'step_value' => 1,
'label' => '',
'class' => '',
);
/**
* Render html UI_Slider.
*
* @since 1.0.0
*/
public function render() {
$html = '';
$class = implode( ' ',
array(
$this->settings['class'],
)
);
$html .= '<div class="cx-ui-container ' . esc_attr( $class ) . '">';
$ui_stepper = new CX_Control_Stepper(
array(
'id' => $this->settings['id'] . '-stepper',
'name' => $this->settings['name'],
'max_value' => $this->settings['max_value'],
'min_value' => $this->settings['min_value'],
'value' => $this->settings['value'],
'step_value' => $this->settings['step_value'],
)
);
$ui_stepper_html = $ui_stepper->render();
if ( '' !== $this->settings['label'] ) {
$html .= '<label class="cx-label" for="' . esc_attr( $this->settings['id'] ) . '">' . esc_html( $this->settings['label'] ) . '</label> ';
}
$html .= '<div class="cx-slider-wrap">';
$html .= '<div class="cx-slider-holder">';
$html .= '<input type="range" class="cx-slider-unit" step="' . esc_attr( $this->settings['step_value'] ) . '" min="' . esc_attr( $this->settings['min_value'] ) . '" max="' . esc_attr( $this->settings['max_value'] ) . '" value="' . esc_attr( $this->settings['value'] ) . '">';
$html .= '</div>';
$html .= '<div class="cx-slider-input">';
$html .= $ui_stepper_html;
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
return $html;
}
/**
* Enqueue javascript and stylesheet UI_Slider.
*
* @since 1.0.0
*/
public static function enqueue_assets() {
wp_enqueue_script(
'ui-slider',
esc_url( Cherry_Core::base_url( 'inc/ui-elements/ui-slider/assets/min/ui-slider.min.js', Cherry_UI_Elements::$module_path ) ),
array( 'jquery' ),
Cherry_UI_Elements::$core_version,
true
);
wp_enqueue_style(
'ui-slider',
esc_url( Cherry_Core::base_url( 'inc/ui-elements/ui-slider/assets/min/ui-slider.min.css', Cherry_UI_Elements::$module_path ) ),
array(),
Cherry_UI_Elements::$core_version,
'all'
);
}
}
}

View File

@@ -0,0 +1,71 @@
<?php
/**
* Class for the building ui stepper elements.
*
* @package Cherry_Framework
* @subpackage Class
* @author Cherry Team <support@cxframework.com>
* @copyright Copyright (c) 2012 - 2015, Cherry Team
* @link http://www.cxframework.com/
* @license http://www.gnu.org/licenses/gpl-3.0.en.html
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
if ( ! class_exists( 'CX_Control_Stepper' ) ) {
/**
* Class for the building CX_Control_Stepper elements.
*/
class CX_Control_Stepper extends CX_Controls_Base {
/**
* Default settings.
*
* @since 1.0.0
* @var array
*/
public $defaults_settings = array(
'id' => 'cx-ui-stepper-id',
'name' => 'cx-ui-stepper-name',
'value' => '0',
'max_value' => '100',
'min_value' => '0',
'step_value' => '1',
'label' => '',
'class' => '',
'placeholder' => '',
);
/**
* Render html UI_Stepper.
*
* @since 1.0.0
*/
public function render() {
$html = '';
$class = implode( ' ',
array(
$this->settings['class'],
)
);
$html .= '<div class="cx-ui-container ' . esc_attr( $class ) . '">';
if ( '' !== $this->settings['label'] ) {
$html .= '<label class="cx-label" for="' . esc_attr( $this->settings['id'] ) . '">' . esc_html( $this->settings['label'] ) . '</label> ';
}
$html .= '<div class="cx-ui-stepper">';
$html .= '<input type="number" id="' . esc_attr( $this->settings['id'] ) . '" class="cx-ui-stepper-input" pattern="[0-5]+([\.,][0-5]+)?" name="' . esc_attr( $this->settings['name'] ) . '" value="' . esc_html( $this->settings['value'] ) . '" min="' . esc_html( $this->settings['min_value'] ) . '" max="' . esc_html( $this->settings['max_value'] ) . '" step="' . esc_html( $this->settings['step_value'] ) . '" placeholder="' . esc_attr( $this->settings['placeholder'] ) . '">';
$html .= '</div>';
$html .= '</div>';
return $html;
}
}
}

View File

@@ -0,0 +1,71 @@
<?php
/**
* Class for the building ui swither elements .
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
if ( ! class_exists( 'CX_Control_Switcher' ) ) {
/**
* Class for the building CX_Control_Switcher elements.
*/
class CX_Control_Switcher extends CX_Controls_Base {
/**
* Default settings.
*
* @since 1.0.0
* @var array
*/
public $defaults_settings = array(
'id' => 'cx-ui-swither-id',
'name' => 'cx-ui-swither-name',
'value' => true,
'toggle' => array(
'true_toggle' => 'On',
'false_toggle' => 'Off',
),
'label' => '',
'class' => '',
);
/**
* Render html UI_Switcher.
*
* @since 1.0.0
*/
public function render() {
$html = '';
$class = implode( ' ',
array(
$this->settings['class'],
)
);
$html .= '<div class="cx-ui-container ' . esc_attr( $class ) . '">';
if ( '' !== $this->settings['label'] ) {
$html .= '<label class="cx-label" for="' . esc_attr( $this->settings['id'] ) . '">' . esc_html( $this->settings['label'] ) . '</label> ';
}
$value = filter_var( $this->settings['value'], FILTER_VALIDATE_BOOLEAN );
$html .= '<div class="cx-switcher-wrap">';
$html .= '<input type="radio" id="' . esc_attr( $this->settings['id'] ) . '-true" class="cx-input-switcher cx-input-switcher-true" name="' . esc_attr( $this->settings['name'] ) . '" ' . checked( true, $value, false ) . ' value="true">';
$html .= '<input type="radio" id="' . esc_attr( $this->settings['id'] ) . '-false" class="cx-input-switcher cx-input-switcher-false" name="' . esc_attr( $this->settings['name'] ) . '" ' . checked( false, $value, false ) . ' value="false">';
$html .= '<span class="bg-cover"></span>';
$html .= '<label class="sw-enable"><span>' . esc_html( $this->settings['toggle']['true_toggle'] ) . '</span></label>';
$html .= '<label class="sw-disable"><span>' . esc_html( $this->settings['toggle']['false_toggle'] ) . '</span></label>';
$html .= '<span class="state-marker"></span>';
$html .= '</div>';
$html .= '</div>';
return $html;
}
}
}

View File

@@ -0,0 +1,72 @@
<?php
/**
* Class for the building ui-text elements.
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
if ( ! class_exists( 'CX_Control_Text' ) ) {
/**
* Class for the building ui-text elements.
*/
class CX_Control_Text extends CX_Controls_Base {
/**
* Default settings.
*
* @since 1.0.0
* @var array
*/
public $defaults_settings = array(
'type' => 'text',
'id' => 'cx-ui-input-id',
'name' => 'cx-ui-input-name',
'value' => '',
'placeholder' => '',
'label' => '',
'class' => '',
'required' => false,
);
/**
* Get required attribute.
*
* @since 1.0.0
* @return string
*/
public function get_required() {
if ( $this->settings['required'] ) {
return 'required="required"';
}
return '';
}
/**
* Render html UI_Text.
*
* @since 1.0.0
*/
public function render() {
$html = '';
$class = implode( ' ',
array(
$this->settings['class'],
)
);
$html .= '<div class="cx-ui-container ' . esc_attr( $class ) . '">';
if ( '' !== $this->settings['label'] ) {
$html .= '<label class="cx-label" for="' . esc_attr( $this->settings['id'] ) . '">' . esc_html( $this->settings['label'] ) . '</label> ';
}
$html .= '<input type="' . esc_attr( $this->settings['type'] ) . '" id="' . esc_attr( $this->settings['id'] ) . '" class="widefat cx-ui-text" name="' . esc_attr( $this->settings['name'] ) . '" value="' . esc_html( $this->settings['value'] ) . '" placeholder="' . esc_attr( $this->settings['placeholder'] ) . '" ' . $this->get_required() . '>';
$html .= '</div>';
return $html;
}
}
}

View File

@@ -0,0 +1,59 @@
<?php
/**
* Class for the building ui-textarea elements
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
if ( ! class_exists( 'CX_Control_Textarea' ) ) {
/**
* Class for the building CX_Control_Textarea elements.
*/
class CX_Control_Textarea extends CX_Controls_Base {
/**
* Default settings.
*
* @since 1.0.0
* @var array
*/
public $defaults_settings = array(
'id' => 'cx-ui-textarea-id',
'name' => 'cx-ui-textarea-name',
'value' => '',
'placeholder' => '',
'rows' => '10',
'cols' => '20',
'label' => '',
'class' => '',
);
/**
* Render html UI_Textarea.
*
* @since 1.0.0
*/
public function render() {
$html = '';
$class = implode( ' ',
array(
$this->settings['class'],
)
);
$html .= '<div class="cx-ui-container ' . esc_attr( $class ) . '">';
if ( '' !== $this->settings['label'] ) {
$html .= '<label class="cx-label" for="' . esc_attr( $this->settings['id'] ) . '">' . $this->settings['label'] . '</label> ';
}
$html .= '<textarea id="' . esc_attr( $this->settings['id'] ) . '" class="cx-ui-textarea" name="' . esc_attr( $this->settings['name'] ) . '" rows="' . esc_attr( $this->settings['rows'] ) . '" cols="' . esc_attr( $this->settings['cols'] ) . '" placeholder="' . esc_attr( $this->settings['placeholder'] ) . '">' . esc_html( $this->settings['value'] ) . '</textarea>';
$html .= '</div>';
return $html;
}
}
}

View File

@@ -0,0 +1,23 @@
<?php
/**
* Accordion template.
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
?>
<div class="cx-ui-kit cx-component cx-accordion <?php echo esc_attr( $args['class'] ); ?>" data-compotent-id="#<?php echo esc_attr( $args['id'] ) ?>">
<?php if ( ! empty( $args['title'] ) ) { ?>
<h2 class="cx-ui-kit__title cx-component__title" role="banner" ><?php echo wp_kses_post( $args['title'] ); ?></h2>
<?php } ?>
<?php if ( ! empty( $args['description'] ) ) { ?>
<div class="cx-ui-kit__description cx-component__description" role="note" ><?php echo wp_kses_post( $args['description'] ); ?></div>
<?php } ?>
<?php if ( ! empty( $args['children'] ) ) { ?>
<div class="cx-ui-kit__content cx-component__content cx-accordion__content" role="group" >
<?php echo $args['children'] ?>
</div>
<?php } ?>
</div>

View File

@@ -0,0 +1,23 @@
<?php
/**
* Repeater template.
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
?>
<div class="cx-ui-kit cx-component cx-repeater <?php echo esc_attr( $args['class'] ); ?>" data-compotent-id="#<?php echo esc_attr( $args['id'] ); ?>">
<?php if ( ! empty( $args['title'] ) ) { ?>
<h2 class="cx-ui-kit__title cx-component__title" role="banner" ><?php echo wp_kses_post( $args['title'] ); ?></h2>
<?php } ?>
<?php if ( ! empty( $args['description'] ) ) { ?>
<div class="cx-ui-kit__description cx-component__description" role="note" ><?php echo wp_kses_post( $args['description'] ); ?></div>
<?php } ?>
<?php if ( ! empty( $args['children'] ) ) { ?>
<div class="cx-ui-kit__content cx-component__content" role="group" >
<?php echo $args['children']; ?>
</div>
<?php } ?>
</div>

View File

@@ -0,0 +1,28 @@
<?php
/**
* Horizontal tab template.
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
?>
<div class="cx-ui-kit cx-component cx-tab cx-tab--horizontal <?php echo esc_attr( $args['class'] ) ?>" data-compotent-id="#<?php echo esc_attr( $args['id'] ); ?>">
<?php if ( ! empty( $args['title'] ) ) { ?>
<h2 class="cx-ui-kit__title cx-component__title" role="banner" ><?php echo wp_kses_post( $args['title'] ); ?></h2>
<?php } ?>
<?php if ( ! empty( $args['description'] ) ) { ?>
<div class="cx-ui-kit__description cx-component__description" role="note" ><?php echo wp_kses_post( $args['description'] ); ?></div>
<?php } ?>
<?php if ( ! empty( $args['children'] ) ) { ?>
<div class="cx-tab__body" >
<div class="cx-tab__tabs" role="navigation" >
<?php echo $args['tabs']; ?>
</div>
<div class="cx-ui-kit__content cx-component__content cx-tab__content" role="group" >
<?php echo $args['children']; ?>
</div>
</div>
<?php } ?>
</div>

View File

@@ -0,0 +1,28 @@
<?php
/**
* Verticall tab template.
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
?>
<div class="cx-ui-kit cx-component cx-tab cx-tab--vertical <?php echo esc_attr( $args['class'] ); ?>" data-compotent-id="#<?php echo esc_attr( $args['id'] ); ?>">
<?php if ( ! empty( $args['title'] ) ) { ?>
<h2 class="cx-ui-kit__title cx-component__title" role="banner" ><?php echo wp_kses_post( $args['title'] ); ?></h2>
<?php } ?>
<?php if ( ! empty( $args['description'] ) ) { ?>
<div class="cx-ui-kit__description cx-component__description" role="note" ><?php echo wp_kses_post( $args['description'] ); ?></div>
<?php } ?>
<?php if ( ! empty( $args['children'] ) ) { ?>
<div class="cx-tab__body" >
<div class="cx-tab__tabs" role="navigation" >
<?php echo $args['tabs']; ?>
</div>
<div class="cx-ui-kit__content cx-component__content cx-tab__content" role="group" >
<?php echo $args['children']; ?>
</div>
</div>
<?php } ?>
</div>

View File

@@ -0,0 +1,23 @@
<?php
/**
* Toggle template.
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
?>
<div class="cx-ui-kit cx-component cx-toggle <?php echo esc_attr( $args['class'] ); ?>" data-compotent-id="#<?php echo esc_attr( $args['id'] ); ?>">
<?php if ( ! empty( $args['title'] ) ) { ?>
<h2 class="cx-ui-kit__title cx-component__title" role="banner" ><?php echo wp_kses_post( $args['title'] ); ?></h2>
<?php } ?>
<?php if ( ! empty( $args['description'] ) ) { ?>
<div class="cx-ui-kit__description cx-component__description" role="note" ><?php echo wp_kses_post( $args['description'] ); ?></div>
<?php } ?>
<?php if ( ! empty( $args['children'] ) ) { ?>
<div class="cx-ui-kit__content cx-component__content cx-toggle__content" role="group" >
<?php echo $args['children']; ?>
</div>
<?php } ?>
</div>

View File

@@ -0,0 +1,27 @@
<?php
/**
* Control template.
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
?>
<div class="cx-ui-kit cx-control cx-control-<?php echo esc_attr( $args['type'] ); ?>" data-control-name="<?php echo esc_attr( $args['id'] ); ?>">
<?php if ( ! empty( $args['title'] ) || ! empty( $args['description'] ) ) { ?>
<div class="cx-control__info">
<?php if ( ! empty( $args['title'] ) ) { ?>
<h4 class="cx-ui-kit__title cx-control__title" role="banner" ><?php echo wp_kses_post( $args['title'] ); ?></h4>
<?php } ?>
<?php if ( ! empty( $args['description'] ) ) { ?>
<div class="cx-ui-kit__description cx-control__description" role="note" ><?php echo wp_kses_post( $args['description'] ); ?></div>
<?php } ?>
</div>
<?php } ?>
<?php if ( ! empty( $args['children'] ) ) { ?>
<div class="cx-ui-kit__content cx-control__content" role="group" >
<?php echo $args['children']; ?>
</div>
<?php } ?>
</div>

View File

@@ -0,0 +1,17 @@
<?php
/**
* Form template.
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
?>
<form class="cx-form <?php echo esc_attr( $args['class'] ); ?>" id="<?php echo esc_attr( $args['id'] ); ?>" name="<?php echo esc_attr( $args['id'] ); ?>" accept-charset="<?php echo esc_attr( $args['accept-charset'] ); ?>" action="<?php echo esc_attr( $args['action'] ); ?>" autocomplete="<?php echo esc_attr( $args['autocomplete'] ); ?>" enctype="<?php echo esc_attr( $args['enctype'] ); ?>" method="<?php echo esc_attr( $args['method'] ); ?>" target="<?php echo esc_attr( $args['target'] ); ?>" <?php echo esc_attr( $args['novalidate'] ); ?> >
<?php
if ( ! empty( $args['children'] ) ) {
echo $args['children'];
}
?>
</form>

View File

@@ -0,0 +1,17 @@
<?php
/**
* HTML template.
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
?>
<div class="cx-ui-kit <?php echo esc_attr( $args['class'] ); ?>">
<?php if ( ! empty( $args['children'] ) ) { ?>
<div class="cx-ui-kit__content" role="group" >
<?php echo $args['children']; ?>
</div>
<?php } ?>
</div>

View File

@@ -0,0 +1,29 @@
<?php
/**
* Section template.
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
?>
<div class="cx-ui-kit cx-section <?php echo esc_attr( $args['class'] ); ?>" onclick="void(0)">
<div class="cx-section__holder">
<div class="cx-section__inner">
<div class="cx-section__info">
<?php if ( ! empty( $args['title'] ) ) { ?>
<h1 class="cx-ui-kit__title cx-section__title" role="banner" ><?php echo wp_kses_post( $args['title'] ); ?></h1>
<?php } ?>
<?php if ( ! empty( $args['description'] ) ) { ?>
<div class="cx-ui-kit__description cx-section__description " role="note" ><?php echo wp_kses_post( $args['description'] ); ?></div>
<?php } ?>
</div>
<?php if ( ! empty( $args['children'] ) ) { ?>
<div class="cx-ui-kit__content cx-section__content" role="group" >
<?php echo $args['children']; ?>
</div>
<?php } ?>
</div>
</div>
</div>

View File

@@ -0,0 +1,11 @@
<?php
/**
* Settings title template.
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
?>
<h3 class="cx-ui-kit__title cx-settings__title" role="banner" ><?php echo wp_kses_post( $args['title'] ); ?></h3>

View File

@@ -0,0 +1,25 @@
<?php
/**
* Settings template.
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
?>
<div class="cx-ui-kit cx-settings <?php echo esc_attr( $args['class'] ); ?>">
<?php if ( ! empty( $args['title'] ) ) {
echo $args['title'];
} ?>
<?php if ( ! empty( $args['children'] ) || ! empty( $args['description'] ) ) { ?>
<div class="cx-ui-kit__content cx-settings__content" role="group" id="<?php echo esc_attr( $args['id'] ); ?>" >
<?php if ( ! empty( $args['description'] ) ) { ?>
<div class="cx-ui-kit__description cx-settings__description" role="note" ><?php echo wp_kses_post( $args['description'] ); ?></div>
<?php } ?>
<?php if ( ! empty( $args['children'] ) ) { ?>
<?php echo $args['children']; ?>
<?php } ?>
</div>
<?php } ?>
</div>

View File

@@ -0,0 +1,13 @@
<?php
/**
* Tabs title template.
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
?>
<button class="cx-tab__button cx-component__button" role="button" title="<?php echo esc_attr( $args['title'] ); ?>" aria-expanded="false" data-content-id="#<?php echo esc_attr( $args['id'] ); ?>">
<h3 class="cx-ui-kit__title cx-tab__title" aria-grabbed="true" role="banner" ><?php echo wp_kses_post( $args['title'] ); ?></h3>
</button>

View File

@@ -0,0 +1,15 @@
<?php
/**
* Toggle title template.
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
?>
<button class="cx-toggle__header cx-component__button" role="button" aria-expanded="false" data-content-id="#<?php echo esc_attr( $args['id'] ); ?>">
<h3 class="cx-ui-kit__title cx-toggle__title" aria-grabbed="true" role="banner" ><?php echo wp_kses_post( $args['title'] ); ?></h3>
<span class="dashicons dashicons-arrow-down hide-icon"></span>
<span class="dashicons dashicons-arrow-up show-icon"></span>
</button>