Changeset 460035
- Timestamp:
- 11/06/2011 08:33:08 PM (14 years ago)
- Location:
- rehabtabs/trunk
- Files:
-
- 2 edited
-
options.php (modified) (3 diffs)
-
rehabtabs.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
rehabtabs/trunk/options.php
r457203 r460035 23 23 24 24 function rehabtabs_theme_callback() { 25 $options = get_option( 'rehabtabs_options' ); 25 26 echo '<select name="rehabtabs_options[theme]" id="theme" class="postform">'; 26 27 rehabtabs_scan_themes(); … … 32 33 $options = get_option( 'rehabtabs_options' ); 33 34 $themes_directory = plugin_dir_path( __FILE__ ) . 'themes'; 34 $themes = new DirectoryIterator( $themes_directory ); 35 foreach ( $themes as $theme ) { 36 if ( $theme->isDir() && !$theme->isDot() ) { 37 $theme_items = new FilesystemIterator( $themes_directory . '/' . $theme ); 38 foreach ( $theme_items as $theme_item ) { 39 if ( pathinfo( $theme_item->getFilename(), PATHINFO_EXTENSION ) == 'css' ) { 40 $theme_path = $theme . '/' . $theme_item->getFilename(); 35 if ( class_exists( FilesystemIterator ) ) { 36 $themes = new DirectoryIterator( $themes_directory ); 37 foreach ( $themes as $theme ) { 38 if ( $theme->isDir() && !$theme->isDot() ) { 39 $theme_items = new FilesystemIterator( $themes_directory . '/' . $theme ); 40 foreach ( $theme_items as $theme_item ) { 41 if ( pathinfo( $theme_item->getFilename(), PATHINFO_EXTENSION ) == 'css' ) { 42 $theme_path = $theme . '/' . $theme_item->getFilename(); 43 if ( $get_default ) 44 return $theme_path; 45 echo '<option value="' . $theme_path . '"' . selected( $options['theme'], $theme_path, false ) . '>' . ucfirst( $theme ) . '</option>'; 46 } 47 } 48 } 49 } 50 } else { 51 // Alternative method for PHP version < 5.3.0 52 $themes = scandir( $themes_directory ); 53 foreach ( $themes as $theme ) { 54 if ( is_dir( $themes_directory . '/' . $theme ) ) { 55 foreach ( glob( $themes_directory . '/' . $theme . '/*.css' ) as $theme_item ) { 56 $path_parts = pathinfo( $theme_item ); 57 $theme_path = $theme . '/' . $path_parts['filename'] . '.css'; 41 58 if ( $get_default ) 42 59 return $theme_path; … … 46 63 } 47 64 } 48 echo '<option value="none"' . selected( $options['theme'], 'none' ) . '>None. I\'ll handle the theme myself.</option>'; 49 echo '</select>'; 65 50 66 } 51 67 -
rehabtabs/trunk/rehabtabs.php
r457203 r460035 5 5 Plugin URI: http://vancoder.ca/plugins/rehabtabs 6 6 Description: Use jQuery UI tabs in posts and pages.. 7 Version: 0.17 Version: 1.0 8 8 Author: vancoder 9 9 Author URI: http://vancoder.ca
Note: See TracChangeset
for help on using the changeset viewer.