コード例 #1
0
     * @author Antonio La Rocca <*****@*****.**>
     */
    private function get_popup_template_path()
    {
        $plugin_url = $this->plugin_template_path . "/popup/popup_template.php";
        $template_url = (defined('YIT') ? YIT_THEME_TEMPLATES_PATH : get_template_directory()) . "/popup/popup_template.php";
        $child_url = (defined('YIT') ? str_replace(get_template_directory(), get_stylesheet_directory(), YIT_THEME_TEMPLATES_PATH) : get_stylesheet_directory()) . "/popup/popup_template.php";
        foreach (array('child_url', 'template_url', 'plugin_url') as $var) {
            if (file_exists(${$var})) {
                return ${$var};
            }
        }
        return false;
    }
}
/**
 * Main instance of plugin
 *
 * @return object
 * @since  1.0
 * @author Emanuela Castorina <*****@*****.**>
 */
function YIT_Newsletter()
{
    return YIT_Newsletter::instance();
}
/**
 * Create a new YIT_NEWSLETTER object
 */
YIT_Newsletter();
コード例 #2
0
?>
                </div>

            </li>
            <li>
                <input type="hidden" name="yit_mailchimp_newsletter_form_id" value="<?php 
echo $post_id;
?>
"/>
                <input type="hidden" name="action" value="subscribe_mailchimp_user"/>
                <?php 
wp_nonce_field('yit_mailchimp_newsletter_form_nonce', 'yit_mailchimp_newsletter_form_nonce');
?>
                <input class="button btn submit-field mailchimp-subscription-ajax-submit <?php 
echo $button_class;
?>
" type="button" value="<?php 
echo $button_text;
?>
" />
            </li>
        </ul>
    </fieldset>
</form>

<?php 
wp_enqueue_script('yit-mailchimp-ajax-send-form', YIT_Newsletter()->plugin_assets_url . '/js/mailchimp-ajax-subscribe.js', array('jquery'), '', true);
wp_localize_script('yit-mailchimp-ajax-send-form', 'mailchimp_localization', array('url' => admin_url('admin-ajax.php'), 'error_message' => 'Ops! Something went wrong'));
?>

コード例 #3
0
ファイル: Mailchimp.php プロジェクト: lieison/IndustriasFenix
 /**
  * Get Mailchimp list for the apikey set in db
  *
  * Get mailchimp lists; if no apikey is set, return false. If lists are stored in a transient, return the transient.
  * If no transient is set for lists, get the list from mailchimp server, store the transient and return the list.
  * If update is set, force the update of the list and of the transient
  *
  * @param boolean $update Whether to update list or no. Default false
  * @param int $post_id Post id
  *
  * @return boolean|mixed array()
  * @since 1.0.0
  * @author Antonio La Rocca <*****@*****.**>
  */
 public function get_mailchimp_lists($update = false, $post_id)
 {
     $apikey = YIT_Newsletter()->get_meta('_mailchimp-apikey', $post_id);
     if (isset($apikey) && strcmp($apikey, '') != 0) {
         if (!$update) {
             $transient = get_transient('yit-mailchimp-newsletter-list');
             if ($transient !== false) {
                 return $transient;
             } else {
                 return $this->set_mailchimp_lists($apikey, $post_id);
             }
         } else {
             return $this->set_mailchimp_lists($apikey, $post_id);
         }
     } else {
         return false;
     }
 }
