Coder Social home page Coder Social logo

presscustomizr / nimble-builder Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 3.0 25.79 MB

Powerful yet very simple ( and free 😍 ) WordPress page builder using the native WordPress live customizer. Compatible with any WordPress theme. Used by 50k+ websites .

Home Page: https://wordpress.org/plugins/nimble-builder/

License: Other

JavaScript 52.63% PHP 37.59% CSS 8.20% SCSS 1.58%
free-software gplv3 insert-sections landing-page open-source page-builder post-grids wordpress-plugin

nimble-builder's People

Contributors

eri-trabiccolo avatar james-kshitij avatar james-xitij avatar sm-prasad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

nimble-builder's Issues

Before (after) loop sections might be duplicated in some edge cases

The easiest way to reproduce this is using TwentySeventeen and st:

  • in Homepage Settings -> Your homepage displays select A static page
  • Select as Homepage a page A, select as Posts page a page B
  • in Theme options, make sure that one of your Front Page Section N Content is page B

Even if this is an edge case, the one above is the default starting configuration of TwentySeventeen on a fresh install.

Html code module prototype

Spec

  • the input tmpl should be composed one textarea input type
  • the fmk input type name is html_editor, and will be added in this file assets/czr/sek/js/_dev_control/_7_0_sektions_add_inputs_to_api.js
  • use the wp.codeEditor.initialize() see wp-admin/js/customize-control.js#5270, to turn this textarea into an editor
  • sanitization on save and output validation => see how the wp hmlt widget does it.

Submission issue : Generic function (and/or define) names

There are issues with your plugin code.

Please read this ENTIRE email, address all listed issues, and reply to this email with your corrected code attached (or linked). It is required for you to read and reply to these emails, and failure to do so will result in significant delays with your plugin being accepted.

Remember in addition to code quality, security and functionality, we require all plugins adhere to our guidelines. If you have not yet, please read them:

You will not be able to submit another plugin while this one is being reviewed, so please read the email carefully. We know it can be long, but you must follow the directions at the end as not doing so will result in your review being delayed.

Generic function (and/or define) names

All plugins must have unique function names, namespaces, defines, and classnames. This prevents your plugin from conflicting with other plugins or themes. We need you to update your plugin to use more unique and distinct names.

A good way to do this is with a prefix. For example, if your plugin is called "Easy Custom Post Types" then you could use names like these:

function ecpt_save_post()
define( ‘ECPT_LICENSE’, true );
class ECPT_Admin{}
namespace EasyCustomPostTypes;

Don't try to use two letter slugs anymore. We have over 60 THOUSAND plugins on WordPress.org alone, you’re going to run into conflicts.

Similarly, don't use __ (double underscores), wp_ , or _ (single underscore) as a prefix. Those are reserved for WordPress itself. You can use them inside your classes, but not as stand-alone function.

Remember: Good names are unique and distinct. This will help you and the next person in debugging, as well as prevent conflicts.

Some examples from your plugin:

function sek_display_min_php_message()
namespace czr_fn;
function Flat_Skop_Base


Please make sure you've addressed ALL issues brought up in this email.

When you've corrected your code, REPLY to this email with the updated code attached as a zip, or provide a link to the new code for us to review. If you use gmail, you won’t be able to send a ZIP file if it contains any JS files (yes, we know it’s stupid, blame Google).

Creating a prototype for fetching images from a remote server

Already started here : https://github.com/presscustomizr/nimble-builder/blob/master/inc/sektions/_dev_php/8_0_0_sektions_front_class_construct.php#L38

Specs classic ajax request

  • the prototype could be loaded from the functions
  • should display a button on loop_start in the preview
  • clicking on the button should
  • fetch the image
  • insert it in the media library
  • return a json_success with the attachment id and url
  • display a success/ failure alert with the image id + url

Specs rest api image insertion

Spacing inputs (padding margin) singular issue on focus change: customized values not taken in account?

Sorry for the bad title.

How to reproduce it:

  1. Open a whatever level settings editor
  2. Click on a spacing property input to change: e.g. padding-top
  3. you'll see the element refreshing in the preview, even if you really didn't change anything
  4. write a number in the property input box (or use the "steppers")
  5. you'll see the element refreshing in the preview WITHOUT the padding-top you set correctly applied
  6. now click (focus) on a different spacing property input, e.g. padding-bottom
  7. you'll see the element refreshing in the preview WITHOUT the padding-top you set applied

you can do this back and forth

Can you reproduce this issue?

Font Awesome icon list generation code

/*
* I've put this in the nimble-builder.php file
* any other location assuminig the NIMBLE_BASE_PATH is defined would be fine too
*/
add_action( 'plugins_loaded', 'generate_json' );
function generate_json() {
    $base_path = NIMBLE_BASE_PATH . '/assets/front/fonts/webfonts';
    $json_dest = NIMBLE_BASE_PATH . '/assets/faicons.json';
    $files_src = array(
        'fa-solid-900.svg'   => 'fas',
        'fa-regular-400.svg' => 'far',
        'fa-brands-400.svg'  => 'fab',
    );

    $icons = array();
    foreach ( $files_src as $file => $icon_prefix ) {
        // $xml will look like (a).
        $xml    = @simplexml_load_file( $base_path . '/' . $file );

        if ( ! $xml ) {
            continue;
        }

        if ( ! isset( $xml->defs->font->glyph ) || ! $xml->defs->font->glyph->count() ) {
            continue;
        }


        // $xml->defs->font->glyph is an array of (SimpleXMLElement Object(s)) icon defintions, as you can see in (a).
        $glyph = $xml->defs->font->glyph;


        foreach( $glyph as $glyph_item ) {
            // Each icon name is accessible via the 'glyp-name' attribute.
            $glyph_item_name = (string)$glyph_item->attributes()->{'glyph-name'}[0];

            // This associative array is created so that we can sort by the icon name.
            $icons[ $icon_prefix . ' fa-' . $glyph_item_name ] = $glyph_item_name;
        }
    }

    if ( empty( $icons ) ) {
        error_log( 'Font Awesome icon list is empty' );
    }
    /*
     * Sort icons by value (name) A-Z ASC and then by key DESC (far, fas)
     * This way we ensure multiple occurrences of the same icon name always respect the same order
     * See (c)
     */
    $icon_classes = array_keys( $icons );
    $icon_names   = array_values( $icons );
    array_multisort( $icon_names, SORT_ASC, $icon_classes, SORT_ASC );
    $icons        = array_combine( $icon_classes, $icon_names );


    // Now that all is sorted let's grab only the keys ( icon classes )
    $icon_keys = array_keys( $icons );

    //json generation
    $json      = json_encode( $icon_keys );

    if ( $json ) {
        //write the json
        @file_put_contents( $json_dest, $json );

        error_log( sprintf( 'Font Awesome json file generated at: %s', $json_dest ) );
    }
}//end function

