options; if(is_array($key)) { $result = $result[$key[0]]; } else { $result = $result['sillver']; } if(isset($result[$key])) { $result = $result[$key]; } else { $result = $default; } if($decode) { $result = sillver_deep_decode($result); } if($result == "") { $result = $default; } if($echo) echo $result; return $result; } } if(!function_exists('sillver_check_custom_widget')) { /** * checks which page we are viewing and if the page got a custom widget */ function sillver_check_custom_widget($area, $return = 'title') { $special_id_string = ""; if($area == 'page') { $id_array = sillver_get_option('widget_pages'); } else if($area == 'cat') { $id_array = sillver_get_option('widget_categories'); } else if($area == 'dynamic_template') { global $sillver; $dynamic_widgets = array(); foreach($sillver->options as $option_parent) { foreach ($option_parent as $element_data) { if(isset($element_data[0]) && is_array($element_data) && in_array('widget', $element_data[0])) { for($i = 1; $i <= $element_data[0]['dynamic_column_count']; $i++) { if($element_data[0]['dynamic_column_content_'.$i] == 'widget') { $dynamic_widgets[] = $element_data[0]['dynamic_column_content_'.$i.'_widget']; } } } } } return $dynamic_widgets; } //first build the id string if(is_array($id_array)) { foreach ($id_array as $special) { if(isset($special['widget_'.$area]) && $special['widget_'.$area] != "") { $special_id_string .= $special['widget_'.$area].","; } } } //if we got a valid string remove the last comma $special_id_string = trim($special_id_string,','); $clean_id_array = explode(',',$special_id_string); //if we dont want the title just return the id array if($return != 'title') return $clean_id_array; if(is_page($clean_id_array)) { return get_the_title(); } else if(is_category($clean_id_array)) { return single_cat_title( "", false ); } } } if(!function_exists('sillver_backend_get_dynamic_templates')) { /** * This function gets dynamic templates created at the template generator */ function sillver_backend_get_dynamic_templates() { $templates = array(); global $avia; if(is_array($avia->option_pages)) { foreach($avia->option_pages as $page) { if(array_key_exists('sortable', $page)) { $templates[$page['title']] = $page['slug']; } } } return $templates; } }