PluginProbe
Loading Page with Loading Screen / 1.2.4
Loading Page with Loading Screen v1.2.4
1.2.8 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.1.0 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 1.1.20 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 All 46 releases
loading-page / includes / admin_functions.php

admin_functions.php in Loading Page with Loading Screen 1.2.4, at includes/admin_functions.php

73 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 function loading_page_get_screen_list() {
4 $dir = LOADING_PAGE_PLUGIN_DIR . '/loading-screens';
5 $screens = array();
6 if ( file_exists( $dir ) ) {
7 $d = dir( $dir );
8 while ( false !== ( $entry = $d->read() ) ) {
9 if ( '.' !== $entry && '..' !== $entry && is_dir( $dir . '/' . $entry ) ) {
10 $screen_dir = $dir . '/' . $entry . '/';
11 if ( file_exists( $screen_dir . 'config.ini' ) ) {
12 try {
13 $c = parse_ini_file( $screen_dir . 'config.ini', true );
14 } catch ( Exception $err ) {
15 if ( defined('WP_DEBUG') && WP_DEBUG ) {
16 error_log( $err->getMessage() );
17 }
18 }
19
20 if ( empty( $c ) ) {
21 try {
22 $c = parse_ini_string( file_get_contents( $screen_dir . 'config.ini' ), true );
23 } catch ( Exception $err ) {
24 if ( defined('WP_DEBUG') && WP_DEBUG ) {
25 error_log( $err->getMessage() );
26 }
27 }
28 }
29
30 if ( empty( $c ) || ! is_array( $c ) ) {
31 $c = array();
32 }
33
34 if ( ! empty( $c ) && ! empty( $c['script'] ) ) {
35 $c['script'] = LOADING_PAGE_PLUGIN_URL . '/loading-screens/' . $entry . '/' . $c['script'];
36 }
37
38 if ( ! empty( $c ) && ! empty( $c['adminscript'] ) ) {
39 $c['adminscript'] = LOADING_PAGE_PLUGIN_URL . '/loading-screens/' . $entry . '/' . $c['adminscript'];
40 }
41
42 if ( ! empty( $c ) && ! empty( $c['adminsection'] ) ) {
43 $c['adminsection'] = LOADING_PAGE_PLUGIN_DIR . '/loading-screens/' . $entry . '/' . $c['adminsection'];
44 }
45
46 if ( ! empty( $c ) && ! empty( $c['style'] ) ) {
47 $c['style'] = LOADING_PAGE_PLUGIN_URL . '/loading-screens/' . $entry . '/' . $c['style'];
48 }
49
50 $screens[] = $c;
51
52 }
53 }
54 }
55 $d->close();
56 }
57
58 return $screens;
59 }
60
61 function loading_page_get_screen( $id ) {
62 $screens = loading_page_get_screen_list();
63 if ( ! empty( $screens ) ) {
64 foreach ( $screens as $s ) {
65 if ( $s['id'] == $id ) {
66 return $s;
67 }
68 }
69 return $screens[0];
70 }
71 return false;
72 }
73