Configurations

parent 10d660d0
Pipeline #16 skipped
...@@ -2,18 +2,18 @@ ...@@ -2,18 +2,18 @@
/* /*
* Plugin Name: autoshortcoder * Plugin Name: autoshortcoder
* Version: 1.0 * Version: 1.0
* Plugin URI: http://www.hughlashbrooke.com/ * Plugin URI: https://git.nexlab.net/nextime/autoshortcoder
* Description: This is your starter template for your next WordPress plugin. * Description: programmatically add shortcodes to posts and pages
* Author: Hugh Lashbrooke * Author: Franco (nextime) Lanza
* Author URI: http://www.hughlashbrooke.com/ * Author URI: http://www.nexlab.net
* Requires at least: 4.0 * Requires at least: 4.0
* Tested up to: 4.0 * Tested up to: 4.5.2
* *
* Text Domain: autoshortcoder * Text Domain: autoshortcoder
* Domain Path: /lang/ * Domain Path: /lang/
* *
* @package WordPress * @package WordPress
* @author Hugh Lashbrooke * @author Franco (nextime) Lanza
* @since 1.0.0 * @since 1.0.0
*/ */
......
...@@ -67,7 +67,7 @@ class autoshortcoder_Settings { ...@@ -67,7 +67,7 @@ class autoshortcoder_Settings {
* @return void * @return void
*/ */
public function add_menu_item () { public function add_menu_item () {
$page = add_options_page( __( 'Plugin Settings', 'autoshortcoder' ) , __( 'Plugin Settings', 'autoshortcoder' ) , 'manage_options' , $this->parent->_token . '_settings' , array( $this, 'settings_page' ) ); $page = add_options_page( __( 'Autoshortcode', 'autoshortcoder' ) , __( 'Autoshortcode', 'autoshortcoder' ) , 'manage_options' , $this->parent->_token . '_settings' , array( $this, 'settings_page' ) );
add_action( 'admin_print_styles-' . $page, array( $this, 'settings_assets' ) ); add_action( 'admin_print_styles-' . $page, array( $this, 'settings_assets' ) );
} }
...@@ -77,16 +77,7 @@ class autoshortcoder_Settings { ...@@ -77,16 +77,7 @@ class autoshortcoder_Settings {
*/ */
public function settings_assets () { public function settings_assets () {
// We're including the farbtastic script & styles here because they're needed for the colour picker wp_register_script( $this->parent->_token . '-settings-js', $this->parent->assets_url . 'js/settings' . $this->parent->script_suffix . '.js', '1.0.0' );
// If you're not including a colour picker field then you can leave these calls out as well as the farbtastic dependency for the wpt-admin-js script below
wp_enqueue_style( 'farbtastic' );
wp_enqueue_script( 'farbtastic' );
// We're including the WP media scripts here because they're needed for the image upload field
// If you're not including an image upload then you can leave this function call out
wp_enqueue_media();
wp_register_script( $this->parent->_token . '-settings-js', $this->parent->assets_url . 'js/settings' . $this->parent->script_suffix . '.js', array( 'farbtastic', 'jquery' ), '1.0.0' );
wp_enqueue_script( $this->parent->_token . '-settings-js' ); wp_enqueue_script( $this->parent->_token . '-settings-js' );
} }
...@@ -108,110 +99,17 @@ class autoshortcoder_Settings { ...@@ -108,110 +99,17 @@ class autoshortcoder_Settings {
private function settings_fields () { private function settings_fields () {
$settings['standard'] = array( $settings['standard'] = array(
'title' => __( 'Standard', 'autoshortcoder' ), 'title' => __( '', 'autoshortcoder' ),
'description' => __( 'These are fairly standard form input fields.', 'autoshortcoder' ), 'description' => __( '', 'autoshortcoder' ),
'fields' => array( 'fields' => array(
array( array(
'id' => 'text_field', 'id' => 'autoshortcode_settings',
'label' => __( 'Some Text' , 'autoshortcoder' ), 'label' => __( 'shortcodes to add' , 'autoshortcoder' ),
'description' => __( 'This is a standard text field.', 'autoshortcoder' ), 'description' => __( 'Add tags, a title and shortcodes, one per line, separated by |', 'autoshortcoder' ),
'type' => 'text',
'default' => '',
'placeholder' => __( 'Placeholder text', 'autoshortcoder' )
),
array(
'id' => 'password_field',
'label' => __( 'A Password' , 'autoshortcoder' ),
'description' => __( 'This is a standard password field.', 'autoshortcoder' ),
'type' => 'password',
'default' => '',
'placeholder' => __( 'Placeholder text', 'autoshortcoder' )
),
array(
'id' => 'secret_text_field',
'label' => __( 'Some Secret Text' , 'autoshortcoder' ),
'description' => __( 'This is a secret text field - any data saved here will not be displayed after the page has reloaded, but it will be saved.', 'autoshortcoder' ),
'type' => 'text_secret',
'default' => '',
'placeholder' => __( 'Placeholder text', 'autoshortcoder' )
),
array(
'id' => 'text_block',
'label' => __( 'A Text Block' , 'autoshortcoder' ),
'description' => __( 'This is a standard text area.', 'autoshortcoder' ),
'type' => 'textarea', 'type' => 'textarea',
'default' => '', 'default' => '',
'placeholder' => __( 'Placeholder text for this textarea', 'autoshortcoder' ) 'placeholder' => __( 'exampletag|example title|[exampleshortcode var1=a, var2=b]', 'autoshortcoder' )
),
array(
'id' => 'single_checkbox',
'label' => __( 'An Option', 'autoshortcoder' ),
'description' => __( 'A standard checkbox - if you save this option as checked then it will store the option as \'on\', otherwise it will be an empty string.', 'autoshortcoder' ),
'type' => 'checkbox',
'default' => ''
),
array(
'id' => 'select_box',
'label' => __( 'A Select Box', 'autoshortcoder' ),
'description' => __( 'A standard select box.', 'autoshortcoder' ),
'type' => 'select',
'options' => array( 'drupal' => 'Drupal', 'joomla' => 'Joomla', 'wordpress' => 'WordPress' ),
'default' => 'wordpress'
),
array(
'id' => 'radio_buttons',
'label' => __( 'Some Options', 'autoshortcoder' ),
'description' => __( 'A standard set of radio buttons.', 'autoshortcoder' ),
'type' => 'radio',
'options' => array( 'superman' => 'Superman', 'batman' => 'Batman', 'ironman' => 'Iron Man' ),
'default' => 'batman'
), ),
array(
'id' => 'multiple_checkboxes',
'label' => __( 'Some Items', 'autoshortcoder' ),
'description' => __( 'You can select multiple items and they will be stored as an array.', 'autoshortcoder' ),
'type' => 'checkbox_multi',
'options' => array( 'square' => 'Square', 'circle' => 'Circle', 'rectangle' => 'Rectangle', 'triangle' => 'Triangle' ),
'default' => array( 'circle', 'triangle' )
)
)
);
$settings['extra'] = array(
'title' => __( 'Extra', 'autoshortcoder' ),
'description' => __( 'These are some extra input fields that maybe aren\'t as common as the others.', 'autoshortcoder' ),
'fields' => array(
array(
'id' => 'number_field',
'label' => __( 'A Number' , 'autoshortcoder' ),
'description' => __( 'This is a standard number field - if this field contains anything other than numbers then the form will not be submitted.', 'autoshortcoder' ),
'type' => 'number',
'default' => '',
'placeholder' => __( '42', 'autoshortcoder' )
),
array(
'id' => 'colour_picker',
'label' => __( 'Pick a colour', 'autoshortcoder' ),
'description' => __( 'This uses WordPress\' built-in colour picker - the option is stored as the colour\'s hex code.', 'autoshortcoder' ),
'type' => 'color',
'default' => '#21759B'
),
array(
'id' => 'an_image',
'label' => __( 'An Image' , 'autoshortcoder' ),
'description' => __( 'This will upload an image to your media library and store the attachment ID in the option field. Once you have uploaded an imge the thumbnail will display above these buttons.', 'autoshortcoder' ),
'type' => 'image',
'default' => '',
'placeholder' => ''
),
array(
'id' => 'multi_select_box',
'label' => __( 'A Multi-Select Box', 'autoshortcoder' ),
'description' => __( 'A standard multi-select box - the saved data is stored as an array.', 'autoshortcoder' ),
'type' => 'select_multi',
'options' => array( 'linux' => 'Linux', 'mac' => 'Mac', 'windows' => 'Windows' ),
'default' => array( 'linux' )
)
) )
); );
...@@ -278,7 +176,7 @@ class autoshortcoder_Settings { ...@@ -278,7 +176,7 @@ class autoshortcoder_Settings {
// Build page HTML // Build page HTML
$html = '<div class="wrap" id="' . $this->parent->_token . '_settings">' . "\n"; $html = '<div class="wrap" id="' . $this->parent->_token . '_settings">' . "\n";
$html .= '<h2>' . __( 'Plugin Settings' , 'autoshortcoder' ) . '</h2>' . "\n"; $html .= '<h2>' . __( 'Autoshortcode Settings' , 'autoshortcoder' ) . '</h2>' . "\n";
$tab = ''; $tab = '';
if ( isset( $_GET['tab'] ) && $_GET['tab'] ) { if ( isset( $_GET['tab'] ) && $_GET['tab'] ) {
......
This diff is collapsed.
...@@ -95,7 +95,7 @@ class autoshortcoder_Admin_API { ...@@ -95,7 +95,7 @@ class autoshortcoder_Admin_API {
break; break;
case 'textarea': case 'textarea':
$html .= '<textarea id="' . esc_attr( $field['id'] ) . '" rows="5" cols="50" name="' . esc_attr( $option_name ) . '" placeholder="' . esc_attr( $field['placeholder'] ) . '">' . $data . '</textarea><br/>'. "\n"; $html .= '<textarea id="' . esc_attr( $field['id'] ) . '" rows="10" cols="150" name="' . esc_attr( $option_name ) . '" placeholder="' . esc_attr( $field['placeholder'] ) . '">' . $data . '</textarea><br/>'. "\n";
break; break;
case 'checkbox': case 'checkbox':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment