Admin Columns - Version 2.4.9

Version Description

  • [Added] Display format Url added to Custom Fields
  • [Added] Allow the use of before and after fields for all columns. Use add_filter( 'cac/column/properties/use_before_after', '__return_true' ).
  • [Fixed] Removed Field Groups from post types
  • [Fixed] Removed additional avatars from the comments view
  • [Added] Added the option to replace the Custom Field select menu with a text input. Use add_filter( 'cac/column/meta/use_text_input', '__return_true' ).
Download this release

Release Info

Developer tschutter
Plugin Icon 128x128 Admin Columns
Version 2.4.9
Comparing to
See all releases

Code changes from version 2.4.8 to 2.4.9

Files changed (38) hide show
  1. assets/css/admin-column.css +3 -7
  2. assets/css/admin-column.min.css +1 -1
  3. assets/css/column.css +25 -2
  4. assets/css/column.min.css +1 -1
  5. classes/addons.php +130 -2
  6. classes/column.php +378 -278
  7. classes/column/acf-placeholder.php +1 -1
  8. classes/column/custom-field.php +106 -74
  9. classes/column/post/roles.php +7 -4
  10. classes/column/wc-placeholder.php +1 -1
  11. classes/review_notice.php +2 -2
  12. classes/settings.php +353 -304
  13. classes/storage_model.php +24 -74
  14. classes/storage_model/comment.php +19 -12
  15. classes/storage_model/link.php +9 -3
  16. classes/storage_model/media.php +10 -5
  17. classes/storage_model/post.php +26 -21
  18. classes/storage_model/user.php +10 -4
  19. classes/third_party.php +2 -0
  20. classes/third_party/woocommerce.php +11 -0
  21. classes/upgrade.php +1 -1
  22. classes/utility.php +34 -11
  23. codepress-admin-columns.php +107 -49
  24. languages/codepress-admin-columns-ar.po +1345 -0
  25. languages/codepress-admin-columns-da_DK.po +1337 -0
  26. languages/codepress-admin-columns-es_ES.po +1336 -0
  27. languages/codepress-admin-columns-fa_IR.po +1334 -0
  28. languages/codepress-admin-columns-fr_FR.po +1342 -0
  29. languages/codepress-admin-columns-hu_HU.po +1337 -0
  30. languages/codepress-admin-columns-it_IT.po +1339 -0
  31. languages/codepress-admin-columns-ja.po +1335 -0
  32. languages/codepress-admin-columns-nl_NL.po +1337 -0
  33. languages/codepress-admin-columns-pl_PL.po +1338 -0
  34. languages/codepress-admin-columns-pt_BR.po +1338 -0
  35. languages/codepress-admin-columns-ru_RU.po +1339 -0
  36. languages/codepress-admin-columns-sv_SE.po +1337 -0
  37. languages/codepress-admin-columns-zh_CN.po +1334 -0
  38. readme.txt +19 -12
