Ejemplo n.º 1
0
 static function load_scripts($hook)
 {
     if ($hook != 'widgets.php') {
         return;
     }
     wp_register_script('widget-rules-js', dynamo_file_uri('js/back-end/widget.rules.js'), array('jquery'));
     wp_enqueue_script('widget-rules-js');
     wp_register_style('widget-rules-css', dynamo_file_uri('css/back-end/widget.rules.css'));
     wp_enqueue_style('widget-rules-css');
 }
Ejemplo n.º 2
0
 function dynamo_admin_menu()
 {
     // getting access to the template global object.
     global $dynamo_tpl;
     // set the default icon path
     $icon_path = dynamo_file_uri('images/back-end/small_logo.png');
     // check if user set his own icon and then replace the default path
     if (get_option($dynamo_tpl->name . "_branding_admin_page_image") != '') {
         $icon_path = get_option($dynamo_tpl->name . "_branding_admin_page_image");
     }
     // creating main menu item for the template settings
     if (get_option($dynamo_tpl->name . "_branding_admin_page_template_name") != '') {
         $templatename = get_option($dynamo_tpl->name . "_branding_admin_page_template_name");
     } else {
         $templatename = $dynamo_tpl->config['template']->name;
     }
     $plugin_page = add_object_page('DynamoWP Framework', $templatename, 'manage_options', 'dynamo-menu', 'dynamo_template_options', $icon_path);
     // checking if showing template options is enabled
     if ($dynamo_tpl->config['developer_config']->visibility->template_options == 'true') {
         //
         $plugin_page = add_submenu_page('dynamo-menu', $dynamo_tpl->config['template']->name, __('Template options', DPTPLNAME), 'manage_options', 'dynamo-menu', 'dynamo_template_options');
         // save callback
         add_action("admin_head-" . $plugin_page, 'dynamo_template_save_js');
         // adding scripts and stylesheets
         add_action('admin_enqueue_scripts', 'dynamo_template_options_js');
         dynamo_template_options_css();
     }
     // checking if showing import/export options is enabled
     if ($dynamo_tpl->config['developer_config']->visibility->importexport == 'true') {
         //
         $plugin_page = add_submenu_page('dynamo-menu', $dynamo_tpl->config['template']->name, __('Import/Export', DPTPLNAME), 'manage_options', 'importexport_options', 'dynamo_importexport_options');
     }
     // checking if showing documentation options is enabled
     if ($dynamo_tpl->config['developer_config']->visibility->documentation == 'true') {
         if (get_option($dynamo_tpl->name . '_show_documentation_link') == 'Y' && get_option($dynamo_tpl->name . '_theme_documentation_link') != '') {
             $plugin_page = add_submenu_page('dynamo-menu', $dynamo_tpl->config['template']->name, __('Documentation', DPTPLNAME), 'manage_options', 'themes.php?goto=documentation');
         }
     }
     // checking if showing DynamicPress information is enabled
     if ($dynamo_tpl->config['developer_config']->visibility->dynamicpress_website == 'true') {
         if (get_option($dynamo_tpl->name . '_show_theme_author_link') == 'Y' && get_option($dynamo_tpl->name . '_theme_author_link') != '') {
             $plugin_page = add_submenu_page('dynamo-menu', $dynamo_tpl->config['template']->name, __('Author Website', DPTPLNAME), 'manage_options', 'themes.php?goto=dynamicpress');
         }
     }
 }
Ejemplo n.º 3
0
function dynamowp_dynamic_css()
{
    wp_register_style('dynamo-dynamic-css', dynamo_file_uri('css/dynamic.css'));
    wp_enqueue_style('dynamo-dynamic-css');
}
Ejemplo n.º 4
0
 function admin_scripts()
 {
     // enqueue js files on backend
     wp_register_style('dp-metabox-css', dynamo_file_uri('css/back-end/metabox.css'));
     wp_enqueue_style('dp-metabox-css');
     wp_register_style('dp-import-export-css', get_template_directory_uri() . '/css/back-end/importexport.css');
     wp_enqueue_style('dp-import-export-css');
     wp_enqueue_script('VC-admin-media', $this->assets_js . 'admin-media.js', array('jquery'));
     wp_enqueue_script('media-upload');
     wp_enqueue_media();
     wp_enqueue_style('VC-icon-manager-admin', $this->assets_css . 'icon-manager-admin.css');
     $fonts = get_option('dp_font_icons');
     if (is_array($fonts)) {
         foreach ($fonts as $font => $info) {
             if (strpos($info['style'], 'http://') !== false) {
                 wp_enqueue_style('dpf-' . $font, $info['style']);
             } else {
                 wp_enqueue_style('dpf-' . $font, trailingslashit($this->paths['fonturl']) . $info['style']);
             }
         }
     }
 }
