Advertisement
Guest User

Untitled

a guest
May 26th, 2012
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.07 KB | None | 0 0
  1. <?php
  2.     new Themater_Social_Profiles();
  3.    
  4.     class Themater_Social_Profiles
  5.     {
  6.         var $theme;
  7.         var $status = false;
  8.         var $display_networks = false;
  9.         var $url;
  10.        
  11.         var $defaults;
  12.        
  13.         function __construct()
  14.         {
  15.             global $theme;
  16.             $this->theme = $theme;
  17.             $this->url = THEMATER_INCLUDES_URL . '/social_profiles';
  18.            
  19.             $this->defaults = array(
  20.                 'hook' => 'social_profiles',
  21.                 'networks' => array(
  22.                     array('title' => 'Twitter', 'url' => 'http://twitter.com/', 'button' => get_template_directory_uri() . '/images/social-profiles/twitter.png'),
  23.                     array('title' => 'Facebook', 'url' => 'http://facebook.com/', 'button' => get_template_directory_uri() . '/images/social-profiles/facebook.png'),
  24.                     array('title' => 'certidao', 'url' => 'https://plus.google.com/', 'button' => get_template_directory_uri() . '/images/social-profiles/gplus.png'),
  25.                     array('title' => 'LinkedIn', 'url' => 'http://www.linkedin.com/', 'button' => get_template_directory_uri() . '/images/social-profiles/linkedin.png'),
  26.                     array('title' => 'RSS Feed', 'url' => $theme->rss_url(), 'button' => get_template_directory_uri() . '/images/social-profiles/rss.png'),
  27.                     array('title' => 'Email', 'url' => 'mailto:your@email.com', 'button' => get_template_directory_uri() . '/images/social-profiles/email.png')
  28.                 )
  29.             );                        
  30.            
  31.             if(is_array($this->theme->options['plugins_options']['social_profiles']) ) {
  32.                 $this->defaults = array_merge($this->defaults, $this->theme->options['plugins_options']['social_profiles']);
  33.             }
  34.            
  35.             $this->theme->add_hook($this->defaults['hook'], array(&$this, 'display_social_profiles'), 1);
  36.            
  37.             if($this->theme->is_admin_user()) {
  38.                $this->themater_options();
  39.             }
  40.         }
  41.        
  42.         function display_social_profiles()
  43.         {
  44.             $widget_name = 'ThematerSocialProfiles';
  45.             $args = array('before_widget' => '','after_widget' => '');
  46.             $get_instance = $this->theme->get_option('themater_social_profiles_networks');
  47.             $instance = array('profiles' => $get_instance);
  48.             the_widget($widget_name, $instance, $args);
  49.         }
  50.        
  51.         function get_widget_form()
  52.         {
  53.             $widget_name = 'ThematerSocialProfiles';
  54.             $run_widget = new $widget_name();
  55.             $run_widget->id_base = 'plugin';
  56.             $get_instance = $this->theme->get_option('themater_social_profiles_networks');
  57.             $instance = array('profiles' => $get_instance);
  58.             $run_widget->form($instance);
  59.             ?>
  60.             <script>
  61.                   var update_scial_content = $thematerjQ('.themater_social_profiles_widget').html();
  62.                   update_scial_content = update_scial_content.replace(/widget-plugin\[\]\[profiles\]/g, 'themater_social_profiles_networks');
  63.                   $thematerjQ('.themater_social_profiles_widget').html(update_scial_content);
  64.                   $thematerjQ('.themater_social_profiles_widget_title').hide();
  65.               </script>
  66.             <?php
  67.         }
  68.  
  69.        
  70.         function themater_options()
  71.         {
  72.            
  73.             $this->theme->admin_option(array('Social Profiles', 16),
  74.                 'Social Profiles' , 'social_profiles',
  75.                 'content', 'Add buttons to your social network profiles.'
  76.             );
  77.            
  78.             $this->theme->admin_option('Social Profiles',
  79.                 'Networks', 'themater_social_profiles_networks',
  80.                 'callback', $this->defaults['networks'],
  81.                 array('callback' => array(&$this, 'themater_social_profiles_networks'), 'display' => 'clean')
  82.             );
  83.            
  84.         }
  85.        
  86.         function themater_social_profiles_networks()
  87.         {
  88.             $this->get_widget_form();
  89.         }
  90.     }
  91. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement