| @@ -14,18 +14,19 @@ | ||
| 14 | 14 | global $wp_the_query; |
| 15 | 15 | |
| 16 | 16 | $data = []; |
| 17 | 17 | $actions = []; |
| 18 | - $intro = __( 'Currently Viewing', 'fl-assistant' ); | |
| 18 | + $intro = __( 'Currently Viewing', 'assistant' ); | |
| 19 | 19 | $type = ''; |
| 20 | - $name = __( 'Untitled', 'fl-assistant' ); | |
| 20 | + $type_name = ''; | |
| 21 | + $name = __( 'Untitled', 'assistant' ); | |
| 21 | 22 | |
| 22 | 23 | $obj = get_queried_object(); |
| 23 | 24 | |
| 24 | 25 | if ( is_admin() ) { |
| 25 | 26 | |
| 26 | - $intro = __( 'Currently Viewing Admin Page', 'fl-assistant' ); | |
| 27 | - $type = __( 'Admin Page', 'fl-assistant' ); | |
| 27 | + $intro = __( 'Currently Viewing Admin Page', 'assistant' ); | |
| 28 | + $type = __( 'Admin Page', 'assistant' ); | |
| 28 | 29 | $screen = get_current_screen(); |
| 29 | 30 | $name = $screen->id; |
| 30 | 31 | |
| 31 | 32 | } else { |
| @@ -30,29 +31,30 @@ | ||
| 30 | 31 | |
| 31 | 32 | } else { |
| 32 | 33 | |
| 33 | 34 | if ( is_404() ) { |
| 34 | - $name = __( 'Page Not Found', 'fl-assistant' ); | |
| 35 | - $type = __( '404', 'fl-assistant' ); | |
| 35 | + $name = __( 'Page Not Found', 'assistant' ); | |
| 36 | + $type = __( '404', 'assistant' ); | |
| 36 | 37 | |
| 37 | 38 | } elseif ( is_search() ) { |
| 38 | 39 | |
| 39 | - $intro = __( 'Currently Viewing Search Results For', 'fl-assistant' ); | |
| 40 | - $type = __( 'Search Results For:', 'fl-assistant' ); | |
| 40 | + $intro = __( 'Currently Viewing Search Results For', 'assistant' ); | |
| 41 | + $type = __( 'Search Results For:', 'assistant' ); | |
| 41 | 42 | $name = get_search_query(); |
| 42 | 43 | |
| 43 | 44 | } elseif ( is_date() ) { |
| 44 | 45 | |
| 45 | - $intro = __( 'Currently Viewing Date Archive', 'fl-assistant' ); | |
| 46 | - $type = __( 'Date Archive', 'fl-assistant' ); | |
| 46 | + $intro = __( 'Currently Viewing Date Archive', 'assistant' ); | |
| 47 | + $type = __( 'Date Archive', 'assistant' ); | |
| 47 | 48 | $name = get_the_date(); |
| 48 | 49 | |
| 49 | 50 | } elseif ( is_post_type_archive() ) { |
| 50 | 51 | |
| 51 | 52 | $post_type = get_post_type_object( 'post' ); |
| 52 | - $intro = __( 'Currently Viewing Post Type Archive', 'fl-assistant' ); | |
| 53 | - $type = __( 'Post Type Archive', 'fl-assistant' ); | |
| 53 | + $intro = __( 'Currently Viewing Post Type Archive', 'assistant' ); | |
| 54 | + $type = __( 'Post Type Archive', 'assistant' ); | |
| 54 | 55 | $name = $post_type->labels->singular_name; |
| 56 | + $type_name = $post_type->name; | |
| 55 | 57 | |
| 56 | 58 | } elseif ( is_tax() || is_category() || is_tag() ) { |
| 57 | 59 | |
| 58 | 60 | $tax = get_taxonomy( $obj->taxonomy ); |
| @@ -57,9 +59,9 @@ | ||
| 57 | 59 | |
| 58 | 60 | $tax = get_taxonomy( $obj->taxonomy ); |
| 59 | 61 | $labels = $tax->labels; |
| 60 | 62 | |
| 61 | - $intro = sprintf( esc_html__( 'Currently Viewing %s', 'fl-assistant' ), $labels->singular_name ); | |
| 63 | + $intro = sprintf( esc_html__( 'Currently Viewing %s', 'assistant' ), $labels->singular_name ); | |
| 62 | 64 | $type = $labels->singular_name; |
| 63 | 65 | $name = $obj->name; |
| 64 | 66 | |
| 65 | 67 | $actions[] = [ |
| @@ -71,11 +73,12 @@ | ||
| 71 | 73 | |
| 72 | 74 | } elseif ( is_singular() || is_attachment() ) { |
| 73 | 75 | |
| 74 | 76 | $post_type = get_post_type_object( get_post_type() ); |
| 77 | + $type_name = $post_type->name; | |
| 75 | 78 | $labels = $post_type->labels; |
| 76 | 79 | $post_type = $labels->singular_name; |
| 77 | - $intro = sprintf( esc_html__( 'Currently Viewing %s', 'fl-assistant' ), $post_type ); | |
| 80 | + $intro = sprintf( esc_html__( 'Currently Viewing %s', 'assistant' ), $post_type ); | |
| 78 | 81 | $type = $post_type; |
| 79 | 82 | $name = $obj->post_title; |
| 80 | 83 | |
| 81 | 84 | $actions[] = [ |
| @@ -103,16 +106,16 @@ | ||
| 103 | 106 | } |
| 104 | 107 | } |
| 105 | 108 | } elseif ( is_author() ) { |
| 106 | 109 | |
| 107 | - $intro = __( 'Currently Viewing Author', 'fl-assistant' ); | |
| 108 | - $type = __( 'Author Archive', 'fl-assistant' ); | |
| 110 | + $intro = __( 'Currently Viewing Author', 'assistant' ); | |
| 111 | + $type = __( 'Author Archive', 'assistant' ); | |
| 109 | 112 | $name = wp_get_current_user()->display_name; |
| 110 | 113 | |
| 111 | 114 | } elseif ( is_front_page() ) { |
| 112 | - $intro = __( 'Currently Viewing Post Archive', 'fl-assistant' ); | |
| 113 | - $type = __( 'Post Archive', 'fl-assistant' ); | |
| 114 | - $name = __( 'Latest Posts', 'fl-assistant' ); | |
| 115 | + $intro = __( 'Currently Viewing Post Archive', 'assistant' ); | |
| 116 | + $type = __( 'Post Archive', 'assistant' ); | |
| 117 | + $name = __( 'Latest Posts', 'assistant' ); | |
| 115 | 118 | } |
| 116 | 119 | } |
| 117 | 120 | |
| 118 | 121 | $data['intro'] = $intro; |
| @@ -117,8 +120,9 @@ | ||
| 117 | 120 | |
| 118 | 121 | $data['intro'] = $intro; |
| 119 | 122 | $data['name'] = $name; |
| 120 | 123 | $data['type'] = $type; |
| 124 | + $data['type_name'] = $type_name; | |
| 121 | 125 | |
| 122 | 126 | $data['actions'] = $this->filter_actions_by_capability( $actions ); |
| 123 | 127 | |
| 124 | 128 | $theme = wp_get_theme(); |
| @@ -263,9 +267,9 @@ | ||
| 263 | 267 | */ |
| 264 | 268 | public function is_local() { |
| 265 | 269 | $ips = [ '127.0.0.1', '::1' ]; |
| 266 | 270 | $domain = '.local'; |
| 267 | - if ( ! in_array( $_SERVER['REMOTE_ADDR'], $ips, true ) ) { | |
| 271 | + if ( isset( $_SERVER['REMOTE_ADDR'] ) && ! in_array( $_SERVER['REMOTE_ADDR'], $ips, true ) ) { | |
| 268 | 272 | return substr_compare( $_SERVER['SERVER_NAME'], $domain, -strlen( $domain ) ) === 0; |
| 269 | 273 | } |
| 270 | 274 | return true; |
| 271 | 275 | } |