コード例 #4
0
    /**
     * Form
     *
     * Show the option panel of the widget
     *
     * @param $instance
     *
     * @return void
     * @since  Version 1.0
     * @author Antonio La Rocca <*****@*****.**>
     * @author Francesco Licandro <*****@*****.**>
     */
    public function form($instance)
    {
        $defaults = array('title' => '', 'subtitle' => '', 'icon_form' => '-1', 'post_name' => '-1', 'text' => '', 'with_border' => 'yes', 'button_class' => '');
        $instance = wp_parse_args((array) $instance, $defaults);
        $instance['title'] = strip_tags($instance['title']);
        $instance['text'] = esc_textarea($instance['text']);
        $icons = YIT_Plugin_Common::get_awesome_icons();
        $posts = get_posts(array('posts_per_page' => -1, 'post_type' => YIT_Newsletter()->newsletter_post_type));
        ?>
        <p>
            <label>
                <strong><?php 
        _e('Widget Title', 'yit');
        ?>
:</strong><br />
                <input class="widefat" type="text" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" value="<?php 
        echo $instance['title'];
        ?>
" />
            </label>
        </p>
        <p>
            <label>
                <strong><?php 
        _e('Widget Subtitle', 'yit');
        ?>
:</strong><br />
                <input class="widefat" type="text" id="<?php 
        echo $this->get_field_id('subtitle');
        ?>
" name="<?php 
        echo $this->get_field_name('subtitle');
        ?>
" value="<?php 
        echo $instance['subtitle'];
        ?>
" />
            </label>
        </p>
        <p>
            <label>
                <strong><?php 
        _e('Newsletter Form', 'yit');
        ?>
:</strong>
            </label>
            <select id="<?php 
        echo $this->get_field_id('post_name');
        ?>
" name="<?php 
        echo $this->get_field_name('post_name');
        ?>
">
                <option value="-1">Select your option</option>
                <?php 
        foreach ($posts as $post) {
            ?>
                    <option value="<?php 
            echo $post->post_name;
            ?>
" <?php 
            selected($post->post_name, $instance['post_name']);
            ?>
 ><?php 
            echo strcmp($post->post_title, '') != 0 ? $post->post_title : $post->post_name;
            ?>
</option>
                <?php 
        }
        ?>
            </select>
        </p>
        <p>
            <label>
                <strong><?php 
        _e('Newsletter Form Icon', 'yit');
        ?>
:</strong>
                <select id="<?php 
        echo $this->get_field_id('icon_form');
        ?>
" name="<?php 
        echo $this->get_field_name('icon_form');
        ?>
">
                    <option value="-1">Select your option</option>
                    <?php 
        foreach ($icons as $id => $icon) {
            ?>
                        <option value="<?php 
            echo $id;
            ?>
" <?php 
            selected($id, $instance['icon_form']);
            ?>
 ><?php 
            echo $icon;
            ?>
</option>
                    <?php 
        }
        ?>
                </select>
            </label>
        </p>
        <p>
            <label>
                <strong><?php 
        _e('Form Border', 'yit');
        ?>
</strong>
                <select id="<?php 
        echo $this->get_field_id('with_border');
        ?>
" name="<?php 
        echo $this->get_field_name('with_border');
        ?>
">
                    <option value="yes" <?php 
        selected('yes', $instance['with_border']);
        ?>
 ><?php 
        _e('Yes', 'yit');
        ?>
</option>
                    <option value="no" <?php 
        selected('no', $instance['with_border']);
        ?>
 ><?php 
        _e('No', 'yit');
        ?>
</option>
                </select>
            </label>
        </p>
        <p>
            <label>
                <strong><?php 
        _e('Button Class', 'yit');
        ?>
</strong>
                <input type="text" class="widefat" id="<?php 
        echo $this->get_field_id('button_class');
        ?>
" name="<?php 
        echo $this->get_field_name('button_class');
        ?>
" value="<?php 
        echo $instance['button_class'];
        ?>
">
            </label>
        </p>
        <p>
            <label>
                <strong><?php 
        _e('Widget Text', 'yit');
        ?>
:</strong><br />
                <textarea class="widefat" rows="16" cols="20" id="<?php 
        echo $this->get_field_id('text');
        ?>
" name="<?php 
        echo $this->get_field_name('text');
        ?>
"><?php 
        echo $instance['text'];
        ?>
</textarea>

            </label>
        </p>
    <?php 
    }
コード例 #5
0
<?php

