Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2012
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 24.62 KB | None | 0 0
  1.  
  2. <?php
  3. /**
  4.  * Theme Setup.
  5.  *
  6.  * You can change any of the settings below from a child theme, by simply calling these functions inside the child theme's functions.php file.
  7.  * To override all settings define the ATOM_OVERRIDE_CONFIG constant as "true"
  8.  *
  9.  * @package ATOM
  10.  * @subpackage Template
  11.  */
  12.  
  13. // theme unique ID, used as theme option name, text domain for translations, and possibly other identifiers
  14. // make sure there are no spaces in it if you're setting your own ID inside a child theme
  15. defined('ATOM') or define('ATOM', get_stylesheet());
  16.  
  17. // enable development mode? (loads local & uncompressed js, disables w3c validation in debug mode)
  18. // for testing purposes only; always set this to false on a live site
  19. defined('ATOM_DEV_MODE') or define('ATOM_DEV_MODE', (isset($_SERVER['SERVER_ADDR']) && strpos($_SERVER['SERVER_ADDR'], '127.0.0.1') !== false));
  20.  
  21. // attempt to automatically create and activate a child theme on 1st install or reset;
  22. // if succesfull the user-functions field is enabled in the theme settings;
  23. defined('ATOM_EXTEND') or define('ATOM_EXTEND', true);
  24.  
  25. // log post views (just like wp-post-views) ?
  26. // on a very large site this can cause server load issues since the database is updated on each page view...
  27. defined('ATOM_LOG_VIEWS') or define('ATOM_LOG_VIEWS', false);
  28.  
  29. // track user online status?
  30. defined('ATOM_TRACK_USERS') or define('ATOM_TRACK_USERS', true);
  31.  
  32. // compress and concatenate js with Google's Closure Compiler?
  33. // seems to fail on certain setups...
  34. defined('ATOM_CONCATENATE_JS') or define('ATOM_CONCATENATE_JS', false);
  35.  
  36. // required for compatibility with Mystique < 3.2 child themes and modules
  37. define('ATOM_COMPAT_MODE', true);
  38.  
  39. // the core; if you're reconfiguring Atom from a child theme, this line must be present as well
  40. require_once TEMPLATEPATH.'/atom-core.php';
  41.  
  42. // and this function
  43. if(!function_exists('atom')){
  44.   function atom(){
  45.     static $app;
  46.  
  47.     if(!($app instanceof Atom))
  48.       $app = Atom::app();
  49.  
  50.     return $app;
  51.   }
  52. }
  53.  
  54. // any of the settings below can be overridden from a child theme if this constant is present and set to "true"
  55. if(!defined('ATOM_OVERRIDE_CONFIG') || !ATOM_OVERRIDE_CONFIG){
  56.  
  57.   // available layout types -- @todo: finish this
  58.   atom()->registerLayoutTypes('c1', 'c2left', 'c2right', 'c3', 'c3left', 'c3right');
  59.  
  60.   // menu locations
  61.   atom()->registerMenus(array(
  62.     'top'       => atom()->t('Page Top'),
  63.     'primary'   => atom()->t('Below Header (Main)'),
  64.     'footer'    => atom()->t('Above Footer')
  65.   ));
  66.  
  67.   // A. somente nos posts
  68.   add_theme_support('post-thumbnails');
  69.   add_theme_support('automatic-feed-links');
  70.   add_theme_support('bbpress');
  71.   add_theme_support('post-formats', array('aside', 'gallery'));
  72.  
  73.   atom()->registerDefaultOptions(array(
  74.     'layout'                       => 'c2right',
  75.     'page_width'                   => 'fixed',
  76.     'page_width_max'               => 1200,
  77.     'dimensions_fixed_c2left'      => '320',
  78.     'dimensions_fixed_c2right'     => '640',
  79.     'dimensions_fixed_c3'          => '240;720',
  80.     'dimensions_fixed_c3left'      => '240;480',
  81.     'dimensions_fixed_c3right'     => '480;720',
  82.     'dimensions_fluid_c2left'      => '30',
  83.     'dimensions_fluid_c2right'     => '70',
  84.     'dimensions_fluid_c3'          => '25;75',
  85.     'dimensions_fluid_c3left'      => '25;50',
  86.     'dimensions_fluid_c3right'     => '50;75',
  87.     'favicon'                      => atom()->getThemeURL().'/favicon.ico',
  88.     'logo'                         => '',
  89.     'color_scheme'                 => 'green',
  90.     'background_image'             => '',
  91.     'background_color'             => '000000',
  92.     'background_image_selector'    => '#page',    // internal (only change if you alter the selector name in the html templates / css)
  93.     'background_color_selector'    => 'body',     // internal, same...
  94.     'footer_content'               => '<p> [credit] | [link rss] </p>',
  95.     'post_title'                   => true,
  96.     'post_date'                    => true,
  97.     'post_date_mode'               => 'relative',
  98.     'post_category'                => true,
  99.     'post_tags'                    => true,
  100.     'post_author'                  => true,
  101.     'post_comments'                => true,
  102.     'post_content'                 => true,
  103.     'post_content_mode'            => 'f',
  104.     'post_content_size'            => 600,
  105.     'post_thumbs'                  => true,
  106.     'post_thumbs_mode'             => 'left',
  107.     'post_thumb_size'              => '90x90',
  108.     'post_thumb_auto'              => true,
  109.     'post_navi'                    => 'single',
  110.     'single_links'                 => true,
  111.     'single_meta'                  => true,
  112.     'single_share'                 => true,
  113.     'single_author'                => false,
  114.     'single_related'               => true,
  115.     'comment_karma'                => true,
  116.     'comment_bury_limit'           => -5,
  117.     'widget_icon_size'             => '42x38', // internal, each theme should define its own size
  118.     'css'                          => '',
  119.     'jquery'                       => true,
  120.     'effects'                      => true,
  121.     'optimize'                     => false,
  122.     'generate_thumbs'              => true,
  123.     'lightbox'                     => true,
  124.     'debug'                        => false,
  125.     'meta_description'             => true,
  126.     'remove_settings'              => false,
  127.   ));
  128.  
  129.   atom()->registerWidgetArea(array(
  130.     'id'            => 'sidebar1',
  131.     'name'          => atom()->t('Primary Sidebar'),
  132.     'description'   => atom()->t('This is the default sidebar, active on 2 or 3 column layouts. If no widgets are visible, the page will fall back to a single column layout.'),
  133.     'before_widget' => '<li class="block"><div class="block-content block-%2$s clear-block" id="instance-%1$s">',
  134.     'after_widget'  => '</div></li>',
  135.     'before_title'  => '<div class="title"><h3>',
  136.     'after_title'   => '</h3><div class="bl"></div><div class="br"></div></div><div class="i"></div>',
  137.   ));
  138.  
  139.   atom()->registerWidgetArea(array(
  140.     'id'            => 'sidebar2',
  141.     'name'          => atom()->t('Secondary Sidebar'),
  142.     'description'   => atom()->t('This sidebar is active only on a 3 column setup, if at least one of its widgets is visible to the current user.'),
  143.     'before_widget' => '<li class="block"><div class="block-content block-%2$s clear-block" id="instance-%1$s">',
  144.     'after_widget'  => '</div></li>',
  145.     'before_title'  => '<div class="title"><h3>',
  146.     'after_title'   => '</h3><div class="bl"></div><div class="br"></div></div><div class="i"></div>',
  147.   ));
  148.  
  149.   atom()->registerWidgetArea(array(
  150.     'id'            => 'footer1',
  151.     'name'          => atom()->t('Footer'),
  152.     'description'   => atom()->t('Active only if at least one of its widgets is visible to the current user. You can add between 1 and 6 widgets here (3 or 4 are optimal). They will adjust their size based on the widget count.'),
  153.     'before_widget' => '<li class="block block-%2$s" id="instance-%1$s"><div class="block-content clear-block">',
  154.     'after_widget'  => '</div></li>',
  155.     'before_title'  => '<h4 class="title">',
  156.     'after_title'   => '</h4>'
  157.   ));
  158.  
  159.   atom()->registerWidgetArea(array(
  160.     'id'            => 'arbitrary',
  161.     'name'          => atom()->t('Arbitrary Widgets'),
  162.     'description'   => atom()->t('Widgets from this area can be grouped into tabs, or added into posts/pages using the %1$s or %2$s shortcodes.', array('[widget ID]', '[widget "Name"]')),
  163.     'before_widget' => '<div class="block"><div class="block-content block-%2$s clear-block" id="instance-%1$s">',
  164.     'after_widget'  => '</div></div>',
  165.     'before_title'  => '<h3 class="title"><span>',
  166.     'after_title'   => '</span></h3>',
  167.   ));
  168.  
  169.   // theme settings interface
  170.   if(is_admin()){
  171.  
  172.     // tabs and tab sub-sections
  173.     atom()->interface->addSection('welcome',          atom()->t('Welcome'));
  174.     atom()->interface->addSection('design',           atom()->t('Design'));
  175.     atom()->interface->addSection('content',          atom()->t('Content options'));
  176.     atom()->interface->addSection('content/post',     atom()->t('Post teasers'));
  177.     atom()->interface->addSection('content/single',   atom()->t('Single pages'));
  178.     atom()->interface->addSection('content/comment',  atom()->t('Comments'));
  179.     atom()->interface->addSection('content/footer',   atom()->t('Footer'));
  180.     atom()->interface->addSection('css',              atom()->t('CSS'));
  181.     atom()->interface->addSection('advanced',         atom()->t('Advanced'));
  182.     atom()->interface->addSection('modules',          atom()->t('Modules'));
  183.  
  184.     // options, as form fields
  185.     atom()->interface->addControls(array(
  186.  
  187.       // content options: titles on post teasers
  188.       'post_title'          => array(
  189.                                  'location'    => 'content/post',
  190.                                  'type'        => 'checkbox',
  191.                                  'label'       => atom()->t('Title'),
  192.                                ),
  193.  
  194.       // content options: content on post teasers
  195.       'post_content'        => array(
  196.                                  'location'    => 'content/post',
  197.                                  'type'        => 'checkbox',
  198.                                  'label'       => atom()->t('Content'),
  199.                                ),
  200.  
  201.       // content options: content display mode
  202.       'post_content_mode'   => array(
  203.                                  'location'    => 'content/post/post_content',
  204.                                  'depends_on'  => 'post_content',
  205.                                  'type'        => 'select',
  206.                                  'values'      => array(
  207.                                    'user'        => atom()->t('User limit'),
  208.                                    'f'           => atom()->t('Full post'),
  209.                                    'ff'          => atom()->t('Full post, filtered'),
  210.                                    'e'           => atom()->t('Excerpt'),
  211.                                  ),
  212.                                ),
  213.  
  214.       // content options: content limit
  215.       'post_content_size'   => array(
  216.                                  'location'    => 'content/post/post_content',
  217.                                  'depends_on'  => 'post_content_mode BEING user',
  218.                                  'type'        => 'text:5',
  219.                                  'label'       => atom()->t('~ %s characters', '%post_content_size%'),
  220.                                ),
  221.  
  222.       // content options: show category links on post teasers
  223.       'post_category'       => array(
  224.                                  'location'    => 'content/post',
  225.                                  'type'        => 'checkbox',
  226.                                  'label'       => atom()->t('Category'),
  227.                                ),
  228.  
  229.       // content options: show date on post teasers
  230.       'post_date'           => array(
  231.                                  'location'    => 'content/post',
  232.                                  'type'        => 'checkbox',
  233.                                  'label'       => atom()->t('Date / Time'),
  234.                                ),
  235.  
  236.       // content options: date display mode
  237.       'post_date_mode'      => array(
  238.                                  'location'    => 'content/post/post_date',
  239.                                  'depends_on'  => 'post_date',
  240.                                  'type'        => 'select',
  241.                                  'values'      => array(
  242.                                    'relative'    => atom()->t('Relative'),
  243.                                    'absolute'    => atom()->t('Absolute'),
  244.                                  ),
  245.                                ),
  246.  
  247.       // content options: show author link on post teasers
  248.       'post_author'         => array(
  249.                                  'location'    => 'content/post',
  250.                                  'type'        => 'checkbox',
  251.                                  'label'       => atom()->t('Author'),
  252.                                ),
  253.  
  254.       // content options: comments link on post teasers
  255.       'post_comments'       => array(
  256.                                  'location'    => 'content/post',
  257.                                  'type'        => 'checkbox',
  258.                                  'label'       => atom()->t('Comment Count'),
  259.                                ),
  260.  
  261.       // content options: tag links on post teasers
  262.       'post_tags'           => array(
  263.                                  'location'    => 'content/post',
  264.                                  'type'        => 'checkbox',
  265.                                  'label'       => atom()->t('Tags'),
  266.                                ),
  267.  
  268.       // content options: thumbnails on post teasers
  269.       'post_thumbs'         => array(
  270.                                  'location'    => 'content/post',
  271.                                  'type'        => 'checkbox',
  272.                                  'label'       => atom()->t('Thumbnails'),
  273.                                ),
  274.  
  275.       // content options: alignment of on post thumbnails
  276.       'post_thumbs_mode'    => array(
  277.                                  'location'    => 'content/post/post_thumbs',
  278.                                  'depends_on'  => 'post_thumbs',
  279.                                  'type'        => 'select',
  280.                                  'values'      => array(
  281.                                    'left'        => atom()->t('Left Aligned'),
  282.                                    'right'       => atom()->t('Right Aligned'),
  283.                                  ),
  284.                                ),
  285.  
  286.       // content options: size of post thumbnails
  287.       'post_thumb_size'     => array(
  288.                                  'location'    => 'content/post',
  289.                                  'depends_on'  => 'post_thumbs',
  290.                                  'type'        => 'select',
  291.                                  'label'       => atom()->t('Thumbnail Size'),
  292.                                  'description' => atom()->t('Note that for the new sized thumbnails to take effect, all existing images must be resized. See the Advanced page.'),
  293.                                  'values'      => array(
  294.                                    '60x60'       => atom()->t('Very Small, 60 x 60'),
  295.                                    '90x90'       => atom()->t('Small, 90 x 90'),
  296.                                    '120x120'     => atom()->t('Medium, 120 x 120'),
  297.                                    '140x140'     => atom()->t('Large, 140 x 140'),
  298.                                    '180x180'     => atom()->t('Larger, 180 x 180'),
  299.                                    '210x210'     => atom()->t('Very large, 210 x 210'),
  300.                                    'media'       => atom()->t('Default media setting: %d x %d', array(get_option('thumbnail_size_w'), get_option('thumbnail_size_h'))),
  301.                                  ),
  302.                                ),
  303.  
  304.       // content options: automatically select thumbnails from first image
  305.       'post_thumb_auto'     => array(
  306.                                  'location'    => 'content/post',
  307.                                  'type'        => 'checkbox',
  308.                                  'label'       => atom()->t('Use first attachment as thumbnail, if none is set'),
  309.                                ),
  310.  
  311.       // content options: display mode of navigation links
  312.       'post_navi'           => array(
  313.                                  'location'    => 'content/post',
  314.                                  'type'        => 'select',
  315.                                  'label'       => atom()->t('Navigation'),
  316.                                  'values'      => array(
  317.                                    'single'      => atom()->t('Single link for older posts'),
  318.                                    'prevnext'    => atom()->t('Previous / Next links'),
  319.                                    'numbers'     => atom()->t('Page numbers'),
  320.                                  ),
  321.                                ),
  322.  
  323.       // comments: enable/disable karma ratings
  324.       'comment_karma'       => array(
  325.                                  'location'    => 'content/comment',
  326.                                  'type'        => 'checkbox',
  327.                                  'label'       => atom()->t('Allow Comment Ratings (Karma)'),
  328.                                ),
  329.  
  330.       // comments: hide or show low-karma comments
  331.       'comment_bury_limit'  => array(
  332.                                  'location'    => 'content/comment',
  333.                                  'type'        => 'text:5',
  334.                                  'depends_on'  => 'comment_karma',
  335.                                  'label'       => atom()->t('Hide comments with %s karma and below', array('%comment_bury_limit%')),
  336.                                ),
  337.  
  338.       // single: post navigation for single pages
  339.       'single_links'        => array(
  340.                                  'location'    => 'content/single',
  341.                                  'type'        => 'checkbox',
  342.                                  'label'       => atom()->t('Previous / Next links'),
  343.                                ),
  344.  
  345.       // single: share links on single pages
  346.       'single_share'        => array(
  347.                                  'location'    => 'content/single',
  348.                                  'type'        => 'checkbox',
  349.                                  'label'       => atom()->t('Share Links'),
  350.                                ),
  351.  
  352.       // single: meta info on single pages
  353.       'single_meta'         => array(
  354.                                  'location'    => 'content/single',
  355.                                  'type'        => 'checkbox',
  356.                                  'label'       => atom()->t('Meta Information'),
  357.                                ),
  358.  
  359.       // single: about the author info on single pages
  360.       'single_author'       => array(
  361.                                  'location'    => 'content/single',
  362.                                  'type'        => 'checkbox',
  363.                                  'label'       => atom()->t('About the Author'),
  364.                                ),
  365.  
  366.       // single: related posts
  367.       'single_related'      => array(
  368.                                  'location'    => 'content/single',
  369.                                  'type'        => 'checkbox',
  370.                                  'label'       => atom()->t('Related Posts'),
  371.                                ),
  372.  
  373.       // footer: contents of the footer (last block area)
  374.       'footer_content'      => array(
  375.                                  'location'    => 'content/footer',
  376.                                  'type'        => 'text/code/html',
  377.                                  'description' => atom()->t('Use %s for convenient adjustments', array(sprintf('<code>[%s]</code>', atom()->t('shortcodes')))),
  378.                                ),
  379.  
  380.       // advanced: jquery
  381.       'jquery'              => array(
  382.                                  'location'    => 'advanced',
  383.                                  'type'        => 'checkbox',
  384.                                  'label'       => atom()->t('Use jQuery'),
  385.                                  'description' => atom()->t("Only uncheck if you know what you're doing. Your site will load faster without jQuery, but features that depend on it will be disabled."),
  386.                                ),
  387.  
  388.       // advanced: effects
  389.       'effects'             => array(
  390.                                  'location'    => 'advanced',
  391.                                  'type'        => 'checkbox',
  392.                                  'depends_on'  => 'jquery',
  393.                                  'label'       => atom()->t('Animate content'),
  394.                                  'description' => atom()->t('Enable jQuery effects such as fading or sliding. Effects can render the site slightly slower on less powerful PCs'),
  395.                                ),
  396.  
  397.       // advanced: optimize
  398.       'optimize'            => array(
  399.                                  'location'    => 'advanced',
  400.                                  'type'        => 'checkbox',
  401.                                  'cap'         => 'edit_themes', // this option is slightly sensitive, so we only enable editing for users who can access the editor (usually super-admins)
  402.                                  'label'       => atom()->t('Optimize website for faster loading'),
  403.                                  'description' => atom()->t("Compresses and concatenates stylesheets and javascript files (using %s). Leave this unchecked if you're experiencing conflicts with other plugins, or if you're using a cache plugin that handles such functions"),
  404.                                ),
  405.  
  406.       // advanced: auto (re-)generate missing thumbnails
  407.       'generate_thumbs'     => array(
  408.                                  'location'    => 'advanced',
  409.                                  'type'        => 'checkbox',
  410.                                  'depends_on'  => 'jquery',
  411.                                  'label'       => atom()->t('Automatically create missing thumbnail sizes'),
  412.                                  'description' => atom()->t('Asynchronously update thumbnails if needed. You can also use the %s plugin to process all missing thumbnail sizes manually, in a single pass', array('<a href="http://wordpress.org/extend/plugins/regenerate-thumbnails/" target="_blank">Regenerate Thumbnails</a>')),
  413.                                ),
  414.  
  415.       // advanced: use built-in lightbox
  416.       'lightbox'            => array(
  417.                                  'location'    => 'advanced',
  418.                                  'type'        => 'checkbox',
  419.                                  'depends_on'  => 'jquery',
  420.                                  'label'       => atom()->t('Use theme built-in lightbox on all image links'),
  421.                                  'description' => atom()->t('Uncheck if you prefer a lightbox plugin'),
  422.                                ),
  423.  
  424.       // advanced: auto-generate meta descriptions
  425.       'meta_description'    => array(
  426.                                  'location'    => 'advanced',
  427.                                  'type'        => 'checkbox',
  428.                                  'label'       => atom()->t('Automatically generate meta descriptions'),
  429.                                  'description' => atom()->t("Uncheck if you're using a SEO plugin, otherwise you'll get duplicate fields! Note that you don't need such plugins, %s is heavily optimized for search engines", array(atom()->getThemeName())),
  430.                                ),
  431.  
  432.       // advanced: debug info
  433.       'debug'               => array(
  434.                                  'location'    => 'advanced',
  435.                                  'type'        => 'checkbox',
  436.                                  'label'       => atom()->t('Display debug messages (english only)'),
  437.                                  'description' => atom()->t('Status notifications about the theme setup (only visible to administrators). Only enable this when you need to, because it can significantly slow down page load for admins'),
  438.                                ),
  439.  
  440.       // advanced: auto-uninstall
  441.       'remove_settings'     => array(
  442.                                  'location'    => 'advanced',
  443.                                  'type'        => 'checkbox',
  444.                                  'label'       => atom()->t('Theme auto-uninstall'),
  445.                                  'description' => atom()->t('Check to remove all %s settings from the database after you switch to a different theme (Featured post records are preserved).', array(atom()->getThemeName())),
  446.                                ),
  447.  
  448.     ));
  449.  
  450.   }
  451.  
  452.   /*** Mystique-specific settings / hooks ***/
  453.  
  454.   // append arrow pointers inside primary menu items
  455.   atom()->addContextArgs('primary_menu', array('link_after' => '<span class="p"></span>'));
  456.  
  457.   atom()->add('sync_options', 'mystique_sync_old_options', 10, 3);
  458.  
  459.   function mystique_sync_old_options($old_version, $defaults, $old_options){
  460.  
  461.     // completely reset settings from the database if version is older than 3.0,
  462.     // because almost none of the older settings are relevant in 3+
  463.     if(version_compare($old_version, '3.0', '<')){
  464.       atom()->reset();
  465.     }
  466.  
  467.     /*
  468.     // some of the 3.2+ option names are different
  469.     // we need to safely update them -- not now...
  470.     elseif(version_compare($old_version, '3.1', '<')){
  471.       // we're changing the option ID
  472.       $old_id = get_stylesheet();
  473.       $old_options = get_option($old_id);
  474.  
  475.       if($old_id !== 'mystique'){
  476.         atom()->setOptions($old_options);
  477.         delete_option($old_id);
  478.       }
  479.  
  480.     }
  481.     */
  482.   }
  483.  
  484. }
  485.  
  486. remove_action(‘wp_head’,' wp_generator’);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement