Plugin Directory

Changeset 1764702


Ignore:
Timestamp:
11/13/2017 06:44:49 AM (8 years ago)
Author:
themespond
Message:
  • Fix image_picker field does not work in repeater field
  • Add: tpfw_build_link_attrs
Location:
tp-framework
Files:
170 added
6 edited

Legend:

Unmodified
Added
Removed
  • tp-framework/trunk/assets/js/admin_fields.js

    r1755070 r1764702  
    3636     * Field Image Picker
    3737     */
    38     if (document.getElementsByClassName('tpfw-image_picker').length) {
    39         $('.tpfw-image_picker').tpfwImagePicker();
    40     }
     38    $('.tpfw-image_picker').tpfwImagePicker();
    4139
    4240    /**
  • tp-framework/trunk/assets/js/admin_fields.min.js

    r1755070 r1764702  
    1 jQuery(function(e){"use strict";var t=e(document),a="";e("#widgets-right").length?a="#widgets-right ":0==e("#menu-to-edit").length&&(document.getElementsByClassName("tpfw-repeater").length&&e(".tpfw-repeater").tpfwRepeater(),document.getElementsByClassName("tpfw-map").length&&e(".tpfw-map").tpfwMap()),document.getElementsByClassName("tpfw-image_picker").length&&e(".tpfw-image_picker").tpfwImagePicker(),document.getElementsByClassName("tpfw-link").length&&e(".tpfw-link").tpfwLink(),e(".tpfw-color:not(.child-field)").length&&e(a+".tpfw-color:not(.child-field)").wpColorPicker(),e(a+".tpfw-icon_picker:not(.child-field)").length&&e(a+".tpfw-icon_picker:not(.child-field) select").fontIconPicker(),document.getElementsByClassName("tpfw-datetime").length&&e(a+".tpfw-datetime input").each(function(){var t=e(this).data();e(this).datetimepicker(t)}),document.getElementsByClassName("tpfw-checkboxes")&&t.on("change",'.tpfw-checkboxes input[type="checkbox"]',function(){var t=e(this).closest("ul").find('input[type="checkbox"]:checked').map(function(){return this.value}).get().join(",");e(this).closest("ul").prev("input.tpfw_value").val(t).trigger("change")}),document.getElementsByClassName("tpfw-radios")&&t.on("change",'.tpfw-radios input[type="radio"]',function(){var t=e(this),a=t.closest("ul");a.find("input").removeAttr("checked"),t.attr("checked","checked"),a.prev("input.tpfw_value").val(t.val()).trigger("change")}),document.getElementsByClassName("tpfw-upload")&&e(".tpfw-upload").tpfwUpload(),e(a+".tpfw-select-multiple").length&&(e(a+".tpfw-select-multiple:not(.child-field)").selectize({plugins:["remove_button","drag_drop"]}),t.on("change",a+".tpfw-select-multiple",function(){e(this).closest("div").find(".tpfw_value").val(e(this).val()).trigger("change")})),e(a+".tpfw-autocomplete select").length&&(e(a+".tpfw-autocomplete:not(.child-field) select").tpfwAutocomplete(),t.on("change",a+".tpfw-autocomplete select",function(){e(this).closest("div").find(".tpfw_value").val(e(this).val()).trigger("change")}));var n=function(t){if(window.hasOwnProperty("google")){var a=t.find(".tpfw-map");a.length&&a.tpfwMap().addClass("map_loaded")}var n=t.find(".tpfw-color");n.length&&n.wpColorPicker();var i=t.find(".tpfw-icon_picker select");i.length&&i.fontIconPicker();var p=t.find(".tpfw-datetime input");p.length&&p.each(function(){var t=e(this).data();e(this).datetimepicker(t)});var l=t.find(".tpfw-repeater");l.length&&!l.hasClass("repeater_loaded")&&l.addClass("repeater_loaded").tpfwRepeater(),t.find(".tpfw-select-multiple").length&&t.find(".tpfw-select-multiple:not(.child-field)").selectize({plugins:["remove_button","drag_drop"]}),t.find(".tpfw-autocomplete").length&&t.find(".tpfw-autocomplete:not(.child-field) select").tpfwAutocomplete();var o=t.find("div[data-dependency]");o.length&&o.initWidgetDependency()};if(t.on("widget-updated",function(e,t){n(t)}),t.on("widget-added",function(e,t){n(t)}),t.on("click","#widgets-right .widget-title",function(t){var a=e(this);setTimeout(function(){var e=a.closest(".open");if(e.length){var t=e.find(".tpfw-map");t.length&&!t.hasClass("map_loaded")&&t.tpfwMap();var n=e.find(".tpfw-repeater");n.length&&!n.hasClass("repeater_loaded")&&n.addClass("repeater_loaded").tpfwRepeater()}},300),t.preventDefault()}),t.on("tpfw-repeater-item-opened",function(e,t){var a=t.find(".tpfw-map");a.length&&a.tpfwMap()}),t.on("click",".tpfw_group .group_nav a",function(a){var n=e(this),i=n.attr("href");n.closest("ul").find(".active").removeClass("active"),n.addClass("active"),e(".tpfw_group .group_item.active").removeClass("active");var p=e(".tpfw_group "+i);p.addClass("active"),e(".tpfw_group "+i+" .map_loaded").length&&(p.find(".tpfw-map").hasClass("map_refresh")||p.find(".tpfw-map").tpfwMap().addClass("map_refresh")),t.trigger("tpfw_group_active",[p]),a.preventDefault()}),e("#menu-to-edit .menu-item .item-edit").click(function(t){var a=e(this);setTimeout(function(){var e=a.closest(".menu-item");if(e.length){var t=e.find(".tpfw-map");t.length&&!t.hasClass("map_loaded")&&t.tpfwMap()}},300),t.preventDefault()}),window.hasOwnProperty("pagenow"))if("widgets"===pagenow){var i=e("#widgets-right").find("div[data-dependency]");i.length&&i.initWidgetDependency()}else"nav-menus"===pagenow?e("#menu-to-edit div[data-dependency]").length&&e("#menu-to-edit div[data-dependency]").initMenuDependency():e("[data-dependency]").initDependency();else e("[data-dependency]").length&&e("[data-dependency]").initDependency();e("input.tpfw-manage_box").length&&(e("input.tpfw-manage_box").each(function(){var t=e(this),a="";1==t.val()?(a="checked",t.closest(".postbox").removeClass("postbox--disabled")):t.closest(".postbox").addClass("postbox--disabled"),t.closest(".postbox").find(".hndle").before('<label class="tpfw-controlbox"><input type="checkbox" '+a+' data-name="'+t.attr("name")+'"/>'+t.data("label")+"</label>")}),e(document).on("change",".tpfw-controlbox input",function(t){var a=e(this),n=a.closest(".postbox"),i=0;a.is(":checked")?(n.removeClass("postbox--disabled"),i=1):n.addClass("postbox--disabled"),e("input[name="+a.data("name")+"]").val(i).change(),t.preventDefault(),t.stopPropagation()})),e(".tpfw-manage_group").length&&(e("input.tpfw-manage_group").on("change",function(t){var a=e(this);a.is(":checked")?a.closest(".tpfw_form_row").removeClass("group-disabled"):a.closest(".tpfw_form_row").addClass("group-disabled"),t.preventDefault()}),e("input.tpfw-manage_group").change())});
     1jQuery(function(e){"use strict";var t=e(document),a="";e("#widgets-right").length?a="#widgets-right ":0==e("#menu-to-edit").length&&(document.getElementsByClassName("tpfw-repeater").length&&e(".tpfw-repeater").tpfwRepeater(),document.getElementsByClassName("tpfw-map").length&&e(".tpfw-map").tpfwMap()),e(".tpfw-image_picker").tpfwImagePicker(),document.getElementsByClassName("tpfw-link").length&&e(".tpfw-link").tpfwLink(),e(".tpfw-color:not(.child-field)").length&&e(a+".tpfw-color:not(.child-field)").wpColorPicker(),e(a+".tpfw-icon_picker:not(.child-field)").length&&e(a+".tpfw-icon_picker:not(.child-field) select").fontIconPicker(),document.getElementsByClassName("tpfw-datetime").length&&e(a+".tpfw-datetime input").each(function(){var t=e(this).data();e(this).datetimepicker(t)}),document.getElementsByClassName("tpfw-checkboxes")&&t.on("change",'.tpfw-checkboxes input[type="checkbox"]',function(){var t=e(this).closest("ul").find('input[type="checkbox"]:checked').map(function(){return this.value}).get().join(",");e(this).closest("ul").prev("input.tpfw_value").val(t).trigger("change")}),document.getElementsByClassName("tpfw-radios")&&t.on("change",'.tpfw-radios input[type="radio"]',function(t){var a=e(this),n=a.closest("ul");n.find("input").removeAttr("checked"),a.attr("checked","checked"),n.prev("input.tpfw_value").val(a.val()).trigger("change")}),document.getElementsByClassName("tpfw-upload")&&e(".tpfw-upload").tpfwUpload(),e(a+".tpfw-select-multiple").length&&(e(a+".tpfw-select-multiple:not(.child-field)").selectize({plugins:["remove_button","drag_drop"]}),t.on("change",a+".tpfw-select-multiple",function(){e(this).closest("div").find(".tpfw_value").val(e(this).val()).trigger("change")})),e(a+".tpfw-autocomplete select").length&&(e(a+".tpfw-autocomplete:not(.child-field) select").tpfwAutocomplete(),t.on("change",a+".tpfw-autocomplete select",function(){e(this).closest("div").find(".tpfw_value").val(e(this).val()).trigger("change")}));var n=function(t){if(window.hasOwnProperty("google")){var a=t.find(".tpfw-map");a.length&&a.tpfwMap().addClass("map_loaded")}var n=t.find(".tpfw-color");n.length&&n.wpColorPicker();var i=t.find(".tpfw-icon_picker select");i.length&&i.fontIconPicker();var p=t.find(".tpfw-datetime input");p.length&&p.each(function(){var t=e(this).data();e(this).datetimepicker(t)});var l=t.find(".tpfw-repeater");l.length&&!l.hasClass("repeater_loaded")&&l.addClass("repeater_loaded").tpfwRepeater();var o=t.find(".tpfw-select-multiple");o.length&&t.find(".tpfw-select-multiple:not(.child-field)").selectize({plugins:["remove_button","drag_drop"]});var d=t.find(".tpfw-autocomplete");d.length&&t.find(".tpfw-autocomplete:not(.child-field) select").tpfwAutocomplete();var s=t.find("div[data-dependency]");s.length&&s.initWidgetDependency()};if(t.on("widget-updated",function(e,t){n(t)}),t.on("widget-added",function(e,t){n(t)}),t.on("click","#widgets-right .widget-title",function(t){var a=e(this);setTimeout(function(){var e=a.closest(".open");if(e.length){var t=e.find(".tpfw-map");t.length&&!t.hasClass("map_loaded")&&t.tpfwMap();var n=e.find(".tpfw-repeater");n.length&&!n.hasClass("repeater_loaded")&&n.addClass("repeater_loaded").tpfwRepeater()}},300),t.preventDefault()}),t.on("tpfw-repeater-item-opened",function(e,t){var a=t.find(".tpfw-map");a.length&&a.tpfwMap()}),t.on("click",".tpfw_group .group_nav a",function(a){var n=e(this),i=n.attr("href");n.closest("ul").find(".active").removeClass("active"),n.addClass("active"),e(".tpfw_group .group_item.active").removeClass("active");var p=e(".tpfw_group "+i);p.addClass("active"),e(".tpfw_group "+i+" .map_loaded").length&&(p.find(".tpfw-map").hasClass("map_refresh")||p.find(".tpfw-map").tpfwMap().addClass("map_refresh")),t.trigger("tpfw_group_active",[p]),a.preventDefault()}),e("#menu-to-edit .menu-item .item-edit").click(function(t){var a=e(this);setTimeout(function(){var e=a.closest(".menu-item");if(e.length){var t=e.find(".tpfw-map");t.length&&!t.hasClass("map_loaded")&&t.tpfwMap()}},300),t.preventDefault()}),window.hasOwnProperty("pagenow"))if("widgets"===pagenow){var i=e("#widgets-right").find("div[data-dependency]");i.length&&i.initWidgetDependency()}else"nav-menus"===pagenow?e("#menu-to-edit div[data-dependency]").length&&e("#menu-to-edit div[data-dependency]").initMenuDependency():e("[data-dependency]").initDependency();else e("[data-dependency]").length&&e("[data-dependency]").initDependency();e("input.tpfw-manage_box").length&&(e("input.tpfw-manage_box").each(function(){var t=e(this),a="";1==t.val()?(a="checked",t.closest(".postbox").removeClass("postbox--disabled")):t.closest(".postbox").addClass("postbox--disabled"),t.closest(".postbox").find(".hndle").before('<label class="tpfw-controlbox"><input type="checkbox" '+a+' data-name="'+t.attr("name")+'"/>'+t.data("label")+"</label>")}),e(document).on("change",".tpfw-controlbox input",function(t){var a=e(this),n=a.closest(".postbox"),i=0;a.is(":checked")?(n.removeClass("postbox--disabled"),i=1):n.addClass("postbox--disabled"),e("input[name="+a.data("name")+"]").val(i).change(),t.preventDefault(),t.stopPropagation()})),e(".tpfw-manage_group").length&&(e("input.tpfw-manage_group").on("change",function(t){var a=e(this);a.is(":checked")?a.closest(".tpfw_form_row").removeClass("group-disabled"):a.closest(".tpfw_form_row").addClass("group-disabled"),t.preventDefault()}),e("input.tpfw-manage_group").change())});
  • tp-framework/trunk/includes/admin-fields/field_link.php

    r1675334 r1764702  
    8989
    9090/**
    91  * Build Link from string
    92  *
    93  * @param string $value
    94  *
    95  * @since 1.0.0
    96  * @return array
    97  */
    98 function tpfw_build_link( $value ) {
    99     return tpfw_parse_multi_attribute( $value, array( 'url' => '', 'title' => '', 'target' => '', 'rel' => '' ) );
    100 }
    101 
    102 /**
    10391 * Print link editor template
    10492 * Link field need a hidden textarea to work
  • tp-framework/trunk/includes/tpfw-helpers-functions.php

    r1703500 r1764702  
    6060        $value = explode( ',', $value );
    6161    }
    62    
     62
    6363    return $value;
    6464}
    65 
    6665
    6766/**
     
    8786        $value = json_decode( urldecode( $value ), true );
    8887    }
    89    
     88
    9089    if ( empty( $value ) ) {
    9190        $value = $subfields;
     
    107106}
    108107
    109 
     108/**
     109 * Build Link from string
     110 *
     111 * @param string $value
     112 *
     113 * @since 1.0.0
     114 * @return array
     115 */
     116function tpfw_build_link( $value ) {
     117    return tpfw_parse_multi_attribute( $value, array( 'url' => '', 'title' => '', 'target' => '', 'rel' => '' ) );
     118}
    110119
    111120/**
     
    126135    return array();
    127136}
     137
     138/**
     139 * Build link from a value of field link to attributes
     140 *
     141 * @since 1.0.6
     142 * @param string $value Value of field link
     143 * @return string
     144 */
     145function tpfw_build_link_attrs( $value ) {
     146   
     147    $arr = tpfw_build_link( $value );
     148    $arr['href'] = $arr['url'];
     149    unset( $arr['url'] );
     150   
     151    $attrs = array();
     152    foreach ( $arr as $key => $val ) {
     153        $attrs[] = sprintf( '%s="%s"', $key, $val );
     154    }
     155   
     156    return implode(' ', $attrs);
     157}
  • tp-framework/trunk/readme.txt

    r1755566 r1764702  
    55Requires at least: 4.5   
    66Tested up to: 4.8   
    7 Stable tag: 1.0.5   
     7Stable tag: 1.0.6   
    88License: GPLv3   
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html   
     
    9494== Changelog ==
    9595
    96 = 1.0.5 (Oct 30, 2017): =
     96= 1.0.6 (November 13, 2017): =
     97 * Fix image_picker field does not work in repeater field
     98 * Add: tpfw_build_link_attrs
     99
     100= 1.0.5 (October 30, 2017): =
    97101 * Update: autocomplete field with static data
    98102 * Update: prevent upload wrong mimetype in field upload
    99103
    100 = 1.0.4 (Oct 30, 2017): =
     104= 1.0.4 (October 30, 2017): =
    101105 * Fix dependency on radio field
    102106 * Add field Upload (Single and Multiple File upload)
  • tp-framework/trunk/tp-framework.php

    r1755566 r1764702  
    66  Description: TP Framework provides theme users with an advanced importer and a library including Taxonomy, Metabox, Customizer, Menu Meta, Widget Fields.
    77  Author: themespond
    8   Version: 1.0.5
     8  Version: 1.0.6
    99  Author URI: https://themespond.com
    1010  Text Domain: tp-framework
     
    2222     * @var string
    2323     */
    24     public $version = '1.0.5';
     24    public $version = '1.0.6';
    2525
    2626    /**
     
    341341                    case 'typography':
    342342                    case 'autocomplete':
    343 
     343                       
    344344                        wp_enqueue_script( 'selectize', TPFW_URL . 'assets/vendors/selectize/selectize' . $min . '.js', array( 'jquery' ), TPFW_VERSION );
    345345                        wp_enqueue_style( 'selectize', TPFW_URL . 'assets/vendors/selectize/selectize' . $min . '.css', null, TPFW_VERSION );
Note: See TracChangeset for help on using the changeset viewer.