/**
 * This file belongs to the YIT Plugin Framework.
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-3.0.txt
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
return array('general' => array('home' => array(array('name' => __('Newsletter Popup General Settings', 'yiw'), 'type' => 'title'), array('type' => 'close')), 'general' => array(array('type' => 'open'), array('name' => __('Enable Newsletter Popup', 'yit'), 'desc' => __('Enable the newsletter popup. (Default: Off) ', 'yit'), 'id' => 'newsletter_popup_enable', 'type' => 'on-off', 'std' => 'no'), array('name' => __('Show on all pages', 'yit'), 'desc' => __('Enable newsletter popup for all pages. (Default: Off) ', 'yit'), 'id' => 'newsletter_enabled_everywhere', 'type' => 'on-off', 'std' => 'yes'), array('name' => __('Select where you want to show popup', 'yit'), 'desc' => __('Select pages where you want to show popup. ', 'yit'), 'id' => 'newsletter_popup_pages', 'type' => 'chosen', 'multiple' => true, 'options' => YIT_Newsletter()->get_available_pages(), 'std' => array(), 'deps' => array('ids' => 'newsletter_enabled_everywhere', 'values' => 'no')), array('name' => __('Hide policy', 'yit'), 'desc' => __('Select when popup should hide. (Default: Hide only on hiding checkbox checked) ', 'yit'), 'id' => 'newsletter_hide_policy', 'type' => 'select', 'options' => array('always' => __('Hide only on hiding checkbox checked', 'yit'), 'session' => __('Show only one time for session', 'yit')), 'std' => 'yes'), array('name' => __('Enable Form Popup', 'yit'), 'desc' => __('Enable a newsletter subscription form in the popup. (Default: Off) ', 'yit'), 'id' => 'newsletter_form_enable', 'type' => 'on-off', 'std' => 'no'), array('name' => __('Select newsletter form to use in popup', 'yit'), 'desc' => __('Select the form you want to use in your popup; if no form is shown, you may have to create a new one', 'yit'), 'id' => 'newsletter_form', 'type' => 'select', 'options' => YIT_Newsletter()->get_newsletter_post(), 'std' => apply_filters('yit_newsletter_popup_form_std', false), 'deps' => array('ids' => 'newsletter_form_enable', 'values' => 'yes')), array('name' => __('Cookie Variable', 'yit'), 'desc' => __('Write here a name to be given to the cookie generated by the closing link of the popup, in this way, as soon as you\'ll change this value all your visitors will see it again even if they disabled it. Don\'t abuse of this function!', 'yit'), 'id' => 'newsletter_popup_cookie_var', 'type' => 'text', 'std' => __('yithpopup', 'yit')), array('name' => __('Popup Title', 'yit'), 'desc' => __('The title displayed. You can also use HTML code.', 'yit'), 'id' => 'newsletter_popup_title', 'type' => 'text', 'std' => __('Join our faboulous community today!', 'yit')), array('name' => __('Popup Image', 'yit'), 'desc' => __('Upload an image. (Tip: best viewed with a rectangular image sized like 315px X 225px)', 'yit'), 'id' => 'newsletter_popup_image', 'type' => 'upload', 'std' => apply_filters('yit_newsletter_popup_image_std', YIT_Newsletter()->plugin_assets_url . '/images/popup/popup.jpg')), array('name' => __('Popup Message', 'yit'), 'desc' => __('The message displayed. You can also use HTML code.', 'yit'), 'id' => 'newsletter_popup_message', 'type' => 'textarea', 'std' => __('Write your message here', 'yit')), array('name' => __('Hiding text', 'yit'), 'desc' => __('The title displayed next to the checkbox that let users hide the popup forever. You can also use HTML code.', 'yit'), 'id' => 'newsletter_popup_hide_text', 'type' => 'text', 'std' => __('Do not show it anymore.', 'yit')), array('name' => __('Button Class', 'yit'), 'desc' => __('The class of form button.', 'yit'), 'id' => 'newsletter_button_class', 'type' => 'text', 'std' => '', 'deps' => array('ids' => 'newsletter_form_enable', 'values' => 'yes')), array('name' => __('Custom style', 'yit'), 'desc' => __('Insert here your custom CSS style.', 'yit'), 'id' => 'newsletter_custom_style', 'type' => 'textarea', 'std' => ''), array('type' => 'close'))));
コード例 #6
0
<?php

/**
 * This file belongs to the YIT Plugin Framework.
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-3.0.txt
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
$selected_product_id = YIT_Newsletter()->get_option('newsletter_popup_woocommerce_ids');
$selected_product_name = sprintf('#%d - %s', $selected_product_id, get_the_title($selected_product_id));
return array('woocommerce' => array('home' => array(array('name' => __('Newsletter WooCommerce Settings', 'yiw'), 'type' => 'title'), array('type' => 'close')), 'general' => array(array('type' => 'open'), array('name' => __('Enable WooCommerce Integration Popup', 'yit'), 'desc' => __('If the option is enabled, the popup shows the informations about the WooCommerce products selected below. (Default: Off) ', 'yit'), 'id' => 'newsletter_popup_woocommerce_integration_enable', 'type' => 'on-off', 'std' => 'no'), array('name' => __('Woocommerce Product', 'yit'), 'desc' => __('Select the product that you would like to show in your popup. (If no select appears, just insert the ID of the selected product)', 'yit'), 'id' => 'newsletter_popup_woocommerce_ids', 'type' => 'text', 'std' => apply_filters('yit_newsletter_popup_woocommerce_ids_std', ''), 'custom_attributes' => array('class' => 'wc-product-search', 'style' => 'height: 27px; width: 300px;', 'data-placeholder' => __('Select a product', 'yit'), 'data-selected' => $selected_product_name), 'deps' => array('ids' => 'newsletter_popup_woocommerce_integration_enable', 'values' => 'yes')), array('name' => __('Woocommerce add to cart button', 'yit'), 'desc' => __('Write here the text that you would like to display in "Add to cart" button', 'yit'), 'id' => 'newsletter_popup_woocommerce_button', 'type' => 'text', 'std' => '', 'deps' => array('ids' => 'newsletter_popup_woocommerce_integration_enable', 'values' => 'yes')), array('type' => 'close'))));
コード例 #7
0
ファイル: Wysija.php プロジェクト: lieison/IndustriasFenix
 /**
  * Subscribe Mailpoet user
  *
  * Add user to a mailpoet list posted via AJAX-Request to wp_ajax_subscribe_mailpoet_user action
  *
  * @return void
  * @since 1.0.0
  * @author Antonio La Rocca <*****@*****.**>
  */
 public function subscribe_mailpoet_user()
 {
     $post_id = $_REQUEST['yit_mailpoet_newsletter_form_id'];
     $mail = $_REQUEST['yit_mailpoet_newsletter_form_email'];
     $list = "";
     if (isset($post_id) && strcmp($post_id, '') != 0) {
         $list = YIT_Newsletter()->get_meta('_mailpoet-list', $post_id);
     }
     if (isset($mail) && is_email($mail)) {
         if (isset($list) && strcmp($list, '-1') != 0 && check_ajax_referer('yit_mailpoet_newsletter_form_nonce', 'yit_mailpoet_newsletter_form_nonce', false)) {
             $user_data = array('email' => $mail);
             $data_subscriber = array('user' => $user_data, 'user_list' => array('list_ids' => array($list)));
             $helper_user = WYSIJA::get('user', 'helper');
             $helper_user->addSubscriber($data_subscriber);
             _e('Email succesfully registered', 'yit');
             die;
         } else {
             _e('Ops! Something went wrong', 'yit');
             die;
         }
     } else {
         _e('Ops! You have to insert a valid email', 'yit');
         die;
     }
 }
