Пример #1
0
 /**
  * Determine the type of the current optin(s) needed.
  *
  * @return array Array of current in use types in form of type => theme
  */
 static function determine_type()
 {
     $types = array_keys(Prompt_Optins::types());
     $themes = array_keys(Prompt_Optins::themes());
     $options = self::optins_options();
     $current_types = array();
     foreach ($types as $type) {
         $field = "optins_{$type}_enable";
         if ($options[$field]) {
             $theme_key = "optins_{$type}_theme";
             $theme = $options[$theme_key];
             $current_types[$type] = $theme;
         }
     }
     return $current_types;
 }
Пример #2
0
 /**
  * Instantiate SCB framework classes.
  */
 public static function action_plugins_loaded()
 {
     $invite_subject = sprintf(__('You\'re invited to subscribe to %s', 'Postmatic'), get_option('blogname'));
     $invite_intro = __('This is an invitation to subscribe to email updates from this website. We hope it is welcome, but we promise we won\'t contact you again unless you respond.', 'Postmatic');
     $subscribed_introduction = '<h2>' . __('Thanks for signing up!', 'Postmatic') . '</h2>' . '<p>' . __('We\'re glad you\'ve decided to join and hope you enjoy our posts.', 'Postmatic') . '</p>';
     $default_options = array('auto_subscribe_authors' => true, 'prompt_key' => '', 'site_subscription_post_types' => array('post'), 'skip_notices' => array(), 'skip_widget_intro' => false, 'skip_akismet_intro' => false, 'skip_zero_spam_intro' => false, 'skip_local_mail_intro' => false, 'skip_moderation_user_intro' => false, 'redirect_to_options_page' => true, 'send_login_info' => false, 'email_header_type' => Prompt_Enum_Email_Header_Types::TEXT, 'email_header_image' => 0, 'email_header_text' => get_option('blogname'), 'email_footer_type' => Prompt_Enum_Email_Footer_Types::WIDGETS, 'email_footer_text' => '', 'email_footer_credit' => true, 'plan' => '', 'email_transport' => Prompt_Enum_Email_Transports::LOCAL, 'messages' => array('welcome' => __('Welcome!', 'Postmatic')), 'invite_subject' => $invite_subject, 'invite_introduction' => $invite_intro, 'last_version' => 0, 'enable_collection' => false, 'site_icon' => 0, 'no_post_featured_image_default' => false, 'no_post_email_default' => false, 'enabled_message_types' => array(), 'excerpt_default' => false, 'comment_opt_in_default' => false, 'comment_opt_in_text' => __('Continue this conversation via email', 'Postmatic'), 'comment_flood_control_trigger_count' => 6, 'upgrade_required' => false, 'enable_optins' => false, 'enable_skimlinks' => false, 'skimlinks_publisher_id' => '', 'emails_per_chunk' => 25, 'enable_digests' => false, 'digest_plans' => array(), 'site_styles' => array(), 'enable_invites' => false, 'enable_mailchimp_import' => false, 'enable_jetpack_import' => false, 'enable_mailpoet_import' => false, 'enable_post_delivery' => true, 'enable_comment_delivery' => true, 'subscribed_introduction' => $subscribed_introduction, 'connected' => false, 'scr_import_done' => false);
     $default_options = array_merge($default_options, Prompt_Optins::options_fields());
     self::prevent_options_errors();
     self::$options = new scbOptions('prompt_options', __FILE__, $default_options);
     /**
      * Filter overridden options.
      *
      * @param array $overridden_options
      * @param array $current_options
      */
     $filtered_options = apply_filters('prompt/override_options', array(), self::$options->get());
     self::$overridden_options = wp_array_slice_assoc($filtered_options, array_keys(self::$options->get()));
     if (!empty(self::$overridden_options)) {
         self::$options->set(self::$overridden_options);
     }
     // Until we have a key we won't do much
     $key = self::$options->get('prompt_key');
     if ($key) {
         self::add_hooks();
     }
     if (is_admin()) {
         self::settings_page();
         self::delivery_metabox();
         self::text_metabox();
         self::$activate_notice = new Prompt_Admin_Activate_Notice($key, self::$settings_page);
     }
     /**
      * Fires when Postmatic has loaded.
      *
      * This happens after plugins are loaded {@see 'plugins_loaded'}, and always fires when Postmatic is active.
      *
      * @since 1.0.0
      */
     do_action('prompt/core_loaded');
 }
Пример #3
0
 /**
  * @since 2.0.0
  * @param string $id
  * @param string $name
  * @param string $prompt
  * @param array|string $values
  * @return string
  */
 protected function theme_chooser_html($id, $name, $prompt, $values)
 {
     $radio_buttons = array();
     foreach (Prompt_Optins::themes() as $slug => $label) {
         $input_attributes = array('type' => 'radio', 'name' => $name, 'value' => $slug);
         $value = is_array($values) ? $values[$name] : $values;
         if ($value === $slug) {
             $input_attributes['checked'] = 'checked';
         }
         $radio_buttons[] = html('label', array('class' => $slug), html('input', $input_attributes), $label);
     }
     return html('div class="theme-chooser"', array('id' => $id), html('h3', $prompt), implode('', $radio_buttons));
 }