Skip to content

Commit

Permalink
Several code formatting changes according to the WordPress coding sta…
Browse files Browse the repository at this point in the history
…ndards

Additional: Note in readme.txt about a bug that has been introduced in
0.4 (only in SVN repo).
  • Loading branch information
tyrann0us committed Jan 7, 2017
1 parent 6603a08 commit 2070a27
Show file tree
Hide file tree
Showing 9 changed files with 216 additions and 188 deletions.
14 changes: 7 additions & 7 deletions inc/cache.class.php → inc/class-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* @since 0.1
*/
class slickSliderCache {
class Slick_Slider_Cache {

/**
* Cached values stored in array.
Expand All @@ -32,11 +32,11 @@ public static function get( $key ) {
if ( empty( $key ) ) {
return;
}
$cache = ( array ) self::$_cache;
if ( empty( $cache[$key] ) ) {
$cache = (array) self::$_cache;
if ( empty( $cache[ $key ] ) ) {
return null;
}
return $cache[$key];
return $cache[ $key ];

}

Expand All @@ -54,9 +54,9 @@ public static function set( $key, $value ) {
if ( empty( $key ) ) {
return;
}
$cache = ( array ) self::$_cache;
$cache[$key] = $value;
$cache = (array) self::$_cache;
$cache[ $key ] = $value;
self::$_cache = $cache;

}
}
}
28 changes: 14 additions & 14 deletions inc/feedback.class.php → inc/class-feedback.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* @since 0.1
*/
class slickSliderFeedback {
class Slick_Slider_Feedback {

/**
* Add warning if PHP and/or WordPress version is too low.
Expand All @@ -15,12 +15,12 @@ class slickSliderFeedback {
*/
public static function rules() {

switch ( slickSliderMain::currentPage() ) {
switch ( Slick_Slider_Main::current_page() ) {
case 'plugins' :
case 'options-media' :
if ( ! slickSliderMain::isMinWp( '4.4' ) ) {
self::add( 'critical', sprintf( '%s: %s %s.', __( 'Attention', 'slick-slider' ), __( 'Slick Slider requires at least WordPress', 'slick-slider' ), '4.4' ) );
} else if ( ! slickSliderMain::isMinPhp( SLICK_SLIDER_MIN_PHP ) ) {
if ( ! Slick_Slider_Main::is_min_wp( SLICK_SLIDER_MIN_WP ) ) {
self::add( 'critical', sprintf( '%s: %s %s.', __( 'Attention', 'slick-slider' ), __( 'Slick Slider requires at least WordPress', 'slick-slider' ), SLICK_SLIDER_MIN_WP ) );
} elseif ( ! Slick_Slider_Main::is_min_php( SLICK_SLIDER_MIN_PHP ) ) {
self::add( 'critical', sprintf( '%s: %s %s.', __( 'Attention', 'slick-slider' ), __( 'Slick Slider requires at least PHP', 'slick-slider' ), SLICK_SLIDER_MIN_PHP ) );
}
break;
Expand All @@ -40,15 +40,15 @@ public static function rules() {
*/
public static function add( $type, $msg ) {

if ( empty( $type ) OR empty( $msg ) OR ! in_array( $type, array(
if ( empty( $type ) || empty( $msg ) || ! in_array( $type, array(
'critical',
'notice'
) ) ) {
return false;
}
$data = ( array ) slickSliderCache::get( 'feedback' );
$data[$type] = $msg;
SlickSliderCache::set( 'feedback', $data );
$data = (array) Slick_Slider_Cache::get( 'feedback' );
$data[ $type ] = $msg;
Slick_Slider_Cache::set( 'feedback', $data );

}

Expand All @@ -62,7 +62,7 @@ public static function add( $type, $msg ) {
*/
public static function get( $type = '' ) {

$data = ( array ) slickSliderCache::get( 'feedback' );
$data = (array) Slick_Slider_Cache::get( 'feedback' );
if ( empty( $data ) ) {
return false;
}
Expand All @@ -72,8 +72,8 @@ public static function get( $type = '' ) {
if ( in_array( $type, array(
'critical',
'notice'
) ) && ! empty( $data[$type] ) ) {
return $data[$type];
) ) && ! empty( $data[ $type ] ) ) {
return $data[ $type ];
}
return false;

Expand Down Expand Up @@ -122,11 +122,11 @@ private static function _display() {
foreach ( $errors as $type => $msg ) {
echo sprintf(
'<div class="notice notice-%s is-dismissible"><p>%s</p></div>',
esc_attr( $matrix[$type] ),
esc_attr( $matrix[ $type ] ),
$msg
);
}

}

}
}
50 changes: 25 additions & 25 deletions inc/gui.class.php → inc/class-gui.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* @since 0.1
*/
class slickSliderGui {
class Slick_Slider_Gui {

/**
* If set to true, skip saving Slick Slider options to database.
Expand All @@ -18,7 +18,7 @@ class slickSliderGui {
*
* @var boolean $skip_saving Whether to skip saving.
*/
private static $skipSaving = false;
private static $skip_saving = false;

/**
* Enqueue assets,
Expand All @@ -27,7 +27,7 @@ class slickSliderGui {
*
* @since 0.1
*/
public static function initSettings() {
public static function init_settings() {

if ( ! current_user_can( 'manage_options' ) ) {
return;
Expand All @@ -36,22 +36,22 @@ public static function initSettings() {
'admin_enqueue_scripts',
array(
__CLASS__,
'addCss'
'add_css'
)
);
add_action(
'admin_print_styles',
array(
__CLASS__,
'addJs'
'add_js'
)
);

add_action(
'load-options-media.php',
array(
__CLASS__,
'addHelpTab'
'add_help_tab'
)
);

Expand All @@ -60,13 +60,13 @@ public static function initSettings() {
__( 'Slick Slider settings', 'slick-slider' ),
array(
__CLASS__,
'settingSectionCallback'
'setting_section_callback'
),
'media'
);

$pagenow = slickSliderMain::currentPage();
slickSliderOptions::renderSettingsMarkup( $pagenow );
$pagenow = Slick_Slider_Main::current_page();
Slick_Slider_Options::render_settings_markup( $pagenow );

}

Expand All @@ -75,15 +75,15 @@ public static function initSettings() {
*
* @since 0.1
*/
public static function addCss() {
public static function add_css() {

$assetSuffix = slickSliderMain::getAssetSuffix();
$assetSuffix = Slick_Slider_Main::get_asset_suffix();

wp_enqueue_style(
'slick-slider-options-media',
slickSliderMain::pluginUrl( "css/slick-slider-options-media{$assetSuffix}.css" ),
Slick_Slider_Main::plugin_url( "css/slick-slider-options-media{$assetSuffix}.css" ),
array(),
slickSliderMain::getPluginData( 'Version' )
Slick_Slider_Main::get_plugin_data( 'Version' )
);

}
Expand All @@ -93,15 +93,15 @@ public static function addCss() {
*
* @since 0.1
*/
public static function addJs() {
public static function add_js() {

$assetSuffix = slickSliderMain::getAssetSuffix();
$assetSuffix = Slick_Slider_Main::get_asset_suffix();

wp_enqueue_script(
'slick-slider-options-media',
slickSliderMain::pluginUrl( "js/slick-slider-options-media{$assetSuffix}.js" ),
Slick_Slider_Main::plugin_url( "js/slick-slider-options-media{$assetSuffix}.js" ),
array( 'jquery-ui-accordion' ),
slickSliderMain::getPluginData( 'Version' )
Slick_Slider_Main::get_plugin_data( 'Version' )
);

}
Expand All @@ -111,7 +111,7 @@ public static function addJs() {
*
* @since 0.1
*/
public static function addHelpTab() {
public static function add_help_tab() {
$screen = get_current_screen();
$screen->add_help_tab( array(
'id' => 'slick-slider-help',
Expand All @@ -131,7 +131,7 @@ public static function addHelpTab() {
*
* @since 0.1
*/
public static function settingSectionCallback() {
public static function setting_section_callback() {

wp_nonce_field( '_slick__settings_nonce', '_slick_nonce' );
echo '<a name="slick-slider-settings" id="slick-slider-settings"></a>';
Expand All @@ -150,9 +150,9 @@ public static function settingSectionCallback() {
*
* @since 0.1
*/
public static function saveChanges() {
public static function save_changes() {

if ( self::$skipSaving ) {
if ( self::$skip_saving ) {
return;
}
if ( empty( $_POST ) || empty( $_POST['_slick_action'] ) ) {
Expand All @@ -168,13 +168,13 @@ public static function saveChanges() {
return;
}

self::$skipSaving = true;
self::$skip_saving = true;
$_POST = array_map( 'stripslashes_deep', $_POST );
if ( isset( $_POST['_slick_reset'] ) ) {
slickSliderOptions::reset();
Slick_Slider_Options::reset();
return;
}
slickSliderOptions::update( $_POST, true );
Slick_Slider_Options::update( $_POST, true );

}
}
}
Loading

0 comments on commit 2070a27

Please sign in to comment.