コード例 #1
0
ファイル: editor.php プロジェクト: maesson/lyft
 public function TinyMCEInit($initArray)
 {
     // Add Modal styles to styles dropdown
     $styles = !empty($initArray['style_formats']) && is_array(json_decode($initArray['style_formats'])) ? json_decode($initArray['style_formats']) : array();
     foreach (get_all_modals() as $modal) {
         $styles[] = array('title' => "Open Modal - {$modal->name}", 'inline' => 'span', 'classes' => "eModal-{$modal->id}");
     }
     $initArray['style_formats'] = json_encode($styles);
     return $initArray;
 }
コード例 #2
0
ファイル: modals.php プロジェクト: maesson/lyft
 public static function load_modals()
 {
     foreach (self::get_enqueued_modals() as $id) {
         if (!array_key_exists($id, self::$loaded_modals)) {
             foreach (get_all_modals("is_trash != 1 AND id IN ({$ids})") as $modal) {
                 self::$loaded_modals[$modal->id] = apply_filters('emodal_load_modal_settings', $modal->as_array());
                 do_action('emodal_preload_modal', $modal);
                 do_action('emodal_load_modal', $modal);
             }
         }
     }
 }
コード例 #3
0
/**
 * Import
 *
 * Runs on plugin install by setting up the post types, custom taxonomies,
 * flushing rewrite rules also creates the plugin and populates the settings
 * fields for those plugin pages. After successful install, the user is
 * redirected to the POPMAKE_EMODAL Welcome screen.
 *
 * @since 1.0
 * @global $wpdb
 * @global $popmake_options
 * @global $wp_version
 * @return void
 */
