PluginProbe
Gallery for Google Photos – share your albums right on your site / trunk
Gallery for Google Photos – share your albums right on your site vtrunk
1.3.0 1.2.2 1.2.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9
embed-google-photos / embed-google-photos.php

embed-google-photos.php in Gallery for Google Photos – share your albums right on your site trunk, at embed-google-photos.php

129 lines 4.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Gallery for Google Photos – share your albums right on your site
4 * Plugin URI: https://bplugins.com/plugins/gallery-for-google-photos/
5 * Description: Embed stunning Google Photos galleries directly into your WordPress site with the Google Photos Block plugin.
6 * Version: 1.3.0
7 * Author: bPlugins
8 * Author URI: http://bplugins.com
9 * License: GPLv3 or later
10 * License URI: https://www.gnu.org/licenses/gpl-3.0.txt
11 * Text Domain: embed-google-photos
12 * Requires at least: 6.5
13 * Requires PHP: 7.1
14 */
15
16 // ABS PATH
17 if (!defined('ABSPATH')) {exit;}
18
19 if (function_exists('bpgpb_fs')) {
20 bpgpb_fs()->set_basename( true, __FILE__ );
21 } else {
22
23 if ( ! function_exists( 'bpgpb_fs' ) ) {
24 // Create a helper function for easy SDK access.
25 function bpgpb_fs() {
26 global $bpgpb_fs;
27
28 if ( ! isset( $bpgpb_fs ) ) {
29 // Include Freemius Lite SDK.
30 require_once dirname(__FILE__) . '/vendor/freemius-lite/start.php';
31
32 $bpgpbConfig = array(
33 'id' => '34444',
34 'slug' => 'wp-google-photos',
35 'type' => 'plugin',
36 'public_key' => 'pk_cdef836737c97094c8ea2d152212b',
37 'is_premium' => false,
38 'menu' => array(
39 'slug' => 'edit.php?post_type=bpgpb_gallery',
40 'first-path' => 'edit.php?post_type=bpgpb_gallery&page=wp-google-photos#/pricing',
41 'support' => false,
42 ),
43 );
44 $bpgpb_fs = fs_lite_dynamic_init( $bpgpbConfig );
45 }
46 return $bpgpb_fs;
47 }
48 // Init Freemius.
49 bpgpb_fs();
50 // Signal that SDK was initiated.
51 do_action( 'bpgpb_fs_loaded' );
52 }
53
54 class bpgpb_Embed_Google_Photos {
55 public static $instance;
56
57 private function __construct()
58 {
59 $this->load_classes();
60 $this->constants_defined();
61
62 add_action('init', [$this, 'onInit']);
63 add_filter('plugin_action_links_' . plugin_basename(__FILE__), [$this, 'pluginActionLinks']);
64 }
65
66 /**
67 * Surface the documentation right where users look first — the Plugins screen.
68 */
69 public function pluginActionLinks($links) {
70 // Highlighted so both stand out from the default Deactivate/Opt Out links.
71 $highlight = esc_attr('color:#f18500;font-weight:bold');
72
73 $dashboard = sprintf(
74 '<a href="%s" style="%s">%s</a>',
75 esc_url(admin_url('edit.php?post_type=bpgpb_gallery&page=wp-google-photos')),
76 $highlight,
77 esc_html__('Dashboard!', 'embed-google-photos')
78 );
79
80 $docs = sprintf(
81 '<a href="%s" style="%s" target="_blank" rel="noopener noreferrer">%s</a>',
82 esc_url(BPGPB_DOCS_URL),
83 $highlight,
84 esc_html__('Docs', 'embed-google-photos')
85 );
86
87 array_unshift($links, $dashboard, $docs);
88
89 return $links;
90 }
91
92 public static function get_instance() {
93 if(self::$instance) {
94 return self::$instance;
95 }
96
97 self::$instance = new self();
98 return self::$instance;
99 }
100
101 public function constants_defined() {
102 // Constant
103 define( 'BPGPB_PLUGIN_VERSION', '1.3.0' );
104 define('BPGPB_ASSETS_DIR', plugin_dir_url(__FILE__) . 'assets/');
105 define('BPGPB_DIR_URL', plugin_dir_url(__FILE__));
106 define('BPGPB_DIR_PATH', plugin_dir_path(__FILE__));
107 // Documentation — kept in sync with src/admin/utils/data.js.
108 define('BPGPB_DOCS_URL', 'https://bplugins.com/docs/embed-google-photos/getting-started/');
109 define('BPGPB_AUTH_DOCS_URL', BPGPB_DOCS_URL . '#google-authorization');
110 }
111
112 public function load_classes () {
113 require_once plugin_dir_path(__FILE__) . 'includes/google-api.php';
114 require_once plugin_dir_path(__FILE__) . 'includes/GooglePhotos.php';
115 require_once plugin_dir_path(__FILE__) . 'includes/custom-post.php';
116 require_once plugin_dir_path(__FILE__) . 'includes/admin-menu.php';
117 }
118
119 public function onInit()
120 {
121 // All scripts, styles and the render.php are declared in build/block.json.
122 register_block_type(__DIR__ . '/build'); // Register Block
123
124 wp_set_script_translations('bpgpb-google-photos-editor-script', 'embed-google-photos', plugin_dir_path(__FILE__) . 'languages'); // Translate
125 }
126 }
127 bpgpb_Embed_Google_Photos::get_instance();
128
129 }