-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 54e2332
Showing
120 changed files
with
27,266 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
[![Codestar Framework](http://s3.codestarthemes.com/codecanyon/23079100/github-banner.png)](http://codestarframework.com/) | ||
|
||
# Codestar Framework | ||
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. | ||
|
||
## Contents | ||
- [Demo](#demo) | ||
- [Installation](#installation) | ||
- [Quick Start](#quick-start) | ||
- [Documentation](#documentation) | ||
- [Free vs Premium](#free-vs-premium) | ||
- [Support](#support) | ||
- [Release Notes](#release-notes) | ||
- [License](#license) | ||
|
||
## Demo | ||
For usage and examples, have a look at :rocket: [online demo](http://codestarthemes.com/plugins/codestar-framework/wp-login.php?login=demo) | ||
|
||
## Installation | ||
|
||
1. Download the installable WordPress plugin zip. | ||
2. Upload and active plugin from `WordPress` → `Plugins` → `Add New` | ||
3. After activation, next step is to configure your settings. You can do it from here :gear: [configurations](http://codestarframework.com/documentation/#/configurations) | ||
|
||
## Quick Start | ||
|
||
Open your current theme **functions.php** file and paste this code. | ||
|
||
```php | ||
// Check core class for avoid errors | ||
if( class_exists( 'CSF' ) ) { | ||
|
||
// Set a unique slug-like ID | ||
$prefix = 'my_framework'; | ||
|
||
// Create options | ||
CSF::createOptions( $prefix, array( | ||
'menu_title' => 'My Framework', | ||
'menu_slug' => 'my-framework', | ||
) ); | ||
|
||
// Create a section | ||
CSF::createSection( $prefix, array( | ||
'title' => 'Tab Title 1', | ||
'fields' => array( | ||
|
||
// A text field | ||
array( | ||
'id' => 'opt-text', | ||
'type' => 'text', | ||
'title' => 'Simple Text', | ||
), | ||
|
||
) | ||
) ); | ||
|
||
// Create a section | ||
CSF::createSection( $prefix, array( | ||
'title' => 'Tab Title 2', | ||
'fields' => array( | ||
|
||
// A textarea field | ||
array( | ||
'id' => 'opt-textarea', | ||
'type' => 'textarea', | ||
'title' => 'Simple Textarea', | ||
), | ||
|
||
) | ||
) ); | ||
|
||
} | ||
``` | ||
How to get option value ? | ||
```php | ||
$options = get_option( 'my_framework' ); // unique id of the framework | ||
|
||
echo $options['opt-text']; // id of the field | ||
echo $options['opt-textarea']; // id of the field | ||
``` | ||
|
||
## Documentation | ||
Read the documentation for details :closed_book: [documentation](http://codestarframework.com/documentation/) | ||
|
||
## Free vs Premium | ||
|
||
| Features | Free Version | Premium Version | ||
|:-----------------------------|:------------------:|:-----------------: | ||
| Admin Option Framework | :heavy_check_mark: | :heavy_check_mark: | ||
| Customize Option Framework | :x: | :heavy_check_mark: | ||
| Metabox Option Framework | :x: | :heavy_check_mark: | ||
| Nav Menu Option Framework | :x: | :heavy_check_mark: | ||
| Taxonomy Option Framework | :x: | :heavy_check_mark: | ||
| Profile Option Framework | :x: | :heavy_check_mark: | ||
| Comment Option Framework | :x: | :heavy_check_mark: | ||
| Widget Option Framework | :x: | :heavy_check_mark: | ||
| Shortcode Option Framework | :x: | :heavy_check_mark: | ||
| All Option Fields | :x: | :heavy_check_mark: | ||
| Developer Packages | :x: | :heavy_check_mark: | ||
| Unminfy Library | :x: | :heavy_check_mark: | ||
| New Requests | :x: | :heavy_check_mark: | ||
| Autoremove Advertisements | :x: | :heavy_check_mark: | ||
| Life-time access/updates | :x: | :heavy_check_mark: | ||
| | | :star2: <a href="http://codestarframework.com/">Upgrade Premium Version</a> | ||
|
||
## Available Option Fields | ||
|
||
| Accordion | Color | Icon | Select | Tabbed | ||
|:------------|:------------|:-------------|:---------|:--- | ||
| Background | Color Group | Image Select | Slider | Text | ||
| Backup | Date | Link Color | Sortable | Textarea | ||
| Border | Dimensions | Media | Sorter | Typography | ||
| Button Set | Fieldset | Palette | Spacing | Upload | ||
| Checkbox | Gallery | Radio | Spinner | WP Editor | ||
| Code Editor | Group | Repeater | Switcher | Others | ||
|
||
## Support | ||
|
||
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). | ||
|
||
## Release Notes | ||
Check out the [release notes](http://codestarframework.com/documentation/#/relnotes) | ||
|
||
## License | ||
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. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
<?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 ); | ||
CSF::$css = apply_filters( "csf_{$this->unique}_output_css", CSF::$css, $this ); | ||
} | ||
|
||
} | ||
|
||
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 ); | ||
|
||
} | ||
|
||
} | ||
|
||
} | ||
|
||
} | ||
|
||
} | ||
|
||
} | ||
|
||
public function pre_tabs( $sections ) { | ||
|
||
$count = 100; | ||
$result = array(); | ||
$parents = array(); | ||
|
||
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( $sections ) as $section ) { | ||
if ( ! empty( $section['subs'] ) ) { | ||
foreach ( $section['subs'] as $sub ) { | ||
$sub['ptitle'] = ( ! empty( $section['title'] ) ) ? $section['title'] : ''; | ||
$result[] = $sub; | ||
} | ||
} | ||
if ( empty( $section['subs'] ) ) { | ||
$result[] = $section; | ||
} | ||
} | ||
|
||
return $result; | ||
} | ||
|
||
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; | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.