/** * Lists installed client side form styles * * * @return * */ function getAvaliableStyles() { $ds = DIRECTORY_SEPARATOR; $styleroot = dirName(__FILE__) . $ds . 'forms' . $ds . 'styles'; $dirs = array(); $dir = dir($styleroot); $current = $this->get('Style'); while (($cdir = $dir->read()) !== false) { if ($cdir != '.' && $cdir != '..' && is_dir($styleroot . $ds . $cdir)) { $selected = $cdir == $current ? ' selected' : ''; $dirs[] = "<option{$selected}>{$cdir}</option>"; } } $dir->close(); $styleroot = ABSPATH . 'wp-content/plugins/easycontact_templates/easycontact_templates.php'; if (is_file($styleroot)) { require_once $styleroot; $dirs = easycontact_templates_getavaliablestyles($dirs, $current); } return implode('', $dirs); }
/** * Lists installed client side form styles * * @param $current * * * @return * */ function basicGetAvaliableStyles($current) { $ds = DIRECTORY_SEPARATOR; $styleroot = dirName(__FILE__) . $ds . 'forms' . $ds . 'styles'; $dirs = array(); $dir = dir($styleroot); while (($cdir = $dir->read()) !== false) { if ($cdir != '.' && $cdir != '..' && is_dir($styleroot . $ds . $cdir)) { $selected = $cdir == $current ? ' selected' : ''; $dirs[] = "<option{$selected}>{$cdir}</option>"; } } $dir->close(); $styleroot = str_replace('easy-contact-forms', 'easycontact_templates', plugin_dir_path(__FILE__)) . 'easycontact_templates.php'; if (is_file($styleroot)) { require_once $styleroot; $dirs = easycontact_templates_getavaliablestyles($dirs, $current); } return implode('', $dirs); }