diff --git a/theme/views_slideshow.theme.inc b/theme/views_slideshow.theme.inc index 33294e0..aced7b2 100644 --- a/theme/views_slideshow.theme.inc +++ b/theme/views_slideshow.theme.inc @@ -70,10 +70,10 @@ function _views_slideshow_preprocess_views_slideshow(&$vars) { foreach ($addons as $addon_id => $addon_info) { foreach ($addon_info['accepts'] as $imp_key => $imp_value) { if (is_array($imp_value)) { - $methods[$imp_key][] = preg_replace('/_(.?)/e',"strtoupper('$1')", $addon_id); + $methods[$imp_key][] = views_slideshow_format_addons_name($addon_id); } else { - $methods[$imp_value][] = preg_replace('/_(.?)/e',"strtoupper('$1')", $addon_id); + $methods[$imp_value][] = views_slideshow_format_addons_name($addon_id); } } } @@ -189,7 +189,7 @@ function theme_views_slideshow_pager_widget_render($vss_id, $view, $settings, $l 'viewsSlideshowPager' => array( $vss_id => array( $location => array( - 'type' => preg_replace('/_(.?)/e',"strtoupper('$1')", $settings['type']), + 'type' => views_slideshow_format_addons_name($settings['type']) ), ), ), @@ -284,7 +284,7 @@ function theme_views_slideshow_controls_widget_render($vss_id, $view, $settings, 'viewsSlideshowControls' => array( $vss_id => array( $location => array( - 'type' => preg_replace('/_(.?)/e',"strtoupper('$1')", $settings['type']), + 'type' => views_slideshow_format_addons_name($settings['type']) ), ), ), diff --git a/views_slideshow.module b/views_slideshow.module index 5628f0d..78cf57d 100644 --- a/views_slideshow.module +++ b/views_slideshow.module @@ -460,3 +460,20 @@ function template_preprocess_views_slideshow_controls_text_next(&$vars) { function template_preprocess_views_slideshow_slide_counter(&$vars) { _views_slideshow_preprocess_views_slideshow_slide_counter($vars); } + +/** + * preg_replace_callback callback(). + * @see views_slideshow_format_addons_name(). + */ +function _views_slideshow_get_preg_strtoupper_callback($matches) { + if (isset($matches[1])) { + return strtoupper($matches[1]); + } +} + +/** + * php5.x preg_replace_callback() method. + */ +function views_slideshow_format_addons_name($subject) { + return preg_replace_callback('/_(.?)/', '_views_slideshow_get_preg_strtoupper_callback', $subject); +} \ No newline at end of file diff --git a/views_slideshow_plugin_style_slideshow.inc b/views_slideshow_plugin_style_slideshow.inc index 150b578..d40a5c5 100644 --- a/views_slideshow_plugin_style_slideshow.inc +++ b/views_slideshow_plugin_style_slideshow.inc @@ -221,7 +221,7 @@ class views_slideshow_plugin_style_slideshow extends views_plugin_style { } // Run any validation on the form settings. - function options_validate(&$form, &$form_state) { + function options_validate($form, &$form_state) { module_load_all_includes('views_slideshow.inc'); $arguments = array(