/*
Data structure documentation

(a) XML of one file
SimpleXMLElement Object
(
    [defs] => SimpleXMLElement Object
        (
            [font] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [id] => fontawesome-free
                            [horiz-adv-x] => 640
                        )

                    [font-face] => SimpleXMLElement Object
                        (
                            [@attributes] => Array
                                (
                                    [font-family] => Font Awesome 5 Free
                                    [units-per-em] => 512
                                    [ascent] => 448
                                    [descent] => 64
                                    [font-weight] => 900
                                    [font-style] => Solid
                                )

                        )

                    [missing-glyph] => SimpleXMLElement Object
                        (
                            [@attributes] => Array
                                (
                                    [horiz-adv-x] => 0
                                )

                        )

                    [glyph] => Array
                        (
                            [0] => SimpleXMLElement Object
                                (
                                    [@attributes] => Array
                                        (
                                            [glyph-name] => address-book
                                            [unicode] => 
                                            [horiz-adv-x] => 448
                                            [d] =>  M436 288C442.627 288 448 293.373 448 300V340C448 346.627 442.627 352 436 352H416V400C416 426.51 394.51 448 368 448H48C21.49 448 0 426.51 0 400V-16C0 -42.51 21.49 -64 48 -64H368C394.51 -64 416 -42.51 416 -16V32H436C442.627 32 448 37.373 448 44V84C448 90.627 442.627 96 436 96H416V160H436C442.627 160 448 165.373 448 172V212C448 218.627 442.627 224 436 224H416V288H436zM208 320C252.183 320 288 284.183 288 240S252.183 160 208 160S128 195.817 128 240S163.817 320 208 320zM336 88C336 74.745 325.255 64 312 64H104C90.745 64 80 74.745 80 88V106.523C80 128.549 94.99 147.7480000000001 116.358 153.09L152.015 162.004C181.116 141.072 226.524 135.059 263.985 162.004L299.642 153.09C321.01 147.748 336 128.548 336 106.523V88z
                                        )

                                )

                            [1] => SimpleXMLElement Object
                                (
                                    [@attributes] => Array
                                        (
                                            [glyph-name] => address-card
                                            [unicode] => 
                                            [horiz-adv-x] => 512
                                            [d] =>  M464 384H48C21.49 384 0 362.51 0 336V48C0 21.49 21.49 0 48 0H464C490.51 0 512 21.49 512 48V336C512 362.51 490.51 384 464 384zM176 304C214.66 304 246 272.66 246 234S214.66 164 176 164S106 195.34 106 234S137.34 304 176 304zM288 101C288 89.402 278.598 80 267 80H85C73.402 80 64 89.402 64 101V117.207C64 136.479 77.116 153.279 95.813 157.953L127.013 165.753C152.477 147.437 192.208 142.176 224.987 165.753L256.187 157.953C274.884 153.279 288 136.48 288 117.207V101zM448 140C448 133.373 442.627 128 436 128H332C325.373 128 320 133.373 320 140V148C320 154.627 325.373 160 332 160H436C442.627 160 448 154.627 448 148V140zM448 204C448 197.373 442.627 192 436 192H332C325.373 192 320 197.373 320 204V212C320 218.627 325.373 224 332 224H436C442.627 224 448 218.627 448 212V204zM448 268C448 261.373 442.627 256 436 256H332C325.373 256 320 261.373 320 268V276C320 282.627 325.373 288 332 288H436C442.627 288 448 282.627 448 276V268z
                                        )

                                )
                            ...
                        )//end glyph
                )//end font
        )//end defs
)//end SimpleXMLElement Object


-------------------
(b) Unordered array of icon_class => name

Array
(
    [fas fa-address-book] => address-book
    [fas fa-address-card] => address-card
    [fas fa-adjust] => adjust
    ...
    [far fa-address-book] => address-book
    [far fa-address-card] => address-card
    [far fa-arrow-alt-circle-down] => arrow-alt-circle-down
    ...
    [fab fa-500px] => 500px
    [fab fa-accessible-icon] => accessible-icon
    [fab fa-accusoft] => accusoft
//end unordered array


(c) Sorted array of icon_class => name : ordered by name ASC and by class ASC
Note the multiple occurrence e.g. of the icon_name address-book and address-cards
Array
(
    [fab fa-500px] => 500px
    [fab fa-accessible-icon] => accessible-icon
    [fab fa-accusoft] => accusoft
    [far fa-address-book] => address-book
    [fas fa-address-book] => address-book
    [far fa-address-card] => address-card
    [fas fa-address-card] => address-card
    [fas fa-adjust] => adjust
    [fab fa-adn] => adn
    [fab fa-adversal] => adversal
    ...
)
*/

font_size and line_height inputs are not initialized with customized values

How to reproduce this:

  1. Go to the Text Editor Font Style tab
  2. Set the "Font size in pixels" to 22
  3. Save and publish
  4. Reload the customizer
  5. Go to the Text Editor Font Style tab
  6. You'll see the "Font size in pixels" showing the default value

Is it something you can reproduce on your end? (maybe you already fixed it)

Nested sektions alignment thoughts

Take a look at the screenshot:
2018-06-11_9-08-56

