function arras_admin() { global $arras_options; $notices = ''; // store notices here so that options_page.php will echo it out later if (isset($_GET['page']) && $_GET['page'] == 'arras-options') { //print_r($_POST); if (isset($_REQUEST['save'])) { $arras_options->save_options(); arras_update_options(); $notices = '<div class="updated"><p>' . __('Your settings have been saved to the database.', 'arras') . '</p></div>'; } if (isset($_REQUEST['reset'])) { delete_option('arras_options'); arras_flush_options(); $notices = '<div class="updated"><p>' . __('Your settings have been reverted to the defaults.', 'arras') . '</p></div>'; } if (isset($_REQUEST['clearcache'])) { $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 = '<div class="updated"><p>' . __('Thumbnail cache has been cleared.', 'arras') . '</p></div>'; } $nonce = wp_create_nonce('arras-admin'); // create nonce token for security include 'templates/options_page.php'; } }
function arras_get_option($name) { global $arras_options; if (!is_object($arras_options)) { arras_flush_options(); } return $arras_options->{$name}; }
function arras_admin_reset() { global $notices; check_admin_referer('arras-admin'); delete_option('arras_options'); arras_flush_options(); do_action('arras_admin_reset'); $notices = '<div class="updated fade"><p>' . __('Your settings have been reverted to the defaults.', 'arras') . '</p></div>'; }
function arras_setup() { /* Load theme options (to be revamped) */ require_once ARRAS_LIB . '/admin/options.php'; require_once ARRAS_LIB . '/admin/templates/functions.php'; arras_flush_options(); /* Load theme library files */ require_once ARRAS_LIB . '/actions.php'; require_once ARRAS_LIB . '/deprecated.php'; require_once ARRAS_LIB . '/filters.php'; require_once ARRAS_LIB . '/tapestries.php'; require_once ARRAS_LIB . '/template.php'; require_once ARRAS_LIB . '/thumbnails.php'; require_once ARRAS_LIB . '/styles.php'; require_once ARRAS_LIB . '/slideshow.php'; require_once ARRAS_LIB . '/widgets.php'; if (is_admin()) { require_once ARRAS_LIB . '/admin/admin.php'; } require_once ARRAS_LIB . '/admin/background.php'; /* Post meta fields */ define('ARRAS_REVIEW_SCORE', 'score'); define('ARRAS_REVIEW_PROS', 'pros'); define('ARRAS_REVIEW_CONS', 'cons'); define('ARRAS_CUSTOM_FIELDS', false); /* Langauge support */ load_theme_textdomain('arras', TEMPLATEPATH . '/language'); $locale = get_locale(); $locale_file = TEMPLATEPATH . "/languages/{$locale}.php"; if (is_readable($locale_file)) { require_once $locale_file; } /* Theme support */ add_theme_support('post-thumbnails'); add_theme_support('nav-menus'); add_theme_support('automatic-feed-links'); /* Menus locations */ register_nav_menus(array('main-menu' => __('Main Menu', 'arras'), 'top-menu' => __('Top Menu', 'arras'))); /* Thumbnail sizes */ arras_add_default_thumbnails(); /* Register sidebars */ arras_add_sidebars(); /* Custom layouts & styles */ if (!defined('ARRAS_INHERIT_STYLES') || ARRAS_INHERIT_STYLES == true) { add_action('arras_custom_styles', 'arras_layout_styles'); } if (!defined('ARRAS_INHERIT_LAYOUT') || ARRAS_INHERIT_LAYOUT == true) { // Alternate Styles & Layouts register_alternate_layout('1c-fixed', __('1 Column Layout (No Sidebars)', 'arras')); register_alternate_layout('2c-r-fixed', __('2 Column Layout (Right Sidebar)', 'arras')); register_alternate_layout('2c-l-fixed', __('2 Column Layout (Left Sidebar)', 'arras')); register_alternate_layout('3c-fixed', __('3 Column Layout (Left & Right Sidebars)', 'arras')); register_alternate_layout('3c-r-fixed', __('3 Column Layout (Right Sidebars)', 'arras')); register_style_dir(TEMPLATEPATH . '/css/styles/'); } /* Header actions */ remove_action('wp_head', 'pagenavi_css'); add_action('arras_head', 'arras_override_styles'); add_action('arras_custom_styles', 'arras_add_custom_logo'); add_action('arras_custom_styles', 'arras_constrain_footer_sidebars'); add_action('arras_custom_styles', 'arras_add_custom_background'); add_action('arras_beside_nav', 'arras_social_nav'); add_action('wp_head', 'arras_load_styles', 1); add_action('wp_head', 'arras_head'); add_action('wp_head', 'arras_add_facebook_share_meta'); add_action('wp_head', 'arras_add_header_js'); add_action('wp_footer', 'arras_add_footer_js'); /* Filters */ add_filter('arras_postheader', 'arras_post_taxonomies'); add_filter('gallery_style', 'remove_gallery_css'); if (defined('ARRAS_CUSTOM_FIELDS') && ARRAS_CUSTOM_FIELDS == true) { add_filter('arras_postheader', 'arras_postmeta'); } /* Admin actions */ if (is_admin()) { add_action('admin_menu', 'arras_addmenu'); } /* Max image size */ $max_image_size = arras_get_single_thumbs_size(); $content_width = $max_image_size[0]; /* For child themes overrides */ do_action('arras_setup'); // print_r($arras_options); }
define(ARRAS_POST_THUMBNAIL, 'thumb'); define(ARRAS_REVIEW_SCORE, 'score'); define(ARRAS_REVIEW_PROS, 'pros'); define(ARRAS_REVIEW_CONS, 'cons'); // Define thumbnail width and height define(ARRAS_2COL_MINI_WIDTH, '190'); define(ARRAS_2COL_MINI_HEIGHT, '100'); define(ARRAS_2COL_FULL_WIDTH, '630'); define(ARRAS_2COL_FULL_HEIGHT, '250'); define(ARRAS_3COL_MINI_WIDTH, '220'); define(ARRAS_3COL_MINI_HEIGHT, '100'); define(ARRAS_3COL_FULL_WIDTH, '480'); define(ARRAS_3COL_FULL_HEIGHT, '225'); // Define PHP file constants define(ARRAS_DIR, TEMPLATEPATH); define(ARRAS_LIB, ARRAS_DIR . '/library'); define(ARRAS_VERSION, $parent_data['Version']); // Thumbnail generator define(ARRAS_THUMB, 'timthumb'); // Load library files require_once ARRAS_LIB . '/actions.php'; require_once ARRAS_LIB . '/filters.php'; require_once ARRAS_LIB . '/template.php'; require_once ARRAS_LIB . '/styles.php'; require_once ARRAS_LIB . '/widgets-legacy.php'; require_once ARRAS_LIB . '/admin/options.php'; arras_flush_options(); if (is_admin()) { require_once ARRAS_LIB . '/admin/admin.php'; } require_once ARRAS_LIB . '/launcher.php';
function arras_get_option($name) { global $arras_options; if (!is_object($arras_options)) { arras_flush_options(); } if (isset($arras_options->{$name})) { return $arras_options->{$name}; } elseif (isset($arras_options->defaults[$name])) { return $arras_options->defaults[$name]; } }