storage(); //--------------------Vertical-----------------------// $rules = !empty($config['vertical_rules']) ? json_decode(urldecode($config['vertical_rules']), true) : []; foreach ($rules as $rule) { $offset = (isset($rule['offset']) && $rule['offset'] > 1) ? intval($rule['offset']) : 1; $nth_child_type = (isset($rule['type']) && $rule['type'] == 'every') ? 'n' . ' + ' . $offset : ''; $nth_child_index = ( isset($rule['index']) && is_numeric($rule['index']) && $rule['index'] >= 1 ) ? intval($rule['index']) : 1; $nth_child = $nth_child_index . $nth_child_type; $border_style = !empty($rule['style']) ? $rule['style'] : 'solid'; $border_width = (isset($rule['width']) && is_numeric($rule['width']) && $rule['width'] > 0) ? $rule['width'] : 1; $border_color = !empty($rule['color']) ? $storage->get($rule['color']) : 'transparent'; $style .= /** @lang CSS */ ' .grid-bg__vertical > div:nth-child(' . $nth_child . ') { border-right-style: ' . $border_style . '; border-right-color: ' . $border_color . '; border-right-width: ' . $border_width . 'px; } .grid-bg__vertical > div:last-child { border: none; } '; } //------------------------------Horizontal-------------------------// $rules = (isset($config['horizontal_rules']) && ($config['horizontal_rules'])) ? json_decode(urldecode($config['horizontal_rules']), true) : []; $distance = !empty($config['horizontal_distance']) ? json_decode(urldecode($config['horizontal_distance'])) : null; $distance = (isset($distance->number) && $distance->number >= 1) ? intval($distance->number) : 100; $style .= /** @lang CSS */ ' body .grid-bg__horizontal .col-horizontal { height:' . $distance . 'px; } '; foreach ($rules as $rule) { $offset = (isset($rule['offset']) && $rule['offset'] > 1) ? intval($rule['offset']) : 1; $nth_child_type = (isset($rule['type']) && $rule['type'] == 'every') ? 'n' . ' + ' . $offset : ''; $nth_child_index = ( isset($rule['index']) && is_numeric($rule['index']) && $rule['index'] >= 1 ) ? intval($rule['index']) : 1; $nth_child = $nth_child_index . $nth_child_type; $border_style = !empty($rule['style']) ? $rule['style'] : 'solid'; $border_width = (isset($rule['width']) && is_numeric($rule['width']) && $rule['width'] > 0) ? $rule['width'] : 1; $border_color = !empty($rule['color']) ? $storage->get($rule['color']) : 'transparent'; $style .= /** @lang CSS */ ' .grid-bg__horizontal > div:nth-child(' . $nth_child . ') { border-bottom-style: ' . $border_style . '; border-bottom-color: ' . $border_color . '; border-bottom-width: ' . $border_width . 'px; } .grid-bg__horizontal > div:last-child { border: none; } '; } print($style);