@@ -1,65 +1,65 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; ?> |
|
1 | +<?php if (!defined('ABSPATH')) exit; ?> |
|
2 | 2 | |
3 | 3 | <div class="tablenav top"> |
4 | 4 | <div class="tablenav-pages"> |
5 | - <span class="displaying-num"><?php echo !empty( $array_service ) ? count( $array_service ) : 0; _e( ' item(s)', 'wpeolog-i18n' ); ?></span> |
|
5 | + <span class="displaying-num"><?php echo !empty($array_service) ? count($array_service) : 0; _e(' item(s)', 'wpeolog-i18n'); ?></span> |
|
6 | 6 | </div> |
7 | 7 | </div> |
8 | 8 | |
9 | 9 | <table class="wp-list-table widefat fixed striped posts"> |
10 | 10 | <thead> |
11 | 11 | <tr> |
12 | - <th scope="col" id="active" class="manage-column"><?php _e( 'Active', 'wpeolog-i18n' ); ?></th> |
|
13 | - <th scope="col" id="title" class="manage-column"><?php _e( 'Title', 'wpeolog-i18n' ); ?></th> |
|
14 | - <th scope="col" id="errors" class="manage-column"><?php _e( 'Errors', 'wpeolog-i18n' ); ?></th> |
|
15 | - <th scope="col" id="warnings" class="manage-column"><?php _e( 'Warnings', 'wpeolog-i18n' ); ?></th> |
|
16 | - <th scope="col" id="size" class="manage-column"><?php _e( 'Size', 'wpeolog-i18n' ); ?></th> |
|
17 | - <th scope="col" id="date" class="manage-column"><?php _e( 'Date', 'wpeolog-i18n' ); ?></th> |
|
12 | + <th scope="col" id="active" class="manage-column"><?php _e('Active', 'wpeolog-i18n'); ?></th> |
|
13 | + <th scope="col" id="title" class="manage-column"><?php _e('Title', 'wpeolog-i18n'); ?></th> |
|
14 | + <th scope="col" id="errors" class="manage-column"><?php _e('Errors', 'wpeolog-i18n'); ?></th> |
|
15 | + <th scope="col" id="warnings" class="manage-column"><?php _e('Warnings', 'wpeolog-i18n'); ?></th> |
|
16 | + <th scope="col" id="size" class="manage-column"><?php _e('Size', 'wpeolog-i18n'); ?></th> |
|
17 | + <th scope="col" id="date" class="manage-column"><?php _e('Date', 'wpeolog-i18n'); ?></th> |
|
18 | 18 | </tr> |
19 | 19 | </thead> |
20 | 20 | <tbody> |
21 | - <?php if ( !empty( $array_service ) ): ?> |
|
22 | - <?php foreach ( $array_service as $key => $service ): ?> |
|
21 | + <?php if (!empty($array_service)): ?> |
|
22 | + <?php foreach ($array_service as $key => $service): ?> |
|
23 | 23 | <tr> |
24 | - <th scope="row"><input disabled type="checkbox" name="service[<?php echo $key; ?>][active]" <?php echo !empty( $service['active'] ) ? 'checked="checked"' : ''; ?> ></th> |
|
24 | + <th scope="row"><input disabled type="checkbox" name="service[<?php echo $key; ?>][active]" <?php echo !empty($service['active']) ? 'checked="checked"' : ''; ?> ></th> |
|
25 | 25 | <td> |
26 | - <a class="view" title="<?php _e( 'View this service', 'wpeolog-i18n' ); ?>" href="<?php echo wp_nonce_url( admin_url( 'tools.php?page=wpeo-log-page&service_id=' . $key . '&action=view&type=info' ), 'view_' . $key ); ?>"><?php echo !empty( $service['name'] ) ? $service['name'] : ''; ?></a> |
|
26 | + <a class="view" title="<?php _e('View this service', 'wpeolog-i18n'); ?>" href="<?php echo wp_nonce_url(admin_url('tools.php?page=wpeo-log-page&service_id=' . $key . '&action=view&type=info'), 'view_' . $key); ?>"><?php echo !empty($service['name']) ? $service['name'] : ''; ?></a> |
|
27 | 27 | <div class="row-actions"> |
28 | - <span class="view"><a class="view" title="<?php _e( 'View this service', 'wpeolog-i18n' ); ?>" href="<?php echo admin_url( 'tools.php?page=wpeo-log-page&service_id=' . $key . '&action=view&type=info' ); ?>"><?php _e( 'View', 'wpeolog-i18n' ); ?></a> </span> |
|
29 | - <span class="trash"><a class="submitdelete" title="<?php _e( 'Move this service to the Trash', 'wpeolog-i18n' ); ?>" href="<?php echo wp_nonce_url( admin_url( 'admin-post.php?service_id=' . $key . '&action=to_trash' ), 'to_trash_' . $key ); ?>"><?php _e( 'Trash', 'wpeolog-i18n' ); ?></a> </span> |
|
28 | + <span class="view"><a class="view" title="<?php _e('View this service', 'wpeolog-i18n'); ?>" href="<?php echo admin_url('tools.php?page=wpeo-log-page&service_id=' . $key . '&action=view&type=info'); ?>"><?php _e('View', 'wpeolog-i18n'); ?></a> </span> |
|
29 | + <span class="trash"><a class="submitdelete" title="<?php _e('Move this service to the Trash', 'wpeolog-i18n'); ?>" href="<?php echo wp_nonce_url(admin_url('admin-post.php?service_id=' . $key . '&action=to_trash'), 'to_trash_' . $key); ?>"><?php _e('Trash', 'wpeolog-i18n'); ?></a> </span> |
|
30 | 30 | </div> |
31 | 31 | </td> |
32 | - <td><a href="<?php echo admin_url( 'tools.php?page=wpeo-log-page&service_id=' . $key . '&action=view&type=error' ); ?>"><?php echo $service['error']['count']; ?></a></td> |
|
33 | - <td><a href="<?php echo admin_url( 'tools.php?page=wpeo-log-page&service_id=' . $key . '&action=view&type=warning' ); ?>"><?php echo $service['warning']['count']; ?></a></td> |
|
32 | + <td><a href="<?php echo admin_url('tools.php?page=wpeo-log-page&service_id=' . $key . '&action=view&type=error'); ?>"><?php echo $service['error']['count']; ?></a></td> |
|
33 | + <td><a href="<?php echo admin_url('tools.php?page=wpeo-log-page&service_id=' . $key . '&action=view&type=warning'); ?>"><?php echo $service['warning']['count']; ?></a></td> |
|
34 | 34 | <td> |
35 | 35 | <?php |
36 | - echo !empty( $service['size'] ) ? $this->convert_to( $service['size'], $service['format'] , false ) : ''; |
|
37 | - echo !empty( $service['format'] ) ? $service['format'] : 'oc' |
|
36 | + echo !empty($service['size']) ? $this->convert_to($service['size'], $service['format'], false) : ''; |
|
37 | + echo !empty($service['format']) ? $service['format'] : 'oc' |
|
38 | 38 | ?> |
39 | 39 | </td> |
40 | - <td><?php echo mysql2date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $service['created_date'], true ); ?></td> |
|
40 | + <td><?php echo mysql2date(get_option('date_format') . ' ' . get_option('time_format'), $service['created_date'], true); ?></td> |
|
41 | 41 | </tr> |
42 | 42 | <?php endforeach; ?> |
43 | 43 | <?php else: ?> |
44 | 44 | <tr> |
45 | - <td><?php _e( 'No services found.', 'wpeolog-i18n' ); ?></td> |
|
45 | + <td><?php _e('No services found.', 'wpeolog-i18n'); ?></td> |
|
46 | 46 | </tr> |
47 | 47 | <?php endif; ?> |
48 | 48 | </tbody> |
49 | 49 | <tfoot> |
50 | 50 | <tr> |
51 | - <th scope="col" id="id" class="manage-column"><?php _e( 'Active', 'wpeolog-i18n' ); ?></th> |
|
52 | - <th scope="col" id="active" class="manage-column"><?php _e( 'Title', 'wpeolog-i18n' ); ?></th> |
|
53 | - <th scope="col" id="size" class="manage-column"><?php _e( 'Errors', 'wpeolog-i18n' ); ?></th> |
|
54 | - <th scope="col" id="size-format" class="manage-column"><?php _e( 'Warnings', 'wpeolog-i18n' ); ?></th> |
|
55 | - <th scope="col" id="number-file" class="manage-column"><?php _e( 'Size', 'wpeolog-i18n' ); ?></th> |
|
56 | - <th scope="col" id="number-file" class="manage-column"><?php _e( 'Date', 'wpeolog-i18n' ); ?></th> |
|
51 | + <th scope="col" id="id" class="manage-column"><?php _e('Active', 'wpeolog-i18n'); ?></th> |
|
52 | + <th scope="col" id="active" class="manage-column"><?php _e('Title', 'wpeolog-i18n'); ?></th> |
|
53 | + <th scope="col" id="size" class="manage-column"><?php _e('Errors', 'wpeolog-i18n'); ?></th> |
|
54 | + <th scope="col" id="size-format" class="manage-column"><?php _e('Warnings', 'wpeolog-i18n'); ?></th> |
|
55 | + <th scope="col" id="number-file" class="manage-column"><?php _e('Size', 'wpeolog-i18n'); ?></th> |
|
56 | + <th scope="col" id="number-file" class="manage-column"><?php _e('Date', 'wpeolog-i18n'); ?></th> |
|
57 | 57 | </tr> |
58 | 58 | </tfoot> |
59 | 59 | </table> |
60 | 60 | |
61 | 61 | <div class="tablenav bottom"> |
62 | 62 | <div class="alignleft actions bulkactions"> |
63 | - <a href="<?php echo admin_url( 'tools.php?page=wpeo-log-page&action=edit' ); ?>" class="button button-primary"><?php _e( 'Quick edit', 'wpeolog-i18n'); ?></a> |
|
63 | + <a href="<?php echo admin_url('tools.php?page=wpeo-log-page&action=edit'); ?>" class="button button-primary"><?php _e('Quick edit', 'wpeolog-i18n'); ?></a> |
|
64 | 64 | </div> |
65 | 65 | </div> |
66 | 66 | \ No newline at end of file |
@@ -1,4 +1,7 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; ?> |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
4 | +?> |
|
2 | 5 | |
3 | 6 | <div class="tablenav top"> |
4 | 7 | <div class="tablenav-pages"> |
@@ -40,9 +43,12 @@ discard block |
||
40 | 43 | <td><?php echo mysql2date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $service['created_date'], true ); ?></td> |
41 | 44 | </tr> |
42 | 45 | <?php endforeach; ?> |
43 | - <?php else: ?> |
|
46 | + <?php else { |
|
47 | + : ?> |
|
44 | 48 | <tr> |
45 | - <td><?php _e( 'No services found.', 'wpeolog-i18n' ); ?></td> |
|
49 | + <td><?php _e( 'No services found.', 'wpeolog-i18n' ); |
|
50 | +} |
|
51 | +?></td> |
|
46 | 52 | </tr> |
47 | 53 | <?php endif; ?> |
48 | 54 | </tbody> |
@@ -1,56 +1,56 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -$service_id = (int) $_GET['service_id']; |
|
3 | -$sanitize_type = sanitize_text_field( $_GET['type'] ); |
|
4 | -$sanitize_key = (int) $_GET['key']; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +$service_id = (int)$_GET['service_id']; |
|
3 | +$sanitize_type = sanitize_text_field($_GET['type']); |
|
4 | +$sanitize_key = (int)$_GET['key']; |
|
5 | 5 | |
6 | 6 | ?> |
7 | 7 | |
8 | 8 | <div class="tablenav bottom"> |
9 | 9 | <div class="alignleft actions bulkactions"> |
10 | - <a href="<?php echo admin_url( 'tools.php?page=wpeo-log-page' ); ?>" class="button"><?php _e( 'Back', 'wpeolog-i18n'); ?></a> |
|
10 | + <a href="<?php echo admin_url('tools.php?page=wpeo-log-page'); ?>" class="button"><?php _e('Back', 'wpeolog-i18n'); ?></a> |
|
11 | 11 | </div> |
12 | 12 | </div> |
13 | 13 | |
14 | -<h3><?php _e( 'Archive', 'wpeolog-i18n' ); ?></h3> |
|
14 | +<h3><?php _e('Archive', 'wpeolog-i18n'); ?></h3> |
|
15 | 15 | <table class="wp-list-table widefat fixed striped posts"> |
16 | 16 | <thead> |
17 | 17 | <tr> |
18 | - <th scope="col" id="active" class="manage-column"><?php _e( 'Title', 'wpeolog-i18n' ); ?></th> |
|
19 | - <th scope="col" id="title" class="manage-column"><?php _e( 'Size', 'wpeolog-i18n' ); ?></th> |
|
18 | + <th scope="col" id="active" class="manage-column"><?php _e('Title', 'wpeolog-i18n'); ?></th> |
|
19 | + <th scope="col" id="title" class="manage-column"><?php _e('Size', 'wpeolog-i18n'); ?></th> |
|
20 | 20 | </tr> |
21 | 21 | </thead> |
22 | 22 | <tbody> |
23 | - <?php if ( !empty( $list_archive_file ) ): ?> |
|
24 | - <?php foreach ( $list_archive_file as $key => $archive_file ): ?> |
|
23 | + <?php if (!empty($list_archive_file)): ?> |
|
24 | + <?php foreach ($list_archive_file as $key => $archive_file): ?> |
|
25 | 25 | <tr> |
26 | 26 | <td> |
27 | - <?php if ( isset( $sanitize_key ) && $sanitize_key == $key ): ?> |
|
28 | - <?php echo substr( $archive_file, 0, -4 ); ?> |
|
27 | + <?php if (isset($sanitize_key) && $sanitize_key == $key): ?> |
|
28 | + <?php echo substr($archive_file, 0, -4); ?> |
|
29 | 29 | <?php else: ?> |
30 | - <a href="<?php echo admin_url( 'tools.php?page=wpeo-log-page&service_id=' . $service_id . '&action=view&type=' .$sanitize_type . '&key=' . $key ); ?>"><?php echo substr( $archive_file, 0, -4 ); ?></a> |
|
30 | + <a href="<?php echo admin_url('tools.php?page=wpeo-log-page&service_id=' . $service_id . '&action=view&type=' . $sanitize_type . '&key=' . $key); ?>"><?php echo substr($archive_file, 0, -4); ?></a> |
|
31 | 31 | <?php endif; ?> |
32 | 32 | <div class="row-actions"> |
33 | - <span class="trash"><a class="submitdelete" title="<?php _e( 'Move this item to the Trash', 'wpeolog-i18n' ); ?>" href="<?php echo wp_nonce_url( admin_url( 'admin-post.php?file_name=' . $archive_file . '&action=file_to_trash' ), 'to_trash_' . $key ); ?>"><?php _e( 'Trash', 'wpeolog-i18n' ); ?></a> </span> |
|
33 | + <span class="trash"><a class="submitdelete" title="<?php _e('Move this item to the Trash', 'wpeolog-i18n'); ?>" href="<?php echo wp_nonce_url(admin_url('admin-post.php?file_name=' . $archive_file . '&action=file_to_trash'), 'to_trash_' . $key); ?>"><?php _e('Trash', 'wpeolog-i18n'); ?></a> </span> |
|
34 | 34 | </div> |
35 | 35 | </td> |
36 | - <td><?php echo filesize( $dir_file . $archive_file ); ?>oc</td> |
|
36 | + <td><?php echo filesize($dir_file . $archive_file); ?>oc</td> |
|
37 | 37 | </tr> |
38 | 38 | <?php endforeach; ?> |
39 | 39 | <?php else: ?> |
40 | - <tr><td><?php _e( 'No archive file', 'wpeolog-i18n' ); ?></td></tr> |
|
40 | + <tr><td><?php _e('No archive file', 'wpeolog-i18n'); ?></td></tr> |
|
41 | 41 | <?php endif; ?> |
42 | 42 | </tbody> |
43 | 43 | <tfoot> |
44 | 44 | <tr> |
45 | - <th scope="col" id="active" class="manage-column"><?php _e( 'Title', 'wpeolog-i18n' ); ?></th> |
|
46 | - <th scope="col" id="size" class="manage-column"><?php _e( 'Size', 'wpeolog-i18n' ); ?></th> |
|
45 | + <th scope="col" id="active" class="manage-column"><?php _e('Title', 'wpeolog-i18n'); ?></th> |
|
46 | + <th scope="col" id="size" class="manage-column"><?php _e('Size', 'wpeolog-i18n'); ?></th> |
|
47 | 47 | </tr> |
48 | 48 | </tfoot> |
49 | 49 | </table> |
50 | 50 | |
51 | 51 | <br /> |
52 | 52 | |
53 | -<h3><?php _e( 'Data', 'wpeolog-i18n' ); ?></h3> |
|
53 | +<h3><?php _e('Data', 'wpeolog-i18n'); ?></h3> |
|
54 | 54 | <table id='wpeo-table-data-csv' class="tablesorter wp-list-table widefat fixed posts"> |
55 | 55 | <thead> |
56 | 56 | <tr> |
@@ -65,20 +65,20 @@ discard block |
||
65 | 65 | </thead> |
66 | 66 | |
67 | 67 | <tbody> |
68 | - <?php if ( !empty( $file ) ): ?> |
|
69 | - <?php foreach ( $file as $key => $value ): |
|
70 | - $user_email = !empty( $value[1] ) ? get_userdata( $value[1] ) : __( 'Empty', 'wpeolog-i18n' ); |
|
71 | - if ( gettype( $user_email ) == 'object' ) { |
|
68 | + <?php if (!empty($file)): ?> |
|
69 | + <?php foreach ($file as $key => $value): |
|
70 | + $user_email = !empty($value[1]) ? get_userdata($value[1]) : __('Empty', 'wpeolog-i18n'); |
|
71 | + if (gettype($user_email) == 'object') { |
|
72 | 72 | $user_email = $user_email->user_email; |
73 | 73 | } |
74 | 74 | |
75 | 75 | ?> |
76 | 76 | <tr> |
77 | - <td><?php echo esc_html( $user_email ); ?></td> |
|
78 | - <td><?php echo !empty( $value[5] ) ? esc_html( $value[5] ) : 0; ?></td> |
|
79 | - <td><?php echo !empty( $value[3] ) ? esc_html( $value[3] ) : __( 'Empty', 'wpeolog-i18n' ); ?></td> |
|
80 | - <td><?php echo !(empty($value[4])) ? trim(esc_html( $value[4] ), "\"" ) : __('Empty', 'wpeolog-i18n'); ?></td> |
|
81 | - <td><?php echo !(empty($value[0])) ? mysql2date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), esc_html( $value[0] ), true ) : __('Empty', 'wpeolog-i18n'); ?></td> |
|
77 | + <td><?php echo esc_html($user_email); ?></td> |
|
78 | + <td><?php echo !empty($value[5]) ? esc_html($value[5]) : 0; ?></td> |
|
79 | + <td><?php echo !empty($value[3]) ? esc_html($value[3]) : __('Empty', 'wpeolog-i18n'); ?></td> |
|
80 | + <td><?php echo !(empty($value[4])) ? trim(esc_html($value[4]), "\"") : __('Empty', 'wpeolog-i18n'); ?></td> |
|
81 | + <td><?php echo !(empty($value[0])) ? mysql2date(get_option('date_format') . ' ' . get_option('time_format'), esc_html($value[0]), true) : __('Empty', 'wpeolog-i18n'); ?></td> |
|
82 | 82 | </tr> |
83 | 83 | <?php endforeach; ?> |
84 | 84 | <?php else: ?> |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | $service_id = (int) $_GET['service_id']; |
3 | 5 | $sanitize_type = sanitize_text_field( $_GET['type'] ); |
4 | 6 | $sanitize_key = (int) $_GET['key']; |
@@ -26,8 +28,11 @@ discard block |
||
26 | 28 | <td> |
27 | 29 | <?php if ( isset( $sanitize_key ) && $sanitize_key == $key ): ?> |
28 | 30 | <?php echo substr( $archive_file, 0, -4 ); ?> |
29 | - <?php else: ?> |
|
30 | - <a href="<?php echo admin_url( 'tools.php?page=wpeo-log-page&service_id=' . $service_id . '&action=view&type=' .$sanitize_type . '&key=' . $key ); ?>"><?php echo substr( $archive_file, 0, -4 ); ?></a> |
|
31 | + <?php else { |
|
32 | + : ?> |
|
33 | + <a href="<?php echo admin_url( 'tools.php?page=wpeo-log-page&service_id=' . $service_id . '&action=view&type=' .$sanitize_type . '&key=' . $key ); |
|
34 | +} |
|
35 | +?>"><?php echo substr( $archive_file, 0, -4 ); ?></a> |
|
31 | 36 | <?php endif; ?> |
32 | 37 | <div class="row-actions"> |
33 | 38 | <span class="trash"><a class="submitdelete" title="<?php _e( 'Move this item to the Trash', 'wpeolog-i18n' ); ?>" href="<?php echo wp_nonce_url( admin_url( 'admin-post.php?file_name=' . $archive_file . '&action=file_to_trash' ), 'to_trash_' . $key ); ?>"><?php _e( 'Trash', 'wpeolog-i18n' ); ?></a> </span> |
@@ -36,8 +41,11 @@ discard block |
||
36 | 41 | <td><?php echo filesize( $dir_file . $archive_file ); ?>oc</td> |
37 | 42 | </tr> |
38 | 43 | <?php endforeach; ?> |
39 | - <?php else: ?> |
|
40 | - <tr><td><?php _e( 'No archive file', 'wpeolog-i18n' ); ?></td></tr> |
|
44 | + <?php else { |
|
45 | + : ?> |
|
46 | + <tr><td><?php _e( 'No archive file', 'wpeolog-i18n' ); |
|
47 | +} |
|
48 | +?></td></tr> |
|
41 | 49 | <?php endif; ?> |
42 | 50 | </tbody> |
43 | 51 | <tfoot> |
@@ -81,9 +89,12 @@ discard block |
||
81 | 89 | <td><?php echo !(empty($value[0])) ? mysql2date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), esc_html( $value[0] ), true ) : __('Empty', 'wpeolog-i18n'); ?></td> |
82 | 90 | </tr> |
83 | 91 | <?php endforeach; ?> |
84 | - <?php else: ?> |
|
92 | + <?php else { |
|
93 | + : ?> |
|
85 | 94 | <tr> |
86 | - <td><?php _e('Nothing to display, select your log of file', 'wpeolog-i18n'); ?></td> |
|
95 | + <td><?php _e('Nothing to display, select your log of file', 'wpeolog-i18n'); |
|
96 | +} |
|
97 | +?></td> |
|
87 | 98 | </tr> |
88 | 99 | <?php endif; ?> |
89 | 100 |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | /** |
3 | 3 | * wpeo_template_01 file definition for project plugin |
4 | 4 | * |
@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | * @version 1.0 |
14 | 14 | */ |
15 | 15 | |
16 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
16 | +if (!defined('ABSPATH')) exit; |
|
17 | 17 | |
18 | -if ( !class_exists( 'wpeo_template_01' ) ) { |
|
18 | +if (!class_exists('wpeo_template_01')) { |
|
19 | 19 | class wpeo_template_01 { |
20 | 20 | /** |
21 | 21 | * INTERNAL LIB - Check and get the template file path to use for a given display part |
@@ -28,42 +28,42 @@ discard block |
||
28 | 28 | * @param string $name The name of the specialised template. |
29 | 29 | * @return string The template file path to use |
30 | 30 | */ |
31 | - static function get_template_part( $plugin_dir_name, $main_template_dir, $side, $slug, $name=null, $debug = null ) { |
|
31 | + static function get_template_part($plugin_dir_name, $main_template_dir, $side, $slug, $name = null, $debug = null) { |
|
32 | 32 | $path = ''; |
33 | 33 | |
34 | 34 | $templates = array(); |
35 | 35 | $name = (string)$name; |
36 | - if ( '' !== $name ) |
|
36 | + if ('' !== $name) |
|
37 | 37 | $templates[] = "{$side}/{$slug}-{$name}.php"; |
38 | 38 | $templates[] = "{$side}/{$slug}.php"; |
39 | 39 | |
40 | 40 | /** Check if required template exists into current theme */ |
41 | 41 | $check_theme_template = array(); |
42 | - foreach ( $templates as $template ) { |
|
42 | + foreach ($templates as $template) { |
|
43 | 43 | $check_theme_template = $plugin_dir_name . "/" . $template; |
44 | - $path = locate_template( $check_theme_template, false ); |
|
45 | - if ( !empty( $path ) ) { |
|
44 | + $path = locate_template($check_theme_template, false); |
|
45 | + if (!empty($path)) { |
|
46 | 46 | break; |
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
50 | 50 | /** Allow debugging */ |
51 | - if ( !empty( $debug ) ) { |
|
51 | + if (!empty($debug)) { |
|
52 | 52 | echo '--- Debug mode ON - Start ---<br/>'; |
53 | 53 | echo __FILE__ . '<br/>'; |
54 | 54 | echo 'Debug for display method<br/>'; |
55 | 55 | } |
56 | 56 | |
57 | - if ( empty( $path ) ) { |
|
58 | - foreach ( (array) $templates as $template_name ) { |
|
59 | - if ( !$template_name ) |
|
57 | + if (empty($path)) { |
|
58 | + foreach ((array)$templates as $template_name) { |
|
59 | + if (!$template_name) |
|
60 | 60 | continue; |
61 | 61 | |
62 | - if ( !empty( $debug ) ) { |
|
62 | + if (!empty($debug)) { |
|
63 | 63 | echo __LINE__ . ' - ' . $main_template_dir . $template_name . '<hr/>'; |
64 | 64 | } |
65 | 65 | |
66 | - if ( file_exists( $main_template_dir . $template_name ) ) { |
|
66 | + if (file_exists($main_template_dir . $template_name)) { |
|
67 | 67 | $path = $main_template_dir . $template_name; |
68 | 68 | break; |
69 | 69 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | /** Allow debugging */ |
77 | - if ( !empty( $debug ) ) { |
|
77 | + if (!empty($debug)) { |
|
78 | 78 | echo '--- Debug mode ON - END ---<br/><br/>'; |
79 | 79 | } |
80 | 80 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * wpeo_template_01 file definition for project plugin |
4 | 6 | * |
@@ -13,7 +15,9 @@ discard block |
||
13 | 15 | * @version 1.0 |
14 | 16 | */ |
15 | 17 | |
16 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
18 | +if ( ! defined( 'ABSPATH' ) ) { |
|
19 | + exit; |
|
20 | +} |
|
17 | 21 | |
18 | 22 | if ( !class_exists( 'wpeo_template_01' ) ) { |
19 | 23 | class wpeo_template_01 { |
@@ -33,8 +37,9 @@ discard block |
||
33 | 37 | |
34 | 38 | $templates = array(); |
35 | 39 | $name = (string)$name; |
36 | - if ( '' !== $name ) |
|
37 | - $templates[] = "{$side}/{$slug}-{$name}.php"; |
|
40 | + if ( '' !== $name ) { |
|
41 | + $templates[] = "{$side}/{$slug}-{$name}.php"; |
|
42 | + } |
|
38 | 43 | $templates[] = "{$side}/{$slug}.php"; |
39 | 44 | |
40 | 45 | /** Check if required template exists into current theme */ |
@@ -56,8 +61,9 @@ discard block |
||
56 | 61 | |
57 | 62 | if ( empty( $path ) ) { |
58 | 63 | foreach ( (array) $templates as $template_name ) { |
59 | - if ( !$template_name ) |
|
60 | - continue; |
|
64 | + if ( !$template_name ) { |
|
65 | + continue; |
|
66 | + } |
|
61 | 67 | |
62 | 68 | if ( !empty( $debug ) ) { |
63 | 69 | echo __LINE__ . ' - ' . $main_template_dir . $template_name . '<hr/>'; |
@@ -68,8 +74,7 @@ discard block |
||
68 | 74 | break; |
69 | 75 | } |
70 | 76 | } |
71 | - } |
|
72 | - else { |
|
77 | + } else { |
|
73 | 78 | echo ''; |
74 | 79 | } |
75 | 80 |
@@ -1,27 +1,27 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | |
3 | -if ( !class_exists( 'wpeo_util' ) ) { |
|
3 | +if (!class_exists('wpeo_util')) { |
|
4 | 4 | class wpeo_util { |
5 | - public static $array_exclude_module = array( 'wpeo_timeline', 'wpeo_files', 'wpeo_project_data_transfert', 'wpeo_calendar' ); |
|
5 | + public static $array_exclude_module = array('wpeo_timeline', 'wpeo_files', 'wpeo_project_data_transfert', 'wpeo_calendar'); |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * CORE - Install all extra-modules in "Core/Module" folder |
9 | 9 | */ |
10 | - public static function install_in( $folder ) { |
|
10 | + public static function install_in($folder) { |
|
11 | 11 | /** Define the directory containing all exrta-modules for current plugin */ |
12 | 12 | $module_folder = WPEOMTM_TASK_PATH . '/' . $folder . '/'; |
13 | 13 | |
14 | 14 | /** Check if the defined directory exists for reading and including the different modules */ |
15 | - if( is_dir( $module_folder ) ) { |
|
16 | - $parent_folder_content = scandir( $module_folder ); |
|
17 | - foreach ( $parent_folder_content as $folder ) { |
|
18 | - if ( $folder && substr( $folder, 0, 1) != '.' && !in_array( $folder, self::$array_exclude_module ) ) { |
|
19 | - if( is_dir ( $module_folder . $folder ) ) |
|
20 | - $child_folder_content = scandir( $module_folder . $folder ); |
|
15 | + if (is_dir($module_folder)) { |
|
16 | + $parent_folder_content = scandir($module_folder); |
|
17 | + foreach ($parent_folder_content as $folder) { |
|
18 | + if ($folder && substr($folder, 0, 1) != '.' && !in_array($folder, self::$array_exclude_module)) { |
|
19 | + if (is_dir($module_folder . $folder)) |
|
20 | + $child_folder_content = scandir($module_folder . $folder); |
|
21 | 21 | |
22 | - if ( file_exists( $module_folder . $folder . '/' . $folder . '.php') ) { |
|
23 | - $f = $module_folder . $folder . '/' . $folder . '.php'; |
|
24 | - include( $f ); |
|
22 | + if (file_exists($module_folder . $folder . '/' . $folder . '.php')) { |
|
23 | + $f = $module_folder . $folder . '/' . $folder . '.php'; |
|
24 | + include($f); |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 | } |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | |
3 | 5 | if ( !class_exists( 'wpeo_util' ) ) { |
4 | 6 | class wpeo_util { |
@@ -16,8 +18,9 @@ discard block |
||
16 | 18 | $parent_folder_content = scandir( $module_folder ); |
17 | 19 | foreach ( $parent_folder_content as $folder ) { |
18 | 20 | if ( $folder && substr( $folder, 0, 1) != '.' && !in_array( $folder, self::$array_exclude_module ) ) { |
19 | - if( is_dir ( $module_folder . $folder ) ) |
|
20 | - $child_folder_content = scandir( $module_folder . $folder ); |
|
21 | + if( is_dir ( $module_folder . $folder ) ) { |
|
22 | + $child_folder_content = scandir( $module_folder . $folder ); |
|
23 | + } |
|
21 | 24 | |
22 | 25 | if ( file_exists( $module_folder . $folder . '/' . $folder . '.php') ) { |
23 | 26 | $f = $module_folder . $folder . '/' . $folder . '.php'; |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | /** |
3 | 3 | * Plugin Name: Gestion des modules internes / Internal module management |
4 | 4 | * Description: Permet d'activer ou de désactiver les différents modules internes présents dans le dossier modules / Allow to activate or deactivate internal modules present into modules directory |
@@ -14,32 +14,32 @@ discard block |
||
14 | 14 | */ |
15 | 15 | |
16 | 16 | /* Check if file is include. No direct access possible with file url */ |
17 | -if ( !defined( 'WPSHOP_VERSION' ) ) { |
|
18 | - die( __('Access is not allowed by this way', 'wpshop') ); |
|
17 | +if (!defined('WPSHOP_VERSION')) { |
|
18 | + die(__('Access is not allowed by this way', 'wpshop')); |
|
19 | 19 | } |
20 | 20 | |
21 | -if ( !defined( 'EOMODMAN_VERSION' ) ) { |
|
21 | +if (!defined('EOMODMAN_VERSION')) { |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Define the current version for the plugin. Interresting for clear cache for plugin style and script |
25 | 25 | * @var string Plugin current version number |
26 | 26 | */ |
27 | - DEFINE( 'EOMODMAN_VERSION', '1.0'); |
|
27 | + DEFINE('EOMODMAN_VERSION', '1.0'); |
|
28 | 28 | |
29 | 29 | /** Définition des constantes pour le module / Define constant for module */ |
30 | - DEFINE( 'EOMODMAN_DIR', basename(dirname(__FILE__))); |
|
31 | - DEFINE( 'EOMODMAN_PATH_TO_MODULE', str_replace( str_replace( "\\", "/", WP_PLUGIN_DIR ), "", str_replace( "\\", "/", plugin_dir_path( __FILE__ ) ) ) ); |
|
32 | - DEFINE( 'EOMODMAN_PATH', str_replace( "\\", "/", plugin_dir_path( __FILE__ ) ) ); |
|
33 | - DEFINE( 'EOMODMAN_URL', str_replace( str_replace( "\\", "/", ABSPATH), site_url() . '/', EOMODMAN_PATH ) ); |
|
30 | + DEFINE('EOMODMAN_DIR', basename(dirname(__FILE__))); |
|
31 | + DEFINE('EOMODMAN_PATH_TO_MODULE', str_replace(str_replace("\\", "/", WP_PLUGIN_DIR), "", str_replace("\\", "/", plugin_dir_path(__FILE__)))); |
|
32 | + DEFINE('EOMODMAN_PATH', str_replace("\\", "/", plugin_dir_path(__FILE__))); |
|
33 | + DEFINE('EOMODMAN_URL', str_replace(str_replace("\\", "/", ABSPATH), site_url() . '/', EOMODMAN_PATH)); |
|
34 | 34 | |
35 | 35 | /** Appel des traductions pour le module / Call translation for module */ |
36 | - load_plugin_textdomain( 'eo-modmanager-i18n', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
|
36 | + load_plugin_textdomain('eo-modmanager-i18n', false, dirname(plugin_basename(__FILE__)) . '/languages/'); |
|
37 | 37 | |
38 | 38 | /** Définition du chemin absolu vers les templates / Define the templates absolute directories */ |
39 | - DEFINE( 'EOMODMAN_TEMPLATES_MAIN_DIR', EOMODMAN_PATH . '/templates/'); |
|
39 | + DEFINE('EOMODMAN_TEMPLATES_MAIN_DIR', EOMODMAN_PATH . '/templates/'); |
|
40 | 40 | |
41 | - include( EOMODMAN_PATH . '/controller/module_management.ctr.php' ); |
|
42 | - $eo_module_management = new eo_module_management(); |
|
41 | + include(EOMODMAN_PATH . '/controller/module_management.ctr.php'); |
|
42 | + $eo_module_management = new eo_module_management(); |
|
43 | 43 | |
44 | 44 | eo_module_management::core_util(); |
45 | 45 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,72 +1,72 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | ?> |
3 | 3 | <ul class="module-list" > |
4 | 4 | <li class="module-list-header" > |
5 | 5 | <!-- |
6 | - <span class="module-cb" ><?php _e( 'Activ', 'eo-modmanager-i18n' ); ?></span> |
|
6 | + <span class="module-cb" ><?php _e('Activ', 'eo-modmanager-i18n'); ?></span> |
|
7 | 7 | --> |
8 | - <span class="module-name" ><?php _e( 'Module name', 'eo-modmanager-i18n' ); ?></span> |
|
9 | - <span class="module-name" ><?php _e( 'Module description', 'eo-modmanager-i18n' ); ?></span> |
|
10 | - <span class="module-info" ><?php _e( 'Module info', 'eo-modmanager-i18n' ); ?></span> |
|
8 | + <span class="module-name" ><?php _e('Module name', 'eo-modmanager-i18n'); ?></span> |
|
9 | + <span class="module-name" ><?php _e('Module description', 'eo-modmanager-i18n'); ?></span> |
|
10 | + <span class="module-info" ><?php _e('Module info', 'eo-modmanager-i18n'); ?></span> |
|
11 | 11 | </li> |
12 | 12 | |
13 | 13 | <?php $i = 0; ?> |
14 | -<?php foreach ( $parent_folder_content as $folder ) : ?> |
|
15 | - <?php if ( $folder && ( substr( $folder, 0, 1) != '.' ) && file_exists( $module_folder . $folder . '/' . $folder . '.php') ) : ?> |
|
14 | +<?php foreach ($parent_folder_content as $folder) : ?> |
|
15 | + <?php if ($folder && (substr($folder, 0, 1) != '.') && file_exists($module_folder . $folder . '/' . $folder . '.php')) : ?> |
|
16 | 16 | <?php |
17 | 17 | $is_activ = false; |
18 | - if ( !empty( $module_option ) && ( array_key_exists( $folder, $module_option ) && ( 'on' == $module_option[ $folder ][ 'activated' ] ) ) ) { |
|
18 | + if (!empty($module_option) && (array_key_exists($folder, $module_option) && ('on' == $module_option[$folder]['activated']))) { |
|
19 | 19 | $is_activ = true; |
20 | 20 | } |
21 | - $module_datas = get_plugin_data( $module_folder . $folder . '/' . $folder . '.php' ); |
|
21 | + $module_datas = get_plugin_data($module_folder . $folder . '/' . $folder . '.php'); |
|
22 | 22 | |
23 | 23 | $module_id = 'module' . $folder; |
24 | 24 | ?> |
25 | - <li class="<?php echo ( $i == 0 ? "odd" : "even" ); ?>" > |
|
25 | + <li class="<?php echo ($i == 0 ? "odd" : "even"); ?>" > |
|
26 | 26 | <!-- |
27 | 27 | <span class="module-cb module-cb-<?php echo $folder; ?>" > |
28 | 28 | <input type="hidden" name="wpshop_modules[<?php echo $folder; ?>][old_activated]" value="<?php echo $is_activ ? 'on' : 'off'; ?>" /> |
29 | - <input id="<?php echo $module_id; ?>" type="checkbox" name="wpshop_modules[<?php echo $folder; ?>][activated]" value="on" <?php checked( true, $is_activ, true); ?> /> |
|
29 | + <input id="<?php echo $module_id; ?>" type="checkbox" name="wpshop_modules[<?php echo $folder; ?>][activated]" value="on" <?php checked(true, $is_activ, true); ?> /> |
|
30 | 30 | </span> |
31 | 31 | --> |
32 | 32 | <span class="module-name module-name-<?php echo $folder; ?>" > |
33 | - <label for="<?php echo $module_id; ?>" ><?php echo !empty( $module_datas ) && !empty( $module_datas[ 'Name' ] ) ? $module_datas[ 'Name' ] : $folder; ?></label> |
|
33 | + <label for="<?php echo $module_id; ?>" ><?php echo !empty($module_datas) && !empty($module_datas['Name']) ? $module_datas['Name'] : $folder; ?></label> |
|
34 | 34 | </span> |
35 | 35 | <span class="module-description" > |
36 | - <?php echo !empty( $module_datas ) && !empty( $module_datas[ 'Description' ] ) ? $module_datas[ 'Description' ] : ''; ?><br/> |
|
36 | + <?php echo !empty($module_datas) && !empty($module_datas['Description']) ? $module_datas['Description'] : ''; ?><br/> |
|
37 | 37 | |
38 | - <?php echo !empty( $module_datas ) && !empty( $module_datas[ 'Version' ] ) ? $module_datas[ 'Version' ] : __( 'Unknown version', 'eo-modmanager-i18n' ); ?> | |
|
39 | - <?php echo !empty( $module_datas ) && !empty( $module_datas[ 'Author' ] ) ? $module_datas[ 'Author' ] : __( 'Unknown author', 'eo-modmanager-i18n' ); ?> |
|
40 | - <?php if ( !empty( $module_datas ) && !empty( $module_datas[ 'PluginURI' ] ) ) : ?> | |
|
41 | - <?php echo $module_datas[ 'Title' ]; ?> |
|
38 | + <?php echo !empty($module_datas) && !empty($module_datas['Version']) ? $module_datas['Version'] : __('Unknown version', 'eo-modmanager-i18n'); ?> | |
|
39 | + <?php echo !empty($module_datas) && !empty($module_datas['Author']) ? $module_datas['Author'] : __('Unknown author', 'eo-modmanager-i18n'); ?> |
|
40 | + <?php if (!empty($module_datas) && !empty($module_datas['PluginURI'])) : ?> | |
|
41 | + <?php echo $module_datas['Title']; ?> |
|
42 | 42 | <?php endif; ?> |
43 | 43 | </span> |
44 | 44 | <span class="module-info module-info-<?php echo $folder; ?>" > |
45 | 45 | <?php |
46 | - if ( 'auto' != $module_option[ $folder ][ 'author_on' ] ) : |
|
47 | - $user = get_userdata( $module_option[ $folder ][ 'author_on' ] ); |
|
46 | + if ('auto' != $module_option[$folder]['author_on']) : |
|
47 | + $user = get_userdata($module_option[$folder]['author_on']); |
|
48 | 48 | $author = $user->display_name; |
49 | 49 | else : |
50 | - $author = __( 'automatic activation', 'eo-modmanager-i18n' ); |
|
50 | + $author = __('automatic activation', 'eo-modmanager-i18n'); |
|
51 | 51 | endif; |
52 | - printf( __( 'Last activation made on %1$s by %2$s', 'eo-modmanager-i18n' ), mysql2date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $module_option[ $folder ][ 'date_on' ], true ), $author); |
|
52 | + printf(__('Last activation made on %1$s by %2$s', 'eo-modmanager-i18n'), mysql2date(get_option('date_format') . ' ' . get_option('time_format'), $module_option[$folder]['date_on'], true), $author); |
|
53 | 53 | ?> |
54 | - <?php if ( !empty( $module_option[ $folder ][ 'date_off' ] ) ) : ?> |
|
54 | + <?php if (!empty($module_option[$folder]['date_off'])) : ?> |
|
55 | 55 | <br/> |
56 | 56 | <?php |
57 | - $user = get_userdata( $module_option[ $folder ][ 'author_off' ] ); |
|
57 | + $user = get_userdata($module_option[$folder]['author_off']); |
|
58 | 58 | $author = $user->display_name; |
59 | - printf( __( 'Last deactivation made on %1$s by %2$s', 'eo-modmanager-i18n' ), mysql2date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $module_option[ $folder ][ 'date_off' ], true ), $author); |
|
59 | + printf(__('Last deactivation made on %1$s by %2$s', 'eo-modmanager-i18n'), mysql2date(get_option('date_format') . ' ' . get_option('time_format'), $module_option[$folder]['date_off'], true), $author); |
|
60 | 60 | ?> |
61 | 61 | <?php endif; ?> |
62 | 62 | |
63 | - <?php apply_filters( 'wps-addon-extra-info', $folder ); ?> |
|
63 | + <?php apply_filters('wps-addon-extra-info', $folder); ?> |
|
64 | 64 | </span> |
65 | 65 | </li> |
66 | 66 | <?php endif; ?> |
67 | 67 | <?php |
68 | 68 | $i++; |
69 | - if ( $i > 1 ) : |
|
69 | + if ($i > 1) : |
|
70 | 70 | $i = 0; |
71 | 71 | endif; |
72 | 72 | ?> |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | ?> |
3 | 5 | <ul class="module-list" > |
4 | 6 | <li class="module-list-header" > |
@@ -46,8 +48,10 @@ discard block |
||
46 | 48 | if ( 'auto' != $module_option[ $folder ][ 'author_on' ] ) : |
47 | 49 | $user = get_userdata( $module_option[ $folder ][ 'author_on' ] ); |
48 | 50 | $author = $user->display_name; |
49 | - else : |
|
51 | + else { |
|
52 | + : |
|
50 | 53 | $author = __( 'automatic activation', 'eo-modmanager-i18n' ); |
54 | + } |
|
51 | 55 | endif; |
52 | 56 | printf( __( 'Last activation made on %1$s by %2$s', 'eo-modmanager-i18n' ), mysql2date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $module_option[ $folder ][ 'date_on' ], true ), $author); |
53 | 57 | ?> |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | /** |
3 | 3 | * Bootstrap file for plugin. Do main includes and create new instance for plugin components |
4 | 4 | * |
@@ -6,25 +6,25 @@ discard block |
||
6 | 6 | * @version 0.1 |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
9 | +if (!defined('ABSPATH')) exit; |
|
10 | 10 | |
11 | -if ( !class_exists( 'constructor_model_ctr_01' ) ) { |
|
11 | +if (!class_exists('constructor_model_ctr_01')) { |
|
12 | 12 | /** Define */ |
13 | - DEFINE( 'WPEO_MODEL_VERSION', 0.1 ); |
|
14 | - DEFINE( 'WPEO_MODEL_DIR', basename( dirname( __FILE__ ) ) ); |
|
15 | - DEFINE( 'WPEO_MODEL_PATH', str_replace( "\\", "/", plugin_dir_path( __FILE__ ) ) ); |
|
13 | + DEFINE('WPEO_MODEL_VERSION', 0.1); |
|
14 | + DEFINE('WPEO_MODEL_DIR', basename(dirname(__FILE__))); |
|
15 | + DEFINE('WPEO_MODEL_PATH', str_replace("\\", "/", plugin_dir_path(__FILE__))); |
|
16 | 16 | |
17 | - require_once( WPEO_MODEL_PATH . '/controller/constructor_model_ctr.01.php' ); |
|
17 | + require_once(WPEO_MODEL_PATH . '/controller/constructor_model_ctr.01.php'); |
|
18 | 18 | |
19 | - require_once( WPEO_MODEL_PATH . '/model/post_mdl.01.php' ); |
|
20 | - require_once( WPEO_MODEL_PATH . '/model/comment_mdl.01.php' ); |
|
21 | - require_once( WPEO_MODEL_PATH . '/model/user_mdl.01.php' ); |
|
22 | - require_once( WPEO_MODEL_PATH . '/model/term_mdl.01.php' ); |
|
19 | + require_once(WPEO_MODEL_PATH . '/model/post_mdl.01.php'); |
|
20 | + require_once(WPEO_MODEL_PATH . '/model/comment_mdl.01.php'); |
|
21 | + require_once(WPEO_MODEL_PATH . '/model/user_mdl.01.php'); |
|
22 | + require_once(WPEO_MODEL_PATH . '/model/term_mdl.01.php'); |
|
23 | 23 | |
24 | - require_once( WPEO_MODEL_PATH . '/controller/post_ctr.01.php' ); |
|
25 | - require_once( WPEO_MODEL_PATH . '/controller/comment_ctr.01.php' ); |
|
26 | - require_once( WPEO_MODEL_PATH . '/controller/user_ctr.01.php' ); |
|
27 | - require_once( WPEO_MODEL_PATH . '/controller/term_ctr.01.php' ); |
|
24 | + require_once(WPEO_MODEL_PATH . '/controller/post_ctr.01.php'); |
|
25 | + require_once(WPEO_MODEL_PATH . '/controller/comment_ctr.01.php'); |
|
26 | + require_once(WPEO_MODEL_PATH . '/controller/user_ctr.01.php'); |
|
27 | + require_once(WPEO_MODEL_PATH . '/controller/term_ctr.01.php'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Bootstrap file for plugin. Do main includes and create new instance for plugin components |
4 | 6 | * |
@@ -6,7 +8,9 @@ discard block |
||
6 | 8 | * @version 0.1 |
7 | 9 | */ |
8 | 10 | |
9 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
11 | +if ( ! defined( 'ABSPATH' ) ) { |
|
12 | + exit; |
|
13 | +} |
|
10 | 14 | |
11 | 15 | if ( !class_exists( 'constructor_model_ctr_01' ) ) { |
12 | 16 | /** Define */ |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | |
3 | 3 | /** |
4 | 4 | * CRUD Functions pour les comments |
@@ -8,80 +8,80 @@ discard block |
||
8 | 8 | class comment_ctr_01 { |
9 | 9 | protected $model_name = 'comment_mdl_01'; |
10 | 10 | protected $meta_key = '_comment'; |
11 | - protected $comment_type = ''; |
|
11 | + protected $comment_type = ''; |
|
12 | 12 | |
13 | 13 | protected $base = 'comment'; |
14 | 14 | protected $version = '0.1'; |
15 | 15 | |
16 | 16 | public function __construct() { |
17 | 17 | /** Ajout des routes personnalisées pour les éléments de type "commentaires" / Add specific routes for "comments" elements' type */ |
18 | - add_filter( 'json_endpoints', array( &$this, 'callback_register_route' ) ); |
|
18 | + add_filter('json_endpoints', array(&$this, 'callback_register_route')); |
|
19 | 19 | } |
20 | 20 | |
21 | - public function update( $data ) { |
|
21 | + public function update($data) { |
|
22 | 22 | $object = $data; |
23 | 23 | |
24 | - if( is_array( $data ) ) { |
|
25 | - $object = new $this->model_name( $data, $this->meta_key, false ); |
|
24 | + if (is_array($data)) { |
|
25 | + $object = new $this->model_name($data, $this->meta_key, false); |
|
26 | 26 | } |
27 | - wp_update_comment( $object->do_wp_object() ); |
|
27 | + wp_update_comment($object->do_wp_object()); |
|
28 | 28 | |
29 | 29 | /** On insert ou on met à jour les meta */ |
30 | - if( !empty( $object->option ) ) { |
|
31 | - $object->save_meta_data( $object, 'update_comment_meta', $this->meta_key ); |
|
30 | + if (!empty($object->option)) { |
|
31 | + $object->save_meta_data($object, 'update_comment_meta', $this->meta_key); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | return $object; |
35 | 35 | } |
36 | 36 | |
37 | - public function create( $data ) { |
|
37 | + public function create($data) { |
|
38 | 38 | |
39 | 39 | $object = $data; |
40 | 40 | |
41 | - if( is_array( $data ) ) { |
|
42 | - $object = new $this->model_name( $data, $this->meta_key ); |
|
41 | + if (is_array($data)) { |
|
42 | + $object = new $this->model_name($data, $this->meta_key); |
|
43 | 43 | $object->type = $this->comment_type; |
44 | 44 | } |
45 | 45 | |
46 | - $object->id = wp_insert_comment( $object->do_wp_object() ); |
|
46 | + $object->id = wp_insert_comment($object->do_wp_object()); |
|
47 | 47 | |
48 | 48 | /** On insert ou on met à jour les meta */ |
49 | - if( !empty( $object->option ) ) { |
|
50 | - $object->save_meta_data( $object, 'update_comment_meta', $this->meta_key ); |
|
49 | + if (!empty($object->option)) { |
|
50 | + $object->save_meta_data($object, 'update_comment_meta', $this->meta_key); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | return $object; |
54 | 54 | } |
55 | 55 | |
56 | - public function delete( $id ) { |
|
57 | - wp_delete_comment( $id ); |
|
56 | + public function delete($id) { |
|
57 | + wp_delete_comment($id); |
|
58 | 58 | } |
59 | 59 | |
60 | - public function show( $id, $cropped = false ) { |
|
61 | - $comment = get_comment( $id ); |
|
60 | + public function show($id, $cropped = false) { |
|
61 | + $comment = get_comment($id); |
|
62 | 62 | |
63 | - if( !empty( $comment ) ) |
|
64 | - $comment = new $this->model_name( $comment, $this->meta_key, $cropped ); |
|
63 | + if (!empty($comment)) |
|
64 | + $comment = new $this->model_name($comment, $this->meta_key, $cropped); |
|
65 | 65 | |
66 | 66 | return $comment; |
67 | 67 | } |
68 | 68 | |
69 | - public function index( $post_id = 0, $args_where = array( 'parent' => 0, 'status' => -34070, ), $cropped = false ) { |
|
69 | + public function index($post_id = 0, $args_where = array('parent' => 0, 'status' => -34070,), $cropped = false) { |
|
70 | 70 | $array_model = array(); |
71 | 71 | |
72 | 72 | $args = array( |
73 | 73 | 'post_id' => $post_id, |
74 | 74 | ); |
75 | 75 | |
76 | - if ( !empty( $this->comment_type ) ) |
|
76 | + if (!empty($this->comment_type)) |
|
77 | 77 | $args['type'] = $this->comment_type; |
78 | 78 | |
79 | 79 | $args = array_merge($args, $args_where); |
80 | - $array_comment = get_comments( $args ); |
|
80 | + $array_comment = get_comments($args); |
|
81 | 81 | |
82 | - if( !empty( $array_comment ) ) { |
|
83 | - foreach( $array_comment as $comment ) { |
|
84 | - $array_model[] = new $this->model_name( $comment, $this->meta_key, $cropped ); |
|
82 | + if (!empty($array_comment)) { |
|
83 | + foreach ($array_comment as $comment) { |
|
84 | + $array_model[] = new $this->model_name($comment, $this->meta_key, $cropped); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
@@ -95,25 +95,25 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @return array La liste des routes personnalisées ajoutées aux routes existantes / The personnalized routes added to existing |
97 | 97 | */ |
98 | - public function callback_register_route( $array_route ) { |
|
98 | + public function callback_register_route($array_route) { |
|
99 | 99 | /** Récupération de la liste complète des éléments / Get all existing elements */ |
100 | - $array_route['/' . $this->version . '/get/' . $this->base ] = array( |
|
101 | - array( array( $this, 'index' ), WP_JSON_Server::READABLE | WP_JSON_Server::ACCEPT_JSON ) |
|
100 | + $array_route['/' . $this->version . '/get/' . $this->base] = array( |
|
101 | + array(array($this, 'index'), WP_JSON_Server::READABLE | WP_JSON_Server::ACCEPT_JSON) |
|
102 | 102 | ); |
103 | 103 | |
104 | 104 | /** Récupération d'un élément donné / Get a given element */ |
105 | 105 | $array_route['/' . $this->version . '/get/' . $this->base . '/(?P<id>\d+)'] = array( |
106 | - array( array( $this, 'show' ), WP_JSON_Server::READABLE | WP_JSON_Server::ACCEPT_JSON ) |
|
106 | + array(array($this, 'show'), WP_JSON_Server::READABLE | WP_JSON_Server::ACCEPT_JSON) |
|
107 | 107 | ); |
108 | 108 | |
109 | 109 | /** Mise à jour d'un élément / Update an element */ |
110 | 110 | $array_route['/' . $this->version . '/post/' . $this->base . ''] = array( |
111 | - array( array( $this, 'update' ), WP_JSON_Server::CREATABLE | WP_JSON_Server::ACCEPT_JSON ), |
|
111 | + array(array($this, 'update'), WP_JSON_Server::CREATABLE | WP_JSON_Server::ACCEPT_JSON), |
|
112 | 112 | ); |
113 | 113 | |
114 | 114 | /** Suppression d'un élément / Delete an element */ |
115 | 115 | $array_route['/' . $this->version . '/delete/' . $this->base . '/(?P<id>\d+)'] = array( |
116 | - array( array( $this, 'delete' ), WP_JSON_Server::DELETABLE | WP_JSON_Server::ACCEPT_JSON ), |
|
116 | + array(array($this, 'delete'), WP_JSON_Server::DELETABLE | WP_JSON_Server::ACCEPT_JSON), |
|
117 | 117 | ); |
118 | 118 | |
119 | 119 | return $array_route; |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | |
3 | 5 | /** |
4 | 6 | * CRUD Functions pour les comments |
@@ -60,8 +62,9 @@ discard block |
||
60 | 62 | public function show( $id, $cropped = false ) { |
61 | 63 | $comment = get_comment( $id ); |
62 | 64 | |
63 | - if( !empty( $comment ) ) |
|
64 | - $comment = new $this->model_name( $comment, $this->meta_key, $cropped ); |
|
65 | + if( !empty( $comment ) ) { |
|
66 | + $comment = new $this->model_name( $comment, $this->meta_key, $cropped ); |
|
67 | + } |
|
65 | 68 | |
66 | 69 | return $comment; |
67 | 70 | } |
@@ -73,8 +76,9 @@ discard block |
||
73 | 76 | 'post_id' => $post_id, |
74 | 77 | ); |
75 | 78 | |
76 | - if ( !empty( $this->comment_type ) ) |
|
77 | - $args['type'] = $this->comment_type; |
|
79 | + if ( !empty( $this->comment_type ) ) { |
|
80 | + $args['type'] = $this->comment_type; |
|
81 | + } |
|
78 | 82 | |
79 | 83 | $args = array_merge($args, $args_where); |
80 | 84 | $array_comment = get_comments( $args ); |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | |
3 | 3 | |
4 | 4 | /** |
@@ -19,75 +19,75 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public function __construct() { |
21 | 21 | /** Ajout des routes personnalisées pour les éléments de type "user" / Add specific routes for "user" elements' type */ |
22 | - add_filter( 'json_endpoints', array( &$this, 'callback_register_route' ) ); |
|
22 | + add_filter('json_endpoints', array(&$this, 'callback_register_route')); |
|
23 | 23 | } |
24 | 24 | |
25 | - public function update( $data ) { |
|
25 | + public function update($data) { |
|
26 | 26 | $object = $data; |
27 | 27 | |
28 | - if( is_array( $data ) ) { |
|
29 | - $object = new $this->model_name( $data, $this->meta_key ); |
|
28 | + if (is_array($data)) { |
|
29 | + $object = new $this->model_name($data, $this->meta_key); |
|
30 | 30 | } |
31 | 31 | |
32 | - wp_update_user( $object->do_wp_object() ); |
|
32 | + wp_update_user($object->do_wp_object()); |
|
33 | 33 | |
34 | 34 | /** On insert ou on met à jour les meta */ |
35 | - if( !empty( $object->option ) ) { |
|
35 | + if (!empty($object->option)) { |
|
36 | 36 | |
37 | - $object->save_meta_data( $object, 'update_user_meta', $this->meta_key ); |
|
37 | + $object->save_meta_data($object, 'update_user_meta', $this->meta_key); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | return $object; |
41 | 41 | } |
42 | 42 | |
43 | - public function create( $data ) { |
|
43 | + public function create($data) { |
|
44 | 44 | $object = $data; |
45 | 45 | |
46 | - if( is_array( $data ) ) { |
|
47 | - $object = new $this->model_name( $data, $this->meta_key ); |
|
46 | + if (is_array($data)) { |
|
47 | + $object = new $this->model_name($data, $this->meta_key); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | $array_object = $object->do_wp_object(); |
51 | 51 | |
52 | - if ( empty( $array_object['user_pass'] ) ) { |
|
52 | + if (empty($array_object['user_pass'])) { |
|
53 | 53 | $array_object['user_pass'] = wp_generate_password(); |
54 | 54 | } |
55 | 55 | |
56 | 56 | |
57 | - $object->id = wp_insert_user( $array_object ); |
|
57 | + $object->id = wp_insert_user($array_object); |
|
58 | 58 | |
59 | - $object->option['user_info']['initial'] = $object->build_user_initial( $object ); |
|
60 | - $object->option[ 'user_info' ][ 'avatar_color' ] = $object->avatar_color[ array_rand( $object->avatar_color, 1 ) ]; |
|
59 | + $object->option['user_info']['initial'] = $object->build_user_initial($object); |
|
60 | + $object->option['user_info']['avatar_color'] = $object->avatar_color[array_rand($object->avatar_color, 1)]; |
|
61 | 61 | |
62 | 62 | /** On insert ou on met à jour les meta */ |
63 | - if( !empty( $object->option ) ) { |
|
63 | + if (!empty($object->option)) { |
|
64 | 64 | |
65 | - $object->save_meta_data( $object, 'update_user_meta', $this->meta_key ); |
|
65 | + $object->save_meta_data($object, 'update_user_meta', $this->meta_key); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | return $object; |
70 | 70 | } |
71 | 71 | |
72 | - public function delete( $id ) { |
|
73 | - wp_delete_user( $id ); |
|
72 | + public function delete($id) { |
|
73 | + wp_delete_user($id); |
|
74 | 74 | } |
75 | 75 | |
76 | - public function show( $id, $cropped = false ) { |
|
77 | - $user = get_user_by( 'id', $id ); |
|
78 | - $user = new $this->model_name( $user, $this->meta_key, $cropped ); |
|
76 | + public function show($id, $cropped = false) { |
|
77 | + $user = get_user_by('id', $id); |
|
78 | + $user = new $this->model_name($user, $this->meta_key, $cropped); |
|
79 | 79 | |
80 | 80 | return $user; |
81 | 81 | } |
82 | 82 | |
83 | - public function index( $args_where = array( ), $cropped = false ) { |
|
83 | + public function index($args_where = array( ), $cropped = false) { |
|
84 | 84 | $array_model = array(); |
85 | 85 | |
86 | - $array_user = get_users( $args_where ); |
|
86 | + $array_user = get_users($args_where); |
|
87 | 87 | |
88 | - if( !empty( $array_user ) ) { |
|
89 | - foreach( $array_user as $key => $user ) { |
|
90 | - $array_model[$key] = new $this->model_name( $user, $this->meta_key, $cropped ); |
|
88 | + if (!empty($array_user)) { |
|
89 | + foreach ($array_user as $key => $user) { |
|
90 | + $array_model[$key] = new $this->model_name($user, $this->meta_key, $cropped); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
@@ -101,25 +101,25 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return array La liste des routes personnalisées ajoutées aux routes existantes / The personnalized routes added to existing |
103 | 103 | */ |
104 | - public function callback_register_route( $array_route ) { |
|
104 | + public function callback_register_route($array_route) { |
|
105 | 105 | /** Récupération de la liste complète des éléments / Get all existing elements */ |
106 | - $array_route['/' . $this->version . '/get/' . $this->base ] = array( |
|
107 | - array( array( $this, 'index' ), WP_JSON_Server::READABLE | WP_JSON_Server::ACCEPT_JSON ) |
|
106 | + $array_route['/' . $this->version . '/get/' . $this->base] = array( |
|
107 | + array(array($this, 'index'), WP_JSON_Server::READABLE | WP_JSON_Server::ACCEPT_JSON) |
|
108 | 108 | ); |
109 | 109 | |
110 | 110 | /** Récupération d'un élément donné / Get a given element */ |
111 | 111 | $array_route['/' . $this->version . '/get/' . $this->base . '/(?P<id>\d+)'] = array( |
112 | - array( array( $this, 'show' ), WP_JSON_Server::READABLE | WP_JSON_Server::ACCEPT_JSON ) |
|
112 | + array(array($this, 'show'), WP_JSON_Server::READABLE | WP_JSON_Server::ACCEPT_JSON) |
|
113 | 113 | ); |
114 | 114 | |
115 | 115 | /** Mise à jour d'un élément / Update an element */ |
116 | 116 | $array_route['/' . $this->version . '/post/' . $this->base . ''] = array( |
117 | - array( array( $this, 'update' ), WP_JSON_Server::CREATABLE | WP_JSON_Server::ACCEPT_JSON ), |
|
117 | + array(array($this, 'update'), WP_JSON_Server::CREATABLE | WP_JSON_Server::ACCEPT_JSON), |
|
118 | 118 | ); |
119 | 119 | |
120 | 120 | /** Suppression d'un élément / Delete an element */ |
121 | 121 | $array_route['/' . $this->version . '/delete/' . $this->base . '/(?P<id>\d+)'] = array( |
122 | - array( array( $this, 'delete' ), WP_JSON_Server::DELETABLE | WP_JSON_Server::ACCEPT_JSON ), |
|
122 | + array(array($this, 'delete'), WP_JSON_Server::DELETABLE | WP_JSON_Server::ACCEPT_JSON), |
|
123 | 123 | ); |
124 | 124 | |
125 | 125 | return $array_route; |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |