array( 'id' => 3, 'type' => 'text', 'placeholder' => 'What\'s the plugin\'s name?', ), 'I could not get the plugin to work' => array( 'id' => 4, ), 'I no longer need the plugin' => array( 'id' => 5, 'type' => 'textarea', 'placeholder' => 'If you could improve one thing about our product, what would it be?', ), 'It\'s a temporary deactivation. I\'m just debugging an issue.' => array( 'id' => 6, ), ); /** * @var array $options_theme The main options list for themes. */ private $options_theme = array( 'I don\'t know how to make it look like demo' => array( 'id' => 7, ), 'It lacks options' => array( 'id' => 8, ), 'Is not working with a plugin that I need' => array( 'id' => 9, 'type' => 'text', 'placeholder' => 'What is the name of the plugin', ), 'I want to try a new design, I don\'t like {theme} style' => array( 'id' => 10, ), ); /** * @var array $other The other option */ private $other = array( 'Other' => array( 'id' => 999, 'type' => 'textarea', 'placeholder' => 'cmon cmon tell us', ), ); /** * @var string $heading_plugin The heading of the modal */ private $heading_plugin = 'Quick Feedback Because we care about our clients, please leave us a feedback.'; /** * @var string $heading_theme The heading of the modal */ private $heading_theme = 'Looking to change {theme} What does not work for you?'; /** * @var string $button_submit_before The text of the deactivate button before an option is chosen */ private $button_submit_before = 'Skip & Deactivate'; /** * @var string $button_submit The text of the deactivate button */ private $button_submit = 'Submit & Deactivate'; /** * @var string $button_cancel The text of the cancel button */ private $button_cancel = 'Skip & Deactivate'; /** * @var int how many seconds before the deactivation window is triggered for themes */ const AUTO_TRIGGER_DEACTIVATE_WINDOW_SECONDS = 3; /** * @var int how many days before the deactivation window pops up again for the theme */ const PAUSE_DEACTIVATE_WINDOW_DAYS = 100; /** * ThemeIsle_SDK_Feedback_Deactivate constructor. * * @param ThemeIsle_SDK_Product $product_object The product object. */ public function __construct( $product_object ) { parent::__construct( $product_object ); } /** * Registers the hooks */ public function setup_hooks_child() { global $pagenow; if ( ( $this->product->get_type() === 'plugin' && $pagenow === 'plugins.php' ) || ( $this->product->get_type() === 'theme' && $pagenow === 'theme-install.php' ) ) { add_action( 'admin_head', array( $this, 'load_resources' ) ); } add_action( 'wp_ajax_' . $this->product->get_key() . __CLASS__, array( $this, 'post_deactivate' ) ); } /** * Loads the additional resources */ function load_resources() { add_thickbox(); $id = $this->product->get_key() . '_deactivate'; $this->add_css( $this->product->get_type(), $this->product->get_key() ); $this->add_js( $this->product->get_type(), $this->product->get_key(), '#TB_inline?' . apply_filters( $this->product->get_key() . '_feedback_deactivate_attributes', 'width=600&height=550' ) . '&inlineId=' . $id ); echo '
'; } /** * Loads the css * * @param string $type The type of product. * @param string $key The product key. */ function add_css( $type, $key ) { $suffix = 'theme' === $type ? 'theme-install-php' : 'plugins-php'; ?> heading_plugin : str_replace( '{theme}', $this->product->get_name(), $this->heading_theme ); $heading = apply_filters( $this->product->get_key() . '_feedback_deactivate_heading', $heading ); ?> options_plugin : $this->options_theme; $button_submit_before = 'plugin' === $type ? $this->button_submit_before : 'Submit'; $button_submit = 'plugin' === $type ? $this->button_submit : 'Submit'; $options = $this->randomize_options( apply_filters( $this->product->get_key() . '_feedback_deactivate_options', $options ) ); $button_submit_before = apply_filters( $this->product->get_key() . '_feedback_deactivate_button_submit_before', $button_submit_before ); $button_submit = apply_filters( $this->product->get_key() . '_feedback_deactivate_button_submit', $button_submit ); $button_cancel = apply_filters( $this->product->get_key() . '_feedback_deactivate_button_cancel', $this->button_cancel ); $options += $this->other; $list = ''; foreach ( $options as $title => $attributes ) { $id = $attributes['id']; $list .= '