/** * Quick link resource pattern * * @param string $url Link href * @param string $text Tag contents * @param mixed $attrs Additional attributes as a string or an associative array * @return string HTML link */ function cot_rc_link($url, $text, $attrs = '') { $link_attrs = cot_rc_attr_string($attrs); return '<a href="' . $url . '"' . $link_attrs . '>' . $text . '</a>'; }
/** * Generates a form input file from a resource string * * @param string $name Input name * @param string $value Entered value * @param string $filepath Entered filepath if defferent from value * @param string $delname Delete file chechbox name * @param mixed $attrs Additional attributes as an associative array or a string * @param string $custom_rc Custom resource string name * @return string */ function cot_filebox($name, $value = '', $filepath = '', $delname = '', $attrs = '', $custom_rc = '') { global $R, $cfg; $input_attrs = cot_rc_attr_string($attrs); $rc_name = preg_match('#^(\\w+)\\[(.*?)\\]$#', $name, $mt) ? $mt[1] : $name; $custom_rc = explode('|', $custom_rc, 2); if (empty($value)) { $rc = empty($R["input_filebox_{$rc_name}_empty"]) ? empty($custom_rc[1]) ? 'input_filebox_empty' : $custom_rc[1] : "input_filebox_{$rc_name}_empty"; } else { $rc = empty($R["input_filebox_{$rc_name}"]) ? empty($custom_rc[0]) ? 'input_filebox' : $custom_rc[0] : "input_filebox_{$rc_name}"; } $filepath = empty($filepath) ? $value : $filepath; $delname = empty($delname) ? 'del' . $name : $delname; $error = $cfg['msg_separate'] ? cot_implode_messages($name, 'error') : ''; return cot_rc($rc, array('name' => $name, 'filepath' => $filepath, 'delname' => $delname, 'value' => $value, 'attrs' => $input_attrs, 'error' => $error)); }