PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.9.3
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.9.3
4.9.3 4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 3.4.2 3.5.0 All 201 releases
← All changes | vendor/priyomukul/wp-notice/src/Notice.php +23 -16 3.5.0 → 4.9.3 View file →
@@ -113,19 +113,21 @@
113 113 return ! empty( $this->content['links'] ) ? $this->content['links'] : ( ! empty( $this->options['links'] ) ? $this->options['links'] : [] );
114 114 }
115 115
116 116 public function links( $links ) {
117 - $_attributes = '';
118 117 $output = '<ul style="display: flex; width: 100%; align-items: center;" class="notice-links ' . $this->app->id . '-notice-links">';
119 118 foreach ( $links as $link ) {
119 + $_attributes = '';
120 120 $class = ! empty( $link['class'] ) ? $link['class'] : '';
121 121
122 122 if ( ! empty( $link['attributes'] ) ) {
123 - $link['attributes']['target'] = '_top';
124 - $_attributes = $this->attributes( $link['attributes'] );
125 - $link['link'] = '#';
123 + $_attributes = $this->attributes( $link['attributes'] );
126 124 }
127 125
126 + if( empty( $link['link'] ) ) {
127 + $link['link'] = '#';
128 + }
129 +
128 130 $output .= '<li style="margin: 0 15px 0 0;" class="notice-link-item ' . $class . '">';
129 131 $output .= ! empty( $link['link'] ) ? '<a href="' . esc_url( $link['link'] ) . '" ' . $_attributes . '>' : '';
130 132 if ( isset( $link['icon_class'] ) ) {
131 133 $output .= '<span style="margin-right: 5px" class="' . esc_attr( $link['icon_class'] ) . '"></span>';
@@ -140,26 +142,31 @@
140 142 return $output;
141 143 }
142 144
143 145 public function attributes( $params = [] ) {
144 - $_attr = [];
145 - $classname = 'dismiss-btn ';
146 + $_attr = [];
147 + if ( ! empty( $params ) ) {
148 + foreach ( $params as $key => $value ) {
149 + $_attr[ $key ] = $value;
146 150
147 - if ( ! empty( $params['class'] ) ) {
148 - $classname .= $params['class'];
149 - unset( $params['class'] );
151 + if( $key === 'class' ) {
152 + $_attr[ $key ] = [ $value ];
153 + }
154 +
155 + if( in_array( $key, [ 'data-later', 'data-dismiss' ] ) ) {
156 + $_attr[ 'class' ][] = 'dismiss-btn';
157 + }
158 + }
150 159 }
151 160
152 - $_attr[] = 'class="' . esc_attr( $classname ) . '"';
153 -
154 - $_attr[] = 'target="_blank"';
155 - if ( ! empty( $params ) ) {
156 - foreach ( $params as $key => $value ) {
157 - $_attr[] = "$key='$value'";
161 + $_attrs = [];
162 + if( ! empty( $_attr ) ) {
163 + foreach ( $_attr as $property => $value ) {
164 + $_attrs[] = "$property=" . '"' . ( is_array( $value ) ? esc_attr( implode(' ', $value ) ) : esc_attr( $value ) ) . '"';
158 165 }
159 166 }
160 167
161 - return \implode( ' ', $_attr );
168 + return implode( ' ', $_attrs );
162 169 }
163 170
164 171 public function url( $params = [] ) {
165 172 $nonce = wp_create_nonce( 'wpnotice_dismiss_notice_' . $this->id );