function popmake_emodal_v2_import()
{
    global $wpdb, $popmake_options, $wp_version, $popmake_tools_page;
    require_once POPMAKE_DIR . 'includes/importer/easy-modal-v2/functions.php';
    if (!class_exists('EModal_Model')) {
        require_once POPMAKE_DIR . '/includes/importer/easy-modal-v2/model.php';
    }
    if (!class_exists('EModal_Model_Modal')) {
        require_once POPMAKE_DIR . '/includes/importer/easy-modal-v2/model/modal.php';
    }
    if (!class_exists('EModal_Model_Theme')) {
        require_once POPMAKE_DIR . '/includes/importer/easy-modal-v2/model/theme.php';
    }
    if (!class_exists('EModal_Model_Theme_Meta')) {
        require_once POPMAKE_DIR . '/includes/importer/easy-modal-v2/model/theme/meta.php';
    }
    if (!class_exists('EModal_Model_Modal_Meta')) {
        require_once POPMAKE_DIR . '/includes/importer/easy-modal-v2/model/modal/meta.php';
    }
    $themes = get_all_modal_themes('1 = 1');
    $theme_id_map = array();
    foreach ($themes as $Theme) {
        $theme = $Theme->as_array();
        $meta = $theme['meta'];
        $theme_meta = apply_filters('popmake_emodal_import_theme_meta', array('popup_theme_defaults_set' => true, 'popup_theme_overlay_background_color' => $meta['overlay']['background']['color'], 'popup_theme_overlay_background_opacity' => $meta['overlay']['background']['opacity'], 'popup_theme_container_padding' => $meta['container']['padding'], 'popup_theme_container_background_color' => $meta['container']['background']['color'], 'popup_theme_container_background_opacity' => $meta['container']['background']['opacity'], 'popup_theme_container_border_radius' => $meta['container']['border']['radius'], 'popup_theme_container_border_style' => $meta['container']['border']['style'], 'popup_theme_container_border_color' => $meta['container']['border']['color'], 'popup_theme_container_border_width' => $meta['container']['border']['width'], 'popup_theme_container_boxshadow_inset' => $meta['container']['boxshadow']['inset'], 'popup_theme_container_boxshadow_horizontal' => $meta['container']['boxshadow']['horizontal'], 'popup_theme_container_boxshadow_vertical' => $meta['container']['boxshadow']['vertical'], 'popup_theme_container_boxshadow_blur' => $meta['container']['boxshadow']['blur'], 'popup_theme_container_boxshadow_spread' => $meta['container']['boxshadow']['spread'], 'popup_theme_container_boxshadow_color' => $meta['container']['boxshadow']['color'], 'popup_theme_container_boxshadow_opacity' => $meta['container']['boxshadow']['opacity'], 'popup_theme_title_font_color' => $meta['title']['font']['color'], 'popup_theme_title_line_height' => $meta['title']['font']['size'], 'popup_theme_title_font_size' => $meta['title']['font']['size'], 'popup_theme_title_font_family' => $meta['title']['font']['family'], 'popup_theme_title_font_weight' => $meta['title']['font']['weight'], 'popup_theme_title_font_style' => $meta['title']['font']['style'], 'popup_theme_title_text_align' => $meta['title']['text']['align'], 'popup_theme_title_textshadow_horizontal' => $meta['title']['textshadow']['horizontal'], 'popup_theme_title_textshadow_vertical' => $meta['title']['textshadow']['vertical'], 'popup_theme_title_textshadow_blur' => $meta['title']['textshadow']['blur'], 'popup_theme_title_textshadow_color' => $meta['title']['textshadow']['color'], 'popup_theme_title_textshadow_opacity' => $meta['title']['textshadow']['opacity'], 'popup_theme_content_font_color' => $meta['content']['font']['color'], 'popup_theme_content_font_family' => $meta['content']['font']['family'], 'popup_theme_content_font_weight' => $meta['content']['font']['weight'], 'popup_theme_content_font_style' => $meta['content']['font']['style'], 'popup_theme_close_text' => $meta['close']['text'], 'popup_theme_close_padding' => $meta['close']['padding'], 'popup_theme_close_location' => $meta['close']['location'], 'popup_theme_close_position_top' => $meta['close']['position']['top'], 'popup_theme_close_position_left' => $meta['close']['position']['left'], 'popup_theme_close_position_bottom' => $meta['close']['position']['bottom'], 'popup_theme_close_position_right' => $meta['close']['position']['right'], 'popup_theme_close_line_height' => $meta['close']['font']['size'], 'popup_theme_close_font_color' => $meta['close']['font']['color'], 'popup_theme_close_font_size' => $meta['close']['font']['size'], 'popup_theme_close_font_family' => $meta['close']['font']['family'], 'popup_theme_close_font_weight' => $meta['close']['font']['weight'], 'popup_theme_close_font_style' => $meta['close']['font']['style'], 'popup_theme_close_background_color' => $meta['close']['background']['color'], 'popup_theme_close_background_opacity' => $meta['close']['background']['opacity'], 'popup_theme_close_border_radius' => $meta['close']['border']['radius'], 'popup_theme_close_border_style' => $meta['close']['border']['style'], 'popup_theme_close_border_color' => $meta['close']['border']['color'], 'popup_theme_close_border_width' => $meta['close']['border']['width'], 'popup_theme_close_boxshadow_inset' => $meta['close']['boxshadow']['inset'], 'popup_theme_close_boxshadow_horizontal' => $meta['close']['boxshadow']['horizontal'], 'popup_theme_close_boxshadow_vertical' => $meta['close']['boxshadow']['vertical'], 'popup_theme_close_boxshadow_blur' => $meta['close']['boxshadow']['blur'], 'popup_theme_close_boxshadow_spread' => $meta['close']['boxshadow']['spread'], 'popup_theme_close_boxshadow_color' => $meta['close']['boxshadow']['color'], 'popup_theme_close_boxshadow_opacity' => $meta['close']['boxshadow']['opacity'], 'popup_theme_close_textshadow_horizontal' => $meta['close']['textshadow']['horizontal'], 'popup_theme_close_textshadow_vertical' => $meta['close']['textshadow']['vertical'], 'popup_theme_close_textshadow_blur' => $meta['close']['textshadow']['blur'], 'popup_theme_close_textshadow_color' => $meta['close']['textshadow']['color'], 'popup_theme_close_textshadow_opacity' => $meta['close']['textshadow']['opacity']), $Theme);
        $new_theme_id = wp_insert_post(array('post_title' => $theme['name'], 'post_status' => $theme['is_trash'] ? 'trash' : 'publish', 'post_author' => get_current_user_id(), 'post_type' => 'popup_theme', 'comment_status' => 'closed'));
        foreach ($theme_meta as $meta_key => $meta_value) {
            update_post_meta($new_theme_id, $meta_key, $meta_value);
        }
        update_post_meta($new_theme_id, 'popup_theme_old_easy_modal_id', $theme['id']);
        $theme_id_map[$theme['id']] = $new_theme_id;
    }
    if (count($themes) == 1) {
        update_post_meta($new_theme_id, 'popup_theme_defaults_set', true);
        update_option('popmake_default_theme', $new_theme_id);
    }
    $modals = get_all_modals('1 = 1');
    //echo '<pre>'; var_export(popmake_popup_meta_fields()); echo '</pre>';
    foreach ($modals as $Modal) {
        $modal = $Modal->as_array();
        $meta = $modal['meta'];
        $modal_meta = apply_filters('popmake_emodal_import_modal_meta', array('popup_old_easy_modal_id' => $modal['id'], 'popup_defaults_set' => true, 'popup_theme' => isset($theme_id_map[$theme['id']]) ? $theme_id_map[$theme['id']] : null, 'popup_title' => $modal['title'], 'popup_display_scrollable_content' => null, 'popup_display_overlay_disabled' => $meta['display']['overlay_disabled'], 'popup_display_size' => $meta['display']['size'], 'popup_display_responsive_min_width' => '', 'popup_display_responsive_min_width_unit' => 'px', 'popup_display_responsive_max_width' => '', 'popup_display_responsive_max_width_unit' => 'px', 'popup_display_custom_width' => $meta['display']['custom_width'], 'popup_display_custom_width_unit' => $meta['display']['custom_width_unit'], 'popup_display_custom_height' => $meta['display']['custom_height'], 'popup_display_custom_height_unit' => $meta['display']['custom_height_unit'], 'popup_display_custom_height_auto' => $meta['display']['custom_height_auto'], 'popup_display_location' => $meta['display']['location'], 'popup_display_position_top' => $meta['display']['position']['top'], 'popup_display_position_left' => $meta['display']['position']['left'], 'popup_display_position_bottom' => $meta['display']['position']['bottom'], 'popup_display_position_right' => $meta['display']['position']['right'], 'popup_display_position_fixed' => $meta['display']['position']['fixed'], 'popup_display_animation_type' => $meta['display']['animation']['type'], 'popup_display_animation_speed' => $meta['display']['animation']['speed'], 'popup_display_animation_origin' => $meta['display']['animation']['origin'], 'popup_close_overlay_click' => $meta['close']['overlay_click'], 'popup_close_esc_press' => $meta['close']['esc_press'], 'popup_close_f4_press' => null), $Modal);
        if ($modal['is_sitewide'] == 1) {
            $modal_meta['popup_targeting_condition_on_entire_site'] = true;
        }
        $new_modal_id = wp_insert_post(array('post_title' => $modal['name'], 'post_status' => $modal['is_trash'] ? 'trash' : 'publish', 'post_content' => $modal['content'], 'post_author' => get_current_user_id(), 'post_type' => 'popup', 'comment_status' => 'closed'));
        foreach ($modal_meta as $meta_key => $meta_value) {
            update_post_meta($new_modal_id, $meta_key, $meta_value);
        }
    }
}
コード例 #4
0
ファイル: postmeta.php プロジェクト: RomualdKarbido/Zeroom
function emodal_post_meta_box_setting_load($object)
{
    $current_modals = get_post_meta($object->ID, EMCORE_SLUG . '_post_modals', true);
    $modals = get_all_modals("is_trash != 1 AND is_sitewide = 0");
    wp_nonce_field(EMCORE_NONCE, EMCORE_NONCE);
    ?>
	<?php 
    if (count($modals)) {
        ?>
	<tr>
		<th scope="row">
			<label><?php 
        _e('Select which modals to load', EMCORE_SLUG);
        ?>
</label>
		</th>
		<td>
			<div class="scrollable-checkboxes" style="padding:5px 10px;border:1px solid #eee;max-height:200px;overflow-y:scroll;">
				<?php 
        foreach ($modals as $modal) {
            ?>
				<label class="selectit"><input type="checkbox" name="emodal_post_modals[]" value="<?php 
            esc_attr_e($modal->id);
            ?>
"<?php 
            esc_attr_e(is_array($current_modals) && in_array($modal->id, $current_modals) ? ' checked="checked"' : '');
            ?>
> <?php 
            esc_html_e($modal->name);
            ?>
</label><br/>
				<?php 
        }
        ?>
			</div>
			<p class="description"><?php 
        _e('Choose witch modal will be loaded on this page.', EMCORE_SLUG);
        ?>
</p>
		</td>
	</tr>
	<?php 
    }
}