__( 'Cookie Settings', 'cookieframe' ), 'class' => '', 'id' => '', ), $atts, 'cookieframe-preferences' ); return $this->render_link( 'preferences', $atts ); } /** * [cookieframe-do-not-sell] — CCPA "Do Not Sell" link. * * @param array|string $atts Shortcode attributes. * @return string */ public function do_not_sell( $atts ) { $atts = shortcode_atts( array( 'text' => __( 'Do Not Sell My Personal Information', 'cookieframe' ), 'class' => '', 'id' => '', ), $atts, 'cookieframe-do-not-sell' ); return $this->render_link( 'do-not-sell', $atts ); } /** * Build the anchor tag. * * @param string $action The data-cookieframe value. * @param array $atts Shortcode attributes. * @return string */ private function render_link( $action, $atts ) { $attrs = sprintf( 'href="#" data-cookieframe="%s"', esc_attr( $action ) ); if ( ! empty( $atts['class'] ) ) { $attrs .= sprintf( ' class="%s"', esc_attr( $atts['class'] ) ); } if ( ! empty( $atts['id'] ) ) { $attrs .= sprintf( ' id="%s"', esc_attr( $atts['id'] ) ); } return sprintf( '%s', $attrs, esc_html( $atts['text'] ) ); } }