'Meniu principal') ); add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size(208,142, true); add_image_size('case-study', 435); /*add_image_size('home-slider', 700, 495, true); add_image_size('article-page', 320, 226, true); add_image_size('listing-article', 160, 113, true); add_image_size('product-image', 560, 420, false); add_image_size('gallery', 9999, 600, false); */ if (!is_admin()) { wp_deregister_script('jquery'); wp_register_script('jquery', ('https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js'), false, '3.7.1'); wp_register_script('jquery-ui', ('https://ajax.googleapis.com/ajax/libs/jqueryui/1.13.2/jquery-ui.min.js'), array('jquery'), '1.13.2'); wp_enqueue_script('jquery-ui'); } show_admin_bar(false); add_editor_style(); remove_action('wp_head', 'rsd_link'); remove_action('wp_head', 'wp_generator'); remove_action('wp_head', 'index_rel_link'); remove_action('wp_head', 'wlwmanifest_link'); remove_action('wp_head', 'start_post_rel_link', 10, 0); remove_action('wp_head', 'parent_post_rel_link', 10, 0); remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0); automatic_feed_links(false); if ( class_exists("global_posts_ordering") ) { $global_posts_ordering = new global_posts_ordering(array("product")); } function image_src($img_tag) { preg_match("/src=\"(.*?)\"/i", $img_tag, $matches); return $matches[1]; } function short_text($text, $len=200, $puncte = ""){ $text = strip_tags($text); if( (mb_strlen($text) > $len) ) { $whitespaceposition = mb_strpos($text," ",$len)-1; if( $whitespaceposition > 0 ) { $chars = count_chars(mb_substr($text, 0, ($whitespaceposition+1)), 1); if (isset($chars[ord('<')]) && $chars[ord('<')] > (isset($chars[ord('>')]) ? $chars[ord('>')] : 0)) $whitespaceposition = mb_strpos($text,">",$whitespaceposition)-1; $text = mb_substr($text, 0, ($whitespaceposition+1)); } // close unclosed html tags if( preg_match_all("|<([a-zA-Z]+)|",$text,$aBuffer) ) { if( !empty($aBuffer[1]) ) { preg_match_all("||",$text,$aBuffer2); if( count($aBuffer[1]) != count($aBuffer2[1]) ) { foreach( $aBuffer[1] as $index => $tag ) { if( empty($aBuffer2[1][$index]) || $aBuffer2[1][$index] != $tag) $text .= ''; } } } } } return $text.$puncte; } /* returneaza data in format: - pt postare de azi 'azi la {ora}' - pt anul asta, dar nu azi '{ziua} {luna} la {ora} - pt alt an '{ziua} {luna} {anul} la {ora} */ function afiseaza_data($data=false) { if (!$data) return false; // verifica daca este data in format corect if (($data_timestamp = strtotime($data)) === false) { // daca nu este corecta si nu am ce face cu ea returnez valoarea inapoi return $data; } else { //@setlocale(LC_TIME, 'ro_RO'); /*if (date("Y")==date("Y",$data_timestamp)) { // acelasi an if (date('d')==date('d',$data_timestamp)) { // aceeasi zi return strftime('azi la %H:%M',$data_timestamp); } else { // zi diferite return strftime('%d %b la %H:%M',$data_timestamp); } } else { // ani diferiti return strftime('%d %b %Y la %H:%M',$data_timestamp); }*/ return strftime("%b %d",$data_timestamp); } } function afiseaza_data_cu_an($data=false) { if (!$data) return false; // verifica daca este data in format corect if (($data_timestamp = strtotime($data)) === false) { // daca nu este corecta si nu am ce face cu ea returnez valoarea inapoi return $data; } else { //@setlocale(LC_TIME, 'ro_RO'); /*if (date("Y")==date("Y",$data_timestamp)) { // acelasi an if (date('d')==date('d',$data_timestamp)) { // aceeasi zi return strftime('azi la %H:%M',$data_timestamp); } else { // zi diferite return strftime('%d %b la %H:%M',$data_timestamp); } } else { // ani diferiti return strftime('%d %b %Y la %H:%M',$data_timestamp); }*/ return strftime("%b %d, %Y",$data_timestamp); } } function arrangeMenuIqon($menu, $selected_object_id = 0, $selected_object_type, $homeID) { global $object_id, $object_id_child, $object_id_child_child; $arranged_menu = array(); $mainLevel = array(); $secondLevel = array(); $thirdLevel = array(); foreach ($menu as $m) if ($m->menu_item_parent == 0) { $key = $m->ID; $arranged_menu[$key] = new stdClass; $arranged_menu[$key]->ID = $m->ID; $arranged_menu[$key]->object_id = $m->object_id; $arranged_menu[$key]->object_id_en = function_exists('icl_object_id') ? icl_object_id($m->object_id, $m->object, true, 'en') : $m->object_id; $arranged_menu[$key]->parrent = 0; $arranged_menu[$key]->title = $m->title; $arranged_menu[$key]->attr_title = $m->attr_title; $arranged_menu[$key]->object = $m->object; if (empty($arranged_menu[$key]->attr_title)) $arranged_menu[$key]->attr_title = $arranged_menu[$key]->title; $arranged_menu[$key]->url = $m->url; $arranged_menu[$key]->has_childrens = false; $arranged_menu[$key]->selected = false; if ($selected_object_type == 'home') { if ($selected_object_id == $arranged_menu[$key]->object_id_en && $m->object == 'page') $arranged_menu[$key]->selected = true; $object_id = $key; } elseif ($selected_object_type == $m->object && $selected_object_id == $m->object_id) { $arranged_menu[$key]->selected = true; $object_id = $key; } $mainLevel[] = $m->ID; } elseif (in_array($m->menu_item_parent, $mainLevel)) { $key_parent = $m->menu_item_parent; $arranged_menu[$key_parent]->has_childrens = true; $key_child = $m->ID; $objectToModify = &$arranged_menu[$key_parent]->childrens; $objectToModify[$key_child] = new stdClass; $objectToModify[$key_child]->ID = $m->ID; $objectToModify[$key_child]->object_id = $m->object_id; $objectToModify[$key_child]->object_id_en = function_exists('icl_object_id') ? icl_object_id($m->object_id, $m->object, true, 'en') : $m->object_id; $objectToModify[$key_child]->parrent = $key_parent; $objectToModify[$key_child]->title = $m->title; $objectToModify[$key_child]->attr_title = $m->attr_title; $objectToModify[$key_child]->object = $m->object; if (empty($objectToModify[$key_child]->attr_title)) $objectToModify[$key_child]->attr_title = $objectToModify[$key_child]->title; $objectToModify[$key_child]->url = $m->url; if (($arranged_menu[$key_parent]->object_id_en == 8) && sizeof($arranged_menu[$key_parent]->childrens) == 1) $arranged_menu[$key_parent]->url = $objectToModify[$key_child]->url; $objectToModify[$key_child]->selected = false; if ($selected_object_type == $m->object && $selected_object_id == $m->object_id) { $objectToModify[$key_child]->selected = true; $arranged_menu[$key_parent]->selected = true; $object_id = $key_parent; $object_id_child = $key_child; } $objectToModify[$key_child]->has_childrens = false; $secondLevel[] = $m->ID; if ($arranged_menu[$key_parent]->object_id_en == 8) { wp_reset_query(); $args_pages = array('post_type' => 'page', 'order' => 'ASC', 'orderby' => 'menu_order', 'post_status' => 'publish', 'nopaging' => true, 'post_parent' => $objectToModify[$key_child]->object_id); $pages = query_posts($args_pages); //dv($pages); if ($pages) { $objectToModifyChild = &$objectToModify[$key_child]->childrens; $objectToModify[$key_child]->has_childrens = true; foreach ($pages as $p) { $key_child_child = $p->ID; $objectToModifyChild[$key_child_child] = new stdClass; $objectToModifyChild[$key_child_child]->ID = $p->ID; $objectToModifyChild[$key_child_child]->object_id = $p->ID; $objectToModifyChild[$key_child_child]->object_id_en = function_exists('icl_object_id') ? icl_object_id($p->ID, $p->post_type, true, 'en') : $p->ID; $objectToModifyChild[$key_child_child]->parrent = $key_child; $objectToModifyChild[$key_child_child]->title = $p->post_title; $objectToModifyChild[$key_child_child]->attr_title = $p->post_title; $objectToModifyChild[$key_child_child]->object = $p->post_type; $objectToModifyChild[$key_child_child]->url = get_permalink($p->ID); $objectToModifyChild[$key_child_child]->selected = false; if ($selected_object_type == $p->post_type && $selected_object_id == $p->ID) { $objectToModifyChild[$key_child_child]->selected = true; $objectToModify[$key_child]->selected = true; $arranged_menu[$key_parent]->selected = true; $object_id = $key_parent; $object_id_child = $key_child; $object_id_child_child = $key_child_child; } $objectToModifyChild[$key_child_child]->has_childrens = false; } } wp_reset_query(); } unset($objectToModify); } return $arranged_menu; } function arrangeMenu($menu, $selected_object_id = 0, $selected_object_type, $homeID) { global $object_id, $object_id_child, $object_id_child_child; $arranged_menu = array(); // get level 1 menus foreach ($menu as $m) if ($m->menu_item_parent == 0) { $i = $m->ID; $arranged_menu[$i] = new stdClass; $arranged_menu[$i]->ID = $m->ID; $arranged_menu[$i]->object_id = $m->object_id; $arranged_menu[$i]->title = $m->title; $arranged_menu[$i]->attr_title = $m->attr_title; if (empty($arranged_menu[$i]->attr_title)) $arranged_menu[$i]->attr_title = $arranged_menu[$i]->title; $arranged_menu[$i]->parrent = 0; $arranged_menu[$i]->url = $m->url; $arranged_menu[$i]->selected = false; if ($selected_object_id == $m->object_id) { $object_id = $i; $arranged_menu[$i]->selected = true; } $arranged_menu[$i]->has_childrens = false; } if ($selected_object_type == 'home') $arranged_menu[$homeID]->selected = true; return $arranged_menu; } function dv($var, $var_type = '') { dump_var($var, $var_type); } function dump_var($var, $var_type = '') { $ip=$_SERVER['REMOTE_ADDR']; $local=false; //if(preg_match("/192\.168\.([0-9]+)\.([0-9]+)/", $ip))$local=true; //if(preg_match("/10\.([0-9]+)\.([0-9]+)\.([0-9]+)/", $ip))$local=true; if($ip == "89.36.30.26") $local=true; $local=true; $rand = rand(0,9999); echo "
"; if($local==true) { print_var($var, $var_type); } echo "
"; } function print_var(&$var, $var_type, $return=false) { global $html; $html="
"; if(!isset($var))$var="%NULL%"; $old = $var; $var = '0unique'.rand().'value'; $var_name = array_search($var, $GLOBALS, true); $var=$old; if($var_name) { print_content($var, "$".$var_name, 1, "$".$var_name); } else { print_content($var, $var_type, 1, $var_type); } $html.="
"; if($return)return $html; else echo $html; } function print_content($var, $var_name, $level, $parent) { if(!isset($var))$var="%NULL%"; global $html; for($i=0;$i<$level;$i++)$html.="     "; if(strpos($var_name, "$")===0) { $html.="$var_name = "; } elseif(strpos($parent, "->$var_name")==strlen($parent)-strlen($var_name)-2) { $html.="->$var_name = "; } else { $html.="["; if(is_numeric($var_name)) { $html.="$var_name"; } else { $html.="\"$var_name\""; } $html.="] = "; } if(is_array($var)) { $id=base64_encode(microtime()); $html.=" Array {
"; $html.="
"; foreach ($var as $k=>$v) { print_content($v, $k, $level+1, $parent."['$k']"); } $html.="
"; for($i=0;$i<$level;$i++)$html.="     "; $html.=" }
"; } elseif(is_object($var)) { $id=base64_encode(microtime()); $html.=" Object {
"; $html.="
"; foreach ($var as $k=>$v) { print_content($v, $k, $level+1, $parent."->$k"); } $html.="
"; for($i=0;$i<$level;$i++)$html.="     "; $html.=" }
"; } else { if (is_string($var)) { $var=htmlentities($var, ENT_QUOTES, "UTF-8"); } if(is_numeric($var)) { $html.="$var;
"; } elseif($var=="%NULL%") { $html.="NULL;
"; } else { $html.="\"$var\";
"; } } } function fileVersion($filename) { //check if the file exists if (file_exists($filename)) { // return the time the file was last modified echo filemtime($filename); } else { // let them know the file wasn't found echo 'FileNotFound'; } } ?>