/**
  * GenerateDynamicTemplate::getTemplateOption()
  * 
  * @return
  */
 function getTemplateOption($option_id)
 {
     global $controller;
     $option = false;
     if (isset($controller->options['builder']) && isset($controller->options['builder'][$this->temp_name . $option_id])) {
         $option = themeple_entity_decode($controller->options['builder'][$this->temp_name . $option_id]);
     }
     return $option;
 }
 /**
  * themeple_entity_decode()
  * 
  * @param mixed $els
  * @return
  */
 function themeple_entity_decode($els)
 {
     if (is_array($els) || is_object($els)) {
         foreach ($els as $key => $val) {
             $els[$key] = themeple_entity_decode($val);
         }
     } else {
         $els = html_entity_decode($els, ENT_QUOTES, get_bloginfo('charset'));
     }
     return $els;
 }
 /**
  * themeple_post_meta()
  * 
  * @param string $post_id
  * @param bool $subkey
  * @return
  */
 function themeple_post_meta($post_id = '', $subkey = false)
 {
     $themeple_post_id = $post_id;
     if (!$subkey && $themeple_post_id != "" && !is_numeric($themeple_post_id) && !is_object($themeple_post_id)) {
         $subkey = $themeple_post_id;
         $themeple_post_id = "";
     }
     global $controller, $themeple_config;
     $key = '_themeple_elements_' . $controller->db_options_prefix;
     $values = "";
     if (is_object($themeple_post_id) && isset($themeple_post_id->ID)) {
         $themeple_post_id = $themeple_post_id->ID;
     }
     if (!$themeple_post_id) {
         $themeple_post_id = @get_the_ID();
     }
     if (!is_numeric($themeple_post_id)) {
         return;
     }
     $themeple_config['meta'] = themeple_entity_decode(get_post_meta($themeple_post_id, $key, true));
     if ($subkey && isset($themeple_config['meta'][$subkey])) {
         $meta = $themeple_config['meta'][$subkey];
     } else {
         if ($subkey) {
             $meta = false;
         } else {
             $meta = $themeple_config['meta'];
         }
     }
     return $meta;
 }