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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,89 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
//
// Comment Metabox
// Set a unique slug-like ID
//
$prefix_comment = '_prefix_comment';
//
// Create a comment metabox
//
CSF::createCommentMetabox( $prefix_comment, array(
'title' => 'Custom Comment Options',
) );
//
// Create a section
//
CSF::createSection( $prefix_comment, array(
'fields' => array(
//
// A text field
//
array(
'id' => 'opt-text',
'type' => 'text',
'title' => 'Text',
),
array(
'id' => 'opt-textarea',
'type' => 'textarea',
'title' => 'Textarea',
'help' => 'The help text of the field.',
),
array(
'id' => 'opt-upload',
'type' => 'upload',
'title' => 'Upload',
),
array(
'id' => 'opt-switcher',
'type' => 'switcher',
'title' => 'Switcher',
'label' => 'The label text of the switcher.',
),
array(
'id' => 'opt-color',
'type' => 'color',
'title' => 'Color',
),
array(
'id' => 'opt-checkbox',
'type' => 'checkbox',
'title' => 'Checkbox',
'label' => 'The label text of the checkbox.',
),
array(
'id' => 'opt-radio',
'type' => 'radio',
'title' => 'Radio',
'options' => array(
'yes' => 'Yes, Please.',
'no' => 'No, Thank you.',
),
'default' => 'yes',
),
array(
'id' => 'opt-select',
'type' => 'select',
'title' => 'Select',
'placeholder' => 'Select an option',
'options' => array(
'opt-1' => 'Option 1',
'opt-2' => 'Option 2',
'opt-3' => 'Option 3',
),
),
)
) );

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,297 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
//
// Metabox of the PAGE
// Set a unique slug-like ID
//
$prefix_page_opts = '_prefix_page_options';
//
// Create a metabox
//
CSF::createMetabox( $prefix_page_opts, array(
'title' => 'Custom Page Options',
'post_type' => 'page',
'show_restore' => true,
) );
//
// Create a section
//
CSF::createSection( $prefix_page_opts, array(
'title' => 'Overview',
'icon' => 'fas fa-rocket',
'fields' => array(
//
// A text field
//
array(
'id' => 'opt-text',
'type' => 'text',
'title' => 'Text',
),
array(
'id' => 'opt-textarea',
'type' => 'textarea',
'title' => 'Textarea',
'help' => 'The help text of the field.',
),
array(
'id' => 'opt-upload',
'type' => 'upload',
'title' => 'Upload',
),
array(
'id' => 'opt-switcher',
'type' => 'switcher',
'title' => 'Switcher',
'label' => 'The label text of the switcher.',
),
array(
'id' => 'opt-color',
'type' => 'color',
'title' => 'Color',
'default' => '#3498db',
),
array(
'id' => 'opt-checkbox',
'type' => 'checkbox',
'title' => 'Checkbox',
'label' => 'The label text of the checkbox.',
),
array(
'id' => 'opt-radio',
'type' => 'radio',
'title' => 'Radio',
'options' => array(
'yes' => 'Yes, Please.',
'no' => 'No, Thank you.',
),
'default' => 'yes',
),
array(
'id' => 'opt-select',
'type' => 'select',
'title' => 'Select',
'placeholder' => 'Select an option',
'options' => array(
'opt-1' => 'Option 1',
'opt-2' => 'Option 2',
'opt-3' => 'Option 3',
),
),
)
) );
//
// Create a section
//
CSF::createSection( $prefix_page_opts, array(
'title' => 'More Fields',
'icon' => 'fas fa-tint',
'fields' => array(
array(
'id' => 'opt-image-select',
'type' => 'image_select',
'title' => 'Image Select',
'options' => array(
'opt-1' => 'http://codestarframework.com/assets/images/placeholder/100x80-2ecc71.gif',
'opt-2' => 'http://codestarframework.com/assets/images/placeholder/100x80-e74c3c.gif',
'opt-3' => 'http://codestarframework.com/assets/images/placeholder/100x80-ffbc00.gif',
'opt-4' => 'http://codestarframework.com/assets/images/placeholder/100x80-3498db.gif',
'opt-5' => 'http://codestarframework.com/assets/images/placeholder/100x80-555555.gif',
),
'default' => 'opt-1',
),
array(
'id' => 'opt-background',
'type' => 'background',
'title' => 'Background',
),
array(
'type' => 'notice',
'style' => 'success',
'content' => 'A <strong>notice</strong> field with <strong>success</strong> style.',
),
array(
'id' => 'opt-icon',
'type' => 'icon',
'title' => 'Icon',
),
array(
'id' => 'opt-alt-text',
'type' => 'text',
'title' => 'Text',
),
array(
'id' => 'opt-alt-textarea',
'type' => 'textarea',
'title' => 'Textarea',
'subtitle' => 'A textarea with shortcoder.',
'shortcoder' => 'csf_demo_shortcodes',
),
)
) );
//
// Metabox of the POST
// Set a unique slug-like ID
//
$prefix_post_opts = '_prefix_post_options';
//
// Create a metabox
//
CSF::createMetabox( $prefix_post_opts, array(
'title' => 'Custom Post Options',
'post_type' => 'post',
'show_restore' => true,
) );
//
// Create a section
//
CSF::createSection( $prefix_post_opts, array(
'fields' => array(
//
// A text field
//
array(
'id' => 'opt-text',
'type' => 'text',
'title' => 'Text',
),
array(
'id' => 'opt-textarea',
'type' => 'textarea',
'title' => 'Textarea',
'help' => 'The help text of the field.',
),
array(
'id' => 'opt-upload',
'type' => 'upload',
'title' => 'Upload',
),
array(
'id' => 'opt-switcher',
'type' => 'switcher',
'title' => 'Switcher',
'label' => 'The label text of the switcher.',
),
array(
'id' => 'opt-color',
'type' => 'color',
'title' => 'Color',
),
array(
'id' => 'opt-checkbox',
'type' => 'checkbox',
'title' => 'Checkbox',
'label' => 'The label text of the checkbox.',
),
array(
'id' => 'opt-radio',
'type' => 'radio',
'title' => 'Radio',
'options' => array(
'yes' => 'Yes, Please.',
'no' => 'No, Thank you.',
),
'default' => 'yes',
),
array(
'id' => 'opt-select',
'type' => 'select',
'title' => 'Select',
'placeholder' => 'Select an option',
'options' => array(
'opt-1' => 'Option 1',
'opt-2' => 'Option 2',
'opt-3' => 'Option 3',
),
),
)
) );
//
// Metabox of the PAGE and POST both.
// Set a unique slug-like ID
//
$prefix_meta_opts = '_prefix_meta_options';
//
// Create a metabox
//
CSF::createMetabox( $prefix_meta_opts, array(
'title' => 'Custom Options',
'post_type' => array( 'post', 'page' ),
'context' => 'side',
) );
//
// Create a section
//
CSF::createSection( $prefix_meta_opts, array(
'fields' => array(
//
// A text field
//
array(
'id' => 'opt-text',
'type' => 'text',
'title' => 'Text',
),
array(
'id' => 'opt-switcher',
'type' => 'switcher',
'title' => 'Switcher',
'label' => 'The label of the switcher.',
),
array(
'id' => 'opt-color',
'type' => 'color',
'title' => 'Color',
),
array(
'id' => 'opt-select',
'type' => 'select',
'title' => 'Select',
'placeholder' => 'Select an option',
'options' => array(
'opt-1' => 'Option 1',
'opt-2' => 'Option 2',
'opt-3' => 'Option 3',
),
),
)
) );

