Skip to content

Commit c7dab9a

Browse files
committed
v2.2.9
0 parents  commit c7dab9a

File tree

120 files changed

+27261
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+27261
-0
lines changed

LICENSE.md

Lines changed: 339 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
[![Codestar Framework](http://s3.codestarthemes.com/codecanyon/23079100/github-banner.png)](http://codestarframework.com/)
2+
3+
# Codestar Framework
4+
A Simple and Lightweight WordPress Option Framework for Themes and Plugins. Built in Object Oriented Programming paradigm with high number of custom fields and tons of options. Allows you to bring custom admin, metabox, taxonomy and customize settings to all of your pages, posts and categories. It's highly modern and advanced framework.
5+
6+
## Contents
7+
- [Demo](#demo)
8+
- [Installation](#installation)
9+
- [Quick Start](#quick-start)
10+
- [Documentation](#documentation)
11+
- [Free vs Premium](#free-vs-premium)
12+
- [Support](#support)
13+
- [Release Notes](#release-notes)
14+
- [License](#license)
15+
16+
## Demo
17+
For usage and examples, have a look at :rocket: [online demo](http://codestarthemes.com/plugins/codestar-framework/wp-login.php?login=demo)
18+
19+
## Installation
20+
21+
1. Download the installable WordPress plugin zip.
22+
2. Upload and active plugin from `WordPress` → `Plugins` → `Add New`
23+
3. After activation, next step is to configure your settings. You can do it from here :gear: [configurations](http://codestarframework.com/documentation/#/configurations)
24+
25+
## Quick Start
26+
27+
Open your current theme **functions.php** file and paste this code.
28+
29+
```php
30+
// Check core class for avoid errors
31+
if( class_exists( 'CSF' ) ) {
32+
33+
// Set a unique slug-like ID
34+
$prefix = 'my_framework';
35+
36+
// Create options
37+
CSF::createOptions( $prefix, array(
38+
'menu_title' => 'My Framework',
39+
'menu_slug' => 'my-framework',
40+
) );
41+
42+
// Create a section
43+
CSF::createSection( $prefix, array(
44+
'title' => 'Tab Title 1',
45+
'fields' => array(
46+
47+
// A text field
48+
array(
49+
'id' => 'opt-text',
50+
'type' => 'text',
51+
'title' => 'Simple Text',
52+
),
53+
54+
)
55+
) );
56+
57+
// Create a section
58+
CSF::createSection( $prefix, array(
59+
'title' => 'Tab Title 2',
60+
'fields' => array(
61+
62+
// A textarea field
63+
array(
64+
'id' => 'opt-textarea',
65+
'type' => 'textarea',
66+
'title' => 'Simple Textarea',
67+
),
68+
69+
)
70+
) );
71+
72+
}
73+
```
74+
How to get option value ?
75+
```php
76+
$options = get_option( 'my_framework' ); // unique id of the framework
77+
78+
echo $options['opt-text']; // id of the field
79+
echo $options['opt-textarea']; // id of the field
80+
```
81+
82+
## Documentation
83+
Read the documentation for details :closed_book: [documentation](http://codestarframework.com/documentation/)
84+
85+
## Free vs Premium
86+
87+
| Features | Free Version | Premium Version
88+
|:-----------------------------|:------------------:|:-----------------:
89+
| Admin Option Framework | :heavy_check_mark: | :heavy_check_mark:
90+
| Customize Option Framework | :x: | :heavy_check_mark:
91+
| Metabox Option Framework | :x: | :heavy_check_mark:
92+
| Nav Menu Option Framework | :x: | :heavy_check_mark:
93+
| Taxonomy Option Framework | :x: | :heavy_check_mark:
94+
| Profile Option Framework | :x: | :heavy_check_mark:
95+
| Comment Option Framework | :x: | :heavy_check_mark:
96+
| Widget Option Framework | :x: | :heavy_check_mark:
97+
| Shortcode Option Framework | :x: | :heavy_check_mark:
98+
| All Option Fields | :x: | :heavy_check_mark:
99+
| Developer Packages | :x: | :heavy_check_mark:
100+
| Unminfy Library | :x: | :heavy_check_mark:
101+
| New Requests | :x: | :heavy_check_mark:
102+
| Autoremove Advertisements | :x: | :heavy_check_mark:
103+
| Life-time access/updates | :x: | :heavy_check_mark:
104+
| | | :star2: <a href="http://codestarframework.com/">Upgrade Premium Version</a>
105+
106+
## Available Option Fields
107+
108+
| Accordion | Color | Icon | Select | Tabbed
109+
|:------------|:------------|:-------------|:---------|:---
110+
| Background | Color Group | Image Select | Slider | Text
111+
| Backup | Date | Link Color | Sortable | Textarea
112+
| Border | Dimensions | Media | Sorter | Typography
113+
| Button Set | Fieldset | Palette | Spacing | Upload
114+
| Checkbox | Gallery | Radio | Spinner | WP Editor
115+
| Code Editor | Group | Repeater | Switcher | Others
116+
117+
## Support
118+
119+
We are provide [support forum](http://support.codestarthemes.com/) for premium version users. You can join to support forum for submit any question after purchasing. Free version users support is limited on [github](https://github.com/Codestar/codestar-framework/issues).
120+
121+
## Release Notes
122+
Check out the [release notes](http://codestarframework.com/documentation/#/relnotes)
123+
124+
## License
125+
Codestar Framework have two different version. Free version has limited features and offers only admin option panel feature. Premium version offers all extensions and more of settings for the best experience and advanced features. You can bundle the framework ( both free and premium ) in your free theme/plugin that you publish inside WordPress.org theme/plugin directory or in premium theme/plugin that you sell on your own website or in marketplaces like ThemeForest. This framework is licensed 100% GPL.

assets/css/style-rtl.min.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/style.min.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/images/checkerboard.png

2.29 KB
Loading

assets/images/wp-logo.svg

Lines changed: 1 addition & 0 deletions
Loading

assets/images/wp-plugin-logo.svg

Lines changed: 1 addition & 0 deletions
Loading

assets/js/main.min.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/plugins.min.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

classes/abstract.class.php

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
2+
/**
3+
*
4+
* Abstract Class
5+
*
6+
* @since 1.0.0
7+
* @version 1.0.0
8+
*
9+
*/
10+
if ( ! class_exists( 'CSF_Abstract' ) ) {
11+
abstract class CSF_Abstract {
12+
13+
public $abstract = '';
14+
public $output_css = '';
15+
16+
public function __construct() {
17+
18+
// Collect output css and typography
19+
if ( ! empty( $this->args['output_css'] ) || ! empty( $this->args['enqueue_webfont'] ) ) {
20+
add_action( 'wp_enqueue_scripts', array( $this, 'collect_output_css_and_typography' ), 10 );
21+
CSF::$css = apply_filters( "csf_{$this->unique}_output_css", CSF::$css, $this );
22+
}
23+
24+
}
25+
26+
public function collect_output_css_and_typography() {
27+
$this->recursive_output_css( $this->pre_fields );
28+
}
29+
30+
public function recursive_output_css( $fields = array(), $combine_field = array() ) {
31+
32+
if ( ! empty( $fields ) ) {
33+
34+
foreach ( $fields as $field ) {
35+
36+
$field_id = ( ! empty( $field['id'] ) ) ? $field['id'] : '';
37+
$field_type = ( ! empty( $field['type'] ) ) ? $field['type'] : '';
38+
$field_output = ( ! empty( $field['output'] ) ) ? $field['output'] : '';
39+
$field_check = ( $field_type === 'typography' || $field_output ) ? true : false;
40+
$field_class = 'CSF_Field_' . $field_type;
41+
42+
if ( $field_type && $field_id ) {
43+
44+
45+
if( $field_type === 'fieldset' ) {
46+
if ( ! empty( $field['fields'] ) ) {
47+
$this->recursive_output_css( $field['fields'], $field );
48+
}
49+
}
50+
51+
if( $field_type === 'accordion' ) {
52+
if ( ! empty( $field['accordions'] ) ) {
53+
foreach ( $field['accordions'] as $accordion ) {
54+
$this->recursive_output_css( $accordion['fields'], $field );
55+
}
56+
}
57+
}
58+
59+
if( $field_type === 'tabbed' ) {
60+
if ( ! empty( $field['tabs'] ) ) {
61+
foreach ( $field['tabs'] as $accordion ) {
62+
$this->recursive_output_css( $accordion['fields'], $field );
63+
}
64+
}
65+
}
66+
67+
if ( class_exists( $field_class ) ) {
68+
69+
if ( method_exists( $field_class, 'output' ) || method_exists( $field_class, 'enqueue_google_fonts' ) ) {
70+
71+
$field_value = '';
72+
73+
if ( $field_check && ( $this->abstract === 'options' || $this->abstract === 'customize' ) ) {
74+
75+
if( ! empty( $combine_field ) ) {
76+
77+
$field_value = ( isset( $this->options[$combine_field['id']][$field_id] ) ) ? $this->options[$combine_field['id']][$field_id] : '';
78+
79+
} else {
80+
81+
$field_value = ( isset( $this->options[$field_id] ) ) ? $this->options[$field_id] : '';
82+
83+
}
84+
85+
} else if ( $field_check && ( $this->abstract === 'metabox' && is_singular() || $this->abstract === 'taxonomy' && is_archive() ) ) {
86+
87+
if( ! empty( $combine_field ) ) {
88+
89+
$meta_value = $this->get_meta_value( $combine_field );
90+
$field_value = ( isset( $meta_value[$field_id] ) ) ? $meta_value[$field_id] : '';
91+
92+
} else {
93+
94+
$meta_value = $this->get_meta_value( $field );
95+
$field_value = ( isset( $meta_value ) ) ? $meta_value : '';
96+
97+
}
98+
99+
}
100+
101+
$instance = new $field_class( $field, $field_value, $this->unique, 'wp/enqueue', $this );
102+
103+
// typography enqueue and embed google web fonts
104+
if ( $field_type === 'typography' && $this->args['enqueue_webfont'] && ! empty( $field_value['font-family'] ) ) {
105+
106+
$method = ( ! empty( $this->args['async_webfont'] ) ) ? 'async' : 'enqueue';
107+
108+
$instance->enqueue_google_fonts( $method );
109+
110+
}
111+
112+
// output css
113+
if ( $field_output && $this->args['output_css'] ) {
114+
CSF::$css .= $instance->output();
115+
}
116+
117+
unset( $instance );
118+
119+
}
120+
121+
}
122+
123+
}
124+
125+
}
126+
127+
}
128+
129+
}
130+
131+
public function pre_tabs( $sections ) {
132+
133+
$count = 100;
134+
$result = array();
135+
$parents = array();
136+
137+
foreach ( $sections as $key => $section ) {
138+
if ( ! empty( $section['parent'] ) ) {
139+
$section['priority'] = ( isset( $section['priority'] ) ) ? $section['priority'] : $count;
140+
$parents[$section['parent']][] = $section;
141+
unset( $sections[$key] );
142+
}
143+
$count++;
144+
}
145+
146+
foreach ( $sections as $key => $section ) {
147+
$section['priority'] = ( isset( $section['priority'] ) ) ? $section['priority'] : $count;
148+
if ( ! empty( $section['id'] ) && ! empty( $parents[$section['id']] ) ) {
149+
$section['subs'] = wp_list_sort( $parents[$section['id']], array( 'priority' => 'ASC' ), 'ASC', true );
150+
}
151+
$result[] = $section;
152+
$count++;
153+
}
154+
155+
return wp_list_sort( $result, array( 'priority' => 'ASC' ), 'ASC', true );
156+
157+
}
158+
159+
public function pre_sections( $sections ) {
160+
161+
$result = array();
162+
163+
foreach ( $this->pre_tabs( $sections ) as $section ) {
164+
if ( ! empty( $section['subs'] ) ) {
165+
foreach ( $section['subs'] as $sub ) {
166+
$sub['ptitle'] = ( ! empty( $section['title'] ) ) ? $section['title'] : '';
167+
$result[] = $sub;
168+
}
169+
}
170+
if ( empty( $section['subs'] ) ) {
171+
$result[] = $section;
172+
}
173+
}
174+
175+
return $result;
176+
}
177+
178+
public function pre_fields( $sections ) {
179+
180+
$result = array();
181+
182+
foreach ( $sections as $key => $section ) {
183+
if ( ! empty( $section['fields'] ) ) {
184+
foreach ( $section['fields'] as $field ) {
185+
$result[] = $field;
186+
}
187+
}
188+
}
189+
190+
return $result;
191+
}
192+
193+
}
194+
}

0 commit comments

Comments
 (0)