* @since 0.1.0 * * @param array $args Array of [ $id Id, $name Name, $value Value, $submit use submit, $extra Extra checkbox code ] */ function __construct($value, $args = array()) { global $tk_form_instance_option_group; if (isset($args['name'])) { $field_name = $tk_form_instance_option_group . '_values[' . $args['name'] . ']'; $args['name'] = $field_name;
function tk_obj_from_node($node, $function_name = FALSE, $is_html = FALSE) { global $tkf_create_textfiles, $tkf_text_domain; // Getting node values $node_name = $node->nodeName; $node_value = $node->nodeValue; $node_attr = $node->attributes; $node_list = $node->childNodes; /* * Running node attributes */ foreach ($node_attr as $attribute) { $params[$attribute->nodeName] = $attribute->nodeValue; } // Functions have to be executed before executing inner functions if (FALSE != $function_name) { // Setting global form instance name if ($function_name == 'form') { global $tk_form_instance_option_group; $tk_form_instance_option_group = $params['name']; } } /* * Running sub nodes */ for ($i = 0; $i < $node_list->length; $i++) { $subnode = $node_list->item($i); $subnode_name = $subnode->nodeName; $subnode_value = $subnode->nodeValue; $subnode_attributes = $subnode->attributes; // WML Tag if (in_array($subnode_name, $this->function_names)) { $params['content'][$i] = $this->tk_obj_from_node($subnode, $subnode_name); // HTML Tag } elseif ($subnode->nodeType != XML_TEXT_NODE) { // Getting Tag attributes $attributes = ''; foreach ($subnode_attributes as $attr_name => $attrNode) { $attributes .= ' ' . $attr_name . '="' . $attrNode->value . '"'; } // Set up Tag $params['content'][$i] = array('<' . $subnode->nodeName . $attributes . '>', $this->tk_obj_from_node($subnode, FALSE, TRUE), '</' . $subnode->nodeName . '>'); // Text } else { if ($subnode->nodeType == XML_TEXT_NODE && trim($subnode_value) != '') { $params['content'][$i] = __(trim($subnode_value), $tkf_text_domain); if ($tkf_create_textfiles) { tk_add_text_string(trim($subnode_value)); } } } } /* * Calling function / Returning value */ if (FALSE != $function_name) { $params = $this->cleanup_function_params($function_name, $params); $function_result = call_user_func_array('tk_db_' . $function_name, $params); return $function_result; } elseif ($is_html) { if (isset($params['content'])) { return $params['content']; } } else { return $params; } }