/** * Register and load frontend scripts * @return void */ public function load_assets() { global $wp_scripts; // Filter base front end assets directory $this->assets_dir = apply_filters('masterslider_frontend_assets_dir', $this->assets_dir); // JS ////////////////////////////////////////////////////////////////////////////// wp_register_script('jquery-easing', $this->assets_dir . '/js/jquery.easing.min.js', array('jquery'), $this->version, true); wp_register_script('masterslider-core', $this->assets_dir . '/js/masterslider.min.js', array('jquery', 'jquery-easing'), $this->version, true); wp_register_script('masterslider-flickr', $this->assets_dir . '/js/masterslider.flickr.min.js', array('masterslider-core'), $this->version, true); // always load assets by default if 'allways_load_ms_assets' option was enabled if ('on' == msp_get_setting('allways_load_ms_assets', 'msp_advanced')) { wp_enqueue_script('masterslider-core'); wp_enqueue_script('masterslider-flickr'); } // Print JS Object ////////////////////////////////////////////////////////////////// wp_localize_script('masterslider', 'masterslider_js_params', apply_filters('masterslider_js_params', array('ajax_url' => admin_url('admin-ajax.php')))); // CSS ////////////////////////////////////////////////////////////////////////////// $enqueue_styles = $this->get_styles(); // Load Css files if ($enqueue_styles) { foreach ($enqueue_styles as $handle => $args) { wp_enqueue_style($handle, $args['src'], $args['deps'], $args['version']); } } // load custom.css if the directory is writable. else use inline css fallback $inline_css = msp_get_option('custom_inline_style', ''); if (empty($inline_css)) { $custom_css_ver = msp_get_option('masterslider_custom_css_ver', '1.0'); $uploads = wp_upload_dir(); $css_file = $uploads['baseurl'] . '/' . MSWP_SLUG . '/custom.css'; $css_file = apply_filters('masterslider_custom_css_url', $css_file); wp_enqueue_style($this->prefix . 'custom', $css_file, array($this->prefix . 'main'), $custom_css_ver); } }
function msp_on_plugins_loaded() { if ('on' !== msp_get_setting('enable_single_product_slider', 'msp_woocommerce')) { return; } remove_action('woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20); remove_action('woocommerce_product_thumbnails', 'woocommerce_show_product_thumbnails', 20); add_action('woocommerce_before_single_product_summary', 'msp_show_product_images', 20); }
function msp_new_api_compatibility() { if (get_option(MSWP_SLUG . '_is_license_actived', 0)) { $token = msp_get_setting('token', 'msp_envato_license'); if (empty($token)) { $username = msp_get_setting('username', 'msp_envato_license'); $purchase_code = msp_get_setting('purchase_code', 'msp_envato_license'); Axiom_Plugin_License::get_instance()->license_action($username, $purchase_code); } } }
/** * Register and load frontend scripts * @return void */ public function load_assets() { global $wp_scripts; // Filter base front end assets directory $this->assets_dir = apply_filters('masterslider_frontend_assets_dir', $this->assets_dir); // JS ////////////////////////////////////////////////////////////////////////////// wp_register_script('jquery-easing', $this->assets_dir . '/js/jquery.easing.min.js', array('jquery'), $this->version, true); wp_register_script('masterslider-core', $this->assets_dir . '/js/masterslider.min.js', array('jquery', 'jquery-easing'), $this->version, true); // always load assets by default if 'allways_load_ms_assets' option was enabled if ('on' == msp_get_setting('allways_load_ms_assets', 'msp_advanced')) { wp_enqueue_script('masterslider-core'); } // Print JS Object ////////////////////////////////////////////////////////////////// wp_localize_script('masterslider', 'masterslider_js_params', apply_filters('masterslider_js_params', array('ajax_url' => admin_url('admin-ajax.php')))); // CSS ////////////////////////////////////////////////////////////////////////////// $enqueue_styles = $this->get_styles(); // Load Css files if ($enqueue_styles) { foreach ($enqueue_styles as $handle => $args) { wp_enqueue_style($handle, $args['src'], $args['deps'], $args['version']); } } }
msp_get_panel_header(); // Display sliders list $slider_table_list = new MSP_List_Table(); $slider_table_list->prepare_items(); $slider_table_list->display(); // Display action buttons echo '<div class="action-btns-list">'; if (current_user_can('create_masterslider')) { printf('<a id="msp-add-slider" class="action-add-new msp-ac-btn msp-btn-blue msp-iconic-big" href="%s"><span></span>%s</a>', admin_url('admin.php?page=' . MSWP_SLUG . '&action=add'), __('Create New Slider', MSWP_TEXT_DOMAIN)); } if (current_user_can('export_masterslider') || apply_filters('masterslider_admin_display_export_import', 0)) { printf('<a class="action-import-export msp-ac-btn" href="%s" onClick="lunchMastersliderImportExport(); return false;">%s</a>', admin_url('admin.php?page=' . MSWP_SLUG), __('Import & Export', MSWP_TEXT_DOMAIN)); } echo '</div>'; // Display update table if (apply_filters('masterslider_admin_display_update_list', 1) && 'off' == msp_get_setting('hide_info_table', 'msp_general_setting')) { ?> <table class="wp-list-table widefat fixed master-updates"> <thead> <tr> <th scope="col" class="latest-tuts" ><?php _e('Latest Video Tutorials', MSWP_TEXT_DOMAIN); ?> </th> <th scope="col" class="latest-updates" ><?php _e('Updates', MSWP_TEXT_DOMAIN); ?> </th> </tr> </thead>
/** * Set/update the value of a slider output transient. * * @param int $slider_id The slider id * @param mixed $value Slider transient output * @param int $cache_period Time until expiration in hours, default 12 * @return bool False if value was not set and true if value was set. */ function msp_set_slider_transient($slider_id, $value, $cache_period = null) { $cache_period = is_numeric($cache_period) ? (double) msp_get_setting('_cache_period', 'msp_general_setting', 12) : $cache_period; return set_transient('master_slider_output_' . $slider_id, $value, (int) $cache_period * HOUR_IN_SECONDS); }
/** * Override the plugin row context * * @param string $file The plugin file path * @param array $plugin_data Plugin information * * @return void */ public function plugin_update_row($file, $plugin_data) { $current = get_site_transient('update_plugins'); if (!isset($current->response[$file])) { return false; } $r = $current->response[$file]; // if license is already actived (token is set), add temp download link $r->package = msp_get_setting('token', 'msp_envato_license') ? 'temp_package' : ''; $plugins_allowedtags = array('a' => array('href' => array(), 'title' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'code' => array(), 'em' => array(), 'strong' => array()); $plugin_name = wp_kses($plugin_data['Name'], $plugins_allowedtags); $details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $r->slug . '§ion=changelog&TB_iframe=true&width=600&height=800'); $wp_list_table = _get_list_table('WP_Plugins_List_Table'); if (is_network_admin() || !is_multisite()) { echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">'; if (!current_user_can('update_plugins')) { printf(__('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version); } else { if (empty($r->package)) { printf(__('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>. <em>Please visit %5$ssetting page%6$s to enable automatic update for this plugin.</em>'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version, '<a href="' . admin_url('admin.php?page=' . $this->slug . '-setting') . '">', '</a>'); } else { printf(__('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version, wp_nonce_url(self_admin_url("update.php?action={$this->slug}-upgrade&plugin=") . $file, 'upgrade-plugin_' . $file)); } } do_action("in_plugin_update_message-{$file}", $plugin_data, $r); echo '</div></td></tr>'; } }
protected function get_downloaded_package_url() { global $wp_filesystem; $this->skin->feedback('download_item_package'); $res = $this->fs_connect(array(WP_CONTENT_DIR)); if (!$res) { return new WP_Error('no_credentials', __("Error! Failed to connect filesystem")); } $username = msp_get_setting('username', 'msp_envato_license'); $api_key = msp_get_setting('api_key', 'msp_envato_license'); $purchase_code = msp_get_setting('purchase_code', 'msp_envato_license'); $the_download_url = $this->get_download_url($username, $api_key, $purchase_code); if (is_wp_error($the_download_url)) { return $the_download_url; } $download_file = download_url($the_download_url); if (is_wp_error($download_file)) { return $download_file; } $upgrade_folder = $wp_filesystem->wp_content_dir() . "upgrade_dir/{$this->slug}"; if (is_dir($upgrade_folder)) { $wp_filesystem->delete($upgrade_folder); } $result = unzip_file($download_file, $upgrade_folder); $installable_file = $upgrade_folder . '/' . $this->installable_plugin_zip_file; if ($result && is_file($installable_file)) { return $installable_file; } return new WP_Error('no_credentials', __('Error on unzipping archive file ..')); }