Ultimate Posts Widget - Version 2.2.1

Version Description

  • Tested up to WordPress 6.0
  • Tested with PHP 8.1
Download this release

Release Info

Developer iclyde
Plugin Icon wp plugin Ultimate Posts Widget
Version 2.2.1
Comparing to
See all releases

Code changes from version 2.2.0 to 2.2.1

banner/assets/style.min.css CHANGED
@@ -135,3 +135,6 @@ a.ci-see-all-projects {
135
  padding: 35px 15px 5px 15px;
136
  }
137
  }
 
 
 
135
  padding: 35px 15px 5px 15px;
136
  }
137
  }
138
+
139
+ /* @since - Version 2.0 */
140
+ @media (max-width:760px){.ci-carrinis .ci-project:not(.ci-project-SocialShare):not(.ci-project-redRed) .ci-left-part .ci-project-logo a img{max-height:45px}}.ci-project-content{max-height:260px}.ci-project-content.ci-redRed-visible>div:not(.ci-project-redRed){display:none!important}.ci-carrinis .ci-project-redRed .ci-install-state .ci-install-button button{background-color:#374785}.ci-carrinis .ci-project-redRed .ci-install-state .ci-install-button a{color:#374785}.ci-carrinis .ci-project-redRed .ci-right-part img{top:0;right:0}@media (max-width:900px){.ci-carrinis .ci-project-redRed .ci-right-part img{display:none}}.ci-carrinis .ci-project-list-element-redRed:not(.ci-selected-project){background:#374785}.ci-carrinis .ci-project-list-element-redRed .ci-project-list-element-logo{width:45px;height:auto;margin-left:-8px}.ci-carrinis .ci-project-list-element.ci-project-list-element-redRed span{margin-left:6px}.ci-project-redRed .ci-background-top-left{position:absolute;top:-44px;left:0;z-index:-1}.ci-project-redRed .ci-project-logo{margin-left:128px;margin-right:46px}.ci-project-redRed .ci-project-logo a{margin-bottom:8px}.ci-projects-list>.ci-project-list-element:not(.ci-selected-project){height:32px;transition:height .3s cubic-bezier(.25,.1,.25,1)}.ci-projects-list>.ci-project-list-element.ci-selected-project{height:40px;transition:height .3s cubic-bezier(.25,.1,.25,1)}.ci-project-redRed .ci-redi-logo-p{width:131px}.ci-project-redRed .ci-right-part .ci-background-top-right{width:480px;z-index:-1}.ci-project-redRed .ci-already-installed-heading-redi::after{content:'';clear:both;display:block}.ci-project-redRed .ci-already-installed-heading-redi svg{margin-left:70px;float:left}.ci-project-redRed .ci-installed-column-redi{margin-left:90px!important}.ci-project-redRed .ci-already-redi-installed{float:left;font-size:24px;font-weight:400;color:#72c694;margin-left:15px;line-height:40px;font-family:Montserrat}.ci-project-redRed .ci-check-out-others-redi{font-family:Montserrat;font-size:18px;color:#374785;font-weight:400;line-height:40px;margin-top:15px}
banner/misc.php CHANGED
@@ -4,7 +4,7 @@
4
  * File for our cool Carousel in the footer
5
  *
6
  * @category Child Plugin
7
- * @version v0.1.0
8
  * @since v0.1.0
9
  * @author iClyde <kontakt@iclyde.pl>
10
  */
@@ -31,6 +31,7 @@
31
  private $bmi_slug = 'backup-backup/backup-backup.php';
32
  private $cdp_premium = 'copy-delete-posts-premium/copy-delete-posts-premium.php';
33
  private $cdp_slug = 'copy-delete-posts/copy-delete-posts.php';
 
34
  private $mpu_slug = 'pop-up-pop-up/pop-up-pop-up.php';
35
 
36
  /*
@@ -298,6 +299,12 @@
298
  $url = admin_url() . 'admin.php?page=backup-migration';
299
  }
300
 
 
 
 
 
 
 
301
  // Send success
302
  wp_send_json_success([ 'installed' => true, 'url' => $url ]);
303
 
@@ -353,6 +360,10 @@
353
 
354
  $this->install($this->mpu_slug, 'pop-up-pop-up');
355
 
 
 
 
 
356
  // Anything else error
357
  } else wp_send_json_error();
358
 
4
  * File for our cool Carousel in the footer
5
  *
6
  * @category Child Plugin
7
+ * @version v0.2.0
8
  * @since v0.1.0
9
  * @author iClyde <kontakt@iclyde.pl>
10
  */
31
  private $bmi_slug = 'backup-backup/backup-backup.php';
32
  private $cdp_premium = 'copy-delete-posts-premium/copy-delete-posts-premium.php';
33
  private $cdp_slug = 'copy-delete-posts/copy-delete-posts.php';
34
+ private $redi_slug = 'redirect-redirection/redirect-redirection.php';
35
  private $mpu_slug = 'pop-up-pop-up/pop-up-pop-up.php';
36
 
37
  /*
299
  $url = admin_url() . 'admin.php?page=backup-migration';
300
  }
301
 
302
+ // Redirection for RED
303
+ if ($_POST['slug'] === 'redi') {
304
+ update_option('irrp_activation_redirect', true);
305
+ $url = admin_url() . 'admin.php?page=irrp-redirection';
306
+ }
307
+
308
  // Send success
309
  wp_send_json_success([ 'installed' => true, 'url' => $url ]);
310
 
360
 
361
  $this->install($this->mpu_slug, 'pop-up-pop-up');
362
 
363
+ } elseif ($slug == 'redi') {
364
+
365
+ $this->install($this->redi_slug, 'redirect-redirection');
366
+
367
  // Anything else error
368
  } else wp_send_json_error();
369
 
banner/views/index.php CHANGED
@@ -118,6 +118,21 @@
118
  <img src="<?php $this->_asset('/projects/cdp/imgs/main-background-image.png'); ?>" class="ci-main-image">
119
  </div>
120
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  <div class="ci-project ci-project-TasteWP ci-install-state-visible">
122
  <?php $this->_include('projects/twp/install'); ?>
123
  <div class="ci-right-part">
118
  <img src="<?php $this->_asset('/projects/cdp/imgs/main-background-image.png'); ?>" class="ci-main-image">
119
  </div>
120
  </div>
121
+ <?php
122
+
123
+ $redi_plugin = $this->is_plugin_installed($this->redi_slug);
124
+ $redi_state = $redi_plugin ? 'already-installed' : 'install';
125
+
126
+ ?>
127
+ <div class="ci-project ci-project-redRed ci-<?php echo $redi_state; ?>-state-visible">
128
+ <?php
129
+ if ($redi_state == 'install') {
130
+ $this->_include('projects/red/install');
131
+ } else {
132
+ $this->_include('projects/red/installed');
133
+ }
134
+ ?>
135
+ </div>
136
  <div class="ci-project ci-project-TasteWP ci-install-state-visible">
137
  <?php $this->_include('projects/twp/install'); ?>
138
  <div class="ci-right-part">
banner/views/projects/red/imgs/background-top-left.svg ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <svg width="260" height="287" viewBox="0 0 260 287" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M260 177.123C260.001 190.104 256.148 202.793 248.926 213.586C241.705 224.379 231.441 232.792 219.432 237.76C207.423 242.728 194.208 244.028 181.459 241.497C168.709 238.965 156.998 232.715 147.806 223.537C138.614 214.359 132.354 202.665 129.817 189.934C127.281 177.203 128.582 164.008 133.557 152.015C138.531 140.023 146.955 129.773 157.763 122.562C168.572 115.35 181.279 111.501 194.278 111.501C202.908 111.5 211.454 113.197 219.428 116.495C227.402 119.792 234.647 124.626 240.75 130.72C246.853 136.813 251.694 144.048 254.997 152.01C258.3 159.972 260 168.505 260 177.123ZM-125.739 -82.1804C-156.882 -58.3489 -181.43 -26.361 -193.954 10.741C-221.736 93.0385 -181.15 200.83 -93.4224 226.18C-11.4701 249.862 82.4792 199.817 97.2995 113.53C105.408 66.3073 111.616 20.7462 160.238 -1.42454C170.156 -5.94683 180.744 -8.99534 190.336 -14.1784C242.871 -42.5636 161.875 -83.6702 138.478 -95.8819C85.3785 -123.594 22.9974 -135.386 -36.1155 -123.234C-68.6949 -116.434 -99.3252 -102.403 -125.739 -82.1804ZM-225.256 59.6042C-225.257 61.8165 -225.693 64.007 -226.541 66.0509C-227.389 68.0947 -228.632 69.9517 -230.198 71.5159C-231.765 73.0802 -233.625 74.321 -235.672 75.1674C-237.718 76.0139 -239.912 76.4495 -242.128 76.4494C-244.343 76.4496 -246.537 76.014 -248.584 75.1676C-250.631 74.3212 -252.491 73.0804 -254.058 71.5162C-255.624 69.952 -256.867 68.0949 -257.715 66.051C-258.563 64.0072 -259 61.8165 -259 59.6042C-259 55.1362 -257.222 50.8514 -254.058 47.6922C-250.894 44.5331 -246.603 42.7583 -242.128 42.7585C-239.913 42.7583 -237.719 43.1939 -235.672 44.0404C-233.625 44.8869 -231.765 46.1278 -230.198 47.692C-228.632 49.2563 -227.389 51.1134 -226.541 53.1573C-225.693 55.2012 -225.257 57.3919 -225.256 59.6042ZM-108.813 254.172C-108.814 262.879 -112.278 271.229 -118.444 277.386C-124.61 283.542 -132.973 287 -141.693 287C-146.01 287 -150.286 286.151 -154.275 284.502C-158.264 282.852 -161.888 280.434 -164.942 277.386C-167.995 274.337 -170.417 270.718 -172.069 266.735C-173.722 262.752 -174.572 258.483 -174.573 254.172C-174.572 249.86 -173.722 245.591 -172.069 241.608C-170.417 237.625 -167.995 234.006 -164.942 230.957C-161.889 227.909 -158.264 225.491 -154.275 223.841C-150.286 222.192 -146.01 221.343 -141.693 221.343C-137.375 221.343 -133.1 222.192 -129.111 223.841C-125.122 225.491 -121.497 227.909 -118.444 230.958C-115.391 234.006 -112.969 237.625 -111.316 241.608C-109.664 245.591 -108.813 249.86 -108.813 254.172ZM-220.321 84.1895C-220.321 85.2063 -220.726 86.1816 -221.446 86.9006C-222.166 87.6197 -223.142 88.0236 -224.161 88.0236C-224.665 88.0237 -225.164 87.9246 -225.63 87.7319C-226.096 87.5393 -226.52 87.2569 -226.876 86.9008C-227.233 86.5448 -227.516 86.1221 -227.709 85.6569C-227.902 85.1916 -228.001 84.693 -228.001 84.1895C-228.001 83.6859 -227.902 83.1873 -227.709 82.7221C-227.516 82.2569 -227.233 81.8342 -226.876 81.4781C-226.52 81.1221 -226.096 80.8397 -225.63 80.647C-225.164 80.4544 -224.665 80.3553 -224.161 80.3553C-223.143 80.3556 -222.166 80.7597 -221.446 81.4787C-220.727 82.1977 -220.322 83.1728 -220.322 84.1895H-220.321Z" fill="#F0F3FF"/>
3
+ </svg>
banner/views/projects/red/imgs/big-colored-logo-rr.png ADDED
Binary file
banner/views/projects/red/imgs/colored-logo-rr.svg ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <svg width="48" height="23" viewBox="0 0 48 23" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M41.3512 8.15972L39.5502 0.235294C39.4781 0.091214 39.334 -0.0528797 39.19 0.0191605C39.1179 0.0191605 39.0459 0.0912052 39.0459 0.0912052L37.1728 2.10832C33.5708 -0.917367 28.528 0.739558 26.2227 3.18893C26.0786 3.33301 26.1507 3.47709 26.2227 3.62117C26.3668 3.76525 26.5109 3.69321 26.655 3.62117C27.2313 3.04485 31.9859 2.61262 34.6514 4.84587L32.7784 6.86298C32.6343 7.00706 32.7063 7.15115 32.7784 7.29523C32.8504 7.36727 32.8504 7.36727 32.9224 7.36727L40.9189 8.51992C41.063 8.51992 41.2071 8.44786 41.2791 8.23174C41.3512 8.23174 41.3512 8.23176 41.3512 8.15972Z" fill="#374785"/>
3
+ <g opacity="0.4">
4
+ <path opacity="0.4" d="M10.734 10.2489C10.4459 10.2489 10.1577 10.465 10.1577 10.8973C10.1577 11.3295 10.3738 11.5456 10.734 11.5456C11.0222 11.5456 11.3103 11.3295 11.3103 10.8973C11.2383 10.465 11.0222 10.2489 10.734 10.2489Z" fill="#374785"/>
5
+ <path opacity="0.4" d="M25.142 6.35873H4.10628C1.87303 6.35873 0 8.15973 0 10.465C0 12.7703 1.80099 14.5713 4.10628 14.5713H25.142C27.3753 14.5713 29.2483 12.7703 29.2483 10.465C29.2483 8.15973 27.3753 6.35873 25.142 6.35873ZM5.90729 12.266C5.0428 12.266 4.39446 11.6897 4.39446 10.8973C4.39446 10.1048 5.0428 9.5285 5.90729 9.5285C6.77177 9.5285 7.42014 10.1048 7.42014 10.8973C7.42014 11.6897 6.77177 12.266 5.90729 12.266ZM8.78889 12.194H7.85238V8.59196H8.78889V12.194ZM12.1748 12.194H11.3103V11.9058C11.1662 12.1219 10.8781 12.194 10.5179 12.194C9.79748 12.194 9.22114 11.6897 9.22114 10.8252C9.22114 9.96073 9.79748 9.45646 10.5179 9.45646C10.806 9.45646 11.0942 9.52849 11.2383 9.74461V8.51994H12.1748V12.194ZM14.1199 11.1854H12.6791V10.465H14.1199V11.1854ZM17.866 10.6811C17.866 11.6897 17.2897 12.266 16.2811 12.266C15.2725 12.266 14.6962 11.6897 14.6962 10.6811V8.8081H15.6327V10.6811C15.6327 11.2575 15.8489 11.4736 16.2811 11.4736C16.7133 11.4736 16.9295 11.2575 16.9295 10.6811V8.8081H17.866V10.6811ZM20.6755 12.194L20.0272 11.2575H19.5229V12.194H18.5864V8.8081H20.1713C21.1078 8.8081 21.6841 9.31237 21.6841 10.1048C21.6841 10.6091 21.468 10.9693 21.0357 11.1854L21.7561 12.266H20.6755V12.194ZM24.7818 12.194H22.1884V8.8081H23.1249V11.4736H24.7818V12.194Z" fill="#374785"/>
6
+ <path opacity="0.4" d="M20.0271 9.5285H19.5228V10.5371H20.0271C20.4593 10.5371 20.6034 10.3209 20.6034 10.0328C20.6755 9.74461 20.4593 9.5285 20.0271 9.5285Z" fill="#374785"/>
7
+ <path opacity="0.4" d="M5.90737 10.2489C5.61921 10.2489 5.33105 10.465 5.33105 10.8973C5.33105 11.3295 5.54717 11.5456 5.90737 11.5456C6.19553 11.5456 6.4837 11.3295 6.4837 10.8973C6.4837 10.465 6.19553 10.2489 5.90737 10.2489Z" fill="#374785"/>
8
+ </g>
9
+ <path d="M41.4952 23H12.1748C9.07709 23 6.48364 20.4786 6.48364 17.3088V17.2368C6.48364 14.139 9.00505 11.5456 12.1748 11.5456H41.4952C44.5929 11.5456 47.1864 14.067 47.1864 17.2368V17.3088C47.1864 20.4786 44.665 23 41.4952 23Z" fill="#374785"/>
10
+ <path d="M14.7682 17.5249V19.6141H13.4715V17.7411C13.4715 17.2368 13.2554 17.0207 12.8952 17.0207C12.4629 17.0207 12.1748 17.3088 12.1748 17.8852V19.6862H10.8781V15.9401H12.1027V16.3723C12.3909 16.0841 12.8231 15.9401 13.2554 15.9401C14.1199 15.868 14.7682 16.3723 14.7682 17.5249Z" fill="white"/>
11
+ <path d="M19.3787 18.1012H16.7132C16.8573 18.4614 17.1455 18.6776 17.6498 18.6776C18.01 18.6776 18.2261 18.6055 18.5142 18.3894L19.1626 19.1098C18.8024 19.47 18.2981 19.6861 17.5777 19.6861C16.281 19.6861 15.4165 18.8937 15.4165 17.8131C15.4165 16.7325 16.281 15.94 17.4336 15.94C18.5142 15.94 19.3787 16.6604 19.3787 17.8131C19.3787 17.8851 19.3787 18.0292 19.3787 18.1012ZM16.6412 17.4529H18.154C18.082 17.0927 17.7938 16.8045 17.4336 16.8045C17.0014 16.8045 16.7132 17.0206 16.6412 17.4529Z" fill="white"/>
12
+ <path d="M26.0064 15.94L24.7097 19.6141H23.485L22.7646 17.5969L22.0442 19.6141H20.8195L19.5228 15.94H20.7475L21.4679 18.1733L22.2603 15.94H23.341L24.1334 18.1733L24.9258 15.94H26.0064Z" fill="white"/>
13
+ <path d="M26.1505 17.1647H28.0956V18.1733H26.1505V17.1647Z" fill="white"/>
14
+ <path d="M28.8881 17.5249V14.8594H30.2568V17.4529C30.2568 18.2453 30.617 18.6055 31.1933 18.6055C31.7697 18.6055 32.0578 18.2453 32.0578 17.4529V14.8594H33.3545V17.5249C33.3545 18.9657 32.5621 19.7582 31.1213 19.7582C29.7525 19.6861 28.8881 18.8937 28.8881 17.5249Z" fill="white"/>
15
+ <path d="M36.3803 18.3894H35.6599V19.6861H34.2911V14.9315H36.4523C37.7491 14.9315 38.5415 15.5798 38.5415 16.6604C38.5415 17.3809 38.1813 17.8851 37.605 18.1733L38.6136 19.6861H37.1727L36.3803 18.3894ZM36.3803 15.94H35.6599V17.3088H36.3803C36.9566 17.3088 37.2448 17.0206 37.2448 16.5884C37.1727 16.1562 36.9566 15.94 36.3803 15.94Z" fill="white"/>
16
+ <path d="M39.334 14.8594H40.7027V18.5335H42.936V19.6141H39.334V14.8594Z" fill="white"/>
17
+ </svg>
banner/views/projects/red/imgs/main-background-image.png ADDED
Binary file
banner/views/projects/red/imgs/not-colored-logo.svg ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <svg width="45" height="22" viewBox="0 0 45 22" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M39.2718 7.74945L37.5614 0.223493C37.4929 0.0866579 37.3561 -0.0501902 37.2193 0.0182276C37.1509 0.0182276 37.0824 0.0866496 37.0824 0.0866496L35.3036 2.00234C31.8827 -0.871208 27.0934 0.702401 24.9041 3.02861C24.7672 3.16544 24.8357 3.30228 24.9041 3.43912C25.0409 3.57595 25.1778 3.50753 25.3146 3.43912C25.8619 2.89177 30.3775 2.48128 32.909 4.60223L31.1301 6.51792C30.9933 6.65475 31.0617 6.79159 31.1301 6.92843C31.1985 6.99685 31.1985 6.99685 31.2669 6.99685L38.8613 8.09154C38.9981 8.09154 39.135 8.0231 39.2034 7.81785C39.2718 7.81785 39.2718 7.81787 39.2718 7.74945Z" fill="white"/>
3
+ <g opacity="0.4">
4
+ <path opacity="0.4" d="M10.1942 9.73355C9.92051 9.73355 9.64685 9.9388 9.64685 10.3493C9.64685 10.7598 9.8521 10.9651 10.1942 10.9651C10.4679 10.9651 10.7415 10.7598 10.7415 10.3493C10.6731 9.9388 10.4679 9.73355 10.1942 9.73355Z" fill="white"/>
5
+ <path opacity="0.4" d="M23.8778 6.039H3.8998C1.77885 6.039 0 7.74943 0 9.9388C0 12.1282 1.71043 13.8386 3.8998 13.8386H23.8778C25.9988 13.8386 27.7776 12.1282 27.7776 9.9388C27.7776 7.74943 25.9988 6.039 23.8778 6.039ZM5.61025 11.6492C4.78923 11.6492 4.17349 11.1019 4.17349 10.3493C4.17349 9.59672 4.78923 9.04938 5.61025 9.04938C6.43126 9.04938 7.04702 9.59672 7.04702 10.3493C7.04702 11.1019 6.43126 11.6492 5.61025 11.6492ZM8.34696 11.5808H7.45753V8.15994H8.34696V11.5808ZM11.5626 11.5808H10.7416V11.3072C10.6047 11.5124 10.3311 11.5808 9.989 11.5808C9.30482 11.5808 8.75747 11.1019 8.75747 10.2809C8.75747 9.45988 9.30482 8.98096 9.989 8.98096C10.2627 8.98096 10.5363 9.04937 10.6732 9.25462V8.09153H11.5626V11.5808ZM13.4099 10.623H12.0415V9.9388H13.4099V10.623ZM16.9676 10.1441C16.9676 11.1019 16.4203 11.6492 15.4624 11.6492C14.5046 11.6492 13.9572 11.1019 13.9572 10.1441V8.3652H14.8466V10.1441C14.8466 10.6914 15.0519 10.8966 15.4624 10.8966C15.8729 10.8966 16.0782 10.6914 16.0782 10.1441V8.3652H16.9676V10.1441ZM19.6359 11.5808L19.0201 10.6914H18.5412V11.5808H17.6518V8.3652H19.157C20.0464 8.3652 20.5938 8.84412 20.5938 9.59671C20.5938 10.0756 20.3885 10.4177 19.978 10.623L20.6622 11.6492H19.6359V11.5808ZM23.5357 11.5808H21.0727V8.3652H21.9621V10.8966H23.5357V11.5808Z" fill="white"/>
6
+ <path opacity="0.4" d="M19.02 9.04938H18.5411V10.0072H19.02C19.4306 10.0072 19.5674 9.80196 19.5674 9.52829C19.6358 9.25462 19.4306 9.04938 19.02 9.04938Z" fill="white"/>
7
+ <path opacity="0.4" d="M5.61032 9.73355C5.33665 9.73355 5.06299 9.9388 5.06299 10.3493C5.06299 10.7598 5.26823 10.9651 5.61032 10.9651C5.88399 10.9651 6.15768 10.7598 6.15768 10.3493C6.15768 9.9388 5.88399 9.73355 5.61032 9.73355Z" fill="white"/>
8
+ </g>
9
+ <path d="M39.4086 21.8435H11.5626C8.62063 21.8435 6.15759 19.4489 6.15759 16.4385V16.3701C6.15759 13.4281 8.55221 10.9651 11.5626 10.9651H39.4086C42.3506 10.9651 44.8136 13.3597 44.8136 16.3701V16.4385C44.8136 19.4489 42.419 21.8435 39.4086 21.8435Z" fill="white"/>
10
+ <path d="M14.0256 16.6437V18.6279H12.7941V16.849C12.7941 16.3701 12.5888 16.1648 12.2467 16.1648C11.8362 16.1648 11.5626 16.4385 11.5626 16.9858V18.6963H10.3311V15.1385H11.4941V15.549C11.7678 15.2754 12.1783 15.1385 12.5888 15.1385C13.4098 15.0701 14.0256 15.5491 14.0256 16.6437Z" fill="black"/>
11
+ <path d="M18.4042 17.1911H15.8727C16.0096 17.5331 16.2833 17.7384 16.7622 17.7384C17.1043 17.7384 17.3095 17.67 17.5832 17.4647L18.199 18.1489C17.8569 18.491 17.3779 18.6963 16.6938 18.6963C15.4622 18.6963 14.6412 17.9437 14.6412 16.9174C14.6412 15.8911 15.4622 15.1385 16.5569 15.1385C17.5832 15.1385 18.4042 15.8227 18.4042 16.9174C18.4042 16.9858 18.4042 17.1226 18.4042 17.1911ZM15.8043 16.5753H17.2411C17.1727 16.2332 16.899 15.9595 16.5569 15.9595C16.1464 15.9595 15.8728 16.1648 15.8043 16.5753Z" fill="black"/>
12
+ <path d="M24.6987 15.1385L23.4672 18.6278H22.3041L21.6199 16.7121L20.9358 18.6278H19.7726L18.5411 15.1385H19.7042L20.3884 17.2595L21.141 15.1385H22.1673L22.9199 17.2595L23.6725 15.1385H24.6987Z" fill="black"/>
13
+ <path d="M24.8356 16.3016H26.6829V17.2595H24.8356V16.3016Z" fill="black"/>
14
+ <path d="M27.4354 16.6437V14.1123H28.7354V16.5753C28.7354 17.3279 29.0774 17.67 29.6248 17.67C30.1721 17.67 30.4458 17.3279 30.4458 16.5753V14.1123H31.6773V16.6437C31.6773 18.0121 30.9247 18.7647 29.5564 18.7647C28.2564 18.6963 27.4354 17.9437 27.4354 16.6437Z" fill="black"/>
15
+ <path d="M34.5509 17.4647H33.8667V18.6963H32.5668V14.1807H34.6193C35.8508 14.1807 36.6034 14.7965 36.6034 15.8227C36.6034 16.5069 36.2613 16.9858 35.714 17.2595L36.6718 18.6963H35.3035L34.5509 17.4647ZM34.5509 15.1385H33.8667V16.4385H34.5509C35.0982 16.4385 35.3719 16.1648 35.3719 15.7543C35.3035 15.3438 35.0982 15.1385 34.5509 15.1385Z" fill="black"/>
16
+ <path d="M37.3561 14.1123H38.656V17.6016H40.777V18.6279H37.3561V14.1123Z" fill="black"/>
17
+ </svg>
banner/views/projects/red/install.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Namespace
4
+ namespace Inisev\Subs;
5
+
6
+ // Disallow direct access
7
+ if (!defined('ABSPATH')) exit;
8
+
9
+ ?>
10
+
11
+ <img src="<?php $this->_asset('/projects/red/imgs/background-top-left.svg'); ?>" class="ci-background-top-left">
12
+ <div class="ci-left-part ci-install-state">
13
+
14
+ <div class="ci-project-logo">
15
+ <a href="https://wordpress.org/plugins/redirect-redirection/" target="_blank">
16
+ <img class="ci-redi-logo-p" alt="Redirect Logo" src="<?php $this->_asset('/projects/red/imgs/big-colored-logo-rr.png'); ?>">
17
+ </a>
18
+ <img src="<?php $this->_asset('/static/imgs/rating.svg'); ?>">
19
+ </div>
20
+
21
+ <div class="ci-install-column">
22
+ <ul class="ci-checkmark-list ci-checkmark-list-type-1">
23
+ <li>Redirect URLs with one click</li>
24
+ <li>Define redirection rules</li>
25
+ <li><b>100% Free</b></li>
26
+ </ul>
27
+ <div class="ci-install-button">
28
+ <button class="ci-inisev-install-plugin" data-slug="redi">Install plugin now</button>
29
+ <span>(from <a href="https://wordpress.org/plugins/redirect-redirection/" target="_blank">WP directory</a>)</span>
30
+ </div>
31
+ </div>
32
+
33
+ </div>
34
+
35
+ <div class="ci-right-part">
36
+ <img src="<?php $this->_asset('/projects/red/imgs/main-background-image.png'); ?>" class="ci-background-top-right">
37
+ </div>
banner/views/projects/red/installed.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Namespace
4
+ namespace Inisev\Subs;
5
+
6
+ // Disallow direct access
7
+ if (!defined('ABSPATH')) exit;
8
+
9
+ ?>
10
+
11
+ <img src="<?php $this->_asset('/projects/red/imgs/background-top-left.svg'); ?>" class="ci-background-top-left">
12
+ <div class="ci-left-part ci-install-state">
13
+
14
+ <div class="ci-install-column ci-installed-column ci-installed-column-redi">
15
+ <div class="ci-already-installed-heading ci-already-installed-heading-redi">
16
+ <svg width="42" height="42" viewBox="0 0 42 42" fill="none" xmlns="http://www.w3.org/2000/svg">
17
+ <path d="M40.7975 5.74273C40.1757 5.1268 39.1785 5.1268 38.5567 5.74273L19.5688 24.6779L12.7232 17.24C12.1307 16.5947 11.1276 16.5536 10.4824 17.1461C9.843 17.7385 9.802 18.7416 10.3945 19.381L18.3603 28.0332C18.6478 28.35 19.0584 28.5318 19.4866 28.5436C19.4984 28.5436 19.51 28.5436 19.5218 28.5436C19.9441 28.5436 20.343 28.3793 20.6422 28.0802L40.7916 7.98351C41.4134 7.36759 41.4134 6.36451 40.7975 5.74273ZM40.4162 19.4162C39.5421 19.4162 38.8324 20.126 38.8324 21C38.8324 30.8313 30.8313 38.8324 21 38.8324C11.1687 38.8324 3.16761 30.8313 3.16761 21C3.16761 11.1687 11.1687 3.16758 21 3.16758C21.874 3.16758 22.5838 2.45783 22.5838 1.58381C22.5838 0.709784 21.874 0 21 0C9.42069 0 0 9.42067 0 21C0 32.5793 9.42069 42 21 42C32.5793 42 42 32.5793 42 21C42 20.126 41.2902 19.4162 40.4162 19.4162Z" fill="#6BB4A7"/>
18
+ </svg>
19
+ <div class="ci-already-redi-installed">
20
+ <span class="ci-colored-part">Already installed</span>
21
+ </div>
22
+ </div>
23
+ <div class="ci-check-out-others-redi">
24
+ Please keep checking out our other plugins :)
25
+ </div>
26
+ </div>
27
+
28
+ </div>
29
+
30
+ <div class="ci-right-part">
31
+ <img src="<?php $this->_asset('/projects/red/imgs/main-background-image.png'); ?>" class="ci-background-top-right">
32
+ </div>
banner/views/static/tabs.php CHANGED
@@ -44,6 +44,13 @@
44
  </div>
45
  <span>Social Share</span>
46
  </div>
 
 
 
 
 
 
 
47
  <div class="ci-project-list-element ci-project-list-element-followIt" id="followIt-trigger">
48
  <div class="ci-project-list-element-logo">
49
  <img src="<?php $this->_asset('/projects/fit/imgs/white-logo.svg'); ?>" class="ci-white-project-logo">
44
  </div>
45
  <span>Social Share</span>
46
  </div>
47
+ <div class="ci-project-list-element ci-project-list-element-redRed" id="redRed-trigger">
48
+ <div class="ci-project-list-element-logo">
49
+ <img src="<?php $this->_asset('/projects/red/imgs/not-colored-logo.svg'); ?>" class="ci-white-project-logo">
50
+ <img src="<?php $this->_asset('/projects/red/imgs/colored-logo-rr.svg'); ?>" class="ci-colored-project-logo">
51
+ </div>
52
+ <span>Redirect Redirection</span>
53
+ </div>
54
  <div class="ci-project-list-element ci-project-list-element-followIt" id="followIt-trigger">
55
  <div class="ci-project-list-element-logo">
56
  <img src="<?php $this->_asset('/projects/fit/imgs/white-logo.svg'); ?>" class="ci-white-project-logo">
js/upw-admin.min.js CHANGED
@@ -1,111 +1,125 @@
1
- jQuery(document).ready(function(a){a("#widgets-right").on("click",".upw-tab-item",function(b){b.preventDefault();var c=a(this).parents(".widget");console.log(c),c.find(".upw-tab-item").removeClass("active"),a(this).addClass("active"),c.find(".upw-tab").addClass("upw-hide"),c.find("."+a(this).data("toggle")).removeClass("upw-hide")})});
2
-
3
- if (typeof wpse1_6817 === 'undefined') {
4
- var wpse1_6817 = 'yes';
5
- jQuery(document).ready(function($) {
6
-
7
- let entered = false, interval = null;
8
- $('body').on('click', '#wpse1_6817_install_btn', wpse1_6817_btn_install);
9
-
10
- function wpse1_6817_btn_install(e) {
11
- e.preventDefault();
12
-
13
- $('#wpse1_6817_install_btn').css({'pointer-events': 'none', 'opacity': '.6'});
14
-
15
- $('.upw-cdp').animate({'opacity': '0'}, 500, function () {
16
- $('.upw-cdp').html(`We\'re downloading this awesome plugin!<br>We will redirect you soon, please wait<span id="wpse1_6817_dots">...</span> :)`);
17
- $('.upw-cdp').animate({'opacity': '1'}, 500, function () {
18
- let dox = '..', predox = '...';
19
- interval = setInterval(() => {
20
- $('#wpse1_6817_dots').text(dox);
21
-
22
- // I named it DOXPARADOX <3
23
- if (dox == '..' && predox == '...') { dox = '.'; predox = '..' }
24
- else if (dox == '.' && predox == '...') { dox = '..'; predox = '.' }
25
- else if (dox == '..' && predox == '..') { dox = '...'; predox = '..' }
26
- else if (dox == '.' && predox == '..') { dox = '..'; predox = '.' }
27
- else if (dox == '..' && predox == '.') { dox = '...'; predox = '..' }
28
- else { dox = '..'; predox = '...' }
29
- }, 700);
30
- });
31
- });
32
-
33
- $.post(ajaxurl, { action: 'wpse1_6817_install' }).done((res) => {
34
- if (isJsonString(res)) res = cdpParse(res);
35
- let url = $('.upw-cdp').data('url');
36
- if (res.status == 'success') window.location.reload();
37
- else if (typeof res.url != 'undefined') handleIssue();
38
- else handleIssue();
39
- }).fail(() => { handleIssue(); });
40
-
41
- function handleIssue() {
42
- clearInterval(interval);
43
-
44
- $('.upw-cdp').animate({'opacity': '0'}, 500, function () {
45
- let url = $('.upw-cdp').data('url');
46
- $('.upw-cdp').html(`There was an error during plugin download :(<br>Please try to do it manualy, we will redirect you in <span id="wpse1_6817_dots">3</span>s, or click <a href="${url}/wp-admin/plugin-install.php?s=CopyDeletePosts&tab=search&type=author" target="_blank">here</a>.`);
47
- $('.upw-cdp').animate({'opacity': '1'}, 500, function () {
48
- let i = 3;
49
- interval = setInterval(() => {
50
- i--;
51
- $('#wpse1_6817_dots').text(i);
52
- if (i == 0) {
53
- window.location.href = `${url}/wp-admin/plugin-install.php?s=CopyDeletePosts&tab=search&type=author`;
54
- }
55
- }, 1050);
56
- });
57
- });
58
-
59
- }
60
-
61
- }
62
- function isJsonString(str) {
63
- try { JSON.parse(str); }
64
- catch (e) {
65
- if (typeof str === 'string') {
66
- let reversed = cdpReverseString(str);
67
- let lastcorrect = reversed.indexOf('}');
68
- if (lastcorrect == 0) lastcorrect = str.length;
69
- else lastcorrect = -lastcorrect;
70
-
71
- str = str.slice(str.indexOf('{'), lastcorrect);
72
-
73
- try {
74
- JSON.parse(str);
75
- } catch (e) {
76
- return false;
77
- }
78
- return true;
79
- } else return false;
80
- }
81
- return true;
82
- }
83
- function cdpReverseString(str) {
84
- if (typeof str === 'string')
85
- return (str === '') ? '' : cdpReverseString(str.substr(1)) + str.charAt(0);
86
- else
87
- return str;
88
- }
89
- function cdpParse(str) {
90
- try { JSON.parse(str); }
91
- catch (e) {
92
- if (typeof str === 'string') {
93
- let reversed = cdpReverseString(str);
94
- let lastcorrect = reversed.indexOf('}');
95
- if (lastcorrect == 0) lastcorrect = str.length;
96
- else lastcorrect = -lastcorrect;
97
- str = str.slice(str.indexOf('{'), lastcorrect);
98
- try {
99
- JSON.parse(str);
100
- } catch (e) {
101
- return false;
102
- }
103
- return JSON.parse(str);
104
- } else return false;
105
- }
106
- return JSON.parse(str);
107
- }
108
-
109
- });
110
-
111
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function(a){
2
+
3
+ a( '.upw-notice-wrapper.is-dismissible .notice-dismiss' ).on( 'click', function () {
4
+ a.ajax({
5
+ type: "post",
6
+ dataType: "json",
7
+ url: upw_admin_scripts_ajax_object.ajaxurl,
8
+ data : { action: "upw_hide_admin_notification" },
9
+ success: function(){
10
+
11
+ }
12
+ });
13
+ });
14
+
15
+ a("#widgets-right").on("click",".upw-tab-item",function(b){b.preventDefault();var c=a(this).parents(".widget");console.log(c),c.find(".upw-tab-item").removeClass("active"),a(this).addClass("active"),c.find(".upw-tab").addClass("upw-hide"),c.find("."+a(this).data("toggle")).removeClass("upw-hide")})});
16
+
17
+ if (typeof wpse1_6817 === 'undefined') {
18
+ var wpse1_6817 = 'yes';
19
+ jQuery(document).ready(function($) {
20
+
21
+ let entered = false, interval = null;
22
+ $('body').on('click', '#wpse1_6817_install_btn', wpse1_6817_btn_install);
23
+
24
+ function wpse1_6817_btn_install(e) {
25
+ e.preventDefault();
26
+
27
+ $('#wpse1_6817_install_btn').css({'pointer-events': 'none', 'opacity': '.6'});
28
+
29
+ $('.upw-cdp').animate({'opacity': '0'}, 500, function () {
30
+ $('.upw-cdp').html(`We\'re downloading this awesome plugin!<br>We will redirect you soon, please wait<span id="wpse1_6817_dots">...</span> :)`);
31
+ $('.upw-cdp').animate({'opacity': '1'}, 500, function () {
32
+ let dox = '..', predox = '...';
33
+ interval = setInterval(() => {
34
+ $('#wpse1_6817_dots').text(dox);
35
+
36
+ // I named it DOXPARADOX <3
37
+ if (dox == '..' && predox == '...') { dox = '.'; predox = '..' }
38
+ else if (dox == '.' && predox == '...') { dox = '..'; predox = '.' }
39
+ else if (dox == '..' && predox == '..') { dox = '...'; predox = '..' }
40
+ else if (dox == '.' && predox == '..') { dox = '..'; predox = '.' }
41
+ else if (dox == '..' && predox == '.') { dox = '...'; predox = '..' }
42
+ else { dox = '..'; predox = '...' }
43
+ }, 700);
44
+ });
45
+ });
46
+
47
+ $.post(ajaxurl, { action: 'wpse1_6817_install' }).done((res) => {
48
+ if (isJsonString(res)) res = cdpParse(res);
49
+ let url = $('.upw-cdp').data('url');
50
+ if (res.status == 'success') window.location.reload();
51
+ else if (typeof res.url != 'undefined') handleIssue();
52
+ else handleIssue();
53
+ }).fail(() => { handleIssue(); });
54
+
55
+ function handleIssue() {
56
+ clearInterval(interval);
57
+
58
+ $('.upw-cdp').animate({'opacity': '0'}, 500, function () {
59
+ let url = $('.upw-cdp').data('url');
60
+ $('.upw-cdp').html(`There was an error during plugin download :(<br>Please try to do it manualy, we will redirect you in <span id="wpse1_6817_dots">3</span>s, or click <a href="${url}/wp-admin/plugin-install.php?s=CopyDeletePosts&tab=search&type=author" target="_blank">here</a>.`);
61
+ $('.upw-cdp').animate({'opacity': '1'}, 500, function () {
62
+ let i = 3;
63
+ interval = setInterval(() => {
64
+ i--;
65
+ $('#wpse1_6817_dots').text(i);
66
+ if (i == 0) {
67
+ window.location.href = `${url}/wp-admin/plugin-install.php?s=CopyDeletePosts&tab=search&type=author`;
68
+ }
69
+ }, 1050);
70
+ });
71
+ });
72
+
73
+ }
74
+
75
+ }
76
+ function isJsonString(str) {
77
+ try { JSON.parse(str); }
78
+ catch (e) {
79
+ if (typeof str === 'string') {
80
+ let reversed = cdpReverseString(str);
81
+ let lastcorrect = reversed.indexOf('}');
82
+ if (lastcorrect == 0) lastcorrect = str.length;
83
+ else lastcorrect = -lastcorrect;
84
+
85
+ str = str.slice(str.indexOf('{'), lastcorrect);
86
+
87
+ try {
88
+ JSON.parse(str);
89
+ } catch (e) {
90
+ return false;
91
+ }
92
+ return true;
93
+ } else return false;
94
+ }
95
+ return true;
96
+ }
97
+ function cdpReverseString(str) {
98
+ if (typeof str === 'string')
99
+ return (str === '') ? '' : cdpReverseString(str.substr(1)) + str.charAt(0);
100
+ else
101
+ return str;
102
+ }
103
+ function cdpParse(str) {
104
+ try { JSON.parse(str); }
105
+ catch (e) {
106
+ if (typeof str === 'string') {
107
+ let reversed = cdpReverseString(str);
108
+ let lastcorrect = reversed.indexOf('}');
109
+ if (lastcorrect == 0) lastcorrect = str.length;
110
+ else lastcorrect = -lastcorrect;
111
+ str = str.slice(str.indexOf('{'), lastcorrect);
112
+ try {
113
+ JSON.parse(str);
114
+ } catch (e) {
115
+ return false;
116
+ }
117
+ return JSON.parse(str);
118
+ } else return false;
119
+ }
120
+ return JSON.parse(str);
121
+ }
122
+
123
+ });
124
+
125
+ }
readme.txt CHANGED
@@ -1,311 +1,316 @@
1
- === Ultimate Posts Widget ===
2
- Contributors: cl272
3
- Donate link: https://sellcodes.com/5U4SICyc
4
- License: MIT
5
- License URI: http://opensource.org/licenses/MIT
6
- Tags: widget, recent posts, custom post types, sticky posts, featured image, post thumbnail, excerpts, category, custom fields, list pages, widget query, microformats, customizable widget, categories widget, tags widget, excerpt, widget templates, post author, post date, custom query, ultimate posts, comments, orderby, comment count
7
- Requires at least: 3.5
8
- Tested up to: 5.8
9
- Stable tag: 2.2.0
10
-
11
- The ultimate widget for displaying posts, custom post types or sticky posts with an array of options.
12
-
13
- == Description ==
14
-
15
- **Try it out on your free dummy site: Click here => [https://tastewp.com/plugins/ultimate-posts-widget](https://tastewp.com/plugins/ultimate-posts-widget)**
16
-
17
- UPDATE: Plugin ownership changed for this plugin. We are currently evaluating possible enhancements for it. Stay tuned! If you have any suggestions yourself, please let us know in the Support Forum.
18
-
19
- The ultimate widget for displaying posts, custom post types or sticky posts with an array of options to customize the display.
20
-
21
- Designed for both the average user and developer, Ultimate Posts Widgets aims to provide flexibility and ease of use for displaying any kinds of posts within your widget areas. An array of widget options are available as well as hooks, filters and custom templates for more advanced customization.
22
-
23
- = Options =
24
-
25
- * Filter by categories
26
- * Filter by current category
27
- * Filter by tags
28
- * Filter by current tag
29
- * Filter by custom post types
30
- * Filter by sticky posts
31
- * Select number of posts to display
32
- * Display title
33
- * Display publish date/time with custom format options
34
- * Display post author and link
35
- * Display post comment count
36
- * Display excerpt or full content
37
- * Display read more link with custom label
38
- * Display featured image and at any size
39
- * Display post categories
40
- * Display post tags
41
- * Display custom fields
42
- * Add text or HTML before and after posts list
43
- * Add CSS class to widget
44
- * Add widget title link
45
- * Change excerpt length (in words)
46
- * Order by date, title, number of comments, random or a custom field
47
- * Exclude current post from the list
48
-
49
- = Documentation =
50
-
51
- See the [FAQ tab](https://wordpress.org/plugins/ultimate-posts-widget/faq/) for documentation on custom templates, hooks, common issues, and more.
52
-
53
- = Support =
54
-
55
- For help please ask in the [Support Forum](http://wordpress.org/support/plugin/ultimate-posts-widget/)
56
-
57
- Enjoy this plugin? [Send a tip to support development](https://sellcodes.com/5U4SICyc).
58
-
59
- This plugin is part of the Inisev product family - [check out our other products](https://inisev.com).
60
-
61
- == Frequently Asked Questions ==
62
-
63
- = Filters =
64
-
65
- **upw_enqueue_styles** *(boolean)*
66
- Allows changing whether to load the template CSS file(s).
67
-
68
- **upw_wp_query_args** *(array)*
69
- Allows changing the WP_Query arguments for the widget.
70
-
71
- **upw_custom_template_path** *(string)*
72
- Allows changing the default custom template path.
73
-
74
- = Templates =
75
-
76
- **legacy**
77
- As of version 2.0.0 we changed the widget HTML markup. For installs prior to 2.0.0 you can use the legacy template to retain the old HTML markup and compatibility.
78
-
79
- **standard**
80
- The new standard template as of version 2.0.0. It features better HTML5 markup, improved styling on various themes without the need for custom CSS, and hfeed microformat.
81
-
82
- **custom**
83
- As of version 2.0.0 you can now provide your own custom template files. To do this, create a directory named `upw` in your theme and copy a template from the plugin's `templates` directory. Edit as needed.
84
-
85
- Then, in the widget settings under the *Display* tab, choose *Custom* from the *Template* drop down. In the *Custom Template Name* field that appears and enter the file name of your template (excluding .php). For example, if your template is named `custom.php` then enter `custom` in the *Custom Template Name* field.
86
-
87
- = Images sizes =
88
-
89
- *As of version 2.0.0, the plugin no longer supports setting custom image sizes from the widget options panel.*
90
-
91
- To change image sizes you can either edit the built-in sizes (thumbnail, medium, and large) or define a custom image size in your theme `functions.php`.
92
-
93
- **Edit built-in image sizes:** Go to *Settings > Media* and change the image sizes as desired. Once image sizes are changed you will need to regenerate thumbnails to update any existing images. This can be done with [AJAX Thumbnail Rebuild](https://wordpress.org/plugins/ajax-thumbnail-rebuild/) or [Regenerate Thumbnails](https://wordpress.org/plugins/regenerate-thumbnails/) plugins. Note that this will affect image sizes for the entire site.
94
-
95
- **Define a custom image size:** Edit your `functions.php` file and add a new image size with the `add_image_size` function. See the [WordPress codex for documentation](http://codex.wordpress.org/Function_Reference/add_image_size). Once the function is added, your custom size will be available to select from the widget options. Like editing a built-in size, you will need to regenerate thumbnails for existing images.
96
-
97
- Example:
98
-
99
- `<?php add_image_size( 'my-custom-size', 800, 600, false ); ?>`
100
-
101
- = Thumbnail images are not displaying =
102
-
103
- *As of version 2.0.0 timthumb is no longer used.*
104
-
105
- This plugin uses the [timthumb library](http://www.binarymoon.co.uk/projects/timthumb/) to resize post thumbnails. Please review these requirements and troubleshooting tips if you are having problems displaying thumbnails.
106
-
107
- * Right click > view image - If an image isn't loading then this is the first thing you should do. 9 times out of 10 it will tell you what the problem is in an easy to read error message.
108
- * JetPack plugin - There is a known conflict between JetPack's "Photon" component, please disable it for compatibility with timthumb.
109
- * Server requirements - PHP and the GD image library must be installed on your web server. Normally most web servers include them by default.
110
- * Cache permissions - The cache directory `wp-content/plugins/ultimate-posts-widget/cache` should be set to 777 or if that doesn't work, you may find 755 is ok.
111
- * Image sizes - timthumb is configured to only work for images smaller than 1500 x 1500. The plugin and automatically selects the "Large" size from Settings > Media, if it is greater than 1500 x 1500 you will need to reduce the size or modify the configuration in `thumb.php` to support larger image sizes.
112
- * Tilde(~) in url - timthumb has a known issue with this, please use a url without a tilde until a fix is available. [Bug report](https://code.google.com/p/timthumb/issues/detail?id=263)
113
- * Thumbnail images only work with WordPress' native post thumbnail / featured image. Many theme use a custom image field for thumbnails, these are not supported.
114
-
115
- **Still stuck?** See [additional troubleshooting tips](http://www.binarymoon.co.uk/2010/11/timthumb-hints-tips/) from the timthumb author.
116
-
117
- == Screenshots ==
118
-
119
- 1. Example with TwentyTwelve theme with the default widget options
120
- 2. General options tab
121
- 3. Display options tab
122
- 4. Filter options tab
123
- 5. Order options tab
124
-
125
- == Changelog ==
126
-
127
- = 2.2.0 =
128
- * Tested up to WordPress 5.7.1
129
- * Added support for PHP 8
130
- * Updated banner
131
-
132
- = 2.1.6 =
133
- * Tested up to WordPress 5.4.2
134
- * Updated Opt-in
135
-
136
- = 2.1.5 =
137
- * Tested up to WordPress 5.4.1
138
- * Changed info
139
-
140
- = 2.1.4 =
141
- * Plugin has been updated up to WordPress 5.4
142
-
143
- = 2.1.3 =
144
- * Hotfixed issue
145
-
146
- = 2.1.2 =
147
- * Serval improvements
148
-
149
- = 2.1.1 =
150
- * Added possibility to exclude current post from the list
151
- * Tested update WordPress 5.3.3 (beta)+
152
-
153
- = 2.1.0 =
154
- * Added possibility for changing custom message when no posts.
155
- * Increased stability of the plugin
156
- * Fixed filtering
157
- * Tested update WordPress 5.3.2+
158
-
159
- = 2.0.9 =
160
- * Replaced deprecated code
161
-
162
- = 2.0.8 =
163
- * Plugin revival
164
- * Feedback system integrated
165
- * Readme updated
166
-
167
- = 2.0.7 =
168
- * Tested update WordPress 4.8
169
-
170
- = 2.0.6 =
171
- * Fix PHP notice (thanks @rhyswynne)
172
- * Search custom template both in child theme and in parent (thanks @groucho75)
173
-
174
- = 2.0.5 =
175
- * Adds menu order sort by option
176
-
177
- = 2.0.4 =
178
- * Updated class constructor for WordPress 4.3 compatibility (thanks @JustB)
179
-
180
- = 2.0.3 =
181
- * Adds link to thumbnail images
182
- * Adds option to show all categories, tags, or types for better usability
183
- * Improve spacing and font sizes on some themes for the standard template
184
- * Document adding custom image sizes
185
- * Add option to display full size post thumbnail
186
- * Remove post_class() from legacy template for better backwards compatibility
187
-
188
- = 2.0.2 =
189
- * Reverts back to using `widget_title` filter
190
- * Fixes number of posts setting to allow unlimited amounts
191
- * Adds instance and widget ID variables to filters for more control
192
-
193
- = 2.0.1 =
194
- * Fixes issue loading multiple widgets on the same page and using the same template
195
- * Adds a default title to the widget for new instances
196
- * Documentation improvements
197
-
198
- = 2.0.0 =
199
-
200
- * Added a new standard template and custom template support
201
- * Added basic CSS styles for better formatting
202
- * Add hfeed microformat into new standard template
203
- * Improved widget options interface
204
- * Add option to filter by tags or current tag
205
- * Remove timthumb in favor of using built-in WordPress image sizes
206
- * Remove widget "More Button" options
207
- * Change date display options to now accept any custom date formats
208
- * Add before and after posts HTML fields
209
- * Add option for widget CSS class (thanks @avenirer)
210
- * Add option to display comment count
211
- * Set better defaults for newly created widgets
212
- * Various bug fixes and optimizations
213
-
214
- *Upgrading from an earlier version?*
215
-
216
- * Upgrades from prior to 2.0.0 we retain the "legacy" template for you. To change which template to use, find the "Template" option under the "Display" tab.
217
- * If you used the "More Button", you will need to add in your own HTML into one of the new fields since the more button is now removed.
218
- * If you used custom thumbnail settings you will need to update them. You can now choose from pre-defined sizes available to WordPress. If you need an additional image size please see [how to add image sizes](http://codex.wordpress.org/Function_Reference/add_image_size).
219
- * Date formatting has changed, you will need to update your settings. By default it uses WordPress' date/time options.
220
-
221
- = 1.9.0 =
222
-
223
- * Adds option to order by custom field (thanks @enekochan)
224
- * Remove "Permalink to:" from link titles (thanks @wirelessgizmo)
225
- * Swedish translation (thanks @brstp)
226
-
227
- = 1.8.1 =
228
-
229
- * Add content display option
230
-
231
- = 1.8 =
232
-
233
- * Add custom field display
234
- * Re-organized widget options
235
- * Use proper alt tag for image thumbnails
236
- * Better title attribute for links
237
-
238
- = 1.7 =
239
-
240
- * Added show author option
241
- * Added class to highlight current post
242
- * Fixed PHP error notices
243
-
244
- = 1.6 =
245
-
246
- * Added localization support
247
- * Added show post categories option
248
- * Added show post tags option
249
- * Added custom widget title URL option
250
- * Improved filter controls for sticky posts
251
- * Bug fixes
252
-
253
- = 1.5.1 =
254
-
255
- * Upgrade timthumb to 2.8.11
256
- * Load "Large" size post thumbnails which should eliminate large image errors
257
- * Improved FAQ for thumbnail troubleshooting
258
-
259
- = 1.5 =
260
-
261
- * Adds crop mode option
262
- * Add show published time option
263
- * Now uses date / time format settings
264
- * Bug fixes
265
-
266
- = 1.4.5 =
267
-
268
- * Updates screenshot
269
-
270
- = 1.4.4 =
271
-
272
- * Fixes show_readmore function
273
- * Adds more button link option
274
-
275
- = 1.4 =
276
-
277
- * Cleaner widget options
278
- * Code refactoring and fixes
279
- * Adds order by option
280
-
281
- = 1.3 =
282
-
283
- * Sticky posts only now optional
284
-
285
- = 1.2 =
286
-
287
- * Added post type filter option.
288
- * Code cleanup.
289
- * Better selection mechanism for categories.
290
-
291
- = 1.1 =
292
-
293
- * Added category filter option.
294
-
295
- = 1.0 =
296
-
297
- * First release.
298
-
299
- == Upgrade Notice ==
300
-
301
- = 2.2.0 =
302
- * Tested up to WordPress 5.7.1
303
- * Added support for PHP 8
304
- * Updated banner
305
-
306
- == Installation ==
307
-
308
- 1. Download and extract the zip archive
309
- 2. Upload `ultimate-posts-widget` folder to `/wp-content/plugins/`
310
- 3. Activate the plugin through the 'Plugins' menu in WordPress
311
- 4. Add the widget to a sidebar and configure the options as desired
 
 
 
 
 
1
+ === Ultimate Posts Widget ===
2
+ Contributors: cl272
3
+ Donate link: https://sellcodes.com/5U4SICyc
4
+ License: MIT
5
+ License URI: http://opensource.org/licenses/MIT
6
+ Tags: widget, recent posts, custom post types, sticky posts, featured image, post thumbnail, excerpts, category, custom fields, list pages, widget query, microformats, customizable widget, categories widget, tags widget, excerpt, widget templates, post author, post date, custom query, ultimate posts, comments, orderby, comment count
7
+ Requires at least: 3.5
8
+ Tested up to: 6.0
9
+ Stable tag: 2.2.1
10
+
11
+ The ultimate widget for displaying posts, custom post types or sticky posts with an array of options.
12
+
13
+ == Description ==
14
+
15
+ **Try it out on your free dummy site: Click here => [https://tastewp.com/plugins/ultimate-posts-widget](https://tastewp.com/plugins/ultimate-posts-widget)**
16
+
17
+ UPDATE: Plugin ownership changed for this plugin. We are currently evaluating possible enhancements for it. Stay tuned! If you have any suggestions yourself, please let us know in the Support Forum.
18
+
19
+ Note: This is a **classic widget** type, in order for it to work on the latest version of WordPress you will need [Classic Widgets](https://wordpress.org/plugins/classic-widgets/) plugin installed on your site.
20
+
21
+ The ultimate widget for displaying posts, custom post types or sticky posts with an array of options to customize the display.
22
+
23
+ Designed for both the average user and developer, Ultimate Posts Widgets aims to provide flexibility and ease of use for displaying any kinds of posts within your widget areas. An array of widget options are available as well as hooks, filters and custom templates for more advanced customization.
24
+
25
+ = Options =
26
+
27
+ * Filter by categories
28
+ * Filter by current category
29
+ * Filter by tags
30
+ * Filter by current tag
31
+ * Filter by custom post types
32
+ * Filter by sticky posts
33
+ * Select number of posts to display
34
+ * Display title
35
+ * Display publish date/time with custom format options
36
+ * Display post author and link
37
+ * Display post comment count
38
+ * Display excerpt or full content
39
+ * Display read more link with custom label
40
+ * Display featured image and at any size
41
+ * Display post categories
42
+ * Display post tags
43
+ * Display custom fields
44
+ * Add text or HTML before and after posts list
45
+ * Add CSS class to widget
46
+ * Add widget title link
47
+ * Change excerpt length (in words)
48
+ * Order by date, title, number of comments, random or a custom field
49
+ * Exclude current post from the list
50
+
51
+ = Documentation =
52
+
53
+ See the [FAQ tab](https://wordpress.org/plugins/ultimate-posts-widget/faq/) for documentation on custom templates, hooks, common issues, and more.
54
+
55
+ = Support =
56
+
57
+ For help please ask in the [Support Forum](http://wordpress.org/support/plugin/ultimate-posts-widget/)
58
+
59
+ Enjoy this plugin? [Send a tip to support development](https://sellcodes.com/5U4SICyc).
60
+
61
+ This plugin is part of the Inisev product family - [check out our other products](https://inisev.com).
62
+
63
+ == Frequently Asked Questions ==
64
+
65
+ = Filters =
66
+
67
+ **upw_enqueue_styles** *(boolean)*
68
+ Allows changing whether to load the template CSS file(s).
69
+
70
+ **upw_wp_query_args** *(array)*
71
+ Allows changing the WP_Query arguments for the widget.
72
+
73
+ **upw_custom_template_path** *(string)*
74
+ Allows changing the default custom template path.
75
+
76
+ = Templates =
77
+
78
+ **legacy**
79
+ As of version 2.0.0 we changed the widget HTML markup. For installs prior to 2.0.0 you can use the legacy template to retain the old HTML markup and compatibility.
80
+
81
+ **standard**
82
+ The new standard template as of version 2.0.0. It features better HTML5 markup, improved styling on various themes without the need for custom CSS, and hfeed microformat.
83
+
84
+ **custom**
85
+ As of version 2.0.0 you can now provide your own custom template files. To do this, create a directory named `upw` in your theme and copy a template from the plugin's `templates` directory. Edit as needed.
86
+
87
+ Then, in the widget settings under the *Display* tab, choose *Custom* from the *Template* drop down. In the *Custom Template Name* field that appears and enter the file name of your template (excluding .php). For example, if your template is named `custom.php` then enter `custom` in the *Custom Template Name* field.
88
+
89
+ = Images sizes =
90
+
91
+ *As of version 2.0.0, the plugin no longer supports setting custom image sizes from the widget options panel.*
92
+
93
+ To change image sizes you can either edit the built-in sizes (thumbnail, medium, and large) or define a custom image size in your theme `functions.php`.
94
+
95
+ **Edit built-in image sizes:** Go to *Settings > Media* and change the image sizes as desired. Once image sizes are changed you will need to regenerate thumbnails to update any existing images. This can be done with [AJAX Thumbnail Rebuild](https://wordpress.org/plugins/ajax-thumbnail-rebuild/) or [Regenerate Thumbnails](https://wordpress.org/plugins/regenerate-thumbnails/) plugins. Note that this will affect image sizes for the entire site.
96
+
97
+ **Define a custom image size:** Edit your `functions.php` file and add a new image size with the `add_image_size` function. See the [WordPress codex for documentation](http://codex.wordpress.org/Function_Reference/add_image_size). Once the function is added, your custom size will be available to select from the widget options. Like editing a built-in size, you will need to regenerate thumbnails for existing images.
98
+
99
+ Example:
100
+
101
+ `<?php add_image_size( 'my-custom-size', 800, 600, false ); ?>`
102
+
103
+ = Thumbnail images are not displaying =
104
+
105
+ *As of version 2.0.0 timthumb is no longer used.*
106
+
107
+ This plugin uses the [timthumb library](http://www.binarymoon.co.uk/projects/timthumb/) to resize post thumbnails. Please review these requirements and troubleshooting tips if you are having problems displaying thumbnails.
108
+
109
+ * Right click > view image - If an image isn't loading then this is the first thing you should do. 9 times out of 10 it will tell you what the problem is in an easy to read error message.
110
+ * JetPack plugin - There is a known conflict between JetPack's "Photon" component, please disable it for compatibility with timthumb.
111
+ * Server requirements - PHP and the GD image library must be installed on your web server. Normally most web servers include them by default.
112
+ * Cache permissions - The cache directory `wp-content/plugins/ultimate-posts-widget/cache` should be set to 777 or if that doesn't work, you may find 755 is ok.
113
+ * Image sizes - timthumb is configured to only work for images smaller than 1500 x 1500. The plugin and automatically selects the "Large" size from Settings > Media, if it is greater than 1500 x 1500 you will need to reduce the size or modify the configuration in `thumb.php` to support larger image sizes.
114
+ * Tilde(~) in url - timthumb has a known issue with this, please use a url without a tilde until a fix is available. [Bug report](https://code.google.com/p/timthumb/issues/detail?id=263)
115
+ * Thumbnail images only work with WordPress' native post thumbnail / featured image. Many theme use a custom image field for thumbnails, these are not supported.
116
+
117
+ **Still stuck?** See [additional troubleshooting tips](http://www.binarymoon.co.uk/2010/11/timthumb-hints-tips/) from the timthumb author.
118
+
119
+ == Screenshots ==
120
+
121
+ 1. Example with TwentyTwelve theme with the default widget options
122
+ 2. General options tab
123
+ 3. Display options tab
124
+ 4. Filter options tab
125
+ 5. Order options tab
126
+
127
+ == Changelog ==
128
+
129
+ = 2.2.1 =
130
+ * Tested up to WordPress 6.0
131
+ * Tested with PHP 8.1
132
+
133
+ = 2.2.0 =
134
+ * Tested up to WordPress 5.7.1
135
+ * Added support for PHP 8
136
+ * Updated banner
137
+
138
+ = 2.1.6 =
139
+ * Tested up to WordPress 5.4.2
140
+ * Updated Opt-in
141
+
142
+ = 2.1.5 =
143
+ * Tested up to WordPress 5.4.1
144
+ * Changed info
145
+
146
+ = 2.1.4 =
147
+ * Plugin has been updated up to WordPress 5.4
148
+
149
+ = 2.1.3 =
150
+ * Hotfixed issue
151
+
152
+ = 2.1.2 =
153
+ * Serval improvements
154
+
155
+ = 2.1.1 =
156
+ * Added possibility to exclude current post from the list
157
+ * Tested update WordPress 5.3.3 (beta)+
158
+
159
+ = 2.1.0 =
160
+ * Added possibility for changing custom message when no posts.
161
+ * Increased stability of the plugin
162
+ * Fixed filtering
163
+ * Tested update WordPress 5.3.2+
164
+
165
+ = 2.0.9 =
166
+ * Replaced deprecated code
167
+
168
+ = 2.0.8 =
169
+ * Plugin revival
170
+ * Feedback system integrated
171
+ * Readme updated
172
+
173
+ = 2.0.7 =
174
+ * Tested update WordPress 4.8
175
+
176
+ = 2.0.6 =
177
+ * Fix PHP notice (thanks @rhyswynne)
178
+ * Search custom template both in child theme and in parent (thanks @groucho75)
179
+
180
+ = 2.0.5 =
181
+ * Adds menu order sort by option
182
+
183
+ = 2.0.4 =
184
+ * Updated class constructor for WordPress 4.3 compatibility (thanks @JustB)
185
+
186
+ = 2.0.3 =
187
+ * Adds link to thumbnail images
188
+ * Adds option to show all categories, tags, or types for better usability
189
+ * Improve spacing and font sizes on some themes for the standard template
190
+ * Document adding custom image sizes
191
+ * Add option to display full size post thumbnail
192
+ * Remove post_class() from legacy template for better backwards compatibility
193
+
194
+ = 2.0.2 =
195
+ * Reverts back to using `widget_title` filter
196
+ * Fixes number of posts setting to allow unlimited amounts
197
+ * Adds instance and widget ID variables to filters for more control
198
+
199
+ = 2.0.1 =
200
+ * Fixes issue loading multiple widgets on the same page and using the same template
201
+ * Adds a default title to the widget for new instances
202
+ * Documentation improvements
203
+
204
+ = 2.0.0 =
205
+
206
+ * Added a new standard template and custom template support
207
+ * Added basic CSS styles for better formatting
208
+ * Add hfeed microformat into new standard template
209
+ * Improved widget options interface
210
+ * Add option to filter by tags or current tag
211
+ * Remove timthumb in favor of using built-in WordPress image sizes
212
+ * Remove widget "More Button" options
213
+ * Change date display options to now accept any custom date formats
214
+ * Add before and after posts HTML fields
215
+ * Add option for widget CSS class (thanks @avenirer)
216
+ * Add option to display comment count
217
+ * Set better defaults for newly created widgets
218
+ * Various bug fixes and optimizations
219
+
220
+ *Upgrading from an earlier version?*
221
+
222
+ * Upgrades from prior to 2.0.0 we retain the "legacy" template for you. To change which template to use, find the "Template" option under the "Display" tab.
223
+ * If you used the "More Button", you will need to add in your own HTML into one of the new fields since the more button is now removed.
224
+ * If you used custom thumbnail settings you will need to update them. You can now choose from pre-defined sizes available to WordPress. If you need an additional image size please see [how to add image sizes](http://codex.wordpress.org/Function_Reference/add_image_size).
225
+ * Date formatting has changed, you will need to update your settings. By default it uses WordPress' date/time options.
226
+
227
+ = 1.9.0 =
228
+
229
+ * Adds option to order by custom field (thanks @enekochan)
230
+ * Remove "Permalink to:" from link titles (thanks @wirelessgizmo)
231
+ * Swedish translation (thanks @brstp)
232
+
233
+ = 1.8.1 =
234
+
235
+ * Add content display option
236
+
237
+ = 1.8 =
238
+
239
+ * Add custom field display
240
+ * Re-organized widget options
241
+ * Use proper alt tag for image thumbnails
242
+ * Better title attribute for links
243
+
244
+ = 1.7 =
245
+
246
+ * Added show author option
247
+ * Added class to highlight current post
248
+ * Fixed PHP error notices
249
+
250
+ = 1.6 =
251
+
252
+ * Added localization support
253
+ * Added show post categories option
254
+ * Added show post tags option
255
+ * Added custom widget title URL option
256
+ * Improved filter controls for sticky posts
257
+ * Bug fixes
258
+
259
+ = 1.5.1 =
260
+
261
+ * Upgrade timthumb to 2.8.11
262
+ * Load "Large" size post thumbnails which should eliminate large image errors
263
+ * Improved FAQ for thumbnail troubleshooting
264
+
265
+ = 1.5 =
266
+
267
+ * Adds crop mode option
268
+ * Add show published time option
269
+ * Now uses date / time format settings
270
+ * Bug fixes
271
+
272
+ = 1.4.5 =
273
+
274
+ * Updates screenshot
275
+
276
+ = 1.4.4 =
277
+
278
+ * Fixes show_readmore function
279
+ * Adds more button link option
280
+
281
+ = 1.4 =
282
+
283
+ * Cleaner widget options
284
+ * Code refactoring and fixes
285
+ * Adds order by option
286
+
287
+ = 1.3 =
288
+
289
+ * Sticky posts only now optional
290
+
291
+ = 1.2 =
292
+
293
+ * Added post type filter option.
294
+ * Code cleanup.
295
+ * Better selection mechanism for categories.
296
+
297
+ = 1.1 =
298
+
299
+ * Added category filter option.
300
+
301
+ = 1.0 =
302
+
303
+ * First release.
304
+
305
+ == Upgrade Notice ==
306
+
307
+ = 2.2.1 =
308
+ * Tested up to WordPress 6.0
309
+ * Tested with PHP 8.1
310
+
311
+ == Installation ==
312
+
313
+ 1. Download and extract the zip archive
314
+ 2. Upload `ultimate-posts-widget` folder to `/wp-content/plugins/`
315
+ 3. Activate the plugin through the 'Plugins' menu in WordPress
316
+ 4. Add the widget to a sidebar and configure the options as desired
ultimate-posts-widget.php CHANGED
@@ -1,781 +1,828 @@
1
- <?php
2
- /*
3
- Plugin Name: Ultimate Posts Widget
4
- Plugin URI: http://wordpress.org/plugins/ultimate-posts-widget/
5
- Description: The ultimate widget for displaying posts, custom post types or sticky posts with an array of options.
6
- Version: 2.2.0
7
- Author: Clever Widgets
8
- Author URI: https://themecheck.info
9
- Text Domain: ultimate-posts-widget
10
- Domain Path: /languages
11
- License: MIT
12
- */
13
- require_once 'analyst/main.php';
14
-
15
- analyst_init(array(
16
- 'client-id' => 'vmg6q36wn85b8kzr',
17
- 'client-secret' => '35dcca0d55e95f21b3b1f3c6987ae34cf38c65c5',
18
- 'base-dir' => __FILE__
19
- ));
20
-
21
- if (!class_exists('WP_Widget_Ultimate_Posts')) {
22
-
23
- class WP_Widget_Ultimate_Posts extends WP_Widget {
24
-
25
- function __construct() {
26
-
27
- $widget_options = array(
28
- 'classname' => 'widget_ultimate_posts',
29
- 'description' => __( 'Displays list of posts with an array of options', 'ultimate-posts-widget' )
30
- );
31
-
32
- $control_options = array(
33
- 'width' => 450
34
- );
35
-
36
- parent::__construct(
37
- 'sticky-posts',
38
- __( 'Ultimate Posts', 'ultimate-posts-widget' ),
39
- $widget_options,
40
- $control_options
41
- );
42
-
43
- $this->alt_option_name = 'widget_ultimate_posts';
44
-
45
- add_action('save_post', array(&$this, 'flush_widget_cache'));
46
- add_action('deleted_post', array(&$this, 'flush_widget_cache'));
47
- add_action('switch_theme', array(&$this, 'flush_widget_cache'));
48
- add_action('admin_enqueue_scripts', array(&$this, 'enqueue_admin_scripts'));
49
-
50
- if (apply_filters('upw_enqueue_styles', true) && !is_admin()) {
51
- add_action('wp_enqueue_scripts', array(&$this, 'enqueue_theme_scripts'));
52
- }
53
-
54
- load_plugin_textdomain('ultimate-posts-widget', false, basename( dirname( __FILE__ ) ) . '/languages' );
55
-
56
- }
57
-
58
- function enqueue_admin_scripts() {
59
- wp_register_style('upw_admin_styles', plugins_url('css/upw-admin.min.css', __FILE__));
60
- wp_enqueue_style('upw_admin_styles');
61
-
62
- wp_register_script('upw_admin_scripts', plugins_url('js/upw-admin.min.js', __FILE__), array('jquery'), null, true);
63
- wp_enqueue_script('upw_admin_scripts');
64
- }
65
-
66
- function enqueue_theme_scripts() {
67
- wp_register_style('upw_theme_standard', plugins_url('css/upw-theme-standard.min.css', __FILE__));
68
- wp_enqueue_style('upw_theme_standard');
69
- }
70
-
71
- function widget( $args, $instance ) {
72
-
73
- global $post;
74
-
75
- if ( is_object( $post ) ) {
76
- $current_post_id = $post->ID;
77
- } else {
78
- $current_post_id = 0;
79
- }
80
-
81
- $cache = wp_cache_get( 'widget_ultimate_posts', 'widget' );
82
-
83
- if ( !is_array( $cache ) )
84
- $cache = array();
85
-
86
- if ( isset( $cache[$args['widget_id']] ) ) {
87
- echo $cache[$args['widget_id']];
88
- return;
89
- }
90
-
91
- ob_start();
92
- extract( $args );
93
-
94
- $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
95
- $title_link = $instance['title_link'];
96
- $class = $instance['class'];
97
- $number = empty($instance['number']) ? -1 : $instance['number'];
98
- $types = empty($instance['types']) ? 'any' : explode(',', $instance['types']);
99
- $cats = empty($instance['cats']) ? '' : explode(',', $instance['cats']);
100
- $tags = empty($instance['tags']) ? '' : explode(',', $instance['tags']);
101
- $atcat = $instance['atcat'] ? true : false;
102
- $thumb_size = $instance['thumb_size'];
103
- $attag = $instance['attag'] ? true : false;
104
- $exclude_current = $instance['exclude_current'] ? true : false;
105
- $excerpt_length = $instance['excerpt_length'];
106
- $excerpt_readmore = $instance['excerpt_readmore'];
107
- $sticky = $instance['sticky'];
108
- $order = $instance['order'];
109
- $orderby = $instance['orderby'];
110
- $meta_key = $instance['meta_key'];
111
- $custom_empty = isset($instance['custom_empty']) ? $instance['custom_empty'] : '';
112
- $custom_fields = $instance['custom_fields'];
113
-
114
- if (strlen($custom_empty) == 0) {
115
- $custom_empty = 'No posts found.';
116
- $instance['custom_empty'] = 'No posts found.';
117
- }
118
-
119
-
120
- // Sticky posts
121
- if ($sticky == 'only') {
122
- $sticky_query = array( 'post__in' => get_option( 'sticky_posts' ) );
123
- } elseif ($sticky == 'hide') {
124
- $sticky_query = array( 'post__not_in' => get_option( 'sticky_posts' ) );
125
- } else {
126
- $sticky_query = null;
127
- }
128
-
129
- // If $atcat true and in category
130
- if ($atcat && is_category()) {
131
- $cats = get_query_var('cat');
132
- }
133
-
134
- // If $atcat true and is single post
135
- if ($atcat && is_single()) {
136
- $cats = '';
137
- foreach (get_the_category() as $catt) {
138
- $cats .= $catt->term_id.' ';
139
- }
140
- $cats = str_replace(' ', ',', trim($cats));
141
- }
142
-
143
- // If $attag true and in tag
144
- if ($attag && is_tag()) {
145
- $tags = get_query_var('tag_id');
146
- }
147
-
148
- // If $attag true and is single post
149
- if ($attag && is_single()) {
150
- $tags = '';
151
- $thetags = get_the_tags();
152
- if ($thetags) {
153
- foreach ($thetags as $tagg) {
154
- $tags .= $tagg->term_id . ' ';
155
- }
156
- }
157
- $tags = str_replace(' ', ',', trim($tags));
158
- }
159
-
160
- // Excerpt more filter
161
- $new_excerpt_more = function($more) { return "..."; };
162
- add_filter('excerpt_more', $new_excerpt_more);
163
-
164
- // Excerpt length filter
165
- $new_excerpt_length = function($length) use ($excerpt_length) { return $excerpt_length; };
166
- if ( $instance['excerpt_length'] > 0 ) add_filter('excerpt_length', $new_excerpt_length);
167
- if( $class ) {
168
- $before_widget = str_replace('class="', 'class="'. $class . ' ', $before_widget);
169
- }
170
-
171
- echo $before_widget;
172
-
173
- if ( $title ) {
174
- echo $before_title;
175
- if ( $title_link ) echo "<a href='$title_link'>";
176
- echo $title;
177
- if ( $title_link ) echo '</a>';
178
- echo $after_title;
179
- }
180
-
181
- $args = array(
182
- 'posts_per_page' => $number,
183
- 'order' => $order,
184
- 'orderby' => $orderby,
185
- 'category__in' => $cats,
186
- 'tag__in' => $tags,
187
- 'post_type' => $types,
188
- 'post_status' => array('publish', 'inherit')
189
- );
190
-
191
- if ($exclude_current) {
192
- $args['post__not_in'] = array($post->ID);
193
- }
194
-
195
- if ($orderby === 'meta_value') {
196
- $args['meta_key'] = $meta_key;
197
- }
198
-
199
- if (!empty($sticky_query)) {
200
- $args[key($sticky_query)] = reset($sticky_query);
201
- }
202
-
203
- $args = apply_filters('upw_wp_query_args', $args, $instance, $this->id_base);
204
- $upw_query = new WP_Query($args);
205
-
206
- if ($instance['template'] === 'custom') {
207
- $custom_template_path = apply_filters('upw_custom_template_path', '/upw/' . $instance['template_custom'] . '.php', $instance, $this->id_base);
208
- if ( $template = locate_template($custom_template_path) ) {
209
- include $template;
210
- } else {
211
- include 'templates/standard.php';
212
- }
213
- } elseif ($instance['template']) {
214
- include 'templates/' . $instance['template'] . '.php';
215
- } else {
216
- include 'templates/legacy.php';
217
- }
218
-
219
- // Reset the global $the_post as this query will have stomped on it
220
- wp_reset_postdata();
221
-
222
- echo $after_widget;
223
-
224
- if ($cache) {
225
- $cache[$args['widget_id']] = ob_get_flush();
226
- }
227
- wp_cache_set( 'widget_ultimate_posts', $cache, 'widget' );
228
-
229
- remove_filter('excerpt_more', $new_excerpt_more);
230
- if ( $instance['excerpt_length'] > 0 ) remove_filter('excerpt_length', $new_excerpt_length);
231
-
232
- ob_end_flush();
233
- }
234
-
235
- function update( $new_instance, $old_instance ) {
236
- $instance = $old_instance;
237
-
238
- $instance['title'] = strip_tags( $new_instance['title'] );
239
- $instance['class'] = strip_tags( $new_instance['class']);
240
- $instance['title_link'] = strip_tags( $new_instance['title_link'] );
241
- $instance['number'] = strip_tags( $new_instance['number'] );
242
- $instance['types'] = (isset( $new_instance['types'] )) ? implode(',', (array) $new_instance['types']) : '';
243
- $instance['cats'] = (isset( $new_instance['cats'] )) ? implode(',', (array) $new_instance['cats']) : '';
244
- $instance['tags'] = (isset( $new_instance['tags'] )) ? implode(',', (array) $new_instance['tags']) : '';
245
- $instance['atcat'] = isset( $new_instance['atcat'] );
246
- $instance['attag'] = isset( $new_instance['attag'] );
247
- $instance['show_excerpt'] = isset( $new_instance['show_excerpt'] );
248
- $instance['exclude_current'] = isset( $new_instance['exclude_current'] );
249
- $instance['show_content'] = isset( $new_instance['show_content'] );
250
- $instance['show_thumbnail'] = isset( $new_instance['show_thumbnail'] );
251
- $instance['show_date'] = isset( $new_instance['show_date'] );
252
- $instance['date_format'] = strip_tags( $new_instance['date_format'] );
253
- $instance['show_title'] = isset( $new_instance['show_title'] );
254
- $instance['show_author'] = isset( $new_instance['show_author'] );
255
- $instance['show_comments'] = isset( $new_instance['show_comments'] );
256
- $instance['thumb_size'] = strip_tags( $new_instance['thumb_size'] );
257
- $instance['show_readmore'] = isset( $new_instance['show_readmore']);
258
- $instance['excerpt_length'] = strip_tags( $new_instance['excerpt_length'] );
259
- $instance['excerpt_readmore'] = strip_tags( $new_instance['excerpt_readmore'] );
260
- $instance['sticky'] = $new_instance['sticky'];
261
- $instance['order'] = $new_instance['order'];
262
- $instance['orderby'] = $new_instance['orderby'];
263
- $instance['meta_key'] = $new_instance['meta_key'];
264
- $instance['show_cats'] = isset( $new_instance['show_cats'] );
265
- $instance['show_tags'] = isset( $new_instance['show_tags'] );
266
- $instance['custom_fields'] = strip_tags( $new_instance['custom_fields'] );
267
- $instance['template'] = strip_tags( $new_instance['template'] );
268
- $instance['custom_empty'] = strip_tags( $new_instance['custom_empty'] );
269
- $instance['template_custom'] = strip_tags( $new_instance['template_custom'] );
270
-
271
- if (current_user_can('unfiltered_html')) {
272
- $instance['before_posts'] = $new_instance['before_posts'];
273
- $instance['after_posts'] = $new_instance['after_posts'];
274
- } else {
275
- $instance['before_posts'] = wp_filter_post_kses($new_instance['before_posts']);
276
- $instance['after_posts'] = wp_filter_post_kses($new_instance['after_posts']);
277
- }
278
-
279
- $this->flush_widget_cache();
280
-
281
- $alloptions = wp_cache_get( 'alloptions', 'options' );
282
- if ( isset( $alloptions['widget_ultimate_posts'] ) )
283
- delete_option( 'widget_ultimate_posts' );
284
-
285
- return $instance;
286
-
287
- }
288
-
289
- function flush_widget_cache() {
290
-
291
- wp_cache_delete( 'widget_ultimate_posts', 'widget' );
292
-
293
- }
294
-
295
- function form( $instance ) {
296
-
297
- // Set default arguments
298
- $instance = wp_parse_args( (array) $instance, array(
299
- 'title' => __('Ultimate Posts', 'ultimate-posts-widget'),
300
- 'class' => '',
301
- 'title_link' => '' ,
302
- 'number' => '5',
303
- 'types' => 'post',
304
- 'cats' => '',
305
- 'tags' => '',
306
- 'atcat' => false,
307
- 'thumb_size' => 'thumbnail',
308
- 'attag' => false,
309
- 'excerpt_length' => 10,
310
- 'excerpt_readmore' => __('Read more &rarr;', 'ultimate-posts-widget'),
311
- 'order' => 'DESC',
312
- 'orderby' => 'date',
313
- 'meta_key' => '',
314
- 'sticky' => 'show',
315
- 'show_cats' => false,
316
- 'show_tags' => false,
317
- 'show_title' => true,
318
- 'show_date' => true,
319
- 'date_format' => get_option('date_format') . ' ' . get_option('time_format'),
320
- 'show_author' => true,
321
- 'show_comments' => false,
322
- 'show_excerpt' => true,
323
- 'exclude_current' => false,
324
- 'show_content' => false,
325
- 'show_readmore' => true,
326
- 'show_thumbnail' => true,
327
- 'custom_empty' => 'No posts found.',
328
- 'custom_fields' => '',
329
- // Set template to 'legacy' if field from UPW < 2.0 is set.
330
- 'template' => empty($instance['morebutton_text']) ? 'standard' : 'legacy',
331
- 'template_custom' => '',
332
- 'before_posts' => '',
333
- 'after_posts' => ''
334
- ) );
335
-
336
- // Or use the instance
337
- $title = strip_tags($instance['title']);
338
- $class = strip_tags($instance['class']);
339
- $title_link = strip_tags($instance['title_link']);
340
- $number = strip_tags($instance['number']);
341
- $types = $instance['types'];
342
- $cats = $instance['cats'];
343
- $tags = $instance['tags'];
344
- $atcat = $instance['atcat'];
345
- $thumb_size = $instance['thumb_size'];
346
- $attag = $instance['attag'];
347
- $excerpt_length = strip_tags($instance['excerpt_length']);
348
- $excerpt_readmore = strip_tags($instance['excerpt_readmore']);
349
- $order = $instance['order'];
350
- $orderby = $instance['orderby'];
351
- $meta_key = $instance['meta_key'];
352
- $sticky = $instance['sticky'];
353
- $show_cats = $instance['show_cats'];
354
- $show_tags = $instance['show_tags'];
355
- $show_title = $instance['show_title'];
356
- $show_date = $instance['show_date'];
357
- $date_format = $instance['date_format'];
358
- $show_author = $instance['show_author'];
359
- $show_comments = $instance['show_comments'];
360
- $show_excerpt = $instance['show_excerpt'];
361
- $exclude_current = $instance['exclude_current'];
362
- $show_content = $instance['show_content'];
363
- $show_readmore = $instance['show_readmore'];
364
- $show_thumbnail = $instance['show_thumbnail'];
365
- $custom_empty = strip_tags($instance['custom_empty']);
366
- $custom_fields = strip_tags($instance['custom_fields']);
367
- $template = $instance['template'];
368
- $template_custom = strip_tags($instance['template_custom']);
369
- $before_posts = format_to_edit($instance['before_posts']);
370
- $after_posts = format_to_edit($instance['after_posts']);
371
-
372
- // Let's turn $types, $cats, and $tags into an array if they are set
373
- if (!empty($types)) $types = explode(',', $types);
374
- if (!empty($cats)) $cats = explode(',', $cats);
375
- if (!empty($tags)) $tags = explode(',', $tags);
376
-
377
- // Count number of post types for select box sizing
378
- $cpt_types = get_post_types( array( 'public' => true ), 'names' );
379
- if ($cpt_types) {
380
- foreach ($cpt_types as $cpt ) {
381
- $cpt_ar[] = $cpt;
382
- }
383
- $n = count($cpt_ar);
384
- if($n > 6) { $n = 6; }
385
- } else {
386
- $n = 3;
387
- }
388
-
389
- // Count number of categories for select box sizing
390
- $cat_list = get_categories( 'hide_empty=0' );
391
- if ($cat_list) {
392
- foreach ($cat_list as $cat) {
393
- $cat_ar[] = $cat;
394
- }
395
- $c = count($cat_ar);
396
- if($c > 6) { $c = 6; }
397
- } else {
398
- $c = 3;
399
- }
400
-
401
- // Count number of tags for select box sizing
402
- $tag_list = get_tags( 'hide_empty=0' );
403
- if ($tag_list) {
404
- foreach ($tag_list as $tag) {
405
- $tag_ar[] = $tag;
406
- }
407
- $t = count($tag_ar);
408
- if($t > 6) { $t = 6; }
409
- } else {
410
- $t = 3;
411
- }
412
-
413
- ?>
414
-
415
- <div class="upw-tabs">
416
- <a class="upw-tab-item active" data-toggle="upw-tab-general"><?php _e('General', 'ultimate-posts-widget'); ?></a>
417
- <a class="upw-tab-item" data-toggle="upw-tab-display"><?php _e('Display', 'ultimate-posts-widget'); ?></a>
418
- <a class="upw-tab-item" data-toggle="upw-tab-filter"><?php _e('Filter', 'ultimate-posts-widget'); ?></a>
419
- <a class="upw-tab-item" data-toggle="upw-tab-order"><?php _e('Order', 'ultimate-posts-widget'); ?></a>
420
- </div>
421
-
422
- <div class="upw-tab upw-tab-general">
423
-
424
- <p>
425
- <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title', 'ultimate-posts-widget' ); ?>:</label>
426
- <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" />
427
- </p>
428
-
429
- <p>
430
- <label for="<?php echo $this->get_field_id( 'title_link' ); ?>"><?php _e( 'Title URL', 'ultimate-posts-widget' ); ?>:</label>
431
- <input class="widefat" id="<?php echo $this->get_field_id( 'title_link' ); ?>" name="<?php echo $this->get_field_name( 'title_link' ); ?>" type="text" value="<?php echo $title_link; ?>" />
432
- </p>
433
-
434
- <p>
435
- <label for="<?php echo $this->get_field_id( 'class' ); ?>"><?php _e( 'CSS class', 'ultimate-posts-widget' ); ?>:</label>
436
- <input class="widefat" id="<?php echo $this->get_field_id( 'class' ); ?>" name="<?php echo $this->get_field_name( 'class' ); ?>" type="text" value="<?php echo $class; ?>" />
437
- </p>
438
-
439
- <p>
440
- <label for="<?php echo $this->get_field_id('before_posts'); ?>"><?php _e('Before posts', 'ultimate-posts-widget'); ?>:</label>
441
- <textarea class="widefat" id="<?php echo $this->get_field_id('before_posts'); ?>" name="<?php echo $this->get_field_name('before_posts'); ?>" rows="5"><?php echo $before_posts; ?></textarea>
442
- </p>
443
-
444
- <p>
445
- <label for="<?php echo $this->get_field_id('after_posts'); ?>"><?php _e('After posts', 'ultimate-posts-widget'); ?>:</label>
446
- <textarea class="widefat" id="<?php echo $this->get_field_id('after_posts'); ?>" name="<?php echo $this->get_field_name('after_posts'); ?>" rows="5"><?php echo $after_posts; ?></textarea>
447
- </p>
448
-
449
- <p>
450
- <label for="<?php echo $this->get_field_id( 'custom_empty' ); ?>"><?php _e( 'No posts found message', 'ultimate-posts-widget' ); ?>:</label>
451
- <input class="widefat" id="<?php echo $this->get_field_id( 'custom_empty' ); ?>" name="<?php echo $this->get_field_name( 'custom_empty' ); ?>" type="text" value="<?php echo $custom_empty; ?>" placeholder="No posts found." />
452
- </p>
453
-
454
- </div>
455
-
456
- <div class="upw-tab upw-hide upw-tab-display">
457
-
458
- <p>
459
- <label for="<?php echo $this->get_field_id('template'); ?>"><?php _e('Template', 'ultimate-posts-widget'); ?>:</label>
460
- <select name="<?php echo $this->get_field_name('template'); ?>" id="<?php echo $this->get_field_id('template'); ?>" class="widefat">
461
- <option value="legacy"<?php if( $template == 'legacy') echo ' selected'; ?>><?php _e('Legacy', 'ultimate-posts-widget'); ?></option>
462
- <option value="standard"<?php if( $template == 'standard') echo ' selected'; ?>><?php _e('Standard', 'ultimate-posts-widget'); ?></option>
463
- <option value="custom"<?php if( $template == 'custom') echo ' selected'; ?>><?php _e('Custom', 'ultimate-posts-widget'); ?></option>
464
- </select>
465
- </p>
466
-
467
- <p<?php if ($template !== 'custom') echo ' style="display:none;"'; ?>>
468
- <label for="<?php echo $this->get_field_id('template_custom'); ?>"><?php _e('Custom Template Name', 'ultimate-posts-widget'); ?>:</label>
469
- <input class="widefat" id="<?php echo $this->get_field_id('template_custom'); ?>" name="<?php echo $this->get_field_name('template_custom'); ?>" type="text" value="<?php echo $template_custom; ?>" />
470
- </p>
471
-
472
- <p>
473
- <label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts', 'ultimate-posts-widget' ); ?>:</label>
474
- <input class="widefat" id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="number" value="<?php echo $number; ?>" min="-1" />
475
- </p>
476
-
477
- <p>
478
- <input class="checkbox" id="<?php echo $this->get_field_id( 'show_title' ); ?>" name="<?php echo $this->get_field_name( 'show_title' ); ?>" type="checkbox" <?php checked( (bool) $show_title, true ); ?> />
479
- <label for="<?php echo $this->get_field_id( 'show_title' ); ?>"><?php _e( 'Show title', 'ultimate-posts-widget' ); ?></label>
480
- </p>
481
-
482
- <p>
483
- <input class="box" id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" type="checkbox" <?php checked( (bool) $show_date, true ); ?> />
484
- <label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Show published date', 'ultimate-posts-widget' ); ?></label>
485
- </p>
486
-
487
- <p<?php if (!$show_date) echo ' style="display:none;"'; ?>>
488
- <label for="<?php echo $this->get_field_id('date_format'); ?>"><?php _e( 'Date format', 'ultimate-posts-widget' ); ?>:</label>
489
- <input class="widefat" type="text" id="<?php echo $this->get_field_id('date_format'); ?>" name="<?php echo $this->get_field_name('date_format'); ?>" value="<?php echo $date_format; ?>" />
490
- </p>
491
-
492
- <p>
493
- <input class="checkbox" id="<?php echo $this->get_field_id( 'show_author' ); ?>" name="<?php echo $this->get_field_name( 'show_author' ); ?>" type="checkbox" <?php checked( (bool) $show_author, true ); ?> />
494
- <label for="<?php echo $this->get_field_id( 'show_author' ); ?>"><?php _e( 'Show post author', 'ultimate-posts-widget' ); ?></label>
495
- </p>
496
-
497
- <p>
498
- <input class="checkbox" id="<?php echo $this->get_field_id( 'show_comments' ); ?>" name="<?php echo $this->get_field_name( 'show_comments' ); ?>" type="checkbox" <?php checked( (bool) $show_comments, true ); ?> />
499
- <label for="<?php echo $this->get_field_id( 'show_comments' ); ?>"><?php _e( 'Show comments count', 'ultimate-posts-widget' ); ?></label>
500
- </p>
501
-
502
- <p>
503
- <input class="checkbox" id="<?php echo $this->get_field_id( 'exclude_current' ); ?>" name="<?php echo $this->get_field_name( 'exclude_current' ); ?>" type="checkbox" <?php checked( (bool) $exclude_current, true ); ?> />
504
- <label for="<?php echo $this->get_field_id( 'exclude_current' ); ?>"><?php _e( 'Exclude current post from the list', 'ultimate-posts-widget' ); ?></label>
505
- </p>
506
-
507
- <p>
508
- <input class="checkbox" id="<?php echo $this->get_field_id( 'show_excerpt' ); ?>" name="<?php echo $this->get_field_name( 'show_excerpt' ); ?>" type="checkbox" <?php checked( (bool) $show_excerpt, true ); ?> />
509
- <label for="<?php echo $this->get_field_id( 'show_excerpt' ); ?>"><?php _e( 'Show excerpt', 'ultimate-posts-widget' ); ?></label>
510
- </p>
511
-
512
- <p<?php if (!$show_excerpt) echo ' style="display:none;"'; ?>>
513
- <label for="<?php echo $this->get_field_id('excerpt_length'); ?>"><?php _e( 'Excerpt length (in words)', 'ultimate-posts-widget' ); ?>:</label>
514
- <input class="widefat" type="number" id="<?php echo $this->get_field_id('excerpt_length'); ?>" name="<?php echo $this->get_field_name('excerpt_length'); ?>" value="<?php echo $excerpt_length; ?>" min="-1" />
515
- </p>
516
-
517
- <p>
518
- <input class="checkbox" id="<?php echo $this->get_field_id( 'show_content' ); ?>" name="<?php echo $this->get_field_name( 'show_content' ); ?>" type="checkbox" <?php checked( (bool) $show_content, true ); ?> />
519
- <label for="<?php echo $this->get_field_id( 'show_content' ); ?>"><?php _e( 'Show content', 'ultimate-posts-widget' ); ?></label>
520
- </p>
521
-
522
- <p<?php if (!$show_excerpt && !$show_content) echo ' style="display:none;"'; ?>>
523
- <label for="<?php echo $this->get_field_id('show_readmore'); ?>">
524
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_readmore'); ?>" name="<?php echo $this->get_field_name('show_readmore'); ?>"<?php checked( (bool) $show_readmore, true ); ?> />
525
- <?php _e( 'Show read more link', 'ultimate-posts-widget' ); ?>
526
- </label>
527
- </p>
528
-
529
- <p<?php if (!$show_readmore || (!$show_excerpt && !$show_content)) echo ' style="display:none;"'; ?>>
530
- <input class="widefat" type="text" id="<?php echo $this->get_field_id('excerpt_readmore'); ?>" name="<?php echo $this->get_field_name('excerpt_readmore'); ?>" value="<?php echo $excerpt_readmore; ?>" />
531
- </p>
532
-
533
- <?php if ( function_exists('the_post_thumbnail') && current_theme_supports( 'post-thumbnails' ) ) : ?>
534
-
535
- <?php $sizes = get_intermediate_image_sizes(); ?>
536
-
537
- <p>
538
- <input class="checkbox" id="<?php echo $this->get_field_id( 'show_thumbnail' ); ?>" name="<?php echo $this->get_field_name( 'show_thumbnail' ); ?>" type="checkbox" <?php checked( (bool) $show_thumbnail, true ); ?> />
539
-
540
- <label for="<?php echo $this->get_field_id( 'show_thumbnail' ); ?>"><?php _e( 'Show thumbnail', 'ultimate-posts-widget' ); ?></label>
541
- </p>
542
-
543
- <p<?php if (!$show_thumbnail) echo ' style="display:none;"'; ?>>
544
- <select id="<?php echo $this->get_field_id('thumb_size'); ?>" name="<?php echo $this->get_field_name('thumb_size'); ?>" class="widefat">
545
- <?php foreach ($sizes as $size) : ?>
546
- <option value="<?php echo $size; ?>"<?php if ($thumb_size == $size) echo ' selected'; ?>><?php echo $size; ?></option>
547
- <?php endforeach; ?>
548
- <option value="full"<?php if ($thumb_size == $size) echo ' selected'; ?>><?php _e('full'); ?></option>
549
- </select>
550
- </p>
551
-
552
- <?php endif; ?>
553
-
554
- <p>
555
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_cats'); ?>" name="<?php echo $this->get_field_name('show_cats'); ?>" <?php checked( (bool) $show_cats, true ); ?> />
556
- <label for="<?php echo $this->get_field_id('show_cats'); ?>"> <?php _e('Show post categories', 'ultimate-posts-widget'); ?></label>
557
- </p>
558
-
559
- <p>
560
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_tags'); ?>" name="<?php echo $this->get_field_name('show_tags'); ?>" <?php checked( (bool) $show_tags, true ); ?> />
561
- <label for="<?php echo $this->get_field_id('show_tags'); ?>"> <?php _e('Show post tags', 'ultimate-posts-widget'); ?></label>
562
- </p>
563
-
564
- <p>
565
- <label for="<?php echo $this->get_field_id( 'custom_fields' ); ?>"><?php _e( 'Show custom fields (comma separated)', 'ultimate-posts-widget' ); ?>:</label>
566
- <input class="widefat" id="<?php echo $this->get_field_id( 'custom_fields' ); ?>" name="<?php echo $this->get_field_name( 'custom_fields' ); ?>" type="text" value="<?php echo $custom_fields; ?>" />
567
- </p>
568
-
569
- </div>
570
-
571
- <div class="upw-tab upw-hide upw-tab-filter">
572
-
573
- <p>
574
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('atcat'); ?>" name="<?php echo $this->get_field_name('atcat'); ?>" <?php checked( (bool) $atcat, true ); ?> />
575
- <label for="<?php echo $this->get_field_id('atcat'); ?>"> <?php _e('Show posts only from current category', 'ultimate-posts-widget');?></label>
576
- </p>
577
-
578
- <p>
579
- <label for="<?php echo $this->get_field_id('cats'); ?>"><?php _e( 'Categories', 'ultimate-posts-widget' ); ?>:</label>
580
- <select name="<?php echo $this->get_field_name('cats'); ?>[]" id="<?php echo $this->get_field_id('cats'); ?>" class="widefat" style="height: auto;" size="<?php echo $c ?>" multiple>
581
- <option value="" <?php if (empty($cats)) echo 'selected="selected"'; ?>><?php _e('&ndash; Show All &ndash;') ?></option>
582
- <?php
583
- $categories = get_categories( 'hide_empty=0' );
584
- foreach ($categories as $category ) { ?>
585
- <option value="<?php echo $category->term_id; ?>" <?php if(is_array($cats) && in_array($category->term_id, $cats)) echo 'selected="selected"'; ?>><?php echo $category->cat_name;?></option>
586
- <?php } ?>
587
- </select>
588
- </p>
589
-
590
- <?php if ($tag_list) : ?>
591
- <p>
592
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('attag'); ?>" name="<?php echo $this->get_field_name('attag'); ?>" <?php checked( (bool) $attag, true ); ?> />
593
- <label for="<?php echo $this->get_field_id('attag'); ?>"> <?php _e('Show posts only from current tag', 'ultimate-posts-widget');?></label>
594
- </p>
595
-
596
- <p>
597
- <label for="<?php echo $this->get_field_id('tags'); ?>"><?php _e( 'Tags', 'ultimate-posts-widget' ); ?>:</label>
598
- <select name="<?php echo $this->get_field_name('tags'); ?>[]" id="<?php echo $this->get_field_id('tags'); ?>" class="widefat" style="height: auto;" size="<?php echo $t ?>" multiple>
599
- <option value="" <?php if (empty($tags)) echo 'selected="selected"'; ?>><?php _e('&ndash; Show All &ndash;') ?></option>
600
- <?php
601
- foreach ($tag_list as $tag) { ?>
602
- <option value="<?php echo $tag->term_id; ?>" <?php if (is_array($tags) && in_array($tag->term_id, $tags)) echo 'selected="selected"'; ?>><?php echo $tag->name;?></option>
603
- <?php } ?>
604
- </select>
605
- </p>
606
- <?php endif; ?>
607
-
608
- <p>
609
- <label for="<?php echo $this->get_field_id('types'); ?>"><?php _e( 'Post types', 'ultimate-posts-widget' ); ?>:</label>
610
- <select name="<?php echo $this->get_field_name('types'); ?>[]" id="<?php echo $this->get_field_id('types'); ?>" class="widefat" style="height: auto;" size="<?php echo $n ?>" multiple>
611
- <option value="" <?php if (empty($types)) echo 'selected="selected"'; ?>><?php _e('&ndash; Show All &ndash;') ?></option>
612
- <?php
613
- $args = array( 'public' => true );
614
- $post_types = get_post_types( $args, 'names' );
615
- foreach ($post_types as $post_type ) { ?>
616
- <option value="<?php echo $post_type; ?>" <?php if(is_array($types) && in_array($post_type, $types)) { echo 'selected="selected"'; } ?>><?php echo $post_type;?></option>
617
- <?php } ?>
618
- </select>
619
- </p>
620
-
621
- <p>
622
- <label for="<?php echo $this->get_field_id('sticky'); ?>"><?php _e( 'Sticky posts', 'ultimate-posts-widget' ); ?>:</label>
623
- <select name="<?php echo $this->get_field_name('sticky'); ?>" id="<?php echo $this->get_field_id('sticky'); ?>" class="widefat">
624
- <option value="show"<?php if( $sticky === 'show') echo ' selected'; ?>><?php _e('Show All Posts', 'ultimate-posts-widget'); ?></option>
625
- <option value="hide"<?php if( $sticky == 'hide') echo ' selected'; ?>><?php _e('Hide Sticky Posts', 'ultimate-posts-widget'); ?></option>
626
- <option value="only"<?php if( $sticky == 'only') echo ' selected'; ?>><?php _e('Show Only Sticky Posts', 'ultimate-posts-widget'); ?></option>
627
- </select>
628
- </p>
629
-
630
- </div>
631
-
632
- <div class="upw-tab upw-hide upw-tab-order">
633
-
634
- <p>
635
- <label for="<?php echo $this->get_field_id('orderby'); ?>"><?php _e('Order by', 'ultimate-posts-widget'); ?>:</label>
636
- <select name="<?php echo $this->get_field_name('orderby'); ?>" id="<?php echo $this->get_field_id('orderby'); ?>" class="widefat">
637
- <option value="date"<?php if( $orderby == 'date') echo ' selected'; ?>><?php _e('Published Date', 'ultimate-posts-widget'); ?></option>
638
- <option value="title"<?php if( $orderby == 'title') echo ' selected'; ?>><?php _e('Title', 'ultimate-posts-widget'); ?></option>
639
- <option value="comment_count"<?php if( $orderby == 'comment_count') echo ' selected'; ?>><?php _e('Comment Count', 'ultimate-posts-widget'); ?></option>
640
- <option value="rand"<?php if( $orderby == 'rand') echo ' selected'; ?>><?php _e('Random'); ?></option>
641
- <option value="meta_value"<?php if( $orderby == 'meta_value') echo ' selected'; ?>><?php _e('Custom Field', 'ultimate-posts-widget'); ?></option>
642
- <option value="menu_order"<?php if( $orderby == 'menu_order') echo ' selected'; ?>><?php _e('Menu Order', 'ultimate-posts-widget'); ?></option>
643
- </select>
644
- </p>
645
-
646
- <p<?php if ($orderby !== 'meta_value') echo ' style="display:none;"'; ?>>
647
- <label for="<?php echo $this->get_field_id( 'meta_key' ); ?>"><?php _e('Custom field', 'ultimate-posts-widget'); ?>:</label>
648
- <input class="widefat" id="<?php echo $this->get_field_id('meta_key'); ?>" name="<?php echo $this->get_field_name('meta_key'); ?>" type="text" value="<?php echo $meta_key; ?>" />
649
- </p>
650
-
651
- <p>
652
- <label for="<?php echo $this->get_field_id('order'); ?>"><?php _e('Order', 'ultimate-posts-widget'); ?>:</label>
653
- <select name="<?php echo $this->get_field_name('order'); ?>" id="<?php echo $this->get_field_id('order'); ?>" class="widefat">
654
- <option value="DESC"<?php if( $order == 'DESC') echo ' selected'; ?>><?php _e('Descending', 'ultimate-posts-widget'); ?></option>
655
- <option value="ASC"<?php if( $order == 'ASC') echo ' selected'; ?>><?php _e('Ascending', 'ultimate-posts-widget'); ?></option>
656
- </select>
657
- </p>
658
-
659
- </div>
660
-
661
- <div class="etw-carousel-ad-trigger">
662
- <div class="etw-new-label">
663
- New
664
- </div>
665
- <span>Please check out our other plugins too!</span>
666
- <div class="etw-check-it-label">
667
- Check it out
668
- </div>
669
- </div>
670
-
671
- <?php if ( $instance ) { ?>
672
-
673
- <script>
674
-
675
- jQuery(document).ready(function($){
676
-
677
- var show_excerpt = $("#<?php echo $this->get_field_id( 'show_excerpt' ); ?>");
678
- var exclude_current = $("#<?php echo $this->get_field_id( 'exclude_current' ); ?>");
679
- var show_content = $("#<?php echo $this->get_field_id( 'show_content' ); ?>");
680
- var show_readmore = $("#<?php echo $this->get_field_id( 'show_readmore' ); ?>");
681
- var show_readmore_wrap = $("#<?php echo $this->get_field_id( 'show_readmore' ); ?>").parents('p');
682
- var show_thumbnail = $("#<?php echo $this->get_field_id( 'show_thumbnail' ); ?>");
683
- var show_date = $("#<?php echo $this->get_field_id( 'show_date' ); ?>");
684
- var date_format = $("#<?php echo $this->get_field_id( 'date_format' ); ?>").parents('p');
685
- var excerpt_length = $("#<?php echo $this->get_field_id( 'excerpt_length' ); ?>").parents('p');
686
- var excerpt_readmore_wrap = $("#<?php echo $this->get_field_id( 'excerpt_readmore' ); ?>").parents('p');
687
- var thumb_size_wrap = $("#<?php echo $this->get_field_id( 'thumb_size' ); ?>").parents('p');
688
- var order = $("#<?php echo $this->get_field_id('orderby'); ?>");
689
- var meta_key_wrap = $("#<?php echo $this->get_field_id( 'meta_key' ); ?>").parents('p');
690
- var template = $("#<?php echo $this->get_field_id('template'); ?>");
691
- var template_custom = $("#<?php echo $this->get_field_id('template_custom'); ?>").parents('p');
692
-
693
- var toggleReadmore = function() {
694
- if (show_excerpt.is(':checked') || show_content.is(':checked')) {
695
- show_readmore_wrap.show('fast');
696
- } else {
697
- show_readmore_wrap.hide('fast');
698
- }
699
- toggleExcerptReadmore();
700
- }
701
-
702
- var toggleExcerptReadmore = function() {
703
- if ((show_excerpt.is(':checked') || show_content.is(':checked')) && show_readmore.is(':checked')) {
704
- excerpt_readmore_wrap.show('fast');
705
- } else {
706
- excerpt_readmore_wrap.hide('fast');
707
- }
708
- }
709
-
710
- // Toggle read more option
711
- show_excerpt.click(function() {
712
- toggleReadmore();
713
- });
714
-
715
- // Toggle read more option
716
- show_content.click(function() {
717
- toggleReadmore();
718
- });
719
-
720
- // Toggle excerpt length on click
721
- show_excerpt.click(function(){
722
- excerpt_length.toggle('fast');
723
- });
724
-
725
- // Toggle excerpt length on click
726
- show_readmore.click(function(){
727
- toggleExcerptReadmore();
728
- });
729
-
730
- // Toggle date format on click
731
- show_date.click(function(){
732
- date_format.toggle('fast');
733
- });
734
-
735
- // Toggle excerpt length on click
736
- show_thumbnail.click(function(){
737
- thumb_size_wrap.toggle('fast');
738
- });
739
-
740
- // Show or hide custom field meta_key value on order change
741
- order.change(function(){
742
- if ($(this).val() === 'meta_value') {
743
- meta_key_wrap.show('fast');
744
- } else {
745
- meta_key_wrap.hide('fast');
746
- }
747
- });
748
-
749
- // Show or hide custom template field
750
- template.change(function(){
751
- if ($(this).val() === 'custom') {
752
- template_custom.show('fast');
753
- } else {
754
- template_custom.hide('fast');
755
- }
756
- });
757
-
758
- });
759
-
760
- </script>
761
-
762
- <?php
763
-
764
- }
765
-
766
- }
767
-
768
- }
769
-
770
- function init_wp_widget_ultimate_posts() {
771
- register_widget( 'WP_Widget_Ultimate_Posts' );
772
- }
773
-
774
- add_action( 'widgets_init', 'init_wp_widget_ultimate_posts' );
775
- }
776
-
777
- add_action('admin_init', function () {
778
-
779
- require_once 'banner/misc.php';
780
-
781
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Ultimate Posts Widget
4
+ Plugin URI: http://wordpress.org/plugins/ultimate-posts-widget/
5
+ Description: The ultimate widget for displaying posts, custom post types or sticky posts with an array of options.
6
+ Version: 2.2.1
7
+ Author: Clever Widgets
8
+ Author URI: https://themecheck.info
9
+ Text Domain: ultimate-posts-widget
10
+ Domain Path: /languages
11
+ License: MIT
12
+ */
13
+ require_once 'analyst/main.php';
14
+
15
+ analyst_init(array(
16
+ 'client-id' => 'vmg6q36wn85b8kzr',
17
+ 'client-secret' => '35dcca0d55e95f21b3b1f3c6987ae34cf38c65c5',
18
+ 'base-dir' => __FILE__
19
+ ));
20
+
21
+ if (!class_exists('WP_Widget_Ultimate_Posts')) {
22
+
23
+ class WP_Widget_Ultimate_Posts extends WP_Widget {
24
+
25
+ function __construct() {
26
+
27
+ $widget_options = array(
28
+ 'classname' => 'widget_ultimate_posts',
29
+ 'description' => __( 'Displays list of posts with an array of options', 'ultimate-posts-widget' )
30
+ );
31
+
32
+ $control_options = array(
33
+ 'width' => 450
34
+ );
35
+
36
+ parent::__construct(
37
+ 'sticky-posts',
38
+ __( 'Ultimate Posts', 'ultimate-posts-widget' ),
39
+ $widget_options,
40
+ $control_options
41
+ );
42
+
43
+ $this->alt_option_name = 'widget_ultimate_posts';
44
+
45
+ add_action('save_post', array(&$this, 'flush_widget_cache'));
46
+ add_action('deleted_post', array(&$this, 'flush_widget_cache'));
47
+ add_action('switch_theme', array(&$this, 'flush_widget_cache'));
48
+ add_action('admin_enqueue_scripts', array(&$this, 'enqueue_admin_scripts'));
49
+
50
+ /* Admin notice to check Classic Widgets Plugin is not already installed and WordPress version 5.8 or higher */
51
+ add_action( 'admin_notices', array( &$this, 'flush_admin_notice__warning' ) );
52
+
53
+ if (apply_filters('upw_enqueue_styles', true) && !is_admin()) {
54
+ add_action('wp_enqueue_scripts', array(&$this, 'enqueue_theme_scripts'));
55
+ }
56
+
57
+ load_plugin_textdomain('ultimate-posts-widget', false, basename( dirname( __FILE__ ) ) . '/languages' );
58
+
59
+ }
60
+
61
+ function flush_admin_notice__warning() {
62
+ global $wp_version;
63
+
64
+ if ( version_compare( $wp_version, '5.8' ) >= 0 && !is_plugin_active( 'classic-widgets/classic-widgets.php' ) ) {
65
+
66
+ $upw_hide_admin_notification = get_option( 'upw_hide_admin_notification' );
67
+ if( 'yes' === $upw_hide_admin_notification ) {
68
+ return;
69
+ }
70
+ ?>
71
+ <div class="notice notice-warning upw-notice-wrapper is-dismissible">
72
+ <p><?php
73
+ echo sprintf(
74
+ __( '%1$sUltimate Posts Widget:%2$s This plugin provides a classic widget type, and needs the %3$sClassic Widgets%4$s plugin to function properly on this WordPress version.', 'ultimate-posts-widget' ),
75
+ '<b>',
76
+ '</b>',
77
+ '<a href="https://wordpress.org/plugins/classic-widgets/" target="_blank">',
78
+ '</a>'
79
+ );
80
+ ?></p>
81
+ </div>
82
+ <?php
83
+ }
84
+ }
85
+
86
+ function enqueue_admin_scripts() {
87
+ wp_register_style('upw_admin_styles', plugins_url('css/upw-admin.min.css', __FILE__));
88
+ wp_enqueue_style('upw_admin_styles');
89
+
90
+ wp_register_script('upw_admin_scripts', plugins_url('js/upw-admin.min.js', __FILE__), array('jquery'), null, true);
91
+ wp_enqueue_script('upw_admin_scripts');
92
+
93
+ wp_localize_script( 'upw_admin_scripts', 'upw_admin_scripts_ajax_object',
94
+ array(
95
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
96
+ )
97
+ );
98
+ }
99
+
100
+ function enqueue_theme_scripts() {
101
+ wp_register_style('upw_theme_standard', plugins_url('css/upw-theme-standard.min.css', __FILE__));
102
+ wp_enqueue_style('upw_theme_standard');
103
+ }
104
+
105
+ function widget( $args, $instance ) {
106
+
107
+ global $post;
108
+
109
+ if ( is_object( $post ) ) {
110
+ $current_post_id = $post->ID;
111
+ } else {
112
+ $current_post_id = 0;
113
+ }
114
+
115
+ $cache = wp_cache_get( 'widget_ultimate_posts', 'widget' );
116
+
117
+ if ( !is_array( $cache ) )
118
+ $cache = array();
119
+
120
+ if ( isset( $cache[$args['widget_id']] ) ) {
121
+ echo $cache[$args['widget_id']];
122
+ return;
123
+ }
124
+
125
+ ob_start();
126
+ extract( $args );
127
+
128
+ $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
129
+ $title_link = $instance['title_link'];
130
+ $class = $instance['class'];
131
+ $number = empty($instance['number']) ? -1 : $instance['number'];
132
+ $types = empty($instance['types']) ? 'any' : explode(',', $instance['types']);
133
+ $cats = empty($instance['cats']) ? '' : explode(',', $instance['cats']);
134
+ $tags = empty($instance['tags']) ? '' : explode(',', $instance['tags']);
135
+ $atcat = $instance['atcat'] ? true : false;
136
+ $thumb_size = $instance['thumb_size'];
137
+ $attag = $instance['attag'] ? true : false;
138
+ $exclude_current = $instance['exclude_current'] ? true : false;
139
+ $excerpt_length = $instance['excerpt_length'];
140
+ $excerpt_readmore = $instance['excerpt_readmore'];
141
+ $sticky = $instance['sticky'];
142
+ $order = $instance['order'];
143
+ $orderby = $instance['orderby'];
144
+ $meta_key = $instance['meta_key'];
145
+ $custom_empty = isset($instance['custom_empty']) ? $instance['custom_empty'] : '';
146
+ $custom_fields = $instance['custom_fields'];
147
+
148
+ if (strlen($custom_empty) == 0) {
149
+ $custom_empty = 'No posts found.';
150
+ $instance['custom_empty'] = 'No posts found.';
151
+ }
152
+
153
+
154
+ // Sticky posts
155
+ if ($sticky == 'only') {
156
+ $sticky_query = array( 'post__in' => get_option( 'sticky_posts' ) );
157
+ } elseif ($sticky == 'hide') {
158
+ $sticky_query = array( 'post__not_in' => get_option( 'sticky_posts' ) );
159
+ } else {
160
+ $sticky_query = null;
161
+ }
162
+
163
+ // If $atcat true and in category
164
+ if ($atcat && is_category()) {
165
+ $cats = get_query_var('cat');
166
+ }
167
+
168
+ // If $atcat true and is single post
169
+ if ($atcat && is_single()) {
170
+ $cats = '';
171
+ foreach (get_the_category() as $catt) {
172
+ $cats .= $catt->term_id.' ';
173
+ }
174
+ $cats = str_replace(' ', ',', trim($cats));
175
+ }
176
+
177
+ // If $attag true and in tag
178
+ if ($attag && is_tag()) {
179
+ $tags = get_query_var('tag_id');
180
+ }
181
+
182
+ // If $attag true and is single post
183
+ if ($attag && is_single()) {
184
+ $tags = '';
185
+ $thetags = get_the_tags();
186
+ if ($thetags) {
187
+ foreach ($thetags as $tagg) {
188
+ $tags .= $tagg->term_id . ' ';
189
+ }
190
+ }
191
+ $tags = str_replace(' ', ',', trim($tags));
192
+ }
193
+
194
+ // Excerpt more filter
195
+ $new_excerpt_more = function($more) { return "..."; };
196
+ add_filter('excerpt_more', $new_excerpt_more);
197
+
198
+ // Excerpt length filter
199
+ $new_excerpt_length = function($length) use ($excerpt_length) { return $excerpt_length; };
200
+ if ( $instance['excerpt_length'] > 0 ) add_filter('excerpt_length', $new_excerpt_length);
201
+ if( $class ) {
202
+ $before_widget = str_replace('class="', 'class="'. $class . ' ', $before_widget);
203
+ }
204
+
205
+ echo $before_widget;
206
+
207
+ if ( $title ) {
208
+ echo $before_title;
209
+ if ( $title_link ) echo "<a href='$title_link'>";
210
+ echo $title;
211
+ if ( $title_link ) echo '</a>';
212
+ echo $after_title;
213
+ }
214
+
215
+ $args = array(
216
+ 'posts_per_page' => $number,
217
+ 'order' => $order,
218
+ 'orderby' => $orderby,
219
+ 'category__in' => $cats,
220
+ 'tag__in' => $tags,
221
+ 'post_type' => $types,
222
+ 'post_status' => array('publish', 'inherit')
223
+ );
224
+
225
+ if ($exclude_current) {
226
+ $args['post__not_in'] = array($post->ID);
227
+ }
228
+
229
+ if ($orderby === 'meta_value') {
230
+ $args['meta_key'] = $meta_key;
231
+ }
232
+
233
+ if (!empty($sticky_query)) {
234
+ $args[key($sticky_query)] = reset($sticky_query);
235
+ }
236
+
237
+ $args = apply_filters('upw_wp_query_args', $args, $instance, $this->id_base);
238
+ $upw_query = new WP_Query($args);
239
+
240
+ if ($instance['template'] === 'custom') {
241
+ $custom_template_path = apply_filters('upw_custom_template_path', '/upw/' . $instance['template_custom'] . '.php', $instance, $this->id_base);
242
+ if ( $template = locate_template($custom_template_path) ) {
243
+ include $template;
244
+ } else {
245
+ include 'templates/standard.php';
246
+ }
247
+ } elseif ($instance['template']) {
248
+ include 'templates/' . $instance['template'] . '.php';
249
+ } else {
250
+ include 'templates/legacy.php';
251
+ }
252
+
253
+ // Reset the global $the_post as this query will have stomped on it
254
+ wp_reset_postdata();
255
+
256
+ echo $after_widget;
257
+
258
+ if ($cache) {
259
+ $cache[$args['widget_id']] = ob_get_flush();
260
+ }
261
+ wp_cache_set( 'widget_ultimate_posts', $cache, 'widget' );
262
+
263
+ remove_filter('excerpt_more', $new_excerpt_more);
264
+ if ( $instance['excerpt_length'] > 0 ) remove_filter('excerpt_length', $new_excerpt_length);
265
+
266
+ ob_end_flush();
267
+ }
268
+
269
+ function update( $new_instance, $old_instance ) {
270
+ $instance = $old_instance;
271
+
272
+ $instance['title'] = strip_tags( $new_instance['title'] );
273
+ $instance['class'] = strip_tags( $new_instance['class']);
274
+ $instance['title_link'] = strip_tags( $new_instance['title_link'] );
275
+ $instance['number'] = strip_tags( $new_instance['number'] );
276
+ $instance['types'] = (isset( $new_instance['types'] )) ? implode(',', (array) $new_instance['types']) : '';
277
+ $instance['cats'] = (isset( $new_instance['cats'] )) ? implode(',', (array) $new_instance['cats']) : '';
278
+ $instance['tags'] = (isset( $new_instance['tags'] )) ? implode(',', (array) $new_instance['tags']) : '';
279
+ $instance['atcat'] = isset( $new_instance['atcat'] );
280
+ $instance['attag'] = isset( $new_instance['attag'] );
281
+ $instance['show_excerpt'] = isset( $new_instance['show_excerpt'] );
282
+ $instance['exclude_current'] = isset( $new_instance['exclude_current'] );
283
+ $instance['show_content'] = isset( $new_instance['show_content'] );
284
+ $instance['show_thumbnail'] = isset( $new_instance['show_thumbnail'] );
285
+ $instance['show_date'] = isset( $new_instance['show_date'] );
286
+ $instance['date_format'] = strip_tags( $new_instance['date_format'] );
287
+ $instance['show_title'] = isset( $new_instance['show_title'] );
288
+ $instance['show_author'] = isset( $new_instance['show_author'] );
289
+ $instance['show_comments'] = isset( $new_instance['show_comments'] );
290
+ $instance['thumb_size'] = strip_tags( $new_instance['thumb_size'] );
291
+ $instance['show_readmore'] = isset( $new_instance['show_readmore']);
292
+ $instance['excerpt_length'] = strip_tags( $new_instance['excerpt_length'] );
293
+ $instance['excerpt_readmore'] = strip_tags( $new_instance['excerpt_readmore'] );
294
+ $instance['sticky'] = $new_instance['sticky'];
295
+ $instance['order'] = $new_instance['order'];
296
+ $instance['orderby'] = $new_instance['orderby'];
297
+ $instance['meta_key'] = $new_instance['meta_key'];
298
+ $instance['show_cats'] = isset( $new_instance['show_cats'] );
299
+ $instance['show_tags'] = isset( $new_instance['show_tags'] );
300
+ $instance['custom_fields'] = strip_tags( $new_instance['custom_fields'] );
301
+ $instance['template'] = strip_tags( $new_instance['template'] );
302
+ $instance['custom_empty'] = strip_tags( $new_instance['custom_empty'] );
303
+ $instance['template_custom'] = strip_tags( $new_instance['template_custom'] );
304
+
305
+ if (current_user_can('unfiltered_html')) {
306
+ $instance['before_posts'] = $new_instance['before_posts'];
307
+ $instance['after_posts'] = $new_instance['after_posts'];
308
+ } else {
309
+ $instance['before_posts'] = wp_filter_post_kses($new_instance['before_posts']);
310
+ $instance['after_posts'] = wp_filter_post_kses($new_instance['after_posts']);
311
+ }
312
+
313
+ $this->flush_widget_cache();
314
+
315
+ $alloptions = wp_cache_get( 'alloptions', 'options' );
316
+ if ( isset( $alloptions['widget_ultimate_posts'] ) )
317
+ delete_option( 'widget_ultimate_posts' );
318
+
319
+ return $instance;
320
+
321
+ }
322
+
323
+ function flush_widget_cache() {
324
+
325
+ wp_cache_delete( 'widget_ultimate_posts', 'widget' );
326
+
327
+ }
328
+
329
+ function form( $instance ) {
330
+
331
+ // Set default arguments
332
+ $instance = wp_parse_args( (array) $instance, array(
333
+ 'title' => __('Ultimate Posts', 'ultimate-posts-widget'),
334
+ 'class' => '',
335
+ 'title_link' => '' ,
336
+ 'number' => '5',
337
+ 'types' => 'post',
338
+ 'cats' => '',
339
+ 'tags' => '',
340
+ 'atcat' => false,
341
+ 'thumb_size' => 'thumbnail',
342
+ 'attag' => false,
343
+ 'excerpt_length' => 10,
344
+ 'excerpt_readmore' => __('Read more &rarr;', 'ultimate-posts-widget'),
345
+ 'order' => 'DESC',
346
+ 'orderby' => 'date',
347
+ 'meta_key' => '',
348
+ 'sticky' => 'show',
349
+ 'show_cats' => false,
350
+ 'show_tags' => false,
351
+ 'show_title' => true,
352
+ 'show_date' => true,
353
+ 'date_format' => get_option('date_format') . ' ' . get_option('time_format'),
354
+ 'show_author' => true,
355
+ 'show_comments' => false,
356
+ 'show_excerpt' => true,
357
+ 'exclude_current' => false,
358
+ 'show_content' => false,
359
+ 'show_readmore' => true,
360
+ 'show_thumbnail' => true,
361
+ 'custom_empty' => 'No posts found.',
362
+ 'custom_fields' => '',
363
+ // Set template to 'legacy' if field from UPW < 2.0 is set.
364
+ 'template' => empty($instance['morebutton_text']) ? 'standard' : 'legacy',
365
+ 'template_custom' => '',
366
+ 'before_posts' => '',
367
+ 'after_posts' => ''
368
+ ) );
369
+
370
+ // Or use the instance
371
+ $title = strip_tags($instance['title']);
372
+ $class = strip_tags($instance['class']);
373
+ $title_link = strip_tags($instance['title_link']);
374
+ $number = strip_tags($instance['number']);
375
+ $types = $instance['types'];
376
+ $cats = $instance['cats'];
377
+ $tags = $instance['tags'];
378
+ $atcat = $instance['atcat'];
379
+ $thumb_size = $instance['thumb_size'];
380
+ $attag = $instance['attag'];
381
+ $excerpt_length = strip_tags($instance['excerpt_length']);
382
+ $excerpt_readmore = strip_tags($instance['excerpt_readmore']);
383
+ $order = $instance['order'];
384
+ $orderby = $instance['orderby'];
385
+ $meta_key = $instance['meta_key'];
386
+ $sticky = $instance['sticky'];
387
+ $show_cats = $instance['show_cats'];
388
+ $show_tags = $instance['show_tags'];
389
+ $show_title = $instance['show_title'];
390
+ $show_date = $instance['show_date'];
391
+ $date_format = $instance['date_format'];
392
+ $show_author = $instance['show_author'];
393
+ $show_comments = $instance['show_comments'];
394
+ $show_excerpt = $instance['show_excerpt'];
395
+ $exclude_current = $instance['exclude_current'];
396
+ $show_content = $instance['show_content'];
397
+ $show_readmore = $instance['show_readmore'];
398
+ $show_thumbnail = $instance['show_thumbnail'];
399
+ $custom_empty = strip_tags($instance['custom_empty']);
400
+ $custom_fields = strip_tags($instance['custom_fields']);
401
+ $template = $instance['template'];
402
+ $template_custom = strip_tags($instance['template_custom']);
403
+ $before_posts = format_to_edit($instance['before_posts']);
404
+ $after_posts = format_to_edit($instance['after_posts']);
405
+
406
+ // Let's turn $types, $cats, and $tags into an array if they are set
407
+ if (!empty($types)) $types = explode(',', $types);
408
+ if (!empty($cats)) $cats = explode(',', $cats);
409
+ if (!empty($tags)) $tags = explode(',', $tags);
410
+
411
+ // Count number of post types for select box sizing
412
+ $cpt_types = get_post_types( array( 'public' => true ), 'names' );
413
+ if ($cpt_types) {
414
+ foreach ($cpt_types as $cpt ) {
415
+ $cpt_ar[] = $cpt;
416
+ }
417
+ $n = count($cpt_ar);
418
+ if($n > 6) { $n = 6; }
419
+ } else {
420
+ $n = 3;
421
+ }
422
+
423
+ // Count number of categories for select box sizing
424
+ $cat_list = get_categories( 'hide_empty=0' );
425
+ if ($cat_list) {
426
+ foreach ($cat_list as $cat) {
427
+ $cat_ar[] = $cat;
428
+ }
429
+ $c = count($cat_ar);
430
+ if($c > 6) { $c = 6; }
431
+ } else {
432
+ $c = 3;
433
+ }
434
+
435
+ // Count number of tags for select box sizing
436
+ $tag_list = get_tags( 'hide_empty=0' );
437
+ if ($tag_list) {
438
+ foreach ($tag_list as $tag) {
439
+ $tag_ar[] = $tag;
440
+ }
441
+ $t = count($tag_ar);
442
+ if($t > 6) { $t = 6; }
443
+ } else {
444
+ $t = 3;
445
+ }
446
+
447
+ ?>
448
+
449
+ <div class="upw-tabs">
450
+ <a class="upw-tab-item active" data-toggle="upw-tab-general"><?php _e('General', 'ultimate-posts-widget'); ?></a>
451
+ <a class="upw-tab-item" data-toggle="upw-tab-display"><?php _e('Display', 'ultimate-posts-widget'); ?></a>
452
+ <a class="upw-tab-item" data-toggle="upw-tab-filter"><?php _e('Filter', 'ultimate-posts-widget'); ?></a>
453
+ <a class="upw-tab-item" data-toggle="upw-tab-order"><?php _e('Order', 'ultimate-posts-widget'); ?></a>
454
+ </div>
455
+
456
+ <div class="upw-tab upw-tab-general">
457
+
458
+ <p>
459
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title', 'ultimate-posts-widget' ); ?>:</label>
460
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" />
461
+ </p>
462
+
463
+ <p>
464
+ <label for="<?php echo $this->get_field_id( 'title_link' ); ?>"><?php _e( 'Title URL', 'ultimate-posts-widget' ); ?>:</label>
465
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title_link' ); ?>" name="<?php echo $this->get_field_name( 'title_link' ); ?>" type="text" value="<?php echo $title_link; ?>" />
466
+ </p>
467
+
468
+ <p>
469
+ <label for="<?php echo $this->get_field_id( 'class' ); ?>"><?php _e( 'CSS class', 'ultimate-posts-widget' ); ?>:</label>
470
+ <input class="widefat" id="<?php echo $this->get_field_id( 'class' ); ?>" name="<?php echo $this->get_field_name( 'class' ); ?>" type="text" value="<?php echo $class; ?>" />
471
+ </p>
472
+
473
+ <p>
474
+ <label for="<?php echo $this->get_field_id('before_posts'); ?>"><?php _e('Before posts', 'ultimate-posts-widget'); ?>:</label>
475
+ <textarea class="widefat" id="<?php echo $this->get_field_id('before_posts'); ?>" name="<?php echo $this->get_field_name('before_posts'); ?>" rows="5"><?php echo $before_posts; ?></textarea>
476
+ </p>
477
+
478
+ <p>
479
+ <label for="<?php echo $this->get_field_id('after_posts'); ?>"><?php _e('After posts', 'ultimate-posts-widget'); ?>:</label>
480
+ <textarea class="widefat" id="<?php echo $this->get_field_id('after_posts'); ?>" name="<?php echo $this->get_field_name('after_posts'); ?>" rows="5"><?php echo $after_posts; ?></textarea>
481
+ </p>
482
+
483
+ <p>
484
+ <label for="<?php echo $this->get_field_id( 'custom_empty' ); ?>"><?php _e( 'No posts found message', 'ultimate-posts-widget' ); ?>:</label>
485
+ <input class="widefat" id="<?php echo $this->get_field_id( 'custom_empty' ); ?>" name="<?php echo $this->get_field_name( 'custom_empty' ); ?>" type="text" value="<?php echo $custom_empty; ?>" placeholder="No posts found." />
486
+ </p>
487
+
488
+ </div>
489
+
490
+ <div class="upw-tab upw-hide upw-tab-display">
491
+
492
+ <p>
493
+ <label for="<?php echo $this->get_field_id('template'); ?>"><?php _e('Template', 'ultimate-posts-widget'); ?>:</label>
494
+ <select name="<?php echo $this->get_field_name('template'); ?>" id="<?php echo $this->get_field_id('template'); ?>" class="widefat">
495
+ <option value="legacy"<?php if( $template == 'legacy') echo ' selected'; ?>><?php _e('Legacy', 'ultimate-posts-widget'); ?></option>
496
+ <option value="standard"<?php if( $template == 'standard') echo ' selected'; ?>><?php _e('Standard', 'ultimate-posts-widget'); ?></option>
497
+ <option value="custom"<?php if( $template == 'custom') echo ' selected'; ?>><?php _e('Custom', 'ultimate-posts-widget'); ?></option>
498
+ </select>
499
+ </p>
500
+
501
+ <p<?php if ($template !== 'custom') echo ' style="display:none;"'; ?>>
502
+ <label for="<?php echo $this->get_field_id('template_custom'); ?>"><?php _e('Custom Template Name', 'ultimate-posts-widget'); ?>:</label>
503
+ <input class="widefat" id="<?php echo $this->get_field_id('template_custom'); ?>" name="<?php echo $this->get_field_name('template_custom'); ?>" type="text" value="<?php echo $template_custom; ?>" />
504
+ </p>
505
+
506
+ <p>
507
+ <label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts', 'ultimate-posts-widget' ); ?>:</label>
508
+ <input class="widefat" id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="number" value="<?php echo $number; ?>" min="-1" />
509
+ </p>
510
+
511
+ <p>
512
+ <input class="checkbox" id="<?php echo $this->get_field_id( 'show_title' ); ?>" name="<?php echo $this->get_field_name( 'show_title' ); ?>" type="checkbox" <?php checked( (bool) $show_title, true ); ?> />
513
+ <label for="<?php echo $this->get_field_id( 'show_title' ); ?>"><?php _e( 'Show title', 'ultimate-posts-widget' ); ?></label>
514
+ </p>
515
+
516
+ <p>
517
+ <input class="box" id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" type="checkbox" <?php checked( (bool) $show_date, true ); ?> />
518
+ <label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Show published date', 'ultimate-posts-widget' ); ?></label>
519
+ </p>
520
+
521
+ <p<?php if (!$show_date) echo ' style="display:none;"'; ?>>
522
+ <label for="<?php echo $this->get_field_id('date_format'); ?>"><?php _e( 'Date format', 'ultimate-posts-widget' ); ?>:</label>
523
+ <input class="widefat" type="text" id="<?php echo $this->get_field_id('date_format'); ?>" name="<?php echo $this->get_field_name('date_format'); ?>" value="<?php echo $date_format; ?>" />
524
+ </p>
525
+
526
+ <p>
527
+ <input class="checkbox" id="<?php echo $this->get_field_id( 'show_author' ); ?>" name="<?php echo $this->get_field_name( 'show_author' ); ?>" type="checkbox" <?php checked( (bool) $show_author, true ); ?> />
528
+ <label for="<?php echo $this->get_field_id( 'show_author' ); ?>"><?php _e( 'Show post author', 'ultimate-posts-widget' ); ?></label>
529
+ </p>
530
+
531
+ <p>
532
+ <input class="checkbox" id="<?php echo $this->get_field_id( 'show_comments' ); ?>" name="<?php echo $this->get_field_name( 'show_comments' ); ?>" type="checkbox" <?php checked( (bool) $show_comments, true ); ?> />
533
+ <label for="<?php echo $this->get_field_id( 'show_comments' ); ?>"><?php _e( 'Show comments count', 'ultimate-posts-widget' ); ?></label>
534
+ </p>
535
+
536
+ <p>
537
+ <input class="checkbox" id="<?php echo $this->get_field_id( 'exclude_current' ); ?>" name="<?php echo $this->get_field_name( 'exclude_current' ); ?>" type="checkbox" <?php checked( (bool) $exclude_current, true ); ?> />
538
+ <label for="<?php echo $this->get_field_id( 'exclude_current' ); ?>"><?php _e( 'Exclude current post from the list', 'ultimate-posts-widget' ); ?></label>
539
+ </p>
540
+
541
+ <p>
542
+ <input class="checkbox" id="<?php echo $this->get_field_id( 'show_excerpt' ); ?>" name="<?php echo $this->get_field_name( 'show_excerpt' ); ?>" type="checkbox" <?php checked( (bool) $show_excerpt, true ); ?> />
543
+ <label for="<?php echo $this->get_field_id( 'show_excerpt' ); ?>"><?php _e( 'Show excerpt', 'ultimate-posts-widget' ); ?></label>
544
+ </p>
545
+
546
+ <p<?php if (!$show_excerpt) echo ' style="display:none;"'; ?>>
547
+ <label for="<?php echo $this->get_field_id('excerpt_length'); ?>"><?php _e( 'Excerpt length (in words)', 'ultimate-posts-widget' ); ?>:</label>
548
+ <input class="widefat" type="number" id="<?php echo $this->get_field_id('excerpt_length'); ?>" name="<?php echo $this->get_field_name('excerpt_length'); ?>" value="<?php echo $excerpt_length; ?>" min="-1" />
549
+ </p>
550
+
551
+ <p>
552
+ <input class="checkbox" id="<?php echo $this->get_field_id( 'show_content' ); ?>" name="<?php echo $this->get_field_name( 'show_content' ); ?>" type="checkbox" <?php checked( (bool) $show_content, true ); ?> />
553
+ <label for="<?php echo $this->get_field_id( 'show_content' ); ?>"><?php _e( 'Show content', 'ultimate-posts-widget' ); ?></label>
554
+ </p>
555
+
556
+ <p<?php if (!$show_excerpt && !$show_content) echo ' style="display:none;"'; ?>>
557
+ <label for="<?php echo $this->get_field_id('show_readmore'); ?>">
558
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_readmore'); ?>" name="<?php echo $this->get_field_name('show_readmore'); ?>"<?php checked( (bool) $show_readmore, true ); ?> />
559
+ <?php _e( 'Show read more link', 'ultimate-posts-widget' ); ?>
560
+ </label>
561
+ </p>
562
+
563
+ <p<?php if (!$show_readmore || (!$show_excerpt && !$show_content)) echo ' style="display:none;"'; ?>>
564
+ <input class="widefat" type="text" id="<?php echo $this->get_field_id('excerpt_readmore'); ?>" name="<?php echo $this->get_field_name('excerpt_readmore'); ?>" value="<?php echo $excerpt_readmore; ?>" />
565
+ </p>
566
+
567
+ <?php if ( function_exists('the_post_thumbnail') && current_theme_supports( 'post-thumbnails' ) ) : ?>
568
+
569
+ <?php $sizes = get_intermediate_image_sizes(); ?>
570
+
571
+ <p>
572
+ <input class="checkbox" id="<?php echo $this->get_field_id( 'show_thumbnail' ); ?>" name="<?php echo $this->get_field_name( 'show_thumbnail' ); ?>" type="checkbox" <?php checked( (bool) $show_thumbnail, true ); ?> />
573
+
574
+ <label for="<?php echo $this->get_field_id( 'show_thumbnail' ); ?>"><?php _e( 'Show thumbnail', 'ultimate-posts-widget' ); ?></label>
575
+ </p>
576
+
577
+ <p<?php if (!$show_thumbnail) echo ' style="display:none;"'; ?>>
578
+ <select id="<?php echo $this->get_field_id('thumb_size'); ?>" name="<?php echo $this->get_field_name('thumb_size'); ?>" class="widefat">
579
+ <?php foreach ($sizes as $size) : ?>
580
+ <option value="<?php echo $size; ?>"<?php if ($thumb_size == $size) echo ' selected'; ?>><?php echo $size; ?></option>
581
+ <?php endforeach; ?>
582
+ <option value="full"<?php if ($thumb_size == $size) echo ' selected'; ?>><?php _e('full'); ?></option>
583
+ </select>
584
+ </p>
585
+
586
+ <?php endif; ?>
587
+
588
+ <p>
589
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_cats'); ?>" name="<?php echo $this->get_field_name('show_cats'); ?>" <?php checked( (bool) $show_cats, true ); ?> />
590
+ <label for="<?php echo $this->get_field_id('show_cats'); ?>"> <?php _e('Show post categories', 'ultimate-posts-widget'); ?></label>
591
+ </p>
592
+
593
+ <p>
594
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_tags'); ?>" name="<?php echo $this->get_field_name('show_tags'); ?>" <?php checked( (bool) $show_tags, true ); ?> />
595
+ <label for="<?php echo $this->get_field_id('show_tags'); ?>"> <?php _e('Show post tags', 'ultimate-posts-widget'); ?></label>
596
+ </p>
597
+
598
+ <p>
599
+ <label for="<?php echo $this->get_field_id( 'custom_fields' ); ?>"><?php _e( 'Show custom fields (comma separated)', 'ultimate-posts-widget' ); ?>:</label>
600
+ <input class="widefat" id="<?php echo $this->get_field_id( 'custom_fields' ); ?>" name="<?php echo $this->get_field_name( 'custom_fields' ); ?>" type="text" value="<?php echo $custom_fields; ?>" />
601
+ </p>
602
+
603
+ </div>
604
+
605
+ <div class="upw-tab upw-hide upw-tab-filter">
606
+
607
+ <p>
608
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('atcat'); ?>" name="<?php echo $this->get_field_name('atcat'); ?>" <?php checked( (bool) $atcat, true ); ?> />
609
+ <label for="<?php echo $this->get_field_id('atcat'); ?>"> <?php _e('Show posts only from current category', 'ultimate-posts-widget');?></label>
610
+ </p>
611
+
612
+ <p>
613
+ <label for="<?php echo $this->get_field_id('cats'); ?>"><?php _e( 'Categories', 'ultimate-posts-widget' ); ?>:</label>
614
+ <select name="<?php echo $this->get_field_name('cats'); ?>[]" id="<?php echo $this->get_field_id('cats'); ?>" class="widefat" style="height: auto;" size="<?php echo $c ?>" multiple>
615
+ <option value="" <?php if (empty($cats)) echo 'selected="selected"'; ?>><?php _e('&ndash; Show All &ndash;') ?></option>
616
+ <?php
617
+ $categories = get_categories( 'hide_empty=0' );
618
+ foreach ($categories as $category ) { ?>
619
+ <option value="<?php echo $category->term_id; ?>" <?php if(is_array($cats) && in_array($category->term_id, $cats)) echo 'selected="selected"'; ?>><?php echo $category->cat_name;?></option>
620
+ <?php } ?>
621
+ </select>
622
+ </p>
623
+
624
+ <?php if ($tag_list) : ?>
625
+ <p>
626
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('attag'); ?>" name="<?php echo $this->get_field_name('attag'); ?>" <?php checked( (bool) $attag, true ); ?> />
627
+ <label for="<?php echo $this->get_field_id('attag'); ?>"> <?php _e('Show posts only from current tag', 'ultimate-posts-widget');?></label>
628
+ </p>
629
+
630
+ <p>
631
+ <label for="<?php echo $this->get_field_id('tags'); ?>"><?php _e( 'Tags', 'ultimate-posts-widget' ); ?>:</label>
632
+ <select name="<?php echo $this->get_field_name('tags'); ?>[]" id="<?php echo $this->get_field_id('tags'); ?>" class="widefat" style="height: auto;" size="<?php echo $t ?>" multiple>
633
+ <option value="" <?php if (empty($tags)) echo 'selected="selected"'; ?>><?php _e('&ndash; Show All &ndash;') ?></option>
634
+ <?php
635
+ foreach ($tag_list as $tag) { ?>
636
+ <option value="<?php echo $tag->term_id; ?>" <?php if (is_array($tags) && in_array($tag->term_id, $tags)) echo 'selected="selected"'; ?>><?php echo $tag->name;?></option>
637
+ <?php } ?>
638
+ </select>
639
+ </p>
640
+ <?php endif; ?>
641
+
642
+ <p>
643
+ <label for="<?php echo $this->get_field_id('types'); ?>"><?php _e( 'Post types', 'ultimate-posts-widget' ); ?>:</label>
644
+ <select name="<?php echo $this->get_field_name('types'); ?>[]" id="<?php echo $this->get_field_id('types'); ?>" class="widefat" style="height: auto;" size="<?php echo $n ?>" multiple>
645
+ <option value="" <?php if (empty($types)) echo 'selected="selected"'; ?>><?php _e('&ndash; Show All &ndash;') ?></option>
646
+ <?php
647
+ $args = array( 'public' => true );
648
+ $post_types = get_post_types( $args, 'names' );
649
+ foreach ($post_types as $post_type ) { ?>
650
+ <option value="<?php echo $post_type; ?>" <?php if(is_array($types) && in_array($post_type, $types)) { echo 'selected="selected"'; } ?>><?php echo $post_type;?></option>
651
+ <?php } ?>
652
+ </select>
653
+ </p>
654
+
655
+ <p>
656
+ <label for="<?php echo $this->get_field_id('sticky'); ?>"><?php _e( 'Sticky posts', 'ultimate-posts-widget' ); ?>:</label>
657
+ <select name="<?php echo $this->get_field_name('sticky'); ?>" id="<?php echo $this->get_field_id('sticky'); ?>" class="widefat">
658
+ <option value="show"<?php if( $sticky === 'show') echo ' selected'; ?>><?php _e('Show All Posts', 'ultimate-posts-widget'); ?></option>
659
+ <option value="hide"<?php if( $sticky == 'hide') echo ' selected'; ?>><?php _e('Hide Sticky Posts', 'ultimate-posts-widget'); ?></option>
660
+ <option value="only"<?php if( $sticky == 'only') echo ' selected'; ?>><?php _e('Show Only Sticky Posts', 'ultimate-posts-widget'); ?></option>
661
+ </select>
662
+ </p>
663
+
664
+ </div>
665
+
666
+ <div class="upw-tab upw-hide upw-tab-order">
667
+
668
+ <p>
669
+ <label for="<?php echo $this->get_field_id('orderby'); ?>"><?php _e('Order by', 'ultimate-posts-widget'); ?>:</label>
670
+ <select name="<?php echo $this->get_field_name('orderby'); ?>" id="<?php echo $this->get_field_id('orderby'); ?>" class="widefat">
671
+ <option value="date"<?php if( $orderby == 'date') echo ' selected'; ?>><?php _e('Published Date', 'ultimate-posts-widget'); ?></option>
672
+ <option value="title"<?php if( $orderby == 'title') echo ' selected'; ?>><?php _e('Title', 'ultimate-posts-widget'); ?></option>
673
+ <option value="comment_count"<?php if( $orderby == 'comment_count') echo ' selected'; ?>><?php _e('Comment Count', 'ultimate-posts-widget'); ?></option>
674
+ <option value="rand"<?php if( $orderby == 'rand') echo ' selected'; ?>><?php _e('Random'); ?></option>
675
+ <option value="meta_value"<?php if( $orderby == 'meta_value') echo ' selected'; ?>><?php _e('Custom Field', 'ultimate-posts-widget'); ?></option>
676
+ <option value="menu_order"<?php if( $orderby == 'menu_order') echo ' selected'; ?>><?php _e('Menu Order', 'ultimate-posts-widget'); ?></option>
677
+ </select>
678
+ </p>
679
+
680
+ <p<?php if ($orderby !== 'meta_value') echo ' style="display:none;"'; ?>>
681
+ <label for="<?php echo $this->get_field_id( 'meta_key' ); ?>"><?php _e('Custom field', 'ultimate-posts-widget'); ?>:</label>
682
+ <input class="widefat" id="<?php echo $this->get_field_id('meta_key'); ?>" name="<?php echo $this->get_field_name('meta_key'); ?>" type="text" value="<?php echo $meta_key; ?>" />
683
+ </p>
684
+
685
+ <p>
686
+ <label for="<?php echo $this->get_field_id('order'); ?>"><?php _e('Order', 'ultimate-posts-widget'); ?>:</label>
687
+ <select name="<?php echo $this->get_field_name('order'); ?>" id="<?php echo $this->get_field_id('order'); ?>" class="widefat">
688
+ <option value="DESC"<?php if( $order == 'DESC') echo ' selected'; ?>><?php _e('Descending', 'ultimate-posts-widget'); ?></option>
689
+ <option value="ASC"<?php if( $order == 'ASC') echo ' selected'; ?>><?php _e('Ascending', 'ultimate-posts-widget'); ?></option>
690
+ </select>
691
+ </p>
692
+
693
+ </div>
694
+
695
+ <div class="etw-carousel-ad-trigger">
696
+ <div class="etw-new-label"><?php _e( 'New', 'ultimate-posts-widget' ); ?></div>
697
+ <span><?php _e( 'Please check out our other plugins too!', 'ultimate-posts-widget' ); ?></span>
698
+ <div class="etw-check-it-label"><?php _e( 'Check it out', 'ultimate-posts-widget' ); ?></div>
699
+ </div>
700
+
701
+ <?php if ( $instance ) { ?>
702
+
703
+ <script>
704
+
705
+ jQuery(document).ready(function($){
706
+
707
+ var show_excerpt = $("#<?php echo $this->get_field_id( 'show_excerpt' ); ?>");
708
+ var exclude_current = $("#<?php echo $this->get_field_id( 'exclude_current' ); ?>");
709
+ var show_content = $("#<?php echo $this->get_field_id( 'show_content' ); ?>");
710
+ var show_readmore = $("#<?php echo $this->get_field_id( 'show_readmore' ); ?>");
711
+ var show_readmore_wrap = $("#<?php echo $this->get_field_id( 'show_readmore' ); ?>").parents('p');
712
+ var show_thumbnail = $("#<?php echo $this->get_field_id( 'show_thumbnail' ); ?>");
713
+ var show_date = $("#<?php echo $this->get_field_id( 'show_date' ); ?>");
714
+ var date_format = $("#<?php echo $this->get_field_id( 'date_format' ); ?>").parents('p');
715
+ var excerpt_length = $("#<?php echo $this->get_field_id( 'excerpt_length' ); ?>").parents('p');
716
+ var excerpt_readmore_wrap = $("#<?php echo $this->get_field_id( 'excerpt_readmore' ); ?>").parents('p');
717
+ var thumb_size_wrap = $("#<?php echo $this->get_field_id( 'thumb_size' ); ?>").parents('p');
718
+ var order = $("#<?php echo $this->get_field_id('orderby'); ?>");
719
+ var meta_key_wrap = $("#<?php echo $this->get_field_id( 'meta_key' ); ?>").parents('p');
720
+ var template = $("#<?php echo $this->get_field_id('template'); ?>");
721
+ var template_custom = $("#<?php echo $this->get_field_id('template_custom'); ?>").parents('p');
722
+
723
+ var toggleReadmore = function() {
724
+ if (show_excerpt.is(':checked') || show_content.is(':checked')) {
725
+ show_readmore_wrap.show('fast');
726
+ } else {
727
+ show_readmore_wrap.hide('fast');
728
+ }
729
+ toggleExcerptReadmore();
730
+ }
731
+
732
+ var toggleExcerptReadmore = function() {
733
+ if ((show_excerpt.is(':checked') || show_content.is(':checked')) && show_readmore.is(':checked')) {
734
+ excerpt_readmore_wrap.show('fast');
735
+ } else {
736
+ excerpt_readmore_wrap.hide('fast');
737
+ }
738
+ }
739
+
740
+ // Toggle read more option
741
+ show_excerpt.click(function() {
742
+ toggleReadmore();
743
+ });
744
+
745
+ // Toggle read more option
746
+ show_content.click(function() {
747
+ toggleReadmore();
748
+ });
749
+
750
+ // Toggle excerpt length on click
751
+ show_excerpt.click(function(){
752
+ excerpt_length.toggle('fast');
753
+ });
754
+
755
+ // Toggle excerpt length on click
756
+ show_readmore.click(function(){
757
+ toggleExcerptReadmore();
758
+ });
759
+
760
+ // Toggle date format on click
761
+ show_date.click(function(){
762
+ date_format.toggle('fast');
763
+ });
764
+
765
+ // Toggle excerpt length on click
766
+ show_thumbnail.click(function(){
767
+ thumb_size_wrap.toggle('fast');
768
+ });
769
+
770
+ // Show or hide custom field meta_key value on order change
771
+ order.change(function(){
772
+ if ($(this).val() === 'meta_value') {
773
+ meta_key_wrap.show('fast');
774
+ } else {
775
+ meta_key_wrap.hide('fast');
776
+ }
777
+ });
778
+
779
+ // Show or hide custom template field
780
+ template.change(function(){
781
+ if ($(this).val() === 'custom') {
782
+ template_custom.show('fast');
783
+ } else {
784
+ template_custom.hide('fast');
785
+ }
786
+ });
787
+
788
+ });
789
+
790
+ </script>
791
+
792
+ <?php
793
+
794
+ }
795
+
796
+ }
797
+
798
+ }
799
+
800
+ function init_wp_widget_ultimate_posts() {
801
+ register_widget( 'WP_Widget_Ultimate_Posts' );
802
+ }
803
+
804
+ add_action( 'widgets_init', 'init_wp_widget_ultimate_posts' );
805
+ }
806
+
807
+ add_action('admin_init', function () {
808
+ require_once 'banner/misc.php';
809
+ });
810
+
811
+ add_action( 'wp_ajax_nopriv_upw_hide_admin_notification', 'upw_hide_admin_notification_callback' );
812
+ add_action( 'wp_ajax_upw_hide_admin_notification', 'upw_hide_admin_notification_callback' );
813
+
814
+ function upw_hide_admin_notification_callback() {
815
+
816
+ $option_name = 'upw_hide_admin_notification';
817
+ $new_value = 'yes';
818
+
819
+ if ( get_option( $option_name ) !== false ) {
820
+ update_option( $option_name, $new_value );
821
+ } else {
822
+ $deprecated = null;
823
+ $autoload = 'no';
824
+ add_option( $option_name, $new_value, $deprecated, $autoload );
825
+ }
826
+ wp_send_json_success();
827
+ die;
828
+ }