entry = $entry; $this->userId = Arr::get($entry, 'user_id', null); } public function getWPValues($key) { switch ($key) { case 'user_id': return $this->userId; case 'user_first_name': $user = $this->getUser(); if (!$user) { return ''; } return $user->user_firstname; case 'user_last_name': $user = $this->getUser(); if (!$user) { return ''; } return $user->user_lastname; case 'user_display_name': $user = $this->getUser(); if (!$user) { return ''; } return $user->display_name; case 'user_email': $user = $this->getUser(); if (!$user) { return ''; } return $user->user_email; case 'user_url': $user = $this->getUser(); if (!$user) { return ''; } return $user->user_url; case 'site_title': return get_bloginfo('name'); case 'site_url': return get_bloginfo('url'); case 'admin_email': return get_bloginfo('admin_email'); case 'store_logo'; return $this->getStoreLogo(); default: return ''; break; } } public function getuserMeta($key) { $meta = get_user_meta($this->userId, $key, true); if (is_array($meta)) { return implode(', ', $meta); } return $meta; } public function getOtherData($key) { // wp_date(), not current_time(): current_time() is gmdate() underneath, // so it renders the store's format with English month and weekday // names -- '14. October 2026' on a German store, which is the exact // half-translated string DateFormatter exists to remove. wp_date() // with no timestamp is the same instant in the same site timezone, // only localized. The format comes from DateFormatter so these two // shortcodes follow date_time_format_source like every other date. if ($key == 'date') { return wp_date(DateFormatter::dateFormat()); } if ($key == 'time') { return wp_date(DateFormatter::timeFormat()); } if ($key == 'user_ip') { return $this->entry->ip_address; } return ''; } protected function getUser() { if ($this->user) { return $this->user; } $this->user = get_user_by('ID', $this->userId); return $this->user; } public function getStoreLogo(): string { $storeSettings = new StoreSettings(); $logoPath = $storeSettings->get('store_logo'); if (isset($logoPath) && !empty($logoPath)) { $html = 'Store Logo'; } else { $html = ''; } return $html; } }