'http://www.animeblog.nl/', 'dgodfather' => 'http://trusupremekillaz.com/tskgaming', 'Charles' => 'http://www.claireraborar.com/travel', 'Nedrago' => 'http://www.nedrago.com/', 'Dan' => 'http://www.techunfolding.com/' ); $translators = array( 'Celso Azevedo (Portuguese)' => '', 'Nolog (French)' => 'http://pookiecookie.fr/', 'kokaz84 (French)' => 'http://micromanga.free.fr/', 'er_mejor (Spanish)' => 'http://www.teusoft.com/', 'AddVariety (Dutch)' => 'http://www.addvariety.com/', 'Fredik Arvidsson (Swedish)' => 'http://www.fredrikarvidsson.com/', 'Michael Wenzl (German)' => 'http://www.michaelwenzl.de/', 'Michalis Pissas (Greek)' => '', 'chaibi (Norwegian)' => '', 'cngamers (Chinese)' => '', 'lesta (Romanian)' => '' ); $notices = ''; // store notices here so that options_page.php will echo it out later function arras_addmenu() { $options_page = add_menu_page( '', __('Arras', 'arras'), 'switch_themes', 'arras-options', 'arras_admin', get_template_directory_uri() . '/images/icon.png', 63); add_submenu_page( 'arras-options', __('Arras Options', 'arras'), __('Theme Options', 'arras'), 'switch_themes', 'arras-options', 'arras_admin' ); $posttax_page = add_submenu_page( 'arras-options', __('Post Types & Taxonomies', 'arras'), __('Post Types & Tax.', 'arras'), 'switch_themes', 'arras-posttax', 'arras_posttax' ); $custom_background_page = add_submenu_page( 'arras-options', __('Custom Background', 'arras'), __('Custom Background', 'arras'), 'switch_themes', 'arras-custom-background', 'arras_custom_background' ); add_action('admin_print_scripts-'. $options_page, 'arras_admin_scripts'); add_action('admin_print_styles-'. $options_page, 'arras_admin_styles'); add_action('admin_print_scripts-' . $posttax_page, 'arras_admin_scripts'); add_action('admin_print_styles-' . $posttax_page, 'arras_admin_styles'); add_action('admin_print_scripts-' . $custom_background_page, 'arras_custom_background_scripts'); add_action('admin_print_styles-' . $custom_background_page, 'arras_custom_background_styles'); } function arras_admin() { global $arras_options, $arras_image_sizes, $notices; if ( isset($_GET['page']) && $_GET['page'] == 'arras-options' ) { //print_r($_POST); if ( isset($_REQUEST['save']) ) { arras_admin_save(); } if ( isset($_REQUEST['reset']) ) { arras_admin_reset(); } 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') . '

'; } if ( isset($_REQUEST['arras-regen-thumbs']) ) { check_admin_referer('arras-admin'); echo '
'; screen_icon('themes'); ?>

'; } else { $arras_image_sizes = array(); arras_add_default_thumbnails(); include 'templates/options_page.php'; } } } function arras_admin_save() { global $arras_options, $arras_image_sizes, $notices; check_admin_referer('arras-admin'); if ( isset($_REQUEST['arras-tools-import']) && $_REQUEST['arras-tools-import'] != '' ) { $new_arras_options = maybe_unserialize(json_decode($_REQUEST['arras-tools-import'])); if (is_a($new_arras_options, 'Options')) { $arras_options = $new_arras_options; arras_update_options(); $notices = '

' . __('Your settings have been successfully imported.', 'arras') . '

'; } } else { if (!isset($_POST['arras-delete-logo'])) { if ($_FILES['arras-logo']['error'] != 4) { $overrides = array('test_form' => 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 = ''; } // Hack! $arras_options->layout = (string)$_POST['arras-layout-col']; $arras_image_sizes = array(); arras_add_default_thumbnails(); $arras_custom_image_sizes = array(); foreach ($arras_image_sizes as $id => $args) { if ( isset($_POST['arras-reset-thumbs']) && $_POST['arras-reset-thumbs'] ) { $arras_custom_image_sizes[$id]['w'] = $arras_image_sizes[$id]['dw']; $arras_custom_image_sizes[$id]['h'] = $arras_image_sizes[$id]['dh']; } else { $arras_custom_image_sizes[$id]['w'] = (int)($_POST['arras-' . $id . '-w']); $arras_custom_image_sizes[$id]['h'] = (int)($_POST['arras-' . $id . '-h']); } } $arras_options->custom_thumbs = $arras_custom_image_sizes; $arras_options->save_options(); arras_update_options(); do_action('arras_admin_save'); $notices = '

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

'; } } function arras_admin_reset() { global $notices; check_admin_referer('arras-admin'); delete_option('arras_options'); arras_flush_options(); do_action('arras_admin_reset'); $notices = '

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

'; } function arras_posttax() { global $arras_options, $notices; if ( isset($_GET['page']) && $_GET['page'] == 'arras-posttax' ) { if ( isset($_REQUEST['save']) ) { if ( isset($_REQUEST['type']) && $_REQUEST['type'] == 'posttype' ) { $arras_options->save_posttypes(); arras_update_options(); do_action('arras_admin_posttype_save'); $notices = '

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

'; } if ( isset($_REQUEST['type']) && $_REQUEST['type'] == 'taxonomy' ) { $arras_options->save_taxonomies(); arras_update_options(); do_action('arras_admin_taxonomy_save'); $notices = '

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

'; } } if ( isset($_REQUEST['type']) && $_REQUEST['type'] == 'taxonomy' ) { include 'templates/taxonomy_page.php'; } else { include 'templates/posttype_page.php'; } } } function arras_admin_scripts() { wp_enqueue_script('jquery-ui-custom', get_template_directory_uri() . '/js/jquery-ui-1.8.2.custom.min.js', null, 'jquery'); wp_enqueue_script('arras-admin-js', get_template_directory_uri() . '/js/admin.js'); wp_enqueue_script('jquery-multiselect', get_template_directory_uri() . '/js/jquery.multiselect.min.js', null, 'jquery'); } function arras_admin_styles() { ?> '; } else { echo ''; } } function get_remote_array($url) { if ( function_exists('wp_remote_request') ) { $options = array(); $options['headers'] = array( 'User-Agent' => 'Arras 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 ", "; } } function arras_right_col() { global $forum_contributors, $translators; ?>