display-conditions
5 years ago
front
5 years ago
helpers
5 years ago
metas
5 years ago
palettes
5 years ago
provider
5 years ago
providers
5 years ago
templates
5 years ago
update
5 years ago
class-hustle-admin-page-abstract.php
5 years ago
class-hustle-condition-factory.php
6 years ago
class-hustle-dashboard-admin.php
5 years ago
class-hustle-data.php
5 years ago
class-hustle-db.php
6 years ago
class-hustle-module-admin.php
5 years ago
class-hustle-module-collection.php
5 years ago
class-hustle-module-decorator.php
5 years ago
class-hustle-module-page-abstract.php
5 years ago
class-hustle-notifications.php
5 years ago
class-hustle-settings-admin.php
5 years ago
class-hustle-upsell-page.php
5 years ago
class-hustle-wp-dashboard-page.php
5 years ago
hustle-collection.php
6 years ago
hustle-deletion.php
5 years ago
hustle-embedded-admin.php
6 years ago
hustle-entries-admin.php
5 years ago
hustle-entry-model.php
5 years ago
hustle-general-data-protection.php
6 years ago
hustle-init.php
5 years ago
hustle-mail.php
5 years ago
hustle-meta.php
5 years ago
hustle-migration.php
5 years ago
hustle-model.php
5 years ago
hustle-module-model.php
5 years ago
hustle-module-widget-legacy.php
5 years ago
hustle-module-widget.php
5 years ago
hustle-modules-common-admin-ajax.php
5 years ago
hustle-popup-admin.php
6 years ago
hustle-providers-admin.php
5 years ago
hustle-providers.php
6 years ago
hustle-settings-admin-ajax.php
5 years ago
hustle-settings-page.php
5 years ago
hustle-slidein-admin.php
6 years ago
hustle-sshare-admin.php
5 years ago
hustle-sshare-model.php
5 years ago
hustle-tracking-model.php
5 years ago
opt-in-geo.php
5 years ago
opt-in-utils.php
5 years ago
opt-in-wpmudev-api.php
6 years ago
hustle-sshare-admin.php
80 lines
| 1 | <?php |
| 2 | |
| 3 | if ( ! class_exists( 'Hustle_SShare_Admin' ) ) : |
| 4 | |
| 5 | class Hustle_SShare_Admin extends Hustle_Module_Page_Abstract { |
| 6 | |
| 7 | protected function set_page_properties() { |
| 8 | |
| 9 | $this->module_type = Hustle_Module_Model::SOCIAL_SHARING_MODULE; |
| 10 | |
| 11 | $this->page_title = Opt_In_Utils::get_module_type_display_name( $this->module_type, false, true ); |
| 12 | |
| 13 | $this->page_template_path = '/admin/sshare/listing'; |
| 14 | $this->page_edit_template_path = '/admin/sshare/wizard'; |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * Gets the JS variables to be localized in Wizard for Social Sharing modules. |
| 19 | * |
| 20 | * @since 4.3.0 |
| 21 | * |
| 22 | * @return array |
| 23 | */ |
| 24 | protected function get_wizard_js_variables_to_localize() { |
| 25 | $variables = array( |
| 26 | 'social_platforms' => Hustle_SShare_Model::get_social_platform_names(), |
| 27 | 'social_platforms_with_endpoints' => Hustle_SShare_Model::get_sharing_endpoints(), |
| 28 | 'social_platforms_with_api' => Hustle_SShare_Model::get_networks_counter_endpoint(), |
| 29 | 'social_platforms_data' => array( |
| 30 | 'email_message_default' => __( "I've found an excellent article on {post_url} which may interest you.", 'hustle' ), |
| 31 | ), |
| 32 | 'palettes' => array( |
| 33 | 'sshare_defaults' => $this->module->get_design()->defaults, |
| 34 | ), |
| 35 | ); |
| 36 | return $variables; |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Get the args for the wizard page. |
| 41 | * |
| 42 | * @since 4.0.1 |
| 43 | * @return array |
| 44 | */ |
| 45 | protected function get_page_edit_template_args() { |
| 46 | return array( |
| 47 | 'section' => $this->get_current_section( 'services' ), |
| 48 | 'module_id' => $this->module->module_id, |
| 49 | 'module' => $this->module, |
| 50 | 'is_active' => (bool) $this->module->active, |
| 51 | ); |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Loads preview styles used only by the Ssharing wizard. |
| 56 | * |
| 57 | * @since 4.3.1 |
| 58 | */ |
| 59 | protected function on_listing_and_wizard_actions() { |
| 60 | parent::on_listing_and_wizard_actions(); |
| 61 | |
| 62 | // Load preview scripts used only by ssharing wizard. |
| 63 | if ( $this->page_edit === $this->current_page ) { |
| 64 | add_action( 'admin_print_styles', array( $this, 'print_preview_styles' ) ); |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Prints the styles for Ssharing inline modules. |
| 70 | * |
| 71 | * @since 4.3.1 |
| 72 | */ |
| 73 | public function print_preview_styles() { |
| 74 | $module_types = array( Hustle_Module_Model::SOCIAL_SHARING_MODULE, Hustle_SShare_Model::INLINE_MODULE ); |
| 75 | Hustle_Module_Front::print_front_styles( $module_types ); |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | endif; |
| 80 |