function wptouch_prune_backup_files($amount = 2) { require_once WPTOUCH_DIR . '/core/file-operations.php'; $all_files = wptouch_get_files_in_directory(WPTOUCH_BACKUP_DIRECTORY, '.txt'); if (is_array($all_files) && count($all_files)) { $file_data = array(); foreach ($all_files as $backup_file) { $file_data[filemtime($backup_file)] = $backup_file; } // Sort by file modification time in desc. order krsort($file_data); // Determine the files we want to delete $files_to_delete = array_diff_key($file_data, array_slice($file_data, 0, $amount, true)); foreach ($files_to_delete as $ftime => $file_name) { unlink($file_name); } } }
function wptouch_get_theme_preview_images() { require_once WPTOUCH_DIR . '/core/file-operations.php'; return wptouch_get_files_in_directory(WP_CONTENT_DIR . wptouch_get_theme_location() . '/preview', '.jpg', false); }
function create_icon_set_info($name, $desc, $author, $author_url, $url, $location, $dark = false) { $icon_pack_info = new stdClass(); $icon_pack_info->name = $name; $icon_pack_info->description = $desc; // Check to see if we have an author. It's not required that you do, i.e. in the case of Custom if ($author) { $icon_pack_info->author = $author; $icon_pack_info->author_url = $author_url; } $icon_pack_info->url = $url; $icon_pack_info->location = $location; $icon_pack_info->class_name = wptouch_convert_to_class_name($icon_pack_info->name); $icon_pack_info->dark_background = $dark; require_once WPTOUCH_DIR . '/core/file-operations.php'; $icon_pack_info->icons = wptouch_get_files_in_directory($location, 'png'); if (is_array($icon_pack_info->icons) && count($icon_pack_info->icons)) { $icon_pack_info->thumbnail = str_replace(WP_CONTENT_DIR, WP_CONTENT_URL, $icon_pack_info->icons[0]); } return $icon_pack_info; }