Ejemplo n.º 1
0
 /**
  * Main init method executed as wordpress action 'init'.
  */
 function init()
 {
     $this->is_ie6 = $this->o["disable_ie6_check"] == 1 ? false : is_msie6();
     if ($this->is_update) {
         GDSRDatabase::init_categories_data();
     }
     if (is_admin()) {
         gdsrAdmFunc::init_uninstall();
         gdsrAdmFunc::init_templates();
         $this->init_operations();
         $this->load_translation();
     }
     wp_enqueue_script('jquery');
     if (!is_admin()) {
         $this->is_bot = gdsrFrontHelp::detect_bot($_SERVER['HTTP_USER_AGENT'], $this->bots);
         $this->is_ban = gdsrFrontHelp::detect_ban();
         if ($this->o["cached_loading"] != 1) {
             $this->f->render_wait_article();
             $this->f->render_wait_comment();
             $this->f->render_wait_multis();
             $this->f->render_wait_article_thumb();
             $this->f->render_wait_comment_thumb();
         }
         $js_name = STARRATING_JAVASCRIPT_DEBUG ? 'gd-star-rating/js/gdsr.debug.js' : 'gd-star-rating/js/gdsr.js';
         wp_enqueue_script("gdsr_script", plugins_url($js_name), array(), $this->o["version"]);
         if ($this->o["external_rating_css"] == 1) {
             wp_enqueue_style("gdsr_style_main", $this->include_rating_css(true, true), array(), $this->o["version"]);
         }
         if ($this->o["external_css"] == 1 && file_exists($this->plugin_xtra_path . "css/rating.css")) {
             wp_enqueue_style("gdsr_style_xtra", $this->plugin_xtra_url . "css/rating.css", array(), $this->o["version"]);
         }
     } else {
         if ($this->wp_version >= 28) {
             wp_enqueue_script('jquery-ui-core');
             wp_enqueue_script('jquery-ui-tabs');
         }
         if (isset($_GET["page"])) {
             if (substr($_GET["page"], 0, 14) == "gd-star-rating") {
                 $this->admin_plugin = true;
                 $this->admin_plugin_page = substr($_GET["page"], 15);
             }
         }
         $this->cache_cleanup();
         $this->init_specific_pages();
         $this->load_datepicker();
     }
     if (is_admin() && $this->o["mur_review_set"] == 0) {
         $set = GDSRDBMulti::get_multis(0, 1);
         if (count($set) > 0) {
             $this->o["mur_review_set"] = $set[0]->multi_id;
             update_option('gd-star-rating', $this->o);
         }
     }
     $this->custom_actions('init');
 }
Ejemplo n.º 2
0
 /**
  * Main init method executed as wordpress action 'init'.
  */
 function init()
 {
     $this->init_uninstall();
     define('STARRATING_ENCODING', $this->o["encoding"]);
     if (isset($_GET["page"])) {
         if (substr($_GET["page"], 0, 14) == "gd-star-rating") {
             $this->admin_plugin = true;
             $this->admin_plugin_page = substr($_GET["page"], 15);
         }
     }
     $this->init_operations();
     if (!is_admin()) {
         $this->is_bot = GDSRHelper::detect_bot($_SERVER['HTTP_USER_AGENT']);
         $this->is_ban = GDSRHelper::detect_ban();
         $this->render_wait_article();
         if ($this->o["comments_active"] == 1) {
             $this->render_wait_comment();
         }
         if ($this->o["multis_active"] == 1) {
             $this->render_wait_multis();
         }
     } else {
         $this->cache_cleanup();
     }
     if ($this->admin_plugin_page == "settings-page") {
         $gdsr_options = $this->o;
         include $this->plugin_path . "code/gd-star-settings.php";
         $this->o = $gdsr_options;
     }
     wp_enqueue_script('jquery');
     if ($this->admin_plugin) {
         if ($this->wp_version >= 26) {
             add_thickbox();
         } else {
             wp_enqueue_script("thickbox");
         }
         $this->safe_mode = gdFunctionsGDSR::php_in_safe_mode();
         if (!$this->safe_mode) {
             $this->extra_folders = GDSRHelper::create_folders($this->wp_version);
         }
     }
     $this->l = get_locale();
     if (!empty($this->l)) {
         $moFile = dirname(__FILE__) . "/languages/gd-star-rating-" . $this->l . ".mo";
         if (@file_exists($moFile) && is_readable($moFile)) {
             load_textdomain('gd-star-rating', $moFile);
         }
     }
     $this->is_cached = $this->o["cache_active"];
     $this->is_ie6 = is_msie6();
     $this->custom_actions('init');
     if (is_admin() && $this->o["mur_review_set"] == 0) {
         $set = GDSRDBMulti::get_multis(0, 1);
         if (count($set) > 0) {
             $this->o["mur_review_set"] = $set[0]->multi_id;
             update_option('gd-star-rating', $this->o);
         }
     }
     if (!is_admin() && !is_feed()) {
         $this->rendering_sets = GDSRDBMulti::get_multisets_for_auto_insert();
         if (!is_array($this->rendering_sets)) {
             $this->rendering_sets = array();
         }
     } else {
         $this->rendering_sets = array();
     }
 }