コード例 #8
0
            $popup_message = $woocommerce_product->post->post_content;
            $product_type = $woocommerce_product->product_type;
            if ($product_type == "simple") {
                $yit_addtocart_url = add_query_arg('add-to-cart', $woocommerce_product->id, home_url());
            } elseif ($product_type == 'variation') {
                $yit_addtocart_url = add_query_arg('add-to-cart', $woocommerce_product->id, home_url());
                $yit_addtocart_url = add_query_arg('variation_id', $woocommerce_product->id, $yit_addtocart_url);
                $yit_addtocart_url = add_query_arg('product_id', $woocommerce_product->id, $yit_addtocart_url);
                $yit_addtocart_url = add_query_arg('quantity', 1, $yit_addtocart_url);
                if (!empty($woocommerce_product->variation_data)) {
                    foreach ($woocommerce_product->variation_data as $attribute => $value) {
                        $yit_addtocart_url = add_query_arg($attribute, $value, $yit_addtocart_url);
                    }
                }
            }
            $woocommerce_button_text = YIT_Newsletter()->get_option('newsletter_popup_woocommerce_button');
            $popup_addtocart_text = !empty($woocommerce_button_text) ? $woocommerce_button_text : $woocommerce_product->add_to_cart_text();
        }
    }
}
$show_right = $enable_form == 'yes' || $use_wc || isset($popup_message) && $popup_message != '';
?>
<!-- yit-newsletter-popup -->
<div class="yit-popup-container">
    <h2 id="yit-popup-title"><?php 
echo $popup_title;
?>
</h2>
    <div id="yit-popup-border" class="group <?php 
if ($use_wc) {
    ?>
コード例 #9
0
                echo $incipit;
                ?>
</span><?php 
            }
            ?>
    </div>

	<?php 
        } else {
            $center = 'newsletter-call3-center';
        }
        ?>

	<div class="newsletter-call3 <?php 
        echo $center;
        ?>
 clearfix">
        <?php 
        if (yit_plugin_locate_template(YIT_Newsletter()->plugin_path, 'newsletter-services/' . $integration . '.php')) {
            yit_plugin_get_template(YIT_Newsletter()->plugin_path, 'newsletter-services/' . $integration . '.php', $args);
        }
        ?>
	</div>
	<div class="clear"></div>

    </div>

</div>
<?php 
    }
}