// Sanitize the ability description and quote texts if (isset($form_data['ability_description'])) { $form_data['ability_description'] = trim(preg_replace('/\\s+/', ' ', strip_tags($form_data['ability_description']))); } if (isset($form_data['ability_description2'])) { $form_data['ability_description2'] = trim(preg_replace('/\\s+/', ' ', strip_tags($form_data['ability_description2']))); } // Trim the ability load, trigger, and effect function file names and encode their argument data $temp_func_types = array('load', 'trigger', 'effect'); foreach ($temp_func_types as $type) { //echo('<pre>$type = '.print_r($type, true).'</pre>'); if (isset($form_data['ability_' . $type . '_function'])) { $form_data['ability_' . $type . '_function'] = !empty($form_data['ability_' . $type . '_function']) ? trim($form_data['ability_' . $type . '_function']) : ''; if (!empty($form_data['ability_' . $type . '_function']) && isset($form_data['ability_' . $type . '_arguments'])) { $temp_path = $form_data['ability_' . $type . '_function']; $temp_meta = rpg_functions::parse_action_meta($temp_path); $temp_raw_args = !empty($form_data['ability_' . $type . '_arguments']) ? $form_data['ability_' . $type . '_arguments'] : array(); $temp_clean_args = array(); if (!empty($temp_meta['arguments'])) { foreach ($temp_meta['arguments'] as $key => $arg) { $token = $arg['token']; $default = $arg['default']; if (isset($temp_raw_args[$token])) { $value = $temp_raw_args[$token]; switch ($arg['datatype']) { case 'bool': case 'boolean': $value = $value ? 1 : 0; break; case 'int': case 'integer':
$it = new RecursiveDirectoryIterator($action_root.'abilities/'); foreach(new RecursiveIteratorIterator($it) AS $file) { $clean_path = "{$file}"; if (substr($clean_path, -1, 1) == '.'){ continue; } $clean_path = str_replace("\\", "/", $clean_path); $clean_path = str_replace($action_root, '', $clean_path); $action_file_paths[] = $clean_path; } // Collect and parse the name, description, and variable info from the file $action_file_meta = array(); $action_file_templates = array(); foreach ($action_file_paths AS $key => $action_path){ // Generate action meta data from the function $action_meta = rpg_functions::parse_action_meta($action_path); // Append this meta to the overall index $action_file_meta[$action_path] = $action_meta; } // Print out the tab headers for the different function sections ?> <div class="section tablinks" data-group="functions"> <div class="tabwrap"> <? // Loop through and display tab links for the various alts $action_key = 0; foreach ($ability_action_index AS $action_token => $action_info){ // Print out the markup for this link tab