Server : Apache System : Linux copper.netcy.com 2.6.32-754.27.1.el6.centos.plus.x86_64 #1 SMP Thu Jan 30 13:54:25 UTC 2020 x86_64 User : montcaro ( 581) PHP Version : 7.4.28 Disable Function : NONE Directory : /home/montcaro/public_html/sites/all/themes/basic/ |
<?php //*темизирую корзину*/ function basic_uc_cart_block_items($variables) { $items = $variables['items']; $class = $variables['collapsed'] ? 'cart-block-items collapsed' : 'cart-block-items'; // If there are items in the shopping cart... if ($items) { $output = '<table class="' . $class . '"><tbody>'; // Loop through each item. $row_class = 'odd'; foreach ($items as $item) { //убираю ненужную хуйню из карзины // Add the basic row with quantity, title, and price. // $output .= '<tr class="' . $row_class . '"><td class="cart-block-item-qty">' . $item['qty'] . '</td>' // . '<td class="cart-block-item-title">' . $item['title'] . '</td>' // . '<td class="cart-block-item-price">' . theme('uc_price', array('price' => $item['price'])) . '</td></tr>'; // Add a row of description if necessary. if ($item['desc']) { $output .= '<tr class="' . $row_class . '"><td colspan="3" class="cart-block-item-desc">' . $item['desc'] . '</td></tr>'; } // Alternate the class for the rows. $row_class = ($row_class == 'odd') ? 'even' : 'odd'; } $output .= '</tbody></table>'; } else { // Otherwise display an empty message. global $user; if(!$user->uid) { $output = '<ul class="navi"> <li class="first">'.t('CART').' |</li> <li class="last"><a class="colorbox-node" href="/user/login?width=620&height=320">ВОЙТИ</a></li> </ul>'; } if($user->uid) { $output = '<ul class="navi"> <li class="first">'.t('CART').' |</li> <li class="last"><a class="colorbox-node" href="/user/'.$user->uid.'/orders?width=800&height=420">'.t('ORDERS').'</a> |</li> <li class="last"><a href="/user/logout">'.t('LOGOUT').'</a></li> </ul>'; } } return $output; } function basic_uc_cart_block_summary($variables) { $item_count = $variables['item_count']; $item_text = $variables['item_text']; $total = $variables['total']; $summary_links = $variables['summary_links']; // Build the basic table with the number of items in the cart and total. global $user; if($total > 0 && $user->uid) { $output = '<span class="cart_count">'.$item_count.'</span> <ul class="navi"> <li class="first active"><a href="/cart">'.t('CART').' </a>|</li> <li class="last"><a class="colorbox-node" href="/user/'.$user->uid.'/orders?width=800&height=420">'.t('ORDERS').'</a> |</li> <li class="last"><a href="/user/logout">'.t('LOGOUT').'</a></li> </ul>'; return $output; } if($total > 0 && !$user->uid) { $output = '<span class="cart_count">'.$item_count.'</span> <ul class="navi"> <li class="first active"><a href="/cart">'.t('CART').' </a>|</li> <li class="last"><a class="colorbox-node" href="/user/login?width=620&height=320">'.t('LOGOUT').'</a></li> </ul>'; return $output; } } /** * Here we override the default HTML output of drupal. * refer to http://drupal.org/node/550722 */ // Auto-rebuild the theme registry during theme development. if (theme_get_setting('clear_registry')) { // Rebuild .info data. system_rebuild_theme_data(); // Rebuild theme registry. drupal_theme_rebuild(); } // Add Zen Tabs styles if (theme_get_setting('basic_tabs')) { drupal_add_css( drupal_get_path('theme', 'basic') .'/css/tabs.css'); } function basic_preprocess_html(&$vars) { global $user; //Add role name classes (to allow css based show for admin/hidden from user) foreach ($user->roles as $role){ $vars['classes_array'][] = 'role-' . basic_id_safe($role); } if (!$vars['is_front']) { // Add unique classes for each page and website section $path = drupal_get_path_alias($_GET['q']); list($section, ) = explode('/', $path, 2); $vars['classes_array'][] = 'with-subnav'; $vars['classes_array'][] = basic_id_safe('page-'. $path); $vars['classes_array'][] = basic_id_safe('section-'. $section); if (arg(0) == 'node') { if (arg(1) == 'add') { if ($section == 'node') { // Remove 'section-node' array_pop( $vars['classes_array'] ); } // Add 'section-node-add' $vars['classes_array'][] = 'section-node-add'; } elseif (is_numeric(arg(1)) && (arg(2) == 'edit' || arg(2) == 'delete')) { if ($section == 'node') { // Remove 'section-node' array_pop( $vars['classes_array']); } // Add 'section-node-edit' or 'section-node-delete' $vars['classes_array'][] = 'section-node-'. arg(2); } } } //for normal un-themed edit pages if ((arg(0) == 'node') && (arg(2) == 'edit')) { $vars['template_files'][] = 'page'; } // Add IE classes. if (theme_get_setting('basic_ie_enabled')) { $basic_ie_enabled_versions = theme_get_setting('basic_ie_enabled_versions'); if (in_array('ie8', $basic_ie_enabled_versions, TRUE)) { drupal_add_css(path_to_theme() . '/css/ie8.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'IE 8', '!IE' => FALSE), 'preprocess' => FALSE)); drupal_add_js(path_to_theme() . '/js/selectivizr-min.js'); } if (in_array('ie9', $basic_ie_enabled_versions, TRUE)) { drupal_add_css(path_to_theme() . '/css/ie9.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'IE 9', '!IE' => FALSE), 'preprocess' => FALSE)); } if (in_array('ie10', $basic_ie_enabled_versions, TRUE)) { drupal_add_css(path_to_theme() . '/css/ie10.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'IE 10', '!IE' => FALSE), 'preprocess' => FALSE)); } } } function basic_preprocess_page(&$vars, $hook) { global $user; /* if(arg(0) == 'user' && arg(1) == $user->uid) { drupal_goto("<front>"); } */ if(arg(0) == 'cart' && arg(1) =='') { drupal_set_title('МОЯ КОРЗИНА'); } // Грохнул title у nid 13 if (isset($vars['node']) && $vars['node']->nid == '13'){ drupal_set_title(''); } if (isset($vars['node']) && $vars['node']->nid == '2'){ drupal_set_title(''); } if (isset($vars['node']) && $vars['node']->nid == '15'){ drupal_set_title(''); } if (isset($vars['node']) && $vars['node']->nid == '16'){ drupal_set_title(''); } if (arg(1) =='checkout'){ drupal_set_title(''); } // Adding classes whether #navigation is here or not if (!empty($vars['main_menu']) or !empty($vars['sub_menu'])) { $vars['classes_array'][] = 'with-navigation'; } if (!empty($vars['secondary_menu'])) { $vars['classes_array'][] = 'with-subnav'; } // Add first/last classes to node listings about to be rendered. if (isset($vars['page']['content']['system_main']['nodes'])) { // All nids about to be loaded (without the #sorted attribute). $nids = element_children($vars['page']['content']['system_main']['nodes']); // Only add first/last classes if there is more than 1 node being rendered. if (count($nids) > 1) { $first_nid = reset($nids); $last_nid = end($nids); $first_node = $vars['page']['content']['system_main']['nodes'][$first_nid]['#node']; $first_node->classes_array = array('first'); $last_node = $vars['page']['content']['system_main']['nodes'][$last_nid]['#node']; $last_node->classes_array = array('last'); } } // Allow page override template suggestions based on node content type. if (isset($vars['node']->type) && isset($vars['node']->nid)) { $vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type; $vars['theme_hook_suggestions'][] = "page__node__" . $vars['node']->nid; } } function basic_preprocess_node(&$vars) { // Add a striping class. $vars['classes_array'][] = 'node-' . $vars['zebra']; // Add $unpublished variable. $vars['unpublished'] = (!$vars['status']) ? TRUE : FALSE; // Merge first/last class (from basic_preprocess_page) into classes array of current node object. $node = $vars['node']; if (!empty($node->classes_array)) { $vars['classes_array'] = array_merge($vars['classes_array'], $node->classes_array); } } /** * Return a themed breadcrumb trail. * * @param $breadcrumb * An array containing the breadcrumb links. * @return * A string containing the breadcrumb output. */ function basic_breadcrumb($variables) { $breadcrumb = $variables['breadcrumb']; // Determine if we are to display the breadcrumb. $show_breadcrumb = theme_get_setting('basic_breadcrumb'); if ($show_breadcrumb == 'yes' || $show_breadcrumb == 'admin' && arg(0) == 'admin') { // Optionally get rid of the homepage link. $show_breadcrumb_home = theme_get_setting('basic_breadcrumb_home'); if (!$show_breadcrumb_home) { array_shift($breadcrumb); } // Return the breadcrumb with separators. if (!empty($breadcrumb)) { $breadcrumb_separator = theme_get_setting('basic_breadcrumb_separator'); $trailing_separator = $title = ''; if (theme_get_setting('basic_breadcrumb_title')) { $item = menu_get_item(); if (!empty($item['tab_parent'])) { // If we are on a non-default tab, use the tab's title. $title = check_plain($item['title']); } else { $title = drupal_get_title(); } if ($title) { $trailing_separator = $breadcrumb_separator; } } elseif (theme_get_setting('basic_breadcrumb_trailing')) { $trailing_separator = $breadcrumb_separator; } // Provide a navigational heading to give context for breadcrumb links to // screen-reader users. Make the heading invisible with .element-invisible. $heading = '<h2 class="element-invisible">' . t('You are here') . '</h2>'; return $heading . '<div class="breadcrumb">' . implode($breadcrumb_separator, $breadcrumb) . $trailing_separator . $title . '</div>'; } } // Otherwise, return an empty string. return ''; } /** * Converts a string to a suitable html ID attribute. * * http://www.w3.org/TR/html4/struct/global.html#h-7.5.2 specifies what makes a * valid ID attribute in HTML. This function: * * - Ensure an ID starts with an alpha character by optionally adding an 'n'. * - Replaces any character except A-Z, numbers, and underscores with dashes. * - Converts entire string to lowercase. * * @param $string * The string * @return * The converted string */ function basic_id_safe($string) { // Replace with dashes anything that isn't A-Z, numbers, dashes, or underscores. $string = strtolower(preg_replace('/[^a-zA-Z0-9_-]+/', '-', $string)); // If the first character is not a-z, add 'n' in front. if (!ctype_lower($string{0})) { // Don't use ctype_alpha since its locale aware. $string = 'id'. $string; } return $string; } /** * Generate the HTML output for a menu link and submenu. * * @param $variables * An associative array containing: * - element: Structured array data for a menu link. * * @return * A themed HTML string. * * @ingroup themeable * */ function basic_menu_link(array $variables) { $element = $variables['element']; $sub_menu = ''; if ($element['#below']) { $sub_menu = drupal_render($element['#below']); } $output = l($element['#title'], $element['#href'], $element['#localized_options']); // Adding a class depending on the TITLE of the link (not constant) $element['#attributes']['class'][] = basic_id_safe($element['#title']); // Adding a class depending on the ID of the link (constant) $element['#attributes']['class'][] = 'mid-' . $element['#original_link']['mlid']; return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n"; } /** * Override or insert variables into theme_menu_local_task(). */ function basic_preprocess_menu_local_task(&$variables) { $link =& $variables['element']['#link']; // If the link does not contain HTML already, check_plain() it now. // After we set 'html'=TRUE the link will not be sanitized by l(). if (empty($link['localized_options']['html'])) { $link['title'] = check_plain($link['title']); } $link['localized_options']['html'] = TRUE; $link['title'] = '<span class="tab">' . $link['title'] . '</span>'; } function basic_theme() { $items = array(); $items['user_login'] = array( 'render element' => 'form', 'path' => drupal_get_path('theme', 'basic') . '/templates', 'template' => 'user-login', 'preprocess functions' => array( 'basic_preprocess_user_login' ), ); $items['user_register_form'] = array( 'render element' => 'form', 'path' => drupal_get_path('theme', 'basic') . '/templates', 'template' => 'user-register-form', 'preprocess functions' => array( 'basic_preprocess_user_register_form' ), ); return $items; } function basic_preprocess_user_login(&$vars) { $vars['intro_text'] = t('This is my awesome login form'); } function basic_preprocess_user_register_form(&$vars) { $vars['intro_text'] = t('This is my super awesome reg form'); }