*/ function awosign_get_supported_languages() { return array( 'tr', 'en', 'zh', 'ar', 'de', 'ru', 'es', 'fr', 'ja', 'ko' ); } /** * Resolve WordPress Custom Logo or Site Icon URL if available. */ function awosign_get_wp_site_logo_url() { $custom_logo_id = get_theme_mod( 'custom_logo' ); if ( $custom_logo_id ) { $url = wp_get_attachment_image_url( $custom_logo_id, 'full' ); if ( $url ) { return $url; } } $site_icon = get_site_icon_url( 512 ); return $site_icon ? $site_icon : ''; } /** * Format an IBAN into 4-character groups for display. * * @param string $iban Raw IBAN string. * @return string */ function awosign_format_iban_display( $iban ) { $cleaned = strtoupper( preg_replace( '/\s+/', '', (string) $iban ) ); if ( '' === $cleaned ) { return ''; } return trim( chunk_split( $cleaned, 4, ' ' ) ); } /** * Default workspace state structure (v5: Global 10-Language + Decoupled UI Language + Bilingual Signatures, Business Cards, CR80 Staff Badges & Invoice/IBAN Cards). */ function awosign_get_default_workspace() { $site_name = get_bloginfo( 'name' ); $site_url = home_url( '/' ); $comp_name = $site_name ? $site_name : 'Example Studio A.Ş.'; return array( 'version' => 5, 'activeProfileId' => 'prof_1', 'brand' => array( 'company' => $comp_name, 'companyAlt' => '', 'brand' => '#172e49', 'accent' => '#e7b52e', 'website' => $site_url ? $site_url : 'https://example.com', 'address' => '123 Example Street, Levent, Istanbul, TR', 'logo' => '', 'logoUrl' => awosign_get_wp_site_logo_url(), 'sigTemplate' => 'classic', 'uiLanguage' => 'tr', 'language' => 'tr', 'theme' => 'auto', // Badge (CR80 54x86mm) shared back-side fields 'emergency' => '+90 212 444 0 112 (İSG & Güvenlik)', 'badgeRules' => 'Bu kimlik kartı kurum mülkiyetindedir. Görev süresince görünür şekilde taşınması zorunludur. Bulunduğunda lütfen güvenlik birimine teslim ediniz.', // Billing & Invoice (AwoCard) shared fields 'taxOffice' => 'Büyük Mükellefler V.D.', 'taxId' => '1234567890', 'mersis' => '0123456789000015', 'kep' => 'ornek@hs01.kep.tr', 'billingPhone' => '+90 212 555 00 00', 'billingEmail' => 'muhasebe@example.com', 'wooBacsEnabled' => false, ), 'profiles' => array( array( 'id' => 'prof_1', 'person' => 'Alex Morgan', 'personAlt' => '', 'job' => 'Creative Director', 'jobAlt' => '', 'department' => 'Tasarım & Mühendislik', 'staffNo' => 'PER-2026-001', 'blood' => 'A Rh (+)', 'roleBadge' => 'YETKİLİ / MÜHENDİS', 'photo' => '', 'photoUrl' => '', 'phone' => '+90 555 123 4567', 'email' => 'alex@example.com', 'qrMode' => 'url', 'qrUrl' => '', 'social' => array( 'LinkedIn' => array( 'enabled' => true, 'value' => 'example' ), 'Instagram' => array( 'enabled' => true, 'value' => 'example' ), 'Facebook' => array( 'enabled' => true, 'value' => 'example' ), ), ), ), 'banks' => array( array( 'id' => 'bank_1', 'holder' => $comp_name, 'bank' => 'Garanti BBVA', 'branch' => 'Levent Ticari (0412)', 'iban' => 'TR330006100519786457841326', 'currency' => 'TRY', 'swift' => 'TGBATRISXXX', ), array( 'id' => 'bank_2', 'holder' => $comp_name, 'bank' => 'Türkiye İş Bankası', 'branch' => 'Maslak Kurumsal (1205)', 'iban' => 'TR170006400000212050012345', 'currency' => 'EUR', 'swift' => 'ISBKTRISXXX', ), ), ); } /** * Retrieve saved workspace merged with v5 defaults and automatic schema migration backup (AWO-QS-08). */ function awosign_get_workspace() { $defaults = awosign_get_default_workspace(); $saved = get_option( AWOSIGN_OPTION_KEY, null ); if ( ! is_array( $saved ) || empty( $saved['profiles'] ) || ! is_array( $saved['profiles'] ) ) { return $defaults; } // Automatic non-destructive backup when upgrading from schema version < 5. $saved_ver = isset( $saved['version'] ) ? (int) $saved['version'] : 1; if ( $saved_ver < 5 ) { update_option( AWOSIGN_BACKUP_OPTION_KEY, $saved, false ); $saved['version'] = 5; } $saved['brand'] = array_merge( $defaults['brand'], isset( $saved['brand'] ) && is_array( $saved['brand'] ) ? $saved['brand'] : array() ); if ( empty( $saved['banks'] ) || ! is_array( $saved['banks'] ) ) { $saved['banks'] = $defaults['banks']; } foreach ( $saved['profiles'] as $idx => $p ) { $saved['profiles'][ $idx ] = array_merge( $defaults['profiles'][0], is_array( $p ) ? $p : array() ); } return $saved; } /** * Register WP Admin Menu. */ function awosign_register_menu() { add_menu_page( __( 'AwoSign Corporate Identity Studio', 'awosign' ), 'AwoSign', 'manage_options', 'awosign', 'awosign_render_page', 'dashicons-id-alt', 80 ); } add_action( 'admin_menu', 'awosign_register_menu' ); /** * Enqueue Admin Designer Assets + WP Media Library + Localize Saved Workspace & Nonce. */ function awosign_enqueue_assets( $hook ) { if ( 'toplevel_page_awosign' !== $hook || ! current_user_can( 'manage_options' ) ) { return; } wp_enqueue_media(); wp_enqueue_style( 'awosign-designer', plugins_url( 'assets/designer.css', __FILE__ ), array(), AWOSIGN_VERSION ); wp_enqueue_script( 'awosign-qrcode', plugins_url( 'assets/qrcode.js', __FILE__ ), array(), '1.4.4', true ); wp_enqueue_script( 'awosign-designer', plugins_url( 'assets/designer.js', __FILE__ ), array( 'awosign-qrcode' ), AWOSIGN_VERSION, true ); wp_localize_script( 'awosign-designer', 'awosignWpConfig', array( 'ajaxUrl' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'awosign_save_workspace_nonce' ), 'siteLogoUrl' => esc_url_raw( awosign_get_wp_site_logo_url() ), 'siteName' => sanitize_text_field( get_bloginfo( 'name' ) ), 'siteUrl' => esc_url_raw( home_url( '/' ) ), 'workspace' => awosign_get_workspace(), ) ); } add_action( 'admin_enqueue_scripts', 'awosign_enqueue_assets' ); /** * Render Admin Page. */ function awosign_render_page() { if ( ! current_user_can( 'manage_options' ) ) { wp_die( esc_html__( 'You do not have permission to access this page.', 'awosign' ) ); } require __DIR__ . '/designer-view.php'; } /** * Sanitize a data URL or HTTP(S) URL image field. * * @param string $raw Raw image string. * @return string */ function awosign_sanitize_image_field( $raw ) { $raw = (string) $raw; if ( '' === $raw ) { return ''; } if ( preg_match( '/^data:image\/(png|jpeg|webp|svg\+xml);base64,[a-zA-Z0-9+\/=]+$/', $raw ) && strlen( $raw ) < 3500000 ) { return $raw; } if ( filter_var( $raw, FILTER_VALIDATE_URL ) ) { return esc_url_raw( $raw, array( 'http', 'https' ) ); } return ''; } /** * Strip leading spreadsheet formula triggers (=, +, -, @) from imported text fields (AWO-QS-03). * * @param string $val Input text. * @return string */ function awosign_sanitize_safe_text( $val ) { $clean = sanitize_text_field( (string) $val ); return ltrim( $clean, "=+-@\t\r" ); } /** * Sanitize and Save Workspace via AJAX (manage_options + Nonce protected). */ function awosign_ajax_save_workspace() { if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( array( 'message' => __( 'Unauthorized operation (manage_options required).', 'awosign' ) ), 403 ); } check_ajax_referer( 'awosign_save_workspace_nonce', 'nonce' ); $raw_json = isset( $_POST['workspace'] ) ? sanitize_textarea_field( wp_unslash( $_POST['workspace'] ) ) : ''; $decoded = json_decode( $raw_json, true ); if ( ! is_array( $decoded ) || empty( $decoded['profiles'] ) || ! is_array( $decoded['profiles'] ) ) { wp_send_json_error( array( 'message' => __( 'Invalid workspace payload format.', 'awosign' ) ), 400 ); } $brand_in = isset( $decoded['brand'] ) && is_array( $decoded['brand'] ) ? $decoded['brand'] : array(); $brand_color = isset( $brand_in['brand'] ) && preg_match( '/^#[0-9a-fA-F]{6}$/', $brand_in['brand'] ) ? $brand_in['brand'] : '#172e49'; $accent_color = isset( $brand_in['accent'] ) && preg_match( '/^#[0-9a-fA-F]{6}$/', $brand_in['accent'] ) ? $brand_in['accent'] : '#e7b52e'; $sig_tpl = isset( $brand_in['sigTemplate'] ) && in_array( $brand_in['sigTemplate'], array( 'classic', 'compact', 'banner' ), true ) ? $brand_in['sigTemplate'] : 'classic'; $supported_langs = awosign_get_supported_languages(); $lang_code = ( isset( $brand_in['language'] ) && in_array( $brand_in['language'], $supported_langs, true ) ) ? $brand_in['language'] : 'tr'; $ui_lang_code = ( isset( $brand_in['uiLanguage'] ) && 'en' === $brand_in['uiLanguage'] ) ? 'en' : 'tr'; $clean_brand = array( 'company' => awosign_sanitize_safe_text( isset( $brand_in['company'] ) ? $brand_in['company'] : '' ), 'companyAlt' => awosign_sanitize_safe_text( isset( $brand_in['companyAlt'] ) ? $brand_in['companyAlt'] : '' ), 'brand' => $brand_color, 'accent' => $accent_color, 'website' => esc_url_raw( isset( $brand_in['website'] ) ? $brand_in['website'] : '', array( 'http', 'https' ) ), 'address' => sanitize_textarea_field( isset( $brand_in['address'] ) ? $brand_in['address'] : '' ), 'logo' => awosign_sanitize_image_field( isset( $brand_in['logo'] ) ? $brand_in['logo'] : '' ), 'logoUrl' => esc_url_raw( isset( $brand_in['logoUrl'] ) ? $brand_in['logoUrl'] : '', array( 'http', 'https' ) ), 'sigTemplate' => $sig_tpl, 'uiLanguage' => $ui_lang_code, 'language' => $lang_code, 'theme' => ( isset( $brand_in['theme'] ) && in_array( $brand_in['theme'], array( 'auto', 'dark', 'light' ), true ) ) ? $brand_in['theme'] : 'auto', 'emergency' => awosign_sanitize_safe_text( isset( $brand_in['emergency'] ) ? $brand_in['emergency'] : '' ), 'badgeRules' => sanitize_textarea_field( isset( $brand_in['badgeRules'] ) ? $brand_in['badgeRules'] : '' ), 'taxOffice' => awosign_sanitize_safe_text( isset( $brand_in['taxOffice'] ) ? $brand_in['taxOffice'] : '' ), 'taxId' => awosign_sanitize_safe_text( isset( $brand_in['taxId'] ) ? $brand_in['taxId'] : '' ), 'mersis' => awosign_sanitize_safe_text( isset( $brand_in['mersis'] ) ? $brand_in['mersis'] : '' ), 'kep' => awosign_sanitize_safe_text( isset( $brand_in['kep'] ) ? $brand_in['kep'] : '' ), 'billingPhone' => awosign_sanitize_safe_text( isset( $brand_in['billingPhone'] ) ? $brand_in['billingPhone'] : '' ), 'billingEmail' => sanitize_email( isset( $brand_in['billingEmail'] ) ? $brand_in['billingEmail'] : '' ), 'wooBacsEnabled' => ! empty( $brand_in['wooBacsEnabled'] ), ); $clean_profiles = array(); foreach ( array_slice( $decoded['profiles'], 0, 150 ) as $idx => $p ) { if ( ! is_array( $p ) ) { continue; } $pid = isset( $p['id'] ) ? preg_replace( '/[^a-zA-Z0-9_-]/', '', (string) $p['id'] ) : ''; if ( ! $pid ) { $pid = 'prof_' . ( $idx + 1 ); } $social_in = isset( $p['social'] ) && is_array( $p['social'] ) ? $p['social'] : array(); $clean_social = array(); foreach ( $social_in as $plat => $sdata ) { $plat_key = preg_replace( '/[^a-zA-Z0-9]/', '', (string) $plat ); if ( $plat_key && is_array( $sdata ) ) { $clean_social[ $plat_key ] = array( 'enabled' => ! empty( $sdata['enabled'] ), 'value' => awosign_sanitize_safe_text( isset( $sdata['value'] ) ? $sdata['value'] : '' ), ); } } $clean_profiles[] = array( 'id' => $pid, 'person' => awosign_sanitize_safe_text( isset( $p['person'] ) ? $p['person'] : '' ), 'personAlt' => awosign_sanitize_safe_text( isset( $p['personAlt'] ) ? $p['personAlt'] : '' ), 'job' => awosign_sanitize_safe_text( isset( $p['job'] ) ? $p['job'] : '' ), 'jobAlt' => awosign_sanitize_safe_text( isset( $p['jobAlt'] ) ? $p['jobAlt'] : '' ), 'department' => awosign_sanitize_safe_text( isset( $p['department'] ) ? $p['department'] : '' ), 'staffNo' => awosign_sanitize_safe_text( isset( $p['staffNo'] ) ? $p['staffNo'] : '' ), 'blood' => awosign_sanitize_safe_text( isset( $p['blood'] ) ? $p['blood'] : 'A Rh (+)' ), 'roleBadge' => awosign_sanitize_safe_text( isset( $p['roleBadge'] ) ? $p['roleBadge'] : 'PERSONEL' ), 'photo' => awosign_sanitize_image_field( isset( $p['photo'] ) ? $p['photo'] : '' ), 'photoUrl' => esc_url_raw( isset( $p['photoUrl'] ) ? $p['photoUrl'] : '', array( 'http', 'https' ) ), 'phone' => awosign_sanitize_safe_text( isset( $p['phone'] ) ? $p['phone'] : '' ), 'email' => sanitize_email( isset( $p['email'] ) ? $p['email'] : '' ), 'qrMode' => ( isset( $p['qrMode'] ) && 'vcard' === $p['qrMode'] ) ? 'vcard' : 'url', 'qrUrl' => esc_url_raw( isset( $p['qrUrl'] ) ? $p['qrUrl'] : '', array( 'http', 'https' ) ), 'social' => $clean_social, ); } if ( empty( $clean_profiles ) ) { $clean_profiles = awosign_get_default_workspace()['profiles']; } $clean_banks = array(); $banks_in = isset( $decoded['banks'] ) && is_array( $decoded['banks'] ) ? array_slice( $decoded['banks'], 0, 20 ) : array(); foreach ( $banks_in as $b_idx => $b_item ) { if ( ! is_array( $b_item ) ) { continue; } $clean_banks[] = array( 'id' => awosign_sanitize_safe_text( isset( $b_item['id'] ) ? $b_item['id'] : 'bank_' . ( $b_idx + 1 ) ), 'holder' => awosign_sanitize_safe_text( isset( $b_item['holder'] ) ? $b_item['holder'] : '' ), 'bank' => awosign_sanitize_safe_text( isset( $b_item['bank'] ) ? $b_item['bank'] : '' ), 'branch' => awosign_sanitize_safe_text( isset( $b_item['branch'] ) ? $b_item['branch'] : '' ), 'iban' => awosign_sanitize_safe_text( isset( $b_item['iban'] ) ? $b_item['iban'] : '' ), 'currency' => awosign_sanitize_safe_text( isset( $b_item['currency'] ) ? $b_item['currency'] : 'TRY' ), 'swift' => awosign_sanitize_safe_text( isset( $b_item['swift'] ) ? $b_item['swift'] : '' ), ); } $active_id = isset( $decoded['activeProfileId'] ) ? preg_replace( '/[^a-zA-Z0-9_-]/', '', (string) $decoded['activeProfileId'] ) : $clean_profiles[0]['id']; $to_save = array( 'version' => 5, 'activeProfileId' => $active_id, 'brand' => $clean_brand, 'profiles' => $clean_profiles, 'banks' => $clean_banks, 'updatedAt' => current_time( 'mysql' ), ); update_option( AWOSIGN_OPTION_KEY, $to_save, false ); wp_send_json_success( array( 'message' => __( 'AwoSign workspace saved to WordPress database.', 'awosign' ), 'workspace' => $to_save, ) ); } add_action( 'wp_ajax_awosign_save_workspace', 'awosign_ajax_save_workspace' ); /** * Render CR80 Vertical Staff ID Badge via Shortcode ([awosign type="badge" id="prof_1"] or [awobadge]). * Privacy-by-Default (AWO-QS-03 / K-01): Health data (blood group) and personal phone are hidden on public pages unless show_blood="1" / show_phone="1" is explicitly set. * * @param array $profile Selected staff profile. * @param array $brand Brand configuration. * @param bool $show_blood Whether to display blood type publicly. * @param bool $show_phone Whether to display phone number publicly. * @return string */ function awosign_render_badge_shortcode_html( $profile, $brand, $show_blood = false, $show_phone = false ) { $company = isset( $brand['company'] ) ? $brand['company'] : ''; $company_alt = isset( $brand['companyAlt'] ) ? $brand['companyAlt'] : ''; $brand_color = isset( $brand['brand'] ) ? $brand['brand'] : '#172e49'; $accent_color = isset( $brand['accent'] ) ? $brand['accent'] : '#e7b52e'; $logo = ! empty( $brand['logoUrl'] ) ? $brand['logoUrl'] : ( isset( $brand['logo'] ) ? $brand['logo'] : '' ); $emergency = isset( $brand['emergency'] ) ? $brand['emergency'] : ''; $rules = isset( $brand['badgeRules'] ) ? $brand['badgeRules'] : ''; $person = isset( $profile['person'] ) ? $profile['person'] : ''; $person_alt = isset( $profile['personAlt'] ) ? $profile['personAlt'] : ''; $job = isset( $profile['job'] ) ? $profile['job'] : ''; $job_alt = isset( $profile['jobAlt'] ) ? $profile['jobAlt'] : ''; $department = isset( $profile['department'] ) ? $profile['department'] : ''; $staff_no = isset( $profile['staffNo'] ) ? $profile['staffNo'] : 'PER-001'; $blood = isset( $profile['blood'] ) ? $profile['blood'] : 'A Rh (+)'; $role_badge = isset( $profile['roleBadge'] ) ? $profile['roleBadge'] : 'PERSONEL'; $phone = isset( $profile['phone'] ) ? $profile['phone'] : ''; $photo = ! empty( $profile['photoUrl'] ) ? $profile['photoUrl'] : ( isset( $profile['photo'] ) ? $profile['photo'] : '' ); $words = preg_split( '/\s+/', trim( $person ) ); $initials = ''; if ( is_array( $words ) ) { foreach ( array_slice( $words, 0, 2 ) as $w ) { $initials .= mb_strtoupper( mb_substr( $w, 0, 1 ) ); } } if ( '' === $initials ) { $initials = 'AS'; } $qr_parts = array( 'ID:' . $staff_no, $person . ( $person_alt ? ' (' . $person_alt . ')' : '' ), $job, $company, ); if ( $show_blood && $blood ) { $qr_parts[] = 'KAN:' . $blood; } if ( $show_phone && $phone ) { $qr_parts[] = 'TEL:' . $phone; } $qr_payload = implode( ' | ', $qr_parts ); $uid = 'awosign-badge-' . wp_unique_id(); ob_start(); ?>
<?php echo esc_attr( $company ); ?>
<?php echo esc_attr( $person ); ?>
ID: 🩸
KURUMSAL KİMLİK & GİRİŞ KARTI
Tel:
Kan Grubu:
Acil / İSG:
$brand Brand and billing configuration. * @param array> $banks Saved bank accounts. * @param string $mode Display mode: all | invoice | bank. * @return string */ function awosign_render_billing_shortcode_html( $brand, $banks, $mode = 'all' ) { $lang = isset( $brand['language'] ) ? $brand['language'] : 'tr'; $is_tr = ( 'tr' === $lang ); $is_rtl = ( 'ar' === $lang ); $company = isset( $brand['company'] ) ? $brand['company'] : ''; $company_alt = isset( $brand['companyAlt'] ) ? $brand['companyAlt'] : ''; $brand_color = isset( $brand['brand'] ) ? $brand['brand'] : '#172e49'; $accent_color = isset( $brand['accent'] ) ? $brand['accent'] : '#e7b52e'; $logo = ! empty( $brand['logoUrl'] ) ? $brand['logoUrl'] : ( isset( $brand['logo'] ) ? $brand['logo'] : '' ); $uid = 'awosign-billing-' . wp_unique_id(); $invoice_rows = array( ( $is_tr ? 'Vergi Dairesi' : 'Tax Office' ) => isset( $brand['taxOffice'] ) ? $brand['taxOffice'] : '', ( $is_tr ? 'Vergi / VKN No' : 'Tax ID' ) => isset( $brand['taxId'] ) ? $brand['taxId'] : '', ( $is_tr ? 'MERSİS No' : 'MERSIS No' ) => isset( $brand['mersis'] ) ? $brand['mersis'] : '', ( $is_tr ? 'KEP / E-Fatura' : 'KEP / E-Invoice' ) => isset( $brand['kep'] ) ? $brand['kep'] : '', ( $is_tr ? 'Fatura Adresi' : 'Billing Address' ) => isset( $brand['address'] ) ? $brand['address'] : '', ( $is_tr ? 'Muhasebe Tel' : 'Billing Phone' ) => ! empty( $brand['billingPhone'] ) ? $brand['billingPhone'] : '', ( $is_tr ? 'Muhasebe E-posta' : 'Billing Email' ) => ! empty( $brand['billingEmail'] ) ? $brand['billingEmail'] : '', ); $inv_qr = $company . ' | VD:' . ( $brand['taxOffice'] ?? '' ) . ' | VKN:' . ( $brand['taxId'] ?? '' ) . ' | MERSIS:' . ( $brand['mersis'] ?? '' ); ob_start(); ?>
<?php echo esc_attr( $company ); ?>
$val ) : ?>
IBAN
SWIFT / BIC:
'', 'type' => 'card', 'mode' => 'all', 'theme' => 'auto', 'show_blood' => '0', 'show_phone' => '0', ), $atts, 'awosign' ); $workspace = awosign_get_workspace(); $brand = isset( $workspace['brand'] ) ? $workspace['brand'] : array(); $profiles = isset( $workspace['profiles'] ) && is_array( $workspace['profiles'] ) ? $workspace['profiles'] : array(); $banks = isset( $workspace['banks'] ) && is_array( $workspace['banks'] ) ? $workspace['banks'] : array(); wp_enqueue_style( 'awosign-designer', plugins_url( 'assets/designer.css', __FILE__ ), array(), AWOSIGN_VERSION ); wp_enqueue_script( 'awosign-qrcode', plugins_url( 'assets/qrcode.js', __FILE__ ), array(), '1.4.4', true ); $type = strtolower( trim( (string) $atts['type'] ) ); if ( in_array( $type, array( 'billing', 'iban', 'invoice', 'bank' ), true ) ) { $b_mode = in_array( $type, array( 'invoice', 'bank' ), true ) ? $type : $atts['mode']; return awosign_render_billing_shortcode_html( $brand, $banks, $b_mode ); } if ( empty( $profiles ) ) { return ''; } $target_id = $atts['id'] ? $atts['id'] : ( isset( $workspace['activeProfileId'] ) ? $workspace['activeProfileId'] : '' ); $profile = $profiles[0]; foreach ( $profiles as $candidate ) { if ( isset( $candidate['id'] ) && $candidate['id'] === $target_id ) { $profile = $candidate; break; } } if ( 'badge' === $type ) { $show_blood = ( '1' === (string) $atts['show_blood'] || 'true' === strtolower( (string) $atts['show_blood'] ) ); $show_phone = ( '1' === (string) $atts['show_phone'] || 'true' === strtolower( (string) $atts['show_phone'] ) ); return awosign_render_badge_shortcode_html( $profile, $brand, $show_blood, $show_phone ); } $lang = isset( $brand['language'] ) ? $brand['language'] : 'tr'; $is_rtl = ( 'ar' === $lang ); $company = isset( $brand['company'] ) ? $brand['company'] : ''; $company_alt = isset( $brand['companyAlt'] ) ? $brand['companyAlt'] : ''; $brand_color = isset( $brand['brand'] ) ? $brand['brand'] : '#172e49'; $accent_color = isset( $brand['accent'] ) ? $brand['accent'] : '#e7b52e'; $website = isset( $brand['website'] ) ? $brand['website'] : ''; $address = isset( $brand['address'] ) ? $brand['address'] : ''; $logo = ! empty( $brand['logoUrl'] ) ? $brand['logoUrl'] : ( isset( $brand['logo'] ) ? $brand['logo'] : '' ); $person = isset( $profile['person'] ) ? $profile['person'] : ''; $person_alt = isset( $profile['personAlt'] ) ? $profile['personAlt'] : ''; $job = isset( $profile['job'] ) ? $profile['job'] : ''; $job_alt = isset( $profile['jobAlt'] ) ? $profile['jobAlt'] : ''; $phone = isset( $profile['phone'] ) ? $profile['phone'] : ''; $email = isset( $profile['email'] ) ? $profile['email'] : ''; $qr_mode = isset( $profile['qrMode'] ) ? $profile['qrMode'] : 'url'; $qr_url = ! empty( $profile['qrUrl'] ) ? $profile['qrUrl'] : $website; $full_name = $person . ( $person_alt ? ' (' . $person_alt . ')' : '' ); $full_org = $company . ( $company_alt ? ' (' . $company_alt . ')' : '' ); $full_job = $job . ( $job_alt ? ' / ' . $job_alt : '' ); $vcard_lines = array( 'BEGIN:VCARD', 'VERSION:3.0', 'FN;CHARSET=UTF-8:' . $full_name, 'ORG;CHARSET=UTF-8:' . $full_org, 'TITLE;CHARSET=UTF-8:' . $full_job, ); if ( $phone ) { $vcard_lines[] = 'TEL;TYPE=WORK,VOICE:' . $phone; } if ( $email ) { $vcard_lines[] = 'EMAIL:' . $email; } if ( $website ) { $vcard_lines[] = 'URL:' . $website; } if ( $address ) { $vcard_lines[] = 'ADR;TYPE=WORK;CHARSET=UTF-8:;;' . str_replace( array( "\r\n", "\r", "\n" ), ' ', $address ) . ';;;;'; } $vcard_lines[] = 'END:VCARD'; $vcard_payload = implode( "\r\n", $vcard_lines ); $qr_payload = ( 'vcard' === $qr_mode ) ? $vcard_payload : $qr_url; $uid = 'awosign-sc-' . wp_unique_id(); $theme_attr = in_array( $atts['theme'], array( 'auto', 'dark', 'light' ), true ) ? $atts['theme'] : 'auto'; $wa_text = rawurlencode( trim( $full_name . ' — ' . $full_job . ' (' . $full_org . ')' . "\n" . $phone . "\n" . $email . "\n" . $website ) ); ob_start(); ?>
<?php echo esc_attr( $company ); ?>




💬 WhatsApp
renders AwoSign Billing & IBAN Cards. */ function awosign_render_awocard_alias( $atts ) { $atts = shortcode_atts( array( 'mode' => 'all' ), $atts, 'awocard' ); return awosign_render_shortcode( array( 'type' => 'billing', 'mode' => $atts['mode'] ) ); } add_shortcode( 'awocard', 'awosign_render_awocard_alias' ); /** * Alias Shortcode [awobadge id="prof_1" show_blood="0" show_phone="0"] -> renders AwoSign CR80 Vertical Staff ID Badge. */ function awosign_render_awobadge_alias( $atts ) { $atts = shortcode_atts( array( 'id' => '', 'show_blood' => '0', 'show_phone' => '0', ), $atts, 'awobadge' ); return awosign_render_shortcode( array( 'type' => 'badge', 'id' => $atts['id'], 'show_blood' => $atts['show_blood'], 'show_phone' => $atts['show_phone'], ) ); } add_shortcode( 'awobadge', 'awosign_render_awobadge_alias' ); /** * Automatically display Company Invoice & Bank IBAN cards on WooCommerce Bank Transfer (BACS) Thank-You page when enabled. */ function awosign_render_woocommerce_bacs_cards() { $workspace = awosign_get_workspace(); if ( empty( $workspace['brand']['wooBacsEnabled'] ) ) { return; } // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped inside awosign_render_billing_shortcode_html(). echo awosign_render_billing_shortcode_html( $workspace['brand'], $workspace['banks'], 'all' ); } add_action( 'woocommerce_thankyou_bacs', 'awosign_render_woocommerce_bacs_cards', 15 ); /** * Register WordPress Privacy Policy Guide & Personal Data Exporter/Eraser (AWO-QS-03 KVKK/GDPR Technical Compliance). */ function awosign_register_privacy_policy_content() { if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) { return; } $content = '

' . esc_html__( 'AwoSign stores staff contact and badge profiles (name, title, department, phone, email, optional portrait photo, and optional blood type for printed HSE badges) locally in the WordPress options table (awosign_workspace_data_v1). QR codes are generated locally in the browser without external HTTP requests. Public [awobadge] shortcodes mask blood group and personal phone numbers by default unless explicitly enabled.', 'awosign' ) . '

'; wp_add_privacy_policy_content( 'AwoSign', wp_kses_post( $content ) ); } add_action( 'admin_init', 'awosign_register_privacy_policy_content' ); /** * Export staff personal data by email address via WordPress Privacy Tools. * * @param string $email_address Staff email address. * @return array */ function awosign_privacy_personal_data_exporter( $email_address ) { $email_address = trim( strtolower( (string) $email_address ) ); $workspace = awosign_get_workspace(); $export_items = array(); if ( ! empty( $workspace['profiles'] ) && is_array( $workspace['profiles'] ) ) { foreach ( $workspace['profiles'] as $p ) { $p_email = isset( $p['email'] ) ? trim( strtolower( (string) $p['email'] ) ) : ''; if ( $p_email && $p_email === $email_address ) { $export_items[] = array( 'group_id' => 'awosign-staff-profiles', 'group_label' => __( 'AwoSign Staff Profiles & ID Badges', 'awosign' ), 'item_id' => 'awosign-' . ( isset( $p['id'] ) ? $p['id'] : 'profile' ), 'data' => array( array( 'name' => __( 'Full Name', 'awosign' ), 'value' => isset( $p['person'] ) ? $p['person'] : '' ), array( 'name' => __( 'Title', 'awosign' ), 'value' => isset( $p['job'] ) ? $p['job'] : '' ), array( 'name' => __( 'Department', 'awosign' ), 'value' => isset( $p['department'] ) ? $p['department'] : '' ), array( 'name' => __( 'Staff No', 'awosign' ), 'value' => isset( $p['staffNo'] ) ? $p['staffNo'] : '' ), array( 'name' => __( 'Blood Group', 'awosign' ), 'value' => isset( $p['blood'] ) ? $p['blood'] : '' ), array( 'name' => __( 'Phone', 'awosign' ), 'value' => isset( $p['phone'] ) ? $p['phone'] : '' ), array( 'name' => __( 'Email', 'awosign' ), 'value' => isset( $p['email'] ) ? $p['email'] : '' ), ), ); } } } return array( 'data' => $export_items, 'done' => true, ); } /** * Erase staff personal data by email address via WordPress Privacy Tools. * * @param string $email_address Staff email address. * @return array */ function awosign_privacy_personal_data_eraser( $email_address ) { $email_address = trim( strtolower( (string) $email_address ) ); $workspace = awosign_get_workspace(); $items_removed = false; if ( ! empty( $workspace['profiles'] ) && is_array( $workspace['profiles'] ) ) { $remaining = array(); foreach ( $workspace['profiles'] as $p ) { $p_email = isset( $p['email'] ) ? trim( strtolower( (string) $p['email'] ) ) : ''; if ( $p_email && $p_email === $email_address ) { $items_removed = true; continue; } $remaining[] = $p; } if ( $items_removed ) { $workspace['profiles'] = ! empty( $remaining ) ? $remaining : awosign_get_default_workspace()['profiles']; update_option( AWOSIGN_OPTION_KEY, $workspace, false ); } } return array( 'items_removed' => $items_removed, 'items_retained' => false, 'messages' => array(), 'done' => true, ); } /** * Register Exporter and Eraser with WordPress Core Privacy API. */ function awosign_register_privacy_hooks() { add_filter( 'wp_privacy_personal_data_exporters', function ( $exporters ) { $exporters['awosign-staff-exporter'] = array( 'exporter_friendly_name' => __( 'AwoSign Staff Profiles', 'awosign' ), 'callback' => 'awosign_privacy_personal_data_exporter', ); return $exporters; } ); add_filter( 'wp_privacy_personal_data_erasers', function ( $erasers ) { $erasers['awosign-staff-eraser'] = array( 'eraser_friendly_name' => __( 'AwoSign Staff Profiles', 'awosign' ), 'callback' => 'awosign_privacy_personal_data_eraser', ); return $erasers; } ); } add_action( 'init', 'awosign_register_privacy_hooks' ); if ( file_exists( __DIR__ . '/includes/awo-ecosystem-hub.php' ) ) { require_once __DIR__ . '/includes/awo-ecosystem-hub.php'; }