'nierstichting'); } if (file_exists($_404dir . $options['charity'] . '/index.php')) { define('DIR404PAGES', plugins_url() . '/404sponsoring/404pages/' . $options['charity'] . '/'); define('SITEHOME', get_bloginfo('wpurl') . '/'); include($_404dir . $options['charity'] . '/index.php'); exit; } else { // TODO can't display 404sponsoring page } } remove_all_actions('404_template'); add_action('404_template', 'spons404_show_template'); // thx: http://michael.tyson.id.au/smart-404 function smart404_redirect_canonical_filter($redirect, $request) { return (is_404()) ? false : $redirect; } add_filter('redirect_canonical', 'smart404_redirect_canonical_filter', 10, 2); ////////////////////////////////////////////// // Add link to settings in 'Manage plugins' // ////////////////////////////////////////////// function spons_set_plugin_meta($links, $file) { $plugin = basename(__FILE__); // create link if (basename($file) == $plugin) { return array_merge( array('' . __('Settings') . ''), $links ); } return $links; } add_filter('plugin_action_links', 'spons_set_plugin_meta', 10, 2); /////////////////// // Configuration // /////////////////// function spons_add_pages() { add_submenu_page('options-general.php', '404 sponsoring', '404 sponsoring', 8, basename(__FILE__), 'spons_options'); } function spons_get_settings($_file) { global $_404dir; $_page = array(); $_page['dirname'] = $_file; if (!file_exists($_404dir . $_file . '/index.php')) { return false; } $_settings = file_get_contents($_404dir . $_file . '/index.php'); $_settings = explode("\n", $_settings); foreach($_settings as $_s) { if (0 === strpos($_s, '404 Name:')) { $_page['displayname'] = trim(substr($_s, 9)); } else if (0 === strpos($_s, 'Version:')) { $_page['version'] = trim(substr($_s, 8)); } } return $_page; } function custom_colors_and_script() { ?>
Your settings have been updated.