assets/css/admin-column.css CHANGED
@@ -2,6 +2,9 @@
2
#cpac a:active {
3
outline: none;
4
}
5
/**
6
* General
7
* ----------------------------------------------------------------------------
@@ -107,13 +110,6 @@ a.help {
107
right: 0;
108
left: auto;
109
}
110
- /**
111
- * Header
112
- * ----------------------------------------------------------------------------
113
- */
114
- h2.cpac-nav-tab-wrapper {
115
- margin-bottom: 10px;
116
- }
117
/**
118
* Menu
119
* ----------------------------------------------------------------------------
2
#cpac a:active {
3
outline: none;
4
}
5
+ #cpac h2.cpac-nav-tab-wrapper {
6
+ margin-bottom: 10px;
7
+ }
8
/**
9
* General
10
* ----------------------------------------------------------------------------
110
right: 0;
111
left: auto;
112
}
113
/**
114
* Menu
115
* ----------------------------------------------------------------------------
assets/css/admin-column.min.css CHANGED
@@ -1 +1 @@
1
- .button.loading span,.cpac-column .comment-grey-bubble,.icon-no,.icon-yes,a.help{height:16px;width:16px}#cpac a:active,#cpac a:focus{outline:0}#icon-codepress-admin-columns{background:url(../images/icon.png) no-repeat}.cpac-settings-link{float:right;margin:12px 14px 5px 0;background:url(../images/settings.png) no-repeat;padding-left:20px;text-decoration:none;display:inline-block;line-height:16px}.cpac-settings-link.current{font-weight:700}.rtl .cpac-settings-link{float:left;margin:12px 0 5px 14px;padding-right:20px;padding-left:0}.cpac-menu,h2.cpac-nav-tab-wrapper{margin-bottom:10px}a.help{background:url(../images/help.png) no-repeat;display:inline-block}.button.loading{padding-right:25px;position:relative}.rtl .button.loading{padding-left:25px;padding-right:0}.button.loading span{position:absolute;top:2px;right:6px;background:url(../images/loading.gif) right 50% no-repeat;display:inline-block}.icon-no,.icon-yes{display:inline-block;position:relative}.rtl .button.loading span{left:6px;right:auto}.cpac_message.error.warning{border-left:4px solid #ffba00}.icon-yes{background:url(../images/yes.png) no-repeat;top:2px}.icon-no{background:url(../images/no.png) no-repeat;top:2px}.cpac-column .comment-grey-bubble:before{content:'\f101';font:400 20px/.5 dashicons;speak:none;display:inline-block;padding:0;top:4px;left:0;position:relative;vertical-align:top;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none!important}.rtl .cpac-column .comment-grey-bubble:before{right:0;left:auto}.cpac-menu{clear:both;overflow:hidden}.cpac-menu .subsubsub{white-space:normal;width:100%;margin:0 14px 0 0}.cpac-menu .subsubsub li.first{font-weight:700;min-width:100px}.columns-container{margin-right:300px;max-width:700px}.columns-container .columns-left{float:left;width:100%}.columns-container .columns-right{float:right;margin-right:-300px;width:280px}.columns-container .columns-right .columns-right-inside.fixed{position:fixed;top:40px;width:280px}.ui-sortable-helper{-webkit-box-shadow:1px 3px 6px 0 rgba(1,1,1,.4);box-shadow:1px 3px 6px 0 rgba(1,1,1,.4)}.columns-left .cpac-boxes .cpac-columns form,.columns-right .sidebox{box-shadow:0 1px 3px rgba(0,0,0,.1)}.ui-sortable-helper .column-meta{border-width:1px}.cpac-placeholder{visibility:visible!important;border-top:1px solid #dfdfdf;padding:5px 4px 7px 0}.cpac-placeholder .inner-placeholder{border:1px dashed grey;background:#eee;width:100%;height:100%}.cpac-placeholder :first-child{border:none}.cpac-column .column-meta{border-style:solid;border-color:#dfdfdf;border-width:1px 1px 0;background:#fcfcfc}.cpac-column .column-meta:nth-child(2n) .column-meta{background:#f9f9f9}.cpac-column .column-meta img{margin-right:3px}.cpac-column .column-meta table{border:none;background:0 0;border-radius:0}.cpac-column .column-meta table tr td{vertical-align:top;height:18px;border:none solid transparent;padding:11px 8px;border-width:1px 0 0}.cpac-column .column-meta table tr td.column_sort{width:10px;background:url(../images/drag.png) 8px 8px no-repeat;cursor:move}.cpac-column .column-meta table tr td.column_label{width:70%;font-weight:700;vertical-align:middle;position:relative}.cpac-column .column-meta table tr td.column_label .inner{position:relative;overflow:hidden;height:18px}.cpac-column .column-meta table tr td.column_label .inner>a{color:#5a5a5a;padding:0 4px}.cpac-column .column-meta table tr td.column_label .inner>a:hover{color:#333}.cpac-column .column-meta table tr td.column_label .inner>a.clone-button,.cpac-column .column-meta table tr td.column_label .inner>a.edit-button,.cpac-column .column-meta table tr td.column_label .inner>a.remove-button{display:none;color:#a00;text-decoration:none;text-shadow:none;font-weight:400;margin-left:5px;font-size:12px}.cpac-column .column-meta table tr td.column_label .inner>a.clone-button:hover,.cpac-column .column-meta table tr td.column_label .inner>a.edit-button:hover,.cpac-column .column-meta table tr td.column_label .inner>a.remove-button:hover{color:red}.cpac-column .column-meta table tr td.column_label .inner>a.clone-button,.cpac-column .column-meta table tr td.column_label .inner>a.edit-button{color:#0074a2}.cpac-column .column-meta table tr td.column_label .inner>a.clone-button:hover,.cpac-column .column-meta table tr td.column_label .inner>a.edit-button:hover{color:#2ea2cc}.cpac-column .column-meta table tr td.column_label .inner .meta{display:inline-block;float:right;font-weight:400;color:#b2b2b2;font-size:12px}.cpac-column .column-meta table tr td.column_label .inner .meta span{cursor:pointer}.cpac-column .column-meta table tr td.column_label .inner .meta span.width{margin-right:5px;cursor:auto;color:#737373}.cpac-column .column-meta table tr td.column_label span.vers{float:left}.cpac-column .column-meta table tr td.column_type{width:auto;min-width:120px;text-align:right;vertical-align:middle;color:#999;padding-right:0}.cpac-column .column-meta table tr td.column_type .inner{height:18px;overflow:hidden}.cpac-column .column-meta table tr td.column_type .inner a{color:#999}.cpac-column .column-meta table tr td.column_edit{width:38px;min-width:38px;background:url(../images/arrow.png) 23px 18px no-repeat;cursor:pointer}.cpac-column .column-meta:hover .column_label .inner>a.clone-button,.cpac-column .column-meta:hover .column_label .inner>a.edit-button,.cpac-column .column-meta:hover .column_label .inner>a.remove-button{display:inline-block}.cpac-column .column-meta span.vers{padding-top:2px}.cpac-column .column-meta span.vers .comment-grey-bubble{float:right}.cpac-column .column-form{display:none;border-width:1px 1px 0;border-style:solid;border-color:#dfdfdf;position:relative}.cpac-column .column-form table{border:none;background:#fcfcfc}.cpac-column .column-form table tr.hide{display:none}.cpac-column .column-form table tr td{vertical-align:top;border:none;padding:8px;background:#fff;border-top:1px solid #F5F5F5}.cpac-column .column-form table tr td input[type=text],.cpac-column .column-form table tr td select{width:99.95%}.cpac-column .column-form table tr td input[type=text].small,.cpac-column .column-form table tr td select.small{width:100px}.cpac-column .column-form table tr td span.suffix{line-height:40px;color:grey}.cpac-column .column-form table tr td select optgroup:nth-child(2n){background:#F9F9F9}.cpac-column .column-form table tr td.label{position:relative;overflow:visible;background:#f5f5f5;border-right:1px solid #E1E1E1;vertical-align:top;width:34%;border-top:1px solid #F0F0F0}.column-footer,.wp-pointer-content{overflow:hidden}.cpac-column .column-form table tr td.label label{font-weight:700;color:#333;display:block;position:relative}.cpac-column .column-form table tr td.label p{color:#666;display:block;font-size:12px;font-style:normal;line-height:16px;margin:0!important}.cpac-column .column-form table tr td.label p.description{display:none;position:absolute;z-index:99;top:30px;left:0;background:#eaf2fa;border-radius:5px;border:1px solid #c7d7e2;padding:5px 8px!important;font-weight:400}.cpac-column .column-form table tr td.label p.description em{display:block;color:#999}.cpac-column .column-form table tr td.label .info{position:absolute;top:0;left:0;width:100%;height:100%;z-index:1}.cpac-column .column-form table tr td.label .info:before{position:absolute;z-index:1;right:10px;top:50%;margin-top:-7px;content:'';display:block;border-radius:32px;border:1px solid #E6E6E6;width:12px;height:12px}.cpac-column .column-form table tr td.label .info:after{position:absolute;z-index:1;right:10px;top:50%;margin-top:-6px;content:'?';display:block;width:14px;height:14px;color:#E6E6E6;font:700 10px Arial;text-align:center;vertical-align:middle;line-height:14px}.cpac-column .column-form table tr td.input label{padding-left:10px;padding-right:0}.cpac-column .column-form table tr td.input div.msg{margin-top:5px;display:none;color:#333;padding:6px 8px;background-color:#ffebe8;border:1px solid #fff;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px}.cpac-column .column-form table tr td.input .section{padding:12px}.cpac-column .column-form table tr.column_width .input{position:relative}.cpac-column .column-form table tr.column_width .input div.description{font-size:11px;width:54px;position:absolute;left:10px;text-align:middle}.cpac-column .column-form table tr.column_width .input div.description input{background:#efefef;border:none;height:20px;line-height:20px;text-align:right;width:36px;font-size:12px}.cpac-column .column-form table tr.column_width .input div.width-slider{margin-left:60px;margin-right:100px;position:relative;margin-top:4px}.cpac-column .column-form table tr.column_width .input div.width-slider .ui-slider-handle{cursor:ew-resize}.cpac-column .column-form table tr.column_width .input div.unit-select{position:absolute;top:8px;right:10px;width:90px;text-align:right}.cpac-column .column-form table tr.column_width .input div.unit-select label{padding-left:5px}.cpac-column .column-form table tr.column_image_size{border:10px solid red}.cpac-column .column-form table tr.column_image_size td.input label.custom-size{display:inline-block;margin-top:4px;margin-bottom:4px}.cpac-column .column-form table tr.column_image_size td.input label.custom-size input{margin-right:3px}.cpac-column .column-form table tr.column_image_size td.input .custom_image_size{display:inline-block}.cpac-column .column-form table tr.column_image_size td.input .custom_image_size .custom-size-h.hidden,.cpac-column .column-form table tr.column_image_size td.input .custom_image_size .custom-size-w.hidden,.cpac-column .column-form table tr.column_image_size td.input .custom_image_size .hidden{display:none}.cpac-column .column-form table tr.column_image_size td.input .custom_image_size .custom-size-h,.cpac-column .column-form table tr.column_image_size td.input .custom_image_size .custom-size-w{margin:0}.cpac-column .column-form table tr.column_image_size td.input .custom_image_size .custom-size-h input[type=text],.cpac-column .column-form table tr.column_image_size td.input .custom_image_size .custom-size-w input[type=text]{margin-right:3px;width:40px!important}.cpac-column .column-form table tr.column_action td{background:#f9f9f9}.cpac-column .column-form table tr.column_action td p{margin:0}.cpac-column .column-form table tr.column_action td p a.remove-button{color:#a00;text-decoration:none;text-shadow:none;font-weight:400;margin-left:5px;font-size:12px;padding:0 5px}.cpac-column .column-form table tr.column_action td p a.remove-button:hover{color:#fff;background:red}.cpac-column .column-form table tr:first-child td{border-top:none}.cpac-column.loading .column-form>.spinner{position:absolute;left:50%;top:50%;z-index:200;margin-left:-10px;margin-top:-10px;display:block}.cpac-column.loading .column-form:before{content:'';position:absolute;width:100%;height:100%;background:#FFF;z-index:100;opacity:.5}.cpac-column.opened .column-meta{background-color:#c7c7c7;background-image:-ms-linear-gradient(top,#e9e9e9,#c7c7c7);background-image:-moz-linear-gradient(top,#e9e9e9,#c7c7c7);background-image:-o-linear-gradient(top,#e9e9e9,#c7c7c7);background-image:-webkit-gradient(linear,left top,left bottom,from(#e9e9e9),to(#c7c7c7));background-image:-webkit-linear-gradient(top,#e9e9e9,#c7c7c7);background-image:linear-gradient(top,#e9e9e9,#c7c7c7);border-color:#aeaeae}.cpac-column.opened .column-meta table{background:0 0}.cpac-column.opened .column-meta table td{border-color:#f8f8f8;color:#333;text-shadow:0 1px 0 #FFF}.cpac-column.opened .column-meta table td a{color:#333;text-shadow:0 1px 0 #FFF}.cpac-column.opened .column-meta table td.column_sort{background-position:8px -39px}.cpac-column.opened .column-meta table td.column_label .inner .meta span{color:grey;text-shadow:none}.cpac-column.opened .column-meta table td.column_type{color:#5C5C5C}.column-footer{background:#EAF2FA;border:1px solid #c7d7e2;min-height:26px;padding:8px}.column-footer .order-message{background:url(../images/order_arrow.png) no-repeat;color:#7A9BBE;float:left;font-family:Comic Sans MS,sans-serif;font-size:11px;height:13px;line-height:1em;margin-left:4px;padding:7px 0 0 22px;text-shadow:0 1px 0 #FFF;display:inline-block}.column-footer .button-container{float:right;display:inline-block;margin-top:-5px}.column-footer .button-container a{display:inline-block;margin-top:5px}.cpac-content-body hr{-moz-border-bottom-colors:none;-moz-border-left-colors:none;-moz-border-right-colors:none;-moz-border-top-colors:none;background:none;border-color:#DFDFDF -moz-use-text-color -moz-use-text-color;border-image:none;border-right:0 none;border-style:solid none none;border-width:1px 0 0;clear:both;margin:30px 0;opacity:.2}#cpac-welcome.about-wrap div.error{display:block!important}.cpac-alert{display:inline-block;background:#FCF8E3;border:1px solid #FBEED5;border-radius:4px;color:#C09853;margin:20px 0;padding:16px 14px;text-shadow:0 1px 0 rgba(255,255,255,.5)}.cpac-alert p{margin:0}.cpac-alert.cpac-alert-success{background-color:#DFF0D8;border-color:#D6E9C6;color:#468847}.cpac-alert.cpac-alert-error{background-color:#F2DEDE;border-color:#EED3D7;color:#B94A48}.cpac-alert a.button-primary{height:28px;line-height:28px;display:inline-block}#cpac-download-add-ons-table{max-width:600px}.wp-core-ui .button-large{height:40px;line-height:40px;font-size:16px;padding:0 15px;text-shadow:0 1px 0 rgba(0,0,0,.5)}.cac-notification.updated{border-left-color:#0071aa}.cac-notification.updated .learnmore{float:right}.cac-notification.updated .learnmore:after{content:"\f139";font:400 20px/1 dashicons;float:right}.columns-right{margin-top:54px}.columns-right .sidebox{background:#FFF;border:1px solid #E1E1E1;border-radius:0;position:relative;margin-bottom:14px}.columns-right .sidebox h3{padding:10px;margin:0}.columns-right .sidebox h3.title{font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;font-size:15px;font-weight:400;line-height:1;margin:0;padding:7px 10px;background:#f1f1f1;background-image:-webkit-gradient(linear,left bottom,left top,from(#ececec),to(#f9f9f9));background-image:-webkit-linear-gradient(bottom,#ececec,#f9f9f9);background-image:-moz-linear-gradient(bottom,#ececec,#f9f9f9);background-image:-o-linear-gradient(bottom,#ececec,#f9f9f9);background-image:linear-gradient(to top,#ececec,#f9f9f9);border-bottom-color:#dfdfdf;text-shadow:#fff 0 1px 0;-webkit-box-shadow:0 1px 0 #fff;box-shadow:0 1px 0 #fff;border-bottom-style:solid;border-bottom-width:1px}.columns-right .sidebox .inside{padding:10px}.columns-right .sidebox .inside p{margin-top:0}.columns-right .sidebox#form-actions .form-reset{border-bottom:1px solid #F5F5F5;padding:8px}.columns-right .sidebox#form-actions .reset-column-type{text-decoration:none;color:#BC0B0B;line-height:25px;display:inline-block}.columns-right .sidebox#form-actions .form-update{padding:8px;overflow:hidden}.columns-right .sidebox#form-actions .submit-update{display:block;width:100%;height:28px;line-height:28px;text-align:center}.columns-right .sidebox#pro-version .cta{background:url(../images/get_the_addon.png) no-repeat;background-size:cover}.columns-right .sidebox#pro-version .padding-box{padding:8px 15px 0}.columns-right .sidebox#pro-version h3 a{color:#fff;font-size:19px;text-decoration:none;font-weight:400;margin-top:6px}.columns-right .sidebox#pro-version .inside ul{margin:0 0 10px}.columns-right .sidebox#pro-version .inside ul li{margin:0;padding:0}.columns-right .sidebox#pro-version .inside ul li a{display:inline-block;min-height:24px;font-size:19px;line-height:24px;margin-bottom:1px;padding:0 5px;background:#000;color:#fff;text-decoration:none}.columns-right .sidebox#pro-version .inside ul li.acf a{background-color:#5ee8bf;color:grey}.columns-right .sidebox#pro-version .inside p{color:#fff;font-size:12px}.columns-right .sidebox#pro-version .inside p a{color:#fff;display:inline-block;background:#a4c518;padding:0 2px;font-size:15px;text-decoration:none}.columns-right .sidebox#add-acf{background-color:#5ee8bf}.columns-right .sidebox#add-acf h3{padding:0}.columns-right .sidebox#add-acf h3 a{color:#fff;text-decoration:none;font-size:15px}.columns-right .sidebox#direct-feedback #feedback-rate,.columns-right .sidebox#direct-feedback #feedback-support{display:none}.columns-right .sidebox#direct-feedback .inside>a{border-radius:4px;border:1px solid #CCC;width:48%;height:64px;text-align:center;line-height:64px;font-weight:700;color:#222;display:inline-block;text-decoration:none}.columns-right .sidebox#direct-feedback .inside>a:hover{background:#FAFAFA}.columns-right .sidebox#direct-feedback .inside form textarea{width:100%;height:120px}.columns-right .sidebox#direct-feedback .inside form input[type=submit]{float:right;border-radius:4px;border:1px solid #CCC;height:32px;text-align:center;line-height:32px;font-weight:700;font-size:12px;padding:0 32px;color:#CCC;display:inline-block;background:0 0;text-decoration:none;cursor:pointer}.columns-right .sidebox#direct-feedback .inside form input[type=submit]:hover,.columns-right .sidebox#direct-feedback .inside ul.share li a:hover{background:#FAFAFA}.columns-right .sidebox#direct-feedback .inside form p.description{float:left;font-size:10px}.columns-right .sidebox#direct-feedback .inside ul{margin:0}.columns-right .sidebox#direct-feedback .inside ul.share li{margin:0 0 0 9px;display:block;float:left;width:30%}.columns-right .sidebox#direct-feedback .inside ul.share li a{text-decoration:none;vertical-align:middle;line-height:20px;padding:16px 0;width:100%;text-align:center;border:1px solid #CCC;border-radius:4px;display:block}.columns-right .sidebox#direct-feedback .inside ul.share li:first-child{margin-left:0}.columns-right .sidebox#direct-feedback #feedback-support .inside ul.share li{width:48%}table.cpac-form-table{max-width:1100px;margin-top:20px}table.cpac-form-table>tbody>tr>td,table.cpac-form-table>tbody>tr>th{vertical-align:top}table.cpac-form-table td.padding-22{padding-top:22px}table.cpac-form-table td .cpac_export .ms-container{background:url(../images/switch_bw.png) 50% 50% no-repeat}table.cpac-form-table td .cpac_export .ms-container .ms-selectable{width:48%;margin-right:0}table.cpac-form-table td .cpac_export .ms-container .ms-selection{float:right;width:48%}table.cpac-form-table td .cpac_export .ms-container ul.ms-list{width:100%}table.cpac-form-table td .cpac_export .ms-container ul.ms-list li{margin:0;padding-top:5px;padding-bottom:5px}table.cpac-form-table.settings tr td{padding-top:74px}table.cpac-form-table.settings tr:first-child th{padding-top:0}table.cpac-form-table.settings tr:first-child td{padding-top:54px}.wp-pointer-content ol{margin-left:1.5em;padding:0 15px}.wp-pointer-right{margin-right:15px}body.rtl .wp-pointer-right{margin-left:15px;margin-right:0}body.rtl .wp-pointer-right ol{margin-right:1.5em;margin-left:0}body.rtl .cpac-menu .subsubsub{margin-left:14px;margin-right:0}body.rtl .columns-container{margin-left:300px;margin-right:0}body.rtl .columns-left{float:right}body.rtl .columns-left .cpac-columns .cpac-column .column-meta img{margin-left:3px;margin-right:0}body.rtl .columns-left .cpac-columns .cpac-column .column-meta .column_label .inner>a.remove-button{margin-right:12px;margin-left:0}body.rtl .columns-left .cpac-columns .cpac-column .column-meta .column_label .inner .meta{float:left}body.rtl .columns-left .cpac-columns .cpac-column .column-meta .column_label span.vers{float:right}body.rtl .columns-left .cpac-columns .cpac-column .column-form table tr td.label a.more-info,body.rtl .columns-left .cpac-columns .cpac-column .column-meta span.vers .comment-grey-bubble{float:left}body.rtl .columns-left .cpac-columns .cpac-column .column-meta .column_type{text-align:left;padding-left:0;padding-right:auto}body.rtl .columns-left .cpac-columns .cpac-column .column-form table tr.column_image_size td.input label input{margin-left:3px;margin-right:0}body.rtl .columns-left .cpac-columns .cpac-column .column-form table tr td.label p.description{right:0;left:auto}body.rtl .columns-left .cpac-columns .cpac-column .column-form div.description,body.rtl .columns-left .cpac-columns .cpac-column .column-form div.input-width-range{float:right}body.rtl .columns-left .cpac-columns .cpac-column .column-form tr td.input label{padding-left:10px;padding-right:0}body.rtl .columns-left .cpac-columns .cpac-column .column-form a.help{float:left}body.rtl .columns-left .column-footer .order-message{float:right;padding-right:22px;padding-left:0;background:url(../images/order_arrow-rtl.png) right top no-repeat}body.rtl .columns-left .column-footer .button-container,body.rtl .cpac_export .ms-container .ms-selection{float:left}body.rtl .columns-right{float:left;margin-left:-300px;margin-right:0}body.rtl .cpac-placeholder{padding:5px 0 7px 4px}@media only screen and (max-width:900px){.columns-container{margin-right:0}.columns-container .columns-left{float:none}.columns-container .columns-right{float:none;margin-top:0;margin-right:0;width:100%}.columns-container .columns-right .columns-right-inside.fixed{position:relative;top:0;width:100%}}.cpac-addons li{width:200px;background:#FFF;float:left;margin-right:16px;margin-bottom:16px;border:1px solid #DDD;-webkit-box-shadow:0 3px 10px 0 rgba(0,0,0,.15);-moz-box-shadow:0 3px 10px 0 rgba(0,0,0,.15);box-shadow:0 3px 10px 0 rgba(0,0,0,.15)}.cpac-addons li:hover{-webkit-box-shadow:0 3px 10px 0 rgba(0,0,0,.25);-moz-box-shadow:0 3px 10px 0 rgba(0,0,0,.25);box-shadow:0 3px 10px 0 rgba(0,0,0,.25)}.cpac-addons li a{color:#444}.cpac-addons li .cpac-addon-content{display:table;width:100%;height:125px;text-align:center;vertical-align:middle;border-top:1px solid #DDD;background:#0069a4;background:-moz-radial-gradient(center,ellipse cover,#0069a4 0,#085079 100%);background:-webkit-gradient(radial,center center,0,center center,100%,color-stop(0,#0069a4),color-stop(100%,#085079));background:-webkit-radial-gradient(center,ellipse cover,#0069a4 0,#085079 100%);background:-o-radial-gradient(center,ellipse cover,#0069a4 0,#085079 100%);background:-ms-radial-gradient(center,ellipse cover,#0069a4 0,#085079 100%);background:radial-gradient(ellipse at center,#0069a4 0,#085079 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#0069a4', endColorstr='#085079', GradientType=1)}.cpac-addons li .cpac-addon-content>*{display:table-cell;vertical-align:middle}.cpac-addons li .cpac-addon-content h3{padding:0 16px;color:#FFF;line-height:150%}.cpac-addons li .cpac-addon-content img{width:100%}.cpac-addons li .cpac-addon-header{width:100%;padding:25px 15px;-moz-box-sizing:border-box;box-sizing:border-box}.cpac-addons li .cpac-addon-header>:first-child{margin-top:0}.cpac-addons li .cpac-addon-header>:last-child{margin-bottom:0}.cpac-addons li .cpac-addon-actions{background:#EEE;border-top:1px solid #DDD;padding:8px}.cpac-addons li .cpac-addon-actions .cpac-installed:before{content:"\f147";font-family:dashicons;vertical-align:middle;margin-left:-5px;margin-right:3px}
1
+ .button.loading span,.cpac-column .comment-grey-bubble,.icon-no,.icon-yes,a.help{height:16px;width:16px}#cpac a:active,#cpac a:focus{outline:0}#cpac h2.cpac-nav-tab-wrapper{margin-bottom:10px}#icon-codepress-admin-columns{background:url(../images/icon.png) no-repeat}.cpac-settings-link{float:right;margin:12px 14px 5px 0;background:url(../images/settings.png) no-repeat;padding-left:20px;text-decoration:none;display:inline-block;line-height:16px}.cpac-settings-link.current{font-weight:700}.rtl .cpac-settings-link{float:left;margin:12px 0 5px 14px;padding-right:20px;padding-left:0}a.help{background:url(../images/help.png) no-repeat;display:inline-block}.button.loading{padding-right:25px;position:relative}.rtl .button.loading{padding-left:25px;padding-right:0}.button.loading span{position:absolute;top:2px;right:6px;background:url(../images/loading.gif) right 50% no-repeat;display:inline-block}.icon-no,.icon-yes{display:inline-block;position:relative}.rtl .button.loading span{left:6px;right:auto}.cpac_message.error.warning{border-left:4px solid #ffba00}.icon-yes{background:url(../images/yes.png) no-repeat;top:2px}.icon-no{background:url(../images/no.png) no-repeat;top:2px}.cpac-column .comment-grey-bubble:before{content:'\f101';font:400 20px/.5 dashicons;speak:none;display:inline-block;padding:0;top:4px;left:0;position:relative;vertical-align:top;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none!important}.rtl .cpac-column .comment-grey-bubble:before{right:0;left:auto}.cpac-menu{clear:both;overflow:hidden;margin-bottom:10px}.cpac-menu .subsubsub{white-space:normal;width:100%;margin:0 14px 0 0}.cpac-menu .subsubsub li.first{font-weight:700;min-width:100px}.columns-container{margin-right:300px;max-width:700px}.columns-container .columns-left{float:left;width:100%}.columns-container .columns-right{float:right;margin-right:-300px;width:280px}.columns-container .columns-right .columns-right-inside.fixed{position:fixed;top:40px;width:280px}.ui-sortable-helper{-webkit-box-shadow:1px 3px 6px 0 rgba(1,1,1,.4);box-shadow:1px 3px 6px 0 rgba(1,1,1,.4)}.columns-left .cpac-boxes .cpac-columns form,.columns-right .sidebox{box-shadow:0 1px 3px rgba(0,0,0,.1)}.ui-sortable-helper .column-meta{border-width:1px}.cpac-placeholder{visibility:visible!important;border-top:1px solid #dfdfdf;padding:5px 4px 7px 0}.cpac-placeholder .inner-placeholder{border:1px dashed grey;background:#eee;width:100%;height:100%}.cpac-placeholder :first-child{border:none}.cpac-column .column-meta{border-style:solid;border-color:#dfdfdf;border-width:1px 1px 0;background:#fcfcfc}.cpac-column .column-meta:nth-child(2n) .column-meta{background:#f9f9f9}.cpac-column .column-meta img{margin-right:3px}.cpac-column .column-meta table{border:none;background:0 0;border-radius:0}.cpac-column .column-meta table tr td{vertical-align:top;height:18px;border:none solid transparent;padding:11px 8px;border-width:1px 0 0}.cpac-column .column-meta table tr td.column_sort{width:10px;background:url(../images/drag.png) 8px 8px no-repeat;cursor:move}.cpac-column .column-meta table tr td.column_label{width:70%;font-weight:700;vertical-align:middle;position:relative}.cpac-column .column-meta table tr td.column_label .inner{position:relative;overflow:hidden;height:18px}.cpac-column .column-meta table tr td.column_label .inner>a{color:#5a5a5a;padding:0 4px}.cpac-column .column-meta table tr td.column_label .inner>a:hover{color:#333}.cpac-column .column-meta table tr td.column_label .inner>a.clone-button,.cpac-column .column-meta table tr td.column_label .inner>a.edit-button,.cpac-column .column-meta table tr td.column_label .inner>a.remove-button{display:none;color:#a00;text-decoration:none;text-shadow:none;font-weight:400;margin-left:5px;font-size:12px}.cpac-column .column-meta table tr td.column_label .inner>a.clone-button:hover,.cpac-column .column-meta table tr td.column_label .inner>a.edit-button:hover,.cpac-column .column-meta table tr td.column_label .inner>a.remove-button:hover{color:red}.cpac-column .column-meta table tr td.column_label .inner>a.clone-button,.cpac-column .column-meta table tr td.column_label .inner>a.edit-button{color:#0074a2}.cpac-column .column-meta table tr td.column_label .inner>a.clone-button:hover,.cpac-column .column-meta table tr td.column_label .inner>a.edit-button:hover{color:#2ea2cc}.cpac-column .column-meta table tr td.column_label .inner .meta{display:inline-block;float:right;font-weight:400;color:#b2b2b2;font-size:12px}.cpac-column .column-meta table tr td.column_label .inner .meta span{cursor:pointer}.cpac-column .column-meta table tr td.column_label .inner .meta span.width{margin-right:5px;cursor:auto;color:#737373}.cpac-column .column-meta table tr td.column_label span.vers{float:left}.cpac-column .column-meta table tr td.column_type{width:auto;min-width:120px;text-align:right;vertical-align:middle;color:#999;padding-right:0}.cpac-column .column-meta table tr td.column_type .inner{height:18px;overflow:hidden}.cpac-column .column-meta table tr td.column_type .inner a{color:#999}.cpac-column .column-meta table tr td.column_edit{width:38px;min-width:38px;background:url(../images/arrow.png) 23px 18px no-repeat;cursor:pointer}.cpac-column .column-meta:hover .column_label .inner>a.clone-button,.cpac-column .column-meta:hover .column_label .inner>a.edit-button,.cpac-column .column-meta:hover .column_label .inner>a.remove-button{display:inline-block}.cpac-column .column-meta span.vers{padding-top:2px}.cpac-column .column-meta span.vers .comment-grey-bubble{float:right}.cpac-column .column-form{display:none;border-width:1px 1px 0;border-style:solid;border-color:#dfdfdf;position:relative}.cpac-column .column-form table{border:none;background:#fcfcfc}.cpac-column .column-form table tr.hide{display:none}.cpac-column .column-form table tr td{vertical-align:top;border:none;padding:8px;background:#fff;border-top:1px solid #F5F5F5}.cpac-column .column-form table tr td input[type=text],.cpac-column .column-form table tr td select{width:99.95%}.cpac-column .column-form table tr td input[type=text].small,.cpac-column .column-form table tr td select.small{width:100px}.cpac-column .column-form table tr td span.suffix{line-height:40px;color:grey}.cpac-column .column-form table tr td select optgroup:nth-child(2n){background:#F9F9F9}.cpac-column .column-form table tr td.label{position:relative;overflow:visible;background:#f5f5f5;border-right:1px solid #E1E1E1;vertical-align:top;width:34%;border-top:1px solid #F0F0F0}.column-footer,.wp-pointer-content{overflow:hidden}.cpac-column .column-form table tr td.label label{font-weight:700;color:#333;display:block;position:relative}.cpac-column .column-form table tr td.label p{color:#666;display:block;font-size:12px;font-style:normal;line-height:16px;margin:0!important}.cpac-column .column-form table tr td.label p.description{display:none;position:absolute;z-index:99;top:30px;left:0;background:#eaf2fa;border-radius:5px;border:1px solid #c7d7e2;padding:5px 8px!important;font-weight:400}.cpac-column .column-form table tr td.label p.description em{display:block;color:#999}.cpac-column .column-form table tr td.label .info{position:absolute;top:0;left:0;width:100%;height:100%;z-index:1}.cpac-column .column-form table tr td.label .info:before{position:absolute;z-index:1;right:10px;top:50%;margin-top:-7px;content:'';display:block;border-radius:32px;border:1px solid #E6E6E6;width:12px;height:12px}.cpac-column .column-form table tr td.label .info:after{position:absolute;z-index:1;right:10px;top:50%;margin-top:-6px;content:'?';display:block;width:14px;height:14px;color:#E6E6E6;font:700 10px Arial;text-align:center;vertical-align:middle;line-height:14px}.cpac-column .column-form table tr td.input label{padding-left:10px;padding-right:0}.cpac-column .column-form table tr td.input div.msg{margin-top:5px;display:none;color:#333;padding:6px 8px;background-color:#ffebe8;border:1px solid #fff;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px}.cpac-column .column-form table tr td.input .section{padding:12px}.cpac-column .column-form table tr.column_width .input{position:relative}.cpac-column .column-form table tr.column_width .input div.description{font-size:11px;width:54px;position:absolute;left:10px;text-align:middle}.cpac-column .column-form table tr.column_width .input div.description input{background:#efefef;border:none;height:20px;line-height:20px;text-align:right;width:36px;font-size:12px}.cpac-column .column-form table tr.column_width .input div.width-slider{margin-left:60px;margin-right:100px;position:relative;margin-top:4px}.cpac-column .column-form table tr.column_width .input div.width-slider .ui-slider-handle{cursor:ew-resize}.cpac-column .column-form table tr.column_width .input div.unit-select{position:absolute;top:8px;right:10px;width:90px;text-align:right}.cpac-column .column-form table tr.column_width .input div.unit-select label{padding-left:5px}.cpac-column .column-form table tr.column_image_size{border:10px solid red}.cpac-column .column-form table tr.column_image_size td.input label.custom-size{display:inline-block;margin-top:4px;margin-bottom:4px}.cpac-column .column-form table tr.column_image_size td.input label.custom-size input{margin-right:3px}.cpac-column .column-form table tr.column_image_size td.input .custom_image_size{display:inline-block}.cpac-column .column-form table tr.column_image_size td.input .custom_image_size .custom-size-h.hidden,.cpac-column .column-form table tr.column_image_size td.input .custom_image_size .custom-size-w.hidden,.cpac-column .column-form table tr.column_image_size td.input .custom_image_size .hidden{display:none}.cpac-column .column-form table tr.column_image_size td.input .custom_image_size .custom-size-h,.cpac-column .column-form table tr.column_image_size td.input .custom_image_size .custom-size-w{margin:0}.cpac-column .column-form table tr.column_image_size td.input .custom_image_size .custom-size-h input[type=text],.cpac-column .column-form table tr.column_image_size td.input .custom_image_size .custom-size-w input[type=text]{margin-right:3px;width:40px!important}.cpac-column .column-form table tr.column_action td{background:#f9f9f9}.cpac-column .column-form table tr.column_action td p{margin:0}.cpac-column .column-form table tr.column_action td p a.remove-button{color:#a00;text-decoration:none;text-shadow:none;font-weight:400;margin-left:5px;font-size:12px;padding:0 5px}.cpac-column .column-form table tr.column_action td p a.remove-button:hover{color:#fff;background:red}.cpac-column .column-form table tr:first-child td{border-top:none}.cpac-column.loading .column-form>.spinner{position:absolute;left:50%;top:50%;z-index:200;margin-left:-10px;margin-top:-10px;display:block}.cpac-column.loading .column-form:before{content:'';position:absolute;width:100%;height:100%;background:#FFF;z-index:100;opacity:.5}.cpac-column.opened .column-meta{background-color:#c7c7c7;background-image:-ms-linear-gradient(top,#e9e9e9,#c7c7c7);background-image:-moz-linear-gradient(top,#e9e9e9,#c7c7c7);background-image:-o-linear-gradient(top,#e9e9e9,#c7c7c7);background-image:-webkit-gradient(linear,left top,left bottom,from(#e9e9e9),to(#c7c7c7));background-image:-webkit-linear-gradient(top,#e9e9e9,#c7c7c7);background-image:linear-gradient(top,#e9e9e9,#c7c7c7);border-color:#aeaeae}.cpac-column.opened .column-meta table{background:0 0}.cpac-column.opened .column-meta table td{border-color:#f8f8f8;color:#333;text-shadow:0 1px 0 #FFF}.cpac-column.opened .column-meta table td a{color:#333;text-shadow:0 1px 0 #FFF}.cpac-column.opened .column-meta table td.column_sort{background-position:8px -39px}.cpac-column.opened .column-meta table td.column_label .inner .meta span{color:grey;text-shadow:none}.cpac-column.opened .column-meta table td.column_type{color:#5C5C5C}.column-footer{background:#EAF2FA;border:1px solid #c7d7e2;min-height:26px;padding:8px}.column-footer .order-message{background:url(../images/order_arrow.png) no-repeat;color:#7A9BBE;float:left;font-family:Comic Sans MS,sans-serif;font-size:11px;height:13px;line-height:1em;margin-left:4px;padding:7px 0 0 22px;text-shadow:0 1px 0 #FFF;display:inline-block}.column-footer .button-container{float:right;display:inline-block;margin-top:-5px}.column-footer .button-container a{display:inline-block;margin-top:5px}.cpac-content-body hr{-moz-border-bottom-colors:none;-moz-border-left-colors:none;-moz-border-right-colors:none;-moz-border-top-colors:none;background:none;border-color:#DFDFDF -moz-use-text-color -moz-use-text-color;border-image:none;border-right:0 none;border-style:solid none none;border-width:1px 0 0;clear:both;margin:30px 0;opacity:.2}#cpac-welcome.about-wrap div.error{display:block!important}.cpac-alert{display:inline-block;background:#FCF8E3;border:1px solid #FBEED5;border-radius:4px;color:#C09853;margin:20px 0;padding:16px 14px;text-shadow:0 1px 0 rgba(255,255,255,.5)}.cpac-alert p{margin:0}.cpac-alert.cpac-alert-success{background-color:#DFF0D8;border-color:#D6E9C6;color:#468847}.cpac-alert.cpac-alert-error{background-color:#F2DEDE;border-color:#EED3D7;color:#B94A48}.cpac-alert a.button-primary{height:28px;line-height:28px;display:inline-block}#cpac-download-add-ons-table{max-width:600px}.wp-core-ui .button-large{height:40px;line-height:40px;font-size:16px;padding:0 15px;text-shadow:0 1px 0 rgba(0,0,0,.5)}.cac-notification.updated{border-left-color:#0071aa}.cac-notification.updated .learnmore{float:right}.cac-notification.updated .learnmore:after{content:"\f139";font:400 20px/1 dashicons;float:right}.columns-right{margin-top:54px}.columns-right .sidebox{background:#FFF;border:1px solid #E1E1E1;border-radius:0;position:relative;margin-bottom:14px}.columns-right .sidebox h3{padding:10px;margin:0}.columns-right .sidebox h3.title{font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif;font-size:15px;font-weight:400;line-height:1;margin:0;padding:7px 10px;background:#f1f1f1;background-image:-webkit-gradient(linear,left bottom,left top,from(#ececec),to(#f9f9f9));background-image:-webkit-linear-gradient(bottom,#ececec,#f9f9f9);background-image:-moz-linear-gradient(bottom,#ececec,#f9f9f9);background-image:-o-linear-gradient(bottom,#ececec,#f9f9f9);background-image:linear-gradient(to top,#ececec,#f9f9f9);border-bottom-color:#dfdfdf;text-shadow:#fff 0 1px 0;-webkit-box-shadow:0 1px 0 #fff;box-shadow:0 1px 0 #fff;border-bottom-style:solid;border-bottom-width:1px}.columns-right .sidebox .inside{padding:10px}.columns-right .sidebox .inside p{margin-top:0}.columns-right .sidebox#form-actions .form-reset{border-bottom:1px solid #F5F5F5;padding:8px}.columns-right .sidebox#form-actions .reset-column-type{text-decoration:none;color:#BC0B0B;line-height:25px;display:inline-block}.columns-right .sidebox#form-actions .form-update{padding:8px;overflow:hidden}.columns-right .sidebox#form-actions .submit-update{display:block;width:100%;height:28px;line-height:28px;text-align:center}.columns-right .sidebox#pro-version .cta{background:url(../images/get_the_addon.png) no-repeat;background-size:cover}.columns-right .sidebox#pro-version .padding-box{padding:8px 15px 0}.columns-right .sidebox#pro-version h3 a{color:#fff;font-size:19px;text-decoration:none;font-weight:400;margin-top:6px}.columns-right .sidebox#pro-version .inside ul{margin:0 0 10px}.columns-right .sidebox#pro-version .inside ul li{margin:0;padding:0}.columns-right .sidebox#pro-version .inside ul li a{display:inline-block;min-height:24px;font-size:19px;line-height:24px;margin-bottom:1px;padding:0 5px;background:#000;color:#fff;text-decoration:none}.columns-right .sidebox#pro-version .inside ul li.acf a{background-color:#5ee8bf;color:grey}.columns-right .sidebox#pro-version .inside p{color:#fff;font-size:12px}.columns-right .sidebox#pro-version .inside p a{color:#fff;display:inline-block;background:#a4c518;padding:0 2px;font-size:15px;text-decoration:none}.columns-right .sidebox#add-acf{background-color:#5ee8bf}.columns-right .sidebox#add-acf h3{padding:0}.columns-right .sidebox#add-acf h3 a{color:#fff;text-decoration:none;font-size:15px}.columns-right .sidebox#direct-feedback #feedback-rate,.columns-right .sidebox#direct-feedback #feedback-support{display:none}.columns-right .sidebox#direct-feedback .inside>a{border-radius:4px;border:1px solid #CCC;width:48%;height:64px;text-align:center;line-height:64px;font-weight:700;color:#222;display:inline-block;text-decoration:none}.columns-right .sidebox#direct-feedback .inside>a:hover{background:#FAFAFA}.columns-right .sidebox#direct-feedback .inside form textarea{width:100%;height:120px}.columns-right .sidebox#direct-feedback .inside form input[type=submit]{float:right;border-radius:4px;border:1px solid #CCC;height:32px;text-align:center;line-height:32px;font-weight:700;font-size:12px;padding:0 32px;color:#CCC;display:inline-block;background:0 0;text-decoration:none;cursor:pointer}.columns-right .sidebox#direct-feedback .inside form input[type=submit]:hover,.columns-right .sidebox#direct-feedback .inside ul.share li a:hover{background:#FAFAFA}.columns-right .sidebox#direct-feedback .inside form p.description{float:left;font-size:10px}.columns-right .sidebox#direct-feedback .inside ul{margin:0}.columns-right .sidebox#direct-feedback .inside ul.share li{margin:0 0 0 9px;display:block;float:left;width:30%}.columns-right .sidebox#direct-feedback .inside ul.share li a{text-decoration:none;vertical-align:middle;line-height:20px;padding:16px 0;width:100%;text-align:center;border:1px solid #CCC;border-radius:4px;display:block}.columns-right .sidebox#direct-feedback .inside ul.share li:first-child{margin-left:0}.columns-right .sidebox#direct-feedback #feedback-support .inside ul.share li{width:48%}table.cpac-form-table{max-width:1100px;margin-top:20px}table.cpac-form-table>tbody>tr>td,table.cpac-form-table>tbody>tr>th{vertical-align:top}table.cpac-form-table td.padding-22{padding-top:22px}table.cpac-form-table td .cpac_export .ms-container{background:url(../images/switch_bw.png) 50% 50% no-repeat}table.cpac-form-table td .cpac_export .ms-container .ms-selectable{width:48%;margin-right:0}table.cpac-form-table td .cpac_export .ms-container .ms-selection{float:right;width:48%}table.cpac-form-table td .cpac_export .ms-container ul.ms-list{width:100%}table.cpac-form-table td .cpac_export .ms-container ul.ms-list li{margin:0;padding-top:5px;padding-bottom:5px}table.cpac-form-table.settings tr td{padding-top:74px}table.cpac-form-table.settings tr:first-child th{padding-top:0}table.cpac-form-table.settings tr:first-child td{padding-top:54px}.wp-pointer-content ol{margin-left:1.5em;padding:0 15px}.wp-pointer-right{margin-right:15px}body.rtl .wp-pointer-right{margin-left:15px;margin-right:0}body.rtl .wp-pointer-right ol{margin-right:1.5em;margin-left:0}body.rtl .cpac-menu .subsubsub{margin-left:14px;margin-right:0}body.rtl .columns-container{margin-left:300px;margin-right:0}body.rtl .columns-left{float:right}body.rtl .columns-left .cpac-columns .cpac-column .column-meta img{margin-left:3px;margin-right:0}body.rtl .columns-left .cpac-columns .cpac-column .column-meta .column_label .inner>a.remove-button{margin-right:12px;margin-left:0}body.rtl .columns-left .cpac-columns .cpac-column .column-meta .column_label .inner .meta{float:left}body.rtl .columns-left .cpac-columns .cpac-column .column-meta .column_label span.vers{float:right}body.rtl .columns-left .cpac-columns .cpac-column .column-form table tr td.label a.more-info,body.rtl .columns-left .cpac-columns .cpac-column .column-meta span.vers .comment-grey-bubble{float:left}body.rtl .columns-left .cpac-columns .cpac-column .column-meta .column_type{text-align:left;padding-left:0;padding-right:auto}body.rtl .columns-left .cpac-columns .cpac-column .column-form table tr.column_image_size td.input label input{margin-left:3px;margin-right:0}body.rtl .columns-left .cpac-columns .cpac-column .column-form table tr td.label p.description{right:0;left:auto}body.rtl .columns-left .cpac-columns .cpac-column .column-form div.description,body.rtl .columns-left .cpac-columns .cpac-column .column-form div.input-width-range{float:right}body.rtl .columns-left .cpac-columns .cpac-column .column-form tr td.input label{padding-left:10px;padding-right:0}body.rtl .columns-left .cpac-columns .cpac-column .column-form a.help{float:left}body.rtl .columns-left .column-footer .order-message{float:right;padding-right:22px;padding-left:0;background:url(../images/order_arrow-rtl.png) right top no-repeat}body.rtl .columns-left .column-footer .button-container,body.rtl .cpac_export .ms-container .ms-selection{float:left}body.rtl .columns-right{float:left;margin-left:-300px;margin-right:0}body.rtl .cpac-placeholder{padding:5px 0 7px 4px}@media only screen and (max-width:900px){.columns-container{margin-right:0}.columns-container .columns-left{float:none}.columns-container .columns-right{float:none;margin-top:0;margin-right:0;width:100%}.columns-container .columns-right .columns-right-inside.fixed{position:relative;top:0;width:100%}}.cpac-addons li{width:200px;background:#FFF;float:left;margin-right:16px;margin-bottom:16px;border:1px solid #DDD;-webkit-box-shadow:0 3px 10px 0 rgba(0,0,0,.15);-moz-box-shadow:0 3px 10px 0 rgba(0,0,0,.15);box-shadow:0 3px 10px 0 rgba(0,0,0,.15)}.cpac-addons li:hover{-webkit-box-shadow:0 3px 10px 0 rgba(0,0,0,.25);-moz-box-shadow:0 3px 10px 0 rgba(0,0,0,.25);box-shadow:0 3px 10px 0 rgba(0,0,0,.25)}.cpac-addons li a{color:#444}.cpac-addons li .cpac-addon-content{display:table;width:100%;height:125px;text-align:center;vertical-align:middle;border-top:1px solid #DDD;background:#0069a4;background:-moz-radial-gradient(center,ellipse cover,#0069a4 0,#085079 100%);background:-webkit-gradient(radial,center center,0,center center,100%,color-stop(0,#0069a4),color-stop(100%,#085079));background:-webkit-radial-gradient(center,ellipse cover,#0069a4 0,#085079 100%);background:-o-radial-gradient(center,ellipse cover,#0069a4 0,#085079 100%);background:-ms-radial-gradient(center,ellipse cover,#0069a4 0,#085079 100%);background:radial-gradient(ellipse at center,#0069a4 0,#085079 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#0069a4', endColorstr='#085079', GradientType=1)}.cpac-addons li .cpac-addon-content>*{display:table-cell;vertical-align:middle}.cpac-addons li .cpac-addon-content h3{padding:0 16px;color:#FFF;line-height:150%}.cpac-addons li .cpac-addon-content img{width:100%}.cpac-addons li .cpac-addon-header{width:100%;padding:25px 15px;-moz-box-sizing:border-box;box-sizing:border-box}.cpac-addons li .cpac-addon-header>:first-child{margin-top:0}.cpac-addons li .cpac-addon-header>:last-child{margin-bottom:0}.cpac-addons li .cpac-addon-actions{background:#EEE;border-top:1px solid #DDD;padding:8px}.cpac-addons li .cpac-addon-actions .cpac-installed:before{content:"\f147";font-family:dashicons;vertical-align:middle;margin-left:-5px;margin-right:3px}
assets/css/column.css CHANGED
@@ -9,10 +9,32 @@
9
span.status-closed {
10
color: red;
11
}
12
.tablenav.top .cpac-edit {
13
- top: 0;
14
display: inline-block;
15
- vertical-align: bottom;
16
}
17
/* =General Column
18
-------------------------------------------------------------- */
@@ -34,6 +56,7 @@ span.status-closed {
34
background: transparent;
35
margin-right: 2px;
36
overflow: hidden;
37
}
38
.rtl .cpac-column-value-image {
39
margin-left: 2px;
9
span.status-closed {
10
color: red;
11
}
12
+ .actions #post-query-submit {
13
+ float: left;
14
+ vertical-align: middle;
15
+ margin-bottom: 4px;
16
+ }
17
.tablenav.top .cpac-edit {
18
+ top: 2px;
19
display: inline-block;
20
+ vertical-align: middle;
21
+ float: left;
22
+ margin-bottom: 4px;
23
+ }
24
+ @media screen and (max-width: 782px) {
25
+ .tablenav.top .actions {
26
+ display: block !important;
27
+ margin-bottom: 4px;
28
+ }
29
+ .tablenav.top .actions * {
30
+ display: none;
31
+ }
32
+ .tablenav.top .actions .cpac-edit {
33
+ display: inline-block;
34
+ }
35
+ }
36
+ body.upload-php .tablenav.top .cpac-edit {
37
+ float: none;
38
}
39
/* =General Column
40
-------------------------------------------------------------- */
56
background: transparent;
57
margin-right: 2px;
58
overflow: hidden;
59
+ max-width: 100%;
60
}
61
.rtl .cpac-column-value-image {
62
margin-left: 2px;
assets/css/column.min.css CHANGED
@@ -1 +1 @@
1
- .cpac-divider{display:inline-block;width:14px;height:12px;background:url(../images/square.png) 50% 7px no-repeat}span.status-closed{color:red}.tablenav.top .cpac-edit{top:0;display:inline-block;vertical-align:bottom}.cpac-rounded{display:inline-block;border-radius:10px;min-width:8px;padding:0 6px;height:20px;background-color:#e0e0e0;text-align:center;margin-left:8px;font-size:12px}.cpac-column-value-image{display:inline-block;background:0 0;margin-right:2px;overflow:hidden}.rtl .cpac-column-value-image{margin-left:2px;margin-right:0}.cpac-column-value-image img{display:block;margin:0 auto}.column-column-attachment img{padding-right:5px;padding-bottom:4px}.rtl .column-column-attachment img{padding-left:5px;padding-right:0}div.cpac-color{line-height:26px}div.cpac-color span{display:block;-webkit-border-radius:3px;border-radius:3px;color:#fff;float:left;height:16px;line-height:16px;margin-right:12px;overflow:hidden;padding:4px 5px;font-size:10px;font-family:Monaco,Menlo,Consolas,"Courier New",monospace;min-width:47px;text-align:center}.rtl div.cpac-color span{float:right;margin-left:12px;margin-right:0}div.sizes span.not-available{color:#999}.button.cpac-button-action{position:relative;text-indent:9999px;margin-right:4px;padding:0 13px;overflow:hidden}.button.cpac-button-action:before{position:absolute;top:0;left:0;width:100%;height:100%;text-indent:0}.cpac-tip{display:inline-block}.qtip.qtip-tipsy{background:rgba(0,0,0,.75);font-weight:400;min-width:25px}
1
+ .actions #post-query-submit,.tablenav.top .cpac-edit{vertical-align:middle;float:left;margin-bottom:4px}.cpac-divider{display:inline-block;width:14px;height:12px;background:url(../images/square.png) 50% 7px no-repeat}span.status-closed{color:red}.tablenav.top .cpac-edit{top:2px;display:inline-block}@media screen and (max-width:782px){.tablenav.top .actions{display:block!important;margin-bottom:4px}.tablenav.top .actions *{display:none}.tablenav.top .actions .cpac-edit{display:inline-block}}body.upload-php .tablenav.top .cpac-edit{float:none}.cpac-rounded{display:inline-block;border-radius:10px;min-width:8px;padding:0 6px;height:20px;background-color:#e0e0e0;text-align:center;margin-left:8px;font-size:12px}.cpac-column-value-image{display:inline-block;background:0 0;margin-right:2px;overflow:hidden;max-width:100%}.rtl .cpac-column-value-image{margin-left:2px;margin-right:0}.cpac-column-value-image img{display:block;margin:0 auto}.column-column-attachment img{padding-right:5px;padding-bottom:4px}.rtl .column-column-attachment img{padding-left:5px;padding-right:0}div.cpac-color{line-height:26px}div.cpac-color span{display:block;-webkit-border-radius:3px;border-radius:3px;color:#fff;float:left;height:16px;line-height:16px;margin-right:12px;overflow:hidden;padding:4px 5px;font-size:10px;font-family:Monaco,Menlo,Consolas,"Courier New",monospace;min-width:47px;text-align:center}.rtl div.cpac-color span{float:right;margin-left:12px;margin-right:0}div.sizes span.not-available{color:#999}.button.cpac-button-action{position:relative;text-indent:9999px;margin-right:4px;padding:0 13px;overflow:hidden}.button.cpac-button-action:before{position:absolute;top:0;left:0;width:100%;height:100%;text-indent:0}.cpac-tip{display:inline-block}.qtip.qtip-tipsy{background:rgba(0,0,0,.75);font-weight:400;min-width:25px}
classes/addons.php CHANGED
@@ -9,6 +9,13 @@ class CPAC_Addons {
9
*/
10
private $cpac;
11
12
/**
13
* @since 2.2
14
*
@@ -25,6 +32,127 @@ class CPAC_Addons {
25
26
// Handle install request
27
add_action( 'admin_init', array( $this, 'handle_install_request' ) );
28
}
29
30
/**
@@ -39,13 +167,13 @@ class CPAC_Addons {
39
}
40
41
if ( ! $this->get_addon( $_GET['plugin'] ) ) {
42
- cpac_admin_message( 'Addon does not exist.', 'error' );
43
44
return;
45
}
46
47
if ( ! class_exists( 'CAC_Addon_Pro', false ) ) {
48
- cpac_admin_message( 'You need Admin Columns Pro.', 'error' );
49
50
return;
51
}
9
*/
10
private $cpac;
11
12
+ /**
13
+ * User meta key for hiding "Install addons" notice
14
+ *
15
+ * @since 2.4.9
16
+ */
17
+ const OPTION_ADMIN_NOTICE_INSTALL_ADDONS_KEY = 'cpac-hide-install-addons-notice';
18
+
19
/**
20
* @since 2.2
21
*
32
33
// Handle install request
34
add_action( 'admin_init', array( $this, 'handle_install_request' ) );
35
+ add_action( 'admin_notices', array( $this, 'missing_addon_notices' ) );
36
+ add_action( 'wp_ajax_cpac_hide_install_addons_notice', array( $this, 'ajax_hide_install_addons_notice' ) );
37
+ }
38
+
39
+ /**
40
+ * Possibly adds an admin notice when a third party plugin supported by an addon is installed, but the addon isn't
41
+ *
42
+ * @since 2.4.9
43
+ */
44
+ public function missing_addon_notices() {
45
+
46
+ if ( get_user_meta( get_current_user_id(), self::OPTION_ADMIN_NOTICE_INSTALL_ADDONS_KEY, true ) ) {
47
+ return;
48
+ }
49
+
50
+ $plugins = array();
51
+
52
+ if ( $this->cpac->is_plugin_acf_active() && ! class_exists( 'CPAC_Addon_ACF' ) ) {
53
+ $plugins[] = __( 'Advanced Custom Fields', 'codepress-admin-columns' );
54
+ }
55
+
56
+ if ( $this->cpac->is_plugin_woocommerce_active() && ! class_exists( 'CPAC_Addon_WC' ) ) {
57
+ $plugins[] = __( 'WooCommerce', 'codepress-admin-columns' );
58
+ }
59
+
60
+ if ( $plugins ) {
61
+ $num_plugins = count( $plugins );
62
+
63
+ foreach ( $plugins as $index => $plugin ) {
64
+ $plugins[ $index ] = '<strong>' . $plugin . '</strong>';
65
+ }
66
+
67
+ $plugins_list = $plugins[0];
68
+
69
+ if ( $num_plugins > 1 ) {
70
+ if ( $num_plugins > 2 ) {
71
+ $plugins_list = implode( ', ', array_slice( $plugins, 0, $num_plugins - 1 ) );
72
+ $plugins = array( $plugins_list, $plugins[ $num_plugins - 1 ] );
73
+ }
74
+
75
+ $plugins_list = sprintf( __( '%s and %s', 'codepress-admin-columns' ), $plugins[0], $plugins[1] );
76
+ }
77
+ ?>
78
+ <div class="cpac_message updated">
79
+ <a href="#" class="hide-notice hide-install-addons-notice"></a>
80
+ <p><?php printf(
81
+ __( "Did you know Admin Columns Pro has an integration addon for %s? With the proper Admin Columns Pro license, you can download them from %s!", 'codepress-admin-columns' ),
82
+ $plugins_list,
83
+ '<a href="' . $this->cpac->settings()->get_settings_url( 'addons' ) . '">' . __( 'the addons page', 'codepress-admin-columns' ) . '</a>'
84
+ ); ?>
85
+ </div>
86
+ <style type="text/css">
87
+ body .wrap .cpac_message {
88
+ position: relative;
89
+ padding-right: 40px;
90
+ }
91
+ .cpac_message .spinner.right {
92
+ visibility: visible;
93
+ display: block;
94
+ right: 8px;
95
+ text-decoration: none;
96
+ text-align: right;
97
+ position: absolute;
98
+ top: 50%;
99
+ margin-top: -10px;
100
+ }
101
+ .cpac_message .hide-notice {
102
+ right: 8px;
103
+ text-decoration: none;
104
+ width: 32px;
105
+ text-align: right;
106
+ position: absolute;
107
+ top: 50%;
108
+ height: 32px;
109
+ margin-top: -16px;
110
+ }
111
+ .cpac_message .hide-notice:before {
112
+ display: block;
113
+ content: '\f335';
114
+ font-family: 'Dashicons';
115
+ margin: .5em 0;
116
+ padding: 2px;
117
+ }
118
+ </style>
119
+ <script type="text/javascript">
120
+ jQuery( function( $ ) {
121
+ $( document ).ready( function() {
122
+ $( '.updated a.hide-install-addons-notice' ).click( function( e ) {
123
+ e.preventDefault();
124
+
125
+ var el = $( this ).parents( '.cpac_message' );
126
+ var el_close = el.find( '.hide-notice' );
127
+
128
+ el_close.hide();
129
+ el_close.after( '<div class="spinner right"></div>' );
130
+ el.find( '.spinner' ).show();
131
+
132
+ $.post( ajaxurl, {
133
+ 'action': 'cpac_hide_install_addons_notice'
134
+ }, function( data ) {
135
+ el.find( '.spinner' ).remove();
136
+ el.slideUp();
137
+ } );
138
+
139
+ return false;
140
+ } );
141
+ } );
142
+ } );
143
+ </script>
144
+ <?php
145
+ }
146
+ }
147
+
148
+ /**
149
+ * Ajax callback for hiding the "Missing addons" notice used for notifying users of available integration addons for plugins they have installed
150
+ *
151
+ * @since 2.4.9
152
+ */
153
+ public function ajax_hide_install_addons_notice() {
154
+
155
+ update_user_meta( get_current_user_id(), self::OPTION_ADMIN_NOTICE_INSTALL_ADDONS_KEY, '1', true );
156
}
157
158
/**
167
}
168
169
if ( ! $this->get_addon( $_GET['plugin'] ) ) {
170
+ cpac_admin_message( __( 'Addon does not exist.', 'codepress-admin-columns' ), 'error' );
171
172
return;
173
}
174
175
if ( ! class_exists( 'CAC_Addon_Pro', false ) ) {
176
+ cpac_admin_message( __( 'You need Admin Columns Pro.', 'codepress-admin-columns' ), 'error' );
177
178
return;
179
}
classes/column.php CHANGED
@@ -1,4 +1,5 @@
1
<?php
2
/**
3
* CPAC_Column class
4
*
@@ -48,9 +49,11 @@ class CPAC_Column {
48
* @since 2.0
49
*
50
* @param int $id ID
51
* @return string Value
52
*/
53
- public function get_value( $id ) {}
54
55
/**
56
* Get the raw, underlying value for the column
@@ -59,14 +62,17 @@ class CPAC_Column {
59
* @since 2.0.3
60
*
61
* @param int $id ID
62
* @return mixed Value
63
*/
64
- public function get_raw_value( $id ) {}
65
66
/**
67
* @since 2.0
68
*/
69
- protected function display_settings() {}
70
71
/**
72
* Overwrite this function in child class to sanitize
@@ -75,6 +81,7 @@ class CPAC_Column {
75
* @since 2.0
76
*
77
* @param $options array User submitted column options
78
* @return array Options
79
*/
80
protected function sanitize_options( $options ) {
@@ -112,7 +119,8 @@ class CPAC_Column {
112
*
113
* @since 2.3.4
114
*/
115
- public function scripts() {}
116
117
/**
118
* An object copy (clone) is created for creating multiple column instances.
@@ -122,8 +130,8 @@ class CPAC_Column {
122
public function __clone() {
123
124
// Force a copy of this->object, otherwise it will point to same object.
125
- $this->options = clone $this->options;
126
- $this->properties = clone $this->properties;
127
}
128
129
/**
@@ -146,17 +154,18 @@ class CPAC_Column {
146
147
// Default properties
148
$default_properties = array(
149
- 'clone' => null, // Unique clone ID
150
- 'type' => null, // Unique type
151
- 'name' => null, // Unique name
152
- 'label' => null, // Label which describes this column.
153
- 'classes' => null, // Custom CSS classes for this column.
154
- 'hide_label' => false, // Should the Label be hidden?
155
- 'is_registered' => true, // Should the column be registered based on conditional logic, example usage see: 'post/page-template.php'
156
- 'is_cloneable' => true, // Should the column be cloneable
157
- 'default' => false, // Is this a WP default column,
158
- 'group' => 'custom',
159
- 'hidden' => false
160
);
161
162
// @since 2.4.7
@@ -168,17 +177,18 @@ class CPAC_Column {
168
169
// Default options
170
$default_options = array(
171
- 'before' => '', // Before field
172
- 'after' => '', // After field
173
- 'width' => null, // Width for this column.
174
- 'width_unit'=> '%', // Unit for width; pecentage (%) or pixels (px).
175
- 'state' => 'off' // Active state for this column.
176
);
177
178
/**
179
* Filter the default options for a column instance, such as label and width
180
*
181
* @since 2.2
182
* @param array $default_options Default column options
183
* @param CPAC_Storage_Model $storage_model Storage Model class instance
184
*/
@@ -208,6 +218,7 @@ class CPAC_Column {
208
* Property $column_instance added in Admin Columns 2.2
209
*
210
* @since 2.0
211
* @param array $properties Column properties
212
* @param CPAC_Storage_Model $storage_model Storage Model class instance
213
*/
@@ -235,6 +246,11 @@ class CPAC_Column {
235
$this->populate_options();
236
237
$this->sanitize_label();
238
}
239
240
/**
@@ -242,14 +258,16 @@ class CPAC_Column {
242
* Added $options parameter in 2.2
243
*
244
* @since 2.0
245
* @param array $options Optional. Options to populate the storage model with. Defaults to options from database.
246
*/
247
- public function populate_options( $options = NULL ) {
248
$this->options = (object) array_merge( (array) $this->options, is_array( $options ) ? $options : $this->read() );
249
}
250
251
/**
252
* @param string $property
253
* @return mixed $value
254
*/
255
public function set_properties( $property, $value ) {
@@ -260,6 +278,7 @@ class CPAC_Column {
260
261
/**
262
* @param string $option
263
* @return mixed $value
264
*/
265
public function set_options( $option, $value ) {
@@ -273,6 +292,7 @@ class CPAC_Column {
273
*/
274
public function set_filter( $filtering_model ) {
275
$this->filtering_model = $filtering_model;
276
return $this;
277
}
278
@@ -288,6 +308,7 @@ class CPAC_Column {
288
*/
289
public function set_editable( $editable_model ) {
290
$this->editable_model = $editable_model;
291
return $this;
292
}
293
@@ -300,6 +321,7 @@ class CPAC_Column {
300
301
/**
302
* @param int $id
303
* @return object
304
*/
305
public function set_clone( $id = null ) {
@@ -312,18 +334,32 @@ class CPAC_Column {
312
return $this;
313
}
314
315
/**
316
* @since 1.0
317
*/
318
public function get_before() {
319
- return stripslashes( $this->options->before );
320
}
321
322
/**
323
* @since 1.0
324
*/
325
public function get_after() {
326
- return stripslashes( $this->options->after );
327
}
328
329
/**
@@ -344,6 +380,15 @@ class CPAC_Column {
344
return $this->properties->name;
345
}
346
347
/**
348
* Get the column options set by the user
349
*
@@ -378,7 +423,9 @@ class CPAC_Column {
378
* Checks column type
379
*
380
* @since 2.3.4
381
* @param string $type Column type. Also work without the 'column-' prefix. Example 'column-meta' or 'meta'.
382
* @return bool Matches column type
383
*/
384
public function is_type( $type ) {
@@ -415,22 +462,26 @@ class CPAC_Column {
415
416
/**
417
* @param string $field_key
418
* @return void
419
*/
420
public function attr_name( $field_name ) {
421
echo $this->get_attr_name( $field_name );
422
}
423
public function get_attr_name( $field_name ) {
424
return "{$this->storage_model->key}[{$this->properties->name}][{$field_name}]";
425
}
426
427
/**
428
* @param string $field_key
429
* @return string Attribute Name
430
*/
431
public function get_attr_id( $field_name ) {
432
return "cpac-{$this->storage_model->key}-{$this->properties->name}-{$field_name}";
433
}
434
public function attr_id( $field_name ) {
435
echo $this->get_attr_id( $field_name );
436
}
@@ -464,7 +515,9 @@ class CPAC_Column {
464
465
/**
466
* @since 2.0
467
* @param $options array User submitted column options
468
* @return array Options
469
*/
470
public function sanitize_storage( $options ) {
@@ -514,11 +567,16 @@ class CPAC_Column {
514
* Sanitizes label using intern wordpress function esc_url so it matches the label sorting url.
515
*
516
* @since 1.0
517
* @param string $string
518
* @return string Sanitized string
519
*/
520
public function get_sanitized_label() {
521
- $string = esc_url( $this->options->label );
522
$string = str_replace( 'http://', '', $string );
523
$string = str_replace( 'https://', '', $string );
524
@@ -551,12 +609,14 @@ class CPAC_Column {
551
if ( is_wp_error( $term_field ) ) {
552
return false;
553
}
554
return $term_field;
555
}
556
557
// since 2.4.8
558
public function get_raw_post_field( $field, $id ) {
559
global $wpdb;
560
return $id ? $wpdb->get_var( $wpdb->prepare( "SELECT " . $wpdb->_real_escape( $field ) . " FROM {$wpdb->posts} WHERE ID = %d LIMIT 1", $id ) ) : false;
561
}
562
@@ -567,19 +627,21 @@ class CPAC_Column {
567
568
/**
569
* @since 1.0
570
* @param int $post_id Post ID
571
* @return string Post Excerpt.
572
*/
573
- protected function get_post_excerpt( $post_id, $words ) {
574
global $post;
575
576
- $save_post = $post;
577
- $post = get_post( $post_id );
578
579
setup_postdata( $post );
580
581
- $excerpt = get_the_excerpt();
582
- $post = $save_post;
583
584
if ( $post ) {
585
setup_postdata( $post );
@@ -605,8 +667,10 @@ class CPAC_Column {
605
606
/**
607
* @since 1.3.1
608
* @param string $name
609
* @param string $title
610
* @return string HTML img element
611
*/
612
public function get_asset_image( $name = '', $title = '' ) {
@@ -614,6 +678,7 @@ class CPAC_Column {
614
if ( ! $name ) {
615
return false;
616
}
617
return sprintf( "<img alt='' src='%s' title='%s'/>", CPAC_URL . "assets/images/{$name}", esc_attr( $title ) );
618
}
619
@@ -629,12 +694,15 @@ class CPAC_Column {
629
AND post_author = %d
630
AND post_type = %s
631
";
632
return $wpdb->get_var( $wpdb->prepare( $sql, $user_id, $post_type ) );
633
}
634
635
/**
636
* @since 1.2.0
637
* @param string $url
638
* @return bool
639
*/
640
protected function is_image_url( $url ) {
@@ -643,8 +711,8 @@ class CPAC_Column {
643
return false;
644
}
645
646
- $validExt = array('.jpg', '.jpeg', '.gif', '.png', '.bmp');
647
- $ext = strrchr( $url, '.' );
648
649
return in_array( $ext, $validExt );
650
}
@@ -655,15 +723,15 @@ class CPAC_Column {
655
*/
656
public function get_all_image_sizes() {
657
$image_sizes = array(
658
- 'thumbnail' => __( "Thumbnail", 'codepress-admin-columns' ),
659
- 'medium' => __( "Medium", 'codepress-admin-columns' ),
660
- 'large' => __( "Large", 'codepress-admin-columns' ),
661
- 'full' => __( "Full", 'codepress-admin-columns' )
662
);
663
664
- foreach( get_intermediate_image_sizes() as $size ) {
665
- if ( ! isset( $image_sizes[$size] ) ) {
666
- $image_sizes[$size] = ucwords( str_replace( '-', ' ', $size) );
667
}
668
}
669
@@ -708,7 +776,9 @@ class CPAC_Column {
708
709
/**
710
* @since 2.0
711
* @param string $name
712
* @return array Image Sizes
713
*/
714
public function get_image_size_by_name( $name = '' ) {
@@ -733,23 +803,26 @@ class CPAC_Column {
733
*/
734
public function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) {
735
$resized = false;
736
- $editor = wp_get_image_editor( $file );
737
738
- if ( is_wp_error( $editor ) )
739
return false;
740
741
$editor->set_quality( $jpeg_quality );
742
743
$resized = $editor->resize( $max_w, $max_h, $crop );
744
- if ( is_wp_error( $resized ) )
745
return false;
746
747
$dest_file = $editor->generate_filename( $suffix, $dest_path );
748
749
$saved = $editor->save( $dest_file );
750
751
- if ( is_wp_error( $saved ) )
752
return false;
753
754
$resized = $dest_file;
755
@@ -765,6 +838,7 @@ class CPAC_Column {
765
return false;
766
}
767
$text_color = $this->get_text_color( $color_hex );
768
return "<div class='cpac-color'><span style='background-color:{$color_hex};color:{$text_color}'>{$color_hex}</span></div>";
769
}
770
@@ -777,7 +851,7 @@ class CPAC_Column {
777
778
$rgb = $this->hex2rgb( $bg_color );
779
780
- return $rgb && ( ( $rgb[0]*0.299 + $rgb[1]*0.587 + $rgb[2]*0.114 ) < 186 ) ? '#ffffff' : '#333333';
781
}
782
783
/**
@@ -788,16 +862,16 @@ class CPAC_Column {
788
public function hex2rgb( $hex ) {
789
$hex = str_replace( "#", "", $hex );
790
791
- if(strlen($hex) == 3) {
792
- $r = hexdec(substr($hex,0,1).substr($hex,0,1));
793
- $g = hexdec(substr($hex,1,1).substr($hex,1,1));
794
- $b = hexdec(substr($hex,2,1).substr($hex,2,1));
795
} else {
796
- $r = hexdec(substr($hex,0,2));
797
- $g = hexdec(substr($hex,2,2));
798
- $b = hexdec(substr($hex,4,2));
799
}
800
- $rgb = array($r, $g, $b);
801
802
return $rgb;
803
}
@@ -808,6 +882,7 @@ class CPAC_Column {
808
* @since 2.3
809
*
810
* @param string $input Input string
811
* @return int Number of words
812
*/
813
public function str_count_words( $input ) {
@@ -815,8 +890,8 @@ class CPAC_Column {
815
$patterns = array(
816
'strip' => '/<[a-zA-Z\/][^<>]*>/',
817
'clean' => '/[0-9.(),;:!?%#$¿\'"_+=\\/-]+/',
818
- 'w' => '/\S\s+/',
819
- 'c' => '/\S/'
820
);
821
822
$type = 'w';
@@ -834,8 +909,10 @@ class CPAC_Column {
834
835
/**
836
* @since 1.0
837
* @param mixed $meta Image files or Image ID's
838
* @param array $args
839
* @return array HTML img elements
840
*/
841
public function get_thumbnails( $images, $args = array() ) {
@@ -848,24 +925,23 @@ class CPAC_Column {
848
if ( is_string( $images ) || is_numeric( $images ) ) {
849
if ( strpos( $images, ',' ) !== false ) {
850
$images = array_filter( explode( ',', $this->strip_trim( str_replace( ' ', '', $images ) ) ) );
851
- }
852
- else {
853
$images = array( $images );
854
}
855
}
856
857
// Image size
858
$defaults = array(
859
- 'image_size' => 'cpac-custom',
860
- 'image_size_w' => 80,
861
- 'image_size_h' => 80,
862
);
863
$args = wp_parse_args( $args, $defaults );
864
865
extract( $args );
866
867
$thumbnails = array();
868
- foreach( $images as $value ) {
869
870
if ( $this->is_image_url( $value ) ) {
871
@@ -881,17 +957,13 @@ class CPAC_Column {
881
882
// try to resize image
883
if ( $resized = $this->image_resize( $image_path, $image_size_w, $image_size_h, true ) ) {
884
- $thumbnails[] = "<img src='" . str_replace( WP_CONTENT_DIR, WP_CONTENT_URL, $resized ) . "' alt='' width='{$image_size_w}' height='{$image_size_h}' />";
885
- }
886
-
887
- // return full image with maxed dimensions
888
else {
889
$thumbnails[] = "<img src='{$value}' alt='' style='max-width:{$image_size_w}px;max-height:{$image_size_h}px' />";
890
}
891
}
892
- }
893
-
894
- // Media Attachment
895
elseif ( is_numeric( $value ) && wp_get_attachment_url( $value ) ) {
896
897
$src = '';
@@ -899,8 +971,8 @@ class CPAC_Column {
899
$height = '';
900
901
if ( ! $image_size || 'cpac-custom' == $image_size ) {
902
- $width = $image_size_w;
903
- $height = $image_size_h;
904
905
// to make sure wp_get_attachment_image_src() get the image with matching dimensions.
906
$image_size = array( $width, $height );
@@ -908,18 +980,17 @@ class CPAC_Column {
908
909
// Is Image
910
if ( $attributes = wp_get_attachment_image_src( $value, $image_size ) ) {
911
- $src = $attributes[0];
912
- $width = $attributes[1];
913
- $height = $attributes[2];
914
915
// image size by name
916
if ( $sizes = $this->get_image_size_by_name( $image_size ) ) {
917
- $width = $sizes['width'];
918
- $height = $sizes['height'];
919
}
920
- }
921
-
922
- // Is File, use icon
923
elseif ( $attributes = wp_get_attachment_image_src( $value, $image_size, true ) ) {
924
$src = $attributes[0];
925
@@ -928,11 +999,17 @@ class CPAC_Column {
928
$height = $sizes['height'];
929
}
930
}
931
932
- // maximum dimensions
933
- $max = max( array( $width, $height ) );
934
935
- $thumbnails[] = "<span class='cpac-column-value-image' style='width:{$width}px;height:{$height}px;'><img style='max-width:{$max}px;max-height:{$max}px;' src='{$src}' alt=''/></span>";
936
}
937
}
938
@@ -943,20 +1020,21 @@ class CPAC_Column {
943
* Implode for multi dimensional array
944
*
945
* @since 1.0
946
* @param string $glue
947
* @param array $pieces
948
* @return string Imploded array
949
*/
950
public function recursive_implode( $glue, $pieces ) {
951
- foreach( $pieces as $r_pieces ) {
952
if ( is_array( $r_pieces ) ) {
953
$retVal[] = $this->recursive_implode( $glue, $r_pieces );
954
- }
955
- else {
956
$retVal[] = $r_pieces;
957
}
958
}
959
- if ( isset($retVal) && is_array( $retVal ) ) {
960
return implode( $glue, $retVal );
961
}
962
@@ -967,7 +1045,9 @@ class CPAC_Column {
967
* Get timestamp
968
*
969
* @since 2.0
970
* @param string $date
971
* @return string Formatted date
972
*/
973
public function get_timestamp( $date ) {
@@ -992,12 +1072,10 @@ class CPAC_Column {
992
993
// Date format: yyyymmdd ( often used by ACF ) must start with 19xx or 20xx and is 8 long
994
// @todo: in theory a numeric string of 8 can also be a unixtimestamp; no conversion would be needed
995
- if ( 8 === $length && ( strpos( $date, '20' ) === 0 || strpos( $date, '19' ) === 0 ) ) {
996
$date = strtotime( $date );
997
}
998
- }
999
-
1000
- // Parse with strtotime if it's not numeric
1001
else {
1002
$date = strtotime( $date );
1003
}
@@ -1007,7 +1085,9 @@ class CPAC_Column {
1007
1008
/**
1009
* @since 1.3.1
1010
* @param string $date
1011
* @return string Formatted date
1012
*/
1013
public function get_date( $date, $format = '' ) {
@@ -1024,7 +1104,9 @@ class CPAC_Column {
1024
1025
/**
1026
* @since 1.3.1
1027
* @param string $date
1028
* @return string Formatted time
1029
*/
1030
protected function get_time( $date, $format = '' ) {
@@ -1059,12 +1141,10 @@ class CPAC_Column {
1059
$display_as = $this->options->display_author_as;
1060
1061
if ( 'first_last_name' == $display_as ) {
1062
- $first = ! empty( $userdata->first_name ) ? $userdata->first_name : '';
1063
- $last = ! empty( $userdata->last_name ) ? " {$userdata->last_name}" : '';
1064
- $name = $first.$last;
1065
- }
1066
-
1067
- elseif ( ! empty( $userdata->{$display_as} ) ) {
1068
$name = $userdata->{$display_as};
1069
}
1070
}
@@ -1077,30 +1157,11 @@ class CPAC_Column {
1077
return $name;
1078
}
1079
1080
- /**
1081
- * @since 2.4.7
1082
- */
1083
- public function get_filter_operator_label( $name ) {
1084
- $operators = $this->get_filter_operators();
1085
- return isset( $operators[ $name ] ) ? $operators[ $name ] : false;
1086
- }
1087
-
1088
- /**
1089
- * @since 2.4.7
1090
- */
1091
- public function get_filter_operators() {
1092
- $operators = array(
1093
- '' => __( 'Exact match', 'codepress-admin-columns' ),
1094
- '<=' => __( 'Lesser than', 'codepress-admin-columns' ),
1095
- '>=' => __( 'Greater than', 'codepress-admin-columns' ),
1096
- 'between' => __( 'Between', 'codepress-admin-columns' ),
1097
- );
1098
- return $operators;
1099
- }
1100
-
1101
/**
1102
* @since 2.0
1103
* @param string $field_key
1104
* @return string Attribute Name
1105
*/
1106
public function label_view( $label, $description = '', $pointer = '' ) {
@@ -1108,7 +1169,7 @@ class CPAC_Column {
1108
<td class="label">
1109
<label for="<?php $this->attr_id( $pointer ); ?>">
1110
<?php echo stripslashes( $label ); ?>
1111
- <?php if( $description ) : ?><p class="description"><?php echo $description; ?></p><?php endif; ?>
1112
</label>
1113
</td>
1114
<?php
@@ -1119,17 +1180,18 @@ class CPAC_Column {
1119
*/
1120
public function display_field_date_format() {
1121
1122
- $field_key = 'date_format';
1123
- $label = __( 'Date Format', 'codepress-admin-columns' );
1124
- $description = __( 'This will determine how the date will be displayed.', 'codepress-admin-columns' );
1125
1126
?>
1127
<tr class="column_<?php echo $field_key; ?>">
1128
<?php $this->label_view( $label, $description, $field_key ); ?>
1129
<td class="input">
1130
<input type="text" name="<?php $this->attr_name( $field_key ); ?>" id="<?php $this->attr_id( $field_key ); ?>" value="<?php echo $this->options->date_format; ?>" placeholder="<?php _e( 'Example:', 'codepress-admin-columns' ); ?> d M Y H:i"/>
1131
<p class="description">
1132
- <?php printf( __( "Leave empty for WordPress date format, change your <a href='%s'>default date format here</a>." , 'codepress-admin-columns' ), admin_url( 'options-general.php' ) . '#date_format_custom_radio' ); ?>
1133
<a target='_blank' href='http://codex.wordpress.org/Formatting_Date_and_Time'><?php _e( 'Documentation on date and time formatting.', 'codepress-admin-columns' ); ?></a>
1134
</p>
1135
</td>
@@ -1143,9 +1205,9 @@ class CPAC_Column {
1143
*/
1144
public function display_field_excerpt_length() {
1145
1146
- $field_key = 'excerpt_length';
1147
- $label = __( 'Excerpt length', 'codepress-admin-columns' );
1148
- $description = __( 'Number of words', 'codepress-admin-columns' );
1149
1150
?>
1151
<tr class="column_<?php echo $field_key; ?>">
@@ -1154,7 +1216,25 @@ class CPAC_Column {
1154
<input type="text" name="<?php $this->attr_name( $field_key ); ?>" id="<?php $this->attr_id( $field_key ); ?>" value="<?php echo $this->options->excerpt_length; ?>"/>
1155
</td>
1156
</tr>
1157
- <?php
1158
}
1159
1160
/**
@@ -1162,8 +1242,8 @@ class CPAC_Column {
1162
*/
1163
public function display_field_preview_size() {
1164
1165
- $field_key = 'image_size';
1166
- $label = __( 'Preview size', 'codepress-admin-columns' );
1167
1168
?>
1169
<tr class="column_<?php echo $field_key; ?>">
@@ -1179,19 +1259,21 @@ class CPAC_Column {
1179
<?php endforeach; ?>
1180
1181
<div class="custom_image_size">
1182
- <label for="<?php $this->attr_id( $field_key ); ?>-custom" class="custom-size image-size-custom" >
1183
<input type="radio" value="cpac-custom" name="<?php $this->attr_name( $field_key ); ?>" id="<?php $this->attr_id( $field_key ); ?>-custom"<?php checked( $this->options->image_size, 'cpac-custom' ); ?>><?php _e( 'Custom', 'codepress-admin-columns' ); ?>
1184
</label>
1185
- <label for="<?php $this->attr_id( $field_key ); ?>-w" class="custom-size-w<?php echo $this->options->image_size != 'cpac-custom' ? ' hidden' : ''; ?>">
1186
- <input type="text" name="<?php $this->attr_name( 'image_size_w' ); ?>" id="<?php $this->attr_id( $field_key ); ?>-w" value="<?php echo $this->options->image_size_w; ?>" /><?php _e( 'width', 'codepress-admin-columns' ); ?>
1187
</label>
1188
- <label for="<?php $this->attr_id( $field_key ); ?>-h" class="custom-size-h<?php echo $this->options->image_size != 'cpac-custom' ? ' hidden' : ''; ?>">
1189
- <input type="text" name="<?php $this->attr_name( 'image_size_h' ); ?>" id="<?php $this->attr_id( $field_key ); ?>-h" value="<?php echo $this->options->image_size_h; ?>" /><?php _e( 'height', 'codepress-admin-columns' ); ?>
1190
</label>
1191
</div>
1192
</td>
1193
</tr>
1194
- <?php
1195
}
1196
1197
/**
@@ -1208,14 +1290,14 @@ class CPAC_Column {
1208
public function display_field_user_format() {
1209
1210
$nametypes = array(
1211
- 'display_name' => __( 'Display Name', 'codepress-admin-columns' ),
1212
- 'first_name' => __( 'First Name', 'codepress-admin-columns' ),
1213
- 'last_name' => __( 'Last Name', 'codepress-admin-columns' ),
1214
- 'nickname' => __( 'Nickname', 'codepress-admin-columns' ),
1215
- 'user_login' => __( 'User Login', 'codepress-admin-columns' ),
1216
- 'user_email' => __( 'User Email', 'codepress-admin-columns' ),
1217
- 'ID' => __( 'User ID', 'codepress-admin-columns' ),
1218
- 'first_last_name' => __( 'First and Last Name', 'codepress-admin-columns' ),
1219
);
1220
1221
$this->display_field_select( 'display_author_as', __( 'Display format', 'codepress-admin-columns' ), $nametypes, __( 'This is the format of the author name.', 'codepress-admin-columns' ) );
@@ -1223,6 +1305,7 @@ class CPAC_Column {
1223
1224
/**
1225
* @since 2.3.4
1226
* @param string $name Name of the column option
1227
* @param string $label Label
1228
* @param array $options Select options
@@ -1239,9 +1322,9 @@ class CPAC_Column {
1239
<?php $this->label_view( $label, $description, $name ); ?>
1240
<td class="input">
1241
<select name="<?php $this->attr_name( $name ); ?>" id="<?php $this->attr_id( $name ); ?>">
1242
- <?php foreach ( $options as $key => $label ) : ?>
1243
- <option value="<?php echo $key; ?>"<?php selected( $key, $current ); ?>><?php echo $label; ?></option>
1244
- <?php endforeach; ?>
1245
</select>
1246
</td>
1247
</tr>
@@ -1250,6 +1333,7 @@ class CPAC_Column {
1250
1251
/**
1252
* @since 2.3.4
1253
* @param string $name Name of the column option
1254
* @param string $label Label
1255
* @param array $options Select options
@@ -1268,6 +1352,7 @@ class CPAC_Column {
1268
1269
/**
1270
* @since 2.4.8
1271
* @param string $name Name of the column option
1272
* @param string $value
1273
*/
@@ -1311,7 +1396,9 @@ class CPAC_Column {
1311
1312
/**
1313
* @since 2.0
1314
* @param array Column Objects
1315
* @return string HTML List
1316
*/
1317
public function get_column_list( $columns = array(), $label = '' ) {
@@ -1348,7 +1435,7 @@ class CPAC_Column {
1348
*/
1349
public function display() {
1350
1351
- $classes = implode( ' ', array_filter( array ( "cpac-box-{$this->properties->type}", $this->properties->classes ) ) );
1352
1353
// column list
1354
$column_list = '';
@@ -1363,54 +1450,55 @@ class CPAC_Column {
1363
1364
?>
1365
<div class="cpac-column <?php echo $classes; ?>" data-type="<?php echo $this->properties->type; ?>"<?php echo $data_clone; ?>>
1366
- <input type="hidden" class="column-name" name="<?php echo $this->attr_name( 'column-name' ); ?>" value="<?php echo esc_attr( $this->properties->name ); ?>" />
1367
- <input type="hidden" class="type" name="<?php echo $this->attr_name( 'type' ); ?>" value="<?php echo $this->properties->type; ?>" />
1368
- <input type="hidden" class="clone" name="<?php echo $this->attr_name( 'clone' ); ?>" value="<?php echo $this->properties->clone; ?>" />
1369
<div class="column-meta">
1370
<table class="widefat">
1371
<tbody>
1372
- <tr>
1373
- <td class="column_sort"></td>
1374
- <td class="column_label">
1375
- <div class="inner">
1376
- <div class="meta">
1377
-
1378
- <span title="<?php echo esc_attr( __( 'width', 'codepress-admin-columns' ) ); ?>" class="width" data-indicator-id="">
1379
- <?php echo ! empty( $this->options->width ) ? $this->options->width . $this->options->width_unit : ''; ?>
1380
- </span>
1381
-
1382
- <?php
1383
- /**
1384
- * Fires in the meta-element for column options, which is displayed right after the column label
1385
- *
1386
- * @since 2.0
1387
- *
1388
- * @param CPAC_Column $column_instance Column class instance
1389
- */
1390
- do_action( 'cac/column/settings_meta', $this );
1391
-
1392
- /**
1393
- * @deprecated 2.2 Use cac/column/settings_meta instead
1394
- */
1395
- do_action( 'cac/column/label', $this );
1396
- ?>
1397
-
1398
- </div>
1399
- <a class="toggle" href="javascript:;"><?php echo stripslashes( $this->get_label() ); ?></a>
1400
- <a class="edit-button" href="javascript:;"><?php _e( 'Edit', 'codepress-admin-columns' ); ?></a>
1401
- <?php if ( $this->properties->is_cloneable ) : ?>
1402
- <a class="clone-button" href="#"><?php _e( 'Clone', 'codepress-admin-columns' ); ?></a>
1403
- <?php endif; ?>
1404
- <a class="remove-button" href="javascript:;"><?php _e( 'Remove', 'codepress-admin-columns' ); ?></a>
1405
- </div>
1406
- </td>
1407
- <td class="column_type">
1408
- <div class="inner">
1409
- <a href="#"><?php echo stripslashes( $this->properties->label ); ?></a>
1410
</div>
1411
- </td>
1412
- <td class="column_edit"></td>
1413
- </tr>
1414
</tbody>
1415
</table>
1416
</div><!--.column-meta-->
@@ -1418,90 +1506,101 @@ class CPAC_Column {
1418
<div class="column-form">
1419
<table class="widefat">
1420
<tbody>
1421
- <tr class="column_type">
1422
- <?php $this->label_view( __( 'Type', 'codepress-admin-columns' ), __( 'Choose a column type.', 'codepress-admin-columns' ) . '<em>' . __( 'Type', 'codepress-admin-columns' ) . ': ' . $this->properties->type . '</em><em>' . __( 'Name', 'codepress-admin-columns' ) . ': ' . $this->properties->name . '</em>', 'type' ); ?>
1423
- <td class="input">
1424
- <select name="<?php $this->attr_name( 'type' ); ?>" id="<?php $this->attr_id( 'type' ); ?>">
1425
- <?php echo $column_list; ?>
1426
- </select>
1427
- <div class="msg"></div>
1428
- </td>
1429
- </tr><!--.column_label-->
1430
-
1431
- <tr class="column_label<?php echo $this->properties->hide_label ? ' hidden' : ''; ?>">
1432
- <?php $this->label_view( __( 'Label', 'codepress-admin-columns' ), __( 'This is the name which will appear as the column header.', 'codepress-admin-columns' ), 'label' ); ?>
1433
- <td class="input">
1434
- <input class="text" type="text" name="<?php $this->attr_name( 'label' ); ?>" id="<?php $this->attr_id( 'label' ); ?>" value="<?php echo esc_attr( $this->options->label ); //echo sanitize_text_field( $this->options->label ); ?>" />
1435
- </td>
1436
- </tr><!--.column_label-->
1437
-
1438
- <tr class="column_width">
1439
- <?php $this->label_view( __( 'Width', 'codepress-admin-columns' ), '', 'width' ); ?>
1440
- <td class="input">
1441
- <div class="description" title="<?php _e( 'default', 'codepress-admin-columns' ); ?>">
1442
- <input class="width" type="text" placeholder="<?php _e( 'auto', 'codepress-admin-columns' ); ?>" name="<?php $this->attr_name( 'width' ); ?>" id="<?php $this->attr_id( 'width' ); ?>" value="<?php echo $this->options->width; ?>" />
1443
- <span class="unit"><?php echo $this->options->width_unit; ?></span>
1444
- </div>
1445
- <div class="width-slider"></div>
1446
-
1447
- <div class="unit-select">
1448
- <label for="<?php $this->attr_id( 'width_unit_px' ); ?>">
1449
- <input type="radio" class="unit" name="<?php $this->attr_name( 'width_unit' ); ?>" id="<?php $this->attr_id( 'width_unit_px' ); ?>" value="px"<?php checked( $this->options->width_unit, 'px' ); ?>/>
1450
- px
1451
- </label>
1452
- <label for="<?php $this->attr_id( 'width_unit_perc' ); ?>">
1453
- <input type="radio" class="unit" name="<?php $this->attr_name( 'width_unit' ); ?>" id="<?php $this->attr_id( 'width_unit_perc' ); ?>" value="%"<?php checked( $this->options->width_unit, '%' ); ?>/>
1454
- %
1455
- </label>
1456
- </div>
1457
-
1458
- </td>
1459
- </tr><!--.column_width-->
1460
-
1461
- <?php
1462
- /**
1463
- * Fires directly before the custom options for a column are displayed in the column form
1464
- *
1465
- * @since 2.0
1466
- * @param CPAC_Column $column_instance Column class instance
1467
- */
1468
- do_action( 'cac/column/settings_before', $this );
1469
- ?>
1470
-
1471
- <?php
1472
- /**
1473
- * Load specific column settings.
1474
- *
1475
- */
1476
- $this->display_settings();
1477
-
1478
- ?>
1479
-
1480
- <?php
1481
- /**
1482
- * Fires directly after the custom options for a column are displayed in the column form
1483
- *
1484
- * @since 2.0
1485
- * @param CPAC_Column $column_instance Column class instance
1486
- */
1487
- do_action( 'cac/column/settings_after', $this );
1488
- ?>
1489
-
1490
- <tr class="column_action">
1491
- <td colspan="2">
1492
- <p>
1493
- <?php if ( $this->properties->is_cloneable ) : ?>
1494
- <a class="clone-button" href="#"><?php _e( 'Clone', 'codepress-admin-columns' ); ?></a>
1495
- <?php endif; ?>
1496
- <a href="javascript:;" class="remove-button"><?php _e( 'Remove' );?></a>
1497
- </p>
1498
- </td>
1499
- </tr>
1500
1501
</tbody>
1502
</table>
1503
- </div>
1504
- </div>
1505
<?php
1506
}
1507
@@ -1515,8 +1614,8 @@ class CPAC_Column {
1515
'post_property_display',
1516
__( 'Property To Display', 'codepress-admin-columns' ),
1517
array(
1518
- 'title' => __( 'Title' ), // default
1519
- 'id' => __( 'ID' ),
1520
'author' => __( 'Author' )
1521
),
1522
__( 'Post property to display for related post(s).', 'codepress-admin-columns' )
@@ -1533,9 +1632,9 @@ class CPAC_Column {
1533
'post_link_to',
1534
__( 'Link To', 'codepress-admin-columns' ),
1535
array(
1536
- '' => __( 'None' ),
1537
- 'edit_post' => __( 'Edit Post' ),
1538
- 'view_post' => __( 'View Post' ),
1539
'edit_author' => __( 'Edit Post Author', 'codepress-admin-columns' ),
1540
'view_author' => __( 'View Public Post Author Page', 'codepress-admin-columns' )
1541
),
@@ -1551,19 +1650,20 @@ class CPAC_Column {
1551
<p>
1552
<strong><?php printf( __( "The %s column is only available in Admin Columns Pro - Business or Developer.", 'codepress-admin-columns' ), $this->get_label() ); ?></strong>
1553
</p>
1554
<p>
1555
<?php printf( __( "If you have a business or developer licence please download & install your %s add-on from the <a href='%s'>add-ons tab</a>.", 'codepress-admin-columns' ), $this->get_label(), admin_url( 'options-general.php?page=codepress-admin-columns&tab=addons' ) ); ?>
1556
</p>
1557
<p>
1558
<?php printf( __( "Admin Columns Pro offers full %s integration, allowing you to easily display and edit %s fields from within your overview.", 'codepress-admin-columns' ), $this->get_label(), $this->get_label() ); ?>
1559
</p>
1560
<a href="<?php echo add_query_arg( array(
1561
- 'utm_source' => 'plugin-installation',
1562
- 'utm_medium' => $this->get_type(),
1563
'utm_campaign' => 'plugin-installation'
1564
), $url ); ?>" class="button button-primary"><?php _e( 'Find out more', 'codepress-admin-columns' ); ?></a>
1565
</div>
1566
<?php
1567
}
1568
-
1569
}
1
<?php
2
+
3
/**
4
* CPAC_Column class
5
*
49
* @since 2.0
50
*
51
* @param int $id ID
52
+ *
53
* @return string Value
54
*/
55
+ public function get_value( $id ) {
56
+ }
57
58
/**
59
* Get the raw, underlying value for the column
62
* @since 2.0.3
63
*
64
* @param int $id ID
65
+ *
66
* @return mixed Value
67
*/
68
+ public function get_raw_value( $id ) {
69
+ }
70
71
/**
72
* @since 2.0
73
*/
74
+ protected function display_settings() {
75
+ }
76
77
/**
78
* Overwrite this function in child class to sanitize
81
* @since 2.0
82
*
83
* @param $options array User submitted column options
84
+ *
85
* @return array Options
86
*/
87
protected function sanitize_options( $options ) {
119
*
120
* @since 2.3.4
121
*/
122
+ public function scripts() {
123
+ }
124
125
/**
126
* An object copy (clone) is created for creating multiple column instances.
130
public function __clone() {
131
132
// Force a copy of this->object, otherwise it will point to same object.
133
+ $this->options = clone $this->options;
134
+ $this->properties = clone $this->properties;
135
}
136
137
/**
154
155
// Default properties
156
$default_properties = array(
157
+ 'clone' => null, // Unique clone ID
158
+ 'type' => null, // Unique type
159
+ 'name' => null, // Unique name
160
+ 'label' => null, // Label which describes this column.
161
+ 'classes' => null, // Custom CSS classes for this column.
162
+ 'hide_label' => false, // Should the Label be hidden?
163
+ 'is_registered' => true, // Should the column be registered based on conditional logic, example usage see: 'post/page-template.php'
164
+ 'is_cloneable' => true, // Should the column be cloneable
165
+ 'default' => false, // Is this a WP default column,
166
+ 'group' => 'custom',
167
+ 'hidden' => false,
168
+ 'use_before_after' => false
169
);
170
171
// @since 2.4.7
177
178
// Default options
179
$default_options = array(
180
+ 'before' => '', // Before field
181
+ 'after' => '', // After field
182
+ 'width' => null, // Width for this column.
183
+ 'width_unit' => '%', // Unit for width; pecentage (%) or pixels (px).
184
+ 'state' => 'off' // Active state for this column.
185
);
186
187
/**
188
* Filter the default options for a column instance, such as label and width
189
*
190
* @since 2.2
191
+ *
192
* @param array $default_options Default column options
193
* @param CPAC_Storage_Model $storage_model Storage Model class instance
194
*/
218
* Property $column_instance added in Admin Columns 2.2
219
*
220
* @since 2.0
221
+ *
222
* @param array $properties Column properties
223
* @param CPAC_Storage_Model $storage_model Storage Model class instance
224
*/
246
$this->populate_options();
247
248
$this->sanitize_label();
249
+
250
+ // Filters
251
+ foreach ( $this->properties as $name => $value ) {
252
+ $this->properties->{$name} = apply_filters( "cac/column/properties/{$name}", $value, $this );
253
+ }
254
}
255
256
/**
258
* Added $options parameter in 2.2
259
*
260
* @since 2.0
261
+ *
262
* @param array $options Optional. Options to populate the storage model with. Defaults to options from database.
263
*/
264
+ public function populate_options( $options = null ) {
265
$this->options = (object) array_merge( (array) $this->options, is_array( $options ) ? $options : $this->read() );
266
}
267
268
/**
269
* @param string $property
270
+ *
271
* @return mixed $value
272
*/
273
public function set_properties( $property, $value ) {
278
279
/**
280
* @param string $option
281
+ *
282
* @return mixed $value
283
*/
284
public function set_options( $option, $value ) {
292
*/
293
public function set_filter( $filtering_model ) {
294
$this->filtering_model = $filtering_model;
295
+
296
return $this;
297
}
298
308
*/
309
public function set_editable( $editable_model ) {
310
$this->editable_model = $editable_model;
311
+
312
return $this;
313
}
314
321
322
/**
323
* @param int $id
324
+ *
325
* @return object
326
*/
327
public function set_clone( $id = null ) {
334
return $this;
335
}
336
337
+ /**
338
+ * @since 2.4.9
339
+ */
340
+ public function get_display_value( $id ) {
341
+ $value = $this->get_value( $id );
342
+
343
+ // add before and after string
344
+ if ( $value ) {
345
+ $value = $this->get_before() . $value . $this->get_after();
346
+ }
347
+
348
+ return $value;
349
+ }
350
+
351
/**
352
* @since 1.0
353
*/
354
public function get_before() {
355
+ return isset( $this->options->before ) ? stripslashes( $this->options->before ) : false;
356
}
357
358
/**
359
* @since 1.0
360
*/
361
public function get_after() {
362
+ return isset( $this->options->after ) ? stripslashes( $this->options->after ) : false;
363
}
364
365
/**
380
return $this->properties->name;
381
}
382
383
+ /**
384
+ * Get the type of the column.
385
+ *
386
+ * @since 2.4.9
387
+ */
388
+ public function get_type_label() {
389
+ return $this->properties->label;
390
+ }
391
+
392
/**
393
* Get the column options set by the user
394
*
423
* Checks column type
424
*
425
* @since 2.3.4
426
+ *
427
* @param string $type Column type. Also work without the 'column-' prefix. Example 'column-meta' or 'meta'.
428
+ *
429
* @return bool Matches column type
430
*/
431
public function is_type( $type ) {
462
463
/**
464
* @param string $field_key
465
+ *
466
* @return void
467
*/
468
public function attr_name( $field_name ) {
469
echo $this->get_attr_name( $field_name );
470
}
471
+
472
public function get_attr_name( $field_name ) {
473
return "{$this->storage_model->key}[{$this->properties->name}][{$field_name}]";
474
}
475
476
/**
477
* @param string $field_key
478
+ *
479
* @return string Attribute Name
480
*/
481
public function get_attr_id( $field_name ) {
482
return "cpac-{$this->storage_model->key}-{$this->properties->name}-{$field_name}";
483
}
484
+
485
public function attr_id( $field_name ) {
486
echo $this->get_attr_id( $field_name );
487
}
515
516
/**
517
* @since 2.0
518
+ *
519
* @param $options array User submitted column options
520
+ *
521
* @return array Options
522
*/
523
public function sanitize_storage( $options ) {
567
* Sanitizes label using intern wordpress function esc_url so it matches the label sorting url.
568
*
569
* @since 1.0
570
+ *
571
* @param string $string
572
+ *
573
* @return string Sanitized string
574
*/
575
public function get_sanitized_label() {
576
+
577
+ $string = $this->options->label;
578
+ $string = strip_tags( $string );
579
+ $string = preg_replace( "/[^a-zA-Z0-9]+/", "", $string );
580
$string = str_replace( 'http://', '', $string );
581
$string = str_replace( 'https://', '', $string );
582
609
if ( is_wp_error( $term_field ) ) {
610
return false;
611
}
612
+
613
return $term_field;
614
}
615
616
// since 2.4.8
617
public function get_raw_post_field( $field, $id ) {
618
global $wpdb;
619
+
620
return $id ? $wpdb->get_var( $wpdb->prepare( "SELECT " . $wpdb->_real_escape( $field ) . " FROM {$wpdb->posts} WHERE ID = %d LIMIT 1", $id ) ) : false;
621
}
622
627
628
/**
629
* @since 1.0
630
+ *
631
* @param int $post_id Post ID
632
+ *
633
* @return string Post Excerpt.
634
*/
635
+ protected function get_post_excerpt( $post_id, $words ) {
636
global $post;
637
638
+ $save_post = $post;
639
+ $post = get_post( $post_id );
640
641
setup_postdata( $post );
642
643
+ $excerpt = get_the_excerpt();
644
+ $post = $save_post;
645
646
if ( $post ) {
647
setup_postdata( $post );
667
668
/**
669
* @since 1.3.1
670
+ *
671
* @param string $name
672
* @param string $title
673
+ *
674
* @return string HTML img element
675
*/
676
public function get_asset_image( $name = '', $title = '' ) {
678
if ( ! $name ) {
679
return false;
680
}
681
+
682
return sprintf( "<img alt='' src='%s' title='%s'/>", CPAC_URL . "assets/images/{$name}", esc_attr( $title ) );
683
}
684
694
AND post_author = %d
695
AND post_type = %s
696
";
697
+
698
return $wpdb->get_var( $wpdb->prepare( $sql, $user_id, $post_type ) );
699
}
700
701
/**
702
* @since 1.2.0
703
+ *
704
* @param string $url
705
+ *
706
* @return bool
707
*/
708
protected function is_image_url( $url ) {
711
return false;
712
}
713
714
+ $validExt = array( '.jpg', '.jpeg', '.gif', '.png', '.bmp' );
715
+ $ext = strrchr( $url, '.' );
716
717
return in_array( $ext, $validExt );
718
}
723
*/
724
public function get_all_image_sizes() {
725
$image_sizes = array(
726
+ 'thumbnail' => __( "Thumbnail", 'codepress-admin-columns' ),
727
+ 'medium' => __( "Medium", 'codepress-admin-columns' ),
728
+ 'large' => __( "Large", 'codepress-admin-columns' ),
729
+ 'full' => __( "Full", 'codepress-admin-columns' )
730
);
731
732
+ foreach ( get_intermediate_image_sizes() as $size ) {
733
+ if ( ! isset( $image_sizes[ $size ] ) ) {
734
+ $image_sizes[ $size ] = ucwords( str_replace( '-', ' ', $size ) );
735
}
736
}
737
776
777
/**
778
* @since 2.0
779
+ *
780
* @param string $name
781
+ *
782
* @return array Image Sizes
783
*/
784
public function get_image_size_by_name( $name = '' ) {
803
*/
804
public function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) {
805
$resized = false;
806
+ $editor = wp_get_image_editor( $file );
807
808
+ if ( is_wp_error( $editor ) ) {
809
return false;
810
+ }
811
812
$editor->set_quality( $jpeg_quality );
813
814
$resized = $editor->resize( $max_w, $max_h, $crop );
815
+ if ( is_wp_error( $resized ) ) {
816
return false;
817
+ }
818
819
$dest_file = $editor->generate_filename( $suffix, $dest_path );
820
821
$saved = $editor->save( $dest_file );
822
823
+ if ( is_wp_error( $saved ) ) {
824
return false;
825
+ }
826
827
$resized = $dest_file;
828
838
return false;
839
}
840
$text_color = $this->get_text_color( $color_hex );
841
+
842
return "<div class='cpac-color'><span style='background-color:{$color_hex};color:{$text_color}'>{$color_hex}</span></div>";
843
}
844
851
852
$rgb = $this->hex2rgb( $bg_color );
853
854
+ return $rgb && ( ( $rgb[0] * 0.299 + $rgb[1] * 0.587 + $rgb[2] * 0.114 ) < 186 ) ? '#ffffff' : '#333333';
855
}
856
857
/**
862
public function hex2rgb( $hex ) {
863
$hex = str_replace( "#", "", $hex );
864
865
+ if ( strlen( $hex ) == 3 ) {
866
+ $r = hexdec( substr( $hex, 0, 1 ) . substr( $hex, 0, 1 ) );
867
+ $g = hexdec( substr( $hex, 1, 1 ) . substr( $hex, 1, 1 ) );
868
+ $b = hexdec( substr( $hex, 2, 1 ) . substr( $hex, 2, 1 ) );
869
} else {
870
+ $r = hexdec( substr( $hex, 0, 2 ) );
871
+ $g = hexdec( substr( $hex, 2, 2 ) );
872
+ $b = hexdec( substr( $hex, 4, 2 ) );
873
}
874
+ $rgb = array( $r, $g, $b );
875
876
return $rgb;
877
}
882
* @since 2.3
883
*
884
* @param string $input Input string
885
+ *
886
* @return int Number of words
887
*/
888
public function str_count_words( $input ) {
890
$patterns = array(
891
'strip' => '/<[a-zA-Z\/][^<>]*>/',
892
'clean' => '/[0-9.(),;:!?%#$¿\'"_+=\\/-]+/',
893
+ 'w' => '/\S\s+/',
894
+ 'c' => '/\S/'
895
);
896
897
$type = 'w';
909
910
/**
911
* @since 1.0
912
+ *
913
* @param mixed $meta Image files or Image ID's
914
* @param array $args
915
+ *
916
* @return array HTML img elements
917
*/
918
public function get_thumbnails( $images, $args = array() ) {
925
if ( is_string( $images ) || is_numeric( $images ) ) {
926
if ( strpos( $images, ',' ) !== false ) {
927
$images = array_filter( explode( ',', $this->strip_trim( str_replace( ' ', '', $images ) ) ) );
928
+ } else {
929
$images = array( $images );
930
}
931
}
932
933
// Image size
934
$defaults = array(
935
+ 'image_size' => 'cpac-custom',
936
+ 'image_size_w' => 80,
937
+ 'image_size_h' => 80,
938
);
939
$args = wp_parse_args( $args, $defaults );
940
941
extract( $args );
942
943
$thumbnails = array();
944
+ foreach ( $images as $value ) {
945
946
if ( $this->is_image_url( $value ) ) {
947
957
958
// try to resize image
959
if ( $resized = $this->image_resize( $image_path, $image_size_w, $image_size_h, true ) ) {
960
+ $thumbnails[] = "<img src='" . str_replace( WP_CONTENT_DIR, WP_CONTENT_URL, $resized ) . "' alt='' width='{$image_size_w}' height='{$image_size_h}' />";
961
+ } // return full image with maxed dimensions
962
else {
963
$thumbnails[] = "<img src='{$value}' alt='' style='max-width:{$image_size_w}px;max-height:{$image_size_h}px' />";
964
}
965
}
966
+ } // Media Attachment
967
elseif ( is_numeric( $value ) && wp_get_attachment_url( $value ) ) {
968
969
$src = '';
971
$height = '';
972
973
if ( ! $image_size || 'cpac-custom' == $image_size ) {
974
+ $width = $image_size_w;
975
+ $height = $image_size_h;
976
977
// to make sure wp_get_attachment_image_src() get the image with matching dimensions.
978
$image_size = array( $width, $height );
980
981
// Is Image
982
if ( $attributes = wp_get_attachment_image_src( $value, $image_size ) ) {
983
+
984
+ $src = $attributes[0];
985
+ $width = $attributes[1];
986
+ $height = $attributes[2];
987
988
// image size by name
989
if ( $sizes = $this->get_image_size_by_name( $image_size ) ) {
990
+ $width = $sizes['width'];
991
+ $height = $sizes['height'];
992
}
993
+ } // Is File, use icon
994
elseif ( $attributes = wp_get_attachment_image_src( $value, $image_size, true ) ) {
995
$src = $attributes[0];
996
999
$height = $sizes['height'];
1000
}
1001
}
1002
+ if ( is_array( $image_size ) ) {
1003
+ $width = $image_size_w;
1004
+ $height = $image_size_h;
1005
1006
+ $thumbnails[] = "<span class='cpac-column-value-image' style='width:{$width}px;height:{$height}px; background-size: cover; background-image: url({$src}); background-position: center;'></span>";
1007
+
1008
+ } else {
1009
+ $max = max( array( $width, $height ) );
1010
+ $thumbnails[] = "<span class='cpac-column-value-image' style='width:{$width}px;height:{$height}px;'><img style='max-width:{$max}px;max-height:{$max}px;' src='{$src}' alt=''/></span>";
1011
+ }
1012
1013
}
1014
}
1015
1020
* Implode for multi dimensional array
1021
*
1022
* @since 1.0
1023
+ *
1024
* @param string $glue
1025
* @param array $pieces
1026
+ *
1027
* @return string Imploded array
1028
*/
1029
public function recursive_implode( $glue, $pieces ) {
1030
+ foreach ( $pieces as $r_pieces ) {
1031
if ( is_array( $r_pieces ) ) {
1032
$retVal[] = $this->recursive_implode( $glue, $r_pieces );
1033
+ } else {
1034
$retVal[] = $r_pieces;
1035
}
1036
}
1037
+ if ( isset( $retVal ) && is_array( $retVal ) ) {
1038
return implode( $glue, $retVal );
1039
}
1040
1045
* Get timestamp
1046
*
1047
* @since 2.0
1048
+ *
1049
* @param string $date
1050
+ *
1051
* @return string Formatted date
1052
*/
1053
public function get_timestamp( $date ) {
1072
1073
// Date format: yyyymmdd ( often used by ACF ) must start with 19xx or 20xx and is 8 long
1074
// @todo: in theory a numeric string of 8 can also be a unixtimestamp; no conversion would be needed
1075
+ if ( 8 === $length && ( strpos( $date, '20' ) === 0 || strpos( $date, '19' ) === 0 ) ) {
1076
$date = strtotime( $date );
1077
}
1078
+ } // Parse with strtotime if it's not numeric
1079
else {
1080
$date = strtotime( $date );
1081
}
1085
1086
/**
1087
* @since 1.3.1
1088
+ *
1089
* @param string $date
1090
+ *
1091
* @return string Formatted date
1092
*/
1093
public function get_date( $date, $format = '' ) {
1104
1105
/**
1106
* @since 1.3.1
1107
+ *
1108
* @param string $date
1109
+ *
1110
* @return string Formatted time
1111
*/
1112
protected function get_time( $date, $format = '' ) {
1141
$display_as = $this->options->display_author_as;
1142
1143
if ( 'first_last_name' == $display_as ) {
1144
+ $first = ! empty( $userdata->first_name ) ? $userdata->first_name : '';
1145
+ $last = ! empty( $userdata->last_name ) ? " {$userdata->last_name}" : '';
1146
+ $name = $first . $last;
1147
+ } elseif ( ! empty( $userdata->{$display_as} ) ) {
1148
$name = $userdata->{$display_as};
1149
}
1150
}
1157
return $name;
1158
}
1159
1160
/**
1161
* @since 2.0
1162
+ *
1163
* @param string $field_key
1164
+ *
1165
* @return string Attribute Name
1166
*/
1167
public function label_view( $label, $description = '', $pointer = '' ) {
1169
<td class="label">
1170
<label for="<?php $this->attr_id( $pointer ); ?>">
1171
<?php echo stripslashes( $label ); ?>
1172
+ <?php if ( $description ) : ?><p class="description"><?php echo $description; ?></p><?php endif; ?>
1173
</label>
1174
</td>
1175
<?php
1180
*/
1181
public function display_field_date_format() {
1182
1183
+ $field_key = 'date_format';
1184
+ $label = __( 'Date Format', 'codepress-admin-columns' );
1185
+ $description = __( 'This will determine how the date will be displayed.', 'codepress-admin-columns' );
1186
1187
?>
1188
<tr class="column_<?php echo $field_key; ?>">
1189
<?php $this->label_view( $label, $description, $field_key ); ?>
1190
<td class="input">
1191
<input type="text" name="<?php $this->attr_name( $field_key ); ?>" id="<?php $this->attr_id( $field_key ); ?>" value="<?php echo $this->options->date_format; ?>" placeholder="<?php _e( 'Example:', 'codepress-admin-columns' ); ?> d M Y H:i"/>
1192
+
1193
<p class="description">
1194
+ <?php printf( __( "Leave empty for WordPress date format, change your <a href='%s'>default date format here</a>.", 'codepress-admin-columns' ), admin_url( 'options-general.php' ) . '#date_format_custom_radio' ); ?>
1195
<a target='_blank' href='http://codex.wordpress.org/Formatting_Date_and_Time'><?php _e( 'Documentation on date and time formatting.', 'codepress-admin-columns' ); ?></a>
1196
</p>
1197
</td>
1205
*/
1206
public function display_field_excerpt_length() {
1207
1208
+ $field_key = 'excerpt_length';
1209
+ $label = __( 'Excerpt length', 'codepress-admin-columns' );
1210
+ $description = __( 'Number of words', 'codepress-admin-columns' );
1211
1212
?>
1213
<tr class="column_<?php echo $field_key; ?>">
1216
<input type="text" name="<?php $this->attr_name( $field_key ); ?>" id="<?php $this->attr_id( $field_key ); ?>" value="<?php echo $this->options->excerpt_length; ?>"/>
1217
</td>
1218
</tr>
1219
+ <?php
1220
+ }
1221
+
1222
+ /**
1223
+ * @since 2.4.9
1224
+ */
1225
+ public function display_field_link_label() {
1226
+ $field_key = 'link_label';
1227
+ $label = __( 'Link label', 'codepress-admin-columns' );
1228
+ $description = __( 'Leave blank to display the url', 'codepress-admin-columns' );
1229
+
1230
+ ?>
1231
+ <tr class="column_<?php echo $field_key; ?>">
1232
+ <?php $this->label_view( $label, $description, $field_key ); ?>
1233
+ <td class="input">
1234
+ <input type="text" name="<?php $this->attr_name( $field_key ); ?>" id="<?php $this->attr_id( $field_key ); ?>" value="<?php echo $this->options->link_label; ?>"/>
1235
+ </td>
1236
+ </tr>
1237
+ <?php
1238
}
1239
1240
/**
1242
*/
1243
public function display_field_preview_size() {
1244
1245
+ $field_key = 'image_size';
1246
+ $label = __( 'Preview size', 'codepress-admin-columns' );
1247
1248
?>
1249
<tr class="column_<?php echo $field_key; ?>">
1259
<?php endforeach; ?>
1260
1261
<div class="custom_image_size">
1262
+ <label for="<?php $this->attr_id( $field_key ); ?>-custom" class="custom-size image-size-custom">
1263
<input type="radio" value="cpac-custom" name="<?php $this->attr_name( $field_key ); ?>" id="<?php $this->attr_id( $field_key ); ?>-custom"<?php checked( $this->options->image_size, 'cpac-custom' ); ?>><?php _e( 'Custom', 'codepress-admin-columns' ); ?>
1264
</label>
1265
+ <label for="<?php $this->attr_id( $field_key ); ?>-w"
1266
+ class="custom-size-w<?php echo $this->options->image_size != 'cpac-custom' ? ' hidden' : ''; ?>">
1267
+ <input type="text" name="<?php $this->attr_name( 'image_size_w' ); ?>" id="<?php $this->attr_id( $field_key ); ?>-w" value="<?php echo $this->options->image_size_w; ?>"/><?php _e( 'width', 'codepress-admin-columns' ); ?>
1268
</label>
1269
+ <label for="<?php $this->attr_id( $field_key ); ?>-h"
1270
+ class="custom-size-h<?php echo $this->options->image_size != 'cpac-custom' ? ' hidden' : ''; ?>">
1271
+ <input type="text" name="<?php $this->attr_name( 'image_size_h' ); ?>" id="<?php $this->attr_id( $field_key ); ?>-h" value="<?php echo $this->options->image_size_h; ?>"/><?php _e( 'height', 'codepress-admin-columns' ); ?>
1272
</label>
1273
</div>
1274
</td>
1275
</tr>
1276
+ <?php
1277
}
1278
1279
/**
1290
public function display_field_user_format() {
1291
1292
$nametypes = array(
1293
+ 'display_name' => __( 'Display Name', 'codepress-admin-columns' ),
1294
+ 'first_name' => __( 'First Name', 'codepress-admin-columns' ),
1295
+ 'last_name' => __( 'Last Name', 'codepress-admin-columns' ),
1296
+ 'nickname' => __( 'Nickname', 'codepress-admin-columns' ),
1297
+ 'user_login' => __( 'User Login', 'codepress-admin-columns' ),
1298
+ 'user_email' => __( 'User Email', 'codepress-admin-columns' ),
1299
+ 'ID' => __( 'User ID', 'codepress-admin-columns' ),
1300
+ 'first_last_name' => __( 'First and Last Name', 'codepress-admin-columns' ),
1301
);
1302
1303
$this->display_field_select( 'display_author_as', __( 'Display format', 'codepress-admin-columns' ), $nametypes, __( 'This is the format of the author name.', 'codepress-admin-columns' ) );
1305
1306
/**
1307
* @since 2.3.4
1308
+ *
1309
* @param string $name Name of the column option
1310
* @param string $label Label
1311
* @param array $options Select options
1322
<?php $this->label_view( $label, $description, $name ); ?>
1323
<td class="input">
1324
<select name="<?php $this->attr_name( $name ); ?>" id="<?php $this->attr_id( $name ); ?>">
1325
+ <?php foreach ( $options as $key => $label ) : ?>
1326
+ <option value="<?php echo $key; ?>"<?php selected( $key, $current ); ?>><?php echo $label; ?></option>
1327
+ <?php endforeach; ?>
1328
</select>
1329
</td>
1330
</tr>
1333
1334
/**
1335
* @since 2.3.4
1336
+ *
1337
* @param string $name Name of the column option
1338
* @param string $label Label
1339
* @param array $options Select options
1352
1353
/**
1354
* @since 2.4.8
1355
+ *
1356
* @param string $name Name of the column option
1357
* @param string $value
1358
*/
1396
1397
/**
1398
* @since 2.0
1399
+ *
1400
* @param array Column Objects
1401
+ *
1402
* @return string HTML List
1403
*/
1404
public function get_column_list( $columns = array(), $label = '' ) {
1435
*/
1436
public function display() {
1437
1438
+ $classes = implode( ' ', array_filter( array( "cpac-box-{$this->properties->type}", $this->properties->classes ) ) );
1439
1440
// column list
1441
$column_list = '';
1450
1451
?>
1452
<div class="cpac-column <?php echo $classes; ?>" data-type="<?php echo $this->properties->type; ?>"<?php echo $data_clone; ?>>
1453
+ <input type="hidden" class="column-name" name="<?php echo $this->attr_name( 'column-name' ); ?>" value="<?php echo esc_attr( $this->properties->name ); ?>"/>
1454
+ <input type="hidden" class="type" name="<?php echo $this->attr_name( 'type' ); ?>" value="<?php echo $this->properties->type; ?>"/>
1455
+ <input type="hidden" class="clone" name="<?php echo $this->attr_name( 'clone' ); ?>" value="<?php echo $this->properties->clone; ?>"/>
1456
+
1457
<div class="column-meta">
1458
<table class="widefat">
1459
<tbody>
1460
+ <tr>
1461
+ <td class="column_sort"></td>
1462
+ <td class="column_label">
1463
+ <div class="inner">
1464
+ <div class="meta">
1465
+
1466
+ <span title="<?php echo esc_attr( __( 'width', 'codepress-admin-columns' ) ); ?>" class="width" data-indicator-id="">
1467
+ <?php echo ! empty( $this->options->width ) ? $this->options->width . $this->options->width_unit : ''; ?>
1468
+ </span>
1469
+
1470
+ <?php
1471
+ /**
1472
+ * Fires in the meta-element for column options, which is displayed right after the column label
1473
+ *
1474
+ * @since 2.0
1475
+ *
1476
+ * @param CPAC_Column $column_instance Column class instance
1477
+ */
1478
+ do_action( 'cac/column/settings_meta', $this );
1479
+
1480
+ /**
1481
+ * @deprecated 2.2 Use cac/column/settings_meta instead
1482
+ */
1483
+ do_action( 'cac/column/label', $this );
1484
+ ?>
1485
+
1486
</div>
1487
+ <a class="toggle" href="javascript:;"><?php echo stripslashes( $this->get_label() ); ?></a>
1488
+ <a class="edit-button" href="javascript:;"><?php _e( 'Edit', 'codepress-admin-columns' ); ?></a>
1489
+ <?php if ( $this->properties->is_cloneable ) : ?>
1490
+ <a class="clone-button" href="#"><?php _e( 'Clone', 'codepress-admin-columns' ); ?></a>
1491
+ <?php endif; ?>
1492
+ <a class="remove-button" href="javascript:;"><?php _e( 'Remove', 'codepress-admin-columns' ); ?></a>
1493
+ </div>
1494
+ </td>
1495
+ <td class="column_type">
1496
+ <div class="inner">
1497
+ <a href="#"><?php echo stripslashes( $this->properties->label ); ?></a>
1498
+ </div>
1499
+ </td>
1500
+ <td class="column_edit"></td>
1501
+ </tr>
1502
</tbody>
1503
</table>
1504
</div><!--.column-meta-->
1506
<div class="column-form">
1507
<table class="widefat">
1508
<tbody>
1509
+ <tr class="column_type">
1510
+ <?php $this->label_view( __( 'Type', 'codepress-admin-columns' ), __( 'Choose a column type.', 'codepress-admin-columns' ) . '<em>' . __( 'Type', 'codepress-admin-columns' ) . ': ' . $this->properties->type . '</em><em>' . __( 'Name', 'codepress-admin-columns' ) . ': ' . $this->properties->name . '</em>', 'type' ); ?>
1511
+ <td class="input">
1512
+ <select name="<?php $this->attr_name( 'type' ); ?>" id="<?php $this->attr_id( 'type' ); ?>">
1513
+ <?php echo $column_list; ?>
1514
+ </select>
1515
+
1516
+ <div class="msg"></div>
1517
+ </td>
1518
+ </tr><!--.column_label-->
1519
+
1520
+ <tr class="column_label<?php echo $this->properties->hide_label ? ' hidden' : ''; ?>">
1521
+ <?php $this->label_view( __( 'Label', 'codepress-admin-columns' ), __( 'This is the name which will appear as the column header.', 'codepress-admin-columns' ), 'label' ); ?>
1522
+ <td class="input">
1523
+ <input class="text" type="text" name="<?php $this->attr_name( 'label' ); ?>" id="<?php $this->attr_id( 'label' ); ?>" value="<?php echo esc_attr( $this->options->label ); //echo sanitize_text_field( $this->options->label ); ?>"/>
1524
+ </td>
1525
+ </tr><!--.column_label-->
1526
+
1527
+ <tr class="column_width">
1528
+ <?php $this->label_view( __( 'Width', 'codepress-admin-columns' ), '', 'width' ); ?>
1529
+ <td class="input">
1530
+ <div class="description" title="<?php _e( 'default', 'codepress-admin-columns' ); ?>">
1531
+ <input class="width" type="text" placeholder="<?php _e( 'auto', 'codepress-admin-columns' ); ?>" name="<?php $this->attr_name( 'width' ); ?>" id="<?php $this->attr_id( 'width' ); ?>" value="<?php echo $this->options->width; ?>"/>
1532
+ <span class="unit"><?php echo $this->options->width_unit; ?></span>
1533
+ </div>
1534
+ <div class="width-slider"></div>
1535
+
1536
+ <div class="unit-select">
1537
+ <label for="<?php $this->attr_id( 'width_unit_px' ); ?>">
1538
+ <input type="radio" class="unit" name="<?php $this->attr_name( 'width_unit' ); ?>" id="<?php $this->attr_id( 'width_unit_px' ); ?>" value="px"<?php checked( $this->options->width_unit, 'px' ); ?>/>px
1539
+ </label>
1540
+ <label for="<?php $this->attr_id( 'width_unit_perc' ); ?>">
1541
+ <input type="radio" class="unit" name="<?php $this->attr_name( 'width_unit' ); ?>" id="<?php $this->attr_id( 'width_unit_perc' ); ?>" value="%"<?php checked( $this->options->width_unit, '%' ); ?>/>%
1542
+ </label>
1543
+ </div>
1544
+
1545
+ </td>
1546
+ </tr><!--.column_width-->
1547
+
1548
+ <?php
1549
+ /**
1550
+ * Fires directly before the custom options for a column are displayed in the column form
1551
+ *
1552
+ * @since 2.0
1553
+ *
1554
+ * @param CPAC_Column $column_instance Column class instance
1555
+ */
1556
+ do_action( 'cac/column/settings_before', $this );
1557
+ ?>
1558
+
1559
+ <?php
1560
+ /**
1561
+ * Load specific column settings.
1562
+ *
1563
+ */
1564
+ $this->display_settings();
1565
+
1566
+ ?>
1567
+
1568
+ <?php
1569
+ /**
1570
+ * Load before and after fields for custom columns.
1571
+ *
1572
+ */
1573
+ if ( $this->properties->use_before_after && ! $this->properties->default ) {
1574
+ $this->display_field_before_after();
1575
+ }
1576
+ ?>
1577
+
1578
+ <?php
1579
+ /**
1580
+ * Fires directly after the custom options for a column are displayed in the column form
1581
+ *
1582
+ * @since 2.0
1583
+ *
1584
+ * @param CPAC_Column $column_instance Column class instance
1585
+ */
1586
+ do_action( 'cac/column/settings_after', $this );
1587
+ ?>
1588
+
1589
+ <tr class="column_action">
1590
+ <td colspan="2">
1591
+ <p>
1592
+ <?php if ( $this->properties->is_cloneable ) : ?>
1593
+ <a class="clone-button" href="#"><?php _e( 'Clone', 'codepress-admin-columns' ); ?></a>
1594
+ <?php endif; ?>
1595
+ <a href="javascript:;" class="remove-button"><?php _e( 'Remove' ); ?></a>
1596
+ </p>
1597
+ </td>
1598
+ </tr>
1599
1600
</tbody>
1601
</table>
1602
+ </div><!--.column-form-->
1603
+ </div><!--.cpac-column-->
1604
<?php
1605
}
1606
1614
'post_property_display',
1615
__( 'Property To Display', 'codepress-admin-columns' ),
1616
array(
1617
+ 'title' => __( 'Title' ), // default
1618
+ 'id' => __( 'ID' ),
1619
'author' => __( 'Author' )
1620
),
1621
__( 'Post property to display for related post(s).', 'codepress-admin-columns' )
1632
'post_link_to',
1633
__( 'Link To', 'codepress-admin-columns' ),
1634
array(
1635
+ '' => __( 'None' ),
1636
+ 'edit_post' => __( 'Edit Post' ),
1637
+ 'view_post' => __( 'View Post' ),
1638
'edit_author' => __( 'Edit Post Author', 'codepress-admin-columns' ),
1639
'view_author' => __( 'View Public Post Author Page', 'codepress-admin-columns' )
1640
),
1650
<p>
1651
<strong><?php printf( __( "The %s column is only available in Admin Columns Pro - Business or Developer.", 'codepress-admin-columns' ), $this->get_label() ); ?></strong>
1652
</p>
1653
+
1654
<p>
1655
<?php printf( __( "If you have a business or developer licence please download & install your %s add-on from the <a href='%s'>add-ons tab</a>.", 'codepress-admin-columns' ), $this->get_label(), admin_url( 'options-general.php?page=codepress-admin-columns&tab=addons' ) ); ?>
1656
</p>
1657
+
1658
<p>
1659
<?php printf( __( "Admin Columns Pro offers full %s integration, allowing you to easily display and edit %s fields from within your overview.", 'codepress-admin-columns' ), $this->get_label(), $this->get_label() ); ?>
1660
</p>
1661
<a href="<?php echo add_query_arg( array(
1662
+ 'utm_source' => 'plugin-installation',
1663
+ 'utm_medium' => $this->get_type(),
1664
'utm_campaign' => 'plugin-installation'
1665
), $url ); ?>" class="button button-primary"><?php _e( 'Find out more', 'codepress-admin-columns' ); ?></a>
1666
</div>
1667
<?php
1668
}
1669
}
classes/column/acf-placeholder.php CHANGED
@@ -18,6 +18,6 @@ class CPAC_Column_ACF_Placeholder extends CPAC_Column {
18
}
19
20
public function display_settings() {
21
- $this->display_settings_placeholder( 'https://www.admincolumns.com/advanced-custom-fields-columns/' );
22
}
23
}
18
}
19
20
public function display_settings() {
21
+ $this->display_settings_placeholder( ac_get_site_url( 'advanced-custom-fields-columns' ) );
22
}
23
}
classes/column/custom-field.php CHANGED
@@ -1,4 +1,5 @@
1
<?php
2
/**
3
* Custom field column, displaying the contents of meta fields.
4
* Suited for all storage models supporting WordPress' default way of handling meta data.
@@ -19,26 +20,28 @@ class CPAC_Column_Custom_Field extends CPAC_Column {
19
parent::init();
20
21
// Properties
22
- $this->properties['type'] = 'column-meta';
23
- $this->properties['label'] = __( 'Custom Field', 'codepress-admin-columns' );
24
- $this->properties['classes'] = 'cpac-box-metafield';
25
- $this->properties['is_cloneable'] = true;
26
- $this->properties['group'] = 'custom-field';
27
28
// Options
29
- $this->options['field'] = '';
30
- $this->options['field_type'] = '';
31
- $this->options['before'] = '';
32
- $this->options['after'] = '';
33
34
- $this->options['image_size'] = '';
35
- $this->options['image_size_w'] = 80;
36
- $this->options['image_size_h'] = 80;
37
38
- $this->options['excerpt_length'] = 15;
39
40
- $this->options['date_format'] = '';
41
- $this->options['date_save_format'] = '';
42
}
43
44
/**
@@ -92,19 +95,20 @@ class CPAC_Column_Custom_Field extends CPAC_Column {
92
public function get_custom_field_types() {
93
94
$custom_field_types = array(
95
- '' => __( 'Default', 'codepress-admin-columns' ),
96
- 'checkmark' => __( 'Checkmark (true/false)', 'codepress-admin-columns' ),
97
- 'color' => __( 'Color', 'codepress-admin-columns' ),
98
- 'count' => __( 'Counter', 'codepress-admin-columns' ),
99
- 'date' => __( 'Date', 'codepress-admin-columns' ),
100
- 'excerpt' => __( 'Excerpt'),
101
- 'image' => __( 'Image', 'codepress-admin-columns' ),
102
- 'library_id' => __( 'Media Library', 'codepress-admin-columns' ),
103
- 'array' => __( 'Multiple Values', 'codepress-admin-columns' ),
104
- 'numeric' => __( 'Numeric', 'codepress-admin-columns' ),
105
- 'title_by_id' => __( 'Post Title (Post ID\'s)', 'codepress-admin-columns' ),
106
- 'user_by_id' => __( 'Username (User ID\'s)', 'codepress-admin-columns' ),
107
- 'term_by_id' => __( 'Term Name (Term ID\'s)', 'codepress-admin-columns' ),
108
);
109
110
// deprecated. do not use, will be removed.
@@ -128,12 +132,13 @@ class CPAC_Column_Custom_Field extends CPAC_Column {
128
* @since 1.0
129
*
130
* @param string $meta
131
* @return string Titles
132
*/
133
public function get_ids_from_meta( $meta ) {
134
135
//remove white spaces and strip tags
136
- $meta = $this->strip_trim( str_replace( ' ','', $meta ) );
137
138
// var
139
$ids = array();
@@ -141,8 +146,7 @@ class CPAC_Column_Custom_Field extends CPAC_Column {
141
// check for multiple id's
142
if ( strpos( $meta, ',' ) !== false ) {
143
$ids = explode( ',', $meta );
144
- }
145
- elseif ( is_numeric( $meta ) ) {
146
$ids[] = $meta;
147
}
148
@@ -155,6 +159,7 @@ class CPAC_Column_Custom_Field extends CPAC_Column {
155
* @since 1.0
156
*
157
* @param string $meta
158
* @return string Titles
159
*/
160
private function get_titles_by_id( $ids ) {
@@ -176,25 +181,44 @@ class CPAC_Column_Custom_Field extends CPAC_Column {
176
}
177
}
178
179
- return implode('<span class="cpac-divider"></span>', $titles);
180
}
181
182
/**
183
* Get Users by ID - Value method
184
*
185
* @since 1.0
186
*
187
* @param string $meta
188
* @return string Users
189
*/
190
- private function get_users_by_id( $meta ) {
191
192
$names = array();
193
194
// display username
195
if ( $ids = $this->get_ids_from_meta( $meta ) ) {
196
foreach ( (array) $ids as $id ) {
197
- if ( ! is_numeric( $id ) ) continue;
198
199
$userdata = get_userdata( $id );
200
if ( is_object( $userdata ) && ! empty( $userdata->display_name ) ) {
@@ -216,13 +240,15 @@ class CPAC_Column_Custom_Field extends CPAC_Column {
216
* @since 2.3.2
217
*
218
* @param array $meta_value Term ID's
219
* @return string Terms
220
*/
221
- public function get_terms_by_id( $meta_value ) {
222
// as used by Pods, @todo
223
- if ( ! is_array( $meta_value) || ! isset( $meta_value['term_id'] ) || ! isset( $meta_value['taxonomy'] ) ) {
224
return false;
225
}
226
return $this->get_terms_for_display( $meta_value['term_id'], $meta_value['taxonomy'] );
227
}
228
@@ -233,6 +259,7 @@ class CPAC_Column_Custom_Field extends CPAC_Column {
233
*
234
* @param string $meta Contains Meta Value
235
* @param int $id Optional Object ID
236
* @return string Users
237
*/
238
public function get_value_by_meta( $meta, $id = null ) {
@@ -242,10 +269,10 @@ class CPAC_Column_Custom_Field extends CPAC_Column {
242
case "image" :
243
case "library_id" :
244
$meta = implode( $this->get_thumbnails( $meta, array(
245
- 'image_size' => $this->options->image_size,
246
- 'image_size_w' => $this->options->image_size_w,
247
- 'image_size_h' => $this->options->image_size_h,
248
- )));
249
break;
250
251
case "excerpt" :
@@ -256,6 +283,10 @@ class CPAC_Column_Custom_Field extends CPAC_Column {
256
$meta = $this->get_date( $meta, $this->options->date_format );
257
break;
258
259
case "title_by_id" :
260
$meta = $this->get_titles_by_id( $meta );
261
break;
@@ -313,6 +344,7 @@ class CPAC_Column_Custom_Field extends CPAC_Column {
313
* @since 1.0
314
*
315
* @param int $id ID
316
* @return string Meta Value
317
*/
318
public function get_meta_by_id( $id ) {
@@ -367,14 +399,6 @@ class CPAC_Column_Custom_Field extends CPAC_Column {
367
*/
368
$value = apply_filters( 'cac/column/meta/value', $value, $id, $this );
369
370
- $before = $this->get_before();
371
- $after = $this->get_after();
372
-
373
- // add before and after string
374
- if ( $value ) {
375
- $value = "{$before}{$value}{$after}";
376
- }
377
-
378
return $value;
379
}
380
@@ -417,28 +441,35 @@ class CPAC_Column_Custom_Field extends CPAC_Column {
417
* @see CPAC_Column::display_settings()
418
* @since 1.0
419
*/
420
- public function display_settings() { ?>
421
- <tr class="column_field">
422
- <?php $this->label_view( __( "Custom Field", 'codepress-admin-columns' ), __( "Select your custom field.", 'codepress-admin-columns' ), 'field' ); ?>
423
- <td class="input">
424
- <?php
425
- if ( $list = $this->get_meta_keys_list() ) {
426
- echo $list;
427
- }
428
- else {
429
- _e( 'No custom fields available.', 'codepress-admin-columns' ); ?> <?php printf( __( 'Please create a %s item first.', 'codepress-admin-columns' ), '<strong>' . $this->storage_model->singular_label . '</strong>' );
430
- }
431
- ?>
432
- </td>
433
- </tr>
434
435
<tr class="column_field_type" data-refresh="1">
436
<?php $this->label_view( __( "Field Type", 'codepress-admin-columns' ), __( 'This will determine how the value will be displayed.', 'codepress-admin-columns' ) . '<em>' . __( 'Type', 'codepress-admin-columns' ) . ': ' . $this->options->field_type . '</em>', 'field_type' ); ?>
437
<td class="input">
438
<select name="<?php $this->attr_name( 'field_type' ); ?>" id="<?php $this->attr_id( 'field_type' ); ?>">
439
- <?php foreach ( $this->get_custom_field_types() as $fieldkey => $fieldtype ) : ?>
440
- <option value="<?php echo $fieldkey ?>"<?php selected( $fieldkey, $this->options->field_type ) ?>><?php echo $fieldtype; ?></option>
441
- <?php endforeach; ?>
442
</select>
443
</td>
444
</tr>
@@ -448,15 +479,16 @@ class CPAC_Column_Custom_Field extends CPAC_Column {
448
case 'date':
449
$this->display_field_date_format();
450
break;
451
- case 'image':
452
- case 'library_id':
453
- $this->display_field_preview_size();
454
- break;
455
- case 'excerpt':
456
- $this->display_field_excerpt_length();
457
- break;
458
}
459
-
460
- $this->display_field_before_after();
461
}
462
}
1
<?php
2
+
3
/**
4
* Custom field column, displaying the contents of meta fields.
5
* Suited for all storage models supporting WordPress' default way of handling meta data.
20
parent::init();
21
22
// Properties
23
+ $this->properties['type'] = 'column-meta';
24
+ $this->properties['label'] = __( 'Custom Field', 'codepress-admin-columns' );
25
+ $this->properties['classes'] = 'cpac-box-metafield';
26
+ $this->properties['group'] = 'custom-field';
27
+ $this->properties['use_before_after'] = true;
28
29
// Options
30
+ $this->options['field'] = '';
31
+ $this->options['field_type'] = '';
32
+ $this->options['before'] = '';
33
+ $this->options['after'] = '';
34
+
35
+ $this->options['image_size'] = '';
36
+ $this->options['image_size_w'] = 80;
37
+ $this->options['image_size_h'] = 80;
38
39
+ $this->options['excerpt_length'] = 15;
40
41
+ $this->options['link_label'] = '';
42
43
+ $this->options['date_format'] = '';
44
+ $this->options['date_save_format'] = '';
45
}
46
47
/**
95
public function get_custom_field_types() {
96
97
$custom_field_types = array(
98
+ '' => __( 'Default', 'codepress-admin-columns' ),
99
+ 'checkmark' => __( 'Checkmark (true/false)', 'codepress-admin-columns' ),
100
+ 'color' => __( 'Color', 'codepress-admin-columns' ),
101
+ 'count' => __( 'Counter', 'codepress-admin-columns' ),
102
+ 'date' => __( 'Date', 'codepress-admin-columns' ),
103
+ 'excerpt' => __( 'Excerpt' ),
104
+ 'image' => __( 'Image', 'codepress-admin-columns' ),
105
+ 'library_id' => __( 'Media Library', 'codepress-admin-columns' ),
106
+ 'link' => __( 'Url', 'codepress-admin-columns' ),
107
+ 'array' => __( 'Multiple Values', 'codepress-admin-columns' ),
108
+ 'numeric' => __( 'Numeric', 'codepress-admin-columns' ),
109
+ 'title_by_id' => __( 'Post Title (Post ID\'s)', 'codepress-admin-columns' ),
110
+ 'user_by_id' => __( 'Username (User ID\'s)', 'codepress-admin-columns' ),
111
+ 'term_by_id' => __( 'Term Name (Term ID\'s)', 'codepress-admin-columns' ),
112
);
113
114
// deprecated. do not use, will be removed.
132
* @since 1.0
133
*
134
* @param string $meta
135
+ *
136
* @return string Titles
137
*/
138
public function get_ids_from_meta( $meta ) {
139
140
//remove white spaces and strip tags
141
+ $meta = $this->strip_trim( str_replace( ' ', '', $meta ) );
142
143
// var
144
$ids = array();
146
// check for multiple id's
147
if ( strpos( $meta, ',' ) !== false ) {
148
$ids = explode( ',', $meta );
149
+ } elseif ( is_numeric( $meta ) ) {
150
$ids[] = $meta;
151
}
152
159
* @since 1.0
160
*
161
* @param string $meta
162
+ *
163
* @return string Titles
164
*/
165
private function get_titles_by_id( $ids ) {
181
}
182
}
183
184
+ return implode( '<span class="cpac-divider"></span>', $titles );
185
+ }
186
+
187
+ /**
188
+ * @since 2.4.9
189
+ */
190
+ private function get_link_by_meta( $meta ) {
191
+ $label = $meta;
192
+ if ( filter_var( $meta, FILTER_VALIDATE_URL ) || preg_match( '/[^\w.-]/', $meta ) ) {
193
+ if ( ! empty( $this->options->link_label ) ) {
194
+ $label = $this->options->link_label;
195
+ }
196
+ $meta = '<a href="' . $meta . '">' . $label . '</a>';
197
+ }
198
+
199
+ return $meta;
200
}
201
202
+
203
/**
204
* Get Users by ID - Value method
205
*
206
* @since 1.0
207
*
208
* @param string $meta
209
+ *
210
* @return string Users
211
*/
212
+ private function get_users_by_id( $meta ) {
213
214
$names = array();
215
216
// display username
217
if ( $ids = $this->get_ids_from_meta( $meta ) ) {
218
foreach ( (array) $ids as $id ) {
219
+ if ( ! is_numeric( $id ) ) {
220
+ continue;
221
+ }
222
223
$userdata = get_userdata( $id );
224
if ( is_object( $userdata ) && ! empty( $userdata->display_name ) ) {
240
* @since 2.3.2
241
*
242
* @param array $meta_value Term ID's
243
+ *
244
* @return string Terms
245
*/
246
+ public function get_terms_by_id( $meta_value ) {
247
// as used by Pods, @todo
248
+ if ( ! is_array( $meta_value ) || ! isset( $meta_value['term_id'] ) || ! isset( $meta_value['taxonomy'] ) ) {
249
return false;
250
}
251
+
252
return $this->get_terms_for_display( $meta_value['term_id'], $meta_value['taxonomy'] );
253
}
254
259
*
260
* @param string $meta Contains Meta Value
261
* @param int $id Optional Object ID
262
+ *
263
* @return string Users
264
*/
265
public function get_value_by_meta( $meta, $id = null ) {
269
case "image" :
270
case "library_id" :
271
$meta = implode( $this->get_thumbnails( $meta, array(
272
+ 'image_size' => $this->options->image_size,
273
+ 'image_size_w' => $this->options->image_size_w,
274
+ 'image_size_h' => $this->options->image_size_h,
275
+ ) ) );
276
break;
277
278
case "excerpt" :
283
$meta = $this->get_date( $meta, $this->options->date_format );
284
break;
285
286
+ case "link" :
287
+ $meta = $this->get_link_by_meta( $this->get_raw_value( $id ) );
288
+ break;
289
+
290
case "title_by_id" :
291
$meta = $this->get_titles_by_id( $meta );
292
break;
344
* @since 1.0
345
*
346
* @param int $id ID
347
+ *
348
* @return string Meta Value
349
*/
350
public function get_meta_by_id( $id ) {
399
*/
400
$value = apply_filters( 'cac/column/meta/value', $value, $id, $this );
401
402
return $value;
403
}
404
441
* @see CPAC_Column::display_settings()
442
* @since 1.0
443
*/
444
+ public function display_settings() {
445
+
446
+ // DOM can get overloaded when dropdown contains to many custom fields. Use this filter to replace the dropdown with a text input.
447
+ if ( apply_filters( 'cac/column/meta/use_text_input', false ) ) :
448
+ $this->display_field_text( 'field', __( "Custom Field", 'codepress-admin-columns' ), __( "Enter your custom field key.", 'codepress-admin-columns' ) );
449
+ else :
450
+ ?>
451
+ <tr class="column_field">
452
+ <?php $this->label_view( __( "Custom Field", 'codepress-admin-columns' ), __( "Select your custom field.", 'codepress-admin-columns' ), 'field' ); ?>
453
+ <td class="input">
454
+ <?php
455
+ if ( $list = $this->get_meta_keys_list() ) {
456
+ echo $list;
457
+ } else {
458
+ _e( 'No custom fields available.', 'codepress-admin-columns' ); ?><?php printf( __( 'Please create a %s item first.', 'codepress-admin-columns' ), '<strong>' . $this->storage_model->singular_label . '</strong>' );
459
+ }
460
+ ?>
461
+ </td>
462
+ </tr>
463
+ <?php endif; ?>
464
465
<tr class="column_field_type" data-refresh="1">
466
<?php $this->label_view( __( "Field Type", 'codepress-admin-columns' ), __( 'This will determine how the value will be displayed.', 'codepress-admin-columns' ) . '<em>' . __( 'Type', 'codepress-admin-columns' ) . ': ' . $this->options->field_type . '</em>', 'field_type' ); ?>
467
<td class="input">
468
<select name="<?php $this->attr_name( 'field_type' ); ?>" id="<?php $this->attr_id( 'field_type' ); ?>">
469
+ <?php foreach ( $this->get_custom_field_types() as $fieldkey => $fieldtype ) : ?>
470
+ <option
471
+ value="<?php echo $fieldkey ?>"<?php selected( $fieldkey, $this->options->field_type ) ?>><?php echo $fieldtype; ?></option>
472
+ <?php endforeach; ?>
473
</select>
474
</td>
475
</tr>
479
case 'date':
480
$this->display_field_date_format();
481
break;
482
+ case 'image':
483
+ case 'library_id':
484
+ $this->display_field_preview_size();
485
+ break;
486
+ case 'excerpt':
487
+ $this->display_field_excerpt_length();
488
+ break;
489
+ case 'link':
490
+ $this->display_field_link_label();
491
+ break;
492
}
493
}
494