<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/

class Inspira_Api_Core extends Core_Api_Abstract {

  public function themeConstants($themeColor = array(), $fonts = array()) {

    $settings = Engine_Api::_()->getApi('settings', 'core');
    
    $constant = array();

    $themeColorsArray = array();
    if(engine_count($themeColor) > 0) {
      foreach($themeColor as $key => $value) {
        $themeColorsArray["".$key.""] = "".$value."";
      }
    } else {
      $themecustom = Engine_Api::_()->getDbTable('customthemes', 'inspira')->getThemeKey(array('theme_id'=> $settings->getSetting('inspira.theme.color', 1)));
      foreach($themecustom as $value) {
        $themeColorsArray["".$value['column_key'].""] = "".$value['value']."";
      }
    } 
    $constant = array_merge($constant, $themeColorsArray);

    //Fonts
    if(engine_count($fonts) > 0) { 
      $fontsArray = array();
      foreach($fonts as $key => $value) {
        $fontsArray["".$key.""] = "".$value."";
      }
    } else {
      $fontsArray = array(
        "inspira_body_fontfamily" => "Roboto",
        "inspira_heading_fontfamily" => "Roboto",
        "inspira_mainmenu_fontfamily" => "Roboto",
        "inspira_tab_fontfamily" => "Roboto",
      );
    }

    $constant = array_merge($constant, $fontsArray);

    return $constant;
  }
}
