Advertisement
Guest User

Untitled

a guest
Aug 19th, 2013
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 13.87 KB | None | 0 0
  1. <?php
  2. define('TEMPLATE_DOMAIN', 'business-feature');
  3. if ( ! function_exists( 'businessfeature_setup' ) ) :
  4. function businessfeature_setup() {
  5. global $options, $options2, $options3, $bp_existed, $multi_site_on;
  6.  
  7.     load_theme_textdomain('business-feature', get_template_directory() . '/languages/');
  8.     $locale = get_locale();
  9.     $locale_file = get_template_directory() . "/languages/$locale.php";
  10.     if ( is_readable( $locale_file ) )
  11.         require_once( $locale_file );
  12.  
  13.     global $content_width;
  14.     if ( ! isset( $content_width ) ) {
  15.         $content_width = 685;
  16.     }
  17.  
  18.     add_action( 'wp_enqueue_scripts', 'businessfeature_load_scripts' );
  19.     add_action( 'widgets_init', 'businessfeature_widgets_init' );
  20.     add_action( 'wp_enqueue_scripts', 'businessfeature_enqueue_styles' );
  21.     add_action( 'wp_head', 'businessfeature_themeoptions_output' );
  22.  
  23.     require( dirname( __FILE__ ) . '/library/functions/conditional-functions.php' );
  24.     if($bp_existed == 'true') {
  25.         require( dirname( __FILE__ ) . '/library/functions/bp-functions.php' );
  26.         add_filter( 'comment_form_defaults', 'wpmudev_comment_form', 10 );
  27.     }
  28.  
  29.     require( dirname( __FILE__ ) . '/library/functions/custom-functions.php' );
  30.     require( dirname( __FILE__ ) . '/library/functions/option-functions.php' );
  31.     require( dirname( __FILE__ ) . '/library/functions/loop-functions.php' );
  32.  
  33.     add_theme_support('automatic-feed-links');
  34. }
  35. endif;
  36. add_action( 'after_setup_theme', 'businessfeature_setup');
  37.  
  38. if ( ! function_exists( 'businessfeature_enqueue_styles' ) ) :
  39. function businessfeature_enqueue_styles(){
  40.     global $options, $options2, $options3, $bp_existed, $multi_site_on;
  41.     $version = '2';
  42.  
  43.     if ($bp_existed){
  44.         wp_enqueue_style( 'businessfeature-buddypress', get_template_directory_uri() . '/_inc/css/businessfeature-buddypress.css', array(), $version );
  45.     }
  46.  
  47.     wp_enqueue_style( 'businessfeature', get_template_directory_uri() . '/_inc/css/businessfeature.css', array(), $version );
  48. }
  49. endif;
  50.  
  51. if ( ! function_exists( 'businessfeature_load_scripts' ) ) :
  52. function businessfeature_load_scripts() {
  53.     $version = '2';
  54.     if ( !is_admin() ) {
  55.         wp_enqueue_script("jquery");
  56.         wp_enqueue_script( "hoverIntent", get_template_directory_uri() . "/library/scripts/hoverIntent.js" , $version);
  57.         wp_enqueue_script( "jquery-superfish", get_template_directory_uri() . "/library/scripts/superfish.js" , $version);
  58.         wp_enqueue_script( "jquery-supersubs", get_template_directory_uri() . "/library/scripts/supersubs.js" , $version);
  59.         if ( is_singular() && get_option( 'thread_comments' ) && comments_open() )
  60.         wp_enqueue_script( 'comment-reply' );
  61.     }
  62. }
  63. endif;
  64.  
  65. if ( ! function_exists( 'businessfeature_themeoptions_output' ) ) :
  66. function businessfeature_themeoptions_output(){
  67. include (get_template_directory() . '/library/options/options.php');
  68. $get_current_scheme = get_option('dev_businessfeature_custom_style');
  69. if($get_current_scheme == 'default.css') {
  70.  print "<style type='text/css' media='screen'>";
  71.  include (get_template_directory() . '/library/options/theme-options.php');
  72.         print "</style>";
  73. }
  74. ?>
  75. <?php
  76. function custom_remove_from_free_subscription( $tosub_id, $tolevel_id, $to_order, $user_id ) {
  77.         // check for the subscription id
  78.         if( $tosub_id == 3 ) {
  79.                 // It's the one we are interested in
  80.                 wp_mail('info@eltrendo.com', 'Here from paid sub', 'I have been fired by the paid subscription');
  81.                 // Get the member
  82.                 $member = new M_Membership( $user_id );
  83.                 // Check they are on the free subscription
  84.                 if( $member->on_sub( 5 ) ) {
  85.                         // Remove the subscription
  86.                         wp_mail('info@eltrendo.com', 'Found Free sub', 'I have found the free subscription');
  87.                         $member->drop_subscription( 5 );
  88.                 }
  89.         }
  90. }
  91. add_action( 'membership_add_subscription', 'custom_remove_from_free_subscription', 10, 4 );
  92. ?>
  93. <script type="text/javascript">
  94.                 jQuery(document).ready(function() {
  95.                    jQuery.noConflict();
  96.  
  97.                      // Put all your code in your document ready area
  98.                      jQuery(document).ready(function(){
  99.                        // Do jQuery stuff using $
  100.                         jQuery(function(){
  101.                          jQuery(".sf-menu").supersubs({
  102.                                     minWidth:    12,   // minimum width of sub-menus in em units
  103.                                     maxWidth:    27,   // maximum width of sub-menus in em units
  104.                                     extraWidth:  1     // extra width can ensure lines don't sometimes turn over
  105.                                                        // due to slight rounding differences and font-family
  106.                                 }).superfish();  // call supersubs first, then superfish, so that subs are
  107.                                                  // not display:none when measuring. Call before initialising
  108.                                                  // containing tabs for same reason.
  109.                         });
  110.                     });
  111.                 });
  112.             </script>
  113.             <link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/_inc/css/child.css" type="text/css" media="all" />
  114. <?php
  115. }
  116. endif;
  117. function businessfeature_widgets_init() {
  118.     global $options, $options2, $options3, $bp_existed, $multi_site_on;
  119.     register_sidebar(array(
  120.         'name' => __( 'home sidebar', 'business-feature'),
  121.         'id' => 'home-sidebar',
  122.         'description' => __( 'Home Sidebar', 'business-feature'),
  123.         'before_widget' => '<div id="%1$s" class="widget %2$s">',
  124.         'after_widget' => '</div>',
  125.         'before_title' => '<h3 class="widgettitle">',
  126.         'after_title' => '</h3>'
  127.     )
  128.     );
  129.  
  130. register_sidebar(array(
  131.     'name' => __( 'default sidebar', 'business-feature'),
  132.     'id' => 'default-sidebar',
  133.     'description' => __( 'Default Sidebar', 'business-feature'),
  134.     'before_widget' => '<div id="%1$s" class="widget %2$s">',
  135.     'after_widget' => '</div>',
  136.     'before_title' => '<h3 class="widgettitle">',
  137.     'after_title' => '</h3>'
  138. )
  139. );
  140.  
  141. register_sidebar(array(
  142.     'name' => __( 'blog sidebar', 'business-feature'),
  143.     'id' => 'blog-sidebar',
  144.     'description' => __( 'Home Sidebar', 'business-feature'),
  145.     'before_widget' => '<div id="%1$s" class="widget %2$s">',
  146.     'after_widget' => '</div>',
  147.     'before_title' => '<h3 class="widgettitle">',
  148.     'after_title' => '</h3>'
  149. )
  150. );
  151.  
  152. register_sidebar(array(
  153.     'name' => __( 'page-sidebar', 'business-feature'),
  154.     'id' => 'page-sidebar',
  155.     'description' => __( 'Page Sidebar', 'business-feature'),
  156.     'before_widget' => '<div id="%1$s" class="widget %2$s">',
  157.     'after_widget' => '</div>',
  158.     'before_title' => '<h3 class="widgettitle">',
  159.     'after_title' => '</h3>'
  160. )
  161. );
  162.  
  163. if($bp_existed == 'true') {
  164.     register_sidebar(array(
  165.         'name' => __( 'members-sidebar', 'business-feature'),
  166.         'id' => 'members-sidebar',
  167.         'description' => __( 'Members Sidebar', 'business-feature'),
  168.         'before_widget' => '<div id="%1$s" class="widget %2$s">',
  169.         'after_widget' => '</div>',
  170.         'before_title' => '<h3 class="widgettitle">',
  171.         'after_title' => '</h3>'
  172.     )
  173.     );
  174.  
  175. }
  176. }
  177. add_action( 'widgets_init', 'businessfeature_widgets_init' );
  178.  
  179. if ( !function_exists( 'wpmudev_comment_form' ) ) :
  180. function wpmudev_comment_form( $default_labels ) {
  181.     global $themename, $shortname, $options, $options2, $options3, $bp_existed, $multi_site_on;
  182.  
  183.     if($bp_existed == 'true') :
  184.     global $user_identity;
  185.  
  186.     $commenter = wp_get_current_commenter();
  187.     $req = get_option( 'require_name_email' );
  188.     $aria_req = ( $req ? " aria-required='true'" : '' );
  189.     $fields =  array(
  190.         'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name', 'business-feature' ) . ( $req ? '<span class="required"> *</span>' : '' ) . '</label> ' .
  191.                     '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',
  192.         'email'  => '<p class="comment-form-email"><label for="email">' . __( 'Email', 'business-feature' ) . ( $req ? '<span class="required"> *</span>' : '' ) . '</label> ' .
  193.                     '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>',
  194.         'url'    => '<p class="comment-form-url"><label for="url">' . __( 'Website', 'business-feature' ) . '</label>' .
  195.                     '<input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p>',
  196.     );
  197.  
  198.     $new_labels = array(
  199.         'comment_field'  => '<p class="form-textarea"><textarea name="comment" id="comment" cols="60" rows="10" aria-required="true"></textarea></p>',
  200.         'fields'         => apply_filters( 'comment_form_default_fields', $fields ),
  201.         'logged_in_as'   => '',
  202.         'must_log_in'    => '<p class="alert">' . sprintf( __( 'You must be <a href="%1$s">logged in</a> to post a comment.', 'business-feature' ), wp_login_url( get_permalink() ) )   . '</p>',
  203.         'title_reply'    => __( 'Leave a reply', 'business-feature' )
  204.     );
  205.  
  206.     return apply_filters( 'wpmudev_comment_form', array_merge( $default_labels, $new_labels ) );
  207.     endif;
  208. }
  209. endif;
  210.  
  211. if (!current_user_can(‘edit_posts’)) {
  212. show_admin_bar(false);
  213. }
  214.  
  215. if ( !function_exists( 'wpmudev_blog_comments' ) ) :
  216. function wpmudev_blog_comments( $comment, $args, $depth ) {
  217. global $themename, $shortname, $options, $options2, $options3, $bp_existed, $multi_site_on;
  218.  
  219. if($bp_existed == 'true') {
  220.     $GLOBALS['comment'] = $comment;
  221.  
  222.     if ( 'pingback' == $comment->comment_type )
  223.         return false;
  224.  
  225.     if ( 1 == $depth )
  226.         $avatar_size = 50;
  227.     else
  228.         $avatar_size = 25;
  229.     ?>
  230.  
  231.     <li <?php comment_class() ?> id="comment-<?php comment_ID() ?>">
  232.         <div class="comment-avatar-box">
  233.             <div class="avb">
  234.                 <a href="<?php echo get_comment_author_url() ?>" rel="nofollow">
  235.                     <?php if ( $comment->user_id ) : ?>
  236.                         <?php echo bp_core_fetch_avatar( array( 'item_id' => $comment->user_id, 'width' => $avatar_size, 'height' => $avatar_size, 'email' => $comment->comment_author_email ) ) ?>
  237.                     <?php else : ?>
  238.                         <?php echo get_avatar( $comment, $avatar_size ) ?>
  239.                     <?php endif; ?>
  240.                 </a>
  241.             </div>
  242.         </div>
  243.  
  244.         <div class="comment-content">
  245.             <div class="comment-meta">
  246.                 <p>
  247.                     <?php
  248.                         printf( __( '<a href="%1$s" rel="nofollow">%2$s</a> said on <a href="%3$s"><span class="time-since">%4$s</span></a>', 'business-feature' ), get_comment_author_url(), get_comment_author(), get_comment_link(), get_comment_date() );
  249.                     ?>
  250.                 </p>
  251.             </div>
  252.  
  253.             <div class="comment-entry">
  254.                 <?php if ( $comment->comment_approved == '0' ) : ?>
  255.                     <em class="moderate"><?php _e( 'Your comment is awaiting moderation.', 'business-feature' ); ?></em>
  256.                 <?php endif; ?>
  257.  
  258.                 <?php comment_text() ?>
  259.             </div>
  260.  
  261.             <div class="comment-options">
  262.                     <?php if ( comments_open() ) : ?>
  263.                         <?php comment_reply_link( array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ); ?>
  264.                     <?php endif; ?>
  265.  
  266.                     <?php if ( current_user_can( 'edit_comment', $comment->comment_ID ) ) : ?>
  267.                         <?php printf( '<a class="button comment-edit-link bp-secondary-action" href="%1$s" title="%2$s">%3$s</a> ', get_edit_comment_link( $comment->comment_ID ), esc_attr__( 'Edit comment', 'business-feature' ), __( 'Edit', 'business-feature' ) ) ?>
  268.                     <?php endif; ?>
  269.  
  270.             </div>
  271.  
  272.         </div>
  273. <?php } else {
  274.  
  275.     $GLOBALS['comment'] = $comment;
  276.  
  277.     if ( 'pingback' == $comment->comment_type )
  278.         return false;
  279.  
  280.     if ( 1 == $depth )
  281.         $avatar_size = 50;
  282.     else
  283.         $avatar_size = 25;
  284.     ?>
  285.     <li <?php comment_class() ?> id="comment-<?php comment_ID() ?>">
  286.         <div class="comment-avatar-box">
  287.             <div class="avb">
  288.                 <a href="<?php echo get_comment_author_url() ?>" rel="nofollow">
  289.                     <?php if ( $comment->user_id ) : ?>
  290.                             <?php echo get_avatar( $comment, 40 ); ?>
  291.                     <?php else : ?>
  292.                         <?php echo get_avatar( $comment, $avatar_size ) ?>
  293.                     <?php endif; ?>
  294.                 </a>
  295.             </div>
  296.         </div>
  297.  
  298.         <div class="comment-content">
  299.             <div class="comment-meta">
  300.                 <p>
  301.                     <?php
  302.                         printf( __( '<a href="%1$s" rel="nofollow">%2$s</a> said on <a href="%3$s"><span class="time-since">%4$s</span></a>', 'business-feature' ), get_comment_author_url(), get_comment_author(), get_comment_link(), get_comment_date() );
  303.                     ?>
  304.                 </p>
  305.             </div>
  306.  
  307.             <div class="comment-entry">
  308.                 <?php if ( $comment->comment_approved == '0' ) : ?>
  309.                     <em class="moderate"><?php _e( 'Your comment is awaiting moderation.', 'business-feature' ); ?></em>
  310.                 <?php endif; ?>
  311.  
  312.                 <?php comment_text() ?>
  313.             </div>
  314.  
  315.             <div class="comment-options">
  316.                     <?php if ( comments_open() ) : ?>
  317.                         <?php comment_reply_link( array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ); ?>
  318.                     <?php endif; ?>
  319.  
  320.                     <?php if ( current_user_can( 'edit_comment', $comment->comment_ID ) ) : ?>
  321.                         <?php printf( '<a class="button comment-edit-link" href="%1$s" title="%2$s">%3$s</a> ', get_edit_comment_link( $comment->comment_ID ), esc_attr__( 'Edit comment', 'business-feature' ), __( 'Edit', 'business-feature' ) ) ?>
  322.                     <?php endif; ?>
  323.  
  324.             </div>
  325.  
  326.         </div>
  327. <?php
  328.     }
  329. }
  330. endif;
  331.  
  332.  
  333. ///////////////////////////////////////////////////////////////////////////
  334. /* -------------------- Update Notifications Notice -------------------- */
  335. if ( !function_exists( 'wdp_un_check' ) ) {
  336.   add_action( 'admin_notices', 'wdp_un_check', 5 );
  337.   add_action( 'network_admin_notices', 'wdp_un_check', 5 );
  338.   function wdp_un_check() {
  339.     if ( !class_exists( 'WPMUDEV_Update_Notifications' ) && current_user_can( 'edit_users' ) )
  340.       echo '<div class="error fade"><p>' . __('Please install the latest version of <a href="http://premium.wpmudev.org/project/update-notifications/" title="Download Now &raquo;">our free Update Notifications plugin</a> which helps you stay up-to-date with the most stable, secure versions of WPMU DEV themes and plugins. <a href="http://premium.wpmudev.org/wpmu-dev/update-notifications-plugin-information/">More information &raquo;</a>', 'wpmudev') . '</a></p></div>';
  341.   }
  342. }
  343. /* --------------------------------------------------------------------- */
  344.  
  345. include("library/functions/customizer-functions.php");?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement