/functions.php

  1. <?php 
  2.  
  3. add_action( 'after_setup_theme', 'web_dor_lang_load' ); 
  4.  
  5. function web_dor_lang_load() { 
  6. load_theme_textdomain('sp_webBusiness', get_template_directory() . '/Languages' ); 
  7.  
  8.  
  9. $web_dor_mobile_browser = '0'; 
  10. $web_dor_tablet_browser = '0'; 
  11.  
  12. if (preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|android)/i', strtolower($_SERVER['HTTP_USER_AGENT']))) { 
  13. $web_dor_mobile_browser++; 
  14.  
  15. if ((strpos(strtolower($_SERVER['HTTP_ACCEPT']), 'application/vnd.wap.xhtml+xml') > 0) or ((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE'])))) { 
  16. $web_dor_mobile_browser++; 
  17. }  
  18.  
  19. $web_dor_user_agent = empty($_SERVER['HTTP_USER_AGENT']) ? false : $_SERVER['HTTP_USER_AGENT']; 
  20.  
  21.  
  22. $web_dor_mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'], 0, 4)); 
  23. $web_dor_mobile_agents = array( 
  24. 'w3c ', 'acs-', 'alav', 'alca', 'amoi', 'audi', 'avan', 'benq', 'bird', 'blac',  
  25. 'blaz', 'brew', 'cell', 'cldc', 'cmd-', 'dang', 'doco', 'eric', 'hipt', 'inno',  
  26. 'ipaq', 'java', 'jigs', 'kddi', 'keji', 'leno', 'lg-c', 'lg-d', 'lg-g', 'lge-',  
  27. 'maui', 'maxo', 'midp', 'mits', 'mmef', 'mobi', 'mot-', 'moto', 'mwbp', 'nec-',  
  28. 'newt', 'noki', 'oper', 'palm', 'pana', 'pant', 'phil', 'play', 'port', 'prox',  
  29. 'qwap', 'sage', 'sams', 'sany', 'sch-', 'sec-', 'send', 'seri', 'sgh-', 'shar',  
  30. 'sie-', 'siem', 'smal', 'smar', 'sony', 'sph-', 'symb', 't-mo', 'teli', 'tim-',  
  31. 'tosh', 'tsm-', 'upg1', 'upsi', 'vk-v', 'voda', 'wap-', 'wapa', 'wapi', 'wapp',  
  32. 'wapr', 'webc', 'winw', 'winw', 'xda ', 'xda-'); 
  33.  
  34. if (in_array($web_dor_mobile_ua, $web_dor_mobile_agents)) { 
  35. $web_dor_mobile_browser++; 
  36. if(isset($_SERVER['ALL_HTTP'])) 
  37. if (strpos(strtolower($_SERVER['ALL_HTTP']), 'OperaMini') > 0) { 
  38. $web_dor_mobile_browser++; 
  39.  
  40. if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'windows') > 0) { 
  41. $web_dor_mobile_browser = 0; 
  42.  
  43. if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'iemobile')>0) { 
  44. $web_dor_mobile_browser++; 
  45.  
  46.  
  47. //////////////////////////////////////tablet 
  48. if (preg_match('/(ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle)/i', strtolower($_SERVER['HTTP_USER_AGENT']))) { 
  49. $web_dor_tablet_browser++; 
  50. if(preg_match('/(ipad|viewpad|tablet|bolt|xoom|touchpad|playbook|kindle|gt-p|gt-i|sch-i|sch-t|mz609|mz617|mid7015|tf101|g-v|ct1002|transformer|silk| tab)/i', $web_dor_user_agent ) ||( preg_match('/android/i', $web_dor_user_agent ) && !preg_match('/mobile/i', $web_dor_user_agent )) ) { 
  51. $web_dor_tablet_browser++; 
  52.  
  53. if ($web_dor_mobile_browser > 0) { define ("device", "phone" , TRUE);} 
  54.  
  55. elseif ($web_dor_tablet_browser > 0) { define ("device", "tablet" , TRUE);} 
  56.  
  57. else {define ("device", "", TRUE);}  
  58.  
  59.  
  60. function web_dor_entry_meta() { 
  61. $categories_list = get_the_category_list(', ' ); 
  62.  
  63. if ( $categories_list ) { 
  64. echo '<span class="categories-links"><span class="sep">C.</span> ' . $categories_list . '</span>'; 
  65.  
  66.  
  67. $tag_list = get_the_tag_list( '', __( ' , ', 'sp_webBusiness' ) ); 
  68.  
  69. if ( $tag_list ) { 
  70. echo '<span class="tags-links"><span class="sep">T. </span>' . $tag_list . '</span>'; 
  71.  
  72.  
  73.  
  74.  
  75. function web_dor_posted_on() { 
  76.  
  77. printf( __( '<span class="sep">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a><span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'sp_webBusiness' ),  
  78. esc_url( get_permalink() ),  
  79. esc_attr( get_the_time() ),  
  80. esc_attr( get_the_date( 'c' ) ),  
  81. esc_html( get_the_date() ),  
  82. esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),  
  83. esc_attr( sprintf( __( 'View all posts by %s', 'sp_webBusiness' ), get_the_author() ) ),  
  84. get_the_author() 
  85.  
  86. ); 
  87.  
  88. /////////////////////// include admin 
  89.  
  90. function web_dor_post_nav() { 
  91. global $post; 
  92. $previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true ); 
  93. $next = get_adjacent_post( false, '', false ); 
  94.  
  95. if ( ! $next && ! $previous ) 
  96. return; 
  97. ?> 
  98. <nav class="page-navigation"> 
  99. <?php previous_post_link( '%link', '<span class="meta-nav">←</span> %title', 'Previous post link' ); ?> 
  100. <?php next_post_link( '%link', '%title <span class="meta-nav">→</span>', 'Next post link' ); ?> 
  101. </nav> 
  102. <?php 
  103.  
  104.  
  105.  
  106. require_once('admin/main_admin_controler.php'); 
  107.  
  108. function web_dor_widgets_init() 
  109.  
  110. // Area 1, located at the top of the sidebar. 
  111.  
  112. register_sidebar(array( 
  113.  
  114. 'name' => __('Primary Widget Area', 'sp_webBusiness'),  
  115.  
  116. 'id' => 'primary-widget-area',  
  117.  
  118. 'description' => __('The primary widget area', 'sp_webBusiness'),  
  119.  
  120. 'before_widget' => '<div id="%1$s" class="widget-container %2$s">',  
  121.  
  122.  
  123. 'after_widget' => '</div>',  
  124.  
  125. 'before_title' => '<h3 class="widget-title">',  
  126.  
  127. 'after_title' => '</h3>',  
  128.  
  129. ); 
  130.  
  131. // Area 2, located below the Primary Widget Area in the sidebar. Empty by default. 
  132.  
  133. register_sidebar(array( 
  134.  
  135. 'name' => __('Secondary Widget Area', 'sp_webBusiness'),  
  136.  
  137. 'id' => 'secondary-widget-area',  
  138.  
  139. 'description' => __('The secondary widget area', 'sp_webBusiness'),  
  140.  
  141. 'before_widget' => '<div id="%1$s" class="widget-container %2$s">',  
  142.  
  143. 'after_widget' => '</div>',  
  144.  
  145. 'before_title' => '<h3 class="widget-title">',  
  146.  
  147. 'after_title' => '</h3>',  
  148. ); 
  149. register_sidebar(array( 
  150.  
  151. 'name' => __('Footer Sidebar', 'sp_webBusiness'),  
  152.  
  153. 'id' => 'footer-sidebar',  
  154.  
  155. 'description' => __('The footer-sidebar', 'sp_webBusiness'),  
  156.  
  157. 'before_widget' => '<div style="float: left;" id="%1$s" class="widget-container widget_conteiner_fotter %2$s">',  
  158.  
  159. 'after_widget' => '</div>',  
  160.  
  161. 'before_title' => '<h3 class="widget-title">',  
  162.  
  163. 'after_title' => '</h3>',  
  164. ); 
  165.  
  166. //Register sidebars by running web_dor_widgets_init() on the widgets_init hook. 
  167.  
  168. add_action('widgets_init', 'web_dor_widgets_init'); 
  169.  
  170. //Add support for WordPress 3.0's custom menus 
  171.  
  172. add_action('init', 'web_dor_register_menu'); 
  173.  
  174. //Register area for custom menu 
  175.  
  176. function web_dor_register_menu() 
  177.  
  178. register_nav_menu('primary-menu', __('Primary Menu', 'sp_webBusiness')); 
  179.  
  180. add_theme_support( 'automatic-feed-links' ); 
  181.  
  182. // Enable post thumbnails 
  183. if (function_exists('add_theme_support')) { 
  184.  
  185. add_theme_support('post-thumbnails', array('post')); 
  186.  
  187. set_post_thumbnail_size(150, 150); 
  188.  
  189. add_action('publish_page', 'web_dor_add_custom_field_automatically'); 
  190.  
  191. add_action('publish_post', 'web_dor_add_custom_field_automatically'); 
  192.  
  193. function web_dor_add_custom_field_automatically($post_ID) 
  194.  
  195. if (!wp_is_post_revision($post_ID)) { 
  196.  
  197. add_post_meta($post_ID, 'field-name', 'custom value', true); 
  198.  
  199.  
  200.  
  201. if( !function_exists('web_dor_the_excerpt_max_charlength')) { 
  202. function web_dor_the_excerpt_max_charlength($charlength) { 
  203. $excerpt = get_the_excerpt(); 
  204. $charlength++; 
  205.  
  206. if ( mb_strlen( $excerpt ) > $charlength ) { 
  207. $subex = mb_substr( $excerpt, 0, $charlength - 5 ); 
  208. $exwords = explode( ' ', $subex ); 
  209. $excut = - ( mb_strlen( $exwords[ count( $exwords ) - 1 ] ) ); 
  210. if ( $excut < 0 ) { 
  211. echo mb_substr( $subex, 0, $excut ).'...'; 
  212. } else { 
  213. echo $subex.'...'; 
  214.  
  215. } else { 
  216. echo $excerpt; 
  217.  
  218. function web_dor_post_thumbnail($width, $height) 
  219.  
  220. $thumb = get_post_custom_values("Image"); 
  221.  
  222. if (!empty($thumb)) { 
  223.  
  224. $str = '<img src="' . $thumb[0] . '" width="' . $width . '" height="' . $height . '" alt="' . get_the_title() . '" width="' . $width . '" height="' . $height . '" border="0" />'; 
  225. return $str; 
  226.  
  227.  
  228. return !empty($thumb); 
  229.  
  230. function web_dor_catch_that_image() 
  231.  
  232. global $post, $posts; 
  233.  
  234. $first_img = ''; 
  235. $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); 
  236. if(isset($matches [1] [0])) {  
  237. $first_img = $matches [1] [0]; 
  238. if (empty($first_img)) { 
  239.  
  240. //Defines a default image 
  241.  
  242. $first_img = get_template_directory_uri() . "/images/default.jpg"; 
  243.  
  244.  
  245. return $first_img; 
  246.  
  247.  
  248. function web_dor_first_image($width, $height, $url_or_img=0) 
  249. $thumb = web_dor_catch_that_image(); 
  250. if ($thumb) { 
  251.  
  252. $str = "<img src=\""; 
  253. $str .= $thumb; 
  254.  
  255. $str .= '"'; 
  256. $str .= 'alt="'.get_the_title().'" width="'.$width.'" height="'.$height.'" border="0" />'; 
  257. return $str; 
  258.  
  259. function web_dor_empty_thumb() 
  260.  
  261. $thumb = get_post_custom_values("Image"); 
  262.  
  263. return !empty($thumb); 
  264.  
  265.  
  266. function web_dor_display_thumbnail($width, $height) 
  267. if (function_exists('has_post_thumbnail') && has_post_thumbnail()) the_post_thumbnail(array($width, $height)); 
  268.  
  269. elseif (!web_dor_empty_thumb()) { 
  270. return web_dor_first_image($width, $height); 
  271. } else { 
  272. return web_dor_post_thumbnail($width, $height); 
  273.  
  274. function web_dor_thumbnail($width, $height) 
  275.  
  276. if (function_exists('has_post_thumbnail') && has_post_thumbnail()) 
  277.  
  278. the_post_thumbnail(array($width, $height)); 
  279.  
  280. elseif (web_dor_empty_thumb()) { 
  281.  
  282. return web_dor_post_thumbnail($width, $height); 
  283.  
  284.  
  285. //the_content($more_link_text, $strip_teaser); 
  286.  
  287. function web_dor_remove_more_jump_link($link) 
  288.  
  289. $offset = strpos($link, '#more-'); 
  290. if ($offset) { 
  291. $end = strpos($link, '"', $offset); 
  292. if ($end) { 
  293. $link = substr_replace($link, '', $offset, $end - $offset); 
  294.  
  295. return $link; 
  296.  
  297.  
  298. add_filter('the_content_more_link', 'web_dor_remove_more_jump_link'); 
  299.  
  300.  
  301.  
  302. function web_dor_comment($comment, $args, $depth) { 
  303.  
  304. $GLOBALS['comment'] = $comment; 
  305.  
  306. switch ($comment->comment_type) { 
  307. case '' : 
  308. ?> 
  309. <div <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>"> 
  310. <div class="comment-avatar"><?php echo get_avatar($comment, $size = '54'); ?></div> 
  311. <div class="comment-body"> 
  312. <p class="comment-meta"><span 
  313. class="comment-author"><?php comment_author_link(); ?></span><?php _e(' on ', 'sp_webBusiness'); ?><?php comment_date() ?><?php _e(' at ', 'sp_webBusiness'); ?><?php comment_time() ?> 
  314. .</p> 
  315. <?php if ($comment->comment_approved == '0') { ?> 
  316. <p><strong><?php _e('Your comment is awaiting moderation.', 'sp_webBusiness'); ?></strong></p> 
  317. <?php } ?> 
  318.  
  319. <?php comment_text(); ?> 
  320.  
  321. <p class="comment-reply-meta"><?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth']))); ?></p> 
  322. </div> 
  323. <?php 
  324. break; 
  325.  
  326. case 'pingback' : 
  327. case 'trackback' : 
  328. ?> 
  329. <div <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>" class="post pingback"> 
  330. <p><?php _e('Pingback:', 'sp_webBusiness'); ?> <?php comment_author_link(); ?><?php edit_comment_link(__('Edit', 'sp_webBusiness'), ' '); ?></p> 
  331. <?php 
  332. break; 
  333.  
  334.  
  335.  
  336.  
  337.  
  338. function web_dor_update_post_format() 
  339.  
  340. global $options_post_format_options; 
  341.  
  342. foreach ($options_post_format_options as $value) { 
  343.  
  344. if (get_theme_mod($value['id']) === FALSE) { 
  345. $value['id'] = $value['std']; 
  346. } else { 
  347. $value['id'] = get_theme_mod($value['id']); 
  348.  
  349. switch ($pf_post_format) { 
  350.  
  351. case 1: 
  352. return "post-1"; 
  353. break; 
  354.  
  355. case 2: 
  356. return "post-2"; 
  357. break; 
  358.  
  359. case 3: 
  360. return "post-3"; 
  361. break; 
  362.  
  363. function web_dor_update_head_integration() 
  364.  
  365. global $dor_integration_page; 
  366.  
  367. foreach ($dor_integration_page->options_integration as $value) { 
  368.  
  369. if (get_theme_mod($value['id']) === FALSE) { 
  370. $$value['id'] = $value['std']; 
  371. } else { 
  372. $$value['id'] = get_theme_mod($value['id']); 
  373.  
  374. if($_integrate_header_enable) 
  375. echo stripslashes($_integration_head); 
  376.  
  377.  
  378. function web_dor_update_body_integration() 
  379.  
  380. global $dor_integration_page; 
  381.  
  382. foreach ($dor_integration_page->options_integration as $value) { 
  383.  
  384. if (get_theme_mod($value['id']) === FALSE) { 
  385. $$value['id'] = $value['std']; 
  386. } else { 
  387. $$value['id'] = get_theme_mod($value['id']); 
  388.  
  389. if($_integrate_body_enable) 
  390. echo stripslashes($_integration_body); 
  391.  
  392.  
  393. function web_dor_update_top_of_post_integration() 
  394.  
  395. global $dor_integration_page; 
  396.  
  397. foreach ($dor_integration_page->options_integration as $value) { 
  398.  
  399. if (get_theme_mod($value['id']) === FALSE) { 
  400. $$value['id'] = $value['std']; 
  401. } else { 
  402. $$value['id'] = get_theme_mod($value['id']); 
  403.  
  404. if($_integrate_singletop_enable) 
  405. echo stripslashes($_integration_single_top); 
  406.  
  407.  
  408. function web_dor_update_bottom_of_post_integration() 
  409.  
  410. global $dor_integration_page; 
  411.  
  412. foreach ($dor_integration_page->options_integration as $value) { 
  413.  
  414. if (get_theme_mod($value['id']) === FALSE) { 
  415.  
  416. $$value['id'] = $value['std']; 
  417. } else { 
  418.  
  419. $$value['id'] = get_theme_mod($value['id']); 
  420.  
  421.  
  422. if($_integrate_singlebottom_enable) 
  423. echo stripslashes($_integration_single_bottom); 
  424.  
  425.  
  426.  
  427.  
  428. function web_dor_update_typography() 
  429. //update options 
  430. global $dor_typography_page; 
  431.  
  432. foreach ($dor_typography_page->options_typography as $value) { 
  433. if(isset($value['id'])) { 
  434. if (get_theme_mod($value['id']) === FALSE) { 
  435. $$value['id'] = $value['std']; 
  436. } else { 
  437. $$value['id'] = get_theme_mod($value['id']); 
  438.  
  439. ?> 
  440.  
  441. <style type="text/css"> 
  442. h1, h2, h3, h4, h5, h6 { 
  443. font-family: <?php echo $_type_headers_font; ?>; 
  444. font-weight: <?php echo $_type_headers_weight; ?>; 
  445. letter-spacing: <?php echo $_type_headers_kern; ?>; 
  446. text-transform: <?php echo $_type_headers_transform; ?>; 
  447. font-variant: <?php echo $_type_headers_variant; ?>; 
  448. font-style: <?php echo $_type_headers_style; ?>; 
  449.  
  450. .nav, .metabar, .subtext, .subhead, .widget-title, .reply a, .editpage, #page .wp-pagenavi, .post-edit-link, #wp-calendar caption, #wp-calendar thead th, .soapbox-links a, .fancybox, .standard-form .admin-links, .ftitle small { 
  451. font-family: <?php echo $_type_headers_font; ?>; 
  452. font-weight: <?php echo $_type_headers_weight; ?>; 
  453. letter-spacing: <?php echo $_type_headers_kern; ?>; 
  454. text-transform: <?php echo $_type_headers_transform; ?>; 
  455. font-variant: <?php echo $_type_headers_variant; ?>; 
  456. font-style: <?php echo $_type_headers_style; ?>; 
  457.  
  458. body { 
  459. font-family: <?php echo $_type_primary_font; ?>; 
  460. font-weight: <?php echo $_type_primary_weight; ?>; 
  461. letter-spacing: <?php echo $_type_primary_kern; ?>; 
  462. text-transform: <?php echo $_type_primary_transform; ?>; 
  463. font-variant: <?php echo $_type_primary_variant; ?>; 
  464. font-style: <?php echo $_type_primary_style; ?>; 
  465.  
  466. input, textarea { 
  467. font-family: <?php echo $_type_inputs_font; ?>; 
  468. font-weight: <?php echo $_type_inputs_weight; ?>; 
  469. letter-spacing: <?php echo $_type_inputs_kern; ?>; 
  470. text-transform: <?php echo $_type_inputs_transform; ?>; 
  471. font-variant: <?php echo $_type_inputs_variant; ?>; 
  472. font-style: <?php echo $_type_inputs_style; ?>; 
  473.  
  474. </style> 
  475. <?php 
  476.  
  477. function web_dor_update_layout_editor() 
  478. //for update global options 
  479. global $dor_layout_page; 
  480. if ( ! isset( $content_width ) ) $content_width = 900; 
  481.  
  482. foreach ($dor_layout_page->options_themeoptions as $value) { 
  483. if(isset($value['id'])) { 
  484. if (get_theme_mod($value['id']) === FALSE) { 
  485.  
  486. $$value['id'] = $value['std']; 
  487. } else { 
  488.  
  489. $$value['id'] = get_theme_mod($value['id']); 
  490.  
  491. if (get_theme_mod("gs_full_width")) { 
  492.  
  493. $them_content_are_width='100%'; 
  494. ?><script>var full_width_web_buisnes=1</script><?php 
  495.  
  496. else { 
  497.  
  498. $them_content_are_width=$gs_content_area . "px;"; 
  499. ?><script> var full_width_web_buisnes=0</script><?php 
  500. if (get_theme_mod("gs_full_width")) { 
  501. ?> 
  502. <style> 
  503. body { 
  504. margin-right: 24.1%; 
  505. </style> 
  506. <?php 
  507. switch ($gs_default_layout) { 
  508. //set styles leauts 
  509. case 1: 
  510. ?> 
  511. <style type="text/css"> 
  512. #sidebar1,  
  513. #sidebar2 { 
  514. display:none; 
  515. #blog { 
  516. display:block;  
  517. float:left; 
  518.  
  519. .container{ 
  520. width:<?php echo $them_content_are_width; ?>; 
  521. }  
  522. #blog{ 
  523. width:100%; 
  524. }  
  525. </style> 
  526. <?php 
  527. break; 
  528. case 2: 
  529. ?> 
  530. <style type="text/css"> 
  531. #sidebar2{ 
  532. display:none; 
  533. }  
  534. #sidebar1 { 
  535. display:block; 
  536. float:right; 
  537. #blog{ 
  538. display:block; 
  539. float:left; 
  540. }  
  541. .container{ 
  542. width:<?php echo $them_content_are_width; ?> 
  543. #blog{ 
  544. width:<?php echo $gs_main_column ; ?>%; 
  545. #sidebar1{ 
  546. width:<?php echo (100 - $gs_main_column-1); ?>%; 
  547. </style> 
  548. <?php 
  549. break; 
  550. case 3: 
  551. ?> 
  552. <style type="text/css"> 
  553. #sidebar2{ 
  554. display:none; 
  555. }  
  556. #sidebar1 { 
  557. display:block; 
  558. float:left; 
  559. }  
  560. #blog{ 
  561. display:block; 
  562. float:left; 
  563. .container{ 
  564. width:<?php echo $them_content_are_width; ?> 
  565. #blog{ 
  566. width:<?php echo $gs_main_column ; ?>%; 
  567. #sidebar1{ 
  568. width:<?php echo (100 - $gs_main_column-1); ?>%; 
  569. margin-right: 1%; 
  570. </style> 
  571. <?php 
  572. break; 
  573. case 4: 
  574. ?> 
  575. <style type="text/css"> 
  576. #sidebar2{ 
  577. display:block; 
  578. float:right; 
  579. }  
  580. #sidebar1 { 
  581. display:block; float:right; 
  582. }  
  583. #blog{ 
  584. display:block; 
  585. float:left; 
  586. .container{ 
  587. width:<?php echo $them_content_are_width; ?> 
  588. #blog{ 
  589. width:<?php echo ($gs_main_column-2) ; ?>%; 
  590. #sidebar1{ 
  591. width:<?php echo $gs_pwa_width ; ?>%; 
  592. #sidebar2{ 
  593. width:<?php echo (100 - $gs_pwa_width - $gs_main_column); ?>%; 
  594. margin-right: 1%; 
  595. </style> 
  596. <?php 
  597. break; 
  598. case 5: 
  599. ?> 
  600. <style type="text/css"> 
  601. #sidebar2{ 
  602. display:block; 
  603. float:left; 
  604. }  
  605. #sidebar1 { 
  606. display:block; 
  607. float:left; 
  608. }  
  609. #blog{ 
  610. display:block; 
  611. float:right; 
  612. .container{ 
  613. width:<?php echo $them_content_are_width; ?> 
  614. #blog{ 
  615. width:<?php echo ($gs_main_column-2); ?>%; 
  616. #sidebar1{ 
  617. width:<?php echo $gs_pwa_width; ?>%; 
  618. margin-right: 1%; 
  619. #sidebar2{ 
  620. width:<?php echo (100- $gs_pwa_width - $gs_main_column); ?>%; 
  621. margin-right: 1%; 
  622. </style> 
  623. <?php 
  624. break; 
  625. case 6: 
  626. ?> 
  627. <style type="text/css"> 
  628. #sidebar2{ 
  629. display:block; 
  630. float:right; 
  631. }  
  632. #sidebar1 { 
  633. display:block; 
  634. float:left;  
  635. }  
  636. #blog{ 
  637. display:block; 
  638. float:left; 
  639. }  
  640. .container{ 
  641. width:<?php echo $them_content_are_width; ?> 
  642. #blog{ 
  643. width:<?php echo ($gs_main_column-2) ; ?>%; 
  644. #sidebar1{ 
  645. width:<?php echo $gs_pwa_width ; ?>%; 
  646. margin-right: 1%; 
  647. #sidebar2{ 
  648. width:<?php echo (100 - $gs_pwa_width - $gs_main_column); ?>%; 
  649. }  
  650. </style> 
  651. <?php 
  652. break; 
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665. function web_dor_update_hompage_settings() 
  666. /** 
  667. global $options_homepage; 
  668.   
  669. foreach ($options_homepage as $value) { 
  670.   
  671. if (get_theme_mod( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_theme_mod( $value['id'] ); } 
  672.   
  673. } 
  674. var_dump($options_homepage); 
  675. global $post; 
  676. $arr = get_post_meta($post->ID, '_arr', TRUE); 
  677. $cats = get_categories('hide_empty=0'); 
  678. $cat_query=""; 
  679. foreach ($cats as $categs) { 
  680. $str = "cat".$categs->cat_ID; 
  681. if ($str) { 
  682. $cat_query.=$categs->cat_ID.", "; 
  683. }  
  684. } 
  685. $temp = $wp_query; 
  686. $wp_query= null; 
  687. $wp_query = new WP_Query(); 
  688. $wp_query->query('showposts='.($_n_of_home_post).'&paged='.$paged.'&cat='.$cat_query);*/ 
  689.  
  690.  
  691.  
  692. function web_dor_update_general_settings() 
  693.  
  694. global $dor_general_settings_page; 
  695.  
  696. foreach ($dor_general_settings_page->options_generalsettings as $value) { 
  697.  
  698. if (get_theme_mod($value['id']) === FALSE) { 
  699. $$value['id'] = $value['std']; 
  700. } else { 
  701. $$value['id'] = get_theme_mod($value['id']); 
  702.  
  703.  
  704. function web_dor_update_color_control() { 
  705. //for update global options 
  706. global $dor_color_control_page; 
  707.  
  708. foreach ($dor_color_control_page->options_colorcontrol as $value) { 
  709. $$value['id'] = $value['std'];  
  710. ?> 
  711.  
  712. <style type="text/css"> 
  713.  
  714. h1, h2, h3, h4, h5, h6 { 
  715. color:<?php echo $cc_text_headers_color; ?>; 
  716.  
  717. .searchback { 
  718. background-color:<?php echo '#'.web_dor_ligthest_brigths($cc_selected_menu_color, 20); ?> !important; 
  719.  
  720. .read_more, .post-password-form input[type="submit"], .more-link { 
  721. background-color: <?php echo $cc_selected_menu_color; ?>; 
  722. color:<?php echo $cc_primary_links_hover_color ?>; 
  723.  
  724. #header{ 
  725. background-color:<?php echo $cc_content_back_color; ?>; 
  726. .shadow 
  727. background:url(<?php echo get_template_directory_uri(); ?>/images/stver.png) bottom center no-repeat <?php echo $cc_shadow_background_color; ?>; 
  728. background-color: ; 
  729.  
  730. .container{ 
  731. color: <?php echo $cc_primary_text_color; ?>; 
  732.  
  733. #wrapper, #content{ 
  734. color: <?php echo $cc_primary_text_color; ?>; 
  735. background-color: <?php echo $cc_content_back_color; ?>; 
  736.  
  737. #site-title 
  738. background-color:<?php echo $cc_content_back_color; ?>; 
  739. #header-block, .web_buisnes_menu{ 
  740. background-color:<?php echo $cc_head_elem_back_color; ?>; 
  741. #footer .container.phone{ 
  742. background-color:<?php echo $cc_footer_back_color; ?>; 
  743.  
  744. .topPost { 
  745. background-image: url(<?php echo get_template_directory_uri(); ?>/images/topPost-back<?php if($cc_color_scheme == "Theme-1") echo "1"; elseif($cc_color_scheme == "Theme-2") echo "2"; elseif($cc_color_scheme == "Theme-3") echo "3"; else echo "1"; ?>.png); 
  746. .about_us_img { 
  747. background-image: url(<?php echo get_template_directory_uri(); ?>/images/topPost-back<?php if($cc_color_scheme == "Theme-1") echo "1"; elseif($cc_color_scheme == "Theme-2") echo "2"; elseif($cc_color_scheme == "Theme-3") echo "3"; else echo "1"; ?>.png); 
  748.  
  749.  
  750. body, .content { 
  751. background-color: <?php echo $cc_content_back_color; ?>; 
  752.  
  753. #footer { 
  754. background-color: <?php echo $cc_footer_back_color; ?>; 
  755.  
  756. #header { 
  757. color: <?php echo $cc_text_headers_color; ?>; 
  758.  
  759.  
  760.  
  761. #footer { 
  762. color: <?php echo $cc_footer_text_color; ?>; 
  763.  
  764. a:link, a:visited { 
  765. text-decoration: none; 
  766. color: <?php echo $cc_primary_links_color; ?>; 
  767.  
  768. a { 
  769. text-decoration: none; 
  770. color: <?php echo $cc_primary_links_color; ?>; 
  771. a:hover, a:focus, a:active { 
  772. color: <?php echo $cc_primary_links_hover_color; ?>; 
  773. .web_buisnes_menu a:hover, .web_buisnes_menu .current-menu-item > a, .web_buisnes_menu .current_page_item > a, .web_buisnes_menu .current-page-parent > a, .web_buisnes_menu .current-menu-parent > a { 
  774. color: <?php echo $cc_primary_links_hover_color; ?>; 
  775.  
  776. .web_buisnes_menu li:hover { 
  777. background-color: <?php echo $cc_menu_color; ?>; 
  778.  
  779. .get_title{ 
  780. background-image:url(<?php echo get_template_directory_uri(); ?>/images/Shado.png); 
  781. background-position: bottom; 
  782. background-repeat: no-repeat; 
  783. color: <?php echo $cc_primary_links_hover_color; ?>; 
  784.  
  785. .comment-author .fn { 
  786. color: <?php echo $cc_text_headers_color; ?> !important; 
  787.  
  788. .sep{ 
  789. color: <?php echo $cc_selected_menu_color; ?>; 
  790. .nav .current-menu-item, .nav .current_page_item , .nav .current-page-parent, #menu-button-block, .get_title, .nav .current-menu-parent, a .page-links-number{ 
  791. background-color: <?php echo $cc_selected_menu_color; ?>; 
  792. a .page-links-number{ 
  793. color:<?php echo $cc_primary_links_hover_color; ?>; 
  794.  
  795. .nav li li:hover { 
  796. background-color: <?php echo $cc_menu_color; ?>; 
  797. .web_buisnes_menu a{ 
  798. color:<?php echo $cc_primary_links_color ?>; 
  799. .container.top-posts.phone{ 
  800. /*background-color:<?php echo $cc_content_back_color; ?>;*/ 
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807. .nav.phone > li > a, .nav.phone > li > a:link, .nav.phone > li > a:visited, .page-links-number { 
  808. color:<?php echo $cc_primary_links_color; ?>; 
  809. background:<?php echo $cc_head_elem_back_color; ?>; 
  810. .nav.phone > li:hover > a , .nav.phone > li > a:hover, .nav.phone > li > a:focus, .nav.phone > li > a:active { 
  811. color:<?php echo $cc_primary_links_hover_color; ?>; 
  812. background:<?php echo $cc_menu_color; ?>; 
  813.  
  814. #menu-button-block a { 
  815. background-image:url(<?php echo get_template_directory_uri(); ?>/images/menu.phone.png); 
  816. .nav.phone li ul li > a, .nav.phone li ul li > a:link, .nav.phone li ul li > a:visited { 
  817. color:<?php echo $cc_primary_links_color ?> !important; 
  818. .nav.phone li ul li:hover > a, .nav.phone li ul li > a:hover, .nav.phone li ul li > a:focus, .nav.phone li ul li > a:active, .nav.phone li.current-menu-item > a:hover{ 
  819. color:<?php echo $cc_primary_links_hover_color; ?> !important; 
  820. background-color:<?php echo $cc_menu_color; ?> !important; 
  821. .nav.phone li.has-sub > a, .nav.phone li.has-sub > a:link, .nav.phone li.has-sub > a:visited { 
  822. background:<?php echo $cc_head_elem_back_color; ?> url(<?php echo get_template_directory_uri(); ?>/images/menu_right.png) right top no-repeat !important; 
  823. background-size:contain !important; 
  824. .nav.phone li.has-sub:hover > a, .nav.phone li.has-sub > a:hover, .nav.phone li.has-sub > a:focus, .nav.phone li.has-sub > a:active, .nav.phone li.has-sub.current-menu-ancestor > a:hover, .nav.phone li.has-sub.current-menu-item > a:focus, .nav.phone li.has-sub.current-menu-item > a:active, .nav.phone li.current-menu-parent > a:hover, .nav.phone li.current-menu-parent > a:focus, .nav.phone li.current-menu-parent > a:active, .nav.phone li.current-menu-ancestor > a:hover, .nav.phone li.current-menu-ancestor > a:focus, .nav.phone li.current-menu-ancestor > a:active{ 
  825. background:<?php echo $cc_menu_color; ?> url(<?php echo get_template_directory_uri(); ?>/images/menu_right.png) right top no-repeat !important; 
  826. background-size:contain !important; 
  827.  
  828. .nav.phone li ul li.has-sub > a, .nav.phone li ul li.has-sub > a:link, .nav.phone li ul li.has-sub > a:visited{ 
  829. background:<?php echo $cc_head_elem_back_color; ?> url(<?php echo get_template_directory_uri(); ?>/images/down_menu.png) right bottom no-repeat !important; 
  830. background-size:contain !important; 
  831.  
  832. .nav.phone li ul li.has-sub:hover > a, .nav.phone li ul li.has-sub > a:hover, .nav.phone li ul li.has-sub > a:focus, .nav.phone li ul li.has-sub > a:active { 
  833. background:<?php echo '#'.web_dor_ligthest_brigths($cc_menu_color, 15); ?> url(<?php echo get_template_directory_uri(); ?>/images/down_menu.png) right bottom no-repeat !important; 
  834. background-size:contain !important; 
  835. .nav.phone li.current-menu-item > a 
  836. color:<?php echo $cc_primary_links_hover_color ?> !important; 
  837. background-color:<?php echo $cc_selected_menu_color; ?> !important; 
  838. .nav.phone li.current-menu-ancestor > a:hover, .nav.phone li.current-menu-item > a:focus, .nav.phone li.current-menu-item > a:active{ 
  839. color:<?php echo $cc_primary_links_color ?> !important; 
  840. background-color:<?php echo $cc_menu_color; ?> !important; 
  841. .nav.phone li.current-menu-parent > a, .nav.phone li.current-menu-parent > a:visited,  
  842. .nav.phone li.has-sub.current-menu-item > a, .nav.phone li.has-sub.current-menu-item > a:visited,  
  843. .nav.phone li.current-menu-ancestor > a, .nav.phone li.current-menu-ancestor > a:visited,  
  844. color:<?php echo $cc_primary_links_hover_color ?> !important; 
  845. background:<?php echo $cc_selected_menu_color; ?> url(<?php echo get_template_directory_uri(); ?>/images/down_menu.png) right bottom no-repeat !important; 
  846. background-size:contain !important; 
  847. .nav.phone li ul li.current-menu-item > a, .nav.phone li ul li.current-menu-item > a:visited,  
  848. .nav.phone li ul li.current-menu-item > a:focus, .nav.phone li ul li.current-menu-item > a:active{ 
  849. color:<?php echo $cc_primary_links_hover_color ?> !important; 
  850. background-color:<?php echo '#'.web_dor_ligthest_brigths($cc_selected_menu_color, 15); ?> !important; 
  851. .nav.phone li ul li.current-menu-ancestor > a:hover, { 
  852. background-color:<?php echo '#'.web_dor_ligthest_brigths($cc_menu_color, 15); ?> !important; 
  853. .nav.phone li ul li.current-menu-parent > a, .nav.phone li ul li.current-menu-parent > a:visited,  
  854. .nav.phone li ul li.current-menu-parent > a:hover, .nav.phone li ul li.current-menu-parent > a:focus, .nav.phone li ul li.current-menu-parent > a:active,  
  855. .nav.phone li ul li.has-sub.current-menu-item > a, .nav.phone li ul li.has-sub.current-menu-item > a:visited,  
  856. .nav.phone li ul li.has-sub.current-menu-ancestor > a:hover, .nav.phone li ul li.has-sub.current-menu-item > a:focus, .nav.phone li ul li.has-sub.current-menu-item > a:active,  
  857. .nav.phone li ul li.current-menu-ancestor > a, .nav.phone li ul li.current-menu-ancestor > a:visited,  
  858. .nav.phone li ul li.current-menu-ancestor > a:hover, .nav.phone li ul li.current-menu-ancestor > a:focus, .nav.phone li ul li.current-menu-ancestor > a:active { 
  859. color:<?php echo $cc_primary_links_hover_color ?> !important; 
  860. background:<?php echo '#'.web_dor_ligthest_brigths($cc_selected_menu_color, 15); ?> url(<?php echo get_template_directory_uri(); ?>/images/down_menu.png) right bottom no-repeat !important; 
  861. background-size:contain !important; 
  862.  
  863.  
  864.  
  865.  
  866.  
  867.  
  868.  
  869.  
  870.  
  871.  
  872. .nav.phone li.current-menu-parent > a, .nav.phone li.current-menu-parent > a:link, .nav.phone li.current-menu-parent > a:visited,  
  873. .nav.phone li.current-menu-parent > a:hover, .nav.phone li.current-menu-parent > a:focus, .nav.phone li.current-menu-parent > a:active,  
  874. .nav.phone li.has-sub.current_page_item > a, .nav.phone li.has-sub.current_page_item > a:link, .nav.phone li.has-sub.current_page_item > a:visited,  
  875. .nav.phone li.has-sub.current-menu-ancestor > a:hover, .nav.phone li.has-sub.current_page_item > a:focus, .nav.phone li.has-sub.current_page_item > a:active,  
  876. .nav.phone li.current-menu-ancestor > a, .nav.phone li.current-menu-ancestor > a:link, .nav.phone li.current-menu-ancestor > a:visited,  
  877. .nav.phone li.current-menu-ancestor > a:hover, .nav.phone li.current-menu-ancestor > a:focus, .nav.phone li.current-menu-ancestor > a:active { 
  878. color:<?php echo $cc_primary_links_hover_color ?> !important; 
  879. background:<?php echo $cc_selected_menu_color; ?> url(<?php echo get_template_directory_uri(); ?>/images/down_menu.png) right bottom no-repeat !important; 
  880. background-size:contain !important; 
  881. .nav.phone li ul li.current_page_item > a, .nav.phone li ul li.current_page_item > a:link, .nav.phone li ul li.current_page_item > a:visited,  
  882. .nav.phone li ul li.current-menu-ancestor > a:hover, .nav.phone li ul li.current_page_item > a:focus, .nav.phone li ul li.current_page_item > a:active{ 
  883. color:<?php echo $cc_primary_links_hover_color ?> !important; 
  884. background-color:<?php echo '#'.web_dor_ligthest_brigths($cc_selected_menu_color, 15); ?> !important; 
  885. .nav.phone li ul li.current-menu-parent > a, .nav.phone li ul li.current-menu-parent > a:link, .nav.phone li ul li.current-menu-parent > a:visited,  
  886. .nav.phone li ul li.current-menu-parent > a:hover, .nav.phone li ul li.current-menu-parent > a:focus, .nav.phone li ul li.current-menu-parent > a:active,  
  887. .nav.phone li ul li.has-sub.current_page_item > a, .nav.phone li ul li.has-sub.current_page_item > a:link, .nav.phone li ul li.has-sub.current_page_item > a:visited,  
  888. .nav.phone li ul li.has-sub.current-menu-ancestor > a:hover, .nav.phone li ul li.has-sub.current_page_item > a:focus, .nav.phone li ul li.has-sub.current_page_item > a:active,  
  889. .nav.phone li ul li.current-menu-ancestor > a, .nav.phone li ul li.current-menu-ancestor > a:link, .nav.phone li ul li.current-menu-ancestor > a:visited,  
  890.  
  891.  
  892. .nav.phone li ul li.current-menu-ancestor > a:hover, .nav.phone li ul li.current-menu-ancestor > a:focus, .nav.phone li ul li.current-menu-ancestor > a:active { 
  893. color:<?php echo $cc_primary_links_color ?> !important; 
  894. background:<?php echo '#'.web_dor_ligthest_brigths($cc_menu_color, 15); ?> url(<?php echo get_template_directory_uri(); ?>/images/down_menu.png) right bottom no-repeat !important; 
  895. background-size:contain !important; 
  896.  
  897. .form-submit #submit { 
  898. background-color:<?php echo $cc_selected_menu_color; ?>; 
  899. color:<?php echo $cc_primary_links_hover_color; ?>; 
  900. .comment-reply-link{ 
  901. background-color:<?php echo $cc_selected_menu_color; ?>; 
  902.  
  903. .sub-menu, .nav ul { 
  904. background-color: <?php echo '#'.web_dor_ligthest_brigths($cc_head_elem_back_color, 15); ?>; 
  905. </style> 
  906.  
  907. <?php 
  908. ?> 
  909. <?php 
  910.  
  911. $themename = "Slider Options"; 
  912. $shortname = "ct"; 
  913.  
  914. //add_action('admin_init', 'mytheme_add_init'); 
  915.  
  916.  
  917. /////////////////////////////////// 
  918. /////////////////////////////////// 
  919. //theme options end 
  920. /////////////////////////////////// 
  921. /////////////////////////////////// 
  922.  
  923.  
  924. /***************/ 
  925. /**page meta box*/ 
  926. /***************/ 
  927.  
  928. define('MY_WORDPRESS_FOLDER', $_SERVER['DOCUMENT_ROOT']); 
  929. define('MY_THEME_FOLDER', str_replace('\\', '/', dirname(__FILE__))); 
  930. define('MY_THEME_PATH', '/' . substr(MY_THEME_FOLDER, stripos(MY_THEME_FOLDER, 'wp-content'))); 
  931.  
  932. add_action('admin_init', 'web_dor_web_business_meta_init'); 
  933.  
  934. function web_dor_web_business_meta_init() 
  935. // review the function reference for parameter details 
  936. // http://codex.wordpress.org/Function_Reference/wp_enqueue_script 
  937. // http://codex.wordpress.org/Function_Reference/wp_enqueue_style 
  938.  
  939. wp_enqueue_script('web_business_meta_js', MY_THEME_PATH . '/custom/meta.js', array('jquery')); 
  940. wp_enqueue_style('web_business_meta_css', MY_THEME_PATH . '/custom/meta.css'); 
  941.  
  942. // review the function reference for parameter details 
  943. // http://codex.wordpress.org/Function_Reference/add_meta_box 
  944.  
  945. foreach (array('post', 'page') as $type) { 
  946. add_meta_box('web_business_all_meta', 'Web Business Custom Meta Box', 'web_dor_meta_setup', $type, 'normal', 'high'); 
  947.  
  948. add_action('save_post', 'web_dor_meta_save'); 
  949.  
  950. function web_dor_meta_setup() 
  951. global $post; 
  952. global $dor_layout_page, $dor_general_settings_page; 
  953. // using an underscore, prevents the meta variable 
  954. // from showing up in the custom fields section 
  955. $meta = get_post_meta($post->ID, '_web_business_meta', TRUE); 
  956. global $post; 
  957. if( gettype ($post->ID) == 'integer' ) { 
  958. $meta=array( 
  959. 'layout' => $dor_layout_page->options_themeoptions[0]['std'] ,  
  960. 'content_width' => '' ,  
  961. 'main_col_width' => '',  
  962. 'pr_widget_area_width' => '',  
  963. 'fullwidthpage' => '',  
  964. 'show_comments' => $dor_general_settings_page->options_generalsettings[4]['std'],  
  965. 'blogstyle' => '',  
  966. 'showthumb' => '',  
  967. 'blog_perpage' => get_theme_mod("_n_of_home_post", 3),  
  968. 'showtitle' => '',  
  969. 'showdesc' => '',  
  970. 'detect_portrait' => '',  
  971. 'thumbsize' => '2',  
  972. 'static_pages_on' => '',  
  973. 'all_categories_on' => '',  
  974. 'tags_on' => '',  
  975. 'archives_on' => '',  
  976. 'authors_on' => '',  
  977. ); 
  978.  
  979. else 
  980. $meta_if_par_not_initilas=array( 
  981. 'layout' => $dor_layout_page->options_themeoptions[0]['std'] ,  
  982. 'content_width' => '' ,  
  983. 'main_col_width' => '' ,  
  984. 'pr_widget_area_width' => '',  
  985. 'fullwidthpage' =>NULL,  
  986. 'show_comments' =>NULL,  
  987. 'blogstyle' => '',  
  988. 'showthumb' => '',  
  989. 'blog_perpage' => get_theme_mod("_n_of_home_post", 3),  
  990. 'showtitle' => '',  
  991. 'showdesc' => '',  
  992. 'detect_portrait' => '',  
  993. 'thumbsize' => '2',  
  994. 'static_pages_on' => '',  
  995. 'all_categories_on' => '',  
  996. 'tags_on' => '',  
  997. 'archives_on' => '',  
  998. 'authors_on' => '',  
  999. 'blog_posts_on' => '',  
  1000. ); 
  1001. foreach($meta_if_par_not_initilas as $key=>$meta_if_par_not_initila) { 
  1002.  
  1003. if(!isset($meta[$key])) { 
  1004. $meta[$key]=$meta_if_par_not_initila; 
  1005.  
  1006.  
  1007.  
  1008. // instead of writing HTML here, lets do an include 
  1009. include(MY_THEME_FOLDER . '/custom/meta.php'); 
  1010.  
  1011. // create a custom nonce for submit verification later 
  1012. echo '<input type="hidden" name="web_business_meta_noncename" value="' . wp_create_nonce(__FILE__) . '" />'; 
  1013.  
  1014. function web_dor_meta_save($post_id) 
  1015. // authentication checks 
  1016.  
  1017. // check user permissions 
  1018. if (isset($_POST['post_type']) && $_POST['post_type'] == 'page') { 
  1019. if (!current_user_can('edit_page', $post_id)) return $post_id; 
  1020. } else { 
  1021. if (!current_user_can('edit_post', $post_id)) return $post_id; 
  1022.  
  1023. // authentication passed, save data 
  1024.  
  1025. // var types 
  1026. // single: _web_business_meta[var] 
  1027. // array: _web_business_meta[var][] 
  1028. // grouped array: _web_business_meta[var_group][0][var_1], _web_business_meta[var_group][0][var_2] 
  1029.  
  1030. $current_data = get_post_meta($post_id, '_web_business_meta', TRUE); 
  1031. if(isset($_POST['_web_business_meta'])) 
  1032. $new_data = $_POST['_web_business_meta']; 
  1033.  
  1034. web_dor_meta_clean($new_data); 
  1035.  
  1036. if ($current_data) { 
  1037. if (is_null($new_data)) delete_post_meta($post_id, '_web_business_meta'); 
  1038. else update_post_meta($post_id, '_web_business_meta', $new_data); 
  1039. } elseif (!is_null($new_data)) { 
  1040. add_post_meta($post_id, '_web_business_meta', $new_data, TRUE); 
  1041.  
  1042. return $post_id; 
  1043.  
  1044. function web_dor_meta_clean(&$arr) 
  1045. if (is_array($arr)) { 
  1046. foreach ($arr as $i => $v) { 
  1047. if (is_array($arr[$i])) { 
  1048. web_dor_meta_clean($arr[$i]); 
  1049.  
  1050. if (!count($arr[$i])) { 
  1051. unset($arr[$i]); 
  1052. } else { 
  1053. if (trim($arr[$i]) == '') { 
  1054. unset($arr[$i]); 
  1055.  
  1056. if (!count($arr)) { 
  1057. $arr = NULL; 
  1058.  
  1059. /*******************/ 
  1060. /**page meta box end*/ 
  1061. /*******************/ 
  1062.  
  1063. //search filter 
  1064. function web_dor_SearchFilter($query) 
  1065. if ($query->is_search or $query->is_feed) { 
  1066. // Portfolio 
  1067. if(!isset($_GET['inc-posts']) && !isset($_GET['inc-pages'])) { 
  1068.  
  1069. $query->set('post_type', array('post', 'page')); 
  1070.  
  1071. else 
  1072. if ($_GET['inc-posts'] == "on" && $_GET['inc-pages'] != "on") { 
  1073. $query->set('post_type', 'post'); 
  1074. } else if ($_GET['inc-posts'] != "on" && $_GET['inc-pages'] == "on") { 
  1075. $query->set('post_type', 'page'); 
  1076. } else if ($_GET['inc-posts'] == "on" && $_GET['inc-pages'] == "on") { 
  1077. $query->set('post_type', array('post', 'page')); 
  1078. } else { 
  1079. $query->set('post_type', ''); 
  1080. if (isset($_GET['month']) && $_GET['month'] != "no") { 
  1081. $query->set('year', substr($_GET['month'], 0, 4)); 
  1082. $query->set('monthnum', substr($_GET['month'], 4, 2)); 
  1083. //var_dump($query); 
  1084. return $query; 
  1085.  
  1086. // This filter will jump into the loop and arrange our results before they're returned 
  1087. add_filter('pre_get_posts', 'web_dor_SearchFilter'); 
  1088.  
  1089.  
  1090. function web_dor_update_page_layout_meta_settings() 
  1091. /**update page layout*/ 
  1092. global $post; 
  1093.  
  1094. if(isset($post)) 
  1095. $web_business_meta = get_post_meta($post->ID, '_web_business_meta', TRUE); 
  1096.  
  1097. global $dor_layout_page; 
  1098.  
  1099. if(!isset($web_business_meta['content_width'])) 
  1100. $web_business_meta['content_width'] = $dor_layout_page->options_themeoptions[2]['std']; 
  1101. if(!isset($web_business_meta['main_col_width'])) 
  1102. $web_business_meta['main_col_width'] = $dor_layout_page->options_themeoptions[3]['std']; 
  1103. if(!isset($web_business_meta['layout'])) 
  1104. $web_business_meta['layout'] = $dor_layout_page->options_themeoptions[0]['std']; 
  1105. if(!isset($web_business_meta['pr_widget_area_width'])) 
  1106. $web_business_meta['pr_widget_area_width'] = $dor_layout_page->options_themeoptions[4]['std']; 
  1107.  
  1108.  
  1109. if ($web_business_meta['fullwidthpage']) { 
  1110.  
  1111. $them_content_are_width='100%'; 
  1112. ?><script>var full_width_web_buisnes=1</script><?php 
  1113.  
  1114. else { 
  1115.  
  1116. if(isset($web_business_meta['content_width'])) 
  1117. $them_content_are_width=$web_business_meta['content_width'] . "px;"; 
  1118. else 
  1119. $them_content_are_width=$dor_layout_page->options_themeoptions[2]['std']; 
  1120. ?><script> var full_width_web_buisnes=0</script><?php 
  1121.  
  1122. switch ($web_business_meta['layout']) { 
  1123. //set styles leauts 
  1124. case 1: 
  1125. ?> 
  1126. <style type="text/css"> 
  1127. #sidebar1,  
  1128. #sidebar2 { 
  1129. display:none; 
  1130. #blog { 
  1131. display:block;  
  1132. float:left; 
  1133. }; 
  1134.  
  1135. .container{ 
  1136. width:<?php echo $them_content_are_width; ?> 
  1137. }  
  1138. #blog{ 
  1139. width:<?php echo $them_content_are_width; ?> 
  1140. }  
  1141. </style> 
  1142. <?php 
  1143. break; 
  1144. case 2: 
  1145. ?> 
  1146. <style type="text/css"> 
  1147. #sidebar2{ 
  1148. display:none; 
  1149. }  
  1150. #sidebar1 { 
  1151. display:block; 
  1152. float:right; 
  1153. #blog{ 
  1154. display:block; 
  1155. float:left; 
  1156. }  
  1157. .container{ 
  1158. width:<?php echo $them_content_are_width; ?> 
  1159. #blog{ 
  1160. width:<?php echo $web_business_meta['main_col_width']-1; ?>%; 
  1161. #sidebar1{ 
  1162. width:<?php echo (100 - $web_business_meta['main_col_width']-1); ?>%; 
  1163. </style> 
  1164. <?php 
  1165. break; 
  1166. case 3: 
  1167. ?> 
  1168. <style type="text/css"> 
  1169. #sidebar2{ 
  1170. display:none; 
  1171. }  
  1172. #sidebar1 { 
  1173. display:block; 
  1174. float:left; 
  1175. }  
  1176. #blog{ 
  1177. display:block; 
  1178. float:left; 
  1179. .container{ 
  1180. width:<?php echo $them_content_are_width; ?> 
  1181. #blog{ 
  1182. width:<?php echo $web_business_meta['main_col_width']; ?>%; 
  1183. #sidebar1{ 
  1184. width:<?php echo (100 - $web_business_meta['main_col_width']-1); ?>%; 
  1185. margin-right: 1%; 
  1186. </style> 
  1187. <?php 
  1188. break; 
  1189. case 4: 
  1190. ?> 
  1191. <style type="text/css"> 
  1192. #sidebar2{ 
  1193. display:block; 
  1194. float:right; 
  1195. }  
  1196. #sidebar1 { 
  1197. display:block; float:right; 
  1198. }  
  1199. #blog{ 
  1200. display:block; 
  1201. float:left; 
  1202. .container{ 
  1203. width:<?php echo $them_content_are_width; ?> 
  1204. #blog{ 
  1205. width:<?php echo ($web_business_meta['main_col_width']-2) ; ?>%; 
  1206. #sidebar1{ 
  1207. width:<?php echo $web_business_meta['pr_widget_area_width'] ; ?>%; 
  1208. #sidebar2{ 
  1209. width:<?php echo (100 - $web_business_meta['pr_widget_area_width'] - $web_business_meta['main_col_width']); ?>%; 
  1210. margin-right: 1%; 
  1211. </style> 
  1212. <?php 
  1213. break; 
  1214. case 5: 
  1215. ?> 
  1216. <style type="text/css"> 
  1217. #sidebar2{ 
  1218. display:block; 
  1219. float:left; 
  1220. }  
  1221. #sidebar1 { 
  1222. display:block; 
  1223. float:left; 
  1224. }  
  1225. #blog{ 
  1226. display:block; 
  1227. float:right; 
  1228. .container{ 
  1229. width:<?php echo $them_content_are_width; ?> 
  1230. #blog{ 
  1231. width:<?php echo ($web_business_meta['main_col_width']-2); ?>%; 
  1232. #sidebar1{ 
  1233. width:<?php echo $web_business_meta['pr_widget_area_width']; ?>%; 
  1234. margin-right: 1%; 
  1235. #sidebar2{ 
  1236. width:<?php echo (100 - $web_business_meta['pr_widget_area_width'] - $web_business_meta['main_col_width']); ?>%; 
  1237. margin-right: 1%; 
  1238. </style> 
  1239. <?php 
  1240. break; 
  1241. case 6: 
  1242. ?> 
  1243. <style type="text/css"> 
  1244. #sidebar2{ 
  1245. display:block; 
  1246. float:right; 
  1247. }  
  1248. #sidebar1 { 
  1249. display:block; 
  1250. float:left;  
  1251. }  
  1252. #blog{ 
  1253. display:block; 
  1254. float:left; 
  1255. }  
  1256. .container{ 
  1257. width:<?php echo $them_content_are_width; ?> 
  1258. #blog{ 
  1259. width:<?php echo ($web_business_meta['main_col_width']-2); ?>%; 
  1260. #sidebar1{ 
  1261. width:<?php echo $web_business_meta['pr_widget_area_width']; ?>%; 
  1262. margin-right: 1%; 
  1263. #sidebar2{ 
  1264. width:<?php echo (100 - $web_business_meta['pr_widget_area_width'] - $web_business_meta['main_col_width']); ?>%; 
  1265. }  
  1266. </style><?php 
  1267. break; 
  1268. /**update page layout end*/ 
  1269.  
  1270. /**customize*/ 
  1271. require_once "custom_functions.php"; 
  1272.  
  1273. add_action('wp_ajax_themewdcaptchareturn', 'web_dor_captchareturn'); 
  1274.  
  1275. function web_dor_captchareturn() { 
  1276.  
  1277.  
  1278. //Check to see if the honeypot captcha field was filled in 
  1279. @session_start(); 
  1280.  
  1281. if ( trim( $_GET['captcha_key'] ) !== $_SESSION['web_dor_them_cap_code'] ) { 
  1282. $captchaError = true; 
  1283. echo '3'; 
  1284. exit; 
  1285. } else { 
  1286.  
  1287. //Check to make sure that the name field is not empty 
  1288. if ( trim($_GET['name']) === '') { 
  1289. echo '4'; 
  1290. exit; 
  1291. $nameError = 'You forgot to enter your name.'; 
  1292. $hasError = true; 
  1293. } else { 
  1294. $name = trim( $_GET['name'] ); 
  1295.  
  1296.  
  1297. //If there is no error, send the email 
  1298. if(isset($_GET['captcha_key'])) 
  1299. $code=$_GET['captcha_key']; 
  1300. else 
  1301. $code=''; 
  1302.  
  1303. if($code!='' and $code==$_SESSION['web_dor_them_cap_code'] ) { 
  1304. global $post;  
  1305. $email=$_GET['email']; 
  1306. $web_business_meta = get_post_meta( $_GET['curenid'], '_web_business_meta', TRUE ); 
  1307. $emailTo = $web_business_meta['email_to']; 
  1308. $subject = $_GET['message_title']; 
  1309. $comments=$_GET['message']; 
  1310. $sendCopy = $_GET['sendcopy']; 
  1311. $body = "Name: $name \n\nEmail: $email \n\nComments: $comments"; 
  1312. $mail_send = wp_mail($emailTo, $subject, $body, ''); 
  1313. if(!$mail_send) { 
  1314. echo '5'; 
  1315. exit; 
  1316. if ( $sendCopy == true ) { 
  1317. $subject = $_GET['message_title']; 
  1318. $mail_send = wp_mail($email, $subject, $body, ''); 
  1319. if(!$mail_send) { 
  1320. echo '5'; 
  1321. exit; 
  1322.  
  1323.  
  1324. echo '1'; 
  1325.  
  1326.  
  1327.  
  1328.  
  1329. die(); 
  1330.  
  1331.  
  1332.  
  1333.  
  1334. add_action('wp_ajax_themewdcaptcha', 'web_dor_captcha'); 
  1335. add_action('wp_ajax_nopriv_themewdcaptcha', 'web_dor_captcha'); 
  1336. function web_dor_captcha() 
  1337. if(isset($_GET['action']) && $_GET['action']=='themewdcaptcha') { 
  1338. $cap_width=80; 
  1339. $cap_height=30; 
  1340. $cap_quality=100; 
  1341. $cap_length_min=6; 
  1342. $cap_length_max=6; 
  1343. $cap_digital=1; 
  1344. $cap_latin_char=1; 
  1345. function web_dor_code_generic($_length, $_digital=1, $_latin_char=1) 
  1346. $dig=array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); 
  1347. $lat=array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'o',  
  1348. 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'); 
  1349. $main=array(); 
  1350. if ($_digital) $main=array_merge($main, $dig); 
  1351. if ($_latin_char) $main=array_merge($main, $lat); 
  1352. shuffle($main); 
  1353. $pass=substr(implode('', $main), 0, $_length); 
  1354. return $pass; 
  1355. if(isset($_GET['checkcap'])=='1') { 
  1356. if($_GET['checkcap']=='1') 
  1357. @session_start(); 
  1358. if(isset($_GET['cap_code'])) {  
  1359. if($_GET['cap_code']==$_SESSION['web_dor_them_cap_code']) 
  1360. echo 1; 
  1361. else echo 0; 
  1362. }} 
  1363. else 
  1364. $l=rand($cap_length_min, $cap_length_max); 
  1365. $code=web_dor_code_generic($l, $cap_digital, $cap_latin_char); 
  1366. @session_start(); 
  1367. $_SESSION['web_dor_them_cap_code']= $code; 
  1368. $canvas=imagecreatetruecolor($cap_width, $cap_height); 
  1369. $c=imagecolorallocate($canvas, rand(150, 255), rand(150, 255), rand(150, 255)); 
  1370. imagefilledrectangle($canvas, 0, 0, $cap_width, $cap_height, $c); 
  1371. $count=strlen($code); 
  1372. $color_text=imagecolorallocate($canvas, 0, 0, 0); 
  1373. for($it=0;$it<$count;$it++) 
  1374. { $letter=$code[$it]; 
  1375. imagestring($canvas, 6, (10*$it+10), $cap_height/4, $letter, $color_text); 
  1376. for ($c = 0; $c < 150; $c++) { 
  1377. $x = rand(0, 79); 
  1378. $y = rand(0, 29); 
  1379. $col='0x'.rand(0, 9).'0'.rand(0, 9).'0'.rand(0, 9).'0'; 
  1380. imagesetpixel($canvas, $x, $y, $col); 
  1381. header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');  
  1382. header('Cache-Control: no-store, no-cache, must-revalidate');  
  1383. header('Cache-Control: post-check=0, pre-check=0', false); 
  1384. header('Pragma: no-cache'); 
  1385. header('Content-Type: image/jpeg'); 
  1386. imagejpeg($canvas, null, $cap_quality); 
  1387.  
  1388. }  
  1389. die(''); 
  1390.  
  1391.  
  1392.  
  1393.  
  1394.  
  1395.  
  1396. /// include requerid scripts and styles 
  1397.  
  1398.  
  1399. add_filter('wp_head', 'web_dor_include_requerid_scripts_for_theme', 1); 
  1400. add_filter('admin_head', 'web_dor_include_requerid_scripts_for_theme_admin', 1); 
  1401.  
  1402. function web_dor_include_requerid_scripts_for_theme() { 
  1403. wp_enqueue_script('jquery');  
  1404. wp_enqueue_script('roundabout', get_template_directory_uri().'/roundabout/roundabout.js'); 
  1405. wp_enqueue_script('jquery-effects-transfer'); 
  1406. wp_enqueue_style('nivo_slider', get_template_directory_uri().'/nivo_files/nivo-slider.css'); 
  1407. wp_enqueue_style('nivo_default', get_template_directory_uri().'/nivo_files/themes/default/default.css'); 
  1408. wp_enqueue_script('nivo_pack', get_template_directory_uri().'/nivo_files/jquery.nivo.slider.pack.js'); 
  1409. wp_enqueue_script('custom_js', get_template_directory_uri().'/scripts/javascript.js'); 
  1410. wp_enqueue_script('response', get_template_directory_uri().'/scripts/responsive.js', array('jquery'), false, true); 
  1411. wp_enqueue_style( 'webdr-style', get_stylesheet_uri(), array(), '2013-11-18' ); 
  1412. if ( is_singular() && get_theme_mod( 'thread_comments' ) ) 
  1413. wp_enqueue_script( 'comment-reply' ); 
  1414.  
  1415. function web_dor_include_requerid_scripts_for_theme_admin() { 
  1416. wp_register_style('googleFonts', 'http://fonts.googleapis.com/css?family=Rock+Salt|Neucha'); 
  1417. wp_enqueue_style( 'googleFonts'); 
  1418.  
  1419.  
  1420. function web_dor_ligthest_brigths($color, $pracent) { 
  1421.  
  1422. $new_color=$color; 
  1423. if(!(strlen($new_color==6) || strlen($new_color)==7)) 
  1424. return $color; 
  1425. $color_vandakanishov=strpos($new_color, '#'); 
  1426. if($color_vandakanishov == false) { 
  1427. $new_color= str_replace('#', '', $new_color); 
  1428. $color_part_1=substr($new_color, 0, 2); 
  1429. $color_part_2=substr($new_color, 2, 2); 
  1430. $color_part_3=substr($new_color, 4, 2); 
  1431. $color_part_1=dechex( (int) (hexdec( $color_part_1 ) + (( 255-( hexdec( $color_part_1 ) ) ) * $pracent / 100 ))); 
  1432. $color_part_2=dechex( (int) (hexdec( $color_part_2) + (( 255-( hexdec( $color_part_2 ) ) ) * $pracent / 100 ))); 
  1433. $color_part_3=dechex( (int) (hexdec( $color_part_3 ) + (( 255-( hexdec( $color_part_3 ) ) ) * $pracent / 100 ))); 
  1434. $new_color=$color_part_1.$color_part_2.$color_part_3; 
  1435. if($color_vandakanishov == false) { 
  1436. return $new_color; 
  1437. else{ 
  1438. return '#'.$new_color; 
  1439.  
  1440.  
  1441. function web_dor_wp_title( $title, $sep ) { 
  1442. global $page; 
  1443.  
  1444. if ( is_feed() ) 
  1445. return $title; 
  1446.  
  1447. // Add the site name. 
  1448. $title .= get_bloginfo( 'name' ); 
  1449.  
  1450. // Add the site description for the home/front page. 
  1451. $site_description = get_bloginfo( 'description', 'display' ); 
  1452. if ( $site_description && ( is_home() || is_front_page() ) ) 
  1453. $title = "$title $sep $site_description"; 
  1454.  
  1455.  
  1456. return $title; 
  1457. add_filter( 'wp_title', 'web_dor_wp_title', 10, 2 ); 
  1458.  
  1459.  
  1460. function web_dor_custom_head() { 
  1461.  
  1462. global $dor_general_settings_page; 
  1463. foreach ( $dor_general_settings_page->options_generalsettings as $value ) { 
  1464. if(isset($value['id'])) { 
  1465.  
  1466. if ( get_theme_mod( $value['id'] ) === FALSE ) { 
  1467. $$value['id'] = $value['std'];  
  1468. }  
  1469. else { 
  1470. $$value['id'] = get_theme_mod( $value['id'] );  
  1471.  
  1472. }?> 
  1473.  
  1474. <script> 
  1475. var skzbi_hasce="<?php echo get_template_directory_uri(); ?>"; 
  1476. $ = jQuery; 
  1477. </script> 
  1478. <?php 
  1479.  
  1480. echo "<style>".stripslashes(get_theme_mod("_custom_css"))."</style>"; 
  1481. ?> 
  1482. <script type="text/javascript"> 
  1483. $(document).ready(function() { 
  1484. $('#slider').nivoSlider({ 
  1485. effect: "<?php echo trim(get_theme_mod('ct_effect', 'random')); ?>", // Specify sets like: 'fold, fade, sliceDown' 
  1486. slices: 15, // For slice animations 
  1487. boxCols: 8, // For box animations 
  1488. boxRows: 4, // For box animations 
  1489. animSpeed: <?php echo get_theme_mod('ct_anim_speed', '500'); ?>, // Slide transition speed 
  1490. pauseTime: <?php echo get_theme_mod('ct_pause_time', '4000'); ?>, // How long each slide will show 
  1491. startSlide: 0, // Set starting Slide (0 index) 
  1492. directionNav: true, // Next & Prev navigation 
  1493. directionNavHide: true, // Only show on hover 
  1494. controlNav: true, // 1, 2, 3... navigation 
  1495. controlNavThumbs: false, // Use thumbnails for Control Nav 
  1496. pauseOnHover: <?php if(get_theme_mod('ct_pause_on_hover')) {echo "true";}else{echo "false";} ?>, // Stop animation while hovering 
  1497. manualAdvance: false, // Force manual transitions 
  1498. prevText: 'Prev', // Prev directionNav text 
  1499. nextText: 'Next', // Next directionNav text 
  1500. randomStart: false, // Start on a random slide 
  1501. beforeChange: function() {}, // Triggers before a slide transition 
  1502. afterChange: function() {}, // Triggers after a slide transition 
  1503. slideshowEnd: function() {}, // Triggers after all slides have been shown 
  1504. lastSlide: function() {}, // Triggers when last slide is shown 
  1505. afterLoad: function() {} // Triggers when slider has loaded 
  1506. }); 
  1507. $('#slider').nivoSlider(); 
  1508. }); 
  1509. </script> 
  1510.  
  1511. <?php 
  1512.  
  1513.  
  1514.  
  1515.  
  1516. ?> 
.