tag() ] = $element; } } } } /** * Check if architect is active * * @return bool */ public static function is_architect_active() { return defined( 'TVE_VERSION' ); } /** * call my by my name * * @return string|void */ public static function title() { return __( 'WordPress Login Screen Branding', TVE_DASH_TRANSLATE_DOMAIN ); } /** * Check if we're on a edit page for the login screen * * @return bool */ public static function is_edit_screen() { $post_type = get_post_type(); if ( empty( $post_type ) && is_admin() && isset( $_GET['post'] ) ) { $post_type = get_post_type( sanitize_text_field( $_GET['post'] ) ); } return isset( $_GET[ Main::EDIT_FLAG ] ) || $post_type === Post_Type::NAME; } /** * Return the css part which includes the main logo from the site * * @return string */ public static function get_main_logo_image() { $logo_image = ''; if ( class_exists( 'TCB_Logo' ) ) { $logos = \TCB_Logo::get_logos(); if ( ! empty( $logos ) ) { $active_logos = array_filter( $logos, static function ( $logo ) { return (int) $logo['active'] === 1 && (int) $logo['default'] === 1; } ); /* get the src for each attachment ID */ foreach ( $active_logos as $key => $logo ) { $active_logos[ $key ]['src'] = \TCB_Logo::get_src( $logo['id'] ); } } $logo_image = "{$active_logos[0]['src']}?default=1&login_logo"; } return $logo_image; } /** * Check if we've enabled login screen design * * @return bool */ public static function is_login_design_enabled() { $option = get_option( static::OPTION, false ); return ! empty( $option ); } /** * Update the content with the current logo * * @param string $content * * @return string */ public static function update_logo_in_content( $content = '' ) { $logo_image = static::get_main_logo_image(); if ( ! empty( $logo_image ) ) { $content = preg_replace( '/url\("([^"]*)&login_logo/', 'url("' . $logo_image . '&login_logo', $content ); } return $content; } }