View File

@@ -0,0 +1,94 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
//
// Set a unique slug-like ID
//
$prefix = '_prefix_menu_options';
//
// Create menu options
//
CSF::createNavMenuOptions( $prefix, array(
'data_type' => 'serialize'
) );
//
// Create a section
//
CSF::createSection( $prefix, array(
'fields' => array(
//
// A text field
//
array(
'id' => 'opt-text',
'type' => 'text',
'title' => 'Text',
),
array(
'id' => 'opt-textarea',
'type' => 'textarea',
'title' => 'Textarea',
'help' => 'The help text of the field.',
),
array(
'id' => 'opt-upload',
'type' => 'upload',
'title' => 'Upload',
),
array(
'id' => 'opt-icon',
'type' => 'icon',
'title' => 'Icon',
),
array(
'id' => 'opt-switcher',
'type' => 'switcher',
'title' => 'Switcher',
'label' => 'The label text of the switcher.',
),
array(
'id' => 'opt-color',
'type' => 'color',
'title' => 'Color',
'default' => '#3498db',
),
array(
'id' => 'opt-checkbox',
'type' => 'checkbox',
'title' => 'Checkbox',
'label' => 'The label text of the checkbox.',
),
array(
'id' => 'opt-radio',
'type' => 'radio',
'title' => 'Radio',
'options' => array(
'yes' => 'Yes, Please.',
'no' => 'No, Thank you.',
),
'default' => 'yes',
),
array(
'id' => 'opt-select',
'type' => 'select',
'title' => 'Select',
'placeholder' => 'Select an option',
'options' => array(
'opt-1' => 'Option 1',
'opt-2' => 'Option 2',
'opt-3' => 'Option 3',
),
),
)
) );

