PluginProbe ʕ •ᴥ•ʔ
Hustle – Email Marketing, Lead Generation, Optins, Popups / trunk
Hustle – Email Marketing, Lead Generation, Optins, Popups vtrunk
7.8.14.2 7.8.14 7.8.14.1 7.8.13 7.8.13.1 trunk 3.0 3.1 3.1.1 3.1.2 3.1.3 3.1.4 4.3.2 4.4.4 4.4.5 4.4.5.1 4.4.5.4 4.6 4.6.1.1 4.6.1.4 4.7.0.2 4.7.0.3 4.7.0.7 4.7.0.9 4.7.1.0 4.7.1.1 4.8.0.0 5.0.0 5.0.1 5.0.1.1 5.0.1.2 5.1 5.1.1 5.1.2 5.1.3 5.1.3.1 5.1.3.2 5.1.4 5.1.5 6.0 6.0.1 6.0.2 6.0.3 6.0.4.2 6.0.5 6.0.6.1 6.0.7 6.0.8.1 6.0.9 7.0.0.1 7.0.2 7.0.3 7.0.4 7.1.0 7.1.1 7.2.0 7.2.1 7.3.0 7.3.1 7.3.3 7.3.5 7.3.6 7.3.7 7.4.0 7.4.1 7.4.11 7.4.13 7.4.13.1 7.4.2 7.4.3 7.4.4 7.4.5 7.4.5.1 7.4.5.2 7.4.6 7.4.7 7.5.0 7.6.0 7.6.1 7.6.3 7.6.4 7.6.6 7.7.0 7.7.1 7.8.0 7.8.1 7.8.10 7.8.10.1 7.8.10.2 7.8.11 7.8.12 7.8.12.1 7.8.2 7.8.3 7.8.4 7.8.5 7.8.6 7.8.7 7.8.8 7.8.9 7.8.9.1 7.8.9.2 7.8.9.3
wordpress-popup / inc / providers / gutenberg / blocks / block-social-share.php
wordpress-popup / inc / providers / gutenberg / blocks Last commit date
block-embeds.php 3 years ago block-popup-trigger.php 3 years ago block-slidein-trigger.php 3 years ago block-social-share.php 7 months ago block-unsubscribe.php 7 months ago
block-social-share.php
138 lines
1 <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2 /**
3 * Hustle_GHBlock_Social_Share class
4 *
5 * @package Hustle
6 */
7
8 /**
9 * Class Hustle_GHBlock_Social_Share
10 *
11 * @since 1.0 Gutenberg Addon
12 */
13 class Hustle_GHBlock_Social_Share extends Hustle_GHBlock_Abstract {
14
15 /**
16 * Block identifier
17 *
18 * @since 1.0 Gutenberg Addon
19 *
20 * @var string
21 */
22 protected $slug = 'social-share';
23
24 /**
25 * Hustle_GHBlock_Social_Share constructor.
26 *
27 * @since 1.0 Gutenberg Addon
28 */
29 public function __construct() {
30 // Initialize block.
31 $this->init();
32 }
33
34 /**
35 * Render block markup on front-end
36 *
37 * @since 1.0 Gutenberg Addon
38 * @param array $properties Block properties.
39 *
40 * @return string
41 */
42 public function render_block( $properties = array() ) {
43 $css_class = isset( $properties['css_class'] ) ? $properties['css_class'] : '';
44
45 if ( isset( $properties['id'] ) ) {
46 return '[wd_hustle id="' . esc_attr( $properties['id'] ) . '" type="social_sharing" css_class="' . esc_attr( $css_class ) . '"/]';
47 }
48 }
49
50 /**
51 * Enqueue assets ( scritps / styles )
52 * Should be overriden in block class
53 *
54 * @since 1.0 Gutenberg Addon
55 */
56 public function load_assets() {
57
58 Hustle_Module_Front::add_hui_scripts();
59
60 // Scripts.
61 wp_enqueue_script(
62 'hustle-block-social-share',
63 Hustle_Gutenberg::get_plugin_url() . '/js/social-share-block.min.js',
64 array( 'wp-blocks', 'wp-i18n', 'wp-element', 'hui_scripts' ),
65 filemtime( Hustle_Gutenberg::get_plugin_dir() . '/js/social-share-block.min.js' ),
66 true
67 );
68
69 // Localize scripts.
70 wp_localize_script(
71 'hustle-block-social-share',
72 'hustle_ss_data',
73 array(
74 'modules' => $this->get_modules(),
75 'admin_url' => admin_url( 'admin.php' ),
76 'shortcode_tag' => Hustle_Module_Front::SHORTCODE,
77 'nonce' => wp_create_nonce( 'hustle_gutenberg_get_module' ),
78 'l10n' => $this->localize(),
79 )
80 );
81
82 wp_enqueue_style(
83 'hustle_icons',
84 Opt_In::$plugin_url . 'assets/hustle-ui/css/hustle-icons.min.css',
85 array(),
86 Opt_In::VERSION
87 );
88
89 wp_enqueue_style(
90 'hustle_social',
91 Opt_In::$plugin_url . 'assets/hustle-ui/css/hustle-social.min.css',
92 array(),
93 Opt_In::VERSION
94 );
95 }
96
97 /**
98 * Get modules
99 *
100 * @return array
101 */
102 public function get_modules() {
103 $module_list = $this->get_modules_by_type( 'social_sharing' );
104 return $module_list;
105 }
106
107 /**
108 * Get texts for localize
109 *
110 * @return array
111 */
112 private function localize() {
113 return array(
114 'advanced' => esc_html__( 'Advanced', 'hustle' ),
115 'additional_css_classes' => esc_html__( 'Additional CSS Classes', 'hustle' ),
116 'name' => esc_html__( 'Name', 'hustle' ),
117 'module' => esc_html__( 'Module', 'hustle' ),
118 'customize_module' => esc_html__( 'Customize Social Share', 'hustle' ),
119 'rendering' => esc_html__( 'Rendering...', 'hustle' ),
120 'block_name' => esc_html__( 'Social Share', 'hustle' ),
121 /* translators: Plugin name */
122 'block_description' => esc_html( sprintf( __( 'Display your %s Social Share module in this block.', 'hustle' ), Opt_In_Utils::get_plugin_name() ) ),
123 );
124 }
125
126 /**
127 * Is module included
128 *
129 * @param Hustle_Model $module Module.
130 * @return bool
131 */
132 protected function is_module_included( Hustle_Model $module ) {
133 return $module->is_display_type_active( Hustle_Module_Model::SHORTCODE_MODULE );
134 }
135 }
136
137 new Hustle_GHBlock_Social_Share();
138