Commit 143052d2 authored by lucha's avatar lucha

[auto] Theme: bliss 1.0.12

parent 3ec74ca2
......@@ -8,7 +8,7 @@
//from http://codex.wordpress.org/Function_Reference/the_excerpt#Make_the_.22read_more.22_link_to_the_post
function bliss_excerpt_more($more) {
global $post;
return ' <br /><a href="'. get_permalink($post->ID) . '" class="right btn read-more-btn">Read More&nbsp;<span class="fa small fa-arrow-circle-right"></span></a>';
return ' <br /><a href="'. get_permalink($post->ID) . '" class="right btn read-more-btn">Read More&nbsp;<span class="fa small fa-arrow-right"></span></a>';
}
add_filter('excerpt_more', 'bliss_excerpt_more');
......@@ -19,14 +19,14 @@ add_filter('excerpt_more', 'bliss_excerpt_more');
function bliss_next_post_link_attributes($output) {
$classname = 'class="btn"';
$output = str_replace(' href=', ' '.$classname.' href=', $output);
return str_replace('</a>', '&nbsp;<span class="fa fa-arrow-circle-right"></span></a>', $output);
return str_replace('</a>', '&nbsp;<span class="fa fa-arrow-right"></span></a>', $output);
}
add_filter('next_post_link', 'bliss_next_post_link_attributes');
function bliss_previous_post_link_attributes($output) {
$classname = 'class="btn"';
$output = str_replace(' href=', ' '.$classname.' href=', $output);
return str_replace('">', '"><span class="fa fa-arrow-circle-left"></span>&nbsp;', $output);
return str_replace('">', '"><span class="fa fa-arrow-left"></span>&nbsp;', $output);
}
add_filter('previous_post_link', 'bliss_previous_post_link_attributes');
......
......@@ -32,15 +32,18 @@
line-height:16px;
color: #777;
}
#optionsframework .controls input[type=text] {
width:100%;
}
#optionsframework .section-checkbox .controls {
width: 98%;
}
#optionsframework .section-checkbox .explain {
max-width:94%;
}
#optionsframework .controls input[type=text] {
width:100%;
}
#optionsframework .controls input[type=text].wp-color-picker {
width: 65px;
}
#optionsframework .controls select, #optionsframework .controls textarea {
margin-bottom:10px;
width:100%;
......@@ -84,6 +87,9 @@
margin-right:5px;
float:left
}
#optionsframework .section-typography .wp-picker-container {
margin-top:2px;
}
#optionsframework .of-background-properties {
clear:both;
margin-top: 18px;
......
......@@ -4,7 +4,7 @@
* @author Devin Price <devin@wptheming.com>
* @license GPL-2.0+
* @link http://wptheming.com
* @copyright 2013 WP Theming
* @copyright 2010-2014 WP Theming
*/
class Options_Framework_Admin {
......@@ -31,7 +31,7 @@ class Options_Framework_Admin {
if ( $options ) {
// Add the options page and menu item.
add_action( 'admin_menu', array( $this, 'add_custom_options_page' ) );
add_action( 'admin_menu', array( $this, 'bliss_options_page' ) );
// Add the required scripts and styles
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
......@@ -54,11 +54,12 @@ class Options_Framework_Admin {
*/
function settings_init() {
// Load Options Framework Settings
$optionsframework_settings = get_option( 'optionsframework' );
// Get the option name
$options_framework = new Options_Framework;
$name = $options_framework->get_option_name();
// Registers the settings fields and callback
register_setting( 'optionsframework', $optionsframework_settings['id'], array ( $this, 'validate_options' ) );
register_setting( 'optionsframework', $name, array ( $this, 'validate_options' ) );
// Displays notice after options save
add_action( 'optionsframework_after_validate', array( $this, 'save_options_notice' ) );
......@@ -66,7 +67,7 @@ class Options_Framework_Admin {
}
/*
* Define menu options (still limited to appearance section)
* Define menu options
*
* Examples usage:
*
......@@ -82,10 +83,21 @@ class Options_Framework_Admin {
static function menu_settings() {
$menu = array(
'page_title' => __( 'Theme Options', 'textdomain' ),
'menu_title' => __( 'Theme Options', 'textdomain' ),
// Modes: submenu, menu
'mode' => 'submenu',
// Submenu default settings
'page_title' => __( 'Bliss Theme Options', 'bliss' ),
'menu_title' => __( 'Bliss Theme Options', 'bliss' ),
'capability' => 'edit_theme_options',
'menu_slug' => 'options-framework'
'menu_slug' => 'options-framework',
'parent_slug' => 'themes.php',
// Menu default settings
'icon_url' => 'dashicons-admin-generic',
'position' => '61'
);
return apply_filters( 'optionsframework_menu', $menu );
......@@ -96,10 +108,24 @@ class Options_Framework_Admin {
*
* @since 1.7.0
*/
function add_custom_options_page() {
// Mardesco edit:
// ThemeCheck still complains about this function name. Note that the required add_theme_page function is used here.
function bliss_options_page() {
$menu = $this->menu_settings();
$this->options_screen = add_theme_page( $menu['page_title'], $menu['menu_title'], $menu['capability'], $menu['menu_slug'], array( $this, 'options_page' ) );
// If you want a top level menu, see this Gist:
// https://gist.github.com/devinsays/884d6abe92857a329d99
// Code removed because it conflicts with .org theme check.
$this->options_screen = add_theme_page(
$menu['page_title'],
$menu['menu_title'],
$menu['capability'],
$menu['menu_slug'],
array( $this, 'options_page' )
);
}
......@@ -108,12 +134,13 @@ class Options_Framework_Admin {
*
* @since 1.7.0
*/
function enqueue_admin_styles( $hook ) {
if ( $this->options_screen != $hook )
return;
wp_enqueue_style( 'optionsframework', OPTIONS_FRAMEWORK_DIRECTORY . 'css/optionsframework.css', array(), Options_Framework::VERSION );
wp_enqueue_style( 'optionsframework', OPTIONS_FRAMEWORK_DIRECTORY . 'css/optionsframework.css', array(), Options_Framework::VERSION );
wp_enqueue_style( 'wp-color-picker' );
}
......@@ -128,7 +155,12 @@ class Options_Framework_Admin {
return;
// Enqueue custom option panel JS
wp_enqueue_script( 'options-custom', OPTIONS_FRAMEWORK_DIRECTORY . 'js/options-custom.js', array( 'jquery','wp-color-picker' ), Options_Framework::VERSION );
wp_enqueue_script(
'options-custom',
OPTIONS_FRAMEWORK_DIRECTORY . 'js/options-custom.js',
array( 'jquery','wp-color-picker' ),
Options_Framework::VERSION
);
// Inline scripts from options-interface.php
add_action( 'admin_head', array( $this, 'of_admin_head' ) );
......@@ -170,8 +202,8 @@ class Options_Framework_Admin {
<?php settings_fields( 'optionsframework' ); ?>
<?php Options_Framework_Interface::optionsframework_fields(); /* Settings */ ?>
<div id="optionsframework-submit">
<input type="submit" class="button-primary" name="update" value="<?php esc_attr_e( 'Save Options', 'textdomain' ); ?>" />
<input type="submit" class="reset-button button-secondary" name="reset" value="<?php esc_attr_e( 'Restore Defaults', 'textdomain' ); ?>" onclick="return confirm( '<?php print esc_js( __( 'Click OK to reset. Any theme settings will be lost!', 'textdomain' ) ); ?>' );" />
<input type="submit" class="button-primary" name="update" value="<?php esc_attr_e( 'Save Options', 'bliss' ); ?>" />
<input type="submit" class="reset-button button-secondary" name="reset" value="<?php esc_attr_e( 'Restore Defaults', 'bliss' ); ?>" onclick="return confirm( '<?php print esc_js( __( 'Click OK to reset. Any theme settings will be lost!', 'bliss' ) ); ?>' );" />
<div class="clear"></div>
</div>
</form>
......@@ -202,7 +234,7 @@ class Options_Framework_Admin {
*/
if ( isset( $_POST['reset'] ) ) {
add_settings_error( 'options-framework', 'restore_defaults', __( 'Default options restored.', 'textdomain' ), 'updated fade' );
add_settings_error( 'options-framework', 'restore_defaults', __( 'Default options restored.', 'bliss' ), 'updated fade' );
return $this->get_default_values();
}
......@@ -256,7 +288,7 @@ class Options_Framework_Admin {
*/
function save_options_notice() {
add_settings_error( 'options-framework', 'save_options', __( 'Options saved.', 'textdomain' ), 'updated fade' );
add_settings_error( 'options-framework', 'save_options', __( 'Options saved.', 'bliss' ), 'updated fade' );
}
/**
......@@ -271,7 +303,6 @@ class Options_Framework_Admin {
* @return array Re-keyed options configuration array.
*
*/
function get_default_values() {
$output = array();
$config = & Options_Framework::_optionsframework_options();
......@@ -299,14 +330,23 @@ class Options_Framework_Admin {
function optionsframework_admin_bar() {
$menu = $this->menu_settings();
global $wp_admin_bar;
$wp_admin_bar->add_menu( array(
if ( 'menu' == $menu['mode'] ) {
$href = admin_url( 'admin.php?page=' . $menu['menu_slug'] );
} else {
$href = admin_url( 'themes.php?page=' . $menu['menu_slug'] );
}
$args = array(
'parent' => 'appearance',
'id' => 'of_theme_options',
'title' => __( 'Theme Options', 'textdomain' ),
'href' => admin_url( 'themes.php?page=' . $menu['menu_slug'] )
) );
'title' => $menu['menu_title'],
'href' => $href
);
$wp_admin_bar->add_menu( apply_filters( 'optionsframework_admin_bar', $args ) );
}
}
}
\ No newline at end of file
......@@ -4,7 +4,7 @@
* @author Devin Price <devin@wptheming.com>
* @license GPL-2.0+
* @link http://wptheming.com
* @copyright 2013 WP Theming
* @copyright 2010-2014 WP Theming
*/
class Options_Framework {
......@@ -15,55 +15,29 @@ class Options_Framework {
* @since 1.7.0
* @type string
*/
const VERSION = '1.7.2';
const VERSION = '1.9.1';
/**
* Initialize the plugin.
* Gets option name
*
* @since 1.7.0
* @since 1.9.0
*/
public function init() {
// Needs to run every time in case theme has been changed
add_action( 'admin_init', array( $this, 'set_theme_option' ) );
function get_option_name() {
}
$name = '';
/**
* Sets option defaults
*
* @since 1.7.0
*/
function set_theme_option() {
// Gets option name as defined in the theme
if ( function_exists( 'optionsframework_option_name' ) ) {
$name = optionsframework_option_name();
}
// Load settings
$optionsframework_settings = get_option( 'optionsframework' );
// Fallback
if ( '' == $name ) {
$name = get_option( 'stylesheet' );
$name = preg_replace( "/\W/", "_", strtolower( $name ) );
}
// Updates the unique option id in the database if it has changed
if ( function_exists( 'optionsframework_option_name' ) ) {
optionsframework_option_name();
}
elseif ( has_action( 'optionsframework_option_name' ) ) {
do_action( 'optionsframework_option_name' );
}
// If the developer hasn't explicitly set an option id, we'll use a default
else {
$default_themename = get_option( 'stylesheet' );
$default_themename = preg_replace( "/\W/", "_", strtolower($default_themename ) );
$default_themename = 'optionsframework_' . $default_themename;
if ( isset( $optionsframework_settings['id'] ) ) {
if ( $optionsframework_settings['id'] == $default_themename ) {
// All good, using default theme id
} else {
$optionsframework_settings['id'] = $default_themename;
update_option( 'optionsframework', $optionsframework_settings );
}
}
else {
$optionsframework_settings['id'] = $default_themename;
update_option( 'optionsframework', $optionsframework_settings );
}
}
return apply_filters( 'options_framework_option_name', $name );
}
......@@ -102,9 +76,9 @@ class Options_Framework {
if ( !$options ) {
// Load options from options.php file (if it exists)
$location = apply_filters( 'options_framework_location', array('options.php') );
$location = apply_filters( 'options_framework_location', array( 'options.php' ) );
if ( $optionsfile = locate_template( $location ) ) {
$maybe_options = require_once $optionsfile;
$maybe_options = load_template( $optionsfile );
if ( is_array( $maybe_options ) ) {
$options = $maybe_options;
} else if ( function_exists( 'optionsframework_options' ) ) {
......
......@@ -4,7 +4,7 @@
* @author Devin Price <devin@wptheming.com>
* @license GPL-2.0+
* @link http://wptheming.com
* @copyright 2013 WP Theming
* @copyright 2010-2014 WP Theming
*/
class Options_Framework_Interface {
......@@ -37,17 +37,10 @@ class Options_Framework_Interface {
static function optionsframework_fields() {
global $allowedtags;
$optionsframework_settings = get_option( 'optionsframework' );
// Gets the unique option id
if ( isset( $optionsframework_settings['id'] ) ) {
$option_name = $optionsframework_settings['id'];
}
else {
$option_name = 'optionsframework';
};
$settings = get_option($option_name);
$options_framework = new Options_Framework;
$option_name = $options_framework->get_option_name();
$settings = get_option( $option_name );
$options = & Options_Framework::_optionsframework_options();
$counter = 0;
......@@ -109,6 +102,12 @@ class Options_Framework_Interface {
$explain_value = $value['desc'];
}
// Set the placeholder if one exists
$placeholder = '';
if ( isset( $value['placeholder'] ) ) {
$placeholder = ' placeholder="' . esc_attr( $value['placeholder'] ) . '"';
}
if ( has_filter( 'optionsframework_' . $value['type'] ) ) {
$output .= apply_filters( 'optionsframework_' . $value['type'], $option_name, $value, $val );
}
......@@ -118,7 +117,7 @@ class Options_Framework_Interface {
// Basic text input
case 'text':
$output .= '<input id="' . esc_attr( $value['id'] ) . '" class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" type="text" value="' . esc_attr( $val ) . '" />';
$output .= '<input id="' . esc_attr( $value['id'] ) . '" class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" type="text" value="' . esc_attr( $val ) . '"' . $placeholder . ' />';
break;
// Password input
......@@ -138,7 +137,7 @@ class Options_Framework_Interface {
}
$val = stripslashes( $val );
$output .= '<textarea id="' . esc_attr( $value['id'] ) . '" class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" rows="' . $rows . '">' . esc_textarea( $val ) . '</textarea>';
$output .= '<textarea id="' . esc_attr( $value['id'] ) . '" class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . ']' ) . '" rows="' . $rows . '"' . $placeholder . '>' . esc_textarea( $val ) . '</textarea>';
break;
// Select Box
......@@ -353,7 +352,7 @@ class Options_Framework_Interface {
$default_editor_settings = array(
'textarea_name' => $textarea_name,
'media_buttons' => false,
'tinymce' => array( 'plugins' => 'wordpress' )
'tinymce' => array( 'plugins' => 'wordpress,wplink' )
);
$editor_settings = array();
if ( isset( $value['settings'] ) ) {
......@@ -383,7 +382,7 @@ class Options_Framework_Interface {
$output .= '<h4 class="heading">' . esc_html( $value['name'] ) . '</h4>' . "\n";
}
if ( isset( $value['desc'] ) ) {
$output .= apply_filters('of_sanitize_info', $value['desc'] ) . "\n";
$output .= $value['desc'] . "\n";
}
$output .= '</div>' . "\n";
break;
......
......@@ -4,7 +4,7 @@
* @author Devin Price <devin@wptheming.com>
* @license GPL-2.0+
* @link http://wptheming.com
* @copyright 2013 WP Theming
* @copyright 2010-2014 WP Theming
*/
class Options_Framework_Media_Uploader {
......@@ -31,10 +31,9 @@ class Options_Framework_Media_Uploader {
static function optionsframework_uploader( $_id, $_value, $_desc = '', $_name = '' ) {
$optionsframework_settings = get_option( 'optionsframework' );
// Gets the unique option id
$option_name = $optionsframework_settings['id'];
$options_framework = new Options_Framework;
$option_name = $options_framework->get_option_name();
$output = '';
$id = '';
......@@ -60,15 +59,15 @@ class Options_Framework_Media_Uploader {
if ( $value ) {
$class = ' has-file';
}
$output .= '<input id="' . $id . '" class="upload' . $class . '" type="text" name="'.$name.'" value="' . $value . '" placeholder="' . __('No file chosen', 'textdomain') .'" />' . "\n";
$output .= '<input id="' . $id . '" class="upload' . $class . '" type="text" name="'.$name.'" value="' . $value . '" placeholder="' . __('No file chosen', 'bliss') .'" />' . "\n";
if ( function_exists( 'wp_enqueue_media' ) ) {
if ( ( $value == '' ) ) {
$output .= '<input id="upload-' . $id . '" class="upload-button button" type="button" value="' . __( 'Upload', 'textdomain' ) . '" />' . "\n";
$output .= '<input id="upload-' . $id . '" class="upload-button button" type="button" value="' . __( 'Upload', 'bliss' ) . '" />' . "\n";
} else {
$output .= '<input id="remove-' . $id . '" class="remove-file button" type="button" value="' . __( 'Remove', 'textdomain' ) . '" />' . "\n";
$output .= '<input id="remove-' . $id . '" class="remove-file button" type="button" value="' . __( 'Remove', 'bliss' ) . '" />' . "\n";
}
} else {
$output .= '<p><i>' . __( 'Upgrade your version of WordPress for full media support.', 'textdomain' ) . '</i></p>';
$output .= '<p><i>' . __( 'Upgrade your version of WordPress for full media support.', 'bliss' ) . '</i></p>';
}
if ( $_desc != '' ) {
......@@ -92,7 +91,7 @@ class Options_Framework_Media_Uploader {
$output .= '';
// Standard generic output if it's not an image.
$title = __( 'View File', 'textdomain' );
$title = __( 'View File', 'bliss' );
$output .= '<div class="no-image"><span class="file_link"><a href="' . $value . '" target="_blank" rel="external">'.$title.'</a></span></div>';
}
}
......@@ -107,7 +106,7 @@ class Options_Framework_Media_Uploader {
$menu = Options_Framework_Admin::menu_settings();
if ( 'appearance_page_' . $menu['menu_slug'] != $hook )
if ( substr( $hook, -strlen( $menu['menu_slug'] ) ) !== $menu['menu_slug'] )
return;
if ( function_exists( 'wp_enqueue_media' ) )
......@@ -116,8 +115,8 @@ class Options_Framework_Media_Uploader {
wp_register_script( 'of-media-uploader', OPTIONS_FRAMEWORK_DIRECTORY .'js/media-uploader.js', array( 'jquery' ), Options_Framework::VERSION );
wp_enqueue_script( 'of-media-uploader' );
wp_localize_script( 'of-media-uploader', 'optionsframework_l10n', array(
'upload' => __( 'Upload', 'textdomain' ),
'remove' => __( 'Remove', 'textdomain' )
'upload' => __( 'Upload', 'bliss' ),
'remove' => __( 'Remove', 'bliss' )
) );
}
}
\ No newline at end of file
......@@ -4,41 +4,63 @@
* @author Devin Price <devin@wptheming.com>
* @license GPL-2.0+
* @link http://wptheming.com
* @copyright 2013 WP Theming
* @copyright 2010-2014 WP Theming
*/
/* Text */
/**
* Sanitization for text input
*
* @link http://developer.wordpress.org/reference/functions/sanitize_text_field/
*/
add_filter( 'of_sanitize_text', 'sanitize_text_field' );
/* Password */
/**
* Sanitization for password input
*
* @link http://developer.wordpress.org/reference/functions/sanitize_text_field/
*/
add_filter( 'of_sanitize_password', 'sanitize_text_field' );
/* Textarea */
/**
* Sanitization for select input
*
* Validates that the selected option is a valid option.
*/
add_filter( 'of_sanitize_select', 'of_sanitize_enum', 10, 2 );
function of_sanitize_textarea( $input) {
/**
* Sanitization for radio input
*
* Validates that the selected option is a valid option.
*/
add_filter( 'of_sanitize_radio', 'of_sanitize_enum', 10, 2 );
/**
* Sanitization for image selector
*
* Validates that the selected option is a valid option.
*/
add_filter( 'of_sanitize_images', 'of_sanitize_enum', 10, 2 );
/**
* Sanitization for textarea field
*
* @param $input string
* @return $output sanitized string
*/
function of_sanitize_textarea( $input ) {
global $allowedposttags;
$output = wp_kses( $input, $allowedposttags);
$output = wp_kses( $input, $allowedposttags );
return $output;
}
add_filter( 'of_sanitize_textarea', 'of_sanitize_textarea' );
/* Select */
add_filter( 'of_sanitize_select', 'of_sanitize_enum', 10, 2);
/* Radio */
add_filter( 'of_sanitize_radio', 'of_sanitize_enum', 10, 2);
/* Images */
add_filter( 'of_sanitize_images', 'of_sanitize_enum', 10, 2);
/* Checkbox */
/**
* Sanitization for checkbox input
*
* @param $input string (1 or empty) checkbox state
* @return $output '1' or false
*/
function of_sanitize_checkbox( $input ) {
if ( $input ) {
$output = '1';
......@@ -49,8 +71,12 @@ function of_sanitize_checkbox( $input ) {
}
add_filter( 'of_sanitize_checkbox', 'of_sanitize_checkbox' );
/* Multicheck */
/**
* Sanitization for multicheck
*
* @param array of checkbox values
* @return array of sanitized values ('1' or false)
*/
function of_sanitize_multicheck( $input, $option ) {
$output = '';
if ( is_array( $input ) ) {
......@@ -59,7 +85,7 @@ function of_sanitize_multicheck( $input, $option ) {
}
foreach( $input as $key => $value ) {
if ( array_key_exists( $key, $option['options'] ) && $value ) {
$output[$key] = "1";
$output[$key] = '1';
}
}
}
......@@ -67,55 +93,79 @@ function of_sanitize_multicheck( $input, $option ) {
}
add_filter( 'of_sanitize_multicheck', 'of_sanitize_multicheck', 10, 2 );
</