public static function getInstance() { if (!self::$instance) { self::$instance = new WPDD_Layouts_CSSFrameworkOptions(); } return self::$instance; }
function wpv_layout_wizard_load_settings() { $settings = get_post_meta($_POST["view_id"], '_wpv_layout_settings', true); global $WPV_settings; if (class_exists('WPDD_Layouts_CSSFrameworkOptions')) { $bootstrap_ver = WPDD_Layouts_CSSFrameworkOptions::getInstance()->get_current_framework(); $settings['wpv_bootstrap_version'] = str_replace('bootstrap-', '', $bootstrap_ver); } else { $settings['wpv_bootstrap_version'] = 1; //Load bootstrap version from views settings if (isset($WPV_settings['wpv_bootstrap_version'])) { $settings['wpv_bootstrap_version'] = $WPV_settings['wpv_bootstrap_version']; } } return $settings; }
function wpv_bootstrap_options($options) { $disabled = ''; $disabled_message = ''; if (class_exists('WPDD_Layouts_CSSFrameworkOptions')) { $disabled = ' disabled="disabled" readonly="readonly" '; $framework = WPDD_Layouts_CSSFrameworkOptions::getInstance()->get_current_framework(); $disabled_message = '<p><strong>' . sprintf(__("Bootstrap version overriden by the Layouts plugin settings to use Bootstrap v.%s", 'wpv-views'), str_replace('bootstrap-', '', $framework)) . '</strong></p>'; } ?> <div class="wpv-setting-container"> <div class="wpv-settings-header"> <h3><?php _e('Bootstrap Layouts', 'wpv-views'); ?> </h3> </div> <div class="wpv-setting"> <p> <?php _e("You can set here the Bootstrap version that you want to use, based on the one <strong>provided by your theme</strong>. We will then generate the right markup in the Views Layouts Wizard when using the Bootstrap Grid option.", 'wpv-views'); ?> </p> <?php echo $disabled_message; ?> <p> <?php echo sprintf(__('You can get the details in the <a href="%s" title="Documentation on the Bootstrap Layouts">documentation page</a>.', 'wpv-views'), 'http://wp-types.com/documentation/user-guides/view-layouts-101/?utm_source=viewsplugin&utm_campaign=views&utm_medium=views-settings&utm_term=documentation page#bootstrap'); ?> </p> <ul class="js-bootstrap-version-form"> <li> <label> <input type="radio" name="wpv-bootstrap-version" class="js-wpv-bootstrap-version" value="1" <?php checked($this->wpv_bootstrap_version == 1); disabled($disabled); ?> /> <?php _e("Bootstrap version not set", 'wpv-views'); ?> </label> </li> <li> <label> <input type="radio" name="wpv-bootstrap-version" class="js-wpv-bootstrap-version" value="2" <?php checked($this->wpv_bootstrap_version == 2); disabled($disabled); ?> /> <?php _e("Bootstrap v. 2.0", 'wpv-views'); ?> </label> </li> <li> <label> <input type="radio" name="wpv-bootstrap-version" class="js-wpv-bootstrap-version" value="3" <?php checked($this->wpv_bootstrap_version == 3); disabled($disabled); ?> /> <?php _e("Bootstrap v. 3.0", 'wpv-views'); ?> </label> </li> </ul> <?php wp_nonce_field('wpv_bootstrap_version_nonce', 'wpv_bootstrap_version_nonce'); ?> <p class="update-button-wrap"> <span class="js-wpv-bootstrap-version-update-message toolset-alert toolset-alert-success hidden"> <?php _e('Settings saved', 'wpv-views'); ?> </span> <button class="js-wpv-bootstrap-version-settings-save button-secondary" disabled="disabled"> <?php _e('Save', 'wpv-views'); ?> </button> </p> </div> </div> <?php }
function wpv_bootstrap_options($options) { $is_disabled = ''; $disabled_message = ''; if (class_exists('WPDD_Layouts_CSSFrameworkOptions')) { $is_disabled = true; $framework = WPDD_Layouts_CSSFrameworkOptions::getInstance()->get_current_framework(); $disabled_message = '<p class="toolset-alert toolset-alert-info"><strong>' . sprintf(__("Bootstrap version overriden by the Layouts plugin settings to use Bootstrap v.%s", 'wpv-views'), str_replace('bootstrap-', '', $framework)) . '</strong></p>'; } ?> <div class="wpv-setting-container js-wpv-setting-container"> <div class="wpv-settings-header"> <h3><?php _e('Bootstrap Layouts', 'wpv-views'); ?> </h3> </div> <div class="wpv-setting"> <p> <?php _e("You can set here the Bootstrap version that you want to use, based on the one <strong>provided by your theme</strong>. We will then generate the right markup in the Views Layouts Wizard when using the Bootstrap Grid option.", 'wpv-views'); ?> </p> <?php echo $disabled_message; ?> <p> <?php echo sprintf(__('You can get the details in the <a href="%s" title="Documentation on the Bootstrap Layouts">documentation page</a>.', 'wpv-views'), 'http://wp-types.com/documentation/user-guides/view-layouts-101/?utm_source=viewsplugin&utm_campaign=views&utm_medium=views-settings&utm_term=documentation page#bootstrap'); ?> </p> <ul class="js-bootstrap-version-form"> <?php $version_options = array(array('label' => __('Bootstrap version not set', 'wpv-views'), 'value' => 1), array('label' => __('Bootstrap 2.0', 'wpv-views'), 'value' => 2), array('label' => __('Bootstrap 3.0', 'wpv-views'), 'value' => 3), array('label' => __('This site is not using Bootstrap CSS', 'wpv-views'), 'value' => -1)); foreach ($version_options as $option) { printf('<li><label><input type="radio" name="wpv-bootstrap-version" class="js-wpv-bootstrap-version" value="%s" %s %s autocomplete="off" />%s</label></li>', $option['value'], checked($option['value'] == $this->wpv_bootstrap_version, true, false), disabled($is_disabled, true, false), $option['label']); } ?> </ul> <?php wp_nonce_field('wpv_bootstrap_version_nonce', 'wpv_bootstrap_version_nonce'); ?> <p class="update-button-wrap"> <span class="js-wpv-messages"></span> <button class="js-wpv-bootstrap-version-settings-save button-secondary" disabled="disabled"> <?php _e('Save', 'wpv-views'); ?> </button> </p> </div> </div> <?php }
/** * wpv_layout_wizard_load_saved_settings * * Returns the layout settings for a given View, adjusting the Bootstrap ones based on the Views and Layouts settings * * @since unknown */ function wpv_layout_wizard_load_saved_settings( $view_id ) { $view_layout_settings = get_post_meta( $view_id, '_wpv_layout_settings', true); if ( class_exists( 'WPDD_Layouts_CSSFrameworkOptions' ) ) { $bootstrap_ver = WPDD_Layouts_CSSFrameworkOptions::getInstance()->get_current_framework(); $view_layout_settings['wpv_bootstrap_version'] = str_replace( 'bootstrap-', '', $bootstrap_ver ); } else { global $WPV_settings; $view_layout_settings['wpv_bootstrap_version'] = 1; //Load bootstrap version from views settings if ( isset( $WPV_settings['wpv_bootstrap_version'] ) ) { $view_layout_settings['wpv_bootstrap_version'] = $WPV_settings['wpv_bootstrap_version']; } } if ( isset( $view_layout_settings['fields'] ) && is_array( $view_layout_settings['fields'] ) ) { $view_layout_settings['fields'] = array_values( $view_layout_settings['fields'] ); } return $view_layout_settings; }
function __construct() { $this->plugin_localization(); WPDDL_Layouts_WPML::getInstance(); WPDDL_ModuleManagerSupport::getInstance(); WDDL_ExtraModulesLoader::getInstance(); $this->ddl_caps = WPDD_Layouts_Users_Profiles::getInstance(); $this->registed_cells = new WPDD_registed_cell_types(); $this->layout_post_loop_cell_manager = new WPDD_layout_post_loop_cell_manager(); $this->registered_theme_sections = new WPDD_register_layout_theme_section(); $this->scripts_manager = WPDDL_scripts_manager::getInstance(); if (is_admin()) { $this->parents_options = new WPDDL_Options_Manager(self::PARENTS_OPTIONS); } $this->post_types_manager = new WPDD_Layouts_PostTypesManager(); $this->individual_assignment_manager = new WPDD_Layouts_IndividualAssignmentManager(); global $wpdd_gui_editor; $this->wpddl_init(); $this->css_manager = WPDD_Layouts_CSSManager::getInstance(); $this->frameworks_options_manager = WPDD_Layouts_CSSFrameworkOptions::getInstance(); $this->set_css_framework($this->frameworks_options_manager->get_current_framework()); add_action('wp_ajax_nopriv_' . WPDDL_LAYOUTS_CSS, array(&$this, 'handle_layout_css_from_db_print'), 10); add_action('init', array(&$this, 'init_listing_page'), 20); add_action('before_delete_post', array(&$this, 'before_delete_post_action')); add_action('add_attachment', array(&$this, 'add_attachment_action')); if (is_admin()) { // a little trick to have global $this available in post edit page upon construction add_action('init', array(&$this, 'init_create_layout_for_pages'), 20); $this->fix_up_views_slugs(); if ($this->layouts_editor_page) { new WPDD_GUI_DIALOGS(); } global $pagenow; $wpdd_gui_editor = new WPDD_GUI_EDITOR(); /**/ if (class_exists('WPDDL_Admin_Pages')) { WPDDL_Admin_Pages::getInstance(); } else { if (class_exists('WPDDL_Admin_Pages_Embedded')) { WPDDL_Admin_Pages_Embedded::getInstance(); } } if ($pagenow == 'plugins.php') { add_action('admin_enqueue_scripts', array($this, 'plugin_page_styles')); } if (isset($_GET['page']) && ($_GET['page'] == WPDDL_LAYOUTS_POST_TYPE || $_GET['page'] == 'dd_layout_theme_export' || $_GET['page'] == 'dd_layouts_edit')) { add_action('admin_enqueue_scripts', array($this, 'preload_styles')); add_action('admin_enqueue_scripts', array($this, 'preload_scripts')); } if (isset($_GET['page']) && $_GET['page'] == 'dd_tutorial_videos') { add_action('admin_enqueue_scripts', array($this, 'help_page_scripts')); } if (isset($_GET['in-iframe-for-layout']) && $_GET['in-iframe-for-layout'] == 1 && defined('CRED_FORMS_CUSTOM_POST_NAME') && $pagenow == 'post.php' && isset($_GET['post'])) { $post_id = $_GET['post']; $post = get_post($post_id); if ($post->post_type == CRED_FORMS_CUSTOM_POST_NAME) { add_action('admin_enqueue_scripts', array($this, 'cred_in_iframe_scripts')); } } if (isset($_GET['in-iframe-for-layout']) && $_GET['in-iframe-for-layout'] == 1 && defined('CRED_USER_FORMS_CUSTOM_POST_NAME') && $pagenow == 'post.php' && isset($_GET['post'])) { $post_id = $_GET['post']; $post = get_post($post_id); if ($post->post_type == CRED_USER_FORMS_CUSTOM_POST_NAME) { add_action('admin_enqueue_scripts', array($this, 'cred_user_in_iframe_scripts')); } } if (isset($_GET['in-iframe-for-layout']) && $_GET['in-iframe-for-layout'] == 1 && isset($_GET['page']) && ('views-editor' == $_GET['page'] || 'views-embedded' == $_GET['page'] || 'view-archives-embedded' == $_GET['page'] || 'view-archives-editor' == $_GET['page'])) { add_action('admin_enqueue_scripts', array($this, 'views_in_iframe_scripts')); } if (isset($_GET['in-iframe-for-layout']) && '1' == $_GET['in-iframe-for-layout']) { wp_deregister_script('heartbeat'); remove_action('wp_head', 'print_emoji_detection_script', 7); remove_action('wp_print_styles', 'print_emoji_styles'); } add_action('wp_ajax_ddl_create_layout', array($this, 'create_layout_callback')); add_action('wp_ajax_ddl_dismiss_template_message', array($this, 'ddl_dismiss_template_message')); /** * add extra debug information */ add_filter('icl_get_extra_debug_info', array($this, 'add_extra_debug_information')); add_action('wpml_register_string_packages', array($this, 'register_all_strings_for_translation'), 10, 0); add_action('admin_enqueue_scripts', array($this, 'enqueue_toolset_common_styles')); } else { // add_action('wp_head', array(&$this,'handle_layout_css_fe')); if (isset($_GET['ddl_style'])) { header('Content-Type:text/css'); $this->wpddl_frontent_styles($_GET['ddl_style']); die; } // Assign post layout for post create from front-end add_action('wp_enqueue_scripts', array($this, 'load_frontend_js')); add_action('wp_enqueue_scripts', array($this, 'load_frontend_css')); //place layout edit link in last position add_action('get_layout_id_for_render', array(&$this, 'get_layout_id_for_render_callback'), 888, 2); // @see class-toolset-admin-bar-menu.php //add_action( 'admin_bar_menu', array($this, 'print_layout_edit_link'), 999 ); add_action('wp_enqueue_scripts', array($this, 'enqueue_toolset_common_styles')); /** * get cache singleton */ WPDD_Layouts_Cache_Singleton::getInstance(); } }
function ddlayout_set_framework($framework) { $framework_manager = WPDD_Layouts_CSSFrameworkOptions::getInstance(); $framework_manager->theme_set_framework($framework); }
function wpv_create_bootstrap_meta_html($cols, $ct_title, $meta_html) { global $WPV_settings; $col_num = 12 / $cols; $output = ''; $row_style = ''; $col_style = 'col-sm-'; $body = '[wpv-post-body view_template="' . $ct_title . '"]'; //Row style and cols class for bootstrap 2.0 if (class_exists('WPDD_Layouts_CSSFrameworkOptions')) { $bootstrap_ver = WPDD_Layouts_CSSFrameworkOptions::getInstance()->get_current_framework(); $WPV_settings->wpv_bootstrap_version = str_replace('bootstrap-', '', $bootstrap_ver); } else { //Load bootstrap version from views settings if (!isset($WPV_settings->wpv_bootstrap_version)) { $WPV_settings->wpv_bootstrap_version = 2; } } if ($WPV_settings->wpv_bootstrap_version == 2) { $row_style = ' row-fluid'; $col_style = 'span'; } $output .= " <wpv-loop wrap=\"" . $cols . "\" pad=\"true\">\n"; $ifone = ''; // if ($cols == 1) { $ifone = '</div>'; } $output .= " [wpv-item index=1]\n"; $output .= " <div class=\"row" . $row_style . "\"><div class=\"" . $col_style . $col_num . "\">" . $body . "</div>" . $ifone . "\n"; $output .= " [wpv-item index=other]\n"; $output .= " <div class=\"" . $col_style . $col_num . "\">" . $body . "</div>\n"; if ($cols > 1) { $output .= " [wpv-item index=" . $cols . "]\n"; $output .= " <div class=\"" . $col_style . $col_num . "\">" . $body . "</div></div>\n"; } $output .= " [wpv-item index=pad]\n"; $output .= " <div class=\"" . $col_style . $col_num . "\"></div>\n"; $output .= " [wpv-item index=pad-last]\n"; $output .= " </div>\n"; $output .= " </wpv-loop>\n"; return preg_replace('#\\<wpv-loop(.*?)\\>(.*)</wpv-loop>#is', $output, $meta_html); }