It's a column with an image placeholder, then with the red background you can see a nested sektion of two columns.
Do we really want this kind of mixed vertical alignment? Meaning, you can see that the right/left edges of the top image (column with orange background) are not aligned with the left edge of the first column text (yellow background) and the right edge of the second column image (blue background).

  1. The nested sektion should reset its parent column padding
  2. The nested sektion .sek-sektion-inner should not have a right/left padding of 15px (I'm not sure about this padding overall, see: #24 )

Here's the screenshot with the 1) and 2) applied
2018-06-11_9-27-17

CSS:

[data-sek-is-nested="true"] .sek-container-fluid, 
[data-sek-is-nested="true"] .sek-sektion-inner {
    padding-right: 0;
    padding-left: 0;
}

What do you think?

Font awesome icons : how should we store the collection server side, for an optimal ease of maintenance ?

The question is : what is the most convenient format to use for the icon list ?
The solution should take into account the ease of initial creation and maintenance of such a list.

In an ideal world, the best solution would be to use a raw css file downloded from fontawesome.com, which would be parsed by a smart php ajax callback to produce a js parsable json sent to the customizer.

@eri-trabiccolo let's discuss that tomorrow.

Reconsider behavior on mouse click (release) in the preview

Hi Nico,
I'm not sure about opening the nimble module picker on mouse click in the preview.
If I'm not already in the nimble builder and I want to customize something else, e.g. the theme otpions, I would be pretty pissed off of being brought to the module picker every time I click in the preview, e.g.

  • I want to select a text
  • I want to navigate the site
  • I want to use a form, hence I have to click on an input field to focus it and then on the submit.
  • Even clicking on the partial refresh button would open the module picker before opening the actual set of options tied to the partial

Custom Bootstrap specifications

follow up of https://github.com/presscustomizr/advanced-customizer/issues/6

laptops and desktops => The column width is controlled by a default set of css classes expressed in percentages.
For example for a 5 columns structure, the class could be : sek-col-20 { width : 20% }
for a 7 columns, this would be sek-col-14 { width:14.285%}

below 768px => width is 100%

How and where to generate the scss ?
grunt tasks inspired from the boostrap ( auto prefixer )
create a folder with a set of scss files in sektions/assets/front/scss
the generated css should be named sektions/assets/front/sek-main.css

Next step
SCSS / CSS
1- Generate a sek-base.css with the grid system + other things in the future
2- Keep sek-main.css as it is

HTML MARKUP
adapt the front end ::render() markup with the new class names https://github.com/eri-trabiccolo/advanced-customizer/blob/custom-grid/inc/sektions/_dev_php/8_4_0_sektions_front_class_render.php

Workflow for adding a new input type

  • [JS] add the js input_type to the api.czrInputMap in a specific file in assets\czr\sek\js\_dev_control\inputs\
  • [PHP] add the input_type case in the switch statement in inc\sektions\_dev_php\input_tmpl\3_0_1_sek_input_tmpl_base_filter.php
  • [PHP] add the input_type callback in a file in inc\sektions\_dev_php\input_tmpl\
  • [Grunt] add the new php and js files to the concat task in __grunt-tasks-config__\concat.js

Notes

@eri-trabiccolo If you need to add a new type of params to an input tmpl when registrating the module ( for example the code_type, you'll need to declare this new param here https://github.com/presscustomizr/czr-base-fmk/blob/master/_dev_php/0_3_czr-base-fmk-tmpl_builder.php#L14.

Video module +> ON HOLD FOR NOW +> Needs investigation

  • we need to create a video_upload input type, inspired from our current upload_* types
  • add the input type methods in a specific file. Like assets/czr/sek/js/_dev_control/_7_0_sektions_add_inputs_to_api.js
  • the video core WP widget does it well => let's implement the same, without the title field
  • the front end rendering, could be based on what the core wp widget does
    2018-07-03_17-43-06

Workflow for adding new modules

Adding a new modules requires to modify several files in the code.

General idea

  1. register a module in php => the registered params will be used both when customizing and on front end
  2. register a module in js => to motorize the ui when customizing
  3. create a php template file => for the rendering on front and when customizing

Files to add / modify as of June 2018

  • inc/sektions/_dev_php/module_registration/4_0_0_sek_register_modules_after_setup_theme_50.php => this is where we declare the php functions in charge of loading the modules registration params + the module is registered
  • inc/sektions/_dev_php/module_registration/front/4_1_0_sek_register_{module_name}.php => the file in which the registration callback has to be declared.
  • assets/czr/sek/js/_dev_control/modules/front/_9_1_9_FRONT_{module_name}.js => the file where the customizer module can be registered to the api.czrModuleMap
  • inc/sektions/_dev_php/input_tmpl/3_0_1_sek_input_tmpl_module_picker.php => this is where we add new modules so they are draggable when customizing
  • tmpl/modules/{module_name}_tmpl.php => this is where all modules rendering php templates are located. Used both on front end when customizing and when published. The template path is declared as a param when registering the module in php.
  • __grunt-tasks-config__/concat.js => the concatenated files have to be updated with the newly added files

When the module needs specific localized params, like a list of options for a select input for example, or a translation string :

  • inc/sektions/_dev_php/1_0_0_sektions_customizer_assets.php => can be used to register localized params for the modules

Example

The heading module => 8a90aca

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.