YOP Poll - Version 5.5

Version Description

  • Fixed issue with clone poll
  • Fixed issue with archive page
  • Fixed issue with captcha
Download this release

Release Info

Developer yourownprogrammer
Plugin Icon 128x128 YOP Poll
Version 5.5
Comparing to
See all releases

Code changes from version 5.3 to 5.5

Files changed (46) hide show
  1. css/flexslider.css +162 -0
  2. css/reveal.css +66 -0
  3. css/yop-poll-admin.css +1 -1
  4. fonts/flexslider-icon.eot +0 -0
  5. fonts/flexslider-icon.svg +19 -0
  6. fonts/flexslider-icon.ttf +0 -0
  7. fonts/flexslider-icon.woff +0 -0
  8. images/images2/image1.jpg +0 -0
  9. images/images2/image2.jpg +0 -0
  10. images/images2/image3.jpg +0 -0
  11. images/images2/image4.jpg +0 -0
  12. images/images2/image6.jpg +0 -0
  13. inc/admin.php +10 -1
  14. inc/import_admin.php +431 -428
  15. inc/maintenance.php +4 -0
  16. inc/plugin-functions.php +6 -6
  17. inc/poll_admin.php +61 -13
  18. inc/pro_admin.php +6 -2
  19. inc/public-admin.php +8 -5
  20. js/bxslider/bower.json +25 -0
  21. js/bxslider/images/bx_loader.gif +0 -0
  22. js/bxslider/images/controls.png +0 -0
  23. js/bxslider/jquery.bxslider.css +205 -0
  24. js/bxslider/jquery.bxslider.js +1349 -0
  25. js/bxslider/plugins/jquery.easing.1.3.js +205 -0
  26. js/bxslider/plugins/jquery.fitvids.js +80 -0
  27. js/jquery.flexslider.js +1157 -0
  28. js/jquery.reveal.js +165 -0
  29. js/polls/yop-poll-add-edit.js +200 -74
  30. js/polls/yop-poll-results-votes.js +2 -2
  31. js/yop-poll-admin-templates.js +2 -2
  32. js/yop-poll-admin.js +84 -53
  33. js/yop-poll-general-options.js +10 -2
  34. js/yop-poll-modal-functions.js +2 -2
  35. js/yop-poll-public.js +9 -6
  36. js/yop-poll-sidebar-optin-functions.js +5 -3
  37. models/abstract_model.php +9 -6
  38. models/custom_field_model.php +11 -11
  39. readme.txt +6 -1
  40. templates/options_poll_options.html +2 -3
  41. templates/polls_add_edit.html +2 -2
  42. templates/polls_add_edit_options.html +22 -1
  43. templates/polls_base.html +42 -97
  44. templates/polls_results_votes.html +208 -206
  45. templates/pro_pre_upgrade.html +57 -89
  46. yop_poll.php +3 -3
css/flexslider.css ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery FlexSlider v2.2.0
3
+ * http://www.woothemes.com/flexslider/
4
+ *
5
+ * Copyright 2012 WooThemes
6
+ * Free to use under the GPLv2 license.
7
+ * http://www.gnu.org/licenses/gpl-2.0.html
8
+ *
9
+ * Contributing author: Tyler Smith (@mbmufffin)
10
+ */
11
+
12
+
13
+ /* Browser Resets
14
+ *********************************/
15
+ .flex-container a:active,
16
+ .flexslider a:active,
17
+ .flex-container a:focus,
18
+ .flexslider a:focus {outline: none;}
19
+ .slides,
20
+ .flex-control-nav,
21
+ .flex-direction-nav {margin: 0; padding: 0; list-style: none;}
22
+
23
+ /* Icon Fonts
24
+ *********************************/
25
+ /* Font-face Icons */
26
+ @font-face {
27
+ font-family: 'flexslider-icon';
28
+ src:url('../fonts/flexslider-icon.eot');
29
+ src:url('../fonts/flexslider-icon.eot?#iefix') format('embedded-opentype'),
30
+ url('../fonts/flexslider-icon.woff') format('woff'),
31
+ url('../fonts/flexslider-icon.ttf') format('truetype'),
32
+ url('../fonts/flexslider-icon.svg#flexslider-icon') format('svg');
33
+ font-weight: normal;
34
+ font-style: normal;
35
+ }
36
+
37
+ /* FlexSlider Necessary Styles
38
+ *********************************/
39
+ .flexslider {margin: 0; padding: 0;}
40
+ .flexslider .slides > li {display: none; -webkit-backface-visibility: hidden;} /* Hide the slides before the JS is loaded. Avoids image jumping */
41
+ .flexslider .slides img {width: 100%; display: block;}
42
+ .flex-pauseplay span {text-transform: capitalize;}
43
+
44
+ /* Clearfix for the .slides element */
45
+ .slides:after {content: "."; display: block; clear: both; visibility: hidden; line-height: 0; height: 0;}
46
+ html[xmlns] .slides {display: block;}
47
+ * html .slides {height: 1%;}
48
+
49
+ /* No JavaScript Fallback */
50
+ /* If you are not using another script, such as Modernizr, make sure you
51
+ * include js that eliminates this class on page load */
52
+ .no-js .slides > li:first-child {display: block;}
53
+
54
+ /* FlexSlider Default Theme
55
+ *********************************/
56
+ .flexslider { margin: 0 0 60px; background: #fff; border: 4px solid #fff; position: relative; -webkit-border-radius: 4px; -moz-border-radius: 4px; -o-border-radius: 4px; border-radius: 4px; -webkit-box-shadow: 0 1px 4px rgba(0,0,0,.2); -moz-box-shadow: 0 1px 4px rgba(0,0,0,.2); -o-box-shadow: 0 1px 4px rgba(0,0,0,.2); box-shadow: 0 1px 4px rgba(0,0,0,.2); zoom: 1; }
57
+ .flex-viewport { max-height: 2000px; -webkit-transition: all 1s ease; -moz-transition: all 1s ease; -o-transition: all 1s ease; transition: all 1s ease; }
58
+ .loading .flex-viewport { max-height: 300px; }
59
+ .flexslider .slides { zoom: 1; }
60
+ .carousel li { margin-right: 5px; }
61
+
62
+ /* Direction Nav */
63
+ .flex-direction-nav {*height: 0;}
64
+ .flex-direction-nav a { text-decoration:none; display: block; width: 40px; height: 40px; margin: -20px 0 0; position: absolute; top: 50%; z-index: 10; overflow: hidden; opacity: 0; cursor: pointer; color: rgba(0,0,0,0.8); text-shadow: 1px 1px 0 rgba(255,255,255,0.3); -webkit-transition: all .3s ease; -moz-transition: all .3s ease; transition: all .3s ease; }
65
+ .flex-direction-nav .flex-prev { left: 10px; opacity: 0.7 }
66
+ .flex-direction-nav .flex-next { right: 10px; text-align: right;opacity: 0.7 }
67
+ .flexslider:hover .flexslider:hover { opacity: 1; }
68
+ .flex-direction-nav .flex-disabled { opacity: 0!important; filter:alpha(opacity=0); cursor: default; }
69
+ .flex-direction-nav a:before { font-family: "flexslider-icon"; font-size: 40px; line-height:1; display: inline-block; content: '\f001'; }
70
+ .flex-direction-nav a.flex-next:before { content: '\f002'; }
71
+
72
+ /* Pause/Play */
73
+ .flex-pauseplay a { display: block; width: 20px; height: 20px; position: absolute; bottom: 5px; left: 10px; opacity: 0.8; z-index: 10; overflow: hidden; cursor: pointer; color: #000; }
74
+ .flex-pauseplay a:before { font-family: "flexslider-icon"; font-size: 20px; display: inline-block; content: '\f004'; }
75
+ .flex-pauseplay a:hover { opacity: 1; }
76
+ .flex-pauseplay a.flex-play:before { content: '\f003'; }
77
+
78
+ /* Control Nav */
79
+ .flex-control-nav {width: 100%; position: absolute; bottom: -40px; text-align: center;}
80
+ .flex-control-nav li {margin: 0 6px; display: inline-block; zoom: 1; *display: inline;}
81
+ .flex-control-paging li a {width: 11px; height: 11px; display: block; background: #666; background: rgba(0,0,0,0.5); cursor: pointer; text-indent: -9999px; -webkit-border-radius: 20px; -moz-border-radius: 20px; -o-border-radius: 20px; border-radius: 20px; -webkit-box-shadow: inset 0 0 3px rgba(0,0,0,0.3); -moz-box-shadow: inset 0 0 3px rgba(0,0,0,0.3); -o-box-shadow: inset 0 0 3px rgba(0,0,0,0.3); box-shadow: inset 0 0 3px rgba(0,0,0,0.3); }
82
+ .flex-control-paging li a:hover { background: #333; background: rgba(0,0,0,0.7); }
83
+ .flex-control-paging li a.flex-active { background: #000; background: rgba(0,0,0,0.9); cursor: default; }
84
+
85
+ .flex-control-thumbs {margin: 5px 0 0; position: static; overflow: hidden;}
86
+ .flex-control-thumbs li {width: 25%; float: left; margin: 0;}
87
+ .flex-control-thumbs img {width: 100%; display: block; opacity: .7; cursor: pointer;}
88
+ .flex-control-thumbs img:hover {opacity: 1;}
89
+ .flex-control-thumbs .flex-active {opacity: 1; cursor: default;}
90
+
91
+ @media screen and (max-width: 860px) {
92
+ .flex-direction-nav .flex-prev { opacity: 1; left: 10px;}
93
+ .flex-direction-nav .flex-next { opacity: 1; right: 10px;}
94
+ }
95
+ .yop_testimonials{
96
+ border-color:#0088cc ;
97
+ border: 2px solid;
98
+ border-radius: 15px;
99
+ }
100
+ .yop_testimonials_header{
101
+ text-align: left;
102
+ font-size: 20px;
103
+ font-weight: bold;
104
+ margin-left: 5%;
105
+ }
106
+ .yop_testimonials_content{
107
+ text-align: left;
108
+ font-size: 15px;
109
+ margin-left: 5%;
110
+ margin-right: 5%;
111
+ }
112
+ .yop_testimonials_client{
113
+ text-align: right;
114
+ font-size: 15px;
115
+ margin-left: 5%;
116
+ margin-right: 5%;
117
+ font-weight: bold;
118
+ }
119
+ .upgrade_button{
120
+ color: #fff;
121
+ display: inline-block;
122
+ font-weight: bold;
123
+ margin-left: auto;
124
+ margin-right: auto;
125
+ text-align: center !important;
126
+ text-decoration: none !important;
127
+ border-radius: 5px;
128
+ font-size: 21px;
129
+ padding: 15px 35px;
130
+ background-color: rgb(14, 141, 199);
131
+ border:none;
132
+ cursor: pointer;
133
+ }
134
+ .upgrade_button:hover{
135
+ background-color: #0b72a1 !important;
136
+ }
137
+ .yop_testimonials_pro1{
138
+ border-color:#0088cc ;
139
+ border: 2px solid;
140
+ border-radius: 15px;
141
+ text-align: center;
142
+ width: 44%;
143
+ float: left;
144
+ margin-top: 10px;
145
+ }
146
+ .yop_testimonials_pro2{
147
+ border-color:#0088cc ;
148
+ border: 2px solid;
149
+ border-radius: 15px;
150
+ margin-right: 10%;
151
+ width:44%;
152
+ float:right;
153
+ margin-top: 10px;
154
+
155
+ }
156
+ section {
157
+ width: 80%;
158
+ height: 200px;
159
+ text-align: center;
160
+ margin: auto;
161
+ padding: 10px;
162
+ }
css/reveal.css ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* --------------------------------------------------
2
+ Reveal Modals
3
+ -------------------------------------------------- */
4
+
5
+ .reveal-modal-bg {
6
+ position: fixed;
7
+ height: 100%;
8
+ width: 100%;
9
+ background: #000;
10
+ background: rgba(0,0,0,.8);
11
+ z-index: 100;
12
+ display: none;
13
+ top: 0;
14
+ left: 0;
15
+ }
16
+
17
+ .reveal-modal {
18
+ visibility: hidden;
19
+ top: 100px;
20
+ left: 50%;
21
+ margin-left: -570px;
22
+ width: 1050px;
23
+ background: #eee url(modal-gloss.png) no-repeat -200px -80px;
24
+ position: absolute;
25
+ z-index: 101;
26
+ padding: 30px 40px 34px;
27
+ -moz-border-radius: 5px;
28
+ -webkit-border-radius: 5px;
29
+ border-radius: 5px;
30
+ -moz-box-shadow: 0 0 10px rgba(0,0,0,.4);
31
+ -webkit-box-shadow: 0 0 10px rgba(0,0,0,.4);
32
+ -box-shadow: 0 0 10px rgba(0,0,0,.4);
33
+ }
34
+
35
+ .reveal-modal.small { width: 200px; margin-left: -140px;}
36
+ .reveal-modal.medium { width: 400px; margin-left: -240px;}
37
+ .reveal-modal.large { width: 600px; margin-left: -340px;}
38
+ .reveal-modal.xlarge { width: 800px; margin-left: -440px;}
39
+
40
+ .reveal-modal .close-reveal-modal {
41
+ font-size: 22px;
42
+ line-height: .5;
43
+ position: absolute;
44
+ top: 8px;
45
+ right: 11px;
46
+ color: #aaa;
47
+ text-shadow: 0 -1px 1px rbga(0,0,0,.6);
48
+ font-weight: bold;
49
+ cursor: pointer;
50
+ }
51
+ /*
52
+
53
+ NOTES
54
+
55
+ Close button entity is ×
56
+
57
+ Example markup
58
+
59
+ <div id="myModal" class="reveal-modal">
60
+ <h2>Awesome. I have it.</h2>
61
+ <p class="lead">Your couch. I it's mine.</p>
62
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ultrices aliquet placerat. Duis pulvinar orci et nisi euismod vitae tempus lorem consectetur. Duis at magna quis turpis mattis venenatis eget id diam. </p>
63
+ <a class="close-reveal-modal">&#215;</a>
64
+ </div>
65
+
66
+ */
css/yop-poll-admin.css CHANGED
@@ -272,4 +272,4 @@ a {
272
  color: #0088cc;
273
  text-decoration: none;
274
  }
275
- .wp-switch-editor { display:none!important; }
272
  color: #0088cc;
273
  text-decoration: none;
274
  }
275
+ .wp-switch-editor { display:none!important; }
fonts/flexslider-icon.eot ADDED
Binary file
fonts/flexslider-icon.svg ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>
5
+ This is a custom SVG font generated by IcoMoon.
6
+ <iconset grid="14"></iconset>
7
+ </metadata>
8
+ <defs>
9
+ <font id="flexslider-icon" horiz-adv-x="448" >
10
+ <font-face units-per-em="448" ascent="384" descent="-64" />
11
+ <missing-glyph horiz-adv-x="448" />
12
+ <glyph unicode="&#xf001;" d="M 185.50-9.25l-163.00,162.75q-9.25,9.25 -9.25,22.625t 9.25,22.625l 163.00,162.75q 9.25,9.25 22.625,9.25t 22.625-9.25l 18.75-18.75q 9.25-9.25 9.25-22.625t-9.25-22.625l-121.50-121.50l 121.50-121.25q 9.25-9.50 9.25-22.75t-9.25-22.50l-18.75-18.75q-9.25-9.25 -22.625-9.25t-22.625,9.25z" horiz-adv-x="288" />
13
+ <glyph unicode="&#xf002;" d="M 274.75,176.00q0.00-13.00 -9.25-22.75l-163.00-162.75q-9.25-9.25 -22.50-9.25t-22.50,9.25l-19.00,18.75q-9.25,9.75 -9.25,22.75q0.00,13.25 9.25,22.50l 121.50,121.50l-121.50,121.25q-9.25,9.75 -9.25,22.75q0.00,13.25 9.25,22.50l 19.00,18.75q 9.00,9.50 22.50,9.50t 22.50-9.50l 163.00-162.75q 9.25-9.25 9.25-22.50z" horiz-adv-x="288" />
14
+ <glyph unicode="&#xf003;" d="M 346.00,152.25l-332.00-184.50q-5.75-3.25 -9.875-0.75t-4.125,9.00l0.00,368.00 q0.00,6.50 4.125,9.00t 9.875-0.75l 332.00-184.50q 5.75-3.25 5.75-7.75t-5.75-7.75z" horiz-adv-x="352" />
15
+ <glyph unicode="&#xf004;" d="M 384.00,336.00l0.00-352.00 q0.00-6.50 -4.75-11.25t-11.25-4.75l-128.00,0.00 q-6.50,0.00 -11.25,4.75t-4.75,11.25l0.00,352.00 q0.00,6.50 4.75,11.25t 11.25,4.75l 128.00,0.00 q 6.50,0.00 11.25-4.75t 4.75-11.25zM 160.00,336.00l0.00-352.00 q0.00-6.50 -4.75-11.25t-11.25-4.75l-128.00,0.00 q-6.50,0.00 -11.25,4.75t-4.75,11.25l0.00,352.00 q0.00,6.50 4.75,11.25t 11.25,4.75l 128.00,0.00 q 6.50,0.00 11.25-4.75t 4.75-11.25z" horiz-adv-x="384" />
16
+ <glyph unicode="&#xf005;" d="M 402.75,208.00q0.00-13.25 -9.25-22.50l-162.75-162.75q-9.50-9.50 -22.75-9.50q-13.50,0.00 -22.50,9.50l-162.75,162.75q-9.50,9.00 -9.50,22.50q0.00,13.25 9.50,22.75l 18.50,18.75q 9.75,9.25 22.75,9.25q 13.25,0.00 22.50-9.25l 121.50-121.50l 121.50,121.50q 9.25,9.25 22.50,9.25q 13.00,0.00 22.75-9.25l 18.75-18.75q 9.25-9.75 9.25-22.75z" horiz-adv-x="416" />
17
+ <glyph unicode="&#x20;" horiz-adv-x="224" />
18
+ <glyph class="hidden" unicode="&#xf000;" d="M0,384L 448 -64L0 -64 z" horiz-adv-x="0" />
19
+ </font></defs></svg>
fonts/flexslider-icon.ttf ADDED
Binary file
fonts/flexslider-icon.woff ADDED
Binary file
images/images2/image1.jpg ADDED
Binary file
images/images2/image2.jpg ADDED
Binary file
images/images2/image3.jpg ADDED
Binary file
images/images2/image4.jpg ADDED
Binary file
images/images2/image6.jpg ADDED
Binary file
inc/admin.php CHANGED
@@ -199,16 +199,17 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
199
  public function ajax_modal_option_signup() {
200
  $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options_yop' );
201
  $optin_box_modal_options ['modal_had_submit'] = 'yes';
 
202
  update_option( 'yop_poll_optin_box_modal_options', $optin_box_modal_options );
203
  die ();
204
  }
205
  public function ajax_show_optin_box_modal() {
206
  $this->yop_poll_optin_form1();
207
-
208
  $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options' );
209
  $optin_box_modal_options ['show'] = 'no'; //restore to no
210
  $optin_box_modal_options ['sidebar_had_submit'] = 'no';
211
  $optin_box_modal_options ['modal_had_submit'] = 'no';
 
212
  update_option( 'yop_poll_optin_box_modal_options_yop', $optin_box_modal_options );
213
 
214
 
@@ -415,6 +416,7 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
415
  $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options_yop' );
416
  $optin_box_modal_options ['sidebar_had_submit'] = 'yes';
417
  $optin_box_modal_options ['modal_had_submit'] = 'yes';
 
418
  update_option( 'yop_poll_optin_box_modal_options_yop', $optin_box_modal_options );
419
  die ();
420
  }
@@ -430,6 +432,12 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
430
  wp_enqueue_style( 'yop-poll-timepicker', YOP_POLL_URL . "css/timepicker.css", array(), YOP_POLL_VERSION );
431
  wp_enqueue_style( 'yop-poll-colorpicker', YOP_POLL_URL . "css/colorpicker.css", array(), YOP_POLL_VERSION );
432
  wp_enqueue_style( 'yop-poll-jquery-ui', YOP_POLL_URL . "css/jquery-ui.css", array(), YOP_POLL_VERSION );
 
 
 
 
 
 
433
  wp_enqueue_script( 'yop-poll-admin-js', YOP_POLL_URL . "js/yop-poll-admin.js", array( 'jquery','jquery-ui-tooltip' ), YOP_POLL_VERSION, true );
434
  wp_enqueue_script( 'yop-poll-tool_tips-js', YOP_POLL_URL . "js/yop_poll_tool_tips.js", array( 'jquery','jquery-ui-tooltip' ), YOP_POLL_VERSION, true );
435
  wp_enqueue_script( 'yop-poll-color', YOP_POLL_URL . "js/color.picker.js", array( 'jquery','jquery-ui-tooltip' ), YOP_POLL_VERSION, true );
@@ -439,6 +447,7 @@ class Yop_Poll_Admin extends Yop_Poll_Plugin {
439
  'jquery-ui-slider'
440
  ), YOP_POLL_VERSION, true );
441
 
 
442
  $time_format="hh:mm:ss";
443
  $options = get_option('yop_poll_options' );
444
  if($options['date_format']=="UE")
199
  public function ajax_modal_option_signup() {
200
  $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options_yop' );
201
  $optin_box_modal_options ['modal_had_submit'] = 'yes';
202
+ $optin_box_modal_options['modal_email']=isset($_POST['email'])?$_POST['email']:"johndoe@email.com";
203
  update_option( 'yop_poll_optin_box_modal_options', $optin_box_modal_options );
204
  die ();
205
  }
206
  public function ajax_show_optin_box_modal() {
207
  $this->yop_poll_optin_form1();
 
208
  $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options' );
209
  $optin_box_modal_options ['show'] = 'no'; //restore to no
210
  $optin_box_modal_options ['sidebar_had_submit'] = 'no';
211
  $optin_box_modal_options ['modal_had_submit'] = 'no';
212
+ $optin_box_modal_options['modal_email']=isset($_POST['email'])?$_POST['email']:"johndoe@email.com";
213
  update_option( 'yop_poll_optin_box_modal_options_yop', $optin_box_modal_options );
214
 
215
 
416
  $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options_yop' );
417
  $optin_box_modal_options ['sidebar_had_submit'] = 'yes';
418
  $optin_box_modal_options ['modal_had_submit'] = 'yes';
419
+ $optin_box_modal_options['modal_email']=isset($_POST['email'])?$_POST['email']:"johndoe@email.com";
420
  update_option( 'yop_poll_optin_box_modal_options_yop', $optin_box_modal_options );
421
  die ();
422
  }
432
  wp_enqueue_style( 'yop-poll-timepicker', YOP_POLL_URL . "css/timepicker.css", array(), YOP_POLL_VERSION );
433
  wp_enqueue_style( 'yop-poll-colorpicker', YOP_POLL_URL . "css/colorpicker.css", array(), YOP_POLL_VERSION );
434
  wp_enqueue_style( 'yop-poll-jquery-ui', YOP_POLL_URL . "css/jquery-ui.css", array(), YOP_POLL_VERSION );
435
+ wp_enqueue_style( 'yop-poll-bxslider-css', YOP_POLL_URL . "js/bxslider/jquery.bxslider.css", array(), YOP_POLL_VERSION );
436
+ wp_enqueue_style( 'yop-poll-flex-slider-css', YOP_POLL_URL . "css/flexslider.css", array(), YOP_POLL_VERSION );
437
+ wp_enqueue_style( 'yop-poll-reveal-css', YOP_POLL_URL . "css/reveal.css", array(), YOP_POLL_VERSION );
438
+ wp_enqueue_script( 'yop-poll--flex-slider-js', YOP_POLL_URL . "js/jquery.flexslider.js", array( 'jquery','jquery-ui-slider' ), YOP_POLL_VERSION, true );
439
+ wp_enqueue_script( 'yop-poll-jquery-bxslider.js', YOP_POLL_URL . "js/bxslider/jquery.bxslider.js", array( 'jquery','jquery-ui-slider' ), YOP_POLL_VERSION, true );
440
+ wp_enqueue_script( 'yop-poll-reveal.js', YOP_POLL_URL . "js/jquery.reveal.js", array( 'jquery' ), YOP_POLL_VERSION, true );
441
  wp_enqueue_script( 'yop-poll-admin-js', YOP_POLL_URL . "js/yop-poll-admin.js", array( 'jquery','jquery-ui-tooltip' ), YOP_POLL_VERSION, true );
442
  wp_enqueue_script( 'yop-poll-tool_tips-js', YOP_POLL_URL . "js/yop_poll_tool_tips.js", array( 'jquery','jquery-ui-tooltip' ), YOP_POLL_VERSION, true );
443
  wp_enqueue_script( 'yop-poll-color', YOP_POLL_URL . "js/color.picker.js", array( 'jquery','jquery-ui-tooltip' ), YOP_POLL_VERSION, true );
447
  'jquery-ui-slider'
448
  ), YOP_POLL_VERSION, true );
449
 
450
+
451
  $time_format="hh:mm:ss";
452
  $options = get_option('yop_poll_options' );
453
  if($options['date_format']=="UE")
inc/import_admin.php CHANGED
@@ -1,464 +1,467 @@
1
  <?php
2
 
3
- class YOP_POLL_Imports_Admin extends YOP_POLL_Abstract_Admin{
4
 
5
- private static $_instance = NULL;
6
 
7
 
8
 
9
- protected function __construct() {
10
 
11
- parent::__construct( 'imports' );
 
 
12
 
13
- }
14
 
15
 
 
16
 
17
- public static function get_instance() {
18
 
19
- if ( self::$_instance == NULL ){
20
 
21
- $class = __CLASS__;
 
 
22
 
23
- self::$_instance = new $class;
24
 
25
  }
26
 
27
- return self::$_instance;
28
 
29
- }
30
 
 
 
 
31
 
 
32
 
33
- public function manage_imports() {
34
 
35
- switch ( $GLOBALS['page'] ) {
36
 
37
- default:
38
 
39
- $this->manage_options();
40
 
41
- break;
42
 
43
  }
44
 
 
45
 
 
46
 
47
- }
48
 
49
- public function manage_load_imports() {
50
 
51
- wp_enqueue_style( 'yop-poll-timepicker', YOP_POLL_URL . "css/timepicker.css", array(), YOP_POLL_VERSION );
52
 
53
- wp_enqueue_style( 'yop-poll-jquery-ui', YOP_POLL_URL . "css/jquery-ui.css", array(), YOP_POLL_VERSION );
54
 
55
- }
56
 
 
57
 
 
58
 
59
- private function manage_options() {
60
 
61
- global $page, $action, $message;
62
- switch ( $action ) {
63
 
 
64
 
 
65
 
66
- case 'import-all':
67
 
68
- {
69
 
70
- $this->import_wp_polls();
71
 
 
72
 
73
- break;
74
 
75
- }
76
 
77
- case 'import':
78
 
79
- {
80
 
81
- $this->import_wp_poll();
82
 
83
- break;
84
 
85
- }
 
86
 
87
- default:
88
 
89
- {
90
- self:: view_wp_polls();
91
 
92
- }
93
 
94
 
95
 
 
96
 
97
 
98
- }
99
-
100
 
 
101
 
102
- }
103
 
104
- private function import_wp_poll() {
105
 
 
106
 
107
- if ( !current_user_can( 'edit_own_yop_polls' ) && ( !current_user_can( 'edit_yop_polls' )) ){
108
 
109
- wp_die( __yop_poll( 'You are not allowed to edit this item.' ) );
110
 
111
- }
112
 
113
- else
114
 
115
- if( check_admin_referer('yop-poll-import', 'yop-poll-imports') ) {
116
 
117
- if (isset ($_REQUEST['id']))
118
 
119
- {
120
 
121
- self::import_wp_poll_fom_db($_REQUEST['id']);
122
 
123
- }
124
 
125
- else if ( isset ( $_REQUEST ['yoppollwppollcheck'] ) ){
126
 
127
- $wp_poll = ( array )$_REQUEST ['yoppollwppollcheck'];
128
 
129
- foreach ( $wp_poll as $wp_id ) {
130
 
131
- $wp_id = ( int )$wp_id ;
132
 
133
- $message = self::import_wp_poll_fom_db($wp_id);
134
 
135
  }
136
 
137
  }
138
 
139
- }
140
 
141
- else {
142
 
143
- wp_die( __yop_poll('You do not have enough permission to import a Wp-poll'));
144
 
145
- }
146
 
147
- self:: view_wp_polls();
148
 
149
- }
150
 
151
- private function import_wp_poll_fom_db($id)
 
152
 
153
- { self::activation_hook();
154
- $current_date= date('Y/m/d H:i:s');
155
 
156
- $wp_polls=self::get_wp_poll_search_by_id($id );
157
- global $message;
158
 
 
159
 
160
- foreach ($wp_polls as $wp_poll)
 
161
 
162
- {
163
- $poll = new YOP_POLL_Poll_Model(0);
164
 
165
- $answers= self::get_wp_poll_answers_from_db_by_id($wp_poll['pollq_id']);
166
 
167
- $poll->poll_title=$wp_poll['pollq_question'];
168
 
169
- $poll->poll_name=$wp_poll['pollq_question'];
170
 
171
- $poll->poll_author=get_current_user_id();
 
 
 
172
 
173
- $poll->poll_start_date=date("Y-m-d H:i:s", $wp_poll['pollq_timestamp']);
174
- if($wp_poll['pollq_multiple']>0){
175
- $poll->allow_multiple_answers="yes";
176
- $poll->allow_multiple_answers_max_number=$wp_poll['pollq_multiple'];
177
 
178
- }
179
 
180
- if($wp_poll['pollq_expiry']!="")
181
 
182
- $poll->poll_end_date= date("Y-m-d H:i:s", $wp_poll['pollq_expiry']);
183
 
184
- else
185
 
186
- $poll->poll_end_date="01-01-2038 23:59:59";
187
 
188
- $poll->poll_status="active";
189
 
190
- $poll->poll_date=$current_date;
191
 
192
- $poll->poll_modified=$current_date;
193
 
194
- $poll->poll_total_votes=$wp_poll['pollq_totalvotes'];
195
 
196
- $question= new YOP_POLL_Question_Model();
197
 
198
 
 
199
 
200
- $poll_id=$poll->save();
201
 
202
 
 
203
 
204
- $question->poll_id=$poll_id;
205
 
206
- $question->question=$wp_poll['pollq_question'];
207
 
208
- $question->question_status="active";
 
 
 
209
 
210
- $question->type="text";
211
- if($wp_poll['pollq_multiple']>0){
212
- $question->allow_multiple_answers="yes";
213
- $question->allow_multiple_answers_max_number=$wp_poll['pollq_multiple'];
214
 
215
- }
216
 
217
- $question->question_author=get_current_user_id();
218
 
219
- $question->poll_order=1;
220
 
221
- $question->question_date =$current_date;
222
 
223
- $question->question_modified=$current_date;
224
 
225
 
 
226
 
227
- $question->save();
228
 
229
 
 
230
 
231
- foreach($answers as $answer){
232
 
233
 
 
234
 
235
- $poll_answer =new YOP_POLL_Answer_Model();
236
 
237
- $poll_answer->poll_id=$poll_id;
238
 
239
- $poll_answer->question_id=$question->ID;
240
 
241
- $poll_answer->answer=$answer['polla_answers'];
242
 
243
- $poll_answer->answer_status="active";
244
 
245
- $poll_answer->type="text";
246
 
247
- $poll_answer->question_order=1;
248
 
249
- $poll_answer->answer_author=get_current_user_id();
250
 
251
- $poll_answer->votes=$answer['polla_votes'];
252
 
253
- $poll_answer->answer_date=$current_date;
254
 
255
- $poll_answer->answer_modified=$current_date;
256
 
257
 
 
258
 
259
- $poll_answer->save();
260
 
261
- unset($log_details);
262
 
263
- $log_details= self::get_log_from_db_by_poll_id($wp_poll['pollq_id'],$answer['polla_aid']);
264
 
265
- foreach($log_details as $log)
266
 
267
- {
268
 
269
- $arg['poll_id']=$poll->ID;
270
 
271
- $arg['ip']=$log['pollip_ip'];
272
 
273
- if($log['pollip_user']=='Guest'){
274
 
275
- $arg['user_type']='anonymous';
276
 
277
- }else
278
 
279
- $arg['user_type']="wordpress";
280
 
281
- $arg['user_id']=$log['pollip_userid'];
282
 
283
- $arg['vote_date']=$log['pollip_timestamp'];
284
 
285
- $a = self::get_answer_from_db_by_id($log['pollip_aid']);
286
 
287
- $arg[1]["q-".$question->ID ]['a'][0]= $poll_answer->ID;
288
 
289
- $arg[1]["q-".$question->ID ]['answers'][0]=$a[0]['polla_answers'];
290
 
291
- $q = self::get_question_from_db_by_id($log['pollip_qid']);
292
 
293
- $arg[1]["q-".$question->ID ]['question']=$q[0]['pollq_question'];
294
 
295
- $arg['vote_details']=json_encode($arg[1]);
296
 
297
- $this->insert_log_in_db($arg);
298
 
 
299
 
300
- unset($arg);
301
 
302
  }
303
 
304
- }
305
 
306
 
 
 
 
 
 
 
307
 
308
  }
309
- if($poll_id){
310
- $message['success']="Poll imported!" ;
311
- }
312
- else
313
- $message['error']="Could not import ban from database! Please try again!" ;
314
 
315
- }
316
 
317
 
 
318
 
319
- private function import_wp_polls()
320
 
321
- { self::activation_hook();
322
 
323
- if( check_admin_referer('yop-poll-import', 'yop-poll-imports') ) {
324
 
325
- if(current_user_can('import_wp_polls')){
326
 
327
- $current_date= date('Y/m/d H:i:s');
328
 
329
- $wp_polls=self::get_wp_polls_from_db();
330
 
331
- foreach ($wp_polls as $wp_poll)
332
 
333
- {
334
 
335
- $poll = new YOP_POLL_Poll_Model(0);
336
 
337
- $answers = self::get_wp_poll_answers_from_db_by_id($wp_poll->pollq_id);
338
 
339
- $poll->poll_title =$wp_poll->pollq_question;
340
 
341
- $poll->poll_name =$wp_poll->pollq_question;
342
 
343
- $poll->poll_author =get_current_user_id();
344
 
345
- $poll->poll_start_date=date("Y-m-d H:i:s", $wp_poll['pollq_timestamp']);
346
 
347
- if($wp_poll['pollq_expiry']!="")
348
 
349
- $poll->poll_end_date = date("Y-m-d H:i:s", $wp_poll['pollq_expiry']);
350
 
351
- else
352
 
353
- $poll->poll_end_date ="01-01-2038 23:59:59";
354
 
355
- $poll->poll_status ="active";
356
 
357
- $poll->poll_date =$current_date;
358
 
359
- $poll->poll_modified =$current_date;
360
 
361
- $poll->poll_total_votes =$wp_poll->pollq_totalvotes;
362
 
363
- $question = new YOP_POLL_Question_Model();
364
 
365
 
 
366
 
367
- $poll_id=$poll->save();
368
 
369
 
 
370
 
371
- $question->poll_d =$poll_id;
372
 
373
- $question->question =$wp_poll->pollq_question;
374
 
375
- $question->question_status ="active";
376
 
377
- $question->question_author =get_current_user_id();
378
 
379
- $question->poll_order =1;
380
 
381
- $question->question_date =$current_date;
382
 
383
- $question->question_modified =$current_date;
384
 
385
 
 
386
 
387
- $question->save();
388
 
389
 
 
390
 
391
- foreach($answers as $answer){
392
 
393
- $poll_answer =new YOP_POLL_Answer_Model();
394
 
395
- $poll_answer->poll_id =$poll_id;
396
 
397
- $poll_answer->question_id =$question->ID;
398
 
399
- $poll_answer->answer =$answer['polla_answers'];
400
 
401
- $poll_answer->answer_status ="active";
402
 
403
- $poll_answer->question_order =1;
404
 
405
- $poll_answer->answer_author =get_current_user_id();
406
 
407
- $poll_answer->votes =$answer['polla_votes'];
408
 
409
- $poll_answer->answer_date =$current_date;
410
 
411
- $poll_answer->answer_modified =$current_date;
412
 
413
 
 
414
 
415
- $poll_answer->save();
416
 
417
- unset($log_details);
418
 
419
- $log_details= self::get_log_from_db_by_poll_id($wp_poll->pollq_id,$answer['polla_aid']);
420
 
421
- foreach($log_details as $log)
422
 
423
- {
424
 
425
- $arg['poll_id'] =$poll->ID;
426
 
427
- $arg['ip'] =$log['pollip_ip'];
428
 
429
- if($log['pollip_user']=='Guest'){
430
 
431
- $arg['user_type']='anonymous';
432
 
433
- }else
434
 
435
- $arg['user_type'] ="wordpress";
436
 
437
- $arg['user_id'] =$log['pollip_userid'];
438
 
439
- $arg['vote_date'] =$log['pollip_timestamp'];
440
 
441
- $a =self::get_answer_from_db_by_id($log['pollip_aid']);
442
 
443
- $arg[1]["q-".$question->ID ]['a'][0]= $poll_answer->ID;
444
 
445
- $arg[1]["q-".$question->ID ]['answers'][0]=$a[0]['polla_answers'];
446
 
447
- $q = self::get_question_from_db_by_id($log['pollip_qid']);
448
 
449
- $arg[1]["q-".$question->ID ]['question']=$q[0]['pollq_question'];
450
 
451
- $arg['vote_details'] =json_encode($arg[1]);
452
 
453
- $message=$this->insert_log_in_db($arg);
454
 
 
455
 
456
- if($message['error']!=""|| $message['success']!="")
457
 
458
- $data['message']=$message;
459
 
 
460
 
461
- unset($arg);
462
 
463
  }
464
 
@@ -466,37 +469,35 @@ class YOP_POLL_Imports_Admin extends YOP_POLL_Abstract_Admin{
466
 
467
  }
468
 
469
- }
470
-
471
- else
472
 
473
- wp_die( __yop_poll('You do not have enough permission to import a Wp-poll'));
474
 
475
- }
476
 
477
- else {
478
 
479
- wp_die( __yop_poll('You do not have enough permission to import a Wp-poll'));
480
 
481
- }
482
 
483
 
484
 
485
- $data['title']='Import Polls from Wp-Poll';
486
 
487
 
488
 
489
- $this->display('imports.html',$data);
490
 
491
- }
492
 
493
- public function get_wp_polls_from_db(){
494
 
495
 
496
 
497
- global $wpdb;
498
 
499
- return $wpdb->get_results($wpdb->prepare( "
500
 
501
  SELECT *
502
 
@@ -506,15 +507,15 @@ class YOP_POLL_Imports_Admin extends YOP_POLL_Abstract_Admin{
506
 
507
  "));
508
 
509
- }
510
 
511
 
512
 
513
- public function get_wp_poll_answers_from_db_by_id($poll_id)
514
 
515
- { global $wpdb;
516
 
517
- return $wpdb->get_results($wpdb->prepare( "
518
 
519
  SELECT *
520
 
@@ -526,15 +527,15 @@ class YOP_POLL_Imports_Admin extends YOP_POLL_Abstract_Admin{
526
 
527
 
528
 
529
- }
530
 
531
 
532
 
533
- public function get_log_from_db_by_poll_id($poll_id,$a_id)
534
 
535
- {global $wpdb;
536
 
537
- return $wpdb->get_results($wpdb->prepare( "
538
 
539
  SELECT *
540
 
@@ -546,15 +547,15 @@ class YOP_POLL_Imports_Admin extends YOP_POLL_Abstract_Admin{
546
 
547
 
548
 
549
- }
550
 
551
 
552
 
553
- public function get_answer_from_db_by_id($poll_id)
554
 
555
- {global $wpdb;
556
 
557
- return $wpdb->get_results($wpdb->prepare( "
558
 
559
  SELECT *
560
 
@@ -566,13 +567,13 @@ class YOP_POLL_Imports_Admin extends YOP_POLL_Abstract_Admin{
566
 
567
 
568
 
569
- }
570
 
571
- public function get_question_from_db_by_id($poll_id)
572
 
573
- {global $wpdb;
574
 
575
- return $wpdb->get_results($wpdb->prepare( "
576
 
577
  SELECT *
578
 
@@ -584,23 +585,23 @@ class YOP_POLL_Imports_Admin extends YOP_POLL_Abstract_Admin{
584
 
585
 
586
 
587
- }
588
 
589
- public function insert_log_in_db( $log ){
590
 
591
- global $wpdb;
592
 
593
 
594
 
595
- $response['success'] = "";
596
 
597
- $response['error'] = "";
598
 
599
- define( 'DIEONDBERROR', true );
600
 
601
 
602
 
603
- $sql = $wpdb->query( $wpdb->prepare( "
604
 
605
  INSERT INTO {$wpdb->yop_poll_logs} (
606
 
@@ -618,272 +619,274 @@ class YOP_POLL_Imports_Admin extends YOP_POLL_Abstract_Admin{
618
 
619
  ) VALUES ( %d, %s, %d, %s, %s, %s )",
620
 
621
- $log['poll_id'],
622
 
623
- $log['ip'],
624
 
625
- $log['user_id'],
626
 
627
- $log['user_type'],
628
 
629
- $log['vote_details'],
630
 
631
- $log['vote_date']
632
 
633
- ));
634
 
635
- if ( $sql ){
636
 
637
- $response['success'] = __yop_poll( 'Polls imported!' );
638
 
639
- $response['insert_id'] = $wpdb->insert_id;
640
 
641
- }
642
 
643
- else {
644
 
645
- $response['error'] = __yop_poll( 'Could not import polls into database!' );
646
 
647
- }
648
 
649
- return $response;
650
 
651
 
652
 
653
 
654
 
655
- }
656
 
657
- private function view_wp_polls(){
 
658
 
659
- $data['REQUEST'] = $_REQUEST;
 
660
 
661
- $voter['poll_id']=7;
662
 
663
- $voter['user_id']=1;
664
 
665
- $voter['user_type']="wordpress";
666
 
667
- global $wpdb, $message;
668
 
669
- global $page, $action, $orderby, $order, $current_user;
670
 
671
- $orderby = ( empty ( $GLOBALS['orderby'] ) ) ? 'pollq_question' : $GLOBALS['orderby'];
672
 
673
- $order = ( empty ( $GLOBALS['order'] ) ) ? 'desc' : $GLOBALS['order'];
674
 
675
- $data['per_page'] = ( isset ( $_GET ['per_page'] ) ? intval( $_GET ['per_page'] ) : 100 );
676
 
677
- $data['page_no'] = isset ( $_REQUEST ['page_no'] ) ? ( int )$_REQUEST ['page_no'] : 1;
678
 
679
- $order_fields = array( 'pollq_question', 'pollq_totalvoters' );
680
 
 
681
 
682
 
683
- $data['orderby'] = ( empty ( $data['REQUEST']['orderby'] ) ) ? 'pollq_question' : $data['REQUEST']['orderby'];
684
 
685
- $data['order'] = ( empty ( $data['REQUEST']['order'] ) ) ? 'desc' : $data['REQUEST']['order'];
686
 
687
- $data['order_direction'] = $this->make_order_array( $order_fields, 'asc', $orderby, ( 'desc' == $order ) ? 'asc' : 'desc' );
688
 
689
- $data['order_sortable'] = $this->make_order_array( $order_fields, 'sortable', $orderby, 'sorted' );
690
 
691
- $data['order_direction_reverse'] = $this->make_order_array( $order_fields, 'desc', $orderby, ( 'desc' == $order ) ? 'desc' : 'asc' );
692
 
693
- $data['search'] = array( 'fields' => array( 'pollq_question' ), 'value' => isset ( $_REQUEST ['s'] ) ? trim( $_REQUEST ['s'] ) : '' );
694
 
695
- $data['wp_polls'] = self::get_wp_poll_search( $data['orderby'], $data['order'], $data['search'], $data['page_no'], $data['per_page'] );
696
- if(!empty($data['wp_polls']))
697
- foreach($data['wp_polls']as &$wp_poll)
698
 
699
- {
700
 
701
- $wp_poll['pollq_timestamp']=date("Y-m-d H:i:s", $wp_poll['pollq_timestamp']);
702
 
703
- $wp_poll['pollq_expiry']=date("Y-m-d H:i:s", $wp_poll['pollq_expiry']);
704
 
 
705
 
 
706
 
707
- }
708
 
709
- $data['total_wp_polls'] = self::count_wp_search( $data['orderby'], $data['order'], $data['search'] );
710
 
711
- $data['total_polls'] = $data['total_wp_polls'][0]['poll_no'];
712
 
713
- $data['message'] = array( 'error' => $message['error'], 'success' => $message['success'] );
714
 
715
- if ( intval( $data['page_no'] ) > intval( $data['total_polls'] ) ){
716
 
717
- $data['page_no'] = 1;
718
 
719
- }
720
 
721
- $args = array(
722
 
723
- 'base' => remove_query_arg(
724
 
725
- 'page_no',
726
 
727
- $_SERVER ['REQUEST_URI'] ) . '%_%',
728
 
729
- 'format' => '&page_no=%#%',
730
 
731
- 'current' => max( 1, $data['page_no'] ),
732
 
733
- 'total' => ceil( $data['total_wp_polls'][0]['poll_no'] / $data['per_page'] ),
734
 
735
- 'prev_next' => true,
736
 
737
- 'prev_text' => __( '&laquo;' ),
738
 
739
- 'next_text' => __( '&raquo;' )
740
 
741
- );
742
 
 
743
 
 
744
 
745
- $data['pagination'] = paginate_links( $args );
746
 
747
 
 
748
 
749
- $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'action' ), $_SERVER ['REQUEST_URI'] );
750
 
751
- $data['request']['uri'] = $_SERVER["REQUEST_URI"];
752
 
 
753
 
 
754
 
755
- $data['title']='Import Polls from Wp-Poll';
756
 
757
- $this->display('imports.html',$data);
 
758
 
759
- }
760
 
761
- public static function get_wp_poll_search( $orderby = 'pollq_question', $order = 'desc', $search = array( 'fields' => array(), 'value' => NULL ), $offset = 0 , $per_page = 100 ,$poll_id = NULL ) {
762
 
763
- global $wpdb;
764
- if($wpdb->get_var("SHOW TABLES LIKE '$wpdb->pollsq'") == $wpdb->pollsq) {
765
- $sql = "SELECT * FROM " . $wpdb->pollsq;
766
 
 
767
 
 
768
 
769
- $sql_search = '';
770
 
771
- if ( $poll_id ){
772
 
773
- $sql_search .= $wpdb->prepare( ' WHERE pollq_id = %d', $poll_id );
774
 
775
- }
776
 
 
777
 
 
778
 
779
 
780
 
781
- if ( count( $search['fields'] ) > 0 ){
782
 
783
 
 
784
 
785
- $sql_search .= ' WHERE (';
786
 
787
 
 
788
 
789
- foreach ( $search['fields'] as $field ) {
790
 
791
- $sql_search .= $wpdb->prepare( ' ' . esc_attr( $field ) . ' like \'%%%s%%\' OR', $search['value'] );
792
 
793
- }
794
 
795
- $sql_search = trim( $sql_search, 'OR' );
796
 
797
- $sql_search .= ' ) ';
798
 
799
- }
 
 
 
 
800
 
801
- $sql .= $sql_search;
802
 
803
- $sql_order_by = ' ORDER BY ' . esc_attr( $orderby ) . ' ' . esc_attr( $order ) . ' ';
804
 
805
- $sql .= $sql_order_by;
806
 
807
- $sql .= $wpdb->prepare( ' LIMIT %d, %d', (($offset-1) * $per_page), $per_page );
 
 
808
 
809
- return $wpdb->get_results( $sql, ARRAY_A );
810
  }
811
- }
812
 
813
- public static function get_wp_poll_search_by_id($poll_id = NULL ) {
814
 
815
- global $wpdb;
816
 
817
- $sql = "SELECT * FROM " . $wpdb->pollsq;
818
 
819
 
820
 
821
- $sql_search = '';
822
 
823
- if ( $poll_id ){
824
 
825
- $sql_search .= $wpdb->prepare( ' WHERE pollq_id = %d', $poll_id );
826
 
827
- }
828
 
829
 
830
 
831
 
832
 
833
- $sql .= $sql_search;
834
 
835
 
836
 
837
- return $wpdb->get_results( $sql, ARRAY_A );
838
 
839
- }
840
 
841
- public static function count_wp_search( $orderby = 'pollq_question', $order = 'desc', $search = array( 'fields' => array(), 'value' => NULL ) ) {
842
 
843
- global $wpdb;
844
- if($wpdb->get_var("SHOW TABLES LIKE '$wpdb->pollsq'") == $wpdb->pollsq) {
845
- $sql = "SELECT COUNT(*) AS poll_no FROM " . $wpdb->pollsq;
846
 
847
- $sql_search = '';
848
 
849
- if ( count( $search['fields'] ) > 0 ){
850
 
 
851
 
852
 
853
- $sql_search .= ' WHERE (';
854
 
 
855
 
856
 
857
- foreach ( $search['fields'] as $field ) {
858
 
859
- $sql_search .= $wpdb->prepare( ' ' . esc_attr( $field ) . ' like \'%%%s%%\' OR', $search['value'] );
860
 
861
- }
862
 
863
- $sql_search = trim( $sql_search, 'OR' );
864
 
865
- $sql_search .= ' ) ';
866
 
867
- }
868
 
869
- $sql .= $sql_search;
870
- yop_poll_dump($sql);
 
 
 
871
 
872
- $sql_order_by = ' ORDER BY ' . esc_attr( $orderby ) . ' ' . esc_attr( $order ) . ' ';
873
 
874
- $sql .= $sql_order_by;
875
 
876
- return $wpdb->get_results( $sql, ARRAY_A );
877
  }
878
- }
879
 
880
 
881
 
882
- public function yop_poll_get_polls_meta_from_db(){
883
 
884
- global $wpdb;
885
 
886
- $result = $wpdb->get_results( "
887
 
888
  SELECT *
889
 
@@ -891,17 +894,17 @@ class YOP_POLL_Imports_Admin extends YOP_POLL_Abstract_Admin{
891
 
892
  ", ARRAY_A );
893
 
894
- return $result;
895
 
896
 
897
 
898
- }
899
 
900
- public function yop_poll_get_polls_from_db(){
901
 
902
- global $wpdb;
903
 
904
- $result = $wpdb->get_results( ( "
905
 
906
  SELECT *
907
 
@@ -909,109 +912,109 @@ class YOP_POLL_Imports_Admin extends YOP_POLL_Abstract_Admin{
909
 
910
  "), ARRAY_A );
911
 
912
- return $result;
913
 
914
 
915
 
916
- }
917
 
918
 
919
 
920
 
921
- public function yop_poll_get_answers_meta_from_db() {
922
- global $wpdb;
923
 
924
- $result = $wpdb->get_results( "
925
  SELECT *
926
  FROM " . $wpdb->prefix . "yop_poll_answermeta
927
 
928
  " , ARRAY_A );
929
- return $result;
930
 
931
- }
932
 
933
- public function yop_poll_get_templates_from_db() {
934
- global $wpdb;
935
- $result = $wpdb->get_results( "
936
  SELECT *
937
  FROM " . $wpdb->prefix . "yop_poll_templates
938
  " , ARRAY_A );
939
- return $result;
940
- }
941
 
942
- public function yop_poll_get_custom_fields_from_db() {
943
- global $wpdb;
944
- $result = $wpdb->get_results("
945
  SELECT *
946
  FROM " . $wpdb->prefix . "yop_poll_custom_fields ORDER BY poll_id ASC
947
  " , ARRAY_A );
948
- return $result;
949
- }
950
 
951
- public function yop_poll_get_custom_fields_votes_from_db() {
952
- global $wpdb;
953
- $result = $wpdb->get_results( "
954
  SELECT *
955
  FROM " . $wpdb->prefix . "yop_poll_votes_custom_fields
956
  " , ARRAY_A );
957
- return $result;
958
- }
959
 
960
- public function yop_poll_get_bans_from_db() {
961
- global $wpdb;
962
- $result = $wpdb->get_results( "
963
  SELECT *
964
  FROM " . $wpdb->prefix . "yop_poll_bans ORDER BY poll_id ASC
965
  " , ARRAY_A );
966
- return $result;
967
- }
968
 
969
- public function yop_poll_get_answers_from_db() {
970
- global $wpdb;
971
- $result = $wpdb->get_results( "
972
  SELECT *
973
  FROM " . $wpdb->prefix . "yop_poll_answers ORDER BY poll_id ASC
974
  ", ARRAY_A );
975
- return $result;
976
- }
977
 
978
- public function yop_poll_get_logs_from_db() {
979
- global $wpdb;
980
- $result = $wpdb->get_results( ( "
981
  SELECT *
982
  FROM " . $wpdb->prefix . "yop_poll_logs WHERE ID>%d
983
  " ), ARRAY_A );
984
- return $result;
985
- }
986
 
987
- private static function insert_ban_in_db( $ban ) {
988
- global $wpdb;
989
- $sql = $wpdb->query( $wpdb->prepare( "
990
  INSERT INTO $wpdb->yop_poll_bans
991
  ( poll_id,type,value,period ,unit)
992
  VALUES(%d,%s,%s,%d,%s)
993
  ", $ban['poll_id'], $ban['type'], $ban['value'], intval( $ban['period'] ), $ban['unit'] ) );
994
- return $wpdb->get_results( $sql );
995
- }
996
- private function save_poll_order( $poll, $poll_order ) {
997
- $poll_archive_order = get_option( 'yop_poll_archive_order', array() );
998
- if( $poll_archive_order == "" ) {
999
- $poll_archive_order = array();
1000
- }if( trim( $poll_order ) <= 0 ) {
1001
- $poll_order = 1;
1002
  }
1003
- $key = array_search( $poll, $poll_archive_order );
1004
- if( $key !== false ) {
1005
- unset( $poll_archive_order[$key] );
1006
- }
1007
- if( $poll_order > count( $poll_archive_order ) ) {
1008
- array_push( $poll_archive_order, $poll );
1009
- }
1010
- else {
1011
- array_splice( $poll_archive_order, trim( $poll_order ) - 1, 0, array( $poll ) );
 
 
 
 
 
 
 
 
 
1012
  }
1013
- update_option( 'yop_poll_archive_order', $poll_archive_order );
1014
- }
1015
 
1016
 
1017
- }
1
  <?php
2
 
3
+ class YOP_POLL_Imports_Admin extends YOP_POLL_Abstract_Admin{
4
 
5
+ private static $_instance = NULL;
6
 
7
 
8
 
9
+ protected function __construct() {
10
 
11
+ parent::__construct( 'imports' );
12
+
13
+ }
14
 
 
15
 
16
 
17
+ public static function get_instance() {
18
 
19
+ if ( self::$_instance == NULL ){
20
 
21
+ $class = __CLASS__;
22
 
23
+ self::$_instance = new $class;
24
+
25
+ }
26
 
27
+ return self::$_instance;
28
 
29
  }
30
 
 
31
 
 
32
 
33
+ public function manage_imports() {
34
+
35
+ switch ( $GLOBALS['page'] ) {
36
 
37
+ default:
38
 
39
+ $this->manage_options();
40
 
41
+ break;
42
 
43
+ }
44
 
 
45
 
 
46
 
47
  }
48
 
49
+ public function manage_load_imports() {
50
 
51
+ wp_enqueue_style( 'yop-poll-timepicker', YOP_POLL_URL . "css/timepicker.css", array(), YOP_POLL_VERSION );
52
 
53
+ wp_enqueue_style( 'yop-poll-jquery-ui', YOP_POLL_URL . "css/jquery-ui.css", array(), YOP_POLL_VERSION );
54
 
55
+ }
56
 
 
57
 
 
58
 
59
+ private function manage_options() {
60
 
61
+ global $page, $action, $message;
62
 
63
+ switch ( $action ) {
64
 
 
65
 
 
 
66
 
67
+ case 'import-all':
68
 
69
+ {
70
 
71
+ $this->import_wp_polls();
72
 
 
73
 
74
+ break;
75
 
76
+ }
77
 
78
+ case 'import':
79
 
80
+ {
81
 
82
+ $this->import_wp_poll();
83
 
84
+ break;
85
 
86
+ }
87
 
88
+ default:
89
 
90
+ {
91
+ self:: view_wp_polls();
92
 
93
+ }
94
 
 
 
95
 
 
96
 
97
 
98
 
99
+ }
100
 
101
 
 
 
102
 
103
+ }
104
 
105
+ private function import_wp_poll() {
106
 
 
107
 
108
+ if ( !current_user_can( 'edit_own_yop_polls' ) && ( !current_user_can( 'edit_yop_polls' )) ){
109
 
110
+ wp_die( __yop_poll( 'You are not allowed to edit this item.' ) );
111
 
112
+ }
113
 
114
+ else
115
 
116
+ if( check_admin_referer('yop-poll-import', 'yop-poll-imports') ) {
117
 
118
+ if (isset ($_REQUEST['id']))
119
 
120
+ {
121
 
122
+ self::import_wp_poll_fom_db($_REQUEST['id']);
123
 
124
+ }
125
 
126
+ else if ( isset ( $_REQUEST ['yoppollwppollcheck'] ) ){
127
 
128
+ $wp_poll = ( array )$_REQUEST ['yoppollwppollcheck'];
129
 
130
+ foreach ( $wp_poll as $wp_id ) {
131
 
132
+ $wp_id = ( int )$wp_id ;
133
 
134
+ $message = self::import_wp_poll_fom_db($wp_id);
135
 
136
+ }
137
 
138
  }
139
 
140
  }
141
 
142
+ else {
143
 
144
+ wp_die( __yop_poll('You do not have enough permission to import a Wp-poll'));
145
 
146
+ }
147
 
148
+ self:: view_wp_polls();
149
 
150
+ }
151
 
152
+ private function import_wp_poll_fom_db($id)
153
 
154
+ {
155
+ $current_date= date('Y/m/d H:i:s');
156
 
157
+ $wp_polls=self::get_wp_poll_search_by_id($id );
158
+ global $message;
159
 
 
 
160
 
161
+ foreach ($wp_polls as $wp_poll)
162
 
163
+ {
164
+ $poll = new YOP_POLL_Poll_Model(0);
165
 
166
+ $answers= self::get_wp_poll_answers_from_db_by_id($wp_poll['pollq_id']);
 
167
 
168
+ $poll->poll_title=$wp_poll['pollq_question'];
169
 
170
+ $poll->poll_name=$wp_poll['pollq_question'];
171
 
172
+ $poll->poll_author=get_current_user_id();
173
 
174
+ $poll->poll_start_date=date("Y-m-d H:i:s", $wp_poll['pollq_timestamp']);
175
+ if($wp_poll['pollq_multiple']>0){
176
+ $poll->allow_multiple_answers="yes";
177
+ $poll->allow_multiple_answers_max_number=$wp_poll['pollq_multiple'];
178
 
179
+ }
 
 
 
180
 
181
+ if($wp_poll['pollq_expiry']!="")
182
 
183
+ $poll->poll_end_date= date("Y-m-d H:i:s", $wp_poll['pollq_expiry']);
184
 
185
+ else
186
 
187
+ $poll->poll_end_date="01-01-2038 23:59:59";
188
 
189
+ $poll->poll_status="active";
190
 
191
+ $poll->poll_date=$current_date;
192
 
193
+ $poll->poll_modified=$current_date;
194
 
195
+ $poll->poll_total_votes=$wp_poll['pollq_totalvotes'];
196
 
197
+ $question= new YOP_POLL_Question_Model();
198
 
 
199
 
200
 
201
+ $poll_id=$poll->save();
202
 
 
203
 
204
 
205
+ $question->poll_id=$poll_id;
206
 
207
+ $question->question=$wp_poll['pollq_question'];
208
 
209
+ $question->question_status="active";
210
 
211
+ $question->type="text";
212
+ if($wp_poll['pollq_multiple']>0){
213
+ $question->allow_multiple_answers="yes";
214
+ $question->allow_multiple_answers_max_number=$wp_poll['pollq_multiple'];
215
 
216
+ }
 
 
 
217
 
218
+ $question->question_author=get_current_user_id();
219
 
220
+ $question->poll_order=1;
221
 
222
+ $question->question_date =$current_date;
223
 
224
+ $question->question_modified=$current_date;
225
 
 
226
 
227
 
228
+ $question->save();
229
 
 
230
 
231
 
232
+ foreach($answers as $answer){
233
 
 
234
 
235
 
236
+ $poll_answer =new YOP_POLL_Answer_Model();
237
 
238
+ $poll_answer->poll_id=$poll_id;
239
 
240
+ $poll_answer->question_id=$question->ID;
241
 
242
+ $poll_answer->answer=$answer['polla_answers'];
243
 
244
+ $poll_answer->answer_status="active";
245
 
246
+ $poll_answer->type="text";
247
 
248
+ $poll_answer->question_order=1;
249
 
250
+ $poll_answer->answer_author=get_current_user_id();
251
 
252
+ $poll_answer->votes=$answer['polla_votes'];
253
 
254
+ $poll_answer->answer_date=$current_date;
255
 
256
+ $poll_answer->answer_modified=$current_date;
257
 
 
258
 
259
 
260
+ $poll_answer->save();
261
 
262
+ unset($log_details);
263
 
264
+ $log_details= self::get_log_from_db_by_poll_id($wp_poll['pollq_id'],$answer['polla_aid']);
265
 
266
+ foreach($log_details as $log)
267
 
268
+ {
269
 
270
+ $arg['poll_id']=$poll->ID;
271
 
272
+ $arg['ip']=$log['pollip_ip'];
273
 
274
+ if($log['pollip_user']=='Guest'){
275
 
276
+ $arg['user_type']='anonymous';
277
 
278
+ }else
279
 
280
+ $arg['user_type']="wordpress";
281
 
282
+ $arg['user_id']=$log['pollip_userid'];
283
 
284
+ $arg['vote_date']=$log['pollip_timestamp'];
285
 
286
+ $a = self::get_answer_from_db_by_id($log['pollip_aid']);
287
 
288
+ $arg[1]["q-".$question->ID ]['a'][0]= $poll_answer->ID;
289
 
290
+ $arg[1]["q-".$question->ID ]['answers'][0]=$a[0]['polla_answers'];
291
 
292
+ $q = self::get_question_from_db_by_id($log['pollip_qid']);
293
 
294
+ $arg[1]["q-".$question->ID ]['question']=$q[0]['pollq_question'];
295
 
296
+ $arg['vote_details']=json_encode($arg[1]);
297
 
298
+ $this->insert_log_in_db($arg);
299
 
 
300
 
301
+ unset($arg);
302
 
303
+ }
304
 
305
  }
306
 
 
307
 
308
 
309
+ }
310
+ if($poll_id){
311
+ $message['success']="Poll imported!" ;
312
+ }
313
+ else
314
+ $message['error']="Could not import ban from database! Please try again!" ;
315
 
316
  }
 
 
 
 
 
317
 
 
318
 
319
 
320
+ private function import_wp_polls()
321
 
322
+ {
323
 
324
+ if( check_admin_referer('yop-poll-import', 'yop-poll-imports') ) {
325
 
326
+ if(current_user_can('import_wp_polls')){
327
 
328
+ $current_date= date('Y/m/d H:i:s');
329
 
330
+ $wp_polls=self::get_wp_polls_from_db();
331
 
332
+ foreach ($wp_polls as $wp_poll)
333
 
334
+ {
335
 
336
+ $poll = new YOP_POLL_Poll_Model(0);
337
 
338
+ $answers = self::get_wp_poll_answers_from_db_by_id($wp_poll->pollq_id);
339
 
340
+ $poll->poll_title =$wp_poll->pollq_question;
341
 
342
+ $poll->poll_name =$wp_poll->pollq_question;
343
 
344
+ $poll->poll_author =get_current_user_id();
345
 
346
+ $poll->poll_start_date=date("Y-m-d H:i:s", $wp_poll['pollq_timestamp']);
347
 
348
+ if($wp_poll['pollq_expiry']!="")
349
 
350
+ $poll->poll_end_date = date("Y-m-d H:i:s", $wp_poll['pollq_expiry']);
351
 
352
+ else
353
 
354
+ $poll->poll_end_date ="01-01-2038 23:59:59";
355
 
356
+ $poll->poll_status ="active";
357
 
358
+ $poll->poll_date =$current_date;
359
 
360
+ $poll->poll_modified =$current_date;
361
 
362
+ $poll->poll_total_votes =$wp_poll->pollq_totalvotes;
363
 
364
+ $question = new YOP_POLL_Question_Model();
365
 
 
366
 
367
 
368
+ $poll_id=$poll->save();
369
 
 
370
 
371
 
372
+ $question->poll_d =$poll_id;
373
 
374
+ $question->question =$wp_poll->pollq_question;
375
 
376
+ $question->question_status ="active";
377
 
378
+ $question->question_author =get_current_user_id();
379
 
380
+ $question->poll_order =1;
381
 
382
+ $question->question_date =$current_date;
383
 
384
+ $question->question_modified =$current_date;
385
 
 
386
 
387
 
388
+ $question->save();
389
 
 
390
 
391
 
392
+ foreach($answers as $answer){
393
 
394
+ $poll_answer =new YOP_POLL_Answer_Model();
395
 
396
+ $poll_answer->poll_id =$poll_id;
397
 
398
+ $poll_answer->question_id =$question->ID;
399
 
400
+ $poll_answer->answer =$answer['polla_answers'];
401
 
402
+ $poll_answer->answer_status ="active";
403
 
404
+ $poll_answer->question_order =1;
405
 
406
+ $poll_answer->answer_author =get_current_user_id();
407
 
408
+ $poll_answer->votes =$answer['polla_votes'];
409
 
410
+ $poll_answer->answer_date =$current_date;
411
 
412
+ $poll_answer->answer_modified =$current_date;
413
 
 
414
 
415
 
416
+ $poll_answer->save();
417
 
418
+ unset($log_details);
419
 
420
+ $log_details= self::get_log_from_db_by_poll_id($wp_poll->pollq_id,$answer['polla_aid']);
421
 
422
+ foreach($log_details as $log)
423
 
424
+ {
425
 
426
+ $arg['poll_id'] =$poll->ID;
427
 
428
+ $arg['ip'] =$log['pollip_ip'];
429
 
430
+ if($log['pollip_user']=='Guest'){
431
 
432
+ $arg['user_type']='anonymous';
433
 
434
+ }else
435
 
436
+ $arg['user_type'] ="wordpress";
437
 
438
+ $arg['user_id'] =$log['pollip_userid'];
439
 
440
+ $arg['vote_date'] =$log['pollip_timestamp'];
441
 
442
+ $a =self::get_answer_from_db_by_id($log['pollip_aid']);
443
 
444
+ $arg[1]["q-".$question->ID ]['a'][0]= $poll_answer->ID;
445
 
446
+ $arg[1]["q-".$question->ID ]['answers'][0]=$a[0]['polla_answers'];
447
 
448
+ $q = self::get_question_from_db_by_id($log['pollip_qid']);
449
 
450
+ $arg[1]["q-".$question->ID ]['question']=$q[0]['pollq_question'];
451
 
452
+ $arg['vote_details'] =json_encode($arg[1]);
453
 
454
+ $message=$this->insert_log_in_db($arg);
455
 
 
456
 
457
+ if($message['error']!=""|| $message['success']!="")
458
 
459
+ $data['message']=$message;
460
 
 
461
 
462
+ unset($arg);
463
 
464
+ }
465
 
466
  }
467
 
469
 
470
  }
471
 
472
+ else
 
 
473
 
474
+ wp_die( __yop_poll('You do not have enough permission to import a Wp-poll'));
475
 
476
+ }
477
 
478
+ else {
479
 
480
+ wp_die( __yop_poll('You do not have enough permission to import a Wp-poll'));
481
 
482
+ }
483
 
484
 
485
 
486
+ $data['title']='Import Polls from Wp-Poll';
487
 
488
 
489
 
490
+ $this->display('imports.html',$data);
491
 
492
+ }
493
 
494
+ public function get_wp_polls_from_db(){
495
 
496
 
497
 
498
+ global $wpdb;
499
 
500
+ return $wpdb->get_results($wpdb->prepare( "
501
 
502
  SELECT *
503
 
507
 
508
  "));
509
 
510
+ }
511
 
512
 
513
 
514
+ public function get_wp_poll_answers_from_db_by_id($poll_id)
515
 
516
+ { global $wpdb;
517
 
518
+ return $wpdb->get_results($wpdb->prepare( "
519
 
520
  SELECT *
521
 
527
 
528
 
529
 
530
+ }
531
 
532
 
533
 
534
+ public function get_log_from_db_by_poll_id($poll_id,$a_id)
535
 
536
+ {global $wpdb;
537
 
538
+ return $wpdb->get_results($wpdb->prepare( "
539
 
540
  SELECT *
541
 
547
 
548
 
549
 
550
+ }
551
 
552
 
553
 
554
+ public function get_answer_from_db_by_id($poll_id)
555
 
556
+ {global $wpdb;
557
 
558
+ return $wpdb->get_results($wpdb->prepare( "
559
 
560
  SELECT *
561
 
567
 
568
 
569
 
570
+ }
571
 
572
+ public function get_question_from_db_by_id($poll_id)
573
 
574
+ {global $wpdb;
575
 
576
+ return $wpdb->get_results($wpdb->prepare( "
577
 
578
  SELECT *
579
 
585
 
586
 
587
 
588
+ }
589
 
590
+ public function insert_log_in_db( $log ){
591
 
592
+ global $wpdb;
593
 
594
 
595
 
596
+ $response['success'] = "";
597
 
598
+ $response['error'] = "";
599
 
600
+ define( 'DIEONDBERROR', true );
601
 
602
 
603
 
604
+ $sql = $wpdb->query( $wpdb->prepare( "
605
 
606
  INSERT INTO {$wpdb->yop_poll_logs} (
607
 
619
 
620
  ) VALUES ( %d, %s, %d, %s, %s, %s )",
621
 
622
+ $log['poll_id'],
623
 
624
+ $log['ip'],
625
 
626
+ $log['user_id'],
627
 
628
+ $log['user_type'],
629
 
630
+ $log['vote_details'],
631
 
632
+ $log['vote_date']
633
 
634
+ ));
635
 
636
+ if ( $sql ){
637
 
638
+ $response['success'] = __yop_poll( 'Polls imported!' );
639
 
640
+ $response['insert_id'] = $wpdb->insert_id;
641
 
642
+ }
643
 
644
+ else {
645
 
646
+ $response['error'] = __yop_poll( 'Could not import polls into database!' );
647
 
648
+ }
649
 
650
+ return $response;
651
 
652
 
653
 
654
 
655
 
656
+ }
657
 
658
+ private function view_wp_polls(){
659
+ global $wpdb;
660
 
661
+ if( $wpdb->get_var("SHOW TABLES LIKE '" . $wpdb->prefix . "pollsq'") === $wpdb->prefix . 'pollsq' ) {
662
+ $data['REQUEST'] = $_REQUEST;
663
 
 
664
 
665
+ $voter['poll_id']=7;
666
 
667
+ $voter['user_id']=1;
668
 
669
+ $voter['user_type']="wordpress";
670
 
671
+ global $wpdb, $message;
672
 
673
+ global $page, $action, $orderby, $order, $current_user;
674
 
675
+ $orderby = ( empty ( $GLOBALS['orderby'] ) ) ? 'pollq_question' : $GLOBALS['orderby'];
676
 
677
+ $order = ( empty ( $GLOBALS['order'] ) ) ? 'desc' : $GLOBALS['order'];
678
 
679
+ $data['per_page'] = ( isset ( $_GET ['per_page'] ) ? intval( $_GET ['per_page'] ) : 100 );
680
 
681
+ $data['page_no'] = isset ( $_REQUEST ['page_no'] ) ? ( int )$_REQUEST ['page_no'] : 1;
682
 
683
+ $order_fields = array( 'pollq_question', 'pollq_totalvoters' );
684
 
685
 
 
686
 
687
+ $data['orderby'] = ( empty ( $data['REQUEST']['orderby'] ) ) ? 'pollq_question' : $data['REQUEST']['orderby'];
688
 
689
+ $data['order'] = ( empty ( $data['REQUEST']['order'] ) ) ? 'desc' : $data['REQUEST']['order'];
690
 
691
+ $data['order_direction'] = $this->make_order_array( $order_fields, 'asc', $orderby, ( 'desc' == $order ) ? 'asc' : 'desc' );
692
 
693
+ $data['order_sortable'] = $this->make_order_array( $order_fields, 'sortable', $orderby, 'sorted' );
694
 
695
+ $data['order_direction_reverse'] = $this->make_order_array( $order_fields, 'desc', $orderby, ( 'desc' == $order ) ? 'desc' : 'asc' );
696
 
697
+ $data['search'] = array( 'fields' => array( 'pollq_question' ), 'value' => isset ( $_REQUEST ['s'] ) ? trim( $_REQUEST ['s'] ) : '' );
 
 
698
 
699
+ $data['wp_polls'] = self::get_wp_poll_search( $data['orderby'], $data['order'], $data['search'], $data['page_no'], $data['per_page'] );
700
 
701
+ foreach($data['wp_polls']as &$wp_poll)
702
 
703
+ {
704
 
705
+ $wp_poll['pollq_timestamp']=date("Y-m-d H:i:s", $wp_poll['pollq_timestamp']);
706
 
707
+ $wp_poll['pollq_expiry']=date("Y-m-d H:i:s", $wp_poll['pollq_expiry']);
708
 
 
709
 
 
710
 
711
+ }
712
 
713
+ $data['total_wp_polls'] = self::count_wp_search( $data['orderby'], $data['order'], $data['search'] );
714
 
715
+ $data['total_polls'] = $data['total_wp_polls'][0]['poll_no'];
716
 
717
+ $data['message'] = array( 'error' => $message['error'], 'success' => $message['success'] );
718
 
719
+ if ( intval( $data['page_no'] ) > intval( $data['total_polls'] ) ){
720
 
721
+ $data['page_no'] = 1;
722
 
723
+ }
724
 
725
+ $args = array(
726
 
727
+ 'base' => remove_query_arg(
728
 
729
+ 'page_no',
730
 
731
+ $_SERVER ['REQUEST_URI'] ) . '%_%',
732
 
733
+ 'format' => '&page_no=%#%',
734
 
735
+ 'current' => max( 1, $data['page_no'] ),
736
 
737
+ 'total' => ceil( $data['total_wp_polls'][0]['poll_no'] / $data['per_page'] ),
738
 
739
+ 'prev_next' => true,
740
 
741
+ 'prev_text' => __( '&laquo;' ),
742
 
743
+ 'next_text' => __( '&raquo;' )
744
 
745
+ );
746
 
 
747
 
748
 
749
+ $data['pagination'] = paginate_links( $args );
750
 
 
751
 
 
752
 
753
+ $_SERVER ['REQUEST_URI'] = remove_query_arg( array( 'action' ), $_SERVER ['REQUEST_URI'] );
754
 
755
+ $data['request']['uri'] = $_SERVER["REQUEST_URI"];
756
 
 
757
 
758
+ }
759
+ $data['title']='Import Polls from Wp-Poll';
760
 
761
+ $this->display('imports.html',$data);
762
 
763
+ }
764
 
765
+ public static function get_wp_poll_search( $orderby = 'pollq_question', $order = 'desc', $search = array( 'fields' => array(), 'value' => NULL ), $offset = 0 , $per_page = 100 ,$poll_id = NULL ) {
 
 
766
 
767
+ global $wpdb;
768
 
769
+ $sql = "SELECT * FROM " . $wpdb->pollsq;
770
 
 
771
 
 
772
 
773
+ $sql_search = '';
774
 
775
+ if ( $poll_id ){
776
 
777
+ $sql_search .= $wpdb->prepare( ' WHERE pollq_id = %d', $poll_id );
778
 
779
+ }
780
 
781
 
782
 
 
783
 
784
 
785
+ if ( count( $search['fields'] ) > 0 ){
786
 
 
787
 
788
 
789
+ $sql_search .= ' WHERE (';
790
 
 
791
 
 
792
 
793
+ foreach ( $search['fields'] as $field ) {
794
 
795
+ $sql_search .= $wpdb->prepare( ' ' . esc_attr( $field ) . ' like \'%%%s%%\' OR', $search['value'] );
796
 
797
+ }
798
 
799
+ $sql_search = trim( $sql_search, 'OR' );
800
+
801
+ $sql_search .= ' ) ';
802
+
803
+ }
804
 
805
+ $sql .= $sql_search;
806
 
807
+ $sql_order_by = ' ORDER BY ' . esc_attr( $orderby ) . ' ' . esc_attr( $order ) . ' ';
808
 
809
+ $sql .= $sql_order_by;
810
 
811
+ $sql .= $wpdb->prepare( ' LIMIT %d, %d', (($offset-1) * $per_page), $per_page );
812
+
813
+ return $wpdb->get_results( $sql, ARRAY_A );
814
 
 
815
  }
 
816
 
817
+ public static function get_wp_poll_search_by_id($poll_id = NULL ) {
818
 
819
+ global $wpdb;
820
 
821
+ $sql = "SELECT * FROM " . $wpdb->pollsq;
822
 
823
 
824
 
825
+ $sql_search = '';
826
 
827
+ if ( $poll_id ){
828
 
829
+ $sql_search .= $wpdb->prepare( ' WHERE pollq_id = %d', $poll_id );
830
 
831
+ }
832
 
833
 
834
 
835
 
836
 
837
+ $sql .= $sql_search;
838
 
839
 
840
 
841
+ return $wpdb->get_results( $sql, ARRAY_A );
842
 
843
+ }
844
 
845
+ public static function count_wp_search( $orderby = 'pollq_question', $order = 'desc', $search = array( 'fields' => array(), 'value' => NULL ) ) {
846
 
847
+ global $wpdb;
 
 
848
 
849
+ $sql = "SELECT COUNT(*) AS poll_no FROM " . $wpdb->pollsq;
850
 
851
+ $sql_search = '';
852
 
853
+ if ( count( $search['fields'] ) > 0 ){
854
 
855
 
 
856
 
857
+ $sql_search .= ' WHERE (';
858
 
859
 
 
860
 
861
+ foreach ( $search['fields'] as $field ) {
862
 
863
+ $sql_search .= $wpdb->prepare( ' ' . esc_attr( $field ) . ' like \'%%%s%%\' OR', $search['value'] );
864
 
865
+ }
866
 
867
+ $sql_search = trim( $sql_search, 'OR' );
868
 
869
+ $sql_search .= ' ) ';
870
 
871
+ }
872
+
873
+ $sql .= $sql_search;
874
+
875
+ $sql_order_by = ' ORDER BY ' . esc_attr( $orderby ) . ' ' . esc_attr( $order ) . ' ';
876
 
877
+ $sql .= $sql_order_by;
878
 
879
+ return $wpdb->get_results( $sql, ARRAY_A );
880
 
 
881
  }
 
882
 
883
 
884
 
885
+ public function yop_poll_get_polls_meta_from_db(){
886
 
887
+ global $wpdb;
888
 
889
+ $result = $wpdb->get_results( "
890
 
891
  SELECT *
892
 
894
 
895
  ", ARRAY_A );
896
 
897
+ return $result;
898
 
899
 
900
 
901
+ }
902
 
903
+ public function yop_poll_get_polls_from_db(){
904
 
905
+ global $wpdb;
906
 
907
+ $result = $wpdb->get_results( ( "
908
 
909
  SELECT *
910
 
912
 
913
  "), ARRAY_A );
914
 
915
+ return $result;
916
 
917
 
918
 
919
+ }
920
 
921
 
922
 
923
 
924
+ public function yop_poll_get_answers_meta_from_db() {
925
+ global $wpdb;
926
 
927
+ $result = $wpdb->get_results( "
928
  SELECT *
929
  FROM " . $wpdb->prefix . "yop_poll_answermeta
930
 
931
  " , ARRAY_A );
932
+ return $result;
933
 
934
+ }
935
 
936
+ public function yop_poll_get_templates_from_db() {
937
+ global $wpdb;
938
+ $result = $wpdb->get_results( "
939
  SELECT *
940
  FROM " . $wpdb->prefix . "yop_poll_templates
941
  " , ARRAY_A );
942
+ return $result;
943
+ }
944
 
945
+ public function yop_poll_get_custom_fields_from_db() {
946
+ global $wpdb;
947
+ $result = $wpdb->get_results("
948
  SELECT *
949
  FROM " . $wpdb->prefix . "yop_poll_custom_fields ORDER BY poll_id ASC
950
  " , ARRAY_A );
951
+ return $result;
952
+ }
953
 
954
+ public function yop_poll_get_custom_fields_votes_from_db() {
955
+ global $wpdb;
956
+ $result = $wpdb->get_results( "
957
  SELECT *
958
  FROM " . $wpdb->prefix . "yop_poll_votes_custom_fields
959
  " , ARRAY_A );
960
+ return $result;
961
+ }
962
 
963
+ public function yop_poll_get_bans_from_db() {
964
+ global $wpdb;
965
+ $result = $wpdb->get_results( "
966
  SELECT *
967
  FROM " . $wpdb->prefix . "yop_poll_bans ORDER BY poll_id ASC
968
  " , ARRAY_A );
969
+ return $result;
970
+ }
971
 
972
+ public function yop_poll_get_answers_from_db() {
973
+ global $wpdb;
974
+ $result = $wpdb->get_results( "
975
  SELECT *
976
  FROM " . $wpdb->prefix . "yop_poll_answers ORDER BY poll_id ASC
977
  ", ARRAY_A );
978
+ return $result;
979
+ }
980
 
981
+ public function yop_poll_get_logs_from_db() {
982
+ global $wpdb;
983
+ $result = $wpdb->get_results( ( "
984
  SELECT *
985
  FROM " . $wpdb->prefix . "yop_poll_logs WHERE ID>%d
986
  " ), ARRAY_A );
987
+ return $result;
988
+ }
989
 
990
+ private static function insert_ban_in_db( $ban ) {
991
+ global $wpdb;
992
+ $sql = $wpdb->query( $wpdb->prepare( "
993
  INSERT INTO $wpdb->yop_poll_bans
994
  ( poll_id,type,value,period ,unit)
995
  VALUES(%d,%s,%s,%d,%s)
996
  ", $ban['poll_id'], $ban['type'], $ban['value'], intval( $ban['period'] ), $ban['unit'] ) );
997
+ return $wpdb->get_results( $sql );
 
 
 
 
 
 
 
998
  }
999
+ private function save_poll_order( $poll, $poll_order ) {
1000
+ $poll_archive_order = get_option( 'yop_poll_archive_order', array() );
1001
+ if( $poll_archive_order == "" ) {
1002
+ $poll_archive_order = array();
1003
+ }if( trim( $poll_order ) <= 0 ) {
1004
+ $poll_order = 1;
1005
+ }
1006
+ $key = array_search( $poll, $poll_archive_order );
1007
+ if( $key !== false ) {
1008
+ unset( $poll_archive_order[$key] );
1009
+ }
1010
+ if( $poll_order > count( $poll_archive_order ) ) {
1011
+ array_push( $poll_archive_order, $poll );
1012
+ }
1013
+ else {
1014
+ array_splice( $poll_archive_order, trim( $poll_order ) - 1, 0, array( $poll ) );
1015
+ }
1016
+ update_option( 'yop_poll_archive_order', $poll_archive_order );
1017
  }
 
 
1018
 
1019
 
1020
+ }
inc/maintenance.php CHANGED
@@ -548,6 +548,10 @@ NOWDOC;
548
  }
549
  update_option( "yop_poll_version", YOP_POLL_VERSION );
550
  }
 
 
 
 
551
 
552
  }
553
  public function yop_poll_get_polls_for_body_mail_update(){
548
  }
549
  update_option( "yop_poll_version", YOP_POLL_VERSION );
550
  }
551
+ $installed_version = get_option( "yop_poll_version" );
552
+ if ( version_compare( $installed_version, '5.3', '<=' ) ){
553
+ update_option( "yop_poll_version", YOP_POLL_VERSION );
554
+ }
555
 
556
  }
557
  public function yop_poll_get_polls_for_body_mail_update(){
inc/plugin-functions.php CHANGED
@@ -180,7 +180,7 @@ function yop_poll_default_options() {
180
 
181
  'view_poll_archive_link' => 'no',
182
 
183
- 'auto_generate_poll_page' => 'yes',
184
 
185
  'has_auto_generate_poll_page' => 'no',
186
 
@@ -369,7 +369,7 @@ function yop_poll_poll_default_options() {
369
 
370
  'view_poll_archive_link' => 'no',
371
 
372
- 'auto_generate_poll_page' => 'yes',
373
 
374
  'has_auto_generate_poll_page' => 'no',
375
 
@@ -983,13 +983,13 @@ function xss_clean($data)
983
  }
984
  function yop_poll_ret_poll_by_votes_desc ($array){
985
  if(count($array)>0) {
986
- $sql = 'SELECT ID FROM ' . $GLOBALS['wpdb']->yop_polls . ' WHERE (ID='.$array[0].')';
987
 
988
  for( $i = 1; $i < count( $array ); $i ++ ) {
989
- $sql.='OR (ID= '. $array[$i]. ')';
990
  }
991
  $sql.=' ORDER BY poll_total_votes DESC ';
992
- return $GLOBALS['wpdb']->get_results( $sql, ARRAY_A );
993
  }
994
  }
995
  function yop_poll_sort_desc_database ($array){
@@ -1000,7 +1000,7 @@ function xss_clean($data)
1000
  $sql.='OR (ID= '. $array[$i]. ')';
1001
  }
1002
  $sql.=' ORDER BY ID DESC ';
1003
- return $GLOBALS['wpdb']->get_results( $sql, ARRAY_A );
1004
  }
1005
  }
1006
  function yop_poll_sort_asc_database ($array){
180
 
181
  'view_poll_archive_link' => 'no',
182
 
183
+ 'auto_generate_poll_page' => 'no',
184
 
185
  'has_auto_generate_poll_page' => 'no',
186
 
369
 
370
  'view_poll_archive_link' => 'no',
371
 
372
+ 'auto_generate_poll_page' => 'no',
373
 
374
  'has_auto_generate_poll_page' => 'no',
375
 
983
  }
984
  function yop_poll_ret_poll_by_votes_desc ($array){
985
  if(count($array)>0) {
986
+ $sql = 'SELECT ID, poll_total_votes FROM ' . $GLOBALS['wpdb']->yop_polls . ' WHERE (ID='.$array[0].')';
987
 
988
  for( $i = 1; $i < count( $array ); $i ++ ) {
989
+ $sql.=' OR (ID='. $array[$i]. ')';
990
  }
991
  $sql.=' ORDER BY poll_total_votes DESC ';
992
+ return $GLOBALS['wpdb']->get_results( $sql, ARRAY_A );
993
  }
994
  }
995
  function yop_poll_sort_desc_database ($array){
1000
  $sql.='OR (ID= '. $array[$i]. ')';
1001
  }
1002
  $sql.=' ORDER BY ID DESC ';
1003
+ return $GLOBALS['wpdb']->get_results( $sql, ARRAY_A );
1004
  }
1005
  }
1006
  function yop_poll_sort_asc_database ($array){
inc/poll_admin.php CHANGED
@@ -580,6 +580,9 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
580
  $current->email_notifications_recipients=$options['email_notifications_recipients'];
581
  $current->email_notifications_subject=$options['email_notifications_subject'];
582
  $current->email_notifications_body=$options['email_notifications_body'];
 
 
 
583
  }
584
  $data['current_poll'] = $current;
585
  if( 'edit' == $action_type ) {
@@ -676,6 +679,7 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
676
  $archive = get_option( 'yop_poll_archive_order', array() );
677
  if(($key = array_search($_REQUEST['id'], $archive)) !== false) {
678
  unset($archive[$key]);
 
679
  update_option( 'yop_poll_archive_order', $archive );
680
 
681
  }
@@ -689,6 +693,7 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
689
  $archive = get_option( 'yop_poll_archive_order', array() );
690
  if(($key = array_search($poll_id, $archive)) !== false) {
691
  unset($archive[$key]);
 
692
  update_option( 'yop_poll_archive_order', $archive );
693
  }
694
  }
@@ -739,11 +744,11 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
739
  global $wpdb, $current_user;
740
  $poll_details = self::get_poll_from_database_by_id( $poll_id );
741
  $clone_number = self::count_poll_from_database_like_name( $poll_details['poll_name'] . ' - clone' );
742
-
743
  $current_poll = new YOP_POLL_Poll_Model( $poll_id );
744
- $poll_clone = clone $current_poll;
745
- $poll_clone->poll_total_votes=0;
746
- $poll_clone->ID = NULL;
747
  if( $poll_details ) {
748
  $poll = array(
749
  'title' => $poll_details['poll_title'] . ' - clone' . ( 0 == $clone_number ? '' : $clone_number ),
@@ -751,7 +756,7 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
751
  'end_date' => $poll_details['poll_end_date'],
752
  'status' => $poll_details['poll_status'],
753
  'poll_date' => $poll_details['poll_date'],
754
- 'total_votes' => $poll_details['poll_total_votes'],
755
  'author' => $poll_details['poll_author'],
756
  'name' => $poll_details['poll_name'] . ' - clone' . ( 0 == $clone_number ? '' : $clone_number ),
757
  'type' => $poll_details['poll_type'],
@@ -760,20 +765,63 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
760
  $poll_clone->poll_name = $poll['name'];
761
  $poll_clone->poll_title = $poll['title'];
762
 
763
- foreach( $poll_clone->questions as &$question ) {
764
- $question->ID = NULL;
765
-
766
- foreach( $question->answers as &$answer ) {
767
- $answer->ID = NULL;
 
 
 
 
 
768
  }
769
  }
770
 
771
- // yop_poll_dump($poll_clone);
772
- $poll_clone->save();
 
773
 
774
  }
775
  }
776
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
777
  public static function get_poll_total_customfields_logs( $poll_id, $quest_id, $sdate = '', $edate = '' ) {
778
  global $wpdb;
779
  $sdatesql = '';
@@ -2243,7 +2291,7 @@ class YOP_POLL_Poll_Admin extends YOP_POLL_Abstract_Admin {
2243
  unset($answer_details);
2244
  }
2245
  if($cheked==0){
2246
- $message['error']= "You must select at least an answer!";
2247
  wp_die( json_encode( $message ) );
2248
  }
2249
  }
580
  $current->email_notifications_recipients=$options['email_notifications_recipients'];
581
  $current->email_notifications_subject=$options['email_notifications_subject'];
582
  $current->email_notifications_body=$options['email_notifications_body'];
583
+ $current->vote_permisions_wordpress_label=$options['vote_permisions_wordpress_label'];
584
+ $current->vote_permisions_anonymous_label=$options['vote_permisions_anonymous_label'];
585
+ $current->vote_button_label=$options['vote_button_label'];
586
  }
587
  $data['current_poll'] = $current;
588
  if( 'edit' == $action_type ) {
679
  $archive = get_option( 'yop_poll_archive_order', array() );
680
  if(($key = array_search($_REQUEST['id'], $archive)) !== false) {
681
  unset($archive[$key]);
682
+ $archive=array_values($archive);
683
  update_option( 'yop_poll_archive_order', $archive );
684
 
685
  }
693
  $archive = get_option( 'yop_poll_archive_order', array() );
694
  if(($key = array_search($poll_id, $archive)) !== false) {
695
  unset($archive[$key]);
696
+ $archive=array_values($archive);
697
  update_option( 'yop_poll_archive_order', $archive );
698
  }
699
  }
744
  global $wpdb, $current_user;
745
  $poll_details = self::get_poll_from_database_by_id( $poll_id );
746
  $clone_number = self::count_poll_from_database_like_name( $poll_details['poll_name'] . ' - clone' );
747
+ $meta = get_yop_poll_meta( $poll_id, 'options', true );
748
  $current_poll = new YOP_POLL_Poll_Model( $poll_id );
749
+ $current_poll->poll_total_votes=0;
750
+ $poll_clone =$current_poll;
751
+ $poll_clone->ID = 0;
752
  if( $poll_details ) {
753
  $poll = array(
754
  'title' => $poll_details['poll_title'] . ' - clone' . ( 0 == $clone_number ? '' : $clone_number ),
756
  'end_date' => $poll_details['poll_end_date'],
757
  'status' => $poll_details['poll_status'],
758
  'poll_date' => $poll_details['poll_date'],
759
+ 'poll_total_votes' => 0,
760
  'author' => $poll_details['poll_author'],
761
  'name' => $poll_details['poll_name'] . ' - clone' . ( 0 == $clone_number ? '' : $clone_number ),
762
  'type' => $poll_details['poll_type'],
765
  $poll_clone->poll_name = $poll['name'];
766
  $poll_clone->poll_title = $poll['title'];
767
 
768
+ foreach( $poll_clone->questions as $question ) {
769
+ $question->ID = 0;
770
+ foreach( $question->answers as $answer ) {
771
+ $answer->ID = 0;
772
+ }
773
+ if(isset($question->custom_fields))
774
+ foreach($question->custom_fields as $custom){
775
+ $custom->ID=0;
776
+ $custom->poll_id=0;
777
+ $custom->question_id=0;
778
  }
779
  }
780
 
781
+ $id_poll=$poll_clone->save();
782
+ self::save_poll_order($poll_clone,$poll_clone->poll_archive_order);
783
+ update_yop_poll_meta( $id_poll, 'options', $meta );
784
 
785
  }
786
  }
787
 
788
+ private static function save_poll_order( $poll, $poll_order ) {
789
+ $poll_archive_order = get_option( 'yop_poll_archive_order', array() );
790
+ if( $poll_archive_order == "" ) {
791
+ $poll_archive_order = array();
792
+ }
793
+ if( isset( $poll->show_poll_in_archive ) ) {
794
+ if( $poll->show_poll_in_archive == 'yes' ) {
795
+ if( isset( $poll_order ) && is_numeric( trim( $poll_order ) ) ) {
796
+ if( trim( $poll_order ) <= 0 ) {
797
+ $poll_order = 1;
798
+ }
799
+ $key = array_search( $poll->ID, $poll_archive_order );
800
+ if( $key !== false ) {
801
+ unset( $poll_archive_order[$key] );
802
+ }
803
+ if( $poll_order > count( $poll_archive_order ) ) {
804
+ array_push( $poll_archive_order, $poll->ID );
805
+ }
806
+ else {
807
+ array_splice( $poll_archive_order, trim( $poll_order ) - 1, 0, array( $poll->ID ) );
808
+ }
809
+
810
+ }
811
+
812
+ }
813
+ else {
814
+ $key = array_search( $poll->ID, $poll_archive_order );
815
+
816
+ if( $key !== null ) {
817
+ unset( $poll_archive_order[$key] );
818
+ }
819
+ }
820
+ }
821
+
822
+ $poll_archive_order = array_values( $poll_archive_order );
823
+ update_option( 'yop_poll_archive_order', $poll_archive_order );
824
+ }
825
  public static function get_poll_total_customfields_logs( $poll_id, $quest_id, $sdate = '', $edate = '' ) {
826
  global $wpdb;
827
  $sdatesql = '';
2291
  unset($answer_details);
2292
  }
2293
  if($cheked==0){
2294
+ $message['error']= "You must select at least one answer!";
2295
  wp_die( json_encode( $message ) );
2296
  }
2297
  }
inc/pro_admin.php CHANGED
@@ -168,9 +168,13 @@ class YOP_POLL_Pro_Admin extends YOP_POLL_Abstract_Admin {
168
  $pro_options = get_option( "yop_poll_pro" );
169
  $pro_options['rand_number'] = $rand_number;
170
  update_option( "yop_poll_pro", $pro_options );
 
 
171
  $redirect_url = urlencode( "https://yop-poll.com/yop-licence/upgrade.php?action=getPackageLink&domain=" .
172
  urlencode( $domain ) . "&rand=" .
173
- urlencode( $rand_number )."&redirect_after=". urlencode( add_query_arg( array(
 
 
174
  "page" => "yop-polls-become-pro",
175
  "action" => 'after-buy'
176
  ), admin_url( 'admin.php' ) ) )
@@ -178,7 +182,7 @@ class YOP_POLL_Pro_Admin extends YOP_POLL_Abstract_Admin {
178
  $paypalUrl = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7YBTNHDBFJBG6&return=" .
179
  "$redirect_url&rm=2&custom=" .
180
  urlencode( $domain . ";" .
181
- $rand_number
182
  ) . "";
183
  ;
184
 
168
  $pro_options = get_option( "yop_poll_pro" );
169
  $pro_options['rand_number'] = $rand_number;
170
  update_option( "yop_poll_pro", $pro_options );
171
+ $optin_box_modal_options = get_option( 'yop_poll_optin_box_modal_options_yop' );
172
+ $email=isset($optin_box_modal_options['modal_email'])?$optin_box_modal_options['modal_email']:"johndoe@email.com";
173
  $redirect_url = urlencode( "https://yop-poll.com/yop-licence/upgrade.php?action=getPackageLink&domain=" .
174
  urlencode( $domain ) . "&rand=" .
175
+ urlencode( $rand_number )."&yop_email=".
176
+ urlencode($email).
177
+ "&redirect_after=". urlencode( add_query_arg( array(
178
  "page" => "yop-polls-become-pro",
179
  "action" => 'after-buy'
180
  ), admin_url( 'admin.php' ) ) )
182
  $paypalUrl = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7YBTNHDBFJBG6&return=" .
183
  "$redirect_url&rm=2&custom=" .
184
  urlencode( $domain . ";" .
185
+ $rand_number. ";" .$email
186
  ) . "";
187
  ;
188
 
inc/public-admin.php CHANGED
@@ -169,17 +169,20 @@
169
  $temp = "";
170
 
171
  if($ok==1){
172
- for( $i = ( $args['current'] - 1 ) * $per_page; $i <= ( $args['current'] - 1 ) * $per_page + $per_page - 1; $i ++ ) {
173
- $temp .= $this->return_yop_poll( $archives[$i]['ID'], $results );
174
- }
 
175
  }else{
176
  for( $i = ( $args['current'] - 1 ) * $per_page; $i <= ( $args['current'] - 1 ) * $per_page + $per_page - 1; $i ++ ) {
 
177
  $temp .= $this->return_yop_poll( $archives[$i], $results );
178
- }
179
  }
180
  return $temp . paginate_links( $args );
181
 
182
 
 
183
  }
184
 
185
 
@@ -283,7 +286,7 @@
283
  'loading_image_src' => $loading_image_src,
284
  'loading_image_alt' => __yop_poll( 'Loading' ),
285
  );
286
-
287
  $tabulate['results']=false;
288
  $tabulate['answers']=false;
289
  $tabulate['orizontal_answers']=0;
169
  $temp = "";
170
 
171
  if($ok==1){
172
+ for( $i = ( $args['current'] - 1 ) * $per_page; $i <= ( $args['current'] - 1 ) * $per_page + $per_page - 1; $i ++ ) {
173
+ if(isset($archives[$i]['ID']))
174
+ $temp .= $this->return_yop_poll( $archives[$i]['ID'], $results );
175
+ }
176
  }else{
177
  for( $i = ( $args['current'] - 1 ) * $per_page; $i <= ( $args['current'] - 1 ) * $per_page + $per_page - 1; $i ++ ) {
178
+ if(isset($archives[$i]['ID']))
179
  $temp .= $this->return_yop_poll( $archives[$i], $results );
180
+ }
181
  }
182
  return $temp . paginate_links( $args );
183
 
184
 
185
+
186
  }
187
 
188
 
286
  'loading_image_src' => $loading_image_src,
287
  'loading_image_alt' => __yop_poll( 'Loading' ),
288
  );
289
+
290
  $tabulate['results']=false;
291
  $tabulate['answers']=false;
292
  $tabulate['orizontal_answers']=0;
js/bxslider/bower.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "bxslider-4",
3
+ "version": "4.1.2",
4
+ "homepage": "http://bxslider.com",
5
+ "license": "MIT",
6
+ "main": [
7
+ "jquery.bxslider.js",
8
+ "jquery.bxslider.css",
9
+ "images/bx_loader.gif",
10
+ "images/controls.png"
11
+ ],
12
+ "keywords": [
13
+ "bxslider",
14
+ "javascript",
15
+ "jquery",
16
+ "library"
17
+ ],
18
+ "ignore": [
19
+ "**/.*",
20
+ "*.md"
21
+ ],
22
+ "dependencies": {
23
+ "jquery": ">=1.6"
24
+ }
25
+ }
js/bxslider/images/bx_loader.gif ADDED
Binary file
js/bxslider/images/controls.png ADDED
Binary file
js/bxslider/jquery.bxslider.css ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * BxSlider v4.1.2 - Fully loaded, responsive content slider
3
+ * http://bxslider.com
4
+ *
5
+ * Written by: Steven Wanderski, 2014
6
+ * http://stevenwanderski.com
7
+ * (while drinking Belgian ales and listening to jazz)
8
+ *
9
+ * CEO and founder of bxCreative, LTD
10
+ * http://bxcreative.com
11
+ */
12
+
13
+
14
+ /** RESET AND LAYOUT
15
+ ===================================*/
16
+
17
+ .bx-wrapper {
18
+ position: relative;
19
+ margin: 0 auto 60px;
20
+ padding: 0;
21
+ *zoom: 1;
22
+ }
23
+
24
+ .bx-wrapper img {
25
+ max-width: 100%;
26
+ display: block;
27
+ margin-top:-14px;
28
+ }
29
+
30
+ /** THEME
31
+ ===================================*/
32
+
33
+ .bx-wrapper .bx-viewport {
34
+ -moz-box-shadow: 0 0 5px #ccc;
35
+ -webkit-box-shadow: 0 0 5px #ccc;
36
+ box-shadow: 0 0 5px #ccc;
37
+ border: 5px solid #fff;
38
+ left: -5px;
39
+ background: #fff;
40
+
41
+ /*fix other elements on the page moving (on Chrome)*/
42
+ -webkit-transform: translatez(0);
43
+ -moz-transform: translatez(0);
44
+ -ms-transform: translatez(0);
45
+ -o-transform: translatez(0);
46
+ transform: translatez(0);
47
+ }
48
+
49
+ .bx-wrapper .bx-pager,
50
+ .bx-wrapper .bx-controls-auto {
51
+ position: absolute;
52
+ bottom: -30px;
53
+ width: 100%;
54
+ }
55
+
56
+ /* LOADER */
57
+
58
+ .bx-wrapper .bx-loading {
59
+ min-height: 50px;
60
+ background: url(images/bx_loader.gif) center center no-repeat #fff;
61
+ height: 100%;
62
+ width: 100%;
63
+ position: absolute;
64
+ top: 0;
65
+ left: 0;
66
+ z-index: 2000;
67
+ }
68
+
69
+ /* PAGER */
70
+
71
+ .bx-wrapper .bx-pager {
72
+ text-align: center;
73
+ font-size: .85em;
74
+ font-family: Arial;
75
+ font-weight: bold;
76
+ color: #666;
77
+ padding-top: 20px;
78
+ }
79
+
80
+ .bx-wrapper .bx-pager .bx-pager-item,
81
+ .bx-wrapper .bx-controls-auto .bx-controls-auto-item {
82
+ display: inline-block;
83
+ *zoom: 1;
84
+ *display: inline;
85
+ }
86
+
87
+ .bx-wrapper .bx-pager.bx-default-pager a {
88
+ background: #666;
89
+ text-indent: -9999px;
90
+ display: block;
91
+ width: 10px;
92
+ height: 10px;
93
+ margin: 0 5px;
94
+ outline: 0;
95
+ -moz-border-radius: 5px;
96
+ -webkit-border-radius: 5px;
97
+ border-radius: 5px;
98
+ }
99
+
100
+ .bx-wrapper .bx-pager.bx-default-pager a:hover,
101
+ .bx-wrapper .bx-pager.bx-default-pager a.active {
102
+ background: #000;
103
+ }
104
+
105
+ /* DIRECTION CONTROLS (NEXT / PREV) */
106
+
107
+ .bx-wrapper .bx-prev {
108
+ left: 10px;
109
+ background: url(images/controls.png) no-repeat 0 -32px;
110
+ }
111
+
112
+ .bx-wrapper .bx-next {
113
+ right: 10px;
114
+ background: url(images/controls.png) no-repeat -43px -32px;
115
+ }
116
+
117
+ .bx-wrapper .bx-prev:hover {
118
+ background-position: 0 0;
119
+ }
120
+
121
+ .bx-wrapper .bx-next:hover {
122
+ background-position: -43px 0;
123
+ }
124
+
125
+ .bx-wrapper .bx-controls-direction a {
126
+ position: absolute;
127
+ top: 50%;
128
+ margin-top: -16px;
129
+ outline: 0;
130
+ width: 32px;
131
+ height: 32px;
132
+ text-indent: -9999px;
133
+ z-index: 9999;
134
+ }
135
+
136
+ .bx-wrapper .bx-controls-direction a.disabled {
137
+ display: none;
138
+ }
139
+
140
+ /* AUTO CONTROLS (START / STOP) */
141
+
142
+ .bx-wrapper .bx-controls-auto {
143
+ text-align: center;
144
+ }
145
+
146
+ .bx-wrapper .bx-controls-auto .bx-start {
147
+ display: block;
148
+ text-indent: -9999px;
149
+ width: 10px;
150
+ height: 11px;
151
+ outline: 0;
152
+ background: url(images/controls.png) -86px -11px no-repeat;
153
+ margin: 0 3px;
154
+ }
155
+
156
+ .bx-wrapper .bx-controls-auto .bx-start:hover,
157
+ .bx-wrapper .bx-controls-auto .bx-start.active {
158
+ background-position: -86px 0;
159
+ }
160
+
161
+ .bx-wrapper .bx-controls-auto .bx-stop {
162
+ display: block;
163
+ text-indent: -9999px;
164
+ width: 9px;
165
+ height: 11px;
166
+ outline: 0;
167
+ background: url(images/controls.png) -86px -44px no-repeat;
168
+ margin: 0 3px;
169
+ }
170
+
171
+ .bx-wrapper .bx-controls-auto .bx-stop:hover,
172
+ .bx-wrapper .bx-controls-auto .bx-stop.active {
173
+ background-position: -86px -33px;
174
+ }
175
+
176
+ /* PAGER WITH AUTO-CONTROLS HYBRID LAYOUT */
177
+
178
+ .bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager .bx-pager {
179
+ text-align: left;
180
+ width: 80%;
181
+ }
182
+
183
+ .bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager .bx-controls-auto {
184
+ right: 0;
185
+ width: 35px;
186
+ }
187
+
188
+ /* IMAGE CAPTIONS */
189
+
190
+ .bx-wrapper .bx-caption {
191
+ position: absolute;
192
+ bottom: 0;
193
+ left: 0;
194
+ background: #666\9;
195
+ background: rgba(80, 80, 80, 0.75);
196
+ width: 100%;
197
+ }
198
+
199
+ .bx-wrapper .bx-caption span {
200
+ color: #fff;
201
+ font-family: Arial;
202
+ display: block;
203
+ font-size: .85em;
204
+ padding: 10px;
205
+ }
js/bxslider/jquery.bxslider.js ADDED
@@ -0,0 +1,1349 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * BxSlider v4.1.2 - Fully loaded, responsive content slider
3
+ * http://bxslider.com
4
+ *
5
+ * Copyright 2014, Steven Wanderski - http://stevenwanderski.com - http://bxcreative.com
6
+ * Written while drinking Belgian ales and listening to jazz
7
+ *
8
+ * Released under the MIT license - http://opensource.org/licenses/MIT
9
+ */
10
+
11
+ ;(function($){
12
+
13
+ var plugin = {};
14
+
15
+ var defaults = {
16
+
17
+ // GENERAL
18
+ mode: 'horizontal',
19
+ slideSelector: '',
20
+ infiniteLoop: true,
21
+ hideControlOnEnd: false,
22
+ speed: 500,
23
+ easing: null,
24
+ slideMargin: 0,
25
+ startSlide: 0,
26
+ randomStart: false,
27
+ captions: false,
28
+ ticker: false,
29
+ tickerHover: false,
30
+ adaptiveHeight: false,
31
+ adaptiveHeightSpeed: 500,
32
+ video: false,
33
+ useCSS: true,
34
+ preloadImages: 'visible',
35
+ responsive: true,
36
+ slideZIndex: 50,
37
+ wrapperClass: 'bx-wrapper',
38
+
39
+ // TOUCH
40
+ touchEnabled: true,
41
+ swipeThreshold: 50,
42
+ oneToOneTouch: true,
43
+ preventDefaultSwipeX: true,
44
+ preventDefaultSwipeY: false,
45
+
46
+ // PAGER
47
+ pager: true,
48
+ pagerType: 'full',
49
+ pagerShortSeparator: ' / ',
50
+ pagerSelector: null,
51
+ buildPager: null,
52
+ pagerCustom: null,
53
+
54
+ // CONTROLS
55
+ controls: true,
56
+ nextText: 'Next',
57
+ prevText: 'Prev',
58
+ nextSelector: null,
59
+ prevSelector: null,
60
+ autoControls: false,
61
+ startText: 'Start',
62
+ stopText: 'Stop',
63
+ autoControlsCombine: false,
64
+ autoControlsSelector: null,
65
+
66
+ // AUTO
67
+ auto: true,
68
+ pause: 90000000,
69
+ autoStart: true,
70
+ autoDirection: 'next',
71
+ autoHover: false,
72
+ autoDelay: 0,
73
+ autoSlideForOnePage: false,
74
+
75
+ // CAROUSEL
76
+ minSlides: 1,
77
+ maxSlides: 1,
78
+ moveSlides: 0,
79
+ slideWidth: 0,
80
+
81
+ // CALLBACKS
82
+ onSliderLoad: function() {},
83
+ onSlideBefore: function() {},
84
+ onSlideAfter: function() {},
85
+ onSlideNext: function() {},
86
+ onSlidePrev: function() {},
87
+ onSliderResize: function() {}
88
+ }
89
+ $.fn.bxSlider = function(options){
90
+
91
+ if(this.length == 0) return this;
92
+
93
+ // support mutltiple elements
94
+ if(this.length > 1){
95
+ this.each(function(){$(this).bxSlider(options)});
96
+ return this;
97
+ }
98
+
99
+ // create a namespace to be used throughout the plugin
100
+ var slider = {};
101
+ // set a reference to our slider element
102
+ var el = this;
103
+ plugin.el = this;
104
+
105
+ /**
106
+ * Makes slideshow responsive
107
+ */
108
+ // first get the original window dimens (thanks alot IE)
109
+ var windowWidth = $(window).width();
110
+ var windowHeight = $(window).height();
111
+
112
+
113
+
114
+ /**
115
+ * ===================================================================================
116
+ * = PRIVATE FUNCTIONS
117
+ * ===================================================================================
118
+ */
119
+
120
+ /**
121
+ * Initializes namespace settings to be used throughout plugin
122
+ */
123
+ var init = function(){
124
+ // merge user-supplied options with the defaults
125
+ slider.settings = $.extend({}, defaults, options);
126
+ // parse slideWidth setting
127
+ slider.settings.slideWidth = parseInt(slider.settings.slideWidth);
128
+ // store the original children
129
+ slider.children = el.children(slider.settings.slideSelector);
130
+ // check if actual number of slides is less than minSlides / maxSlides
131
+ if(slider.children.length < slider.settings.minSlides) slider.settings.minSlides = slider.children.length;
132
+ if(slider.children.length < slider.settings.maxSlides) slider.settings.maxSlides = slider.children.length;
133
+ // if random start, set the startSlide setting to random number
134
+ if(slider.settings.randomStart) slider.settings.startSlide = Math.floor(Math.random() * slider.children.length);
135
+ // store active slide information
136
+ slider.active = { index: slider.settings.startSlide }
137
+ // store if the slider is in carousel mode (displaying / moving multiple slides)
138
+ slider.carousel = slider.settings.minSlides > 1 || slider.settings.maxSlides > 1;
139
+ // if carousel, force preloadImages = 'all'
140
+ if(slider.carousel) slider.settings.preloadImages = 'all';
141
+ // calculate the min / max width thresholds based on min / max number of slides
142
+ // used to setup and update carousel slides dimensions
143
+ slider.minThreshold = (slider.settings.minSlides * slider.settings.slideWidth) + ((slider.settings.minSlides - 1) * slider.settings.slideMargin);
144
+ slider.maxThreshold = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin);
145
+ // store the current state of the slider (if currently animating, working is true)
146
+ slider.working = false;
147
+ // initialize the controls object
148
+ slider.controls = {};
149
+ // initialize an auto interval
150
+ slider.interval = null;
151
+ // determine which property to use for transitions
152
+ slider.animProp = slider.settings.mode == 'vertical' ? 'top' : 'left';
153
+ // determine if hardware acceleration can be used
154
+ slider.usingCSS = slider.settings.useCSS && slider.settings.mode != 'fade' && (function(){
155
+ // create our test div element
156
+ var div = document.createElement('div');
157
+ // css transition properties
158
+ var props = ['WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
159
+ // test for each property
160
+ for(var i in props){
161
+ if(div.style[props[i]] !== undefined){
162
+ slider.cssPrefix = props[i].replace('Perspective', '').toLowerCase();
163
+ slider.animProp = '-' + slider.cssPrefix + '-transform';
164
+ return true;
165
+ }
166
+ }
167
+ return false;
168
+ }());
169
+ // if vertical mode always make maxSlides and minSlides equal
170
+ if(slider.settings.mode == 'vertical') slider.settings.maxSlides = slider.settings.minSlides;
171
+ // save original style data
172
+ el.data("origStyle", el.attr("style"));
173
+ el.children(slider.settings.slideSelector).each(function() {
174
+ $(this).data("origStyle", $(this).attr("style"));
175
+ });
176
+ // perform all DOM / CSS modifications
177
+ setup();
178
+ }
179
+
180
+ /**
181
+ * Performs all DOM and CSS modifications
182
+ */
183
+ var setup = function(){
184
+ // wrap el in a wrapper
185
+ el.wrap('<div class="' + slider.settings.wrapperClass + '"><div class="bx-viewport"></div></div>');
186
+ // store a namspace reference to .bx-viewport
187
+ slider.viewport = el.parent();
188
+ // add a loading div to display while images are loading
189
+ slider.loader = $('<div class="bx-loading" />');
190
+ slider.viewport.prepend(slider.loader);
191
+ // set el to a massive width, to hold any needed slides
192
+ // also strip any margin and padding from el
193
+ el.css({
194
+ width: slider.settings.mode == 'horizontal' ? (slider.children.length * 100 + 215) + '%' : 'auto',
195
+ position: 'relative'
196
+ });
197
+ // if using CSS, add the easing property
198
+ if(slider.usingCSS && slider.settings.easing){
199
+ el.css('-' + slider.cssPrefix + '-transition-timing-function', slider.settings.easing);
200
+ // if not using CSS and no easing value was supplied, use the default JS animation easing (swing)
201
+ }else if(!slider.settings.easing){
202
+ slider.settings.easing = 'swing';
203
+ }
204
+ var slidesShowing = getNumberSlidesShowing();
205
+ // make modifications to the viewport (.bx-viewport)
206
+ slider.viewport.css({
207
+ width: '100%',
208
+ overflow: 'hidden',
209
+ position: 'relative'
210
+ });
211
+ slider.viewport.parent().css({
212
+ maxWidth: getViewportMaxWidth()
213
+ });
214
+ // make modification to the wrapper (.bx-wrapper)
215
+ if(!slider.settings.pager) {
216
+ slider.viewport.parent().css({
217
+ margin: '0 auto 0px'
218
+ });
219
+ }
220
+ // apply css to all slider children
221
+ slider.children.css({
222
+ 'float': slider.settings.mode == 'horizontal' ? 'left' : 'none',
223
+ listStyle: 'none',
224
+ position: 'relative'
225
+ });
226
+ // apply the calculated width after the float is applied to prevent scrollbar interference
227
+ slider.children.css('width', getSlideWidth());
228
+ // if slideMargin is supplied, add the css
229
+ if(slider.settings.mode == 'horizontal' && slider.settings.slideMargin > 0) slider.children.css('marginRight', slider.settings.slideMargin);
230
+ if(slider.settings.mode == 'vertical' && slider.settings.slideMargin > 0) slider.children.css('marginBottom', slider.settings.slideMargin);
231
+ // if "fade" mode, add positioning and z-index CSS
232
+ if(slider.settings.mode == 'fade'){
233
+ slider.children.css({
234
+ position: 'absolute',
235
+ zIndex: 0,
236
+ display: 'none'
237
+ });
238
+ // prepare the z-index on the showing element
239
+ slider.children.eq(slider.settings.startSlide).css({zIndex: slider.settings.slideZIndex, display: 'block'});
240
+ }
241
+ // create an element to contain all slider controls (pager, start / stop, etc)
242
+ slider.controls.el = $('<div class="bx-controls" />');
243
+ // if captions are requested, add them
244
+ if(slider.settings.captions) appendCaptions();
245
+ // check if startSlide is last slide
246
+ slider.active.last = slider.settings.startSlide == getPagerQty() - 1;
247
+ // if video is true, set up the fitVids plugin
248
+ if(slider.settings.video) el.fitVids();
249
+ // set the default preload selector (visible)
250
+ var preloadSelector = slider.children.eq(slider.settings.startSlide);
251
+ if (slider.settings.preloadImages == "all") preloadSelector = slider.children;
252
+ // only check for control addition if not in "ticker" mode
253
+ if(!slider.settings.ticker){
254
+ // if pager is requested, add it
255
+ if(slider.settings.pager) appendPager();
256
+ // if controls are requested, add them
257
+ if(slider.settings.controls) appendControls();
258
+ // if auto is true, and auto controls are requested, add them
259
+ if(slider.settings.auto && slider.settings.autoControls) appendControlsAuto();
260
+ // if any control option is requested, add the controls wrapper
261
+ if(slider.settings.controls || slider.settings.autoControls || slider.settings.pager) slider.viewport.after(slider.controls.el);
262
+ // if ticker mode, do not allow a pager
263
+ }else{
264
+ slider.settings.pager = false;
265
+ }
266
+ // preload all images, then perform final DOM / CSS modifications that depend on images being loaded
267
+ loadElements(preloadSelector, start);
268
+ }
269
+
270
+ var loadElements = function(selector, callback){
271
+ var total = selector.find('img, iframe').length;
272
+ if (total == 0){
273
+ callback();
274
+ return;
275
+ }
276
+ var count = 0;
277
+ selector.find('img, iframe').each(function(){
278
+ $(this).one('load', function() {
279
+ if(++count == total) callback();
280
+ }).each(function() {
281
+ if(this.complete) $(this).load();
282
+ });
283
+ });
284
+ }
285
+
286
+ /**
287
+ * Start the slider
288
+ */
289
+ var start = function(){
290
+ // if infinite loop, prepare additional slides
291
+ if(slider.settings.infiniteLoop && slider.settings.mode != 'fade' && !slider.settings.ticker){
292
+ var slice = slider.settings.mode == 'vertical' ? slider.settings.minSlides : slider.settings.maxSlides;
293
+ var sliceAppend = slider.children.slice(0, slice).clone().addClass('bx-clone');
294
+ var slicePrepend = slider.children.slice(-slice).clone().addClass('bx-clone');
295
+ el.append(sliceAppend).prepend(slicePrepend);
296
+ }
297
+ // remove the loading DOM element
298
+ slider.loader.remove();
299
+ // set the left / top position of "el"
300
+ setSlidePosition();
301
+ // if "vertical" mode, always use adaptiveHeight to prevent odd behavior
302
+ if (slider.settings.mode == 'vertical') slider.settings.adaptiveHeight = true;
303
+ // set the viewport height
304
+ slider.viewport.height(getViewportHeight());
305
+ // make sure everything is positioned just right (same as a window resize)
306
+ el.redrawSlider();
307
+ // onSliderLoad callback
308
+ slider.settings.onSliderLoad(slider.active.index);
309
+ // slider has been fully initialized
310
+ slider.initialized = true;
311
+ // bind the resize call to the window
312
+ if (slider.settings.responsive) $(window).bind('resize', resizeWindow);
313
+ // if auto is true and has more than 1 page, start the show
314
+ if (slider.settings.auto && slider.settings.autoStart && (getPagerQty() > 1 || slider.settings.autoSlideForOnePage)) initAuto();
315
+ // if ticker is true, start the ticker
316
+ if (slider.settings.ticker) initTicker();
317
+ // if pager is requested, make the appropriate pager link active
318
+ if (slider.settings.pager) updatePagerActive(slider.settings.startSlide);
319
+ // check for any updates to the controls (like hideControlOnEnd updates)
320
+ if (slider.settings.controls) updateDirectionControls();
321
+ // if touchEnabled is true, setup the touch events
322
+ if (slider.settings.touchEnabled && !slider.settings.ticker) initTouch();
323
+ }
324
+
325
+ /**
326
+ * Returns the calculated height of the viewport, used to determine either adaptiveHeight or the maxHeight value
327
+ */
328
+ var getViewportHeight = function(){
329
+ var height = 0;
330
+ // first determine which children (slides) should be used in our height calculation
331
+ var children = $();
332
+ // if mode is not "vertical" and adaptiveHeight is false, include all children
333
+ if(slider.settings.mode != 'vertical' && !slider.settings.adaptiveHeight){
334
+ children = slider.children;
335
+ }else{
336
+ // if not carousel, return the single active child
337
+ if(!slider.carousel){
338
+ children = slider.children.eq(slider.active.index);
339
+ // if carousel, return a slice of children
340
+ }else{
341
+ // get the individual slide index
342
+ var currentIndex = slider.settings.moveSlides == 1 ? slider.active.index : slider.active.index * getMoveBy();
343
+ // add the current slide to the children
344
+ children = slider.children.eq(currentIndex);
345
+ // cycle through the remaining "showing" slides
346
+ for (i = 1; i <= slider.settings.maxSlides - 1; i++){
347
+ // if looped back to the start
348
+ if(currentIndex + i >= slider.children.length){
349
+ children = children.add(slider.children.eq(i - 1));
350
+ }else{
351
+ children = children.add(slider.children.eq(currentIndex + i));
352
+ }
353
+ }
354
+ }
355
+ }
356
+ // if "vertical" mode, calculate the sum of the heights of the children
357
+ if(slider.settings.mode == 'vertical'){
358
+ children.each(function(index) {
359
+ height += $(this).outerHeight();
360
+ });
361
+ // add user-supplied margins
362
+ if(slider.settings.slideMargin > 0){
363
+ height += slider.settings.slideMargin * (slider.settings.minSlides - 1);
364
+ }
365
+ // if not "vertical" mode, calculate the max height of the children
366
+ }else{
367
+ height = Math.max.apply(Math, children.map(function(){
368
+ return $(this).outerHeight(false);
369
+ }).get());
370
+ }
371
+
372
+ if(slider.viewport.css('box-sizing') == 'border-box'){
373
+ height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom')) +
374
+ parseFloat(slider.viewport.css('border-top-width')) + parseFloat(slider.viewport.css('border-bottom-width'));
375
+ }else if(slider.viewport.css('box-sizing') == 'padding-box'){
376
+ height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom'));
377
+ }
378
+
379
+ return height;
380
+ }
381
+
382
+ /**
383
+ * Returns the calculated width to be used for the outer wrapper / viewport
384
+ */
385
+ var getViewportMaxWidth = function(){
386
+ var width = '100%';
387
+ if(slider.settings.slideWidth > 0){
388
+ if(slider.settings.mode == 'horizontal'){
389
+ width = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin);
390
+ }else{
391
+ width = slider.settings.slideWidth;
392
+ }
393
+ }
394
+ return width;
395
+ }
396
+
397
+ /**
398
+ * Returns the calculated width to be applied to each slide
399
+ */
400
+ var getSlideWidth = function(){
401
+ // start with any user-supplied slide width
402
+ var newElWidth = slider.settings.slideWidth;
403
+ // get the current viewport width
404
+ var wrapWidth = slider.viewport.width();
405
+ // if slide width was not supplied, or is larger than the viewport use the viewport width
406
+ if(slider.settings.slideWidth == 0 ||
407
+ (slider.settings.slideWidth > wrapWidth && !slider.carousel) ||
408
+ slider.settings.mode == 'vertical'){
409
+ newElWidth = wrapWidth;
410
+ // if carousel, use the thresholds to determine the width
411
+ }else if(slider.settings.maxSlides > 1 && slider.settings.mode == 'horizontal'){
412
+ if(wrapWidth > slider.maxThreshold){
413
+ // newElWidth = (wrapWidth - (slider.settings.slideMargin * (slider.settings.maxSlides - 1))) / slider.settings.maxSlides;
414
+ }else if(wrapWidth < slider.minThreshold){
415
+ newElWidth = (wrapWidth - (slider.settings.slideMargin * (slider.settings.minSlides - 1))) / slider.settings.minSlides;
416
+ }
417
+ }
418
+ //alert(newElWidth);
419
+ return newElWidth;
420
+ }
421
+
422
+ /**
423
+ * Returns the number of slides currently visible in the viewport (includes partially visible slides)
424
+ */
425
+ var getNumberSlidesShowing = function(){
426
+ var slidesShowing = 1;
427
+ if(slider.settings.mode == 'horizontal' && slider.settings.slideWidth > 0){
428
+ // if viewport is smaller than minThreshold, return minSlides
429
+ if(slider.viewport.width() < slider.minThreshold){
430
+ slidesShowing = slider.settings.minSlides;
431
+ // if viewport is larger than minThreshold, return maxSlides
432
+ }else if(slider.viewport.width() > slider.maxThreshold){
433
+ slidesShowing = slider.settings.maxSlides;
434
+ // if viewport is between min / max thresholds, divide viewport width by first child width
435
+ }else{
436
+ var childWidth = slider.children.first().width() + slider.settings.slideMargin;
437
+ slidesShowing = Math.floor((slider.viewport.width() +
438
+ slider.settings.slideMargin) / childWidth);
439
+ }
440
+ // if "vertical" mode, slides showing will always be minSlides
441
+ }else if(slider.settings.mode == 'vertical'){
442
+ slidesShowing = slider.settings.minSlides;
443
+ }
444
+ return slidesShowing;
445
+ }
446
+
447
+ /**
448
+ * Returns the number of pages (one full viewport of slides is one "page")
449
+ */
450
+ var getPagerQty = function(){
451
+ var pagerQty = 0;
452
+ // if moveSlides is specified by the user
453
+ if(slider.settings.moveSlides > 0){
454
+ if(slider.settings.infiniteLoop){
455
+ pagerQty = Math.ceil(slider.children.length / getMoveBy());
456
+ }else{
457
+ // use a while loop to determine pages
458
+ var breakPoint = 0;
459
+ var counter = 0
460
+ // when breakpoint goes above children length, counter is the number of pages
461
+ while (breakPoint < slider.children.length){
462
+ ++pagerQty;
463
+ breakPoint = counter + getNumberSlidesShowing();
464
+ counter += slider.settings.moveSlides <= getNumberSlidesShowing() ? slider.settings.moveSlides : getNumberSlidesShowing();
465
+ }
466
+ }
467
+ // if moveSlides is 0 (auto) divide children length by sides showing, then round up
468
+ }else{
469
+ pagerQty = Math.ceil(slider.children.length / getNumberSlidesShowing());
470
+ }
471
+ return pagerQty;
472
+ }
473
+
474
+ /**
475
+ * Returns the number of indivual slides by which to shift the slider
476
+ */
477
+ var getMoveBy = function(){
478
+ // if moveSlides was set by the user and moveSlides is less than number of slides showing
479
+ if(slider.settings.moveSlides > 0 && slider.settings.moveSlides <= getNumberSlidesShowing()){
480
+ return slider.settings.moveSlides;
481
+ }
482
+ // if moveSlides is 0 (auto)
483
+ return getNumberSlidesShowing();
484
+ }
485
+
486
+ /**
487
+ * Sets the slider's (el) left or top position
488
+ */
489
+ var setSlidePosition = function(){
490
+ // if last slide, not infinite loop, and number of children is larger than specified maxSlides
491
+ if(slider.children.length > slider.settings.maxSlides && slider.active.last && !slider.settings.infiniteLoop){
492
+ if (slider.settings.mode == 'horizontal'){
493
+ // get the last child's position
494
+ var lastChild = slider.children.last();
495
+ var position = lastChild.position();
496
+ // set the left position
497
+ setPositionProperty(-(position.left - (slider.viewport.width() - lastChild.outerWidth())), 'reset', 0);
498
+ }else if(slider.settings.mode == 'vertical'){
499
+ // get the last showing index's position
500
+ var lastShowingIndex = slider.children.length - slider.settings.minSlides;
501
+ var position = slider.children.eq(lastShowingIndex).position();
502
+ // set the top position
503
+ setPositionProperty(-position.top, 'reset', 0);
504
+ }
505
+ // if not last slide
506
+ }else{
507
+ // get the position of the first showing slide
508
+ var position = slider.children.eq(slider.active.index * getMoveBy()).position();
509
+ // check for last slide
510
+ if (slider.active.index == getPagerQty() - 1) slider.active.last = true;
511
+ // set the repective position
512
+ if (position != undefined){
513
+ if (slider.settings.mode == 'horizontal') setPositionProperty(-position.left, 'reset', 0);
514
+ else if (slider.settings.mode == 'vertical') setPositionProperty(-position.top, 'reset', 0);
515
+ }
516
+ }
517
+ }
518
+
519
+ /**
520
+ * Sets the el's animating property position (which in turn will sometimes animate el).
521
+ * If using CSS, sets the transform property. If not using CSS, sets the top / left property.
522
+ *
523
+ * @param value (int)
524
+ * - the animating property's value
525
+ *
526
+ * @param type (string) 'slider', 'reset', 'ticker'
527
+ * - the type of instance for which the function is being
528
+ *
529
+ * @param duration (int)
530
+ * - the amount of time (in ms) the transition should occupy
531
+ *
532
+ * @param params (array) optional
533
+ * - an optional parameter containing any variables that need to be passed in
534
+ */
535
+ var setPositionProperty = function(value, type, duration, params){
536
+ // use CSS transform
537
+ if(slider.usingCSS){
538
+ // determine the translate3d value
539
+ var propValue = slider.settings.mode == 'vertical' ? 'translate3d(0, ' + value + 'px, 0)' : 'translate3d(' + value + 'px, 0, 0)';
540
+ // add the CSS transition-duration
541
+ el.css('-' + slider.cssPrefix + '-transition-duration', duration / 1000 + 's');
542
+ if(type == 'slide'){
543
+ // set the property value
544
+ el.css(slider.animProp, propValue);
545
+ // bind a callback method - executes when CSS transition completes
546
+ el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(){
547
+ // unbind the callback
548
+ el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
549
+ updateAfterSlideTransition();
550
+ });
551
+ }else if(type == 'reset'){
552
+ el.css(slider.animProp, propValue);
553
+ }else if(type == 'ticker'){
554
+ // make the transition use 'linear'
555
+ el.css('-' + slider.cssPrefix + '-transition-timing-function', 'linear');
556
+ el.css(slider.animProp, propValue);
557
+ // bind a callback method - executes when CSS transition completes
558
+ el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(){
559
+ // unbind the callback
560
+ el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
561
+ // reset the position
562
+ setPositionProperty(params['resetValue'], 'reset', 0);
563
+ // start the loop again
564
+ tickerLoop();
565
+ });
566
+ }
567
+ // use JS animate
568
+ }else{
569
+ var animateObj = {};
570
+ animateObj[slider.animProp] = value;
571
+ if(type == 'slide'){
572
+ el.animate(animateObj, duration, slider.settings.easing, function(){
573
+ updateAfterSlideTransition();
574
+ });
575
+ }else if(type == 'reset'){
576
+ el.css(slider.animProp, value)
577
+ }else if(type == 'ticker'){
578
+ el.animate(animateObj, speed, 'linear', function(){
579
+ setPositionProperty(params['resetValue'], 'reset', 0);
580
+ // run the recursive loop after animation
581
+ tickerLoop();
582
+ });
583
+ }
584
+ }
585
+ }
586
+
587
+ /**
588
+ * Populates the pager with proper amount of pages
589
+ */
590
+ var populatePager = function(){
591
+ var pagerHtml = '';
592
+ var pagerQty = getPagerQty();
593
+ // loop through each pager item
594
+ for(var i=0; i < pagerQty; i++){
595
+ var linkContent = '';
596
+ // if a buildPager function is supplied, use it to get pager link value, else use index + 1
597
+ if(slider.settings.buildPager && $.isFunction(slider.settings.buildPager)){
598
+ linkContent = slider.settings.buildPager(i);
599
+ slider.pagerEl.addClass('bx-custom-pager');
600
+ }else{
601
+ linkContent = i + 1;
602
+ slider.pagerEl.addClass('bx-default-pager');
603
+ }
604
+ // var linkContent = slider.settings.buildPager && $.isFunction(slider.settings.buildPager) ? slider.settings.buildPager(i) : i + 1;
605
+ // add the markup to the string
606
+ pagerHtml += '<div class="bx-pager-item"><a href="" data-slide-index="' + i + '" class="bx-pager-link">' + linkContent + '</a></div>';
607
+ };
608
+ // populate the pager element with pager links
609
+ slider.pagerEl.html(pagerHtml);
610
+ }
611
+
612
+ /**
613
+ * Appends the pager to the controls element
614
+ */
615
+ var appendPager = function(){
616
+ if(!slider.settings.pagerCustom){
617
+ // create the pager DOM element
618
+ slider.pagerEl = $('<div class="bx-pager" />');
619
+ // if a pager selector was supplied, populate it with the pager
620
+ if(slider.settings.pagerSelector){
621
+ $(slider.settings.pagerSelector).html(slider.pagerEl);
622
+ // if no pager selector was supplied, add it after the wrapper
623
+ }else{
624
+ slider.controls.el.addClass('bx-has-pager').append(slider.pagerEl);
625
+ }
626
+ // populate the pager
627
+ populatePager();
628
+ }else{
629
+ slider.pagerEl = $(slider.settings.pagerCustom);
630
+ }
631
+ // assign the pager click binding
632
+ slider.pagerEl.on('click', 'a', clickPagerBind);
633
+ }
634
+
635
+ /**
636
+ * Appends prev / next controls to the controls element
637
+ */
638
+ var appendControls = function(){
639
+ slider.controls.next = $('<a class="bx-next" href="">' + slider.settings.nextText + '</a>');
640
+ slider.controls.prev = $('<a class="bx-prev" href="">' + slider.settings.prevText + '</a>');
641
+ // bind click actions to the controls
642
+ slider.controls.next.bind('click', clickNextBind);
643
+ slider.controls.prev.bind('click', clickPrevBind);
644
+ // if nextSlector was supplied, populate it
645
+ if(slider.settings.nextSelector){
646
+ $(slider.settings.nextSelector).append(slider.controls.next);
647
+ }
648
+ // if prevSlector was supplied, populate it
649
+ if(slider.settings.prevSelector){
650
+ $(slider.settings.prevSelector).append(slider.controls.prev);
651
+ }
652
+ // if no custom selectors were supplied
653
+ if(!slider.settings.nextSelector && !slider.settings.prevSelector){
654
+ // add the controls to the DOM
655
+ slider.controls.directionEl = $('<div class="bx-controls-direction" />');
656
+ // add the control elements to the directionEl
657
+ slider.controls.directionEl.append(slider.controls.prev).append(slider.controls.next);
658
+ // slider.viewport.append(slider.controls.directionEl);
659
+ slider.controls.el.addClass('bx-has-controls-direction').append(slider.controls.directionEl);
660
+ }
661
+ }
662
+
663
+ /**
664
+ * Appends start / stop auto controls to the controls element
665
+ */
666
+ var appendControlsAuto = function(){
667
+ slider.controls.start = $('<div class="bx-controls-auto-item"><a class="bx-start" href="">' + slider.settings.startText + '</a></div>');
668
+ slider.controls.stop = $('<div class="bx-controls-auto-item"><a class="bx-stop" href="">' + slider.settings.stopText + '</a></div>');
669
+ // add the controls to the DOM
670
+ slider.controls.autoEl = $('<div class="bx-controls-auto" />');
671
+ // bind click actions to the controls
672
+ slider.controls.autoEl.on('click', '.bx-start', clickStartBind);
673
+ slider.controls.autoEl.on('click', '.bx-stop', clickStopBind);
674
+ // if autoControlsCombine, insert only the "start" control
675
+ if(slider.settings.autoControlsCombine){
676
+ slider.controls.autoEl.append(slider.controls.start);
677
+ // if autoControlsCombine is false, insert both controls
678
+ }else{
679
+ slider.controls.autoEl.append(slider.controls.start).append(slider.controls.stop);
680
+ }
681
+ // if auto controls selector was supplied, populate it with the controls
682
+ if(slider.settings.autoControlsSelector){
683
+ $(slider.settings.autoControlsSelector).html(slider.controls.autoEl);
684
+ // if auto controls selector was not supplied, add it after the wrapper
685
+ }else{
686
+ slider.controls.el.addClass('bx-has-controls-auto').append(slider.controls.autoEl);
687
+ }
688
+ // update the auto controls
689
+ updateAutoControls(slider.settings.autoStart ? 'stop' : 'start');
690
+ }
691
+
692
+ /**
693
+ * Appends image captions to the DOM
694
+ */
695
+ var appendCaptions = function(){
696
+ // cycle through each child
697
+ slider.children.each(function(index){
698
+ // get the image title attribute
699
+ var title = $(this).find('img:first').attr('title');
700
+ // append the caption
701
+ if (title != undefined && ('' + title).length) {
702
+ $(this).append('<div class="bx-caption"><span>' + title + '</span></div>');
703
+ }
704
+ });
705
+ }
706
+
707
+ /**
708
+ * Click next binding
709
+ *
710
+ * @param e (event)
711
+ * - DOM event object
712
+ */
713
+ var clickNextBind = function(e){
714
+ // if auto show is running, stop it
715
+ if (slider.settings.auto) el.stopAuto();
716
+ el.goToNextSlide();
717
+ e.preventDefault();
718
+ }
719
+
720
+ /**
721
+ * Click prev binding
722
+ *
723
+ * @param e (event)
724
+ * - DOM event object
725
+ */
726
+ var clickPrevBind = function(e){
727
+ // if auto show is running, stop it
728
+ if (slider.settings.auto) el.stopAuto();
729
+ el.goToPrevSlide();
730
+ e.preventDefault();
731
+ }
732
+
733
+ /**
734
+ * Click start binding
735
+ *
736
+ * @param e (event)
737
+ * - DOM event object
738
+ */
739
+ var clickStartBind = function(e){
740
+ el.startAuto();
741
+ e.preventDefault();
742
+ }
743
+
744
+ $(document).click('.bx-next, .bx-prev',function() {
745
+ // slider.stopAuto();
746
+ el.startAuto();
747
+
748
+ });
749
+ /**
750
+ * Click stop binding
751
+ *
752
+ * @param e (event)
753
+ * - DOM event object
754
+ */
755
+ var clickStopBind = function(e){
756
+ el.stopAuto();
757
+ e.preventDefault();
758
+ }
759
+
760
+ /**
761
+ * Click pager binding
762
+ *
763
+ * @param e (event)
764
+ * - DOM event object
765
+ */
766
+ var clickPagerBind = function(e){
767
+ // if auto show is running, stop it
768
+ if (slider.settings.auto) el.stopAuto();
769
+ var pagerLink = $(e.currentTarget);
770
+ if(pagerLink.attr('data-slide-index') !== undefined){
771
+ var pagerIndex = parseInt(pagerLink.attr('data-slide-index'));
772
+ // if clicked pager link is not active, continue with the goToSlide call
773
+ if(pagerIndex != slider.active.index) el.goToSlide(pagerIndex);
774
+ e.preventDefault();
775
+ }
776
+ }
777
+
778
+ /**
779
+ * Updates the pager links with an active class
780
+ *
781
+ * @param slideIndex (int)
782
+ * - index of slide to make active
783
+ */
784
+ var updatePagerActive = function(slideIndex){
785
+ // if "short" pager type
786
+ var len = slider.children.length; // nb of children
787
+ if(slider.settings.pagerType == 'short'){
788
+ if(slider.settings.maxSlides > 1) {
789
+ len = Math.ceil(slider.children.length/slider.settings.maxSlides);
790
+ }
791
+ slider.pagerEl.html( (slideIndex + 1) + slider.settings.pagerShortSeparator + len);
792
+ return;
793
+ }
794
+ // remove all pager active classes
795
+ slider.pagerEl.find('a').removeClass('active');
796
+ // apply the active class for all pagers
797
+ slider.pagerEl.each(function(i, el) { $(el).find('a').eq(slideIndex).addClass('active'); });
798
+ }
799
+
800
+ /**
801
+ * Performs needed actions after a slide transition
802
+ */
803
+ var updateAfterSlideTransition = function(){
804
+ // if infinte loop is true
805
+ if(slider.settings.infiniteLoop){
806
+ var position = '';
807
+ // first slide
808
+ if(slider.active.index == 0){
809
+ // set the new position
810
+ position = slider.children.eq(0).position();
811
+ // carousel, last slide
812
+ }else if(slider.active.index == getPagerQty() - 1 && slider.carousel){
813
+ position = slider.children.eq((getPagerQty() - 1) * getMoveBy()).position();
814
+ // last slide
815
+ }else if(slider.active.index == slider.children.length - 1){
816
+ position = slider.children.eq(slider.children.length - 1).position();
817
+ }
818
+ if(position){
819
+ if (slider.settings.mode == 'horizontal') { setPositionProperty(-position.left, 'reset', 0); }
820
+ else if (slider.settings.mode == 'vertical') { setPositionProperty(-position.top, 'reset', 0); }
821
+ }
822
+ }
823
+ // declare that the transition is complete
824
+ slider.working = false;
825
+ // onSlideAfter callback
826
+ slider.settings.onSlideAfter(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
827
+ }
828
+
829
+ /**
830
+ * Updates the auto controls state (either active, or combined switch)
831
+ *
832
+ * @param state (string) "start", "stop"
833
+ * - the new state of the auto show
834
+ */
835
+ var updateAutoControls = function(state){
836
+ // if autoControlsCombine is true, replace the current control with the new state
837
+ if(slider.settings.autoControlsCombine){
838
+ slider.controls.autoEl.html(slider.controls[state]);
839
+ // if autoControlsCombine is false, apply the "active" class to the appropriate control
840
+ }else{
841
+ slider.controls.autoEl.find('a').removeClass('active');
842
+ slider.controls.autoEl.find('a:not(.bx-' + state + ')').addClass('active');
843
+ }
844
+ }
845
+
846
+ /**
847
+ * Updates the direction controls (checks if either should be hidden)
848
+ */
849
+ var updateDirectionControls = function(){
850
+ if(getPagerQty() == 1){
851
+ slider.controls.prev.addClass('disabled');
852
+ slider.controls.next.addClass('disabled');
853
+ }else if(!slider.settings.infiniteLoop && slider.settings.hideControlOnEnd){
854
+ // if first slide
855
+ if (slider.active.index == 0){
856
+ slider.controls.prev.addClass('disabled');
857
+ slider.controls.next.removeClass('disabled');
858
+ // if last slide
859
+ }else if(slider.active.index == getPagerQty() - 1){
860
+ slider.controls.next.addClass('disabled');
861
+ slider.controls.prev.removeClass('disabled');
862
+ // if any slide in the middle
863
+ }else{
864
+ slider.controls.prev.removeClass('disabled');
865
+ slider.controls.next.removeClass('disabled');
866
+ }
867
+ }
868
+ }
869
+
870
+ /**
871
+ * Initialzes the auto process
872
+ */
873
+ var initAuto = function(){
874
+ // if autoDelay was supplied, launch the auto show using a setTimeout() call
875
+ if(slider.settings.autoDelay > 0){
876
+ var timeout = setTimeout(el.startAuto, slider.settings.autoDelay);
877
+ // if autoDelay was not supplied, start the auto show normally
878
+ }else{
879
+ el.startAuto();
880
+ }
881
+ // if autoHover is requested
882
+ if(slider.settings.autoHover){
883
+ // on el hover
884
+ el.hover(function(){
885
+ // if the auto show is currently playing (has an active interval)
886
+ if(slider.interval){
887
+ // stop the auto show and pass true agument which will prevent control update
888
+ el.stopAuto(true);
889
+ // create a new autoPaused value which will be used by the relative "mouseout" event
890
+ slider.autoPaused = true;
891
+ }
892
+ }, function(){
893
+ // if the autoPaused value was created be the prior "mouseover" event
894
+ if(slider.autoPaused){
895
+ // start the auto show and pass true agument which will prevent control update
896
+ el.startAuto(true);
897
+ // reset the autoPaused value
898
+ slider.autoPaused = null;
899
+ }
900
+ });
901
+ }
902
+ }
903
+
904
+ /**
905
+ * Initialzes the ticker process
906
+ */
907
+ var initTicker = function(){
908
+ var startPosition = 0;
909
+ // if autoDirection is "next", append a clone of the entire slider
910
+ if(slider.settings.autoDirection == 'next'){
911
+ el.append(slider.children.clone().addClass('bx-clone'));
912
+ // if autoDirection is "prev", prepend a clone of the entire slider, and set the left position
913
+ }else{
914
+ el.prepend(slider.children.clone().addClass('bx-clone'));
915
+ var position = slider.children.first().position();
916
+ startPosition = slider.settings.mode == 'horizontal' ? -position.left : -position.top;
917
+ }
918
+ setPositionProperty(startPosition, 'reset', 0);
919
+ // do not allow controls in ticker mode
920
+ slider.settings.pager = false;
921
+ slider.settings.controls = false;
922
+ slider.settings.autoControls = false;
923
+ // if autoHover is requested
924
+ if(slider.settings.tickerHover && !slider.usingCSS){
925
+ // on el hover
926
+ slider.viewport.hover(function(){
927
+ el.stop();
928
+ }, function(){
929
+ // calculate the total width of children (used to calculate the speed ratio)
930
+ var totalDimens = 0;
931
+ slider.children.each(function(index){
932
+ totalDimens += slider.settings.mode == 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true);
933
+ });
934
+ // calculate the speed ratio (used to determine the new speed to finish the paused animation)
935
+ var ratio = slider.settings.speed / totalDimens;
936
+ // determine which property to use
937
+ var property = slider.settings.mode == 'horizontal' ? 'left' : 'top';
938
+ // calculate the new speed
939
+ var newSpeed = ratio * (totalDimens - (Math.abs(parseInt(el.css(property)))));
940
+ tickerLoop(newSpeed);
941
+ });
942
+ }
943
+ // start the ticker loop
944
+ tickerLoop();
945
+ }
946
+
947
+ /**
948
+ * Runs a continuous loop, news ticker-style
949
+ */
950
+ var tickerLoop = function(resumeSpeed){
951
+ speed = resumeSpeed ? resumeSpeed : slider.settings.speed;
952
+ var position = {left: 0, top: 0};
953
+ var reset = {left: 0, top: 0};
954
+ // if "next" animate left position to last child, then reset left to 0
955
+ if(slider.settings.autoDirection == 'next'){
956
+ position = el.find('.bx-clone').first().position();
957
+ // if "prev" animate left position to 0, then reset left to first non-clone child
958
+ }else{
959
+ reset = slider.children.first().position();
960
+ }
961
+ var animateProperty = slider.settings.mode == 'horizontal' ? -position.left : -position.top;
962
+ var resetValue = slider.settings.mode == 'horizontal' ? -reset.left : -reset.top;
963
+ var params = {resetValue: resetValue};
964
+ setPositionProperty(animateProperty, 'ticker', speed, params);
965
+ }
966
+
967
+ /**
968
+ * Initializes touch events
969
+ */
970
+ var initTouch = function(){
971
+ // initialize object to contain all touch values
972
+ slider.touch = {
973
+ start: {x: 0, y: 0},
974
+ end: {x: 0, y: 0}
975
+ }
976
+ slider.viewport.bind('touchstart', onTouchStart);
977
+ }
978
+
979
+ /**
980
+ * Event handler for "touchstart"
981
+ *
982
+ * @param e (event)
983
+ * - DOM event object
984
+ */
985
+ var onTouchStart = function(e){
986
+ if(slider.working){
987
+ e.preventDefault();
988
+ }else{
989
+ // record the original position when touch starts
990
+ slider.touch.originalPos = el.position();
991
+ var orig = e.originalEvent;
992
+ // record the starting touch x, y coordinates
993
+ slider.touch.start.x = orig.changedTouches[0].pageX;
994
+ slider.touch.start.y = orig.changedTouches[0].pageY;
995
+ // bind a "touchmove" event to the viewport
996
+ slider.viewport.bind('touchmove', onTouchMove);
997
+ // bind a "touchend" event to the viewport
998
+ slider.viewport.bind('touchend', onTouchEnd);
999
+ }
1000
+ }
1001
+
1002
+ /**
1003
+ * Event handler for "touchmove"
1004
+ *
1005
+ * @param e (event)
1006
+ * - DOM event object
1007
+ */
1008
+ var onTouchMove = function(e){
1009
+ var orig = e.originalEvent;
1010
+ // if scrolling on y axis, do not prevent default
1011
+ var xMovement = Math.abs(orig.changedTouches[0].pageX - slider.touch.start.x);
1012
+ var yMovement = Math.abs(orig.changedTouches[0].pageY - slider.touch.start.y);
1013
+ // x axis swipe
1014
+ if((xMovement * 3) > yMovement && slider.settings.preventDefaultSwipeX){
1015
+ e.preventDefault();
1016
+ // y axis swipe
1017
+ }else if((yMovement * 3) > xMovement && slider.settings.preventDefaultSwipeY){
1018
+ e.preventDefault();
1019
+ }
1020
+ if(slider.settings.mode != 'fade' && slider.settings.oneToOneTouch){
1021
+ var value = 0;
1022
+ // if horizontal, drag along x axis
1023
+ if(slider.settings.mode == 'horizontal'){
1024
+ var change = orig.changedTouches[0].pageX - slider.touch.start.x;
1025
+ value = slider.touch.originalPos.left + change;
1026
+ // if vertical, drag along y axis
1027
+ }else{
1028
+ var change = orig.changedTouches[0].pageY - slider.touch.start.y;
1029
+ value = slider.touch.originalPos.top + change;
1030
+ }
1031
+ setPositionProperty(value, 'reset', 0);
1032
+ }
1033
+ }
1034
+
1035
+ /**
1036
+ * Event handler for "touchend"
1037
+ *
1038
+ * @param e (event)
1039
+ * - DOM event object
1040
+ */
1041
+ var onTouchEnd = function(e){
1042
+ slider.viewport.unbind('touchmove', onTouchMove);
1043
+ var orig = e.originalEvent;
1044
+ var value = 0;
1045
+ // record end x, y positions
1046
+ slider.touch.end.x = orig.changedTouches[0].pageX;
1047
+ slider.touch.end.y = orig.changedTouches[0].pageY;
1048
+ // if fade mode, check if absolute x distance clears the threshold
1049
+ if(slider.settings.mode == 'fade'){
1050
+ var distance = Math.abs(slider.touch.start.x - slider.touch.end.x);
1051
+ if(distance >= slider.settings.swipeThreshold){
1052
+ slider.touch.start.x > slider.touch.end.x ? el.goToNextSlide() : el.goToPrevSlide();
1053
+ el.stopAuto();
1054
+ }
1055
+ // not fade mode
1056
+ }else{
1057
+ var distance = 0;
1058
+ // calculate distance and el's animate property
1059
+ if(slider.settings.mode == 'horizontal'){
1060
+ distance = slider.touch.end.x - slider.touch.start.x;
1061
+ value = slider.touch.originalPos.left;
1062
+ }else{
1063
+ distance = slider.touch.end.y - slider.touch.start.y;
1064
+ value = slider.touch.originalPos.top;
1065
+ }
1066
+ // if not infinite loop and first / last slide, do not attempt a slide transition
1067
+ if(!slider.settings.infiniteLoop && ((slider.active.index == 0 && distance > 0) || (slider.active.last && distance < 0))){
1068
+ setPositionProperty(value, 'reset', 200);
1069
+ }else{
1070
+ // check if distance clears threshold
1071
+ if(Math.abs(distance) >= slider.settings.swipeThreshold){
1072
+ distance < 0 ? el.goToNextSlide() : el.goToPrevSlide();
1073
+ el.stopAuto();
1074
+ }else{
1075
+ // el.animate(property, 200);
1076
+ setPositionProperty(value, 'reset', 200);
1077
+ }
1078
+ }
1079
+ }
1080
+ slider.viewport.unbind('touchend', onTouchEnd);
1081
+ }
1082
+
1083
+ /**
1084
+ * Window resize event callback
1085
+ */
1086
+ var resizeWindow = function(e){
1087
+ // don't do anything if slider isn't initialized.
1088
+ if(!slider.initialized) return;
1089
+ // get the new window dimens (again, thank you IE)
1090
+ var windowWidthNew = $(window).width();
1091
+ var windowHeightNew = $(window).height();
1092
+ // make sure that it is a true window resize
1093
+ // *we must check this because our dinosaur friend IE fires a window resize event when certain DOM elements
1094
+ // are resized. Can you just die already?*
1095
+ if(windowWidth != windowWidthNew || windowHeight != windowHeightNew){
1096
+ // set the new window dimens
1097
+ windowWidth = windowWidthNew;
1098
+ windowHeight = windowHeightNew;
1099
+ // update all dynamic elements
1100
+ el.redrawSlider();
1101
+ // Call user resize handler
1102
+ slider.settings.onSliderResize.call(el, slider.active.index);
1103
+ }
1104
+ }
1105
+
1106
+ /**
1107
+ * ===================================================================================
1108
+ * = PUBLIC FUNCTIONS
1109
+ * ===================================================================================
1110
+ */
1111
+
1112
+ /**
1113
+ * Performs slide transition to the specified slide
1114
+ *
1115
+ * @param slideIndex (int)
1116
+ * - the destination slide's index (zero-based)
1117
+ *
1118
+ * @param direction (string)
1119
+ * - INTERNAL USE ONLY - the direction of travel ("prev" / "next")
1120
+ */
1121
+ el.goToSlide = function(slideIndex, direction){
1122
+ // if plugin is currently in motion, ignore request
1123
+ if(slider.working || slider.active.index == slideIndex) return;
1124
+ // declare that plugin is in motion
1125
+ slider.working = true;
1126
+ // store the old index
1127
+ slider.oldIndex = slider.active.index;
1128
+ // if slideIndex is less than zero, set active index to last child (this happens during infinite loop)
1129
+ if(slideIndex < 0){
1130
+ slider.active.index = getPagerQty() - 1;
1131
+ // if slideIndex is greater than children length, set active index to 0 (this happens during infinite loop)
1132
+ }else if(slideIndex >= getPagerQty()){
1133
+ slider.active.index = 0;
1134
+ // set active index to requested slide
1135
+ }else{
1136
+ slider.active.index = slideIndex;
1137
+ }
1138
+ // onSlideBefore, onSlideNext, onSlidePrev callbacks
1139
+ slider.settings.onSlideBefore(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
1140
+ if(direction == 'next'){
1141
+ slider.settings.onSlideNext(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
1142
+ }else if(direction == 'prev'){
1143
+ slider.settings.onSlidePrev(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
1144
+ }
1145
+ // check if last slide
1146
+ slider.active.last = slider.active.index >= getPagerQty() - 1;
1147
+ // update the pager with active class
1148
+ if(slider.settings.pager) updatePagerActive(slider.active.index);
1149
+ // // check for direction control update
1150
+ if(slider.settings.controls) updateDirectionControls();
1151
+ // if slider is set to mode: "fade"
1152
+ if(slider.settings.mode == 'fade'){
1153
+ // if adaptiveHeight is true and next height is different from current height, animate to the new height
1154
+ if(slider.settings.adaptiveHeight && slider.viewport.height() != getViewportHeight()){
1155
+ slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
1156
+ }
1157
+ // fade out the visible child and reset its z-index value
1158
+ slider.children.filter(':visible').fadeOut(slider.settings.speed).css({zIndex: 0});
1159
+ // fade in the newly requested slide
1160
+ slider.children.eq(slider.active.index).css('zIndex', slider.settings.slideZIndex+1).fadeIn(slider.settings.speed, function(){
1161
+ $(this).css('zIndex', slider.settings.slideZIndex);
1162
+ updateAfterSlideTransition();
1163
+ });
1164
+ // slider mode is not "fade"
1165
+ }else{
1166
+ // if adaptiveHeight is true and next height is different from current height, animate to the new height
1167
+ if(slider.settings.adaptiveHeight && slider.viewport.height() != getViewportHeight()){
1168
+ slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
1169
+ }
1170
+ var moveBy = 0;
1171
+ var position = {left: 0, top: 0};
1172
+ // if carousel and not infinite loop
1173
+ if(!slider.settings.infiniteLoop && slider.carousel && slider.active.last){
1174
+ if(slider.settings.mode == 'horizontal'){
1175
+ // get the last child position
1176
+ var lastChild = slider.children.eq(slider.children.length - 1);
1177
+ position = lastChild.position();
1178
+ // calculate the position of the last slide
1179
+ moveBy = slider.viewport.width() - lastChild.outerWidth();
1180
+ }else{
1181
+ // get last showing index position
1182
+ var lastShowingIndex = slider.children.length - slider.settings.minSlides;
1183
+ position = slider.children.eq(lastShowingIndex).position();
1184
+ }
1185
+ // horizontal carousel, going previous while on first slide (infiniteLoop mode)
1186
+ }else if(slider.carousel && slider.active.last && direction == 'prev'){
1187
+ // get the last child position
1188
+ var eq = slider.settings.moveSlides == 1 ? slider.settings.maxSlides - getMoveBy() : ((getPagerQty() - 1) * getMoveBy()) - (slider.children.length - slider.settings.maxSlides);
1189
+ var lastChild = el.children('.bx-clone').eq(eq);
1190
+ position = lastChild.position();
1191
+ // if infinite loop and "Next" is clicked on the last slide
1192
+ }else if(direction == 'next' && slider.active.index == 0){
1193
+ // get the last clone position
1194
+ position = el.find('> .bx-clone').eq(slider.settings.maxSlides).position();
1195
+ slider.active.last = false;
1196
+ // normal non-zero requests
1197
+ }else if(slideIndex >= 0){
1198
+ var requestEl = slideIndex * getMoveBy();
1199
+ position = slider.children.eq(requestEl).position();
1200
+ }
1201
+
1202
+ /* If the position doesn't exist
1203
+ * (e.g. if you destroy the slider on a next click),
1204
+ * it doesn't throw an error.
1205
+ */
1206
+ if ("undefined" !== typeof(position)) {
1207
+ var value = slider.settings.mode == 'horizontal' ? -(position.left - moveBy) : -position.top;
1208
+ // plugin values to be animated
1209
+ setPositionProperty(value, 'slide', slider.settings.speed);
1210
+ }
1211
+ }
1212
+ }
1213
+
1214
+ /**
1215
+ * Transitions to the next slide in the show
1216
+ */
1217
+ el.goToNextSlide = function(){
1218
+ // if infiniteLoop is false and last page is showing, disregard call
1219
+ if (!slider.settings.infiniteLoop && slider.active.last) return;
1220
+ var pagerIndex = parseInt(slider.active.index) + 1;
1221
+ el.goToSlide(pagerIndex, 'next');
1222
+ }
1223
+
1224
+ /**
1225
+ * Transitions to the prev slide in the show
1226
+ */
1227
+ el.goToPrevSlide = function(){
1228
+ // if infiniteLoop is false and last page is showing, disregard call
1229
+ if (!slider.settings.infiniteLoop && slider.active.index == 0) return;
1230
+ var pagerIndex = parseInt(slider.active.index) - 1;
1231
+ el.goToSlide(pagerIndex, 'prev');
1232
+ }
1233
+
1234
+ /**
1235
+ * Starts the auto show
1236
+ *
1237
+ * @param preventControlUpdate (boolean)
1238
+ * - if true, auto controls state will not be updated
1239
+ */
1240
+ el.startAuto = function(preventControlUpdate){
1241
+ // if an interval already exists, disregard call
1242
+ if(slider.interval) return;
1243
+ // create an interval
1244
+ slider.interval = setInterval(function(){
1245
+ slider.settings.autoDirection == 'next' ? el.goToNextSlide() : el.goToPrevSlide();
1246
+ }, slider.settings.pause);
1247
+ // if auto controls are displayed and preventControlUpdate is not true
1248
+ if (slider.settings.autoControls && preventControlUpdate != true) updateAutoControls('stop');
1249
+ }
1250
+
1251
+ /**
1252
+ * Stops the auto show
1253
+ *
1254
+ * @param preventControlUpdate (boolean)
1255
+ * - if true, auto controls state will not be updated
1256
+ */
1257
+ el.stopAuto = function(preventControlUpdate){
1258
+ // if no interval exists, disregard call
1259
+ if(!slider.interval) return;
1260
+ // clear the interval
1261
+ clearInterval(slider.interval);
1262
+ slider.interval = null;
1263
+ // if auto controls are displayed and preventControlUpdate is not true
1264
+ if (slider.settings.autoControls && preventControlUpdate != true) updateAutoControls('start');
1265
+ }
1266
+
1267
+ /**
1268
+ * Returns current slide index (zero-based)
1269
+ */
1270
+ el.getCurrentSlide = function(){
1271
+ return slider.active.index;
1272
+ }
1273
+
1274
+ /**
1275
+ * Returns current slide element
1276
+ */
1277
+ el.getCurrentSlideElement = function(){
1278
+ return slider.children.eq(slider.active.index);
1279
+ }
1280
+
1281
+ /**
1282
+ * Returns number of slides in show
1283
+ */
1284
+ el.getSlideCount = function(){
1285
+ return slider.children.length;
1286
+ }
1287
+
1288
+ /**
1289
+ * Update all dynamic slider elements
1290
+ */
1291
+ el.redrawSlider = function(){
1292
+ // resize all children in ratio to new screen size
1293
+ slider.children.add(el.find('.bx-clone')).width(getSlideWidth());
1294
+ // adjust the height
1295
+ slider.viewport.css('height', getViewportHeight());
1296
+ // update the slide position
1297
+ if(!slider.settings.ticker) setSlidePosition();
1298
+ // if active.last was true before the screen resize, we want
1299
+ // to keep it last no matter what screen size we end on
1300
+ if (slider.active.last) slider.active.index = getPagerQty() - 1;
1301
+ // if the active index (page) no longer exists due to the resize, simply set the index as last
1302
+ if (slider.active.index >= getPagerQty()) slider.active.last = true;
1303
+ // if a pager is being displayed and a custom pager is not being used, update it
1304
+ if(slider.settings.pager && !slider.settings.pagerCustom){
1305
+ populatePager();
1306
+ updatePagerActive(slider.active.index);
1307
+ }
1308
+ }
1309
+
1310
+ /**
1311
+ * Destroy the current instance of the slider (revert everything back to original state)
1312
+ */
1313
+ el.destroySlider = function(){
1314
+ // don't do anything if slider has already been destroyed
1315
+ if(!slider.initialized) return;
1316
+ slider.initialized = false;
1317
+ $('.bx-clone', this).remove();
1318
+ slider.children.each(function() {
1319
+ $(this).data("origStyle") != undefined ? $(this).attr("style", $(this).data("origStyle")) : $(this).removeAttr('style');
1320
+ });
1321
+ $(this).data("origStyle") != undefined ? this.attr("style", $(this).data("origStyle")) : $(this).removeAttr('style');
1322
+ $(this).unwrap().unwrap();
1323
+ if(slider.controls.el) slider.controls.el.remove();
1324
+ if(slider.controls.next) slider.controls.next.remove();
1325
+ if(slider.controls.prev) slider.controls.prev.remove();
1326
+ if(slider.pagerEl && slider.settings.controls) slider.pagerEl.remove();
1327
+ $('.bx-caption', this).remove();
1328
+ if(slider.controls.autoEl) slider.controls.autoEl.remove();
1329
+ clearInterval(slider.interval);
1330
+ if(slider.settings.responsive) $(window).unbind('resize', resizeWindow);
1331
+ }
1332
+
1333
+ /**
1334
+ * Reload the slider (revert all DOM changes, and re-initialize)
1335
+ */
1336
+ el.reloadSlider = function(settings){
1337
+ if (settings != undefined) options = settings;
1338
+ el.destroySlider();
1339
+ init();
1340
+ }
1341
+
1342
+ init();
1343
+
1344
+ // returns the current jQuery object
1345
+ return this;
1346
+ }
1347
+
1348
+
1349
+ })(jQuery);
js/bxslider/plugins/jquery.easing.1.3.js ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
3
+ *
4
+ * Uses the built in easing capabilities added In jQuery 1.1
5
+ * to offer multiple easing options
6
+ *
7
+ * TERMS OF USE - jQuery Easing
8
+ *
9
+ * Open source under the BSD License.
10
+ *
11
+ * Copyright © 2008 George McGinley Smith
12
+ * All rights reserved.
13
+ *
14
+ * Redistribution and use in source and binary forms, with or without modification,
15
+ * are permitted provided that the following conditions are met:
16
+ *
17
+ * Redistributions of source code must retain the above copyright notice, this list of
18
+ * conditions and the following disclaimer.
19
+ * Redistributions in binary form must reproduce the above copyright notice, this list
20
+ * of conditions and the following disclaimer in the documentation and/or other materials
21
+ * provided with the distribution.
22
+ *
23
+ * Neither the name of the author nor the names of contributors may be used to endorse
24
+ * or promote products derived from this software without specific prior written permission.
25
+ *
26
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
27
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
31
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
32
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
34
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
35
+ *
36
+ */
37
+
38
+ // t: current time, b: begInnIng value, c: change In value, d: duration
39
+ jQuery.easing['jswing'] = jQuery.easing['swing'];
40
+
41
+ jQuery.extend( jQuery.easing,
42
+ {
43
+ def: 'easeOutQuad',
44
+ swing: function (x, t, b, c, d) {
45
+ //alert(jQuery.easing.default);
46
+ return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
47
+ },
48
+ easeInQuad: function (x, t, b, c, d) {
49
+ return c*(t/=d)*t + b;
50
+ },
51
+ easeOutQuad: function (x, t, b, c, d) {
52
+ return -c *(t/=d)*(t-2) + b;
53
+ },
54
+ easeInOutQuad: function (x, t, b, c, d) {
55
+ if ((t/=d/2) < 1) return c/2*t*t + b;
56
+ return -c/2 * ((--t)*(t-2) - 1) + b;
57
+ },
58
+ easeInCubic: function (x, t, b, c, d) {
59
+ return c*(t/=d)*t*t + b;
60
+ },
61
+ easeOutCubic: function (x, t, b, c, d) {
62
+ return c*((t=t/d-1)*t*t + 1) + b;
63
+ },
64
+ easeInOutCubic: function (x, t, b, c, d) {
65
+ if ((t/=d/2) < 1) return c/2*t*t*t + b;
66
+ return c/2*((t-=2)*t*t + 2) + b;
67
+ },
68
+ easeInQuart: function (x, t, b, c, d) {
69
+ return c*(t/=d)*t*t*t + b;
70
+ },
71
+ easeOutQuart: function (x, t, b, c, d) {
72
+ return -c * ((t=t/d-1)*t*t*t - 1) + b;
73
+ },
74
+ easeInOutQuart: function (x, t, b, c, d) {
75
+ if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
76
+ return -c/2 * ((t-=2)*t*t*t - 2) + b;
77
+ },
78
+ easeInQuint: function (x, t, b, c, d) {
79
+ return c*(t/=d)*t*t*t*t + b;
80
+ },
81
+ easeOutQuint: function (x, t, b, c, d) {
82
+ return c*((t=t/d-1)*t*t*t*t + 1) + b;
83
+ },
84
+ easeInOutQuint: function (x, t, b, c, d) {
85
+ if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
86
+ return c/2*((t-=2)*t*t*t*t + 2) + b;
87
+ },
88
+ easeInSine: function (x, t, b, c, d) {
89
+ return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
90
+ },
91
+ easeOutSine: function (x, t, b, c, d) {
92
+ return c * Math.sin(t/d * (Math.PI/2)) + b;
93
+ },
94
+ easeInOutSine: function (x, t, b, c, d) {
95
+ return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
96
+ },
97
+ easeInExpo: function (x, t, b, c, d) {
98
+ return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
99
+ },
100
+ easeOutExpo: function (x, t, b, c, d) {
101
+ return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
102
+ },
103
+ easeInOutExpo: function (x, t, b, c, d) {
104
+ if (t==0) return b;
105
+ if (t==d) return b+c;
106
+ if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
107
+ return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
108
+ },
109
+ easeInCirc: function (x, t, b, c, d) {
110
+ return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
111
+ },
112
+ easeOutCirc: function (x, t, b, c, d) {
113
+ return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
114
+ },
115
+ easeInOutCirc: function (x, t, b, c, d) {
116
+ if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
117
+ return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
118
+ },
119
+ easeInElastic: function (x, t, b, c, d) {
120
+ var s=1.70158;var p=0;var a=c;
121
+ if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
122
+ if (a < Math.abs(c)) { a=c; var s=p/4; }
123
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
124
+ return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
125
+ },
126
+ easeOutElastic: function (x, t, b, c, d) {
127
+ var s=1.70158;var p=0;var a=c;
128
+ if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
129
+ if (a < Math.abs(c)) { a=c; var s=p/4; }
130
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
131
+ return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
132
+ },
133
+ easeInOutElastic: function (x, t, b, c, d) {
134
+ var s=1.70158;var p=0;var a=c;
135
+ if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
136
+ if (a < Math.abs(c)) { a=c; var s=p/4; }
137
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
138
+ if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
139
+ return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
140
+ },
141
+ easeInBack: function (x, t, b, c, d, s) {
142
+ if (s == undefined) s = 1.70158;
143
+ return c*(t/=d)*t*((s+1)*t - s) + b;
144
+ },
145
+ easeOutBack: function (x, t, b, c, d, s) {
146
+ if (s == undefined) s = 1.70158;
147
+ return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
148
+ },
149
+ easeInOutBack: function (x, t, b, c, d, s) {
150
+ if (s == undefined) s = 1.70158;
151
+ if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
152
+ return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
153
+ },
154
+ easeInBounce: function (x, t, b, c, d) {
155
+ return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
156
+ },
157
+ easeOutBounce: function (x, t, b, c, d) {
158
+ if ((t/=d) < (1/2.75)) {
159
+ return c*(7.5625*t*t) + b;
160
+ } else if (t < (2/2.75)) {
161
+ return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
162
+ } else if (t < (2.5/2.75)) {
163
+ return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
164
+ } else {
165
+ return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
166
+ }
167
+ },
168
+ easeInOutBounce: function (x, t, b, c, d) {
169
+ if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
170
+ return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
171
+ }
172
+ });
173
+
174
+ /*
175
+ *
176
+ * TERMS OF USE - EASING EQUATIONS
177
+ *
178
+ * Open source under the BSD License.
179
+ *
180
+ * Copyright © 2001 Robert Penner
181
+ * All rights reserved.
182
+ *
183
+ * Redistribution and use in source and binary forms, with or without modification,
184
+ * are permitted provided that the following conditions are met:
185
+ *
186
+ * Redistributions of source code must retain the above copyright notice, this list of
187
+ * conditions and the following disclaimer.
188
+ * Redistributions in binary form must reproduce the above copyright notice, this list
189
+ * of conditions and the following disclaimer in the documentation and/or other materials
190
+ * provided with the distribution.
191
+ *
192
+ * Neither the name of the author nor the names of contributors may be used to endorse
193
+ * or promote products derived from this software without specific prior written permission.
194
+ *
195
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
196
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
197
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
198
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
199
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
200
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
201
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
202
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
203
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
204
+ *
205
+ */
js/bxslider/plugins/jquery.fitvids.js ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*global jQuery */
2
+ /*jshint multistr:true browser:true */
3
+ /*!
4
+ * FitVids 1.0
5
+ *
6
+ * Copyright 2011, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
7
+ * Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
8
+ * Released under the WTFPL license - http://sam.zoy.org/wtfpl/
9
+ *
10
+ * Date: Thu Sept 01 18:00:00 2011 -0500
11
+ */
12
+
13
+ (function( $ ){
14
+
15
+ "use strict";
16
+
17
+ $.fn.fitVids = function( options ) {
18
+ var settings = {
19
+ customSelector: null
20
+ };
21
+
22
+ var div = document.createElement('div'),
23
+ ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0];
24
+
25
+ div.className = 'fit-vids-style';
26
+ div.innerHTML = '&shy;<style> \
27
+ .fluid-width-video-wrapper { \
28
+ width: 100%; \
29
+ position: relative; \
30
+ padding: 0; \
31
+ } \
32
+ \
33
+ .fluid-width-video-wrapper iframe, \
34
+ .fluid-width-video-wrapper object, \
35
+ .fluid-width-video-wrapper embed { \
36
+ position: absolute; \
37
+ top: 0; \
38
+ left: 0; \
39
+ width: 100%; \
40
+ height: 100%; \
41
+ } \
42
+ </style>';
43
+
44
+ ref.parentNode.insertBefore(div,ref);
45
+
46
+ if ( options ) {
47
+ $.extend( settings, options );
48
+ }
49
+
50
+ return this.each(function(){
51
+ var selectors = [
52
+ "iframe[src*='player.vimeo.com']",
53
+ "iframe[src*='www.youtube.com']",
54
+ "iframe[src*='www.kickstarter.com']",
55
+ "object",
56
+ "embed"
57
+ ];
58
+
59
+ if (settings.customSelector) {
60
+ selectors.push(settings.customSelector);
61
+ }
62
+
63
+ var $allVideos = $(this).find(selectors.join(','));
64
+
65
+ $allVideos.each(function(){
66
+ var $this = $(this);
67
+ if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }
68
+ var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(),
69
+ width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
70
+ aspectRatio = height / width;
71
+ if(!$this.attr('id')){
72
+ var videoID = 'fitvid' + Math.floor(Math.random()*999999);
73
+ $this.attr('id', videoID);
74
+ }
75
+ $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%");
76
+ $this.removeAttr('height').removeAttr('width');
77
+ });
78
+ });
79
+ };
80
+ })( jQuery );
js/jquery.flexslider.js ADDED
@@ -0,0 +1,1157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery FlexSlider v2.2.2
3
+ * Copyright 2012 WooThemes
4
+ * Contributing Author: Tyler Smith
5
+ */
6
+ ;
7
+ (function ($) {
8
+
9
+ //FlexSlider: Object Instance
10
+ $.flexslider = function(el, options) {
11
+ var slider = $(el);
12
+
13
+ // making variables public
14
+ slider.vars = $.extend({}, $.flexslider.defaults, options);
15
+
16
+ var namespace = slider.vars.namespace,
17
+ msGesture = window.navigator && window.navigator.msPointerEnabled && window.MSGesture,
18
+ touch = (( "ontouchstart" in window ) || msGesture || window.DocumentTouch && document instanceof DocumentTouch) && slider.vars.touch,
19
+ // depricating this idea, as devices are being released with both of these events
20
+ //eventType = (touch) ? "touchend" : "click",
21
+ eventType = "click touchend MSPointerUp keyup",
22
+ watchedEvent = "",
23
+ watchedEventClearTimer,
24
+ vertical = slider.vars.direction === "vertical",
25
+ reverse = slider.vars.reverse,
26
+ carousel = (slider.vars.itemWidth > 0),
27
+ fade = slider.vars.animation === "fade",
28
+ asNav = slider.vars.asNavFor !== "",
29
+ methods = {},
30
+ focused = true;
31
+
32
+ // Store a reference to the slider object
33
+ $.data(el, "flexslider", slider);
34
+
35
+ // Private slider methods
36
+ methods = {
37
+ init: function() {
38
+ slider.animating = false;
39
+ // Get current slide and make sure it is a number
40
+ slider.currentSlide = parseInt( ( slider.vars.startAt ? slider.vars.startAt : 0), 10 );
41
+ if ( isNaN( slider.currentSlide ) ) slider.currentSlide = 0;
42
+ slider.animatingTo = slider.currentSlide;
43
+ slider.atEnd = (slider.currentSlide === 0 || slider.currentSlide === slider.last);
44
+ slider.containerSelector = slider.vars.selector.substr(0,slider.vars.selector.search(' '));
45
+ slider.slides = $(slider.vars.selector, slider);
46
+ slider.container = $(slider.containerSelector, slider);
47
+ slider.count = slider.slides.length;
48
+ // SYNC:
49
+ slider.syncExists = $(slider.vars.sync).length > 0;
50
+ // SLIDE:
51
+ if (slider.vars.animation === "slide") slider.vars.animation = "swing";
52
+ slider.prop = (vertical) ? "top" : "marginLeft";
53
+ slider.args = {};
54
+ // SLIDESHOW:
55
+ slider.manualPause = false;
56
+ slider.stopped = false;
57
+ //PAUSE WHEN INVISIBLE
58
+ slider.started = false;
59
+ slider.startTimeout = null;
60
+ // TOUCH/USECSS:
61
+ slider.transitions = !slider.vars.video && !fade && slider.vars.useCSS && (function() {
62
+ var obj = document.createElement('div'),
63
+ props = ['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
64
+ for (var i in props) {
65
+ if ( obj.style[ props[i] ] !== undefined ) {
66
+ slider.pfx = props[i].replace('Perspective','').toLowerCase();
67
+ slider.prop = "-" + slider.pfx + "-transform";
68
+ return true;
69
+ }
70
+ }
71
+ return false;
72
+ }());
73
+ slider.ensureAnimationEnd = '';
74
+ // CONTROLSCONTAINER:
75
+ if (slider.vars.controlsContainer !== "") slider.controlsContainer = $(slider.vars.controlsContainer).length > 0 && $(slider.vars.controlsContainer);
76
+ // MANUAL:
77
+ if (slider.vars.manualControls !== "") slider.manualControls = $(slider.vars.manualControls).length > 0 && $(slider.vars.manualControls);
78
+
79
+ // RANDOMIZE:
80
+ if (slider.vars.randomize) {
81
+ slider.slides.sort(function() { return (Math.round(Math.random())-0.5); });
82
+ slider.container.empty().append(slider.slides);
83
+ }
84
+
85
+ slider.doMath();
86
+
87
+ // INIT
88
+ slider.setup("init");
89
+
90
+ // CONTROLNAV:
91
+ if (slider.vars.controlNav) methods.controlNav.setup();
92
+
93
+ // DIRECTIONNAV:
94
+ if (slider.vars.directionNav) methods.directionNav.setup();
95
+
96
+ // KEYBOARD:
97
+ if (slider.vars.keyboard && ($(slider.containerSelector).length === 1 || slider.vars.multipleKeyboard)) {
98
+ $(document).bind('keyup', function(event) {
99
+ var keycode = event.keyCode;
100
+ if (!slider.animating && (keycode === 39 || keycode === 37)) {
101
+ var target = (keycode === 39) ? slider.getTarget('next') :
102
+ (keycode === 37) ? slider.getTarget('prev') : false;
103
+ slider.flexAnimate(target, slider.vars.pauseOnAction);
104
+ }
105
+ });
106
+ }
107
+ // MOUSEWHEEL:
108
+ if (slider.vars.mousewheel) {
109
+ slider.bind('mousewheel', function(event, delta, deltaX, deltaY) {
110
+ event.preventDefault();
111
+ var target = (delta < 0) ? slider.getTarget('next') : slider.getTarget('prev');
112
+ slider.flexAnimate(target, slider.vars.pauseOnAction);
113
+ });
114
+ }
115
+
116
+ // PAUSEPLAY
117
+ if (slider.vars.pausePlay) methods.pausePlay.setup();
118
+
119
+ //PAUSE WHEN INVISIBLE
120
+ if (slider.vars.slideshow && slider.vars.pauseInvisible) methods.pauseInvisible.init();
121
+
122
+ // SLIDSESHOW
123
+ if (slider.vars.slideshow) {
124
+ if (slider.vars.pauseOnHover) {
125
+ slider.hover(function() {
126
+ if (!slider.manualPlay && !slider.manualPause) slider.pause();
127
+ }, function() {
128
+ if (!slider.manualPause && !slider.manualPlay && !slider.stopped) slider.play();
129
+ });
130
+ }
131
+ // initialize animation
132
+ //If we're visible, or we don't use PageVisibility API
133
+ if(!slider.vars.pauseInvisible || !methods.pauseInvisible.isHidden()) {
134
+ (slider.vars.initDelay > 0) ? slider.startTimeout = setTimeout(slider.play, slider.vars.initDelay) : slider.play();
135
+ }
136
+ }
137
+
138
+ // ASNAV:
139
+ if (asNav) methods.asNav.setup();
140
+
141
+ // TOUCH
142
+ if (touch && slider.vars.touch) methods.touch();
143
+
144
+ // FADE&&SMOOTHHEIGHT || SLIDE:
145
+ if (!fade || (fade && slider.vars.smoothHeight)) $(window).bind("resize orientationchange focus", methods.resize);
146
+
147
+ slider.find("img").attr("draggable", "false");
148
+
149
+ // API: start() Callback
150
+ setTimeout(function(){
151
+ slider.vars.start(slider);
152
+ }, 200);
153
+ },
154
+ asNav: {
155
+ setup: function() {
156
+ slider.asNav = true;
157
+ slider.animatingTo = Math.floor(slider.currentSlide/slider.move);
158
+ slider.currentItem = slider.currentSlide;
159
+ slider.slides.removeClass(namespace + "active-slide").eq(slider.currentItem).addClass(namespace + "active-slide");
160
+ if(!msGesture){
161
+ slider.slides.on(eventType, function(e){
162
+ e.preventDefault();
163
+ var $slide = $(this),
164
+ target = $slide.index();
165
+ var posFromLeft = $slide.offset().left - $(slider).scrollLeft(); // Find position of slide relative to left of slider container
166
+ if( posFromLeft <= 0 && $slide.hasClass( namespace + 'active-slide' ) ) {
167
+ slider.flexAnimate(slider.getTarget("prev"), true);
168
+ } else if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass(namespace + "active-slide")) {
169
+ slider.direction = (slider.currentItem < target) ? "next" : "prev";
170
+ slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true);
171
+ }
172
+ });
173
+ }else{
174
+ el._slider = slider;
175
+ slider.slides.each(function (){
176
+ var that = this;
177
+ that._gesture = new MSGesture();
178
+ that._gesture.target = that;
179
+ that.addEventListener("MSPointerDown", function (e){
180
+ e.preventDefault();
181
+ if(e.currentTarget._gesture)
182
+ e.currentTarget._gesture.addPointer(e.pointerId);
183
+ }, false);
184
+ that.addEventListener("MSGestureTap", function (e){
185
+ e.preventDefault();
186
+ var $slide = $(this),
187
+ target = $slide.index();
188
+ if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass('active')) {
189
+ slider.direction = (slider.currentItem < target) ? "next" : "prev";
190
+ slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true);
191
+ }
192
+ });
193
+ });
194
+ }
195
+ }
196
+ },
197
+ controlNav: {
198
+ setup: function() {
199
+ if (!slider.manualControls) {
200
+ methods.controlNav.setupPaging();
201
+ } else { // MANUALCONTROLS:
202
+ methods.controlNav.setupManual();
203
+ }
204
+ },
205
+ setupPaging: function() {
206
+ var type = (slider.vars.controlNav === "thumbnails") ? 'control-thumbs' : 'control-paging',
207
+ j = 1,
208
+ item,
209
+ slide;
210
+
211
+ slider.controlNavScaffold = $('<ol class="'+ namespace + 'control-nav ' + namespace + type + '"></ol>');
212
+
213
+ if (slider.pagingCount > 1) {
214
+ for (var i = 0; i < slider.pagingCount; i++) {
215
+ slide = slider.slides.eq(i);
216
+ item = (slider.vars.controlNav === "thumbnails") ? '<img src="' + slide.attr( 'data-thumb' ) + '"/>' : '<a>' + j + '</a>';
217
+ if ( 'thumbnails' === slider.vars.controlNav && true === slider.vars.thumbCaptions ) {
218
+ var captn = slide.attr( 'data-thumbcaption' );
219
+ if ( '' != captn && undefined != captn ) item += '<span class="' + namespace + 'caption">' + captn + '</span>';
220
+ }
221
+ slider.controlNavScaffold.append('<li>' + item + '</li>');
222
+ j++;
223
+ }
224
+ }
225
+
226
+ // CONTROLSCONTAINER:
227
+ (slider.controlsContainer) ? $(slider.controlsContainer).append(slider.controlNavScaffold) : slider.append(slider.controlNavScaffold);
228
+ methods.controlNav.set();
229
+
230
+ methods.controlNav.active();
231
+
232
+ slider.controlNavScaffold.delegate('a, img', eventType, function(event) {
233
+ event.preventDefault();
234
+
235
+ if (watchedEvent === "" || watchedEvent === event.type) {
236
+ var $this = $(this),
237
+ target = slider.controlNav.index($this);
238
+
239
+ if (!$this.hasClass(namespace + 'active')) {
240
+ slider.direction = (target > slider.currentSlide) ? "next" : "prev";
241
+ slider.flexAnimate(target, slider.vars.pauseOnAction);
242
+ }
243
+ }
244
+
245
+ // setup flags to prevent event duplication
246
+ if (watchedEvent === "") {
247
+ watchedEvent = event.type;
248
+ }
249
+ methods.setToClearWatchedEvent();
250
+
251
+ });
252
+ },
253
+ setupManual: function() {
254
+ slider.controlNav = slider.manualControls;
255
+ methods.controlNav.active();
256
+
257
+ slider.controlNav.bind(eventType, function(event) {
258
+ event.preventDefault();
259
+
260
+ if (watchedEvent === "" || watchedEvent === event.type) {
261
+ var $this = $(this),
262
+ target = slider.controlNav.index($this);
263
+
264
+ if (!$this.hasClass(namespace + 'active')) {
265
+ (target > slider.currentSlide) ? slider.direction = "next" : slider.direction = "prev";
266
+ slider.flexAnimate(target, slider.vars.pauseOnAction);
267
+ }
268
+ }
269
+
270
+ // setup flags to prevent event duplication
271
+ if (watchedEvent === "") {
272
+ watchedEvent = event.type;
273
+ }
274
+ methods.setToClearWatchedEvent();
275
+ });
276
+ },
277
+ set: function() {
278
+ var selector = (slider.vars.controlNav === "thumbnails") ? 'img' : 'a';
279
+ slider.controlNav = $('.' + namespace + 'control-nav li ' + selector, (slider.controlsContainer) ? slider.controlsContainer : slider);
280
+ },
281
+ active: function() {
282
+ slider.controlNav.removeClass(namespace + "active").eq(slider.animatingTo).addClass(namespace + "active");
283
+ },
284
+ update: function(action, pos) {
285
+ if (slider.pagingCount > 1 && action === "add") {
286
+ slider.controlNavScaffold.append($('<li><a>' + slider.count + '</a></li>'));
287
+ } else if (slider.pagingCount === 1) {
288
+ slider.controlNavScaffold.find('li').remove();
289
+ } else {
290
+ slider.controlNav.eq(pos).closest('li').remove();
291
+ }
292
+ methods.controlNav.set();
293
+ (slider.pagingCount > 1 && slider.pagingCount !== slider.controlNav.length) ? slider.update(pos, action) : methods.controlNav.active();
294
+ }
295
+ },
296
+ directionNav: {
297
+ setup: function() {
298
+ var directionNavScaffold = $('<ul class="' + namespace + 'direction-nav"><li><a class="' + namespace + 'prev" href="#">' + slider.vars.prevText + '</a></li><li><a class="' + namespace + 'next" href="#">' + slider.vars.nextText + '</a></li></ul>');
299
+
300
+ // CONTROLSCONTAINER:
301
+ if (slider.controlsContainer) {
302
+ $(slider.controlsContainer).append(directionNavScaffold);
303
+ slider.directionNav = $('.' + namespace + 'direction-nav li a', slider.controlsContainer);
304
+ } else {
305
+ slider.append(directionNavScaffold);
306
+ slider.directionNav = $('.' + namespace + 'direction-nav li a', slider);
307
+ }
308
+
309
+ methods.directionNav.update();
310
+
311
+ slider.directionNav.bind(eventType, function(event) {
312
+ event.preventDefault();
313
+ var target;
314
+
315
+ if (watchedEvent === "" || watchedEvent === event.type) {
316
+ target = ($(this).hasClass(namespace + 'next')) ? slider.getTarget('next') : slider.getTarget('prev');
317
+ slider.flexAnimate(target, slider.vars.pauseOnAction);
318
+ }
319
+
320
+ // setup flags to prevent event duplication
321
+ if (watchedEvent === "") {
322
+ watchedEvent = event.type;
323
+ }
324
+ methods.setToClearWatchedEvent();
325
+ });
326
+ },
327
+ update: function() {
328
+ var disabledClass = namespace + 'disabled';
329
+ if (slider.pagingCount === 1) {
330
+ slider.directionNav.addClass(disabledClass).attr('tabindex', '-1');
331
+ } else if (!slider.vars.animationLoop) {
332
+ if (slider.animatingTo === 0) {
333
+ slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "prev").addClass(disabledClass).attr('tabindex', '-1');
334
+ } else if (slider.animatingTo === slider.last) {
335
+ slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "next").addClass(disabledClass).attr('tabindex', '-1');
336
+ } else {
337
+ slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
338
+ }
339
+ } else {
340
+ slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
341
+ }
342
+ }
343
+ },
344
+ pausePlay: {
345
+ setup: function() {
346
+ var pausePlayScaffold = $('<div class="' + namespace + 'pauseplay"><a></a></div>');
347
+
348
+ // CONTROLSCONTAINER:
349
+ if (slider.controlsContainer) {
350
+ slider.controlsContainer.append(pausePlayScaffold);
351
+ slider.pausePlay = $('.' + namespace + 'pauseplay a', slider.controlsContainer);
352
+ } else {
353
+ slider.append(pausePlayScaffold);
354
+ slider.pausePlay = $('.' + namespace + 'pauseplay a', slider);
355
+ }
356
+
357
+ methods.pausePlay.update((slider.vars.slideshow) ? namespace + 'pause' : namespace + 'play');
358
+
359
+ slider.pausePlay.bind(eventType, function(event) {
360
+ event.preventDefault();
361
+
362
+ if (watchedEvent === "" || watchedEvent === event.type) {
363
+ if ($(this).hasClass(namespace + 'pause')) {
364
+ slider.manualPause = true;
365
+ slider.manualPlay = false;
366
+ slider.pause();
367
+ } else {
368
+ slider.manualPause = false;
369
+ slider.manualPlay = true;
370
+ slider.play();
371
+ }
372
+ }
373
+
374
+ // setup flags to prevent event duplication
375
+ if (watchedEvent === "") {
376
+ watchedEvent = event.type;
377
+ }
378
+ methods.setToClearWatchedEvent();
379
+ });
380
+ },
381
+ update: function(state) {
382
+ (state === "play") ? slider.pausePlay.removeClass(namespace + 'pause').addClass(namespace + 'play').html(slider.vars.playText) : slider.pausePlay.removeClass(namespace + 'play').addClass(namespace + 'pause').html(slider.vars.pauseText);
383
+ }
384
+ },
385
+ touch: function() {
386
+ var startX,
387
+ startY,
388
+ offset,
389
+ cwidth,
390
+ dx,
391
+ startT,
392
+ scrolling = false,
393
+ localX = 0,
394
+ localY = 0,
395
+ accDx = 0;
396
+
397
+ if(!msGesture){
398
+ el.addEventListener('touchstart', onTouchStart, false);
399
+
400
+ function onTouchStart(e) {
401
+ if (slider.animating) {
402
+ e.preventDefault();
403
+ } else if ( ( window.navigator.msPointerEnabled ) || e.touches.length === 1 ) {
404
+ slider.pause();
405
+ // CAROUSEL:
406
+ cwidth = (vertical) ? slider.h : slider. w;
407
+ startT = Number(new Date());
408
+ // CAROUSEL:
409
+
410
+ // Local vars for X and Y points.
411
+ localX = e.touches[0].pageX;
412
+ localY = e.touches[0].pageY;
413
+
414
+ offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
415
+ (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
416
+ (carousel && slider.currentSlide === slider.last) ? slider.limit :
417
+ (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :
418
+ (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
419
+ startX = (vertical) ? localY : localX;
420
+ startY = (vertical) ? localX : localY;
421
+
422
+ el.addEventListener('touchmove', onTouchMove, false);
423
+ el.addEventListener('touchend', onTouchEnd, false);
424
+ }
425
+ }
426
+
427
+ function onTouchMove(e) {
428
+ // Local vars for X and Y points.
429
+
430
+ localX = e.touches[0].pageX;
431
+ localY = e.touches[0].pageY;
432
+
433
+ dx = (vertical) ? startX - localY : startX - localX;
434
+ scrolling = (vertical) ? (Math.abs(dx) < Math.abs(localX - startY)) : (Math.abs(dx) < Math.abs(localY - startY));
435
+
436
+ var fxms = 500;
437
+
438
+ if ( ! scrolling || Number( new Date() ) - startT > fxms ) {
439
+ e.preventDefault();
440
+ if (!fade && slider.transitions) {
441
+ if (!slider.vars.animationLoop) {
442
+ dx = dx/((slider.currentSlide === 0 && dx < 0 || slider.currentSlide === slider.last && dx > 0) ? (Math.abs(dx)/cwidth+2) : 1);
443
+ }
444
+ slider.setProps(offset + dx, "setTouch");
445
+ }
446
+ }
447
+ }
448
+
449
+ function onTouchEnd(e) {
450
+ // finish the touch by undoing the touch session
451
+ el.removeEventListener('touchmove', onTouchMove, false);
452
+
453
+ if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
454
+ var updateDx = (reverse) ? -dx : dx,
455
+ target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
456
+
457
+ if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) {
458
+ slider.flexAnimate(target, slider.vars.pauseOnAction);
459
+ } else {
460
+ if (!fade) slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true);
461
+ }
462
+ }
463
+ el.removeEventListener('touchend', onTouchEnd, false);
464
+
465
+ startX = null;
466
+ startY = null;
467
+ dx = null;
468
+ offset = null;
469
+ }
470
+ }else{
471
+ el.style.msTouchAction = "none";
472
+ el._gesture = new MSGesture();
473
+ el._gesture.target = el;
474
+ el.addEventListener("MSPointerDown", onMSPointerDown, false);
475
+ el._slider = slider;
476
+ el.addEventListener("MSGestureChange", onMSGestureChange, false);
477
+ el.addEventListener("MSGestureEnd", onMSGestureEnd, false);
478
+
479
+ function onMSPointerDown(e){
480
+ e.stopPropagation();
481
+ if (slider.animating) {
482
+ e.preventDefault();
483
+ }else{
484
+ slider.pause();
485
+ el._gesture.addPointer(e.pointerId);
486
+ accDx = 0;
487
+ cwidth = (vertical) ? slider.h : slider. w;
488
+ startT = Number(new Date());
489
+ // CAROUSEL:
490
+
491
+ offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
492
+ (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
493
+ (carousel && slider.currentSlide === slider.last) ? slider.limit :
494
+ (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :
495
+ (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
496
+ }
497
+ }
498
+
499
+ function onMSGestureChange(e) {
500
+ e.stopPropagation();
501
+ var slider = e.target._slider;
502
+ if(!slider){
503
+ return;
504
+ }
505
+ var transX = -e.translationX,
506
+ transY = -e.translationY;
507
+
508
+ //Accumulate translations.
509
+ accDx = accDx + ((vertical) ? transY : transX);
510
+ dx = accDx;
511
+ scrolling = (vertical) ? (Math.abs(accDx) < Math.abs(-transX)) : (Math.abs(accDx) < Math.abs(-transY));
512
+
513
+ if(e.detail === e.MSGESTURE_FLAG_INERTIA){
514
+ setImmediate(function (){
515
+ el._gesture.stop();
516
+ });
517
+
518
+ return;
519
+ }
520
+
521
+ if (!scrolling || Number(new Date()) - startT > 500) {
522
+ e.preventDefault();
523
+ if (!fade && slider.transitions) {
524
+ if (!slider.vars.animationLoop) {
525
+ dx = accDx / ((slider.currentSlide === 0 && accDx < 0 || slider.currentSlide === slider.last && accDx > 0) ? (Math.abs(accDx) / cwidth + 2) : 1);
526
+ }
527
+ slider.setProps(offset + dx, "setTouch");
528
+ }
529
+ }
530
+ }
531
+
532
+ function onMSGestureEnd(e) {
533
+ e.stopPropagation();
534
+ var slider = e.target._slider;
535
+ if(!slider){
536
+ return;
537
+ }
538
+ if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
539
+ var updateDx = (reverse) ? -dx : dx,
540
+ target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
541
+
542
+ if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) {
543
+ slider.flexAnimate(target, slider.vars.pauseOnAction);
544
+ } else {
545
+ if (!fade) slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true);
546
+ }
547
+ }
548
+
549
+ startX = null;
550
+ startY = null;
551
+ dx = null;
552
+ offset = null;
553
+ accDx = 0;
554
+ }
555
+ }
556
+ },
557
+ resize: function() {
558
+ if (!slider.animating && slider.is(':visible')) {
559
+ if (!carousel) slider.doMath();
560
+
561
+ if (fade) {
562
+ // SMOOTH HEIGHT:
563
+ methods.smoothHeight();
564
+ } else if (carousel) { //CAROUSEL:
565
+ slider.slides.width(slider.computedW);
566
+ slider.update(slider.pagingCount);
567
+ slider.setProps();
568
+ }
569
+ else if (vertical) { //VERTICAL:
570
+ slider.viewport.height(slider.h);
571
+ slider.setProps(slider.h, "setTotal");
572
+ } else {
573
+ // SMOOTH HEIGHT:
574
+ if (slider.vars.smoothHeight) methods.smoothHeight();
575
+ slider.newSlides.width(slider.computedW);
576
+ slider.setProps(slider.computedW, "setTotal");
577
+ }
578
+ }
579
+ },
580
+ smoothHeight: function(dur) {
581
+ if (!vertical || fade) {
582
+ var $obj = (fade) ? slider : slider.viewport;
583
+ (dur) ? $obj.animate({"height": slider.slides.eq(slider.animatingTo).height()}, dur) : $obj.height(slider.slides.eq(slider.animatingTo).height());
584
+ }
585
+ },
586
+ sync: function(action) {
587
+ var $obj = $(slider.vars.sync).data("flexslider"),
588
+ target = slider.animatingTo;
589
+
590
+ switch (action) {
591
+ case "animate": $obj.flexAnimate(target, slider.vars.pauseOnAction, false, true); break;
592
+ case "play": if (!$obj.playing && !$obj.asNav) { $obj.play(); } break;
593
+ case "pause": $obj.pause(); break;
594
+ }
595
+ },
596
+ uniqueID: function($clone) {
597
+ // Append _clone to current level and children elements with id attributes
598
+ $clone.filter( '[id]' ).add($clone.find( '[id]' )).each(function() {
599
+ var $this = $(this);
600
+ $this.attr( 'id', $this.attr( 'id' ) + '_clone' );
601
+ });
602
+ return $clone;
603
+ },
604
+ pauseInvisible: {
605
+ visProp: null,
606
+ init: function() {
607
+ var prefixes = ['webkit','moz','ms','o'];
608
+
609
+ if ('hidden' in document) return 'hidden';
610
+ for (var i = 0; i < prefixes.length; i++) {
611
+ if ((prefixes[i] + 'Hidden') in document)
612
+ methods.pauseInvisible.visProp = prefixes[i] + 'Hidden';
613
+ }
614
+ if (methods.pauseInvisible.visProp) {
615
+ var evtname = methods.pauseInvisible.visProp.replace(/[H|h]idden/,'') + 'visibilitychange';
616
+ document.addEventListener(evtname, function() {
617
+ if (methods.pauseInvisible.isHidden()) {
618
+ if(slider.startTimeout) clearTimeout(slider.startTimeout); //If clock is ticking, stop timer and prevent from starting while invisible
619
+ else slider.pause(); //Or just pause
620
+ }
621
+ else {
622
+ if(slider.started) slider.play(); //Initiated before, just play
623
+ else (slider.vars.initDelay > 0) ? setTimeout(slider.play, slider.vars.initDelay) : slider.play(); //Didn't init before: simply init or wait for it
624
+ }
625
+ });
626
+ }
627
+ },
628
+ isHidden: function() {
629
+ return document[methods.pauseInvisible.visProp] || false;
630
+ }
631
+ },
632
+ setToClearWatchedEvent: function() {
633
+ clearTimeout(watchedEventClearTimer);
634
+ watchedEventClearTimer = setTimeout(function() {
635
+ watchedEvent = "";
636
+ }, 3000);
637
+ }
638
+ };
639
+
640
+ // public methods
641
+ slider.flexAnimate = function(target, pause, override, withSync, fromNav) {
642
+ if (!slider.vars.animationLoop && target !== slider.currentSlide) {
643
+ slider.direction = (target > slider.currentSlide) ? "next" : "prev";
644
+ }
645
+
646
+ if (asNav && slider.pagingCount === 1) slider.direction = (slider.currentItem < target) ? "next" : "prev";
647
+
648
+ if (!slider.animating && (slider.canAdvance(target, fromNav) || override) && slider.is(":visible")) {
649
+ if (asNav && withSync) {
650
+ var master = $(slider.vars.asNavFor).data('flexslider');
651
+ slider.atEnd = target === 0 || target === slider.count - 1;
652
+ master.flexAnimate(target, true, false, true, fromNav);
653
+ slider.direction = (slider.currentItem < target) ? "next" : "prev";
654
+ master.direction = slider.direction;
655
+
656
+ if (Math.ceil((target + 1)/slider.visible) - 1 !== slider.currentSlide && target !== 0) {
657
+ slider.currentItem = target;
658
+ slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
659
+ target = Math.floor(target/slider.visible);
660
+ } else {
661
+ slider.currentItem = target;
662
+ slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
663
+ return false;
664
+ }
665
+ }
666
+
667
+ slider.animating = true;
668
+ slider.animatingTo = target;
669
+
670
+ // SLIDESHOW:
671
+ if (pause) slider.pause();
672
+
673
+ // API: before() animation Callback
674
+ slider.vars.before(slider);
675
+
676
+ // SYNC:
677
+ if (slider.syncExists && !fromNav) methods.sync("animate");
678
+
679
+ // CONTROLNAV
680
+ if (slider.vars.controlNav) methods.controlNav.active();
681
+
682
+ // !CAROUSEL:
683
+ // CANDIDATE: slide active class (for add/remove slide)
684
+ if (!carousel) slider.slides.removeClass(namespace + 'active-slide').eq(target).addClass(namespace + 'active-slide');
685
+
686
+ // INFINITE LOOP:
687
+ // CANDIDATE: atEnd
688
+ slider.atEnd = target === 0 || target === slider.last;
689
+
690
+ // DIRECTIONNAV:
691
+ if (slider.vars.directionNav) methods.directionNav.update();
692
+
693
+ if (target === slider.last) {
694
+ // API: end() of cycle Callback
695
+ slider.vars.end(slider);
696
+ // SLIDESHOW && !INFINITE LOOP:
697
+ if (!slider.vars.animationLoop) slider.pause();
698
+ }
699
+
700
+ // SLIDE:
701
+ if (!fade) {
702
+ var dimension = (vertical) ? slider.slides.filter(':first').height() : slider.computedW,
703
+ margin, slideString, calcNext;
704
+
705
+ // INFINITE LOOP / REVERSE:
706
+ if (carousel) {
707
+ //margin = (slider.vars.itemWidth > slider.w) ? slider.vars.itemMargin * 2 : slider.vars.itemMargin;
708
+ margin = slider.vars.itemMargin;
709
+ calcNext = ((slider.itemW + margin) * slider.move) * slider.animatingTo;
710
+ slideString = (calcNext > slider.limit && slider.visible !== 1) ? slider.limit : calcNext;
711
+ } else if (slider.currentSlide === 0 && target === slider.count - 1 && slider.vars.animationLoop && slider.direction !== "next") {
712
+ slideString = (reverse) ? (slider.count + slider.cloneOffset) * dimension : 0;
713
+ } else if (slider.currentSlide === slider.last && target === 0 && slider.vars.animationLoop && slider.direction !== "prev") {
714
+ slideString = (reverse) ? 0 : (slider.count + 1) * dimension;
715
+ } else {
716
+ slideString = (reverse) ? ((slider.count - 1) - target + slider.cloneOffset) * dimension : (target + slider.cloneOffset) * dimension;
717
+ }
718
+ slider.setProps(slideString, "", slider.vars.animationSpeed);
719
+ if (slider.transitions) {
720
+ if (!slider.vars.animationLoop || !slider.atEnd) {
721
+ slider.animating = false;
722
+ slider.currentSlide = slider.animatingTo;
723
+ }
724
+
725
+ // Unbind previous transitionEnd events and re-bind new transitionEnd event
726
+ slider.container.unbind("webkitTransitionEnd transitionend");
727
+ slider.container.bind("webkitTransitionEnd transitionend", function() {
728
+ clearTimeout(slider.ensureAnimationEnd);
729
+ slider.wrapup(dimension);
730
+ });
731
+
732
+ // Insurance for the ever-so-fickle transitionEnd event
733
+ clearTimeout(slider.ensureAnimationEnd);
734
+ slider.ensureAnimationEnd = setTimeout(function() {
735
+ slider.wrapup(dimension);
736
+ }, slider.vars.animationSpeed + 100);
737
+
738
+ } else {
739
+ slider.container.animate(slider.args, slider.vars.animationSpeed, slider.vars.easing, function(){
740
+ slider.wrapup(dimension);
741
+ });
742
+ }
743
+ } else { // FADE:
744
+ if (!touch) {
745
+ //slider.slides.eq(slider.currentSlide).fadeOut(slider.vars.animationSpeed, slider.vars.easing);
746
+ //slider.slides.eq(target).fadeIn(slider.vars.animationSpeed, slider.vars.easing, slider.wrapup);
747
+
748
+ slider.slides.eq(slider.currentSlide).css({"zIndex": 1}).animate({"opacity": 0}, slider.vars.animationSpeed, slider.vars.easing);
749
+ slider.slides.eq(target).css({"zIndex": 2}).animate({"opacity": 1}, slider.vars.animationSpeed, slider.vars.easing, slider.wrapup);
750
+
751
+ } else {
752
+ slider.slides.eq(slider.currentSlide).css({ "opacity": 0, "zIndex": 1 });
753
+ slider.slides.eq(target).css({ "opacity": 1, "zIndex": 2 });
754
+ slider.wrapup(dimension);
755
+ }
756
+ }
757
+ // SMOOTH HEIGHT:
758
+ if (slider.vars.smoothHeight) methods.smoothHeight(slider.vars.animationSpeed);
759
+ }
760
+ };
761
+ slider.wrapup = function(dimension) {
762
+ // SLIDE:
763
+ if (!fade && !carousel) {
764
+ if (slider.currentSlide === 0 && slider.animatingTo === slider.last && slider.vars.animationLoop) {
765
+ slider.setProps(dimension, "jumpEnd");
766
+ } else if (slider.currentSlide === slider.last && slider.animatingTo === 0 && slider.vars.animationLoop) {
767
+ slider.setProps(dimension, "jumpStart");
768
+ }
769
+ }
770
+ slider.animating = false;
771
+ slider.currentSlide = slider.animatingTo;
772
+ // API: after() animation Callback
773
+ slider.vars.after(slider);
774
+ };
775
+
776
+ // SLIDESHOW:
777
+ slider.animateSlides = function() {
778
+ if (!slider.animating && focused ) slider.flexAnimate(slider.getTarget("next"));
779
+ };
780
+ // SLIDESHOW:
781
+ slider.pause = function() {
782
+ clearInterval(slider.animatedSlides);
783
+ slider.animatedSlides = null;
784
+ slider.playing = false;
785
+ // PAUSEPLAY:
786
+ if (slider.vars.pausePlay) methods.pausePlay.update("play");
787
+ // SYNC:
788
+ if (slider.syncExists) methods.sync("pause");
789
+ };
790
+ // SLIDESHOW:
791
+ slider.play = function() {
792
+ if (slider.playing) clearInterval(slider.animatedSlides);
793
+ slider.animatedSlides = slider.animatedSlides || setInterval(slider.animateSlides, slider.vars.slideshowSpeed);
794
+ slider.started = slider.playing = true;
795
+ // PAUSEPLAY:
796
+ if (slider.vars.pausePlay) methods.pausePlay.update("pause");
797
+ // SYNC:
798
+ if (slider.syncExists) methods.sync("play");
799
+ };
800
+ // STOP:
801
+ slider.stop = function () {
802
+ slider.pause();
803
+ slider.stopped = true;
804
+ };
805
+ slider.canAdvance = function(target, fromNav) {
806
+ // ASNAV:
807
+ var last = (asNav) ? slider.pagingCount - 1 : slider.last;
808
+ return (fromNav) ? true :
809
+ (asNav && slider.currentItem === slider.count - 1 && target === 0 && slider.direction === "prev") ? true :
810
+ (asNav && slider.currentItem === 0 && target === slider.pagingCount - 1 && slider.direction !== "next") ? false :
811
+ (target === slider.currentSlide && !asNav) ? false :
812
+ (slider.vars.animationLoop) ? true :
813
+ (slider.atEnd && slider.currentSlide === 0 && target === last && slider.direction !== "next") ? false :
814
+ (slider.atEnd && slider.currentSlide === last && target === 0 && slider.direction === "next") ? false :
815
+ true;
816
+ };
817
+ slider.getTarget = function(dir) {
818
+ slider.direction = dir;
819
+ if (dir === "next") {
820
+ return (slider.currentSlide === slider.last) ? 0 : slider.currentSlide + 1;
821
+ } else {
822
+ return (slider.currentSlide === 0) ? slider.last : slider.currentSlide - 1;
823
+ }
824
+ };
825
+
826
+ // SLIDE:
827
+ slider.setProps = function(pos, special, dur) {
828
+ var target = (function() {
829
+ var posCheck = (pos) ? pos : ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo,
830
+ posCalc = (function() {
831
+ if (carousel) {
832
+ return (special === "setTouch") ? pos :
833
+ (reverse && slider.animatingTo === slider.last) ? 0 :
834
+ (reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
835
+ (slider.animatingTo === slider.last) ? slider.limit : posCheck;
836
+ } else {
837
+ switch (special) {
838
+ case "setTotal": return (reverse) ? ((slider.count - 1) - slider.currentSlide + slider.cloneOffset) * pos : (slider.currentSlide + slider.cloneOffset) * pos;
839
+ case "setTouch": return (reverse) ? pos : pos;
840
+ case "jumpEnd": return (reverse) ? pos : slider.count * pos;
841
+ case "jumpStart": return (reverse) ? slider.count * pos : pos;
842
+ default: return pos;
843
+ }
844
+ }
845
+ }());
846
+
847
+ return (posCalc * -1) + "px";
848
+ }());
849
+
850
+ if (slider.transitions) {
851
+ target = (vertical) ? "translate3d(0," + target + ",0)" : "translate3d(" + target + ",0,0)";
852
+ dur = (dur !== undefined) ? (dur/1000) + "s" : "0s";
853
+ slider.container.css("-" + slider.pfx + "-transition-duration", dur);
854
+ slider.container.css("transition-duration", dur);
855
+ }
856
+
857
+ slider.args[slider.prop] = target;
858
+ if (slider.transitions || dur === undefined) slider.container.css(slider.args);
859
+
860
+ slider.container.css('transform',target);
861
+ };
862
+
863
+ slider.setup = function(type) {
864
+ // SLIDE:
865
+ if (!fade) {
866
+ var sliderOffset, arr;
867
+
868
+ if (type === "init") {
869
+ slider.viewport = $('<div class="' + namespace + 'viewport"></div>').css({"overflow": "hidden", "position": "relative"}).appendTo(slider).append(slider.container);
870
+ // INFINITE LOOP:
871
+ slider.cloneCount = 0;
872
+ slider.cloneOffset = 0;
873
+ // REVERSE:
874
+ if (reverse) {
875
+ arr = $.makeArray(slider.slides).reverse();
876
+ slider.slides = $(arr);
877
+ slider.container.empty().append(slider.slides);
878
+ }
879
+ }
880
+ // INFINITE LOOP && !CAROUSEL:
881
+ if (slider.vars.animationLoop && !carousel) {
882
+ slider.cloneCount = 2;
883
+ slider.cloneOffset = 1;
884
+ // clear out old clones
885
+ if (type !== "init") slider.container.find('.clone').remove();
886
+ slider.container.append(methods.uniqueID(slider.slides.first().clone().addClass('clone')).attr('aria-hidden', 'true'))
887
+ .prepend(methods.uniqueID(slider.slides.last().clone().addClass('clone')).attr('aria-hidden', 'true'));
888
+ }
889
+ slider.newSlides = $(slider.vars.selector, slider);
890
+
891
+ sliderOffset = (reverse) ? slider.count - 1 - slider.currentSlide + slider.cloneOffset : slider.currentSlide + slider.cloneOffset;
892
+ // VERTICAL:
893
+ if (vertical && !carousel) {
894
+ slider.container.height((slider.count + slider.cloneCount) * 200 + "%").css("position", "absolute").width("100%");
895
+ setTimeout(function(){
896
+ slider.newSlides.css({"display": "block"});
897
+ slider.doMath();
898
+ slider.viewport.height(slider.h);
899
+ slider.setProps(sliderOffset * slider.h, "init");
900
+ }, (type === "init") ? 100 : 0);
901
+ } else {
902
+ slider.container.width((slider.count + slider.cloneCount) * 200 + "%");
903
+ slider.setProps(sliderOffset * slider.computedW, "init");
904
+ setTimeout(function(){
905
+ slider.doMath();
906
+ slider.newSlides.css({"width": slider.computedW, "float": "left", "display": "block"});
907
+ // SMOOTH HEIGHT:
908
+ if (slider.vars.smoothHeight) methods.smoothHeight();
909
+ }, (type === "init") ? 100 : 0);
910
+ }
911
+ } else { // FADE:
912
+ slider.slides.css({"width": "100%", "float": "left", "marginRight": "-100%", "position": "relative"});
913
+ if (type === "init") {
914
+ if (!touch) {
915
+ //slider.slides.eq(slider.currentSlide).fadeIn(slider.vars.animationSpeed, slider.vars.easing);
916
+ if (slider.vars.fadeFirstSlide == false) {
917
+ slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({"zIndex": 2}).css({"opacity": 1});
918
+ } else {
919
+ slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({"zIndex": 2}).animate({"opacity": 1},slider.vars.animationSpeed,slider.vars.easing);
920
+ }
921
+ } else {
922
+ slider.slides.css({ "opacity": 0, "display": "block", "webkitTransition": "opacity " + slider.vars.animationSpeed / 1000 + "s ease", "zIndex": 1 }).eq(slider.currentSlide).css({ "opacity": 1, "zIndex": 2});
923
+ }
924
+ }
925
+ // SMOOTH HEIGHT:
926
+ if (slider.vars.smoothHeight) methods.smoothHeight();
927
+ }
928
+ // !CAROUSEL:
929
+ // CANDIDATE: active slide
930
+ if (!carousel) slider.slides.removeClass(namespace + "active-slide").eq(slider.currentSlide).addClass(namespace + "active-slide");
931
+
932
+ //FlexSlider: init() Callback
933
+ slider.vars.init(slider);
934
+ };
935
+
936
+ slider.doMath = function() {
937
+ var slide = slider.slides.first(),
938
+ slideMargin = slider.vars.itemMargin,
939
+ minItems = slider.vars.minItems,
940
+ maxItems = slider.vars.maxItems;
941
+
942
+ slider.w = (slider.viewport===undefined) ? slider.width() : slider.viewport.width();
943
+ slider.h = slide.height();
944
+ slider.boxPadding = slide.outerWidth() - slide.width();
945
+
946
+ // CAROUSEL:
947
+ if (carousel) {
948
+ slider.itemT = slider.vars.itemWidth + slideMargin;
949
+ slider.minW = (minItems) ? minItems * slider.itemT : slider.w;
950
+ slider.maxW = (maxItems) ? (maxItems * slider.itemT) - slideMargin : slider.w;
951
+ slider.itemW = (slider.minW > slider.w) ? (slider.w - (slideMargin * (minItems - 1)))/minItems :
952
+ (slider.maxW < slider.w) ? (slider.w - (slideMargin * (maxItems - 1)))/maxItems :
953
+ (slider.vars.itemWidth > slider.w) ? slider.w : slider.vars.itemWidth;
954
+
955
+ slider.visible = Math.floor(slider.w/(slider.itemW));
956
+ slider.move = (slider.vars.move > 0 && slider.vars.move < slider.visible ) ? slider.vars.move : slider.visible;
957
+ slider.pagingCount = Math.ceil(((slider.count - slider.visible)/slider.move) + 1);
958
+ slider.last = slider.pagingCount - 1;
959
+ slider.limit = (slider.pagingCount === 1) ? 0 :
960
+ (slider.vars.itemWidth > slider.w) ? (slider.itemW * (slider.count - 1)) + (slideMargin * (slider.count - 1)) : ((slider.itemW + slideMargin) * slider.count) - slider.w - slideMargin;
961
+ } else {
962
+ slider.itemW = slider.w;
963
+ slider.pagingCount = slider.count;
964
+ slider.last = slider.count - 1;
965
+ }
966
+ slider.computedW = slider.itemW - slider.boxPadding;
967
+ };
968
+
969
+ slider.update = function(pos, action) {
970
+ slider.doMath();
971
+
972
+ // update currentSlide and slider.animatingTo if necessary
973
+ if (!carousel) {
974
+ if (pos < slider.currentSlide) {
975
+ slider.currentSlide += 1;
976
+ } else if (pos <= slider.currentSlide && pos !== 0) {
977
+ slider.currentSlide -= 1;
978
+ }
979
+ slider.animatingTo = slider.currentSlide;
980
+ }
981
+
982
+ // update controlNav
983
+ if (slider.vars.controlNav && !slider.manualControls) {
984
+ if ((action === "add" && !carousel) || slider.pagingCount > slider.controlNav.length) {
985
+ methods.controlNav.update("add");
986
+ } else if ((action === "remove" && !carousel) || slider.pagingCount < slider.controlNav.length) {
987
+ if (carousel && slider.currentSlide > slider.last) {
988
+ slider.currentSlide -= 1;
989
+ slider.animatingTo -= 1;
990
+ }
991
+ methods.controlNav.update("remove", slider.last);
992
+ }
993
+ }
994
+ // update directionNav
995
+ if (slider.vars.directionNav) methods.directionNav.update();
996
+
997
+ };
998
+
999
+ slider.addSlide = function(obj, pos) {
1000
+ var $obj = $(obj);
1001
+
1002
+ slider.count += 1;
1003
+ slider.last = slider.count - 1;
1004
+
1005
+ // append new slide
1006
+ if (vertical && reverse) {
1007
+ (pos !== undefined) ? slider.slides.eq(slider.count - pos).after($obj) : slider.container.prepend($obj);
1008
+ } else {
1009
+ (pos !== undefined) ? slider.slides.eq(pos).before($obj) : slider.container.append($obj);
1010
+ }
1011
+
1012
+ // update currentSlide, animatingTo, controlNav, and directionNav
1013
+ slider.update(pos, "add");
1014
+
1015
+ // update slider.slides
1016
+ slider.slides = $(slider.vars.selector + ':not(.clone)', slider);
1017
+ // re-setup the slider to accomdate new slide
1018
+ slider.setup();
1019
+
1020
+ //FlexSlider: added() Callback
1021
+ slider.vars.added(slider);
1022
+ };
1023
+ slider.removeSlide = function(obj) {
1024
+ var pos = (isNaN(obj)) ? slider.slides.index($(obj)) : obj;
1025
+
1026
+ // update count
1027
+ slider.count -= 1;
1028
+ slider.last = slider.count - 1;
1029
+
1030
+ // remove slide
1031
+ if (isNaN(obj)) {
1032
+ $(obj, slider.slides).remove();
1033
+ } else {
1034
+ (vertical && reverse) ? slider.slides.eq(slider.last).remove() : slider.slides.eq(obj).remove();
1035
+ }
1036
+
1037
+ // update currentSlide, animatingTo, controlNav, and directionNav
1038
+ slider.doMath();
1039
+ slider.update(pos, "remove");
1040
+
1041
+ // update slider.slides
1042
+ slider.slides = $(slider.vars.selector + ':not(.clone)', slider);
1043
+ // re-setup the slider to accomdate new slide
1044
+ slider.setup();
1045
+
1046
+ // FlexSlider: removed() Callback
1047
+ slider.vars.removed(slider);
1048
+ };
1049
+
1050
+ //FlexSlider: Initialize
1051
+ methods.init();
1052
+ };
1053
+
1054
+ // Ensure the slider isn't focussed if the window loses focus.
1055
+ $( window ).blur( function ( e ) {
1056
+ focused = false;
1057
+ }).focus( function ( e ) {
1058
+ focused = true;
1059
+ });
1060
+
1061
+ //FlexSlider: Default Settings
1062
+ $.flexslider.defaults = {
1063
+ namespace: "flex-", //{NEW} String: Prefix string attached to the class of every element generated by the plugin
1064
+ selector: ".slides > li", //{NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril
1065
+ animation: "fade", //String: Select your animation type, "fade" or "slide"
1066
+ easing: "swing", //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!
1067
+ direction: "horizontal", //String: Select the sliding direction, "horizontal" or "vertical"
1068
+ reverse: false, //{NEW} Boolean: Reverse the animation direction
1069
+ animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
1070
+ smoothHeight: false, //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode
1071
+ startAt: 0, //Integer: The slide that the slider should start on. Array notation (0 = first slide)
1072
+ slideshow: true, //Boolean: Animate slider automatically
1073
+ slideshowSpeed: 7000, //Integer: Set the speed of the slideshow cycling, in milliseconds
1074
+ animationSpeed: 600, //Integer: Set the speed of animations, in milliseconds
1075
+ initDelay: 0, //{NEW} Integer: Set an initialization delay, in milliseconds
1076
+ randomize: false, //Boolean: Randomize slide order
1077
+ fadeFirstSlide: true, //Boolean: Fade in the first slide when animation type is "fade"
1078
+ thumbCaptions: false, //Boolean: Whether or not to put captions on thumbnails when using the "thumbnails" controlNav.
1079
+
1080
+ // Usability features
1081
+ pauseOnAction: true, //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
1082
+ pauseOnHover: false, //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
1083
+ pauseInvisible: true, //{NEW} Boolean: Pause the slideshow when tab is invisible, resume when visible. Provides better UX, lower CPU usage.
1084
+ useCSS: true, //{NEW} Boolean: Slider will use CSS3 transitions if available
1085
+ touch: true, //{NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices
1086
+ video: false, //{NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches
1087
+
1088
+ // Primary Controls
1089
+ controlNav: true, //Boolean: Create navigation for paging control of each slide? Note: Leave true for manualControls usage
1090
+ directionNav: true, //Boolean: Create navigation for previous/next navigation? (true/false)
1091
+ prevText: "Previous", //String: Set the text for the "previous" directionNav item
1092
+ nextText: "Next", //String: Set the text for the "next" directionNav item
1093
+
1094
+ // Secondary Navigation
1095
+ keyboard: true, //Boolean: Allow slider navigating via keyboard left/right keys
1096
+ multipleKeyboard: false, //{NEW} Boolean: Allow keyboard navigation to affect multiple sliders. Default behavior cuts out keyboard navigation with more than one slider present.
1097
+ mousewheel: false, //{UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel
1098
+ pausePlay: false, //Boolean: Create pause/play dynamic element
1099
+ pauseText: "Pause", //String: Set the text for the "pause" pausePlay item
1100
+ playText: "Play", //String: Set the text for the "play" pausePlay item
1101
+
1102
+ // Special properties
1103
+ controlsContainer: "", //{UPDATED} jQuery Object/Selector: Declare which container the navigation elements should be appended too. Default container is the FlexSlider element. Example use would be $(".flexslider-container"). Property is ignored if given element is not found.
1104
+ manualControls: "", //{UPDATED} jQuery Object/Selector: Declare custom control navigation. Examples would be $(".flex-control-nav li") or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs.
1105
+ sync: "", //{NEW} Selector: Mirror the actions performed on this slider with another slider. Use with care.
1106
+ asNavFor: "", //{NEW} Selector: Internal property exposed for turning the slider into a thumbnail navigation for another slider
1107
+
1108
+ // Carousel Options
1109
+ itemWidth: 0, //{NEW} Integer: Box-model width of individual carousel items, including horizontal borders and padding.
1110
+ itemMargin: 0, //{NEW} Integer: Margin between carousel items.
1111
+ minItems: 1, //{NEW} Integer: Minimum number of carousel items that should be visible. Items will resize fluidly when below this.
1112
+ maxItems: 0, //{NEW} Integer: Maxmimum number of carousel items that should be visible. Items will resize fluidly when above this limit.
1113
+ move: 0, //{NEW} Integer: Number of carousel items that should move on animation. If 0, slider will move all visible items.
1114
+ allowOneSlide: true, //{NEW} Boolean: Whether or not to allow a slider comprised of a single slide
1115
+
1116
+ // Callback API
1117
+ start: function(){}, //Callback: function(slider) - Fires when the slider loads the first slide
1118
+ before: function(){}, //Callback: function(slider) - Fires asynchronously with each slider animation
1119
+ after: function(){}, //Callback: function(slider) - Fires after each slider animation completes
1120
+ end: function(){}, //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)
1121
+ added: function(){}, //{NEW} Callback: function(slider) - Fires after a slide is added
1122
+ removed: function(){}, //{NEW} Callback: function(slider) - Fires after a slide is removed
1123
+ init: function() {} //{NEW} Callback: function(slider) - Fires after the slider is initially setup
1124
+ };
1125
+
1126
+ //FlexSlider: Plugin Function
1127
+ $.fn.flexslider = function(options) {
1128
+ if (options === undefined) options = {};
1129
+
1130
+ if (typeof options === "object") {
1131
+ return this.each(function() {
1132
+ var $this = $(this),
1133
+ selector = (options.selector) ? options.selector : ".slides > li",
1134
+ $slides = $this.find(selector);
1135
+
1136
+ if ( ( $slides.length === 1 && options.allowOneSlide === true ) || $slides.length === 0 ) {
1137
+ $slides.fadeIn(400);
1138
+ if (options.start) options.start($this);
1139
+ } else if ($this.data('flexslider') === undefined) {
1140
+ new $.flexslider(this, options);
1141
+ }
1142
+ });
1143
+ } else {
1144
+ // Helper strings to quickly perform functions on the slider
1145
+ var $slider = $(this).data('flexslider');
1146
+ switch (options) {
1147
+ case "play": $slider.play(); break;
1148
+ case "pause": $slider.pause(); break;
1149
+ case "stop": $slider.stop(); break;
1150
+ case "next": $slider.flexAnimate($slider.getTarget("next"), true); break;
1151
+ case "prev":
1152
+ case "previous": $slider.flexAnimate($slider.getTarget("prev"), true); break;
1153
+ default: if (typeof options === "number") $slider.flexAnimate(options, true);
1154
+ }
1155
+ }
1156
+ };
1157
+ })(jQuery);
js/jquery.reveal.js ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery Reveal Plugin 1.0
3
+ * www.ZURB.com
4
+ * Copyright 2010, ZURB
5
+ * Free to use under the MIT license.
6
+ * http://www.opensource.org/licenses/mit-license.php
7
+ */
8
+
9
+
10
+ (function($) {
11
+
12
+ /*---------------------------
13
+ Defaults for Reveal
14
+ ----------------------------*/
15
+
16
+ /*---------------------------
17
+ Listener for data-reveal-id attributes
18
+ ----------------------------*/
19
+
20
+ $('a[data-reveal-id]').live('click', function(e) {
21
+ e.preventDefault();
22
+ var modalLocation = $(this).attr('data-reveal-id');
23
+ $('#'+modalLocation).reveal($(this).data());
24
+ });
25
+
26
+ /*---------------------------
27
+ Extend and Execute
28
+ ----------------------------*/
29
+
30
+ $.fn.reveal = function(options) {
31
+
32
+
33
+ var defaults = {
34
+ animation: 'fadeAndPop', //fade, fadeAndPop, none
35
+ animationspeed: 300, //how fast animtions are
36
+ closeonbackgroundclick: true, //if you click background will modal close?
37
+ dismissmodalclass: 'close-reveal-modal' //the class of a button or element that will close an open modal
38
+ };
39
+
40
+ //Extend dem' options
41
+ var options = $.extend({}, defaults, options);
42
+
43
+ return this.each(function() {
44
+
45
+ /*---------------------------
46
+ Global Variables
47
+ ----------------------------*/
48
+ var modal = $(this),
49
+ topMeasure = 0,
50
+ topOffset = modal.height() + topMeasure,
51
+ locked = false,
52
+ modalBG = $('.reveal-modal-bg');
53
+
54
+ /*---------------------------
55
+ Create Modal BG
56
+ ----------------------------*/
57
+ if(modalBG.length == 0) {
58
+ modalBG = $('<div class="reveal-modal-bg" />').insertAfter(modal);
59
+ }
60
+
61
+ /*---------------------------
62
+ Open & Close Animations
63
+ ----------------------------*/
64
+ //Entrance Animations
65
+ modal.bind('reveal:open', function () {
66
+ modalBG.unbind('click.modalEvent');
67
+ $('.' + options.dismissmodalclass).unbind('click.modalEvent');
68
+ if(!locked) {
69
+ lockModal();
70
+ if(options.animation == "fadeAndPop") {
71
+ modal.css({'top': $(document).scrollTop()-topOffset, 'opacity' : 0, 'visibility' : 'visible'});
72
+ modalBG.fadeIn(options.animationspeed/2);
73
+ modal.delay(options.animationspeed/2).animate({
74
+ "top": $(document).scrollTop()+topMeasure + 'px',
75
+ "opacity" : 1
76
+ }, options.animationspeed,unlockModal());
77
+ }
78
+ if(options.animation == "fade") {
79
+ console.log(topMeasure);
80
+ modal.css({'opacity' : 0, 'visibility' : 'visible', 'top': $(document).scrollTop()+topMeasure});
81
+ modalBG.fadeIn(options.animationspeed/2);
82
+ modal.delay(options.animationspeed/2).animate({
83
+ "opacity" : 1
84
+ }, options.animationspeed,unlockModal());
85
+ }
86
+ if(options.animation == "none") {
87
+ modal.css({'visibility' : 'visible', 'top':$(document).scrollTop()+topMeasure});
88
+ modalBG.css({"display":"block"});
89
+ unlockModal()
90
+ }
91
+ }
92
+ modal.unbind('reveal:open');
93
+ });
94
+
95
+ //Closing Animation
96
+ modal.bind('reveal:close', function () {
97
+
98
+ if(!locked) {
99
+
100
+ lockModal();
101
+ jQuery('.flex-prev').css("opacity","0");
102
+ jQuery('.flex-next').css("opacity","0");
103
+ if(options.animation == "fadeAndPop") {
104
+ modalBG.delay(options.animationspeed).fadeOut(options.animationspeed);
105
+ modal.animate({
106
+ "top": $(document).scrollTop()-topOffset + 'px',
107
+ "opacity" : 0
108
+ }, options.animationspeed/2, function() {
109
+ modal.css({'top':topMeasure, 'opacity' : 1, 'visibility' : 'hidden'});
110
+ unlockModal();
111
+ });
112
+ }
113
+ if(options.animation == "fade") {
114
+ modalBG.delay(options.animationspeed).fadeOut(options.animationspeed);
115
+ modal.animate({
116
+ "opacity" : 0
117
+ }, options.animationspeed, function() {
118
+ modal.css({'opacity' : 1, 'visibility' : 'hidden', 'top' : topMeasure});
119
+ unlockModal();
120
+ });
121
+ }
122
+ if(options.animation == "none") {
123
+ modal.css({'visibility' : 'hidden', 'top' : topMeasure});
124
+ modalBG.css({'display' : 'none'});
125
+ }
126
+ }
127
+ modal.unbind('reveal:close');
128
+ });
129
+
130
+ /*---------------------------
131
+ Open and add Closing Listeners
132
+ ----------------------------*/
133
+ //Open Modal Immediately
134
+ modal.trigger('reveal:open')
135
+
136
+ //Close Modal Listeners
137
+ var closeButton = $('.' + options.dismissmodalclass).bind('click.modalEvent', function () {
138
+ modal.trigger('reveal:close')
139
+ });
140
+
141
+ if(options.closeonbackgroundclick) {
142
+ modalBG.css({"cursor":"pointer"})
143
+ modalBG.bind('click.modalEvent', function () {
144
+ modal.trigger('reveal:close')
145
+ });
146
+ }
147
+ $('body').keyup(function(e) {
148
+ if(e.which===27){ modal.trigger('reveal:close'); } // 27 is the keycode for the Escape key
149
+ });
150
+
151
+
152
+ /*---------------------------
153
+ Animations Locks
154
+ ----------------------------*/
155
+ function unlockModal() {
156
+ locked = false;
157
+ }
158
+ function lockModal() {
159
+ locked = true;
160
+ }
161
+
162
+ });//each call
163
+ }//orbit plugin call
164
+ })(jQuery);
165
+
js/polls/yop-poll-add-edit.js CHANGED
@@ -26,19 +26,48 @@ jQuery( document ).ready( function( jQuery ) {
26
  jQuery("#yop_poll_email_notification").hide();
27
  }
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  if( jQuery( '#yop-poll-vote-permisions-guest' ).attr( "checked" ) == 'checked' ) {
30
 
31
- jQuery( '#yop-poll-vote-anonymous' ).show();
 
 
 
 
 
32
 
33
  }
34
  else{
35
- jQuery( '#yop-poll-vote-anonymous' ).hide();
36
  }
37
  jQuery("#yop-poll-edit-add-new-form").css('visibility', 'visible');
38
  if(jQuery('#yop-poll-send-email-notifications-yes').attr("checked")=='checked'){
39
  jQuery("#yop_poll_email_notification").show();
40
  }
41
- yop_poll_answers_sortable = function() {
 
 
42
  jQuery( ".yop-poll-answers-sortable" ).sortable( {
43
  update: function( event, ui ) {
44
  Ordinable = ui.item.parent().find( '.yop-poll-answer-order-input' );
@@ -104,39 +133,119 @@ jQuery( document ).ready( function( jQuery ) {
104
  jQuery("#yop_poll_email_notification").hide();
105
 
106
  });
107
- jQuery( '#yop-poll-vote-permisions-guest' ).change( function() {
108
 
109
- if( jQuery( '#yop-poll-vote-permisions-registered' ).attr( "checked" ) != 'checked' ) {
110
- jQuery( '.yop-poll-vote-as-div' ).hide();
111
- }
112
- if( jQuery( '#yop-poll-vote-permisions-registered' ).attr( "checked" ) == 'checked' ) {
113
- jQuery( '#yop-poll-vote-anonymous' ).show();
114
- }
 
115
 
116
- if( jQuery( '#yop-poll-vote-permisions-guest' ).attr( "checked" ) == 'checked' ) {
117
 
118
- jQuery( '#yop-poll-vote-anonymous' ).hide();
119
- jQuery( '#yop-poll-vote-permisions-anonymous-yes' ).attr( "checked",true );
 
 
120
 
121
- }
 
 
 
 
 
 
 
122
 
123
- } );
124
- jQuery( '#yop-poll-vote-permisions-registered' ).change( function() {
125
- if( jQuery( this ).attr( 'checked' ) == "checked" ) {
126
- jQuery( '.yop-poll-vote-as-div' ).show();
127
- jQuery( '#yop-poll-vote-anonymous' ).show();
 
128
 
129
- }
130
- else {
131
- jQuery( '.yop-poll-vote-as-div' ).hide();
132
- }
133
- if( jQuery( '#yop-poll-vote-permisions-guest' ).attr( "checked" ) == 'checked' ) {
134
 
135
- jQuery( '#yop-poll-vote-anonymous' ).hide();
136
- jQuery( '#yop-poll-vote-permisions-anonymous-yes' ).attr( "checked",true );
137
- }
 
 
 
138
 
139
- } );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  //</editor-fold>
141
  if( jQuery( '#yop-poll-view-results-custom' ).is( ':checked' )==true){
142
  jQuery( '#yop-poll-display-view-results-div' ).show();
@@ -252,19 +361,47 @@ jQuery( document ).ready( function( jQuery ) {
252
  //yop_poll_reorder_questions();
253
  jQuery(".yop_poll_tooltip-buy_pro" ).click( function(){
254
  var id=this.id;
 
 
 
 
 
 
 
 
255
  //console.log(id);
256
  if(id=='add_new_media_question2'){
257
- jQuery('.yop-poll-buy-template-li').removeClass('yop-poll-buy-template-selected');
258
- jQuery('#yop-poll-buy-template-2').addClass('yop-poll-buy-template-selected');
 
 
 
 
 
 
 
259
  }
260
  if(id=='add_new_text_question2')
261
  {
262
- jQuery('.yop-poll-buy-template-li').removeClass('yop-poll-buy-template-selected');
263
- jQuery('#yop-poll-buy-template-1').addClass('yop-poll-buy-template-selected');
 
 
 
 
 
 
 
264
  }
265
  if(id=='yop-poll-1'){
266
- jQuery('.yop-poll-buy-template-li').removeClass('yop-poll-buy-template-selected');
267
- jQuery('#yop-poll-buy-template-4').addClass('yop-poll-buy-template-selected');
 
 
 
 
 
 
268
  }
269
  if(id=='yop-poll-vote-permisions-facebook-integration-yes' || id=='yop-poll-vote-permisions-facebook-no' ||
270
  id=='yop-poll-facebook-share-after-vote-yes' || id=='yop-poll-facebook-share-after-vote-no' ||
@@ -276,53 +413,42 @@ jQuery( document ).ready( function( jQuery ) {
276
 
277
 
278
 
279
- jQuery('.yop-poll-buy-template-li').removeClass('yop-poll-buy-template-selected');
280
-
281
- jQuery("#yop-poll-buy-template-3").addClass('yop-poll-buy-template-selected');
282
- }
283
- if(id=='yop-poll-user-interface-type-beginner' || id=='yop-poll-user-interface-type-advanced'){
284
- jQuery('.yop-poll-buy-template-li').removeClass('yop-poll-buy-template-selected');
285
- jQuery("#yop-poll-buy-template-0").addClass('yop-poll-buy-template-selected');
 
286
  }
 
287
  if(id=='yop-poll-for-slider-page'||id=='yop-poll-for-slider-page1'){
288
- jQuery('.yop-poll-buy-template-li').removeClass('yop-poll-buy-template-selected');
289
- jQuery("#yop-poll-buy-template-3").addClass('yop-poll-buy-template-selected');
 
 
 
 
 
 
 
290
  }
291
  if(id=='yop-poll-for-slider-page-7'){
292
- jQuery('.yop-poll-buy-template-li').removeClass('yop-poll-buy-template-selected');
293
- jQuery("#yop-poll-buy-template-5").addClass('yop-poll-buy-template-selected');
294
- }
295
-
296
-
297
-
298
-
299
- jQuery(".yop_poll_pro_feature").dialog({
300
-
301
- height: '650',
302
-
303
- width: 'auto',
304
 
305
- resizable: false,
306
-
307
- modal: true,
308
-
309
- dialogClass: 'fixed-dialog'
310
-
311
- //position:{top:'top+100'}
312
-
313
- });
314
- jQuery( "#yop-poll-buy-template-slider" ).jcarousel( 'scroll', jQuery( '.yop-poll-buy-template-selected' ) );
315
- //if (jQuery(this).is(':radio')) {
316
- // jQuery(this ).attr('checked', false);
317
-
318
- // }
319
- // jQuery(".yop_poll_pro_feature").removeClass('yop-poll-buy-template-selected');
320
  });
321
- jQuery('#yop-poll-pro-close').click(function() {
322
 
323
- jQuery(".yop_poll_pro_feature").dialog('close');
324
-
325
- });
326
 
327
  } );
328
 
26
  jQuery("#yop_poll_email_notification").hide();
27
  }
28
 
29
+ if( jQuery( "#yop-poll-vote-permisions-registered" ).attr( "checked" ) != 'checked' ) {
30
+
31
+ jQuery( '#yop-poll-vote-permisions-wordpress-div' ).hide();
32
+
33
+ }
34
+ else
35
+ {
36
+
37
+ if(jQuery('#yop-poll-vote-permisions-anonymous-yes' ).attr("checked")=="checked")
38
+ jQuery('#yop-poll-vote-permisions-anonymous-div' ).show();
39
+ else
40
+ jQuery('#yop-poll-vote-permisions-anonymous-div').hide();
41
+ if( jQuery( "#yop-poll-vote-permisions-registered" ).attr( "checked" ) != 'checked' ) {
42
+
43
+ jQuery( '#yop-poll-vote-permisions-wordpress-div' ).hide();
44
+ }
45
+ else
46
+ if(jQuery('#yop-poll-vote-permisions-wordpress-yes' ).attr("checked")=="checked")
47
+ jQuery('#yop-poll-vote-permisions-wordpress-div' ).show();
48
+ else
49
+ jQuery('#yop-poll-vote-permisions-anonymous-div').hide();
50
+ }
51
  if( jQuery( '#yop-poll-vote-permisions-guest' ).attr( "checked" ) == 'checked' ) {
52
 
53
+ jQuery( '#yop-poll-vote-anonymous' ).hide();
54
+ jQuery( '#yop-poll-vote-permisions-anonymous-div' ).show();
55
+ if( jQuery( '#yop-poll-vote-permisions-registered').attr("checked")!="checked"){
56
+ jQuery( '#yop-poll-vote-permisions-anonymous-label-div' ).hide();
57
+ }
58
+
59
 
60
  }
61
  else{
62
+ jQuery( '#yop-poll-vote-anonymous' ).show();
63
  }
64
  jQuery("#yop-poll-edit-add-new-form").css('visibility', 'visible');
65
  if(jQuery('#yop-poll-send-email-notifications-yes').attr("checked")=='checked'){
66
  jQuery("#yop_poll_email_notification").show();
67
  }
68
+
69
+
70
+ yop_poll_answers_sortable = function() {
71
  jQuery( ".yop-poll-answers-sortable" ).sortable( {
72
  update: function( event, ui ) {
73
  Ordinable = ui.item.parent().find( '.yop-poll-answer-order-input' );
133
  jQuery("#yop_poll_email_notification").hide();
134
 
135
  });
136
+ jQuery( '#yop-poll-vote-permisions-guest' ).change( function() {
137
 
138
+ if( jQuery( '#yop-poll-vote-permisions-registered' ).attr( "checked" ) != 'checked' ) {
139
+ jQuery( '.yop-poll-vote-as-div' ).hide();
140
+ }
141
+ if( jQuery( '#yop-poll-vote-permisions-registered' ).attr( "checked" ) == 'checked' ) {
142
+ jQuery( '#yop-poll-vote-anonymous' ).show();
143
+ jQuery( '#yop-poll-vote-permisions-anonymous-label-div' ).show();
144
+ }
145
 
146
+ if( jQuery( '#yop-poll-vote-permisions-guest' ).attr( "checked" ) == 'checked' ) {
147
 
148
+ jQuery( '#yop-poll-vote-anonymous' ).hide();
149
+ jQuery( '#yop-poll-vote-permisions-anonymous-yes' ).attr( "checked",true );
150
+ jQuery('#yop-poll-vote-permisions-anonymous-div' ).show();
151
+ jQuery( '#yop-poll-vote-permisions-anonymous-label-div' ).show();
152
 
153
+ }
154
+ if( jQuery( '#yop-poll-vote-permisions-guest' ).attr( "checked" ) != 'checked' &&jQuery( '#yop-poll-vote-permisions-registered' ).attr( "checked" ) != 'checked')
155
+ jQuery( '#yop-poll-vote-permisions-anonymous-label-div' ).hide();
156
+ else
157
+ jQuery( '#yop-poll-vote-permisions-anonymous-label-div' ).show();
158
+ if( jQuery( '#yop-poll-vote-permisions-registered').attr("checked")!="checked"){
159
+ jQuery( '#yop-poll-vote-permisions-anonymous-label-div' ).hide();
160
+ }
161
 
162
+ } );
163
+ jQuery('#yop-poll-vote-permisions-wordpress-no').change(function(){
164
+ if(jQuery('#yop-poll-vote-permisions-wordpress-yes' ).attr("checked")=="checked")
165
+ jQuery('#yop-poll-vote-permisions-wordpress-div' ).show();
166
+ else
167
+ jQuery('#yop-poll-vote-permisions-wordpress-div').hide();
168
 
 
 
 
 
 
169
 
170
+ });
171
+ jQuery('#yop-poll-vote-permisions-wordpress-yes').change(function(){
172
+ if(jQuery('#yop-poll-vote-permisions-google-yes' ).attr("checked")=="checked")
173
+ jQuery('#yop-poll-vote-permisions-google-div' ).show();
174
+ else
175
+ jQuery('#yop-poll-vote-permisions-google-div').hide();
176
 
177
+ });
178
+ jQuery('#yop-poll-vote-permisions-google-no').change(function(){
179
+ if(jQuery('#yop-poll-vote-permisions-google-yes' ).attr("checked")=="checked")
180
+ jQuery('#yop-poll-vote-permisions-google-div' ).show();
181
+ else
182
+ jQuery('#yop-poll-vote-permisions-google-div').hide();
183
+
184
+ }); jQuery('#yop-poll-vote-permisions-wordpress-yes').change(function(){
185
+ if(jQuery('#yop-poll-vote-permisions-wordpress-yes' ).attr("checked")=="checked")
186
+ jQuery('#yop-poll-vote-permisions-wordpress-div' ).show();
187
+ else
188
+ jQuery('#yop-poll-vote-permisions-wordpress-div').hide();
189
+
190
+ });
191
+ jQuery('#yop-poll-vote-permisions-anonymous-no').change(function(){
192
+ if(jQuery('#yop-poll-vote-permisions-anonymous-yes' ).attr("checked")=="checked")
193
+ jQuery('#yop-poll-vote-permisions-anonymous-div' ).show();
194
+ else
195
+ jQuery('#yop-poll-vote-permisions-anonymous-div').hide();
196
+
197
+ });
198
+ jQuery('#yop-poll-vote-permisions-facebook-yes').change(function(){
199
+ if(jQuery('#yop-poll-vote-permisions-facebook-yes' ).attr("checked")=="checked")
200
+ jQuery('#yop-poll-vote-permisions-facebook-div' ).show();
201
+ else
202
+ jQuery('#yop-poll-vote-permisions-facebook-div').hide();
203
+
204
+ });
205
+ jQuery('#yop-poll-vote-permisions-facebook-no').change(function(){
206
+ if(jQuery('#yop-poll-vote-permisions-facebook-yes' ).attr("checked")=="checked")
207
+ jQuery('#yop-poll-vote-permisions-facebook-div' ).show();
208
+ else
209
+ jQuery('#yop-poll-vote-permisions-facebook-div').hide();
210
+
211
+ });
212
+ jQuery('#yop-poll-vote-permisions-anonymous-yes').change(function(){
213
+ if(jQuery('#yop-poll-vote-permisions-anonymous-yes' ).attr("checked")=="checked")
214
+ jQuery('#yop-poll-vote-permisions-anonymous-div' ).show();
215
+ else
216
+ jQuery('#yop-poll-vote-permisions-anonymous-div').hide();
217
+
218
+ });
219
+ jQuery( '#yop-poll-vote-permisions-registered' ).change( function() {
220
+ if( jQuery( this ).attr( 'checked' ) == "checked" ) {
221
+ jQuery( '.yop-poll-vote-as-div' ).show();
222
+ jQuery( '#yop-poll-vote-anonymous' ).show();
223
+ jQuery( '#yop-poll-vote-permisions-anonymous-label-div' ).show();
224
+
225
+ }
226
+ else {
227
+ jQuery( '.yop-poll-vote-as-div' ).hide();
228
+ }
229
+ if( jQuery( '#yop-poll-vote-permisions-guest' ).attr( "checked" ) == 'checked' ) {
230
+
231
+ jQuery( '#yop-poll-vote-anonymous' ).hide();
232
+ jQuery( '#yop-poll-vote-permisions-anonymous-yes' ).attr( "checked",true );
233
+ jQuery( '#yop-poll-vote-permisions-anonymous-label-div' ).show();
234
+ }
235
+ if( jQuery( '#yop-poll-vote-permisions-guest' ).attr( "checked" ) != 'checked' &&jQuery( '#yop-poll-vote-permisions-registered' ).attr( "checked" ) != 'checked')
236
+ jQuery( '#yop-poll-vote-permisions-anonymous-label-div' ).hide();
237
+ else
238
+ jQuery( '#yop-poll-vote-permisions-anonymous-label-div' ).show();
239
+ if( jQuery( '#yop-poll-vote-permisions-guest' ).attr( "checked" ) != 'checked' &&jQuery( '#yop-poll-vote-permisions-registered' ).attr( "checked" ) != 'checked')
240
+ jQuery( '#yop-poll-vote-permisions-anonymous-label-div' ).hide();
241
+ else
242
+ jQuery( '#yop-poll-vote-permisions-anonymous-label-div' ).show();
243
+ if( jQuery( '#yop-poll-vote-permisions-registered').attr("checked")!="checked"){
244
+ jQuery( '#yop-poll-vote-permisions-anonymous-label-div' ).hide();
245
+ }
246
+
247
+
248
+ } );
249
  //</editor-fold>
250
  if( jQuery( '#yop-poll-view-results-custom' ).is( ':checked' )==true){
251
  jQuery( '#yop-poll-display-view-results-div' ).show();
361
  //yop_poll_reorder_questions();
362
  jQuery(".yop_poll_tooltip-buy_pro" ).click( function(){
363
  var id=this.id;
364
+ jQuery('#myModal').reveal({
365
+ animation: 'fade',
366
+ animationspeed: 300,
367
+ closeonbackgroundclick: false,
368
+ dismissmodalclass: 'close-reveal-modal',
369
+ slideshowSpeed: 70000
370
+ });
371
+
372
  //console.log(id);
373
  if(id=='add_new_media_question2'){
374
+ jQuery('.flexslider').flexslider({
375
+ startAt: 0,
376
+ slideshow: true,
377
+ slideshowSpeed: 7000
378
+ });
379
+ jQuery(".flexslider").data('flexslider').flexAnimate(0, true);
380
+ jQuery('.flex-prev').css("opacity","0.7");
381
+ jQuery('.flex-next').css("opacity","0.7");
382
+
383
  }
384
  if(id=='add_new_text_question2')
385
  {
386
+ jQuery('.flexslider').flexslider({
387
+ startAt: 0,
388
+ slideshow: true,
389
+ slideshowSpeed: 7000
390
+ });
391
+ jQuery(".flexslider").data('flexslider').flexAnimate(0, true);
392
+ jQuery('.flex-prev').css("opacity","0.7");
393
+ jQuery('.flex-next').css("opacity","0.7");
394
+
395
  }
396
  if(id=='yop-poll-1'){
397
+ jQuery('.flexslider').flexslider({
398
+ startAt: 3,
399
+ slideshow: true,
400
+ slideshowSpeed: 7000
401
+ });
402
+ jQuery(".flexslider").data('flexslider').flexAnimate(3, true);
403
+ jQuery('.flex-prev').css("opacity","0.7");
404
+ jQuery('.flex-next').css("opacity","0.7");
405
  }
406
  if(id=='yop-poll-vote-permisions-facebook-integration-yes' || id=='yop-poll-vote-permisions-facebook-no' ||
407
  id=='yop-poll-facebook-share-after-vote-yes' || id=='yop-poll-facebook-share-after-vote-no' ||
413
 
414
 
415
 
416
+ jQuery('.flexslider').flexslider({
417
+ startAt: 2,
418
+ slideshow: true,
419
+ slideshowSpeed: 8000
420
+ });
421
+ jQuery(".flexslider").data('flexslider').flexAnimate(2, false);
422
+ jQuery('.flex-prev').css("opacity","0.7");
423
+ jQuery('.flex-next').css("opacity","0.7");
424
  }
425
+
426
  if(id=='yop-poll-for-slider-page'||id=='yop-poll-for-slider-page1'){
427
+ jQuery('.flexslider').flexslider({
428
+ startAt: 2,
429
+ slideshow: true,
430
+ slideshowSpeed: 8000
431
+ });
432
+
433
+ jQuery(".flexslider").data('flexslider').flexAnimate(2, false);
434
+ jQuery('.flex-prev').css("opacity","0.7");
435
+ jQuery('.flex-next').css("opacity","0.7");
436
  }
437
  if(id=='yop-poll-for-slider-page-7'){
438
+ jQuery('.yop-poll-buy-template-li').removeClass('flex-active-slide');
439
+ jQuery('#yop-poll-buy-template-5').addClass('flex-active-slide');
440
+ jQuery('.flexslider').flexslider({
441
+ startAt: 4,
442
+ slideshow: true,
443
+ slideshowSpeed: 8000
444
+ });
445
+ jQuery(".flexslider").data('flexslider').flexAnimate(4, false);
446
+ jQuery('.flex-prev').css("opacity","0.7");
447
+ jQuery('.flex-next').css("opacity","0.7");
 
 
448
 
449
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
450
  });
 
451
 
 
 
 
452
 
453
  } );
454
 
js/polls/yop-poll-results-votes.js CHANGED
@@ -3,9 +3,9 @@ jQuery( document ).ready( function( jQuery ) {
3
  jQuery(".yop_poll_tooltip-buy_pro" ).click( function(){
4
  jQuery(".yop_poll_pro_feature").dialog({
5
 
6
- height: '650',
7
 
8
- width: 'auto',
9
 
10
  resizable: false,
11
 
3
  jQuery(".yop_poll_tooltip-buy_pro" ).click( function(){
4
  jQuery(".yop_poll_pro_feature").dialog({
5
 
6
+ height: '700',
7
 
8
+ width: '750',
9
 
10
  resizable: false,
11
 
js/yop-poll-admin-templates.js CHANGED
@@ -49,9 +49,9 @@ jQuery(document).ready(function(jQuery) {
49
 
50
  jQuery(".yop_poll_pro_feature").dialog({
51
 
52
- height: '650',
53
 
54
- width: 'auto',
55
 
56
  resizable: false,
57
 
49
 
50
  jQuery(".yop_poll_pro_feature").dialog({
51
 
52
+ height: '700',
53
 
54
+ width: '750',
55
 
56
  resizable: false,
57
 
js/yop-poll-admin.js CHANGED
@@ -2,77 +2,96 @@ var write_console = false;
2
  var yoppolltitlehint;
3
  jQuery(".yop_poll_tooltip-buy_pro" ).click( function(){
4
  var id=this.id;
 
 
 
 
 
 
 
 
 
5
  //console.log(id);
6
  if(id=='add_new_media_question2'){
7
- jQuery('.yop-poll-buy-template-li').removeClass('yop-poll-buy-template-selected');
8
- jQuery('#yop-poll-buy-template-2').addClass('yop-poll-buy-template-selected');
 
 
 
 
 
 
 
9
  }
10
  if(id=='add_new_text_question2')
11
  {
12
- jQuery('.yop-poll-buy-template-li').removeClass('yop-poll-buy-template-selected');
13
- jQuery('#yop-poll-buy-template-1').addClass('yop-poll-buy-template-selected');
 
 
 
 
 
 
 
14
  }
15
  if(id=='yop-poll-1'){
16
- jQuery('.yop-poll-buy-template-li').removeClass('yop-poll-buy-template-selected');
17
- jQuery('#yop-poll-buy-template-4').addClass('yop-poll-buy-template-selected');
 
 
 
 
 
 
18
  }
19
  if(id=='yop-poll-vote-permisions-facebook-integration-yes' || id=='yop-poll-vote-permisions-facebook-no' ||
20
- id=='yop-poll-facebook-share-after-vote-yes' || id=='yop-poll-facebook-share-after-vote-no' ||
21
- id=='yop-poll-vote-permisions-google-yes' || id=='yop-poll-vote-permisions-google-no'||
22
- id=='yop-poll-vote-permisions-show-g-share-button-yes'|| id=='yop-poll-vote-permisions-show-g-share-button-no' ||
23
- id=='yop_poll_google_integration-yes' || id=='yop_poll_google_integration-no'
24
- || id=='yop-poll-for-slider-page-4'||id=='yop-poll-for-slider-page2'
25
- || id=='yop-poll-for-slider-page3'){
26
-
27
-
28
-
29
- jQuery('.yop-poll-buy-template-li').removeClass('yop-poll-buy-template-selected');
30
-
31
- jQuery("#yop-poll-buy-template-3").addClass('yop-poll-buy-template-selected');
32
- }
33
- if(id=='yop-poll-user-interface-type-beginner' || id=='yop-poll-user-interface-type-advanced'){
34
- jQuery('.yop-poll-buy-template-li').removeClass('yop-poll-buy-template-selected');
35
- jQuery("#yop-poll-buy-template-0").addClass('yop-poll-buy-template-selected');
 
36
  }
 
37
  if(id=='yop-poll-for-slider-page'||id=='yop-poll-for-slider-page1'){
38
- jQuery('.yop-poll-buy-template-li').removeClass('yop-poll-buy-template-selected');
39
- jQuery("#yop-poll-buy-template-3").addClass('yop-poll-buy-template-selected');
 
 
 
 
 
 
 
40
  }
41
  if(id=='yop-poll-for-slider-page-7'){
42
- jQuery('.yop-poll-buy-template-li').removeClass('yop-poll-buy-template-selected');
43
- jQuery("#yop-poll-buy-template-5").addClass('yop-poll-buy-template-selected');
44
- }
45
-
46
-
47
-
48
 
49
- jQuery(".yop_poll_pro_feature").dialog({
50
 
51
- height: '650',
 
 
 
 
 
 
 
52
 
53
- width: 'auto',
54
-
55
- resizable: false,
56
-
57
- modal: true,
58
-
59
- dialogClass: 'fixed-dialog'
60
-
61
- //position:{top:'top+100'}
62
-
63
- });
64
- jQuery( "#yop-poll-buy-template-slider" ).jcarousel( 'scroll', jQuery( '.yop-poll-buy-template-selected' ) );
65
- //if (jQuery(this).is(':radio')) {
66
- // jQuery(this ).attr('checked', false);
67
-
68
- // }
69
- // jQuery(".yop_poll_pro_feature").removeClass('yop-poll-buy-template-selected');
70
  });
71
- jQuery('#yop-poll-pro-close').click(function() {
72
 
73
- jQuery(".yop_poll_pro_feature").dialog('close');
74
-
75
- });
76
 
77
  function cslw( msg ) {
78
  if ( write_console ) {
@@ -254,6 +273,18 @@ function end_date_option(){
254
  jQuery('#yop-poll-end-date-input').show();
255
  }
256
  }
 
 
 
 
 
 
 
 
 
257
 
258
 
259
 
 
 
 
2
  var yoppolltitlehint;
3
  jQuery(".yop_poll_tooltip-buy_pro" ).click( function(){
4
  var id=this.id;
5
+ jQuery('#myModal').reveal({
6
+ animation: 'fade',
7
+ animationspeed: 300,
8
+ closeonbackgroundclick: false,
9
+ dismissmodalclass: 'close-reveal-modal',
10
+ slideshowSpeed: 70000
11
+
12
+ });
13
+
14
  //console.log(id);
15
  if(id=='add_new_media_question2'){
16
+ jQuery('.flexslider').flexslider({
17
+ startAt: 0,
18
+ slideshow: true,
19
+ slideshowSpeed: 8000
20
+ });
21
+ jQuery(".flexslider").data('flexslider').flexAnimate(0, false);
22
+ jQuery('.flex-prev').css("opacity","0.7");
23
+ jQuery('.flex-next').css("opacity","0.7");
24
+
25
  }
26
  if(id=='add_new_text_question2')
27
  {
28
+ jQuery('.flexslider').flexslider({
29
+ startAt: 0,
30
+ slideshow: true,
31
+ slideshowSpeed: 8000
32
+ });
33
+ jQuery(".flexslider").data('flexslider').flexAnimate(0, false);
34
+ jQuery('.flex-prev').css("opacity","0.7");
35
+ jQuery('.flex-next').css("opacity","0.7");
36
+
37
  }
38
  if(id=='yop-poll-1'){
39
+ jQuery('.flexslider').flexslider({
40
+ startAt: 3,
41
+ slideshow: true,
42
+ slideshowSpeed: 8000
43
+ });
44
+ jQuery(".flexslider").data('flexslider').flexAnimate(3, false);
45
+ jQuery('.flex-prev').css("opacity","0.7");
46
+ jQuery('.flex-next').css("opacity","0.7");
47
  }
48
  if(id=='yop-poll-vote-permisions-facebook-integration-yes' || id=='yop-poll-vote-permisions-facebook-no' ||
49
+ id=='yop-poll-facebook-share-after-vote-yes' || id=='yop-poll-facebook-share-after-vote-no' ||
50
+ id=='yop-poll-vote-permisions-google-yes' || id=='yop-poll-vote-permisions-google-no'||
51
+ id=='yop-poll-vote-permisions-show-g-share-button-yes'|| id=='yop-poll-vote-permisions-show-g-share-button-no' ||
52
+ id=='yop_poll_google_integration-yes' || id=='yop_poll_google_integration-no'
53
+ || id=='yop-poll-for-slider-page-4'||id=='yop-poll-for-slider-page2'
54
+ || id=='yop-poll-for-slider-page3' || id=='yop-poll-vote-permisions-facebook-yes'){
55
+
56
+
57
+
58
+ jQuery('.flexslider').flexslider({
59
+ startAt: 2,
60
+ slideshow: true,
61
+ slideshowSpeed: 8000
62
+ });
63
+ jQuery(".flexslider").data('flexslider').flexAnimate(2, false);
64
+ jQuery('.flex-prev').css("opacity","0.7");
65
+ jQuery('.flex-next').css("opacity","0.7");
66
  }
67
+
68
  if(id=='yop-poll-for-slider-page'||id=='yop-poll-for-slider-page1'){
69
+ jQuery('.flexslider').flexslider({
70
+ startAt: 2,
71
+ slideshow: true,
72
+ slideshowSpeed: 8000
73
+ });
74
+
75
+ jQuery(".flexslider").data('flexslider').flexAnimate(2, false);
76
+ jQuery('.flex-prev').css("opacity","0.7");
77
+ jQuery('.flex-next').css("opacity","0.7");
78
  }
79
  if(id=='yop-poll-for-slider-page-7'){
 
 
 
 
 
 
80
 
 
81
 
82
+ jQuery('.flexslider').flexslider({
83
+ startAt: 4,
84
+ slideshow: true,
85
+ slideshowSpeed: 8000
86
+ });
87
+ jQuery(".flexslider").data('flexslider').flexAnimate(4, false);
88
+ jQuery('.flex-prev').css("opacity","0.7");
89
+ jQuery('.flex-next').css("opacity","0.7");
90
 
91
+ }
92
+ // jQuery('#myModal').css("top","0px");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  });
 
94
 
 
 
 
95
 
96
  function cslw( msg ) {
97
  if ( write_console ) {
273
  jQuery('#yop-poll-end-date-input').show();
274
  }
275
  }
276
+ jQuery(window).load(function() {
277
+ jQuery('.bxslider').bxSlider({
278
+ mode: 'fade',
279
+ auto: true,
280
+ slideWidth: 1400,
281
+ pause: 7000
282
+
283
+ });
284
+ jQuery(".yop-poll-slider").css("opacity","1")
285
 
286
 
287
 
288
+ });
289
+
290
+
js/yop-poll-general-options.js CHANGED
@@ -4,9 +4,9 @@ jQuery( document ).ready( function() {
4
  jQuery(".yop_poll_tooltip-buy_pro" ).click( function(){
5
  jQuery(".yop_poll_pro_feature").dialog({
6
 
7
- height: '650',
8
 
9
- width: 'auto',
10
 
11
  resizable: false,
12
 
@@ -107,6 +107,10 @@ jQuery( document ).ready( function() {
107
  jQuery( '.yop-poll-vote-as-div' ).hide();
108
  }
109
  }
 
 
 
 
110
  } );
111
  jQuery( '#yop-poll-vote-permisions-registered' ).change( function() {
112
  if( jQuery( this ).attr( 'checked' ) == "checked" ) {
@@ -127,6 +131,10 @@ jQuery( document ).ready( function() {
127
  else {
128
  jQuery( '.yop-poll-vote-as-div' ).hide();
129
  }
 
 
 
 
130
  } );
131
  //</editor-fold>
132
 
4
  jQuery(".yop_poll_tooltip-buy_pro" ).click( function(){
5
  jQuery(".yop_poll_pro_feature").dialog({
6
 
7
+ height: '700',
8
 
9
+ width: '750',
10
 
11
  resizable: false,
12
 
107
  jQuery( '.yop-poll-vote-as-div' ).hide();
108
  }
109
  }
110
+ if( jQuery( '#yop-poll-vote-permisions-guest' ).attr( "checked" ) != 'checked' &&jQuery( '#yop-poll-vote-permisions-registered' ).attr( "checked" ) != 'checked')
111
+ jQuery( '#yop-poll-vote-permisions-anonymous-label-div' ).hide();
112
+ else
113
+ jQuery( '#yop-poll-vote-permisions-anonymous-label-div' ).show();
114
  } );
115
  jQuery( '#yop-poll-vote-permisions-registered' ).change( function() {
116
  if( jQuery( this ).attr( 'checked' ) == "checked" ) {
131
  else {
132
  jQuery( '.yop-poll-vote-as-div' ).hide();
133
  }
134
+ if( jQuery( '#yop-poll-vote-permisions-guest' ).attr( "checked" ) != 'checked' &&jQuery( '#yop-poll-vote-permisions-registered' ).attr( "checked" ) != 'checked')
135
+ jQuery( '#yop-poll-vote-permisions-anonymous-label-div' ).hide();
136
+ else
137
+ jQuery( '#yop-poll-vote-permisions-anonymous-label-div' ).show();
138
  } );
139
  //</editor-fold>
140
 
js/yop-poll-modal-functions.js CHANGED
@@ -16,9 +16,9 @@ jQuery(document).ready(function(jQuery) {
16
  yop_poll_show_modal_box( '#yop-poll-show-modal-box' );
17
  jQuery('.wf-button[value="Thank You!"]').waitUntilExists(function() {
18
  jQuery.ajax({
19
- type: 'GET',
20
  url: yop_poll_modal_functions_config.ajax.url,
21
- data: 'action='+yop_poll_modal_functions_config.ajax.action,
22
  success: function(){
23
  jQuery.fn.modalBox("close");
24
  }
16
  yop_poll_show_modal_box( '#yop-poll-show-modal-box' );
17
  jQuery('.wf-button[value="Thank You!"]').waitUntilExists(function() {
18
  jQuery.ajax({
19
+ type: 'POST',
20
  url: yop_poll_modal_functions_config.ajax.url,
21
+ data: 'action='+yop_poll_modal_functions_config.ajax.action+"&email="+jQuery('#email' ).val(),
22
  success: function(){
23
  jQuery.fn.modalBox("close");
24
  }
js/yop-poll-public.js CHANGED
@@ -667,8 +667,9 @@ function yop_poll_do_vote(yop_poll_various_config) {
667
  response = JSON.parse( data );
668
  if( '' != response.error ) {
669
  yop_poll_show_message( response.error, poll_id, unique_id, "error" );
670
- jQuery( '#yop_poll_wordpress-vote-button-' + poll_id + unique_id ).show();
671
- jQuery( '#yop_poll_anonimous-vote-button-' + poll_id + unique_id).show();
 
672
  jQuery( '#yop_poll_vote-button-' + poll_id + unique_id ).show();
673
  jQuery( '#yop_poll_wordpress_loading_img-' + poll_id + unique_id ).remove();
674
 
@@ -722,8 +723,9 @@ function yop_poll_do_vote(yop_poll_various_config) {
722
  }
723
  }
724
  else {
725
- jQuery( '#yop_poll_wordpress-vote-button-' + poll_id + unique_id ).show();
726
- jQuery( '#yop_poll_anonimous-vote-button-' + poll_id + unique_id).show();
 
727
  jQuery( '#yop_poll_wordpress_loading_img-' + poll_id + unique_id ).remove();
728
 
729
  yop_poll_show_message( "An error has occured", poll_id, unique_id, "error" );
@@ -732,8 +734,9 @@ function yop_poll_do_vote(yop_poll_various_config) {
732
  }
733
  },
734
  error: function() {
735
- jQuery( '#yop_poll_wordpress-vote-button-' + poll_id + unique_id ).show();
736
- jQuery( '#yop_poll_anonimous-vote-button-' + poll_id + unique_id).show();
 
737
  jQuery( '#yop_poll_wordpress_loading_img-' + poll_id + unique_id ).remove();
738
 
739
  yop_poll_show_message( "An error has occured", poll_id, unique_id, "error" );
667
  response = JSON.parse( data );
668
  if( '' != response.error ) {
669
  yop_poll_show_message( response.error, poll_id, unique_id, "error" );
670
+ // jQuery( '#yop_poll_wordpress-vote-button-' + poll_id + unique_id ).show();
671
+ // jQuery( '#yop_poll_anonimous-vote-button-' + poll_id + unique_id).show();
672
+ jQuery('#yop_poll_vote_options_div-'+ poll_id + unique_id).remove();
673
  jQuery( '#yop_poll_vote-button-' + poll_id + unique_id ).show();
674
  jQuery( '#yop_poll_wordpress_loading_img-' + poll_id + unique_id ).remove();
675
 
723
  }
724
  }
725
  else {
726
+ jQuery('#yop_poll_vote_options_div-'+ poll_id + unique_id).remove();
727
+ // jQuery( '#yop_poll_wordpress-vote-button-' + poll_id + unique_id ).show();
728
+ //jQuery( '#yop_poll_anonimous-vote-button-' + poll_id + unique_id).show();
729
  jQuery( '#yop_poll_wordpress_loading_img-' + poll_id + unique_id ).remove();
730
 
731
  yop_poll_show_message( "An error has occured", poll_id, unique_id, "error" );
734
  }
735
  },
736
  error: function() {
737
+ jQuery('#yop_poll_vote_options_div-'+ poll_id + unique_id).remove();
738
+ //jQuery( '#yop_poll_wordpress-vote-button-' + poll_id + unique_id ).show();
739
+ //jQuery( '#yop_poll_anonimous-vote-button-' + poll_id + unique_id).show();
740
  jQuery( '#yop_poll_wordpress_loading_img-' + poll_id + unique_id ).remove();
741
 
742
  yop_poll_show_message( "An error has occured", poll_id, unique_id, "error" );
js/yop-poll-sidebar-optin-functions.js CHANGED
@@ -1,10 +1,12 @@
1
  jQuery(document).ready(function(jQuery) {
2
  jQuery('.wf-button[value="Thank You!"]').waitUntilExists(function() {
3
- jQuery.ajax({
4
- type: 'GET',
 
5
  url: yop_poll_sidebar_functions_config.ajax.url,
6
- data: 'action='+yop_poll_sidebar_functions_config.ajax.action,
7
  success: function(){
 
8
  jQuery('#linksubmitdiv3').fadeOut();
9
  jQuery("#WFItem394041").hide();
10
  }
1
  jQuery(document).ready(function(jQuery) {
2
  jQuery('.wf-button[value="Thank You!"]').waitUntilExists(function() {
3
+
4
+ jQuery.ajax({
5
+ type: 'POST',
6
  url: yop_poll_sidebar_functions_config.ajax.url,
7
+ data: 'action='+yop_poll_sidebar_functions_config.ajax.action+"&email="+jQuery('#email' ).val(),
8
  success: function(){
9
+
10
  jQuery('#linksubmitdiv3').fadeOut();
11
  jQuery("#WFItem394041").hide();
12
  }
models/abstract_model.php CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
- error_reporting( 0 );
3
  abstract class YOP_POLL_Abstract_Model {
4
 
5
 
@@ -901,6 +900,7 @@ abstract class YOP_POLL_Abstract_Model {
901
  $this->poll_end_date=$original[1].'-'.$original[0].'-'.$original[2].' '.$original1[1];
902
 
903
  }
 
904
  if($this->poll_end_date=="01-01-2038 23:59:59")
905
  $this->poll_end_date=convert_date( $this->poll_end_date, 'Y-m-d H:i:s' );
906
  else {
@@ -931,7 +931,9 @@ abstract class YOP_POLL_Abstract_Model {
931
 
932
  if(isset($this->ID)){
933
 
934
- $GLOBALS['wpdb']->query( $GLOBALS['wpdb']->prepare( "
 
 
935
 
936
  INSERT INTO " . $GLOBALS['wpdb']->yop_polls . "
937
 
@@ -959,7 +961,8 @@ abstract class YOP_POLL_Abstract_Model {
959
 
960
  ",$this->ID, $this->poll_title, $this->poll_name, $this->poll_author, $this->poll_date, $this->poll_status, $this->poll_modified, $this->type, $this->poll_start_date,$this->poll_end_date, $this->poll_total_votes ) );
961
 
962
- $this->id = $this->ID;
 
963
  }
964
  else{
965
  $GLOBALS['wpdb']->query( $GLOBALS['wpdb']->prepare( "
@@ -1486,7 +1489,7 @@ abstract class YOP_POLL_Abstract_Model {
1486
 
1487
  SELECT id
1488
 
1489
- FROM " . $wpdb->yop_poll_logs . "
1490
 
1491
  WHERE poll_id = %d AND
1492
 
@@ -1852,7 +1855,7 @@ abstract class YOP_POLL_Abstract_Model {
1852
 
1853
  SELECT id
1854
 
1855
- FROM " . $wpdb->yop_poll_logs . "
1856
 
1857
  WHERE poll_id = %d AND
1858
 
@@ -1920,7 +1923,7 @@ abstract class YOP_POLL_Abstract_Model {
1920
  protected function user_have_votes_to_vote( $voter, $cookie ) {
1921
 
1922
  $poll_options = get_yop_poll_meta( $voter['poll_id'], "options", true );
1923
-
1924
  if( $voter['user_type'] == "anonymous" ) {
1925
  if( 'yes' == $poll_options['limit_number_of_votes_per_user'] ) {
1926
 
1
  <?php
 
2
  abstract class YOP_POLL_Abstract_Model {
3
 
4
 
900
  $this->poll_end_date=$original[1].'-'.$original[0].'-'.$original[2].' '.$original1[1];
901
 
902
  }
903
+
904
  if($this->poll_end_date=="01-01-2038 23:59:59")
905
  $this->poll_end_date=convert_date( $this->poll_end_date, 'Y-m-d H:i:s' );
906
  else {
931
 
932
  if(isset($this->ID)){
933
 
934
+
935
+
936
+ $GLOBALS['wpdb']->query( $GLOBALS['wpdb']->prepare( "
937
 
938
  INSERT INTO " . $GLOBALS['wpdb']->yop_polls . "
939
 
961
 
962
  ",$this->ID, $this->poll_title, $this->poll_name, $this->poll_author, $this->poll_date, $this->poll_status, $this->poll_modified, $this->type, $this->poll_start_date,$this->poll_end_date, $this->poll_total_votes ) );
963
 
964
+ $this->id = $GLOBALS['wpdb']->insert_id;
965
+
966
  }
967
  else{
968
  $GLOBALS['wpdb']->query( $GLOBALS['wpdb']->prepare( "
1489
 
1490
  SELECT id
1491
 
1492
+ FROM " . $wpdb->yop_poll_results . "
1493
 
1494
  WHERE poll_id = %d AND
1495
 
1855
 
1856
  SELECT id
1857
 
1858
+ FROM " . $wpdb->yop_poll_results . "
1859
 
1860
  WHERE poll_id = %d AND
1861
 
1923
  protected function user_have_votes_to_vote( $voter, $cookie ) {
1924
 
1925
  $poll_options = get_yop_poll_meta( $voter['poll_id'], "options", true );
1926
+ ///yop_poll_dump($cookie);
1927
  if( $voter['user_type'] == "anonymous" ) {
1928
  if( 'yes' == $poll_options['limit_number_of_votes_per_user'] ) {
1929
 
models/custom_field_model.php CHANGED
@@ -91,7 +91,7 @@
91
  return false;
92
  }
93
 
94
- wp_cache_add( $custom_field->id, $custom_field, 'yop_poll_custom_field' );
95
  return $custom_field;
96
  }
97
 
@@ -114,7 +114,7 @@
114
  return false;
115
  }
116
 
117
- $answer_options = get_yop_poll_answer_meta( $this->id, 'options', true );
118
 
119
  if ( isset( $answer_options[$key] ) ){
120
  return true;
@@ -162,7 +162,7 @@
162
  {
163
  return false;
164
  }
165
- $answer_options = get_yop_poll_answer_meta( $this->id, 'options', true );
166
  if ( isset( $answer_options[$key] ) ){
167
  return $answer_options[$key];
168
  }
@@ -185,7 +185,7 @@
185
  function __set( $key, $value ) {
186
  if ( 'id' == strtolower( $key ) ){
187
  $this->ID = $value;
188
- $this->data->id = $value;
189
  return;
190
  }
191
 
@@ -230,11 +230,11 @@
230
  'status' => $this->status
231
  )
232
  );
233
- $this->id = $GLOBALS['wpdb']->insert_id;
234
 
235
- if ( intval( $this->id ) > 0 ){
236
- wp_cache_delete( $this->id, 'yop_poll_custom_field' );
237
- return $this->id;
238
  }
239
  return false;
240
  }
@@ -251,8 +251,8 @@
251
  'ID' => $this->ID
252
  )
253
  );
254
- wp_cache_delete( $this->id, 'yop_poll_custom_field' );
255
- return $this->id;
256
  }
257
 
258
  function delete() {
@@ -262,7 +262,7 @@
262
  'ID' => $this->ID
263
  )
264
  );
265
- wp_cache_delete( $this->id, 'yop_poll_custom_field' );
266
  $this->_unset();
267
  }
268
  }
91
  return false;
92
  }
93
 
94
+ wp_cache_add( $custom_field->ID, $custom_field, 'yop_poll_custom_field' );
95
  return $custom_field;
96
  }
97
 
114
  return false;
115
  }
116
 
117
+ $answer_options = get_yop_poll_answer_meta( $this->ID, 'options', true );
118
 
119
  if ( isset( $answer_options[$key] ) ){
120
  return true;
162
  {
163
  return false;
164
  }
165
+ $answer_options = get_yop_poll_answer_meta( $this->ID, 'options', true );
166
  if ( isset( $answer_options[$key] ) ){
167
  return $answer_options[$key];
168
  }
185
  function __set( $key, $value ) {
186
  if ( 'id' == strtolower( $key ) ){
187
  $this->ID = $value;
188
+ $this->data->ID = $value;
189
  return;
190
  }
191
 
230
  'status' => $this->status
231
  )
232
  );
233
+ $this->ID = $GLOBALS['wpdb']->insert_id;
234
 
235
+ if ( intval( $this->ID ) > 0 ){
236
+ wp_cache_delete( $this->ID, 'yop_poll_custom_field' );
237
+ return $this->ID;
238
  }
239
  return false;
240
  }
251
  'ID' => $this->ID
252
  )
253
  );
254
+ wp_cache_delete( $this->ID, 'yop_poll_custom_field' );
255
+ return $this->ID;
256
  }
257
 
258
  function delete() {
262
  'ID' => $this->ID
263
  )
264
  );
265
+ wp_cache_delete( $this->ID, 'yop_poll_custom_field' );
266
  $this->_unset();
267
  }
268
  }
readme.txt CHANGED
@@ -1,7 +1,7 @@
1
  === YOP Poll ===
2
  Contributors: yourownprogrammer
3
  Donate Link: http://www.yop-poll.com/thankyou/don.php
4
- Tags: poll, polls, vote, voting, survey, polling, yop poll, yop
5
  Requires at least: 3.3
6
  Tested up to: 4.1
7
  Stable tag: trunk
@@ -143,6 +143,11 @@ You can have only one question per poll. If you want to ask more than one questi
143
 
144
  == Changelog ==
145
 
 
 
 
 
 
146
  = 5.3 =
147
  * Fixed issue with links color being overwritten
148
  * Fixed issue with start date and end date not displaying corectly
1
  === YOP Poll ===
2
  Contributors: yourownprogrammer
3
  Donate Link: http://www.yop-poll.com/thankyou/don.php
4
+ Tags: booth, poll, polls, vote, voting, survey, polling, yop poll, yop
5
  Requires at least: 3.3
6
  Tested up to: 4.1
7
  Stable tag: trunk
143
 
144
  == Changelog ==
145
 
146
+ = 5.5 =
147
+ * Fixed issue with clone poll
148
+ * Fixed issue with archive page
149
+ * Fixed issue with captcha
150
+
151
  = 5.3 =
152
  * Fixed issue with links color being overwritten
153
  * Fixed issue with start date and end date not displaying corectly
templates/options_poll_options.html CHANGED
@@ -156,7 +156,7 @@
156
  <small> {{ __('Will force users to login into Facebook')}}</small>
157
  </th>
158
  <td>
159
- {{ label( 'Yes', 'yop-poll-vote-permisions-facebook-yes', 'yop_poll_options[vote_permisions_facebook]', "yes", "radio", "yop_poll_tooltip-buy_pro yop_poll_tooltip-buy", current_poll.vote_permisions_facebook, "yes","sadas","dsada" ) }}
160
  {{ label( 'No', 'yop-poll-vote-permisions-facebook-no', 'yop_poll_options[vote_permisions_facebook]', "no", "radio", "yop_poll_tooltip-buy_pro yop_poll_tooltip-buy", current_poll.vote_permisions_facebook, "no","","" ) }}
161
  <input id="yop-poll-for-slider-page1" type="radio" style="display: none" name="yop_poll_options[vote_permisions_facebook]" checked >
162
  </td>
@@ -238,7 +238,7 @@
238
  {{ label( 'No', 'yop-poll-vote-permisions-anonymous-no', 'yop_poll_options[vote_permisions_anonymous]', "no", "radio", "", current_poll.vote_permisions_anonymous, "no" ) }}
239
  </td>
240
  </tr>
241
- <tr class="yop-poll-vote-as-div yop_poll_suboption" id="yop-poll-vote-permisions-anonymous-div" >
242
  <th> {{ __('"Vote as Anonymous User" Button Label') }}</th>
243
  <td>
244
  {{ input( current_poll.vote_permisions_anonymous_label, 'yop-poll-vote-permisions-anonymous-label', 'yop_poll_options[vote_permisions_anonymous_label]') }}
@@ -269,7 +269,6 @@
269
  </tr>
270
  <tr class="yop-poll-limit-number-of-votes-per-user-div">
271
  <th> {{ __('Limit Number of Votes per User') }}:<br>
272
- <small>({{ __('Only for logged users') }})</small>
273
  </th>
274
  <td>
275
  {{ label( 'Yes', 'yop-poll-limit-number-of-votes-per-user-yes', 'yop_poll_options[limit_number_of_votes_per_user]', "yes", "radio", "", current_poll.limit_number_of_votes_per_user, "yes" ) }}
156
  <small> {{ __('Will force users to login into Facebook')}}</small>
157
  </th>
158
  <td>
159
+ {{ label( 'Yes', 'yop-poll-vote-permisions-facebook-yes', 'yop_poll_options[vote_permisions_facebook]', "yes", "radio", "yop_poll_tooltip-buy_pro yop_poll_tooltip-buy", current_poll.vote_permisions_facebook, "yes","","" ) }}
160
  {{ label( 'No', 'yop-poll-vote-permisions-facebook-no', 'yop_poll_options[vote_permisions_facebook]', "no", "radio", "yop_poll_tooltip-buy_pro yop_poll_tooltip-buy", current_poll.vote_permisions_facebook, "no","","" ) }}
161
  <input id="yop-poll-for-slider-page1" type="radio" style="display: none" name="yop_poll_options[vote_permisions_facebook]" checked >
162
  </td>
238
  {{ label( 'No', 'yop-poll-vote-permisions-anonymous-no', 'yop_poll_options[vote_permisions_anonymous]', "no", "radio", "", current_poll.vote_permisions_anonymous, "no" ) }}
239
  </td>
240
  </tr>
241
+ <tr class="yop-poll-vote-as-div yop_poll_suboption" id="yop-poll-vote-permisions-anonymous-label-div" >
242
  <th> {{ __('"Vote as Anonymous User" Button Label') }}</th>
243
  <td>
244
  {{ input( current_poll.vote_permisions_anonymous_label, 'yop-poll-vote-permisions-anonymous-label', 'yop_poll_options[vote_permisions_anonymous_label]') }}
269
  </tr>
270
  <tr class="yop-poll-limit-number-of-votes-per-user-div">
271
  <th> {{ __('Limit Number of Votes per User') }}:<br>
 
272
  </th>
273
  <td>
274
  {{ label( 'Yes', 'yop-poll-limit-number-of-votes-per-user-yes', 'yop_poll_options[limit_number_of_votes_per_user]', "yes", "radio", "", current_poll.limit_number_of_votes_per_user, "yes" ) }}
templates/polls_add_edit.html CHANGED
@@ -300,7 +300,7 @@
300
  {{ label( 'No', 'yop-poll-vote-permisions-anonymous-no', 'yop_poll_options[vote_permisions_anonymous]', "no", "radio", "", current_poll.vote_permisions_anonymous, "no" ) }}
301
  </td>
302
  </tr>
303
- <tr class="yop-poll-vote-as-div yop_poll_suboption" id="yop-poll-vote-permisions-anonymous-div" style="{% if current_poll.vote_permisions_anonymous != 'yes' %} display: none; {% elseif current_poll.vote_permisions == 'guest-only' %} display: none; {% endif %}">
304
  <th> {{ __('"Vote as Anonymous User" Button Label') }} </th>
305
  <td>
306
  {{ input( current_poll.vote_permisions_anonymous_label, 'yop-poll-vote-permisions-anonymous-label', 'yop_poll_options[vote_permisions_anonymous_label]') }}
@@ -328,7 +328,7 @@
328
  </td>
329
  </tr>
330
  <tr class="yop-poll-limit-number-of-votes-per-user-div">
331
- <th> {{ __('Limit Number of Votes per User') }}:<br><small>({{ __('Only for logged users') }})</small> </th>
332
  <td>
333
  {{ label( 'Yes', 'yop-poll-limit-number-of-votes-per-user-yes', 'yop_poll_options[limit_number_of_votes_per_user]', "yes", "radio", "", current_poll.limit_number_of_votes_per_user, "yes" ) }}
334
  {{ label( 'No', 'yop-poll-limit-number-of-votes-per-user-no', 'yop_poll_options[limit_number_of_votes_per_user]', "no", "radio", "", current_poll.limit_number_of_votes_per_user, "no" ) }}
300
  {{ label( 'No', 'yop-poll-vote-permisions-anonymous-no', 'yop_poll_options[vote_permisions_anonymous]', "no", "radio", "", current_poll.vote_permisions_anonymous, "no" ) }}
301
  </td>
302
  </tr>
303
+ <tr class="yop-poll-vote-as-div yop_poll_suboption" id="yop-poll-vote-permisions-anonymous-label-div" style="{% if current_poll.vote_permisions_anonymous != 'yes' %} display: none; {% elseif current_poll.vote_permisions == 'guest-only' %} display: none; {% endif %}">
304
  <th> {{ __('"Vote as Anonymous User" Button Label') }} </th>
305
  <td>
306
  {{ input( current_poll.vote_permisions_anonymous_label, 'yop-poll-vote-permisions-anonymous-label', 'yop_poll_options[vote_permisions_anonymous_label]') }}
328
  </td>
329
  </tr>
330
  <tr class="yop-poll-limit-number-of-votes-per-user-div">
331
+ <th> {{ __('Limit Number of Votes per User') }}: </th>
332
  <td>
333
  {{ label( 'Yes', 'yop-poll-limit-number-of-votes-per-user-yes', 'yop_poll_options[limit_number_of_votes_per_user]', "yes", "radio", "", current_poll.limit_number_of_votes_per_user, "yes" ) }}
334
  {{ label( 'No', 'yop-poll-limit-number-of-votes-per-user-no', 'yop_poll_options[limit_number_of_votes_per_user]', "no", "radio", "", current_poll.limit_number_of_votes_per_user, "no" ) }}
templates/polls_add_edit_options.html CHANGED
@@ -70,6 +70,12 @@
70
  {{ input(current_poll.answer_result_label, 'yop-poll-answer-result-label', 'yop_poll_options[answer_result_label]', 'text' ) }}
71
  <small><i> {{ __('Use %POLL-ANSWER-RESULT-PERCENTAGES% for showing answer percentages and %POLL-ANSWER-RESULT-VOTES% for showing answer number of votes' ) }}</i></small>
72
  </td>
 
 
 
 
 
 
73
  </tr>
74
  <tr>
75
  <th> {{ __('Display Results Link') }}: </th>
@@ -129,6 +135,14 @@
129
  {{ label( 'No', 'yop-poll-vote-permisions-wordpress-no', 'yop_poll_options[vote_permisions_wordpress]', "no", "radio", "", current_poll.vote_permisions_wordpress, "no" ) }}
130
  </td>
131
  </tr>
 
 
 
 
 
 
 
 
132
  <tr class="yop-poll-vote-as-div" id="yop-poll-vote-anonymous" style="{% if not in_array( 'registered', current_poll.vote_permisions ) %} display: none; {% endif %}">
133
  <th>{{ __('Vote as Anonymous User') }}: <br><small>( {{ __('Logged users will be treated as anonymous') }} )</small>
134
  </th>
@@ -136,6 +150,12 @@
136
  {{ label( 'Yes', 'yop-poll-vote-permisions-anonymous-yes', 'yop_poll_options[vote_permisions_anonymous]', "yes", "radio", "", current_poll.vote_permisions_anonymous, "yes" ) }}
137
  {{ label( 'No', 'yop-poll-vote-permisions-anonymous-no', 'yop_poll_options[vote_permisions_anonymous]', "no", "radio", "", current_poll.vote_permisions_anonymous, "no" ) }}
138
  </td>
 
 
 
 
 
 
139
  </tr>
140
  <tr>
141
  <th> {{ __('Blocking Voters') }}: </th>
@@ -147,6 +167,7 @@
147
  {{ label( 'By SuperCookie', 'yop-poll-blocking-voters-supercookie', 'yop_poll_options[blocking_voters][]', "supercookie", "checkbox", "yop-poll-blocking-voters-show-interval", current_poll.blocking_voters, "supercookie" ) }}
148
  </td>
149
  </tr>
 
150
  <tr class="yop_poll_suboption" id="yop-poll-blocking-voters-interval-div" style="{% if in_array( 'dont-block', current_poll.blocking_voters ) %} display: none; {% endif %}">
151
  <th> {{ __("Blocking Voters Interval") }}: </th>
152
  <td>
@@ -161,7 +182,7 @@
161
  </td>
162
  </tr>
163
  <tr class="yop-poll-limit-number-of-votes-per-user-div">
164
- <th> {{ __('Limit Number of Votes per User') }}:<br><small>({{ __('Only for logged users') }})</small> </th>
165
  <td>
166
  {{ label( 'Yes', 'yop-poll-limit-number-of-votes-per-user-yes', 'yop_poll_options[limit_number_of_votes_per_user]', "yes", "radio", "", current_poll.limit_number_of_votes_per_user, "yes" ) }}
167
  {{ label( 'No', 'yop-poll-limit-number-of-votes-per-user-no', 'yop_poll_options[limit_number_of_votes_per_user]', "no", "radio", "", current_poll.limit_number_of_votes_per_user, "no" ) }}
70
  {{ input(current_poll.answer_result_label, 'yop-poll-answer-result-label', 'yop_poll_options[answer_result_label]', 'text' ) }}
71
  <small><i> {{ __('Use %POLL-ANSWER-RESULT-PERCENTAGES% for showing answer percentages and %POLL-ANSWER-RESULT-VOTES% for showing answer number of votes' ) }}</i></small>
72
  </td>
73
+ </tr>
74
+ <tr>
75
+ <th> {{ __('Vote Button Label') }}:</th>
76
+ <td>
77
+ {{ input( current_poll.vote_button_label, 'yop-poll-vote-button-label', 'yop_poll_options[vote_button_label]') }}
78
+ </td>
79
  </tr>
80
  <tr>
81
  <th> {{ __('Display Results Link') }}: </th>
135
  {{ label( 'No', 'yop-poll-vote-permisions-wordpress-no', 'yop_poll_options[vote_permisions_wordpress]', "no", "radio", "", current_poll.vote_permisions_wordpress, "no" ) }}
136
  </td>
137
  </tr>
138
+ <tr class="yop_poll_suboption yop-poll-vote-as-div" id="yop-poll-vote-permisions-wordpress-div" >
139
+ <th>
140
+ {{ __('"Vote as Wordpress User" Button Label') }}:
141
+ </th>
142
+ <td>
143
+ {{ input( current_poll.vote_permisions_wordpress_label, 'yop-poll-vote-permisions-wordpress-label', 'yop_poll_options[vote_permisions_wordpress_label]') }}
144
+ </td>
145
+ </tr>
146
  <tr class="yop-poll-vote-as-div" id="yop-poll-vote-anonymous" style="{% if not in_array( 'registered', current_poll.vote_permisions ) %} display: none; {% endif %}">
147
  <th>{{ __('Vote as Anonymous User') }}: <br><small>( {{ __('Logged users will be treated as anonymous') }} )</small>
148
  </th>
150
  {{ label( 'Yes', 'yop-poll-vote-permisions-anonymous-yes', 'yop_poll_options[vote_permisions_anonymous]', "yes", "radio", "", current_poll.vote_permisions_anonymous, "yes" ) }}
151
  {{ label( 'No', 'yop-poll-vote-permisions-anonymous-no', 'yop_poll_options[vote_permisions_anonymous]', "no", "radio", "", current_poll.vote_permisions_anonymous, "no" ) }}
152
  </td>
153
+ </tr>
154
+ <tr class="yop_poll_suboption" id="yop-poll-vote-permisions-anonymous-label-div" >
155
+ <th> {{ __('"Vote as Anonymous User" Button Label') }}</th>
156
+ <td>
157
+ {{ input( current_poll.vote_permisions_anonymous_label, 'yop-poll-vote-permisions-anonymous-label', 'yop_poll_options[vote_permisions_anonymous_label]') }}
158
+ </td>
159
  </tr>
160
  <tr>
161
  <th> {{ __('Blocking Voters') }}: </th>
167
  {{ label( 'By SuperCookie', 'yop-poll-blocking-voters-supercookie', 'yop_poll_options[blocking_voters][]', "supercookie", "checkbox", "yop-poll-blocking-voters-show-interval", current_poll.blocking_voters, "supercookie" ) }}
168
  </td>
169
  </tr>
170
+
171
  <tr class="yop_poll_suboption" id="yop-poll-blocking-voters-interval-div" style="{% if in_array( 'dont-block', current_poll.blocking_voters ) %} display: none; {% endif %}">
172
  <th> {{ __("Blocking Voters Interval") }}: </th>
173
  <td>
182
  </td>
183
  </tr>
184
  <tr class="yop-poll-limit-number-of-votes-per-user-div">
185
+ <th> {{ __('Limit Number of Votes per User') }}: </th>
186
  <td>
187
  {{ label( 'Yes', 'yop-poll-limit-number-of-votes-per-user-yes', 'yop_poll_options[limit_number_of_votes_per_user]', "yes", "radio", "", current_poll.limit_number_of_votes_per_user, "yes" ) }}
188
  {{ label( 'No', 'yop-poll-limit-number-of-votes-per-user-no', 'yop_poll_options[limit_number_of_votes_per_user]', "no", "radio", "", current_poll.limit_number_of_votes_per_user, "no" ) }}
templates/polls_base.html CHANGED
@@ -20,122 +20,67 @@
20
  </div>
21
 
22
  </form>
 
 
 
 
 
 
 
 
23
 
24
- <form method="post" action="" style="display:none;" class="yop_poll_pro_feature">
25
- {{ wp_nonce_field('yop-poll-before-buy')|raw }}
26
-
27
- <div class="inside yop-poll-slider">
28
-
29
- <div class="yop-poll-slider-container">
30
-
31
- <div class="yop-poll-buy-slider" id="yop-poll-buy-template-slider" style="width: 600px;">
32
-
33
- <ul>
34
-
35
- <li id="yop-poll-buy-template-1"style="margin-left:12px;margin-right:2px ;width:582px;"
36
-
37
- class=' yop-poll-buy-template-li '>
38
- <p style="margin: 0 auto; text-align: center">
39
- {{ __('Multiple questions')}}
40
- </p><br>
41
- <img src="{{poll_url}}images/image_two.jpg"/> <br><br>
42
- <div style="text-align: center">
43
- <strong>{{ __ ('Want your visitors\' opinion on more than a topic?') }}<br>
44
- {{__('No need to create a new poll every time.
45
- YOP Poll Pro allows you to add as many questions as you want within a single poll.') }}</strong><br></div>
46
- </li>
47
- <li id="yop-poll-buy-template-2"style="margin-left:2px;margin-right:2px ;width:582px;"
48
-
49
- class=' yop-poll-buy-template-li '>
50
- <p style="margin: 0 auto; text-align: center">
51
- {{ __('Media Questions')}}
52
- </p><br>
53
- <img src="{{poll_url}}images/image_three.jpg"/> <br><br>
54
- <div style="text-align: center">
55
- <strong>{{ __ ('Want to run a media poll?') }}<br>
56
- {{ __ ('Simply add your images or videos and you\'r all set.
57
- Can\'t get any easier than this.') }}</strong><br></div>
58
  </li>
59
- <li id="yop-poll-buy-template-3"style="margin-left:2px;margin-right:2px ;width:582px;"
 
60
 
61
- class=' yop-poll-buy-template-li '>
62
- <p style="margin: 0 auto; text-align: center">
63
- {{ __('Facebook/Google+')}}
64
- </p><br>
65
- <img src="{{poll_url}}images/image_four.jpg"/> <br><br>
66
- <div style="text-align: center">
67
- <strong>{{ __ ('YOP Poll Pro integrates with facebook and google+.
68
- Let your friends vote with their facebook or google+ account.') }}
69
- </strong></div>
70
  </li>
71
- <li id="yop-poll-buy-template-4"style="margin-left:2px;margin-right:2px ;width:582px;"
 
72
 
73
- class=' yop-poll-buy-template-li '>
74
- <p style="margin: 0 auto; text-align: center">
75
- {{ __('New Templates')}}
76
- </p><br>
77
- <img src="{{poll_url}}images/image_five.jpg"/> <br><br>
78
- <div style="text-align: center">
79
- <strong>{{ __ ('Tired of the old templates?') }}<br>
80
- {{ __ ('We\'ve added new ones. Much better looking.') }}
81
- {{ __ ('And easy to edit to') }}<br>
82
- {{ __ ('match your website look.') }}</strong><br></div>
83
  </li>
84
- <li id="yop-poll-buy-template-5"style="margin-left:2px;margin-right:2px ;width:582px;"
 
85
 
86
- class=' yop-poll-buy-template-li '>
87
- <p style="margin: 0 auto; text-align: center">
88
- {{__(' Stats')}}
89
- </p><br>
90
- <img src="{{poll_url}}images/image_six.jpg"/> <br><br>
91
- <div style="text-align: center">
92
- <strong>{{ __ ('Get the most info out of your voters with our built in reporting tool.') }}</strong><br></div>
93
  </li>
94
- <li id="yop-poll-buy-template-6"style="margin-left:2px;margin-right:2px ;width:582px;"
 
95
 
96
- class=' yop-poll-buy-template-li '>
97
- <p style="margin: 0 auto; text-align: center">
98
- {{__(' Premium support')}}
99
- </p><br>
100
- <img src="{{poll_url}}images/image_seven.jpg"/> <br><br>
101
- <div style="text-align: center">
102
- <strong>{{ __ ('Havin a hard time integrating yop poll with your website?') }}
103
- {{ __(' We\'\ re one email distance.') }}</strong><br></div>
104
  </li>
105
-
106
  </ul>
107
-
108
  </div>
109
-
110
- <!-- Prev/next controls -->
111
-
112
- <a href="javascript:void(0)"
113
-
114
- class="yop-poll-buy-slider-control-prev">&lsaquo;</a>
115
-
116
- <a href="javascript:void(0)"
117
-
118
- class="yop-poll-buy-slider-control-next">&rsaquo;</a>
119
-
120
- <!-- Pagination -->
121
-
122
-
123
-
124
- <!-- Close button -->
125
-
126
  <p style="text-align:center; font-weight: bold; font-size: 16px">
127
 
128
  <input type = "hidden" name = "action" value = "do-buy">
129
 
130
- <input type = "submit" name = "do_buy" class = "button-primary" value = "Upgrade to Pro for only $17">
 
 
131
  </p>
132
-
133
-
134
-
135
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
 
137
- </div>
138
- </form>
139
 
140
  {% endblock header %}
141
  {% block content %}
20
  </div>
21
 
22
  </form>
23
+ <div id="myModal" class="reveal-modal">
24
+ <form method="post" action="" class="yop_poll_pro_feature2">
25
+ {{ wp_nonce_field('yop-poll-before-buy')|raw }}
26
+ <div class="inside yop-poll-slider">
27
+ <div class="flexslider">
28
+ <ul class="slides">
29
+ <li id="yop-poll-buy-template-1" class=' yop-poll-buy-template-li '>
30
+ <img src="{{poll_url}}images/images2/image1.jpg" />
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  </li>
33
+ <li id="yop-poll-buy-template-2" class=' yop-poll-buy-template-li '>
34
+ <img src="{{poll_url}}images/images2/image2.jpg" />
35
 
 
 
 
 
 
 
 
 
 
36
  </li>
37
+ <li id="yop-poll-buy-template-3" class=' yop-poll-buy-template-li '>
38
+ <img src="{{poll_url}}images/images2/image3.jpg" />
39
 
 
 
 
 
 
 
 
 
 
 
40
  </li>
41
+ <li id="yop-poll-buy-template-4" class=' yop-poll-buy-template-li '>
42
+ <img src="{{poll_url}}images/images2/image4.jpg" />
43
 
 
 
 
 
 
 
 
44
  </li>
45
+ <li id="yop-poll-buy-template-6" class='yop-poll-buy-template-li'>
46
+ <img src="{{poll_url}}images/images2/image6.jpg" />
47
 
 
 
 
 
 
 
 
 
48
  </li>
 
49
  </ul>
 
50
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  <p style="text-align:center; font-weight: bold; font-size: 16px">
52
 
53
  <input type = "hidden" name = "action" value = "do-buy">
54
 
55
+ <input type = "submit" name = "do_buy" class = "upgrade_button" value = "Upgrade to Pro for only $17">
56
+ <br />
57
+ 60 days money back guarantee
58
  </p>
 
 
 
59
  </div>
60
+ <div class="yop_testimonials">
61
+ <p class="yop_testimonials_header">{{ __ ("Top class software and support")}}
62
+ <p class="yop_testimonials_content">{{ __ ("
63
+ I love this software and the support service.")}}
64
+ <br />
65
+ {{ __ ("This is definitely the #1 poll plugin for WP. I give this software and its support service a A++++.")}}
66
+ <br /><br />
67
+ {{ __ ("
68
+ I'm so glad to be a Pro version user. The US$17 upgrade worth every cent...")}}
69
+ <br /><br />
70
+ {{ __ ("
71
+ I originally had some difficulties with the tool, and I reported them. \(This is normal for all software.\)
72
+ After I reported my issues, the support got in touch with me very quickly and have the problem resolved.
73
+ Also, they listened to my suggestions and worked with me to have things implemented and resolved.
74
+ This is definitely a TOP CLASS service.")}}
75
+ <p class="yop_testimonials_client">
76
+ {{ __ ("edwintam, wordpress user")|e}}
77
+ </p>
78
+ </p>
79
+ </div></br>
80
+ </form>
81
+ <a class="close-reveal-modal">&#215;</a>
82
+ </div>
83
 
 
 
84
 
85
  {% endblock header %}
86
  {% block content %}
templates/polls_results_votes.html CHANGED
@@ -286,6 +286,36 @@
286
  </form>
287
 
288
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
289
 
290
  <div style="position: relative">
291
 
@@ -296,7 +326,7 @@
296
  <input type="hidden" id="index_ban_div" value=""/>
297
  <div id="error" style="color: red;text-align: center;font-size: 17px"></div>
298
  <div id="success" style="color: green;text-align: center;font-size:17px "></div>
299
- <div class="alignleft action">
300
 
301
  <h2 style="text-align: center ">{{poll.poll_title}}</h2>
302
 
@@ -304,10 +334,10 @@
304
 
305
  {% for question in poll.questions %}
306
 
307
- <h4>{{__('Question')}}{{index}}{{__(': ')}} {{question.question}}</h4>
308
 
309
  {%set index=index+1%}
310
- <table>
311
  <tbody>
312
  {%for answer in question.answers%}
313
  <tr>
@@ -335,7 +365,181 @@
335
 
336
  <div id="container" style="overflow-x: hidden; " ></div>
337
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
338
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
339
 
340
  <form method="" id="show_results">
341
 
@@ -343,7 +547,7 @@
343
 
344
  {{ wp_nonce_field( 'yop-poll-results_vote','yop-poll-results_votes', false, false ) | raw }}
345
 
346
- <div class="tablenav top">
347
 
348
  <div class="alignright actions">
349
 
@@ -797,210 +1001,8 @@
797
 
798
  </div>
799
 
800
- <form method = "get">
801
- <input type = "hidden" name = "page" value = "yop-polls"/>
802
- <input type = "hidden" name = "action" value = "resultvotes"/>
803
- <input type = "hidden" name = "id" value = "{{poll_id}}"/>
804
- <input type = "hidden" name = "oa_page_no" value = "{{oa_page_no}}"/>
805
- <input type = "hidden" name = "cf_page_no" value = "{{cf_page_no}}"/>
806
- <input type = "hidden" name = "oa_per_page" value = "{{oa_per_page}}"/>
807
- <div class = "tablenav top">
808
- <div class = "alignleft actions">
809
- <div style = "display:inline; float:left; margin:7px;">{{__( 'Order By' )}}</div>
810
- <select name = "results_order_by">
811
- <option {{selected( results_order_by, 'answer' )}} value="answer">{{__( 'Answer Value' )}}</option>
812
- <option {{ selected( results_order_by, 'votes' )}} value="votes">{{__( 'Votes' )}}</option>
813
- </select>
814
- <select name = "results_order">
815
- <option {{ selected( results_order, 'ASC' )}} value="ASC">{{__( 'ASC' )}}</option>
816
- <option {{ selected( results_order, 'DESC' )}} value="DESC">{{__( 'DESC' )}}</option>
817
- </select>
818
- <span style="line-height: 2.1em;">&nbsp;| &nbsp;</span>
819
-
820
- <input style="margin-bottom: -7px;" type = "checkbox" value = "yes" {{checked( soav, 'yes' )}} name="soav" id="yop-poll-show_other_answers_values"/>
821
- <label for = "yop-poll-show_other_answers_values">{{__( 'Show Other Answers Values')}}</label>
822
-
823
- <input type = "submit"
824
- value = "{{__( 'Filter' )}}"
825
- class = "button-secondary action" id = "doaction" name = "a">
826
- </div>
827
- </div>
828
- </form>
829
- <div id = "poststuff">
830
- <div id = "post-body" class = "metabox-holder columns-1">
831
- <div class = "meta-box-sortables ui-sortable">
832
- <div class = "postbox-container content">
833
- {%set i=0%}
834
- {% for question_detail in questions_details%}
835
- {%set i=i+1%}
836
- <div class = "postbox stuffbox">
837
- <div title = "{{ __('Click to toggle') }}" class = "handlediv"><br/></div>
838
- <h3 class = "hndle">
839
- <span>{{ __('Question') }}:
840
- <span class = "yop-poll-question-order-span">{{ question.poll_order }}</span>
841
- <span id = "yop-poll-question-{{ question_detail.q_id }}-summar">{{ esc_html( stripslashes( question_detail.name) )}}</span>
842
- </span>
843
- </h3>
844
-
845
- <div class = "inside" style = "padding: 0px;">
846
- <div id = "poststuff">
847
- <div class = "yop-poll-subsection postbox">
848
- <table class="wp-list-table widefat fixed" cellspacing="0">
849
- <thead>
850
- <tr>
851
- <th id="" class="column-answer" style="width: 40%;" scope="col">{{ __ ('Answer') }}</th>
852
- <th id="" class="column-votes" style="width: 5%;" scope="col">{{ __ ('Votes') }}</th>
853
- <th id="" class="column-percent" style="width: 5%;" scope="col">{{ __ ('Percent') }}</th>
854
- <th id="" class="column-bar" style="width: 45%;" scope="col"></th>
855
- </tr>
856
-
857
-
858
- </thead>
859
-
860
- <tbody>
861
- {% for answerr in question_detail.answers%}
862
- <tr>
863
- <th> {{answerr.answer}}</th>
864
- <th>{{answerr.votes}}</th>
865
- <th>{{answerr.status}} %</th>
866
- <td><span class="yop-poll-admin-result-bar" style="width:{{answerr.status*5}}px">
867
- </span></td>
868
- </tr>
869
- {%endfor%}
870
- </tbody>
871
- </table>
872
-
873
-
874
- </div>
875
-
876
- <div class = "yop-poll-subsection postbox">
877
-
878
- <div title = "{{ __('Click to toggle') }}" class = "handlediv"><br/> </div>
879
 
880
- <h4 class = "yop-poll-subsection-title hndle" style = "padding-top: 5px; padding-bottom: 5px; padding-left: 10px;">{{__( 'Poll Other Answers')}}:</h4>
881
 
882
- <div class = "inside" style = "border-top: 1px solid #AAAAAA; padding: 0px;">
883
- <div>
884
- <table class = "wp-list-table widefat fixed" cellspacing = "0">
885
- <thead>
886
- <tr>
887
- <th class = "column-answer" scope = "col">{{__( 'Value' )}}</th>
888
- <th class = "column-votes" scope = "col">{{__( 'Votes' )}}</th>
889
- </tr>
890
- </thead>
891
- <tbody>
892
- {%set index=0%}
893
- {% for answer in question_detail.answers%}
894
- <tr>
895
- {% if answer.type == 'other' %}
896
- <th>{{ esc_html( stripslashes( answer.answer ) )}}</th>
897
- <td>{{ esc_html( stripslashes( answer.votes ) )}}</td>
898
- {%set index=1 %}
899
- {%endif%}
900
- </tr>
901
- {%endfor%}
902
- {% if index==0 %}
903
- <tr>
904
- <td colspan = "2">{{__( 'No other answers defined!')}}</td>
905
- </tr>
906
- {%endif%}
907
- </tbody>
908
- </table>
909
- </div>
910
- </div>
911
- </div>
912
-
913
- <div class = "yop-poll-subsection postbox">
914
-
915
- <div title = "{{ __('Click to toggle') }}" class = "handlediv"><br/> </div>
916
-
917
- <h4 class = "yop-poll-subsection-title hndle" style = "padding-top: 5px; padding-bottom: 5px; padding-left: 10px;">
918
- {{__( 'Custom Fields')}}:
919
- </h4>
920
- <form method = "get" action = "">
921
- <div>
922
- <div style = "position: absolute; float: right; top: 0px; right: 30px;">
923
- {{ wp_nonce_field( 'yop-poll-custom-fields', 'yop-poll-custom-fields', false, false ) | raw }}
924
- <label for = "yop-poll-items-per-page" class = "displaying-num">{{__( 'Items Per Page' )}}:</label>
925
- <input style="margin-top: 4px;"
926
- id = "yop-poll-items-per-page" type = "text" name = "cf_per_page"
927
- value = "{{cf_per_page}}"/>
928
- <input name = "a"
929
- value = "{{__( 'Set')}}" class="button-secondary" style="margin-top: 2px;"
930
- type = "submit"/>&nbsp;&nbsp;
931
- <span class = "displaying-num">
932
- {{ count( question_detail.custom_fields_logs_details)}} / {{question_detail.total_custom_fields_logs}} items
933
- </span>
934
- <input type="hidden" name="page" value="yop-polls">
935
- <input type="hidden" name="action" value="resultvotes">
936
- <input type="hidden" name="cf_page_no" value="{{cf_page_no}}">
937
- <input type = "hidden" name = "id" value = "{{poll_id}}"/>
938
- <input type = "hidden" name = "q_id" value = "{{ question_detail.q_id }}"/>
939
- {{question_detail.cf_pagination | raw}}
940
- <select name = "export">
941
- <option value = "page">{{__( 'This Page')}}</option>
942
- <option value = "all">{{__( 'All Pages')}}</option>
943
- </select>
944
- <input type = "submit" value = "{{__( 'Export' )}}" class = "button-secondary action" id = "doaction" name = "a">
945
- </div>
946
- </div>
947
- </form>
948
-
949
- <div class = "inside" style = "border-top: 1px solid #AAAAAA; padding: 0px;">
950
- <table class = "wp-list-table widefat fixed">
951
- <thead>
952
- <tr>
953
- <th class = "column-answer" scope = "col">{{__( '#' )}}</th>
954
- {% for custom_field in question_detail.custom_fields %}
955
-
956
- <th id = "custom_field_{{custom_field.ID}}"
957
- class = "column-custom-field"
958
- scope = "col">{{ ucfirst( custom_field.custom_field )}}</th>
959
- {%endfor%}
960
- <th class = "column-vote-id" style = "width:20%"
961
- scope = "col">{{__( 'Vote ID')}}</th>
962
- <th class = "column-tr-id" style = "width:15%"
963
- scope = "col">{{__( 'Tracking ID' )}}</th>
964
- <th class = "column-vote-date" style = "width:15%"
965
- scope = "col">{{__( 'Vote Date')}}</th>
966
- </tr>
967
- </thead>
968
- <tbody>
969
- {%set index=0%}
970
- {%for custom_field_detail in question_detail.custom_fields_logs_details%}
971
- <tr>
972
- {%set index=index+1%}
973
- <td>{{index}}</td>
974
- {%for id in custom_field_detail.column_custom_fields_ids%}
975
- {%set value=custom_field_detail.custom_fields_value%}
976
-
977
- <td>{{value[id]}}</td>
978
-
979
- {%endfor%}
980
- <td>{{custom_field_detail.vote_id}}</td>
981
- <td>{{custom_field_detail.tr_id}}</td>
982
- <td>{{custom_field_detail.vote_date}}</td>
983
-
984
- </tr>
985
- {% else %}
986
- <tr>
987
- <td colspan="4">
988
- {{ __('No Custom Field Defined') }}
989
- </td>
990
- </tr>
991
- {%endfor%}
992
- </tbody>
993
- </table>
994
- </div>
995
- </div>
996
- </div>
997
- </div>
998
- </div>
999
- {% endfor %}
1000
- </div>
1001
- </div>
1002
- </div>
1003
- </div>
1004
  {%else %}
1005
  <h3>{{__( 'Your poll doesn`t exist!' )}}</h3>
1006
  {%endif%}
286
  </form>
287
 
288
  </div>
289
+ <form method = "get">
290
+ <input type = "hidden" name = "page" value = "yop-polls"/>
291
+ <input type = "hidden" name = "action" value = "resultvotes"/>
292
+ <input type = "hidden" name = "id" value = "{{poll_id}}"/>
293
+ <input type = "hidden" name = "oa_page_no" value = "{{oa_page_no}}"/>
294
+ <input type = "hidden" name = "cf_page_no" value = "{{cf_page_no}}"/>
295
+ <input type = "hidden" name = "oa_per_page" value = "{{oa_per_page}}"/>
296
+ <div class = "tablenav top">
297
+ <div class = "alignleft actions">
298
+ <div style = "display:inline; float:left; margin:7px;">{{__( 'Order By' )}}</div>
299
+ <select name = "results_order_by">
300
+ <option {{selected( results_order_by, 'answer' )}} value="answer">{{__( 'Answer Value' )}}</option>
301
+ <option {{ selected( results_order_by, 'votes' )}} value="votes">{{__( 'Votes' )}}</option>
302
+ </select>
303
+ <select name = "results_order">
304
+ <option {{ selected( results_order, 'ASC' )}} value="ASC">{{__( 'ASC' )}}</option>
305
+ <option {{ selected( results_order, 'DESC' )}} value="DESC">{{__( 'DESC' )}}</option>
306
+ </select>
307
+ <span style="line-height: 2.1em;">&nbsp;| &nbsp;</span>
308
+
309
+ <input style="margin-bottom: -7px;" type = "checkbox" value = "yes" {{checked( soav, 'yes' )}} name="soav" id="yop-poll-show_other_answers_values"/>
310
+ <label for = "yop-poll-show_other_answers_values">{{__( 'Show Other Answers Values')}}</label>
311
+
312
+ <input type = "submit"
313
+ value = "{{__( 'Filter' )}}"
314
+ class = "button-secondary action" id = "doaction" name = "a">
315
+ </div>
316
+ </div>
317
+ </form>
318
+
319
 
320
  <div style="position: relative">
321
 
326
  <input type="hidden" id="index_ban_div" value=""/>
327
  <div id="error" style="color: red;text-align: center;font-size: 17px"></div>
328
  <div id="success" style="color: green;text-align: center;font-size:17px "></div>
329
+ <div >
330
 
331
  <h2 style="text-align: center ">{{poll.poll_title}}</h2>
332
 
334
 
335
  {% for question in poll.questions %}
336
 
337
+ <h4 style="text-align: center" >{{__('Question')}}{{index}}{{__(': ')}} {{question.question}}</h4>
338
 
339
  {%set index=index+1%}
340
+ <table style="margin-left: auto; margin-right: auto;">
341
  <tbody>
342
  {%for answer in question.answers%}
343
  <tr>
365
 
366
  <div id="container" style="overflow-x: hidden; " ></div>
367
 
368
+ <div id = "poststuff">
369
+ <div id = "post-body" class = "metabox-holder columns-1">
370
+ <div class = "meta-box-sortables ui-sortable">
371
+ <div class = "postbox-container content">
372
+ {%set i=0%}
373
+ {% for question_detail in questions_details%}
374
+ {%set i=i+1%}
375
+ <div class = "postbox stuffbox">
376
+ <div title = "{{ __('Click to toggle') }}" class = "handlediv"><br/></div>
377
+ <h3 class = "hndle">
378
+ <span>{{ __('Question') }}:
379
+ <span class = "yop-poll-question-order-span">{{ question.poll_order }}</span>
380
+ <span id = "yop-poll-question-{{ question_detail.q_id }}-summar">{{ esc_html( stripslashes( question_detail.name) )}}</span>
381
+ </span>
382
+ </h3>
383
+
384
+ <div class = "inside" style = "padding: 0px;">
385
+ <div id = "poststuff">
386
+ <div class = "yop-poll-subsection postbox">
387
+ <table class="wp-list-table widefat fixed" cellspacing="0">
388
+ <thead>
389
+ <tr>
390
+ <th id="" class="column-answer" style="width: 40%;" scope="col">{{ __ ('Answer') }}</th>
391
+ <th id="" class="column-votes" style="width: 5%;" scope="col">{{ __ ('Votes') }}</th>
392
+ <th id="" class="column-percent" style="width: 5%;" scope="col">{{ __ ('Percent') }}</th>
393
+ <th id="" class="column-bar" style="width: 45%;" scope="col"></th>
394
+ </tr>
395
+
396
 
397
+ </thead>
398
+
399
+ <tbody>
400
+ {% for answerr in question_detail.answers%}
401
+ <tr>
402
+ <th> {{answerr.answer}}</th>
403
+ <th>{{answerr.votes}}</th>
404
+ <th>{{answerr.status}} %</th>
405
+ <td><span class="yop-poll-admin-result-bar" style="width:{{answerr.status*5}}px">
406
+ </span></td>
407
+ </tr>
408
+ {%endfor%}
409
+ </tbody>
410
+ </table>
411
+
412
+
413
+ </div>
414
+
415
+ <div class = "yop-poll-subsection postbox">
416
+
417
+ <div title = "{{ __('Click to toggle') }}" class = "handlediv"><br/> </div>
418
+
419
+ <h4 class = "yop-poll-subsection-title hndle" style = "padding-top: 5px; padding-bottom: 5px; padding-left: 10px;">{{__( 'Poll Other Answers')}}:</h4>
420
+
421
+ <div class = "inside" style = "border-top: 1px solid #AAAAAA; padding: 0px;">
422
+ <div>
423
+ <table class = "wp-list-table widefat fixed" cellspacing = "0">
424
+ <thead>
425
+ <tr>
426
+ <th class = "column-answer" scope = "col">{{__( 'Value' )}}</th>
427
+ <th class = "column-votes" scope = "col">{{__( 'Votes' )}}</th>
428
+ </tr>
429
+ </thead>
430
+ <tbody>
431
+ {%set index=0%}
432
+ {% for answer in question_detail.answers%}
433
+ <tr>
434
+ {% if answer.type == 'other' %}
435
+ <th>{{ esc_html( stripslashes( answer.answer ) )}}</th>
436
+ <td>{{ esc_html( stripslashes( answer.votes ) )}}</td>
437
+ {%set index=1 %}
438
+ {%endif%}
439
+ </tr>
440
+ {%endfor%}
441
+ {% if index==0 %}
442
+ <tr>
443
+ <td colspan = "2">{{__( 'No other answers defined!')}}</td>
444
+ </tr>
445
+ {%endif%}
446
+ </tbody>
447
+ </table>
448
+ </div>
449
+ </div>
450
+ </div>
451
+
452
+ <div class = "yop-poll-subsection postbox">
453
+
454
+ <div title = "{{ __('Click to toggle') }}" class = "handlediv"><br/> </div>
455
+
456
+ <h4 class = "yop-poll-subsection-title hndle" style = "padding-top: 5px; padding-bottom: 5px; padding-left: 10px;">
457
+ {{__( 'Custom Fields')}}:
458
+ </h4>
459
+ <form method = "get" action = "">
460
+ <div>
461
+ <div style = "position: absolute; float: right; top: 0px; right: 30px;">
462
+ {{ wp_nonce_field( 'yop-poll-custom-fields', 'yop-poll-custom-fields', false, false ) | raw }}
463
+ <label for = "yop-poll-items-per-page" class = "displaying-num">{{__( 'Items Per Page' )}}:</label>
464
+ <input style="margin-top: 4px;"
465
+ id = "yop-poll-items-per-page" type = "text" name = "cf_per_page"
466
+ value = "{{cf_per_page}}"/>
467
+ <input name = "a"
468
+ value = "{{__( 'Set')}}" class="button-secondary" style="margin-top: 2px;"
469
+ type = "submit"/>&nbsp;&nbsp;
470
+ <span class = "displaying-num">
471
+ {{ count( question_detail.custom_fields_logs_details)}} / {{question_detail.total_custom_fields_logs}} items
472
+ </span>
473
+ <input type="hidden" name="page" value="yop-polls">
474
+ <input type="hidden" name="action" value="resultvotes">
475
+ <input type="hidden" name="cf_page_no" value="{{cf_page_no}}">
476
+ <input type = "hidden" name = "id" value = "{{poll_id}}"/>
477
+ <input type = "hidden" name = "q_id" value = "{{ question_detail.q_id }}"/>
478
+ {{question_detail.cf_pagination | raw}}
479
+ <select name = "export">
480
+ <option value = "page">{{__( 'This Page')}}</option>
481
+ <option value = "all">{{__( 'All Pages')}}</option>
482
+ </select>
483
+ <input type = "submit" value = "{{__( 'Export' )}}" class = "button-secondary action" id = "doaction" name = "a">
484
+ </div>
485
+ </div>
486
+ </form>
487
+
488
+ <div class = "inside" style = "border-top: 1px solid #AAAAAA; padding: 0px;">
489
+ <table class = "wp-list-table widefat fixed">
490
+ <thead>
491
+ <tr>
492
+ <th class = "column-answer" scope = "col">{{__( '#' )}}</th>
493
+ {% for custom_field in question_detail.custom_fields %}
494
+
495
+ <th id = "custom_field_{{custom_field.ID}}"
496
+ class = "column-custom-field"
497
+ scope = "col">{{ ucfirst( custom_field.custom_field )}}</th>
498
+ {%endfor%}
499
+ <th class = "column-vote-id" style = "width:20%"
500
+ scope = "col">{{__( 'Vote ID')}}</th>
501
+ <th class = "column-tr-id" style = "width:15%"
502
+ scope = "col">{{__( 'Tracking ID' )}}</th>
503
+ <th class = "column-vote-date" style = "width:15%"
504
+ scope = "col">{{__( 'Vote Date')}}</th>
505
+ </tr>
506
+ </thead>
507
+ <tbody>
508
+ {%set index=0%}
509
+ {%for custom_field_detail in question_detail.custom_fields_logs_details%}
510
+ <tr>
511
+ {%set index=index+1%}
512
+ <td>{{index}}</td>
513
+ {%for id in custom_field_detail.column_custom_fields_ids%}
514
+ {%set value=custom_field_detail.custom_fields_value%}
515
+
516
+ <td>{{value[id]}}</td>
517
+
518
+ {%endfor%}
519
+ <td>{{custom_field_detail.vote_id}}</td>
520
+ <td>{{custom_field_detail.tr_id}}</td>
521
+ <td>{{custom_field_detail.vote_date}}</td>
522
+
523
+ </tr>
524
+ {% else %}
525
+ <tr>
526
+ <td colspan="4">
527
+ {{ __('No Custom Field Defined') }}
528
+ </td>
529
+ </tr>
530
+ {%endfor%}
531
+ </tbody>
532
+ </table>
533
+ </div>
534
+ </div>
535
+ </div>
536
+ </div>
537
+ </div>
538
+ {% endfor %}
539
+ </div>
540
+ </div>
541
+ </div>
542
+ </div>
543
 
544
  <form method="" id="show_results">
545
 
547
 
548
  {{ wp_nonce_field( 'yop-poll-results_vote','yop-poll-results_votes', false, false ) | raw }}
549
 
550
+ <div class="tablenav top" style="padding-top: 30px">
551
 
552
  <div class="alignright actions">
553
 
1001
 
1002
  </div>
1003
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1004
 
 
1005
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1006
  {%else %}
1007
  <h3>{{__( 'Your poll doesn`t exist!' )}}</h3>
1008
  {%endif%}
templates/pro_pre_upgrade.html CHANGED
@@ -11,107 +11,75 @@
11
  <br>
12
 
13
  <script>
14
- jQuery( "#yop-poll-buy-template-slider" ).remove();</script>
15
 
16
- <form method="" style="text-align: center" action="">
17
-
18
- <div class="inside yop-poll-slider" >
19
-
20
- <div class="yop-poll-slider-container yop-poll-slider-container2 " >
21
- <div class="set-upgrade-to-pro-width set-upgrade-to-pro-width5 set-upgrade-to-pro-width4" style="text-align: center">
22
- <div class="yop-poll-buy-slider set-slider-margin" style="width: 800px; " class="yop_poll_carusel "id="yop-poll-buy-template-slider" >
23
-
24
- <ul>
25
-
26
- <li id="yop-poll-buy-template-1"style="margin-left:12px;margin-right:2px ;width:800px;"
27
-
28
- class=' yop-poll-buy-template-li '>
29
- <p style="margin: 0 auto; text-align: center">
30
- {{ __('Multiple questions')}}
31
- </p><br>
32
- <img src="{{poll_url}}images/images2/image_two.jpg"/> <br><br>
33
-
34
- </li>
35
- <li id="yop-poll-buy-template-2"style="margin-left:2px;margin-right:2px ;width:800px;"
36
-
37
- class=' yop-poll-buy-template-li '>
38
- <p style="margin: 0 auto; text-align: center">
39
- {{ __('Media Questions')}}
40
- </p><br>
41
- <img src="{{poll_url}}images/images2/image_three.jpg"/> <br><br>
42
-
43
- </li>
44
- <li id="yop-poll-buy-template-3"style="margin-left:2px;margin-right:2px ;width:800px;"
45
-
46
- class=' yop-poll-buy-template-li '>
47
- <p style="margin: 0 auto; text-align: center">
48
- {{ __('Facebook/Google+')}}
49
- </p><br>
50
- <img src="{{poll_url}}images/images2/image_four.jpg"/> <br><br>
51
-
52
- </li>
53
- <li id="yop-poll-buy-template-4"style="margin-left:2px;margin-right:2px ;width:800px;"
54
-
55
- class=' yop-poll-buy-template-li '>
56
- <p style="margin: 0 auto; text-align: center">
57
- {{ __('New Templates')}}
58
- </p><br>
59
- <img src="{{poll_url}}images/images2/image_five.jpg"/> <br><br>
60
 
61
- </li>
62
- <li id="yop-poll-buy-template-5"style="margin-left:2px;margin-right:2px ;width:800px;"
63
 
64
- class=' yop-poll-buy-template-li '>
65
- <p style="margin: 0 auto; text-align: center">
66
- {{__(' Stats')}}
67
- </p><br>
68
- <img src="{{poll_url}}images/images2/image_six.jpg"/> <br><br>
69
 
70
- </li>
71
- <li id="yop-poll-buy-template-6"style="margin-left:2px;margin-right:2px ;width:800px;"
72
 
73
- class=' yop-poll-buy-template-li '>
74
- <p style="margin: 0 auto; text-align: center">
75
- {{__(' Premium support')}}
76
- </p><br>
77
- <img src="{{poll_url}}images/images2/image_seven.jpg"/> <br><br>
78
-
79
- </li>
80
-
81
- </ul>
82
-
83
- </div>
84
- </div>
85
- <!-- Prev/next controls -->
86
-
87
- <a href="javascript:void(0)"
88
-
89
- class="yop-poll-buy-slider-control-prev align-prev-button" style="left:58%" >&lsaquo;</a>
90
- <div style="margin-left: 40px">
91
- <a href="javascript:void(0)"
92
-
93
- class="yop-poll-buy-slider-control-next align-next-button " >&rsaquo;</a></div>
94
-
95
- <br>
96
- <div class="set-upgrade-to-pro-width" style=" text-align: center">
97
- <!-- Pagination -->
98
-
99
-
100
- <!-- Close button -->
101
 
102
 
 
103
 
 
 
 
 
 
 
 
 
104
 
105
- </div>
106
 
107
- </div>
108
- </div>
109
  </form>
110
  <form style="text-align: center" action = "" method = "post">
111
-
112
- <input type = "hidden" name = "action" value = "do-buy" >
113
- {{ wp_nonce_field('yop-poll-before-buy')|raw }}
114
- <input style="height: 33px; padding: 0 10px 10px;font-size: 20px;" type = "submit" name = "do_buy" class = "button-primary" value = "Upgrade To Pro For Only $17">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  </form>
116
 
117
  {% endblock content %}
11
  <br>
12
 
13
  <script>
14
+ jQuery( "#yop-poll-buy-template-slider" ).remove();
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
 
 
17
 
 
 
 
 
 
18
 
19
+ </script>
 
20
 
21
+ <div class="inside yop-poll-slider" style="opacity: 0" >
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
 
24
+ <ul class="bxslider" >
25
 
26
+ <li><img src="{{poll_url}}images/images2/image1.jpg" /></li>
27
+ <li><img src="{{poll_url}}images/images2/image2.jpg" /></li>
28
+ <li><img src="{{poll_url}}images/images2/image3.jpg" /></li>
29
+ <li><img src="{{poll_url}}images/images2/image4.jpg" /></li>
30
+ <li><img src="{{poll_url}}images/images2/image6.jpg" /></li>
31
+ </ul>
32
+ </div>
33
+ <form method="" style="text-align: center" action="">
34
 
 
35
 
 
 
36
  </form>
37
  <form style="text-align: center" action = "" method = "post">
38
+ <p style="text-align:center; font-weight: bold; font-size: 16px">
39
+ <input type = "hidden" name = "action" value = "do-buy" >
40
+ {{ wp_nonce_field('yop-poll-before-buy')|raw }}
41
+ <input type = "submit" name = "do_buy" class = "upgrade_button" value = "Upgrade To Pro For Only $17">
42
+ <br />
43
+ 60 days money back guarantee
44
+ </p>
45
+
46
+ <section>
47
+ <div class="yop_testimonials_pro1">
48
+ <p class="yop_testimonials_header">
49
+ {{ __ ("Top class software and support")}}
50
+ </p>
51
+ <p class="yop_testimonials_content">{{ __ ("
52
+ I love this software and the support service.")}}
53
+ <br />
54
+ {{ __ ("This is definitely the #1 poll plugin for WP. I give this software and its support service a A++++.")}}
55
+ <br /><br />
56
+ {{ __ ("
57
+ I'm so glad to be a Pro version user. The US$17 upgrade worth every cent...")}}
58
+ <br /><br />
59
+ {{ __ ("
60
+ I originally had some difficulties with the tool, and I reported them. \(This is normal for all software.\)
61
+ After I reported my issues, the support got in touch with me very quickly and have the problem resolved.
62
+ Also, they listened to my suggestions and worked with me to have things implemented and resolved.
63
+ This is definitely a TOP CLASS service.")}}
64
+ </p>
65
+ <p class="yop_testimonials_client">
66
+ {{ __ ("edwintam, wordpress user")|e}}
67
+ </p>
68
+ </p> </div>
69
+ <div class="yop_testimonials_pro2">
70
+ <p class="yop_testimonials_header">
71
+ {{ __ ("Great support for a very useful product")}}
72
+ </p>
73
+ <p class="yop_testimonials_content">
74
+ {{ __ ('I used yop poll standard and tried upgrading. I ran into an issue and send support an email. I got the best suppor timaginable. They immediately (within the hour) started working on the issue, solved it and solved a bunch of other stuff in the running.')}}
75
+ <br /><br />
76
+ {{ __ ("Superb Support, absolutely worth paying for!")}}
77
+ </p>
78
+ <p class="yop_testimonials_client">
79
+ {{ __ ("fredverhoeven, wordpress user")|e}}
80
+ </p>
81
+ </div> </br>
82
+ </section>
83
  </form>
84
 
85
  {% endblock content %}
yop_poll.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Use a full option polling functionality to get the answers you need. YOP Poll is the perfect, easy to use plugin for your WordPress website.
6
  * Author: yourownprogrammer
7
  * Author URL: http://www.yop-poll.com/thankyou/
8
- * Version: 5.3
9
  * Network: false
10
  */
11
 
@@ -22,7 +22,7 @@
22
  if (!(version_compare(phpversion(), '5.3', '<'))) {
23
  define ( 'YOP_POLL_DOMAIN', 'yop_poll' );
24
  define ( 'YOP_POLL_WP_VERSION', '3.3' );
25
- define ( 'YOP_POLL_VERSION', '5.3' );
26
  define ( 'YOP_POLL_PATH', plugin_dir_path( __FILE__ ) ); ///home/..../wp-content/plugins/yop-poll-2.0/
27
  define ( 'YOP_POLL_URL', plugin_dir_url( __FILE__ ) ); //http://your-domain/wp-content/plugins/yop-poll-2.0/
28
  define ( 'YOP_POLL_PLUGIN_FILE', __FILE__ ); ///home/..../wp-content/plugins/yop-poll-2.0/yop-poll-2.0.php
@@ -30,7 +30,7 @@ if (!(version_compare(phpversion(), '5.3', '<'))) {
30
  define ( 'YOP_POLL_PLUGIN_DIR', plugin_basename( dirname( __FILE__ ) ) ); //yop-poll-2.0
31
  define ( 'YOP_POLL_INC', YOP_POLL_PATH . 'inc/' );
32
  define ( 'YOP_POLL_MODELS', YOP_POLL_PATH . 'models/' );
33
- define ( "YOP_POLL_DEBUG", false );
34
 
35
  require_once( YOP_POLL_PATH . 'lib/Twig/Autoloader.php' );
36
  Twig_Autoloader::register();
5
  * Description: Use a full option polling functionality to get the answers you need. YOP Poll is the perfect, easy to use plugin for your WordPress website.
6
  * Author: yourownprogrammer
7
  * Author URL: http://www.yop-poll.com/thankyou/
8
+ * Version: 5.5
9
  * Network: false
10
  */
11
 
22
  if (!(version_compare(phpversion(), '5.3', '<'))) {
23
  define ( 'YOP_POLL_DOMAIN', 'yop_poll' );
24
  define ( 'YOP_POLL_WP_VERSION', '3.3' );
25
+ define ( 'YOP_POLL_VERSION', '5.5' );
26
  define ( 'YOP_POLL_PATH', plugin_dir_path( __FILE__ ) ); ///home/..../wp-content/plugins/yop-poll-2.0/
27
  define ( 'YOP_POLL_URL', plugin_dir_url( __FILE__ ) ); //http://your-domain/wp-content/plugins/yop-poll-2.0/
28
  define ( 'YOP_POLL_PLUGIN_FILE', __FILE__ ); ///home/..../wp-content/plugins/yop-poll-2.0/yop-poll-2.0.php
30
  define ( 'YOP_POLL_PLUGIN_DIR', plugin_basename( dirname( __FILE__ ) ) ); //yop-poll-2.0
31
  define ( 'YOP_POLL_INC', YOP_POLL_PATH . 'inc/' );
32
  define ( 'YOP_POLL_MODELS', YOP_POLL_PATH . 'models/' );
33
+ define ( "YOP_POLL_DEBUG", true );
34
 
35
  require_once( YOP_POLL_PATH . 'lib/Twig/Autoloader.php' );
36
  Twig_Autoloader::register();