first commit

This commit is contained in:
2026-03-05 13:07:40 +01:00
commit 64ba0721ee
25709 changed files with 4691006 additions and 0 deletions

View File

@@ -0,0 +1,590 @@
/**
*
* ---------------------------------------------------------
* CODESTAR FRAMEWORK RTL CSS MAP
* ---------------------------------------------------------
*
* 01. Base
* 01. 01. Header
* 01. 02. Header Buttons
* 01. 03. Navigation
* 01. 04. Content
* 01. 05. Section
* 01. 06. Show All Settings
* 01. 07. Search Input
* 01. 08. Copyright
* 01. 09. Metabox
* 02. Fields
* 02. 01. Field: typography
* 02. 02. Field: checkbox, radio
* 02. 03. Field: switcher
* 02. 04. Field: upload
* 02. 05. Field: group
* 02. 06. Field: repeater
* 02. 07. Field: help
* 02. 08. Field: icon
* 02. 09. Field: gallery
* 02. 10. Field: sorter
* 02. 11. Field: tabbed
* 02. 12. Field: media
* 02. 13. Field: notice
* 02. 14. Field: border, spacing, dimensions
* 02. 15. Field: background
* 02. 16. Field: spinner
* 02. 17. Field: slider
* 02. 18. Field: button_set
* 02. 19. Field: link_color
* 02. 20. Field: color_group
* 02. 21. Field: palette
* 02. 22. Field: accordion
* 02. 23. Field: date
* 02. 24. Field: map
* 02. 25. Field: sortable
* 02. 26. Field: number
* 03. Taxonomy
* 04. Profile
* 05. Nav Menu
* 06. Modal
* 07. Customizer
* 08. Responsive
* 09. Others
*
* ---------------------------------------------------------
*
*/
/**
* 01. Base
*/
.csf-options {
margin-left: 20px;
margin-right: 0;
}
/**
* 01. 01. Header
*/
.csf-header h1 {
float: right;
}
.csf-header fieldset {
float: left;
}
/**
* 01. 02. Header Buttons
*/
.csf-buttons {
float: left;
direction: ltr;
}
.csf-header-left {
float: right;
}
.csf-header-right {
float: left;
}
/**
* 01. 03. Navigation
*/
.csf-nav {
float: right;
}
.csf-nav ul {
clear: right;
}
.csf-nav ul li .csf-active:after {
right: auto;
left: 0;
border-left-color: #fff;
border-right-color: transparent;
}
.csf-nav ul li .csf-arrow:after {
content: "\f053";
right: auto;
left: 10px;
}
.csf-nav ul li.csf-tab-expanded .csf-arrow:after {
transform: rotate(-90deg);
}
.csf-nav ul ul li a {
padding-right: 25px;
padding-left: 15px;
}
.csf-nav ul ul:before {
left: auto;
right: 15px;
}
.csf-nav .csf-tab-icon {
margin-left: 5px;
margin-right: 0;
}
.csf-nav-background {
left: auto;
right: 0;
}
/**
* 01. 04. Content
*/
.csf-content {
margin-left: 0;
margin-right: 225px;
}
/**
* 01. 05. Section
*/
.csf-sections {
float: right;
}
/**
* 01. 06. Show all options
*/
.csf-show-all .csf-content {
margin-right: 0;
overflow: hidden;
}
.csf-expand-all {
float: right;
right: auto;
left: 40px;
margin-right: 0;
margin-left: 4px;
}
/**
* 01. 07. Search Input
*/
.csf-search {
float: right;
}
.csf-search input {
margin: 0 0 0 5px;
}
/**
* 01. 08. Copyright
*/
.csf-copyright {
float: right;
}
/**
* 01. 09. Metabox
*/
.csf-metabox {
margin: -6px -12px -12px -12px;
}
.csf-metabox .csf-section-title {
padding: 20px;
}
.csf-section-title .csf-section-icon {
margin-left: 5px;
margin-right: 0;
}
/**
* 02. Fields
*/
.csf-field .csf-title {
float: right;
}
.csf-field .csf-fieldset {
float: left;
}
.csf-pseudo-field {
padding: 0 0 0 5px !important;
}
/**
* 02. 01. Field: typography
*/
.csf-field-typography select {
margin: 0;
width: 100%;
}
.csf-field-typography .csf--blocks-inputs .csf--blocks {
flex-direction: row-reverse;
}
.csf-field-typography .csf--unit {
left: 4px;
right: auto;
}
/**
* 02. 02. Field: checkbox, radio
*/
.csf-field-checkbox ul ul li,
.csf-field-radio ul ul li {
margin-left: 0;
margin-right: 8px;
}
.csf-field-checkbox ul ul li:first-child,
.csf-field-radio ul ul li:first-child {
margin-right: 0;
}
.csf-field-checkbox .csf--inline-list li,
.csf-field-radio .csf--inline-list li {
margin-right: 0;
margin-left: 15px;
}
.csf-field-checkbox .csf--text,
.csf-field-radio .csf--text {
margin-left: 0;
margin-right: 5px;
}
/**
* 02. 03. Field: switcher
*/
.csf-field-switcher .csf--switcher {
float: right;
}
.csf-field-switcher .csf--label {
float: right;
margin-left: 0;
margin-right: 5px;
}
/**
* 02. 04. Field: upload
*/
.csf-field-upload .csf--remove,
.csf-field-upload .csf--button {
margin-left: 0;
margin-right: 5px;
}
/**
* 02. 05. Field: group
*/
.csf-field-group .csf-cloneable-title {
padding: 15px 10px 15px 65px;
}
.csf-field-group .csf-cloneable-helper {
right: auto;
left: 10px;
}
/**
* 02. 06. Field: repeater
*/
.csf-field-repeater .csf-repeater-helper {
border-left: 0;
border-right: 1px solid #eee;
}
/**
* 02. 07. Field: help
*/
.csf-help {
right: auto;
left: 5px;
}
/**
* 02. 08. Field: icon
*/
.csf-field-icon .button {
margin-right: 0;
margin-left: 5px;
}
.csf-field-icon .csf-icon-preview i {
margin-right: 0;
margin-left: 5px;
}
/**
* 02. 09. Field: gallery
*/
.csf-field-gallery ul li {
margin-right: 0;
margin-left: 5px;
}
.csf-field-gallery .button {
margin-right: 0;
margin-left: 5px;
}
/**
* 02. 11. Field: tabbed
*/
.csf-field-tabbed .csf-tabbed-nav .csf--icon {
padding-right: 0;
padding-left: 5px;
}
.csf-field-tabbed .csf-tabbed-nav a {
margin-right: 0;
margin-left: 5px;
}
/**
* 02. 12. Field: media
*/
.csf-field-media .button {
margin-left: 0;
margin-right: 7px;
}
.csf-field-media .hidden + .button {
margin-right: 0;
}
/**
* 02. 13. Field: notice
*/
.csf-notice {
border-left: none;
border-right-style: solid;
border-right-width: 4px;
}
/**
* 02. 14. Field: border, spacing, dimensions
*/
.csf-field-dimensions .csf--input,
.csf-field-dimensions .csf-fieldset,
.csf-field-spacing .csf--input,
.csf-field-spacing .csf-fieldset,
.csf-field-border .csf--input,
.csf-field-border .csf-fieldset {
direction: ltr;
}
.csf-field-dimensions .csf--inputs,
.csf-field-dimensions .csf--color,
.csf-field-spacing .csf--inputs,
.csf-field-spacing .csf--color,
.csf-field-border .csf--inputs,
.csf-field-border .csf--color {
float: right;
}
.csf-field-dimensions .csf--color,
.csf-field-spacing .csf--color,
.csf-field-border .csf--color {
margin-right: 4px;
direction: rtl;
}
/**
* 02. 15. Field: background
*/
.csf-field-background .csf--block {
float: right;
}
.csf-field-background .csf--select,
.csf-field-background .csf--media {
padding-right: 0;
}
.csf-field-background .csf--title {
margin-right: 0;
margin-left: 5px;
}
/**
* 02. 16. Field: spinner
*/
.csf-field-spinner .csf--spin {
float: right;
direction: ltr;
}
/**
* 02. 17. Field: slider
*/
.csf-field-slider .csf-slider-ui {
direction: ltr;
margin-right: 0;
margin-left: 15px;
}
.csf-field-slider .csf--input {
direction: ltr;
}
/**
* 02. 18. Field: button_set
*/
.csf-field-button_set .csf--button-group {
float: right;
}
/**
* 02. 19. Field: link_color
*/
.csf-field-link_color .csf--left {
float: right;
margin-right: 0;
margin-left: 10px;
}
/**
* 02. 20. Field: color_group
*/
.csf-field-color_group .csf--left {
float: right;
margin-right: 0;
margin-left: 10px;
}
/**
* 02. 21. Field: palette
*/
.csf-field-palette .csf--palette {
margin-right: 0;
margin-left: 10px;
}
/**
* 02. 22. Field: accordion
*/
.csf-field-accordion .csf--icon {
margin-right: 0;
margin-left: 2px;
}
/**
* 02. 23. Field: date
*/
.csf-field-date .csf--to {
margin-left: 0;
margin-right: 7px;
}
/**
* 02. 24. Field: map
*/
.csf-field-map .csf--map-input:last-child {
padding-left: 0;
padding-right: 10px;
}
/**
* 02. 25. Field: sortable
*/
.csf-field-sortable .csf-sortable-helper {
border-left: none;
border-right: 1px solid #eee;
}
/**
* 02. 26. Field: number
*/
.csf-field-number .csf--wrap {
float: right;
}
.csf-field-number .csf--unit {
left: 4px;
right: auto;
}
/**
* 03. Taxonomy
*/
.csf-taxonomy-add-fields {
margin-right: 0;
margin-left: 30px;
}
.csf-taxonomy-add-fields .csf-field > .csf-fieldset > .csf-help {
left: -5px;
right: auto;
}
.csf-taxonomy-edit-fields {
margin-right: 0;
margin-left: 35px;
}
.csf-taxonomy-edit-fields .csf-field > .csf-fieldset > .csf-help {
right: auto;
left: -5px;
}
/**
* 04. Profile
*/
.csf-profile-options > h2 > .fa {
padding-right: 0;
padding-left: 7px;
}
.csf-profile-options > .csf-field > .csf-fieldset > .csf-help {
left: -5px;
right: auto;
}
/**
* 05. Nav Menu
*/
.csf-nav-menu-options > .csf-fields {
margin-left: 0;
margin-right: -10px;
}
.csf-nav-menu-title {
padding-left: 14px;
padding-right: 12px;
}
.csf-nav-menu-icon {
margin-right: 0;
margin-left: 5px;
}
/**
* 06. Modal
*/
.csf-modal-content .csf-field {
padding: 15px 15px 15px 30px;
}
.csf-modal-title {
padding: 0 16px 0 36px;
}
.csf-modal-close {
right: auto;
left: 0;
}
/**
* 07. Customizer
*/
.control-section .csf-field .csf-fieldset {
margin-right: 0;
}
/**
* 08. Responsive
*/
@media only screen and (max-width: 1200px) {
.csf-metabox .csf-field .csf-fieldset {
margin-left: 0;
}
}
@media only screen and (max-width: 782px) {
.csf .csf-fieldset,
.csf .csf-content {
margin-right: 0;
}
}
/**
* 09. Others
*/
.csf-field .csf--transparent-slider {
margin-left: 0;
margin-right: 2px;
}
.csf-field .csf--transparent-slider .ui-slider-handle {
margin: 0 -11px;
}
.csf-field .csf--transparent-offset {
background-position: center right;
}
.csf-field .csf--transparent-text {
right: auto;
left: 10px;
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><rect x="0" fill="none" width="20" height="20"/><g><g fill="#fff"><path d="M20 10c0-5.52-4.48-10-10-10S0 4.48 0 10s4.48 10 10 10 10-4.48 10-10zM10 1.01c4.97 0 8.99 4.02 8.99 8.99s-4.02 8.99-8.99 8.99S1.01 14.97 1.01 10 5.03 1.01 10 1.01zM8.01 14.82L4.96 6.61c.49-.03 1.05-.08 1.05-.08.43-.05.38-1.01-.06-.99 0 0-1.29.1-2.13.1-.15 0-.33 0-.52-.01 1.44-2.17 3.9-3.6 6.7-3.6 2.09 0 3.99.79 5.41 2.09-.6-.08-1.45.35-1.45 1.42 0 .66.38 1.22.79 1.88.31.54.5 1.22.5 2.21 0 1.34-1.27 4.48-1.27 4.48l-2.71-7.5c.48-.03.75-.16.75-.16.43-.05.38-1.1-.05-1.08 0 0-1.3.11-2.14.11-.78 0-2.11-.11-2.11-.11-.43-.02-.48 1.06-.05 1.08l.84.08 1.12 3.04zm6.02 2.15L16.64 10s.67-1.69.39-3.81c.63 1.14.94 2.42.94 3.81 0 2.96-1.56 5.58-3.94 6.97zM2.68 6.77L6.5 17.25c-2.67-1.3-4.47-4.08-4.47-7.25 0-1.16.2-2.23.65-3.23zm7.45 4.53l2.29 6.25c-.75.27-1.57.42-2.42.42-.72 0-1.41-.11-2.06-.3z"/></g></g></svg>

After

Width:  |  Height:  |  Size: 940 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><rect x="0" fill="none" width="20" height="20"/><g><g fill="#fff"><path d="M13.11 4.36L9.87 7.6 8 5.73l3.24-3.24c.35-.34 1.05-.2 1.56.32.52.51.66 1.21.31 1.55zm-8 1.77l.91-1.12 9.01 9.01-1.19.84c-.71.71-2.63 1.16-3.82 1.16H6.14L4.9 17.26c-.59.59-1.54.59-2.12 0-.59-.58-.59-1.53 0-2.12l1.24-1.24v-3.88c0-1.13.4-3.19 1.09-3.89zm7.26 3.97l3.24-3.24c.34-.35 1.04-.21 1.55.31.52.51.66 1.21.31 1.55l-3.24 3.25z"/></g></g></svg>

After

Width:  |  Height:  |  Size: 482 B

View File

@@ -0,0 +1,79 @@
/**
*
* -----------------------------------------------------------
*
* Codestar Framework Gutenberg Block
* A Simple and Lightweight WordPress Option Framework
*
* -----------------------------------------------------------
*
*/
( function( blocks, blockEditor, element, components ) {
if ( !window.csf_gutenberg_blocks ) { return; }
Object.values(window.csf_gutenberg_blocks).forEach( function( block ) {
var registerBlockType = blocks.registerBlockType;
var PlainText = blockEditor.PlainText;
var createElement = element.createElement;
var RawHTML = element.RawHTML;
var Button = components.Button;
registerBlockType('csf-gutenberg-block/block-'+block.hash, {
title: block.gutenberg.title,
description: block.gutenberg.description,
icon: block.gutenberg.icon || 'screenoptions',
category: block.gutenberg.category || 'widgets',
keywords: block.gutenberg.keywords,
supports: {
html: false,
className: false,
customClassName: false,
},
attributes: {
shortcode: {
string: 'string',
source: 'text',
}
},
edit: function (props) {
return (
createElement('div', {className: 'csf-shortcode-block'},
createElement(Button, {
'data-modal-id': block.modal_id,
'data-gutenberg-id': block.hash,
className: 'is-secondary csf-shortcode-button',
onClick: function () {
window.csf_gutenberg_props = props;
},
}, block.button_title ),
createElement(PlainText, {
placeholder: block.gutenberg.placeholder,
className: 'input-control blocks-shortcode__textarea',
onChange: function (value) {
props.setAttributes({
shortcode: value
});
},
value: props.attributes.shortcode
})
)
);
},
save: function (props) {
return createElement(RawHTML, {}, props.attributes.shortcode);
}
});
});
})(
window.wp.blocks,
window.wp.blockEditor,
window.wp.element,
window.wp.components
);

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,728 @@
/**
*
* ---------------------------------------------------------
* CODESTAR FRAMEWORK RTL CSS MAP
* ---------------------------------------------------------
*
* 01. Base
* 01. 01. Header
* 01. 02. Header Buttons
* 01. 03. Navigation
* 01. 04. Content
* 01. 05. Section
* 01. 06. Show All Settings
* 01. 07. Search Input
* 01. 08. Copyright
* 01. 09. Metabox
* 02. Fields
* 02. 01. Field: typography
* 02. 02. Field: checkbox, radio
* 02. 03. Field: switcher
* 02. 04. Field: upload
* 02. 05. Field: group
* 02. 06. Field: repeater
* 02. 07. Field: help
* 02. 08. Field: icon
* 02. 09. Field: gallery
* 02. 10. Field: sorter
* 02. 11. Field: tabbed
* 02. 12. Field: media
* 02. 13. Field: notice
* 02. 14. Field: border, spacing, dimensions
* 02. 15. Field: background
* 02. 16. Field: spinner
* 02. 17. Field: slider
* 02. 18. Field: button_set
* 02. 19. Field: link_color
* 02. 20. Field: color_group
* 02. 21. Field: palette
* 02. 22. Field: accordion
* 02. 23. Field: date
* 02. 24. Field: map
* 02. 25. Field: sortable
* 02. 26. Field: number
* 03. Taxonomy
* 04. Profile
* 05. Nav Menu
* 06. Modal
* 07. Customizer
* 08. Responsive
* 09. Others
*
* ---------------------------------------------------------
*
*/
/**
* 01. Base
*/
.csf-options{
margin-left: 20px;
margin-right: 0;
}
/**
* 01. 01. Header
*/
.csf-header{
h1{
float: right;
}
fieldset{
float: left;
}
}
/**
* 01. 02. Header Buttons
*/
.csf-buttons{
float: left;
direction: ltr;
}
.csf-header-left{
float: right;
}
.csf-header-right{
float: left;
}
/**
* 01. 03. Navigation
*/
.csf-nav{
float: right;
ul{
clear: right;
li{
.csf-active:after{
right: auto;
left: 0;
border-left-color: #fff;
border-right-color: transparent;
}
.csf-arrow:after{
content: "\f053";
right: auto;
left: 10px;
}
&.csf-tab-expanded .csf-arrow:after{
transform: rotate(-90deg);
}
}
ul{
li{
a{
padding-right: 25px;
padding-left: 15px;
}
}
&:before{
left: auto;
right: 15px;
}
}
}
.csf-tab-icon{
margin-left: 5px;
margin-right: 0;
}
}
.csf-nav-background{
left: auto;
right: 0;
}
/**
* 01. 04. Content
*/
.csf-content{
margin-left: 0;
margin-right: 225px;
}
/**
* 01. 05. Section
*/
.csf-sections{
float: right;
}
/**
* 01. 06. Show all options
*/
.csf-show-all .csf-content{
margin-right: 0;
overflow: hidden;
}
.csf-expand-all{
float: right;
right: auto;
left: 40px;
margin-right: 0;
margin-left: 4px;
}
/**
* 01. 07. Search Input
*/
.csf-search{
float: right;
input{
margin: 0 0 0 5px;
}
}
/**
* 01. 08. Copyright
*/
.csf-copyright{
float: right;
}
/**
* 01. 09. Metabox
*/
.csf-metabox{
margin: -6px -12px -12px -12px;
.csf-section-title{
padding: 20px;
}
}
.csf-section-title{
.csf-section-icon{
margin-left: 5px;
margin-right: 0;
}
}
/**
* 02. Fields
*/
.csf-field{
.csf-title{
float: right;
}
.csf-fieldset{
float: left;
}
}
.csf-pseudo-field{
padding: 0 0 0 5px !important;
}
/**
* 02. 01. Field: typography
*/
.csf-field-typography{
select{
margin: 0;
width: 100%;
}
.csf--blocks-inputs{
.csf--blocks{
flex-direction: row-reverse;
}
}
.csf--unit{
left: 4px;
right: auto;
}
}
/**
* 02. 02. Field: checkbox, radio
*/
.csf-field-checkbox,
.csf-field-radio{
ul ul li{
margin-left: 0;
margin-right: 8px;
&:first-child{
margin-right: 0;
}
}
.csf--inline-list li{
margin-right: 0;
margin-left: 15px;
}
.csf--text{
margin-left: 0;
margin-right: 5px;
}
}
/**
* 02. 03. Field: switcher
*/
.csf-field-switcher{
.csf--switcher{
float: right;
}
.csf--label{
float: right;
margin-left: 0;
margin-right: 5px;
}
}
/**
* 02. 04. Field: upload
*/
.csf-field-upload{
.csf--remove,
.csf--button{
margin-left: 0;
margin-right: 5px;
}
}
/**
* 02. 05. Field: group
*/
.csf-field-group{
.csf-cloneable-title{
padding: 15px 10px 15px 65px;
}
.csf-cloneable-helper{
right: auto;
left: 10px;
}
}
/**
* 02. 06. Field: repeater
*/
.csf-field-repeater{
.csf-repeater-helper{
border-left: 0;
border-right: 1px solid #eee;
}
}
/**
* 02. 07. Field: help
*/
.csf-help{
right: auto;
left: 5px;
}
/**
* 02. 08. Field: icon
*/
.csf-field-icon{
.button{
margin-right: 0;
margin-left: 5px;
}
.csf-icon-preview i{
margin-right: 0;
margin-left: 5px;
}
}
/**
* 02. 09. Field: gallery
*/
.csf-field-gallery{
ul li{
margin-right: 0;
margin-left: 5px;
}
.button{
margin-right: 0;
margin-left: 5px;
}
}
/**
* 02. 11. Field: tabbed
*/
.csf-field-tabbed{
.csf-tabbed-nav{
.csf--icon{
padding-right: 0;
padding-left: 5px;
}
a{
margin-right: 0;
margin-left: 5px;
}
}
}
/**
* 02. 12. Field: media
*/
.csf-field-media{
.button{
margin-left: 0;
margin-right: 7px;
}
.hidden + .button{
margin-right: 0;
}
}
/**
* 02. 13. Field: notice
*/
.csf-notice{
border-left: none;
border-right-style: solid;
border-right-width: 4px;
}
/**
* 02. 14. Field: border, spacing, dimensions
*/
.csf-field-dimensions,
.csf-field-spacing,
.csf-field-border{
.csf--input,
.csf-fieldset{
direction: ltr;
}
.csf--inputs,
.csf--color{
float: right;
}
.csf--color{
margin-right: 4px;
direction: rtl;
}
}
/**
* 02. 15. Field: background
*/
.csf-field-background{
.csf--block{
float: right;
}
.csf--select,
.csf--media{
padding-right: 0;
}
.csf--title{
margin-right: 0;
margin-left: 5px;
}
}
/**
* 02. 16. Field: spinner
*/
.csf-field-spinner{
.csf--spin{
float: right;
direction: ltr;
}
}
/**
* 02. 17. Field: slider
*/
.csf-field-slider{
.csf-slider-ui{
direction: ltr;
margin-right: 0;
margin-left: 15px;
}
.csf--input{
direction: ltr;
}
}
/**
* 02. 18. Field: button_set
*/
.csf-field-button_set{
.csf--button-group{
float: right;
}
}
/**
* 02. 19. Field: link_color
*/
.csf-field-link_color{
.csf--left{
float: right;
margin-right: 0;
margin-left: 10px;
}
}
/**
* 02. 20. Field: color_group
*/
.csf-field-color_group{
.csf--left{
float: right;
margin-right: 0;
margin-left: 10px;
}
}
/**
* 02. 21. Field: palette
*/
.csf-field-palette{
.csf--palette{
margin-right: 0;
margin-left: 10px;
}
}
/**
* 02. 22. Field: accordion
*/
.csf-field-accordion{
.csf--icon{
margin-right: 0;
margin-left: 2px;
}
}
/**
* 02. 23. Field: date
*/
.csf-field-date{
.csf--to {
margin-left: 0;
margin-right: 7px;
}
}
/**
* 02. 24. Field: map
*/
.csf-field-map{
.csf--map-input:last-child {
padding-left: 0;
padding-right: 10px;
}
}
/**
* 02. 25. Field: sortable
*/
.csf-field-sortable{
.csf-sortable-helper{
border-left: none;
border-right: 1px solid #eee;
}
}
/**
* 02. 26. Field: number
*/
.csf-field-number{
.csf--wrap{
float: right;
}
.csf--unit{
left: 4px;
right: auto;
}
}
/**
* 03. Taxonomy
*/
.csf-taxonomy-add-fields{
margin-right: 0;
margin-left: 30px;
.csf-field > .csf-fieldset > .csf-help{
left: -5px;
right: auto;
}
}
.csf-taxonomy-edit-fields{
margin-right: 0;
margin-left: 35px;
.csf-field > .csf-fieldset > .csf-help{
right: auto;
left: -5px;
}
}
/**
* 04. Profile
*/
.csf-profile-options{
> h2 > .fa{
padding-right: 0;
padding-left: 7px;
}
> .csf-field{
> .csf-fieldset{
> .csf-help{
left: -5px;
right: auto;
}
}
}
}
/**
* 05. Nav Menu
*/
.csf-nav-menu-options{
> .csf-fields{
margin-left: 0;
margin-right: -10px;
}
}
.csf-nav-menu-title {
padding-left: 14px;
padding-right: 12px;
}
.csf-nav-menu-icon{
margin-right: 0;
margin-left: 5px;
}
/**
* 06. Modal
*/
.csf-modal-content{
.csf-field{
padding: 15px 15px 15px 30px;
}
}
.csf-modal-title{
padding: 0 16px 0 36px;
}
.csf-modal-close{
right: auto;
left: 0;
}
/**
* 07. Customizer
*/
.control-section{
.csf-field{
.csf-fieldset{
margin-right: 0;
}
}
}
/**
* 08. Responsive
*/
@media only screen and (max-width:1200px){
.csf-metabox .csf-field .csf-fieldset{
margin-left: 0;
}
}
@media only screen and (max-width:782px){
.csf .csf-fieldset,
.csf .csf-content{
margin-right: 0;
}
}
/**
* 09. Others
*/
.csf-field{
.csf--transparent-slider{
margin-left: 0;
margin-right: 2px;
.ui-slider-handle{
margin: 0 -11px;
}
}
.csf--transparent-offset{
background-position: center right;
}
.csf--transparent-text{
right: auto;
left: 10px;
}
}

View File

@@ -0,0 +1,95 @@
/**
*
* ---------------------------------------------------------
* CODESTAR FRAMEWORK CSS MAP
* ---------------------------------------------------------
*
* 01. Base
* 01. 01. Header
* 01. 02. Sticky
* 01. 03. Header Buttons
* 01. 04. Navigation
* 01. 05. Wrapper
* 01. 06. Content
* 01. 07. Section
* 01. 08. Footer
* 01. 09. Copyright
* 01. 10. Show All Settings
* 01. 11. Search Input
* 01. 12. Metabox
* 01. 13. Comment Metabox
* 01. 14. Help Tooltip
* 02. Themes
* 02. 01. Theme Dark
* 02. 02. Theme Light
* 03. Fields
* 03. 01. Field
* 03. 02. Field: accordion
* 03. 03. Field: background
* 03. 04. Field: backup
* 03. 05. Field: border, spacing, dimensions
* 03. 06. Field: button_set
* 03. 07. Field: checkbox, radio
* 03. 08. Field: code_editor
* 03. 09. Field: color
* 03. 10. Field: color_group
* 03. 11. Field: fieldset
* 03. 12. Field: date
* 03. 13. Field: gallery
* 03. 14. Field: group
* 03. 15. Field: icon
* 03. 16. Field: image_select
* 03. 17. Field: link_color
* 03. 18. Field: map
* 03. 19. Field: media
* 03. 20. Field: palette
* 03. 21. Field: repeater
* 03. 22. Field: select
* 03. 23. Field: slider
* 03. 24. Field: sortable
* 03. 25. Field: sorter
* 03. 26. Field: spinner
* 03. 27. Field: switcher
* 03. 28. Field: tabbed
* 03. 29. Field: text
* 03. 30. Field: textarea
* 03. 31. Field: typography
* 03. 32. Field: upload
* 03. 33. Field: wp_editor
* 03. 34. Field: heading
* 03. 35. Field: subheading
* 03. 36. Field: submessage
* 03. 37. Field: notice
* 03. 38. Field: number
* 03. 39. Field: link
* 03. 40. Field: others
* 04. Widget
* 05. Customizer
* 06. Taxonomy
* 07. Profile
* 08. Nav Menu
* 09. Modal
* 09. 01. Shortcode Modal
* 09. 02. Gutenberg Modal
* 09. 03. Icon Modal
* 10. Helper
* 11. Welcome Page
* 12. Responsive
* 13. Others
*
* ---------------------------------------------------------
*
*/
@import "vendor/base";
@import "vendor/themes";
@import "vendor/fields";
@import "vendor/widget";
@import "vendor/customizer";
@import "vendor/taxonomy";
@import "vendor/navmenu";
@import "vendor/profile";
@import "vendor/modal";
@import "vendor/helper";
@import "vendor/welcome";
@import "vendor/responsive";
@import "vendor/chosen";

View File

@@ -0,0 +1,470 @@
/**
* 01. Base
*/
.csf{
position: relative;
label{
padding: 0;
margin: 0;
display: inline-block;
}
}
.csf-ab-icon{
top: 2px;
}
#screen-meta-links + .csf-options{
margin-top: 40px;
}
.csf-options{
margin-top: 20px;
margin-right: 20px;
}
/**
* 01. 01. Header
*/
.csf-header{
position: relative;
}
.csf-header-inner{
padding: 25px;
transition: box-shadow .3s ease;
h1{
float: left;
font-size: 1.5em;
line-height: 26px;
font-weight: 400;
margin: 0;
small{
font-size: 11px;
font-weight: 500;
}
}
}
/**
* 01. 02. Sticky
*/
.csf-sticky{
.csf-header-inner{
position: fixed;
z-index: 99;
top: 32px;
box-shadow: 0 5px 10px rgba(0,0,0,0.1);
}
}
/**
* 01. 03. Header Buttons
*/
.csf-buttons{
float: right;
.button{
margin: 0 2px;
line-height: 26px;
&:focus{
outline: none !important;
box-shadow: none !important;
}
}
.csf-save{
min-width: 72px;
}
}
.csf-header-left{
float: left;
}
.csf-header-right{
float: right;
}
/**
* 01. 04. Navigation
*/
.csf-nav{
display: block;
position: relative;
z-index: 10;
float: left;
ul{
clear: left;
margin: 0;
list-style-type: none;
li{
margin-bottom: 0;
a{
font-size: 13px;
position: relative;
display: block;
padding: 14px 12px;
text-decoration: none;
transition-property: color, background;
transition-duration: 0.2s;
transition-timing-function: ease;
&:focus{
outline: none;
box-shadow: none;
}
}
.csf-arrow:after{
content: "\f054";
display: inline-block;
font-family: "Font Awesome 5 Pro", "Font Awesome 5 Free", "FontAwesome";
font-weight: 900;
font-size: 9px;
line-height: 1;
position: absolute;
right: 10px;
top: 50%;
margin-top: -4px;
}
&.csf-tab-expanded{
.csf-arrow:after{
transform: rotate(90deg);
}
ul{
display: block;
}
}
}
ul{
display: none;
position: relative;
li{
a{
font-size: 12px;
padding: 12px 14px 12px 24px;
}
}
}
}
.csf-tab-icon{
width: 20px;
margin-right: 5px;
font-size: 13px;
text-align: center;
}
.csf-label-error{
margin-left: 4px;
vertical-align: top;
}
}
.csf-nav-normal{
width: 225px;
+ .csf-content{
margin-left: 225px;
}
}
.csf-nav-inline{
width: 100%;
ul{
li{
display: inline-block;
vertical-align: top;
}
}
}
.csf-nav-background{
position: absolute;
top: 0;
left: 0;
bottom: 0;
z-index: 9;
width: 225px;
}
/**
* 01. 05. Wrapper
*/
.csf-wrapper{
position: relative;
}
/**
* 01. 06. Content
*/
.csf-content{
position: relative;
background-color: #fff;
}
/**
* 01. 07. Section
*/
.csf-sections{
float: left;
width: 100%;
}
.csf-section-title{
display: none;
padding: 20px 30px;
background-color: #f5f5f5;
border-top: 1px solid #eee;
border-bottom: 1px solid #eee;
h3{
margin: 0;
padding: 0 ;
font-size: 13px;
font-weight: bold;
text-transform: uppercase;
}
.csf-section-icon{
margin-right: 5px;
}
}
/**
* 01. 08. Footer
*/
.csf-footer{
padding: 20px;
font-size: 11px;
}
/**
* 01. 09. Copyright
*/
.csf-copyright{
float: left;
margin-top: 5px;
}
/**
* 01. 10. Show All Settings
*/
.csf-search-all,
.csf-show-all{
.csf-nav-background,
.csf-nav{
display: none;
}
.csf-content{
margin-left: 0;
}
.csf-section-title,
.csf-section{
display: block !important;
}
}
.csf-search-all{
.csf-section-title{
display: none !important;
}
}
//
// Expand
//
.csf-expand-all{
float: left;
padding: 0 8px;
margin-right: 4px;
z-index: 1;
font-size: 13px;
line-height: 30px;
cursor: pointer;
user-select: none;
border-radius: 2px;
transition: all .2s;
span{
font-size: 11px;
vertical-align: middle;
}
}
/**
* 01. 11. Search Input
*/
.csf-search{
float: left;
input{
margin: 0 2px 0 0;
border: none;
font-size: 12px;
line-height: 30px;
min-height: 30px;
text-align: inherit;
padding: 0 10px;
border-radius: 2px;
box-shadow: none;
&:focus{
box-shadow: none;
}
}
}
.csf-saving{
.csf-buttons,
.csf-content{
cursor: default;
pointer-events: none;
opacity: 0.5;
}
}
/**
* 01. 12. Metabox
*/
.csf-metabox{
margin: -6px -12px -12px -12px;
.csf-field{
padding: 20px;
}
.csf-section-title{
padding: 20px;
}
}
.block-editor-page{
.csf-metabox{
margin: -6px -14px -14px -14px;
}
}
.block-editor-editor-skeleton__content{
.csf-metabox{
border-left: 1px solid #e2e4e7;
border-right: 1px solid #e2e4e7;
}
}
.csf-sections-reset{
float: left;
width: 100%;
text-align: right;
border-top: 1px solid #eee;
.csf-button-cancel,
input{
display: none;
}
label{
padding: 10px;
}
span{
-webkit-user-select: none;
user-select: none;
}
input:checked ~ .csf-button-reset{
display: none;
}
input:checked ~ .csf-button-cancel{
display: inline-block;
}
}
#side-sortables{
.csf-section-title{
padding: 12px;
}
.csf-field{
padding: 10px 15px;
.csf-title{
float: none;
width: 100%;
margin-bottom: 6px;
}
.csf-fieldset{
float: none;
width: 100%;
}
}
.csf-field-text input{
width: 100%;
}
.csf-notice{
padding: 10px 15px;
}
}
/**
* 01. 13. Comment Metabox
*/
.csf-comment-metabox{
margin: -6px -12px -12px -12px;
.csf-field{
padding: 20px;
}
.csf-section-title{
padding: 20px;
}
}
/**
* 01. 14. Help Tooltip
*/
.csf-tooltip{
position: absolute;
z-index: 5000001;
font-size: 12px;
line-height: 1.4;
text-align: center;
text-decoration: none;
padding: 6px 12px;
max-width: 200px;
color: #fff;
background-color: #000;
background-color: rgba(black, 0.85);
border-radius: 4px;
}

View File

@@ -0,0 +1,405 @@
/**
* Chosen JS Styles
*/
.chosen-container {
position: relative;
display: inline-block;
vertical-align: middle;
font-size: 13px;
user-select: none;
}
.chosen-container * {
box-sizing: border-box;
}
.chosen-container .chosen-drop {
position: absolute;
top: 100%;
z-index: 1010;
width: 100%;
border: 1px solid #aaa;
border-top: 0;
background: #fff;
box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
clip: rect(0, 0, 0, 0);
clip-path: inset(100% 100%);
}
.chosen-container.chosen-with-drop .chosen-drop {
clip: auto;
clip-path: none;
}
.chosen-container a {
cursor: pointer;
}
.chosen-container .search-choice .group-name, .chosen-container .chosen-single .group-name {
margin-right: 4px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-weight: normal;
color: #999999;
}
.chosen-container .search-choice .group-name:after, .chosen-container .chosen-single .group-name:after {
content: ":";
padding-left: 2px;
vertical-align: top;
}
.chosen-container-single .chosen-single {
position: relative;
display: block;
overflow: hidden;
padding: 0 0 0 8px;
height: 25px;
border: 1px solid #aaa;
border-radius: 5px;
background-color: #fff;
background: linear-gradient(#fff 20%, #f6f6f6 50%, #eee 52%, #f4f4f4 100%);
background-clip: padding-box;
box-shadow: 0 0 3px #fff inset, 0 1px 1px rgba(0, 0, 0, 0.1);
color: #444;
text-decoration: none;
white-space: nowrap;
line-height: 24px;
}
.chosen-container-single .chosen-default {
color: #999;
}
.chosen-container-single .chosen-single span {
display: block;
overflow: hidden;
margin-right: 26px;
text-overflow: ellipsis;
white-space: nowrap;
}
.chosen-container-single .chosen-single-with-deselect span {
margin-right: 38px;
}
.chosen-container-single .chosen-single abbr {
position: absolute;
top: 6px;
right: 26px;
display: block;
width: 12px;
height: 12px;
font-size: 1px;
}
.chosen-container-single .chosen-single div {
position: absolute;
top: 0;
right: 0;
display: block;
width: 18px;
height: 100%;
}
.chosen-container-single .chosen-single div b {
display: block;
width: 100%;
height: 100%;
}
.chosen-container-single .chosen-search {
position: relative;
z-index: 1010;
margin: 0;
padding: 3px 4px;
white-space: nowrap;
}
.chosen-container-single .chosen-search input[type="text"] {
margin: 1px 0;
padding: 4px 20px 4px 5px;
width: 100%;
height: auto;
outline: 0;
border: 1px solid #aaa;
font-size: 1em;
font-family: sans-serif;
line-height: normal;
border-radius: 0;
}
.chosen-container-single .chosen-drop {
margin-top: -1px;
border-radius: 0 0 4px 4px;
background-clip: padding-box;
}
.chosen-container-single.chosen-container-single-nosearch .chosen-search {
position: absolute;
clip: rect(0, 0, 0, 0);
clip-path: inset(100% 100%);
}
.chosen-container .chosen-results {
color: #444;
position: relative;
overflow-x: hidden;
overflow-y: auto;
margin: 0 4px 4px 0;
padding: 0 0 0 4px;
max-height: 240px;
-webkit-overflow-scrolling: touch;
}
.chosen-container .chosen-results li {
display: none;
margin: 0;
padding: 5px 6px;
list-style: none;
line-height: 15px;
word-wrap: break-word;
-webkit-touch-callout: none;
}
.chosen-container .chosen-results li.active-result {
display: list-item;
cursor: pointer;
}
.chosen-container .chosen-results li.disabled-result {
display: list-item;
color: #ccc;
cursor: default;
}
.chosen-container .chosen-results li.highlighted {
background-color: #3875d7;
background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
color: #fff;
}
.chosen-container .chosen-results li.no-results {
color: #777;
display: list-item;
background: #f4f4f4;
}
.chosen-container .chosen-results li.group-result {
display: list-item;
font-weight: bold;
cursor: default;
}
.chosen-container .chosen-results li.group-option {
padding-left: 15px;
}
.chosen-container .chosen-results li em {
font-style: normal;
text-decoration: underline;
}
.chosen-container-multi .chosen-choices {
position: relative;
overflow: hidden;
margin: 0;
padding: 0 5px;
width: 100%;
height: auto;
border: 1px solid #aaa;
background-color: #fff;
background-image: linear-gradient(#eee 1%, #fff 15%);
cursor: text;
}
.chosen-container-multi .chosen-choices li {
float: left;
list-style: none;
}
.chosen-container-multi .chosen-choices li.search-field {
margin: 0;
padding: 0;
white-space: nowrap;
}
.chosen-container-multi .chosen-choices li.search-field input[type="text"] {
margin: 1px 0;
padding: 0;
outline: 0;
border: 0 !important;
background: transparent !important;
box-shadow: none;
color: #999;
font-size: 100%;
font-family: sans-serif;
line-height: normal;
border-radius: 0;
width: 25px;
height: 25px;
min-height: 25px;
}
.chosen-container-multi .chosen-choices li.search-choice {
position: relative;
margin: 3px 5px 3px 0;
padding: 3px 20px 3px 6px;
border: 1px solid #aaa;
max-width: 100%;
border-radius: 3px;
background-color: #eeeeee;
background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
background-size: 100% 19px;
background-repeat: repeat-x;
background-clip: padding-box;
box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
color: #333;
line-height: 13px;
cursor: default;
}
.chosen-container-multi .chosen-choices li.search-choice span {
word-wrap: break-word;
white-space: nowrap;
}
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
position: absolute;
top: 0;
right: 0;
display: block;
width: 12px;
height: 12px;
font-size: 1px;
}
.chosen-container-multi .chosen-choices li.search-choice-disabled {
padding-right: 5px;
border: 1px solid #ccc;
background-color: #e4e4e4;
background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
color: #666;
}
.chosen-container-multi .chosen-choices li.search-choice-focus {
background: #d4d4d4;
}
.chosen-container-multi .chosen-results {
margin: 0;
padding: 0;
}
.chosen-container-multi .chosen-drop .result-selected {
display: list-item;
color: #ccc;
cursor: default;
}
.chosen-container-active .chosen-single {
border: 1px solid #5897fb;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
.chosen-container-active.chosen-with-drop .chosen-single {
border: 1px solid #aaa;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
background-image: linear-gradient(#eee 20%, #fff 80%);
box-shadow: 0 1px 0 #fff inset;
}
.chosen-container-active.chosen-with-drop .chosen-single div {
border-left: none;
background: transparent;
}
.chosen-container-active .chosen-choices {
border: 1px solid #5897fb;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
.chosen-container-active .chosen-choices li.search-field input[type="text"] {
color: #222 !important;
}
.chosen-disabled {
opacity: 0.5 !important;
cursor: default;
}
.chosen-disabled .chosen-single {
cursor: default;
}
.chosen-disabled .chosen-choices .search-choice .search-choice-close {
cursor: default;
}
.chosen-rtl {
text-align: right;
}
.chosen-rtl .chosen-single {
overflow: visible;
padding: 0 8px 0 0;
}
.chosen-rtl .chosen-single span {
margin-right: 0;
margin-left: 26px;
direction: rtl;
}
.chosen-rtl .chosen-single-with-deselect span {
margin-left: 38px;
}
.chosen-rtl .chosen-single div {
right: auto;
left: 3px;
}
.chosen-rtl .chosen-single abbr {
right: auto;
left: 26px;
}
.chosen-rtl .chosen-choices li {
float: right;
}
.chosen-rtl .chosen-choices li.search-field input[type="text"] {
direction: rtl;
}
.chosen-rtl .chosen-choices li.search-choice {
margin: 3px 5px 3px 0;
padding: 3px 5px 3px 19px;
}
.chosen-rtl .chosen-choices li.search-choice .search-choice-close {
right: auto;
left: 4px;
}
.chosen-rtl.chosen-container-single .chosen-results {
margin: 0 0 4px 4px;
padding: 0 4px 0 0;
}
.chosen-rtl .chosen-results li.group-option {
padding-right: 15px;
padding-left: 0;
}
.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
border-right: none;
}
.chosen-rtl .chosen-search input[type="text"] {
padding: 4px 5px 4px 20px;
direction: rtl;
}

View File

@@ -0,0 +1,179 @@
/**
* 05. Widget
*/
.control-section{
.csf-field{
padding: 0;
.csf-title{
float: none;
width: 100%;
margin-bottom: 6px;
h4{
display: block;
font-size: 13px;
line-height: 1;
font-weight: 600;
color: inherit;
}
}
.csf-fieldset{
float: none;
width: 100%;
}
}
.csf-help{
top: -5px;
right: -5px;
}
.csf-field-select select{
width: 100%;
}
.csf-field-heading{
color: inherit;
font-size: 14px;
line-height: 1em;
margin-right: -15px;
margin-left: -15px;
padding: 15px;
}
.csf-field-subheading{
color: inherit;
font-size: 11px;
margin-right: -15px;
margin-left: -15px;
padding: 10px 15px;
}
.csf-subtitle-text{
margin-top: 4px;
font-size: 12px;
}
.csf-field-submessage .csf-submessage{
margin-right: -15px;
margin-left: -15px;
padding: 15px;
}
.csf-fieldset{
.csf-field-submessage .csf-submessage,
.csf-field-heading,
.csf-field-subheading{
margin-left: 0;
margin-right: 0;
}
}
.csf-field-date{
.csf--to{
margin-left: 0;
}
}
.csf-field-sorter{
ul li{
padding: 5px;
}
.csf-modules{
float: none;
width: 100%;
}
.csf-modules:first-child{
padding-right: 0;
padding-bottom: 15px;
}
}
.csf-field-background{
.csf--background-attributes{
flex-direction: column;
}
}
.csf-field-spacing{
input{
width: 90px;
}
}
.csf-field-border{
.csf--input{
flex: 1 50%;
}
input,
select{
width: 100%;
}
}
.csf-field-spinner{
input{
width: 50px;
}
}
.csf-field-number{
.csf--wrap{
width: 100%;
}
}
.csf-field-backup{
.csf-export-data{
display: none;
}
}
.csf-field-fieldset{
.csf-fieldset-content{
border-color: #e5e5e5;
}
}
.csf-tabbed-content,
.csf-sortable-content,
.csf-repeater-content,
.csf-fieldset-content,
.csf-cloneable-content,
.csf-accordion-content{
> .csf-field{
padding: 10px;
.csf-title{
margin-bottom: 5px;
}
h4{
font-size: 12px;
}
}
}
.csf-depend-hidden.csf-depend-on{
display: none !important;
}
.csf-depend-visible.csf-depend-on{
border-top: 0 !important;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,152 @@
/**
* 10. Helper
*/
.csf-subtitle-text{
margin-top: 6px;
font-weight: 400;
color: #999;
}
.csf-desc-text{
clear: both;
float: left;
width: 100%;
margin-top: 6px;
font-weight: 400;
color: #999;
}
.csf-error-text{
margin-top: 6px;
color: #d02c21;
}
.csf-before-text{
margin-bottom: 6px;
}
.csf-after-text{
margin-top: 6px;
}
.csf-metabox-hide{
display: none !important;
}
.csf-metabox-show{
display: block !important;
}
.csf-depend-hidden.csf-depend-on{
display: none;
}
.csf-depend-visible.csf-depend-on{
display: block;
opacity: 0.75;
filter: grayscale(1);
user-select: none;
border-top: 1px solid #eee;
.clear:before{
content: "";
left: 0;
top: 0;
right: 0;
bottom: 0;
position: absolute;
background-color: #eee;
opacity: 0.25;
z-index: 10;
}
}
.csf-warning-primary{
color: #fff !important;
border-color: #dc3545 !important;
background: #dc3545 !important;
&:hover,
&:focus{
border-color: #bd2130 !important;
background: #bd2130 !important;
}
&:focus{
box-shadow: 0 0 0 1px #fff, 0 0 0 3px #bd2130 !important;
}
&:active{
border-color: #bd2130 !important;
background: #bd2130 !important;
}
}
.csf-form-result{
display: none;
float: left;
padding: 0 8px;
margin-right: 4px;
font-size: 11px;
line-height: 30px;
user-select: none;
border-radius: 2px;
}
.csf-form-show{
display: block;
}
.csf-form-success{
color: #fff;
background-color: #46b450;
}
.csf-form-warning{
color: #8a6d3b;
background-color: #faebcc;
}
.csf-label-error{
position: relative;
top: -2px;
display: inline-block;
font-size: 10px;
line-height: 10px;
height: 10px;
width: 10px;
padding: 1px;
font-style: normal;
text-align: center;
color: #fff;
vertical-align: middle;
background-color: #e10000;
border-radius: 2px;
}
.csf-no-option{
padding: 30px;
}
.csf-input-number{
-moz-appearance:textfield;
}
.csf-input-number::-webkit-inner-spin-button,
.csf-input-number::-webkit-outer-spin-button{
-webkit-appearance: none;
margin: 0;
}
.csf-fa5-shims{
.csf{
.fas,
.far,
.fab{
font-family: "FontAwesome";
font-style: normal;
}
}
}

View File

@@ -0,0 +1,330 @@
/**
* 09. Modal
*/
.csf-modal{
position: fixed;
z-index: 100101;
top: 0;
left: 0;
width: 100%;
height: 100%;
&.hidden{
display: none;
}
}
.csf-modal-icon{
z-index: 100102;
}
.csf-modal-table{
display: table;
width: 100%;
height: 100%;
}
.csf-modal-table-cell{
display: table-cell;
vertical-align: middle;
margin: 100px 0;
}
.csf-modal-inner{
position: relative;
z-index: 10;
width: 760px;
height: 750px;
margin: 0 auto;
background-color: #fff;
}
.csf-modal-content{
position: relative;
overflow: hidden;
overflow-y: auto;
height: 595px;
.csf-shortcode-button{
display: none;
}
.csf-field{
padding: 15px 30px 15px 15px;
}
a{
&:active,
&:focus{
outline: none;
box-shadow: none;
}
}
h4{
font-size: 13px;
small{
font-style: italic;
font-weight: 400;
color: #aaa;
}
}
}
.csf-modal-title{
position: relative;
background-color: #fcfcfc;
border-bottom: 1px solid #ddd;
height: 36px;
font-size: 16px;
font-weight: 600;
line-height: 36px;
margin: 0;
padding: 0 36px 0 16px;
}
.csf-modal-header{
width: 100%;
padding: 14px 0;
background-color: #f5f5f5;
border-bottom: 1px solid #ddd;
select{
display: block;
width: 250px;
margin: 0 auto;
font-size: 13px;
line-height: 1;
height: 30px;
min-height: 30px;
background-color: #fff;
}
}
.csf-modal-close{
color: #666;
padding: 0;
position: absolute;
top: 0;
right: 0;
width: 36px;
height: 36px;
text-align: center;
background: none;
border: none;
cursor: pointer;
&:before{
font: normal 20px/36px dashicons;
content: "\f158";
vertical-align: top;
width: 36px;
height: 36px;
}
&:hover{
opacity: 0.5;
}
}
.csf-modal-insert-wrapper{
text-align: center;
width: 100%;
padding: 15px 0;
background-color: #f5f5f5;
border-top: 1px solid #ddd;
}
.csf-modal-overlay{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #000;
opacity: 0.5;
}
/**
* 09. 01. Shortcode Modal
*/
.csf--repeatable{
padding: 15px 15px 0 15px;
}
.csf--repeat-button-block{
text-align: center;
padding-bottom: 15px;
}
.csf--repeat-shortcode{
position: relative;
margin-bottom: 15px;
border: 1px dashed #ddd;
&:first-child{
.csf-repeat-remove{
display: none;
}
}
.csf-repeat-remove{
position: absolute;
right: 10px;
top: 10px;
z-index: 10;
cursor: pointer;
display: inline-block;
font-size: 11px;
width: 18px;
height: 18px;
line-height: 18px;
text-align: center;
border-radius: 2px;
color: #fff;
background-color: #e14d43;
opacity: 0.5;
&:hover{
opacity: 0.5;
}
}
}
.csf-shortcode-single{
.csf-modal-inner{
height: 750px;
}
.csf-modal-content{
height: 652px;
}
}
.elementor-editor-active{
.csf-shortcode-button{
margin-left: 5px;
}
.csf-modal .hidden{
display: none !important;
}
}
/**
* 09. 02. Gutenberg Modal
*/
.csf-shortcode-block{
text-align: center;
padding: 14px;
font-size: 13px;
background-color: #f5f5f5;
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
}
.csf-shortcode-block .components-button{
margin-bottom: 10px;
}
/**
* 09. 03. Icon Modal
*/
.csf-modal-icon{
.csf-icon-title{
padding: 15px 0;
margin: 4px;
font-size: 14px;
font-weight: bold;
text-align: center;
border: 1px solid #eee;
background-color: #f7f7f7;
}
.csf-modal-header{
text-align: center;
}
.csf-icon-search{
width: 50%;
height: 40px;
line-height: 40px;
}
i{
cursor: pointer;
display: inline-block;
margin: 4px;
width: 35px;
height: 35px;
line-height: 35px;
font-size: 16px;
color: #555;
text-align: center;
border: 1px solid #ccc;
background-color: #f7f7f7;
border-radius: 2px;
box-shadow: 1px 1px 0 rgba(0,0,0,0.05);
&:hover {
color: #fff;
border-color: #222;
background-color: #222;
}
}
.csf-modal-content{
padding: 10px;
height: 618px;
}
.csf-error-text{
padding: 10px;
}
}
.csf-modal-loading{
display: none;
position: absolute;
left: 15px;
top: 15px;
}
.csf-loading{
position: relative;
width: 20px;
height: 20px;
background: #ccc;
border-radius: 20px;
box-shadow: 0 2px 5px rgba(0,0,0,0.07);
&:after{
position: absolute;
top: 50%;
left: 50%;
width: 4px;
height: 4px;
content: "";
margin-top: -2px;
margin-left: -2px;
background-color: white;
animation-duration: 0.5s;
animation-iteration-count: infinite;
animation-timing-function: linear;
animation-name: csfLoader;
border-radius: 4px;
}
}
@keyframes csfLoader {
0% {
transform: rotate(0deg) translateX(-6px) rotate(0deg);
}
100% {
transform: rotate(360deg) translateX(-6px) rotate(-360deg);
}
}

View File

@@ -0,0 +1,60 @@
/**
* 08. Nav Menu
*/
.csf-nav-menu-options{
clear: both;
float: left;
width: 100%;
> .csf-fields{
margin-left: -10px;
margin-top: 10px;
margin-bottom: 10px;
border-top: 1px solid #eee;
border-bottom: 1px solid #eee;
> .csf-field{
padding: 12px 14px 12px 12px;
.csf-title{
float: none;
width: 100%;
margin-bottom: 5px;
}
.csf-fieldset{
float: none;
width: 100%;
}
}
}
.csf-field-text input{
width: 100%;
}
.csf-field-notice .csf-notice{
padding: 15px;
}
}
.csf-nav-menu-title{
padding: 12px 14px 12px 12px;
background-color: #f5f5f5;
border-top: 1px solid #eee;
border-bottom: 1px solid #eee;
&:first-child{
border-top: 0;
}
h4{
margin: 0;
padding: 0;
color: #23282d;
}
}
.csf-nav-menu-icon{
margin-right: 5px;
}

View File

@@ -0,0 +1,67 @@
/**
* 06. Profile
*/
.csf-profile-options{
> h2 > .fa {
padding-right: 7px;
}
> .csf-field{
max-width: 750px;
padding: 15px 0;
border-top: none !important;
> .csf-title{
width: 200px;
h4{
font-size: 14px;
font-weight: 600;
line-height: 1.3;
display: inline-block;
vertical-align: middle;
}
}
> .csf-fieldset{
width: calc(100% - 220px);
> .csf-help{
top: -15px;
right: -5px;
}
}
}
> .csf-field-heading{
font-size: 1.1em;
}
> .csf-field-subheading{
font-size: 12px;
}
> .csf-field-subheading,
> .csf-field-heading{
margin: 10px 0;
padding: 15px !important;
border: 1px solid #ddd;
}
> .csf-field-submessage{
margin: 20px 0;
.csf-submessage{
padding: 10px;
border-left-width: 1px;
border-left-style: solid;
border-right-width: 1px;
border-right-style: solid;
}
}
> .csf-field-notice{
background-color: transparent;
}
}

View File

@@ -0,0 +1,166 @@
/**
* 12. Responsive
*/
@media only screen and (max-width:1200px){
.csf-metabox{
.csf-field{
.csf-title{
float: none;
width: 100%;
margin-bottom: 10px;
}
.csf-fieldset{
float: none;
width: 100%;
}
}
}
}
@media only screen and (max-width:782px){
.csf-header-inner{
text-align: center;
h1{
width: 100%;
margin-bottom: 10px;
}
}
.csf-form-result{
float: none;
margin-right: 0;
margin-bottom: 10px;
}
.csf-search,
.csf-header-right,
.csf-header-left{
width: 100%;
}
.csf-search{
text-align: center;
margin-bottom: 15px;
}
.csf-footer{
text-align: center;
}
.csf-buttons{
float: none;
}
.csf-copyright{
float: none;
margin-top: 10px;
}
.csf-nav,
.csf-expand-all,
.csf-reset-section,
.csf-nav-background{
display: none !important;
}
.csf-nav-normal + .csf-content{
margin-left: 0;
}
.csf-section-title,
.csf-section{
display: block !important;
}
.csf-field{
.csf-title{
float: none;
width: 100%;
margin-bottom: 10px;
}
.csf-fieldset{
float: none;
width: 100%;
}
}
.csf-field-color{
.button.wp-picker-clear{
padding: 0 8px;
line-height: 2.14285714;
min-height: 32px;
}
}
.csf-modal-inner{
width: 350px;
height: 400px;
}
.csf-modal-content{
height: 237px;
}
.csf-icon-dialog{
.csf-modal-inner{
width: 305px;
height: 380px;
}
.csf-modal-content{
height: 267px;
}
}
.csf-modal-icon{
.csf-modal-inner{
width: 330px;
height: 385px;
}
.csf-modal-content{
height: 252px;
}
}
.csf-profile-options,
.csf-taxonomy-edit-fields{
> .csf-field{
> .csf-title{
float: none;
width: 100%;
margin-bottom: 10px;
}
> .csf-fieldset{
float: none;
width: 100%;
}
}
}
.csf-nav-menu-options{
> .csf-fields{
margin-left: -10px;
margin-right: -10px;
> .csf-field{
padding: 10px;
}
}
}
}

View File

@@ -0,0 +1,114 @@
/**
* 06. Taxonomy
*/
.csf-taxonomy{
max-width: 95%;
> .csf-field{
border-top: none !important;
}
> .csf-field-heading{
font-size: 1.1em;
padding: 20px !important;
border: 1px solid #ddd;
}
> .csf-field-subheading{
font-size: 12px;
padding: 15px !important;
border: 1px solid #ddd;
}
> .csf-field-submessage{
.csf-submessage{
padding: 15px;
border-left-width: 1px;
border-left-style: solid;
border-right-width: 1px;
border-right-style: solid;
}
}
> .csf-field-notice{
background-color: transparent;
}
.csf-section-title{
display: block;
padding: 15px ;
background-color: #f9f9f9;
border: 1px solid #e5e5e5;
box-shadow: 0 1px 1px rgba(0,0,0,0.04);
}
}
.csf-taxonomy-add-fields{
> .csf-field{
padding: 8px 0;
> .csf-title{
float: none;
width: 100%;
padding: 2px 2px 4px 0;
h4{
font-size: 12px;
font-weight: normal;
}
}
> .csf-fieldset{
float: none;
width: 100%;
> .csf-help{
right: -5px;
}
}
}
+ p.submit{
margin-top: 0;
}
}
.csf-taxonomy-edit-fields{
> .csf-field{
padding: 20px 0;
> .csf-title{
width: 200px;
h4{
font-size: 14px;
font-weight: 600;
line-height: 1.3;
display: inline-block;
vertical-align: middle;
}
}
> .csf-fieldset{
width: calc(100% - 220px);
> .csf-help{
top: -5px;
right: -5px;
}
}
}
> .csf-field-submessage{
margin: 20px 0;
}
> .csf-field-subheading,
> .csf-field-heading{
margin: 20px 0;
border: 1px solid #ddd;
}
}

View File

@@ -0,0 +1,303 @@
/**
* 02. Themes
*/
/**
* 02. 01. Theme Dark
*/
.csf-theme-dark{
.csf-header-inner{
background-color: #050505;
h1{
color: #fff;
small{
color: #555;
}
}
}
.csf-expand-all{
color: #999;
background-color: #222;
&:hover{
color: #fff;
background-color: #333;
}
}
.csf-search{
input{
color: #fff;
background-color: #222;
}
&:focus{
background-color: #444;
}
&::-webkit-input-placeholder{
color: #666;
}
}
.csf-nav{
ul{
li{
a{
color: #999;
border-color: #2f2f2f;
background-color: #222;
&:hover{
color: #fff;
}
}
.csf-active{
color: #fff;
background-color: #111;
}
}
ul{
li{
a{
border-color: #2f2f2f;
background-color: #191919;
}
.csf-active{
background-color: #101010;
}
}
&:before{
background-color: rgba(#222, 0.75);
}
}
}
> ul > li:last-child > a{
border: none;
}
}
.csf-nav-normal{
ul{
li{
a{
border-bottom-width: 1px;
border-bottom-style: solid;
}
.csf-active:after{
content: " ";
position: absolute;
right: 0;
top: 50%;
height: 0;
width: 0;
pointer-events: none;
border: solid transparent;
border-right-color: #fff;
border-width: 4px;
margin-top: -4px;
}
}
}
}
.csf-nav-inline{
background-color: #222;
ul{
li{
a{
text-align: center;
border-right-width: 1px;
border-right-style: solid;
}
.csf-active:after{
content: " ";
position: absolute;
left: 50%;
bottom: 0;
height: 0;
width: 0;
pointer-events: none;
border: solid transparent;
border-bottom-color: #fff;
border-width: 4px;
margin-left: -4px;
}
}
}
}
.csf-nav-background{
background-color: #222;
}
.csf-footer{
color: #555;
background-color: #050505;
}
}
/**
* 02. 02. Theme Light
*/
.csf-theme-light{
.csf-container{
border: 1px solid #ccd0d4;
box-shadow: 0 0 15 rgba(0,0,0,0.04);
}
.csf-header-inner{
border-bottom: 1px solid #ccd0d4;
background-color: #f5f5f5;
background: linear-gradient(#fefefe, #f5f5f5);
h1{
small{
color: #999;
}
}
}
.csf-expand-all{
color: #999;
background-color: #eee;
&:hover{
color: #555;
}
}
.csf-search{
input{
color: #555;
background-color: #eee;
&::-webkit-input-placeholder{
color: #999;
}
}
}
.csf-nav{
ul{
li{
a{
font-weight: 500;
color: #444;
background-color: #f5f5f5;
&:hover{
color: #111;
background-color: #fff;
}
}
.csf-active{
color: #111;
background-color: #fff;
}
}
ul{
li{
a{
background-color: #eee;
}
}
}
}
}
.csf-nav-normal{
> ul{
margin-right: -1px;
margin-bottom: -1px;
li{
a{
border-bottom: 1px solid #ccd0d4;
border-right: 1px solid #ccd0d4;
}
.csf-active{
border-right-color: #fff;
}
}
}
}
.csf-nav-inline{
background-color: #f5f5f5;
border-bottom: 1px solid #ccd0d4;
> ul{
margin-bottom: -1px;
li{
a{
text-align: center;
border-right: 1px solid #ccd0d4;
border-bottom: 1px solid #ccd0d4;
}
.csf-active{
border-bottom-color: #fff;
}
}
ul{
display: none !important
}
}
.csf-arrow:after{
display: none;
}
}
.csf-nav-background{
background-color: #f5f5f5;
border-right: 1px solid #ccd0d4;
}
.csf-footer{
color: #555;
border-top: 1px solid #ccd0d4;
background-color: #f5f5f5;
background: linear-gradient(#fafafa, #f5f5f5);
}
}

View File

@@ -0,0 +1,346 @@
/**
* 11. Welcome Page
*/
.csf-welcome-wrap{
position: relative;
margin: 25px 40px 0 20px;
font-size: 15px;
max-width: 1200px;
p{
font-size: 14px;
line-height: 1.5;
}
h1{
margin: 0.2em 200px 0 0;
padding: 0;
color: #32373c;
line-height: 1.2em;
font-size: 2.8em;
font-weight: 400;
}
.csf-logo{
position: absolute;
overflow: hidden;
top: 0;
right: 0;
height: 160px;
width: 140px;
background-image: linear-gradient( 45deg, #2d67cb, #ad19f3);
box-shadow: 0 1px 4px rgba(0,0,0,0.25), inset 0 0 0 4px rgba(0,0,0,0.25);
.csf--effects i{
position: absolute;
width: 200px;
height: 100px;
background-color: rgba(0,0,0,0.15);
transform: rotate(-45deg);
}
.csf--effects i:nth-child(1){
bottom: -20px;
right: -70px;
}
.csf--effects i:nth-child(2){
bottom: -35px;
right: -80px;
}
.csf--effects i:nth-child(3){
bottom: -50px;
right: -90px;
}
.csf--effects i:nth-child(4){
bottom: -65px;
right: -100px;
}
.csf--wp-logos{
position: relative;
padding-top: 25px;
text-align: center;
}
.csf--wp-logo{
position: absolute;
left: 20px;
width: 20px;
height: 20px;
background-repeat: no-repeat;
background-position: center center;
background-image: url(../images/wp-logo.svg);
}
.csf--wp-plugin-logo{
display: inline-block;
width: 50px;
height: 50px;
border: 3px solid #fff;
background-size: 40px;
background-repeat: no-repeat;
background-position: center center;
background-image: url(../images/wp-plugin-logo.svg);
border-radius: 100%;
vertical-align: middle;
}
.csf--text{
position: absolute;
left: 0;
right: 0;
top: 90px;
color: #fff;
font-size: 13px;
line-height: 1.2em;
font-weight: 600;
text-align: center;
text-transform: uppercase;
text-shadow: 1px 1px 0 rgba(0,0,0,0.25);
}
.csf--version{
top: auto;
left: auto;
right: 8px;
bottom: 4px;
font-size: 11px;
text-transform: lowercase;
}
}
.csf-about-text{
font-weight: 400;
line-height: 1.6em;
font-size: 19px;
margin: 1em 200px 1em 0;
color: #555d66;
}
.csf-demo-button{
margin: 1em 200px 2em 0;
}
.nav-tab-wrapper{
margin-bottom: 20px;
}
ul{
list-style-type: disc;
padding-left: 15px;
}
.csf--col{
float: left;
padding-right: 20px;
box-sizing: border-box;
}
.csf--col-2{
width: 50%;
}
.csf--col-3{
width: 33.333%;
}
.csf--col-4{
width: 25%;
}
.csf--col-5{
width: 20%;
}
.csf--col-last{
padding-right: 0;
}
.csf--col-upgrade{
padding: 10px 0;
text-align: center;
border-top: 1px solid #e5e5e5;
}
}
.csf--table-compare{
thead,
tfoot{
td{
text-align: center;
}
}
td{
font-size: 14px;
text-align: center;
vertical-align: middle;
padding: 10px;
}
td:first-child{
text-align: left;
}
tfoot{
td{
padding: 15px 0;
}
}
.fa{
font-size: 18px;
}
.fa-check-circle{
color: #46b450;
}
.fa-times-circle{
color: #dc3232;
}
}
.csf-welcome-cols{
clear: both;
margin: 20px 0;
background-color: #fff;
padding: 0 0;
border-radius: 2px;
border: 1px solid #e5e5e5;
.csf--col{
width: 33.333%;
float: left;
padding: 20px;
text-align: center;
box-sizing: border-box;
min-height: 200px;
border-right: 1px solid #e5e5e5;
}
.csf--left,
.csf--block{
float: left;
width: 20%;
padding: 0 30px;
text-align: center;
box-sizing: border-box;
}
.csf--block{
width: 80%;
}
.csf--col-first{
border-bottom: 1px solid #e5e5e5;
}
.csf--last{
border-right: none;
}
.csf--space{
height: 20px;
}
.csf--icon{
display: inline-block;
font-size: 20px;
width: 30px;
height: 30px;
line-height: 30px;
text-align: center;
margin-bottom: 10px;
color: #fff;
background-color: #555;
border-radius: 30px;
}
.csf--active{
background-color: #5cb85c;
}
.csf--deactive{
background-color: #e14d43;
}
.csf--title{
font-weight: bold;
display: block;
}
p:last-child{
margin-bottom: 0;
}
}
.csf-features-cols{
.csf--key-features{
width: 30%;
}
.csf--available-fields{
width: 70%;
}
}
.csf-code-block{
margin: 20px 0;
padding: 5px 20px;
background-color: #fff;
border-radius: 2px;
box-shadow: 0 1px 1px rgba(0,0,0,0.15);
pre{
font-size: 13px;
color: #0073aa;
span{
color: #999;
}
}
}
.csf--table-fields{
td{
font-size: 14px;
}
}
.csf--upgrade a{
color: #5cb85c;
font-weight: bold;
&:focus,
&:hover{
color: #4aa14a;
outline: none;
box-shadow: none;
}
}
@media only screen and (max-width:782px){
.csf-welcome-cols{
.csf--col{
width: 100%;
min-height: auto;
border-right: none;
border-bottom: 1px solid #e5e5e5;
}
}
.csf-features-cols{
.csf--key-features{
width: 100%;
}
.csf--available-fields{
width: 100%;
}
}
}

View File

@@ -0,0 +1,49 @@
/**
* 04. Widget
*/
.csf-widgets{
> .csf-field{
position: relative;
top: -1px;
margin-right: -15px;
margin-left: -15px;
padding: 12px 15px;
.csf-field{
margin-left: 0;
margin-right: 0;
}
.csf-title{
float: none;
width: 100%;
margin-bottom: 5px;
}
.csf-fieldset{
float: none;
width: 100%;
}
}
.csf-field-text input{
width: 100%;
}
.csf-field-notice .csf-notice{
padding: 15px;
}
}
.control-section{
.csf-widgets{
> .csf-field{
margin-right: -10px;
margin-left: -10px;
padding: 10px 12px;
}
}
}

View File

@@ -0,0 +1,131 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Abstract Class
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Abstract' ) ) {
abstract class CSF_Abstract {
public $abstract = '';
public $output_css = '';
public function __construct() {
// Collect output css and typography
if ( ! empty( $this->args['output_css'] ) || ! empty( $this->args['enqueue_webfont'] ) ) {
add_action( 'wp_enqueue_scripts', array( &$this, 'collect_output_css_and_typography' ), 10 );
}
}
public function collect_output_css_and_typography() {
$this->recursive_output_css( $this->pre_fields );
}
public function recursive_output_css( $fields = array(), $combine_field = array() ) {
if ( ! empty( $fields ) ) {
foreach ( $fields as $field ) {
$field_id = ( ! empty( $field['id'] ) ) ? $field['id'] : '';
$field_type = ( ! empty( $field['type'] ) ) ? $field['type'] : '';
$field_output = ( ! empty( $field['output'] ) ) ? $field['output'] : '';
$field_check = ( $field_type === 'typography' || $field_output ) ? true : false;
$field_class = 'CSF_Field_' . $field_type;
if ( $field_type && $field_id ) {
if( $field_type === 'fieldset' ) {
if ( ! empty( $field['fields'] ) ) {
$this->recursive_output_css( $field['fields'], $field );
}
}
if( $field_type === 'accordion' ) {
if ( ! empty( $field['accordions'] ) ) {
foreach ( $field['accordions'] as $accordion ) {
$this->recursive_output_css( $accordion['fields'], $field );
}
}
}
if( $field_type === 'tabbed' ) {
if ( ! empty( $field['tabs'] ) ) {
foreach ( $field['tabs'] as $accordion ) {
$this->recursive_output_css( $accordion['fields'], $field );
}
}
}
if ( class_exists( $field_class ) ) {
if ( method_exists( $field_class, 'output' ) || method_exists( $field_class, 'enqueue_google_fonts' ) ) {
$field_value = '';
if ( $field_check && ( $this->abstract === 'options' || $this->abstract === 'customize' ) ) {
if( ! empty( $combine_field ) ) {
$field_value = ( isset( $this->options[$combine_field['id']][$field_id] ) ) ? $this->options[$combine_field['id']][$field_id] : '';
} else {
$field_value = ( isset( $this->options[$field_id] ) ) ? $this->options[$field_id] : '';
}
} else if ( $field_check && ( $this->abstract === 'metabox' && is_singular() || $this->abstract === 'taxonomy' && is_archive() ) ) {
if( ! empty( $combine_field ) ) {
$meta_value = $this->get_meta_value( $combine_field );
$field_value = ( isset( $meta_value[$field_id] ) ) ? $meta_value[$field_id] : '';
} else {
$meta_value = $this->get_meta_value( $field );
$field_value = ( isset( $meta_value ) ) ? $meta_value : '';
}
}
$instance = new $field_class( $field, $field_value, $this->unique, 'wp/enqueue', $this );
// typography enqueue and embed google web fonts
if ( $field_type === 'typography' && $this->args['enqueue_webfont'] && ! empty( $field_value['font-family'] ) ) {
$method = ( ! empty( $this->args['async_webfont'] ) ) ? 'async' : 'enqueue';
$instance->enqueue_google_fonts( $method );
}
// output css
if ( $field_output && $this->args['output_css'] ) {
CSF::$css .= $instance->output();
}
unset( $instance );
}
}
}
}
}
}
}
}

View File

@@ -0,0 +1,721 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Options Class
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Options' ) ) {
class CSF_Options extends CSF_Abstract {
// constans
public $unique = '';
public $notice = '';
public $abstract = 'options';
public $sections = array();
public $options = array();
public $errors = array();
public $pre_tabs = array();
public $pre_fields = array();
public $pre_sections = array();
public $args = array(
// framework title
'framework_title' => 'Codestar Framework <small>by Codestar</small>',
'framework_class' => '',
// menu settings
'menu_title' => '',
'menu_slug' => '',
'menu_type' => 'menu',
'menu_capability' => 'manage_options',
'menu_icon' => null,
'menu_position' => null,
'menu_hidden' => false,
'menu_parent' => '',
'sub_menu_title' => '',
// menu extras
'show_bar_menu' => true,
'show_sub_menu' => true,
'show_in_network' => true,
'show_in_customizer' => false,
'show_search' => true,
'show_reset_all' => true,
'show_reset_section' => true,
'show_footer' => true,
'show_all_options' => true,
'show_form_warning' => true,
'sticky_header' => true,
'save_defaults' => true,
'ajax_save' => true,
'form_action' => '',
// admin bar menu settings
'admin_bar_menu_icon' => '',
'admin_bar_menu_priority' => 50,
// footer
'footer_text' => '',
'footer_after' => '',
'footer_credit' => '',
// database model
'database' => '', // options, transient, theme_mod, network
'transient_time' => 0,
// contextual help
'contextual_help' => array(),
'contextual_help_sidebar' => '',
// typography options
'enqueue_webfont' => true,
'async_webfont' => false,
// others
'output_css' => true,
// theme
'nav' => 'normal',
'theme' => 'dark',
'class' => '',
// external default values
'defaults' => array(),
);
// run framework construct
public function __construct( $key, $params = array() ) {
$this->unique = $key;
$this->args = apply_filters( "csf_{$this->unique}_args", wp_parse_args( $params['args'], $this->args ), $this );
$this->sections = apply_filters( "csf_{$this->unique}_sections", $params['sections'], $this );
// run only is admin panel options, avoid performance loss
$this->pre_tabs = $this->pre_tabs( $this->sections );
$this->pre_fields = $this->pre_fields( $this->sections );
$this->pre_sections = $this->pre_sections( $this->sections );
$this->get_options();
$this->set_options();
$this->save_defaults();
add_action( 'admin_menu', array( &$this, 'add_admin_menu' ) );
add_action( 'admin_bar_menu', array( &$this, 'add_admin_bar_menu' ), $this->args['admin_bar_menu_priority'] );
add_action( 'wp_ajax_csf_'. $this->unique .'_ajax_save', array( &$this, 'ajax_save' ) );
if ( $this->args['database'] === 'network' && ! empty( $this->args['show_in_network'] ) ) {
add_action( 'network_admin_menu', array( &$this, 'add_admin_menu' ) );
}
// wp enqeueu for typography and output css
parent::__construct();
}
// instance
public static function instance( $key, $params = array() ) {
return new self( $key, $params );
}
public function pre_tabs( $sections ) {
$result = array();
$parents = array();
$count = 100;
foreach ( $sections as $key => $section ) {
if ( ! empty( $section['parent'] ) ) {
$section['priority'] = ( isset( $section['priority'] ) ) ? $section['priority'] : $count;
$parents[$section['parent']][] = $section;
unset( $sections[$key] );
}
$count++;
}
foreach ( $sections as $key => $section ) {
$section['priority'] = ( isset( $section['priority'] ) ) ? $section['priority'] : $count;
if ( ! empty( $section['id'] ) && ! empty( $parents[$section['id']] ) ) {
$section['subs'] = wp_list_sort( $parents[$section['id']], array( 'priority' => 'ASC' ), 'ASC', true );
}
$result[] = $section;
$count++;
}
return wp_list_sort( $result, array( 'priority' => 'ASC' ), 'ASC', true );
}
public function pre_fields( $sections ) {
$result = array();
foreach ( $sections as $key => $section ) {
if ( ! empty( $section['fields'] ) ) {
foreach ( $section['fields'] as $field ) {
$result[] = $field;
}
}
}
return $result;
}
public function pre_sections( $sections ) {
$result = array();
foreach ( $this->pre_tabs as $tab ) {
if ( ! empty( $tab['subs'] ) ) {
foreach ( $tab['subs'] as $sub ) {
$sub['ptitle'] = $tab['title'];
$result[] = $sub;
}
}
if ( empty( $tab['subs'] ) ) {
$result[] = $tab;
}
}
return $result;
}
// add admin bar menu
public function add_admin_bar_menu( $wp_admin_bar ) {
if( is_network_admin() && ( $this->args['database'] !== 'network' || $this->args['show_in_network'] !== true ) ) {
return;
}
if ( ! empty( $this->args['show_bar_menu'] ) && empty( $this->args['menu_hidden'] ) ) {
global $submenu;
$menu_slug = $this->args['menu_slug'];
$menu_icon = ( ! empty( $this->args['admin_bar_menu_icon'] ) ) ? '<span class="csf-ab-icon ab-icon '. esc_attr( $this->args['admin_bar_menu_icon'] ) .'"></span>' : '';
$wp_admin_bar->add_node( array(
'id' => $menu_slug,
'title' => $menu_icon . esc_attr( $this->args['menu_title'] ),
'href' => esc_url( ( is_network_admin() ) ? network_admin_url( 'admin.php?page='. $menu_slug ) : admin_url( 'admin.php?page='. $menu_slug ) ),
) );
if ( ! empty( $submenu[$menu_slug] ) ) {
foreach ( $submenu[$menu_slug] as $menu_key => $menu_value ) {
$wp_admin_bar->add_node( array(
'parent' => $menu_slug,
'id' => $menu_slug .'-'. $menu_key,
'title' => $menu_value[0],
'href' => esc_url( ( is_network_admin() ) ? network_admin_url( 'admin.php?page='. $menu_value[2] ) : admin_url( 'admin.php?page='. $menu_value[2] ) ),
) );
}
}
}
}
public function ajax_save() {
$result = $this->set_options( true );
if ( ! $result ) {
wp_send_json_error( array( 'error' => esc_html__( 'Error while saving the changes.', 'csf' ) ) );
} else {
wp_send_json_success( array( 'notice' => $this->notice, 'errors' => $this->errors ) );
}
}
// get default value
public function get_default( $field ) {
$default = ( isset( $field['default'] ) ) ? $field['default'] : '';
$default = ( isset( $this->args['defaults'][$field['id']] ) ) ? $this->args['defaults'][$field['id']] : $default;
return $default;
}
// save defaults and set new fields value to main options
public function save_defaults() {
$tmp_options = $this->options;
foreach ( $this->pre_fields as $field ) {
if ( ! empty( $field['id'] ) ) {
$this->options[$field['id']] = ( isset( $this->options[$field['id']] ) ) ? $this->options[$field['id']] : $this->get_default( $field );
}
}
if ( $this->args['save_defaults'] && empty( $tmp_options ) ) {
$this->save_options( $this->options );
}
}
// set options
public function set_options( $ajax = false ) {
// XSS ok.
// No worries, This "POST" requests is sanitizing in the below foreach. see #L337 - #L341
$response = ( $ajax && ! empty( $_POST['data'] ) ) ? json_decode( wp_unslash( trim( $_POST['data'] ) ), true ) : $_POST;
// Set variables.
$data = array();
$noncekey = 'csf_options_nonce'. $this->unique;
$nonce = ( ! empty( $response[$noncekey] ) ) ? $response[$noncekey] : '';
$options = ( ! empty( $response[$this->unique] ) ) ? $response[$this->unique] : array();
$transient = ( ! empty( $response['csf_transient'] ) ) ? $response['csf_transient'] : array();
if ( wp_verify_nonce( $nonce, 'csf_options_nonce' ) ) {
$importing = false;
$section_id = ( ! empty( $transient['section'] ) ) ? $transient['section'] : '';
if ( ! $ajax && ! empty( $response[ 'csf_import_data' ] ) ) {
// XSS ok.
// No worries, This "POST" requests is sanitizing in the below foreach. see #L337 - #L341
$import_data = json_decode( wp_unslash( trim( $response[ 'csf_import_data' ] ) ), true );
$options = ( is_array( $import_data ) && ! empty( $import_data ) ) ? $import_data : array();
$importing = true;
$this->notice = esc_html__( 'Settings successfully imported.', 'csf' );
}
if ( ! empty( $transient['reset'] ) ) {
foreach ( $this->pre_fields as $field ) {
if ( ! empty( $field['id'] ) ) {
$data[$field['id']] = $this->get_default( $field );
}
}
$this->notice = esc_html__( 'Default settings restored.', 'csf' );
} else if ( ! empty( $transient['reset_section'] ) && ! empty( $section_id ) ) {
if ( ! empty( $this->pre_sections[$section_id-1]['fields'] ) ) {
foreach ( $this->pre_sections[$section_id-1]['fields'] as $field ) {
if ( ! empty( $field['id'] ) ) {
$data[$field['id']] = $this->get_default( $field );
}
}
}
$data = wp_parse_args( $data, $this->options );
$this->notice = esc_html__( 'Default settings restored.', 'csf' );
} else {
// sanitize and validate
foreach ( $this->pre_fields as $field ) {
if ( ! empty( $field['id'] ) ) {
$field_id = $field['id'];
$field_value = isset( $options[$field_id] ) ? $options[$field_id] : '';
// Ajax and Importing doing wp_unslash already.
if ( ! $ajax && ! $importing ) {
$field_value = wp_unslash( $field_value );
}
// Sanitize "post" request of field.
if ( ! isset( $field['sanitize'] ) ) {
if( is_array( $field_value ) ) {
$data[$field_id] = wp_kses_post_deep( $field_value );
} else {
$data[$field_id] = wp_kses_post( $field_value );
}
} else if( isset( $field['sanitize'] ) && is_callable( $field['sanitize'] ) ) {
$data[$field_id] = call_user_func( $field['sanitize'], $field_value );
} else {
$data[$field_id] = $field_value;
}
// Validate "post" request of field.
if ( isset( $field['validate'] ) && is_callable( $field['validate'] ) ) {
$has_validated = call_user_func( $field['validate'], $field_value );
if ( ! empty( $has_validated ) ) {
$data[$field_id] = ( isset( $this->options[$field_id] ) ) ? $this->options[$field_id] : '';
$this->errors[$field_id] = $has_validated;
}
}
}
}
}
$data = apply_filters( "csf_{$this->unique}_save", $data, $this );
do_action( "csf_{$this->unique}_save_before", $data, $this );
$this->options = $data;
$this->save_options( $data );
do_action( "csf_{$this->unique}_save_after", $data, $this );
if ( empty( $this->notice ) ) {
$this->notice = esc_html__( 'Settings saved.', 'csf' );
}
return true;
}
return false;
}
// save options database
public function save_options( $data ) {
if ( $this->args['database'] === 'transient' ) {
set_transient( $this->unique, $data, $this->args['transient_time'] );
} else if ( $this->args['database'] === 'theme_mod' ) {
set_theme_mod( $this->unique, $data );
} else if ( $this->args['database'] === 'network' ) {
update_site_option( $this->unique, $data );
} else {
update_option( $this->unique, $data );
}
do_action( "csf_{$this->unique}_saved", $data, $this );
}
// get options from database
public function get_options() {
if ( $this->args['database'] === 'transient' ) {
$this->options = get_transient( $this->unique );
} else if ( $this->args['database'] === 'theme_mod' ) {
$this->options = get_theme_mod( $this->unique );
} else if ( $this->args['database'] === 'network' ) {
$this->options = get_site_option( $this->unique );
} else {
$this->options = get_option( $this->unique );
}
if ( empty( $this->options ) ) {
$this->options = array();
}
return $this->options;
}
// admin menu
public function add_admin_menu() {
extract( $this->args );
if ( $menu_type === 'submenu' ) {
$menu_page = call_user_func( 'add_submenu_page', $menu_parent, esc_attr( $menu_title ), esc_attr( $menu_title ), $menu_capability, $menu_slug, array( &$this, 'add_options_html' ) );
} else {
$menu_page = call_user_func( 'add_menu_page', esc_attr( $menu_title ), esc_attr( $menu_title ), $menu_capability, $menu_slug, array( &$this, 'add_options_html' ), $menu_icon, $menu_position );
if ( ! empty( $sub_menu_title ) ) {
call_user_func( 'add_submenu_page', $menu_slug, esc_attr( $sub_menu_title ), esc_attr( $sub_menu_title ), $menu_capability, $menu_slug, array( &$this, 'add_options_html' ) );
}
if ( ! empty( $this->args['show_sub_menu'] ) && count( $this->pre_tabs ) > 1 ) {
// create submenus
foreach ( $this->pre_tabs as $section ) {
call_user_func( 'add_submenu_page', $menu_slug, esc_attr( $section['title'] ), esc_attr( $section['title'] ), $menu_capability, $menu_slug .'#tab='. sanitize_title( $section['title'] ), '__return_null' );
}
remove_submenu_page( $menu_slug, $menu_slug );
}
if ( ! empty( $menu_hidden ) ) {
remove_menu_page( $menu_slug );
}
}
add_action( 'load-'. $menu_page, array( &$this, 'add_page_on_load' ) );
}
public function add_page_on_load() {
if ( ! empty( $this->args['contextual_help'] ) ) {
$screen = get_current_screen();
foreach ( $this->args['contextual_help'] as $tab ) {
$screen->add_help_tab( $tab );
}
if ( ! empty( $this->args['contextual_help_sidebar'] ) ) {
$screen->set_help_sidebar( $this->args['contextual_help_sidebar'] );
}
}
add_filter( 'admin_footer_text', array( &$this, 'add_admin_footer_text' ) );
}
public function add_admin_footer_text() {
$default = 'Thank you for creating with <a href="http://codestarframework.com/" target="_blank">Codestar Framework</a>';
echo ( ! empty( $this->args['footer_credit'] ) ) ? $this->args['footer_credit'] : $default;
}
public function error_check( $sections, $err = '' ) {
if ( ! $this->args['ajax_save'] ) {
if ( ! empty( $sections['fields'] ) ) {
foreach ( $sections['fields'] as $field ) {
if ( ! empty( $field['id'] ) ) {
if ( array_key_exists( $field['id'], $this->errors ) ) {
$err = '<span class="csf-label-error">!</span>';
}
}
}
}
if ( ! empty( $sections['subs'] ) ) {
foreach ( $sections['subs'] as $sub ) {
$err = $this->error_check( $sub, $err );
}
}
if ( ! empty( $sections['id'] ) && array_key_exists( $sections['id'], $this->errors ) ) {
$err = $this->errors[$sections['id']];
}
}
return $err;
}
// option page html output
public function add_options_html() {
$has_nav = ( count( $this->pre_tabs ) > 1 ) ? true : false;
$show_all = ( ! $has_nav ) ? ' csf-show-all' : '';
$ajax_class = ( $this->args['ajax_save'] ) ? ' csf-save-ajax' : '';
$sticky_class = ( $this->args['sticky_header'] ) ? ' csf-sticky-header' : '';
$wrapper_class = ( $this->args['framework_class'] ) ? ' '. $this->args['framework_class'] : '';
$theme = ( $this->args['theme'] ) ? ' csf-theme-'. $this->args['theme'] : '';
$class = ( $this->args['class'] ) ? ' '. $this->args['class'] : '';
$nav_type = ( $this->args['nav'] === 'inline' ) ? 'inline' : 'normal';
$form_action = ( $this->args['form_action'] ) ? $this->args['form_action'] : '';
do_action( 'csf_options_before' );
echo '<div class="csf csf-options'. esc_attr( $theme . $class . $wrapper_class ) .'" data-slug="'. esc_attr( $this->args['menu_slug'] ) .'" data-unique="'. esc_attr( $this->unique ) .'">';
echo '<div class="csf-container">';
echo '<form method="post" action="'. esc_attr( $form_action ) .'" enctype="multipart/form-data" id="csf-form" autocomplete="off" novalidate="novalidate">';
echo '<input type="hidden" class="csf-section-id" name="csf_transient[section]" value="1">';
wp_nonce_field( 'csf_options_nonce', 'csf_options_nonce'. $this->unique );
echo '<div class="csf-header'. esc_attr( $sticky_class ) .'">';
echo '<div class="csf-header-inner">';
echo '<div class="csf-header-left">';
echo '<h1>'. $this->args['framework_title'] .'</h1>';
echo '</div>';
echo '<div class="csf-header-right">';
$notice_class = ( ! empty( $this->notice ) ) ? 'csf-form-show' : '';
$notice_text = ( ! empty( $this->notice ) ) ? $this->notice : '';
echo '<div class="csf-form-result csf-form-success '. esc_attr( $notice_class ) .'">'. $notice_text .'</div>';
echo ( $this->args['show_form_warning'] ) ? '<div class="csf-form-result csf-form-warning">'. esc_html__( 'You have unsaved changes, save your changes!', 'csf' ) .'</div>' : '';
echo ( $has_nav && $this->args['show_all_options'] ) ? '<div class="csf-expand-all" title="'. esc_html__( 'show all settings', 'csf' ) .'"><i class="fas fa-outdent"></i></div>' : '';
echo ( $this->args['show_search'] ) ? '<div class="csf-search"><input type="text" name="csf-search" placeholder="'. esc_html__( 'Search...', 'csf' ) .'" autocomplete="off" /></div>' : '';
echo '<div class="csf-buttons">';
echo '<input type="submit" name="'. esc_attr( $this->unique ) .'[_nonce][save]" class="button button-primary csf-top-save csf-save'. esc_attr( $ajax_class ) .'" value="'. esc_html__( 'Save', 'csf' ) .'" data-save="'. esc_html__( 'Saving...', 'csf' ) .'">';
echo ( $this->args['show_reset_section'] ) ? '<input type="submit" name="csf_transient[reset_section]" class="button button-secondary csf-reset-section csf-confirm" value="'. esc_html__( 'Reset Section', 'csf' ) .'" data-confirm="'. esc_html__( 'Are you sure to reset this section options?', 'csf' ) .'">' : '';
echo ( $this->args['show_reset_all'] ) ? '<input type="submit" name="csf_transient[reset]" class="button csf-warning-primary csf-reset-all csf-confirm" value="'. ( ( $this->args['show_reset_section'] ) ? esc_html__( 'Reset All', 'csf' ) : esc_html__( 'Reset', 'csf' ) ) .'" data-confirm="'. esc_html__( 'Are you sure you want to reset all settings to default values?', 'csf' ) .'">' : '';
echo '</div>';
echo '</div>';
echo '<div class="clear"></div>';
echo '</div>';
echo '</div>';
echo '<div class="csf-wrapper'. esc_attr( $show_all ) .'">';
if ( $has_nav ) {
echo '<div class="csf-nav csf-nav-'. esc_attr( $nav_type ) .' csf-nav-options">';
echo '<ul>';
foreach ( $this->pre_tabs as $tab ) {
$tab_id = sanitize_title( $tab['title'] );
$tab_error = $this->error_check( $tab );
$tab_icon = ( ! empty( $tab['icon'] ) ) ? '<i class="csf-tab-icon '. esc_attr( $tab['icon'] ) .'"></i>' : '';
if ( ! empty( $tab['subs'] ) ) {
echo '<li class="csf-tab-item">';
echo '<a href="#tab='. esc_attr( $tab_id ) .'" data-tab-id="'. esc_attr( $tab_id ) .'" class="csf-arrow">'. $tab_icon . $tab['title'] . $tab_error .'</a>';
echo '<ul>';
foreach ( $tab['subs'] as $sub ) {
$sub_id = $tab_id .'/'. sanitize_title( $sub['title'] );
$sub_error = $this->error_check( $sub );
$sub_icon = ( ! empty( $sub['icon'] ) ) ? '<i class="csf-tab-icon '. esc_attr( $sub['icon'] ) .'"></i>' : '';
echo '<li><a href="#tab='. esc_attr( $sub_id ) .'" data-tab-id="'. esc_attr( $sub_id ) .'">'. $sub_icon . $sub['title'] . $sub_error .'</a></li>';
}
echo '</ul>';
echo '</li>';
} else {
echo '<li class="csf-tab-item"><a href="#tab='. esc_attr( $tab_id ) .'" data-tab-id="'. esc_attr( $tab_id ) .'">'. $tab_icon . $tab['title'] . $tab_error .'</a></li>';
}
}
echo '</ul>';
echo '</div>';
}
echo '<div class="csf-content">';
echo '<div class="csf-sections">';
foreach ( $this->pre_sections as $section ) {
$section_onload = ( ! $has_nav ) ? ' csf-onload' : '';
$section_class = ( ! empty( $section['class'] ) ) ? ' '. $section['class'] : '';
$section_icon = ( ! empty( $section['icon'] ) ) ? '<i class="csf-section-icon '. esc_attr( $section['icon'] ) .'"></i>' : '';
$section_title = ( ! empty( $section['title'] ) ) ? $section['title'] : '';
$section_parent = ( ! empty( $section['ptitle'] ) ) ? sanitize_title( $section['ptitle'] ) .'/' : '';
$section_slug = ( ! empty( $section['title'] ) ) ? sanitize_title( $section_title ) : '';
echo '<div class="csf-section hidden'. esc_attr( $section_onload . $section_class ) .'" data-section-id="'. esc_attr( $section_parent . $section_slug ) .'">';
echo ( $has_nav ) ? '<div class="csf-section-title"><h3>'. $section_icon . $section_title .'</h3></div>' : '';
echo ( ! empty( $section['description'] ) ) ? '<div class="csf-field csf-section-description">'. $section['description'] .'</div>' : '';
if ( ! empty( $section['fields'] ) ) {
foreach ( $section['fields'] as $field ) {
$is_field_error = $this->error_check( $field );
if ( ! empty( $is_field_error ) ) {
$field['_error'] = $is_field_error;
}
if ( ! empty( $field['id'] ) ) {
$field['default'] = $this->get_default( $field );
}
$value = ( ! empty( $field['id'] ) && isset( $this->options[$field['id']] ) ) ? $this->options[$field['id']] : '';
CSF::field( $field, $value, $this->unique, 'options' );
}
} else {
echo '<div class="csf-no-option">'. esc_html__( 'No data available.', 'csf' ) .'</div>';
}
echo '</div>';
}
echo '</div>';
echo '<div class="clear"></div>';
echo '</div>';
echo ( $has_nav && $nav_type === 'normal' ) ? '<div class="csf-nav-background"></div>' : '';
echo '</div>';
if ( ! empty( $this->args['show_footer'] ) ) {
echo '<div class="csf-footer">';
echo '<div class="csf-buttons">';
echo '<input type="submit" name="csf_transient[save]" class="button button-primary csf-save'. esc_attr( $ajax_class ) .'" value="'. esc_html__( 'Save', 'csf' ) .'" data-save="'. esc_html__( 'Saving...', 'csf' ) .'">';
echo ( $this->args['show_reset_section'] ) ? '<input type="submit" name="csf_transient[reset_section]" class="button button-secondary csf-reset-section csf-confirm" value="'. esc_html__( 'Reset Section', 'csf' ) .'" data-confirm="'. esc_html__( 'Are you sure to reset this section options?', 'csf' ) .'">' : '';
echo ( $this->args['show_reset_all'] ) ? '<input type="submit" name="csf_transient[reset]" class="button csf-warning-primary csf-reset-all csf-confirm" value="'. ( ( $this->args['show_reset_section'] ) ? esc_html__( 'Reset All', 'csf' ) : esc_html__( 'Reset', 'csf' ) ) .'" data-confirm="'. esc_html__( 'Are you sure you want to reset all settings to default values?', 'csf' ) .'">' : '';
echo '</div>';
echo ( ! empty( $this->args['footer_text'] ) ) ? '<div class="csf-copyright">'. $this->args['footer_text'] .'</div>' : '';
echo '<div class="clear"></div>';
echo '</div>';
}
echo '</form>';
echo '</div>';
echo '<div class="clear"></div>';
echo ( ! empty( $this->args['footer_after'] ) ) ? $this->args['footer_after'] : '';
echo '</div>';
do_action( 'csf_options_after' );
}
}
}

View File

@@ -0,0 +1,346 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Comment Metabox Class
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Comment_Metabox' ) ) {
class CSF_Comment_Metabox extends CSF_Abstract{
// constans
public $unique = '';
public $abstract = 'comment_metabox';
public $pre_fields = array();
public $sections = array();
public $args = array(
'title' => '',
'data_type' => 'serialize',
'priority' => 'default',
'show_reset' => false,
'show_restore' => false,
'nav' => 'normal',
'theme' => 'dark',
'class' => '',
'defaults' => array(),
);
// run comment metabox construct
public function __construct( $key, $params = array() ) {
$this->unique = $key;
$this->args = apply_filters( "csf_{$this->unique}_args", wp_parse_args( $params['args'], $this->args ), $this );
$this->sections = apply_filters( "csf_{$this->unique}_sections", $params['sections'], $this );
$this->pre_fields = $this->pre_fields( $this->sections );
add_action( 'add_meta_boxes_comment', array( &$this, 'add_comment_meta_box' ) );
add_action( 'edit_comment', array( &$this, 'save_comment_meta_box' ) );
if ( ! empty( $this->args['class'] ) ) {
add_filter( 'postbox_classes_comment_'. $this->unique, array( &$this, 'add_comment_metabox_classes' ) );
}
}
// instance
public static function instance( $key, $params = array() ) {
return new self( $key, $params );
}
public function pre_fields( $sections ) {
$result = array();
foreach ( $sections as $key => $section ) {
if ( ! empty( $section['fields'] ) ) {
foreach ( $section['fields'] as $field ) {
$result[] = $field;
}
}
}
return $result;
}
public function add_comment_metabox_classes( $classes ) {
if ( ! empty( $this->args['class'] ) ) {
$classes[] = $this->args['class'];
}
return $classes;
}
// add comment metabox
public function add_comment_meta_box( $post_type ) {
add_meta_box( $this->unique, $this->args['title'], array( &$this, 'add_comment_meta_box_content' ), 'comment', 'normal', $this->args['priority'], $this->args );
}
// get default value
public function get_default( $field ) {
$default = ( isset( $field['default'] ) ) ? $field['default'] : '';
$default = ( isset( $this->args['defaults'][$field['id']] ) ) ? $this->args['defaults'][$field['id']] : $default;
return $default;
}
// get meta value
public function get_meta_value( $comment_id, $field ) {
$value = null;
if ( ! empty( $comment_id ) && ! empty( $field['id'] ) ) {
if ( $this->args['data_type'] !== 'serialize' ) {
$meta = get_comment_meta( $comment_id, $field['id'] );
$value = ( isset( $meta[0] ) ) ? $meta[0] : null;
} else {
$meta = get_comment_meta( $comment_id, $this->unique, true );
$value = ( isset( $meta[$field['id']] ) ) ? $meta[$field['id']] : null;
}
}
$default = ( isset( $field['id'] ) ) ? $this->get_default( $field ) : '';
$value = ( isset( $value ) ) ? $value : $default;
return $value;
}
// add comment metabox content
public function add_comment_meta_box_content( $comment, $callback ) {
$has_nav = ( count( $this->sections ) > 1 ) ? true : false;
$show_all = ( ! $has_nav ) ? ' csf-show-all' : '';
$errors = ( is_object ( $comment ) ) ? get_comment_meta( $comment->comment_ID, '_csf_errors_'. $this->unique, true ) : array();
$errors = ( ! empty( $errors ) ) ? $errors : array();
$theme = ( $this->args['theme'] ) ? ' csf-theme-'. $this->args['theme'] : '';
$nav_type = ( $this->args['nav'] === 'inline' ) ? 'inline' : 'normal';
if ( is_object( $comment ) && ! empty( $errors ) ) {
delete_comment_meta( $comment->comment_ID, '_csf_errors_'. $this->unique );
}
wp_nonce_field( 'csf_comment_metabox_nonce', 'csf_comment_metabox_nonce'. $this->unique );
echo '<div class="csf csf-comment-metabox'. esc_attr( $theme ) .'">';
echo '<div class="csf-wrapper'. esc_attr( $show_all ) .'">';
if ( $has_nav ) {
echo '<div class="csf-nav csf-nav-'. esc_attr( $nav_type ) .' csf-nav-metabox">';
echo '<ul>';
$tab_key = 1;
foreach ( $this->sections as $section ) {
$tab_icon = ( ! empty( $section['icon'] ) ) ? '<i class="csf-tab-icon '. esc_attr( $section['icon'] ) .'"></i>' : '';
$tab_error = ( ! empty( $errors['sections'][$tab_key] ) ) ? '<i class="csf-label-error csf-error">!</i>' : '';
echo '<li><a href="#">'. $tab_icon . $section['title'] . $tab_error .'</a></li>';
$tab_key++;
}
echo '</ul>';
echo '</div>';
}
echo '<div class="csf-content">';
echo '<div class="csf-sections">';
$section_key = 1;
foreach ( $this->sections as $section ) {
$section_onload = ( ! $has_nav ) ? ' csf-onload' : '';
$section_class = ( ! empty( $section['class'] ) ) ? ' '. $section['class'] : '';
$section_title = ( ! empty( $section['title'] ) ) ? $section['title'] : '';
$section_icon = ( ! empty( $section['icon'] ) ) ? '<i class="csf-section-icon '. esc_attr( $section['icon'] ) .'"></i>' : '';
echo '<div class="csf-section hidden'. esc_attr( $section_onload . $section_class ) .'">';
echo ( $section_title || $section_icon ) ? '<div class="csf-section-title"><h3>'. $section_icon . $section_title .'</h3></div>' : '';
if ( ! empty( $section['fields'] ) ) {
foreach ( $section['fields'] as $field ) {
if ( ! empty( $field['id'] ) && ! empty( $errors['fields'][$field['id']] ) ) {
$field['_error'] = $errors['fields'][$field['id']];
}
if ( ! empty( $field['id'] ) ) {
$field['default'] = $this->get_default( $field );
}
CSF::field( $field, $this->get_meta_value( $comment->comment_ID, $field ), $this->unique, 'comment_metabox' );
}
} else {
echo '<div class="csf-no-option">'. esc_html__( 'No data available.', 'csf' ) .'</div>';
}
echo '</div>';
$section_key++;
}
echo '</div>';
if ( ! empty( $this->args['show_restore'] ) || ! empty( $this->args['show_reset'] ) ) {
echo '<div class="csf-sections-reset">';
echo '<label>';
echo '<input type="checkbox" name="'. esc_attr( $this->unique ) .'[_reset]" />';
echo '<span class="button csf-button-reset">'. esc_html__( 'Reset', 'csf' ) .'</span>';
echo '<span class="button csf-button-cancel">'. sprintf( '<small>( %s )</small> %s', esc_html__( 'update post', 'csf' ), esc_html__( 'Cancel', 'csf' ) ) .'</span>';
echo '</label>';
echo '</div>';
}
echo '</div>';
echo ( $has_nav && $nav_type === 'normal' ) ? '<div class="csf-nav-background"></div>' : '';
echo '<div class="clear"></div>';
echo '</div>';
echo '</div>';
}
// save comment metabox
public function save_comment_meta_box( $comment_id ) {
$count = 1;
$data = array();
$errors = array();
$noncekey = 'csf_comment_metabox_nonce'. $this->unique;
$nonce = ( ! empty( $_POST[ $noncekey ] ) ) ? sanitize_text_field( wp_unslash( $_POST[ $noncekey ] ) ) : '';
if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ! wp_verify_nonce( $nonce, 'csf_comment_metabox_nonce' ) ) {
return $comment_id;
}
// XSS ok.
// No worries, This "POST" requests is sanitizing in the below foreach.
$request = ( ! empty( $_POST[ $this->unique ] ) ) ? $_POST[ $this->unique ] : array();
if ( ! empty( $request ) ) {
foreach ( $this->sections as $section ) {
if ( ! empty( $section['fields'] ) ) {
foreach ( $section['fields'] as $field ) {
if ( ! empty( $field['id'] ) ) {
$field_id = $field['id'];
$field_value = isset( $request[$field_id] ) ? $request[$field_id] : '';
// Sanitize "post" request of field.
if ( ! isset( $field['sanitize'] ) ) {
if( is_array( $field_value ) ) {
$data[$field_id] = wp_kses_post_deep( $field_value );
} else {
$data[$field_id] = wp_kses_post( $field_value );
}
} else if( isset( $field['sanitize'] ) && is_callable( $field['sanitize'] ) ) {
$data[$field_id] = call_user_func( $field['sanitize'], $field_value );
} else {
$data[$field_id] = $field_value;
}
// Validate "post" request of field.
if ( isset( $field['validate'] ) && is_callable( $field['validate'] ) ) {
$has_validated = call_user_func( $field['validate'], $field_value );
if ( ! empty( $has_validated ) ) {
$errors['sections'][$count] = true;
$errors['fields'][$field_id] = $has_validated;
$data[$field_id] = $this->get_meta_value( $comment_id, $field );
}
}
}
}
}
$count++;
}
}
$data = apply_filters( "csf_{$this->unique}_save", $data, $comment_id, $this );
do_action( "csf_{$this->unique}_save_before", $data, $comment_id, $this );
if ( empty( $data ) || ! empty( $request['_reset'] ) ) {
if ( $this->args['data_type'] !== 'serialize' ) {
foreach ( $data as $key => $value ) {
delete_comment_meta( $comment_id, $key );
}
} else {
delete_comment_meta( $comment_id, $this->unique );
}
} else {
if ( $this->args['data_type'] !== 'serialize' ) {
foreach ( $data as $key => $value ) {
update_comment_meta( $comment_id, $key, $value );
}
} else {
update_comment_meta( $comment_id, $this->unique, $data );
}
if ( ! empty( $errors ) ) {
update_comment_meta( $comment_id, '_csf_errors_'. $this->unique, $errors );
}
}
do_action( "csf_{$this->unique}_saved", $data, $comment_id, $this );
do_action( "csf_{$this->unique}_save_after", $data, $comment_id, $this );
}
}
}

View File

@@ -0,0 +1,282 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Customize Options Class
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Customize_Options' ) ) {
class CSF_Customize_Options extends CSF_Abstract {
// constans
public $unique = '';
public $abstract = 'customize';
public $options = array();
public $sections = array();
public $pre_fields = array();
public $pre_tabs = array();
public $priority = 10;
public $args = array(
'database' => 'option',
'transport' => 'refresh',
'capability' => 'manage_options',
'save_defaults' => true,
'enqueue_webfont' => true,
'async_webfont' => false,
'output_css' => true,
'defaults' => array()
);
// run customize construct
public function __construct( $key, $params ) {
$this->unique = $key;
$this->args = apply_filters( "csf_{$this->unique}_args", wp_parse_args( $params['args'], $this->args ), $this );
$this->sections = apply_filters( "csf_{$this->unique}_sections", $params['sections'], $this );
$this->pre_fields = $this->pre_fields( $this->sections );
$this->get_options();
$this->save_defaults();
add_action( 'customize_register', array( &$this, 'add_customize_options' ) );
add_action( 'customize_save_after', array( &$this, 'add_customize_save_after' ) );
// Get options for enqueue actions
if ( is_customize_preview() ) {
add_action( 'wp_enqueue_scripts', array( &$this, 'get_options' ) );
}
// wp enqeueu for typography and output css
parent::__construct();
}
// instance
public static function instance( $key, $params = array() ) {
return new self( $key, $params );
}
public function add_customize_save_after( $wp_customize ) {
do_action( "csf_{$this->unique}_save_before", $this->get_options(), $this, $wp_customize );
do_action( "csf_{$this->unique}_saved", $this->get_options(), $this, $wp_customize );
do_action( "csf_{$this->unique}_save_after", $this->get_options(), $this, $wp_customize );
}
// get default value
public function get_default( $field ) {
$default = ( isset( $field['default'] ) ) ? $field['default'] : '';
$default = ( isset( $this->args['defaults'][$field['id']] ) ) ? $this->args['defaults'][$field['id']] : $default;
return $default;
}
// get option
public function get_options() {
if ( $this->args['database'] === 'theme_mod' ) {
$this->options = get_theme_mod( $this->unique, array() );
} else {
$this->options = get_option( $this->unique, array() );
}
if ( empty( $this->options ) ) {
$this->options = array();
}
return $this->options;
}
// save defaults and set new fields value to main options
public function save_defaults() {
$tmp_options = $this->options;
if ( ! empty( $this->pre_fields ) ) {
foreach ( $this->pre_fields as $field ) {
if ( ! empty( $field['id'] ) ) {
$this->options[$field['id']] = ( isset( $this->options[$field['id']] ) ) ? $this->options[$field['id']] : $this->get_default( $field );
}
}
}
if ( $this->args['save_defaults'] && empty( $this->args['show_in_customizer'] ) && empty( $tmp_options ) ) {
if ( $this->args['database'] === 'theme_mod' ) {
set_theme_mod( $this->unique, $this->options );
} else {
update_option( $this->unique, $this->options );
}
}
}
public function pre_fields( $sections ) {
$result = array();
foreach ( $sections as $key => $section ) {
if ( ! empty( $section['fields'] ) ) {
foreach ( $section['fields'] as $field ) {
$result[] = $field;
}
}
}
return $result;
}
public function pre_tabs( $sections ) {
$result = array();
$parents = array();
foreach ( $sections as $key => $section ) {
if ( ! empty( $section['parent'] ) ) {
$parents[$section['parent']][] = $section;
unset( $sections[$key] );
}
}
foreach ( $sections as $key => $section ) {
if ( ! empty( $section['id'] ) && ! empty( $parents[$section['id']] ) ) {
$section['subs'] = $parents[$section['id']];
}
$result[] = $section;
}
return $result;
}
public function add_customize_options( $wp_customize ) {
if ( ! class_exists( 'WP_Customize_Panel_CSF' ) ) {
CSF::include_plugin_file( 'functions/customize.php' );
}
if ( ! empty( $this->sections ) ) {
$sections = $this->pre_tabs( $this->sections );
foreach ( $sections as $section ) {
if ( ! empty( $section['subs'] ) ) {
$panel_id = ( isset( $section['id'] ) ) ? $section['id'] : $this->unique .'-panel-'. $this->priority;
$wp_customize->add_panel( new WP_Customize_Panel_CSF( $wp_customize, $panel_id, array(
'title' => ( isset( $section['title'] ) ) ? $section['title'] : null,
'description' => ( isset( $section['description'] ) ) ? $section['description'] : null,
'priority' => ( isset( $section['priority'] ) ) ? $section['priority'] : null,
) ) );
$this->priority++;
foreach ( $section['subs'] as $sub_section ) {
$section_id = ( isset( $sub_section['id'] ) ) ? $sub_section['id'] : $this->unique .'-section-'. $this->priority;
$this->add_section( $wp_customize, $section_id, $sub_section, $panel_id );
$this->priority++;
}
} else {
$section_id = ( isset( $section['id'] ) ) ? $section['id'] : $this->unique .'-section-'. $this->priority;
$this->add_section( $wp_customize, $section_id, $section, false );
$this->priority++;
}
}
}
}
// add customize section
public function add_section( $wp_customize, $section_id, $section_args, $panel_id ) {
if ( ! empty( $section_args['assign'] ) ) {
$section_id = $section_args['assign'];
} else {
$wp_customize->add_section( new WP_Customize_Section_CSF( $wp_customize, $section_id, array(
'title' => ( isset( $section_args['title'] ) ) ? $section_args['title'] : '',
'description' => ( isset( $section_args['description'] ) ) ? $section_args['description'] : '',
'priority' => ( isset( $section_args['priority'] ) ) ? $section_args['priority'] : '',
'panel' => ( $panel_id ) ? $panel_id : '',
) ) );
}
if ( ! empty( $section_args['fields'] ) ) {
$field_key = 1;
foreach ( $section_args['fields'] as $field ) {
if ( isset( $field['id'] ) ) {
$field['default'] = $this->get_default( $field );
}
$field_id = ( isset( $field['id'] ) ) ? $field['id'] : '_nonce-'. $section_id .'-'. $field_key;
$setting_args = ( isset( $field['setting_args'] ) ) ? $field['setting_args'] : array();
$control_args = ( isset( $field['control_args'] ) ) ? $field['control_args'] : array();
$field_transport = ( isset( $field['transport'] ) ) ? $field['transport'] : $this->args['transport'];
$field_sanitize = ( isset( $field['sanitize'] ) ) ? $field['sanitize'] : '';
$field_validate = ( isset( $field['validate'] ) ) ? $field['validate'] : '';
$field_default = ( isset( $field['default'] ) ) ? $field['default'] : '';
$field_customize = ( isset( $field['customize'] ) && ! isset( $field['transport'] ) ) ? true : false;
$has_selective = ( isset( $field['selective_refresh'] ) && isset( $wp_customize->selective_refresh ) ) ? true : false;
$setting_id = $this->unique .'['. $field_id .']';
$transport = ( $has_selective || $field_customize ) ? 'postMessage' : $field_transport;
$wp_customize->add_setting( $setting_id,
wp_parse_args( $setting_args, array(
'default' => $field_default,
'type' => $this->args['database'],
'capability' => $this->args['capability'],
'transport' => $transport,
'sanitize_callback' => $field_sanitize,
'validate_callback' => $field_validate
) )
);
$wp_customize->add_control( new WP_Customize_Control_CSF( $wp_customize, $setting_id,
wp_parse_args( $control_args, array(
'unique' => $this->unique,
'field' => $field,
'section' => $section_id,
'settings' => $setting_id
) )
) );
if ( $has_selective ) {
$wp_customize->selective_refresh->add_partial( $setting_id, $field['selective_refresh'] );
}
$field_key++;
}
}
}
}
}

View File

@@ -0,0 +1,405 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Fields Class
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Fields' ) ) {
abstract class CSF_Fields extends CSF_Abstract {
public function __construct( $field = array(), $value = '', $unique = '', $where = '', $parent = '' ) {
$this->field = $field;
$this->value = $value;
$this->unique = $unique;
$this->where = $where;
$this->parent = $parent;
}
public function field_name( $nested_name = '' ) {
$field_id = ( ! empty( $this->field['id'] ) ) ? $this->field['id'] : '';
$unique_id = ( ! empty( $this->unique ) ) ? $this->unique .'['. $field_id .']' : $field_id;
$field_name = ( ! empty( $this->field['name'] ) ) ? $this->field['name'] : $unique_id;
$tag_prefix = ( ! empty( $this->field['tag_prefix'] ) ) ? $this->field['tag_prefix'] : '';
if ( ! empty( $tag_prefix ) ) {
$nested_name = str_replace( '[', '['. $tag_prefix, $nested_name );
}
return $field_name . $nested_name;
}
public function field_attributes( $custom_atts = array() ) {
$field_id = ( ! empty( $this->field['id'] ) ) ? $this->field['id'] : '';
$attributes = ( ! empty( $this->field['attributes'] ) ) ? $this->field['attributes'] : array();
if ( ! empty( $field_id ) && empty( $attributes['data-depend-id'] ) ) {
$attributes['data-depend-id'] = $field_id;
}
if ( ! empty( $this->field['placeholder'] ) ) {
$attributes['placeholder'] = $this->field['placeholder'];
}
$attributes = wp_parse_args( $attributes, $custom_atts );
$atts = '';
if ( ! empty( $attributes ) ) {
foreach ( $attributes as $key => $value ) {
if ( $value === 'only-key' ) {
$atts .= ' '. esc_attr( $key );
} else {
$atts .= ' '. esc_attr( $key ) . '="'. esc_attr( $value ) .'"';
}
}
}
return $atts;
}
public function field_before() {
return ( ! empty( $this->field['before'] ) ) ? '<div class="csf-before-text">'. $this->field['before'] .'</div>' : '';
}
public function field_after() {
$output = ( ! empty( $this->field['after'] ) ) ? '<div class="csf-after-text">'. $this->field['after'] .'</div>' : '';
$output .= ( ! empty( $this->field['desc'] ) ) ? '<div class="clear"></div><div class="csf-desc-text">'. $this->field['desc'] .'</div>' : '';
$output .= ( ! empty( $this->field['help'] ) ) ? '<div class="csf-help"><span class="csf-help-text">'. $this->field['help'] .'</span><i class="fas fa-question-circle"></i></div>' : '';
$output .= ( ! empty( $this->field['_error'] ) ) ? '<div class="csf-error-text">'. $this->field['_error'] .'</div>' : '';
return $output;
}
public static function field_data( $type = '', $term = false, $query_args = array() ) {
$options = array();
$array_search = false;
// sanitize type name
if ( in_array( $type, array( 'page', 'pages' ) ) ) {
$option = 'page';
} else if ( in_array( $type, array( 'post', 'posts' ) ) ) {
$option = 'post';
} else if ( in_array( $type, array( 'category', 'categories' ) ) ) {
$option = 'category';
} else if ( in_array( $type, array( 'tag', 'tags' ) ) ) {
$option = 'post_tag';
} else if ( in_array( $type, array( 'menu', 'menus' ) ) ) {
$option = 'nav_menu';
} else {
$option = '';
}
// switch type
switch( $type ) {
case 'page':
case 'pages':
case 'post':
case 'posts':
// term query required for ajax select
if ( ! empty( $term ) ) {
$query = new WP_Query( wp_parse_args( $query_args, array(
's' => $term,
'post_type' => $option,
'post_status' => 'publish',
'posts_per_page' => 25,
) ) );
} else {
$query = new WP_Query( wp_parse_args( $query_args, array(
'post_type' => $option,
'post_status' => 'publish',
) ) );
}
if ( ! is_wp_error( $query ) && ! empty( $query->posts ) ) {
foreach ( $query->posts as $item ) {
$options[$item->ID] = $item->post_title;
}
}
break;
case 'category':
case 'categories':
case 'tag':
case 'tags':
case 'menu':
case 'menus':
if ( ! empty( $term ) ) {
$query = new WP_Term_Query( wp_parse_args( $query_args, array(
'search' => $term,
'taxonomy' => $option,
'hide_empty' => false,
'number' => 25,
) ) );
} else {
$query = new WP_Term_Query( wp_parse_args( $query_args, array(
'taxonomy' => $option,
'hide_empty' => false,
) ) );
}
if ( ! is_wp_error( $query ) && ! empty( $query->terms ) ) {
foreach ( $query->terms as $item ) {
$options[$item->term_id] = $item->name;
}
}
break;
case 'user':
case 'users':
if ( ! empty( $term ) ) {
$query = new WP_User_Query( array(
'search' => '*'. $term .'*',
'number' => 25,
'orderby' => 'title',
'order' => 'ASC',
'fields' => array( 'display_name', 'ID' )
) );
} else {
$query = new WP_User_Query( array( 'fields' => array( 'display_name', 'ID' ) ) );
}
if ( ! is_wp_error( $query ) && ! empty( $query->get_results() ) ) {
foreach ( $query->get_results() as $item ) {
$options[$item->ID] = $item->display_name;
}
}
break;
case 'sidebar':
case 'sidebars':
global $wp_registered_sidebars;
if ( ! empty( $wp_registered_sidebars ) ) {
foreach ( $wp_registered_sidebars as $sidebar ) {
$options[$sidebar['id']] = $sidebar['name'];
}
}
$array_search = true;
break;
case 'role':
case 'roles':
global $wp_roles;
if ( ! empty( $wp_roles ) ) {
if ( ! empty( $wp_roles->roles ) ) {
foreach ( $wp_roles->roles as $role_key => $role_value ) {
$options[$role_key] = $role_value['name'];
}
}
}
$array_search = true;
break;
case 'post_type':
case 'post_types':
$post_types = get_post_types( array( 'show_in_nav_menus' => true ), 'objects' );
if ( ! is_wp_error( $post_types ) && ! empty( $post_types ) ) {
foreach ( $post_types as $post_type ) {
$options[$post_type->name] = $post_type->labels->name;
}
}
$array_search = true;
break;
case 'location':
case 'locations':
$nav_menus = get_registered_nav_menus();
if ( ! is_wp_error( $nav_menus ) && ! empty( $nav_menus ) ) {
foreach ( $nav_menus as $nav_menu_key => $nav_menu_name ) {
$options[$nav_menu_key] = $nav_menu_name;
}
}
$array_search = true;
break;
default:
if ( is_callable( $type ) ) {
if ( ! empty( $term ) ) {
$options = call_user_func( $type, $query_args );
} else {
$options = call_user_func( $type, $term, $query_args );
}
}
break;
}
// Array search by "term"
if ( ! empty( $term ) && ! empty( $options ) && ! empty( $array_search ) ) {
$options = preg_grep( '/'. $term .'/i', $options );
}
// Make multidimensional array for ajax search
if ( ! empty( $term ) && ! empty( $options ) ) {
$arr = array();
foreach ( $options as $option_key => $option_value ) {
$arr[] = array( 'value' => $option_key, 'text' => $option_value );
}
$options = $arr;
}
return $options;
}
public function field_wp_query_data_title( $type, $values ) {
$options = array();
if ( ! empty( $values ) && is_array( $values ) ) {
foreach ( $values as $value ) {
$options[$value] = ucfirst( $value );
switch( $type ) {
case 'post':
case 'posts':
case 'page':
case 'pages':
$title = get_the_title( $value );
if ( ! is_wp_error( $title ) && ! empty( $title ) ) {
$options[$value] = $title;
}
break;
case 'category':
case 'categories':
case 'tag':
case 'tags':
case 'menu':
case 'menus':
$term = get_term( $value );
if ( ! is_wp_error( $term ) && ! empty( $term ) ) {
$options[$value] = $term->name;
}
break;
case 'user':
case 'users':
$user = get_user_by( 'id', $value );
if ( ! is_wp_error( $user ) && ! empty( $user ) ) {
$options[$value] = $user->display_name;
}
break;
case 'sidebar':
case 'sidebars':
global $wp_registered_sidebars;
if ( ! empty( $wp_registered_sidebars[$value] ) ) {
$options[$value] = $wp_registered_sidebars[$value]['name'];
}
break;
case 'role':
case 'roles':
global $wp_roles;
if ( ! empty( $wp_roles ) && ! empty( $wp_roles->roles ) && ! empty( $wp_roles->roles[$value] ) ) {
$options[$value] = $wp_roles->roles[$value]['name'];
}
break;
case 'post_type':
case 'post_types':
$post_types = get_post_types( array( 'show_in_nav_menus' => true ) );
if ( ! is_wp_error( $post_types ) && ! empty( $post_types ) && ! empty( $post_types[$value] ) ) {
$options[$value] = ucfirst( $value );
}
break;
case 'location':
case 'locations':
$nav_menus = get_registered_nav_menus();
if ( ! is_wp_error( $nav_menus ) && ! empty( $nav_menus ) && ! empty( $nav_menus[$value] ) ) {
$options[$value] = $nav_menus[$value];
}
break;
default:
if ( is_callable( $type .'_title' ) ) {
$options[$value] = call_user_func( $type .'_title', $value );
}
break;
}
}
}
return $options;
}
}
}

View File

@@ -0,0 +1,424 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Metabox Class
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Metabox' ) ) {
class CSF_Metabox extends CSF_Abstract{
// constans
public $unique = '';
public $abstract = 'metabox';
public $pre_fields = array();
public $sections = array();
public $post_type = array();
public $args = array(
'title' => '',
'post_type' => 'post',
'data_type' => 'serialize',
'context' => 'advanced',
'priority' => 'default',
'exclude_post_types' => array(),
'page_templates' => '',
'post_formats' => '',
'show_reset' => false,
'show_restore' => false,
'enqueue_webfont' => true,
'async_webfont' => false,
'output_css' => true,
'nav' => 'normal',
'theme' => 'dark',
'class' => '',
'defaults' => array(),
);
// run metabox construct
public function __construct( $key, $params = array() ) {
$this->unique = $key;
$this->args = apply_filters( "csf_{$this->unique}_args", wp_parse_args( $params['args'], $this->args ), $this );
$this->sections = apply_filters( "csf_{$this->unique}_sections", $params['sections'], $this );
$this->post_type = ( is_array( $this->args['post_type'] ) ) ? $this->args['post_type'] : array_filter( (array) $this->args['post_type'] );
$this->post_formats = ( is_array( $this->args['post_formats'] ) ) ? $this->args['post_formats'] : array_filter( (array) $this->args['post_formats'] );
$this->page_templates = ( is_array( $this->args['page_templates'] ) ) ? $this->args['page_templates'] : array_filter( (array) $this->args['page_templates'] );
$this->pre_fields = $this->pre_fields( $this->sections );
add_action( 'add_meta_boxes', array( &$this, 'add_meta_box' ) );
add_action( 'save_post', array( &$this, 'save_meta_box' ) );
add_action( 'edit_attachment', array( &$this, 'save_meta_box' ) );
if ( ! empty( $this->page_templates ) || ! empty( $this->post_formats ) || ! empty( $this->args['class'] ) ) {
foreach ( $this->post_type as $post_type ) {
add_filter( 'postbox_classes_'. $post_type .'_'. $this->unique, array( &$this, 'add_metabox_classes' ) );
}
}
// wp enqeueu for typography and output css
parent::__construct();
}
// instance
public static function instance( $key, $params = array() ) {
return new self( $key, $params );
}
public function pre_fields( $sections ) {
$result = array();
foreach ( $sections as $key => $section ) {
if ( ! empty( $section['fields'] ) ) {
foreach ( $section['fields'] as $field ) {
$result[] = $field;
}
}
}
return $result;
}
public function add_metabox_classes( $classes ) {
global $post;
if ( ! empty( $this->post_formats ) ) {
$saved_post_format = ( is_object( $post ) ) ? get_post_format( $post ) : false;
$saved_post_format = ( ! empty( $saved_post_format ) ) ? $saved_post_format : 'default';
$classes[] = 'csf-post-formats';
// Sanitize post format for standard to default
if ( ( $key = array_search( 'standard', $this->post_formats ) ) !== false ) {
$this->post_formats[$key] = 'default';
}
foreach ( $this->post_formats as $format ) {
$classes[] = 'csf-post-format-'. $format;
}
if ( ! in_array( $saved_post_format, $this->post_formats ) ) {
$classes[] = 'csf-metabox-hide';
} else {
$classes[] = 'csf-metabox-show';
}
}
if ( ! empty( $this->page_templates ) ) {
$saved_template = ( is_object( $post ) && ! empty( $post->page_template ) ) ? $post->page_template : 'default';
$classes[] = 'csf-page-templates';
foreach ( $this->page_templates as $template ) {
$classes[] = 'csf-page-'. preg_replace( '/[^a-zA-Z0-9]+/', '-', strtolower( $template ) );
}
if ( ! in_array( $saved_template, $this->page_templates ) ) {
$classes[] = 'csf-metabox-hide';
} else {
$classes[] = 'csf-metabox-show';
}
}
if ( ! empty( $this->args['class'] ) ) {
$classes[] = $this->args['class'];
}
return $classes;
}
// add metabox
public function add_meta_box( $post_type ) {
if ( ! in_array( $post_type, $this->args['exclude_post_types'] ) ) {
add_meta_box( $this->unique, $this->args['title'], array( &$this, 'add_meta_box_content' ), $this->post_type, $this->args['context'], $this->args['priority'], $this->args );
}
}
// get default value
public function get_default( $field ) {
$default = ( isset( $field['default'] ) ) ? $field['default'] : '';
$default = ( isset( $this->args['defaults'][$field['id']] ) ) ? $this->args['defaults'][$field['id']] : $default;
return $default;
}
// get meta value
public function get_meta_value( $field ) {
global $post;
$value = null;
if ( is_object( $post ) && ! empty( $field['id'] ) ) {
if ( $this->args['data_type'] !== 'serialize' ) {
$meta = get_post_meta( $post->ID, $field['id'] );
$value = ( isset( $meta[0] ) ) ? $meta[0] : null;
} else {
$meta = get_post_meta( $post->ID, $this->unique, true );
$value = ( isset( $meta[$field['id']] ) ) ? $meta[$field['id']] : null;
}
}
$default = ( isset( $field['id'] ) ) ? $this->get_default( $field ) : '';
$value = ( isset( $value ) ) ? $value : $default;
return $value;
}
// add metabox content
public function add_meta_box_content( $post, $callback ) {
global $post;
$has_nav = ( count( $this->sections ) > 1 && $this->args['context'] !== 'side' ) ? true : false;
$show_all = ( ! $has_nav ) ? ' csf-show-all' : '';
$post_type = ( is_object ( $post ) ) ? $post->post_type : '';
$errors = ( is_object ( $post ) ) ? get_post_meta( $post->ID, '_csf_errors_'. $this->unique, true ) : array();
$errors = ( ! empty( $errors ) ) ? $errors : array();
$theme = ( $this->args['theme'] ) ? ' csf-theme-'. $this->args['theme'] : '';
$nav_type = ( $this->args['nav'] === 'inline' ) ? 'inline' : 'normal';
if ( is_object ( $post ) && ! empty( $errors ) ) {
delete_post_meta( $post->ID, '_csf_errors_'. $this->unique );
}
wp_nonce_field( 'csf_metabox_nonce', 'csf_metabox_nonce'. $this->unique );
echo '<div class="csf csf-metabox'. esc_attr( $theme ) .'">';
echo '<div class="csf-wrapper'. esc_attr( $show_all ) .'">';
if ( $has_nav ) {
echo '<div class="csf-nav csf-nav-'. esc_attr( $nav_type ) .' csf-nav-metabox">';
echo '<ul>';
$tab_key = 0;
foreach ( $this->sections as $section ) {
if ( ! empty( $section['post_type'] ) && ! in_array( $post_type, array_filter( (array) $section['post_type'] ) ) ) {
continue;
}
$tab_error = ( ! empty( $errors['sections'][$tab_key] ) ) ? '<i class="csf-label-error csf-error">!</i>' : '';
$tab_icon = ( ! empty( $section['icon'] ) ) ? '<i class="csf-tab-icon '. esc_attr( $section['icon'] ) .'"></i>' : '';
echo '<li><a href="#">'. $tab_icon . $section['title'] . $tab_error .'</a></li>';
$tab_key++;
}
echo '</ul>';
echo '</div>';
}
echo '<div class="csf-content">';
echo '<div class="csf-sections">';
$section_key = 0;
foreach ( $this->sections as $section ) {
if ( ! empty( $section['post_type'] ) && ! in_array( $post_type, array_filter( (array) $section['post_type'] ) ) ) {
continue;
}
$section_onload = ( ! $has_nav ) ? ' csf-onload' : '';
$section_class = ( ! empty( $section['class'] ) ) ? ' '. $section['class'] : '';
$section_title = ( ! empty( $section['title'] ) ) ? $section['title'] : '';
$section_icon = ( ! empty( $section['icon'] ) ) ? '<i class="csf-section-icon '. esc_attr( $section['icon'] ) .'"></i>' : '';
echo '<div class="csf-section hidden'. esc_attr( $section_onload . $section_class ) .'">';
echo ( $section_title || $section_icon ) ? '<div class="csf-section-title"><h3>'. $section_icon . $section_title .'</h3></div>' : '';
if ( ! empty( $section['fields'] ) ) {
foreach ( $section['fields'] as $field ) {
if ( ! empty( $field['id'] ) && ! empty( $errors['fields'][$field['id']] ) ) {
$field['_error'] = $errors['fields'][$field['id']];
}
if ( ! empty( $field['id'] ) ) {
$field['default'] = $this->get_default( $field );
}
CSF::field( $field, $this->get_meta_value( $field ), $this->unique, 'metabox' );
}
} else {
echo '<div class="csf-no-option">'. esc_html__( 'No data available.', 'csf' ) .'</div>';
}
echo '</div>';
$section_key++;
}
echo '</div>';
if ( ! empty( $this->args['show_restore'] ) || ! empty( $this->args['show_reset'] ) ) {
echo '<div class="csf-sections-reset">';
echo '<label>';
echo '<input type="checkbox" name="'. esc_attr( $this->unique ) .'[_reset]" />';
echo '<span class="button csf-button-reset">'. esc_html__( 'Reset', 'csf' ) .'</span>';
echo '<span class="button csf-button-cancel">'. sprintf( '<small>( %s )</small> %s', esc_html__( 'update post', 'csf' ), esc_html__( 'Cancel', 'csf' ) ) .'</span>';
echo '</label>';
echo '</div>';
}
echo '</div>';
echo ( $has_nav && $nav_type === 'normal' ) ? '<div class="csf-nav-background"></div>' : '';
echo '<div class="clear"></div>';
echo '</div>';
echo '</div>';
}
// save metabox
public function save_meta_box( $post_id ) {
$count = 1;
$data = array();
$errors = array();
$noncekey = 'csf_metabox_nonce'. $this->unique;
$nonce = ( ! empty( $_POST[ $noncekey ] ) ) ? sanitize_text_field( wp_unslash( $_POST[ $noncekey ] ) ) : '';
if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ! wp_verify_nonce( $nonce, 'csf_metabox_nonce' ) ) {
return $post_id;
}
// XSS ok.
// No worries, This "POST" requests is sanitizing in the below foreach.
$request = ( ! empty( $_POST[ $this->unique ] ) ) ? $_POST[ $this->unique ] : array();
if ( ! empty( $request ) ) {
foreach ( $this->sections as $section ) {
if ( ! empty( $section['fields'] ) ) {
foreach ( $section['fields'] as $field ) {
if ( ! empty( $field['id'] ) ) {
$field_id = $field['id'];
$field_value = isset( $request[$field_id] ) ? $request[$field_id] : '';
// Sanitize "post" request of field.
if ( ! isset( $field['sanitize'] ) ) {
if( is_array( $field_value ) ) {
$data[$field_id] = wp_kses_post_deep( $field_value );
} else {
$data[$field_id] = wp_kses_post( $field_value );
}
} else if( isset( $field['sanitize'] ) && is_callable( $field['sanitize'] ) ) {
$data[$field_id] = call_user_func( $field['sanitize'], $field_value );
} else {
$data[$field_id] = $field_value;
}
// Validate "post" request of field.
if ( isset( $field['validate'] ) && is_callable( $field['validate'] ) ) {
$has_validated = call_user_func( $field['validate'], $field_value );
if ( ! empty( $has_validated ) ) {
$errors['sections'][$count] = true;
$errors['fields'][$field_id] = $has_validated;
$data[$field_id] = $this->get_meta_value( $field );
}
}
}
}
}
$count++;
}
}
$data = apply_filters( "csf_{$this->unique}_save", $data, $post_id, $this );
do_action( "csf_{$this->unique}_save_before", $data, $post_id, $this );
if ( empty( $data ) || ! empty( $request['_reset'] ) ) {
if ( $this->args['data_type'] !== 'serialize' ) {
foreach ( $data as $key => $value ) {
delete_post_meta( $post_id, $key );
}
} else {
delete_post_meta( $post_id, $this->unique );
}
} else {
if ( $this->args['data_type'] !== 'serialize' ) {
foreach ( $data as $key => $value ) {
update_post_meta( $post_id, $key, $value );
}
} else {
update_post_meta( $post_id, $this->unique, $data );
}
if ( ! empty( $errors ) ) {
update_post_meta( $post_id, '_csf_errors_'. $this->unique, $errors );
}
}
do_action( "csf_{$this->unique}_saved", $data, $post_id, $this );
do_action( "csf_{$this->unique}_save_after", $data, $post_id, $this );
}
}
}

View File

@@ -0,0 +1,254 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Nav Menu Options Class
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Nav_Menu_Options' ) ) {
class CSF_Nav_Menu_Options extends CSF_Abstract{
// constans
public $unique = '';
public $abstract = 'menu';
public $sections = array();
public $args = array(
'data_type' => 'serialize',
'class' => '',
'defaults' => array(),
);
// run menu construct
public function __construct( $key, $params ) {
$this->unique = $key;
$this->args = apply_filters( "csf_{$this->unique}_args", wp_parse_args( $params['args'], $this->args ), $this );
$this->sections = apply_filters( "csf_{$this->unique}_sections", $params['sections'], $this );
add_action( 'wp_nav_menu_item_custom_fields', array( &$this, 'wp_nav_menu_item_custom_fields' ), 10, 4 );
add_action( 'wp_update_nav_menu_item', array( &$this, 'wp_update_nav_menu_item' ), 10, 3 );
add_filter( 'wp_edit_nav_menu_walker', array( &$this, 'wp_edit_nav_menu_walker' ), 10, 2 );
}
// instance
public static function instance( $key, $params ) {
return new self( $key, $params );
}
public function wp_edit_nav_menu_walker( $class, $menu_id ) {
global $wp_version;
if( version_compare( $wp_version, '5.4.0', '<' ) ) {
if ( ! class_exists( 'CSF_Walker_Nav_Menu_Edit' ) ) {
CSF::include_plugin_file( 'functions/walker.php' );
}
return 'CSF_Walker_Nav_Menu_Edit';
}
return $class;
}
// get default value
public function get_default( $field ) {
$default = ( isset( $field['default'] ) ) ? $field['default'] : '';
$default = ( isset( $this->args['defaults'][$field['id']] ) ) ? $this->args['defaults'][$field['id']] : $default;
return $default;
}
// get meta value
public function get_meta_value( $menu_item_id, $field ) {
$value = null;
if ( ! empty( $menu_item_id ) && ! empty( $field['id'] ) ) {
if ( $this->args['data_type'] !== 'serialize' ) {
$meta = get_post_meta( $menu_item_id, $field['id'] );
$value = ( isset( $meta[0] ) ) ? $meta[0] : null;
} else {
$meta = get_post_meta( $menu_item_id, $this->unique, true );
$value = ( isset( $meta[$field['id']] ) ) ? $meta[$field['id']] : null;
}
}
$default = ( isset( $field['id'] ) ) ? $this->get_default( $field ) : '';
$value = ( isset( $value ) ) ? $value : $default;
return $value;
}
//
public function wp_nav_menu_item_custom_fields( $menu_item_id, $item, $depth, $args ) {
$errors = ( ! empty( $menu_item_id ) ) ? get_post_meta( $menu_item_id, '_csf_errors_'. $this->unique, true ) : array();
$errors = ( ! empty( $errors ) ) ? $errors : array();
$class = ( $this->args['class'] ) ? ' '. $this->args['class'] : '';
if ( ! empty( $errors ) ) {
delete_post_meta( $menu_item_id, '_csf_errors_'. $this->unique );
}
echo '<div class="csf csf-nav-menu-options'. esc_attr( $class ) .'">';
foreach ( $this->sections as $section ) {
$section_icon = ( ! empty( $section['icon'] ) ) ? '<i class="csf-nav-menu-icon '. esc_attr( $section['icon'] ) .'"></i>' : '';
$section_title = ( ! empty( $section['title'] ) ) ? $section['title'] : '';
echo '<div class="csf-fields">';
echo ( $section_title || $section_icon ) ? '<div class="csf-nav-menu-title"><h4>'. $section_icon . $section_title .'</h4></div>' : '';
if ( ! empty( $section['fields'] ) ) {
foreach ( $section['fields'] as $field ) {
if ( ! empty( $field['id'] ) && ! empty( $errors['fields'][$field['id']] ) ) {
$field['_error'] = $errors['fields'][$field['id']];
}
if ( ! empty( $field['id'] ) ) {
$field['default'] = $this->get_default( $field );
}
CSF::field( $field, $this->get_meta_value( $menu_item_id, $field ), $this->unique .'['. $menu_item_id .']', 'menu' );
}
}
echo '</div>';
}
echo '</div>';
}
public function wp_update_nav_menu_item( $menu_id, $menu_item_db_id, $menu_item_args ) {
$count = 1;
$data = array();
$errors = array();
$noncekey = 'update-nav-menu-nonce';
$nonce = ( ! empty( $_POST[ $noncekey ] ) ) ? sanitize_text_field( wp_unslash( $_POST[ $noncekey ] ) ) : '';
if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ! wp_verify_nonce( $nonce, 'update-nav_menu' ) ) {
return $menu_item_db_id;
}
// XSS ok.
// No worries, This "POST" requests is sanitizing in the below foreach.
$request = ( ! empty( $_POST[ $this->unique ][ $menu_item_db_id ] ) ) ? $_POST[ $this->unique ][ $menu_item_db_id ] : array();
if ( ! empty( $request ) ) {
foreach ( $this->sections as $section ) {
if ( ! empty( $section['fields'] ) ) {
foreach ( $section['fields'] as $field ) {
if ( ! empty( $field['id'] ) ) {
$field_id = $field['id'];
$field_value = isset( $request[$field_id] ) ? $request[$field_id] : '';
// Sanitize "post" request of field.
if ( ! isset( $field['sanitize'] ) ) {
if( is_array( $field_value ) ) {
$data[$field_id] = wp_kses_post_deep( $field_value );
} else {
$data[$field_id] = wp_kses_post( $field_value );
}
} else if( isset( $field['sanitize'] ) && is_callable( $field['sanitize'] ) ) {
$data[$field_id] = call_user_func( $field['sanitize'], $field_value );
} else {
$data[$field_id] = $field_value;
}
// Validate "post" request of field.
if ( isset( $field['validate'] ) && is_callable( $field['validate'] ) ) {
$has_validated = call_user_func( $field['validate'], $field_value );
if ( ! empty( $has_validated ) ) {
$errors['sections'][$count] = true;
$errors['fields'][$field_id] = $has_validated;
$data[$field_id] = $this->get_meta_value( $menu_item_db_id, $field );
}
}
}
}
}
$count++;
}
}
$data = apply_filters( "csf_{$this->unique}_save", $data, $menu_item_db_id, $this );
do_action( "csf_{$this->unique}_save_before", $data, $menu_item_db_id, $this );
if ( empty( $data ) ) {
if ( $this->args['data_type'] !== 'serialize' ) {
foreach ( $data as $key => $value ) {
delete_post_meta( $menu_item_db_id, $key );
}
} else {
delete_post_meta( $menu_item_db_id, $this->unique );
}
} else {
if ( $this->args['data_type'] !== 'serialize' ) {
foreach ( $data as $key => $value ) {
update_post_meta( $menu_item_db_id, $key, $value );
}
} else {
update_post_meta( $menu_item_db_id, $this->unique, $data );
}
if ( ! empty( $errors ) ) {
update_post_meta( $menu_item_db_id, '_csf_errors_'. $this->unique, $errors );
}
}
do_action( "csf_{$this->unique}_saved", $data, $menu_item_db_id, $this );
do_action( "csf_{$this->unique}_save_after", $data, $menu_item_db_id, $this );
}
}
}

View File

@@ -0,0 +1,244 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Profile Option Class
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Profile_Options' ) ) {
class CSF_Profile_Options extends CSF_Abstract{
// constans
public $unique = '';
public $abstract = 'profile';
public $sections = array();
public $args = array(
'data_type' => 'serialize',
'class' => '',
'defaults' => array(),
);
// run profile construct
public function __construct( $key, $params ) {
$this->unique = $key;
$this->args = apply_filters( "csf_{$this->unique}_args", wp_parse_args( $params['args'], $this->args ), $this );
$this->sections = apply_filters( "csf_{$this->unique}_sections", $params['sections'], $this );
add_action( 'admin_init', array( &$this, 'add_profile_options' ) );
}
// instance
public static function instance( $key, $params ) {
return new self( $key, $params );
}
// add profile add/edit fields
public function add_profile_options() {
add_action( 'show_user_profile', array( &$this, 'render_profile_form_fields' ) );
add_action( 'edit_user_profile', array( &$this, 'render_profile_form_fields' ) );
add_action( 'personal_options_update', array( &$this, 'save_profile' ) );
add_action( 'edit_user_profile_update', array( &$this, 'save_profile' ) );
}
// get default value
public function get_default( $field ) {
$default = ( isset( $field['default'] ) ) ? $field['default'] : '';
$default = ( isset( $this->args['defaults'][$field['id']] ) ) ? $this->args['defaults'][$field['id']] : $default;
return $default;
}
// get meta value
public function get_meta_value( $user_id, $field ) {
$value = null;
if ( ! empty( $user_id ) && ! empty( $field['id'] ) ) {
if ( $this->args['data_type'] !== 'serialize' ) {
$meta = get_user_meta( $user_id, $field['id'] );
$value = ( isset( $meta[0] ) ) ? $meta[0] : null;
} else {
$meta = get_user_meta( $user_id, $this->unique, true );
$value = ( isset( $meta[$field['id']] ) ) ? $meta[$field['id']] : null;
}
}
$default = ( isset( $field['id'] ) ) ? $this->get_default( $field ) : '';
$value = ( isset( $value ) ) ? $value : $default;
return $value;
}
// render profile add/edit form fields
public function render_profile_form_fields( $profileuser ) {
$is_profile = ( is_object( $profileuser ) && isset( $profileuser->ID ) ) ? true : false;
$profile_id = ( $is_profile ) ? $profileuser->ID : 0;
$errors = ( ! empty( $profile_id ) ) ? get_user_meta( $profile_id, '_csf_errors_'. $this->unique, true ) : array();
$errors = ( ! empty( $errors ) ) ? $errors : array();
$class = ( $this->args['class'] ) ? ''. $this->args['class'] : '';
if ( ! empty( $errors ) ) {
delete_user_meta( $profile_id, '_csf_errors_'. $this->unique );
}
echo '<div class="csf csf-profile-options csf-onload'. esc_attr( $class ) .'">';
wp_nonce_field( 'csf_profile_nonce', 'csf_profile_nonce'. $this->unique );
foreach ( $this->sections as $section ) {
$section_icon = ( ! empty( $section['icon'] ) ) ? '<i class="csf-section-icon '. esc_attr( $section['icon'] ) .'"></i>' : '';
$section_title = ( ! empty( $section['title'] ) ) ? $section['title'] : '';
echo ( $section_title || $section_icon ) ? '<h2>'. $section_icon . $section_title .'</h2>' : '';
if ( ! empty( $section['fields'] ) ) {
foreach ( $section['fields'] as $field ) {
if ( ! empty( $field['id'] ) && ! empty( $errors['fields'][$field['id']] ) ) {
$field['_error'] = $errors['fields'][$field['id']];
}
if ( ! empty( $field['id'] ) ) {
$field['default'] = $this->get_default( $field );
}
CSF::field( $field, $this->get_meta_value( $profile_id, $field ), $this->unique, 'profile' );
}
}
}
echo '</div>';
}
// save profile form fields
public function save_profile( $user_id ) {
$count = 1;
$data = array();
$errors = array();
$noncekey = 'csf_profile_nonce'. $this->unique;
$nonce = ( ! empty( $_POST[ $noncekey ] ) ) ? sanitize_text_field( wp_unslash( $_POST[ $noncekey ] ) ) : '';
if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ! wp_verify_nonce( $nonce, 'csf_profile_nonce' ) ) {
return $user_id;
}
// XSS ok.
// No worries, This "POST" requests is sanitizing in the below foreach.
$request = ( ! empty( $_POST[ $this->unique ] ) ) ? $_POST[ $this->unique ] : array();
if ( ! empty( $request ) ) {
foreach ( $this->sections as $section ) {
if ( ! empty( $section['fields'] ) ) {
foreach ( $section['fields'] as $field ) {
if ( ! empty( $field['id'] ) ) {
$field_id = $field['id'];
$field_value = isset( $request[$field_id] ) ? $request[$field_id] : '';
// Sanitize "post" request of field.
if ( ! isset( $field['sanitize'] ) ) {
if( is_array( $field_value ) ) {
$data[$field_id] = wp_kses_post_deep( $field_value );
} else {
$data[$field_id] = wp_kses_post( $field_value );
}
} else if( isset( $field['sanitize'] ) && is_callable( $field['sanitize'] ) ) {
$data[$field_id] = call_user_func( $field['sanitize'], $field_value );
} else {
$data[$field_id] = $field_value;
}
// Validate "post" request of field.
if ( isset( $field['validate'] ) && is_callable( $field['validate'] ) ) {
$has_validated = call_user_func( $field['validate'], $field_value );
if ( ! empty( $has_validated ) ) {
$errors['sections'][$count] = true;
$errors['fields'][$field_id] = $has_validated;
$data[$field_id] = $this->get_meta_value( $user_id, $field );
}
}
}
}
}
$count++;
}
}
$data = apply_filters( "csf_{$this->unique}_save", $data, $user_id, $this );
do_action( "csf_{$this->unique}_save_before", $data, $user_id, $this );
if ( empty( $data ) ) {
if ( $this->args['data_type'] !== 'serialize' ) {
foreach ( $data as $key => $value ) {
delete_user_meta( $user_id, $key );
}
} else {
delete_user_meta( $user_id, $this->unique );
}
} else {
if ( $this->args['data_type'] !== 'serialize' ) {
foreach ( $data as $key => $value ) {
update_user_meta( $user_id, $key, $value );
}
} else {
update_user_meta( $user_id, $this->unique, $data );
}
if ( ! empty( $errors ) ) {
update_user_meta( $user_id, '_csf_errors_'. $this->unique, $errors );
}
}
do_action( "csf_{$this->unique}_saved", $data, $user_id, $this );
do_action( "csf_{$this->unique}_save_after", $data, $user_id, $this );
}
}
}

View File

@@ -0,0 +1,785 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Setup Class
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF' ) ) {
class CSF {
// Default constants
public static $premium = true;
public static $version = '2.2.2';
public static $dir = '';
public static $url = '';
public static $css = '';
public static $file = '';
public static $enqueue = false;
public static $webfonts = array();
public static $subsets = array();
public static $inited = array();
public static $fields = array();
public static $args = array(
'admin_options' => array(),
'customize_options' => array(),
'metabox_options' => array(),
'nav_menu_options' => array(),
'profile_options' => array(),
'taxonomy_options' => array(),
'widget_options' => array(),
'comment_options' => array(),
'shortcode_options' => array(),
);
// Shortcode instances
public static $shortcode_instances = array();
private static $instance = null;
public static function init( $file = __FILE__ ) {
// Set file constant
self::$file = $file;
// Set constants
self::constants();
// Include files
self::includes();
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
// Initalize
public function __construct() {
// Init action
do_action( 'csf_init' );
// Setup textdomain
self::textdomain();
add_action( 'after_setup_theme', array( 'CSF', 'setup' ) );
add_action( 'init', array( 'CSF', 'setup' ) );
add_action( 'switch_theme', array( 'CSF', 'setup' ) );
add_action( 'admin_enqueue_scripts', array( 'CSF', 'add_admin_enqueue_scripts' ) );
add_action( 'wp_enqueue_scripts', array( 'CSF', 'add_typography_enqueue_styles' ), 80 );
add_action( 'wp_head', array( 'CSF', 'add_custom_css' ), 80 );
add_filter( 'admin_body_class', array( 'CSF', 'add_admin_body_class' ) );
}
// Setup frameworks
public static function setup() {
// Welcome page
self::include_plugin_file( 'views/welcome.php' );
// Setup admin option framework
$params = array();
if ( class_exists( 'CSF_Options' ) && ! empty( self::$args['admin_options'] ) ) {
foreach ( self::$args['admin_options'] as $key => $value ) {
if ( ! empty( self::$args['sections'][$key] ) && ! isset( self::$inited[$key] ) ) {
$params['args'] = $value;
$params['sections'] = self::$args['sections'][$key];
self::$inited[$key] = true;
CSF_Options::instance( $key, $params );
if ( ! empty( $value['show_in_customizer'] ) ) {
$value['output_css'] = false;
$value['enqueue_webfont'] = false;
self::$args['customize_options'][$key] = $value;
self::$inited[$key] = null;
}
}
}
}
// Setup customize option framework
$params = array();
if ( class_exists( 'CSF_Customize_Options' ) && ! empty( self::$args['customize_options'] ) ) {
foreach ( self::$args['customize_options'] as $key => $value ) {
if ( ! empty( self::$args['sections'][$key] ) && ! isset( self::$inited[$key] ) ) {
$params['args'] = $value;
$params['sections'] = self::$args['sections'][$key];
self::$inited[$key] = true;
CSF_Customize_Options::instance( $key, $params );
}
}
}
// Setup metabox option framework
$params = array();
if ( class_exists( 'CSF_Metabox' ) && ! empty( self::$args['metabox_options'] ) ) {
foreach ( self::$args['metabox_options'] as $key => $value ) {
if ( ! empty( self::$args['sections'][$key] ) && ! isset( self::$inited[$key] ) ) {
$params['args'] = $value;
$params['sections'] = self::$args['sections'][$key];
self::$inited[$key] = true;
CSF_Metabox::instance( $key, $params );
}
}
}
// Setup nav menu option framework
$params = array();
if ( class_exists( 'CSF_Nav_Menu_Options' ) && ! empty( self::$args['nav_menu_options'] ) ) {
foreach ( self::$args['nav_menu_options'] as $key => $value ) {
if ( ! empty( self::$args['sections'][$key] ) && ! isset( self::$inited[$key] ) ) {
$params['args'] = $value;
$params['sections'] = self::$args['sections'][$key];
self::$inited[$key] = true;
CSF_Nav_Menu_Options::instance( $key, $params );
}
}
}
// Setup profile option framework
$params = array();
if ( class_exists( 'CSF_Profile_Options' ) && ! empty( self::$args['profile_options'] ) ) {
foreach ( self::$args['profile_options'] as $key => $value ) {
if ( ! empty( self::$args['sections'][$key] ) && ! isset( self::$inited[$key] ) ) {
$params['args'] = $value;
$params['sections'] = self::$args['sections'][$key];
self::$inited[$key] = true;
CSF_Profile_Options::instance( $key, $params );
}
}
}
// Setup taxonomy option framework
$params = array();
if ( class_exists( 'CSF_Taxonomy_Options' ) && ! empty( self::$args['taxonomy_options'] ) ) {
$taxonomy = ( isset( $_GET['taxonomy'] ) ) ? sanitize_text_field( wp_unslash( $_GET['taxonomy'] ) ) : '';
foreach ( self::$args['taxonomy_options'] as $key => $value ) {
if ( ! empty( self::$args['sections'][$key] ) && ! isset( self::$inited[$key] ) ) {
$params['args'] = $value;
$params['sections'] = self::$args['sections'][$key];
self::$inited[$key] = true;
CSF_Taxonomy_Options::instance( $key, $params );
}
}
}
// Setup widget option framework
if ( class_exists( 'CSF_Widget' ) && class_exists( 'WP_Widget_Factory' ) && ! empty( self::$args['widget_options'] ) ) {
$wp_widget_factory = new WP_Widget_Factory();
foreach ( self::$args['widget_options'] as $key => $value ) {
if ( ! isset( self::$inited[$key] ) ) {
self::$inited[$key] = true;
$wp_widget_factory->register( CSF_Widget::instance( $key, $value ) );
}
}
}
// Setup comment option framework
$params = array();
if ( class_exists( 'CSF_Comment_Metabox' ) && ! empty( self::$args['comment_options'] ) ) {
foreach ( self::$args['comment_options'] as $key => $value ) {
if ( ! empty( self::$args['sections'][$key] ) && ! isset( self::$inited[$key] ) ) {
$params['args'] = $value;
$params['sections'] = self::$args['sections'][$key];
self::$inited[$key] = true;
CSF_Comment_Metabox::instance( $key, $params );
}
}
}
// Setup shortcode option framework
$params = array();
if ( class_exists( 'CSF_Shortcoder' ) && ! empty( self::$args['shortcode_options'] ) ) {
foreach ( self::$args['shortcode_options'] as $key => $value ) {
if ( ! empty( self::$args['sections'][$key] ) && ! isset( self::$inited[$key] ) ) {
$params['args'] = $value;
$params['sections'] = self::$args['sections'][$key];
self::$inited[$key] = true;
CSF_Shortcoder::instance( $key, $params );
}
}
// Once editor setup for gutenberg and media buttons
if ( class_exists( 'CSF_Shortcoder' ) && ! empty( self::$shortcode_instances ) ) {
foreach ( self::$shortcode_instances as $instance ) {
if ( ! empty( $instance['show_in_editor'] ) ) {
CSF_Shortcoder::once_editor_setup();
break;
}
}
}
}
do_action( 'csf_loaded' );
}
// Create options
public static function createOptions( $id, $args = array() ) {
self::$args['admin_options'][$id] = $args;
}
// Create customize options
public static function createCustomizeOptions( $id, $args = array() ) {
self::$args['customize_options'][$id] = $args;
}
// Create metabox options
public static function createMetabox( $id, $args = array() ) {
self::$args['metabox_options'][$id] = $args;
}
// Create menu options
public static function createNavMenuOptions( $id, $args = array() ) {
self::$args['nav_menu_options'][$id] = $args;
}
// Create shortcoder options
public static function createShortcoder( $id, $args = array() ) {
self::$args['shortcode_options'][$id] = $args;
}
// Create taxonomy options
public static function createTaxonomyOptions( $id, $args = array() ) {
self::$args['taxonomy_options'][$id] = $args;
}
// Create profile options
public static function createProfileOptions( $id, $args = array() ) {
self::$args['profile_options'][$id] = $args;
}
// Create widget
public static function createWidget( $id, $args = array() ) {
self::$args['widget_options'][$id] = $args;
self::set_used_fields( $args );
}
// Create comment metabox
public static function createCommentMetabox( $id, $args = array() ) {
self::$args['comment_options'][$id] = $args;
}
// Create section
public static function createSection( $id, $sections ) {
self::$args['sections'][$id][] = $sections;
self::set_used_fields( $sections );
}
// Set directory constants
public static function constants() {
// We need this path-finder code for set URL of framework
$dirname = str_replace( '//', '/', wp_normalize_path( dirname( dirname( self::$file ) ) ) );
$theme_dir = str_replace( '//', '/', wp_normalize_path( get_parent_theme_file_path() ) );
$plugin_dir = str_replace( '//', '/', wp_normalize_path( WP_PLUGIN_DIR ) );
$located_plugin = ( preg_match( '#'. self::sanitize_dirname( $plugin_dir ) .'#', self::sanitize_dirname( $dirname ) ) ) ? true : false;
$directory = ( $located_plugin ) ? $plugin_dir : $theme_dir;
$directory_uri = ( $located_plugin ) ? WP_PLUGIN_URL : get_parent_theme_file_uri();
$foldername = str_replace( $directory, '', $dirname );
$protocol_uri = ( is_ssl() ) ? 'https' : 'http';
$directory_uri = set_url_scheme( $directory_uri, $protocol_uri );
self::$dir = $dirname;
self::$url = $directory_uri . $foldername;
}
// Include file helper
public static function include_plugin_file( $file, $load = true ) {
$path = '';
$file = ltrim( $file, '/' );
$override = apply_filters( 'csf_override', 'csf-override' );
if ( file_exists( get_parent_theme_file_path( $override .'/'. $file ) ) ) {
$path = get_parent_theme_file_path( $override .'/'. $file );
} elseif ( file_exists( get_theme_file_path( $override .'/'. $file ) ) ) {
$path = get_theme_file_path( $override .'/'. $file );
} elseif ( file_exists( self::$dir .'/'. $override .'/'. $file ) ) {
$path = self::$dir .'/'. $override .'/'. $file;
} elseif ( file_exists( self::$dir .'/'. $file ) ) {
$path = self::$dir .'/'. $file;
}
if ( ! empty( $path ) && ! empty( $file ) && $load ) {
global $wp_query;
if ( is_object( $wp_query ) && function_exists( 'load_template' ) ) {
load_template( $path, true );
} else {
require_once( $path );
}
} else {
return self::$dir .'/'. $file;
}
}
// Is active plugin helper
public static function is_active_plugin( $file = '' ) {
return in_array( $file, (array) get_option( 'active_plugins', array() ) );
}
// Sanitize dirname
public static function sanitize_dirname( $dirname ) {
return preg_replace( '/[^A-Za-z]/', '', $dirname );
}
// Set url constant
public static function include_plugin_url( $file ) {
return esc_url( self::$url ) .'/'. ltrim( $file, '/' );
}
// Include files
public static function includes() {
// Helpers
self::include_plugin_file( 'functions/actions.php' );
self::include_plugin_file( 'functions/helpers.php' );
self::include_plugin_file( 'functions/sanitize.php' );
self::include_plugin_file( 'functions/validate.php' );
// Includes free version classes
self::include_plugin_file( 'classes/abstract.class.php' );
self::include_plugin_file( 'classes/fields.class.php' );
self::include_plugin_file( 'classes/admin-options.class.php' );
// Includes premium version classes
if ( self::$premium ) {
self::include_plugin_file( 'classes/customize-options.class.php' );
self::include_plugin_file( 'classes/metabox-options.class.php' );
self::include_plugin_file( 'classes/nav-menu-options.class.php' );
self::include_plugin_file( 'classes/profile-options.class.php' );
self::include_plugin_file( 'classes/shortcode-options.class.php' );
self::include_plugin_file( 'classes/taxonomy-options.class.php' );
self::include_plugin_file( 'classes/widget-options.class.php' );
self::include_plugin_file( 'classes/comment-options.class.php' );
}
// Include all framework fields
$fields = apply_filters( 'csf_fields', array(
'accordion',
'background',
'backup',
'border',
'button_set',
'callback',
'checkbox',
'code_editor',
'color',
'color_group',
'content',
'date',
'dimensions',
'fieldset',
'gallery',
'group',
'heading',
'icon',
'image_select',
'link',
'link_color',
'map',
'media',
'notice',
'number',
'palette',
'radio',
'repeater',
'select',
'slider',
'sortable',
'sorter',
'spacing',
'spinner',
'subheading',
'submessage',
'switcher',
'tabbed',
'text',
'textarea',
'typography',
'upload',
'wp_editor',
) );
if ( ! empty( $fields ) ) {
foreach ( $fields as $field ) {
if ( ! class_exists( 'CSF_Field_'. $field ) && class_exists( 'CSF_Fields' ) ) {
self::include_plugin_file( 'fields/'. $field .'/'. $field .'.php' );
}
}
}
}
// Setup textdomain
public static function textdomain() {
load_textdomain( 'csf', self::$dir .'/languages/'. get_locale() .'.mo' );
}
// Set all of used fields
public static function set_used_fields( $sections ) {
if ( ! empty( $sections['fields'] ) ) {
foreach ( $sections['fields'] as $field ) {
if ( ! empty( $field['fields'] ) ) {
self::set_used_fields( $field );
}
if ( ! empty( $field['tabs'] ) ) {
self::set_used_fields( array( 'fields' => $field['tabs'] ) );
}
if ( ! empty( $field['accordions'] ) ) {
self::set_used_fields( array( 'fields' => $field['accordions'] ) );
}
if ( ! empty( $field['type'] ) ) {
self::$fields[$field['type']] = $field;
}
}
}
}
// Enqueue admin and fields styles and scripts
public static function add_admin_enqueue_scripts() {
// Loads scripts and styles only when needed
$wpscreen = get_current_screen();
if ( ! empty( self::$args['admin_options'] ) ) {
foreach ( self::$args['admin_options'] as $argument ) {
if ( substr( $wpscreen->id, -strlen( $argument['menu_slug'] ) ) === $argument['menu_slug'] ) {
self::$enqueue = true;
}
}
}
if ( ! empty( self::$args['metabox_options'] ) ) {
foreach ( self::$args['metabox_options'] as $argument ) {
if ( in_array( $wpscreen->post_type, (array) $argument['post_type'] ) ) {
self::$enqueue = true;
}
}
}
if ( ! empty( self::$args['taxonomy_options'] ) ) {
foreach ( self::$args['taxonomy_options'] as $argument ) {
if ( in_array( $wpscreen->taxonomy, (array) $argument['taxonomy'] ) ) {
self::$enqueue = true;
}
}
}
if ( ! empty( self::$shortcode_instances ) ) {
foreach ( self::$shortcode_instances as $argument ) {
if ( ( $argument['show_in_editor'] && $wpscreen->base === 'post' ) || $argument['show_in_custom'] ) {
self::$enqueue = true;
}
}
}
if ( ! empty( self::$args['widget_options'] ) && ( $wpscreen->id === 'widgets' || $wpscreen->id === 'customize' ) ) {
self::$enqueue = true;
}
if ( ! empty( self::$args['customize_options'] ) && $wpscreen->id === 'customize' ) {
self::$enqueue = true;
}
if ( ! empty( self::$args['nav_menu_options'] ) && $wpscreen->id === 'nav-menus' ) {
self::$enqueue = true;
}
if ( ! empty( self::$args['profile_options'] ) && ( $wpscreen->id === 'profile' || $wpscreen->id === 'user-edit' ) ) {
self::$enqueue = true;
}
if ( ! empty( self::$args['comment_options'] ) && $wpscreen->id === 'comment' ) {
self::$enqueue = true;
}
if ( $wpscreen->id === 'tools_page_csf-welcome' ) {
self::$enqueue = true;
}
if ( ! apply_filters( 'csf_enqueue_assets', self::$enqueue ) ) {
return;
}
// Check for developer mode
$min = ( self::$premium && SCRIPT_DEBUG ) ? '' : '.min';
// Admin utilities
wp_enqueue_media();
// Wp color picker
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_script( 'wp-color-picker' );
// Font awesome 4 and 5 loader
if ( apply_filters( 'csf_fa4', false ) ) {
wp_enqueue_style( 'csf-fa', 'https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome'. $min .'.css', array(), '4.7.0', 'all' );
} else {
wp_enqueue_style( 'csf-fa5', 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.3/css/all'. $min .'.css', array(), '5.15.3', 'all' );
wp_enqueue_style( 'csf-fa5-v4-shims', 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.3/css/v4-shims'. $min .'.css', array(), '5.15.3', 'all' );
}
// Main style
wp_enqueue_style( 'csf', self::include_plugin_url( 'assets/css/style'. $min .'.css' ), array(), self::$version, 'all' );
// Main RTL styles
if ( is_rtl() ) {
wp_enqueue_style( 'csf-rtl', self::include_plugin_url( 'assets/css/style-rtl'. $min .'.css' ), array(), self::$version, 'all' );
}
// Main scripts
wp_enqueue_script( 'csf-plugins', self::include_plugin_url( 'assets/js/plugins'. $min .'.js' ), array(), self::$version, true );
wp_enqueue_script( 'csf', self::include_plugin_url( 'assets/js/main'. $min .'.js' ), array( 'csf-plugins' ), self::$version, true );
// Main variables
wp_localize_script( 'csf', 'csf_vars', array(
'color_palette' => apply_filters( 'csf_color_palette', array() ),
'i18n' => array(
'confirm' => esc_html__( 'Are you sure?', 'csf' ),
'typing_text' => esc_html__( 'Please enter %s or more characters', 'csf' ),
'searching_text' => esc_html__( 'Searching...', 'csf' ),
'no_results_text' => esc_html__( 'No results found.', 'csf' ),
),
) );
// Enqueue fields scripts and styles
$enqueued = array();
if ( ! empty( self::$fields ) ) {
foreach ( self::$fields as $field ) {
if ( ! empty( $field['type'] ) ) {
$classname = 'CSF_Field_' . $field['type'];
if ( class_exists( $classname ) && method_exists( $classname, 'enqueue' ) ) {
$instance = new $classname( $field );
if ( method_exists( $classname, 'enqueue' ) ) {
$instance->enqueue();
}
unset( $instance );
}
}
}
}
do_action( 'csf_enqueue' );
}
// Add typography enqueue styles to front page
public static function add_typography_enqueue_styles() {
if ( ! empty( self::$webfonts ) ) {
if ( ! empty( self::$webfonts['enqueue'] ) ) {
$query = array();
$fonts = array();
foreach ( self::$webfonts['enqueue'] as $family => $styles ) {
$fonts[] = $family . ( ( ! empty( $styles ) ) ? ':'. implode( ',', $styles ) : '' );
}
if ( ! empty( $fonts ) ) {
$query['family'] = implode( '%7C', $fonts );
}
if ( ! empty( self::$subsets ) ) {
$query['subset'] = implode( ',', self::$subsets );
}
$query['display'] = 'swap';
wp_enqueue_style( 'csf-google-web-fonts', esc_url( add_query_arg( $query, '//fonts.googleapis.com/css' ) ), array(), null );
}
if ( ! empty( self::$webfonts['async'] ) ) {
$fonts = array();
foreach ( self::$webfonts['async'] as $family => $styles ) {
$fonts[] = $family . ( ( ! empty( $styles ) ) ? ':'. implode( ',', $styles ) : '' );
}
wp_enqueue_script( 'csf-google-web-fonts', esc_url( '//ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js' ), array(), null );
wp_localize_script( 'csf-google-web-fonts', 'WebFontConfig', array( 'google' => array( 'families' => $fonts ) ) );
}
}
}
// Add admin body class
public static function add_admin_body_class( $classes ) {
if ( apply_filters( 'csf_fa4', false ) ) {
$classes .= 'csf-fa5-shims';
}
return $classes;
}
// Add custom css to front page
public static function add_custom_css() {
if ( ! empty( self::$css ) ) {
echo '<style type="text/css">'. wp_strip_all_tags( self::$css ) .'</style>';
}
}
// Add a new framework field
public static function field( $field = array(), $value = '', $unique = '', $where = '', $parent = '' ) {
// Check for unallow fields
if ( ! empty( $field['_notice'] ) ) {
$field_type = $field['type'];
$field = array();
$field['content'] = esc_html__( 'Oops! Not allowed.', 'csf' ) .' <strong>('. $field_type .')</strong>';
$field['type'] = 'notice';
$field['style'] = 'danger';
}
$depend = '';
$visible = '';
$unique = ( ! empty( $unique ) ) ? $unique : '';
$class = ( ! empty( $field['class'] ) ) ? ' ' . esc_attr( $field['class'] ) : '';
$is_pseudo = ( ! empty( $field['pseudo'] ) ) ? ' csf-pseudo-field' : '';
$field_type = ( ! empty( $field['type'] ) ) ? esc_attr( $field['type'] ) : '';
if ( ! empty( $field['dependency'] ) ) {
$dependency = $field['dependency'];
$depend_visible = '';
$data_controller = '';
$data_condition = '';
$data_value = '';
$data_global = '';
if ( is_array( $dependency[0] ) ) {
$data_controller = implode( '|', array_column( $dependency, 0 ) );
$data_condition = implode( '|', array_column( $dependency, 1 ) );
$data_value = implode( '|', array_column( $dependency, 2 ) );
$data_global = implode( '|', array_column( $dependency, 3 ) );
$depend_visible = implode( '|', array_column( $dependency, 4 ) );
} else {
$data_controller = ( ! empty( $dependency[0] ) ) ? $dependency[0] : '';
$data_condition = ( ! empty( $dependency[1] ) ) ? $dependency[1] : '';
$data_value = ( ! empty( $dependency[2] ) ) ? $dependency[2] : '';
$data_global = ( ! empty( $dependency[3] ) ) ? $dependency[3] : '';
$depend_visible = ( ! empty( $dependency[4] ) ) ? $dependency[4] : '';
}
$depend .= ' data-controller="'. esc_attr( $data_controller ) .'"';
$depend .= ' data-condition="'. esc_attr( $data_condition ) .'"';
$depend .= ' data-value="'. esc_attr( $data_value ) .'"';
$depend .= ( ! empty( $data_global ) ) ? ' data-depend-global="true"' : '';
$visible = ( ! empty( $depend_visible ) ) ? ' csf-depend-visible' : ' csf-depend-hidden';
}
if ( ! empty( $field_type ) ) {
// These attributes has been sanitized above.
echo '<div class="csf-field csf-field-'. $field_type . $is_pseudo . $class . $visible .'"'. $depend .'>';
if ( ! empty( $field['fancy_title'] ) ) {
echo '<div class="csf-fancy-title">' . $field['fancy_title'] .'</div>';
}
if ( ! empty( $field['title'] ) ) {
echo '<div class="csf-title">';
echo '<h4>'. $field['title'] .'</h4>';
echo ( ! empty( $field['subtitle'] ) ) ? '<div class="csf-subtitle-text">'. $field['subtitle'] .'</div>' : '';
echo '</div>';
}
echo ( ! empty( $field['title'] ) || ! empty( $field['fancy_title'] ) ) ? '<div class="csf-fieldset">' : '';
$value = ( ! isset( $value ) && isset( $field['default'] ) ) ? $field['default'] : $value;
$value = ( isset( $field['value'] ) ) ? $field['value'] : $value;
$classname = 'CSF_Field_'. $field_type;
if ( class_exists( $classname ) ) {
$instance = new $classname( $field, $value, $unique, $where, $parent );
$instance->render();
} else {
echo '<p>'. esc_html__( 'Field not found!', 'csf' ) .'</p>';
}
} else {
echo '<p>'. esc_html__( 'Field not found!', 'csf' ) .'</p>';
}
echo ( ! empty( $field['title'] ) || ! empty( $field['fancy_title'] ) ) ? '</div>' : '';
echo '<div class="clear"></div>';
echo '</div>';
}
}
}
CSF::init( __FILE__ );

View File

@@ -0,0 +1,335 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Shortcoder Class
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Shortcoder' ) ) {
class CSF_Shortcoder extends CSF_Abstract{
// constans
public $unique = '';
public $abstract = 'shortcoder';
public $blocks = array();
public $sections = array();
public $pre_tabs = array();
public $pre_sections = array();
public $args = array(
'button_title' => 'Add Shortcode',
'select_title' => 'Select a shortcode',
'insert_title' => 'Insert Shortcode',
'show_in_editor' => true,
'show_in_custom' => false,
'defaults' => array(),
'class' => '',
'gutenberg' => array(
'title' => 'CSF Shortcodes',
'description' => 'CSF Shortcode Block',
'icon' => 'screenoptions',
'category' => 'widgets',
'keywords' => array( 'shortcode', 'csf', 'insert' ),
'placeholder' => 'Write shortcode here...',
),
);
// run shortcode construct
public function __construct( $key, $params = array() ) {
$this->unique = $key;
$this->args = apply_filters( "csf_{$this->unique}_args", wp_parse_args( $params['args'], $this->args ), $this );
$this->sections = apply_filters( "csf_{$this->unique}_sections", $params['sections'], $this );
$this->pre_tabs = $this->pre_tabs( $this->sections );
$this->pre_sections = $this->pre_sections( $this->sections );
add_action( 'admin_footer', array( &$this, 'add_footer_modal_shortcode' ) );
add_action( 'customize_controls_print_footer_scripts', array( &$this, 'add_footer_modal_shortcode' ) );
add_action( 'wp_ajax_csf-get-shortcode-'. $this->unique, array( &$this, 'get_shortcode' ) );
if ( ! empty( $this->args['show_in_editor'] ) ) {
CSF::$shortcode_instances[$this->unique] = wp_parse_args( array( 'hash' => md5( $key ), 'modal_id' => $this->unique ), $this->args );
// elementor editor support
if ( CSF::is_active_plugin( 'elementor/elementor.php' ) ) {
add_action( 'elementor/editor/before_enqueue_scripts', array( 'CSF', 'add_admin_enqueue_scripts' ) );
add_action( 'elementor/editor/footer', array( 'CSF_Field_icon', 'add_footer_modal_icon' ) );
add_action( 'elementor/editor/footer', array( &$this, 'add_footer_modal_shortcode' ) );
}
}
}
// instance
public static function instance( $key, $params = array() ) {
return new self( $key, $params );
}
public function pre_tabs( $sections ) {
$result = array();
$parents = array();
$count = 100;
foreach ( $sections as $key => $section ) {
if ( ! empty( $section['parent'] ) ) {
$section['priority'] = ( isset( $section['priority'] ) ) ? $section['priority'] : $count;
$parents[$section['parent']][] = $section;
unset( $sections[$key] );
}
$count++;
}
foreach ( $sections as $key => $section ) {
$section['priority'] = ( isset( $section['priority'] ) ) ? $section['priority'] : $count;
if ( ! empty( $section['id'] ) && ! empty( $parents[$section['id']] ) ) {
$section['subs'] = wp_list_sort( $parents[$section['id']], array( 'priority' => 'ASC' ), 'ASC', true );
}
$result[] = $section;
$count++;
}
return wp_list_sort( $result, array( 'priority' => 'ASC' ), 'ASC', true );
}
public function pre_sections( $sections ) {
$result = array();
foreach ( $this->pre_tabs as $tab ) {
if ( ! empty( $tab['subs'] ) ) {
foreach ( $tab['subs'] as $sub ) {
$result[] = $sub;
}
}
if ( empty( $tab['subs'] ) ) {
$result[] = $tab;
}
}
return $result;
}
// get default value
public function get_default( $field ) {
$default = ( isset( $field['default'] ) ) ? $field['default'] : '';
$default = ( isset( $this->args['defaults'][$field['id']] ) ) ? $this->args['defaults'][$field['id']] : $default;
return $default;
}
public function add_footer_modal_shortcode() {
if( ! wp_script_is( 'csf' ) ) {
return;
}
$class = ( $this->args['class'] ) ? ' '. esc_attr( $this->args['class'] ) : '';
$has_select = ( count( $this->pre_tabs ) > 1 ) ? true : false;
$single_usage = ( ! $has_select ) ? ' csf-shortcode-single' : '';
$hide_header = ( ! $has_select ) ? ' hidden' : '';
?>
<div id="csf-modal-<?php echo esc_attr( $this->unique ); ?>" class="wp-core-ui csf-modal csf-shortcode hidden<?php echo esc_attr( $single_usage . $class ); ?>" data-modal-id="<?php echo esc_attr( $this->unique ); ?>" data-nonce="<?php echo esc_attr( wp_create_nonce( 'csf_shortcode_nonce' ) ); ?>">
<div class="csf-modal-table">
<div class="csf-modal-table-cell">
<div class="csf-modal-overlay"></div>
<div class="csf-modal-inner">
<div class="csf-modal-title">
<?php echo $this->args['button_title']; ?>
<div class="csf-modal-close"></div>
</div>
<?php
echo '<div class="csf-modal-header'. esc_attr( $hide_header ) .'">';
echo '<select>';
echo ( $has_select ) ? '<option value="">'. esc_attr( $this->args['select_title'] ) .'</option>' : '';
$tab_key = 1;
foreach ( $this->pre_tabs as $tab ) {
if ( ! empty( $tab['subs'] ) ) {
echo '<optgroup label="'. esc_attr( $tab['title'] ) .'">';
foreach ( $tab['subs'] as $sub ) {
$view = ( ! empty( $sub['view'] ) ) ? ' data-view="'. esc_attr( $sub['view'] ) .'"' : '';
$shortcode = ( ! empty( $sub['shortcode'] ) ) ? ' data-shortcode="'. esc_attr( $sub['shortcode'] ) .'"' : '';
$group = ( ! empty( $sub['group_shortcode'] ) ) ? ' data-group="'. esc_attr( $sub['group_shortcode'] ) .'"' : '';
echo '<option value="'. esc_attr( $tab_key ) .'"'. $view . $shortcode . $group .'>'. esc_attr( $sub['title'] ) .'</option>';
$tab_key++;
}
echo '</optgroup>' ;
} else {
$view = ( ! empty( $tab['view'] ) ) ? ' data-view="'. esc_attr( $tab['view'] ) .'"' : '';
$shortcode = ( ! empty( $tab['shortcode'] ) ) ? ' data-shortcode="'. esc_attr( $tab['shortcode'] ) .'"' : '';
$group = ( ! empty( $tab['group_shortcode'] ) ) ? ' data-group="'. esc_attr( $tab['group_shortcode'] ) .'"' : '';
echo '<option value="'. esc_attr( $tab_key ) .'"'. $view . $shortcode . $group .'>'. esc_attr( $tab['title'] ) .'</option>';
$tab_key++;
}
}
echo '</select>';
echo '</div>';
?>
<div class="csf-modal-content">
<div class="csf-modal-loading"><div class="csf-loading"></div></div>
<div class="csf-modal-load"></div>
</div>
<div class="csf-modal-insert-wrapper hidden"><a href="#" class="button button-primary csf-modal-insert"><?php echo $this->args['insert_title']; ?></a></div>
</div>
</div>
</div>
</div>
<?php
}
public function get_shortcode() {
ob_start();
$nonce = ( ! empty( $_POST[ 'nonce' ] ) ) ? sanitize_text_field( wp_unslash( $_POST[ 'nonce' ] ) ) : '';
$shortcode_key = ( ! empty( $_POST[ 'shortcode_key' ] ) ) ? sanitize_text_field( wp_unslash( $_POST[ 'shortcode_key' ] ) ) : '';
if ( ! empty( $shortcode_key ) && wp_verify_nonce( $nonce, 'csf_shortcode_nonce' ) ) {
$unallows = array( 'group', 'repeater', 'sorter' );
$section = $this->pre_sections[$shortcode_key-1];
$shortcode = ( ! empty( $section['shortcode'] ) ) ? $section['shortcode'] : '';
$view = ( ! empty( $section['view'] ) ) ? $section['view'] : 'normal';
if ( ! empty( $section ) ) {
//
// View: normal
if ( ! empty( $section['fields'] ) && $view !== 'repeater' ) {
echo '<div class="csf-fields">';
foreach ( $section['fields'] as $field ) {
if ( in_array( $field['type'], $unallows ) ) { $field['_notice'] = true; }
// Extra tag improves for spesific fields (border, spacing, dimensions etc...)
$field['tag_prefix'] = ( ! empty( $field['tag_prefix'] ) ) ? $field['tag_prefix'] .'_' : '';
$field_default = ( isset( $field['id'] ) ) ? $this->get_default( $field ) : '';
CSF::field( $field, $field_default, $shortcode, 'shortcode' );
}
echo '</div>';
}
//
// View: group and repeater fields
$repeatable_fields = ( $view === 'repeater' && ! empty( $section['fields'] ) ) ? $section['fields'] : array();
$repeatable_fields = ( $view === 'group' && ! empty( $section['group_fields'] ) ) ? $section['group_fields'] : $repeatable_fields;
if ( ! empty( $repeatable_fields ) ) {
$button_title = ( ! empty( $section['button_title'] ) ) ? ' '. $section['button_title'] : esc_html__( 'Add New', 'csf' );
$inner_shortcode = ( ! empty( $section['group_shortcode'] ) ) ? $section['group_shortcode'] : $shortcode;
echo '<div class="csf--repeatable">';
echo '<div class="csf--repeat-shortcode">';
echo '<div class="csf-repeat-remove fas fa-times"></div>';
echo '<div class="csf-fields">';
foreach ( $repeatable_fields as $field ) {
if ( in_array( $field['type'], $unallows ) ) { $field['_notice'] = true; }
// Extra tag improves for spesific fields (border, spacing, dimensions etc...)
$field['tag_prefix'] = ( ! empty( $field['tag_prefix'] ) ) ? $field['tag_prefix'] .'_' : '';
$field_default = ( isset( $field['id'] ) ) ? $this->get_default( $field ) : '';
CSF::field( $field, $field_default, $inner_shortcode.'[0]', 'shortcode' );
}
echo '</div>';
echo '</div>';
echo '</div>';
echo '<div class="csf--repeat-button-block"><a class="button csf--repeat-button" href="#"><i class="fas fa-plus-circle"></i> '. $button_title .'</a></div>';
}
}
} else {
echo '<div class="csf-field csf-error-text">'. esc_html__( 'Error: Invalid nonce verification.', 'csf' ) .'</div>';
}
wp_send_json_success( array( 'content' => ob_get_clean() ) );
}
// Once editor setup for gutenberg and media buttons
public static function once_editor_setup() {
if ( function_exists( 'register_block_type' ) ) {
add_action( 'enqueue_block_editor_assets', array( 'CSF_Shortcoder', 'add_guteberg_blocks' ) );
}
if ( csf_wp_editor_api() ) {
add_action( 'media_buttons', array( 'CSF_Shortcoder', 'add_media_buttons' ) );
}
}
// Add gutenberg blocks.
public static function add_guteberg_blocks() {
wp_enqueue_script( 'csf-gutenberg-block', CSF::include_plugin_url( 'assets/js/gutenberg.js' ), array( 'wp-blocks', 'wp-editor', 'wp-element', 'wp-components' ) );
wp_localize_script( 'csf-gutenberg-block', 'csf_gutenberg_blocks', CSF::$shortcode_instances );
foreach ( CSF::$shortcode_instances as $value ) {
register_block_type( 'csf-gutenberg-block/block-'. $value['hash'], array(
'editor_script' => 'csf-gutenberg-block',
) );
}
}
// Add media buttons
public static function add_media_buttons( $editor_id ) {
foreach ( CSF::$shortcode_instances as $value ) {
echo '<a href="#" class="button button-primary csf-shortcode-button" data-editor-id="'. esc_attr( $editor_id ) .'" data-modal-id="'. esc_attr( $value['modal_id'] ) .'">'. $value['button_title'] .'</a>';
}
}
}
}

View File

@@ -0,0 +1,281 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Taxonomy Options Class
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Taxonomy_Options' ) ) {
class CSF_Taxonomy_Options extends CSF_Abstract{
// constans
public $unique = '';
public $taxonomy = '';
public $abstract = 'taxonomy';
public $pre_fields = array();
public $sections = array();
public $taxonomies = array();
public $args = array(
'taxonomy' => 'category',
'data_type' => 'serialize',
'class' => '',
'enqueue_webfont' => true,
'async_webfont' => false,
'output_css' => true,
'defaults' => array(),
);
// run taxonomy construct
public function __construct( $key, $params ) {
$this->unique = $key;
$this->args = apply_filters( "csf_{$this->unique}_args", wp_parse_args( $params['args'], $this->args ), $this );
$this->sections = apply_filters( "csf_{$this->unique}_sections", $params['sections'], $this );
$this->taxonomies = ( is_array( $this->args['taxonomy'] ) ) ? $this->args['taxonomy'] : array_filter( (array) $this->args['taxonomy'] );
$this->taxonomy = ( ! empty( $_REQUEST[ 'taxonomy' ] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST[ 'taxonomy' ] ) ) : '';
$this->pre_fields = $this->pre_fields( $this->sections );
if ( ! empty( $this->taxonomies ) && in_array( $this->taxonomy, $this->taxonomies ) ) {
add_action( 'admin_init', array( &$this, 'add_taxonomy_options' ) );
}
// wp enqeueu for typography and output css
parent::__construct();
}
// instance
public static function instance( $key, $params ) {
return new self( $key, $params );
}
public function pre_fields( $sections ) {
$result = array();
foreach ( $sections as $key => $section ) {
if ( ! empty( $section['fields'] ) ) {
foreach ( $section['fields'] as $field ) {
$result[] = $field;
}
}
}
return $result;
}
// add taxonomy add/edit fields
public function add_taxonomy_options() {
add_action( $this->taxonomy .'_add_form_fields', array( &$this, 'render_taxonomy_form_fields' ) );
add_action( $this->taxonomy .'_edit_form', array( &$this, 'render_taxonomy_form_fields' ) );
add_action( 'created_'. $this->taxonomy, array( &$this, 'save_taxonomy' ) );
add_action( 'edited_'. $this->taxonomy, array( &$this, 'save_taxonomy' ) );
}
// get default value
public function get_default( $field ) {
$default = ( isset( $field['default'] ) ) ? $field['default'] : '';
$default = ( isset( $this->args['defaults'][$field['id']] ) ) ? $this->args['defaults'][$field['id']] : $default;
return $default;
}
// get meta value
public function get_meta_value( $field, $term_id = null ) {
$value = null;
$term_id = ( ! isset( $term_id ) ) ? get_queried_object_id() : $term_id;
if ( ! empty( $term_id ) && ! empty( $field['id'] ) ) {
if ( $this->args['data_type'] !== 'serialize' ) {
$meta = get_term_meta( $term_id, $field['id'] );
$value = ( isset( $meta[0] ) ) ? $meta[0] : null;
} else {
$meta = get_term_meta( $term_id, $this->unique, true );
$value = ( isset( $meta[$field['id']] ) ) ? $meta[$field['id']] : null;
}
}
$default = ( isset( $field['id'] ) ) ? $this->get_default( $field ) : '';
$value = ( isset( $value ) ) ? $value : $default;
return $value;
}
// render taxonomy add/edit form fields
public function render_taxonomy_form_fields( $term ) {
$is_term = ( is_object( $term ) && isset( $term->taxonomy ) ) ? true : false;
$term_id = ( $is_term ) ? $term->term_id : 0;
$taxonomy = ( $is_term ) ? $term->taxonomy : $term;
$classname = ( $is_term ) ? 'edit' : 'add';
$errors = ( ! empty( $term_id ) ) ? get_term_meta( $term_id, '_csf_errors_'. $this->unique, true ) : array();
$errors = ( ! empty( $errors ) ) ? $errors : array();
$class = ( $this->args['class'] ) ? ' '. $this->args['class'] : '';
if ( ! empty( $errors ) ) {
delete_term_meta( $term_id, '_csf_errors_'. $this->unique );
}
wp_nonce_field( 'csf_taxonomy_nonce', 'csf_taxonomy_nonce'. $this->unique );
echo '<div class="csf csf-taxonomy csf-show-all csf-onload csf-taxonomy-'. esc_attr( $classname ) .'-fields '. esc_attr( $class ) .'">';
foreach ( $this->sections as $section ) {
if ( $taxonomy === $this->taxonomy ) {
$section_icon = ( ! empty( $section['icon'] ) ) ? '<i class="csf-section-icon '. esc_attr( $section['icon'] ) .'"></i>' : '';
$section_title = ( ! empty( $section['title'] ) ) ? $section['title'] : '';
echo ( $section_title || $section_icon ) ? '<div class="csf-section-title"><h3>'. $section_icon . $section_title .'</h3></div>' : '';
if ( ! empty( $section['fields'] ) ) {
foreach ( $section['fields'] as $field ) {
if ( ! empty( $field['id'] ) && ! empty( $errors['fields'][$field['id']] ) ) {
$field['_error'] = $errors['fields'][$field['id']];
}
if ( ! empty( $field['id'] ) ) {
$field['default'] = $this->get_default( $field );
}
CSF::field( $field, $this->get_meta_value( $field, $term_id ), $this->unique, 'taxonomy' );
}
}
}
}
echo '</div>';
}
// save taxonomy form fields
public function save_taxonomy( $term_id ) {
$count = 1;
$data = array();
$errors = array();
$noncekey = 'csf_taxonomy_nonce'. $this->unique;
$nonce = ( ! empty( $_POST[ $noncekey ] ) ) ? sanitize_text_field( wp_unslash( $_POST[ $noncekey ] ) ) : '';
$taxonomy = ( ! empty( $_POST[ 'taxonomy' ] ) ) ? sanitize_text_field( wp_unslash( $_POST[ 'taxonomy' ] ) ) : '';
if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ! wp_verify_nonce( $nonce, 'csf_taxonomy_nonce' ) ) {
return $term_id;
}
// XSS ok.
// No worries, This "POST" requests is sanitizing in the below foreach.
$request = ( ! empty( $_POST[ $this->unique ] ) ) ? $_POST[ $this->unique ] : array();
if ( ! empty( $request ) ) {
foreach ( $this->sections as $section ) {
if ( ! empty( $section['fields'] ) ) {
foreach ( $section['fields'] as $field ) {
if ( ! empty( $field['id'] ) ) {
$field_id = $field['id'];
$field_value = isset( $request[$field_id] ) ? $request[$field_id] : '';
// Sanitize "post" request of field.
if ( ! isset( $field['sanitize'] ) ) {
if( is_array( $field_value ) ) {
$data[$field_id] = wp_kses_post_deep( $field_value );
} else {
$data[$field_id] = wp_kses_post( $field_value );
}
} else if( isset( $field['sanitize'] ) && is_callable( $field['sanitize'] ) ) {
$data[$field_id] = call_user_func( $field['sanitize'], $field_value );
} else {
$data[$field_id] = $field_value;
}
// Validate "post" request of field.
if ( isset( $field['validate'] ) && is_callable( $field['validate'] ) ) {
$has_validated = call_user_func( $field['validate'], $field_value );
if ( ! empty( $has_validated ) ) {
$errors['sections'][$count] = true;
$errors['fields'][$field_id] = $has_validated;
$data[$field_id] = $this->get_meta_value( $field, $term_id );
}
}
}
}
}
$count++;
}
}
$data = apply_filters( "csf_{$this->unique}_save", $data, $term_id, $this );
do_action( "csf_{$this->unique}_save_before", $data, $term_id, $this );
if ( empty( $data ) ) {
if ( $this->args['data_type'] !== 'serialize' ) {
foreach ( $data as $key => $value ) {
delete_term_meta( $term_id, $key );
}
} else {
delete_term_meta( $term_id, $this->unique );
}
} else {
if ( $this->args['data_type'] !== 'serialize' ) {
foreach ( $data as $key => $value ) {
update_term_meta( $term_id, $key, $value );
}
} else {
update_term_meta( $term_id, $this->unique, $data );
}
if ( ! empty( $errors ) ) {
update_term_meta( $term_id, '_csf_errors_'. $this->unique, $errors );
}
}
do_action( "csf_{$this->unique}_saved", $data, $term_id, $this );
do_action( "csf_{$this->unique}_save_after", $data, $term_id, $this );
}
}
}

View File

@@ -0,0 +1,138 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Widgets Class
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Widget' ) ) {
class CSF_Widget extends WP_Widget {
// constans
public $unique = '';
public $args = array(
'title' => '',
'classname' => '',
'description' => '',
'width' => '',
'class' => '',
'fields' => array(),
'defaults' => array(),
);
public function __construct( $key, $params ) {
$widget_ops = array();
$control_ops = array();
$this->unique = $key;
$this->args = apply_filters( "csf_{$this->unique}_args", wp_parse_args( $params, $this->args ), $this );
// Set control options
if ( ! empty( $this->args['width'] ) ) {
$control_ops['width'] = esc_attr( $this->args['width'] );
}
// Set widget options
if ( ! empty( $this->args['description'] ) ) {
$widget_ops['description'] = esc_attr( $this->args['description'] );
}
if ( ! empty( $this->args['classname'] ) ) {
$widget_ops['classname'] = esc_attr( $this->args['classname'] );
}
// Set filters
$widget_ops = apply_filters( "csf_{$this->unique}_widget_ops", $widget_ops, $this );
$control_ops = apply_filters( "csf_{$this->unique}_control_ops", $control_ops, $this );
parent::__construct( $this->unique, esc_attr( $this->args['title'] ), $widget_ops, $control_ops );
}
// Register widget with WordPress
public static function instance( $key, $params = array() ) {
return new self( $key, $params );
}
// Front-end display of widget.
public function widget( $args, $instance ) {
call_user_func( $this->unique, $args, $instance );
}
// get default value
public function get_default( $field ) {
$default = ( isset( $field['default'] ) ) ? $field['default'] : '';
$default = ( isset( $this->args['defaults'][$field['id']] ) ) ? $this->args['defaults'][$field['id']] : $default;
return $default;
}
// get widget value
public function get_widget_value( $instance, $field ) {
$default = ( isset( $field['id'] ) ) ? $this->get_default( $field ) : '';
$value = ( isset( $field['id'] ) && isset( $instance[$field['id']] ) ) ? $instance[$field['id']] : $default;
return $value;
}
// Back-end widget form.
public function form( $instance ) {
if ( ! empty( $this->args['fields'] ) ) {
$class = ( $this->args['class'] ) ? ' '. $this->args['class'] : '';
echo '<div class="csf csf-widgets csf-fields'. esc_attr( $class ) .'">';
foreach ( $this->args['fields'] as $field ) {
$field_unique = '';
if ( ! empty( $field['id'] ) ) {
$field_unique = 'widget-' . $this->unique . '[' . $this->number . ']';
if ( $field['id'] === 'title' ) {
$field['attributes']['id'] = 'widget-'. $this->unique .'-'. $this->number .'-title';
}
$field['default'] = $this->get_default( $field );
}
CSF::field( $field, $this->get_widget_value( $instance, $field ), $field_unique );
}
echo '</div>';
}
}
// Sanitize widget form values as they are saved.
public function update( $new_instance, $old_instance ) {
// auto sanitize
foreach ( $this->args['fields'] as $field ) {
if ( ! empty( $field['id'] ) && ( ! isset( $new_instance[$field['id']] ) || is_null( $new_instance[$field['id']] ) ) ) {
$new_instance[$field['id']] = '';
}
}
$new_instance = apply_filters( "csf_{$this->unique}_save", $new_instance, $this->args, $this );
do_action( "csf_{$this->unique}_save_before", $new_instance, $this->args, $this );
return $new_instance;
}
}
}

View File

@@ -0,0 +1,20 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* @package Codestar Framework - WordPress Options Framework
* @author Codestar <info@codestarthemes.com>
* @link http://codestarframework.com
* @copyright 2015-2021 Codestar
*
*
* Plugin Name: Codestar Framework
* Plugin URI: http://codestarframework.com/
* Author: Codestar
* Author URI: http://codestarthemes.com/
* Version: 2.2.2
* Description: A Simple and Lightweight WordPress Option Framework for Themes and Plugins
* Text Domain: csf
* Domain Path: /languages
*
*/
require_once plugin_dir_path( __FILE__ ) .'classes/setup.class.php';

View File

@@ -0,0 +1,64 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: accordion
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_accordion' ) ) {
class CSF_Field_accordion extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$unallows = array( 'accordion' );
echo $this->field_before();
echo '<div class="csf-accordion-items" data-depend-id="'. esc_attr( $this->field['id'] ) .'">';
foreach ( $this->field['accordions'] as $key => $accordion ) {
echo '<div class="csf-accordion-item">';
$icon = ( ! empty( $accordion['icon'] ) ) ? 'csf--icon '. $accordion['icon'] : 'csf-accordion-icon fas fa-angle-right';
echo '<h4 class="csf-accordion-title">';
echo '<i class="'. esc_attr( $icon ) .'"></i>';
echo esc_html( $accordion['title'] );
echo '</h4>';
echo '<div class="csf-accordion-content">';
foreach ( $accordion['fields'] as $field ) {
if ( in_array( $field['type'], $unallows ) ) { $field['_notice'] = true; }
$field_id = ( isset( $field['id'] ) ) ? $field['id'] : '';
$field_default = ( isset( $field['default'] ) ) ? $field['default'] : '';
$field_value = ( isset( $this->value[$field_id] ) ) ? $this->value[$field_id] : $field_default;
$unique_id = ( ! empty( $this->unique ) ) ? $this->unique .'['. $this->field['id'] .']' : $this->field['id'];
CSF::field( $field, $field_value, $unique_id, 'field/accordion' );
}
echo '</div>';
echo '</div>';
}
echo '</div>';
echo $this->field_after();
}
}
}

View File

@@ -0,0 +1,340 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: background
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_background' ) ) {
class CSF_Field_background extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$args = wp_parse_args( $this->field, array(
'background_color' => true,
'background_image' => true,
'background_position' => true,
'background_repeat' => true,
'background_attachment' => true,
'background_size' => true,
'background_origin' => false,
'background_clip' => false,
'background_blend_mode' => false,
'background_gradient' => false,
'background_gradient_color' => true,
'background_gradient_direction' => true,
'background_image_preview' => true,
'background_auto_attributes' => false,
'compact' => false,
'background_image_library' => 'image',
'background_image_placeholder' => esc_html__( 'Not selected', 'csf' ),
) );
if ( $args['compact'] ) {
$args['background_color'] = false;
$args['background_auto_attributes'] = true;
}
$default_value = array(
'background-color' => '',
'background-image' => '',
'background-position' => '',
'background-repeat' => '',
'background-attachment' => '',
'background-size' => '',
'background-origin' => '',
'background-clip' => '',
'background-blend-mode' => '',
'background-gradient-color' => '',
'background-gradient-direction' => '',
);
$default_value = ( ! empty( $this->field['default'] ) ) ? wp_parse_args( $this->field['default'], $default_value ) : $default_value;
$this->value = wp_parse_args( $this->value, $default_value );
echo $this->field_before();
echo '<div class="csf--background-colors">';
//
// Background Color
if ( ! empty( $args['background_color'] ) ) {
echo '<div class="csf--color">';
echo ( ! empty( $args['background_gradient'] ) ) ? '<div class="csf--title">'. esc_html__( 'From', 'csf' ) .'</div>' : '';
CSF::field( array(
'id' => 'background-color',
'type' => 'color',
'default' => $default_value['background-color'],
), $this->value['background-color'], $this->field_name(), 'field/background' );
echo '</div>';
}
//
// Background Gradient Color
if ( ! empty( $args['background_gradient_color'] ) && ! empty( $args['background_gradient'] ) ) {
echo '<div class="csf--color">';
echo ( ! empty( $args['background_gradient'] ) ) ? '<div class="csf--title">'. esc_html__( 'To', 'csf' ) .'</div>' : '';
CSF::field( array(
'id' => 'background-gradient-color',
'type' => 'color',
'default' => $default_value['background-gradient-color'],
), $this->value['background-gradient-color'], $this->field_name(), 'field/background' );
echo '</div>';
}
//
// Background Gradient Direction
if ( ! empty( $args['background_gradient_direction'] ) && ! empty( $args['background_gradient'] ) ) {
echo '<div class="csf--color">';
echo ( ! empty( $args['background_gradient'] ) ) ? '<div class="csf---title">'. esc_html__( 'Direction', 'csf' ) .'</div>' : '';
CSF::field( array(
'id' => 'background-gradient-direction',
'type' => 'select',
'options' => array(
'' => esc_html__( 'Gradient Direction', 'csf' ),
'to bottom' => esc_html__( '&#8659; top to bottom', 'csf' ),
'to right' => esc_html__( '&#8658; left to right', 'csf' ),
'135deg' => esc_html__( '&#8664; corner top to right', 'csf' ),
'-135deg' => esc_html__( '&#8665; corner top to left', 'csf' ),
),
), $this->value['background-gradient-direction'], $this->field_name(), 'field/background' );
echo '</div>';
}
echo '</div>';
//
// Background Image
if ( ! empty( $args['background_image'] ) ) {
echo '<div class="csf--background-image">';
CSF::field( array(
'id' => 'background-image',
'type' => 'media',
'class' => 'csf-assign-field-background',
'library' => $args['background_image_library'],
'preview' => $args['background_image_preview'],
'placeholder' => $args['background_image_placeholder'],
'attributes' => array( 'data-depend-id' => $this->field['id'] ),
), $this->value['background-image'], $this->field_name(), 'field/background' );
echo '</div>';
}
$auto_class = ( ! empty( $args['background_auto_attributes'] ) ) ? ' csf--auto-attributes' : '';
$hidden_class = ( ! empty( $args['background_auto_attributes'] ) && empty( $this->value['background-image']['url'] ) ) ? ' csf--attributes-hidden' : '';
echo '<div class="csf--background-attributes'. esc_attr( $auto_class . $hidden_class ) .'">';
//
// Background Position
if ( ! empty( $args['background_position'] ) ) {
CSF::field( array(
'id' => 'background-position',
'type' => 'select',
'options' => array(
'' => esc_html__( 'Background Position', 'csf' ),
'left top' => esc_html__( 'Left Top', 'csf' ),
'left center' => esc_html__( 'Left Center', 'csf' ),
'left bottom' => esc_html__( 'Left Bottom', 'csf' ),
'center top' => esc_html__( 'Center Top', 'csf' ),
'center center' => esc_html__( 'Center Center', 'csf' ),
'center bottom' => esc_html__( 'Center Bottom', 'csf' ),
'right top' => esc_html__( 'Right Top', 'csf' ),
'right center' => esc_html__( 'Right Center', 'csf' ),
'right bottom' => esc_html__( 'Right Bottom', 'csf' ),
),
), $this->value['background-position'], $this->field_name(), 'field/background' );
}
//
// Background Repeat
if ( ! empty( $args['background_repeat'] ) ) {
CSF::field( array(
'id' => 'background-repeat',
'type' => 'select',
'options' => array(
'' => esc_html__( 'Background Repeat', 'csf' ),
'repeat' => esc_html__( 'Repeat', 'csf' ),
'no-repeat' => esc_html__( 'No Repeat', 'csf' ),
'repeat-x' => esc_html__( 'Repeat Horizontally', 'csf' ),
'repeat-y' => esc_html__( 'Repeat Vertically', 'csf' ),
),
), $this->value['background-repeat'], $this->field_name(), 'field/background' );
}
//
// Background Attachment
if ( ! empty( $args['background_attachment'] ) ) {
CSF::field( array(
'id' => 'background-attachment',
'type' => 'select',
'options' => array(
'' => esc_html__( 'Background Attachment', 'csf' ),
'scroll' => esc_html__( 'Scroll', 'csf' ),
'fixed' => esc_html__( 'Fixed', 'csf' ),
),
), $this->value['background-attachment'], $this->field_name(), 'field/background' );
}
//
// Background Size
if ( ! empty( $args['background_size'] ) ) {
CSF::field( array(
'id' => 'background-size',
'type' => 'select',
'options' => array(
'' => esc_html__( 'Background Size', 'csf' ),
'cover' => esc_html__( 'Cover', 'csf' ),
'contain' => esc_html__( 'Contain', 'csf' ),
'auto' => esc_html__( 'Auto', 'csf' ),
),
), $this->value['background-size'], $this->field_name(), 'field/background' );
}
//
// Background Origin
if ( ! empty( $args['background_origin'] ) ) {
CSF::field( array(
'id' => 'background-origin',
'type' => 'select',
'options' => array(
'' => esc_html__( 'Background Origin', 'csf' ),
'padding-box' => esc_html__( 'Padding Box', 'csf' ),
'border-box' => esc_html__( 'Border Box', 'csf' ),
'content-box' => esc_html__( 'Content Box', 'csf' ),
),
), $this->value['background-origin'], $this->field_name(), 'field/background' );
}
//
// Background Clip
if ( ! empty( $args['background_clip'] ) ) {
CSF::field( array(
'id' => 'background-clip',
'type' => 'select',
'options' => array(
'' => esc_html__( 'Background Clip', 'csf' ),
'border-box' => esc_html__( 'Border Box', 'csf' ),
'padding-box' => esc_html__( 'Padding Box', 'csf' ),
'content-box' => esc_html__( 'Content Box', 'csf' ),
),
), $this->value['background-clip'], $this->field_name(), 'field/background' );
}
//
// Background Blend Mode
if ( ! empty( $args['background_blend_mode'] ) ) {
CSF::field( array(
'id' => 'background-blend-mode',
'type' => 'select',
'options' => array(
'' => esc_html__( 'Background Blend Mode', 'csf' ),
'normal' => esc_html__( 'Normal', 'csf' ),
'multiply' => esc_html__( 'Multiply', 'csf' ),
'screen' => esc_html__( 'Screen', 'csf' ),
'overlay' => esc_html__( 'Overlay', 'csf' ),
'darken' => esc_html__( 'Darken', 'csf' ),
'lighten' => esc_html__( 'Lighten', 'csf' ),
'color-dodge' => esc_html__( 'Color Dodge', 'csf' ),
'saturation' => esc_html__( 'Saturation', 'csf' ),
'color' => esc_html__( 'Color', 'csf' ),
'luminosity' => esc_html__( 'Luminosity', 'csf' ),
),
), $this->value['background-blend-mode'], $this->field_name(), 'field/background' );
}
echo '</div>';
echo $this->field_after();
}
public function output() {
$output = '';
$bg_image = array();
$important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : '';
$element = ( is_array( $this->field['output'] ) ) ? join( ',', $this->field['output'] ) : $this->field['output'];
// Background image and gradient
$background_color = ( ! empty( $this->value['background-color'] ) ) ? $this->value['background-color'] : '';
$background_gd_color = ( ! empty( $this->value['background-gradient-color'] ) ) ? $this->value['background-gradient-color'] : '';
$background_gd_direction = ( ! empty( $this->value['background-gradient-direction'] ) ) ? $this->value['background-gradient-direction'] : '';
$background_image = ( ! empty( $this->value['background-image']['url'] ) ) ? $this->value['background-image']['url'] : '';
if ( $background_color && $background_gd_color ) {
$gd_direction = ( $background_gd_direction ) ? $background_gd_direction .',' : '';
$bg_image[] = 'linear-gradient('. $gd_direction . $background_color .','. $background_gd_color .')';
unset( $this->value['background-color'] );
}
if ( $background_image ) {
$bg_image[] = 'url('. $background_image .')';
}
if ( ! empty( $bg_image ) ) {
$output .= 'background-image:'. implode( ',', $bg_image ) . $important .';';
}
// Common background properties
$properties = array( 'color', 'position', 'repeat', 'attachment', 'size', 'origin', 'clip', 'blend-mode' );
foreach ( $properties as $property ) {
$property = 'background-'. $property;
if ( ! empty( $this->value[$property] ) ) {
$output .= $property .':'. $this->value[$property] . $important .';';
}
}
if ( $output ) {
$output = $element .'{'. $output .'}';
}
$this->parent->output_css .= $output;
return $output;
}
}
}

View File

@@ -0,0 +1,38 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: backup
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_backup' ) ) {
class CSF_Field_backup extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$unique = $this->unique;
$nonce = wp_create_nonce( 'csf_backup_nonce' );
$export = add_query_arg( array( 'action' => 'csf-export', 'unique' => $unique, 'nonce' => $nonce ), admin_url( 'admin-ajax.php' ) );
echo $this->field_before();
echo '<textarea name="csf_import_data" class="csf-import-data"></textarea>';
echo '<button type="submit" class="button button-primary csf-confirm csf-import" data-unique="'. esc_attr( $unique ) .'" data-nonce="'. esc_attr( $nonce ) .'">'. esc_html__( 'Import', 'csf' ) .'</button>';
echo '<hr />';
echo '<textarea readonly="readonly" class="csf-export-data">'. esc_attr( json_encode( get_option( $unique ) ) ) .'</textarea>';
echo '<a href="'. esc_url( $export ) .'" class="button button-primary csf-export" target="_blank">'. esc_html__( 'Export & Download', 'csf' ) .'</a>';
echo '<hr />';
echo '<button type="submit" name="csf_transient[reset]" value="reset" class="button csf-warning-primary csf-confirm csf-reset" data-unique="'. esc_attr( $unique ) .'" data-nonce="'. esc_attr( $nonce ) .'">'. esc_html__( 'Reset', 'csf' ) .'</button>';
echo $this->field_after();
}
}
}

View File

@@ -0,0 +1,176 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: border
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_border' ) ) {
class CSF_Field_border extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$args = wp_parse_args( $this->field, array(
'top_icon' => '<i class="fas fa-long-arrow-alt-up"></i>',
'left_icon' => '<i class="fas fa-long-arrow-alt-left"></i>',
'bottom_icon' => '<i class="fas fa-long-arrow-alt-down"></i>',
'right_icon' => '<i class="fas fa-long-arrow-alt-right"></i>',
'all_icon' => '<i class="fas fa-arrows-alt"></i>',
'top_placeholder' => esc_html__( 'top', 'csf' ),
'right_placeholder' => esc_html__( 'right', 'csf' ),
'bottom_placeholder' => esc_html__( 'bottom', 'csf' ),
'left_placeholder' => esc_html__( 'left', 'csf' ),
'all_placeholder' => esc_html__( 'all', 'csf' ),
'top' => true,
'left' => true,
'bottom' => true,
'right' => true,
'all' => false,
'color' => true,
'style' => true,
'unit' => 'px',
) );
$default_value = array(
'top' => '',
'right' => '',
'bottom' => '',
'left' => '',
'color' => '',
'style' => 'solid',
'all' => '',
);
$border_props = array(
'solid' => esc_html__( 'Solid', 'csf' ),
'dashed' => esc_html__( 'Dashed', 'csf' ),
'dotted' => esc_html__( 'Dotted', 'csf' ),
'double' => esc_html__( 'Double', 'csf' ),
'inset' => esc_html__( 'Inset', 'csf' ),
'outset' => esc_html__( 'Outset', 'csf' ),
'groove' => esc_html__( 'Groove', 'csf' ),
'ridge' => esc_html__( 'ridge', 'csf' ),
'none' => esc_html__( 'None', 'csf' )
);
$default_value = ( ! empty( $this->field['default'] ) ) ? wp_parse_args( $this->field['default'], $default_value ) : $default_value;
$value = wp_parse_args( $this->value, $default_value );
echo $this->field_before();
echo '<div class="csf--inputs" data-depend-id="'. esc_attr( $this->field['id'] ) .'">';
if ( ! empty( $args['all'] ) ) {
$placeholder = ( ! empty( $args['all_placeholder'] ) ) ? ' placeholder="'. esc_attr( $args['all_placeholder'] ) .'"' : '';
echo '<div class="csf--input">';
echo ( ! empty( $args['all_icon'] ) ) ? '<span class="csf--label csf--icon">'. $args['all_icon'] .'</span>' : '';
echo '<input type="number" name="'. esc_attr( $this->field_name( '[all]' ) ) .'" value="'. esc_attr( $value['all'] ) .'"'. $placeholder .' class="csf-input-number csf--is-unit" step="any" />';
echo ( ! empty( $args['unit'] ) ) ? '<span class="csf--label csf--unit">'. esc_attr( $args['unit'] ) .'</span>' : '';
echo '</div>';
} else {
$properties = array();
foreach ( array( 'top', 'right', 'bottom', 'left' ) as $prop ) {
if ( ! empty( $args[$prop] ) ) {
$properties[] = $prop;
}
}
$properties = ( $properties === array( 'right', 'left' ) ) ? array_reverse( $properties ) : $properties;
foreach ( $properties as $property ) {
$placeholder = ( ! empty( $args[$property.'_placeholder'] ) ) ? ' placeholder="'. esc_attr( $args[$property.'_placeholder'] ) .'"' : '';
echo '<div class="csf--input">';
echo ( ! empty( $args[$property.'_icon'] ) ) ? '<span class="csf--label csf--icon">'. $args[$property.'_icon'] .'</span>' : '';
echo '<input type="number" name="'. esc_attr( $this->field_name( '['. $property .']' ) ) .'" value="'. esc_attr( $value[$property] ) .'"'. $placeholder .' class="csf-input-number csf--is-unit" step="any" />';
echo ( ! empty( $args['unit'] ) ) ? '<span class="csf--label csf--unit">'. esc_attr( $args['unit'] ) .'</span>' : '';
echo '</div>';
}
}
if ( ! empty( $args['style'] ) ) {
echo '<div class="csf--input">';
echo '<select name="'. esc_attr( $this->field_name( '[style]' ) ) .'">';
foreach ( $border_props as $border_prop_key => $border_prop_value ) {
$selected = ( $value['style'] === $border_prop_key ) ? ' selected' : '';
echo '<option value="'. esc_attr( $border_prop_key ) .'"'. esc_attr( $selected ) .'>'. esc_attr( $border_prop_value ) .'</option>';
}
echo '</select>';
echo '</div>';
}
echo '</div>';
if ( ! empty( $args['color'] ) ) {
$default_color_attr = ( ! empty( $default_value['color'] ) ) ? ' data-default-color="'. esc_attr( $default_value['color'] ) .'"' : '';
echo '<div class="csf--color">';
echo '<div class="csf-field-color">';
echo '<input type="text" name="'. esc_attr( $this->field_name( '[color]' ) ) .'" value="'. esc_attr( $value['color'] ) .'" class="csf-color"'. $default_color_attr .' />';
echo '</div>';
echo '</div>';
}
echo $this->field_after();
}
public function output() {
$output = '';
$unit = ( ! empty( $this->value['unit'] ) ) ? $this->value['unit'] : 'px';
$important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : '';
$element = ( is_array( $this->field['output'] ) ) ? join( ',', $this->field['output'] ) : $this->field['output'];
// properties
$top = ( isset( $this->value['top'] ) && $this->value['top'] !== '' ) ? $this->value['top'] : '';
$right = ( isset( $this->value['right'] ) && $this->value['right'] !== '' ) ? $this->value['right'] : '';
$bottom = ( isset( $this->value['bottom'] ) && $this->value['bottom'] !== '' ) ? $this->value['bottom'] : '';
$left = ( isset( $this->value['left'] ) && $this->value['left'] !== '' ) ? $this->value['left'] : '';
$style = ( isset( $this->value['style'] ) && $this->value['style'] !== '' ) ? $this->value['style'] : '';
$color = ( isset( $this->value['color'] ) && $this->value['color'] !== '' ) ? $this->value['color'] : '';
$all = ( isset( $this->value['all'] ) && $this->value['all'] !== '' ) ? $this->value['all'] : '';
if ( ! empty( $this->field['all'] ) && ( $all !== '' || $color !== '' ) ) {
$output = $element .'{';
$output .= ( $all !== '' ) ? 'border-width:'. $all . $unit . $important .';' : '';
$output .= ( $color !== '' ) ? 'border-color:'. $color . $important .';' : '';
$output .= ( $style !== '' ) ? 'border-style:'. $style . $important .';' : '';
$output .= '}';
} else if ( $top !== '' || $right !== '' || $bottom !== '' || $left !== '' || $color !== '' ) {
$output = $element .'{';
$output .= ( $top !== '' ) ? 'border-top-width:'. $top . $unit . $important .';' : '';
$output .= ( $right !== '' ) ? 'border-right-width:'. $right . $unit . $important .';' : '';
$output .= ( $bottom !== '' ) ? 'border-bottom-width:'. $bottom . $unit . $important .';' : '';
$output .= ( $left !== '' ) ? 'border-left-width:'. $left . $unit . $important .';' : '';
$output .= ( $color !== '' ) ? 'border-color:'. $color . $important .';' : '';
$output .= ( $style !== '' ) ? 'border-style:'. $style . $important .';' : '';
$output .= '}';
}
$this->parent->output_css .= $output;
return $output;
}
}
}

View File

@@ -0,0 +1,67 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: button_set
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_button_set' ) ) {
class CSF_Field_button_set extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$args = wp_parse_args( $this->field, array(
'multiple' => false,
'options' => array(),
'query_args' => array(),
) );
$value = ( is_array( $this->value ) ) ? $this->value : array_filter( (array) $this->value );
echo $this->field_before();
if ( isset( $this->field['options'] ) ) {
$options = $this->field['options'];
$options = ( is_array( $options ) ) ? $options : array_filter( $this->field_data( $options, false, $args['query_args'] ) );
if ( is_array( $options ) && ! empty( $options ) ) {
echo '<div class="csf-siblings csf--button-group" data-multiple="'. esc_attr( $args['multiple'] ) .'">';
foreach ( $options as $key => $option ) {
$type = ( $args['multiple'] ) ? 'checkbox' : 'radio';
$extra = ( $args['multiple'] ) ? '[]' : '';
$active = ( in_array( $key, $value ) || ( empty( $value ) && empty( $key ) ) ) ? ' csf--active' : '';
$checked = ( in_array( $key, $value ) || ( empty( $value ) && empty( $key ) ) ) ? ' checked' : '';
echo '<div class="csf--sibling csf--button'. esc_attr( $active ) .'">';
echo '<input type="'. esc_attr( $type ) .'" name="'. esc_attr( $this->field_name( $extra ) ) .'" value="'. esc_attr( $key ) .'"'. $this->field_attributes() . esc_attr( $checked ) .'/>';
echo $option;
echo '</div>';
}
echo '</div>';
} else {
echo ( ! empty( $this->field['empty_message'] ) ) ? esc_attr( $this->field['empty_message'] ) : esc_html__( 'No data available.', 'csf' );
}
}
echo $this->field_after();
}
}
}

View File

@@ -0,0 +1,31 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: callback
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_callback' ) ) {
class CSF_Field_callback extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
if ( isset( $this->field['function'] ) && is_callable( $this->field['function'] ) ) {
$args = ( isset( $this->field['args'] ) ) ? $this->field['args'] : null;
call_user_func( $this->field['function'], $args );
}
}
}
}

View File

@@ -0,0 +1,95 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: checkbox
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_checkbox' ) ) {
class CSF_Field_checkbox extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$args = wp_parse_args( $this->field, array(
'inline' => false,
'query_args' => array(),
) );
$inline_class = ( $args['inline'] ) ? ' class="csf--inline-list"' : '';
echo $this->field_before();
if ( isset( $this->field['options'] ) ) {
$value = ( is_array( $this->value ) ) ? $this->value : array_filter( (array) $this->value );
$options = $this->field['options'];
$options = ( is_array( $options ) ) ? $options : array_filter( $this->field_data( $options, false, $args['query_args'] ) );
if ( is_array( $options ) && ! empty( $options ) ) {
echo '<ul'. $inline_class .'>';
foreach ( $options as $option_key => $option_value ) {
if ( is_array( $option_value ) && ! empty( $option_value ) ) {
echo '<li>';
echo '<ul>';
echo '<li><strong>'. esc_attr( $option_key ) .'</strong></li>';
foreach ( $option_value as $sub_key => $sub_value ) {
$checked = ( in_array( $sub_key, $value ) ) ? ' checked' : '';
echo '<li>';
echo '<label>';
echo '<input type="checkbox" name="'. esc_attr( $this->field_name( '[]' ) ) .'" value="'. esc_attr( $sub_key ) .'"'. $this->field_attributes() . esc_attr( $checked ) .'/>';
echo '<span class="csf--text">'. esc_attr( $sub_value ) .'</span>';
echo '</label>';
echo '</li>';
}
echo '</ul>';
echo '</li>';
} else {
$checked = ( in_array( $option_key, $value ) ) ? ' checked' : '';
echo '<li>';
echo '<label>';
echo '<input type="checkbox" name="'. esc_attr( $this->field_name( '[]' ) ) .'" value="'. esc_attr( $option_key ) .'"'. $this->field_attributes() . esc_attr( $checked ) .'/>';
echo '<span class="csf--text">'. esc_attr( $option_value ) .'</span>';
echo '</label>';
echo '</li>';
}
}
echo '</ul>';
} else {
echo ( ! empty( $this->field['empty_message'] ) ) ? esc_attr( $this->field['empty_message'] ) : esc_html__( 'No data available.', 'csf' );
}
} else {
echo '<label class="csf-checkbox">';
echo '<input type="hidden" name="'. esc_attr( $this->field_name() ) .'" value="'. $this->value .'" class="csf--input"'. $this->field_attributes() .'/>';
echo '<input type="checkbox" name="_pseudo" class="csf--checkbox"'. esc_attr( checked( $this->value, 1, false ) ) .'/>';
echo ( ! empty( $this->field['label'] ) ) ? '<span class="csf--text">'. esc_attr( $this->field['label'] ) .'</span>' : '';
echo '</label>';
}
echo $this->field_after();
}
}
}

View File

@@ -0,0 +1,58 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: code_editor
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_code_editor' ) ) {
class CSF_Field_code_editor extends CSF_Fields {
public $version = '5.60.0';
public $cdn_url = 'https://cdn.jsdelivr.net/npm/codemirror@';
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$default_settings = array(
'tabSize' => 2,
'lineNumbers' => true,
'theme' => 'default',
'mode' => 'htmlmixed',
'cdnURL' => $this->cdn_url . $this->version,
);
$settings = ( ! empty( $this->field['settings'] ) ) ? $this->field['settings'] : array();
$settings = wp_parse_args( $settings, $default_settings );
echo $this->field_before();
echo '<textarea name="'. esc_attr( $this->field_name() ) .'"'. $this->field_attributes() .' data-editor="'. esc_attr( json_encode( $settings ) ) .'">'. $this->value .'</textarea>';
echo $this->field_after();
}
public function enqueue() {
$page = ( ! empty( $_GET[ 'page' ] ) ) ? sanitize_text_field( wp_unslash( $_GET[ 'page' ] ) ) : '';
// Do not loads CodeMirror in revslider page.
if ( in_array( $page, array( 'revslider' ) ) ) { return; }
if ( ! wp_script_is( 'csf-codemirror' ) ) {
wp_enqueue_script( 'csf-codemirror', esc_url( $this->cdn_url . $this->version .'/lib/codemirror.min.js' ), array( 'csf' ), $this->version, true );
wp_enqueue_script( 'csf-codemirror-loadmode', esc_url( $this->cdn_url . $this->version .'/addon/mode/loadmode.min.js' ), array( 'csf-codemirror' ), $this->version, true );
}
if ( ! wp_style_is( 'csf-codemirror' ) ) {
wp_enqueue_style( 'csf-codemirror', esc_url( $this->cdn_url . $this->version .'/lib/codemirror.min.css' ), array(), $this->version );
}
}
}
}

View File

@@ -0,0 +1,52 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: color
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_color' ) ) {
class CSF_Field_color extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$default_attr = ( ! empty( $this->field['default'] ) ) ? ' data-default-color="'. esc_attr( $this->field['default'] ) .'"' : '';
echo $this->field_before();
echo '<input type="text" name="'. esc_attr( $this->field_name() ) .'" value="'. esc_attr( $this->value ) .'" class="csf-color"'. $default_attr . $this->field_attributes() .'/>';
echo $this->field_after();
}
public function output() {
$output = '';
$elements = ( is_array( $this->field['output'] ) ) ? $this->field['output'] : array_filter( (array) $this->field['output'] );
$important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : '';
$mode = ( ! empty( $this->field['output_mode'] ) ) ? $this->field['output_mode'] : 'color';
if ( ! empty( $elements ) && isset( $this->value ) && $this->value !== '' ) {
foreach ( $elements as $key_property => $element ) {
if ( is_numeric( $key_property ) ) {
$output = implode( ',', $elements ) .'{'. $mode .':'. $this->value . $important .';}';
break;
} else {
$output .= $element .'{'. $key_property .':'. $this->value . $important .'}';
}
}
}
$this->parent->output_css .= $output;
return $output;
}
}
}

View File

@@ -0,0 +1,42 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: color_group
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_color_group' ) ) {
class CSF_Field_color_group extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$options = ( ! empty( $this->field['options'] ) ) ? $this->field['options'] : array();
echo $this->field_before();
if ( ! empty( $options ) ) {
foreach ( $options as $key => $option ) {
$color_value = ( ! empty( $this->value[$key] ) ) ? $this->value[$key] : '';
$default_attr = ( ! empty( $this->field['default'][$key] ) ) ? ' data-default-color="'. esc_attr( $this->field['default'][$key] ) .'"' : '';
echo '<div class="csf--left csf-field-color">';
echo '<div class="csf--title">'. $option .'</div>';
echo '<input type="text" name="'. esc_attr( $this->field_name( '['. $key .']' ) ) .'" value="'. esc_attr( $color_value ) .'" class="csf-color"'. $default_attr . $this->field_attributes() .'/>';
echo '</div>';
}
}
echo $this->field_after();
}
}
}

View File

@@ -0,0 +1,28 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: content
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_content' ) ) {
class CSF_Field_content extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
if ( ! empty( $this->field['content'] ) ) {
echo $this->field['content'];
}
}
}
}

View File

@@ -0,0 +1,64 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: date
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_date' ) ) {
class CSF_Field_date extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$default_settings = array(
'dateFormat' => 'mm/dd/yy',
);
$settings = ( ! empty( $this->field['settings'] ) ) ? $this->field['settings'] : array();
$settings = wp_parse_args( $settings, $default_settings );
echo $this->field_before();
if ( ! empty( $this->field['from_to'] ) ) {
$args = wp_parse_args( $this->field, array(
'text_from' => esc_html__( 'From', 'csf' ),
'text_to' => esc_html__( 'To', 'csf' ),
) );
$value = wp_parse_args( $this->value, array(
'from' => '',
'to' => '',
) );
echo '<label class="csf--from">'. esc_attr( $args['text_from'] ) .' <input type="text" name="'. esc_attr( $this->field_name( '[from]' ) ) .'" value="'. esc_attr( $value['from'] ) .'"'. $this->field_attributes() .'/></label>';
echo '<label class="csf--to">'. esc_attr( $args['text_to'] ) .' <input type="text" name="'. esc_attr( $this->field_name( '[to]' ) ) .'" value="'. esc_attr( $value['to'] ) .'"'. $this->field_attributes() .'/></label>';
} else {
echo '<input type="text" name="'. esc_attr( $this->field_name() ) .'" value="'. esc_attr( $this->value ) .'"'. $this->field_attributes() .'/>';
}
echo '<div class="csf-date-settings" data-settings="'. esc_attr( json_encode( $settings ) ) .'"></div>';
echo $this->field_after();
}
public function enqueue() {
if ( ! wp_script_is( 'jquery-ui-datepicker' ) ) {
wp_enqueue_script( 'jquery-ui-datepicker' );
}
}
}
}

View File

@@ -0,0 +1,101 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: dimensions
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_dimensions' ) ) {
class CSF_Field_dimensions extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$args = wp_parse_args( $this->field, array(
'width_icon' => '<i class="fas fa-arrows-alt-h"></i>',
'height_icon' => '<i class="fas fa-arrows-alt-v"></i>',
'width_placeholder' => esc_html__( 'width', 'csf' ),
'height_placeholder' => esc_html__( 'height', 'csf' ),
'width' => true,
'height' => true,
'unit' => true,
'show_units' => true,
'units' => array( 'px', '%', 'em' )
) );
$default_values = array(
'width' => '',
'height' => '',
'unit' => 'px',
);
$value = wp_parse_args( $this->value, $default_values );
$unit = ( count( $args['units'] ) === 1 && ! empty( $args['unit'] ) ) ? $args['units'][0] : '';
$is_unit = ( ! empty( $unit ) ) ? ' csf--is-unit' : '';
echo $this->field_before();
echo '<div class="csf--inputs" data-depend-id="'. esc_attr( $this->field['id'] ) .'">';
if ( ! empty( $args['width'] ) ) {
$placeholder = ( ! empty( $args['width_placeholder'] ) ) ? ' placeholder="'. esc_attr( $args['width_placeholder'] ) .'"' : '';
echo '<div class="csf--input">';
echo ( ! empty( $args['width_icon'] ) ) ? '<span class="csf--label csf--icon">'. $args['width_icon'] .'</span>' : '';
echo '<input type="number" name="'. esc_attr( $this->field_name( '[width]' ) ) .'" value="'. esc_attr( $value['width'] ) .'"'. $placeholder .' class="csf-input-number'. esc_attr( $is_unit ) .'" step="any" />';
echo ( ! empty( $unit ) ) ? '<span class="csf--label csf--unit">'. esc_attr( $args['units'][0] ) .'</span>' : '';
echo '</div>';
}
if ( ! empty( $args['height'] ) ) {
$placeholder = ( ! empty( $args['height_placeholder'] ) ) ? ' placeholder="'. esc_attr( $args['height_placeholder'] ) .'"' : '';
echo '<div class="csf--input">';
echo ( ! empty( $args['height_icon'] ) ) ? '<span class="csf--label csf--icon">'. $args['height_icon'] .'</span>' : '';
echo '<input type="number" name="'. esc_attr( $this->field_name( '[height]' ) ) .'" value="'. esc_attr( $value['height'] ) .'"'. $placeholder .' class="csf-input-number'. esc_attr( $is_unit ) .'" step="any" />';
echo ( ! empty( $unit ) ) ? '<span class="csf--label csf--unit">'. esc_attr( $args['units'][0] ) .'</span>' : '';
echo '</div>';
}
if ( ! empty( $args['unit'] ) && ! empty( $args['show_units'] ) && count( $args['units'] ) > 1 ) {
echo '<div class="csf--input">';
echo '<select name="'. esc_attr( $this->field_name( '[unit]' ) ) .'">';
foreach ( $args['units'] as $unit ) {
$selected = ( $value['unit'] === $unit ) ? ' selected' : '';
echo '<option value="'. esc_attr( $unit ) .'"'. esc_attr( $selected ) .'>'. esc_attr( $unit ) .'</option>';
}
echo '</select>';
echo '</div>';
}
echo '</div>';
echo $this->field_after();
}
public function output() {
$output = '';
$element = ( is_array( $this->field['output'] ) ) ? join( ',', $this->field['output'] ) : $this->field['output'];
$prefix = ( ! empty( $this->field['output_prefix'] ) ) ? $this->field['output_prefix'] .'-' : '';
$important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : '';
$unit = ( ! empty( $this->value['unit'] ) ) ? $this->value['unit'] : 'px';
$width = ( isset( $this->value['width'] ) && $this->value['width'] !== '' ) ? $prefix .'width:'. $this->value['width'] . $unit . $important .';' : '';
$height = ( isset( $this->value['height'] ) && $this->value['height'] !== '' ) ? $prefix .'height:'. $this->value['height'] . $unit . $important .';' : '';
if ( $width !== '' || $height !== '' ) {
$output = $element .'{'. $width . $height .'}';
}
$this->parent->output_css .= $output;
return $output;
}
}
}

View File

@@ -0,0 +1,41 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: fieldset
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_fieldset' ) ) {
class CSF_Field_fieldset extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
echo $this->field_before();
echo '<div class="csf-fieldset-content" data-depend-id="'. esc_attr( $this->field['id'] ) .'">';
foreach ( $this->field['fields'] as $field ) {
$field_id = ( isset( $field['id'] ) ) ? $field['id'] : '';
$field_default = ( isset( $field['default'] ) ) ? $field['default'] : '';
$field_value = ( isset( $this->value[$field_id] ) ) ? $this->value[$field_id] : $field_default;
$unique_id = ( ! empty( $this->unique ) ) ? $this->unique .'['. $this->field['id'] .']' : $this->field['id'];
CSF::field( $field, $field_value, $unique_id, 'field/fieldset' );
}
echo '</div>';
echo $this->field_after();
}
}
}

View File

@@ -0,0 +1,52 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: gallery
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_gallery' ) ) {
class CSF_Field_gallery extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$args = wp_parse_args( $this->field, array(
'add_title' => esc_html__( 'Add Gallery', 'csf' ),
'edit_title' => esc_html__( 'Edit Gallery', 'csf' ),
'clear_title' => esc_html__( 'Clear', 'csf' ),
) );
$hidden = ( empty( $this->value ) ) ? ' hidden' : '';
echo $this->field_before();
echo '<ul>';
if ( ! empty( $this->value ) ) {
$values = explode( ',', $this->value );
foreach ( $values as $id ) {
$attachment = wp_get_attachment_image_src( $id, 'thumbnail' );
echo '<li><img src="'. esc_url( $attachment[0] ) .'" /></li>';
}
}
echo '</ul>';
echo '<a href="#" class="button button-primary csf-button">'. $args['add_title'] .'</a>';
echo '<a href="#" class="button csf-edit-gallery'. esc_attr( $hidden ) .'">'. $args['edit_title'] .'</a>';
echo '<a href="#" class="button csf-warning-primary csf-clear-gallery'. esc_attr( $hidden ) .'">'. $args['clear_title'] .'</a>';
echo '<input type="text" name="'. esc_attr( $this->field_name() ) .'" value="'. esc_attr( $this->value ) .'"'. $this->field_attributes() .'/>';
echo $this->field_after();
}
}
}

View File

@@ -0,0 +1,144 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: group
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_group' ) ) {
class CSF_Field_group extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$args = wp_parse_args( $this->field, array(
'max' => 0,
'min' => 0,
'fields' => array(),
'button_title' => esc_html__( 'Add New', 'csf' ),
'accordion_title_prefix' => '',
'accordion_title_number' => false,
'accordion_title_auto' => true,
) );
$title_prefix = ( ! empty( $args['accordion_title_prefix'] ) ) ? $args['accordion_title_prefix'] : '';
$title_number = ( ! empty( $args['accordion_title_number'] ) ) ? true : false;
$title_auto = ( ! empty( $args['accordion_title_auto'] ) ) ? true : false;
if ( preg_match( '/'. preg_quote( '['. $this->field['id'] .']' ) .'/', $this->unique ) ) {
echo '<div class="csf-notice csf-notice-danger">'. esc_html__( 'Error: Field ID conflict.', 'csf' ) .'</div>';
} else {
echo $this->field_before();
echo '<div class="csf-cloneable-item csf-cloneable-hidden" data-depend-id="'. esc_attr( $this->field['id'] ) .'">';
echo '<div class="csf-cloneable-helper">';
echo '<i class="csf-cloneable-sort fas fa-arrows-alt"></i>';
echo '<i class="csf-cloneable-clone far fa-clone"></i>';
echo '<i class="csf-cloneable-remove csf-confirm fas fa-times" data-confirm="'. esc_html__( 'Are you sure to delete this item?', 'csf' ) .'"></i>';
echo '</div>';
echo '<h4 class="csf-cloneable-title">';
echo '<span class="csf-cloneable-text">';
echo ( $title_number ) ? '<span class="csf-cloneable-title-number"></span>' : '';
echo ( $title_prefix ) ? '<span class="csf-cloneable-title-prefix">'. esc_attr( $title_prefix ) .'</span>' : '';
echo ( $title_auto ) ? '<span class="csf-cloneable-value"><span class="csf-cloneable-placeholder"></span></span>' : '';
echo '</span>';
echo '</h4>';
echo '<div class="csf-cloneable-content">';
foreach ( $this->field['fields'] as $field ) {
$field_default = ( isset( $field['default'] ) ) ? $field['default'] : '';
$field_unique = ( ! empty( $this->unique ) ) ? $this->unique .'['. $this->field['id'] .'][0]' : $this->field['id'] .'[0]';
CSF::field( $field, $field_default, '___'. $field_unique, 'field/group' );
}
echo '</div>';
echo '</div>';
echo '<div class="csf-cloneable-wrapper csf-data-wrapper" data-title-number="'. esc_attr( $title_number ) .'" data-field-id="['. esc_attr( $this->field['id'] ) .']" data-max="'. esc_attr( $args['max'] ) .'" data-min="'. esc_attr( $args['min'] ) .'">';
if ( ! empty( $this->value ) ) {
$num = 0;
foreach ( $this->value as $value ) {
$first_id = ( isset( $this->field['fields'][0]['id'] ) ) ? $this->field['fields'][0]['id'] : '';
$first_value = ( isset( $value[$first_id] ) ) ? $value[$first_id] : '';
$first_value = ( is_array( $first_value ) ) ? reset( $first_value ) : $first_value;
echo '<div class="csf-cloneable-item">';
echo '<div class="csf-cloneable-helper">';
echo '<i class="csf-cloneable-sort fas fa-arrows-alt"></i>';
echo '<i class="csf-cloneable-clone far fa-clone"></i>';
echo '<i class="csf-cloneable-remove csf-confirm fas fa-times" data-confirm="'. esc_html__( 'Are you sure to delete this item?', 'csf' ) .'"></i>';
echo '</div>';
echo '<h4 class="csf-cloneable-title">';
echo '<span class="csf-cloneable-text">';
echo ( $title_number ) ? '<span class="csf-cloneable-title-number">'. esc_attr( $num+1 ) .'.</span>' : '';
echo ( $title_prefix ) ? '<span class="csf-cloneable-title-prefix">'. esc_attr( $title_prefix ) .'</span>' : '';
echo ( $title_auto ) ? '<span class="csf-cloneable-value">' . esc_attr( $first_value ) .'</span>' : '';
echo '</span>';
echo '</h4>';
echo '<div class="csf-cloneable-content">';
foreach ( $this->field['fields'] as $field ) {
$field_unique = ( ! empty( $this->unique ) ) ? $this->unique .'['. $this->field['id'] .']['. $num .']' : $this->field['id'] .'['. $num .']';
$field_value = ( isset( $field['id'] ) && isset( $value[$field['id']] ) ) ? $value[$field['id']] : '';
CSF::field( $field, $field_value, $field_unique, 'field/group' );
}
echo '</div>';
echo '</div>';
$num++;
}
}
echo '</div>';
echo '<div class="csf-cloneable-alert csf-cloneable-max">'. esc_html__( 'You cannot add more.', 'csf' ) .'</div>';
echo '<div class="csf-cloneable-alert csf-cloneable-min">'. esc_html__( 'You cannot remove more.', 'csf' ) .'</div>';
echo '<a href="#" class="button button-primary csf-cloneable-add">'. $args['button_title'] .'</a>';
echo $this->field_after();
}
}
public function enqueue() {
if ( ! wp_script_is( 'jquery-ui-accordion' ) ) {
wp_enqueue_script( 'jquery-ui-accordion' );
}
if ( ! wp_script_is( 'jquery-ui-sortable' ) ) {
wp_enqueue_script( 'jquery-ui-sortable' );
}
}
}
}

View File

@@ -0,0 +1,24 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: heading
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_heading' ) ) {
class CSF_Field_heading extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
echo ( ! empty( $this->field['content'] ) ) ? $this->field['content'] : '';
}
}
}

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,71 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: icon
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_icon' ) ) {
class CSF_Field_icon extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$args = wp_parse_args( $this->field, array(
'button_title' => esc_html__( 'Add Icon', 'csf' ),
'remove_title' => esc_html__( 'Remove Icon', 'csf' ),
) );
echo $this->field_before();
$nonce = wp_create_nonce( 'csf_icon_nonce' );
$hidden = ( empty( $this->value ) ) ? ' hidden' : '';
echo '<div class="csf-icon-select">';
echo '<span class="csf-icon-preview'. esc_attr( $hidden ) .'"><i class="'. esc_attr( $this->value ) .'"></i></span>';
echo '<a href="#" class="button button-primary csf-icon-add" data-nonce="'. esc_attr( $nonce ) .'">'. $args['button_title'] .'</a>';
echo '<a href="#" class="button csf-warning-primary csf-icon-remove'. esc_attr( $hidden ) .'">'. $args['remove_title'] .'</a>';
echo '<input type="text" name="'. esc_attr( $this->field_name() ) .'" value="'. esc_attr( $this->value ) .'" class="csf-icon-value"'. $this->field_attributes() .' />';
echo '</div>';
echo $this->field_after();
}
public function enqueue() {
add_action( 'admin_footer', array( &$this, 'add_footer_modal_icon' ) );
add_action( 'customize_controls_print_footer_scripts', array( &$this, 'add_footer_modal_icon' ) );
}
public function add_footer_modal_icon() {
?>
<div id="csf-modal-icon" class="csf-modal csf-modal-icon hidden">
<div class="csf-modal-table">
<div class="csf-modal-table-cell">
<div class="csf-modal-overlay"></div>
<div class="csf-modal-inner">
<div class="csf-modal-title">
<?php esc_html_e( 'Add Icon', 'csf' ); ?>
<div class="csf-modal-close csf-icon-close"></div>
</div>
<div class="csf-modal-header">
<input type="text" placeholder="<?php esc_html_e( 'Search...', 'csf' ); ?>" class="csf-icon-search" />
</div>
<div class="csf-modal-content">
<div class="csf-modal-loading"><div class="csf-loading"></div></div>
<div class="csf-modal-load"></div>
</div>
</div>
</div>
</div>
</div>
<?php
}
}
}

View File

@@ -0,0 +1,79 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: image_select
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_image_select' ) ) {
class CSF_Field_image_select extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$args = wp_parse_args( $this->field, array(
'multiple' => false,
'inline' => false,
'options' => array(),
) );
$inline = ( $args['inline'] ) ? ' csf--inline-list' : '';
$value = ( is_array( $this->value ) ) ? $this->value : array_filter( (array) $this->value );
echo $this->field_before();
if ( ! empty( $args['options'] ) ) {
echo '<div class="csf-siblings csf--image-group'. esc_attr( $inline ) .'" data-multiple="'. esc_attr( $args['multiple'] ) .'">';
$num = 1;
foreach ( $args['options'] as $key => $option ) {
$type = ( $args['multiple'] ) ? 'checkbox' : 'radio';
$extra = ( $args['multiple'] ) ? '[]' : '';
$active = ( in_array( $key, $value ) ) ? ' csf--active' : '';
$checked = ( in_array( $key, $value ) ) ? ' checked' : '';
echo '<div class="csf--sibling csf--image'. esc_attr( $active ) .'">';
echo '<figure>';
echo '<img src="'. esc_url( $option ) .'" alt="img-'. esc_attr( $num++ ) .'" />';
echo '<input type="'. esc_attr( $type ) .'" name="'. esc_attr( $this->field_name( $extra ) ) .'" value="'. esc_attr( $key ) .'"'. $this->field_attributes() . esc_attr( $checked ) .'/>';
echo '</figure>';
echo '</div>';
}
echo '</div>';
}
echo $this->field_after();
}
public function output() {
$output = '';
$bg_image = array();
$important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : '';
$elements = ( is_array( $this->field['output'] ) ) ? join( ',', $this->field['output'] ) : $this->field['output'];
if ( ! empty( $elements ) && isset( $this->value ) && $this->value !== '' ) {
$output = $elements .'{background-image:url('. $this->value .')'. $important .';}';
}
$this->parent->output_css .= $output;
return $output;
}
}
}

View File

@@ -0,0 +1 @@
<?php // Silence is golden.

View File

@@ -0,0 +1,82 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: link
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_link' ) ) {
class CSF_Field_link extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$args = wp_parse_args( $this->field, array(
'add_title' => esc_html__( 'Add Link', 'csf' ),
'edit_title' => esc_html__( 'Edit Link', 'csf' ),
'remove_title' => esc_html__( 'Remove Link', 'csf' ),
) );
$default_values = array(
'url' => '',
'text' => '',
'target' => '',
);
$value = wp_parse_args( $this->value, $default_values );
$hidden = ( ! empty( $value['url'] ) || ! empty( $value['url'] ) || ! empty( $value['url'] ) ) ? ' hidden' : '';
$maybe_hidden = ( empty( $hidden ) ) ? ' hidden' : '';
echo $this->field_before();
echo '<textarea readonly="readonly" class="csf--link hidden"></textarea>';
echo '<div class="'. esc_attr( $maybe_hidden ) .'"><div class="csf--result">'. sprintf( '{url:"%s", text:"%s", target:"%s"}', $value['url'], $value['text'], $value['target'] ) .'</div></div>';
echo '<input type="text" name="'. esc_attr( $this->field_name( '[url]' ) ) .'" value="'. esc_attr( $value['url'] ) .'"'. $this->field_attributes( array( 'class' => 'csf--url hidden' ) ) .' />';
echo '<input type="text" name="'. esc_attr( $this->field_name( '[text]' ) ) .'" value="'. esc_attr( $value['text'] ) .'" class="csf--text hidden" />';
echo '<input type="text" name="'. esc_attr( $this->field_name( '[target]' ) ) .'" value="'. esc_attr( $value['target'] ) .'" class="csf--target hidden" />';
echo '<a href="#" class="button button-primary csf--add'. esc_attr( $hidden ) .'">'. $args['add_title'] .'</a> ';
echo '<a href="#" class="button csf--edit'. esc_attr( $maybe_hidden ) .'">'. $args['edit_title'] .'</a> ';
echo '<a href="#" class="button csf-warning-primary csf--remove'. esc_attr( $maybe_hidden ) .'">'. $args['remove_title'] .'</a>';
echo $this->field_after();
}
public function enqueue() {
if ( ! wp_script_is( 'wplink' ) ) {
wp_enqueue_script( 'wplink' );
}
if ( ! wp_script_is( 'jquery-ui-autocomplete' ) ) {
wp_enqueue_script( 'jquery-ui-autocomplete' );
}
add_action( 'admin_print_footer_scripts', array( &$this, 'add_wp_link_dialog' ) );
}
public function add_wp_link_dialog() {
if ( ! class_exists( '_WP_Editors' ) ) {
require_once ABSPATH . WPINC .'/class-wp-editor.php';
}
wp_print_styles( 'editor-buttons' );
_WP_Editors::wp_link_dialog();
}
}
}

View File

@@ -0,0 +1,91 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: link_color
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_link_color' ) ) {
class CSF_Field_link_color extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$args = wp_parse_args( $this->field, array(
'color' => true,
'hover' => true,
'active' => false,
'visited' => false,
'focus' => false,
) );
$default_values = array(
'color' => '',
'hover' => '',
'active' => '',
'visited' => '',
'focus' => '',
);
$color_props = array(
'color' => esc_html__( 'Normal', 'csf' ),
'hover' => esc_html__( 'Hover', 'csf' ),
'active' => esc_html__( 'Active', 'csf' ),
'visited' => esc_html__( 'Visited', 'csf' ),
'focus' => esc_html__( 'Focus', 'csf' )
);
$value = wp_parse_args( $this->value, $default_values );
echo $this->field_before();
foreach ( $color_props as $color_prop_key => $color_prop_value ) {
if ( ! empty( $args[$color_prop_key] ) ) {
$default_attr = ( ! empty( $this->field['default'][$color_prop_key] ) ) ? ' data-default-color="'. esc_attr( $this->field['default'][$color_prop_key] ) .'"' : '';
echo '<div class="csf--left csf-field-color">';
echo '<div class="csf--title">'. esc_attr( $color_prop_value ) .'</div>';
echo '<input type="text" name="'. esc_attr( $this->field_name( '['. $color_prop_key .']' ) ) .'" value="'. esc_attr( $value[$color_prop_key] ) .'" class="csf-color"'. $default_attr . $this->field_attributes() .'/>';
echo '</div>';
}
}
echo $this->field_after();
}
public function output() {
$output = '';
$elements = ( is_array( $this->field['output'] ) ) ? $this->field['output'] : array_filter( (array) $this->field['output'] );
$important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : '';
if ( ! empty( $elements ) && isset( $this->value ) && $this->value !== '' ) {
foreach ( $elements as $element ) {
if ( isset( $this->value['color'] ) && $this->value['color'] !== '' ) { $output .= $element .'{color:'. $this->value['color'] . $important .';}'; }
if ( isset( $this->value['hover'] ) && $this->value['hover'] !== '' ) { $output .= $element .':hover{color:'. $this->value['hover'] . $important .';}'; }
if ( isset( $this->value['active'] ) && $this->value['active'] !== '' ) { $output .= $element .':active{color:'. $this->value['active'] . $important .';}'; }
if ( isset( $this->value['visited'] ) && $this->value['visited'] !== '' ) { $output .= $element .':visited{color:'. $this->value['visited'] . $important .';}'; }
if ( isset( $this->value['focus'] ) && $this->value['focus'] !== '' ) { $output .= $element .':focus{color:'. $this->value['focus'] . $important .';}'; }
}
}
$this->parent->output_css .= $output;
return $output;
}
}
}

View File

@@ -0,0 +1,98 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: map
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_map' ) ) {
class CSF_Field_map extends CSF_Fields {
public $version = '1.7.1';
public $cdn_url = 'https://cdn.jsdelivr.net/npm/leaflet@';
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$args = wp_parse_args( $this->field, array(
'placeholder' => esc_html__( 'Search...', 'csf' ),
'latitude_text' => esc_html__( 'Latitude', 'csf' ),
'longitude_text' => esc_html__( 'Longitude', 'csf' ),
'address_field' => '',
'height' => '',
) );
$value = wp_parse_args( $this->value, array(
'address' => '',
'latitude' => '20',
'longitude' => '0',
'zoom' => '2',
) );
$default_settings = array(
'center' => array( $value['latitude'], $value['longitude'] ),
'zoom' => $value['zoom'],
'scrollWheelZoom' => false,
);
$settings = ( ! empty( $this->field['settings'] ) ) ? $this->field['settings'] : array();
$settings = wp_parse_args( $settings, $default_settings );
$style_attr = ( ! empty( $args['height'] ) ) ? ' style="min-height:'. esc_attr( $args['height'] ) .';"' : '';
$placeholder = ( ! empty( $args['placeholder'] ) ) ? array( 'placeholder' => $args['placeholder'] ) : '';
echo $this->field_before();
if ( empty( $args['address_field'] ) ) {
echo '<div class="csf--map-search">';
echo '<input type="text" name="'. esc_attr( $this->field_name( '[address]' ) ) .'" value="'. esc_attr( $value['address'] ) .'"'. $this->field_attributes( $placeholder ) .' />';
echo '</div>';
} else {
echo '<div class="csf--address-field" data-address-field="'. esc_attr( $args['address_field'] ) .'"></div>';
}
echo '<div class="csf--map-osm-wrap"><div class="csf--map-osm" data-map="'. esc_attr( json_encode( $settings ) ) .'"'. $style_attr .'></div></div>';
echo '<div class="csf--map-inputs">';
echo '<div class="csf--map-input">';
echo '<label>'. esc_attr( $args['latitude_text'] ) .'</label>';
echo '<input type="text" name="'. esc_attr( $this->field_name( '[latitude]' ) ) .'" value="'. esc_attr( $value['latitude'] ) .'" class="csf--latitude" />';
echo '</div>';
echo '<div class="csf--map-input">';
echo '<label>'. esc_attr( $args['longitude_text'] ) .'</label>';
echo '<input type="text" name="'. esc_attr( $this->field_name( '[longitude]' ) ) .'" value="'. esc_attr( $value['longitude'] ) .'" class="csf--longitude" />';
echo '</div>';
echo '</div>';
echo '<input type="hidden" name="'. esc_attr( $this->field_name( '[zoom]' ) ) .'" value="'. esc_attr( $value['zoom'] ) .'" class="csf--zoom" />';
echo $this->field_after();
}
public function enqueue() {
if ( ! wp_script_is( 'csf-leaflet' ) ) {
wp_enqueue_script( 'csf-leaflet', esc_url( $this->cdn_url . $this->version .'/dist/leaflet.js' ), array( 'csf' ), $this->version, true );
}
if ( ! wp_style_is( 'csf-leaflet' ) ) {
wp_enqueue_style( 'csf-leaflet', esc_url( $this->cdn_url . $this->version .'/dist/leaflet.css' ), array(), $this->version );
}
if ( ! wp_script_is( 'jquery-ui-autocomplete' ) ) {
wp_enqueue_script( 'jquery-ui-autocomplete' );
}
}
}
}

View File

@@ -0,0 +1,86 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: media
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_media' ) ) {
class CSF_Field_media extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$args = wp_parse_args( $this->field, array(
'url' => true,
'preview' => true,
'library' => array(),
'button_title' => esc_html__( 'Upload', 'csf' ),
'remove_title' => esc_html__( 'Remove', 'csf' ),
'preview_size' => 'thumbnail',
) );
$default_values = array(
'url' => '',
'id' => '',
'width' => '',
'height' => '',
'thumbnail' => '',
'alt' => '',
'title' => '',
'description' => ''
);
// fallback
if ( is_numeric( $this->value ) ) {
$this->value = array(
'id' => $this->value,
'url' => wp_get_attachment_url( $this->value ),
'thumbnail' => wp_get_attachment_image_src( $this->value, 'thumbnail', true )[0],
);
}
$this->value = wp_parse_args( $this->value, $default_values );
$library = ( is_array( $args['library'] ) ) ? $args['library'] : array_filter( (array) $args['library'] );
$library = ( ! empty( $library ) ) ? implode(',', $library ) : '';
$preview_src = ( $args['preview_size'] !== 'thumbnail' ) ? $this->value['url'] : $this->value['thumbnail'];
$hidden_url = ( empty( $args['url'] ) ) ? ' hidden' : '';
$hidden_auto = ( empty( $this->value['url'] ) ) ? ' hidden' : '';
$placeholder = ( empty( $this->field['placeholder'] ) ) ? ' placeholder="'. esc_html__( 'Not selected', 'csf' ) .'"' : '';
echo $this->field_before();
if ( ! empty( $args['preview'] ) ) {
echo '<div class="csf--preview'. esc_attr( $hidden_auto ) .'">';
echo '<div class="csf-image-preview"><a href="#" class="csf--remove fas fa-times"></a><img src="'. esc_url( $preview_src ) .'" class="csf--src" /></div>';
echo '</div>';
}
echo '<div class="csf--placeholder">';
echo '<input type="text" name="'. esc_attr( $this->field_name( '[url]' ) ) .'" value="'. esc_attr( $this->value['url'] ) .'" class="csf--url'. esc_attr( $hidden_url ) .'" readonly="readonly"'. $this->field_attributes() . $placeholder .' />';
echo '<a href="#" class="button button-primary csf--button" data-library="'. esc_attr( $library ) .'" data-preview-size="'. esc_attr( $args['preview_size'] ) .'">'. $args['button_title'] .'</a>';
echo ( empty( $args['preview'] ) ) ? '<a href="#" class="button button-secondary csf-warning-primary csf--remove'. esc_attr( $hidden_auto ) .'">'. $args['remove_title'] .'</a>' : '';
echo '</div>';
echo '<input type="hidden" name="'. esc_attr( $this->field_name( '[id]' ) ) .'" value="'. esc_attr( $this->value['id'] ) .'" class="csf--id"/>';
echo '<input type="hidden" name="'. esc_attr( $this->field_name( '[width]' ) ) .'" value="'. esc_attr( $this->value['width'] ) .'" class="csf--width"/>';
echo '<input type="hidden" name="'. esc_attr( $this->field_name( '[height]' ) ) .'" value="'. esc_attr( $this->value['height'] ) .'" class="csf--height"/>';
echo '<input type="hidden" name="'. esc_attr( $this->field_name( '[thumbnail]' ) ) .'" value="'. esc_attr( $this->value['thumbnail'] ) .'" class="csf--thumbnail"/>';
echo '<input type="hidden" name="'. esc_attr( $this->field_name( '[alt]' ) ) .'" value="'. esc_attr( $this->value['alt'] ) .'" class="csf--alt"/>';
echo '<input type="hidden" name="'. esc_attr( $this->field_name( '[title]' ) ) .'" value="'. esc_attr( $this->value['title'] ) .'" class="csf--title"/>';
echo '<input type="hidden" name="'. esc_attr( $this->field_name( '[description]' ) ) .'" value="'. esc_attr( $this->value['description'] ) .'" class="csf--description"/>';
echo $this->field_after();
}
}
}

View File

@@ -0,0 +1,26 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: notice
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_notice' ) ) {
class CSF_Field_notice extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$style = ( ! empty( $this->field['style'] ) ) ? $this->field['style'] : 'normal';
echo ( ! empty( $this->field['content'] ) ) ? '<div class="csf-notice csf-notice-'. esc_attr( $style ) .'">'. $this->field['content'] .'</div>' : '';
}
}
}

View File

@@ -0,0 +1,60 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: number
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_number' ) ) {
class CSF_Field_number extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$args = wp_parse_args( $this->field, array(
'unit' => '',
) );
echo $this->field_before();
echo '<div class="csf--wrap">';
echo '<input type="number" name="'. esc_attr( $this->field_name() ) .'" value="'. esc_attr( $this->value ) .'"'. $this->field_attributes( array( 'class' => 'csf-input-number' ) ) .' step="any" />';
echo ( ! empty( $args['unit'] ) ) ? '<span class="csf--unit">'. esc_attr( $args['unit'] ) .'</span>' : '';
echo '</div>';
echo $this->field_after();
}
public function output() {
$output = '';
$elements = ( is_array( $this->field['output'] ) ) ? $this->field['output'] : array_filter( (array) $this->field['output'] );
$important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : '';
$mode = ( ! empty( $this->field['output_mode'] ) ) ? $this->field['output_mode'] : 'width';
$unit = ( ! empty( $this->field['unit'] ) ) ? $this->field['unit'] : 'px';
if ( ! empty( $elements ) && isset( $this->value ) && $this->value !== '' ) {
foreach ( $elements as $key_property => $element ) {
if ( is_numeric( $key_property ) ) {
if ( $mode ) {
$output = implode( ',', $elements ) .'{'. $mode .':'. $this->value . $unit . $important .';}';
}
break;
} else {
$output .= $element .'{'. $key_property .':'. $this->value . $unit . $important .'}';
}
}
}
$this->parent->output_css .= $output;
return $output;
}
}
}

View File

@@ -0,0 +1,58 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: palette
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_palette' ) ) {
class CSF_Field_palette extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$palette = ( ! empty( $this->field['options'] ) ) ? $this->field['options'] : array();
echo $this->field_before();
if ( ! empty( $palette ) ) {
echo '<div class="csf-siblings csf--palettes">';
foreach ( $palette as $key => $colors ) {
$active = ( $key === $this->value ) ? ' csf--active' : '';
$checked = ( $key === $this->value ) ? ' checked' : '';
echo '<div class="csf--sibling csf--palette'. esc_attr( $active ) .'">';
if ( ! empty( $colors ) ) {
foreach ( $colors as $color ) {
echo '<span style="background-color: '. esc_attr( $color ) .';"></span>';
}
}
echo '<input type="radio" name="'. esc_attr( $this->field_name() ) .'" value="'. esc_attr( $key ) .'"'. $this->field_attributes() . esc_attr( $checked ) .'/>';
echo '</div>';
}
echo '</div>';
}
echo $this->field_after();
}
}
}

View File

@@ -0,0 +1,93 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: radio
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_radio' ) ) {
class CSF_Field_radio extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$args = wp_parse_args( $this->field, array(
'inline' => false,
'query_args' => array(),
) );
$inline_class = ( $args['inline'] ) ? ' class="csf--inline-list"' : '';
echo $this->field_before();
if ( isset( $this->field['options'] ) ) {
$options = $this->field['options'];
$options = ( is_array( $options ) ) ? $options : array_filter( $this->field_data( $options, false, $args['query_args'] ) );
if ( is_array( $options ) && ! empty( $options ) ) {
echo '<ul'. $inline_class .'>';
foreach ( $options as $option_key => $option_value ) {
if ( is_array( $option_value ) && ! empty( $option_value ) ) {
echo '<li>';
echo '<ul>';
echo '<li><strong>'. esc_attr( $option_key ) .'</strong></li>';
foreach ( $option_value as $sub_key => $sub_value ) {
$checked = ( $sub_key == $this->value ) ? ' checked' : '';
echo '<li>';
echo '<label>';
echo '<input type="radio" name="'. esc_attr( $this->field_name() ) .'" value="'. esc_attr( $sub_key ) .'"'. $this->field_attributes() . esc_attr( $checked ) .'/>';
echo '<span class="csf--text">'. esc_attr( $sub_value ) .'</span>';
echo '</label>';
echo '</li>';
}
echo '</ul>';
echo '</li>';
} else {
$checked = ( $option_key == $this->value ) ? ' checked' : '';
echo '<li>';
echo '<label>';
echo '<input type="radio" name="'. esc_attr( $this->field_name() ) .'" value="'. esc_attr( $option_key ) .'"'. $this->field_attributes() . esc_attr( $checked ) .'/>';
echo '<span class="csf--text">'. esc_attr( $option_value ) .'</span>';
echo '</label>';
echo '</li>';
}
}
echo '</ul>';
} else {
echo ( ! empty( $this->field['empty_message'] ) ) ? esc_attr( $this->field['empty_message'] ) : esc_html__( 'No data available.', 'csf' );
}
} else {
$label = ( isset( $this->field['label'] ) ) ? $this->field['label'] : '';
echo '<label><input type="radio" name="'. esc_attr( $this->field_name() ) .'" value="1"'. $this->field_attributes() . esc_attr( checked( $this->value, 1, false ) ) .'/>';
echo ( ! empty( $this->field['label'] ) ) ? '<span class="csf--text">'. esc_attr( $this->field['label'] ) .'</span>' : '';
echo '</label>';
}
echo $this->field_after();
}
}
}

View File

@@ -0,0 +1,108 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: repeater
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_repeater' ) ) {
class CSF_Field_repeater extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$args = wp_parse_args( $this->field, array(
'max' => 0,
'min' => 0,
'button_title' => '<i class="fas fa-plus-circle"></i>',
) );
if ( preg_match( '/'. preg_quote( '['. $this->field['id'] .']' ) .'/', $this->unique ) ) {
echo '<div class="csf-notice csf-notice-danger">'. esc_html__( 'Error: Field ID conflict.', 'csf' ) .'</div>';
} else {
echo $this->field_before();
echo '<div class="csf-repeater-item csf-repeater-hidden" data-depend-id="'. esc_attr( $this->field['id'] ) .'">';
echo '<div class="csf-repeater-content">';
foreach ( $this->field['fields'] as $field ) {
$field_default = ( isset( $field['default'] ) ) ? $field['default'] : '';
$field_unique = ( ! empty( $this->unique ) ) ? $this->unique .'['. $this->field['id'] .'][0]' : $this->field['id'] .'[0]';
CSF::field( $field, $field_default, '___'. $field_unique, 'field/repeater' );
}
echo '</div>';
echo '<div class="csf-repeater-helper">';
echo '<div class="csf-repeater-helper-inner">';
echo '<i class="csf-repeater-sort fas fa-arrows-alt"></i>';
echo '<i class="csf-repeater-clone far fa-clone"></i>';
echo '<i class="csf-repeater-remove csf-confirm fas fa-times" data-confirm="'. esc_html__( 'Are you sure to delete this item?', 'csf' ) .'"></i>';
echo '</div>';
echo '</div>';
echo '</div>';
echo '<div class="csf-repeater-wrapper csf-data-wrapper" data-field-id="['. esc_attr( $this->field['id'] ) .']" data-max="'. esc_attr( $args['max'] ) .'" data-min="'. esc_attr( $args['min'] ) .'">';
if ( ! empty( $this->value ) && is_array( $this->value ) ) {
$num = 0;
foreach ( $this->value as $key => $value ) {
echo '<div class="csf-repeater-item">';
echo '<div class="csf-repeater-content">';
foreach ( $this->field['fields'] as $field ) {
$field_unique = ( ! empty( $this->unique ) ) ? $this->unique .'['. $this->field['id'] .']['. $num .']' : $this->field['id'] .'['. $num .']';
$field_value = ( isset( $field['id'] ) && isset( $this->value[$key][$field['id']] ) ) ? $this->value[$key][$field['id']] : '';
CSF::field( $field, $field_value, $field_unique, 'field/repeater' );
}
echo '</div>';
echo '<div class="csf-repeater-helper">';
echo '<div class="csf-repeater-helper-inner">';
echo '<i class="csf-repeater-sort fas fa-arrows-alt"></i>';
echo '<i class="csf-repeater-clone far fa-clone"></i>';
echo '<i class="csf-repeater-remove csf-confirm fas fa-times" data-confirm="'. esc_html__( 'Are you sure to delete this item?', 'csf' ) .'"></i>';
echo '</div>';
echo '</div>';
echo '</div>';
$num++;
}
}
echo '</div>';
echo '<div class="csf-repeater-alert csf-repeater-max">'. esc_html__( 'You cannot add more.', 'csf' ) .'</div>';
echo '<div class="csf-repeater-alert csf-repeater-min">'. esc_html__( 'You cannot remove more.', 'csf' ) .'</div>';
echo '<a href="#" class="button button-primary csf-repeater-add">'. $args['button_title'] .'</a>';
echo $this->field_after();
}
}
public function enqueue() {
if ( ! wp_script_is( 'jquery-ui-sortable' ) ) {
wp_enqueue_script( 'jquery-ui-sortable' );
}
}
}
}

View File

@@ -0,0 +1,132 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: select
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_select' ) ) {
class CSF_Field_select extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$args = wp_parse_args( $this->field, array(
'placeholder' => '',
'chosen' => false,
'multiple' => false,
'sortable' => false,
'ajax' => false,
'settings' => array(),
'query_args' => array(),
) );
$this->value = ( is_array( $this->value ) ) ? $this->value : array_filter( (array) $this->value );
echo $this->field_before();
if ( isset( $this->field['options'] ) ) {
if ( ! empty( $args['ajax'] ) ) {
$args['settings']['data']['type'] = $args['options'];
$args['settings']['data']['nonce'] = wp_create_nonce( 'csf_chosen_ajax_nonce' );
if ( ! empty( $args['query_args'] ) ) {
$args['settings']['data']['query_args'] = $args['query_args'];
}
}
$chosen_rtl = ( is_rtl() ) ? ' chosen-rtl' : '';
$multiple_name = ( $args['multiple'] ) ? '[]' : '';
$multiple_attr = ( $args['multiple'] ) ? ' multiple="multiple"' : '';
$chosen_sortable = ( $args['chosen'] && $args['sortable'] ) ? ' csf-chosen-sortable' : '';
$chosen_ajax = ( $args['chosen'] && $args['ajax'] ) ? ' csf-chosen-ajax' : '';
$placeholder_attr = ( $args['chosen'] && $args['placeholder'] ) ? ' data-placeholder="'. esc_attr( $args['placeholder'] ) .'"' : '';
$field_class = ( $args['chosen'] ) ? ' class="csf-chosen'. esc_attr( $chosen_rtl . $chosen_sortable . $chosen_ajax ) .'"' : '';
$field_name = $this->field_name( $multiple_name );
$field_attr = $this->field_attributes();
$maybe_options = $this->field['options'];
$chosen_data_attr = ( $args['chosen'] && ! empty( $args['settings'] ) ) ? ' data-chosen-settings="'. esc_attr( json_encode( $args['settings'] ) ) .'"' : '';
if ( is_string( $maybe_options ) && ! empty( $args['chosen'] ) && ! empty( $args['ajax'] ) ) {
$options = $this->field_wp_query_data_title( $maybe_options, $this->value );
} else if ( is_string( $maybe_options ) ) {
$options = $this->field_data( $maybe_options, false, $args['query_args'] );
} else {
$options = $maybe_options;
}
if ( ( is_array( $options ) && ! empty( $options ) ) || ( ! empty( $args['chosen'] ) && ! empty( $args['ajax'] ) ) ) {
if ( ! empty( $args['chosen'] ) && ! empty( $args['multiple'] ) ) {
echo '<select name="'. $field_name .'" class="csf-hide-select hidden"'. $multiple_attr . $field_attr .'>';
foreach ( $this->value as $option_key ) {
echo '<option value="'. esc_attr( $option_key ) .'" selected>'. esc_attr( $option_key ) .'</option>';
}
echo '</select>';
$field_name = '_pseudo';
$field_attr = '';
}
// These attributes has been serialized above.
echo '<select name="'. esc_attr( $field_name ) .'"'. $field_class . $multiple_attr . $placeholder_attr . $field_attr . $chosen_data_attr .'>';
if ( $args['placeholder'] && empty( $args['multiple'] ) ) {
if ( ! empty( $args['chosen'] ) ) {
echo '<option value=""></option>';
} else {
echo '<option value="">'. esc_attr( $args['placeholder'] ) .'</option>';
}
}
foreach ( $options as $option_key => $option ) {
if ( is_array( $option ) && ! empty( $option ) ) {
echo '<optgroup label="'. esc_attr( $option_key ) .'">';
foreach ( $option as $sub_key => $sub_value ) {
$selected = ( in_array( $sub_key, $this->value ) ) ? ' selected' : '';
echo '<option value="'. esc_attr( $sub_key ) .'" '. esc_attr( $selected ) .'>'. esc_attr( $sub_value ) .'</option>';
}
echo '</optgroup>';
} else {
$selected = ( in_array( $option_key, $this->value ) ) ? ' selected' : '';
echo '<option value="'. esc_attr( $option_key ) .'" '. esc_attr( $selected ) .'>'. esc_attr( $option ) .'</option>';
}
}
echo '</select>';
} else {
echo ( ! empty( $this->field['empty_message'] ) ) ? esc_attr( $this->field['empty_message'] ) : esc_html__( 'No data available.', 'csf' );
}
}
echo $this->field_after();
}
public function enqueue() {
if ( ! wp_script_is( 'jquery-ui-sortable' ) ) {
wp_enqueue_script( 'jquery-ui-sortable' );
}
}
}
}

View File

@@ -0,0 +1,78 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: slider
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_slider' ) ) {
class CSF_Field_slider extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$args = wp_parse_args( $this->field, array(
'max' => 100,
'min' => 0,
'step' => 1,
'unit' => '',
) );
$is_unit = ( ! empty( $args['unit'] ) ) ? ' csf--is-unit' : '';
echo $this->field_before();
echo '<div class="csf--wrap">';
echo '<div class="csf-slider-ui"></div>';
echo '<div class="csf--input">';
echo '<input type="number" name="'. esc_attr( $this->field_name() ) .'" value="'. esc_attr( $this->value ) .'"'. $this->field_attributes( array( 'class' => 'csf-input-number'. esc_attr( $is_unit ) ) ) .' data-min="'. esc_attr( $args['min'] ) .'" data-max="'. esc_attr( $args['max'] ) .'" data-step="'. esc_attr( $args['step'] ) .'" step="any" />';
echo ( ! empty( $args['unit'] ) ) ? '<span class="csf--unit">'. esc_attr( $args['unit'] ) .'</span>' : '';
echo '</div>';
echo '</div>';
echo $this->field_after();
}
public function enqueue() {
if ( ! wp_script_is( 'jquery-ui-slider' ) ) {
wp_enqueue_script( 'jquery-ui-slider' );
}
}
public function output() {
$output = '';
$elements = ( is_array( $this->field['output'] ) ) ? $this->field['output'] : array_filter( (array) $this->field['output'] );
$important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : '';
$mode = ( ! empty( $this->field['output_mode'] ) ) ? $this->field['output_mode'] : 'width';
$unit = ( ! empty( $this->field['unit'] ) ) ? $this->field['unit'] : 'px';
if ( ! empty( $elements ) && isset( $this->value ) && $this->value !== '' ) {
foreach ( $elements as $key_property => $element ) {
if ( is_numeric( $key_property ) ) {
if ( $mode ) {
$output = implode( ',', $elements ) .'{'. $mode .':'. $this->value . $unit . $important .';}';
}
break;
} else {
$output .= $element .'{'. $key_property .':'. $this->value . $unit . $important .'}';
}
}
}
$this->parent->output_css .= $output;
return $output;
}
}
}

View File

@@ -0,0 +1,87 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: sortable
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_sortable' ) ) {
class CSF_Field_sortable extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
echo $this->field_before();
echo '<div class="csf-sortable" data-depend-id="'. esc_attr( $this->field['id'] ) .'">';
$pre_sortby = array();
$pre_fields = array();
// Add array-keys to defined fields for sort by
foreach ( $this->field['fields'] as $key => $field ) {
$pre_fields[$field['id']] = $field;
}
// Set sort by by saved-value or default-value
if ( ! empty( $this->value ) ) {
foreach ( $this->value as $key => $value ) {
$pre_sortby[$key] = $pre_fields[$key];
}
$diff = array_diff_key( $pre_fields, $this->value );
if( ! empty( $diff ) ) {
$pre_sortby = array_merge( $pre_sortby, $diff );
}
} else {
foreach ( $pre_fields as $key => $value ) {
$pre_sortby[$key] = $value;
}
}
foreach ( $pre_sortby as $key => $field ) {
echo '<div class="csf-sortable-item">';
echo '<div class="csf-sortable-content">';
$field_default = ( isset( $this->field['default'][$key] ) ) ? $this->field['default'][$key] : '';
$field_value = ( isset( $this->value[$key] ) ) ? $this->value[$key] : $field_default;
$unique_id = ( ! empty( $this->unique ) ) ? $this->unique .'['. $this->field['id'] .']' : $this->field['id'];
CSF::field( $field, $field_value, $unique_id, 'field/sortable' );
echo '</div>';
echo '<div class="csf-sortable-helper"><i class="fas fa-arrows-alt"></i></div>';
echo '</div>';
}
echo '</div>';
echo $this->field_after();
}
public function enqueue() {
if ( ! wp_script_is( 'jquery-ui-sortable' ) ) {
wp_enqueue_script( 'jquery-ui-sortable' );
}
}
}
}

View File

@@ -0,0 +1,76 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: sorter
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_sorter' ) ) {
class CSF_Field_sorter extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$args = wp_parse_args( $this->field, array(
'disabled' => true,
'enabled_title' => esc_html__( 'Enabled', 'csf' ),
'disabled_title' => esc_html__( 'Disabled', 'csf' ),
) );
echo $this->field_before();
$this->value = ( ! empty( $this->value ) ) ? $this->value : $this->field['default'];
$enabled_options = ( ! empty( $this->value['enabled'] ) ) ? $this->value['enabled'] : array();
$disabled_options = ( ! empty( $this->value['disabled'] ) ) ? $this->value['disabled'] : array();
echo '<div class="csf-sorter" data-depend-id="'. esc_attr( $this->field['id'] ) .'"></div>';
echo ( $args['disabled'] ) ? '<div class="csf-modules">' : '';
echo ( ! empty( $args['enabled_title'] ) ) ? '<div class="csf-sorter-title">'. esc_attr( $args['enabled_title'] ) .'</div>' : '';
echo '<ul class="csf-enabled">';
if ( ! empty( $enabled_options ) ) {
foreach ( $enabled_options as $key => $value ) {
echo '<li><input type="hidden" name="'. esc_attr( $this->field_name( '[enabled]['. $key .']' ) ) .'" value="'. esc_attr( $value ) .'"/><label>'. esc_attr( $value ) .'</label></li>';
}
}
echo '</ul>';
// Check for hide/show disabled section
if ( $args['disabled'] ) {
echo '</div>';
echo '<div class="csf-modules">';
echo ( ! empty( $args['disabled_title'] ) ) ? '<div class="csf-sorter-title">'. esc_attr( $args['disabled_title'] ) .'</div>' : '';
echo '<ul class="csf-disabled">';
if ( ! empty( $disabled_options ) ) {
foreach ( $disabled_options as $key => $value ) {
echo '<li><input type="hidden" name="'. esc_attr( $this->field_name( '[disabled]['. $key .']' ) ) .'" value="'. esc_attr( $value ) .'"/><label>'. esc_attr( $value ) .'</label></li>';
}
}
echo '</ul>';
echo '</div>';
}
echo $this->field_after();
}
public function enqueue() {
if ( ! wp_script_is( 'jquery-ui-sortable' ) ) {
wp_enqueue_script( 'jquery-ui-sortable' );
}
}
}
}

View File

@@ -0,0 +1,150 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: spacing
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_spacing' ) ) {
class CSF_Field_spacing extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$args = wp_parse_args( $this->field, array(
'top_icon' => '<i class="fas fa-long-arrow-alt-up"></i>',
'right_icon' => '<i class="fas fa-long-arrow-alt-right"></i>',
'bottom_icon' => '<i class="fas fa-long-arrow-alt-down"></i>',
'left_icon' => '<i class="fas fa-long-arrow-alt-left"></i>',
'all_icon' => '<i class="fas fa-arrows-alt"></i>',
'top_placeholder' => esc_html__( 'top', 'csf' ),
'right_placeholder' => esc_html__( 'right', 'csf' ),
'bottom_placeholder' => esc_html__( 'bottom', 'csf' ),
'left_placeholder' => esc_html__( 'left', 'csf' ),
'all_placeholder' => esc_html__( 'all', 'csf' ),
'top' => true,
'left' => true,
'bottom' => true,
'right' => true,
'unit' => true,
'show_units' => true,
'all' => false,
'units' => array( 'px', '%', 'em' )
) );
$default_values = array(
'top' => '',
'right' => '',
'bottom' => '',
'left' => '',
'all' => '',
'unit' => 'px',
);
$value = wp_parse_args( $this->value, $default_values );
$unit = ( count( $args['units'] ) === 1 && ! empty( $args['unit'] ) ) ? $args['units'][0] : '';
$is_unit = ( ! empty( $unit ) ) ? ' csf--is-unit' : '';
echo $this->field_before();
echo '<div class="csf--inputs" data-depend-id="'. esc_attr( $this->field['id'] ) .'">';
if ( ! empty( $args['all'] ) ) {
$placeholder = ( ! empty( $args['all_placeholder'] ) ) ? ' placeholder="'. esc_attr( $args['all_placeholder'] ) .'"' : '';
echo '<div class="csf--input">';
echo ( ! empty( $args['all_icon'] ) ) ? '<span class="csf--label csf--icon">'. $args['all_icon'] .'</span>' : '';
echo '<input type="number" name="'. esc_attr( $this->field_name( '[all]' ) ) .'" value="'. esc_attr( $value['all'] ) .'"'. $placeholder .' class="csf-input-number'. esc_attr( $is_unit ) .'" step="any" />';
echo ( $unit ) ? '<span class="csf--label csf--unit">'. esc_attr( $args['units'][0] ) .'</span>' : '';
echo '</div>';
} else {
$properties = array();
foreach ( array( 'top', 'right', 'bottom', 'left' ) as $prop ) {
if ( ! empty( $args[$prop] ) ) {
$properties[] = $prop;
}
}
$properties = ( $properties === array( 'right', 'left' ) ) ? array_reverse( $properties ) : $properties;
foreach ( $properties as $property ) {
$placeholder = ( ! empty( $args[$property.'_placeholder'] ) ) ? ' placeholder="'. esc_attr( $args[$property.'_placeholder'] ) .'"' : '';
echo '<div class="csf--input">';
echo ( ! empty( $args[$property.'_icon'] ) ) ? '<span class="csf--label csf--icon">'. $args[$property.'_icon'] .'</span>' : '';
echo '<input type="number" name="'. esc_attr( $this->field_name( '['. $property .']' ) ) .'" value="'. esc_attr( $value[$property] ) .'"'. $placeholder .' class="csf-input-number'. esc_attr( $is_unit ) .'" step="any" />';
echo ( $unit ) ? '<span class="csf--label csf--unit">'. esc_attr( $args['units'][0] ) .'</span>' : '';
echo '</div>';
}
}
if ( ! empty( $args['unit'] ) && ! empty( $args['show_units'] ) && count( $args['units'] ) > 1 ) {
echo '<div class="csf--input">';
echo '<select name="'. esc_attr( $this->field_name( '[unit]' ) ) .'">';
foreach ( $args['units'] as $unit ) {
$selected = ( $value['unit'] === $unit ) ? ' selected' : '';
echo '<option value="'. esc_attr( $unit ) .'"'. esc_attr( $selected ) .'>'. esc_attr( $unit ) .'</option>';
}
echo '</select>';
echo '</div>';
}
echo '</div>';
echo $this->field_after();
}
public function output() {
$output = '';
$element = ( is_array( $this->field['output'] ) ) ? join( ',', $this->field['output'] ) : $this->field['output'];
$important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : '';
$unit = ( ! empty( $this->value['unit'] ) ) ? $this->value['unit'] : 'px';
$mode = ( ! empty( $this->field['output_mode'] ) ) ? $this->field['output_mode'] : 'padding';
$mode = ( $mode === 'relative' || $mode === 'absolute' || $mode === 'none' ) ? '' : $mode;
$mode = ( ! empty( $mode ) ) ? $mode .'-' : '';
if ( ! empty( $this->field['all'] ) && isset( $this->value['all'] ) && $this->value['all'] !== '' ) {
$output = $element .'{';
$output .= $mode .'top:'. $this->value['all'] . $unit . $important .';';
$output .= $mode .'right:'. $this->value['all'] . $unit . $important .';';
$output .= $mode .'bottom:'. $this->value['all'] . $unit . $important .';';
$output .= $mode .'left:'. $this->value['all'] . $unit . $important .';';
$output .= '}';
} else {
$top = ( isset( $this->value['top'] ) && $this->value['top'] !== '' ) ? $mode .'top:'. $this->value['top'] . $unit . $important .';' : '';
$right = ( isset( $this->value['right'] ) && $this->value['right'] !== '' ) ? $mode .'right:'. $this->value['right'] . $unit . $important .';' : '';
$bottom = ( isset( $this->value['bottom'] ) && $this->value['bottom'] !== '' ) ? $mode .'bottom:'. $this->value['bottom'] . $unit . $important .';' : '';
$left = ( isset( $this->value['left'] ) && $this->value['left'] !== '' ) ? $mode .'left:'. $this->value['left'] . $unit . $important .';' : '';
if ( $top !== '' || $right !== '' || $bottom !== '' || $left !== '' ) {
$output = $element .'{'. $top . $right . $bottom . $left .'}';
}
}
$this->parent->output_css .= $output;
return $output;
}
}
}

View File

@@ -0,0 +1,70 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: spinner
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_spinner' ) ) {
class CSF_Field_spinner extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$args = wp_parse_args( $this->field, array(
'max' => 100,
'min' => 0,
'step' => 1,
'unit' => '',
) );
echo $this->field_before();
echo '<div class="csf--spin"><input type="number" name="'. esc_attr( $this->field_name() ) .'" value="'. esc_attr( $this->value ) .'"'. $this->field_attributes( array( 'class' => 'csf-input-number' ) ) .' data-min="'. esc_attr( $args['min'] ) .'" data-max="'. esc_attr( $args['max'] ) .'" data-step="'. esc_attr( $args['step'] ) .'" data-unit="'. esc_attr( $args['unit'] ) .'" step="any" /></div>';
echo $this->field_after();
}
public function enqueue() {
if ( ! wp_script_is( 'jquery-ui-spinner' ) ) {
wp_enqueue_script( 'jquery-ui-spinner' );
}
}
public function output() {
$output = '';
$elements = ( is_array( $this->field['output'] ) ) ? $this->field['output'] : array_filter( (array) $this->field['output'] );
$important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : '';
$mode = ( ! empty( $this->field['output_mode'] ) ) ? $this->field['output_mode'] : 'width';
$unit = ( ! empty( $this->field['unit'] ) ) ? $this->field['unit'] : 'px';
if ( ! empty( $elements ) && isset( $this->value ) && $this->value !== '' ) {
foreach ( $elements as $key_property => $element ) {
if ( is_numeric( $key_property ) ) {
if ( $mode ) {
$output = implode( ',', $elements ) .'{'. $mode .':'. $this->value . $unit . $important .';}';
}
break;
} else {
$output .= $element .'{'. $key_property .':'. $this->value . $unit . $important .'}';
}
}
}
$this->parent->output_css .= $output;
return $output;
}
}
}

View File

@@ -0,0 +1,24 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: subheading
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_subheading' ) ) {
class CSF_Field_subheading extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
echo ( ! empty( $this->field['content'] ) ) ? $this->field['content'] : '';
}
}
}

View File

@@ -0,0 +1,26 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: submessage
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_submessage' ) ) {
class CSF_Field_submessage extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$style = ( ! empty( $this->field['style'] ) ) ? $this->field['style'] : 'normal';
echo '<div class="csf-submessage csf-submessage-'. esc_attr( $style ) .'">'. $this->field['content'] .'</div>';
}
}
}

View File

@@ -0,0 +1,40 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: switcher
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_switcher' ) ) {
class CSF_Field_switcher extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$active = ( ! empty( $this->value ) ) ? ' csf--active' : '';
$text_on = ( ! empty( $this->field['text_on'] ) ) ? $this->field['text_on'] : esc_html__( 'On', 'csf' );
$text_off = ( ! empty( $this->field['text_off'] ) ) ? $this->field['text_off'] : esc_html__( 'Off', 'csf' );
$text_width = ( ! empty( $this->field['text_width'] ) ) ? ' style="width: '. esc_attr( $this->field['text_width'] ) .'px;"': '';
echo $this->field_before();
echo '<div class="csf--switcher'. esc_attr( $active ) .'"'. $text_width .'>';
echo '<span class="csf--on">'. esc_attr( $text_on ) .'</span>';
echo '<span class="csf--off">'. esc_attr( $text_off ) .'</span>';
echo '<span class="csf--ball"></span>';
echo '<input type="text" name="'. esc_attr( $this->field_name() ) .'" value="'. esc_attr( $this->value ) .'"'. $this->field_attributes() .' />';
echo '</div>';
echo ( ! empty( $this->field['label'] ) ) ? '<span class="csf--label">'. esc_attr( $this->field['label'] ) . '</span>' : '';
echo $this->field_after();
}
}
}

View File

@@ -0,0 +1,64 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: tabbed
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_tabbed' ) ) {
class CSF_Field_tabbed extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$unallows = array( 'tabbed' );
echo $this->field_before();
echo '<div class="csf-tabbed-nav" data-depend-id="'. esc_attr( $this->field['id'] ) .'">';
foreach ( $this->field['tabs'] as $key => $tab ) {
$tabbed_icon = ( ! empty( $tab['icon'] ) ) ? '<i class="csf--icon '. esc_attr( $tab['icon'] ) .'"></i>' : '';
$tabbed_active = ( empty( $key ) ) ? 'csf-tabbed-active' : '';
echo '<a href="#" class="'. esc_attr( $tabbed_active ) .'"">'. $tabbed_icon . esc_attr( $tab['title'] ) .'</a>';
}
echo '</div>';
echo '<div class="csf-tabbed-contents">';
foreach ( $this->field['tabs'] as $key => $tab ) {
$tabbed_hidden = ( ! empty( $key ) ) ? ' hidden' : '';
echo '<div class="csf-tabbed-content'. esc_attr( $tabbed_hidden ) .'">';
foreach ( $tab['fields'] as $field ) {
if ( in_array( $field['type'], $unallows ) ) { $field['_notice'] = true; }
$field_id = ( isset( $field['id'] ) ) ? $field['id'] : '';
$field_default = ( isset( $field['default'] ) ) ? $field['default'] : '';
$field_value = ( isset( $this->value[$field_id] ) ) ? $this->value[$field_id] : $field_default;
$unique_id = ( ! empty( $this->unique ) ) ? $this->unique .'['. $this->field['id'] .']' : $this->field['id'];
CSF::field( $field, $field_value, $unique_id, 'field/tabbed' );
}
echo '</div>';
}
echo '</div>';
echo $this->field_after();
}
}
}

View File

@@ -0,0 +1,30 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: text
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_text' ) ) {
class CSF_Field_text extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$type = ( ! empty( $this->field['attributes']['type'] ) ) ? $this->field['attributes']['type'] : 'text';
echo $this->field_before();
echo '<input type="'. esc_attr( $type ) .'" name="'. esc_attr( $this->field_name() ) .'" value="'. esc_attr( $this->value ) .'"'. $this->field_attributes() .' />';
echo $this->field_after();
}
}
}

View File

@@ -0,0 +1,48 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: textarea
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_textarea' ) ) {
class CSF_Field_textarea extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
echo $this->field_before();
echo $this->shortcoder();
echo '<textarea name="'. esc_attr( $this->field_name() ) .'"'. $this->field_attributes() .'>'. $this->value .'</textarea>';
echo $this->field_after();
}
public function shortcoder() {
if ( ! empty( $this->field['shortcoder'] ) ) {
$instances = ( is_array( $this->field['shortcoder'] ) ) ? $this->field['shortcoder'] : array_filter( (array) $this->field['shortcoder'] );
foreach ( $instances as $instance_key ) {
if ( isset( CSF::$shortcode_instances[$instance_key] ) ) {
$button_title = CSF::$shortcode_instances[$instance_key]['button_title'];
echo '<a href="#" class="button button-primary csf-shortcode-button" data-modal-id="'. esc_attr( $instance_key ) .'">'. $button_title .'</a>';
}
}
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,544 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: typography
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_typography' ) ) {
class CSF_Field_typography extends CSF_Fields {
public $chosen = false;
public $value = array();
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
echo $this->field_before();
$args = wp_parse_args( $this->field, array(
'font_family' => true,
'font_weight' => true,
'font_style' => true,
'font_size' => true,
'line_height' => true,
'letter_spacing' => true,
'text_align' => true,
'text_transform' => true,
'color' => true,
'chosen' => true,
'preview' => true,
'subset' => true,
'multi_subset' => false,
'extra_styles' => false,
'backup_font_family' => false,
'font_variant' => false,
'word_spacing' => false,
'text_decoration' => false,
'custom_style' => false,
'compact' => false,
'exclude' => '',
'unit' => 'px',
'line_height_unit' => '',
'preview_text' => 'The quick brown fox jumps over the lazy dog',
) );
if ( $args['compact'] ) {
$args['text_transform'] = false;
$args['text_align'] = false;
$args['font_size'] = false;
$args['line_height'] = false;
$args['letter_spacing'] = false;
$args['preview'] = false;
$args['color'] = false;
}
$default_value = array(
'font-family' => '',
'font-weight' => '',
'font-style' => '',
'font-variant' => '',
'font-size' => '',
'line-height' => '',
'letter-spacing' => '',
'word-spacing' => '',
'text-align' => '',
'text-transform' => '',
'text-decoration' => '',
'backup-font-family' => '',
'color' => '',
'custom-style' => '',
'type' => '',
'subset' => '',
'extra-styles' => array(),
);
$default_value = ( ! empty( $this->field['default'] ) ) ? wp_parse_args( $this->field['default'], $default_value ) : $default_value;
$this->value = wp_parse_args( $this->value, $default_value );
$this->chosen = $args['chosen'];
$chosen_class = ( $this->chosen ) ? ' csf--chosen' : '';
$line_height_unit = ( ! empty( $args['line_height_unit'] ) ) ? $args['line_height_unit'] : $args['unit'];
echo '<div class="csf--typography'. esc_attr( $chosen_class ) .'" data-depend-id="'. esc_attr( $this->field['id'] ) .'" data-unit="'. esc_attr( $args['unit'] ) .'" data-line-height-unit="'. esc_attr( $line_height_unit ) .'" data-exclude="'. esc_attr( $args['exclude'] ) .'">';
echo '<div class="csf--blocks csf--blocks-selects">';
//
// Font Family
if ( ! empty( $args['font_family'] ) ) {
echo '<div class="csf--block">';
echo '<div class="csf--title">'. esc_html__( 'Font Family', 'csf' ) .'</div>';
echo $this->create_select( array( $this->value['font-family'] => $this->value['font-family'] ), 'font-family', esc_html__( 'Select a font', 'csf' ) );
echo '</div>';
}
//
// Backup Font Family
if ( ! empty( $args['backup_font_family'] ) ) {
echo '<div class="csf--block csf--block-backup-font-family hidden">';
echo '<div class="csf--title">'. esc_html__( 'Backup Font Family', 'csf' ) .'</div>';
echo $this->create_select( apply_filters( 'csf_field_typography_backup_font_family', array(
'Arial, Helvetica, sans-serif',
"'Arial Black', Gadget, sans-serif",
"'Comic Sans MS', cursive, sans-serif",
'Impact, Charcoal, sans-serif',
"'Lucida Sans Unicode', 'Lucida Grande', sans-serif",
'Tahoma, Geneva, sans-serif',
"'Trebuchet MS', Helvetica, sans-serif'",
'Verdana, Geneva, sans-serif',
"'Courier New', Courier, monospace",
"'Lucida Console', Monaco, monospace",
'Georgia, serif',
'Palatino Linotype'
) ), 'backup-font-family', esc_html__( 'Default', 'csf' ) );
echo '</div>';
}
//
// Font Style and Extra Style Select
if ( ! empty( $args['font_weight'] ) || ! empty( $args['font_style'] ) ) {
//
// Font Style Select
echo '<div class="csf--block csf--block-font-style hidden">';
echo '<div class="csf--title">'. esc_html__( 'Font Style', 'csf') .'</div>';
echo '<select class="csf--font-style-select" data-placeholder="Default">';
echo '<option value="">'. ( ! $this->chosen ? esc_html__( 'Default', 'csf' ) : '' ) .'</option>';
if ( ! empty( $this->value['font-weight'] ) || ! empty( $this->value['font-style'] ) ) {
echo '<option value="'. esc_attr( strtolower( $this->value['font-weight'] . $this->value['font-style'] ) ) .'" selected></option>';
}
echo '</select>';
echo '<input type="hidden" name="'. esc_attr( $this->field_name( '[font-weight]' ) ) .'" class="csf--font-weight" value="'. esc_attr( $this->value['font-weight'] ) .'" />';
echo '<input type="hidden" name="'. esc_attr( $this->field_name( '[font-style]' ) ) .'" class="csf--font-style" value="'. esc_attr( $this->value['font-style'] ) .'" />';
//
// Extra Font Style Select
if ( ! empty( $args['extra_styles'] ) ) {
echo '<div class="csf--block-extra-styles hidden">';
echo ( ! $this->chosen ) ? '<div class="csf--title">'. esc_html__( 'Load Extra Styles', 'csf' ) .'</div>' : '';
$placeholder = ( $this->chosen ) ? esc_html__( 'Load Extra Styles', 'csf' ) : esc_html__( 'Default', 'csf' );
echo $this->create_select( $this->value['extra-styles'], 'extra-styles', $placeholder, true );
echo '</div>';
}
echo '</div>';
}
//
// Subset
if ( ! empty( $args['subset'] ) ) {
echo '<div class="csf--block csf--block-subset hidden">';
echo '<div class="csf--title">'. esc_html__( 'Subset', 'csf' ) .'</div>';
$subset = ( is_array( $this->value['subset'] ) ) ? $this->value['subset'] : array_filter( (array) $this->value['subset'] );
echo $this->create_select( $subset, 'subset', esc_html__( 'Default', 'csf' ), $args['multi_subset'] );
echo '</div>';
}
//
// Text Align
if ( ! empty( $args['text_align'] ) ) {
echo '<div class="csf--block">';
echo '<div class="csf--title">'. esc_html__( 'Text Align', 'csf' ) .'</div>';
echo $this->create_select( array(
'inherit' => esc_html__( 'Inherit', 'csf' ),
'left' => esc_html__( 'Left', 'csf' ),
'center' => esc_html__( 'Center', 'csf' ),
'right' => esc_html__( 'Right', 'csf' ),
'justify' => esc_html__( 'Justify', 'csf' ),
'initial' => esc_html__( 'Initial', 'csf' )
), 'text-align', esc_html__( 'Default', 'csf' ) );
echo '</div>';
}
//
// Font Variant
if ( ! empty( $args['font_variant'] ) ) {
echo '<div class="csf--block">';
echo '<div class="csf--title">'. esc_html__( 'Font Variant', 'csf' ) .'</div>';
echo $this->create_select( array(
'normal' => esc_html__( 'Normal', 'csf' ),
'small-caps' => esc_html__( 'Small Caps', 'csf' ),
'all-small-caps' => esc_html__( 'All Small Caps', 'csf' )
), 'font-variant', esc_html__( 'Default', 'csf' ) );
echo '</div>';
}
//
// Text Transform
if ( ! empty( $args['text_transform'] ) ) {
echo '<div class="csf--block">';
echo '<div class="csf--title">'. esc_html__( 'Text Transform', 'csf' ) .'</div>';
echo $this->create_select( array(
'none' => esc_html__( 'None', 'csf' ),
'capitalize' => esc_html__( 'Capitalize', 'csf' ),
'uppercase' => esc_html__( 'Uppercase', 'csf' ),
'lowercase' => esc_html__( 'Lowercase', 'csf' )
), 'text-transform', esc_html__( 'Default', 'csf' ) );
echo '</div>';
}
//
// Text Decoration
if ( ! empty( $args['text_decoration'] ) ) {
echo '<div class="csf--block">';
echo '<div class="csf--title">'. esc_html__( 'Text Decoration', 'csf' ) .'</div>';
echo $this->create_select( array(
'none' => esc_html__( 'None', 'csf' ),
'underline' => esc_html__( 'Solid', 'csf' ),
'underline double' => esc_html__( 'Double', 'csf' ),
'underline dotted' => esc_html__( 'Dotted', 'csf' ),
'underline dashed' => esc_html__( 'Dashed', 'csf' ),
'underline wavy' => esc_html__( 'Wavy', 'csf' ),
'underline overline' => esc_html__( 'Overline', 'csf' ),
'line-through' => esc_html__( 'Line-through', 'csf' )
), 'text-decoration', esc_html__( 'Default', 'csf' ) );
echo '</div>';
}
echo '</div>';
echo '<div class="csf--blocks csf--blocks-inputs">';
//
// Font Size
if ( ! empty( $args['font_size'] ) ) {
echo '<div class="csf--block">';
echo '<div class="csf--title">'. esc_html__( 'Font Size', 'csf' ) .'</div>';
echo '<div class="csf--input-wrap">';
echo '<input type="number" name="'. esc_attr( $this->field_name( '[font-size]' ) ) .'" class="csf--font-size csf--input csf-input-number" value="'. esc_attr( $this->value['font-size'] ) .'" step="any" />';
echo '<span class="csf--unit">'. esc_attr( $args['unit'] ) .'</span>';
echo '</div>';
echo '</div>';
}
//
// Line Height
if ( ! empty( $args['line_height'] ) ) {
echo '<div class="csf--block">';
echo '<div class="csf--title">'. esc_html__( 'Line Height', 'csf' ) .'</div>';
echo '<div class="csf--input-wrap">';
echo '<input type="number" name="'. esc_attr( $this->field_name( '[line-height]' ) ) .'" class="csf--line-height csf--input csf-input-number" value="'. esc_attr( $this->value['line-height'] ) .'" step="any" />';
echo '<span class="csf--unit">'. esc_attr( $line_height_unit ) .'</span>';
echo '</div>';
echo '</div>';
}
//
// Letter Spacing
if ( ! empty( $args['letter_spacing'] ) ) {
echo '<div class="csf--block">';
echo '<div class="csf--title">'. esc_html__( 'Letter Spacing', 'csf' ) .'</div>';
echo '<div class="csf--input-wrap">';
echo '<input type="number" name="'. esc_attr( $this->field_name( '[letter-spacing]' ) ) .'" class="csf--letter-spacing csf--input csf-input-number" value="'. esc_attr( $this->value['letter-spacing'] ) .'" step="any" />';
echo '<span class="csf--unit">'. esc_attr( $args['unit'] ) .'</span>';
echo '</div>';
echo '</div>';
}
//
// Word Spacing
if ( ! empty( $args['word_spacing'] ) ) {
echo '<div class="csf--block">';
echo '<div class="csf--title">'. esc_html__( 'Word Spacing', 'csf' ) .'</div>';
echo '<div class="csf--input-wrap">';
echo '<input type="number" name="'. esc_attr( $this->field_name( '[word-spacing]' ) ) .'" class="csf--word-spacing csf--input csf-input-number" value="'. esc_attr( $this->value['word-spacing'] ) .'" step="any" />';
echo '<span class="csf--unit">'. esc_attr( $args['unit'] ) .'</span>';
echo '</div>';
echo '</div>';
}
echo '</div>';
//
// Font Color
if ( ! empty( $args['color'] ) ) {
$default_color_attr = ( ! empty( $default_value['color'] ) ) ? ' data-default-color="'. esc_attr( $default_value['color'] ) .'"' : '';
echo '<div class="csf--block csf--block-font-color">';
echo '<div class="csf--title">'. esc_html__( 'Font Color', 'csf' ) .'</div>';
echo '<div class="csf-field-color">';
echo '<input type="text" name="'. esc_attr( $this->field_name( '[color]' ) ) .'" class="csf-color csf--color" value="'. esc_attr( $this->value['color'] ) .'"'. $default_color_attr .' />';
echo '</div>';
echo '</div>';
}
//
// Custom style
if ( ! empty( $args['custom_style'] ) ) {
echo '<div class="csf--block csf--block-custom-style">';
echo '<div class="csf--title">'. esc_html__( 'Custom Style', 'csf' ) .'</div>';
echo '<textarea name="'. esc_attr( $this->field_name( '[custom-style]' ) ) .'" class="csf--custom-style">'. esc_attr( $this->value['custom-style'] ) .'</textarea>';
echo '</div>';
}
//
// Preview
$always_preview = ( $args['preview'] !== 'always' ) ? ' hidden' : '';
if ( ! empty( $args['preview'] ) ) {
echo '<div class="csf--block csf--block-preview'. esc_attr( $always_preview ) .'">';
echo '<div class="csf--toggle fas fa-toggle-off"></div>';
echo '<div class="csf--preview">'. esc_attr( $args['preview_text'] ) .'</div>';
echo '</div>';
}
echo '<input type="hidden" name="'. esc_attr( $this->field_name( '[type]' ) ) .'" class="csf--type" value="'. esc_attr( $this->value['type'] ) .'" />';
echo '<input type="hidden" name="'. esc_attr( $this->field_name( '[unit]' ) ) .'" class="csf--unit-save" value="'. esc_attr( $args['unit'] ) .'" />';
echo '</div>';
echo $this->field_after();
}
public function create_select( $options, $name, $placeholder = '', $is_multiple = false ) {
$multiple_name = ( $is_multiple ) ? '[]' : '';
$multiple_attr = ( $is_multiple ) ? ' multiple data-multiple="true"' : '';
$chosen_rtl = ( $this->chosen && is_rtl() ) ? ' chosen-rtl' : '';
$output = '<select name="'. esc_attr( $this->field_name( '['. $name .']'. $multiple_name ) ) .'" class="csf--'. esc_attr( $name ) . esc_attr( $chosen_rtl ) .'" data-placeholder="'. esc_attr( $placeholder ) .'"'. $multiple_attr .'>';
$output .= ( ! empty( $placeholder ) ) ? '<option value="">'. esc_attr( ( ! $this->chosen ) ? $placeholder : '' ) .'</option>' : '';
if ( ! empty( $options ) ) {
foreach ( $options as $option_key => $option_value ) {
if ( $is_multiple ) {
$selected = ( in_array( $option_value, $this->value[$name] ) ) ? ' selected' : '';
$output .= '<option value="'. esc_attr( $option_value ) .'"'. esc_attr( $selected ).'>'. esc_attr( $option_value ) .'</option>';
} else {
$option_key = ( is_numeric( $option_key ) ) ? $option_value : $option_key;
$selected = ( $option_key === $this->value[$name] ) ? ' selected' : '';
$output .= '<option value="'. esc_attr( $option_key ) .'"'. esc_attr( $selected ).'>'. esc_attr( $option_value ) .'</option>';
}
}
}
$output .= '</select>';
return $output;
}
public function enqueue() {
if ( ! wp_script_is( 'csf-webfontloader' ) ) {
CSF::include_plugin_file( 'fields/typography/google-fonts.php' );
wp_enqueue_script( 'csf-webfontloader', 'https://cdn.jsdelivr.net/npm/webfontloader@1.6.28/webfontloader.min.js', array( 'csf' ), '1.6.28', true );
$webfonts = array();
$customwebfonts = apply_filters( 'csf_field_typography_customwebfonts', array() );
if ( ! empty( $customwebfonts ) ) {
$webfonts['custom'] = array(
'label' => esc_html__( 'Custom Web Fonts', 'csf' ),
'fonts' => $customwebfonts
);
}
$webfonts['safe'] = array(
'label' => esc_html__( 'Safe Web Fonts', 'csf' ),
'fonts' => apply_filters( 'csf_field_typography_safewebfonts', array(
'Arial',
'Arial Black',
'Helvetica',
'Times New Roman',
'Courier New',
'Tahoma',
'Verdana',
'Impact',
'Trebuchet MS',
'Comic Sans MS',
'Lucida Console',
'Lucida Sans Unicode',
'Georgia, serif',
'Palatino Linotype'
)
) );
$webfonts['google'] = array(
'label' => esc_html__( 'Google Web Fonts', 'csf' ),
'fonts' => apply_filters( 'csf_field_typography_googlewebfonts', csf_get_google_fonts()
) );
$defaultstyles = apply_filters( 'csf_field_typography_defaultstyles', array( 'normal', 'italic', '700', '700italic' ) );
$googlestyles = apply_filters( 'csf_field_typography_googlestyles', array(
'100' => 'Thin 100',
'100italic' => 'Thin 100 Italic',
'200' => 'Extra-Light 200',
'200italic' => 'Extra-Light 200 Italic',
'300' => 'Light 300',
'300italic' => 'Light 300 Italic',
'normal' => 'Normal 400',
'italic' => 'Normal 400 Italic',
'500' => 'Medium 500',
'500italic' => 'Medium 500 Italic',
'600' => 'Semi-Bold 600',
'600italic' => 'Semi-Bold 600 Italic',
'700' => 'Bold 700',
'700italic' => 'Bold 700 Italic',
'800' => 'Extra-Bold 800',
'800italic' => 'Extra-Bold 800 Italic',
'900' => 'Black 900',
'900italic' => 'Black 900 Italic'
) );
$webfonts = apply_filters( 'csf_field_typography_webfonts', $webfonts );
wp_localize_script( 'csf', 'csf_typography_json', array(
'webfonts' => $webfonts,
'defaultstyles' => $defaultstyles,
'googlestyles' => $googlestyles
) );
}
}
public function enqueue_google_fonts( $method = 'enqueue' ) {
$is_google = false;
if ( ! empty( $this->value['type'] ) ) {
$is_google = ( $this->value['type'] === 'google' ) ? true : false;
} else {
CSF::include_plugin_file( 'fields/typography/google-fonts.php' );
$is_google = ( array_key_exists( $this->value['font-family'], csf_get_google_fonts() ) ) ? true : false;
}
if ( $is_google ) {
// set style
$font_family = ( ! empty( $this->value['font-family'] ) ) ? $this->value['font-family'] : '';
$font_weight = ( ! empty( $this->value['font-weight'] ) ) ? $this->value['font-weight'] : '';
$font_style = ( ! empty( $this->value['font-style'] ) ) ? $this->value['font-style'] : '';
if ( $font_weight || $font_style ) {
$style = $font_weight . $font_style;
if ( ! empty( $style ) ) {
$style = ( $style === 'normal' ) ? '400' : $style;
CSF::$webfonts[$method][$font_family][$style] = $style;
}
} else {
CSF::$webfonts[$method][$font_family] = array();
}
// set extra styles
if ( ! empty( $this->value['extra-styles'] ) ) {
foreach ( $this->value['extra-styles'] as $extra_style ) {
if ( ! empty( $extra_style ) ) {
$extra_style = ( $extra_style === 'normal' ) ? '400' : $extra_style;
CSF::$webfonts[$method][$font_family][$extra_style] = $extra_style;
}
}
}
// set subsets
if ( ! empty( $this->value['subset'] ) ) {
$this->value['subset'] = ( is_array( $this->value['subset'] ) ) ? $this->value['subset'] : array_filter( (array) $this->value['subset'] );
foreach ( $this->value['subset'] as $subset ) {
if( ! empty( $subset ) ) {
CSF::$subsets[$subset] = $subset;
}
}
}
return true;
}
return false;
}
public function output() {
$output = '';
$bg_image = array();
$important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : '';
$element = ( is_array( $this->field['output'] ) ) ? join( ',', $this->field['output'] ) : $this->field['output'];
$font_family = ( ! empty( $this->value['font-family'] ) ) ? $this->value['font-family'] : '';
$backup_family = ( ! empty( $this->value['backup-font-family'] ) ) ? ', '. $this->value['backup-font-family'] : '';
if ( $font_family ) {
$output .= 'font-family:"'. $font_family .'"'. $backup_family . $important .';';
}
// Common font properties
$properties = array(
'color',
'font-weight',
'font-style',
'font-variant',
'text-align',
'text-transform',
'text-decoration',
);
foreach ( $properties as $property ) {
if ( isset( $this->value[$property] ) && $this->value[$property] !== '' ) {
$output .= $property .':'. $this->value[$property] . $important .';';
}
}
$properties = array(
'font-size',
'line-height',
'letter-spacing',
'word-spacing',
);
$unit = ( ! empty( $this->value['unit'] ) ) ? $this->value['unit'] : '';
$line_height_unit = ( ! empty( $this->value['line_height_unit'] ) ) ? $this->value['line_height_unit'] : $unit;
foreach ( $properties as $property ) {
if ( isset( $this->value[$property] ) && $this->value[$property] !== '' ) {
$unit = ( $property === 'line-height' ) ? $line_height_unit : $unit;
$output .= $property .':'. $this->value[$property] . $unit . $important .';';
}
}
$custom_style = ( ! empty( $this->value['custom-style'] ) ) ? $this->value['custom-style'] : '';
if ( $output ) {
$output = $element .'{'. $output . $custom_style .'}';
}
$this->parent->output_css .= $output;
return $output;
}
}
}

View File

@@ -0,0 +1,41 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: upload
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_upload' ) ) {
class CSF_Field_upload extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$args = wp_parse_args( $this->field, array(
'library' => array(),
'button_title' => esc_html__( 'Upload', 'csf' ),
'remove_title' => esc_html__( 'Remove', 'csf' ),
) );
echo $this->field_before();
$library = ( is_array( $args['library'] ) ) ? $args['library'] : array_filter( (array) $args['library'] );
$library = ( ! empty( $library ) ) ? implode(',', $library ) : '';
$hidden = ( empty( $this->value ) ) ? ' hidden' : '';
echo '<div class="csf--wrap">';
echo '<input type="text" name="'. esc_attr( $this->field_name() ) .'" value="'. esc_attr( $this->value ) .'"'. $this->field_attributes() .'/>';
echo '<a href="#" class="button button-primary csf--button" data-library="'. esc_attr( $library ) .'">'. $args['button_title'] .'</a>';
echo '<a href="#" class="button button-secondary csf-warning-primary csf--remove'. esc_attr( $hidden ) .'">'. $args['remove_title'] .'</a>';
echo '</div>';
echo $this->field_after();
}
}
}

View File

@@ -0,0 +1,103 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Field: wp_editor
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Field_wp_editor' ) ) {
class CSF_Field_wp_editor extends CSF_Fields {
public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
parent::__construct( $field, $value, $unique, $where, $parent );
}
public function render() {
$args = wp_parse_args( $this->field, array(
'tinymce' => true,
'quicktags' => true,
'media_buttons' => true,
'wpautop' => false,
'height' => '',
) );
$attributes = array(
'rows' => 10,
'class' => 'wp-editor-area',
'autocomplete' => 'off',
);
$editor_height = ( ! empty( $args['height'] ) ) ? ' style="height:'. esc_attr( $args['height'] ) .';"' : '';
$editor_settings = array(
'tinymce' => $args['tinymce'],
'quicktags' => $args['quicktags'],
'media_buttons' => $args['media_buttons'],
'wpautop' => $args['wpautop'],
);
echo $this->field_before();
echo ( csf_wp_editor_api() ) ? '<div class="csf-wp-editor" data-editor-settings="'. esc_attr( json_encode( $editor_settings ) ) .'">' : '';
echo '<textarea name="'. esc_attr( $this->field_name() ) .'"'. $this->field_attributes( $attributes ) . $editor_height .'>'. $this->value .'</textarea>';
echo ( csf_wp_editor_api() ) ? '</div>' : '';
echo $this->field_after();
}
public function enqueue() {
if ( csf_wp_editor_api() && function_exists( 'wp_enqueue_editor' ) ) {
wp_enqueue_editor();
$this->setup_wp_editor_settings();
add_action( 'print_default_editor_scripts', array( &$this, 'setup_wp_editor_media_buttons' ) );
}
}
// Setup wp editor media buttons
public function setup_wp_editor_media_buttons() {
ob_start();
echo '<div class="wp-media-buttons">';
do_action( 'media_buttons' );
echo '</div>';
$media_buttons = ob_get_clean();
echo '<script type="text/javascript">';
echo 'var csf_media_buttons = '. json_encode( $media_buttons ) .';';
echo '</script>';
}
// Setup wp editor settings
public function setup_wp_editor_settings() {
if ( csf_wp_editor_api() && class_exists( '_WP_Editors') ) {
$defaults = apply_filters( 'csf_wp_editor', array(
'tinymce' => array(
'wp_skip_init' => true
),
) );
$setup = _WP_Editors::parse_settings( 'csf_wp_editor', $defaults );
_WP_Editors::editor_settings( 'csf_wp_editor', $setup );
}
}
}
}

View File

@@ -0,0 +1,190 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Get icons from admin ajax
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! function_exists( 'csf_get_icons' ) ) {
function csf_get_icons() {
$nonce = ( ! empty( $_POST[ 'nonce' ] ) ) ? sanitize_text_field( wp_unslash( $_POST[ 'nonce' ] ) ) : '';
if ( ! wp_verify_nonce( $nonce, 'csf_icon_nonce' ) ) {
wp_send_json_error( array( 'error' => esc_html__( 'Error: Invalid nonce verification.', 'csf' ) ) );
}
ob_start();
$icon_library = ( apply_filters( 'csf_fa4', false ) ) ? 'fa4' : 'fa5';
CSF::include_plugin_file( 'fields/icon/'. $icon_library .'-icons.php' );
$icon_lists = apply_filters( 'csf_field_icon_add_icons', csf_get_default_icons() );
if ( ! empty( $icon_lists ) ) {
foreach ( $icon_lists as $list ) {
echo ( count( $icon_lists ) >= 2 ) ? '<div class="csf-icon-title">'. esc_attr( $list['title'] ) .'</div>' : '';
foreach ( $list['icons'] as $icon ) {
echo '<i title="'. esc_attr( $icon ) .'" class="'. esc_attr( $icon ) .'"></i>';
}
}
} else {
echo '<div class="csf-error-text">'. esc_html__( 'No data available.', 'csf' ) .'</div>';
}
$content = ob_get_clean();
wp_send_json_success( array( 'content' => $content ) );
}
add_action( 'wp_ajax_csf-get-icons', 'csf_get_icons' );
}
/**
*
* Export
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! function_exists( 'csf_export' ) ) {
function csf_export() {
$nonce = ( ! empty( $_GET[ 'nonce' ] ) ) ? sanitize_text_field( wp_unslash( $_GET[ 'nonce' ] ) ) : '';
$unique = ( ! empty( $_GET[ 'unique' ] ) ) ? sanitize_text_field( wp_unslash( $_GET[ 'unique' ] ) ) : '';
if ( ! wp_verify_nonce( $nonce, 'csf_backup_nonce' ) ) {
die( esc_html__( 'Error: Invalid nonce verification.', 'csf' ) );
}
if ( empty( $unique ) ) {
die( esc_html__( 'Error: Invalid key.', 'csf' ) );
}
// Export
header('Content-Type: application/json');
header('Content-disposition: attachment; filename=backup-'. gmdate( 'd-m-Y' ) .'.json');
header('Content-Transfer-Encoding: binary');
header('Pragma: no-cache');
header('Expires: 0');
echo json_encode( get_option( $unique ) );
die();
}
add_action( 'wp_ajax_csf-export', 'csf_export' );
}
/**
*
* Import Ajax
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! function_exists( 'csf_import_ajax' ) ) {
function csf_import_ajax() {
$nonce = ( ! empty( $_POST[ 'nonce' ] ) ) ? sanitize_text_field( wp_unslash( $_POST[ 'nonce' ] ) ) : '';
$unique = ( ! empty( $_POST[ 'unique' ] ) ) ? sanitize_text_field( wp_unslash( $_POST[ 'unique' ] ) ) : '';
$data = ( ! empty( $_POST[ 'data' ] ) ) ? wp_kses_post_deep( json_decode( wp_unslash( trim( $_POST[ 'data' ] ) ), true ) ) : array();
if ( ! wp_verify_nonce( $nonce, 'csf_backup_nonce' ) ) {
wp_send_json_error( array( 'error' => esc_html__( 'Error: Invalid nonce verification.', 'csf' ) ) );
}
if ( empty( $unique ) ) {
wp_send_json_error( array( 'error' => esc_html__( 'Error: Invalid key.', 'csf' ) ) );
}
if ( empty( $data ) || ! is_array( $data ) ) {
wp_send_json_error( array( 'error' => esc_html__( 'Error: The response is not a valid JSON response.', 'csf' ) ) );
}
// Success
update_option( $unique, $data );
wp_send_json_success();
}
add_action( 'wp_ajax_csf-import', 'csf_import_ajax' );
}
/**
*
* Reset Ajax
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! function_exists( 'csf_reset_ajax' ) ) {
function csf_reset_ajax() {
$nonce = ( ! empty( $_POST[ 'nonce' ] ) ) ? sanitize_text_field( wp_unslash( $_POST[ 'nonce' ] ) ) : '';
$unique = ( ! empty( $_POST[ 'unique' ] ) ) ? sanitize_text_field( wp_unslash( $_POST[ 'unique' ] ) ) : '';
if ( ! wp_verify_nonce( $nonce, 'csf_backup_nonce' ) ) {
wp_send_json_error( array( 'error' => esc_html__( 'Error: Invalid nonce verification.', 'csf' ) ) );
}
// Success
delete_option( $unique );
wp_send_json_success();
}
add_action( 'wp_ajax_csf-reset', 'csf_reset_ajax' );
}
/**
*
* Chosen Ajax
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! function_exists( 'csf_chosen_ajax' ) ) {
function csf_chosen_ajax() {
$nonce = ( ! empty( $_POST[ 'nonce' ] ) ) ? sanitize_text_field( wp_unslash( $_POST[ 'nonce' ] ) ) : '';
$type = ( ! empty( $_POST[ 'type' ] ) ) ? sanitize_text_field( wp_unslash( $_POST[ 'type' ] ) ) : '';
$term = ( ! empty( $_POST[ 'term' ] ) ) ? sanitize_text_field( wp_unslash( $_POST[ 'term' ] ) ) : '';
$query = ( ! empty( $_POST[ 'query_args' ] ) ) ? wp_kses_post_deep( $_POST[ 'query_args' ] ) : array();
if ( ! wp_verify_nonce( $nonce, 'csf_chosen_ajax_nonce' ) ) {
wp_send_json_error( array( 'error' => esc_html__( 'Error: Invalid nonce verification.', 'csf' ) ) );
}
if ( empty( $type ) || empty( $term ) ) {
wp_send_json_error( array( 'error' => esc_html__( 'Error: Invalid term ID.', 'csf' ) ) );
}
$capability = apply_filters( 'csf_chosen_ajax_capability', 'manage_options' );
if ( ! current_user_can( $capability ) ) {
wp_send_json_error( array( 'error' => esc_html__( 'Error: You do not have permission to do that.', 'csf' ) ) );
}
// Success
$options = CSF_Fields::field_data( $type, $term, $query );
wp_send_json_success( $options );
}
add_action( 'wp_ajax_csf-chosen', 'csf_chosen_ajax' );
}

View File

@@ -0,0 +1,142 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* WP Customize custom panel
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'WP_Customize_Panel_CSF' ) && class_exists( 'WP_Customize_Panel' ) ) {
class WP_Customize_Panel_CSF extends WP_Customize_Panel {
public $type = 'csf';
}
}
/**
*
* WP Customize custom section
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'WP_Customize_Section_CSF' ) && class_exists( 'WP_Customize_Section' ) ) {
class WP_Customize_Section_CSF extends WP_Customize_Section {
public $type = 'csf';
}
}
/**
*
* WP Customize custom control
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'WP_Customize_Control_CSF' ) && class_exists( 'WP_Customize_Control' ) ) {
class WP_Customize_Control_CSF extends WP_Customize_Control {
public $type = 'csf';
public $field = '';
public $unique = '';
public function render() {
$depend = '';
$visible = '';
if ( ! empty( $this->field['dependency'] ) ) {
$dependency = $this->field['dependency'];
$depend_visible = '';
$data_controller = '';
$data_condition = '';
$data_value = '';
$data_global = '';
if ( is_array( $dependency[0] ) ) {
$data_controller = implode( '|', array_column( $dependency, 0 ) );
$data_condition = implode( '|', array_column( $dependency, 1 ) );
$data_value = implode( '|', array_column( $dependency, 2 ) );
$data_global = implode( '|', array_column( $dependency, 3 ) );
$depend_visible = implode( '|', array_column( $dependency, 4 ) );
} else {
$data_controller = ( ! empty( $dependency[0] ) ) ? $dependency[0] : '';
$data_condition = ( ! empty( $dependency[1] ) ) ? $dependency[1] : '';
$data_value = ( ! empty( $dependency[2] ) ) ? $dependency[2] : '';
$data_global = ( ! empty( $dependency[3] ) ) ? $dependency[3] : '';
$depend_visible = ( ! empty( $dependency[4] ) ) ? $dependency[4] : '';
}
$depend .= ' data-controller="'. esc_attr( $data_controller ) .'"';
$depend .= ' data-condition="'. esc_attr( $data_condition ) .'"';
$depend .= ' data-value="'. esc_attr( $data_value ) .'"';
$depend .= ( ! empty( $data_global ) ) ? ' data-depend-global="true"' : '';
$visible = ' csf-dependency-control';
$visible .= ( ! empty( $depend_visible ) ) ? ' csf-depend-visible' : ' csf-depend-hidden';
}
$id = 'customize-control-' . str_replace( array( '[', ']' ), array( '-', '' ), $this->id );
$class = 'customize-control customize-control-'. $this->type . $visible;
echo '<li id="'. esc_attr( $id ) .'" class="'. esc_attr( $class ) .'"'. $depend .'>';
$this->render_field_content();
echo '</li>';
}
public function render_field_content() {
$complex = apply_filters( 'csf_customize_complex_fields', array(
'accordion',
'background',
'border',
'button_set',
'checkbox',
'color_group',
'date',
'dimensions',
'fieldset',
'group',
'image_select',
'link',
'link_color',
'media',
'palette',
'repeater',
'sortable',
'sorter',
'spacing',
'switcher',
'tabbed',
'typography'
) );
$field_id = ( ! empty( $this->field['id'] ) ) ? $this->field['id'] : '';
$custom = ( ! empty( $this->field['customizer'] ) ) ? true : false;
$is_complex = ( in_array( $this->field['type'], $complex ) ) ? true : false;
$class = ( $is_complex || $custom ) ? ' csf-customize-complex' : '';
$atts = ( $is_complex || $custom ) ? ' data-unique-id="'. esc_attr( $this->unique ) .'" data-option-id="'. esc_attr( $field_id ) .'"' : '';
if ( ! $is_complex && ! $custom ) {
$this->field['attributes']['data-customize-setting-link'] = $this->settings['default']->id;
}
$this->field['name'] = $this->settings['default']->id;
$this->field['dependency'] = array();
echo '<div class="csf-customize-field'. esc_attr( $class ) .'"'. $atts .'>';
CSF::field( $this->field, $this->value(), $this->unique, 'customize' );
echo '</div>';
}
}
}

View File

@@ -0,0 +1,58 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Array search key & value
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! function_exists( 'csf_array_search' ) ) {
function csf_array_search( $array, $key, $value ) {
$results = array();
if ( is_array( $array ) ) {
if ( isset( $array[$key] ) && $array[$key] == $value ) {
$results[] = $array;
}
foreach ( $array as $sub_array ) {
$results = array_merge( $results, csf_array_search( $sub_array, $key, $value ) );
}
}
return $results;
}
}
/**
*
* Between Microtime
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! function_exists( 'csf_timeout' ) ) {
function csf_timeout( $timenow, $starttime, $timeout = 30 ) {
return ( ( $timenow - $starttime ) < $timeout ) ? true : false;
}
}
/**
*
* Check for wp editor api
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! function_exists( 'csf_wp_editor_api' ) ) {
function csf_wp_editor_api() {
global $wp_version;
return version_compare( $wp_version, '4.8', '>=' );
}
}

View File

@@ -0,0 +1,29 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Sanitize
* Replace letter a to letter b
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! function_exists( 'csf_sanitize_replace_a_to_b' ) ) {
function csf_sanitize_replace_a_to_b( $value ) {
return str_replace( 'a', 'b', $value );
}
}
/**
*
* Sanitize title
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! function_exists( 'csf_sanitize_title' ) ) {
function csf_sanitize_title( $value ) {
return sanitize_title( $value );
}
}

View File

@@ -0,0 +1,152 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Email validate
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! function_exists( 'csf_validate_email' ) ) {
function csf_validate_email( $value ) {
if ( ! filter_var( $value, FILTER_VALIDATE_EMAIL ) ) {
return esc_html__( 'Please enter a valid email address.', 'csf' );
}
}
}
/**
*
* Numeric validate
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! function_exists( 'csf_validate_numeric' ) ) {
function csf_validate_numeric( $value ) {
if ( ! is_numeric( $value ) ) {
return esc_html__( 'Please enter a valid number.', 'csf' );
}
}
}
/**
*
* Required validate
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! function_exists( 'csf_validate_required' ) ) {
function csf_validate_required( $value ) {
if ( empty( $value ) ) {
return esc_html__( 'This field is required.', 'csf' );
}
}
}
/**
*
* URL validate
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! function_exists( 'csf_validate_url' ) ) {
function csf_validate_url( $value ) {
if ( ! filter_var( $value, FILTER_VALIDATE_URL ) ) {
return esc_html__( 'Please enter a valid URL.', 'csf' );
}
}
}
/**
*
* Email validate for Customizer
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! function_exists( 'csf_customize_validate_email' ) ) {
function csf_customize_validate_email( $validity, $value, $wp_customize ) {
if ( ! sanitize_email( $value ) ) {
$validity->add( 'required', esc_html__( 'Please enter a valid email address.', 'csf' ) );
}
return $validity;
}
}
/**
*
* Numeric validate for Customizer
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! function_exists( 'csf_customize_validate_numeric' ) ) {
function csf_customize_validate_numeric( $validity, $value, $wp_customize ) {
if ( ! is_numeric( $value ) ) {
$validity->add( 'required', esc_html__( 'Please enter a valid number.', 'csf' ) );
}
return $validity;
}
}
/**
*
* Required validate for Customizer
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! function_exists( 'csf_customize_validate_required' ) ) {
function csf_customize_validate_required( $validity, $value, $wp_customize ) {
if ( empty( $value ) ) {
$validity->add( 'required', esc_html__( 'This field is required.', 'csf' ) );
}
return $validity;
}
}
/**
*
* URL validate for Customizer
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! function_exists( 'csf_customize_validate_url' ) ) {
function csf_customize_validate_url( $validity, $value, $wp_customize ) {
if ( ! filter_var( $value, FILTER_VALIDATE_URL ) ) {
$validity->add( 'required', esc_html__( 'Please enter a valid URL.', 'csf' ) );
}
return $validity;
}
}

View File

@@ -0,0 +1,28 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
/**
*
* Custom Walker for Nav Menu Edit
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! class_exists( 'CSF_Walker_Nav_Menu_Edit' ) && class_exists( 'Walker_Nav_Menu_Edit' ) ) {
class CSF_Walker_Nav_Menu_Edit extends Walker_Nav_Menu_Edit {
public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
$html = '';
parent::start_el( $html, $item, $depth, $args, $id );
ob_start();
do_action( 'wp_nav_menu_item_custom_fields', $item->ID, $item, $depth, $args );
$custom_fields = ob_get_clean();
$output .= preg_replace( '/(?=<(fieldset|p)[^>]+class="[^"]*field-move)/', $custom_fields, $html );
}
}
}

View File

@@ -0,0 +1 @@
<?php // Silence is golden.

View File

@@ -0,0 +1,664 @@
# Copyright (C) 2021 Codestar
# This file is distributed under the same license as the Codestar Framework package.
msgid ""
msgstr ""
"Project-Id-Version: Codestar Framework 2.2.1\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: ar\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.7.1\n"
#: classes/admin-options.class.php:224
msgid "Error while saving the changes."
msgstr "حصل خلل أثناء حفظ التغييرات."
#: classes/admin-options.class.php:284
msgid "Settings successfully imported."
msgstr "تم استرداد الإعدادات بنجاح."
#: classes/admin-options.class.php:296 classes/admin-options.class.php:312
msgid "Default settings restored."
msgstr "تمت استعادة الاعدادات الافتراضية."
#: classes/admin-options.class.php:383
msgid "Settings saved."
msgstr "تمّ حفظ الإعدادات."
#: classes/admin-options.class.php:561
msgid "You have unsaved changes, save your changes!"
msgstr "لديك تعديلات غير محفظة، حفظ تعديلاتك!"
#: classes/admin-options.class.php:563
msgid "show all settings"
msgstr "عرض جميع الإعدادات"
#: classes/admin-options.class.php:565 fields/icon/icon.php:57
#: fields/map/map.php:23
msgid "Search..."
msgstr "بحث..."
#: classes/admin-options.class.php:568 classes/admin-options.class.php:691
msgid "Save"
msgstr "حفظ"
#: classes/admin-options.class.php:568 classes/admin-options.class.php:691
msgid "Saving..."
msgstr "جاري الحفظ..."
#: classes/admin-options.class.php:569 classes/admin-options.class.php:692
msgid "Reset Section"
msgstr "إعادة الوضع الأصلي للقسم"
#: classes/admin-options.class.php:569 classes/admin-options.class.php:692
msgid "Are you sure to reset this section options?"
msgstr "هل أنت متأكد؟"
#: classes/admin-options.class.php:570 classes/admin-options.class.php:693
msgid "Reset All"
msgstr "إعادة الوضع الأصلي للكل"
#: classes/admin-options.class.php:570 classes/admin-options.class.php:693
#: classes/comment-options.class.php:213 classes/metabox-options.class.php:282
#: fields/backup/backup.php:31
msgid "Reset"
msgstr "إعادة تعيين"
#: classes/admin-options.class.php:570 classes/admin-options.class.php:693
msgid "Are you sure you want to reset all settings to default values?"
msgstr "هل تريد بالتأكيد إعادة تعيين جميع الإعدادات إلى القيم الافتراضية؟"
#: classes/admin-options.class.php:668 classes/comment-options.class.php:196
#: classes/metabox-options.class.php:265 fields/button_set/button_set.php:56
#: fields/checkbox/checkbox.php:76 fields/radio/radio.php:75
#: fields/select/select.php:113 functions/actions.php:41
msgid "No data available."
msgstr "لا بيانات متوفرة."
#: classes/comment-options.class.php:214 classes/metabox-options.class.php:283
msgid "update post"
msgstr "تحديث المقالة"
#: classes/comment-options.class.php:214 classes/metabox-options.class.php:283
msgid "Cancel"
msgstr "إلغاء"
#: classes/setup.class.php:529
msgid "Are you sure?"
msgstr "هل أنت متأكد؟"
#: classes/setup.class.php:530
msgid "Please enter %s or more characters"
msgstr "الرجاء ادخال حرف %s أو أكثر"
#: classes/setup.class.php:531
msgid "Searching..."
msgstr "جاري البحث..."
#: classes/setup.class.php:532
msgid "No results found."
msgstr "لا توجد نتائج."
#: classes/setup.class.php:615
msgid "Oops! Not allowed."
msgstr "هذا غير مسموح."
#: classes/setup.class.php:689 classes/setup.class.php:693
msgid "Field not found!"
msgstr "الحقل غير موجود!"
#: classes/shortcode-options.class.php:251 fields/group/group.php:23
msgid "Add New"
msgstr "إضافة منتج جديد"
#: classes/shortcode-options.class.php:288 functions/actions.php:16
#: functions/actions.php:68 functions/actions.php:106 functions/actions.php:141
#: functions/actions.php:170
msgid "Error: Invalid nonce verification."
msgstr "خطأ: عملية التحقق الحالية غير صالحة."
#: fields/background/background.php:35 fields/media/media.php:57
msgid "Not selected"
msgstr "لم يتم اختياره"
#: fields/background/background.php:66 fields/date/date.php:31
msgid "From"
msgstr ""
#: fields/background/background.php:84 fields/date/date.php:32
msgid "To"
msgstr ""
#: fields/background/background.php:102
msgid "Direction"
msgstr ""
#: fields/background/background.php:108
msgid "Gradient Direction"
msgstr ""
#: fields/background/background.php:109
msgid "&#8659; top to bottom"
msgstr ""
#: fields/background/background.php:110
msgid "&#8658; left to right"
msgstr ""
#: fields/background/background.php:111
msgid "&#8664; corner top to right"
msgstr ""
#: fields/background/background.php:112
msgid "&#8665; corner top to left"
msgstr ""
#: fields/background/background.php:155
msgid "Background Position"
msgstr "موضع الخلفية"
#: fields/background/background.php:156
msgid "Left Top"
msgstr ""
#: fields/background/background.php:157
msgid "Left Center"
msgstr ""
#: fields/background/background.php:158
msgid "Left Bottom"
msgstr ""
#: fields/background/background.php:159
msgid "Center Top"
msgstr ""
#: fields/background/background.php:160
msgid "Center Center"
msgstr ""
#: fields/background/background.php:161
msgid "Center Bottom"
msgstr ""
#: fields/background/background.php:162
msgid "Right Top"
msgstr ""
#: fields/background/background.php:163
msgid "Right Center"
msgstr ""
#: fields/background/background.php:164
msgid "Right Bottom"
msgstr ""
#: fields/background/background.php:178
msgid "Background Repeat"
msgstr "تكرار الخلفية"
#: fields/background/background.php:179
msgid "Repeat"
msgstr ""
#: fields/background/background.php:180
msgid "No Repeat"
msgstr ""
#: fields/background/background.php:181
msgid "Repeat Horizontally"
msgstr ""
#: fields/background/background.php:182
msgid "Repeat Vertically"
msgstr ""
#: fields/background/background.php:196
msgid "Background Attachment"
msgstr "خلفية ثابتة / متحركة"
#: fields/background/background.php:197
msgid "Scroll"
msgstr ""
#: fields/background/background.php:198
msgid "Fixed"
msgstr ""
#: fields/background/background.php:212
msgid "Background Size"
msgstr "حجم الخلفية"
#: fields/background/background.php:213
msgid "Cover"
msgstr ""
#: fields/background/background.php:214
msgid "Contain"
msgstr ""
#: fields/background/background.php:215
msgid "Auto"
msgstr ""
#: fields/background/background.php:229
msgid "Background Origin"
msgstr "أصل الخلفية"
#: fields/background/background.php:230 fields/background/background.php:248
msgid "Padding Box"
msgstr ""
#: fields/background/background.php:231 fields/background/background.php:247
msgid "Border Box"
msgstr ""
#: fields/background/background.php:232 fields/background/background.php:249
msgid "Content Box"
msgstr ""
#: fields/background/background.php:246
msgid "Background Clip"
msgstr "قصاصة الخلفية"
#: fields/background/background.php:263
msgid "Background Blend Mode"
msgstr ""
#: fields/background/background.php:264 fields/link_color/link_color.php:36
#: fields/typography/typography.php:175
msgid "Normal"
msgstr ""
#: fields/background/background.php:265
msgid "Multiply"
msgstr ""
#: fields/background/background.php:266
msgid "Screen"
msgstr ""
#: fields/background/background.php:267
msgid "Overlay"
msgstr ""
#: fields/background/background.php:268
msgid "Darken"
msgstr ""
#: fields/background/background.php:269
msgid "Lighten"
msgstr ""
#: fields/background/background.php:270
msgid "Color Dodge"
msgstr ""
#: fields/background/background.php:271
msgid "Saturation"
msgstr ""
#: fields/background/background.php:272
msgid "Color"
msgstr ""
#: fields/background/background.php:273
msgid "Luminosity"
msgstr ""
#: fields/backup/backup.php:26
msgid "Import"
msgstr "استيراد"
#: fields/backup/backup.php:29
msgid "Export & Download"
msgstr "تصدير& تنزيل"
#: fields/border/border.php:25 fields/spacing/spacing.php:25
msgid "top"
msgstr ""
#: fields/border/border.php:26 fields/spacing/spacing.php:26
msgid "right"
msgstr ""
#: fields/border/border.php:27 fields/spacing/spacing.php:27
msgid "bottom"
msgstr ""
#: fields/border/border.php:28 fields/spacing/spacing.php:28
msgid "left"
msgstr ""
#: fields/border/border.php:29 fields/spacing/spacing.php:29
msgid "all"
msgstr ""
#: fields/border/border.php:51 fields/typography/typography.php:203
msgid "Solid"
msgstr ""
#: fields/border/border.php:52 fields/typography/typography.php:206
msgid "Dashed"
msgstr ""
#: fields/border/border.php:53 fields/typography/typography.php:205
msgid "Dotted"
msgstr ""
#: fields/border/border.php:54 fields/typography/typography.php:204
msgid "Double"
msgstr ""
#: fields/border/border.php:55
msgid "Inset"
msgstr ""
#: fields/border/border.php:56
msgid "Outset"
msgstr ""
#: fields/border/border.php:57
msgid "Groove"
msgstr ""
#: fields/border/border.php:58
msgid "ridge"
msgstr ""
#: fields/border/border.php:59 fields/typography/typography.php:188
#: fields/typography/typography.php:202
msgid "None"
msgstr ""
#: fields/dimensions/dimensions.php:22
msgid "width"
msgstr ""
#: fields/dimensions/dimensions.php:23
msgid "height"
msgstr ""
#: fields/gallery/gallery.php:20
msgid "Add Gallery"
msgstr "أضف معرض صور"
#: fields/gallery/gallery.php:21
msgid "Edit Gallery"
msgstr "تحرير المعرض"
#: fields/gallery/gallery.php:22
msgid "Clear"
msgstr "مسح"
#: fields/group/group.php:35 fields/repeater/repeater.php:27
msgid "Error: Field ID conflict."
msgstr "خطأ: تعارض معرف الحقل."
#: fields/group/group.php:46 fields/group/group.php:87
#: fields/repeater/repeater.php:48 fields/repeater/repeater.php:76
msgid "Are you sure to delete this item?"
msgstr "هل أنت متأكد من رغبتك في الحذف؟"
#: fields/group/group.php:121 fields/repeater/repeater.php:89
msgid "You cannot add more."
msgstr "لا يمكنك إضافة المزيد."
#: fields/group/group.php:122 fields/repeater/repeater.php:90
msgid "You cannot remove more."
msgstr "لا يمكنك إزالة المزيد."
#: fields/icon/icon.php:20 fields/icon/icon.php:53
msgid "Add Icon"
msgstr "إضافة أيقونة"
#: fields/icon/icon.php:21
msgid "Remove Icon"
msgstr "إزالة الأيقونة"
#: fields/link/link.php:20
msgid "Add Link"
msgstr "أضف رابطاً"
#: fields/link/link.php:21
msgid "Edit Link"
msgstr "تحرير الرابط"
#: fields/link/link.php:22
msgid "Remove Link"
msgstr "إزالة الرابط"
#: fields/link_color/link_color.php:37
msgid "Hover"
msgstr ""
#: fields/link_color/link_color.php:38
msgid "Active"
msgstr ""
#: fields/link_color/link_color.php:39
msgid "Visited"
msgstr ""
#: fields/link_color/link_color.php:40
msgid "Focus"
msgstr ""
#: fields/map/map.php:24
msgid "Latitude"
msgstr "خط العرض"
#: fields/map/map.php:25
msgid "Longitude"
msgstr "خط الطول"
#: fields/media/media.php:23 fields/upload/upload.php:21
msgid "Upload"
msgstr "رفع"
#: fields/media/media.php:24 fields/upload/upload.php:22
msgid "Remove"
msgstr "إزالة"
#: fields/sorter/sorter.php:21
msgid "Enabled"
msgstr "مُفعل"
#: fields/sorter/sorter.php:22
msgid "Disabled"
msgstr "معطل"
#: fields/switcher/switcher.php:20
msgid "On"
msgstr ""
#: fields/switcher/switcher.php:21
msgid "Off"
msgstr ""
#: fields/typography/typography.php:85
msgid "Font Family"
msgstr ""
#: fields/typography/typography.php:86
msgid "Select a font"
msgstr ""
#: fields/typography/typography.php:94
msgid "Backup Font Family"
msgstr ""
#: fields/typography/typography.php:108 fields/typography/typography.php:121
#: fields/typography/typography.php:134 fields/typography/typography.php:149
#: fields/typography/typography.php:165 fields/typography/typography.php:178
#: fields/typography/typography.php:192 fields/typography/typography.php:210
msgid "Default"
msgstr ""
#: fields/typography/typography.php:119
msgid "Font Style"
msgstr ""
#: fields/typography/typography.php:133 fields/typography/typography.php:134
msgid "Load Extra Styles"
msgstr ""
#: fields/typography/typography.php:147
msgid "Subset"
msgstr ""
#: fields/typography/typography.php:157
msgid "Text Align"
msgstr ""
#: fields/typography/typography.php:159
msgid "Inherit"
msgstr ""
#: fields/typography/typography.php:160
msgid "Left"
msgstr ""
#: fields/typography/typography.php:161
msgid "Center"
msgstr ""
#: fields/typography/typography.php:162
msgid "Right"
msgstr ""
#: fields/typography/typography.php:163
msgid "Justify"
msgstr ""
#: fields/typography/typography.php:164
msgid "Initial"
msgstr ""
#: fields/typography/typography.php:173
msgid "Font Variant"
msgstr ""
#: fields/typography/typography.php:176
msgid "Small Caps"
msgstr ""
#: fields/typography/typography.php:177
msgid "All Small Caps"
msgstr ""
#: fields/typography/typography.php:186
msgid "Text Transform"
msgstr ""
#: fields/typography/typography.php:189
msgid "Capitalize"
msgstr ""
#: fields/typography/typography.php:190
msgid "Uppercase"
msgstr ""
#: fields/typography/typography.php:191
msgid "Lowercase"
msgstr ""
#: fields/typography/typography.php:200
msgid "Text Decoration"
msgstr ""
#: fields/typography/typography.php:207
msgid "Wavy"
msgstr ""
#: fields/typography/typography.php:208
msgid "Overline"
msgstr ""
#: fields/typography/typography.php:209
msgid "Line-through"
msgstr ""
#: fields/typography/typography.php:222
msgid "Font Size"
msgstr ""
#: fields/typography/typography.php:234
msgid "Line Height"
msgstr ""
#: fields/typography/typography.php:246
msgid "Letter Spacing"
msgstr ""
#: fields/typography/typography.php:258
msgid "Word Spacing"
msgstr ""
#: fields/typography/typography.php:273
msgid "Font Color"
msgstr ""
#: fields/typography/typography.php:284
msgid "Custom Style"
msgstr ""
#: fields/typography/typography.php:351
msgid "Custom Web Fonts"
msgstr ""
#: fields/typography/typography.php:357
msgid "Safe Web Fonts"
msgstr ""
#: fields/typography/typography.php:377
msgid "Google Web Fonts"
msgstr ""
#: functions/actions.php:72 functions/actions.php:110
msgid "Error: Invalid key."
msgstr "خطأ: مفتاح غير صالح."
#: functions/actions.php:114
msgid "Error: The response is not a valid JSON response."
msgstr "خطأ: الاستجابة لا تمثل رد JSON صحيح."
#: functions/actions.php:174
msgid "Error: Invalid term ID."
msgstr "خطأ: معرف (ID) العنصر غير صالح."
#: functions/actions.php:180
msgid "Error: You do not have permission to do that."
msgstr "\"خطأ: لا تملك الصلاحية للقيام بذلك."
#: functions/validate.php:14 functions/validate.php:86
msgid "Please enter a valid email address."
msgstr "الرجاء إدخال عنوان بريد إلكتروني صالح."
#: functions/validate.php:32 functions/validate.php:106
msgid "Please enter a valid number."
msgstr "يُرجى إدخال رقم صالح."
#: functions/validate.php:50 functions/validate.php:126
msgid "This field is required."
msgstr "هذا الحقل مطلوب"
#: functions/validate.php:68 functions/validate.php:146
msgid "Please enter a valid URL."
msgstr "من فضلك، أدخل رابط صحيح."
#~ msgid "Add Shortcode"
#~ msgstr "اضف كود مختصر"
#~ msgid "Select a shortcode"
#~ msgstr "اختيار كود مختصر"
#~ msgid "Insert Shortcode"
#~ msgstr "ادراج كود مختصر"
#~ msgid "Write shortcode here..."
#~ msgstr "كتابة الكود القصير هنا…"

View File

@@ -0,0 +1,664 @@
# Copyright (C) 2021 Codestar
# This file is distributed under the same license as the Codestar Framework package.
msgid ""
msgstr ""
"Project-Id-Version: Codestar Framework 2.2.1\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: az\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.7.1\n"
#: classes/admin-options.class.php:224
msgid "Error while saving the changes."
msgstr "Dəyişiklikləri qeyd edərkən xəta baş verdi."
#: classes/admin-options.class.php:284
msgid "Settings successfully imported."
msgstr "Parametrlər uğurla idxal edildi."
#: classes/admin-options.class.php:296 classes/admin-options.class.php:312
msgid "Default settings restored."
msgstr "Mövcud parametrlər bərpa edildi."
#: classes/admin-options.class.php:383
msgid "Settings saved."
msgstr "Parametrlər qeyd edildi."
#: classes/admin-options.class.php:561
msgid "You have unsaved changes, save your changes!"
msgstr "Dəyişməmisiniz, dəyişikliklərinizi qeyd edin!"
#: classes/admin-options.class.php:563
msgid "show all settings"
msgstr "bütün parametrləri göstərin"
#: classes/admin-options.class.php:565 fields/icon/icon.php:57
#: fields/map/map.php:23
msgid "Search..."
msgstr "Axtar..."
#: classes/admin-options.class.php:568 classes/admin-options.class.php:691
msgid "Save"
msgstr "Qeyd et"
#: classes/admin-options.class.php:568 classes/admin-options.class.php:691
msgid "Saving..."
msgstr "Yazılır..."
#: classes/admin-options.class.php:569 classes/admin-options.class.php:692
msgid "Reset Section"
msgstr "Bölməyi Sıfırla"
#: classes/admin-options.class.php:569 classes/admin-options.class.php:692
msgid "Are you sure to reset this section options?"
msgstr "Bu Bölmənin parametrlərini sıfırlamağa əminsiniz?"
#: classes/admin-options.class.php:570 classes/admin-options.class.php:693
msgid "Reset All"
msgstr "Hamısını Sıfırla"
#: classes/admin-options.class.php:570 classes/admin-options.class.php:693
#: classes/comment-options.class.php:213 classes/metabox-options.class.php:282
#: fields/backup/backup.php:31
msgid "Reset"
msgstr "Yenidən qur"
#: classes/admin-options.class.php:570 classes/admin-options.class.php:693
msgid "Are you sure you want to reset all settings to default values?"
msgstr "Bütün parametrlərini sıfırlamağa əminsiniz?"
#: classes/admin-options.class.php:668 classes/comment-options.class.php:196
#: classes/metabox-options.class.php:265 fields/button_set/button_set.php:56
#: fields/checkbox/checkbox.php:76 fields/radio/radio.php:75
#: fields/select/select.php:113 functions/actions.php:41
msgid "No data available."
msgstr "Məlumat yoxdur."
#: classes/comment-options.class.php:214 classes/metabox-options.class.php:283
msgid "update post"
msgstr "mesajı yeniləmə"
#: classes/comment-options.class.php:214 classes/metabox-options.class.php:283
msgid "Cancel"
msgstr "Vaz geç"
#: classes/setup.class.php:529
msgid "Are you sure?"
msgstr "Siz əminsinizmi?"
#: classes/setup.class.php:530
msgid "Please enter %s or more characters"
msgstr "Lütfən %s və ya daha çox simvol daxil edin"
#: classes/setup.class.php:531
msgid "Searching..."
msgstr "Axtarılır..."
#: classes/setup.class.php:532
msgid "No results found."
msgstr "Heç bir nəticə əldə edilmədi."
#: classes/setup.class.php:615
msgid "Oops! Not allowed."
msgstr "Əfsuslar! İcazəli deyildir."
#: classes/setup.class.php:689 classes/setup.class.php:693
msgid "Field not found!"
msgstr "Sahə tapılmadı."
#: classes/shortcode-options.class.php:251 fields/group/group.php:23
msgid "Add New"
msgstr "Yenisini əlavə et"
#: classes/shortcode-options.class.php:288 functions/actions.php:16
#: functions/actions.php:68 functions/actions.php:106 functions/actions.php:141
#: functions/actions.php:170
msgid "Error: Invalid nonce verification."
msgstr "Xəta: Etibarsız doğrulama yoxlaması."
#: fields/background/background.php:35 fields/media/media.php:57
msgid "Not selected"
msgstr "Seçilməyib"
#: fields/background/background.php:66 fields/date/date.php:31
msgid "From"
msgstr ""
#: fields/background/background.php:84 fields/date/date.php:32
msgid "To"
msgstr ""
#: fields/background/background.php:102
msgid "Direction"
msgstr ""
#: fields/background/background.php:108
msgid "Gradient Direction"
msgstr ""
#: fields/background/background.php:109
msgid "&#8659; top to bottom"
msgstr ""
#: fields/background/background.php:110
msgid "&#8658; left to right"
msgstr ""
#: fields/background/background.php:111
msgid "&#8664; corner top to right"
msgstr ""
#: fields/background/background.php:112
msgid "&#8665; corner top to left"
msgstr ""
#: fields/background/background.php:155
msgid "Background Position"
msgstr "Arxa fon mövqesi"
#: fields/background/background.php:156
msgid "Left Top"
msgstr ""
#: fields/background/background.php:157
msgid "Left Center"
msgstr ""
#: fields/background/background.php:158
msgid "Left Bottom"
msgstr ""
#: fields/background/background.php:159
msgid "Center Top"
msgstr ""
#: fields/background/background.php:160
msgid "Center Center"
msgstr ""
#: fields/background/background.php:161
msgid "Center Bottom"
msgstr ""
#: fields/background/background.php:162
msgid "Right Top"
msgstr ""
#: fields/background/background.php:163
msgid "Right Center"
msgstr ""
#: fields/background/background.php:164
msgid "Right Bottom"
msgstr ""
#: fields/background/background.php:178
msgid "Background Repeat"
msgstr "Arxa fonu təkrarla"
#: fields/background/background.php:179
msgid "Repeat"
msgstr ""
#: fields/background/background.php:180
msgid "No Repeat"
msgstr ""
#: fields/background/background.php:181
msgid "Repeat Horizontally"
msgstr ""
#: fields/background/background.php:182
msgid "Repeat Vertically"
msgstr ""
#: fields/background/background.php:196
msgid "Background Attachment"
msgstr "Arxa fon əlavəsi"
#: fields/background/background.php:197
msgid "Scroll"
msgstr ""
#: fields/background/background.php:198
msgid "Fixed"
msgstr ""
#: fields/background/background.php:212
msgid "Background Size"
msgstr "Arxa fon ölçüsü"
#: fields/background/background.php:213
msgid "Cover"
msgstr ""
#: fields/background/background.php:214
msgid "Contain"
msgstr ""
#: fields/background/background.php:215
msgid "Auto"
msgstr ""
#: fields/background/background.php:229
msgid "Background Origin"
msgstr "Arxa fon mənşəyi"
#: fields/background/background.php:230 fields/background/background.php:248
msgid "Padding Box"
msgstr ""
#: fields/background/background.php:231 fields/background/background.php:247
msgid "Border Box"
msgstr ""
#: fields/background/background.php:232 fields/background/background.php:249
msgid "Content Box"
msgstr ""
#: fields/background/background.php:246
msgid "Background Clip"
msgstr "Arxa fon şablonu"
#: fields/background/background.php:263
msgid "Background Blend Mode"
msgstr ""
#: fields/background/background.php:264 fields/link_color/link_color.php:36
#: fields/typography/typography.php:175
msgid "Normal"
msgstr ""
#: fields/background/background.php:265
msgid "Multiply"
msgstr ""
#: fields/background/background.php:266
msgid "Screen"
msgstr ""
#: fields/background/background.php:267
msgid "Overlay"
msgstr ""
#: fields/background/background.php:268
msgid "Darken"
msgstr ""
#: fields/background/background.php:269
msgid "Lighten"
msgstr ""
#: fields/background/background.php:270
msgid "Color Dodge"
msgstr ""
#: fields/background/background.php:271
msgid "Saturation"
msgstr ""
#: fields/background/background.php:272
msgid "Color"
msgstr ""
#: fields/background/background.php:273
msgid "Luminosity"
msgstr ""
#: fields/backup/backup.php:26
msgid "Import"
msgstr "İdxal"
#: fields/backup/backup.php:29
msgid "Export & Download"
msgstr "İxrac & Yükləyin"
#: fields/border/border.php:25 fields/spacing/spacing.php:25
msgid "top"
msgstr ""
#: fields/border/border.php:26 fields/spacing/spacing.php:26
msgid "right"
msgstr ""
#: fields/border/border.php:27 fields/spacing/spacing.php:27
msgid "bottom"
msgstr ""
#: fields/border/border.php:28 fields/spacing/spacing.php:28
msgid "left"
msgstr ""
#: fields/border/border.php:29 fields/spacing/spacing.php:29
msgid "all"
msgstr ""
#: fields/border/border.php:51 fields/typography/typography.php:203
msgid "Solid"
msgstr ""
#: fields/border/border.php:52 fields/typography/typography.php:206
msgid "Dashed"
msgstr ""
#: fields/border/border.php:53 fields/typography/typography.php:205
msgid "Dotted"
msgstr ""
#: fields/border/border.php:54 fields/typography/typography.php:204
msgid "Double"
msgstr ""
#: fields/border/border.php:55
msgid "Inset"
msgstr ""
#: fields/border/border.php:56
msgid "Outset"
msgstr ""
#: fields/border/border.php:57
msgid "Groove"
msgstr ""
#: fields/border/border.php:58
msgid "ridge"
msgstr ""
#: fields/border/border.php:59 fields/typography/typography.php:188
#: fields/typography/typography.php:202
msgid "None"
msgstr ""
#: fields/dimensions/dimensions.php:22
msgid "width"
msgstr ""
#: fields/dimensions/dimensions.php:23
msgid "height"
msgstr ""
#: fields/gallery/gallery.php:20
msgid "Add Gallery"
msgstr "Qalereya əlavə et"
#: fields/gallery/gallery.php:21
msgid "Edit Gallery"
msgstr "Qalereyanı redaktə et"
#: fields/gallery/gallery.php:22
msgid "Clear"
msgstr "Təmizlə"
#: fields/group/group.php:35 fields/repeater/repeater.php:27
msgid "Error: Field ID conflict."
msgstr "Xəta: Sahə şəxsiyyət ziddiyyəti."
#: fields/group/group.php:46 fields/group/group.php:87
#: fields/repeater/repeater.php:48 fields/repeater/repeater.php:76
msgid "Are you sure to delete this item?"
msgstr "Bu elementi silmək istədiyinizə əminsiniz?"
#: fields/group/group.php:121 fields/repeater/repeater.php:89
msgid "You cannot add more."
msgstr "Daha çox əlavə edə bilməzsiniz."
#: fields/group/group.php:122 fields/repeater/repeater.php:90
msgid "You cannot remove more."
msgstr "Daha çoxunu çıxara bilməzsiniz."
#: fields/icon/icon.php:20 fields/icon/icon.php:53
msgid "Add Icon"
msgstr "İkon Əlavə et"
#: fields/icon/icon.php:21
msgid "Remove Icon"
msgstr "İkonu Sil"
#: fields/link/link.php:20
msgid "Add Link"
msgstr "Bağlantı əlavə et"
#: fields/link/link.php:21
msgid "Edit Link"
msgstr "Bağlantını Dəiyşdir"
#: fields/link/link.php:22
msgid "Remove Link"
msgstr "Bağlantını Sil"
#: fields/link_color/link_color.php:37
msgid "Hover"
msgstr ""
#: fields/link_color/link_color.php:38
msgid "Active"
msgstr ""
#: fields/link_color/link_color.php:39
msgid "Visited"
msgstr ""
#: fields/link_color/link_color.php:40
msgid "Focus"
msgstr ""
#: fields/map/map.php:24
msgid "Latitude"
msgstr "Enlem"
#: fields/map/map.php:25
msgid "Longitude"
msgstr "Uzunluq"
#: fields/media/media.php:23 fields/upload/upload.php:21
msgid "Upload"
msgstr "Yüklə"
#: fields/media/media.php:24 fields/upload/upload.php:22
msgid "Remove"
msgstr "Çıxar"
#: fields/sorter/sorter.php:21
msgid "Enabled"
msgstr "Aktiv"
#: fields/sorter/sorter.php:22
msgid "Disabled"
msgstr "Aktiv deyil"
#: fields/switcher/switcher.php:20
msgid "On"
msgstr ""
#: fields/switcher/switcher.php:21
msgid "Off"
msgstr ""
#: fields/typography/typography.php:85
msgid "Font Family"
msgstr ""
#: fields/typography/typography.php:86
msgid "Select a font"
msgstr ""
#: fields/typography/typography.php:94
msgid "Backup Font Family"
msgstr ""
#: fields/typography/typography.php:108 fields/typography/typography.php:121
#: fields/typography/typography.php:134 fields/typography/typography.php:149
#: fields/typography/typography.php:165 fields/typography/typography.php:178
#: fields/typography/typography.php:192 fields/typography/typography.php:210
msgid "Default"
msgstr ""
#: fields/typography/typography.php:119
msgid "Font Style"
msgstr ""
#: fields/typography/typography.php:133 fields/typography/typography.php:134
msgid "Load Extra Styles"
msgstr ""
#: fields/typography/typography.php:147
msgid "Subset"
msgstr ""
#: fields/typography/typography.php:157
msgid "Text Align"
msgstr ""
#: fields/typography/typography.php:159
msgid "Inherit"
msgstr ""
#: fields/typography/typography.php:160
msgid "Left"
msgstr ""
#: fields/typography/typography.php:161
msgid "Center"
msgstr ""
#: fields/typography/typography.php:162
msgid "Right"
msgstr ""
#: fields/typography/typography.php:163
msgid "Justify"
msgstr ""
#: fields/typography/typography.php:164
msgid "Initial"
msgstr ""
#: fields/typography/typography.php:173
msgid "Font Variant"
msgstr ""
#: fields/typography/typography.php:176
msgid "Small Caps"
msgstr ""
#: fields/typography/typography.php:177
msgid "All Small Caps"
msgstr ""
#: fields/typography/typography.php:186
msgid "Text Transform"
msgstr ""
#: fields/typography/typography.php:189
msgid "Capitalize"
msgstr ""
#: fields/typography/typography.php:190
msgid "Uppercase"
msgstr ""
#: fields/typography/typography.php:191
msgid "Lowercase"
msgstr ""
#: fields/typography/typography.php:200
msgid "Text Decoration"
msgstr ""
#: fields/typography/typography.php:207
msgid "Wavy"
msgstr ""
#: fields/typography/typography.php:208
msgid "Overline"
msgstr ""
#: fields/typography/typography.php:209
msgid "Line-through"
msgstr ""
#: fields/typography/typography.php:222
msgid "Font Size"
msgstr ""
#: fields/typography/typography.php:234
msgid "Line Height"
msgstr ""
#: fields/typography/typography.php:246
msgid "Letter Spacing"
msgstr ""
#: fields/typography/typography.php:258
msgid "Word Spacing"
msgstr ""
#: fields/typography/typography.php:273
msgid "Font Color"
msgstr ""
#: fields/typography/typography.php:284
msgid "Custom Style"
msgstr ""
#: fields/typography/typography.php:351
msgid "Custom Web Fonts"
msgstr ""
#: fields/typography/typography.php:357
msgid "Safe Web Fonts"
msgstr ""
#: fields/typography/typography.php:377
msgid "Google Web Fonts"
msgstr ""
#: functions/actions.php:72 functions/actions.php:110
msgid "Error: Invalid key."
msgstr "Xəta: Keçərsiz açar."
#: functions/actions.php:114
msgid "Error: The response is not a valid JSON response."
msgstr "Xəta: Cavab düzgün JSON cavabı deyil."
#: functions/actions.php:174
msgid "Error: Invalid term ID."
msgstr "Xəta: Xətalı termin ID."
#: functions/actions.php:180
msgid "Error: You do not have permission to do that."
msgstr "Xəta: Bunu etməyə icazəniz yoxdur."
#: functions/validate.php:14 functions/validate.php:86
msgid "Please enter a valid email address."
msgstr "Lütfən keçərli bir e-poşt ünvanı daxil edin."
#: functions/validate.php:32 functions/validate.php:106
msgid "Please enter a valid number."
msgstr "Lütfən keçərli bir nömrəni daxil edin."
#: functions/validate.php:50 functions/validate.php:126
msgid "This field is required."
msgstr "Bu sahə tələb olunur."
#: functions/validate.php:68 functions/validate.php:146
msgid "Please enter a valid URL."
msgstr "Lütfən keçərli bir veb ünvanı daxil edin."
#~ msgid "Add Shortcode"
#~ msgstr "Qısal kod əlavə edin"
#~ msgid "Select a shortcode"
#~ msgstr "Qısa kod seçin"
#~ msgid "Insert Shortcode"
#~ msgstr "Qısa kodu əlavə edin"
#~ msgid "Write shortcode here..."
#~ msgstr "Qısa kodu buraya yazın..."

View File

@@ -0,0 +1,664 @@
# Copyright (C) 2021 Codestar
# This file is distributed under the same license as the Codestar Framework package.
msgid ""
msgstr ""
"Project-Id-Version: Codestar Framework 2.2.1\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: bn_BD\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.7.1\n"
#: classes/admin-options.class.php:224
msgid "Error while saving the changes."
msgstr "পরিবর্তনগুলো সংরক্ষণের সময় কোন একটা সমস্যা হয়েছে।"
#: classes/admin-options.class.php:284
msgid "Settings successfully imported."
msgstr "সেটিংস সফলভাবে আমদানি করা হয়েছে।"
#: classes/admin-options.class.php:296 classes/admin-options.class.php:312
msgid "Default settings restored."
msgstr "ডিফল্ট সেটিংস পুনরুদ্ধার করা হয়েছে।"
#: classes/admin-options.class.php:383
msgid "Settings saved."
msgstr "সেটিংসমূহ সংরক্ষিত।"
#: classes/admin-options.class.php:561
msgid "You have unsaved changes, save your changes!"
msgstr "আপনি অসংরক্ষিত পরিবর্তন আছে, আপনার পরিবর্তনসমূহ সংরক্ষণ করুন। "
#: classes/admin-options.class.php:563
msgid "show all settings"
msgstr "সমস্ত সেটিংস প্রদর্শন করুন"
#: classes/admin-options.class.php:565 fields/icon/icon.php:57
#: fields/map/map.php:23
msgid "Search..."
msgstr "অনুসন্ধান করুন..."
#: classes/admin-options.class.php:568 classes/admin-options.class.php:691
msgid "Save"
msgstr "সংরক্ষণ"
#: classes/admin-options.class.php:568 classes/admin-options.class.php:691
msgid "Saving..."
msgstr "সংরক্ষণ হচ্ছে..."
#: classes/admin-options.class.php:569 classes/admin-options.class.php:692
msgid "Reset Section"
msgstr "সেকশন রিসেট করো"
#: classes/admin-options.class.php:569 classes/admin-options.class.php:692
msgid "Are you sure to reset this section options?"
msgstr "আপনি কি নিশ্চিত?"
#: classes/admin-options.class.php:570 classes/admin-options.class.php:693
msgid "Reset All"
msgstr "সব রিসেট করো"
#: classes/admin-options.class.php:570 classes/admin-options.class.php:693
#: classes/comment-options.class.php:213 classes/metabox-options.class.php:282
#: fields/backup/backup.php:31
msgid "Reset"
msgstr "রিসেট"
#: classes/admin-options.class.php:570 classes/admin-options.class.php:693
msgid "Are you sure you want to reset all settings to default values?"
msgstr "আপনি কি নিশ্চিত?"
#: classes/admin-options.class.php:668 classes/comment-options.class.php:196
#: classes/metabox-options.class.php:265 fields/button_set/button_set.php:56
#: fields/checkbox/checkbox.php:76 fields/radio/radio.php:75
#: fields/select/select.php:113 functions/actions.php:41
msgid "No data available."
msgstr "ডাটা নেই।"
#: classes/comment-options.class.php:214 classes/metabox-options.class.php:283
msgid "update post"
msgstr "আপডেট পোস্ট"
#: classes/comment-options.class.php:214 classes/metabox-options.class.php:283
msgid "Cancel"
msgstr "বাতিল"
#: classes/setup.class.php:529
msgid "Are you sure?"
msgstr "আপনি কি নিশ্চিত?"
#: classes/setup.class.php:530
msgid "Please enter %s or more characters"
msgstr "%s বা আরও অক্ষর লিখুন দয়া করে"
#: classes/setup.class.php:531
msgid "Searching..."
msgstr "অনুসন্ধান করা হচ্ছে..."
#: classes/setup.class.php:532
msgid "No results found."
msgstr "কোন ফলাফল পাওয়া যায়নি।"
#: classes/setup.class.php:615
msgid "Oops! Not allowed."
msgstr "ওহো! অনুমতি নেই।"
#: classes/setup.class.php:689 classes/setup.class.php:693
msgid "Field not found!"
msgstr "মাঠ পাওয়া গেল না!"
#: classes/shortcode-options.class.php:251 fields/group/group.php:23
msgid "Add New"
msgstr "নতুন যুক্ত করুন"
#: classes/shortcode-options.class.php:288 functions/actions.php:16
#: functions/actions.php:68 functions/actions.php:106 functions/actions.php:141
#: functions/actions.php:170
msgid "Error: Invalid nonce verification."
msgstr "ত্রুটি: অবৈধ নন যাচাইকরণ।"
#: fields/background/background.php:35 fields/media/media.php:57
msgid "Not selected"
msgstr "অনির্বাচিত"
#: fields/background/background.php:66 fields/date/date.php:31
msgid "From"
msgstr ""
#: fields/background/background.php:84 fields/date/date.php:32
msgid "To"
msgstr ""
#: fields/background/background.php:102
msgid "Direction"
msgstr ""
#: fields/background/background.php:108
msgid "Gradient Direction"
msgstr ""
#: fields/background/background.php:109
msgid "&#8659; top to bottom"
msgstr ""
#: fields/background/background.php:110
msgid "&#8658; left to right"
msgstr ""
#: fields/background/background.php:111
msgid "&#8664; corner top to right"
msgstr ""
#: fields/background/background.php:112
msgid "&#8665; corner top to left"
msgstr ""
#: fields/background/background.php:155
msgid "Background Position"
msgstr "ব্যকগ্রাউন্ডের অবস্থান"
#: fields/background/background.php:156
msgid "Left Top"
msgstr ""
#: fields/background/background.php:157
msgid "Left Center"
msgstr ""
#: fields/background/background.php:158
msgid "Left Bottom"
msgstr ""
#: fields/background/background.php:159
msgid "Center Top"
msgstr ""
#: fields/background/background.php:160
msgid "Center Center"
msgstr ""
#: fields/background/background.php:161
msgid "Center Bottom"
msgstr ""
#: fields/background/background.php:162
msgid "Right Top"
msgstr ""
#: fields/background/background.php:163
msgid "Right Center"
msgstr ""
#: fields/background/background.php:164
msgid "Right Bottom"
msgstr ""
#: fields/background/background.php:178
msgid "Background Repeat"
msgstr "ব্যকগ্রাউন্ড পুনরাবৃত্তি"
#: fields/background/background.php:179
msgid "Repeat"
msgstr ""
#: fields/background/background.php:180
msgid "No Repeat"
msgstr ""
#: fields/background/background.php:181
msgid "Repeat Horizontally"
msgstr ""
#: fields/background/background.php:182
msgid "Repeat Vertically"
msgstr ""
#: fields/background/background.php:196
msgid "Background Attachment"
msgstr "ব্যকগ্রাউন্ড সংযুক্তি"
#: fields/background/background.php:197
msgid "Scroll"
msgstr ""
#: fields/background/background.php:198
msgid "Fixed"
msgstr ""
#: fields/background/background.php:212
msgid "Background Size"
msgstr "পটভূমি উত্স"
#: fields/background/background.php:213
msgid "Cover"
msgstr ""
#: fields/background/background.php:214
msgid "Contain"
msgstr ""
#: fields/background/background.php:215
msgid "Auto"
msgstr ""
#: fields/background/background.php:229
msgid "Background Origin"
msgstr "পটভূমি উত্স"
#: fields/background/background.php:230 fields/background/background.php:248
msgid "Padding Box"
msgstr ""
#: fields/background/background.php:231 fields/background/background.php:247
msgid "Border Box"
msgstr ""
#: fields/background/background.php:232 fields/background/background.php:249
msgid "Content Box"
msgstr ""
#: fields/background/background.php:246
msgid "Background Clip"
msgstr "পটভূমি ক্লিপ"
#: fields/background/background.php:263
msgid "Background Blend Mode"
msgstr ""
#: fields/background/background.php:264 fields/link_color/link_color.php:36
#: fields/typography/typography.php:175
msgid "Normal"
msgstr ""
#: fields/background/background.php:265
msgid "Multiply"
msgstr ""
#: fields/background/background.php:266
msgid "Screen"
msgstr ""
#: fields/background/background.php:267
msgid "Overlay"
msgstr ""
#: fields/background/background.php:268
msgid "Darken"
msgstr ""
#: fields/background/background.php:269
msgid "Lighten"
msgstr ""
#: fields/background/background.php:270
msgid "Color Dodge"
msgstr ""
#: fields/background/background.php:271
msgid "Saturation"
msgstr ""
#: fields/background/background.php:272
msgid "Color"
msgstr ""
#: fields/background/background.php:273
msgid "Luminosity"
msgstr ""
#: fields/backup/backup.php:26
msgid "Import"
msgstr "আমদানী"
#: fields/backup/backup.php:29
msgid "Export & Download"
msgstr "রপ্তানী ও ডাউনলোড"
#: fields/border/border.php:25 fields/spacing/spacing.php:25
msgid "top"
msgstr ""
#: fields/border/border.php:26 fields/spacing/spacing.php:26
msgid "right"
msgstr ""
#: fields/border/border.php:27 fields/spacing/spacing.php:27
msgid "bottom"
msgstr ""
#: fields/border/border.php:28 fields/spacing/spacing.php:28
msgid "left"
msgstr ""
#: fields/border/border.php:29 fields/spacing/spacing.php:29
msgid "all"
msgstr ""
#: fields/border/border.php:51 fields/typography/typography.php:203
msgid "Solid"
msgstr ""
#: fields/border/border.php:52 fields/typography/typography.php:206
msgid "Dashed"
msgstr ""
#: fields/border/border.php:53 fields/typography/typography.php:205
msgid "Dotted"
msgstr ""
#: fields/border/border.php:54 fields/typography/typography.php:204
msgid "Double"
msgstr ""
#: fields/border/border.php:55
msgid "Inset"
msgstr ""
#: fields/border/border.php:56
msgid "Outset"
msgstr ""
#: fields/border/border.php:57
msgid "Groove"
msgstr ""
#: fields/border/border.php:58
msgid "ridge"
msgstr ""
#: fields/border/border.php:59 fields/typography/typography.php:188
#: fields/typography/typography.php:202
msgid "None"
msgstr ""
#: fields/dimensions/dimensions.php:22
msgid "width"
msgstr ""
#: fields/dimensions/dimensions.php:23
msgid "height"
msgstr ""
#: fields/gallery/gallery.php:20
msgid "Add Gallery"
msgstr "গ্যালারী যুক্ত"
#: fields/gallery/gallery.php:21
msgid "Edit Gallery"
msgstr "গ্যালারি সম্পাদনা"
#: fields/gallery/gallery.php:22
msgid "Clear"
msgstr "মুছুন"
#: fields/group/group.php:35 fields/repeater/repeater.php:27
msgid "Error: Field ID conflict."
msgstr "ত্রুটি: ফিল্ড আইডি দ্বন্দ্ব।"
#: fields/group/group.php:46 fields/group/group.php:87
#: fields/repeater/repeater.php:48 fields/repeater/repeater.php:76
msgid "Are you sure to delete this item?"
msgstr "আপনি কি নিশ্চিত?"
#: fields/group/group.php:121 fields/repeater/repeater.php:89
msgid "You cannot add more."
msgstr "আপনি আরও যোগ করতে পারবেন না।"
#: fields/group/group.php:122 fields/repeater/repeater.php:90
msgid "You cannot remove more."
msgstr "আপনি আরও সরাতে পারবেন না।"
#: fields/icon/icon.php:20 fields/icon/icon.php:53
msgid "Add Icon"
msgstr "আইকন যুক্ত"
#: fields/icon/icon.php:21
msgid "Remove Icon"
msgstr "আইকন রিমোভ"
#: fields/link/link.php:20
msgid "Add Link"
msgstr "লিংক যুক্ত করুন"
#: fields/link/link.php:21
msgid "Edit Link"
msgstr "লিংক এডিট"
#: fields/link/link.php:22
msgid "Remove Link"
msgstr "লিংক সরিয়ে ফেলুন"
#: fields/link_color/link_color.php:37
msgid "Hover"
msgstr ""
#: fields/link_color/link_color.php:38
msgid "Active"
msgstr ""
#: fields/link_color/link_color.php:39
msgid "Visited"
msgstr ""
#: fields/link_color/link_color.php:40
msgid "Focus"
msgstr ""
#: fields/map/map.php:24
msgid "Latitude"
msgstr "অক্ষাংশ"
#: fields/map/map.php:25
msgid "Longitude"
msgstr "দ্রাঘিমাংশ"
#: fields/media/media.php:23 fields/upload/upload.php:21
msgid "Upload"
msgstr "আপলোড"
#: fields/media/media.php:24 fields/upload/upload.php:22
msgid "Remove"
msgstr "অপসারণ"
#: fields/sorter/sorter.php:21
msgid "Enabled"
msgstr "সক্রিয়"
#: fields/sorter/sorter.php:22
msgid "Disabled"
msgstr "নিষ্ক্রিয় করা আছে"
#: fields/switcher/switcher.php:20
msgid "On"
msgstr ""
#: fields/switcher/switcher.php:21
msgid "Off"
msgstr ""
#: fields/typography/typography.php:85
msgid "Font Family"
msgstr ""
#: fields/typography/typography.php:86
msgid "Select a font"
msgstr ""
#: fields/typography/typography.php:94
msgid "Backup Font Family"
msgstr ""
#: fields/typography/typography.php:108 fields/typography/typography.php:121
#: fields/typography/typography.php:134 fields/typography/typography.php:149
#: fields/typography/typography.php:165 fields/typography/typography.php:178
#: fields/typography/typography.php:192 fields/typography/typography.php:210
msgid "Default"
msgstr ""
#: fields/typography/typography.php:119
msgid "Font Style"
msgstr ""
#: fields/typography/typography.php:133 fields/typography/typography.php:134
msgid "Load Extra Styles"
msgstr ""
#: fields/typography/typography.php:147
msgid "Subset"
msgstr ""
#: fields/typography/typography.php:157
msgid "Text Align"
msgstr ""
#: fields/typography/typography.php:159
msgid "Inherit"
msgstr ""
#: fields/typography/typography.php:160
msgid "Left"
msgstr ""
#: fields/typography/typography.php:161
msgid "Center"
msgstr ""
#: fields/typography/typography.php:162
msgid "Right"
msgstr ""
#: fields/typography/typography.php:163
msgid "Justify"
msgstr ""
#: fields/typography/typography.php:164
msgid "Initial"
msgstr ""
#: fields/typography/typography.php:173
msgid "Font Variant"
msgstr ""
#: fields/typography/typography.php:176
msgid "Small Caps"
msgstr ""
#: fields/typography/typography.php:177
msgid "All Small Caps"
msgstr ""
#: fields/typography/typography.php:186
msgid "Text Transform"
msgstr ""
#: fields/typography/typography.php:189
msgid "Capitalize"
msgstr ""
#: fields/typography/typography.php:190
msgid "Uppercase"
msgstr ""
#: fields/typography/typography.php:191
msgid "Lowercase"
msgstr ""
#: fields/typography/typography.php:200
msgid "Text Decoration"
msgstr ""
#: fields/typography/typography.php:207
msgid "Wavy"
msgstr ""
#: fields/typography/typography.php:208
msgid "Overline"
msgstr ""
#: fields/typography/typography.php:209
msgid "Line-through"
msgstr ""
#: fields/typography/typography.php:222
msgid "Font Size"
msgstr ""
#: fields/typography/typography.php:234
msgid "Line Height"
msgstr ""
#: fields/typography/typography.php:246
msgid "Letter Spacing"
msgstr ""
#: fields/typography/typography.php:258
msgid "Word Spacing"
msgstr ""
#: fields/typography/typography.php:273
msgid "Font Color"
msgstr ""
#: fields/typography/typography.php:284
msgid "Custom Style"
msgstr ""
#: fields/typography/typography.php:351
msgid "Custom Web Fonts"
msgstr ""
#: fields/typography/typography.php:357
msgid "Safe Web Fonts"
msgstr ""
#: fields/typography/typography.php:377
msgid "Google Web Fonts"
msgstr ""
#: functions/actions.php:72 functions/actions.php:110
msgid "Error: Invalid key."
msgstr "ত্রুটি: অবৈধ কী।"
#: functions/actions.php:114
msgid "Error: The response is not a valid JSON response."
msgstr "ত্রুটি: রেসপন্সটি সঠিক JSON রেসপন্স নয়।"
#: functions/actions.php:174
msgid "Error: Invalid term ID."
msgstr "ত্রুটি: অবৈধ টার্ম আইডি।"
#: functions/actions.php:180
msgid "Error: You do not have permission to do that."
msgstr "ত্রুটি: আপনার এটি করার অনুমতি নেই।"
#: functions/validate.php:14 functions/validate.php:86
msgid "Please enter a valid email address."
msgstr "অনুগ্রহ করে একটি সঠিক ইমেইল অ্যাড্রেস প্রদান করুন।"
#: functions/validate.php:32 functions/validate.php:106
msgid "Please enter a valid number."
msgstr "দয়া করে একটি বৈধ নম্বর লিখুন।"
#: functions/validate.php:50 functions/validate.php:126
msgid "This field is required."
msgstr "ঘরটি অবশ্যই পূরণ করতে হবে।"
#: functions/validate.php:68 functions/validate.php:146
msgid "Please enter a valid URL."
msgstr "দয়া করে একটি অনুমোদিত ইউআরএল লিখুন।"
#~ msgid "Add Shortcode"
#~ msgstr "শর্টকোড যুক্ত করুন"
#~ msgid "Select a shortcode"
#~ msgstr "একটি শর্টকোড নির্বাচন করুন"
#~ msgid "Insert Shortcode"
#~ msgstr "যুক্ত করুন"
#~ msgid "Write shortcode here..."
#~ msgstr "এখানে শর্টকোড লিখুন..."

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