View File

@@ -0,0 +1,89 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
//
// Set a unique slug-like ID
//
$prefix = '_prefix_profile_options';
//
// Create profile options
//
CSF::createProfileOptions( $prefix, array(
'data_type' => 'serialize'
) );
//
// Create a section
//
CSF::createSection( $prefix, array(
'title' => 'Custom Profile Options',
'fields' => array(
//
// A text field
//
array(
'id' => 'opt-text',
'type' => 'text',
'title' => 'Text',
),
array(
'id' => 'opt-textarea',
'type' => 'textarea',
'title' => 'Textarea',
'help' => 'The help text of the field.',
),
array(
'id' => 'opt-upload',
'type' => 'upload',
'title' => 'Upload',
),
array(
'id' => 'opt-switcher',
'type' => 'switcher',
'title' => 'Switcher',
'label' => 'The label text of the switcher.',
),
array(
'id' => 'opt-color',
'type' => 'color',
'title' => 'Color',
'default' => '#3498db',
),
array(
'id' => 'opt-checkbox',
'type' => 'checkbox',
'title' => 'Checkbox',
'label' => 'The label text of the checkbox.',
),
array(
'id' => 'opt-radio',
'type' => 'radio',
'title' => 'Radio',
'options' => array(
'yes' => 'Yes, Please.',
'no' => 'No, Thank you.',
),
'default' => 'yes',
),
array(
'id' => 'opt-select',
'type' => 'select',
'title' => 'Select',
'placeholder' => 'Select an option',
'options' => array(
'opt-1' => 'Option 1',
'opt-2' => 'Option 2',
'opt-3' => 'Option 3',
),
),
)
) );

View File

