Plugin Directory

Changeset 1490791


Ignore:
Timestamp:
09/06/2016 07:51:00 AM (9 years ago)
Author:
tranthethang
Message:

1.2.5

  • Add new 4 fields: chosen, chosen_singular, repeater, repeater_link ( widget )

1.2.4

  • Tested up to: WordPress version 4.6
  • Apply filter: "kopa_is_load_compiled_assets"
  • Replace function (), _e() by esc_html(), esc_html_e()

1.2.3

  • Add new 5 fields: chosen, chosen_singular, repeater, repeater_link, icon_picker ( metabox, theme-options )

1.2.2

  • Fix Advanced fields JS bug
Location:
kopatheme/trunk
Files:
34 added
27 edited

Legend:

Unmodified
Added
Removed
  • kopatheme/trunk/assets/css/custom-layout.css

    r1486248 r1490791  
    1616  background-image: none;
    1717  border: 1px solid #d3d7da;
    18   box-shadow: 0 0 8px 1px #e9e8e8 inset;
    19 }
     18  box-shadow: 0 0 8px 1px #e9e8e8 inset; }
    2019
    2120.clearfix:before, .kopa_section_group_layout .kopa_controls:before, .clearfix:after, .kopa_section_group_layout .kopa_controls:after {
    2221  content: " ";
    23   display: table;
    24 }
     22  display: table; }
    2523
    2624.clearfix:after, .kopa_section_group_layout .kopa_controls:after {
    27   clear: both;
    28 }
     25  clear: both; }
    2926
    3027.kopa_section_group_layout * {
    3128  -webkit-box-sizing: border-box;
    3229  -moz-box-sizing: border-box;
    33   box-sizing: border-box;
    34 }
    35 
     30  box-sizing: border-box; }
    3631.kopa_section_group_layout a {
    37   text-decoration: none;
    38 }
    39 
    40 .kopa_section_group_layout a:hover, .kopa_section_group_layout a:focus {
    41   text-decoration: none;
    42   outline: none;
    43 }
    44 
     32  text-decoration: none; }
     33  .kopa_section_group_layout a:hover, .kopa_section_group_layout a:focus {
     34    text-decoration: none;
     35    outline: none; }
    4536.kopa_section_group_layout input[type="text"] {
    46   margin: 0;
    47 }
    48 
     37  margin: 0; }
    4938.kopa_section_group_layout .kopa_section_group {
    50   position: relative;
    51 }
    52 
     39  position: relative; }
    5340.kopa_section_group_layout .kopa_controls {
    54   position: relative;
    55 }
    56 
    57 .kopa_section_group_layout .kopa_controls select {
    58   margin: 0;
    59   width: 100%;
    60 }
    61 
     41  position: relative; }
     42  .kopa_section_group_layout .kopa_controls select {
     43    margin: 0;
     44    width: 100%; }
    6245.kopa_section_group_layout .kopa_group_content {
    63   overflow: hidden;
    64 }
    65 
     46  overflow: hidden; }
    6647.kopa_section_group_layout .kopa_section_layout_image {
    6748  padding-left: 20px;
    6849  float: right;
    69   width: 65%;
    70 }
    71 
    72 .kopa_section_group_layout .kopa_section_layout_image img {
    73   display: block;
    74   width: 100%;
    75   height: auto;
    76   border: 1px solid #d3d7da;
    77 }
    78 
     50  width: 65%; }
     51  .kopa_section_group_layout .kopa_section_layout_image img {
     52    display: block;
     53    width: 100%;
     54    height: auto;
     55    border: 1px solid #d3d7da; }
    7956.kopa_section_group_layout .kopa_section {
    8057  padding: 15px 20px 20px;
    8158  border: 1px solid #d3d7da;
    8259  margin-top: -1px;
    83   background: #fff;
    84 }
    85 
     60  background: #fff; }
    8661.kopa_section_group_layout .kopa_section_select_layout {
    8762  margin-bottom: 10px;
    88   margin-top: 0;
    89 }
    90 
     63  margin-top: 0; }
    9164.kopa_section_group_layout .kopa_section_select_layout, .kopa_section_group_layout .kopa_section_select_area_container {
    9265  float: left;
    93   width: 35%;
    94 }
    95 
     66  width: 35%; }
    9667.kopa_section_group_layout label {
    9768  margin-bottom: 20px;
    9869  margin-top: 9px;
    99   display: inline-block;
    100 }
    101 
     70  display: inline-block; }
    10271.kopa_section_group_layout .kopa_heading {
    10372  font-size: 14px;
     
    10776  padding: 0;
    10877  margin: 0 0 10px;
    109   line-height: 1.4;
    110 }
    111 
     78  line-height: 1.4; }
    11279.kopa_section_group_layout .kopa_section_select_area_container, .kopa_section_group_layout .kopa_section_layout_image {
    113   display: none;
    114 }
     80  display: none; }
    11581
    11682td .kopa_section_group_layout label {
    117   margin-top: 5px;
    118 }
     83  margin-top: 5px; }
     84
     85/*# sourceMappingURL=custom-layout.css.map */
  • kopatheme/trunk/assets/css/widget.css

    r1486248 r1490791  
    15241524}
    15251525
     1526.kopa-metabox-wrapper {
     1527  overflow: hidden;
     1528}
    15261529.kopa-metabox-wrapper .kopa_screenshot {
    15271530  display: block;
     
    15381541  display: none;
    15391542}
     1543
     1544.kopa-ui-repeater-links.kopa-size--xs {
     1545  width: 25%;
     1546}
     1547.kopa-ui-repeater-links.kopa-size--sm {
     1548  width: 50%;
     1549}
     1550.kopa-ui-repeater-links.kopa-size--md {
     1551  width: 75%;
     1552}
     1553.kopa-ui-repeater-links.kopa-size--lg {
     1554  width: 100%;
     1555}
     1556
     1557.kopa-repeater-group {
     1558  margin-bottom: 12px;
     1559}
     1560.kopa-repeater-group label {
     1561  display: block;
     1562  position: relative;
     1563  height: 36px;
     1564  line-height: 36px;
     1565  padding: 0px 12px;
     1566  background-color: #eee;
     1567  border: 1px solid #ddd;
     1568}
     1569.kopa-repeater-group label:hover i {
     1570  display: block;
     1571}
     1572.kopa-repeater-group label i {
     1573  display: none;
     1574  position: absolute;
     1575  top: 50%;
     1576  right: 45%;
     1577  margin-top: -12px;
     1578  width: 48px;
     1579  height: 24px;
     1580  line-height: 24px;
     1581  background-color: #9e9e9e;
     1582  color: #fff;
     1583  font-size: 13px;
     1584}
     1585.kopa-repeater-group label i:hover {
     1586  background-color: #858585;
     1587}
     1588.kopa-repeater-group label i.kopa-repeater-edit {
     1589  margin-right: 24px;
     1590  border: 1px solid #858585;
     1591  border-right: 0;
     1592  -webkit-border-top-left-radius: 3px;
     1593  -webkit-border-bottom-left-radius: 3px;
     1594  -moz-border-radius-topleft: 5px;
     1595  -moz-border-radius-bottomleft: 5px;
     1596  border-top-left-radius: 3px;
     1597  border-bottom-left-radius: 3px;
     1598}
     1599.kopa-repeater-group label i.kopa-repeater-delete {
     1600  margin-right: -24px;
     1601  border: 1px solid #858585;
     1602  -webkit-border-top-right-radius: 3px;
     1603  -webkit-border-bottom-right-radius: 3px;
     1604  -moz-border-radius-topright: 5px;
     1605  -moz-border-radius-bottomright: 5px;
     1606  border-top-right-radius: 3px;
     1607  border-bottom-right-radius: 3px;
     1608}
     1609.kopa-repeater-group .kopa-repeater-item-content {
     1610  display: none;
     1611  border-left: 1px solid #ddd;
     1612  border-right: 1px solid #ddd;
     1613  border-bottom: 1px solid #ddd;
     1614  padding: 12px;
     1615  background-color: #fafafa;
     1616}
     1617.kopa-repeater-group .kopa-repeater-item-content > .kopa-repeater-item-block, .kopa-repeater-group .kopa-repeater-item-content > p {
     1618  position: relative;
     1619  margin-bottom: 0px;
     1620  margin-top: 12px;
     1621}
     1622.kopa-repeater-group .kopa-repeater-item-content > .kopa-repeater-item-block:first-child, .kopa-repeater-group .kopa-repeater-item-content > p:first-child {
     1623  margin-top: 0px;
     1624}
     1625.kopa-repeater-group .kopa-repeater-item-content > .kopa-repeater-item-block input, .kopa-repeater-group .kopa-repeater-item-content > p input {
     1626  width: 100%;
     1627}
     1628.kopa-repeater-group .kopa-repeater-item-content > .kopa-repeater-item-block > span, .kopa-repeater-group .kopa-repeater-item-content > p > span {
     1629  display: block;
     1630  width: 100%;
     1631}
     1632.kopa-repeater-group.kopa-repeater-group--open .kopa-repeater-item-content {
     1633  display: block;
     1634  border-color: #303f46;
     1635}
     1636.kopa-repeater-group.kopa-repeater-group--open label {
     1637  background-color: #455a64;
     1638  border-color: #303f46;
     1639}
     1640.kopa-repeater-group.kopa-repeater-group--open label span {
     1641  color: #fff;
     1642}
     1643
     1644.kopa-repeater-toolbar {
     1645  margin-top: 12px;
     1646  margin-bottom: 0px;
     1647}
     1648
     1649.kopa-ui-quote .kopa-row {
     1650  position: relative;
     1651  padding: 15px;
     1652  border: 1px solid #e5e5e5;
     1653  background-color: #fafafa;
     1654  margin-top: 5px;
     1655}
     1656.kopa-ui-quote .kopa-row:first-child {
     1657  margin-top: 0px;
     1658}
     1659
     1660.kopa-ui-icon-picker {
     1661  display: block;
     1662  position: relative;
     1663  overflow: hidden;
     1664  text-align: center;
     1665  border: 1px solid #ddd;
     1666  background-color: #eee;
     1667}
     1668.kopa-ui-icon-picker:hover .kopa-ui-icon-picker-action {
     1669  bottom: 1px !important;
     1670}
     1671.kopa-ui-icon-picker i {
     1672  display: block;
     1673  border: 1px solid #fff;
     1674  color: #333;
     1675}
     1676.kopa-ui-icon-picker .kopa-ui-icon-picker-action {
     1677  transition: all 0.5s;
     1678  -ms-transition: all 0.5s;
     1679  -webkit-transition: all 0.5s;
     1680  -moz-transition: all 0.5s;
     1681  display: block;
     1682  position: absolute;
     1683  left: 1px;
     1684  right: 1px;
     1685  text-align: center;
     1686  text-transform: uppercase;
     1687  color: #fff;
     1688  cursor: pointer;
     1689}
     1690.kopa-ui-icon-picker .kopa-ui-icon-picker-add {
     1691  background-color: rgba(0, 115, 170, 0.75);
     1692}
     1693.kopa-ui-icon-picker .kopa-ui-icon-picker-add:hover {
     1694  background-color: #0085ba;
     1695}
     1696.kopa-ui-icon-picker.kopa-size--lg {
     1697  width: 90px;
     1698  height: 90px;
     1699  line-height: 90px;
     1700}
     1701.kopa-ui-icon-picker.kopa-size--lg i {
     1702  width: 88px;
     1703  height: 88px;
     1704  line-height: 88px;
     1705  font-size: 48px;
     1706}
     1707.kopa-ui-icon-picker.kopa-size--lg .kopa-ui-icon-picker-action {
     1708  bottom: -24px;
     1709  height: 24px;
     1710  line-height: 24px;
     1711  font-size: 10px;
     1712}
     1713.kopa-ui-icon-picker.kopa-size--xs {
     1714  width: 35px;
     1715  height: 35px;
     1716  line-height: 35px;
     1717}
     1718.kopa-ui-icon-picker.kopa-size--xs i {
     1719  width: 33px;
     1720  height: 33px;
     1721  line-height: 33px;
     1722  font-size: 24px;
     1723}
     1724.kopa-ui-icon-picker.kopa-size--xs .kopa-ui-icon-picker-action {
     1725  bottom: -33px;
     1726  height: 31px;
     1727  line-height: 31px;
     1728  font-size: 10px;
     1729}
     1730
     1731#tmpl-kopa-icon-picker .kopa-ui__header {
     1732  margin-bottom: 16px;
     1733}
     1734#tmpl-kopa-icon-picker .kopa-ui__search {
     1735  width: 100%;
     1736}
     1737#tmpl-kopa-icon-picker .kopa-ui__body:after {
     1738  clear: both;
     1739}
     1740#tmpl-kopa-icon-picker .kopa-ui__body:before, #tmpl-kopa-icon-picker .kopa-ui__body:after {
     1741  display: table;
     1742  content: " ";
     1743}
     1744#tmpl-kopa-icon-picker .kopa-ui__body {
     1745  margin-left: -3px;
     1746  margin-right: -3px;
     1747}
     1748#tmpl-kopa-icon-picker .kopa-ui__body span {
     1749  display: block;
     1750  float: left;
     1751  width: 53px;
     1752  height: 53px;
     1753  padding-left: 3px;
     1754  padding-right: 3px;
     1755  margin-bottom: 6px;
     1756}
     1757#tmpl-kopa-icon-picker .kopa-ui__body i {
     1758  display: block;
     1759  width: 100%;
     1760  height: 53px;
     1761  line-height: 53px;
     1762  text-align: center;
     1763  border: 1px solid #dddddd;
     1764  background-color: #fafafa;
     1765  color: #333;
     1766  font-size: 14px;
     1767  cursor: pointer;
     1768}
     1769#tmpl-kopa-icon-picker .kopa-ui__body i.kopa-ui__active, #tmpl-kopa-icon-picker .kopa-ui__body i:hover {
     1770  transition: background-color 0.5s;
     1771  -ms-transition: background-color 0.5s;
     1772  -webkit-transition: background-color 0.5s;
     1773  -moz-transition: background-color 0.5s;
     1774  background-color: #0073aa;
     1775  color: #fff;
     1776}
     1777
     1778.kopa-ui-dialog .ui-dialog-buttonset {
     1779  float: none;
     1780  width: 100%;
     1781}
     1782.kopa-ui-dialog .ui-dialog-buttonset .kopa-ui-button-use {
     1783  float: right;
     1784}
     1785.kopa-ui-dialog .ui-dialog-buttonset .kopa-ui-button-cancel {
     1786  float: right;
     1787}
     1788.kopa-ui-dialog .ui-dialog-buttonset .kopa-ui-button-remove {
     1789  float: left;
     1790  margin-right: 0 !important;
     1791  color: #ff0000;
     1792}
  • kopatheme/trunk/assets/css/widget.scss

    r1486248 r1490791  
     1@import 'config';
    12@import 'grid';
    23@import 'image_field';
     
    188189
    189190.kopa-metabox-wrapper{ 
     191    overflow: hidden;
    190192
    191193  .kopa_screenshot{
     
    205207}
    206208
     209
     210.kopa-ui-repeater-links{
     211    &.kopa-size--xs{ width: 25%; }
     212    &.kopa-size--sm{ width: 50%; }
     213    &.kopa-size--md{ width: 75%; }
     214    &.kopa-size--lg{ width: 100%; }
     215}
     216
     217.kopa-repeater-group{
     218    margin-bottom: 12px;
     219   
     220
     221    label{
     222        display: block;
     223        position: relative;
     224
     225        height: 36px;
     226        line-height: 36px;
     227        padding: 0px 12px;
     228        background-color: #eee;
     229        border: 1px solid #ddd;
     230       
     231        &:hover{
     232            i{
     233                display: block;
     234            }
     235        }
     236
     237        i{
     238            display: none;
     239            position: absolute;
     240            top: 50%;
     241            right: 45%;
     242            margin-top: -12px;         
     243            width: 48px;
     244            height: 24px;
     245            line-height: 24px;
     246            background-color: $color_action--02;   
     247            color: #fff;
     248            font-size: 13px;
     249
     250            &:hover{
     251                background-color: darken( $color_action--02 , 10 );
     252            }
     253        }
     254
     255        i.kopa-repeater-edit{           
     256            margin-right: 24px;
     257            border: 1px solid darken( $color_action--02 , 10 );
     258            border-right: 0;
     259
     260            -webkit-border-top-left-radius: 3px;
     261            -webkit-border-bottom-left-radius: 3px;
     262            -moz-border-radius-topleft: 5px;
     263            -moz-border-radius-bottomleft: 5px;
     264            border-top-left-radius: 3px;
     265            border-bottom-left-radius: 3px;
     266        }
     267
     268        i.kopa-repeater-delete{
     269            margin-right: -24px;
     270            border: 1px solid darken( $color_action--02 , 10 );
     271
     272            -webkit-border-top-right-radius: 3px;
     273            -webkit-border-bottom-right-radius: 3px;
     274            -moz-border-radius-topright: 5px;
     275            -moz-border-radius-bottomright: 5px;
     276            border-top-right-radius: 3px;
     277            border-bottom-right-radius: 3px;
     278        }
     279    }
     280
     281    .kopa-repeater-item-content{
     282        display: none;
     283        border-left: 1px solid #ddd;
     284        border-right: 1px solid #ddd;
     285        border-bottom: 1px solid #ddd;
     286        padding: 12px;
     287        background-color: #fafafa;
     288   
     289        & > .kopa-repeater-item-block,
     290        & > p{
     291            position: relative;
     292            margin-bottom: 0px;
     293            margin-top: 12px;
     294   
     295            &:first-child{
     296                margin-top: 0px;
     297            }
     298
     299            input{
     300                width: 100%;
     301            }
     302            & > span{
     303                display: block;             
     304                width: 100%;               
     305            }
     306        }       
     307    }
     308
     309    &.kopa-repeater-group--open{
     310        .kopa-repeater-item-content{
     311            display: block;
     312            border-color: darken( $color__action--01 , 10 );
     313        }
     314   
     315        label{
     316            background-color: $color__action--01;   
     317            border-color: darken( $color__action--01 , 10 );
     318            span{
     319                color: #fff;
     320            }           
     321        }
     322    }
     323
     324}
     325
     326.kopa-repeater-toolbar{
     327    margin-top: 12px;
     328    margin-bottom: 0px;
     329}
     330
     331.kopa-ui-quote{
     332    .kopa-row{
     333        position: relative;
     334        padding: 15px;     
     335        border: 1px solid #e5e5e5;
     336        background-color: #fafafa;
     337        margin-top: 5px;
     338        &:first-child{
     339            margin-top: 0px;
     340        }
     341    }
     342}
     343
     344.kopa-ui-icon-picker{
     345    display: block;
     346    position: relative;
     347    overflow: hidden;
     348    text-align: center;
     349    border: 1px solid #ddd;
     350    background-color: #eee;
     351
     352    &:hover{
     353        .kopa-ui-icon-picker-action{
     354            bottom: 1px !important;
     355        }
     356    }
     357
     358    i{
     359        display: block;
     360        border: 1px solid #fff;
     361        color: #333;   
     362    }
     363
     364    .kopa-ui-icon-picker-action{
     365        @include transition( .5s );
     366        display: block;     
     367        position: absolute;
     368        left: 1px;
     369        right: 1px;
     370        text-align: center;
     371        text-transform: uppercase;
     372        color: #fff;
     373        cursor: pointer;
     374    }
     375   
     376    .kopa-ui-icon-picker-add{
     377        background-color: rgba( #0073aa, .75 );
     378        &:hover{
     379            background-color: #0085ba;
     380        }       
     381    }
     382
     383    &.kopa-size--lg{       
     384        width: 90px;
     385        height: 90px;       
     386        line-height: 90px;
     387        i{             
     388            width: 88px;
     389            height: 88px;       
     390            line-height: 88px;                 
     391            font-size: 48px;           
     392        }
     393        .kopa-ui-icon-picker-action{                       
     394            bottom: -24px;         
     395            height: 24px;           
     396            line-height: 24px;
     397            font-size: 10px;           
     398        }       
     399    }
     400
     401    &.kopa-size--xs{       
     402        width: 35px;
     403        height: 35px;       
     404        line-height: 35px;
     405        i{             
     406            width: 33px;
     407            height: 33px;   
     408            line-height: 33px;         
     409            font-size: 24px;       
     410        }
     411        .kopa-ui-icon-picker-action{                       
     412            bottom: -33px;         
     413            height: 31px;           
     414            line-height: 31px;
     415            font-size: 10px;           
     416        }               
     417    }   
     418}
     419
     420#tmpl-kopa-icon-picker{
     421    .kopa-ui__header{           
     422        margin-bottom: 16px;
     423    }
     424
     425    .kopa-ui__search{
     426        width: 100%;
     427    }
     428   
     429    .kopa-ui__body{
     430        &:after{
     431            clear: both;
     432        }
     433
     434        &:before,
     435        &:after {
     436            display: table;
     437            content: " ";
     438        }   
     439    }
     440
     441    .kopa-ui__body{
     442        margin-left: -3px;
     443        margin-right: -3px;
     444
     445        span{
     446            display: block;
     447            float: left;
     448            width: 53px;
     449            height: 53px;
     450            padding-left: 3px;
     451            padding-right: 3px;
     452            margin-bottom: 6px;         
     453        }
     454
     455        i{
     456            display: block;         
     457            width: 100%;
     458            height: 53px;
     459            line-height: 53px;
     460            text-align: center;
     461            border: 1px solid #dddddd;
     462            background-color: #fafafa;
     463            color: #333;
     464            font-size: 14px;
     465            cursor: pointer;
     466   
     467            &.kopa-ui__active,
     468            &:hover{
     469                @include transition_m( background-color, .5s );
     470                background-color: #0073aa;
     471                color: #fff;
     472            }
     473        }
     474
     475    }
     476}
     477
     478.kopa-ui-dialog{
     479   
     480    .ui-dialog-buttonset{
     481        float: none;
     482        width: 100%;
     483
     484        .kopa-ui-button-use{
     485            float: right;
     486        }
     487
     488        .kopa-ui-button-cancel{
     489            float: right;
     490        }
     491
     492        .kopa-ui-button-remove{
     493            float: left;
     494            margin-right: 0 !important;
     495            color: #ff0000;
     496        }       
     497    }
     498
     499}
  • kopatheme/trunk/assets/js/admin-fields.js

    r1486248 r1490791  
    1 var Kopa_Icon_Picker, Kopa_Datetime_Js, Kopa_UI_Gallery, kopa_gallery_iframe, kopa_gallery_button;
    2 
    3 var kopa_gallery_sortable_uploader;
    4 var kopa_gallery_iframe;
    5 var kopa_gallery_button;
    6 var kopa_lighbox_icons_id = '#kopa_advanced_field_lighbox_icons';
    7 
    8 jQuery(document).ready(function ($) {
    9   Kopa_UI.init();
    10   Kopa_Field_Image.init($);
     1var Kopa_UI, Kopa_UI_DateTime, Kopa_UI_Gallery, Kopa_UI_Icon, Kopa_UI_Gallery_Sortable, Kopa_UI_Image, Kopa_UI_Repeater, Kopa_UI_Repeater_Link, Kopa_UI_Chosen, Kopa_UI_Icon_Picker;
     2var $kopa_icon_picker_activated;
     3var $kopa_gallery_sortable_uploader;
     4var $kopa_gallery_iframe;
     5var $kopa_gallery_button;
     6
     7jQuery(document).ready(function () {
     8  Kopa_UI.init(); 
    119});
    1210
    13 jQuery( document ).ajaxSuccess( function($) {
    14   Kopa_UI.init($);
    15   Kopa_Field_Image.init($);
     11jQuery(document).ajaxSuccess(function () {
     12  Kopa_UI.init(); 
    1613});
    1714
    1815var Kopa_UI = {
    1916  init: function () {
    20     Kopa_Datetime_Js.init_field_datetime();
     17    Kopa_UI_DateTime.init();
     18    Kopa_UI_Image.init();   
    2119    Kopa_UI_Gallery.init();
    2220    Kopa_UI_Gallery_Sortable.init();
    23     Kopa_Icon_Picker.init();       
     21    Kopa_UI_Icon.init();
     22    Kopa_UI_Icon_Picker.init();
     23      Kopa_UI_Repeater.init();
     24      Kopa_UI_Repeater_Link.init();
     25      Kopa_UI_Chosen.init();
    2426  }
    2527}
    2628
    27 var Kopa_Datetime_Js = {
    28     init_field_datetime: function() {
    29         if (jQuery('.kopa-framework-datetime').length > 0) {
    30             jQuery('.kopa-framework-datetime').each(function(index, element) {
    31                 var kopa_timepicker = jQuery(element).attr('data-timepicker');
    32                 var kopa_datepicker = jQuery(element).attr('data-datepicker');
    33                 if ( 1 == kopa_timepicker ) {
    34                     kopa_timepicker = true;
    35                 } else {
    36                     kopa_timepicker = false;
    37                 }
    38                 if ( 1 == kopa_datepicker ) {
    39                     kopa_datepicker = true;
    40                 } else {
    41                     kopa_datepicker = false;
    42                 }
    43                 jQuery(element).datetimepicker({
    44                     lang: 'en',
    45                     timepicker: kopa_timepicker,
    46                     datepicker: kopa_datepicker,
    47                     format: jQuery(element).attr('data-format'),
    48                     i18n: {
    49                         en: {
    50                             months: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
    51                             dayOfWeek: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
    52                         }
    53                     }
    54                 });
     29var Kopa_UI_DateTime = {
     30  init: function () {
     31    if (jQuery('.kopa-framework-datetime').length > 0) {
     32      jQuery('.kopa-framework-datetime').each(function (index, element) {
     33
     34        if( !jQuery(element).hasClass( 'kopa-framework-datetime--activated' ) ) {
     35
     36            var kopa_timepicker = parseInt( jQuery(element).attr('data-timepicker'), 10 );
     37            var kopa_datepicker = parseInt( jQuery(element).attr('data-datepicker'), 10 );
     38            if (1 == kopa_timepicker) {
     39                kopa_timepicker = true;
     40            } else {
     41                kopa_timepicker = false;
     42            }
     43            if (1 == kopa_datepicker) {
     44                kopa_datepicker = true;
     45            } else {
     46                kopa_datepicker = false;
     47            }
     48
     49            jQuery(element).datetimepicker({
     50                lang: 'en',
     51                timepicker: kopa_timepicker,
     52                datepicker: kopa_datepicker,
     53                format: jQuery(element).attr('data-format'),
     54                i18n: {
     55                  en: {
     56                    months: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
     57                    dayOfWeek: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
     58                  }
     59                }
     60            });
     61
     62
     63            jQuery(element).addClass( 'kopa-framework-datetime--activated' );
     64
     65          }
     66
     67      });
     68    }
     69  }
     70};
     71
     72var Kopa_UI_Gallery = {
     73  init: function () {
     74    jQuery('.kopa-framework-gallery-box').on('click', '.kopa-framework-gallery-config', function (event) {
     75      event.preventDefault();
     76      $kopa_gallery_button = jQuery(this);
     77      if ($kopa_gallery_iframe) {
     78        $kopa_gallery_iframe.open();
     79        return;
     80      }
     81      $kopa_gallery_iframe = wp.media.frames.$kopa_gallery_iframe = wp.media({
     82        title: 'Gallery config',
     83        button: {
     84          text: 'Use'
     85        },
     86        library: {
     87          type: 'image'
     88        },
     89        multiple: true
     90      });
     91      $kopa_gallery_iframe.on('open', function () {
     92        var ids, selection;
     93        ids = $kopa_gallery_button.parents('.kopa-framework-gallery-box').find('input.kopa-framework-gallery').val();
     94        if ('' !== ids) {
     95          selection = $kopa_gallery_iframe.state().get('selection');
     96          ids = ids.split(',');
     97          jQuery(ids).each(function (index, element) {
     98            var attachment;
     99            attachment = wp.media.attachment(element);
     100            attachment.fetch();
     101            selection.add(attachment ? [attachment] : []);
     102          });
     103        }
     104      });
     105      $kopa_gallery_iframe.on('select', function () {
     106        var result, selection;
     107        result = [];
     108        selection = $kopa_gallery_iframe.state().get('selection');
     109        selection.map(function (attachment) {
     110          attachment = attachment.toJSON();
     111          result.push(attachment.id);
     112        });
     113        if (result.length > 0) {
     114          result = result.join(',');
     115          $kopa_gallery_button.parents('.kopa-framework-gallery-box').find('input.kopa-framework-gallery').val(result);
     116        }
     117      });
     118      $kopa_gallery_iframe.open();
     119    });
     120  }
     121};
     122
     123var Kopa_UI_Icon = {
     124    init: function () {
     125      if (jQuery('.kopa-icon-picker').length > 0) {
     126        jQuery('.kopa-icon-picker').click(function (event) {
     127
     128          var btn;
     129          event.preventDefault();
     130          btn = jQuery(this);
     131          if (jQuery( Kopa_UI_Icon.get_id( '#' ) ).length !== 1) {
     132            jQuery('body').append('<div id="' + Kopa_UI_Icon.get_id( '' ) + '" class="upside-hide"></div>');
     133            jQuery.ajax({
     134              beforeSend: function (jqXHR) {},
     135              success: function (data, textStatus, jqXHR) {
     136                jQuery(Kopa_UI_Icon.get_id( '#' )).html(data);
     137              },
     138              complete: function () {
     139                Kopa_UI_Icon.open_lighbox(btn);
     140              },
     141              url: kopa_advanced_field.ajax_url,
     142              dataType: "html",
     143              type: 'GET',
     144              async: false,
     145              data: {
     146                action: 'get_lighbox_icons'
     147              }
    55148            });
    56         }
    57     }
    58 };
    59 
    60 var Kopa_UI_Gallery = {
    61     init: function() {
    62         jQuery('.kopa-framework-gallery-box').on('click', '.kopa-framework-gallery-config', function(event) {
    63             event.preventDefault();
    64             kopa_gallery_button = jQuery(this);
    65             if (kopa_gallery_iframe) {
    66                 kopa_gallery_iframe.open();
    67                 return;
     149          } else {
     150            Kopa_UI_Icon.open_lighbox(btn);
     151          }
     152        });
     153      }
     154    },
     155    open_lighbox: function (btn) {
     156      jQuery(Kopa_UI_Icon.get_id( '#' )).dialog({
     157        width: 360,
     158        height: 480,
     159        modal: true,
     160        closeText: '<i class="dashicons dashicons-dismiss"></i>',
     161        title: kopa_advanced_field.translate.icon_picker,
     162        buttons: [
     163          {
     164            'text': 'Select',
     165            'class': 'kopa-ui-button-use button button-primary',
     166            'click': function () {
     167              var icon;
     168              icon = Kopa_UI_Icon.click_ok();
     169              btn.parent().find('.kopa-icon-picker-value').val(icon);
     170              btn.parent().find('.kopa-icon-picker-preview i').attr('class', icon);
    68171            }
    69             kopa_gallery_iframe = wp.media.frames.kopa_gallery_iframe = wp.media({
    70                 title: 'Gallery config',
    71                 button: {
    72                     text: 'Use'
    73                 },
    74                 library: {
    75                     type: 'image'
    76                 },
    77                 multiple: true
    78             });
    79             kopa_gallery_iframe.on('open', function() {
    80                 var ids, selection;
    81                 ids = kopa_gallery_button.parents('.kopa-framework-gallery-box').find('input.kopa-framework-gallery').val();
    82                 if ('' !== ids) {
    83                     selection = kopa_gallery_iframe.state().get('selection');
    84                     ids = ids.split(',');
    85                     jQuery(ids).each(function(index, element) {
    86                         var attachment;
    87                         attachment = wp.media.attachment(element);
    88                         attachment.fetch();
    89                         selection.add(attachment ? [attachment] : []);
    90                     });
    91                 }
    92             });
    93             kopa_gallery_iframe.on('select', function() {
    94                 var result, selection;
    95                 result = [];
    96                 selection = kopa_gallery_iframe.state().get('selection');
    97                 selection.map(function(attachment) {
    98                     attachment = attachment.toJSON();
    99                     return result.push(attachment.id);
    100                 });
    101                 if (result.length > 0) {
    102                     result = result.join(',');
    103                     kopa_gallery_button.parents('.kopa-framework-gallery-box').find('input.kopa-framework-gallery').val(result);
    104                 }
    105             });
    106             kopa_gallery_iframe.open();
    107         });
    108     }
    109 };
    110 
    111 var Kopa_Icon_Picker = {
    112     init: function() {
    113         if (jQuery('.kopa-icon-picker').length > 0) {
    114             jQuery('.kopa-icon-picker').click(function(event) {                     
    115 
    116                 var btn;
    117                 event.preventDefault();
    118                 btn = jQuery(this);
    119                 if (jQuery(kopa_lighbox_icons_id).length !== 1) {
    120                     jQuery('body').append('<div id="kopa_advanced_field_lighbox_icons" class="upside-hide"></div>');
    121                     jQuery.ajax({
    122                         beforeSend: function(jqXHR) {},
    123                         success: function(data, textStatus, jqXHR) {
    124                             jQuery(kopa_lighbox_icons_id).html(data);
    125                         },
    126                         complete: function() {
    127                             Kopa_Icon_Picker.open_lighbox(btn);
    128                         },
    129                         url: kopa_advanced_field.ajax_url,
    130                         dataType: "html",
    131                         type: 'GET',
    132                         async: false,
    133                         data: {
    134                             action: 'get_lighbox_icons'
    135                         }
    136                     });
    137                 } else {
    138                     Kopa_Icon_Picker.open_lighbox(btn);
    139                 }
    140             });
    141         }
    142     },
    143     open_lighbox: function(btn) {
    144         jQuery(kopa_lighbox_icons_id).dialog({
    145             width: 360,
    146             height: 480,
    147             modal: true,
    148             closeText: '<i class="dashicons dashicons-dismiss"></i>',
    149             title: kopa_advanced_field.i18n.icon_picker,
    150             buttons: [
    151                 {
    152                                 'text': 'Select',
    153                                 'class': 'kopa-ui-button-use button button-primary',
    154                                 'click': function() {
    155                                     var icon;
    156                                     icon = Kopa_Icon_Picker.click_ok();
    157                                     btn.parent().find('.kopa-icon-picker-value').val(icon);
    158                                     btn.parent().find('.kopa-icon-picker-preview i').attr('class', icon);
    159                                 }
    160                 }
    161             ]
    162         });
    163     },
    164     click_ok: function() {
     172          }
     173        ]
     174      });
     175    },
     176    click_ok: function () {
    165177        var icon;
    166         icon = jQuery(kopa_lighbox_icons_id).find('.kopa-icon-item.upside-active i').attr('class');
    167         jQuery(kopa_lighbox_icons_id).dialog('close');
     178        icon = jQuery(Kopa_UI_Icon.get_id( '#' )).find('.kopa-icon-item.upside-active i').attr('class');
     179        jQuery(Kopa_UI_Icon.get_id( '#' )).dialog('close');
    168180        return icon;
    169181    },
    170     select_a_icon: function(event, obj) {
     182    select_a_icon: function (event, obj) {
    171183        event.preventDefault();
    172184        obj.parents('.kopa-wrap').find('.kopa-icon-item').removeClass('upside-active');
    173185        obj.addClass('upside-active');
    174186    },
    175     filter_icons: function(event, obj) {
     187    filter_icons: function (event, obj) {
    176188        var filter, regex, wrap;
    177189        event.preventDefault();
     
    183195        }
    184196        regex = new RegExp(filter, "i");
    185         wrap.find('.kopa-icon-item i').each(function(index, element) {
     197        wrap.find('.kopa-icon-item i').each(function (index, element) {
    186198            if (jQuery(this).data('title').search(regex) < 0) {
    187199                jQuery(this).parent().hide();
     
    190202            }
    191203        });
     204    },
     205    get_id: function( $prefix ){
     206        return $prefix + 'kopa_advanced_field_lighbox_icons';
    192207    }
    193208};
    194209
    195210var Kopa_UI_Gallery_Sortable = {
    196     init: function() {
    197         $galleries = jQuery( 'div.kopa-ui-gallery' );
    198         if( $galleries.length ) {
     211    init: function () {
     212      $galleries = jQuery('div.kopa-ui-gallery');
     213      if ($galleries.length) {
     214
     215        $galleries.map(function ($gallery) {
     216         
     217          var $_gallery = jQuery(this);
     218
     219          if( !$_gallery.hasClass( 'kopa-ui-gallery--activated' ) ) {
     220
     221              Kopa_UI_Gallery_Sortable._init_sortable( $_gallery.find('ul').first() );
     222
     223              $_gallery.on('click', '.kopa-ui-gallery__upload', function (event) {
     224                   Kopa_UI_Gallery_Sortable._edit( event, jQuery(this) );
     225                });
     226
     227                $_gallery.on('click', '.kopa-ui-gallery__remove', function (event) {
     228                   Kopa_UI_Gallery_Sortable._remove( event, jQuery(this) );
     229                });
     230
     231                $_gallery.addClass( 'kopa-ui-gallery--activated' );
     232
     233          }
     234
     235        });       
     236
     237      }
     238    },
     239    _edit: function (event, $button) {
     240      event.preventDefault();
     241
     242      $wrap = $button.parents('.kopa-ui-gallery');
     243      $sortable = $wrap.find('ul').first();
     244      $inputs = $wrap.find('input[type="hidden"]');
     245      $previews = $wrap.find('img');
     246      $gallery_name = $wrap.attr('data-name');
     247
     248      if ($kopa_gallery_sortable_uploader) {
     249        $kopa_gallery_sortable_uploader.open();
     250        return;
     251      }
     252
     253      $kopa_gallery_sortable_uploader = wp.media.frames.$kopa_gallery_sortable_uploader = wp.media({
     254        title: 'Uploader',
     255        $button: {
     256          text: 'Select'
     257        },
     258        library: {type: 'image'},
     259        multiple: true
     260      });
     261
     262      $kopa_gallery_sortable_uploader.on('open', function () {
     263
     264        if ($inputs.length) {
     265
     266          selection = $kopa_gallery_sortable_uploader.state().get('selection');
     267          jQuery.each($inputs, function () {
     268            var attachment = wp.media.attachment(parseInt(jQuery(this).val()));
     269            attachment.fetch();
     270            selection.add(attachment);
     271          });
     272
     273        }
     274      });
     275
     276      $kopa_gallery_sortable_uploader.on('select', function () {
     277
     278        var $results = [];
     279        var selection = $kopa_gallery_sortable_uploader.state().get('selection');
     280
     281        selection.map(function ($attachment) {
     282          $attachment = $attachment.toJSON();
     283          $results.push([$attachment.id, $attachment.sizes.thumbnail.url]);
     284        });
     285        console.log($results);
     286        if ($results.length) {
     287          $sortable.html('');
     288
     289          $results.map(function ($image) {
     290            $html = Kopa_UI_Gallery_Sortable._build_single($gallery_name, $image[0], $image[1]);
     291            $sortable.append(jQuery($html));
     292          });
     293        }
     294
     295      });
     296
     297      $kopa_gallery_sortable_uploader.open();
     298    },
     299    _remove: function (event, $button) {
     300      event.preventDefault();
     301      $button.parents('.kopa-ui-gallery__image').remove();
     302    },
     303    _build_single: function ($gallery_name, $image_id, $image_src) {
     304
     305      $html = '<li class="kopa-ui-gallery__image">';
     306      $html += '<input type="hidden" value="' + $image_id + '" name="' + $gallery_name + '[]">';
     307      $html += '<img alt="" src="' + $image_src + '">';
     308      $html += '<span class="kopa-ui-gallery__remove dashicons dashicons-trash">';
     309      $html += '</span>';
     310      $html += '</li>';
     311
     312      return $html;
     313    },
     314    _init_sortable: function ($sortable) {
     315      $sortable.sortable({
     316        containment: 'parent'
     317      });
     318      $sortable.disableSelection();
     319    }
     320}
     321
     322var Kopa_UI_Image = {
     323    init: function () {
     324        jQuery( '.kopa-field-image' ).on( 'click', '.item-add', function (e) {
     325            e.preventDefault();
    199326           
    200             $galleries.map( function( $gallery ) {
    201                 Kopa_UI_Gallery_Sortable._init_sortable( jQuery(this).find('ul').first() );
    202             } );
    203    
    204             $galleries.on( 'click', '.kopa-ui-gallery__upload', function( $event ) {
    205                 Kopa_UI_Gallery_Sortable._edit( $event, jQuery(this) );
    206             } );
    207 
    208             $galleries.on( 'click', '.kopa-ui-gallery__remove', function( $event ) {
    209                 Kopa_UI_Gallery_Sortable._remove( $event, jQuery(this) );
    210             } );
    211         }
    212     },
    213     _edit: function( $event, $button ) {
    214         $event.preventDefault();       
    215 
    216         $wrap         = $button.parents('.kopa-ui-gallery');
    217         $sortable     = $wrap.find( 'ul' ).first();
    218         $inputs       = $wrap.find( 'input[type="hidden"]' );
    219         $previews     = $wrap.find( 'img' );
    220         $gallery_name = $wrap.attr( 'data-name' );
    221 
    222         if (kopa_gallery_sortable_uploader) {
    223             kopa_gallery_sortable_uploader.open();
    224             return;
    225         }
    226 
    227         kopa_gallery_sortable_uploader = wp.media.frames.kopa_gallery_sortable_uploader = wp.media({
    228             title: 'Uploader',
    229             $button: {
    230                 text: 'Select'
    231             },
    232             library: { type: 'image' },
    233             multiple: true
    234         });
    235 
    236         kopa_gallery_sortable_uploader.on( 'open', function() {
    237 
    238             if( $inputs.length ) {
    239 
    240                 selection = kopa_gallery_sortable_uploader.state().get('selection');             
    241                 jQuery.each( $inputs, function(){
    242                     var attachment = wp.media.attachment( parseInt( jQuery(this).val() ) );
    243                     attachment.fetch();
    244                     selection.add( attachment );
    245                 } );
    246                              
    247             }
    248         });
    249 
    250         kopa_gallery_sortable_uploader.on( 'select', function() {
     327            var $this = jQuery(this);
    251328           
    252             var $results  = [];         
    253             var selection = kopa_gallery_sortable_uploader.state().get('selection');
    254 
    255             selection.map( function( $attachment ) {
    256                 $attachment = $attachment.toJSON();
    257                 $results.push( [ $attachment.id, $attachment.sizes.thumbnail.url] );
    258             });
    259             console.log($results);
    260             if ( $results.length ) {
    261                 $sortable.html( '' );
    262 
    263                 $results.map( function( $image ) {
    264                     $html = Kopa_UI_Gallery_Sortable._build_single( $gallery_name, $image[0], $image[1] );
    265                     $sortable.append( jQuery( $html ) );
    266                 } );
    267             }
    268 
    269         });
    270 
    271         kopa_gallery_sortable_uploader.open();
    272     },
    273     _remove: function( $event, $button ) {
    274         $event.preventDefault();       
    275         $button.closest('.kopa-ui-gallery__image').remove();     
    276     },
    277     _build_single: function( $gallery_name, $image_id, $image_src ){
    278 
    279         $html = '<li class="kopa-ui-gallery__image">';
    280         $html += '<input type="hidden" value="' + $image_id + '" name="' + $gallery_name + '[]">';
    281         $html += '<img alt="" src="' + $image_src + '">';
    282         $html += '<span class="kopa-ui-gallery__remove dashicons dashicons-trash">';
    283         $html += '</span>';
    284         $html += '</li>';
    285 
    286         return $html;
    287     },
    288     _init_sortable: function( $sortable ) {
    289         $sortable.sortable({
    290             containment: 'parent'
    291         });
    292         $sortable.disableSelection();
    293     }
    294 }
    295 
    296 
    297 /**
    298  * Image Select
    299  * @since 1.1.9
    300  */
    301 var Kopa_Field_Image = {
    302     init: function ($) {
    303         /**
    304          * Image Select
    305          */
    306 
    307         $('.kopa-field-image .item-add').click(function (e) {
    308             e.preventDefault();
    309             var $this = $(this);
    310329            var file_frame;
    311             // Create the media frame.
     330           
    312331            file_frame = wp.media.frames.downloadable_file = wp.media({
    313332                title: 'Select an image',
     
    318337            });
    319338
    320 
    321             // When an image is selected, run a callback.
    322339            file_frame.on('select', function () {
    323340                var attachment = file_frame.state().get('selection').first().toJSON();
     
    331348            });
    332349
    333             // Finally, open the modal.
    334350            file_frame.open();
    335351        });
    336 
    337         $(document).on("click", ".kopa-field-image .item-remove", function (e) {
    338             $(this).parent().find('.item-add').empty();
    339             $(this).prev("input").val("");
    340             $(this).parent().removeClass('hasimage');
     352       
     353        jQuery(document).on("click", ".kopa-field-image .item-remove", function (e) {
     354            jQuery(this).parent().find('.item-add').empty();
     355            jQuery(this).prev("input").val("");
     356            jQuery(this).parent().removeClass('hasimage');
    341357            e.preventDefault();
    342358        });
    343     }
    344 };
     359    }   
     360};
     361
     362var Kopa_UI_Repeater = {
     363  init: function() {
     364    var $repeaters;
     365    $repeaters = jQuery( '.kopa-ui-repeater' );
     366
     367    if ($repeaters.length) {
     368
     369      jQuery.each($repeaters, function() {
     370        var $_repeater;
     371        $_repeater = jQuery(this);
     372
     373        if( !$_repeater.hasClass( 'kopa-ui-repeater--activated' ) ) {
     374
     375              $_repeater.on( 'click', '.kopa-repeater-edit', function() {
     376               
     377                var $wrap;       
     378                $wrap = jQuery( this ).parents( '.kopa-repeater-group' );
     379               
     380                if( $wrap.find( '.kopa-repeater-item-content' ).is(":hidden") ) {
     381                    $wrap.addClass( 'kopa-repeater-group--open' );
     382                }else{
     383                            $wrap.removeClass( 'kopa-repeater-group--open' );
     384                }
     385
     386              });
     387
     388              $_repeater.on('keyup', '.kopa-repeater-input-key', function() {
     389                var $label, $new_key, $wrap;
     390                $new_key = jQuery(this).val();
     391                if ('' === jQuery.trim($new_key)) {
     392                  $new_key = kopa_advanced_field.translate.untitle;
     393                } else {
     394                  $new_key = jQuery('<div>' + $new_key + '</div>').text();
     395                }
     396                $wrap = jQuery(this).parents('.kopa-repeater-group');
     397                $label = $wrap.find('> label > span');
     398                $label.text($new_key);
     399              });
     400
     401            $_repeater.find('.kopa-ui-repeater-container').sortable();
     402
     403            $_repeater.find('.kopa-ui-repeater-container').repeatable({
     404              addTrigger: $_repeater.find('.kopa-repeater-add'),
     405              deleteTrigger: '.kopa-repeater-delete',
     406              template: $_repeater.attr('data-id'),
     407              itemContainer: '.kopa-repeater-group'
     408            });
     409
     410            $_repeater.addClass( 'kopa-ui-repeater--activated' );
     411        }
     412
     413      });
     414    }
     415  }
     416};
     417
     418var Kopa_UI_Repeater_Link = {
     419  init: function() {
     420    var $repeater_links;
     421    $repeater_links = jQuery('.kopa-ui-repeater-links');
     422    if ($repeater_links.length) {         
     423
     424      jQuery.each($repeater_links, function() {
     425        var $_repeater;
     426        $_repeater = jQuery(this);
     427
     428        if( !$_repeater.hasClass( 'kopa-ui-repeater-links--activated' ) ) {
     429
     430
     431              $_repeater.on( 'click', '.kopa-repeater-edit', function() {
     432               
     433                var $wrap;       
     434                $wrap = jQuery( this ).parents( '.kopa-repeater-group' );
     435               
     436                if( $wrap.find( '.kopa-repeater-item-content' ).is(":hidden") ) {
     437                    $wrap.addClass( 'kopa-repeater-group--open' );
     438                }else{
     439                            $wrap.removeClass( 'kopa-repeater-group--open' );
     440                }
     441
     442              });
     443
     444              $_repeater.on('keyup', '.kopa-repeater-input-title', function() {
     445                var $label, $new_key, $wrap;
     446                $new_key = jQuery(this).val();
     447                if ('' === jQuery.trim($new_key)) {
     448                  $new_key = kopa_advanced_field.translate.untitle;
     449                } else {
     450                  $new_key = jQuery('<div>' + $new_key + '</div>').text();
     451                }
     452                        $wrap  = jQuery(this).parents('.kopa-repeater-group');
     453                        $label = $wrap.find('> label > span');
     454                $label.text($new_key);
     455              });
     456
     457            $_repeater.find('.kopa-ui-repeater-container').sortable();
     458            $_repeater.find('.kopa-ui-repeater-container').repeatable({
     459              addTrigger: $_repeater.find('.kopa-repeater-add'),
     460              deleteTrigger: '.kopa-repeater-delete',
     461              template: $_repeater.attr('data-id'),
     462              itemContainer: '.kopa-repeater-group',
     463              afterAdd: function() {
     464                Kopa_UI_Icon_Picker.init();
     465              }
     466            });
     467
     468            $_repeater.addClass( 'kopa-ui-repeater-links--activated' );         
     469        }
     470
     471      });
     472    }
     473  }
     474};
     475
     476var Kopa_UI_Chosen = {
     477  init: function() {
     478    var $et_selects;
     479    $et_selects = jQuery('.kopa-ui-chosen select');
     480    if ($et_selects.length) {
     481      jQuery.each($et_selects, function() {
     482
     483        $cbo = jQuery(this);
     484        if( !$cbo.hasClass( 'kopa-ui-chosen--activated' ) ) {
     485
     486            $cbo.chosen({
     487              allow_single_deselect: true,
     488              width: $cbo.attr('data-width')
     489            });
     490
     491            $cbo.addClass( 'kopa-ui-chosen--activated' );
     492
     493        }
     494
     495      });
     496    }
     497  }
     498};
     499
     500var Kopa_UI_Icon_Picker = {
     501  init: function() {
     502    var $icon_pickers;
     503    $icon_pickers = jQuery( '.kopa-ui-icon-picker' );
     504
     505    if ( $icon_pickers.length ) {
     506
     507        jQuery.each( $icon_pickers, function(index, el) {
     508               
     509            $_icon_pickers = jQuery( this );
     510
     511            if( !$_icon_pickers.hasClass( 'kopa-ui-icon-picker--activated' ) ) {
     512
     513              $_icon_pickers.on( 'click', '.kopa-ui-icon-picker-add', function() {
     514                var $obj;
     515                $obj = jQuery(this);
     516                $kopa_icon_picker_activated = $obj.parents('.kopa-ui-icon-picker');
     517                if (!Kopa_UI_Icon_Picker._getBoxObject().length) {
     518                  Kopa_UI_Icon_Picker._build_picker();
     519                  Kopa_UI_Icon_Picker._init_dialog();
     520                }
     521               
     522                Kopa_UI_Icon_Picker._add($obj);
     523
     524              });
     525
     526              $_icon_pickers.addClass( 'kopa-ui-icon-picker--activated' );
     527
     528            }
     529
     530        });
     531
     532    }
     533
     534  },
     535  _getBoxObject: function() {
     536    return jQuery('#' + Kopa_UI_Icon_Picker._getBoxId());
     537  },
     538  _getBoxId: function() {
     539    return 'tmpl-kopa-icon-picker';
     540  },
     541  _add: function($obj) {
     542    var $tmp_picker;
     543    $tmp_picker = Kopa_UI_Icon_Picker._getBoxObject();
     544    if ($tmp_picker.hasClass('ui-dialog-content')) {
     545      $tmp_picker.dialog('open');
     546    }
     547  },
     548  _build_picker: function() {
     549    var $selected, $tmp_html, $tmp_id, $tmp_picker, $tmp_picker_body;
     550    $tmp_id = Kopa_UI_Icon_Picker._getBoxId();
     551    if ($kopa_icon_picker_activated.length && $kopa_icon_picker_activated !== void 0) {
     552      $selected = $kopa_icon_picker_activated.find('input').val();
     553    } else {
     554      $selected = false;
     555    }
     556    $tmp_html = '<div id="' + $tmp_id + '">' + '<div class="kopa-ui__header">' + '<input type="text" class="kopa-ui__search" onkeyup="Kopa_UI_Icon_Picker._search( jQuery(this) );">' + '</div>' + '<div class="kopa-ui__body">' + '</div>' + '</div>';
     557    jQuery('body').append($tmp_html);
     558    $tmp_picker = Kopa_UI_Icon_Picker._getBoxObject();
     559    $tmp_picker_body = $tmp_picker.find('.kopa-ui__body');
     560    _.each(kopa_advanced_field.icon_picker.fonts, function($font) {
     561      jQuery.getJSON($font.file, null, function($json, $textStatus) {
     562        if ('success' === $textStatus) {
     563          _.each($json, function($item) {
     564            var $names, $selector;
     565            $selector = $item.selector;
     566            $names = $selector.split(',');
     567            _.each($names, function($name) {
     568              $name = _.unescape(jQuery.trim($name.replace(':before', '')).substring(1));
     569              if ($font.prefix) {
     570                $name = $font.prefix + ' ' + $name;
     571              }
     572              if ($selected && $name === $selected) {
     573                $name += ' kopa-ui__active';
     574              }
     575              $tmp_picker_body.append('<span><i class="' + $name + '"></i></span>');
     576            });
     577          });
     578        }
     579      });
     580    });
     581    $tmp_picker_body.on('click', 'i', function(event) {
     582      var $wrap;
     583      event.preventDefault();
     584      if (!jQuery(this).hasClass('kopa-ui__active')) {
     585        $wrap = jQuery(this).parents('.kopa-ui__body');
     586        $wrap.find('i').removeClass('kopa-ui__active');
     587      }
     588      jQuery(this).toggleClass('kopa-ui__active');
     589    });
     590  },
     591  _init_dialog: function() {
     592    var $et_dialog;
     593    $et_dialog = Kopa_UI_Icon_Picker._getBoxObject();
     594    $et_dialog.dialog({
     595      title: kopa_advanced_field.icon_picker.label.icon_picker,
     596      dialogClass: 'kopa-ui-dialog kopa-ui-hide-title',
     597      closeText: '<i class="dashicons dashicons-dismiss"></i>',
     598      width: 400,
     599      height: 400,
     600      modal: true,
     601      closeOnEscape: false,
     602      resizable: false,
     603      autoOpen: false,
     604      buttons: [
     605        {
     606          text: kopa_advanced_field.icon_picker.label.remove,
     607          "class": 'kopa-ui-button-remove button button-link button-remove',
     608          click: function() {
     609            $et_dialog.dialog('close');
     610            $kopa_icon_picker_activated.find('input').val('');
     611            $kopa_icon_picker_activated.find('i').attr('class', '');
     612            $kopa_icon_picker_activated.find('.kopa-ui-icon-picker-add').text(kopa_advanced_field.icon_picker.label.add);
     613            Kopa_UI_Icon_Picker._clear();
     614          }
     615        }, {
     616          text: kopa_advanced_field.icon_picker.label.cancel,
     617          "class": 'kopa-ui-button-cancel button button-secondary',
     618          click: function() {
     619            $et_dialog.dialog('close');
     620            Kopa_UI_Icon_Picker._clear();
     621          }
     622        }, {
     623          text: kopa_advanced_field.icon_picker.label.use,
     624          "class": 'kopa-ui-button-use button button-primary',
     625          click: function() {
     626            var $selected, $val;
     627            if ($kopa_icon_picker_activated.length && $kopa_icon_picker_activated !== void 0) {
     628              $selected = $et_dialog.find('.kopa-ui__active');
     629              if ($selected.length) {
     630                $val = jQuery.trim($selected.attr('class').replace('kopa-ui__active', ''));
     631              } else {
     632                $val = '';
     633              }
     634              $kopa_icon_picker_activated.toggleClass('kopa-state-added');
     635              $kopa_icon_picker_activated.find('.kopa-ui-icon-picker-add').text(kopa_advanced_field.icon_picker.label.edit);
     636              $kopa_icon_picker_activated.find('i').attr('class', $val);
     637              $kopa_icon_picker_activated.find('input').val($val);
     638            }
     639            $et_dialog.dialog('close');
     640            Kopa_UI_Icon_Picker._clear();
     641          }
     642        }
     643      ]
     644    });
     645  },
     646  _search: function($input) {
     647    var $regex, $tmp_picker, $tmp_picker_body, $value;
     648    $tmp_picker = Kopa_UI_Icon_Picker._getBoxObject();
     649    $tmp_picker_body = $tmp_picker.find('.kopa-ui__body');
     650    $value = $input.val();
     651    if (!$value) {
     652      $tmp_picker_body.find('i').parent().show();
     653    } else {
     654      $regex = new RegExp($value, 'i');
     655      $tmp_picker_body.find('i').each(function() {
     656        if (jQuery(this).attr('class').search($regex) < 0) {
     657          jQuery(this).parent().hide();
     658        } else {
     659          jQuery(this).parent().show();
     660        }
     661      });
     662    }
     663  },
     664  _clear: function() {
     665    var $tmp_picker;
     666    $kopa_icon_picker_activated = void 0;
     667    $tmp_picker = Kopa_UI_Icon_Picker._getBoxObject();
     668    $tmp_picker.find('.kopa-ui__search').val('');
     669    $tmp_picker.find('.kopa-ui__body span').show();
     670    $tmp_picker.find('.kopa-ui__body i.kopa-ui__active').removeClass('kopa-ui__active');
     671  }
     672};
  • kopatheme/trunk/assets/js/admin-fields.min.js

    r1470471 r1490791  
    1 var Kopa_Icon_Picker,Kopa_Datetime_Js,Kopa_UI_Gallery,kopa_gallery_iframe,kopa_gallery_button,kopa_gallery_sortable_uploader,kopa_gallery_iframe,kopa_gallery_button,kopa_lighbox_icons_id="#kopa_advanced_field_lighbox_icons";jQuery(document).ready(function(e){Kopa_UI.init(),Kopa_Field_Image.init(e)}),jQuery(document).ajaxSuccess(function(){Kopa_UI.init()});var Kopa_UI={init:function(){Kopa_Datetime_Js.init_field_datetime(),Kopa_UI_Gallery.init(),Kopa_UI_Gallery_Sortable.init(),Kopa_Icon_Picker.init()}},Kopa_Datetime_Js={init_field_datetime:function(){jQuery(".kopa-framework-datetime").length>0&&jQuery(".kopa-framework-datetime").each(function(e,a){var i=jQuery(a).attr("data-timepicker"),t=jQuery(a).attr("data-datepicker");i=1==i?!0:!1,t=1==t?!0:!1,jQuery(a).datetimepicker({lang:"en",timepicker:i,datepicker:t,format:jQuery(a).attr("data-format"),i18n:{en:{months:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayOfWeek:["Su","Mo","Tu","We","Th","Fr","Sa"]}}})})}},Kopa_UI_Gallery={init:function(){jQuery(".kopa-framework-gallery-box").on("click",".kopa-framework-gallery-config",function(e){return e.preventDefault(),kopa_gallery_button=jQuery(this),kopa_gallery_iframe?(kopa_gallery_iframe.open(),void 0):(kopa_gallery_iframe=wp.media.frames.kopa_gallery_iframe=wp.media({title:"Gallery config",button:{text:"Use"},library:{type:"image"},multiple:!0}),kopa_gallery_iframe.on("open",function(){var e,a;e=kopa_gallery_button.parents(".kopa-framework-gallery-box").find("input.kopa-framework-gallery").val(),""!==e&&(a=kopa_gallery_iframe.state().get("selection"),e=e.split(","),jQuery(e).each(function(e,i){var t;t=wp.media.attachment(i),t.fetch(),a.add(t?[t]:[])}))}),kopa_gallery_iframe.on("select",function(){var e,a;e=[],a=kopa_gallery_iframe.state().get("selection"),a.map(function(a){return a=a.toJSON(),e.push(a.id)}),e.length>0&&(e=e.join(","),kopa_gallery_button.parents(".kopa-framework-gallery-box").find("input.kopa-framework-gallery").val(e))}),kopa_gallery_iframe.open(),void 0)})}},Kopa_Icon_Picker={init:function(){jQuery(".kopa-icon-picker").length>0&&jQuery(".kopa-icon-picker").click(function(e){var a;e.preventDefault(),a=jQuery(this),1!==jQuery(kopa_lighbox_icons_id).length?(jQuery("body").append('<div id="kopa_advanced_field_lighbox_icons" class="upside-hide"></div>'),jQuery.ajax({beforeSend:function(){},success:function(e){jQuery(kopa_lighbox_icons_id).html(e)},complete:function(){Kopa_Icon_Picker.open_lighbox(a)},url:kopa_advanced_field.ajax_url,dataType:"html",type:"GET",async:!1,data:{action:"get_lighbox_icons"}})):Kopa_Icon_Picker.open_lighbox(a)})},open_lighbox:function(e){jQuery(kopa_lighbox_icons_id).dialog({width:360,height:480,modal:!0,closeText:'<i class="dashicons dashicons-dismiss"></i>',title:kopa_advanced_field.i18n.icon_picker,buttons:[{text:"Select","class":"kopa-ui-button-use button button-primary",click:function(){var a;a=Kopa_Icon_Picker.click_ok(),e.parent().find(".kopa-icon-picker-value").val(a),e.parent().find(".kopa-icon-picker-preview i").attr("class",a)}}]})},click_ok:function(){var e;return e=jQuery(kopa_lighbox_icons_id).find(".kopa-icon-item.upside-active i").attr("class"),jQuery(kopa_lighbox_icons_id).dialog("close"),e},select_a_icon:function(e,a){e.preventDefault(),a.parents(".kopa-wrap").find(".kopa-icon-item").removeClass("upside-active"),a.addClass("upside-active")},filter_icons:function(e,a){var i,t,o;return e.preventDefault(),o=a.parents(".kopa-list-of-icon"),(i=a.val())?(t=new RegExp(i,"i"),o.find(".kopa-icon-item i").each(function(){jQuery(this).data("title").search(t)<0?jQuery(this).parent().hide():jQuery(this).parent().show()}),void 0):(o.find(".kopa-icon-item").show(),!1)}},Kopa_UI_Gallery_Sortable={init:function(){$galleries=jQuery("div.kopa-ui-gallery"),$galleries.length&&($galleries.map(function(){Kopa_UI_Gallery_Sortable._init_sortable(jQuery(this).find("ul").first())}),$galleries.on("click",".kopa-ui-gallery__upload",function(e){Kopa_UI_Gallery_Sortable._edit(e,jQuery(this))}),$galleries.on("click",".kopa-ui-gallery__remove",function(e){Kopa_UI_Gallery_Sortable._remove(e,jQuery(this))}))},_edit:function(e,a){return e.preventDefault(),$wrap=a.parents(".kopa-ui-gallery"),$sortable=$wrap.find("ul").first(),$inputs=$wrap.find('input[type="hidden"]'),$previews=$wrap.find("img"),$gallery_name=$wrap.attr("data-name"),kopa_gallery_sortable_uploader?(kopa_gallery_sortable_uploader.open(),void 0):(kopa_gallery_sortable_uploader=wp.media.frames.kopa_gallery_sortable_uploader=wp.media({title:"Uploader",$button:{text:"Select"},library:{type:"image"},multiple:!0}),kopa_gallery_sortable_uploader.on("open",function(){$inputs.length&&(selection=kopa_gallery_sortable_uploader.state().get("selection"),jQuery.each($inputs,function(){var e=wp.media.attachment(parseInt(jQuery(this).val()));e.fetch(),selection.add(e)}))}),kopa_gallery_sortable_uploader.on("select",function(){var e=[],a=kopa_gallery_sortable_uploader.state().get("selection");a.map(function(a){a=a.toJSON(),e.push([a.id,a.sizes.thumbnail.url])}),console.log(e),e.length&&($sortable.html(""),e.map(function(e){$html=Kopa_UI_Gallery_Sortable._build_single($gallery_name,e[0],e[1]),$sortable.append(jQuery($html))}))}),kopa_gallery_sortable_uploader.open(),void 0)},_remove:function(e,a){e.preventDefault(),a.closest(".kopa-ui-gallery__image").remove()},_build_single:function(e,a,i){return $html='<li class="kopa-ui-gallery__image">',$html+='<input type="hidden" value="'+a+'" name="'+e+'[]">',$html+='<img alt="" src="'+i+'">',$html+='<span class="kopa-ui-gallery__remove dashicons dashicons-trash">',$html+="</span>",$html+="</li>"},_init_sortable:function(e){e.sortable({containment:"parent"}),e.disableSelection()}},Kopa_Field_Image={init:function(e){e(".kopa-field-image .item-add").click(function(a){a.preventDefault();var i,t=e(this);i=wp.media.frames.downloadable_file=wp.media({title:"Select an image",button:{text:"Use image"},multiple:!1}),i.on("select",function(){var e=i.state().get("selection").first().toJSON(),a=e.sizes.thumbnail;void 0!=e.sizes.full&&(a=e.sizes.full),t.html('<div class="img" style="background-image:url('+a.url+')"></div>'),t.next("input").val(e.id),t.parent().addClass("hasimage")}),i.open()}),e(document).on("click",".kopa-field-image .item-remove",function(a){e(this).parent().find(".item-add").empty(),e(this).prev("input").val(""),e(this).parent().removeClass("hasimage"),a.preventDefault()})}};
     1var Kopa_UI,Kopa_UI_DateTime,Kopa_UI_Gallery,Kopa_UI_Icon,Kopa_UI_Gallery_Sortable,Kopa_UI_Image,Kopa_UI_Repeater,Kopa_UI_Repeater_Link,Kopa_UI_Chosen,Kopa_UI_Icon_Picker,$kopa_icon_picker_activated,$kopa_gallery_sortable_uploader,$kopa_gallery_iframe,$kopa_gallery_button;jQuery(document).ready(function(){Kopa_UI.init()}),jQuery(document).ajaxSuccess(function(){Kopa_UI.init()});var Kopa_UI={init:function(){Kopa_UI_DateTime.init(),Kopa_UI_Image.init(),Kopa_UI_Gallery.init(),Kopa_UI_Gallery_Sortable.init(),Kopa_UI_Icon.init(),Kopa_UI_Icon_Picker.init(),Kopa_UI_Repeater.init(),Kopa_UI_Repeater_Link.init(),Kopa_UI_Chosen.init()}},Kopa_UI_DateTime={init:function(){jQuery(".kopa-framework-datetime").length>0&&jQuery(".kopa-framework-datetime").each(function(e,a){if(!jQuery(a).hasClass("kopa-framework-datetime--activated")){var i=parseInt(jQuery(a).attr("data-timepicker"),10),t=parseInt(jQuery(a).attr("data-datepicker"),10);i=1==i?!0:!1,t=1==t?!0:!1,jQuery(a).datetimepicker({lang:"en",timepicker:i,datepicker:t,format:jQuery(a).attr("data-format"),i18n:{en:{months:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayOfWeek:["Su","Mo","Tu","We","Th","Fr","Sa"]}}}),jQuery(a).addClass("kopa-framework-datetime--activated")}})}},Kopa_UI_Gallery={init:function(){jQuery(".kopa-framework-gallery-box").on("click",".kopa-framework-gallery-config",function(e){return e.preventDefault(),$kopa_gallery_button=jQuery(this),$kopa_gallery_iframe?($kopa_gallery_iframe.open(),void 0):($kopa_gallery_iframe=wp.media.frames.$kopa_gallery_iframe=wp.media({title:"Gallery config",button:{text:"Use"},library:{type:"image"},multiple:!0}),$kopa_gallery_iframe.on("open",function(){var e,a;e=$kopa_gallery_button.parents(".kopa-framework-gallery-box").find("input.kopa-framework-gallery").val(),""!==e&&(a=$kopa_gallery_iframe.state().get("selection"),e=e.split(","),jQuery(e).each(function(e,i){var t;t=wp.media.attachment(i),t.fetch(),a.add(t?[t]:[])}))}),$kopa_gallery_iframe.on("select",function(){var e,a;e=[],a=$kopa_gallery_iframe.state().get("selection"),a.map(function(a){a=a.toJSON(),e.push(a.id)}),e.length>0&&(e=e.join(","),$kopa_gallery_button.parents(".kopa-framework-gallery-box").find("input.kopa-framework-gallery").val(e))}),$kopa_gallery_iframe.open(),void 0)})}},Kopa_UI_Icon={init:function(){jQuery(".kopa-icon-picker").length>0&&jQuery(".kopa-icon-picker").click(function(e){var a;e.preventDefault(),a=jQuery(this),1!==jQuery(Kopa_UI_Icon.get_id("#")).length?(jQuery("body").append('<div id="'+Kopa_UI_Icon.get_id("")+'" class="upside-hide"></div>'),jQuery.ajax({beforeSend:function(){},success:function(e){jQuery(Kopa_UI_Icon.get_id("#")).html(e)},complete:function(){Kopa_UI_Icon.open_lighbox(a)},url:kopa_advanced_field.ajax_url,dataType:"html",type:"GET",async:!1,data:{action:"get_lighbox_icons"}})):Kopa_UI_Icon.open_lighbox(a)})},open_lighbox:function(e){jQuery(Kopa_UI_Icon.get_id("#")).dialog({width:360,height:480,modal:!0,closeText:'<i class="dashicons dashicons-dismiss"></i>',title:kopa_advanced_field.translate.icon_picker,buttons:[{text:"Select","class":"kopa-ui-button-use button button-primary",click:function(){var a;a=Kopa_UI_Icon.click_ok(),e.parent().find(".kopa-icon-picker-value").val(a),e.parent().find(".kopa-icon-picker-preview i").attr("class",a)}}]})},click_ok:function(){var e;return e=jQuery(Kopa_UI_Icon.get_id("#")).find(".kopa-icon-item.upside-active i").attr("class"),jQuery(Kopa_UI_Icon.get_id("#")).dialog("close"),e},select_a_icon:function(e,a){e.preventDefault(),a.parents(".kopa-wrap").find(".kopa-icon-item").removeClass("upside-active"),a.addClass("upside-active")},filter_icons:function(e,a){var i,t,o;return e.preventDefault(),o=a.parents(".kopa-list-of-icon"),(i=a.val())?(t=new RegExp(i,"i"),o.find(".kopa-icon-item i").each(function(){jQuery(this).data("title").search(t)<0?jQuery(this).parent().hide():jQuery(this).parent().show()}),void 0):(o.find(".kopa-icon-item").show(),!1)},get_id:function(e){return e+"kopa_advanced_field_lighbox_icons"}},Kopa_UI_Gallery_Sortable={init:function(){$galleries=jQuery("div.kopa-ui-gallery"),$galleries.length&&$galleries.map(function(){var e=jQuery(this);e.hasClass("kopa-ui-gallery--activated")||(Kopa_UI_Gallery_Sortable._init_sortable(e.find("ul").first()),e.on("click",".kopa-ui-gallery__upload",function(e){Kopa_UI_Gallery_Sortable._edit(e,jQuery(this))}),e.on("click",".kopa-ui-gallery__remove",function(e){Kopa_UI_Gallery_Sortable._remove(e,jQuery(this))}),e.addClass("kopa-ui-gallery--activated"))})},_edit:function(e,a){return e.preventDefault(),$wrap=a.parents(".kopa-ui-gallery"),$sortable=$wrap.find("ul").first(),$inputs=$wrap.find('input[type="hidden"]'),$previews=$wrap.find("img"),$gallery_name=$wrap.attr("data-name"),$kopa_gallery_sortable_uploader?($kopa_gallery_sortable_uploader.open(),void 0):($kopa_gallery_sortable_uploader=wp.media.frames.$kopa_gallery_sortable_uploader=wp.media({title:"Uploader",$button:{text:"Select"},library:{type:"image"},multiple:!0}),$kopa_gallery_sortable_uploader.on("open",function(){$inputs.length&&(selection=$kopa_gallery_sortable_uploader.state().get("selection"),jQuery.each($inputs,function(){var e=wp.media.attachment(parseInt(jQuery(this).val()));e.fetch(),selection.add(e)}))}),$kopa_gallery_sortable_uploader.on("select",function(){var e=[],a=$kopa_gallery_sortable_uploader.state().get("selection");a.map(function(a){a=a.toJSON(),e.push([a.id,a.sizes.thumbnail.url])}),console.log(e),e.length&&($sortable.html(""),e.map(function(e){$html=Kopa_UI_Gallery_Sortable._build_single($gallery_name,e[0],e[1]),$sortable.append(jQuery($html))}))}),$kopa_gallery_sortable_uploader.open(),void 0)},_remove:function(e,a){e.preventDefault(),a.parents(".kopa-ui-gallery__image").remove()},_build_single:function(e,a,i){return $html='<li class="kopa-ui-gallery__image">',$html+='<input type="hidden" value="'+a+'" name="'+e+'[]">',$html+='<img alt="" src="'+i+'">',$html+='<span class="kopa-ui-gallery__remove dashicons dashicons-trash">',$html+="</span>",$html+="</li>"},_init_sortable:function(e){e.sortable({containment:"parent"}),e.disableSelection()}},Kopa_UI_Image={init:function(){jQuery(".kopa-field-image").on("click",".item-add",function(e){e.preventDefault();var a,i=jQuery(this);a=wp.media.frames.downloadable_file=wp.media({title:"Select an image",button:{text:"Use image"},multiple:!1}),a.on("select",function(){var e=a.state().get("selection").first().toJSON(),t=e.sizes.thumbnail;void 0!=e.sizes.full&&(t=e.sizes.full),i.html('<div class="img" style="background-image:url('+t.url+')"></div>'),i.next("input").val(e.id),i.parent().addClass("hasimage")}),a.open()}),jQuery(document).on("click",".kopa-field-image .item-remove",function(e){jQuery(this).parent().find(".item-add").empty(),jQuery(this).prev("input").val(""),jQuery(this).parent().removeClass("hasimage"),e.preventDefault()})}},Kopa_UI_Repeater={init:function(){var e;e=jQuery(".kopa-ui-repeater"),e.length&&jQuery.each(e,function(){var e;e=jQuery(this),e.hasClass("kopa-ui-repeater--activated")||(e.on("click",".kopa-repeater-edit",function(){var e;e=jQuery(this).parents(".kopa-repeater-group"),e.find(".kopa-repeater-item-content").is(":hidden")?e.addClass("kopa-repeater-group--open"):e.removeClass("kopa-repeater-group--open")}),e.on("keyup",".kopa-repeater-input-key",function(){var e,a,i;a=jQuery(this).val(),a=""===jQuery.trim(a)?kopa_advanced_field.translate.untitle:jQuery("<div>"+a+"</div>").text(),i=jQuery(this).parents(".kopa-repeater-group"),e=i.find("> label > span"),e.text(a)}),e.find(".kopa-ui-repeater-container").sortable(),e.find(".kopa-ui-repeater-container").repeatable({addTrigger:e.find(".kopa-repeater-add"),deleteTrigger:".kopa-repeater-delete",template:e.attr("data-id"),itemContainer:".kopa-repeater-group"}),e.addClass("kopa-ui-repeater--activated"))})}},Kopa_UI_Repeater_Link={init:function(){var e;e=jQuery(".kopa-ui-repeater-links"),e.length&&jQuery.each(e,function(){var e;e=jQuery(this),e.hasClass("kopa-ui-repeater-links--activated")||(e.on("click",".kopa-repeater-edit",function(){var e;e=jQuery(this).parents(".kopa-repeater-group"),e.find(".kopa-repeater-item-content").is(":hidden")?e.addClass("kopa-repeater-group--open"):e.removeClass("kopa-repeater-group--open")}),e.on("keyup",".kopa-repeater-input-title",function(){var e,a,i;a=jQuery(this).val(),a=""===jQuery.trim(a)?kopa_advanced_field.translate.untitle:jQuery("<div>"+a+"</div>").text(),i=jQuery(this).parents(".kopa-repeater-group"),e=i.find("> label > span"),e.text(a)}),e.find(".kopa-ui-repeater-container").sortable(),e.find(".kopa-ui-repeater-container").repeatable({addTrigger:e.find(".kopa-repeater-add"),deleteTrigger:".kopa-repeater-delete",template:e.attr("data-id"),itemContainer:".kopa-repeater-group",afterAdd:function(){Kopa_UI_Icon_Picker.init()}}),e.addClass("kopa-ui-repeater-links--activated"))})}},Kopa_UI_Chosen={init:function(){var e;e=jQuery(".kopa-ui-chosen select"),e.length&&jQuery.each(e,function(){$cbo=jQuery(this),$cbo.hasClass("kopa-ui-chosen--activated")||($cbo.chosen({allow_single_deselect:!0,width:$cbo.attr("data-width")}),$cbo.addClass("kopa-ui-chosen--activated"))})}},Kopa_UI_Icon_Picker={init:function(){var e;e=jQuery(".kopa-ui-icon-picker"),e.length&&jQuery.each(e,function(){$_icon_pickers=jQuery(this),$_icon_pickers.hasClass("kopa-ui-icon-picker--activated")||($_icon_pickers.on("click",".kopa-ui-icon-picker-add",function(){var e;e=jQuery(this),$kopa_icon_picker_activated=e.parents(".kopa-ui-icon-picker"),Kopa_UI_Icon_Picker._getBoxObject().length||(Kopa_UI_Icon_Picker._build_picker(),Kopa_UI_Icon_Picker._init_dialog()),Kopa_UI_Icon_Picker._add(e)}),$_icon_pickers.addClass("kopa-ui-icon-picker--activated"))})},_getBoxObject:function(){return jQuery("#"+Kopa_UI_Icon_Picker._getBoxId())},_getBoxId:function(){return"tmpl-kopa-icon-picker"},_add:function(){var e;e=Kopa_UI_Icon_Picker._getBoxObject(),e.hasClass("ui-dialog-content")&&e.dialog("open")},_build_picker:function(){var e,a,i,t,o;i=Kopa_UI_Icon_Picker._getBoxId(),e=$kopa_icon_picker_activated.length&&void 0!==$kopa_icon_picker_activated?$kopa_icon_picker_activated.find("input").val():!1,a='<div id="'+i+'"><div class="kopa-ui__header"><input type="text" class="kopa-ui__search" onkeyup="Kopa_UI_Icon_Picker._search( jQuery(this) );"></div><div class="kopa-ui__body"></div></div>',jQuery("body").append(a),t=Kopa_UI_Icon_Picker._getBoxObject(),o=t.find(".kopa-ui__body"),_.each(kopa_advanced_field.icon_picker.fonts,function(a){jQuery.getJSON(a.file,null,function(i,t){"success"===t&&_.each(i,function(i){var t,n;n=i.selector,t=n.split(","),_.each(t,function(i){i=_.unescape(jQuery.trim(i.replace(":before","")).substring(1)),a.prefix&&(i=a.prefix+" "+i),e&&i===e&&(i+=" kopa-ui__active"),o.append('<span><i class="'+i+'"></i></span>')})})})}),o.on("click","i",function(e){var a;e.preventDefault(),jQuery(this).hasClass("kopa-ui__active")||(a=jQuery(this).parents(".kopa-ui__body"),a.find("i").removeClass("kopa-ui__active")),jQuery(this).toggleClass("kopa-ui__active")})},_init_dialog:function(){var e;e=Kopa_UI_Icon_Picker._getBoxObject(),e.dialog({title:kopa_advanced_field.icon_picker.label.icon_picker,dialogClass:"kopa-ui-dialog kopa-ui-hide-title",closeText:'<i class="dashicons dashicons-dismiss"></i>',width:400,height:400,modal:!0,closeOnEscape:!1,resizable:!1,autoOpen:!1,buttons:[{text:kopa_advanced_field.icon_picker.label.remove,"class":"kopa-ui-button-remove button button-link button-remove",click:function(){e.dialog("close"),$kopa_icon_picker_activated.find("input").val(""),$kopa_icon_picker_activated.find("i").attr("class",""),$kopa_icon_picker_activated.find(".kopa-ui-icon-picker-add").text(kopa_advanced_field.icon_picker.label.add),Kopa_UI_Icon_Picker._clear()}},{text:kopa_advanced_field.icon_picker.label.cancel,"class":"kopa-ui-button-cancel button button-secondary",click:function(){e.dialog("close"),Kopa_UI_Icon_Picker._clear()}},{text:kopa_advanced_field.icon_picker.label.use,"class":"kopa-ui-button-use button button-primary",click:function(){var a,i;$kopa_icon_picker_activated.length&&void 0!==$kopa_icon_picker_activated&&(a=e.find(".kopa-ui__active"),i=a.length?jQuery.trim(a.attr("class").replace("kopa-ui__active","")):"",$kopa_icon_picker_activated.toggleClass("kopa-state-added"),$kopa_icon_picker_activated.find(".kopa-ui-icon-picker-add").text(kopa_advanced_field.icon_picker.label.edit),$kopa_icon_picker_activated.find("i").attr("class",i),$kopa_icon_picker_activated.find("input").val(i)),e.dialog("close"),Kopa_UI_Icon_Picker._clear()}}]})},_search:function(e){var a,i,t,o;i=Kopa_UI_Icon_Picker._getBoxObject(),t=i.find(".kopa-ui__body"),o=e.val(),o?(a=new RegExp(o,"i"),t.find("i").each(function(){jQuery(this).attr("class").search(a)<0?jQuery(this).parent().hide():jQuery(this).parent().show()})):t.find("i").parent().show()},_clear:function(){var e;$kopa_icon_picker_activated=void 0,e=Kopa_UI_Icon_Picker._getBoxObject(),e.find(".kopa-ui__search").val(""),e.find(".kopa-ui__body span").show(),e.find(".kopa-ui__body i.kopa-ui__active").removeClass("kopa-ui__active")}};
  • kopatheme/trunk/assets/js/admin-sidebar.js

    r1353276 r1490791  
    203203                        open_modal( 'confirm', $this, kopa_sidebar_attributes_l10n.warning, messages );
    204204                       
    205                         // if ( confirm( messages ) ) {
    206                         //  $this.parents('.kopa_sidebar').slideUp( function () {
    207                         //      $(this).remove();
    208                         //  } );
    209                         // }
    210205                    } else {
    211206                        messages += errors.join("<br>");
    212207                        open_modal( 'alert', $this, kopa_sidebar_attributes_l10n.error, messages );
    213                         // alert( messages );
    214208                    } // end check allow delete or not
    215209
     
    220214   
    221215            open_modal( 'confirm', $this, kopa_sidebar_attributes_l10n.info, confirmMessage );
    222 
    223             // if ( confirm( confirmMessage ) ) {
    224             //  // for the new sidebar which has just been added
    225             //  // delete immediately without ajax checking
    226             //  $this.parents('.kopa_sidebar').slideUp( function () {
    227             //      $(this).remove();
    228             //  } );
    229             // }
    230216
    231217        } // end check empty sidebarID
     
    306292    $('.kopa_sidebar_advanced_settings').on('click', folding_advanced_settings);
    307293
    308    
    309 
    310294});
  • kopatheme/trunk/assets/js/admin.js

    r1353276 r1490791  
    190190    /* ========================================================================
    191191     * Fonts
    192      * Dependencies      : google.com, jquery
     192     * Dependencies         : google.com, jquery
    193193     * Feature added by : Smartik - http://smartik.ws/
    194      * Date              : 03.17.2013
     194     * Date                         : 03.17.2013
    195195     * Modified by      : Kopatheme
    196196     * Modified date    : 07.26.2014
  • kopatheme/trunk/includes/abstracts/abstract-kopa-widget.php

    r1486248 r1490791  
    115115        foreach ( $this->settings as $key => $setting ) {
    116116            $output = null;
     117
    117118            if ( isset( $new_instance[ $key ] ) ) {
    118                 if ( is_array( $new_instance[ $key ] ) ) {
    119                     $output = array_map( 'sanitize_text_field', (array) $new_instance[ $key ] );
    120                 } elseif ( 'textarea' === $setting['type'] ) {
    121                     // $instance[ $key ] = wp_kses_post( trim( $new_instance[ $key ] ) );
    122 
    123                     /**
    124                      * @see update() of WP_Widget_Text
    125                      */
    126                     if ( current_user_can('unfiltered_html') ) {
    127                         $output =  $new_instance[ $key ];
    128                     } else {
    129                         $output = stripslashes( wp_filter_post_kses( addslashes($new_instance[ $key ]) ) ); // wp_filter_post_kses() expects slashed
    130                     }
    131                 } elseif ( 'datetime' === $setting['type'] ) {
    132             $output = strtotime( $new_instance[ $key ] );
    133         }
    134         else {
    135                     $output = sanitize_text_field( $new_instance[ $key ] );
     119
     120                switch ( $setting[ 'type' ] ) {
     121                    case 'text':       
     122                        $output = sanitize_text_field( $new_instance[ $key ] );
     123                        break;
     124                    case 'number':
     125                        $output = sanitize_text_field( $new_instance[ $key ] );
     126                        break;
     127                    case 'select':
     128                        $output = sanitize_text_field( $new_instance[ $key ] );
     129                        break;
     130                    case 'multiselect':
     131                        $output = array_map( 'sanitize_text_field', (array) $new_instance[ $key ] );
     132                        break;
     133                    case 'checkbox':
     134                        if( isset( $new_instance[ $key ] ) ) {
     135                            $output = $new_instance[ $key ];
     136                        }else{
     137                            $output = 0;
     138                        }
     139                        break;
     140                    case 'textarea':
     141                        if ( current_user_can('unfiltered_html') ) {
     142                            $output =  $new_instance[ $key ];
     143                        } else {
     144                            $output = stripslashes( wp_filter_post_kses( addslashes($new_instance[ $key ]) ) ); // wp_filter_post_kses() expects slashed
     145                        }               
     146                        break;
     147                    case 'upload':
     148                        $output = sanitize_text_field( $new_instance[ $key ] );                 
     149                        break;
     150                    case 'repeater':       
     151                        $output = kopa_form_field_repeater_sanitize( $new_instance[ $key ], $setting );         
     152                        break;
     153                    case 'repeater_link':
     154                        $output = kopa_form_field_repeater_link_sanitize( $new_instance[ $key ], $setting );           
     155                        break;
     156                    case 'chosen':
     157                        $output = kopa_sanitize_option_chosen_sanitize( $new_instance[ $key ], $setting );                 
     158                        break;
     159                    case 'chosen_singular':         
     160                        $output = kopa_sanitize_option_chosen_sanitize( $new_instance[ $key ], $setting );     
     161                        break;
     162                    case 'datetime':
     163                        $output = strtotime( $new_instance[ $key ] );
     164                        break;             
     165                    case 'gallery':
     166                        $output = sanitize_text_field( $new_instance[ $key ] );
     167                        break;             
     168                    case 'icon':
     169                        $output = sanitize_text_field( $new_instance[ $key ] );
     170                        break;             
     171                    case 'taxonomy':
     172                        $output = sanitize_text_field( $new_instance[ $key ] );
     173                        break;             
     174                    case 'caption':
     175                        $output = sanitize_text_field( $new_instance[ $key ] );
     176                        break;             
     177                    case 'singular':
     178                        $output = sanitize_text_field( $new_instance[ $key ] );
     179                        break;
     180                    default:
     181                        $output = apply_filters( 'kopa_sanitize_option_' . $setting[ 'type' ], $new_instance[ $key ], $settings );                     
     182                        break;
    136183                }
    137             } elseif ( 'checkbox' === $setting['type'] ) {
    138                 $output = 0;
    139             } elseif ( 'multiselect' === $setting['type'] ) {
    140                 $output = array();
     184               
    141185            }
    142186
    143187            $instance[ $key ] = $output;
     188
    144189        }
    145 
    146190
    147191        $this->flush_widget_cache();
     
    161205     */
    162206    function form( $instance ) {
    163         printf( '<div class="%s">', $this->control_options['id_base'] );
     207
     208    printf( '<div class="%s">', $this->control_options['id_base'] );
    164209        if ( ! $this->settings )
    165210            return;
    166211
    167212        $wrap_start = apply_filters('kopa_set_widget_form_wrap_start','<div class="kopa-widget-block">');
    168         $wrap_end = apply_filters('kopa_set_widget_form_wrap_end', '</div>');
     213        $wrap_end   = apply_filters('kopa_set_widget_form_wrap_end', '</div>');
    169214
    170215        foreach ( $this->settings as $key => $setting ) {
    171 
    172             // sanitize setting arguments
     216           
    173217            $setting = wp_parse_args( $setting,
    174                 apply_filters('kopa_widget_form_parse_args', array(
    175                 // common
    176                 'type'            => '',
    177                 'std'             => '',
    178                 'label'           => '',
    179                 'desc'            => '',
    180                 // number
    181                 'step'            => '',
    182                 'min'             => '',
    183                 'max'             => '',
    184                 // select
    185                 'options'         => '',
    186                 'size'            => '',
    187                 // textarea
    188                 'rows'            => '',
    189                 // upload
    190                 'mimes'           => '',
    191                 'css'             => '',
    192                 // datetime
    193                 'format'          => 'Y/m/d H:i',
    194                 'datepicker'      => true,
    195                 'timepicker'      => true,
    196                 // taxonomy
    197                 'taxonomy'        => '',
    198                 // singular
    199                 'post_type'       => ''             
     218                apply_filters( 'kopa_widget_form_parse_args', array(
     219                'type'       => '',
     220                'std'        => '',
     221                'label'      => '',
     222                'desc'       => '',
     223                'step'       => '',
     224                'min'        => '',
     225                'max'        => '',
     226                'options'    => '',
     227                'size'       => '',
     228                'rows'       => '',
     229                'mimes'      => '',
     230                'css'        => '',
     231                'format'     => 'Y/m/d H:i',
     232                'datepicker' => true,
     233                'timepicker' => true,
     234                'taxonomy'   => '',
     235                'post_type'  => ''             
    200236                )));
    201237
    202             $value   = isset( $instance[ $key ] ) ? $instance[ $key ] : $setting['std'];
    203 
    204             $setting['id'] =  $this->get_field_id( $key );
     238            $value           = isset( $instance[ $key ] ) ? $instance[ $key ] : $setting['std'];           
     239            $setting['id']   =  $this->get_field_id( $key );
    205240            $setting['name'] =  $this->get_field_name( $key );
     241            $setting['desc'] =  !empty($setting['desc']) ? '<small class="kopa-widget-desc">'. $setting['desc'] .'</small>' : false;
    206242
    207243            ob_start();
    208244
    209             $setting['desc'] =  !empty($setting['desc']) ? '<small class="kopa-widget-desc">'. $setting['desc'] .'</small>' : false;
    210 
    211             switch ( $setting['type'] ) {
    212                 case "text" :
     245            switch ( $setting[ 'type' ] ) {
     246                case 'repeater_link':
     247                    $setting['id'] = $this->get_field_name( $key );
     248                    ?>
     249                    <p>
     250                        <label for="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>"><?php echo esc_html( $setting['label'] ); ?></label>
     251                        <?php echo kopa_form_field_repeater_link( '', '', $setting, $value ); ?>
     252                        <?php echo wp_kses_post($setting['desc']); ?>
     253                    </p>
     254                    <?php
     255                    break;
     256                case 'repeater':
     257                    $setting['id'] = $this->get_field_name( $key );
     258                    ?>
     259                    <p>
     260                        <label for="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>"><?php echo esc_html( $setting['label'] ); ?></label>
     261                        <?php echo kopa_form_field_repeater( '', '', $setting, $value ); ?>
     262                        <?php echo wp_kses_post($setting['desc']); ?>
     263                    </p>
     264                    <?php
     265                    break;
     266                case 'chosen':
     267                    $setting['id'] = $this->get_field_name( $key );
     268                    ?>
     269                    <p>
     270                        <label for="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>"><?php echo esc_html( $setting['label'] ); ?></label>
     271                        <?php echo kopa_form_field_chosen( '', '', $setting, $value ); ?>
     272                        <?php echo wp_kses_post($setting['desc']); ?>
     273                    </p>
     274                    <?php
     275                    break;
     276                case 'chosen_singular':
     277                    $setting['id'] = $this->get_field_name( $key );
     278                    ?>
     279                    <p>
     280                        <label for="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>"><?php echo esc_html( $setting['label'] ); ?></label>
     281                        <?php echo kopa_form_field_chosen_singular( '', '', $setting, $value ); ?>
     282                        <?php echo wp_kses_post($setting['desc']); ?>
     283                    </p>
     284                    <?php               
     285                    break;
     286                case 'text' :
    213287                    ?>
    214288                    <p>
     
    219293                    <?php
    220294                    break;
    221                 case "number" :
     295                case 'number' :
    222296                    ?>
    223297                    <p>
     
    228302                    <?php
    229303                    break;
    230                 case "select" :
     304                case 'select' :
    231305                    ?>
    232306                    <p>
     
    241315                    <?php
    242316                    break;
    243                 case "multiselect" :
     317                case 'multiselect' :
    244318                    ?>
    245319                    <p>
     
    254328                    <?php
    255329                    break;
    256                 case "checkbox" :
     330                case 'checkbox' :
    257331                    ?>
    258332                    <p>
     
    263337                    <?php
    264338                    break;
    265                 case "textarea" :
     339                case 'textarea' :
    266340                    ?>
    267341                    <p>
     
    272346                    <?php
    273347                    break;
    274                 case "upload" :
     348                case 'upload' :
    275349                    if ( empty( $setting['css'] ) ) {
    276350                        $setting['css'] = 'width: 88%';
     
    310384                    <?php
    311385                    break;
    312 
    313                 case "datetime":
    314                     $date_value_time = '';
    315                     if ( isset($setting['format']) && ! empty($value) ) {
    316                         $date_value_time = date($setting['format'],$value);
    317                     }
    318                     ?>
    319                     <p>
    320                         <label for="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>"><?php echo esc_html( $setting['label'] ); ?></label>
    321                         <input
    322                             class="widefat kopa-framework-datetime"
    323                             type="text"
    324                             name="<?php echo esc_attr( $this->get_field_name( $key ) ); ?>"
    325                             id="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>"
    326                             value="<?php echo esc_attr($date_value_time);?>"
    327                             data-timepicker="<?php echo esc_attr($setting['timepicker']); ?>"
    328                             data-datepicker="<?php echo esc_attr($setting['datepicker']); ?>"
    329                             data-format="<?php echo wp_kses_post($setting['format']); ?>"
    330                             autocomplete="off">
    331                         <?php echo wp_kses_post($setting['desc']); ?>
    332                     </p>
    333                     <?php break;
    334 
    335                 case 'gallery': ?>
    336                     <div class="kopa-framework-gallery-box">
    337                         <label for="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>"><?php echo esc_html( $setting['label'] ); ?></label><br/>
    338                         <input
    339                             class="widefat kopa-framework-gallery"
    340                             type="text"
    341                             name="<?php echo esc_attr( $this->get_field_name( $key ) ); ?>"
    342                             id="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>"
    343                             value="<?php echo esc_attr($value);?>"
    344                             autocomplete="off">
    345                         <?php echo wp_kses_post($setting['desc']); ?>
    346                         <a href="#" class="kopa-framework-gallery-config button button-secondary">
    347                             <?php echo esc_html__('Config', 'kopa-framework'); ?>
    348                         </a>
    349                     </div>
    350                     <?php
    351                     break;
    352 
    353                 case 'icon': ?>
    354                     <p>
    355                         <label for="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>"><?php echo esc_html( $setting['label'] ); ?></label>
    356                         <div class="kopa-icon-picker-wrap clearfix">                           
    357                             <input type="hidden"
    358                                    name="<?php echo esc_attr( $this->get_field_name( $key ) ); ?>"
    359                                    id="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>"
    360                                    value="<?php echo esc_attr($value);?>"
    361                                    autocomplete="off"
    362                                    class="widefat kopa-icon-picker-value"/>
    363                             <span class="kopa-icon-picker-preview"><i class="<?php echo esc_attr($value);?>"></i></span>
    364                             <a class="kopa-icon-picker dashicons dashicons-arrow-down" href="#"></a>
    365                           </div>
    366                     </p>
    367                     <?php
    368                     break;
    369                 case 'taxonomy':
    370                     $setting['options'] = array( '' => esc_html__( '-- Select --', 'kopa-framework' ) );
    371 
    372                     if ( isset( $setting['taxonomy'] ) && !empty( $setting['taxonomy'] ) ) {
    373                                         $taxonomy = esc_html( $setting['taxonomy'] );
    374                                         $terms    = get_terms( $taxonomy );
    375                                         if( $terms ){
    376                                             foreach( $terms as $term ){
    377                                                 $setting['options'][$term->term_id] = $term->name;
    378                                             }
    379                                         }
    380                                     }                                   
    381                    
     386        case 'datetime':
     387          $date_value_time = '';
     388          if ( isset($setting['format']) && ! empty($value) ) {
     389              $date_value_time = date($setting['format'],$value);
     390          }
     391            ?>
     392          <p>
     393              <label for="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>"><?php echo esc_html( $setting['label'] ); ?></label>
     394              <input
     395                  class="widefat kopa-framework-datetime"
     396                  type="text"
     397                  name="<?php echo esc_attr( $this->get_field_name( $key ) ); ?>"
     398                  id="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>"
     399                  value="<?php echo esc_attr($date_value_time);?>"
     400                  data-timepicker="<?php echo esc_attr($setting['timepicker']); ?>"
     401                  data-datepicker="<?php echo esc_attr($setting['datepicker']); ?>"
     402                  data-format="<?php echo wp_kses_post($setting['format']); ?>"
     403                  autocomplete="off">
     404              <?php echo wp_kses_post($setting['desc']); ?>
     405          </p>
     406          <?php
     407            break;
     408        case 'gallery': ?>
     409          <div class="kopa-framework-gallery-box">
     410              <label for="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>"><?php echo esc_html( $setting['label'] ); ?></label><br/>
     411              <input
     412                  class="widefat kopa-framework-gallery"
     413                  type="text"
     414                  name="<?php echo esc_attr( $this->get_field_name( $key ) ); ?>"
     415                  id="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>"
     416                  value="<?php echo esc_attr($value);?>"
     417                  autocomplete="off">
     418              <?php echo wp_kses_post($setting['desc']); ?>
     419              <a href="#" class="kopa-framework-gallery-config button button-secondary">
     420                  <?php echo esc_html__('Config', 'kopa-framework'); ?>
     421              </a>
     422          </div>
     423          <?php
     424          break;
     425        case 'icon': ?>
     426            <p>
     427                <label for="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>"><?php echo esc_html( $setting['label'] ); ?></label>
     428                <div class="kopa-icon-picker-wrap clearfix">                           
     429                  <input type="hidden"
     430                         name="<?php echo esc_attr( $this->get_field_name( $key ) ); ?>"
     431                         id="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>"
     432                         value="<?php echo esc_attr($value);?>"
     433                         autocomplete="off"
     434                         class="widefat kopa-icon-picker-value"/>
     435                  <span class="kopa-icon-picker-preview"><i class="<?php echo esc_attr($value);?>"></i></span>
     436                  <a class="kopa-icon-picker dashicons dashicons-arrow-down" href="#"></a>
     437                </div>
     438            </p>
     439            <?php
     440            break;
     441        case 'taxonomy':
     442            $setting['options'] = array( '' => esc_html__( '-- Select --', 'kopa-framework' ) );
     443            if ( isset( $setting['taxonomy'] ) && !empty( $setting['taxonomy'] ) ) {
     444                        $taxonomy = esc_html( $setting['taxonomy'] );
     445                        $terms    = get_terms( $taxonomy );
     446                        if( $terms ){
     447                            foreach( $terms as $term ){
     448                                $setting['options'][$term->term_id] = $term->name;
     449                            }
     450                        }
     451                    }                                                 
    382452                    ?>
    383453                    <p>
     
    391461                    </p>                   
    392462                    <?php
    393 
    394                     break;
    395 
    396                 case 'caption':
    397                     ?>
    398                     <div>
    399                         <p class="kopa_ui_caption"><?php echo esc_html( $setting['label'] ); ?></p>
    400                         <?php echo wp_kses_post($setting['desc']); ?>
    401                     </div>
    402                     <?php
    403                     break;
    404                 case 'singular':
    405                     $post_type = ( isset( $setting['post_type'] ) && !empty( $setting['post_type'] ) ) ? esc_html( $setting['post_type'] ) : 'page';                             
    406                     ?>
     463            break;
     464        case 'caption':
     465            ?>
     466            <div>
     467                <p class="kopa_ui_caption"><?php echo esc_html( $setting['label'] ); ?></p>
     468                <?php echo wp_kses_post($setting['desc']); ?>
     469            </div>
     470            <?php
     471            break;
     472        case 'singular':
     473            $post_type = ( isset( $setting['post_type'] ) && !empty( $setting['post_type'] ) ) ? esc_html( $setting['post_type'] ) : 'page';                             
     474          ?>
    407475                    <p>
    408476                        <label for="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>"><?php echo esc_html( $setting['label'] ); ?></label>
     
    452520                        <?php endif; ?>
    453521                    </p>                   
    454                     <?php
    455                     break;
     522        <?php
     523        break;
    456524            }
    457525
     
    461529        }
    462530
    463         print('</div>');
     531    echo '</div>';
    464532    }
    465533
     
    482550        return $default;
    483551    }
     552
    484553}
  • kopatheme/trunk/includes/admin/class-kopa-admin-assets.php

    r1486248 r1490791  
    1313if ( ! class_exists( 'Kopa_Admin_Assets' ) ) {
    1414
    15     /**
    16      * Kopa_Admin_Assets Class
    17      */
    1815    class Kopa_Admin_Assets {
    1916
    20         /**
    21          * Hook in tabs.
    22          *
    23          * @since 1.0.0
    24          * @access public
    25          */
    2617        public function __construct() {
    27             add_action( 'admin_enqueue_scripts', array( $this, 'admin_styles' ) );
    28             add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
    29         }
    30 
    31         /**
    32          * Enqueue styles
    33          *
    34          * @since 1.0.0
    35          * @access public
    36          */
     18            $is_load_compiled_assets = apply_filters( 'kopa_is_load_compiled_assets', false );
     19
     20            if( $is_load_compiled_assets ) {
     21                add_action( 'admin_enqueue_scripts', array( $this, 'load_compiled_assets' ) );             
     22            }else{
     23                add_action( 'admin_enqueue_scripts', array( $this, 'admin_styles' ) );
     24                add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
     25            }
     26        }
     27
     28        public function is_compiled( $hook ) {
     29            $screen           = get_current_screen();
     30            $is_theme_options =  in_array( $screen->id, kopa_get_screen_ids() );
     31            $is_other_pages   = in_array( $hook, array( 'widgets.php', 'post.php', 'post-new.php', 'edit-tags.php','term.php', 'edit.php' ) );
     32
     33            return $is_other_pages || $is_theme_options;   
     34        }
     35
     36        public function load_compiled_assets( $hook ) {
     37
     38            if ( $this->is_compiled( $hook ) ) {           
     39                wp_enqueue_media();                                     
     40                wp_enqueue_style( 'wp-color-picker' );
     41                wp_enqueue_style( 'kopatheme', KF()->framework_url() . '/assets/compiled/kopatheme.min.css', array(), KOPA_FRAMEWORK_VERSION ); 
     42
     43                wp_enqueue_script( 'wp-color-picker' );
     44                wp_enqueue_script( 'jquery-ui-core' );
     45                wp_enqueue_script( 'jquery-ui-dialog' );
     46                wp_enqueue_script( 'jquery-ui-position' );
     47                wp_enqueue_script( 'jquery-ui-droppable' );
     48                wp_enqueue_script( 'jquery-ui-draggable' );
     49                wp_enqueue_script( 'kopatheme', KF()->framework_url() . '/assets/compiled/kopatheme.min.js', array( 'jquery' ), KOPA_FRAMEWORK_VERSION );
     50
     51                wp_localize_script( 'kopatheme', 'kopa_google_fonts', kopa_google_font_property_list_array() );
     52                wp_localize_script( 'kopatheme', 'kopa_google_font_families', kopa_google_font_list() );
     53                wp_localize_script( 'kopatheme', 'kopa_system_fonts', kopa_system_font_list() );
     54                wp_localize_script( 'kopatheme', 'kopa_font_styles', kopa_font_style_options() );
     55                wp_localize_script( 'kopatheme', 'kopa_custom_font_attributes', $this->get_i18n_fonts() );
     56                wp_localize_script( 'kopatheme', 'kopa_admin_l10n', $this->get_i18n_admin() );             
     57                wp_localize_script( 'kopatheme', 'kopa_sidebar_attributes_l10n', $this->get_i18n_sidebar() );
     58        wp_localize_script( 'kopatheme', 'kopa_upload_l10n', $this->get_i18n_uploader() );
     59        wp_localize_script( 'kopatheme', 'kopa_advanced_field', $this->get_i18n_fields() );         
     60            }
     61
     62            do_action( 'kopa_admin_css', $hook );           
     63        }
     64
    3765        public function admin_styles($hook) {
    3866            global $wp_scripts;
    3967
    40             $screen = get_current_screen();
    41 
    42             // Admin styles for admins pages only
     68            $screen = get_current_screen( );
     69
    4370            wp_register_style( 'kopa_admin', KF()->framework_url() . '/assets/css/admin.css', array(), KOPA_FRAMEWORK_VERSION );
    44 
    45             // font awesome
    46             wp_register_style( 'kopa_font_awesome', KF()->framework_url() . '/assets/css/font-awesome.css', array(), '4.0.3' );
    47 
    48             // style for custom layout feature
     71            wp_register_style( 'kopa_font_awesome', KF()->framework_url() . '/assets/css/font-awesome.css', array(), KOPA_FRAMEWORK_VERSION );
     72            wp_register_style( 'font-themify', KF()->framework_url() . '/assets/css/font-themify.css', array(), KOPA_FRAMEWORK_VERSION );
    4973            wp_register_style( 'kopa_custom_layout', KF()->framework_url() . '/assets/css/custom-layout.css', array(), KOPA_FRAMEWORK_VERSION );
    50 
    51             // Widget form styles
    5274            wp_register_style( 'kopa_widget', KF()->framework_url() . '/assets/css/widget.css', array(), KOPA_FRAMEWORK_VERSION );
    5375
    54         // Advanced field
    55         $advanced_field = apply_filters('kopa_admin_metabox_advanced_field', false);
    56         if ( $advanced_field ) {
    57           wp_register_style( 'kopa_datetimepicker', KF()->framework_url() . '/assets/css/jquery.datetimepicker.css', array(), KOPA_FRAMEWORK_VERSION );
     76        if ( $this->is_use_advanced_fields() ) {
     77          wp_register_style( 'jquery-datetimepicker', KF()->framework_url() . '/assets/css/jquery.datetimepicker.css', array(), KOPA_FRAMEWORK_VERSION );
     78          wp_register_style( 'jquery-chosen', KF()->framework_url() . '/assets/css/jquery.chosen.css', array(), KOPA_FRAMEWORK_VERSION );         
    5879        }
    5980       
    60             /**
    61              * @since 1.1.9
    62              * @add `appearance_page_kopa-framework` to check in_array()
    63              *
    64              * @since 1.2.0
    65              * @add `edit-tags.php`, `term.php` to check in_array()
    66              */
    67            
    68             if ( in_array( $hook, array( 'widgets.php', 'post.php', 'post-new.php', 'appearance_page_kopa-framework', 'edit-tags.php','term.php' ) ) ) {
    69                 wp_enqueue_style( 'kopa_widget' );
    70           if ( $advanced_field ) {
    71               wp_enqueue_style( 'kopa_datetimepicker' );
    72               wp_enqueue_style( 'kopa_font_awesome' );
    73               wp_enqueue_style( 'kopa_jquery_ui' );
    74               wp_enqueue_style( 'kopa_jquery_ui_structure' );
    75               wp_enqueue_style( 'kopa_jquery_ui_theme' );
    76 
    77               wp_enqueue_script( 'jquery-ui-core' );
    78               wp_enqueue_script( 'jquery-ui-dialog' );
    79               wp_enqueue_script( 'jquery-ui-position' );
    80               wp_enqueue_script( 'jquery-ui-droppable' );
    81               wp_enqueue_script( 'jquery-ui-draggable' );
     81            if ( in_array( $hook, array( 'widgets.php', 'post.php', 'post-new.php', 'appearance_page_kopa-framework', 'edit-tags.php','term.php', 'edit.php' ) ) ) {
     82
     83                wp_enqueue_media();
     84                wp_enqueue_style( 'kopa_widget' );                             
     85                wp_enqueue_style( 'wp-color-picker' );
     86
     87          if ( $this->is_use_advanced_fields() ) {
     88          wp_enqueue_style( 'jquery-datetimepicker' );
     89          wp_enqueue_style( 'jquery-chosen' );           
     90          wp_enqueue_style( 'kopa_font_awesome' );
     91          wp_enqueue_style( 'font-themify' );                   
    8292          }
    8393            }
    8494
    85             // check admin pages to enqueue styles
    86             if ( in_array( $screen->id, kopa_get_screen_ids() ) ) {         
    87                 wp_enqueue_style( 'kopa_font_awesome' );
    88                 wp_enqueue_style( 'kopa_admin' );
    89                 wp_enqueue_style( 'wp-color-picker' );
    90                 wp_enqueue_style( 'thickbox' );
    91             }
     95            if ( in_array( $screen->id, kopa_get_screen_ids() ) ) { wp_enqueue_style( 'kopa_admin' ); }
    9296
    9397            do_action( 'kopa_admin_css' );
    94         }
    95 
    96 
    97         /**
    98          * Enqueue scripts
    99          *
    100          * @since 1.0.0
    101          * @access public
    102          */
     98        }       
     99
    103100        public function admin_scripts() {
    104101            global $wp_query, $post;
     
    109106            wp_enqueue_media();
    110107           
    111             // Register scripts
    112             wp_register_script( 'kopa_admin', KF()->framework_url() . '/assets/js/admin'.$suffix.'.js', array( 'jquery', 'wp-color-picker', 'jquery-ui-sortable', 'kopa_media_uploader' ), KOPA_FRAMEWORK_VERSION );
    113 
    114             wp_register_script( 'kopa_dynamic_sidebar', KF()->framework_url() .'/assets/js/admin-sidebar'.$suffix.'.js', array( 'jquery', 'jquery-ui-sortable', 'thickbox' ), KOPA_FRAMEWORK_VERSION );
    115 
    116             wp_register_script( 'kopa_dynamic_layout', KF()->framework_url() .'/assets/js/admin-layout'.$suffix.'.js', array( 'jquery' ), KOPA_FRAMEWORK_VERSION );
    117 
    118             // script for custom layout feature
    119             wp_register_script( 'kopa_custom_layout', KF()->framework_url() . '/assets/js/custom-layout'.$suffix.'.js', array( 'jquery' ), KOPA_FRAMEWORK_VERSION );
    120 
    121             wp_register_script( 'kopa_custom_fields', KF()->framework_url() . '/assets/js/admin-fields'.$suffix.'.js', array( 'jquery' ), KOPA_FRAMEWORK_VERSION );
    122 
    123             wp_register_script( 'kopa_media_uploader', KF()->framework_url() . '/assets/js/media-uploader'.$suffix.'.js', array( 'jquery' ), KOPA_FRAMEWORK_VERSION );
    124 
    125         // script for advanced fields
    126         $advanced_field = apply_filters('kopa_admin_metabox_advanced_field', false);
    127         if ( $advanced_field ) {
    128             wp_register_script( 'kopa_datetimepicker', KF()->framework_url() . '/assets/js/jquery.datetimepicker'.$suffix.'.js', array( 'jquery' ), KOPA_FRAMEWORK_VERSION );
     108            wp_register_script( 'kopa_admin', KF()->framework_url() . '/assets/js/admin'.$suffix.'.js', array( 'jquery', 'wp-color-picker', 'jquery-ui-sortable', 'kopa_media_uploader' ), NULL );
     109            wp_register_script( 'kopa_dynamic_sidebar', KF()->framework_url() .'/assets/js/admin-sidebar'.$suffix.'.js', array( 'jquery', 'jquery-ui-sortable', 'thickbox' ), NULL );
     110            wp_register_script( 'kopa_dynamic_layout', KF()->framework_url() .'/assets/js/admin-layout'.$suffix.'.js', array( 'jquery' ), NULL );
     111            wp_register_script( 'kopa_custom_layout', KF()->framework_url() . '/assets/js/custom-layout'.$suffix.'.js', array( 'jquery' ), NULL );
     112            wp_register_script( 'kopa_custom_fields', KF()->framework_url() . '/assets/js/admin-fields'.$suffix.'.js', array( 'jquery' ), NULL );
     113            wp_register_script( 'kopa_media_uploader', KF()->framework_url() . '/assets/js/media-uploader'.$suffix.'.js', array( 'jquery' ), NULL );
     114
     115        if ( $this->is_use_advanced_fields() ) {
     116        wp_register_script( 'jquery-datetimepicker', KF()->framework_url() . '/assets/js/jquery.datetimepicker'.$suffix.'.js', array( 'jquery' ), NULL );
     117        wp_register_script( 'jquery-chosen', KF()->framework_url() . '/assets/js/jquery-chosen'.$suffix.'.js', array( 'jquery' ), NULL );
     118        wp_register_script( 'jquery-repeatable', KF()->framework_url() . '/assets/js/jquery-repeatable'.$suffix.'.js', array( 'jquery' ), NULL );
    129119        }
    130120
    131 
    132 
    133             // KopaFramework admin pages
    134121            if ( in_array( $screen->id, kopa_get_screen_ids() ) ) {
    135 
    136122                wp_enqueue_script( 'kopa_admin' );
     123                wp_enqueue_script( 'kopa_dynamic_sidebar' );
     124                wp_enqueue_script( 'kopa_dynamic_layout' );
     125
    137126                wp_localize_script( 'kopa_admin', 'kopa_google_fonts', kopa_google_font_property_list_array() );
    138127                wp_localize_script( 'kopa_admin', 'kopa_google_font_families', kopa_google_font_list() );
    139128                wp_localize_script( 'kopa_admin', 'kopa_system_fonts', kopa_system_font_list() );
    140129                wp_localize_script( 'kopa_admin', 'kopa_font_styles', kopa_font_style_options() );
    141                 wp_localize_script( 'kopa_admin', 'kopa_custom_font_attributes', array(
    142                     'name' => array(
    143                         'type'        => 'text',
    144                         'placeholder' => __( 'Enter font name', 'kopa-framework' ),
    145                         'required'    => false,
    146                         'value'       => __( 'Custom font', 'kopa-framework' ),
    147                         ),
    148                     'woff' => array(
    149                         'type'        => 'upload',
    150                         'placeholder' => __( 'Upload .woff font file', 'kopa-framework' ),
    151                         'mimes'       => 'font/woff',
    152                         ),
    153                     'ttf' => array(
    154                         'type'        => 'upload',
    155                         'placeholder' => __( 'Upload .ttf font file', 'kopa-framework' ),
    156                         'mimes'       => 'font/truetype',
    157                         ),
    158                     'eot' => array(
    159                         'type'        => 'upload',
    160                         'placeholder' => __( 'Upload .eot font file', 'kopa-framework' ),
    161                         'mimes'       => 'font/eot',
    162                         ),
    163                     'svg' => array(
    164                         'type'        => 'upload',
    165                         'placeholder' => __( 'Upload .svg font file', 'kopa-framework' ),
    166                         'mimes'       => 'font/svg',
    167                         ),
    168                     ) );
    169                 wp_localize_script( 'kopa_admin', 'kopa_admin_l10n', array(
    170                     'upload' => __( 'Upload', 'kopa-framework' ),
    171                     'remove' => __( 'Remove', 'kopa-framework' ),
    172                     'confirm_reset'   => __( 'Click OK to reset. Any selected settings will be lost!', 'kopa-framework' ),
    173                     'confirm_import'  => __( 'Click OK to import. Any selected settings will be lost!', 'kopa-framework' ),
    174                     'confirm_delete'  => __( 'Are you sure you want to delete?', 'kopa-framework' ))
    175                 );             
    176                 wp_enqueue_script( 'kopa_dynamic_sidebar' );
    177                 wp_localize_script( 'kopa_dynamic_sidebar', 'kopa_sidebar_attributes_l10n', array(
    178                     'ajax_url'          => admin_url('admin-ajax.php'),
    179                     'warning'           => __( 'Warning', 'kopa-framework' ),
    180                     'error'             => __( 'Error', 'kopa-framework' ),
    181                     'info'              => __( 'Info', 'kopa-framework' ),
    182                     'confirm_message'   => __( 'Are you sure you want to delete?', 'kopa-framework' ),
    183                     'close'             => __( 'Close', 'kopa-framework' ),
    184                     'remove'            => __( 'Delete', 'kopa-framework' ),
    185                     'advanced_settings' => __( 'Advanced Settings', 'kopa-framework' ),
    186                     'attributes'        => array(
    187                         'name'          => __( 'Name', 'kopa-framework' ),
    188                         'description'   => __( 'Description', 'kopa-framework' ),
    189                         'before_widget' => __( 'Before Widget', 'kopa-framework' ),
    190                         'after_widget'  => __( 'After Widget', 'kopa-framework' ),
    191                         'before_title'  => __( 'Before Title', 'kopa-framework' ),
    192                         'after_title'   => __( 'After Title', 'kopa-framework' ),
    193                         ),
    194                     ) );
    195         wp_enqueue_script( 'kopa_dynamic_layout' );
     130                wp_localize_script( 'kopa_admin', 'kopa_custom_font_attributes', $this->get_i18n_fonts() );
     131                wp_localize_script( 'kopa_admin', 'kopa_admin_l10n', $this->get_i18n_admin() );             
     132                wp_localize_script( 'kopa_dynamic_sidebar', 'kopa_sidebar_attributes_l10n', $this->get_i18n_sidebar() );       
    196133      }
    197134
    198             // script for widget upload fields
    199135            wp_enqueue_media();
    200             wp_enqueue_script( 'kopa_media_uploader' );
    201             wp_enqueue_script( 'kopa_custom_fields' );
    202 
    203             wp_localize_script( 'kopa_media_uploader', 'kopa_upload_l10n', array(
     136            wp_enqueue_script( 'kopa_media_uploader' );         
     137            wp_localize_script( 'kopa_media_uploader', 'kopa_upload_l10n', $this->get_i18n_uploader() );
     138
     139            if ( $this->is_use_advanced_fields() ) {
     140                wp_enqueue_script( 'jquery-ui-core' );
     141                wp_enqueue_script( 'jquery-ui-dialog' );
     142                wp_enqueue_script( 'jquery-ui-position' );
     143                wp_enqueue_script( 'jquery-ui-droppable' );
     144                wp_enqueue_script( 'jquery-ui-draggable' );
     145                wp_enqueue_script( 'kopa_custom_fields' );
     146                wp_enqueue_script( 'jquery-datetimepicker' );     
     147                wp_enqueue_script( 'jquery-chosen' );     
     148                wp_enqueue_script( 'jquery-repeatable' );                   
     149                wp_localize_script( 'kopa_custom_fields', 'kopa_advanced_field', $this->get_i18n_fields() );               
     150            }
     151        }
     152
     153        public function is_use_advanced_fields() {
     154            return apply_filters( 'kopa_admin_metabox_advanced_field', false );
     155        }
     156
     157        public function get_i18n_fonts() {
     158            return array(
     159                'name' => array(
     160                    'type'        => 'text',
     161                    'placeholder' => esc_html__( 'Enter font name', 'kopa-framework' ),
     162                    'required'    => false,
     163                    'value'       => esc_html__( 'Custom font', 'kopa-framework' ),
     164                    ),
     165                'woff' => array(
     166                    'type'        => 'upload',
     167                    'placeholder' => esc_html__( 'Upload .woff font file', 'kopa-framework' ),
     168                    'mimes'       => 'font/woff',
     169                    ),
     170                'ttf' => array(
     171                    'type'        => 'upload',
     172                    'placeholder' => esc_html__( 'Upload .ttf font file', 'kopa-framework' ),
     173                    'mimes'       => 'font/truetype',
     174                    ),
     175                'eot' => array(
     176                    'type'        => 'upload',
     177                    'placeholder' => esc_html__( 'Upload .eot font file', 'kopa-framework' ),
     178                    'mimes'       => 'font/eot',
     179                    ),
     180                'svg' => array(
     181                    'type'        => 'upload',
     182                    'placeholder' => esc_html__( 'Upload .svg font file', 'kopa-framework' ),
     183                    'mimes'       => 'font/svg',
     184                    ),
     185            );
     186        }
     187
     188        public function get_i18n_admin() {
     189            return array(
     190            'upload' => esc_html__( 'Upload', 'kopa-framework' ),
     191            'remove' => esc_html__( 'Remove', 'kopa-framework' ),
     192            'confirm_reset'   => esc_html__( 'Click OK to reset. Any selected settings will be lost!', 'kopa-framework' ),
     193            'confirm_import'  => esc_html__( 'Click OK to import. Any selected settings will be lost!', 'kopa-framework' ),
     194            'confirm_delete'  => esc_html__( 'Are you sure you want to delete?', 'kopa-framework' )
     195            );
     196        }
     197
     198        public function get_i18n_sidebar() {
     199            return array(
     200                'ajax_url'          => admin_url('admin-ajax.php'),
     201                'warning'           => esc_html__( 'Warning', 'kopa-framework' ),
     202                'error'             => esc_html__( 'Error', 'kopa-framework' ),
     203                'info'              => esc_html__( 'Info', 'kopa-framework' ),
     204                'confirm_message'   => esc_html__( 'Are you sure you want to delete?', 'kopa-framework' ),
     205                'close'             => esc_html__( 'Close', 'kopa-framework' ),
     206                'remove'            => esc_html__( 'Delete', 'kopa-framework' ),
     207                'advanced_settings' => esc_html__( 'Advanced Settings', 'kopa-framework' ),
     208                'attributes'        => array(
     209                    'name'          => esc_html__( 'Name', 'kopa-framework' ),
     210                    'description'   => esc_html__( 'Description', 'kopa-framework' ),
     211                    'before_widget' => esc_html__( 'Before Widget', 'kopa-framework' ),
     212                    'after_widget'  => esc_html__( 'After Widget', 'kopa-framework' ),
     213                    'before_title'  => esc_html__( 'Before Title', 'kopa-framework' ),
     214                    'after_title'   => esc_html__( 'After Title', 'kopa-framework' ),
     215                )
     216            );
     217        }
     218
     219        public function get_i18n_uploader() {
     220            return array(
    204221                'upload' => '+',
    205222                'remove' => '&ndash;',
    206                 )
    207             );
    208 
    209             if ( $advanced_field ) {
    210                 wp_enqueue_script( 'kopa_datetimepicker' );     
    211                 wp_localize_script( 'kopa_custom_fields', 'kopa_advanced_field', array(
    212                     'ajax_url' => admin_url('admin-ajax.php'),
    213                     'i18n'     => array( 'icon_picker' => esc_attr__( 'Icon Picker', 'kopa-framework' ) )
     223            );
     224        }
     225
     226        public function get_i18n_fields() {
     227            return array(
     228                'ajax_url'  => admin_url('admin-ajax.php'),                 
     229                'translate' => array(
     230                    'icon_picker' => esc_attr__( 'Icon Picker', 'kopa-framework' ),                     
     231                    'untitle'     => esc_html__( 'Untitle', 'kopa-framework' ),
     232                ),
     233                'icon' => array(
     234                    'shortcodes' => KF()->framework_url() . '/assets/images/shortcodes.png',
     235                ),
     236                'icon_picker' => array(
     237                    'label' => array(
     238                        'icon_picker' => esc_html__( 'Icon Picker', 'kopa-framework' ),
     239                        'add'         => esc_html__( 'Add', 'kopa-framework' ),
     240                        'use'         => esc_html__( 'Use', 'kopa-framework' ),
     241                        'cancel'      => esc_html__( 'Cancel', 'kopa-framework' ),
     242                        'remove'      => esc_html__( 'Remove', 'kopa-framework' ),
     243                        'edit'        => esc_html__( 'Edit', 'kopa-framework' ),
     244                    ),                 
     245                    'fonts' => array(
     246                        'awesome' => array(
     247                            'name'   => esc_html__( 'Awesome', 'kopa-framework' ),
     248                            'file'   => KF()->framework_url() . '/assets/data/font-awesome.json',
     249                            'prefix' => 'fa'
     250                        ),
     251                        'themify' => array(
     252                            'name'   => esc_html__( 'Themify', 'kopa-framework' ),
     253                            'file'   => KF()->framework_url() . '/assets/data/font-themify.json',
     254                            'prefix' => ''
     255                        )
    214256                    )
    215                 );
    216             }
    217 
     257                )
     258            );
    218259        }
    219260
  • kopatheme/trunk/includes/admin/class-kopa-admin-backup.php

    r1353276 r1490791  
    113113        // Check for errors
    114114        if ( ! $options || $_FILES['kopa_import_file']['error'] ) {
    115             Kopa_Admin_Settings::add_error( __( 'There was a problem importing your settings.', 'kopa-framework' ) );
     115            Kopa_Admin_Settings::add_error( esc_html__( 'There was a problem importing your settings.', 'kopa-framework' ) );
    116116            return false;
    117117        }
     
    119119        // Make sure this is a valid backup file.
    120120        if ( ! isset( $options['kopathemes-backup-validator'] ) ) {
    121             Kopa_Admin_Settings::add_error( __( "The import file you've provided is invalid.", 'kopa-framework' ) );
     121            Kopa_Admin_Settings::add_error( esc_html__( "The import file you've provided is invalid.", 'kopa-framework' ) );
    122122            return false;
    123123        } else {
     
    139139
    140140        if ( $has_updated ) {
    141             Kopa_Admin_Settings::add_message( __( 'Settings successfully imported.', 'kopa-framework' ) );
     141            Kopa_Admin_Settings::add_message( esc_html__( 'Settings successfully imported.', 'kopa-framework' ) );
    142142        }
    143143
  • kopatheme/trunk/includes/admin/class-kopa-admin-help.php

    r1353276 r1490791  
    4343        $screen->add_help_tab( array(
    4444            'id'    => 'kopa_framework_docs_tab',
    45             'title' => __( 'Documentation', 'kopa-framework' ),
     45            'title' => esc_html__( 'Documentation', 'kopa-framework' ),
    4646            'content'   =>
    4747
    48                 '<p>' . __( 'Thank you for using Kopa Framework. Should you need help using or extending Kopa Framework please read the documentation.', 'kopa-framework' ) . '</p>' .
     48                '<p>' . esc_html__( 'Thank you for using Kopa Framework. Should you need help using or extending Kopa Framework please read the documentation.', 'kopa-framework' ) . '</p>' .
    4949
    50                 '<p><a href="#docs" class="button button-primary">' . __( 'Kopa Framework Documentation', 'kopa-framework' ) . '</a> <a href="#api" class="button">' . __( 'Developer API Docs', 'kopa-framework' ) . '</a></p>'
     50                '<p><a href="#docs" class="button button-primary">' . esc_html__( 'Kopa Framework Documentation', 'kopa-framework' ) . '</a> <a href="#api" class="button">' . esc_html__( 'Developer API Docs', 'kopa-framework' ) . '</a></p>'
    5151
    5252        ) );
     
    5454        $screen->add_help_tab( array(
    5555            'id'    => 'kopa_framework_support_tab',
    56             'title' => __( 'Support', 'kopa-framework' ),
     56            'title' => esc_html__( 'Support', 'kopa-framework' ),
    5757            'content'   =>
    5858
    59                 '<p>' . sprintf(__( 'After <a href="%s">reading the documentation</a>, for further assistance you can use the <a href="%s">community forum</a>, or if you have access as a Kopatheme customer, <a href="%s">our support desk</a>.', 'kopa-framework' ), '#doc', '#community', '#ticket' ) . '</p>' .
     59                '<p>' . sprintf(esc_html__( 'After <a href="%s">reading the documentation</a>, for further assistance you can use the <a href="%s">community forum</a>, or if you have access as a Kopatheme customer, <a href="%s">our support desk</a>.', 'kopa-framework' ), '#doc', '#community', '#ticket' ) . '</p>' .
    6060
    61                 '<p><a href="' . '#' . '" class="button">' . __( 'Community Support', 'kopa-framework' ) . '</a> <a href="' . '#' . '" class="button">' . __( 'Customer Support', 'kopa-framework' ) . '</a></p>'
     61                '<p><a href="' . '#' . '" class="button">' . esc_html__( 'Community Support', 'kopa-framework' ) . '</a> <a href="' . '#' . '" class="button">' . esc_html__( 'Customer Support', 'kopa-framework' ) . '</a></p>'
    6262
    6363        ) );
     
    6565        $screen->add_help_tab( array(
    6666            'id'    => 'kopa_framework_bugs_tab',
    67             'title' => __( 'Found a bug?', 'kopa-framework' ),
     67            'title' => esc_html__( 'Found a bug?', 'kopa-framework' ),
    6868            'content'   =>
    6969
    70                 '<p>' . sprintf(__( 'If you find a bug within Kopa Framework core you can create a ticket via <a href="%s">Kopatheme ticket</a>. Ensure you read the <a href="%s">contribution guide</a> prior to submitting your report. Be as descriptive as possible.', 'kopa-framework' ), '#ticket', '#guide') . '</p>' .
     70                '<p>' . sprintf(esc_html__( 'If you find a bug within Kopa Framework core you can create a ticket via <a href="%s">Kopatheme ticket</a>. Ensure you read the <a href="%s">contribution guide</a> prior to submitting your report. Be as descriptive as possible.', 'kopa-framework' ), '#ticket', '#guide') . '</p>' .
    7171
    72                 '<p><a href="#report" class="button button-primary">' . __( 'Report a bug', 'kopa-framework' ) . '</a></p>'
     72                '<p><a href="#report" class="button button-primary">' . esc_html__( 'Report a bug', 'kopa-framework' ) . '</a></p>'
    7373
    7474        ) );
     
    7676
    7777        $screen->set_help_sidebar(
    78             '<p><strong>' . __( 'For more information:', 'kopa-framework' ) . '</strong></p>' .
    79             '<p><a href="#" target="_blank">' . __( 'About Kopa Framework', 'kopa-framework' ) . '</a></p>' .
    80             '<p><a href="#" target="_blank">' . __( 'Project on WordPress.org', 'kopa-framework' ) . '</a></p>' .
    81             '<p><a href="#" target="_blank">' . __( 'Official Themes', 'kopa-framework' ) . '</a></p>'
     78            '<p><strong>' . esc_html__( 'For more information:', 'kopa-framework' ) . '</strong></p>' .
     79            '<p><a href="#" target="_blank">' . esc_html__( 'About Kopa Framework', 'kopa-framework' ) . '</a></p>' .
     80            '<p><a href="#" target="_blank">' . esc_html__( 'Project on WordPress.org', 'kopa-framework' ) . '</a></p>' .
     81            '<p><a href="#" target="_blank">' . esc_html__( 'Official Themes', 'kopa-framework' ) . '</a></p>'
    8282        );
    8383    }
  • kopatheme/trunk/includes/admin/class-kopa-admin-menus.php

    r1353276 r1490791  
    4747
    4848        $menu = array(
    49             'page_title' => __( 'Theme Options', 'kopa-framework' ),
    50             'menu_title' => __( 'Theme Options', 'kopa-framework' ),
     49            'page_title' => esc_html__( 'Theme Options', 'kopa-framework' ),
     50            'menu_title' => esc_html__( 'Theme Options', 'kopa-framework' ),
    5151            'capability' => 'edit_theme_options',
    5252            'menu_slug' => 'kopa-framework'
  • kopatheme/trunk/includes/admin/class-kopa-admin-settings.php

    r1486248 r1490791  
    116116
    117117            if ( empty( $_REQUEST['_wpnonce'] ) || !wp_verify_nonce( $_REQUEST['_wpnonce'], 'kopa-settings' ) ) {
    118                 die( __( 'Action failed. Please refresh the page and retry.', 'kopa-framework' ) );
     118                die( esc_html__( 'Action failed. Please refresh the page and retry.', 'kopa-framework' ) );
    119119            }
    120120
     
    132132                    do_action( 'kopa_settings_reset_' . $kopa_current_tab );
    133133                }
    134                 self::add_message( __( 'Default options restored.', 'kopa-framework' ) );
     134                self::add_message( esc_html__( 'Default options restored.', 'kopa-framework' ) );
    135135            }
    136136            // save current tab settings
    137137            else {
    138138                do_action( 'kopa_settings_save_' . $kopa_current_tab );
    139                 self::add_message( __( 'Your settings have been saved.', 'kopa-framework' ) );
     139                self::add_message( esc_html__( 'Your settings have been saved.', 'kopa-framework' ) );
    140140            }
    141141
     
    359359            // Sanitize fields
    360360            $allowed_tags = array(
    361                 'abbr' => array( 'title' => true ),
     361                'abbr'    => array( 'title' => true ),
    362362                'acronym' => array( 'title' => true ),
    363                 'code' => true,
    364                 'em' => true,
    365                 'strong' => true,
    366                 'br' => true,
    367                 'i' => true,
    368                 'small' => true,
    369                 'a' => array(
    370                     'href' => true,
     363                'code'    => true,
     364                'em'      => true,
     365                'strong'  => true,
     366                'br'      => true,
     367                'i'       => true,
     368                'small'   => true,
     369                'a'       => array(
     370                    'href'  => true,
    371371                    'title' => true,
    372372                ),
     
    393393            global $kopa_title_counter;
    394394            $kopa_title_counter = 0;
    395 
    396             $wrap_start = '';
    397             $wrap_end = '';
    398             $output = '';
     395           
     396            $wrap_start         = '';
     397            $wrap_end           = '';
     398            $output             = '';
    399399
    400400
  • kopatheme/trunk/includes/admin/fields/field_font.php

    r1486248 r1490791  
    2626    ) );
    2727
    28     $preview = isset( $settings['preview'] ) ? $settings['preview'] : __( 'preview text', 'kopa-framework' );
     28    $preview = isset( $settings['preview'] ) ? $settings['preview'] : esc_html__( 'preview text', 'kopa-framework' );
    2929
    3030    $output = $wrap_start;
     
    8787        'name' => array(
    8888            'type' => 'text',
    89             'placeholder' => __( 'Enter font name', 'kopa-framework' ),
     89            'placeholder' => esc_html__( 'Enter font name', 'kopa-framework' ),
    9090            'required' => false,
    9191        ),
    9292        'woff' => array(
    9393            'type' => 'upload',
    94             'placeholder' => __( 'Upload .woff font file', 'kopa-framework' ),
     94            'placeholder' => esc_html__( 'Upload .woff font file', 'kopa-framework' ),
    9595            'mimes' => 'font/woff',
    9696        ),
    9797        'ttf' => array(
    9898            'type' => 'upload',
    99             'placeholder' => __( 'Upload .ttf font file', 'kopa-framework' ),
     99            'placeholder' => esc_html__( 'Upload .ttf font file', 'kopa-framework' ),
    100100            'mimes' => 'font/truetype',
    101101        ),
    102102        'eot' => array(
    103103            'type' => 'upload',
    104             'placeholder' => __( 'Upload .eot font file', 'kopa-framework' ),
     104            'placeholder' => esc_html__( 'Upload .eot font file', 'kopa-framework' ),
    105105            'mimes' => 'font/eot',
    106106        ),
    107107        'svg' => array(
    108108            'type' => 'upload',
    109             'placeholder' => __( 'Upload .svg font file', 'kopa-framework' ),
     109            'placeholder' => esc_html__( 'Upload .svg font file', 'kopa-framework' ),
    110110            'mimes' => 'font/svg',
    111111        ),
  • kopatheme/trunk/includes/admin/fields/field_sidebar_manager.php

    r1470471 r1490791  
    3131
    3232    $sidebar_atts = array(
    33         'name' => __( 'Name', 'kopa-framework' ),
    34         'description' => __( 'Description', 'kopa-framework' ),
    35         'before_widget' => __( 'Before Widget', 'kopa-framework' ),
    36         'after_widget' => __( 'After Widget', 'kopa-framework' ),
    37         'before_title' => __( 'Before Title', 'kopa-framework' ),
    38         'after_title' => __( 'After Title', 'kopa-framework' ),
     33        'name' => esc_html__( 'Name', 'kopa-framework' ),
     34        'description' => esc_html__( 'Description', 'kopa-framework' ),
     35        'before_widget' => esc_html__( 'Before Widget', 'kopa-framework' ),
     36        'after_widget' => esc_html__( 'After Widget', 'kopa-framework' ),
     37        'before_title' => esc_html__( 'Before Title', 'kopa-framework' ),
     38        'after_title' => esc_html__( 'After Title', 'kopa-framework' ),
    3939    );
    4040
  • kopatheme/trunk/includes/admin/fields/load.php

    r1486248 r1490791  
    1818//Load advanced fields
    1919require_once 'field_icon.php';
     20require_once 'field_icon_picker.php';
    2021require_once 'field_color.php';
    2122require_once 'field_gallery_sortable.php';
     
    3031require_once 'field_title.php';
    3132require_once 'field_caption.php';
     33require_once 'field_quote.php';
     34require_once 'field_chosen.php';
     35require_once 'field_chosen_singular.php';
     36require_once 'field_repeater.php';
     37require_once 'field_repeater_link.php';
     38
    3239/**
    3340 * Register form fields in global list
     
    4855    'radio',
    4956    'textarea',
    50     'datetime',
     57    'datetime', 
    5158    // Advanced
    5259    'icon',
     60    'icon_picker',
    5361    'color',
    5462    'gallery',
     
    6674    'sidebar_manager',
    6775    'title',
    68     'caption'
     76    'caption',
     77    'quote',
     78    'chosen',
     79    'chosen_singular',
     80    'repeater',
     81    'repeater_link'
    6982);
  • kopatheme/trunk/includes/admin/layouts/class-kopa-layout-box.php

    r1428092 r1490791  
    5454        $output = '';
    5555        $output .= '<div id="kopa_section_group_'.esc_attr( $value['id'] ).'" class="kopa_section_group kopa_section_group_layout">';       
    56         $output .= '<label><input class="kopa_use_custom_layout" type="checkbox" name="_use_custom_layout" value="'.esc_attr( $settings['layout'] ).'" '.checked( $settings['layout'], $use_custom_layout, false ).'> '.__( 'Check if you would like to use custom setting', 'kopa-framework' ).'</label>';
     56        $output .= '<label><input class="kopa_use_custom_layout" type="checkbox" name="_use_custom_layout" value="'.esc_attr( $settings['layout'] ).'" '.checked( $settings['layout'], $use_custom_layout, false ).'> '.esc_html__( 'Check if you would like to use custom setting', 'kopa-framework' ).'</label>';
    5757        $output .= '<div class="kopa_group_content">';
    5858
     
    6666        // select layout section
    6767        $output .= '<div id="kopa_section_select_layout_'.esc_attr( $value['id'] ).'" class="kopa_section kopa_section_select_layout">';
    68         $output .= '<h4 class="kopa_heading">'.__( 'Select layout', 'kopa-framework' ).'</h4>';
     68        $output .= '<h4 class="kopa_heading">'.esc_html__( 'Select layout', 'kopa-framework' ).'</h4>';
    6969        $output .= '<div class="kopa_option">';
    7070        $output .= '<div class="kopa_controls">';
     
    9494                $output .= '<div class="kopa_controls">';
    9595                $output .= '<select name="_custom_layout[sidebars]['.esc_attr( $layout_id ).']['.$position.']">';
    96                 $output .= '<option value="">'.__( '&mdash;Select sidebar&mdash;', 'kopa-framework' ).'</option>';
     96                $output .= '<option value="">'.esc_html__( '&mdash;Select sidebar&mdash;', 'kopa-framework' ).'</option>';
    9797               
    9898                // print all registered sidebars
     
    123123            echo '<tr>';
    124124                echo '<th scope="row" valign="top">';
    125                     echo __( 'Custom Layout', 'kopa-framework' );
     125                    echo esc_html__( 'Custom Layout', 'kopa-framework' );
    126126                echo '</th>';
    127127                echo '<td>';
  • kopatheme/trunk/includes/admin/layouts/class-kopa-layout-post-type.php

    r1353276 r1490791  
    5151            add_meta_box(
    5252                'kopa_custom_layout',
    53                 __( 'Custom Layout', 'kopa-framework' ),
     53                esc_html__( 'Custom Layout', 'kopa-framework' ),
    5454                array( $this, 'output_fields' ),
    5555                $args['screen'],
  • kopatheme/trunk/includes/admin/settings/class-kopa-settings-backup-manager.php

    r1467551 r1490791  
    2626    public function __construct() {
    2727        $this->id    = 'backup-manager';
    28         $this->label = __( 'Backup', 'kopa-framework' );
     28        $this->label = esc_html__( 'Backup', 'kopa-framework' );
    2929
    3030        add_filter( 'kopa_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
     
    4646            // restore default settings
    4747            array(
    48                 'title' => __( 'Restore Default', 'kopa-framework' ),
     48                'title' => esc_html__( 'Restore Default', 'kopa-framework' ),
    4949                'type'  => 'title',
    5050                'id'    => 'restore_default_settings',
     
    5252            ),
    5353                array(
    54                     'title'   => __( 'Restore Default Settings', 'kopa-framework' ),
    55                     'desc'    => __( 'Select one of the options below. When you click the "Restore Defaults" button below, the Kopa Framework will restore corresponding default settings for you.', 'kopa-framework' ),
     54                    'title'   => esc_html__( 'Restore Default Settings', 'kopa-framework' ),
     55                    'desc'    => esc_html__( 'Select one of the options below. When you click the "Restore Defaults" button below, the Kopa Framework will restore corresponding default settings for you.', 'kopa-framework' ),
    5656                    'type'    => 'restore_default',
    5757                    'id'      => 'kopa-restore-default',
     
    6565                     */
    6666                    'options' => array(
    67                         'theme-options,sidebar-manager,layout-manager' => __( 'All Settings (This will contain all of the options listed below.)', 'kopa-framework' ),
    68                         'theme-options' => __( 'Theme Options', 'kopa-framework' ),
    69                         'sidebar-manager,layout-manager' => __( 'Sidebars &amp; Layouts', 'kopa-framework' ),
     67                        'theme-options,sidebar-manager,layout-manager' => esc_html__( 'All Settings (This will contain all of the options listed below.)', 'kopa-framework' ),
     68                        'theme-options' => esc_html__( 'Theme Options', 'kopa-framework' ),
     69                        'sidebar-manager,layout-manager' => esc_html__( 'Sidebars &amp; Layouts', 'kopa-framework' ),
    7070                    ),
    7171                    'default' => 'theme-options,sidebar-manager,layout-manager',
     
    7474            // backup settings
    7575            array(
    76                 'title' => __( 'Import/Export', 'kopa-framework' ),
     76                'title' => esc_html__( 'Import/Export', 'kopa-framework' ),
    7777                'type'  => 'title',
    7878                'id'    => 'backup_settings',
     
    8080            ),
    8181                array(
    82                     'title'   => __( 'Import Settings', 'kopa-framework' ),
     82                    'title'   => esc_html__( 'Import Settings', 'kopa-framework' ),
    8383                    'type'    => 'import',
    8484                    'id'      => 'import',
    85                     'desc'    => __( "If you have settings in a backup file on your computer, you can import those into this site.", 'kopa-framework' ),
     85                    'desc'    => esc_html__( "If you have settings in a backup file on your computer, you can import those into this site.", 'kopa-framework' ),
    8686                    'default' => '',
    8787                ),
    8888                array(
    89                     'title'     => __( 'Export Settings', 'kopa-framework' ),
     89                    'title'     => esc_html__( 'Export Settings', 'kopa-framework' ),
    9090                    'type'      => 'export',
    9191                    'id'        => 'export',
    92                     'desc'      => sprintf( __( "When you click the button below, the Kopa Framework will create a text file for you to save to your computer.\nThis text file can be used to restore your settings here on \"%s\", or to easily setup another website with the same settings.", 'kopa-framework' ), get_bloginfo( 'name' ) ),
     92                    'desc'      => sprintf( esc_html__( "When you click the button below, the Kopa Framework will create a text file for you to save to your computer.\nThis text file can be used to restore your settings here on \"%s\", or to easily setup another website with the same settings.", 'kopa-framework' ), get_bloginfo( 'name' ) ),
    9393                    /**
    9494                     * Tab ids that separate by commas
     
    9999                     */
    100100                    'options' => array(
    101                         'theme-options,sidebar-manager,layout-manager' => __( 'All Settings (This will contain all of the options listed below.)', 'kopa-framework' ),
    102                         'theme-options' => __( 'Theme Options', 'kopa-framework' ),
    103                         'sidebar-manager,layout-manager' => __( 'Sidebars &amp; Layouts', 'kopa-framework' ),
     101                        'theme-options,sidebar-manager,layout-manager' => esc_html__( 'All Settings (This will contain all of the options listed below.)', 'kopa-framework' ),
     102                        'theme-options' => esc_html__( 'Theme Options', 'kopa-framework' ),
     103                        'sidebar-manager,layout-manager' => esc_html__( 'Sidebars &amp; Layouts', 'kopa-framework' ),
    104104                    ),
    105105                    'default' => 'theme-options,sidebar-manager,layout-manager',
  • kopatheme/trunk/includes/admin/settings/class-kopa-settings-layout-manager.php

    r1353276 r1490791  
    2626    public function __construct() {
    2727        $this->id    = 'layout-manager';
    28         $this->label = __( 'Layout Manager', 'kopa-framework' );
     28        $this->label = esc_html__( 'Layout Manager', 'kopa-framework' );
    2929
    3030        add_filter( 'kopa_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
     
    6565            // frontpage layout
    6666            array(
    67                 'title'   => __( 'Frontpage', 'kopa-framework' ),
     67                'title'   => esc_html__( 'Frontpage', 'kopa-framework' ),
    6868                'type'    => 'title',
    6969                'id'      => 'frontpage-title',
     
    7171
    7272            'frontpage-layout' => array(
    73                 'title'        => __( 'Frontpage', 'kopa-framework' ),
     73                'title'        => esc_html__( 'Frontpage', 'kopa-framework' ),
    7474                'type'         => 'layout_manager',
    7575                'id'           => 'frontpage-layout',
     
    8181            // blog layout
    8282            array(
    83                 'title'   => __( 'Blog', 'kopa-framework' ),
     83                'title'   => esc_html__( 'Blog', 'kopa-framework' ),
    8484                'type'    => 'title',
    8585                'id'      => 'blog-title',
     
    8787
    8888            'blog-layout' => array(
    89                 'title'        => __( 'Blog', 'kopa-framework' ),
     89                'title'        => esc_html__( 'Blog', 'kopa-framework' ),
    9090                'type'         => 'layout_manager',
    9191                'id'           => 'blog-layout',
     
    9797            // page layout
    9898            array(
    99                 'title'   => __( 'Page', 'kopa-framework' ),
     99                'title'   => esc_html__( 'Page', 'kopa-framework' ),
    100100                'type'    => 'title',
    101101                'id'      => 'page-title',
     
    103103
    104104            'page-layout' => array(
    105                 'title'        => __( 'Page', 'kopa-framework' ),
     105                'title'        => esc_html__( 'Page', 'kopa-framework' ),
    106106                'type'         => 'layout_manager',
    107107                'id'           => 'page-layout',
     
    113113            // post layout
    114114            array(
    115                 'title'   => __( 'Post', 'kopa-framework' ),
     115                'title'   => esc_html__( 'Post', 'kopa-framework' ),
    116116                'type'    => 'title',
    117117                'id'      => 'post-title',
     
    119119
    120120            'post-layout' => array(
    121                 'title'        => __( 'Post', 'kopa-framework' ),
     121                'title'        => esc_html__( 'Post', 'kopa-framework' ),
    122122                'type'         => 'layout_manager',
    123123                'id'           => 'post-layout',
     
    129129            // search layout
    130130            array(
    131                 'title'   => __( 'Search', 'kopa-framework' ),
     131                'title'   => esc_html__( 'Search', 'kopa-framework' ),
    132132                'type'    => 'title',
    133133                'id'      => 'search-title',
     
    135135
    136136            'search-layout' => array(
    137                 'title'        => __( 'Search', 'kopa-framework' ),
     137                'title'        => esc_html__( 'Search', 'kopa-framework' ),
    138138                'type'         => 'layout_manager',
    139139                'id'           => 'search-layout',
     
    145145            // error 404 layout
    146146            array(
    147                 'title'   => __( '404', 'kopa-framework' ),
     147                'title'   => esc_html__( '404', 'kopa-framework' ),
    148148                'type'    => 'title',
    149149                'id'      => 'error404-title',
     
    151151
    152152            'error404-layout' => array(
    153                 'title'        => __( 'Error 404', 'kopa-framework' ),
     153                'title'        => esc_html__( 'Error 404', 'kopa-framework' ),
    154154                'type'         => 'layout_manager',
    155155                'id'           => 'error404-layout',
  • kopatheme/trunk/includes/admin/settings/class-kopa-settings-sidebar-manager.php

    r1353276 r1490791  
    2626    public function __construct() {
    2727        $this->id    = 'sidebar-manager';
    28         $this->label = __( 'Sidebar Manager', 'kopa-framework' );
     28        $this->label = esc_html__( 'Sidebar Manager', 'kopa-framework' );
    2929
    3030        add_filter( 'kopa_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
     
    4747        return apply_filters( 'kopa_sidebar_manager_settings', array(
    4848            array(
    49                 'title'   => __( 'Sidebar Manager', 'kopa-framework' ),
     49                'title'   => esc_html__( 'Sidebar Manager', 'kopa-framework' ),
    5050                'type'    => 'title',
    5151                'id'      => 'sidebar-title',
     
    5353            array(
    5454                'title'       => 'Sidebar Manager',
    55                 'description' => __( 'Add as many sidebars (widget areas) as you need. Creating sidebars (widget areas) is unlimited.', 'kopa-framework' ),
     55                'description' => esc_html__( 'Add as many sidebars (widget areas) as you need. Creating sidebars (widget areas) is unlimited.', 'kopa-framework' ),
    5656                'id'          => 'sidebar-manager',
    5757                'type'        => 'sidebar_manager',
  • kopatheme/trunk/includes/admin/settings/class-kopa-settings-theme-options.php

    r1467551 r1490791  
    2626    public function __construct() {
    2727        $this->id    = 'theme-options';
    28         $this->label = __( 'General Settings', 'kopa-framework' );
     28        $this->label = esc_html__( 'General Settings', 'kopa-framework' );
    2929
    3030        add_filter( 'kopa_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
  • kopatheme/trunk/includes/class-kopa-ajax.php

    r1462248 r1490791  
    5959
    6060        if ( isset( $sidebars_widgets[ $sidebar_id ] ) && ! empty( $sidebars_widgets[ $sidebar_id ] ) ) {
    61             $warnings[] = __( 'This sidebar is currently containing widgets.', 'kopa-framework' );
     61            $warnings[] = esc_html__( 'This sidebar is currently containing widgets.', 'kopa-framework' );
    6262        }
    6363
     
    8383                                $layout_name = isset( $option['layouts'][ $layout_id ]['title'] ) ? $option['layouts'][ $layout_id ]['title'] : '';
    8484                                $page_title = isset( $option['title'] ) ? $option['title'] : '';
    85                                 $errors[] = "&nbsp;&nbsp;&nbsp;&nbsp;" . sprintf( __( '%1$s of %2$s.', 'kopa-framework' ), $layout_name, $page_title );
     85                                $errors[] = "&nbsp;&nbsp;&nbsp;&nbsp;" . sprintf( esc_html__( '%1$s of %2$s.', 'kopa-framework' ), $layout_name, $page_title );
    8686                            }
    8787                        }
     
    9393        // warning messages
    9494        // if ( ! empty( $warnings ) ) {
    95         //  $warnings[] = __( 'Delete it will also delete all widgets are inside it.', 'kopa-framework' );
     95        //  $warnings[] = esc_html__( 'Delete it will also delete all widgets are inside it.', 'kopa-framework' );
    9696        // }
    9797
     
    100100        if ( ! empty( $errors ) ) {
    101101            $allow_delete = false;
    102             array_unshift( $errors, '<strong>' . __( 'This sidebar is being used in:', 'kopa-framework' ) . '</strong>' );
    103             $errors[] = '<strong>' . __('You cannot delete this sidebar.', 'kopa-framework') . '</strong>';
     102            array_unshift( $errors, '<strong>' . esc_html__( 'This sidebar is being used in:', 'kopa-framework' ) . '</strong>' );
     103            $errors[] = '<strong>' . esc_html__('You cannot delete this sidebar.', 'kopa-framework') . '</strong>';
    104104        }
    105105
     
    135135                       class="kopa-textbox"
    136136                       placeholder="<?php echo esc_html__('Search...', 'upside'); ?>"
    137                        onkeyup="Kopa_Icon_Picker.filter_icons(event, jQuery(this));">
     137                       onkeyup="Kopa_UI_Icon.filter_icons(event, jQuery(this));">
    138138            </div>
    139139            <div class="kopa-row kopa-wrap">
    140140                <?php foreach($icons as $key => $val): ?>
    141                 <span class="kopa-icon-item kopa-col-xs-2" onclick="Kopa_Icon_Picker.select_a_icon(event, jQuery(this));">
     141                <span class="kopa-icon-item kopa-col-xs-2" onclick="Kopa_UI_Icon.select_a_icon(event, jQuery(this));">
    142142                        <i class="<?php echo esc_attr($key); ?>" data-title="<?php echo esc_attr($val); ?>"></i>
    143143                    </span>
  • kopatheme/trunk/includes/kopa-fonts-functions.php

    r1353276 r1490791  
    1251012510        array (
    1251112511            'style' => '100',
    12512             'label' => __( 'Thin', 'kopa-framework' ),
     12512            'label' => esc_html__( 'Thin', 'kopa-framework' ),
    1251312513        ),
    1251412514        array (
    1251512515            'style' => '100italic',
    12516             'label' => __( 'Thin/Italic', 'kopa-framework' ),
     12516            'label' => esc_html__( 'Thin/Italic', 'kopa-framework' ),
    1251712517        ),
    1251812518        array (
    1251912519            'style' => '200',
    12520             'label' => __( 'Extra-Light', 'kopa-framework' ),
     12520            'label' => esc_html__( 'Extra-Light', 'kopa-framework' ),
    1252112521        ),
    1252212522        array (
    1252312523            'style' => '200italic',
    12524             'label' => __( 'Extra-Light/Italic', 'kopa-framework' ),
     12524            'label' => esc_html__( 'Extra-Light/Italic', 'kopa-framework' ),
    1252512525        ),
    1252612526        array (
    1252712527            'style' => '300',
    12528             'label' => __( 'Light', 'kopa-framework' ),
     12528            'label' => esc_html__( 'Light', 'kopa-framework' ),
    1252912529        ),
    1253012530        array (
    1253112531            'style' => '300italic',
    12532             'label' => __( 'Light/Italic', 'kopa-framework' ),
     12532            'label' => esc_html__( 'Light/Italic', 'kopa-framework' ),
    1253312533        ),
    1253412534        array (
    1253512535            'style' => '400',
    12536             'label' => __( 'Normal', 'kopa-framework' ),
     12536            'label' => esc_html__( 'Normal', 'kopa-framework' ),
    1253712537        ),
    1253812538        array (
    1253912539            'style' => '400italic',
    12540             'label' => __( 'Normal/Italic', 'kopa-framework' ),
     12540            'label' => esc_html__( 'Normal/Italic', 'kopa-framework' ),
    1254112541        ),
    1254212542        array (
    1254312543            'style' => 'regular',
    12544             'label' => __( 'Normal', 'kopa-framework' ),
     12544            'label' => esc_html__( 'Normal', 'kopa-framework' ),
    1254512545        ),
    1254612546        array (
    1254712547            'style' => 'italic',
    12548             'label' => __( 'Normal/Italic', 'kopa-framework' ),
     12548            'label' => esc_html__( 'Normal/Italic', 'kopa-framework' ),
    1254912549        ),
    1255012550        array (
    1255112551            'style' => '500',
    12552             'label' => __( 'Medium', 'kopa-framework' ),
     12552            'label' => esc_html__( 'Medium', 'kopa-framework' ),
    1255312553        ),
    1255412554        array (
    1255512555            'style' => '500italic',
    12556             'label' => __( 'Medium/Italic', 'kopa-framework' ),
     12556            'label' => esc_html__( 'Medium/Italic', 'kopa-framework' ),
    1255712557        ),
    1255812558        array (
    1255912559            'style' => '600',
    12560             'label' => __( 'Semi-Bold', 'kopa-framework' ),
     12560            'label' => esc_html__( 'Semi-Bold', 'kopa-framework' ),
    1256112561        ),
    1256212562        array (
    1256312563            'style' => '600italic',
    12564             'label' => __( 'Semi-Bold/Italic', 'kopa-framework' ),
     12564            'label' => esc_html__( 'Semi-Bold/Italic', 'kopa-framework' ),
    1256512565        ),
    1256612566        array (
    1256712567            'style' => '700',
    12568             'label' => __( 'Bold', 'kopa-framework' ),
     12568            'label' => esc_html__( 'Bold', 'kopa-framework' ),
    1256912569        ),
    1257012570        array (
    1257112571            'style' => '700italic',
    12572             'label' => __( 'Bold/Italic', 'kopa-framework' ),
     12572            'label' => esc_html__( 'Bold/Italic', 'kopa-framework' ),
    1257312573        ),
    1257412574        array (
    1257512575            'style' => 'bold',
    12576             'label' => __( 'Bold', 'kopa-framework' ),
     12576            'label' => esc_html__( 'Bold', 'kopa-framework' ),
    1257712577        ),
    1257812578        array (
    1257912579            'style' => 'bolditalic',
    12580             'label' => __( 'Bold/Italic', 'kopa-framework' ),
     12580            'label' => esc_html__( 'Bold/Italic', 'kopa-framework' ),
    1258112581        ),
    1258212582        array (
    1258312583            'style' => '800',
    12584             'label' => __( 'Extra-Bold', 'kopa-framework' ),
     12584            'label' => esc_html__( 'Extra-Bold', 'kopa-framework' ),
    1258512585        ),
    1258612586        array (
    1258712587            'style' => '800italic',
    12588             'label' => __( 'Extra-Bold/Italic', 'kopa-framework' ),
     12588            'label' => esc_html__( 'Extra-Bold/Italic', 'kopa-framework' ),
    1258912589        ),
    1259012590        array (
    1259112591            'style' => '900',
    12592             'label' => __( 'Ultra-Bold', 'kopa-framework' ),
     12592            'label' => esc_html__( 'Ultra-Bold', 'kopa-framework' ),
    1259312593        ),
    1259412594        array (
    1259512595            'style' => '900italic',
    12596             'label' => __( 'Ultra-Bold/Italic', 'kopa-framework' ),
     12596            'label' => esc_html__( 'Ultra-Bold/Italic', 'kopa-framework' ),
    1259712597        ),
    1259812598    ) );
  • kopatheme/trunk/kopa-framework.php

    r1486248 r1490791  
    33 * Plugin Name: Kopa Framework
    44 * Description: A WordPress framework by Kopatheme.
    5  * Version: 1.2.1
     5 * Version: 1.2.5
    66 * Author: Kopa Theme
    77 * Author URI: http://kopatheme.com
     
    2525 * @copyright 2014 Kopatheme
    2626 * @license   GPLv2 or later
    27  * @version   1.0.10
     27 * @version   1.2.5
    2828 * @package   KopaFramework
    2929 * @link      http://kopatheme.com
     
    3535     * @var string framework version
    3636     */
    37     public $version = '1.2.0';
     37    public $version = '1.2.5';
    3838
    3939    /**
     
    156156        add_filter( 'kopa_enable_admin_help_tab', '__return_false' );
    157157
    158         #metabox-custom-wrap
    159         $is_metabox_wrapper = apply_filters('kopa_admin_metabox_wrapper', true);
    160         if ( $is_metabox_wrapper ) {
    161             add_filter('kopa_admin_meta_box_wrap_start', array( $this, 'meta_box_wrap_start' ), 10, 3);
    162             add_filter('kopa_admin_meta_box_wrap_end', array( $this, 'meta_box_wrap_end' ), 10, 3);
    163         }
    164 
    165         $advanced_field = apply_filters('kopa_admin_metabox_advanced_field', false);
    166         if ( $advanced_field ) {
    167             add_filter('kopa_sanitize_option_datetime', array($this, 'kopa_sanitize_option_datetime'), 10, 2);
    168         }
     158    #metabox-custom-wrap
     159    $is_metabox_wrapper = apply_filters('kopa_admin_metabox_wrapper', true);
     160    if ( $is_metabox_wrapper ) {
     161        add_filter('kopa_admin_meta_box_wrap_start', array( $this, 'meta_box_wrap_start' ), 10, 3);
     162        add_filter('kopa_admin_meta_box_wrap_end', array( $this, 'meta_box_wrap_end' ), 10, 3);
     163    }
     164
     165    $advanced_field = apply_filters('kopa_admin_metabox_advanced_field', false);
     166    if ( $advanced_field ) {
     167        add_filter('kopa_sanitize_option_datetime', array($this, 'kopa_sanitize_option_datetime'), 10, 2);
     168    }
    169169    }
    170170
  • kopatheme/trunk/languages/kopa-framework-en_US.pot

    r1486248 r1490791  
    44"Project-Id-Version: Kopa Framework\n"
    55"Report-Msgid-Bugs-To: \n"
    6 "POT-Creation-Date: 2016-08-18 10:03+0700\n"
     6"POT-Creation-Date: 2016-09-01 10:00+0700\n"
    77"PO-Revision-Date: 2015-05-17 23:17+0700\n"
    88"Last-Translator: thanh4890 <[email protected]>\n"
     
    1616"X-Poedit-SourceCharset: UTF-8\n"
    1717"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
    18 "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
     18"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;"
     19"esc_html__;esc_html_e;esc_attr__;esc_attr_e\n"
    1920"X-Poedit-Basepath: ..\n"
    2021"X-Textdomain-Support: yes\n"
    2122"X-Poedit-SearchPath-0: .\n"
    2223
    23 #: includes/admin/class-kopa-admin-assets.php:140
    24 #: includes/admin/fields/field_font.php:95
     24#: includes/admin/class-kopa-admin-assets.php:160
     25#: includes/admin/fields/field_font.php:89
    2526msgid "Enter font name"
    2627msgstr ""
    2728
    28 #: includes/admin/class-kopa-admin-assets.php:142
     29#: includes/admin/class-kopa-admin-assets.php:162
    2930msgid "Custom font"
    3031msgstr ""
    3132
    32 #: includes/admin/class-kopa-admin-assets.php:146
    33 #: includes/admin/fields/field_font.php:100
     33#: includes/admin/class-kopa-admin-assets.php:166
     34#: includes/admin/fields/field_font.php:94
    3435msgid "Upload .woff font file"
    3536msgstr ""
    3637
    37 #: includes/admin/class-kopa-admin-assets.php:151
    38 #: includes/admin/fields/field_font.php:105
     38#: includes/admin/class-kopa-admin-assets.php:171
     39#: includes/admin/fields/field_font.php:99
    3940msgid "Upload .ttf font file"
    4041msgstr ""
    4142
    42 #: includes/admin/class-kopa-admin-assets.php:156
    43 #: includes/admin/fields/field_font.php:110
     43#: includes/admin/class-kopa-admin-assets.php:176
     44#: includes/admin/fields/field_font.php:104
    4445msgid "Upload .eot font file"
    4546msgstr ""
    4647
    47 #: includes/admin/class-kopa-admin-assets.php:161
    48 #: includes/admin/fields/field_font.php:115
     48#: includes/admin/class-kopa-admin-assets.php:181
     49#: includes/admin/fields/field_font.php:109
    4950msgid "Upload .svg font file"
    5051msgstr ""
    5152
    52 #: includes/admin/class-kopa-admin-assets.php:166
     53#: includes/admin/class-kopa-admin-assets.php:189
    5354msgid "Upload"
    5455msgstr ""
    5556
    56 #: includes/admin/class-kopa-admin-assets.php:167
     57#: includes/admin/class-kopa-admin-assets.php:190
    5758msgid "Remove"
    5859msgstr ""
    5960
    60 #: includes/admin/class-kopa-admin-assets.php:168
     61#: includes/admin/class-kopa-admin-assets.php:191
    6162msgid "Click OK to reset. Any selected settings will be lost!"
    6263msgstr ""
    6364
    64 #: includes/admin/class-kopa-admin-assets.php:169
     65#: includes/admin/class-kopa-admin-assets.php:192
    6566msgid "Click OK to import. Any selected settings will be lost!"
    6667msgstr ""
    6768
    68 #: includes/admin/class-kopa-admin-assets.php:170
    69 #: includes/admin/class-kopa-admin-assets.php:178
     69#: includes/admin/class-kopa-admin-assets.php:193
     70#: includes/admin/class-kopa-admin-assets.php:203
    7071msgid "Are you sure you want to delete?"
    7172msgstr ""
    7273
    73 #: includes/admin/class-kopa-admin-assets.php:175
     74#: includes/admin/class-kopa-admin-assets.php:200
    7475msgid "Warning"
    7576msgstr ""
    7677
    77 #: includes/admin/class-kopa-admin-assets.php:176
     78#: includes/admin/class-kopa-admin-assets.php:201
    7879msgid "Error"
    7980msgstr ""
    8081
    81 #: includes/admin/class-kopa-admin-assets.php:177
     82#: includes/admin/class-kopa-admin-assets.php:202
    8283msgid "Info"
    8384msgstr ""
    8485
    85 #: includes/admin/class-kopa-admin-assets.php:179
     86#: includes/admin/class-kopa-admin-assets.php:204
    8687msgid "Close"
    8788msgstr ""
    8889
    89 #: includes/admin/class-kopa-admin-assets.php:180
     90#: includes/admin/class-kopa-admin-assets.php:205
    9091msgid "Delete"
    9192msgstr ""
    9293
    93 #: includes/admin/class-kopa-admin-assets.php:181
     94#: includes/admin/class-kopa-admin-assets.php:206
    9495msgid "Advanced Settings"
    9596msgstr ""
    9697
    97 #: includes/admin/class-kopa-admin-assets.php:183
     98#: includes/admin/class-kopa-admin-assets.php:208
    9899#: includes/admin/fields/field_sidebar_manager.php:33
    99100msgid "Name"
    100101msgstr ""
    101102
    102 #: includes/admin/class-kopa-admin-assets.php:184
     103#: includes/admin/class-kopa-admin-assets.php:209
    103104#: includes/admin/fields/field_sidebar_manager.php:34
    104105msgid "Description"
    105106msgstr ""
    106107
    107 #: includes/admin/class-kopa-admin-assets.php:185
     108#: includes/admin/class-kopa-admin-assets.php:210
    108109#: includes/admin/fields/field_sidebar_manager.php:35
    109110msgid "Before Widget"
    110111msgstr ""
    111112
    112 #: includes/admin/class-kopa-admin-assets.php:186
     113#: includes/admin/class-kopa-admin-assets.php:211
    113114#: includes/admin/fields/field_sidebar_manager.php:36
    114115msgid "After Widget"
    115116msgstr ""
    116117
    117 #: includes/admin/class-kopa-admin-assets.php:187
     118#: includes/admin/class-kopa-admin-assets.php:212
    118119#: includes/admin/fields/field_sidebar_manager.php:37
    119120msgid "Before Title"
    120121msgstr ""
    121122
    122 #: includes/admin/class-kopa-admin-assets.php:188
     123#: includes/admin/class-kopa-admin-assets.php:213
    123124#: includes/admin/fields/field_sidebar_manager.php:38
    124125msgid "After Title"
  • kopatheme/trunk/readme.txt

    r1486248 r1490791  
    55Requires at least: 4.1
    66Tested up to: 4.6
    7 Stable tag: 1.2.1
     7Stable tag: 1.2.5
    88License: GPLv2 or later
    99
     
    2121
    2222== Changelog ==
     23= 1.2.5 =
     24* Add new 4 fields: chosen, chosen_singular, repeater, repeater_link ( widget )
     25
     26= 1.2.4 =
     27* Tested up to: WordPress version 4.6
     28* Apply filter: "kopa_is_load_compiled_assets"
     29* Replace function __(), _e() by esc_html__(), esc_html_e()
     30
     31= 1.2.3 =
     32* Add new 5 fields: chosen, chosen_singular, repeater, repeater_link, icon_picker ( metabox, theme-options )
     33
    2334= 1.2.2 =
    2435* Fix Advanced fields JS bug
Note: See TracChangeset for help on using the changeset viewer.