HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux sci 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: tpdc (1002)
PHP: 7.4.3-4ubuntu2.29
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/nsci/wp-content/plugins/penci-shortcodes/inc/penci_button.php
<?php
/**
 * Show button shortcode
 *
 * @param array  $atts
 * @param string $content
 *
 * @return string
 */
if ( ! function_exists( 'penci_penci_button_shortcode' ) ) {
	function penci_penci_button_shortcode( $atts, $content ) {
		$link = $color = $size = $icon = $icon_position = '';
		$id = $nofollow = $background = $text_color = $target  = $align = '';
		$full = $class = $margin_bottom = $text_hover_color = $hover_bgcolor =  '';

		$atts = shortcode_atts( array(
			'link'          => '#',
			'color'         => '',
			'size'          => '',
			'icon'          => '',
			'icon_position' => '',
			'radius'		=> '',
			'id'               => '',
			'nofollow'         => '',
			'background'       => '',
			'text_color'       => '',
			'hover_bgcolor'    => '',
			'text_hover_color' => '',
			'target'           => '',
			'align'            => '',
			'full'             => '',
			'class'            => '',
			'margin_bottom'    => '',
			'margin_top'       => '',
		), $atts, 'button' );

		extract( $atts );
		
		$unique_id = 'pencisc-button' . '__' . rand( 1000, 100000000 );
		
		$classes = array( 'pencisc-button', $unique_id );

		if ( $full ): $classes[] = 'pencisc-full'; endif;
		if ( 'right' == $icon_position ): $classes[] = 'pencisc-icon-right'; endif;
		if ( $color ): $classes[] = "pencisc-background-$color"; endif;
		if ( $align ): $classes[] = "pencisc-align-$align"; endif;
		if ( $size ): $classes[] = "pencisc-$size"; endif;
		if ( $class ): $classes[] = $class; endif;
		$classes = implode( ' ', $classes );
		$style = '';
		if ( $background ){
			$style .= "background-color:$background;";
			$style .= "border-color:$background;";
		}
		if ( $radius ){
			$style .= "border-radius:$radius;";
		}
		if ( $text_color ){
			$style .= "color:$text_color;";
		}
		if ( $margin_bottom ) {
			$style .= "margin-bottom:$margin_bottom;";
		}
		if ( $margin_top ) {
			$style .= "margin-top:$margin_top;";
		}

		$content = do_shortcode( $content );

		$html = "<a href='$link' class='$classes'" .
		        ( $id ? " id='$id'" : '' ) .
		        ( $nofollow ? " rel='nofollow'" : '' ) .
		        ( $target ? " target='$target'" : '' ) .
		        ( $style ? " style='$style'" : '' ) .
		        '>';
		if ( $icon ) {
			$icon = '<i class="' . $icon . '"></i>';
			$content = $icon_position == 'right' ? ( $content . $icon ) : ( $icon . $content );
		}
		$html .= $content . '</a>';
		if ( $align == 'center' ){
			$html = '<div style="text-align:center">' . $html . '</div>';
		}

		if( $hover_bgcolor || $text_hover_color ) {
			$html .= '<style>a.pencisc-button.'. $unique_id . ':hover{ ';

			if ( $hover_bgcolor ){
				$html .= "background-color:$hover_bgcolor !important;";
				$html .= "border-color:$hover_bgcolor !important;";
			}

			if ( $text_hover_color ) {
				$html .= "color:$text_hover_color !important;";
			}

			$html .= '}</style>';
		}

		return apply_filters( 'pencisc_shortcode_button', $html, $atts, $content );
	}
}