@@ -0,0 +1,279 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
//
// Set a unique slug-like ID
//
$prefix = 'csf_demo_shortcodes';
//
// Create a shortcoder
//
CSF::createShortcoder( $prefix, array(
// 'button_title' => 'Add Shortcode',
// 'select_title' => 'Select a shortcode',
// 'insert_title' => 'Insert Shortcode',
// 'show_in_editor' => true,
// 'gutenberg' => array(
// 'title' => 'CSF Shortcodes',
// 'description' => 'CSF Shortcode Block',
// 'icon' => 'screenoptions',
// 'category' => 'widgets',
// 'keywords' => array( 'shortcode', 'csf', 'insert' ),
// 'placeholder' => 'Write shortcode here...',
// )
) );
//
// A shortcode [foo title=""]
//
CSF::createSection( $prefix, array(
'title' => '[foo] view: normal',
'view' => 'normal',
'shortcode' => 'foo',
'fields' => array(
array(
'id' => 'opt_title',
'type' => 'text',
'title' => 'Title',
),
array(
'id' => 'opt_switcher',
'type' => 'switcher',
'title' => 'Switcher',
'label' => 'The label text of the switcher.',
),
)
) );
//
// A shortcode [foo title=""]content[/foo]
//
CSF::createSection( $prefix, array(
'title' => '[foo] view: normal alternative',
'view' => 'normal',
'shortcode' => 'foo',
'fields' => array(
array(
'id' => 'opt_title',
'type' => 'text',
'title' => 'Title',
),
array(
'id' => 'opt_checkbox',
'type' => 'checkbox',
'title' => 'Options',
'options' => array(
'opt-1' => 'Option 1',
'opt-2' => 'Option 2',
'opt-3' => 'Option 3',
)
),
array(
'id' => 'opt_select',
'type' => 'select',
'title' => 'Select',
'options' => array(
'opt-1' => 'Option 1',
'opt-2' => 'Option 2',
'opt-3' => 'Option 3',
),
),
array(
'id' => 'content',
'type' => 'textarea',
'title' => 'Content',
),
)
) );
//
// A shortcode [content]content[/content][content]content[/content]
//
CSF::createSection( $prefix, array(
'title' => '[foo] view: contents',
'view' => 'contents',
'shortcode' => 'content',
'fields' => array(
array(
'id' => 'opt_content_1',
'type' => 'textarea',
'title' => 'Content 1',
),
array(
'id' => 'opt_content_2',
'type' => 'textarea',
'title' => 'Content 2',
),
)
) );
//
// A shortcode [opt_content_1]content[/opt_content_1][opt_content_2]content[/opt_content_2]
//
CSF::createSection( $prefix, array(
'title' => '[foo] view: contents alternative',
'view' => 'contents',
'fields' => array(
array(
'id' => 'opt_content_1',
'type' => 'textarea',
'title' => 'Content 1',
),
array(
'id' => 'opt_content_2',
'type' => 'textarea',
'title' => 'Content 2',
),
)
) );
CSF::createSection( $prefix, array(
'title' => '[foo] view: group',
'view' => 'group',
'shortcode' => 'foo',
'group_shortcode' => 'nested_foo',
'group_fields' => array(
array(
'id' => 'opt_title',
'type' => 'text',
'title' => 'Title',
),
array(
'id' => 'content',
'type' => 'textarea',
'title' => 'Content',
),
)
) );
CSF::createSection( $prefix, array(
'title' => '[foo] view: group alternative',
'view' => 'group',
'shortcode' => 'foo',
'fields' => array(
array(
'id' => 'opt_switcher',
'type' => 'switcher',
'title' => 'Switcher',
'label' => 'The label text of the switcher.',
),
array(
'id' => 'opt_select',
'type' => 'select',
'title' => 'Select',
'options' => array(
'opt-1' => 'Option 1',
'opt-2' => 'Option 2',
'opt-3' => 'Option 3',
),
),
),
'group_shortcode' => 'nested_foo',
'group_fields' => array(
array(
'id' => 'title',
'type' => 'text',
'title' => 'Title',
),
array(
'id' => 'content',
'type' => 'textarea',
'title' => 'Content',
),
)
) );
CSF::createSection( $prefix, array(
'title' => '[foo] view: repeater',
'view' => 'repeater',
'shortcode' => 'foo',
'fields' => array(
array(
'id' => 'opt_title',
'type' => 'text',
'title' => 'Title',
),
array(
'id' => 'opt_switcher',
'type' => 'switcher',
'title' => 'Switcher',
'label' => 'The label text of the switcher.',
),
array(
'id' => 'opt_select',
'type' => 'select',
'title' => 'Select',
'options' => array(
'opt-1' => 'Option 1',
'opt-2' => 'Option 2',
'opt-3' => 'Option 3',
),
),
)
) );
CSF::createSection( $prefix, array(
'title' => '[foo] view: repeater alternative',
'view' => 'repeater',
'shortcode' => 'foo',
'fields' => array(
array(
'id' => 'opt_title',
'type' => 'text',
'title' => 'Title',
),
array(
'id' => 'opt_switcher',
'type' => 'switcher',
'title' => 'Switcher',
'label' => 'The label text of the switcher.',
),
array(
'id' => 'opt_select',
'type' => 'select',
'title' => 'Select',
'options' => array(
'opt-1' => 'Option 1',
'opt-2' => 'Option 2',
'opt-3' => 'Option 3',
),
),
array(
'id' => 'content',
'type' => 'textarea',
'title' => 'Content',
),
)
) );

View File

@@ -0,0 +1,88 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
//
// Set a unique slug-like ID
//
$prefix = '_prefix_taxonomy_options';
//
// Create taxonomy options
//
CSF::createTaxonomyOptions( $prefix, array(
'taxonomy' => 'category',
) );
//
// Create a section
//
CSF::createSection( $prefix, array(
'fields' => array(
//
// A text field
//
array(
'id' => 'opt-text',
'type' => 'text',
'title' => 'Text',
),
array(
'id' => 'opt-textarea',
'type' => 'textarea',
'title' => 'Textarea',
'help' => 'The help text of the field.',
),
array(
'id' => 'opt-upload',
'type' => 'upload',
'title' => 'Upload',
),
array(
'id' => 'opt-switcher',
'type' => 'switcher',
'title' => 'Switcher',
'label' => 'The label text of the switcher.',
),
array(
'id' => 'opt-color',
'type' => 'color',
'title' => 'Color',
'default' => '#3498db',
),
array(
'id' => 'opt-checkbox',
'type' => 'checkbox',
'title' => 'Checkbox',
'label' => 'The label text of the checkbox.',
),
array(
'id' => 'opt-radio',
'type' => 'radio',
'title' => 'Radio',
'options' => array(
'yes' => 'Yes, Please.',
'no' => 'No, Thank you.',
),
'default' => 'yes',
),
array(
'id' => 'opt-select',
'type' => 'select',
'title' => 'Select',
'placeholder' => 'Select an option',
'options' => array(
'opt-1' => 'Option 1',
'opt-2' => 'Option 2',
'opt-3' => 'Option 3',
),
),
)
) );

