false); $file = wp_handle_upload($_FILES['arras-logo'], $overrides); if ( isset($file['error']) ) die( $file['error'] ); $url = $file['url']; $type = $file['type']; $file = $file['file']; $filename = basename($file); // Construct the object array $object = array( 'post_title' => $filename, 'post_content' => $url, 'post_mime_type' => $type, 'guid' => $url); // Save the data $arras_options->logo = wp_insert_attachment($object, $file); // Force generate the logo thumbnail $fullsizepath = get_attached_file($arras_options->logo); wp_update_attachment_metadata($arras_options->logo, wp_generate_attachment_metadata($arras_options->logo, $fullsizepath)); } } else { $arras_options->logo = ''; } $arras_options->save_options(); arras_update_options(); $notices = '

' . __('Your settings have been saved to the database.', 'arras') . '

'; } if ( isset($_REQUEST['reset']) ) { check_admin_referer('arras-admin'); delete_option('arras_options'); arras_flush_options(); $notices = '

' . __('Your settings have been reverted to the defaults.', 'arras') . '

'; } if ( isset($_REQUEST['clearcache']) ) { check_admin_referer('arras-admin'); $cache_location = get_template_directory() . '/library/cache'; if ( !$dh = @opendir($cache_location) ) return false; while ( false !== ($obj = readdir($dh)) ) { if($obj == '.' || $obj == '..') continue; @unlink(trailingslashit($cache_location) . $obj); } closedir($dh); $notices = '

' . __('Thumbnail cache has been cleared.', 'arras') . '

'; } include 'templates/options_page.php'; } } function arras_admin_scripts() { wp_enqueue_script('jquery-ui-tabs', null, 'jquery-ui-core'); wp_enqueue_script('arras-admin-js', get_template_directory_uri() . '/js/admin.js'); } function arras_admin_styles() { ?> 'Arras Theme Feed Grabber' . ARRAS_VERSION . '; (' . get_bloginfo('url') .')' ); $response = wp_remote_request($url, $options); if ( is_wp_error( $response ) ) return false; if ( 200 != $response['response']['code'] ) return false; $content = unserialize($response['body']); if (is_array($content)) return $content; } return false; } function arras_get_contributors($arr) { ksort($arr); $i = count($arr); foreach ($arr as $name => $url) { if ($url) echo "$name"; else echo $name; $i--; if ($i == 1) echo " & "; elseif ($i) echo ", "; } } /* End of file admin.php */ /* Location: ./library/admin/admin.php */