← All changes
|
core/base/providers/social-network-provider.php
+0
-61
4.3.0
→
3.35.0-dev2
View file →
| @@ -279,66 +279,5 @@ | ||
| 279 | 279 | return add_query_arg( [ |
| 280 | 280 | 'number' => urlencode( $number ), |
| 281 | 281 | ], 'viber://' . $action ); |
| 282 | 282 | } |
| 283 | - | |
| 284 | - public static function build_platform_link( array $link, string $prefix ): string { | |
| 285 | - $platform = $link['platform'] ?? ''; | |
| 286 | - | |
| 287 | - switch ( $platform ) { | |
| 288 | - case self::EMAIL: | |
| 289 | - return self::build_email_link( $link['email_data'] ?? [], $prefix ); | |
| 290 | - case self::SMS: | |
| 291 | - $number = $link['number'] ?? ''; | |
| 292 | - | |
| 293 | - return '' !== $number ? 'sms:' . $number : ''; | |
| 294 | - case self::MESSENGER: | |
| 295 | - $username = $link['username'] ?? ''; | |
| 296 | - | |
| 297 | - return '' !== $username ? self::build_messenger_link( $username ) : ''; | |
| 298 | - case self::WHATSAPP: | |
| 299 | - $number = $link['number'] ?? ''; | |
| 300 | - | |
| 301 | - return '' !== $number ? 'https://wa.me/' . $number : ''; | |
| 302 | - case self::VIBER: | |
| 303 | - return self::build_viber_link( $link['viber_action'] ?? 'chat', $link['number'] ?? '' ); | |
| 304 | - case self::SKYPE: | |
| 305 | - $username = $link['username'] ?? ''; | |
| 306 | - | |
| 307 | - return '' !== $username ? 'skype:' . $username . '?chat' : ''; | |
| 308 | - case self::TELEPHONE: | |
| 309 | - $number = $link['number'] ?? ''; | |
| 310 | - | |
| 311 | - return '' !== $number ? 'tel:' . $number : ''; | |
| 312 | - case self::WAZE: | |
| 313 | - $location = $link['location'] ?? []; | |
| 314 | - | |
| 315 | - return is_array( $location ) ? ( $location['url'] ?? '' ) : (string) $location; | |
| 316 | - case self::URL: | |
| 317 | - $url = $link['url'] ?? []; | |
| 318 | - | |
| 319 | - return is_array( $url ) ? ( $url['url'] ?? '' ) : (string) $url; | |
| 320 | - case self::FILE_DOWNLOAD: | |
| 321 | - case self::VCF: | |
| 322 | - $file = $link['file'] ?? []; | |
| 323 | - | |
| 324 | - return is_array( $file ) ? ( $file['url'] ?? '' ) : (string) $file; | |
| 325 | - default: | |
| 326 | - $url = $link['url'] ?? []; | |
| 327 | - | |
| 328 | - return is_array( $url ) ? ( $url['url'] ?? '' ) : (string) $url; | |
| 329 | - } | |
| 330 | - } | |
| 331 | - | |
| 332 | - public static function build_contact_link( string $platform, array $data, string $prefix ): string { | |
| 333 | - return self::build_platform_link( [ | |
| 334 | - 'platform' => $platform, | |
| 335 | - 'number' => $data[ $prefix . '_number' ] ?? $data['number'] ?? '', | |
| 336 | - 'username' => $data[ $prefix . '_username' ] ?? $data['username'] ?? '', | |
| 337 | - 'email_data' => $data, | |
| 338 | - 'viber_action' => $data[ $prefix . '_viber_action' ] ?? $data['viber_action'] ?? 'chat', | |
| 339 | - 'location' => $data[ $prefix . '_waze' ] ?? $data[ $prefix . '_location' ] ?? $data['location'] ?? [], | |
| 340 | - 'url' => $data[ $prefix . '_url' ] ?? $data['url'] ?? [], | |
| 341 | - 'file' => $data[ $prefix . '_file' ] ?? $data['file'] ?? [], | |
| 342 | - ], $prefix ); | |
| 343 | - } | |
| 344 | 283 | } |