Elementor_Enhancer.php
3 years ago
EmbedPress_Core_Installer.php
6 years ago
EmbedPress_Notice.php
4 years ago
EmbedPress_Plugin_Usage_Tracker.php
3 years ago
Extend_Elementor_Controls.php
3 years ago
Feature_Enhancer.php
3 years ago
Helper.php
3 years ago
Helper.php
500 lines
| 1 | <?php |
| 2 | |
| 3 | namespace EmbedPress\Includes\Classes; |
| 4 | use EmbedPress\Shortcode; |
| 5 | |
| 6 | if ( !defined('ABSPATH') ) { |
| 7 | exit; |
| 8 | } // Exit if accessed directly |
| 9 | |
| 10 | class Helper { |
| 11 | |
| 12 | /** |
| 13 | * Parse a query string into an associative array. |
| 14 | * |
| 15 | * If multiple values are found for the same key, the value of that key |
| 16 | * value pair will become an array. This function does not parse nested |
| 17 | * PHP style arrays into an associative array (e.g., foo[a]=1&foo[b]=2 will |
| 18 | * be parsed into ['foo[a]' => '1', 'foo[b]' => '2']). |
| 19 | * |
| 20 | * @param string $str Query string to parse |
| 21 | * @param int|bool $urlEncoding How the query string is encoded |
| 22 | * |
| 23 | * @return array |
| 24 | */ |
| 25 | |
| 26 | public function __construct () { |
| 27 | add_action('wp_ajax_lock_content_form_handler', [$this, 'lock_content_form_handler']); |
| 28 | add_action('wp_ajax_nopriv_lock_content_form_handler', [$this, 'lock_content_form_handler']); |
| 29 | add_action( 'wp_head', [$this, 'ep_add_meta_tags'] ); |
| 30 | } |
| 31 | |
| 32 | public function ep_add_meta_tags() { |
| 33 | echo 'abstract'; |
| 34 | } |
| 35 | |
| 36 | public static function parse_query($str, $urlEncoding = true) |
| 37 | { |
| 38 | $result = []; |
| 39 | |
| 40 | if ($str === '') { |
| 41 | return $result; |
| 42 | } |
| 43 | |
| 44 | if ($urlEncoding === true) { |
| 45 | $decoder = function ($value) { |
| 46 | return rawurldecode(str_replace('+', ' ', $value)); |
| 47 | }; |
| 48 | } elseif ($urlEncoding === PHP_QUERY_RFC3986) { |
| 49 | $decoder = 'rawurldecode'; |
| 50 | } elseif ($urlEncoding === PHP_QUERY_RFC1738) { |
| 51 | $decoder = 'urldecode'; |
| 52 | } else { |
| 53 | $decoder = function ($str) { return $str; }; |
| 54 | } |
| 55 | |
| 56 | foreach (explode('&', $str) as $kvp) { |
| 57 | $parts = explode('=', $kvp, 2); |
| 58 | $key = $decoder($parts[0]); |
| 59 | $value = isset($parts[1]) ? $decoder($parts[1]) : null; |
| 60 | if (!isset($result[$key])) { |
| 61 | $result[$key] = $value; |
| 62 | } else { |
| 63 | if (!is_array($result[$key])) { |
| 64 | $result[$key] = [$result[$key]]; |
| 65 | } |
| 66 | $result[$key][] = $value; |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | return $result; |
| 71 | } |
| 72 | public static function get_pdf_renderer() { |
| 73 | $renderer = EMBEDPRESS_URL_ASSETS . 'pdf/web/viewer.html'; |
| 74 | // @TODO; apply settings query args here |
| 75 | return $renderer; |
| 76 | } |
| 77 | |
| 78 | public static function get_extension_from_file_url($url) { |
| 79 | $urlSplit = explode(".", $url); |
| 80 | $ext = end($urlSplit); |
| 81 | return $ext; |
| 82 | |
| 83 | } |
| 84 | |
| 85 | public static function is_file_url($url) { |
| 86 | $pattern = '/\.([0-9a-z]+)(?=[?#])|(\.)(?:[\w]+)$/i'; |
| 87 | return preg_match($pattern, $url) === 1; |
| 88 | } |
| 89 | |
| 90 | public static function is_opensea($url) { |
| 91 | return strpos($url, "opensea.io") !== false; |
| 92 | } |
| 93 | public static function is_youtube_channel($url) { |
| 94 | return (bool) (preg_match('~(?:https?:\/\/)?(?:www\.)?(?:youtube.com\/)(?:channel\/|c\/|user\/|@)(\w+)~i', (string) $url)); |
| 95 | } |
| 96 | |
| 97 | public static function is_youtube($url) { |
| 98 | return (bool) (preg_match('~(?:https?://)?(?:www\.)?(?:youtube\.com|youtu\.be)/watch\?v=([^&]+)~i', (string) $url)); |
| 99 | } |
| 100 | |
| 101 | // Saved sources data temporary in wp_options table |
| 102 | public static function get_source_data($blockid, $source_url, $source_option_name, $source_temp_option_name) { |
| 103 | |
| 104 | |
| 105 | if(self::is_youtube_channel($source_url)){ |
| 106 | $source_name = 'YoutubeChannel'; |
| 107 | } |
| 108 | else if(self::is_youtube($source_url)){ |
| 109 | $source_name = 'Youtube'; |
| 110 | } |
| 111 | else if (!empty(self::is_file_url($source_url))) { |
| 112 | $source_name = 'document_' . self::get_extension_from_file_url($source_url); |
| 113 | } |
| 114 | else if(self::is_opensea($source_url)){ |
| 115 | $source_name = 'OpenSea'; |
| 116 | } |
| 117 | else{ |
| 118 | Shortcode::get_embera_instance(); |
| 119 | $collectios = Shortcode::get_collection(); |
| 120 | $provider = $collectios->findProviders($source_url); |
| 121 | if(!empty($provider[$source_url])){ |
| 122 | $source_name = $provider[$source_url]->getProviderName(); |
| 123 | } |
| 124 | else{ |
| 125 | $source_name = 'Unknown Source'; |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | if(!empty($blockid) && $blockid != 'undefined'){ |
| 130 | $sources = json_decode(get_option($source_temp_option_name), true); |
| 131 | |
| 132 | if(!$sources) { |
| 133 | $sources = array(); |
| 134 | } |
| 135 | $exists = false; |
| 136 | |
| 137 | foreach($sources as $i => $source) { |
| 138 | if ($source['id'] === $blockid) { |
| 139 | $sources[$i]['source']['name'] = $source_name; |
| 140 | $sources[$i]['source']['url'] = $source_url; |
| 141 | $exists = true; |
| 142 | break; |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | if(!$exists) { |
| 147 | $sources[] = array('id' => $blockid, 'source' => array('name' => $source_name, 'url' => $source_url, 'count' => 1)); |
| 148 | } |
| 149 | |
| 150 | update_option($source_temp_option_name, json_encode($sources)); |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | // Saved source data when post updated |
| 155 | public static function get_save_source_data_on_post_update( $source_option_name, $source_temp_option_name ) { |
| 156 | |
| 157 | if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
| 158 | return; |
| 159 | } |
| 160 | $temp_data = json_decode(get_option($source_temp_option_name), true); |
| 161 | $source_data = json_decode(get_option($source_option_name), true); |
| 162 | if(!$temp_data) { |
| 163 | $temp_data = array(); |
| 164 | } |
| 165 | if(!$source_data) { |
| 166 | $source_data = array(); |
| 167 | } |
| 168 | |
| 169 | $sources = array_merge($temp_data, $source_data); |
| 170 | |
| 171 | $unique_sources = array(); |
| 172 | foreach ($sources as $source) { |
| 173 | $unique_sources[$source['id']] = $source; |
| 174 | } |
| 175 | |
| 176 | $unique_sources = array_values($unique_sources); |
| 177 | |
| 178 | delete_option($source_temp_option_name); |
| 179 | |
| 180 | update_option($source_option_name, json_encode($unique_sources)); |
| 181 | } |
| 182 | |
| 183 | //Delete source data from option table when widget is removed |
| 184 | public static function get_delete_source_data($blockid, $source_option_name, $source_temp_option_name) { |
| 185 | if (!empty($blockid) && $blockid != 'undefined') { |
| 186 | $sources = json_decode(get_option($source_option_name), true); |
| 187 | $temp_sources = json_decode(get_option($source_temp_option_name), true); |
| 188 | if ($sources) { |
| 189 | foreach ($sources as $i => $source) { |
| 190 | if ($source['id'] === $blockid) { |
| 191 | unset($sources[$i]); |
| 192 | break; |
| 193 | } |
| 194 | } |
| 195 | update_option($source_option_name, json_encode(array_values($sources))); |
| 196 | } |
| 197 | if ($temp_sources) { |
| 198 | foreach ($temp_sources as $i => $source) { |
| 199 | if ($source['id'] === $blockid) { |
| 200 | unset($temp_sources[$i]); |
| 201 | break; |
| 202 | } |
| 203 | } |
| 204 | update_option($source_temp_option_name, json_encode(array_values($temp_sources))); |
| 205 | } |
| 206 | } |
| 207 | wp_die(); |
| 208 | } |
| 209 | |
| 210 | //Delete source temporary data when reload without update or publish |
| 211 | public static function get_delete_source_temp_data_on_reload($source_temp_option_name) { |
| 212 | $source_temp_data = json_decode(get_option($source_temp_option_name), true); |
| 213 | if ($source_temp_data ) { |
| 214 | delete_option( $source_temp_option_name ); |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | public static function get_file_title($url){ |
| 219 | return get_the_title(attachment_url_to_postid( $url )); |
| 220 | } |
| 221 | |
| 222 | |
| 223 | public function lock_content_form_handler() |
| 224 | { |
| 225 | |
| 226 | $client_id = isset($_POST['client_id']) ? $_POST['client_id'] : ''; |
| 227 | $password = isset($_POST['password']) ? $_POST['password'] : ''; |
| 228 | $epbase64 = isset($_POST['epbase']) ? $_POST['epbase'] : ''; |
| 229 | $hash_key = isset($_POST['hash_key']) ? $_POST['hash_key'] : ''; |
| 230 | |
| 231 | // Set the decryption key and initialization vector (IV) |
| 232 | $key = "g72@QKgEcANy8%D7xq8%@n%#"; |
| 233 | $iv = "^ZCC$93vsbyYjz01"; |
| 234 | |
| 235 | // Decode the base64 encoded cipher |
| 236 | $cipher = base64_decode($epbase64); |
| 237 | // Decrypt the cipher using AES-128-CBC encryption |
| 238 | |
| 239 | $wp_pass_key = hash('sha256', wp_salt(32) . md5($password)); |
| 240 | |
| 241 | if ($wp_pass_key === $hash_key) { |
| 242 | setcookie("password_correct_", $password, time() + 3600); |
| 243 | |
| 244 | $embed = openssl_decrypt($cipher, 'AES-128-CBC', $key, OPENSSL_RAW_DATA, $iv) . '<script> |
| 245 | var now = new Date(); |
| 246 | var time = now.getTime(); |
| 247 | var expireTime = time + 1000 * 60 * 60 * 24 * 30; |
| 248 | now.setTime(expireTime); |
| 249 | document.cookie = "password_correct_' . $client_id . '=' . $hash_key . '; expires=" + now.toUTCString() + "; path=/"; |
| 250 | </script>'; |
| 251 | } else { |
| 252 | $embed = 0; |
| 253 | } |
| 254 | |
| 255 | // Process the form data and return a response |
| 256 | $response = array( |
| 257 | 'success' => true, |
| 258 | 'password' => $password, |
| 259 | 'embedHtml' => $embed |
| 260 | ); |
| 261 | |
| 262 | echo json_encode($response); |
| 263 | |
| 264 | wp_die(); |
| 265 | } |
| 266 | |
| 267 | public static function display_password_form($client_id='', $embedHtml='', $pass_hash_key='', $attributes = []) |
| 268 | { |
| 269 | $lock_heading = !empty($attributes['lockHeading']) ? $attributes['lockHeading'] : ''; |
| 270 | $lock_subheading = !empty($attributes['lockSubHeading']) ? $attributes['lockSubHeading'] : ''; |
| 271 | $lock_error_message = !empty($attributes['lockErrorMessage']) ? $attributes['lockErrorMessage'] : ''; |
| 272 | $footer_message = !empty($attributes['footerMessage']) ? $attributes['footerMessage'] : ''; |
| 273 | $password_placeholder = !empty($attributes['passwordPlaceholder']) ? $attributes['passwordPlaceholder'] : ''; |
| 274 | $button_text = !empty($attributes['submitButtonText']) ? $attributes['submitButtonText'] : ''; |
| 275 | $unlocking_text = !empty($attributes['submitUnlockingText']) ? $attributes['submitUnlockingText'] : ''; |
| 276 | $enable_footer_message = !empty($attributes['enableFooterMessage']) ? $attributes['enableFooterMessage'] : ''; |
| 277 | |
| 278 | // Set the encryption key and initialization vector (IV) |
| 279 | $key = "g72@QKgEcANy8%D7xq8%@n%#"; |
| 280 | $iv = "^ZCC$93vsbyYjz01"; |
| 281 | |
| 282 | $salt = wp_salt(32); |
| 283 | $wp_hash_key = hash('sha256', $salt . $pass_hash_key); |
| 284 | |
| 285 | |
| 286 | // Encrypt the plaintext using AES-128-CBC encryption |
| 287 | $cipher = openssl_encrypt($embedHtml, 'AES-128-CBC', $key, OPENSSL_RAW_DATA, $iv); |
| 288 | |
| 289 | // Base64 encode the encrypted cipher |
| 290 | $encrypted_data = base64_encode($cipher); |
| 291 | |
| 292 | $lock_icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><g fill="#6354a5" class="color134563 svgShape"><path d="M46.3 28.7h-3v-6.4C43.3 16.1 38.2 11 32 11c-6.2 0-11.3 5.1-11.3 11.3v6.4h-3v-6.4C17.7 14.4 24.1 8 32 8s14.3 6.4 14.3 14.3v6.4" fill="#6354a5" class="color000000 svgShape"></path><path d="M44.8 55.9H19.2c-2.6 0-4.8-2.2-4.8-4.8V31.9c0-2.6 2.2-4.8 4.8-4.8h25.6c2.6 0 4.8 2.2 4.8 4.8v19.2c0 2.7-2.2 4.8-4.8 4.8zM19.2 30.3c-.9 0-1.6.7-1.6 1.6v19.2c0 .9.7 1.6 1.6 1.6h25.6c.9 0 1.6-.7 1.6-1.6V31.9c0-.9-.7-1.6-1.6-1.6H19.2z" fill="#6354a5" class="color000000 svgShape"></path><path d="M35.2 36.7c0 1.8-1.4 3.2-3.2 3.2s-3.2-1.4-3.2-3.2 1.4-3.2 3.2-3.2 3.2 1.5 3.2 3.2" fill="#6354a5" class="color000000 svgShape"></path><path d="M32.8 36.7h-1.6l-1.6 9.6h4.8l-1.6-9.6" fill="#6354a5" class="color000000 svgShape"></path></g></svg>'; |
| 293 | |
| 294 | echo ' |
| 295 | <div class="password-form-container"> |
| 296 | <h2>'.esc_html( $lock_heading ).'</h2> |
| 297 | <p>'.esc_html( $lock_subheading ).' </p> |
| 298 | <form class="password-form" method="post" class="password-form" data-unlocking-text="'.esc_attr( $unlocking_text ).'"> |
| 299 | |
| 300 | <div class="password-field"> |
| 301 | <span class="lock-icon">' . $lock_icon . '</span> |
| 302 | <input type="password" name="pass_' . esc_attr($client_id) . '" placeholder="' . esc_attr($password_placeholder) . '" required> |
| 303 | </div> |
| 304 | <input type="hidden" name="ep_client_id" value="' . esc_attr($client_id) . '"> |
| 305 | <input type="hidden" name="ep_base_' . esc_attr($client_id) . '" value="' . esc_attr($encrypted_data) . '"> |
| 306 | <input type="hidden" name="hash_key_' . esc_attr($client_id) . '" value="' . esc_attr($wp_hash_key ) . '"> |
| 307 | <input type="submit" name="password_submit" value="'.esc_attr( $button_text ).'"> |
| 308 | <div class="error-message hidden">'.esc_html( $lock_error_message ).'</div> |
| 309 | </form> |
| 310 | ' . ( ! empty( $enable_footer_message ) ? '<p class="need-access-message">' . esc_html( $footer_message ) . '</p>' : '' ) . ' |
| 311 | </div> |
| 312 | '; |
| 313 | } |
| 314 | |
| 315 | // Check if the user has already entered the correct password |
| 316 | public static function is_password_correct($client_id) |
| 317 | { |
| 318 | if (isset($_COOKIE['password_correct_' . $client_id])) { |
| 319 | return $_COOKIE['password_correct_' . $client_id]; |
| 320 | } else { |
| 321 | return false; |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | public static function customLogo($embedHTML, $atts){ |
| 326 | $x = !empty($atts['logoX']) ? $atts['logoX'] : 0; |
| 327 | $y = !empty($atts['logoY']) ? $atts['logoY'] : 0; |
| 328 | $uniqid = !empty($atts['url'])? '.ose-uid-' . md5($atts['url']): ''; |
| 329 | |
| 330 | $brandUrl = !empty($atts['customlogoUrl']) ? $atts['customlogoUrl'] : ''; |
| 331 | $opacity = !empty($atts['logoOpacity']) ? $atts['logoOpacity'] : ''; |
| 332 | |
| 333 | $cssClass = !empty( $atts['url'] ) ? '.ose-uid-' . md5( $atts['url'] ) : '.ose-youtube'; |
| 334 | |
| 335 | |
| 336 | |
| 337 | ob_start(); ?> |
| 338 | <style type="text/css"> |
| 339 | <?php echo esc_html($cssClass); ?> |
| 340 | { |
| 341 | position: relative; |
| 342 | } |
| 343 | |
| 344 | <?php echo esc_html($cssClass); ?> .watermark { |
| 345 | border: 0; |
| 346 | position: absolute; |
| 347 | bottom: <?php echo esc_html($y); ?>%; |
| 348 | right: <?php echo esc_html($x); ?>%; |
| 349 | max-width: 150px; |
| 350 | max-height: 75px; |
| 351 | opacity: 0.25; |
| 352 | z-index: 5; |
| 353 | -o-transition: opacity 0.5s ease-in-out; |
| 354 | -moz-transition: opacity 0.5s ease-in-out; |
| 355 | -webkit-transition: opacity 0.5s ease-in-out; |
| 356 | transition: opacity 0.5s ease-in-out; |
| 357 | opacity: <?php echo esc_html($opacity); ?>; |
| 358 | } |
| 359 | |
| 360 | <?php echo esc_html($cssClass); ?> |
| 361 | .watermark:hover { |
| 362 | opacity: 1; |
| 363 | } |
| 364 | </style> |
| 365 | <?php |
| 366 | |
| 367 | |
| 368 | $style = ob_get_clean(); |
| 369 | |
| 370 | if ( ! class_exists( '\simple_html_dom' ) ) { |
| 371 | include_once EMBEDPRESS_PATH_CORE . 'simple_html_dom.php'; |
| 372 | } |
| 373 | |
| 374 | $cta = ''; |
| 375 | $img = ''; |
| 376 | |
| 377 | if(!empty($atts['customlogo'])){ |
| 378 | $img = '<img src="'.esc_url($atts['customlogo']).'"/>'; |
| 379 | |
| 380 | $imgDom = str_get_html( $img ); |
| 381 | $imgDom = $imgDom->find( 'img', 0 ); |
| 382 | $imgDom->setAttribute( 'class', 'watermark ep-custom-logo' ); |
| 383 | $imgDom->removeAttribute( 'style' ); |
| 384 | $imgDom->setAttribute( 'width', 'auto' ); |
| 385 | $imgDom->setAttribute( 'height', 'auto' ); |
| 386 | ob_start(); |
| 387 | echo $imgDom; |
| 388 | |
| 389 | $cta .= ob_get_clean(); |
| 390 | |
| 391 | $imgDom->clear(); |
| 392 | unset( $img, $imgDom ); |
| 393 | |
| 394 | if ( !empty($brandUrl) ) { |
| 395 | $cta = '<a href="'.esc_url($brandUrl).'" target="_blank">'.$cta.'</a>'; |
| 396 | } |
| 397 | $dom = str_get_html( $embedHTML ); |
| 398 | |
| 399 | $wrapDiv = $dom->find( $uniqid, 0 ); |
| 400 | |
| 401 | if ( ! empty( $wrapDiv ) && is_object( $wrapDiv ) ) { |
| 402 | $wrapDiv->innertext .= $cta; |
| 403 | } |
| 404 | |
| 405 | ob_start(); |
| 406 | echo $wrapDiv; |
| 407 | |
| 408 | $markup = ob_get_clean(); |
| 409 | |
| 410 | $dom->clear(); |
| 411 | unset( $dom, $wrapDiv ); |
| 412 | |
| 413 | $embedHTML = $style . $markup; |
| 414 | |
| 415 | } |
| 416 | |
| 417 | return $embedHTML; |
| 418 | |
| 419 | } |
| 420 | |
| 421 | |
| 422 | public static function embed_content_share($content_id='', $attributes = []){ |
| 423 | |
| 424 | $share_position = !empty($attributes['sharePosition']) ? $attributes['sharePosition'] : 'right'; |
| 425 | $custom_thumnail = !empty($attributes['customThumbnail']) ? urlencode($attributes['customThumbnail']) : ''; |
| 426 | $custom_title = !empty($attributes['customTitle']) ? urlencode($attributes['customTitle']) : ''; |
| 427 | $custom_description = !empty($attributes['customDescription']) ? urlencode($attributes['customDescription']) : ''; |
| 428 | |
| 429 | $page_url = urlencode(get_permalink().'?hash='.$content_id); |
| 430 | |
| 431 | $social_icons = '<div class="ep-social-share-wraper"><div class="ep-social-share share-position-'.esc_attr( $share_position ).'">'; |
| 432 | $social_icons .= '<a href="https://www.facebook.com/sharer/sharer.php?u=' . $page_url . '" class="ep-social-icon facebook" target="_blank"> |
| 433 | <svg width="64px" height="64px" fill="#000000" viewBox="0 -6 512 512" xmlns="http://www.w3.org/2000/svg"> |
| 434 | <path d="M0 0h512v500H0z" fill="#475a96"/> |
| 435 | <path d="m375.72 112.55h-237.43c-8.137 0-14.73 6.594-14.73 14.73v237.43c0 8.135 6.594 14.73 14.73 14.73h127.83v-103.36h-34.781v-40.28h34.781v-29.705c0-34.473 21.055-53.244 51.807-53.244 14.73 0 27.391 1.097 31.08 1.587v36.026l-21.328 0.01c-16.725 0-19.963 7.947-19.963 19.609v25.717h39.887l-5.193 40.28h-34.693v103.36h68.012c8.135 0 14.73-6.596 14.73-14.73v-237.43c-1e-3 -8.137-6.596-14.73-14.731-14.73z" fill="#fff"/> |
| 436 | </svg> |
| 437 | </a>'; |
| 438 | $social_icons .= '<a href="https://twitter.com/intent/tweet?url=' . $page_url . '&text=' . $custom_title . '" class="ep-social-icon twitter" target="_blank"> |
| 439 | <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 248 204"> |
| 440 | <path fill="#ffffff" |
| 441 | d="M221.95 51.29c.15 2.17.15 4.34.15 6.53 0 66.73-50.8 143.69-143.69 143.69v-.04c-27.44.04-54.31-7.82-77.41-22.64 3.99.48 8 .72 12.02.73 22.74.02 44.83-7.61 62.72-21.66-21.61-.41-40.56-14.5-47.18-35.07 7.57 1.46 15.37 1.16 22.8-.87-23.56-4.76-40.51-25.46-40.51-49.5v-.64c7.02 3.91 14.88 6.08 22.92 6.32C11.58 63.31 4.74 33.79 18.14 10.71c25.64 31.55 63.47 50.73 104.08 52.76-4.07-17.54 1.49-35.92 14.61-48.25 20.34-19.12 52.33-18.14 71.45 2.19 11.31-2.23 22.15-6.38 32.07-12.26-3.77 11.69-11.66 21.62-22.2 27.93 10.01-1.18 19.79-3.86 29-7.95-6.78 10.16-15.32 19.01-25.2 26.16z" /> |
| 442 | </svg> |
| 443 | </a>'; |
| 444 | $social_icons .= '<a href="http://pinterest.com/pin/create/button/?url=' . $page_url . '&media=' .$custom_thumnail . '&description=' . $custom_description . '" class="ep-social-icon pinterest" target="_blank"> |
| 445 | |
| 446 | <svg xmlns="http://www.w3.org/2000/svg" height="800" width="1200" viewBox="-36.42015 -60.8 315.6413 364.8"><path d="M121.5 0C54.4 0 0 54.4 0 121.5 0 173 32 217 77.2 234.7c-1.1-9.6-2-24.4.4-34.9 2.2-9.5 14.2-60.4 14.2-60.4s-3.6-7.3-3.6-18c0-16.9 9.8-29.5 22-29.5 10.4 0 15.4 7.8 15.4 17.1 0 10.4-6.6 26-10.1 40.5-2.9 12.1 6.1 22 18 22 21.6 0 38.2-22.8 38.2-55.6 0-29.1-20.9-49.4-50.8-49.4-34.6 0-54.9 25.9-54.9 52.7 0 10.4 4 21.6 9 27.7 1 1.2 1.1 2.3.8 3.5-.9 3.8-3 12.1-3.4 13.8-.5 2.2-1.8 2.7-4.1 1.6-15.2-7.1-24.7-29.2-24.7-47.1 0-38.3 27.8-73.5 80.3-73.5 42.1 0 74.9 30 74.9 70.2 0 41.9-26.4 75.6-63 75.6-12.3 0-23.9-6.4-27.8-14 0 0-6.1 23.2-7.6 28.9-2.7 10.6-10.1 23.8-15.1 31.9 11.4 3.5 23.4 5.4 36 5.4 67.1 0 121.5-54.4 121.5-121.5C243 54.4 188.6 0 121.5 0z" fill="#fff"/></svg> |
| 447 | |
| 448 | </a>'; |
| 449 | |
| 450 | $social_icons .= '<a href="https://www.linkedin.com/sharing/share-offsite/?url='.$page_url.'&title='.$custom_title.'&summary='.$custom_description.'&source=LinkedIn" class="ep-social-icon linkedin" target="_blank"> |
| 451 | |
| 452 | <svg fill="#ffffff" height="800px" width="800px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" |
| 453 | viewBox="0 0 310 310" xml:space="preserve"> |
| 454 | <g id="XMLID_801_"> |
| 455 | <path id="XMLID_802_" d="M72.16,99.73H9.927c-2.762,0-5,2.239-5,5v199.928c0,2.762,2.238,5,5,5H72.16c2.762,0,5-2.238,5-5V104.73 |
| 456 | C77.16,101.969,74.922,99.73,72.16,99.73z"/> |
| 457 | <path id="XMLID_803_" d="M41.066,0.341C18.422,0.341,0,18.743,0,41.362C0,63.991,18.422,82.4,41.066,82.4 |
| 458 | c22.626,0,41.033-18.41,41.033-41.038C82.1,18.743,63.692,0.341,41.066,0.341z"/> |
| 459 | <path id="XMLID_804_" d="M230.454,94.761c-24.995,0-43.472,10.745-54.679,22.954V104.73c0-2.761-2.238-5-5-5h-59.599 |
| 460 | c-2.762,0-5,2.239-5,5v199.928c0,2.762,2.238,5,5,5h62.097c2.762,0,5-2.238,5-5v-98.918c0-33.333,9.054-46.319,32.29-46.319 |
| 461 | c25.306,0,27.317,20.818,27.317,48.034v97.204c0,2.762,2.238,5,5,5H305c2.762,0,5-2.238,5-5V194.995 |
| 462 | C310,145.43,300.549,94.761,230.454,94.761z"/> |
| 463 | </g> |
| 464 | </svg> |
| 465 | </a>'; |
| 466 | $social_icons .= '</div></div>'; |
| 467 | |
| 468 | return $social_icons ; |
| 469 | } |
| 470 | |
| 471 | |
| 472 | |
| 473 | public static function ep_get_elementor_widget_settings($page_settings = '', $id = '', $widgetType = ''){ |
| 474 | |
| 475 | $data = json_decode($page_settings, true); |
| 476 | |
| 477 | // Search for the element with the given ID |
| 478 | $element = null; |
| 479 | foreach ($data as $section) { |
| 480 | foreach ($section['elements'] as $column) { |
| 481 | foreach ($column['elements'] as $el) { |
| 482 | if ($el['id'] == $id && $el['elType'] == 'widget' && $el['widgetType'] == $widgetType) { |
| 483 | $element = $el; |
| 484 | break 3; |
| 485 | } |
| 486 | } |
| 487 | } |
| 488 | } |
| 489 | |
| 490 | // Output the element code |
| 491 | if ($element) { |
| 492 | return $element;; |
| 493 | } |
| 494 | } |
| 495 | |
| 496 | |
| 497 | } |
| 498 | |
| 499 | ?> |
| 500 |