configure( array( 'optimizations' => 0, 'environment' => $this->getPluginEnvironment(), 'default_module' => 'galleries', 'lang_domain' => 'sgg', 'lang_path' => plugin_basename(dirname(__FILE__)) . '/langs', 'plugin_prefix' => 'GridGallery', 'plugin_source' => dirname(dirname(__FILE__)) . '/src', 'plugin_title_name' => 'Photo Gallery by Supsystic', 'plugin_menu' => array( 'page_title' => __('Gallery by Supsystic', 'sgg'), 'menu_title' => __('Gallery by Supsystic', 'sgg'), 'capability' => 'manage_options', 'menu_slug' => 'supsystic-gallery', 'icon_url' => 'dashicons-format-gallery', 'position' => '100.3', ), 'shortcode_name' => 'supsystic-gallery', 'db_prefix' => 'sg_', 'hooks_prefix' => 'sg_', 'page_url' => 'http://supsystic.com/plugins/photo-gallery/', 'ajax_url' => admin_url('admin-ajax.php'), 'admin_url' => admin_url(), 'uploads_rw' => true, 'jpeg_quality' => 95, 'plugin_db_update' => true, 'revision' => 244, 'welcome_page_was_showed' => get_option('sg_welcome_page_was_showed'), 'promo_controller' => 'GridGallery_Promo_Controller' ) ); if (!defined('S_YOUR_SECRET_HASH_'. $environment->getPluginName())) { define( 'S_YOUR_SECRET_HASH_' . $environment->getPluginName(), 'hn48SgUyMN53#jhg7@pomnE9W2O#2m@awmMneuGW3512F@jnkj' ); } $this->environment = $environment; $this->alerts = array(); $this->initialize(); } /** * Run plugin */ public function run() { global $grid_gallery_supsystic; $this->environment->run(); $this->environment->getTwig()->addGlobal('core_alerts', $this->alerts); $grid_gallery_supsystic = $this->environment; } /** * Load plugin languages */ public function _loadPluginsTextDomain() { load_plugin_textdomain( 'sgg', false, $this->environment->getConfig()->get('lang_path') ); } public function addShortcodeButton() { add_filter( "mce_external_plugins", array($this, 'addButton')); add_filter( 'mce_buttons', array($this, 'registerButton')); if(is_admin()) { wp_enqueue_script('sgg-bpopup-js', $this->environment->getConfig()->get('plugin_url') . '/app/assets/js/jquery.bpopup.min.js',array('sg-ajax.js'),false,true); wp_enqueue_style('sgg-popup-css', $this->environment->getConfig()->get('plugin_url') . '/app/assets/css/editor-dialog.css'); } } /** * Add button to TinyMCE * @param array $plugin_array * @return array $plugin_array */ public function addButton( $plugin_array ) { $plugin_array['addShortcode'] = $this->environment->getConfig()->get('plugin_url') . '/app/assets/js/buttons.js'; return $plugin_array; } /** * Register button */ public function registerButton( $buttons ) { array_push( $buttons, 'addShortcode', 'selectShortcode' ); return $buttons; } /** * Initialize plugin component and subsustem */ protected function initialize() { $config = $this->environment->getConfig(); $logger = null; $uploads = wp_upload_dir(); if (!is_writable($uploads['basedir'])) { $this->alerts[] = sprintf( '
You need to make your "%s" directory writable.