function __construct($file)
 {
     $this->plugin_base_name = basename(dirname($file)) . '/' . basename($file);
     // PluginUpdateChecker
     require 'third-party/plugin-update-checker.php';
     self::$update_checker = new RSPluginUpdateChecker_1_3('http://dimsemenov.com/private/rsupdate-json.php', $file, 'newroyalslider');
     add_action('init', array(&$this, 'init'));
     $this->global_options = get_option('new_royalslider_config');
     if (!$this->global_options) {
         $this->global_options = array('embed' => array('posts_with_slider' => 'posts_with_slider'), 'allow_authors_cap' => 'no', 'cache_refresh_time' => '24', 'override_all_default_galleries' => '');
         update_option('new_royalslider_config', $this->global_options);
     }
     if (isset($this->global_options['cache_refresh_time'])) {
         self::$refresh_hours = (double) $this->global_options['cache_refresh_time'];
     } else {
         self::$refresh_hours = 24;
     }
     if (isset($this->global_options['override_all_default_galleries']) && $this->global_options['override_all_default_galleries'] != '') {
         self::$override_all_default_galleries = (int) $this->global_options['override_all_default_galleries'];
     } else {
         self::$override_all_default_galleries = false;
     }
     if (isset($this->global_options)) {
         if (isset($this->global_options['embed'])) {
             $e = $this->global_options['embed'];
             if (isset($e['home_page'])) {
                 $this->load_on_home = true;
             }
             if (isset($e['every_page'])) {
                 $this->check_post_shortcode = false;
                 $this->load_on_home = false;
                 $this->load_on_every = true;
             } else {
                 if (isset($e['posts_with_slider'])) {
                     $this->check_post_shortcode = true;
                 }
             }
         }
     }
     add_filter('puc_request_url_args-newroyalslider', array(&$this, 'upd_url_args'), 10, 2);
     add_filter('puc_request_info_options-newroyalslider', array(&$this, 'upd_req_options'), 10, 2);
     add_shortcode('new_royalslider', array(&$this, 'shortcode'));
     add_action('wpmu_new_blog', array(&$this, 'new_blog_added'), 10, 6);
     require_once 'Widget.php';
     require_once 'GalleryShortcode.php';
     $gallery_shortcode = new NewRoyalSliderGalleryShortcode();
     require_once 'sources/Flickr.php';
     add_filter('new_rs_slides_filter', array('NewRoyalSliderFlickrSource', 'get_data'), 10, 3);
     require_once 'sources/500px.php';
     add_filter('new_rs_slides_filter', array('NewRoyalSlider500pxSource', 'get_data'), 10, 3);
     require_once 'sources/Posts.php';
     add_filter('new_rs_slides_filter', array('NewRoyalSliderPostsSource', 'get_data'), 10, 3);
     if (!current_theme_supports('post-thumbnails')) {
         add_theme_support('post-thumbnails');
     }
 }
Ejemplo n.º 2
0
 function __construct($file)
 {
     $this->plugin_base_name = basename(dirname($file)) . '/' . basename($file);
     add_action('init', array(&$this, 'init'));
     $this->global_options = get_option('new_royalslider_config');
     if (!$this->global_options) {
         $this->global_options = array('embed' => array('posts_with_slider' => 'posts_with_slider'), 'allow_authors_cap' => 'no', 'cache_refresh_time' => '24', 'override_all_default_galleries' => '');
         update_option('new_royalslider_config', $this->global_options);
     }
     if (isset($this->global_options['purchase_code'])) {
         self::$purchase_code = $this->global_options['purchase_code'];
     } else {
         self::$purchase_code = '';
     }
     require 'third-party/updates.php';
     self::$updater = new RoyalSliderUpdater();
     if (isset($this->global_options['cache_refresh_time'])) {
         self::$refresh_hours = (double) $this->global_options['cache_refresh_time'];
     } else {
         self::$refresh_hours = 24;
     }
     if (isset($this->global_options['cache_refresh_time'])) {
         self::$include_style_tag = true;
     } else {
         self::$include_style_tag = true;
     }
     if (isset($this->global_options['override_all_default_galleries']) && $this->global_options['override_all_default_galleries'] != '') {
         self::$override_all_default_galleries = (int) $this->global_options['override_all_default_galleries'];
     } else {
         self::$override_all_default_galleries = false;
     }
     if (isset($this->global_options)) {
         if (isset($this->global_options['embed'])) {
             $e = $this->global_options['embed'];
             if (isset($e['home_page'])) {
                 $this->load_on_home = true;
             }
             if (isset($e['every_page'])) {
                 $this->check_post_shortcode = false;
                 $this->load_on_home = false;
                 $this->load_on_every = true;
             } else {
                 if (isset($e['posts_with_slider'])) {
                     $this->check_post_shortcode = true;
                 }
             }
         }
     }
     add_shortcode('new_royalslider', array(&$this, 'shortcode'));
     add_action('wpmu_new_blog', array(&$this, 'new_blog_added'), 10, 6);
     require_once 'Widget.php';
     require_once 'GalleryShortcode.php';
     $gallery_shortcode = new NewRoyalSliderGalleryShortcode();
     require_once 'sources/Flickr.php';
     add_filter('new_rs_slides_filter', array('NewRoyalSliderFlickrSource', 'get_data'), 10, 3);
     require_once 'sources/500px.php';
     add_filter('new_rs_slides_filter', array('NewRoyalSlider500pxSource', 'get_data'), 10, 3);
     require_once 'sources/Posts.php';
     add_filter('new_rs_slides_filter', array('NewRoyalSliderPostsSource', 'get_data'), 10, 3);
     require_once 'sources/NextGen.php';
     $nextgen = new NewRoyalSliderNextGenSource();
     require_once 'sources/Instagram.php';
     add_filter('new_rs_slides_filter', array('NewRoyalSliderInstagramSource', 'get_data'), 10, 3);
     //add_filter('new_rs_slides_filter', array('NewRoyalSliderNextGenSource', 'get_data'), 10, 3 );
     if (!current_theme_supports('post-thumbnails')) {
         add_theme_support('post-thumbnails');
     }
 }