View File

@@ -0,0 +1,174 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
//
// Create a widget 1
//
CSF::createWidget( 'csf_widget_example_1', array(
'title' => 'Codestar Widget Example 1',
'classname' => 'csf-widget-classname',
'description' => 'A description for widget example 1',
'fields' => array(
array(
'id' => 'title',
'type' => 'text',
'title' => 'Title',
),
array(
'id' => 'opt-text',
'type' => 'text',
'title' => 'Text',
'default' => 'Default text value'
),
array(
'id' => 'opt-color',
'type' => 'color',
'title' => 'Color',
),
array(
'id' => 'opt-upload',
'type' => 'upload',
'title' => 'Upload',
),
array(
'id' => 'opt-textarea',
'type' => 'textarea',
'title' => 'Textarea',
'help' => 'The help text of the field.',
),
)
) );
//
// Front-end display of widget example 1
// Attention: This function named considering above widget base id.
//
if ( ! function_exists( 'csf_widget_example_1' ) ) {
function csf_widget_example_1( $args, $instance ) {
echo $args['before_widget'];
if ( ! empty( $instance['title'] ) ) {
echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title'];
}
// var_dump( $args ); // Widget arguments
// var_dump( $instance ); // Saved values from database
echo $instance['title'];
echo $instance['opt-text'];
echo $instance['opt-color'];
echo $instance['opt-upload'];
echo $instance['opt-textarea'];
echo $args['after_widget'];
}
}
//
// Create a widget 2
//
CSF::createWidget( 'csf_widget_example_2', array(
'title' => 'Codestar Widget Example 2',
'classname' => 'csf-widget-classname',
'description' => 'A description for widget example 2',
'fields' => array(
array(
'id' => 'title',
'type' => 'text',
'title' => 'Title',
),
array(
'id' => 'opt-text',
'type' => 'text',
'title' => 'Text',
'default' => 'Default text value'
),
array(
'id' => 'opt-color',
'type' => 'color',
'title' => 'Color',
),
array(
'id' => 'opt-switcher',
'type' => 'switcher',
'title' => 'Switcher',
'label' => 'The label text of the switcher.',
),
array(
'id' => 'opt-checkbox',
'type' => 'checkbox',
'title' => 'Checkbox',
'label' => 'The label text of the checkbox.',
),
array(
'id' => 'opt-select',
'type' => 'select',
'title' => 'Select',
'placeholder' => 'Select an option',
'options' => array(
'opt-1' => 'Option 1',
'opt-2' => 'Option 2',
'opt-3' => 'Option 3',
),
),
array(
'id' => 'opt-radio',
'type' => 'radio',
'title' => 'Radio',
'options' => array(
'yes' => 'Yes, Please.',
'no' => 'No, Thank you.',
),
'default' => 'yes',
),
array(
'type' => 'notice',
'style' => 'success',
'content' => 'A <strong>notice</strong> field with <strong>success</strong> style.',
),
array(
'id' => 'opt-textarea',
'type' => 'textarea',
'title' => 'Textarea',
'help' => 'The help text of the field.',
),
)
) );
//
// Front-end display of widget example 2
// Attention: This function named considering above widget base id.
//
if ( ! function_exists( 'csf_widget_example_2' ) ) {
function csf_widget_example_2( $args, $instance ) {
echo $args['before_widget'];
if ( ! empty( $instance['title'] ) ) {
echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title'];
}
// var_dump( $args ); // Widget arguments
// var_dump( $instance ); // Saved values from database
echo $instance['title'];
echo $instance['opt-text'];
echo $args['after_widget'];
}
}