示例#1
0
 function __construct()
 {
     self::$plugin_path = trailingslashit(dirname(__PORTFOLIO_SLIDESHOW_PLUGIN_FILE__));
     self::$plugin_dir = trailingslashit(basename(self::$plugin_path));
     self::$plugin_url = plugins_url(self::$plugin_dir);
     self::$dot_min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     self::$options = $this->get_options();
     self::$defaults = $this->get_defaults();
     require_once self::$plugin_path . 'src/Portfolio_Slideshow/Settings.php';
     require_once self::$plugin_path . 'src/public/functions.php';
     require_once self::$plugin_path . 'src/Portfolio_Slideshow/Shortcode.php';
     require_once self::$plugin_path . 'src/Portfolio_Slideshow/Upgrader.php';
     require_once self::$plugin_path . 'src/Portfolio_Slideshow/Slideshow.php';
     add_action('add_meta_boxes', array($this, 'add_meta_boxes'));
     add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
     add_action('admin_init', array('Portfolio_Slideshow_Settings', 'admin_init'));
     add_action('admin_menu', array($this, 'admin_menu'), 5);
     add_action('edit_post', array($this, 'edit_post'), 99);
     add_action('media_row_actions', array($this, 'media_row_actions'));
     add_action('save_post', array($this, 'edit_post'), 99);
     add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'));
     add_action('wp_head', array('Portfolio_Slideshow_Slideshow', 'wp_head'));
     add_filter('attachment_fields_to_edit', array($this, 'attachment_fields_to_edit'), 10, 2);
     add_filter('attachment_fields_to_save', array($this, 'attachment_fields_to_save'), 10, 2);
     add_filter('plugin_action_links_' . plugin_basename(plugin_dir_path(__PORTFOLIO_SLIDESHOW_PLUGIN_FILE__) . 'plugin.php'), array($this, 'plugin_action_links'));
     add_filter('plugin_row_meta', array($this, 'plugin_row_meta'), 10, 4);
     add_shortcode('portfolio_slideshow', array('Portfolio_Slideshow_Shortcode', 'do_shortcode'));
 }
 /**
  * The add_shortcode() callback for [portfolio_slideshow].
  *
  * @param string $atts
  * @return string
  */
 static function do_shortcode($atts)
 {
     static $i = 0;
     $args = shortcode_atts(array('size' => Portfolio_Slideshow_Plugin::get_option('size'), 'nowrap' => Portfolio_Slideshow_Plugin::get_option('loop'), 'loop' => Portfolio_Slideshow_Plugin::get_option('loop'), 'speed' => Portfolio_Slideshow_Plugin::get_option('speed'), 'trans' => Portfolio_Slideshow_Plugin::get_option('trans'), 'timeout' => Portfolio_Slideshow_Plugin::get_option('timeout'), 'exclude_featured' => Portfolio_Slideshow_Plugin::get_option('exclude_featured'), 'autoplay' => Portfolio_Slideshow_Plugin::get_option('autoplay'), 'pagerpos' => Portfolio_Slideshow_Plugin::get_option('pagerpos'), 'navpos' => Portfolio_Slideshow_Plugin::get_option('navpos'), 'showcaps' => Portfolio_Slideshow_Plugin::get_option('showcaps'), 'showtitles' => Portfolio_Slideshow_Plugin::get_option('showtitles'), 'showdesc' => Portfolio_Slideshow_Plugin::get_option('showdesc'), 'click' => Portfolio_Slideshow_Plugin::get_option('click'), 'target' => Portfolio_Slideshow_Plugin::get_option('target'), 'centered' => Portfolio_Slideshow_Plugin::get_option('centered'), 'thumbs' => '', 'slideheight' => '', 'id' => '', 'exclude' => '', 'include' => ''), $atts, 'portfolio_slideshow');
     wp_enqueue_style('ps-public-css');
     wp_enqueue_script('ps-public-js');
     $slideshow = new Portfolio_Slideshow_Slideshow($args);
     return $slideshow->the_slideshow();
 }
示例#3
0
/*
 * Plugin Name: Portfolio Slideshow
 * Plugin URI: http://wordpress.org/plugins/portfolio-slideshow
 * Description: Build elegant, responsive slideshows in seconds.
 * Author: George Gecewicz
 * Version: 1.12.0
 * Author URI: http://ggwi.cz
 * License: GPLv2 or later
 * Text Domain: portfolio-slideshow
 *
 * Copyright 2016 George Gecewicz
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */
define('__PORTFOLIO_SLIDESHOW_PLUGIN_FILE__', __FILE__);
require_once dirname(__PORTFOLIO_SLIDESHOW_PLUGIN_FILE__) . '/src/Portfolio_Slideshow/Plugin.php';
Portfolio_Slideshow_Plugin::instance();
示例#4
0
 /**
  * Populates this class's $systeminfo property with the system info for output.
  *
  * @return void
  */
 static function load_system_info()
 {
     $user = wp_get_current_user();
     self::$systeminfo = array('URL' => 'http://' . $_SERVER['HTTP_HOST'], 'Name' => $user->display_name, 'Email' => $user->user_email, 'WordPress version' => get_bloginfo('version'), 'PHP version' => function_exists('phpversion') ? phpversion() : __('Could not determine PHP version because phpversion() does not exist.', 'portfolio-slideshow'), 'Plugins' => self::get_plugins(), 'Network Plugins' => self::get_network_plugins(), 'Must-Use Plugins' => self::get_mu_plugins(), 'Theme' => wp_get_theme()->get('Name'), 'Multisite' => is_multisite(), 'Settings' => Portfolio_Slideshow_Plugin::get_options(), 'Max Upload Size' => size_format(wp_max_upload_size()), 'WordPress Timezone' => get_option('timezone_string', __('Unknown or not set', 'portfolio-slideshow')), 'Server Timezone' => date_default_timezone_get(), 'Server Info' => esc_html($_SERVER['SERVER_SOFTWARE']));
     if (function_exists('ini_get')) {
         self::$systeminfo['PHP Post Max Size'] = size_format(ini_get('post_max_size'));
         self::$systeminfo['PHP Max Execution Time'] = ini_get('max_execution_time');
         self::$systeminfo['PHP Max Input Vars'] = ini_get('max_input_vars');
     }
     self::$systeminfo = apply_filters('portfolio_slideshow_load_system_info', self::$systeminfo);
 }
 /**
  * Adds legacy psHash and psLoader arguments to the header via wp_head(). Soon to be removed.
  *
  * @return void
  */
 static function wp_head()
 {
     printf('<script>/* <![CDATA[ */ portfolio_slideshow = { options : %s, slideshows : new Array() }; /* ]]> */</script>', json_encode(array('psHash' => Portfolio_Slideshow_Plugin::get_option('showhash'), 'psLoader' => Portfolio_Slideshow_Plugin::get_option('showloader'))));
 }