*/ public function get_templates() { $templates = array( 'template-1' => array( 'label' => __( 'Dark Nature', 'absd-under-maintenance' ), 'description' => __( 'Full-screen dark mountain background with centered gold-accented content. The default style.', 'absd-under-maintenance' ), 'thumbnail' => ABSD_UM_URL . 'assets/images/template-1-thumb.svg', ), 'template-2' => array( 'label' => __( 'Minimal Dark', 'absd-under-maintenance' ), 'description' => __( 'Understated dark layout with plenty of whitespace and a slim typographic focus.', 'absd-under-maintenance' ), 'thumbnail' => ABSD_UM_URL . 'assets/images/template-2-thumb.svg', ), 'template-3' => array( 'label' => __( 'Modern Center', 'absd-under-maintenance' ), 'description' => __( 'Bold centered card on a blurred background image with soft shadows.', 'absd-under-maintenance' ), 'thumbnail' => ABSD_UM_URL . 'assets/images/template-3-thumb.svg', ), 'template-4' => array( 'label' => __( 'Elegant', 'absd-under-maintenance' ), 'description' => __( 'Refined serif-accented layout with a thin divider and understated icon.', 'absd-under-maintenance' ), 'thumbnail' => ABSD_UM_URL . 'assets/images/template-4-thumb.svg', ), 'template-5' => array( 'label' => __( 'Corporate', 'absd-under-maintenance' ), 'description' => __( 'Clean, professional layout suited to business and corporate websites.', 'absd-under-maintenance' ), 'thumbnail' => ABSD_UM_URL . 'assets/images/template-5-thumb.svg', ), 'template-6' => array( 'label' => __( 'Fullscreen', 'absd-under-maintenance' ), 'description' => __( 'Edge-to-edge immersive layout with a large heading and minimal chrome.', 'absd-under-maintenance' ), 'thumbnail' => ABSD_UM_URL . 'assets/images/template-6-thumb.svg', ), ); /** * Filter the list of available maintenance templates. * * @param array $templates Template definitions keyed by slug. */ return apply_filters( 'absd_um_templates', $templates ); } /** * Whether a given template id exists. * * @param string $id Template slug. * @return bool */ public function exists( $id ) { $templates = $this->get_templates(); return isset( $templates[ $id ] ); } /** * Get the absolute path to a template's PHP render file. * * @param string $id Template slug. * @return string */ public function get_template_file( $id ) { if ( ! $this->exists( $id ) ) { $id = 'template-1'; } $file = ABSD_UM_PATH . 'templates/' . sanitize_file_name( $id ) . '.php'; /** * Allow themes/child-plugins to override where a template file lives. * * @param string $file Absolute path to the template file. * @param string $id Template slug. */ $file = apply_filters( 'absd_um_template_file', $file, $id ); if ( ! file_exists( $file ) ) { $file = ABSD_UM_PATH . 'templates/template-1.php'; } return $file; } /** * Get default (first) template id. * * @return string */ public function get_default_id() { return 'template-1'; } /** * Get the list of available maintenance icons. * * @return array Icon id => label. */ public function get_icons() { $icons = array( 'wrench' => __( 'Wrench', 'absd-under-maintenance' ), 'gear' => __( 'Gear', 'absd-under-maintenance' ), 'clock' => __( 'Clock', 'absd-under-maintenance' ), 'bell' => __( 'Bell', 'absd-under-maintenance' ), 'rocket' => __( 'Rocket', 'absd-under-maintenance' ), 'cone' => __( 'Cone', 'absd-under-maintenance' ), 'custom' => __( 'Custom (Upload)', 'absd-under-maintenance' ), ); /** * Filter the list of available maintenance icons. * * @param array $icons Icon definitions keyed by id, valued by label. */ return apply_filters( 'absd_um_icons', $icons ); } /** * Whether a given icon id exists. * * @param string $id Icon id. * @return bool */ public function icon_exists( $id ) { $icons = $this->get_icons(); return isset( $icons[ $id ] ); } /** * Get the absolute path to an icon's SVG partial. * * @param string $id Icon id. * @return string */ public function get_icon_file( $id ) { if ( ! $this->icon_exists( $id ) ) { $id = $this->get_default_icon_id(); } $file = ABSD_UM_PATH . 'templates/partials/icon-' . sanitize_file_name( $id ) . '.php'; /** * Allow themes/child-plugins to override where an icon partial lives. * * @param string $file Absolute path to the icon partial. * @param string $id Icon id. */ $file = apply_filters( 'absd_um_icon_file', $file, $id ); if ( ! file_exists( $file ) ) { $file = ABSD_UM_PATH . 'templates/partials/icon-wrench.php'; } return $file; } /** * Get default icon id. * * @return string */ public function get_default_icon_id() { return 'wrench'; } }