Ejemplo n.º 5
0
/**
 *
 * Function used to load template options CSS code
 *
 * @return null
 * 
 **/
function dynamo_template_options_css()
{
    // variable used for the page detection
    global $pagenow;
    // template object
    global $dynamo_tpl;
    // check the page
    if ($pagenow == 'admin.php' && isset($_GET['page']) && ($_GET['page'] == 'template_options' || $_GET['page'] == 'dynamo-menu')) {
        wp_enqueue_style('thickbox');
        wp_register_style('dp-tips-css', dynamo_file_uri('js/back-end/libraries/miniTip/miniTip.css'));
        wp_register_style('dp-template-css', dynamo_file_uri('css/back-end/template.css'));
        wp_enqueue_style('dp-tips-css');
        wp_enqueue_style('dp-template-css');
        // register and load external components scripts
        $tabs = $dynamo_tpl->get_json('options', 'tabs');
        // iterate through tabs
        foreach ($tabs as $tab) {
            if ($tab[2] == 'enabled') {
                // load file
                $loaded_data = $dynamo_tpl->get_json('options', $tab[1]);
                // check the loaded JSON data
                if ($loaded_data != null && count($loaded_data != 0)) {
                    $standard_fields = array('Text', 'Select', 'RawText', 'Switcher', 'Textarea', 'Media', 'WidthHeight', 'Menu', 'TextBlock', 'Color', 'Background', 'Taxonomy', 'HTML', 'Slider', 'Save');
                    // iterate through groups
                    foreach ($loaded_data as $group) {
                        //
                        foreach ($group->fields as $field) {
                            if (!in_array($field->type, $standard_fields)) {
                                // load field config
                                $file_config = $dynamo_tpl->get_json('form_elements/' . $field->type, 'config', false);
                                // check if the file is correct
                                if (is_array($file_config) && count($file_config) > 0 || is_object($file_config)) {
                                    // load the CSS file
                                    if ($file_config->css != '') {
                                        wp_register_style('dp_' . strtolower($file_config->name) . '.css', dynamo_file_uri('dynamo_framework/form_elements/') . $field->type . '/' . $file_config->css);
                                        wp_enqueue_style('dp_' . strtolower($file_config->name) . '.css');
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
Ejemplo n.º 6
0
    function dynamo_generate_import_page()
    {
        global $dynamo_tpl;
        global $wpdb;
        wp_register_style('dp-import-export-css', get_template_directory_uri() . '/css/back-end/importexport.css');
        wp_enqueue_style('dp-import-export-css');
        wp_register_style('dp-metabox-css', dynamo_file_uri('css/back-end/metabox.css'));
        wp_enqueue_style('dp-metabox-css');
        wp_register_style('dp-jquery-ui-css', dynamo_file_uri('css/back-end/jquery-ui.min.css'));
        wp_enqueue_style('dp-jquery-ui-css');
        wp_register_script('dp-jquery-ui-js', get_template_directory_uri() . '/js/back-end/jquery-ui.min.js', array('jquery'), false, true);
        wp_enqueue_script('dp-jquery-ui-js');
        ?>
		<div class="dpWrap wrap">
        <h1><big><?php 
        echo $dynamo_tpl->full_name;
        ?>
</big><small><?php 
        _e('Based on the Dynamo WP framework', DPTPLNAME);
        ?>
</small></h1>
            <h3><?php 
        _e('Import Demo Content', DPTPLNAME);
        ?>
</h3>
            <form method="post" action="" id="importContentForm">
                    <div class="clearfix">
                    <div class="col_onefourth">
                    <p><?php 
        _e('<b>Import</b><br/>Choose demo content you want to import</p>', DPTPLNAME);
        ?>
                    </div>
                    <div class="col_onefourth">
                    <p>
                                            <em>Demo Site</em><br/>
                                            <select class="width100" name="import_example" id="import_example">
												<option value="blend1">Blend 1 - Standard</option>
                                            </select>
                           </p>
                     	</div>
                                        <div class="col_onefourth">
                                        <p>
                                            <em>Import Type</em><br/>
                                            <select class="width100" name="import_option" id="import_option" class="form-control dynamof-form-element">
                                                <option value="">Please Select</option>
                                                <option value="complete_content">All</option>
                                                <option value="content">Content</option>
                                                <option value="widgets">Widgets</option>
                                                <option value="options">Options</option>
                                                <option value="revsliders">Revsliders</option>
                                            </select>
                                         </p>
                                        </div>
						<div class="clearboth"></div>
                        <div class="col_onefourth" >
                            <p>
                                <b><?php 
        esc_html_e('Import attachments', DPTPLNAME);
        ?>
</b><br/>
								<?php 
        esc_html_e('Do you want to import media files?', DPTPLNAME);
        ?>
                            </p>
                        </div>
						<div class="col_onefourth" >
                        <p><input type="checkbox" value="1" name="import_attachments" id="import_attachments" /></p>
                        </div>
						<div class="clearboth"></div>
                        <p>
                        <input type="submit" class="dpMedia" value="<?php 
        esc_html_e('Import Demo Content', DPTPLNAME);
        ?>
" name="import" id="import_demo_data" />
                        </p>

                        <div class="dp_import_load col_onefourth"><span><?php 
        _e('The import process may take some time. Please be patient.', DPTPLNAME);
        ?>
 </span><br />
                            <div class="dynamo-progress-bar-wrapper">
                                <div class="progress-bar-wrapper">
                                    <div id="progressbar" class="dynamo-progress-bar"></div>
                                </div>
                                <div class="progress-value">1%</div>
                                <div class="progress-bar-message">
                                </div>
                            </div>
                        </div>
                        <div class="clearboth"></div>
                        <div class="notification warning"><p><i class="Default-warning2"></i><span><?php 
        _e('Important notes:', DPTPLNAME);
        ?>
</span><br/>                            <ol>
                                <li><?php 
        _e('Please note that import process will take time needed to download all attachments from demo web site.', DPTPLNAME);
        ?>
</li>
                                <li> <?php 
        _e('If you plan to import Revsliders and Essentials Grids, please install this plugins before you run import.', DPTPLNAME);
        ?>
</li>
                                <li> <?php 
        _e('If you plan to use shop, please install WooCommerce before you run import.', DPTPLNAME);
        ?>
</li>
                            </ol>
</p></div>
                        

                    </div>

            </form>
        </div>
        <script type="text/javascript">
            jQuery(document).ready(function() {
                jQuery(document).on('click', '#import_demo_data', function(e) {
                    e.preventDefault(); 
					var import_opt = jQuery( "#import_option" ).val();
					if(import_opt == '') {
							alert ("Please select import type");
							return false;
                        }
                    if (confirm('Are you sure, you want to import Demo Data now?')) {
                        jQuery('.dp_import_load').css('display','block');
                        var dp_progressbar = jQuery('#progressbar')
                       
                        var import_expl = jQuery( "#import_example" ).val();
                        var p = 0;
						dp_progressbar.progressbar({
							value: 1
						});
						if(import_opt == 'content'){
                            for(var i=1;i<10;i++){
                                var str;
                                if (i < 10) str = 'blend_content_0'+i+'.xml';
                                else str = 'blend_content_'+i+'.xml';
                                jQuery.ajax({
                                    type: 'POST',
                                    url: ajaxurl,
                                    data: {
                                        action: 'dynamo_dataImport',
                                        xml: str,
                                        example: import_expl,
                                        import_attachments: (jQuery("#import_attachments").is(':checked') ? 1 : 0)
                                    },
                                    success: function(data, textStatus, XMLHttpRequest){
                                        p+= 10;
                                        jQuery('.progress-value').html((p) + '%');
										dp_progressbar.progressbar("value", p)
                                        if (p == 90) {
                                            str = 'blend_content_10.xml';
                                            jQuery.ajax({
                                                type: 'POST',
                                                url: ajaxurl,
                                                data: {
                                                    action: 'dynamo_dataImport',
                                                    xml: str,
                                                    example: import_expl,
                                                    import_attachments: (jQuery("#import_attachments").is(':checked') ? 1 : 0)
                                                },
                                                success: function(data, textStatus, XMLHttpRequest){
                                                    p+= 10;
                                                    jQuery('.progress-value').html((p) + '%');
                                                    dp_progressbar.progressbar("value", p)
                                                    jQuery('.progress-bar-message').html('<div class="notification success"><p><i class="Default-thumbs-up2"></i><span>Success!</span><br/>Demo content is imported.</p></div>');
                                                },
                                                error: function(MLHttpRequest, textStatus, errorThrown){
                                                }
                                            });
                                        }
                                    },
                                    error: function(MLHttpRequest, textStatus, errorThrown){
                                    }
                                });
                            }
                        } else if(import_opt == 'widgets') {
                            jQuery.ajax({
                                type: 'POST',
                                url: ajaxurl,
                                data: {
                                    action: 'dynamo_widgetsImport',
                                    example: import_expl
                                },
                                success: function(data, textStatus, XMLHttpRequest){
                                    jQuery('.progress-value').html((100) + '%');
                                    dp_progressbar.progressbar("value", 100)
                                },
                                error: function(MLHttpRequest, textStatus, errorThrown){
                                }
                            });
                        } else if(import_opt == 'options'){
                            jQuery.ajax({
                                type: 'POST',
                                url: ajaxurl,
                                data: {
                                    action: 'dynamo_optionsImport',
                                    example: import_expl
                                },
                                success: function(data, textStatus, XMLHttpRequest){
                                    jQuery('.progress-value').html((100) + '%');
                                    dp_progressbar.progressbar("value", 100)
                                },
                                error: function(MLHttpRequest, textStatus, errorThrown){
                                }
                            });
                        }else if(import_opt == 'revsliders'){
                            jQuery.ajax({
                                type: 'POST',
                                url: ajaxurl,
                                data: {
                                    action: 'dynamo_revImport',
                                    example: import_expl
                                },
                                success: function(data, textStatus, XMLHttpRequest){
                                    jQuery('.progress-value').html((100) + '%');
                                    dp_progressbar.progressbar("value", 100)
                                },
                                error: function(MLHttpRequest, textStatus, errorThrown){
                                }
                            });
                        }else if(import_opt == 'grids'){
                            jQuery.ajax({
                                type: 'POST',
                                url: ajaxurl,
                                data: {
                                    action: 'dynamo_gridImport',
                                    example: import_expl
                                },
                                success: function(data, textStatus, XMLHttpRequest){
                                    jQuery('.progress-value').html((100) + '%');
                                    dp_progressbar.progressbar("value", 100)
                                },
                                error: function(MLHttpRequest, textStatus, errorThrown){
                                }
                            });
                        }else if(import_opt == 'complete_content'){
                            for(var i=1;i<10;i++){
                                var str;
                                if (i < 10) str = 'blend_content_0'+i+'.xml';
                                else str = 'blend_content_'+i+'.xml';
                                jQuery.ajax({
                                    type: 'POST',
                                    url: ajaxurl,
                                    data: {
                                        action: 'dynamo_dataImport',
                                        xml: str,
                                        example: import_expl,
                                        import_attachments: (jQuery("#import_attachments").is(':checked') ? 1 : 0)
                                    },
                                    success: function(data, textStatus, XMLHttpRequest){
                                        p+= 10;
                                        jQuery('.progress-value').html((p) + '%');
                                        dp_progressbar.progressbar("value", p)
                                        if (p == 90) {
                                            str = 'blend_content_10.xml';
                                            jQuery.ajax({
                                                type: 'POST',
                                                url: ajaxurl,
                                                data: {
                                                    action: 'dynamo_dataImport',
                                                    xml: str,
                                                    example: import_expl,
                                                    import_attachments: (jQuery("#import_attachments").is(':checked') ? 1 : 0)
                                                },
                                                success: function(data, textStatus, XMLHttpRequest){
                                                    jQuery.ajax({
                                                        type: 'POST',
                                                        url: ajaxurl,
                                                        data: {
                                                            action: 'dynamo_otherImport',
                                                            example: import_expl
                                                        },
                                                        success: function(data, textStatus, XMLHttpRequest){
                                                            jQuery('.progress-value').html((100) + '%');
                                                            dp_progressbar.progressbar("value", 100)
                                                            jQuery('.progress-bar-message').html('<div class="notification success"><p><i class="Default-thumbs-up2"></i><span>Success!</span><br/>Demo content is imported.</p></div>');
                                                        },
                                                        error: function(MLHttpRequest, textStatus, errorThrown){
                                                        }
                                                    });
                                                },
                                                error: function(MLHttpRequest, textStatus, errorThrown){
                                                }
                                            });
                                        }
                                    },
                                    error: function(MLHttpRequest, textStatus, errorThrown){
                                    }
                                });
                            }
                        }
                    }
                    return false;
                });
            });
        </script>

        </div>

    <?php 
    }
Ejemplo n.º 7
0
/**
 *
 * Function used to create links to stylesheets and script files for specific pages
 *
 * @return HTML output
 *
 **/
function dp_head_style_pages()
{
    // get access to the template object
    global $dynamo_tpl;
    // scripts for the contact page
    if (is_page_template('contact.php')) {
        wp_enqueue_script('dynamo-contact-validate', dynamo_file_uri('js/jquery.validate.min.js'), array('jquery', 'dynamo-scripts'), false, true);
        wp_enqueue_script('dynamo-contact-main', dynamo_file_uri('js/contact.js'), array('jquery', 'dynamo-scripts'), false, true);
    }
}
Ejemplo n.º 8
0
function dynamo_opensearch()
{
    // access to the wp_query variable
    global $wp_query, $dynamo_tpl;
    // check if there was an variable opensearch_description in the query vars
    if (!empty($wp_query->query_vars['opensearch_description'])) {
        // if yes - return the XML with OpenSearch description
        header('Content-Type: text/xml');
        // the XML content
        echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
        echo "<OpenSearchDescription xmlns=\"http://a9.com/-/spec/opensearch/1.1/\">\n";
        echo "\t<ShortName>" . get_bloginfo('name') . "</ShortName>\n";
        echo "\t<LongName>" . get_bloginfo('name') . "</LongName>\n";
        echo "\t<Description>Search &quot;" . get_bloginfo('name') . "&quot;</Description>\n";
        if (get_option($dynamo_tpl->name . '_branding_favicon', '') != '') {
            echo "\t<Image width=\"16\" height=\"16\" type=\"image/x-icon\">" . get_option($dynamo_tpl->name . '_branding_favicon', '') . "</Image>\n";
        } else {
            echo "\t<Image width=\"16\" height=\"16\" type=\"image/x-icon\">" . dynamo_file_uri('favicon.ico') . "</Image>\n";
        }
        echo "\t<Contact>" . get_bloginfo('admin_email') . "</Contact>\n";
        echo "\t<Url type=\"text/html\" template=\"" . home_url() . "/?s={searchTerms}\"/>\n";
        echo "\t<Url type=\"application/atom+xml\" template=\"" . home_url() . "/?feed=atom&amp;s={searchTerms}\"/>\n";
        echo "\t<Url type=\"application/rss+xml\" template=\"" . home_url() . "/?feed=rss2&amp;s={searchTerms}\"/>\n";
        echo "\t<Language>" . get_bloginfo('language') . "</Language>\n";
        echo "\t<OutputEncoding>" . get_bloginfo('charset') . "</OutputEncoding>\n";
        echo "\t<InputEncoding>" . get_bloginfo('charset') . "</InputEncoding>\n";
        echo "</OpenSearchDescription>";
        exit;
    }
    // if not just end the function
    return;
}
Ejemplo n.º 9
0
function dynamo_enqueue_admin_js_and_css()
{
    // DP scripts
    wp_enqueue_script('dp_admin_js', dynamo_file_uri('js/back-end/dp_scripts.js'), array('jquery'), '', true);
    // metaboxes scripts
    wp_enqueue_script('dynamo.metabox.js', dynamo_file_uri('js/back-end/dynamo.metabox.js'), array('jquery'), '', true);
    wp_enqueue_media();
    // metaboxes CSS
    wp_register_style('dynamo-metabox-css', dynamo_file_uri('css/back-end/metabox.css'));
    wp_enqueue_style('dynamo-metabox-css');
    //Color picker
    wp_register_script('spectrum', dynamo_file_uri('js/back-end/libraries/spectrum/spectrum.js'), array('jquery'));
    wp_enqueue_script('spectrum');
    wp_register_style('spectrum-css', dynamo_file_uri('js/back-end/libraries/spectrum/spectrum.css'));
    wp_enqueue_style('spectrum-css');
    // metaboxes CSS
    wp_register_style('metaboxes-css', get_template_directory_uri() . '/dynamo_framework/metaboxes/meta.css');
    wp_enqueue_style('metaboxes-css');
    // shortcodes database
    if (get_locale() != '' && is_dir(get_template_directory() . '/dynamo_framework/config/' . get_locale()) && is_dir(get_template_directory() . '/dynamo_framework/options/' . get_locale())) {
        $language = get_locale();
    } else {
        $language = 'en_US';
    }
}
Ejemplo n.º 10
0
 static function add_scripts()
 {
     wp_register_script('dp-tabs', dynamo_file_uri('js/widgets/tabs.js'), array('jquery'), false, true);
     wp_enqueue_script('dp-tabs');
 }