Toolset Types – Custom Post Types, Custom Fields and Taxonomies - Version 1.6.4

Version Description

  • Fixed an issue with dependency between custom taxonomy and custom posts when importing data from the "Custom Post Type UI" plugin.
  • Fixed an issue with editing checkboxes with the option "save 0 to the database" selected, created for Custom Posts. http://wp-types.com/forums/topic/checkbox-custom-field-doesnt-save-value-since-upgrade-to-version-1-6-2/ http://wp-types.com/forums/topic/types-checkbox-field-not-saving-after-save-0-to-the-database/
  • Fixed an issue with PHP notices being thrown when relative URLs to images were used. http://wp-types.com/forums/topic/php-notice-undefined-index-host-in-image-php/
  • Fixed the example file which adds the Google Map field to Types and allows users to enter coordinates to display a map on the front-end.
  • Added the "wpcf_delete_relation_meta" filter which allows deletion of all post relationships when deleting a custom post type.
  • Fixed an issue with the file name being changed when the file was uploaded. https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/189560556/comments http://wp-types.com/forums/topic/types-1-6-update-breaks-layout-that-worked-in-types-1-5-7/
  • Fixed a problem with duplicate slugs on "Edit Group" screen. https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/187118123/comments http://wp-types.com/forums/topic/cant-add-more-custom-fields/
  • Fixed a problem with default description not disappearing for non-English placeholders. https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/189787190/comments
  • Fixed a problem with Custom Taxonomy metaboxes still appearing on the Custom Post editing page even after removing a Custom Taxonomy from a Custom Post Type.
  • Fixed embedding OTGS CSS for the admin area. https://wordpress.org/support/topic/four-stylesheets-being-loaded-at-frontend
  • Fixed a problem with Checkbox field value not being saved. https://wp-types.com/forums/topic/checkbox-value-not-saved/
  • Added the option to select posts with the "Private" post status as parents in a parent-child Custom Post Types relationships. http://wp-types.com/forums/topic/cred-child-form-not-working-with-private-ctp/
  • Fixed a problem with the date-picker. https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/191190651/comments
  • Fixed a problem with label menu in wp-admin for child posts.
  • Fixed a problem with child table when edit parent post and children do not have title.
  • Prevent to chose repetitive field in child table on edit parent screen. http://wp-types.com/forums/topic/wp-types-select-child-fields-to-be-displayed-specific-fields-not-working/
  • Added a dynamic "posted x minutes/hours ago" for Types fields. https://wp-types.com/forums/topic/adding-a-dynamic-posted-x-minuteshours-ago-in-a-view/
  • Improved post relation table by using more precise labels. http://wp-types.com/forums/topic/displaying-the-best-names-of-cpts-in-applicable-contexts/
  • Fixed a problem with display checkbox value from database if checkbox is empty.
Download this release

Release Info

Developer iworks
Plugin Icon 128x128 Toolset Types – Custom Post Types, Custom Fields and Taxonomies
Version 1.6.4
Comparing to
See all releases

Code changes from version 1.6.3 to 1.6.4

Files changed (143) hide show
  1. admin.php +8 -8
  2. embedded/admin.php +4 -4
  3. embedded/bootstrap.php +4 -4
  4. embedded/classes/class.wpcf-post-types.php +3 -3
  5. embedded/classes/field.php +16 -23
  6. embedded/classes/fields.php +3 -3
  7. embedded/classes/forms.php +4 -4
  8. embedded/classes/loader.php +3 -3
  9. embedded/classes/path.php +3 -3
  10. embedded/classes/post-types/messages.php +3 -3
  11. embedded/classes/relationship.php +17 -3
  12. embedded/classes/relationship/form-child.php +113 -62
  13. embedded/classes/usermeta_field.php +3 -5
  14. embedded/common/classes/forms.php +5 -5
  15. embedded/common/classes/validation-cakephp.php +1091 -1089
  16. embedded/common/debug/debug-information.php +3 -3
  17. embedded/common/debug/functions_debug_information.php +27 -22
  18. embedded/common/functions.php +31 -18
  19. embedded/common/installer/changelog.txt +17 -0
  20. embedded/common/installer/includes/installer-upgrader-skins.php +33 -0
  21. embedded/common/installer/includes/installer.class.php +1590 -0
  22. embedded/common/installer/installer.php +21 -0
  23. embedded/common/installer/loader.php +80 -0
  24. embedded/common/installer/repositories.xml +13 -0
  25. embedded/common/installer/res/css/admin.css +130 -0
  26. embedded/common/installer/res/img/complete.png +0 -0
  27. embedded/common/installer/res/img/computer.png +0 -0
  28. embedded/common/installer/res/img/dn.gif +0 -0
  29. embedded/common/installer/res/img/dn2.gif +0 -0
  30. embedded/common/installer/res/img/globe.png +0 -0
  31. embedded/common/installer/res/img/icon_error.gif +0 -0
  32. embedded/common/installer/res/img/on.png +0 -0
  33. embedded/common/installer/res/js/admin.js +286 -0
  34. embedded/common/installer/res/js/iframeResizer.min.js +10 -0
  35. embedded/common/installer/templates/downloads-list-compact.php +58 -0
  36. embedded/common/installer/templates/downloads-list.php +65 -0
  37. embedded/common/installer/templates/products-compact.php +128 -0
  38. embedded/common/installer/templates/repository-listing.php +168 -0
  39. embedded/common/toolset-forms/api.php +3 -3
  40. embedded/common/toolset-forms/bootstrap.php +96 -29
  41. embedded/common/toolset-forms/classes/class.audio.php +3 -3
  42. embedded/common/toolset-forms/classes/class.checkbox.php +11 -5
  43. embedded/common/toolset-forms/classes/class.checkboxes.php +27 -10
  44. embedded/common/toolset-forms/classes/class.colorpicker.php +3 -3
  45. embedded/common/toolset-forms/classes/class.conditional.php +2 -2
  46. embedded/common/toolset-forms/classes/class.credaudio.php +3 -3
  47. embedded/common/toolset-forms/classes/class.credfile.php +4 -4
  48. embedded/common/toolset-forms/classes/class.credimage.php +3 -3
  49. embedded/common/toolset-forms/classes/class.credvideo.php +3 -3
  50. embedded/common/toolset-forms/classes/class.date.php +233 -233
  51. embedded/common/toolset-forms/classes/class.date.scripts.php +4 -4
  52. embedded/common/toolset-forms/classes/class.eforms.php +21 -7
  53. embedded/common/toolset-forms/classes/class.field_factory.php +19 -4
  54. embedded/common/toolset-forms/classes/class.fieldconfig.php +4 -4
  55. embedded/common/toolset-forms/classes/class.file.php +3 -3
  56. embedded/common/toolset-forms/classes/class.form_factory.php +57 -10
  57. embedded/common/toolset-forms/classes/class.image.php +18 -7
  58. embedded/common/toolset-forms/classes/class.integer.php +12 -0
  59. embedded/common/toolset-forms/classes/class.password.php +4 -4
  60. embedded/common/toolset-forms/classes/class.radios.php +27 -10
  61. embedded/common/toolset-forms/classes/class.repetitive.php +3 -3
  62. embedded/common/toolset-forms/classes/class.select.php +3 -3
  63. embedded/common/toolset-forms/classes/class.skype.php +3 -3
  64. embedded/common/toolset-forms/classes/class.submit.php +41 -29
  65. embedded/common/toolset-forms/classes/class.taxonomy.php +15 -11
  66. embedded/common/toolset-forms/classes/class.taxonomyhierarchical.php +62 -48
  67. embedded/common/toolset-forms/classes/class.textarea.php +3 -3
  68. embedded/common/toolset-forms/classes/class.textfield.php +4 -3
  69. embedded/common/toolset-forms/classes/class.types.php +12 -13
  70. embedded/common/toolset-forms/classes/class.video.php +43 -7
  71. embedded/common/toolset-forms/classes/class.wysiwyg.php +10 -10
  72. embedded/common/toolset-forms/css/wpt-jquery-ui/datepicker.css +1 -1
  73. embedded/common/toolset-forms/external/autocompleter.php +3 -3
  74. embedded/common/toolset-forms/js/conditional.js +29 -13
  75. embedded/common/toolset-forms/js/date.js +102 -97
  76. embedded/common/toolset-forms/js/file.js +4 -4
  77. embedded/common/toolset-forms/js/main.js +60 -49
  78. embedded/common/toolset-forms/js/repetitive.js +4 -4
  79. embedded/common/toolset-forms/js/validation.js +4 -4
  80. embedded/common/toolset-forms/lib/CakePHP-Validation.php +197 -194
  81. embedded/common/toolset-forms/lib/js/jquery-form-validation/jquery.validate.js +5 -1
  82. embedded/common/toolset-forms/readme.txt +127 -0
  83. embedded/common/toolset-forms/templates/metaform-item.php +5 -5
  84. embedded/common/toolset-forms/templates/metaform.php +5 -5
  85. embedded/common/visual-editor/editor-addon.class.php +7 -6
  86. embedded/common/wpv-filter-date-embedded.php +1 -1
  87. embedded/frontend.php +17 -10
  88. embedded/functions.php +4 -4
  89. embedded/includes/custom-types.php +4 -3
  90. embedded/includes/examples/google_map.php +31 -2
  91. embedded/includes/fields-post.php +132 -139
  92. embedded/includes/fields.php +39 -40
  93. embedded/includes/fields/audio.php +3 -3
  94. embedded/includes/fields/checkbox.php +410 -292
  95. embedded/includes/fields/date.php +17 -0
  96. embedded/includes/fields/file.php +4 -4
  97. embedded/includes/fields/image.php +4 -4
  98. embedded/includes/fields/skype.php +486 -487
  99. embedded/includes/fields/textarea.php +3 -3
  100. embedded/includes/fields/video.php +3 -3
  101. embedded/includes/import-export.php +4 -4
  102. embedded/includes/module-manager.php +17 -18
  103. embedded/includes/post-relationship.php +71 -44
  104. embedded/includes/usermeta-post.php +87 -88
  105. embedded/includes/wpml.php +4 -4
  106. embedded/onthego-resources/classes/onthegosystems-styles.class.php +5 -3
  107. embedded/onthego-resources/onthegosystems-icons/.fontcustom-manifest.json +27 -23
  108. embedded/onthego-resources/onthegosystems-icons/css/_onthegosystems-icons.scss +9 -7
  109. embedded/onthego-resources/onthegosystems-icons/css/onthegosystems-icons.css +9 -7
  110. embedded/onthego-resources/onthegosystems-icons/fonts/onthegosystems-icons-preview.html +23 -8
  111. embedded/onthego-resources/onthegosystems-icons/fonts/onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.eot +0 -0
  112. embedded/onthego-resources/onthegosystems-icons/fonts/onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.svg +335 -0
  113. embedded/onthego-resources/onthegosystems-icons/fonts/onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.ttf +0 -0
  114. embedded/onthego-resources/onthegosystems-icons/fonts/onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.woff +0 -0
  115. embedded/onthego-resources/onthegosystems-icons/vectors/wpml logo.svg +13 -0
  116. embedded/resources/css/basic.css +9 -1
  117. embedded/resources/css/dashicons.css +4 -4
  118. embedded/resources/js/basic.js +10 -4
  119. embedded/resources/js/fields-form.js +4 -4
  120. embedded/resources/js/post-relationship.js +16 -4
  121. embedded/usermeta-init.php +17 -19
  122. embedded/views/image.php +16 -6
  123. embedded/views/templates/editor-modal-date.tpl.php +5 -1
  124. help.php +3 -3
  125. includes/ajax.php +13 -0
  126. includes/conditional-display.php +1 -2
  127. includes/custom-taxonomies-form.php +5 -6
  128. includes/custom-types-form.php +24 -5
  129. includes/fields-control.php +3 -3
  130. includes/fields-form.php +6 -6
  131. includes/fields-list.php +4 -4
  132. includes/fields.php +59 -63
  133. includes/import-export.php +3 -3
  134. includes/introduction.php +4 -4
  135. includes/migration.php +36 -10
  136. includes/post-relationship.php +5 -2
  137. includes/usermeta-control.php +3 -3
  138. includes/usermeta-form.php +5 -4
  139. marketing/types_marketing_message_survey_2014_09.php +3 -3
  140. readme.txt +27 -4
  141. resources/js/basic.js +4 -4
  142. resources/js/custom-types-form.js +4 -4
  143. wpcf.php +32 -7
admin.php CHANGED
@@ -3,9 +3,9 @@
3
  *
4
  * Admin functions
5
  *
6
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/admin.php $
7
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
8
- * $LastChangedRevision: 1012704 $
9
  * $LastChangedBy: iworks $
10
  *
11
  */
@@ -336,20 +336,20 @@ function wpcf_admin_menu_edit_fields() {
336
  ?>
337
  <script type="text/javascript">
338
  function wpcf_group_submit() {
339
- if (jQuery('#wpcf-group-name').val() == 'Enter group title') {
340
  jQuery('#wpcf-group-name').val('');
341
  }
342
- if (jQuery('#wpcf-group-description').val() == 'Enter a description for this group') {
343
  jQuery('#wpcf-group-description').val('');
344
  }
345
  jQuery('.wpcf-forms-set-legend').each(function(){
346
- if (jQuery(this).val() == 'Enter field name') {
347
  jQuery(this).val('');
348
  }
349
- if (jQuery(this).next().val() == 'Enter field slug') {
350
  jQuery(this).next().val('');
351
  }
352
- if (jQuery(this).next().next().val() == 'Describe this field') {
353
  jQuery(this).next().next().val('');
354
  }
355
  });
3
  *
4
  * Admin functions
5
  *
6
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/admin.php $
7
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
8
+ * $LastChangedRevision: 1027712 $
9
  * $LastChangedBy: iworks $
10
  *
11
  */
336
  ?>
337
  <script type="text/javascript">
338
  function wpcf_group_submit() {
339
+ if (jQuery('#wpcf-group-name').val() == '<?php _e('Enter group title', 'wpcf'); ?>') {
340
  jQuery('#wpcf-group-name').val('');
341
  }
342
+ if (jQuery('#wpcf-group-description').val() == '<?php _e('Enter a description for this group', 'wpcf'); ?>') {
343
  jQuery('#wpcf-group-description').val('');
344
  }
345
  jQuery('.wpcf-forms-set-legend').each(function(){
346
+ if (jQuery(this).val() == '<?php _e('Enter field name', 'wpcf'); ?>') {
347
  jQuery(this).val('');
348
  }
349
+ if (jQuery(this).next().val() == '<?php _e('Enter field slug', 'wpcf'); ?>') {
350
  jQuery(this).next().val('');
351
  }
352
+ if (jQuery(this).next().next().val() == '<?php _e('Describe this field', 'wpcf'); ?>') {
353
  jQuery(this).next().next().val('');
354
  }
355
  });
embedded/admin.php CHANGED
@@ -1,10 +1,10 @@
1
  <?php
2
  /**
3
  *
4
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/admin.php $
5
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
6
- * $LastChangedRevision: 1012704 $
7
- * $LastChangedBy: iworks $
8
  *
9
  */
10
  require_once(WPCF_EMBEDDED_ABSPATH . '/common/visual-editor/editor-addon.class.php');
1
  <?php
2
  /**
3
  *
4
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/admin.php $
5
+ * $LastChangedDate: 2014-08-22 01:02:43 +0000 (Fri, 22 Aug 2014) $
6
+ * $LastChangedRevision: 970205 $
7
+ * $LastChangedBy: brucepearson $
8
  *
9
  */
10
  require_once(WPCF_EMBEDDED_ABSPATH . '/common/visual-editor/editor-addon.class.php');
embedded/bootstrap.php CHANGED
@@ -7,9 +7,9 @@
7
  *
8
  * @since Types 1.2
9
  *
10
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/bootstrap.php $
11
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
12
- * $LastChangedRevision: 1012704 $
13
  * $LastChangedBy: iworks $
14
  *
15
  */
@@ -131,7 +131,7 @@ function wpcf_embedded_init() {
131
  // Define necessary constants if plugin is not present
132
  // This ones are skipped if used as embedded code!
133
  if ( !defined( 'WPCF_VERSION' ) ) {
134
- define( 'WPCF_VERSION', '1.6.3' );
135
  define( 'WPCF_META_PREFIX', 'wpcf-' );
136
  }
137
 
7
  *
8
  * @since Types 1.2
9
  *
10
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/bootstrap.php $
11
+ * $LastChangedDate: 2014-11-18 06:52:14 +0000 (Tue, 18 Nov 2014) $
12
+ * $LastChangedRevision: 1027716 $
13
  * $LastChangedBy: iworks $
14
  *
15
  */
131
  // Define necessary constants if plugin is not present
132
  // This ones are skipped if used as embedded code!
133
  if ( !defined( 'WPCF_VERSION' ) ) {
134
+ define( 'WPCF_VERSION', '1.6.4' );
135
  define( 'WPCF_META_PREFIX', 'wpcf-' );
136
  }
137
 
embedded/classes/class.wpcf-post-types.php CHANGED
@@ -3,9 +3,9 @@
3
  *
4
  * Post Types Class
5
  *
6
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/classes/class.wpcf-post-types.php $
7
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
8
- * $LastChangedRevision: 1012704 $
9
  * $LastChangedBy: iworks $
10
  *
11
  */
3
  *
4
  * Post Types Class
5
  *
6
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/classes/class.wpcf-post-types.php $
7
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
8
+ * $LastChangedRevision: 1027712 $
9
  * $LastChangedBy: iworks $
10
  *
11
  */
embedded/classes/field.php CHANGED
@@ -2,9 +2,9 @@
2
  /*
3
  * Field class.
4
  *
5
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/classes/field.php $
6
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
7
- * $LastChangedRevision: 1012704 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
@@ -301,10 +301,8 @@ class WPCF_Field
301
  * Apply filters
302
  */
303
  $meta = apply_filters( 'wpcf_fields_value_get', $meta, $this );
304
- $meta = apply_filters( 'wpcf_fields_slug_' . $this->cf['slug']
305
- . '_value_get', $meta, $this );
306
- $meta = apply_filters( 'wpcf_fields_type_' . $this->cf['type']
307
- . '_value_get', $meta, $this );
308
 
309
  return $meta;
310
  }
@@ -400,14 +398,12 @@ class WPCF_Field
400
  * @param type $value
401
  * @return type
402
  */
403
- function _filter_save_value( $value ) {
 
404
  // Apply filters
405
- $value = apply_filters( 'wpcf_fields_value_save', $value,
406
- $this->cf['type'], $this->cf['slug'], $this->cf, $this );
407
- $value = apply_filters( 'wpcf_fields_slug_' . $this->cf['slug']
408
- . '_value_save', $value, $this->cf, $this );
409
- $value = apply_filters( 'wpcf_fields_type_' . $this->cf['type']
410
- . '_value_save', $value, $this->cf, $this );
411
 
412
  return $value;
413
  }
@@ -420,13 +416,11 @@ class WPCF_Field
420
  * @param type $value
421
  * @param type $meta_id
422
  */
423
- function _action_save( $field, $value, $meta_id, $meta_value_original ) {
424
- do_action( 'wpcf_fields_save', $value, $field, $this, $meta_id,
425
- $meta_value_original );
426
- do_action( 'wpcf_fields_slug_' . $field['slug'] . '_save', $value,
427
- $field, $this, $meta_id, $meta_value_original );
428
- do_action( 'wpcf_fields_type_' . $field['type'] . '_save', $value,
429
- $field, $this, $meta_id, $meta_value_original );
430
  }
431
 
432
  /**
@@ -620,8 +614,7 @@ class WPCF_Field
620
  }
621
 
622
  // Set form element
623
- $form[$element_key] = apply_filters( 'wpcf_post_edit_field',
624
- $element, $this->cf, $this->post, $this->context );
625
  }
626
 
627
  // Add to editor
2
  /*
3
  * Field class.
4
  *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/classes/field.php $
6
+ * $LastChangedDate: 2014-10-23 10:33:39 +0000 (Thu, 23 Oct 2014) $
7
+ * $LastChangedRevision: 1012677 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
301
  * Apply filters
302
  */
303
  $meta = apply_filters( 'wpcf_fields_value_get', $meta, $this );
304
+ $meta = apply_filters( 'wpcf_fields_slug_' . $this->cf['slug'] . '_value_get', $meta, $this );
305
+ $meta = apply_filters( 'wpcf_fields_type_' . $this->cf['type'] . '_value_get', $meta, $this );
 
 
306
 
307
  return $meta;
308
  }
398
  * @param type $value
399
  * @return type
400
  */
401
+ function _filter_save_value( $value )
402
+ {
403
  // Apply filters
404
+ $value = apply_filters( 'wpcf_fields_value_save', $value, $this->cf['type'], $this->cf['slug'], $this->cf, $this );
405
+ $value = apply_filters( 'wpcf_fields_slug_' . $this->cf['slug'] . '_value_save', $value, $this->cf, $this );
406
+ $value = apply_filters( 'wpcf_fields_type_' . $this->cf['type'] . '_value_save', $value, $this->cf, $this );
 
 
 
407
 
408
  return $value;
409
  }
416
  * @param type $value
417
  * @param type $meta_id
418
  */
419
+ function _action_save( $field, $value, $meta_id, $meta_value_original )
420
+ {
421
+ do_action( 'wpcf_fields_save', $value, $field, $this, $meta_id, $meta_value_original );
422
+ do_action( 'wpcf_fields_slug_' . $field['slug'] . '_save', $value, $field, $this, $meta_id, $meta_value_original );
423
+ do_action( 'wpcf_fields_type_' . $field['type'] . '_save', $value, $field, $this, $meta_id, $meta_value_original );
 
 
424
  }
425
 
426
  /**
614
  }
615
 
616
  // Set form element
617
+ $form[$element_key] = apply_filters( 'wpcf_post_edit_field', $element, $this->cf, $this->post, $this->context );
 
618
  }
619
 
620
  // Add to editor
embedded/classes/fields.php CHANGED
@@ -2,9 +2,9 @@
2
  /**
3
  * Fields class.
4
  *
5
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/classes/fields.php $
6
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
7
- * $LastChangedRevision: 1012704 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
2
  /**
3
  * Fields class.
4
  *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/classes/fields.php $
6
+ * $LastChangedDate: 2014-05-07 06:56:23 +0000 (Wed, 07 May 2014) $
7
+ * $LastChangedRevision: 909470 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
embedded/classes/forms.php CHANGED
@@ -4,10 +4,10 @@
4
  *
5
  * Returns HTML formatted output for elements and handles form submission.
6
  *
7
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/classes/forms.php $
8
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
9
- * $LastChangedRevision: 1012704 $
10
- * $LastChangedBy: iworks $
11
  *
12
  *
13
  * @version 1.0
4
  *
5
  * Returns HTML formatted output for elements and handles form submission.
6
  *
7
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/classes/forms.php $
8
+ * $LastChangedDate: 2014-08-22 01:02:43 +0000 (Fri, 22 Aug 2014) $
9
+ * $LastChangedRevision: 970205 $
10
+ * $LastChangedBy: brucepearson $
11
  *
12
  *
13
  * @version 1.0
embedded/classes/loader.php CHANGED
@@ -3,9 +3,9 @@
3
  *
4
  * Loader class
5
  *
6
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/classes/loader.php $
7
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
8
- * $LastChangedRevision: 1012704 $
9
  * $LastChangedBy: iworks $
10
  *
11
  */
3
  *
4
  * Loader class
5
  *
6
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/classes/loader.php $
7
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
8
+ * $LastChangedRevision: 1027712 $
9
  * $LastChangedBy: iworks $
10
  *
11
  */
embedded/classes/path.php CHANGED
@@ -2,9 +2,9 @@
2
  /**
3
  * WPCF_Path
4
  *
5
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/classes/path.php $
6
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
7
- * $LastChangedRevision: 1012704 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
2
  /**
3
  * WPCF_Path
4
  *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/classes/path.php $
6
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
7
+ * $LastChangedRevision: 1027712 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
embedded/classes/post-types/messages.php CHANGED
@@ -2,9 +2,9 @@
2
  /*
3
  * Messages.
4
  *
5
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/classes/post-types/messages.php $
6
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
7
- * $LastChangedRevision: 1012704 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
2
  /*
3
  * Messages.
4
  *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/classes/post-types/messages.php $
6
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
7
+ * $LastChangedRevision: 1027712 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
embedded/classes/relationship.php CHANGED
@@ -2,9 +2,9 @@
2
  /*
3
  * Post relationship class.
4
  *
5
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/classes/relationship.php $
6
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
7
- * $LastChangedRevision: 1012704 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
@@ -254,6 +254,7 @@ class WPCF_Relationship
254
  $post_title = $save_fields['_wp_title'];
255
  }
256
 
 
257
  $post_data['post_title'] = $post_title;
258
  $post_data['post_content'] = isset( $save_fields['_wp_body'] ) ? $save_fields['_wp_body'] : $child->post_content;
259
  $post_data['post_type'] = $child->post_type;
@@ -275,6 +276,19 @@ class WPCF_Relationship
275
  * UPDATE POST
276
  */
277
 
 
 
 
 
 
 
 
 
 
 
 
 
 
278
  $updated_id = wp_update_post( $post_data );
279
  if ( empty( $updated_id ) ) {
280
  return new WP_Error( 'relationship-update-post-failed', 'Updating post failed' );
2
  /*
3
  * Post relationship class.
4
  *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/classes/relationship.php $
6
+ * $LastChangedDate: 2014-10-23 10:33:39 +0000 (Thu, 23 Oct 2014) $
7
+ * $LastChangedRevision: 1012677 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
254
  $post_title = $save_fields['_wp_title'];
255
  }
256
 
257
+
258
  $post_data['post_title'] = $post_title;
259
  $post_data['post_content'] = isset( $save_fields['_wp_body'] ) ? $save_fields['_wp_body'] : $child->post_content;
260
  $post_data['post_type'] = $child->post_type;
276
  * UPDATE POST
277
  */
278
 
279
+ $cf = new WPCF_Field;
280
+ if (
281
+ isset( $_POST['wpcf_post_relationship'][$parent_id])
282
+ && isset( $_POST['wpcf_post_relationship'][$parent_id][$child_id] )
283
+ ) {
284
+ $_POST['wpcf'] = array();
285
+ foreach( $_POST['wpcf_post_relationship'][$parent_id][$child_id] as $slug => $value ) {
286
+ $_POST['wpcf'][$cf->__get_slug_no_prefix( $slug )] = $value;
287
+ $_POST['wpcf'][$slug] = $value;
288
+ }
289
+ }
290
+ unset($cf);
291
+
292
  $updated_id = wp_update_post( $post_data );
293
  if ( empty( $updated_id ) ) {
294
  return new WP_Error( 'relationship-update-post-failed', 'Updating post failed' );
embedded/classes/relationship/form-child.php CHANGED
@@ -1,14 +1,14 @@
1
  <?php
2
  /*
3
  * Relationship form class.
4
- *
5
  * Used to render child forms
6
  */
7
  require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields-post.php';
8
 
9
  /**
10
  * Relationship form class.
11
- *
12
  * Used on post edit page to show children rows
13
  */
14
  class WPCF_Relationship_Child_Form
@@ -16,29 +16,29 @@ class WPCF_Relationship_Child_Form
16
 
17
  /**
18
  * Current post.
19
- *
20
  * @var type object
21
  */
22
  var $post;
23
 
24
  /**
25
  * Field object.
26
- *
27
  * @var type array
28
  */
29
  var $cf = array();
30
 
31
  /**
32
  * Saved data.
33
- *
34
  * @var type array
35
  */
36
  var $data = array();
37
 
38
  /**
39
  * Child post object.
40
- *
41
- * @var type
42
  */
43
  var $child_post_type_object;
44
  var $parent;
@@ -52,6 +52,23 @@ class WPCF_Relationship_Child_Form
52
  'field');
53
  private $__urlParams = array();
54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  /**
56
  * Construct function.
57
  */
@@ -67,8 +84,13 @@ class WPCF_Relationship_Child_Form
67
  }
68
  $this->cf = new WPCF_Field();
69
  $this->cf->context = 'relationship';
70
- $this->children = WPCF_Relationship_Model::getChildrenByPostType( $this->parent,
71
- $this->child_post_type, $this->data, $_GET );
 
 
 
 
 
72
  // If no children - use dummy post
73
  if ( empty( $this->children ) ) {
74
  $_dummy_post = get_default_post_to_edit( $this->child_post_type,
@@ -77,15 +99,25 @@ class WPCF_Relationship_Child_Form
77
  $this->_dummy_post = true;
78
  }
79
  $this->child_post_type_object = get_post_type_object( $this->child_post_type );
80
-
81
  // Collect params from request
82
  foreach ( $this->__params as $__param ) {
83
  if ( isset( $_GET[$__param] ) ) {
84
  $this->__urlParams[$__param] = $_GET[$__param];
85
  }
86
  }
 
 
 
 
 
 
 
 
 
 
87
  }
88
-
89
  function getParamsQuery() {
90
  return count( $this->__urlParams ) ? '&amp;' . http_build_query( $this->__urlParams,
91
  '', '&amp;' ) : '';
@@ -93,7 +125,7 @@ class WPCF_Relationship_Child_Form
93
 
94
  /**
95
  * Sets form.
96
- *
97
  * @param type $o
98
  */
99
  function _set( $child ) {
@@ -102,11 +134,11 @@ class WPCF_Relationship_Child_Form
102
 
103
  /**
104
  * Returns HTML formatted form.
105
- *
106
  * Renders children per row.
107
- *
108
  * @todo move all here
109
- *
110
  * @return type string (HTML formatted)
111
  */
112
  function render() {
@@ -156,8 +188,8 @@ class WPCF_Relationship_Child_Form
156
  $this->child_post_type, $page, $prev, $next, $per_page,
157
  $total_items );
158
  /*
159
- *
160
- *
161
  * Add pagination bottom
162
  */
163
  $options = array(__( 'All', 'wpcf' ) => 'all', 5 => 5, 10 => 10, 15 => 15);
@@ -189,7 +221,7 @@ class WPCF_Relationship_Child_Form
189
 
190
  /**
191
  * Returns rows.
192
- *
193
  * @return type
194
  */
195
  function rows() {
@@ -203,9 +235,9 @@ class WPCF_Relationship_Child_Form
203
 
204
  /**
205
  * Returns HTML formatted row
206
- *
207
  * While generating rows we collect headers too.
208
- *
209
  * @return type
210
  */
211
  function row() {
@@ -287,10 +319,10 @@ class WPCF_Relationship_Child_Form
287
  }
288
  }
289
  /*
290
- *
291
- *
292
- *
293
- *
294
  * DEFAULT SETTINGS
295
  */
296
  } else {
@@ -345,7 +377,6 @@ class WPCF_Relationship_Child_Form
345
  }
346
  }
347
  }
348
-
349
  return $row;
350
  }
351
 
@@ -370,29 +401,45 @@ class WPCF_Relationship_Child_Form
370
 
371
  /**
372
  * Returns HTML formatted title field.
373
- *
374
  * @param type $post
375
  * @return type
376
  */
377
- function title() {
378
- return wpcf_form_simple(
379
- array('field' => array(
380
- '#type' => 'textfield',
381
- '#id' => 'wpcf_post_relationship_'
382
- . $this->child->ID . '_wp_title',
383
- '#name' => 'wpcf_post_relationship['
384
- . $this->parent->ID . ']['
385
- . $this->child->ID . '][_wp_title]',
386
- '#value' => trim( $this->child->post_title ),
387
- '#inline' => true,
388
- )
389
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
390
  );
 
391
  }
392
 
393
  /**
394
  * Returns HTML formatted body field.
395
- *
396
  * @return type
397
  */
398
  function body() {
@@ -411,10 +458,10 @@ class WPCF_Relationship_Child_Form
411
  )
412
  );
413
  }
414
-
415
  /**
416
  * Returns HTML formatted taxonomy form.
417
- *
418
  * @param type $taxonomy
419
  * @return type
420
  */
@@ -441,7 +488,7 @@ class WPCF_Relationship_Child_Form
441
  );
442
 
443
  return empty( $output ) ? sprintf( __( 'No %s', 'wpcf' ),
444
- $taxonomy->label ) : $output;
445
  }
446
 
447
  $data = array(
@@ -471,9 +518,9 @@ class WPCF_Relationship_Child_Form
471
 
472
  /**
473
  * Returns element form as array.
474
- *
475
  * This is done per field.
476
- *
477
  * @param type $key Field key as stored
478
  * @return array
479
  */
@@ -500,13 +547,13 @@ class WPCF_Relationship_Child_Form
500
  return wptoolset_form_field( 'post', $config, $meta );
501
  }
502
  /*
503
- *
504
  * Get meta form for field
505
  */
506
  $form = $this->cf->_get_meta_form( $this->cf->__meta,
507
  $this->cf->meta_object->meta_id, false );
508
  /*
509
- *
510
  * Filter form
511
  */
512
  $_filtered_form = $this->__filter_meta_form( $form );
@@ -517,17 +564,17 @@ class WPCF_Relationship_Child_Form
517
 
518
  /**
519
  * Filters meta form.
520
- *
521
  * IMPORTANT: This is place where look of child form is altered.
522
  * Try not to spread it over other code.
523
- *
524
  * @param string $form
525
  * @return string
526
  */
527
  function __filter_meta_form( $form = array() ) {
528
  foreach ( $form as $k => &$e ) {
529
  /*
530
- *
531
  * Filter name
532
  */
533
  if ( isset( $e['#name'] ) ) {
@@ -568,7 +615,7 @@ class WPCF_Relationship_Child_Form
568
 
569
  /**
570
  * Content for choose parent column.
571
- *
572
  * @return boolean
573
  */
574
  function _parent_form( $post_parent = '' ) {
@@ -617,7 +664,7 @@ class WPCF_Relationship_Child_Form
617
 
618
  /**
619
  * HTML formatted row.
620
- *
621
  * @return type
622
  */
623
  function child_row( $child ) {
@@ -633,9 +680,9 @@ class WPCF_Relationship_Child_Form
633
 
634
  /**
635
  * Header HTML formatted output.
636
- *
637
  * Each header <th> is array element. Sortable.
638
- *
639
  * @return array 'header_id' => html
640
  */
641
  function headers() {
@@ -660,13 +707,17 @@ class WPCF_Relationship_Child_Form
660
  }
661
 
662
  if ( $header == '_wp_title' ) {
663
- $title_dir = $sort_field == '_wp_title' ? $dir : 'ASC';
664
- $headers[$header] = '';
665
- $headers[$header] .= $sort_field == '_wp_title' ? '<div class="wpcf-pr-sort-' . $dir . '"></div>' : '';
666
- $headers[$header] .= '<a href="' . admin_url( 'admin-ajax.php?action=wpcf_ajax&amp;wpcf_action=pr_sort&amp;field='
667
- . '_wp_title&amp;sort=' . $title_dir . '&amp;post_id=' . $post->ID . '&amp;post_type='
668
- . $post_type . '&amp;_wpnonce='
669
- . wp_create_nonce( 'pr_sort' ) ) . '">' . __( 'Post Title' ) . '</a>';
 
 
 
 
670
  } else if ( $header == '_wp_body' ) {
671
  $body_dir = $sort_field == '_wp_body' ? $dir : $dir_default;
672
  $headers[$header] = '';
@@ -726,4 +777,4 @@ class WPCF_Relationship_Child_Form
726
  return $headers;
727
  }
728
 
729
- }
1
  <?php
2
  /*
3
  * Relationship form class.
4
+ *
5
  * Used to render child forms
6
  */
7
  require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields-post.php';
8
 
9
  /**
10
  * Relationship form class.
11
+ *
12
  * Used on post edit page to show children rows
13
  */
14
  class WPCF_Relationship_Child_Form
16
 
17
  /**
18
  * Current post.
19
+ *
20
  * @var type object
21
  */
22
  var $post;
23
 
24
  /**
25
  * Field object.
26
+ *
27
  * @var type array
28
  */
29
  var $cf = array();
30
 
31
  /**
32
  * Saved data.
33
+ *
34
  * @var type array
35
  */
36
  var $data = array();
37
 
38
  /**
39
  * Child post object.
40
+ *
41
+ * @var type
42
  */
43
  var $child_post_type_object;
44
  var $parent;
52
  'field');
53
  private $__urlParams = array();
54
 
55
+ /**
56
+ * post type configuration
57
+ */
58
+ private $child_supports = array(
59
+ 'title' => false,
60
+ 'editor' => false,
61
+ 'comments' => false,
62
+ 'trackbacks' => false,
63
+ 'revisions' => false,
64
+ 'author' => false,
65
+ 'excerpt' => false,
66
+ 'thumbnail' => false,
67
+ 'custom-fields' => false,
68
+ 'page-attributes' => false,
69
+ 'post-formats' => false,
70
+ );
71
+
72
  /**
73
  * Construct function.
74
  */
84
  }
85
  $this->cf = new WPCF_Field();
86
  $this->cf->context = 'relationship';
87
+ $this->children = WPCF_Relationship_Model::getChildrenByPostType(
88
+ $this->parent,
89
+ $this->child_post_type,
90
+ $this->data,
91
+ $_GET
92
+ );
93
+
94
  // If no children - use dummy post
95
  if ( empty( $this->children ) ) {
96
  $_dummy_post = get_default_post_to_edit( $this->child_post_type,
99
  $this->_dummy_post = true;
100
  }
101
  $this->child_post_type_object = get_post_type_object( $this->child_post_type );
102
+
103
  // Collect params from request
104
  foreach ( $this->__params as $__param ) {
105
  if ( isset( $_GET[$__param] ) ) {
106
  $this->__urlParams[$__param] = $_GET[$__param];
107
  }
108
  }
109
+ $post_types = get_option( 'wpcf-custom-types', array() );
110
+ if (
111
+ array_key_exists($child_post_type, $post_types )
112
+ && array_key_exists('supports', $post_types[$child_post_type] )
113
+ ) {
114
+ foreach( $post_types[$child_post_type]['supports'] as $key => $value ) {
115
+ $this->child_supports[$key] = (boolean)$value;
116
+ }
117
+ }
118
+ unset($post_types);
119
  }
120
+
121
  function getParamsQuery() {
122
  return count( $this->__urlParams ) ? '&amp;' . http_build_query( $this->__urlParams,
123
  '', '&amp;' ) : '';
125
 
126
  /**
127
  * Sets form.
128
+ *
129
  * @param type $o
130
  */
131
  function _set( $child ) {
134
 
135
  /**
136
  * Returns HTML formatted form.
137
+ *
138
  * Renders children per row.
139
+ *
140
  * @todo move all here
141
+ *
142
  * @return type string (HTML formatted)
143
  */
144
  function render() {
188
  $this->child_post_type, $page, $prev, $next, $per_page,
189
  $total_items );
190
  /*
191
+ *
192
+ *
193
  * Add pagination bottom
194
  */
195
  $options = array(__( 'All', 'wpcf' ) => 'all', 5 => 5, 10 => 10, 15 => 15);
221
 
222
  /**
223
  * Returns rows.
224
+ *
225
  * @return type
226
  */
227
  function rows() {
235
 
236
  /**
237
  * Returns HTML formatted row
238
+ *
239
  * While generating rows we collect headers too.
240
+ *
241
  * @return type
242
  */
243
  function row() {
319
  }
320
  }
321
  /*
322
+ *
323
+ *
324
+ *
325
+ *
326
  * DEFAULT SETTINGS
327
  */
328
  } else {
377
  }
378
  }
379
  }
 
380
  return $row;
381
  }
382
 
401
 
402
  /**
403
  * Returns HTML formatted title field.
404
+ *
405
  * @param type $post
406
  * @return type
407
  */
408
+ function title()
409
+ {
410
+ $title = '';
411
+ $type = 'textfield';
412
+ if ( !$this->child_supports['title']) {
413
+ $type = 'hidden';
414
+ $title .= wpcf_form_simple(
415
+ array(
416
+ 'field' => array(
417
+ '#type' => 'markup',
418
+ '#markup' => sprintf('%s id: %d', $this->child_post_type_object->labels->singular_name, $this->child->ID),
419
+ ),
420
+ )
421
+ );
422
+ }
423
+ $title .= wpcf_form_simple(
424
+ array(
425
+ 'field' => array(
426
+ '#type' => $type,
427
+ '#id' => 'wpcf_post_relationship_'
428
+ . $this->child->ID . '_wp_title',
429
+ '#name' => 'wpcf_post_relationship['
430
+ . $this->parent->ID . ']['
431
+ . $this->child->ID . '][_wp_title]',
432
+ '#value' => trim( $this->child->post_title ),
433
+ '#inline' => true,
434
+ ),
435
+ )
436
  );
437
+ return $title;
438
  }
439
 
440
  /**
441
  * Returns HTML formatted body field.
442
+ *
443
  * @return type
444
  */
445
  function body() {
458
  )
459
  );
460
  }
461
+
462
  /**
463
  * Returns HTML formatted taxonomy form.
464
+ *
465
  * @param type $taxonomy
466
  * @return type
467
  */
488
  );
489
 
490
  return empty( $output ) ? sprintf( __( 'No %s', 'wpcf' ),
491
+ $taxonomy->label ) : $output;
492
  }
493
 
494
  $data = array(
518
 
519
  /**
520
  * Returns element form as array.
521
+ *
522
  * This is done per field.
523
+ *
524
  * @param type $key Field key as stored
525
  * @return array
526
  */
547
  return wptoolset_form_field( 'post', $config, $meta );
548
  }
549
  /*
550
+ *
551
  * Get meta form for field
552
  */
553
  $form = $this->cf->_get_meta_form( $this->cf->__meta,
554
  $this->cf->meta_object->meta_id, false );
555
  /*
556
+ *
557
  * Filter form
558
  */
559
  $_filtered_form = $this->__filter_meta_form( $form );
564
 
565
  /**
566
  * Filters meta form.
567
+ *
568
  * IMPORTANT: This is place where look of child form is altered.
569
  * Try not to spread it over other code.
570
+ *
571
  * @param string $form
572
  * @return string
573
  */
574
  function __filter_meta_form( $form = array() ) {
575
  foreach ( $form as $k => &$e ) {
576
  /*
577
+ *
578
  * Filter name
579
  */
580
  if ( isset( $e['#name'] ) ) {
615
 
616
  /**
617
  * Content for choose parent column.
618
+ *
619
  * @return boolean
620
  */
621
  function _parent_form( $post_parent = '' ) {
664
 
665
  /**
666
  * HTML formatted row.
667
+ *
668
  * @return type
669
  */
670
  function child_row( $child ) {
680
 
681
  /**
682
  * Header HTML formatted output.
683
+ *
684
  * Each header <th> is array element. Sortable.
685
+ *
686
  * @return array 'header_id' => html
687
  */
688
  function headers() {
707
  }
708
 
709
  if ( $header == '_wp_title' ) {
710
+ if ( $this->child_supports['title']) {
711
+ $title_dir = $sort_field == '_wp_title' ? $dir : 'ASC';
712
+ $headers[$header] = '';
713
+ $headers[$header] .= $sort_field == '_wp_title' ? '<div class="wpcf-pr-sort-' . $dir . '"></div>' : '';
714
+ $headers[$header] .= '<a href="' . admin_url( 'admin-ajax.php?action=wpcf_ajax&amp;wpcf_action=pr_sort&amp;field='
715
+ . '_wp_title&amp;sort=' . $title_dir . '&amp;post_id=' . $post->ID . '&amp;post_type='
716
+ . $post_type . '&amp;_wpnonce='
717
+ . wp_create_nonce( 'pr_sort' ) ) . '">' . __( 'Post Title' ) . '</a>';
718
+ } else {
719
+ $headers[$header] = 'ID';
720
+ }
721
  } else if ( $header == '_wp_body' ) {
722
  $body_dir = $sort_field == '_wp_body' ? $dir : $dir_default;
723
  $headers[$header] = '';
777
  return $headers;
778
  }
779
 
780
+ }
embedded/classes/usermeta_field.php CHANGED
@@ -179,11 +179,9 @@ class WPCF_Usermeta_Field extends WPCF_Field
179
  * TODO Make this only place where field meta value is filtered
180
  */
181
  $meta = apply_filters( 'wpcf_fields_value_get', $meta, $this );
182
- $meta = apply_filters( 'wpcf_fields_slug_' . $this->cf['slug']
183
- . '_value_get', $meta, $this );
184
- $meta = apply_filters( 'wpcf_fields_type_' . $this->cf['type']
185
- . '_value_get', $meta, $this );
186
  return $meta;
187
  }
188
 
189
- }
179
  * TODO Make this only place where field meta value is filtered
180
  */
181
  $meta = apply_filters( 'wpcf_fields_value_get', $meta, $this );
182
+ $meta = apply_filters( 'wpcf_fields_slug_' . $this->cf['slug'] . '_value_get', $meta, $this );
183
+ $meta = apply_filters( 'wpcf_fields_type_' . $this->cf['type'] . '_value_get', $meta, $this );
 
 
184
  return $meta;
185
  }
186
 
187
+ }
embedded/common/classes/forms.php CHANGED
@@ -2,9 +2,9 @@
2
  /**
3
  * Returns HTML formatted output for elements and handles form submission.
4
  *
5
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/classes/forms.php $
6
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
7
- * $LastChangedRevision: 1012704 $
8
  * $LastChangedBy: iworks $
9
  *
10
  * @version 1.0
@@ -323,7 +323,7 @@ if (!class_exists('Enlimbo_Forms_Wpcf')) {
323
  continue;
324
  }
325
  // Don't set disabled for checkbox
326
- if ($attribute == 'disabled' && $element['#type'] == 'checkbox') {
327
  continue;
328
  }
329
  // Append class values
@@ -583,7 +583,7 @@ if (!class_exists('Enlimbo_Forms_Wpcf')) {
583
  $element['_render']['element'] .= ' onclick="javascript:return false; if(this.checked == 1){this.checked=1; return true;}else{this.checked=0; return false;}"';
584
  }
585
  if (!empty($element['#attributes']['#disabled'])) {
586
- $element['_render']['element'] .= ' disabled="disabled""';
587
  }
588
 
589
  $element['_render']['element'] .= ' />';
2
  /**
3
  * Returns HTML formatted output for elements and handles form submission.
4
  *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/classes/forms.php $
6
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
7
+ * $LastChangedRevision: 1027712 $
8
  * $LastChangedBy: iworks $
9
  *
10
  * @version 1.0
323
  continue;
324
  }
325
  // Don't set disabled for checkbox
326
+ if ( ( 'disabled' == $attribute || '#disabled' == $attribute ) && $element['#type'] == 'checkbox') {
327
  continue;
328
  }
329
  // Append class values
583
  $element['_render']['element'] .= ' onclick="javascript:return false; if(this.checked == 1){this.checked=1; return true;}else{this.checked=0; return false;}"';
584
  }
585
  if (!empty($element['#attributes']['#disabled'])) {
586
+ $element['_render']['element'] .= ' disabled="disabled"';
587
  }
588
 
589
  $element['_render']['element'] .= ' />';
embedded/common/classes/validation-cakephp.php CHANGED
@@ -29,1098 +29,1100 @@
29
  * @since CakePHP v 1.2.0.3830
30
  */
31
  //class Validation extends Object {
32
- if(!class_exists('Wpcf_Cake_Validation')) {
33
- class Wpcf_Cake_Validation
34
- {
35
-
36
- /**
37
- * Set the value of methods $check param.
38
- *
39
- * @var string
40
- * @access public
41
- */
42
- var $check = null;
43
-
44
- /**
45
- * Set to a valid regular expression in the class methods.
46
- * Can be set from $regex param also
47
- *
48
- * @var string
49
- * @access public
50
- */
51
- var $regex = null;
52
-
53
- /**
54
- * Some complex patterns needed in multiple places
55
- *
56
- * @var array
57
- * @access private
58
- */
59
- var $__pattern = array(
60
- 'hostname' => '(?:[a-z0-9][-a-z0-9]*\.)*(?:[a-z0-9][-a-z0-9]{0,62})\.(?:(?:[a-z]{2}\.)?[a-z]{2,4}|museum|travel)'
61
- );
62
-
63
- /**
64
- * Some class methods use a country to determine proper validation.
65
- * This can be passed to methods in the $country param
66
- *
67
- * @var string
68
- * @access public
69
- */
70
- var $country = null;
71
-
72
- /**
73
- * Some class methods use a deeper validation when set to true
74
- *
75
- * @var string
76
- * @access public
77
- */
78
- var $deep = null;
79
-
80
- /**
81
- * Some class methods use the $type param to determine which validation to perfom in the method
82
- *
83
- * @var string
84
- * @access public
85
- */
86
- var $type = null;
87
-
88
- /**
89
- * Holds an array of errors messages set in this class.
90
- * These are used for debugging purposes
91
- *
92
- * @var array
93
- * @access public
94
- */
95
- var $errors = array();
96
-
97
- /**
98
- * Gets a reference to the Validation object instance
99
- *
100
- * @return object Validation instance
101
- * @access public
102
- * @static
103
- */
104
- function &getInstance() {
105
- static $instance = array();
106
-
107
- if (!$instance) {
108
- $instance[0] = new Wpcf_Cake_Validation();
109
- }
110
- return $instance[0];
111
- }
112
-
113
- /**
114
- * Checks that a string contains something other than whitespace
115
- *
116
- * Returns true if string contains something other than whitespace
117
- *
118
- * $check can be passed as an array:
119
- * array('check' => 'valueToCheck');
120
- *
121
- * @param mixed $check Value to check
122
- * @return boolean Success
123
- * @access public
124
- */
125
- function notEmpty($check) {
126
- $_this = & Wpcf_Cake_Validation::getInstance();
127
- $_this->__reset();
128
- $_this->check = $check;
129
-
130
- if (is_array($check)) {
131
- $_this->_extract($check);
132
- }
133
-
134
- if (empty($_this->check) && $_this->check != '0') {
135
- return false;
136
- }
137
- $_this->regex = '/[^\s]+/m';
138
- return $_this->_check();
139
- }
140
-
141
- /**
142
- * Checks that a string contains only integer or letters
143
- *
144
- * Returns true if string contains only integer or letters
145
- *
146
- * $check can be passed as an array:
147
- * array('check' => 'valueToCheck');
148
- *
149
- * @param mixed $check Value to check
150
- * @return boolean Success
151
- * @access public
152
- */
153
- function alphaNumeric($check) {
154
- $_this = & Wpcf_Cake_Validation::getInstance();
155
- $_this->__reset();
156
- $_this->check = $check;
157
-
158
- if (is_array($check)) {
159
- $_this->_extract($check);
160
- }
161
-
162
- if (empty($_this->check) && $_this->check != '0') {
163
- return false;
164
- }
165
- $_this->regex = '/^[a-zA-Z0-9]*$/mu';
166
- $return = $_this->_check();
167
-
168
- if (!$return) {
169
- $_this->regex = '/^[\p{Ll}\p{Lm}\p{Lo}\p{Lt}\p{Lu}\p{Nd}]+$/mu';
170
- $return = $_this->_check();
171
- }
172
-
173
- return $_this->_check();
174
- }
175
-
176
- function alphaNumericWhitespaces($check) {
177
- $_this = & Wpcf_Cake_Validation::getInstance();
178
- $_this->__reset();
179
- $_this->check = $check;
180
-
181
- if (is_array($check)) {
182
- $_this->_extract($check);
183
- }
184
-
185
- if (empty($_this->check) && $_this->check != '0') {
186
- return false;
187
- }
188
- $_this->regex = '/^[a-zA-Z0-9\s\-\_]*$/mu';
189
- $return = $_this->_check();
190
-
191
- if (!$return) {
192
- $_this->regex = '/^[\p{Ll}\p{Lm}\p{Lo}\p{Lt}\p{Lu}\p{Nd}\s\-\_]+$/mu';
193
- $return = $_this->_check();
194
- }
195
-
196
- return $return;
197
- }
198
-
199
- /**
200
- * Checks that a string length is within s specified range.
201
- * Spaces are included in the character count.
202
- * Returns true is string matches value min, max, or between min and max,
203
- *
204
- * @param string $check Value to check for length
205
- * @param integer $min Minimum value in range (inclusive)
206
- * @param integer $max Maximum value in range (inclusive)
207
- * @return boolean Success
208
- * @access public
209
- */
210
- function between($check, $min, $max) {
211
- $length = strlen($check);
212
- return ($length >= $min && $length <= $max);
213
- }
214
-
215
- /**
216
- * Returns true if field is left blank -OR- only whitespace characters are present in it's value
217
- * Whitespace characters include Space, Tab, Carriage Return, Newline
218
- *
219
- * $check can be passed as an array:
220
- * array('check' => 'valueToCheck');
221
- *
222
- * @param mixed $check Value to check
223
- * @return boolean Success
224
- * @access public
225
- */
226
- function blank($check) {
227
- $_this = & Wpcf_Cake_Validation::getInstance();
228
- $_this->__reset();
229
- $_this->check = $check;
230
-
231
- if (is_array($check)) {
232
- $_this->_extract($check);
233
- }
234
-
235
- $_this->regex = '/[^\\s]/';
236
- return!$_this->_check();
237
- }
238
-
239
- /**
240
- * Validation of credit card numbers.
241
- * Returns true if $check is in the proper credit card format.
242
- *
243
- * @param mixed $check credit card number to validate
244
- * @param mixed $type 'all' may be passed as a sting, defaults to fast which checks format of most major credit cards
245
- * if an array is used only the values of the array are checked.
246
- * Example: array('amex', 'bankcard', 'maestro')
247
- * @param boolean $deep set to true this will check the Luhn algorithm of the credit card.
248
- * @param string $regex A custom regex can also be passed, this will be used instead of the defined regex values
249
- * @return boolean Success
250
- * @access public
251
- * @see Wpcf_Cake_Validation::_luhn()
252
- */
253
- function cc($check, $type = 'fast', $deep = false, $regex = null) {
254
- $_this = & Wpcf_Cake_Validation::getInstance();
255
- $_this->__reset();
256
- $_this->check = $check;
257
- $_this->type = $type;
258
- $_this->deep = $deep;
259
- $_this->regex = $regex;
260
-
261
- if (is_array($check)) {
262
- $_this->_extract($check);
263
- }
264
- $_this->check = str_replace(array('-', ' '), '', $_this->check);
265
-
266
- if (strlen($_this->check) < 13) {
267
- return false;
268
- }
269
-
270
- if (!is_null($_this->regex)) {
271
- if ($_this->_check()) {
272
- return $_this->_luhn();
273
- }
274
- }
275
- $cards = array(
276
- 'all' => array(
277
- 'amex' => '/^3[4|7]\\d{13}$/',
278
- 'bankcard' => '/^56(10\\d\\d|022[1-5])\\d{10}$/',
279
- 'diners' => '/^(?:3(0[0-5]|[68]\\d)\\d{11})|(?:5[1-5]\\d{14})$/',
280
- 'disc' => '/^(?:6011|650\\d)\\d{12}$/',
281
- 'electron' => '/^(?:417500|4917\\d{2}|4913\\d{2})\\d{10}$/',
282
- 'enroute' => '/^2(?:014|149)\\d{11}$/',
283
- 'jcb' => '/^(3\\d{4}|2100|1800)\\d{11}$/',
284
- 'maestro' => '/^(?:5020|6\\d{3})\\d{12}$/',
285
- 'mc' => '/^5[1-5]\\d{14}$/',
286
- 'solo' => '/^(6334[5-9][0-9]|6767[0-9]{2})\\d{10}(\\d{2,3})?$/',
287
- 'switch' => '/^(?:49(03(0[2-9]|3[5-9])|11(0[1-2]|7[4-9]|8[1-2])|36[0-9]{2})\\d{10}(\\d{2,3})?)|(?:564182\\d{10}(\\d{2,3})?)|(6(3(33[0-4][0-9])|759[0-9]{2})\\d{10}(\\d{2,3})?)$/',
288
- 'visa' => '/^4\\d{12}(\\d{3})?$/',
289
- 'voyager' => '/^8699[0-9]{11}$/'
290
- ),
291
- 'fast' => '/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})$/'
292
- );
293
-
294
- if (is_array($_this->type)) {
295
- foreach ($_this->type as $value) {
296
- $_this->regex = $cards['all'][strtolower($value)];
297
-
298
- if ($_this->_check()) {
299
- return $_this->_luhn();
300
- }
301
- }
302
- } elseif ($_this->type == 'all') {
303
- foreach ($cards['all'] as $value) {
304
- $_this->regex = $value;
305
-
306
- if ($_this->_check()) {
307
- return $_this->_luhn();
308
- }
309
- }
310
- } else {
311
- $_this->regex = $cards['fast'];
312
-
313
- if ($_this->_check()) {
314
- return $_this->_luhn();
315
- }
316
- }
317
- }
318
-
319
- /**
320
- * Used to compare 2 numeric values.
321
- *
322
- * @param mixed $check1 if string is passed for a string must also be passed for $check2
323
- * used as an array it must be passed as array('check1' => value, 'operator' => 'value', 'check2' -> value)
324
- * @param string $operator Can be either a word or operand
325
- * is greater >, is less <, greater or equal >=
326
- * less or equal <=, is less <, equal to ==, not equal !=
327
- * @param integer $check2 only needed if $check1 is a string
328
- * @return boolean Success
329
- * @access public
330
- */
331
- function comparison($check1, $operator = null, $check2 = null) {
332
- if (is_array($check1)) {
333
- extract($check1, EXTR_OVERWRITE);
334
- }
335
- $operator = str_replace(array(' ', "\t", "\n", "\r", "\0", "\x0B"), '',
336
- strtolower($operator));
337
-
338
- switch ($operator) {
339
- case 'isgreater':
340
- case '>':
341
- if ($check1 > $check2) {
342
- return true;
343
- }
344
- break;
345
- case 'isless':
346
- case '<':
347
- if ($check1 < $check2) {
348
- return true;
349
- }
350
- break;
351
- case 'greaterorequal':
352
- case '>=':
353
- if ($check1 >= $check2) {
354
- return true;
355
- }
356
- break;
357
- case 'lessorequal':
358
- case '<=':
359
- if ($check1 <= $check2) {
360
- return true;
361
- }
362
- break;
363
- case 'equalto':
364
- case '==':
365
- if ($check1 == $check2) {
366
- return true;
367
- }
368
- break;
369
- case 'notequal':
370
- case '!=':
371
- if ($check1 != $check2) {
372
- return true;
373
- }
374
- break;
375
- default:
376
- $_this = & Wpcf_Cake_Validation::getInstance();
377
- $_this->errors[] = __('You must define the $operator parameter for Wpcf_Cake_Validation::comparison()',
378
- 'wpcf');
379
- break;
380
- }
381
- return false;
382
- }
383
-
384
- /**
385
- * Used when a custom regular expression is needed.
386
- *
387
- * @param mixed $check When used as a string, $regex must also be a valid regular expression.
388
- * As and array: array('check' => value, 'regex' => 'valid regular expression')
389
- * @param string $regex If $check is passed as a string, $regex must also be set to valid regular expression
390
- * @return boolean Success
391
- * @access public
392
- */
393
- function custom($check, $regex = null) {
394
- $_this = & Wpcf_Cake_Validation::getInstance();
395
- $_this->__reset();
396
- $_this->check = $check;
397
- $_this->regex = $regex;
398
- if (is_array($check)) {
399
- $_this->_extract($check);
400
- }
401
- if ($_this->regex === null) {
402
- $_this->errors[] = __('You must define a regular expression for Wpcf_Cake_Validation::custom()',
403
- 'wpcf');
404
- return false;
405
- }
406
- return $_this->_check();
407
- }
408
-
409
- /**
410
- * Date validation, determines if the string passed is a valid date.
411
- * keys that expect full month, day and year will validate leap years
412
- *
413
- * @param string $check a valid date string
414
- * @param mixed $format Use a string or an array of the keys below. Arrays should be passed as array('dmy', 'mdy', etc)
415
- * Keys: dmy 27-12-2006 or 27-12-06 separators can be a space, period, dash, forward slash
416
- * mdy 12-27-2006 or 12-27-06 separators can be a space, period, dash, forward slash
417
- * ymd 2006-12-27 or 06-12-27 separators can be a space, period, dash, forward slash
418
- * dMy 27 December 2006 or 27 Dec 2006
419
- * Mdy December 27, 2006 or Dec 27, 2006 comma is optional
420
- * My December 2006 or Dec 2006
421
- * my 12/2006 separators can be a space, period, dash, forward slash
422
- * @param string $regex If a custom regular expression is used this is the only validation that will occur.
423
- * @return boolean Success
424
- * @access public
425
- */
426
- function date($check, $format = 'ymd', $regex = null) {
427
-
428
- $date_format = wpcf_get_date_format();
429
  $cake_date_formats = array(
430
  'F j, Y' => 'Mdy',
431
- 'Y/m/d' => 'ymd',
432
- 'm/d/Y' => 'mdy',
433
- 'd/m/Y' => 'dmy',
434
- 'd/m/y' => 'dmy',
435
  );
436
 
437
  $format = $cake_date_formats[$date_format];
438
-
439
- $_this = & Wpcf_Cake_Validation::getInstance();
440
- $_this->__reset();
441
- $_this->check = $check;
442
- $_this->regex = $regex;
443
-
444
- if (!is_null($_this->regex)) {
445
- return $_this->_check();
446
- }
447
-
448
- $regex['dmy'] = '%^(?:(?:31(\\/|-|\\.|\\x20)(?:0?[13578]|1[02]))\\1|(?:(?:29|30)(\\/|-|\\.|\\x20)(?:0?[1,3-9]|1[0-2])\\2))(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$|^(?:29(\\/|-|\\.|\\x20)0?2\\3(?:(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\\d|2[0-8])(\\/|-|\\.|\\x20)(?:(?:0?[1-9])|(?:1[0-2]))\\4(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$%';
449
- $regex['mdy'] = '%^(?:(?:(?:0?[13578]|1[02])(\\/|-|\\.|\\x20)31)\\1|(?:(?:0?[13-9]|1[0-2])(\\/|-|\\.|\\x20)(?:29|30)\\2))(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$|^(?:0?2(\\/|-|\\.|\\x20)29\\3(?:(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:(?:0?[1-9])|(?:1[0-2]))(\\/|-|\\.|\\x20)(?:0?[1-9]|1\\d|2[0-8])\\4(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$%';
450
- $regex['ymd'] = '%^(?:(?:(?:(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(\\/|-|\\.|\\x20)(?:0?2\\1(?:29)))|(?:(?:(?:1[6-9]|[2-9]\\d)?\\d{2})(\\/|-|\\.|\\x20)(?:(?:(?:0?[13578]|1[02])\\2(?:31))|(?:(?:0?[1,3-9]|1[0-2])\\2(29|30))|(?:(?:0?[1-9])|(?:1[0-2]))\\2(?:0?[1-9]|1\\d|2[0-8]))))$%';
451
- $regex['dMy'] = '/^((31(?!\\ (Feb(ruary)?|Apr(il)?|June?|(Sep(?=\\b|t)t?|Nov)(ember)?)))|((30|29)(?!\\ Feb(ruary)?))|(29(?=\\ Feb(ruary)?\\ (((1[6-9]|[2-9]\\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))|(0?[1-9])|1\\d|2[0-8])\\ (Jan(uary)?|Feb(ruary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sep(?=\\b|t)t?|Nov|Dec)(ember)?)\\ ((1[6-9]|[2-9]\\d)\\d{2})$/';
452
- $regex['Mdy'] = '/^(?:(((Jan(uary)?|Ma(r(ch)?|y)|Jul(y)?|Aug(ust)?|Oct(ober)?|Dec(ember)?)\\ 31)|((Jan(uary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sept|Nov|Dec)(ember)?)\\ (0?[1-9]|([12]\\d)|30))|(Feb(ruary)?\\ (0?[1-9]|1\\d|2[0-8]|(29(?=,?\\ ((1[6-9]|[2-9]\\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))))\\,?\\ ((1[6-9]|[2-9]\\d)\\d{2}))$/';
453
- $regex['My'] = '%^(Jan(uary)?|Feb(ruary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sep(?=\\b|t)t?|Nov|Dec)(ember)?)[ /]((1[6-9]|[2-9]\\d)\\d{2})$%';
454
- $regex['my'] = '%^(((0[123456789]|10|11|12)([- /.])(([1][9][0-9][0-9])|([2][0-9][0-9][0-9]))))$%';
455
-
456
- $format = (is_array($format)) ? array_values($format) : array($format);
457
- foreach ($format as $key) {
458
- $_this->regex = $regex[$key];
459
-
460
- if ($_this->_check() === true) {
461
- return true;
462
- }
463
- }
464
- return false;
465
- }
466
-
467
- /**
468
- * Time validation, determines if the string passed is a valid time.
469
- * Validates time as 24hr (HH:MM) or am/pm ([H]H:MM[a|p]m)
470
- * Does not allow/validate seconds.
471
- *
472
- * @param string $check a valid time string
473
- * @return boolean Success
474
- * @access public
475
- */
476
- function time($check) {
477
- $_this = & Wpcf_Cake_Validation::getInstance();
478
- $_this->__reset();
479
- $_this->check = $check;
480
- $_this->regex = '%^((0?[1-9]|1[012])(:[0-5]\d){0,2}([AP]M|[ap]m))$|^([01]\d|2[0-3])(:[0-5]\d){0,2}$%';
481
- return $_this->_check();
482
- }
483
-
484
- /**
485
- * Boolean validation, determines if value passed is a boolean integer or true/false.
486
- *
487
- * @param string $check a valid boolean
488
- * @return boolean Success
489
- * @access public
490
- */
491
- function boolean($check) {
492
- $booleanList = array(0, 1, '0', '1', true, false);
493
- return in_array($check, $booleanList, true);
494
- }
495
-
496
- /**
497
- * Checks that a value is a valid decimal. If $places is null, the $check is allowed to be a scientific float
498
- * If no decimal point is found a false will be returned. Both the sign and exponent are optional.
499
- *
500
- * @param integer $check The value the test for decimal
501
- * @param integer $places if set $check value must have exactly $places after the decimal point
502
- * @param string $regex If a custom regular expression is used this is the only validation that will occur.
503
- * @return boolean Success
504
- * @access public
505
- */
506
- function decimal($check, $places = null, $regex = null) {
507
- $_this = & Wpcf_Cake_Validation::getInstance();
508
- $_this->__reset();
509
- $_this->regex = $regex;
510
- $_this->check = $check;
511
-
512
- if (is_null($_this->regex)) {
513
- if (is_null($places)) {
514
- $_this->regex = '/^[-+]?[0-9]*\\.{1}[0-9]+(?:[eE][-+]?[0-9]+)?$/';
515
- } else {
516
- $_this->regex = '/^[-+]?[0-9]*\\.{1}[0-9]{' . $places . '}$/';
517
- }
518
- }
519
- return $_this->_check();
520
- }
521
-
522
- /**
523
- * Validates for an email address.
524
- *
525
- * @param string $check Value to check
526
- * @param boolean $deep Perform a deeper validation (if true), by also checking availability of host
527
- * @param string $regex Regex to use (if none it will use built in regex)
528
- * @return boolean Success
529
- * @access public
530
- */
531
- function email($check, $deep = false, $regex = null) {
532
- $_this = & Wpcf_Cake_Validation::getInstance();
533
- $_this->__reset();
534
- $_this->check = $check;
535
- $_this->regex = $regex;
536
- $_this->deep = $deep;
537
-
538
- if (is_array($check)) {
539
- $_this->_extract($check);
540
- }
541
-
542
- if (is_null($_this->regex)) {
543
- $_this->regex = '/^[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+)*@' . $_this->__pattern['hostname'] . '$/i';
544
- }
545
- $return = $_this->_check();
546
-
547
- if ($_this->deep === false || $_this->deep === null) {
548
- return $return;
549
- }
550
-
551
- if ($return === true && preg_match('/@(' . $_this->__pattern['hostname'] . ')$/i',
552
- $_this->check, $regs)) {
553
- if (function_exists('getmxrr') && getmxrr($regs[1], $mxhosts)) {
554
- return true;
555
- }
556
- if (function_exists('checkdnsrr') && checkdnsrr($regs[1], 'MX')) {
557
- return true;
558
- }
559
- return is_array(gethostbynamel($regs[1]));
560
- }
561
- return false;
562
- }
563
-
564
- /**
565
- * Check that value is exactly $comparedTo.
566
- *
567
- * @param mixed $check Value to check
568
- * @param mixed $comparedTo Value to compare
569
- * @return boolean Success
570
- * @access public
571
- */
572
- function equalTo($check, $comparedTo) {
573
- return ($check === $comparedTo);
574
- }
575
-
576
- /**
577
- * Check that value has a valid file extension.
578
- *
579
- * @param mixed $check Value to check
580
- * @param array $extensions file extenstions to allow
581
- * @return boolean Success
582
- * @access public
583
- */
584
- function extension($check, $extensions = array('gif', 'jpeg', 'png', 'jpg')) {
585
- if (is_array($check)) {
586
- return Wpcf_Cake_Validation::extension(array_shift($check),
587
- $extensions);
588
- }
589
- $extension = strtolower(array_pop(explode('.', $check)));
590
- foreach ($extensions as $value) {
591
- if ($extension == strtolower($value)) {
592
- return true;
593
- }
594
- }
595
- return false;
596
- }
597
-
598
- /**
599
- * Validation of an IP address.
600
- *
601
- * Valid IP version strings for type restriction are:
602
- * - both: Check both IPv4 and IPv6, return true if the supplied address matches either version
603
- * - IPv4: Version 4 (Eg: 127.0.0.1, 192.168.10.123, 203.211.24.8)
604
- * - IPv6: Version 6 (Eg: ::1, 2001:0db8::1428:57ab)
605
- *
606
- * @param string $check The string to test.
607
- * @param string $type The IP Version to test against
608
- * @return boolean Success
609
- * @access public
610
- */
611
- function ip($check, $type = 'both') {
612
- $_this = & Wpcf_Cake_Validation::getInstance();
613
- $success = false;
614
- $type = strtolower($type);
615
- if ($type === 'ipv4' || $type === 'both') {
616
- $success |= $_this->_ipv4($check);
617
- }
618
- if ($type === 'ipv6' || $type === 'both') {
619
- $success |= $_this->_ipv6($check);
620
- }
621
- return $success;
622
- }
623
-
624
- /**
625
- * Validation of IPv4 addresses.
626
- *
627
- * @param string $check IP Address to test
628
- * @return boolean Success
629
- * @access protected
630
- */
631
- function _ipv4($check) {
632
- if (function_exists('filter_var')) {
633
- return filter_var($check, FILTER_VALIDATE_IP,
634
- array('flags' => FILTER_FLAG_IPV4)) !== false;
635
- }
636
- $this->__populateIp();
637
- $this->check = $check;
638
- $this->regex = '/^' . $this->__pattern['IPv4'] . '$/';
639
- return $this->_check();
640
- }
641
-
642
- /**
643
- * Validation of IPv6 addresses.
644
- *
645
- * @param string $check IP Address to test
646
- * @return boolean Success
647
- * @access protected
648
- */
649
- function _ipv6($check) {
650
- if (function_exists('filter_var')) {
651
- return filter_var($check, FILTER_VALIDATE_IP,
652
- array('flags' => FILTER_FLAG_IPV6)) !== false;
653
- }
654
- $this->__populateIp();
655
- $this->check = $check;
656
- $this->regex = '/^' . $this->__pattern['IPv6'] . '$/';
657
- return $this->_check();
658
- }
659
-
660
- /**
661
- * Checks whether the length of a string is greater or equal to a minimal length.
662
- *
663
- * @param string $check The string to test
664
- * @param integer $min The minimal string length
665
- * @return boolean Success
666
- * @access public
667
- */
668
- function minLength($check, $min) {
669
- $length = strlen($check);
670
- return ($length >= $min);
671
- }
672
-
673
- /**
674
- * Checks whether the length of a string is smaller or equal to a maximal length..
675
- *
676
- * @param string $check The string to test
677
- * @param integer $max The maximal string length
678
- * @return boolean Success
679
- * @access public
680
- */
681
- function maxLength($check, $max) {
682
- $length = strlen($check);
683
- return ($length <= $max);
684
- }
685
-
686
- /**
687
- * Checks that a value is a monetary amount.
688
- *
689
- * @param string $check Value to check
690
- * @param string $symbolPosition Where symbol is located (left/right)
691
- * @return boolean Success
692
- * @access public
693
- */
694
- function money($check, $symbolPosition = 'left') {
695
- $_this = & Wpcf_Cake_Validation::getInstance();
696
- $_this->check = $check;
697
-
698
- if ($symbolPosition == 'right') {
699
- $_this->regex = '/^(?!0,?\d)(?:\d{1,3}(?:([, .])\d{3})?(?:\1\d{3})*|(?:\d+))((?!\1)[,.]\d{2})?(?<!\x{00a2})\p{Sc}?$/u';
700
- } else {
701
- $_this->regex = '/^(?!\x{00a2})\p{Sc}?(?!0,?\d)(?:\d{1,3}(?:([, .])\d{3})?(?:\1\d{3})*|(?:\d+))((?!\1)[,.]\d{2})?$/u';
702
- }
703
- return $_this->_check();
704
- }
705
-
706
- /**
707
- * Validate a multiple select.
708
- *
709
- * Valid Options
710
- *
711
- * - in => provide a list of choices that selections must be made from
712
- * - max => maximun number of non-zero choices that can be made
713
- * - min => minimum number of non-zero choices that can be made
714
- *
715
- * @param mixed $check Value to check
716
- * @param mixed $options Options for the check.
717
- * @return boolean Success
718
- * @access public
719
- */
720
- function multiple($check, $options = array()) {
721
- $defaults = array('in' => null, 'max' => null, 'min' => null);
722
- $options = array_merge($defaults, $options);
723
- $check = array_filter((array) $check);
724
- if (empty($check)) {
725
- return false;
726
- }
727
- if ($options['max'] && count($check) > $options['max']) {
728
- return false;
729
- }
730
- if ($options['min'] && count($check) < $options['min']) {
731
- return false;
732
- }
733
- if ($options['in'] && is_array($options['in'])) {
734
- foreach ($check as $val) {
735
- if (!in_array($val, $options['in'])) {
736
- return false;
737
- }
738
- }
739
- }
740
- return true;
741
- }
742
-
743
- /**
744
- * Checks if a value is numeric.
745
- *
746
- * @param string $check Value to check
747
- * @return boolean Succcess
748
- * @access public
749
- */
750
- function numeric($check) {
751
- return is_numeric($check);
752
- }
753
-
754
- /**
755
- * Check that a value is a valid phone number.
756
- *
757
- * @param mixed $check Value to check (string or array)
758
- * @param string $regex Regular expression to use
759
- * @param string $country Country code (defaults to 'all')
760
- * @return boolean Success
761
- * @access public
762
- */
763
- function phone($check, $regex = null, $country = 'all') {
764
- $_this = & Wpcf_Cake_Validation::getInstance();
765
- $_this->check = $check;
766
- $_this->regex = $regex;
767
- $_this->country = $country;
768
- if (is_array($check)) {
769
- $_this->_extract($check);
770
- }
771
-
772
- if (is_null($_this->regex)) {
773
- switch ($_this->country) {
774
- case 'us':
775
- case 'all':
776
- case 'can':
777
- // includes all NANPA members. see http://en.wikipedia.org/wiki/North_American_Numbering_Plan#List_of_NANPA_countries_and_territories
778
- $_this->regex = '/^(?:\+?1)?[-. ]?\\(?[2-9][0-8][0-9]\\)?[-. ]?[2-9][0-9]{2}[-. ]?[0-9]{4}$/';
779
- break;
780
- }
781
- }
782
- if (empty($_this->regex)) {
783
- return $_this->_pass('phone', $check, $country);
784
- }
785
- return $_this->_check();
786
- }
787
-
788
- /**
789
- * Checks that a given value is a valid postal code.
790
- *
791
- * @param mixed $check Value to check
792
- * @param string $regex Regular expression to use
793
- * @param string $country Country to use for formatting
794
- * @return boolean Success
795
- * @access public
796
- */
797
- function postal($check, $regex = null, $country = null) {
798
- $_this = & Wpcf_Cake_Validation::getInstance();
799
- $_this->check = $check;
800
- $_this->regex = $regex;
801
- $_this->country = $country;
802
- if (is_array($check)) {
803
- $_this->_extract($check);
804
- }
805
- if (empty($country)) {
806
- $_this->country = 'us';
807
- }
808
-
809
- if (is_null($_this->regex)) {
810
- switch ($_this->country) {
811
- case 'uk':
812
- $_this->regex = '/\\A\\b[A-Z]{1,2}[0-9][A-Z0-9]? [0-9][ABD-HJLNP-UW-Z]{2}\\b\\z/i';
813
- break;
814
- case 'ca':
815
- $_this->regex = '/\\A\\b[ABCEGHJKLMNPRSTVXY][0-9][A-Z] ?[0-9][A-Z][0-9]\\b\\z/i';
816
- break;
817
- case 'it':
818
- case 'de':
819
- $_this->regex = '/^[0-9]{5}$/i';
820
- break;
821
- case 'be':
822
- $_this->regex = '/^[1-9]{1}[0-9]{3}$/i';
823
- break;
824
- case 'us':
825
- $_this->regex = '/\\A\\b[0-9]{5}(?:-[0-9]{4})?\\b\\z/i';
826
- break;
827
- }
828
- }
829
- if (empty($_this->regex)) {
830
- return $_this->_pass('postal', $check, $country);
831
- }
832
- return $_this->_check();
833
- }
834
-
835
- /**
836
- * Validate that a number is in specified range.
837
- * if $lower and $upper are not set, will return true if
838
- * $check is a legal finite on this platform
839
- *
840
- * @param string $check Value to check
841
- * @param integer $lower Lower limit
842
- * @param integer $upper Upper limit
843
- * @return boolean Success
844
- * @access public
845
- */
846
- function range($check, $lower = null, $upper = null) {
847
- if (!is_numeric($check)) {
848
- return false;
849
- }
850
- if (isset($lower) && isset($upper)) {
851
- return ($check > $lower && $check < $upper);
852
- }
853
- return is_finite($check);
854
- }
855
-
856
- /**
857
- * Checks that a value is a valid Social Security Number.
858
- *
859
- * @param mixed $check Value to check
860
- * @param string $regex Regular expression to use
861
- * @param string $country Country
862
- * @return boolean Success
863
- * @access public
864
- */
865
- function ssn($check, $regex = null, $country = null) {
866
- $_this = & Wpcf_Cake_Validation::getInstance();
867
- $_this->check = $check;
868
- $_this->regex = $regex;
869
- $_this->country = $country;
870
- if (is_array($check)) {
871
- $_this->_extract($check);
872
- }
873
-
874
- if (is_null($_this->regex)) {
875
- switch ($_this->country) {
876
- case 'dk':
877
- $_this->regex = '/\\A\\b[0-9]{6}-[0-9]{4}\\b\\z/i';
878
- break;
879
- case 'nl':
880
- $_this->regex = '/\\A\\b[0-9]{9}\\b\\z/i';
881
- break;
882
- case 'us':
883
- $_this->regex = '/\\A\\b[0-9]{3}-[0-9]{2}-[0-9]{4}\\b\\z/i';
884
- break;
885
- }
886
- }
887
- if (empty($_this->regex)) {
888
- return $_this->_pass('ssn', $check, $country);
889
- }
890
- return $_this->_check();
891
- }
892
-
893
- /**
894
- * Checks that a value is a valid uuid - http://tools.ietf.org/html/rfc4122
895
- *
896
- * @param string $check Value to check
897
- * @return boolean Success
898
- * @access public
899
- */
900
- function uuid($check) {
901
- $_this = & Wpcf_Cake_Validation::getInstance();
902
- $_this->check = $check;
903
- $_this->regex = '/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i';
904
- return $_this->_check();
905
- }
906
-
907
- /**
908
- * Checks that a value is a valid URL according to http://www.w3.org/Addressing/URL/url-spec.txt
909
- *
910
- * The regex checks for the following component parts:
911
- *
912
- * - a valid, optional, scheme
913
- * - a valid ip address OR
914
- * a valid domain name as defined by section 2.3.1 of http://www.ietf.org/rfc/rfc1035.txt
915
- * with an optional port number
916
- * - an optional valid path
917
- * - an optional query string (get parameters)
918
- * - an optional fragment (anchor tag)
919
- *
920
- * @param string $check Value to check
921
- * @param boolean $strict Require URL to be prefixed by a valid scheme (one of http(s)/ftp(s)/file/news/gopher)
922
- * @return boolean Success
923
- * @access public
924
- */
925
- function url($check, $strict = false) {
926
- $_this = & Wpcf_Cake_Validation::getInstance();
927
- $_this->__populateIp();
928
- $_this->check = $check;
929
- $validChars = '([' . preg_quote('!"$&\'()*+,-.@_:;=~[]') . '\/0-9a-z\p{L}\p{N}]|(%[0-9a-f]{2}))';
930
- $_this->regex = '/^(?:(?:https?|ftps?|file|news|gopher):\/\/)' . (!empty($strict) ? '' : '?') .
931
- '(?:' . $_this->__pattern['IPv4'] . '|\[' . $_this->__pattern['IPv6'] . '\]|' . $_this->__pattern['hostname'] . ')' .
932
- '(?::[1-9][0-9]{0,4})?' .
933
- '(?:\/?|\/' . $validChars . '*)?' .
934
- '(?:\?' . $validChars . '*)?' .
935
- '(?:#' . $validChars . '*)?$/iu';
936
- return $_this->_check();
937
- }
938
-
939
- /**
940
- * Checks if a value is in a given list.
941
- *
942
- * @param string $check Value to check
943
- * @param array $list List to check against
944
- * @return boolean Succcess
945
- * @access public
946
- */
947
- function inList($check, $list) {
948
- return in_array($check, $list);
949
- }
950
-
951
- /**
952
- * Runs an user-defined validation.
953
- *
954
- * @param mixed $check value that will be validated in user-defined methods.
955
- * @param object $object class that holds validation method
956
- * @param string $method class method name for validation to run
957
- * @param array $args arguments to send to method
958
- * @return mixed user-defined class class method returns
959
- * @access public
960
- */
961
- function userDefined($check, $object, $method, $args = null) {
962
- return call_user_func_array(array(&$object, $method),
963
- array($check, $args));
964
- }
965
-
966
- function noSpecialChars($check) {
967
- return preg_match('#[^a-zA-Z0-9\s\_\-]#', $check) ? false : true;
968
- }
969
-
970
- function rewriteSlug($check) {
971
- return preg_match('#[^a-zA-Z0-9\s\_\-\%]#', $check) ? false : true;
972
- }
973
-
974
- /**
975
- * Attempts to pass unhandled Validation locales to a class starting with $classPrefix
976
- * and ending with Validation. For example $classPrefix = 'nl', the class would be
977
- * `NlValidation`.
978
- *
979
- * @param string $method The method to call on the other class.
980
- * @param mixed $check The value to check or an array of parameters for the method to be called.
981
- * @param string $classPrefix The prefix for the class to do the validation.
982
- * @return mixed Return of Passed method, false on failure
983
- * @access protected
984
- * */
985
- function _pass($method, $check, $classPrefix) {
986
- $className = ucwords($classPrefix) . 'Validation';
987
- if (!class_exists($className)) {
988
- trigger_error(sprintf(__('Could not find %s class, unable to complete validation.',
989
- true), $className), E_USER_WARNING);
990
- return false;
991
- }
992
- if (!is_callable(array($className, $method))) {
993
- trigger_error(sprintf(__('Method %s does not exist on %s unable to complete validation.',
994
- true), $method, $className), E_USER_WARNING);
995
- return false;
996
- }
997
- $check = (array) $check;
998
- return call_user_func_array(array($className, $method), $check);
999
- }
1000
-
1001
- /**
1002
- * Runs a regular expression match.
1003
- *
1004
- * @return boolean Success of match
1005
- * @access protected
1006
- */
1007
- function _check() {
1008
- $_this = & Wpcf_Cake_Validation::getInstance();
1009
- if (preg_match($_this->regex, $_this->check)) {
1010
- $_this->error[] = false;
1011
- return true;
1012
- } else {
1013
- $_this->error[] = true;
1014
- return false;
1015
- }
1016
- }
1017
-
1018
- /**
1019
- * Get the values to use when value sent to validation method is
1020
- * an array.
1021
- *
1022
- * @param array $params Parameters sent to validation method
1023
- * @return void
1024
- * @access protected
1025
- */
1026
- function _extract($params) {
1027
- $_this = & Wpcf_Cake_Validation::getInstance();
1028
- extract($params, EXTR_OVERWRITE);
1029
-
1030
- if (isset($check)) {
1031
- $_this->check = $check;
1032
- }
1033
- if (isset($regex)) {
1034
- $_this->regex = $regex;
1035
- }
1036
- if (isset($country)) {
1037
- $_this->country = strtolower($country);
1038
- }
1039
- if (isset($deep)) {
1040
- $_this->deep = $deep;
1041
- }
1042
- if (isset($type)) {
1043
- $_this->type = $type;
1044
- }
1045
- }
1046
-
1047
- /**
1048
- * Luhn algorithm
1049
- *
1050
- * @see http://en.wikipedia.org/wiki/Luhn_algorithm
1051
- * @return boolean Success
1052
- * @access protected
1053
- */
1054
- function _luhn() {
1055
- $_this = & Wpcf_Cake_Validation::getInstance();
1056
- if ($_this->deep !== true) {
1057
- return true;
1058
- }
1059
- if ($_this->check == 0) {
1060
- return false;
1061
- }
1062
- $sum = 0;
1063
- $length = strlen($_this->check);
1064
-
1065
- for ($position = 1 - ($length % 2); $position < $length; $position += 2) {
1066
- $sum += $_this->check[$position];
1067
- }
1068
-
1069
- for ($position = ($length % 2); $position < $length; $position += 2) {
1070
- $number = $_this->check[$position] * 2;
1071
- $sum += ($number < 10) ? $number : $number - 9;
1072
- }
1073
-
1074
- return ($sum % 10 == 0);
1075
- }
1076
-
1077
- /*
1078
- * Lazily popualate the IP address patterns used for validations
1079
- *
1080
- * @return void
1081
- * @access private
1082
- */
1083
-
1084
- function __populateIp() {
1085
- if (!isset($this->__pattern['IPv6'])) {
1086
- $pattern = '((([0-9A-Fa-f]{1,4}:){7}(([0-9A-Fa-f]{1,4})|:))|(([0-9A-Fa-f]{1,4}:){6}';
1087
- $pattern .= '(:|((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})';
1088
- $pattern .= '|(:[0-9A-Fa-f]{1,4})))|(([0-9A-Fa-f]{1,4}:){5}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})';
1089
- $pattern .= '(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:)';
1090
- $pattern .= '{4}(:[0-9A-Fa-f]{1,4}){0,1}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2}))';
1091
- $pattern .= '{3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){3}(:[0-9A-Fa-f]{1,4}){0,2}';
1092
- $pattern .= '((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|';
1093
- $pattern .= '((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){2}(:[0-9A-Fa-f]{1,4}){0,3}';
1094
- $pattern .= '((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2}))';
1095
- $pattern .= '{3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:)(:[0-9A-Fa-f]{1,4})';
1096
- $pattern .= '{0,4}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)';
1097
- $pattern .= '|((:[0-9A-Fa-f]{1,4}){1,2})))|(:(:[0-9A-Fa-f]{1,4}){0,5}((:((25[0-5]|2[0-4]';
1098
- $pattern .= '\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4})';
1099
- $pattern .= '{1,2})))|(((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})))(%.+)?';
1100
-
1101
- $this->__pattern['IPv6'] = $pattern;
1102
- }
1103
- if (!isset($this->__pattern['IPv4'])) {
1104
- $pattern = '(?:(?:25[0-5]|2[0-4][0-9]|(?:(?:1[0-9])?|[1-9]?)[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|(?:(?:1[0-9])?|[1-9]?)[0-9])';
1105
- $this->__pattern['IPv4'] = $pattern;
1106
- }
1107
- }
1108
-
1109
- /**
1110
- * Reset internal variables for another validation run.
1111
- *
1112
- * @return void
1113
- * @access private
1114
- */
1115
- function __reset() {
1116
- $this->check = null;
1117
- $this->regex = null;
1118
- $this->country = null;
1119
- $this->deep = null;
1120
- $this->type = null;
1121
- $this->error = array();
1122
- $this->errors = array();
1123
- }
1124
-
1125
- }
 
 
 
 
 
1126
  }
29
  * @since CakePHP v 1.2.0.3830
30
  */
31
  //class Validation extends Object {
32
+ if (!class_exists('Wpcf_Cake_Validation')) {
33
+
34
+ class Wpcf_Cake_Validation {
35
+
36
+ /**
37
+ * Set the value of methods $check param.
38
+ *
39
+ * @var string
40
+ * @access public
41
+ */
42
+ var $check = null;
43
+
44
+ /**
45
+ * Set to a valid regular expression in the class methods.
46
+ * Can be set from $regex param also
47
+ *
48
+ * @var string
49
+ * @access public
50
+ */
51
+ var $regex = null;
52
+
53
+ /**
54
+ * Some complex patterns needed in multiple places
55
+ *
56
+ * @var array
57
+ * @access private
58
+ */
59
+ var $__pattern = array(
60
+ 'hostname' => '(?:[a-z0-9][-a-z0-9]*\.)*(?:[a-z0-9][-a-z0-9]{0,62})\.(?:(?:[a-z]{2}\.)?[a-z]{2,4}|museum|travel)'
61
+ );
62
+
63
+ /**
64
+ * Some class methods use a country to determine proper validation.
65
+ * This can be passed to methods in the $country param
66
+ *
67
+ * @var string
68
+ * @access public
69
+ */
70
+ var $country = null;
71
+
72
+ /**
73
+ * Some class methods use a deeper validation when set to true
74
+ *
75
+ * @var string
76
+ * @access public
77
+ */
78
+ var $deep = null;
79
+
80
+ /**
81
+ * Some class methods use the $type param to determine which validation to perfom in the method
82
+ *
83
+ * @var string
84
+ * @access public
85
+ */
86
+ var $type = null;
87
+
88
+ /**
89
+ * Holds an array of errors messages set in this class.
90
+ * These are used for debugging purposes
91
+ *
92
+ * @var array
93
+ * @access public
94
+ */
95
+ var $errors = array();
96
+
97
+ /**
98
+ * Gets a reference to the Validation object instance
99
+ *
100
+ * @return object Validation instance
101
+ * @access public
102
+ * @static
103
+ */
104
+ function &getInstance() {
105
+ static $instance = array();
106
+
107
+ if (!$instance) {
108
+ $instance[0] = new Wpcf_Cake_Validation();
109
+ }
110
+ return $instance[0];
111
+ }
112
+
113
+ /**
114
+ * Checks that a string contains something other than whitespace
115
+ *
116
+ * Returns true if string contains something other than whitespace
117
+ *
118
+ * $check can be passed as an array:
119
+ * array('check' => 'valueToCheck');
120
+ *
121
+ * @param mixed $check Value to check
122
+ * @return boolean Success
123
+ * @access public
124
+ */
125
+ function notEmpty($check) {
126
+ $_this = & Wpcf_Cake_Validation::getInstance();
127
+ $_this->__reset();
128
+ $_this->check = $check;
129
+
130
+ if (is_array($check)) {
131
+ $_this->_extract($check);
132
+ }
133
+
134
+ if (empty($_this->check) && $_this->check != '0') {
135
+ return false;
136
+ }
137
+ $_this->regex = '/[^\s]+/m';
138
+ return $_this->_check();
139
+ }
140
+
141
+ /**
142
+ * Checks that a string contains only integer or letters
143
+ *
144
+ * Returns true if string contains only integer or letters
145
+ *
146
+ * $check can be passed as an array:
147
+ * array('check' => 'valueToCheck');
148
+ *
149
+ * @param mixed $check Value to check
150
+ * @return boolean Success
151
+ * @access public
152
+ */
153
+ function alphaNumeric($check) {
154
+ $_this = & Wpcf_Cake_Validation::getInstance();
155
+ $_this->__reset();
156
+ $_this->check = $check;
157
+
158
+ if (is_array($check)) {
159
+ $_this->_extract($check);
160
+ }
161
+
162
+ if (empty($_this->check) && $_this->check != '0') {
163
+ return false;
164
+ }
165
+ $_this->regex = '/^[a-zA-Z0-9]*$/mu';
166
+ $return = $_this->_check();
167
+
168
+ if (!$return) {
169
+ $_this->regex = '/^[\p{Ll}\p{Lm}\p{Lo}\p{Lt}\p{Lu}\p{Nd}]+$/mu';
170
+ $return = $_this->_check();
171
+ }
172
+
173
+ return $_this->_check();
174
+ }
175
+
176
+ function alphaNumericWhitespaces($check) {
177
+ $_this = & Wpcf_Cake_Validation::getInstance();
178
+ $_this->__reset();
179
+ $_this->check = $check;
180
+
181
+ if (is_array($check)) {
182
+ $_this->_extract($check);
183
+ }
184
+
185
+ if (empty($_this->check) && $_this->check != '0') {
186
+ return false;
187
+ }
188
+ $_this->regex = '/^[a-zA-Z0-9\s\-\_]*$/mu';
189
+ $return = $_this->_check();
190
+
191
+ if (!$return) {
192
+ $_this->regex = '/^[\p{Ll}\p{Lm}\p{Lo}\p{Lt}\p{Lu}\p{Nd}\s\-\_]+$/mu';
193
+ $return = $_this->_check();
194
+ }
195
+
196
+ return $return;
197
+ }
198
+
199
+ /**
200
+ * Checks that a string length is within s specified range.
201
+ * Spaces are included in the character count.
202
+ * Returns true is string matches value min, max, or between min and max,
203
+ *
204
+ * @param string $check Value to check for length
205
+ * @param integer $min Minimum value in range (inclusive)
206
+ * @param integer $max Maximum value in range (inclusive)
207
+ * @return boolean Success
208
+ * @access public
209
+ */
210
+ function between($check, $min, $max) {
211
+ $length = strlen($check);
212
+ return ($length >= $min && $length <= $max);
213
+ }
214
+
215
+ /**
216
+ * Returns true if field is left blank -OR- only whitespace characters are present in it's value
217
+ * Whitespace characters include Space, Tab, Carriage Return, Newline
218
+ *
219
+ * $check can be passed as an array:
220
+ * array('check' => 'valueToCheck');
221
+ *
222
+ * @param mixed $check Value to check
223
+ * @return boolean Success
224
+ * @access public
225
+ */
226
+ function blank($check) {
227
+ $_this = & Wpcf_Cake_Validation::getInstance();
228
+ $_this->__reset();
229
+ $_this->check = $check;
230
+
231
+ if (is_array($check)) {
232
+ $_this->_extract($check);
233
+ }
234
+
235
+ $_this->regex = '/[^\\s]/';
236
+ return !$_this->_check();
237
+ }
238
+
239
+ /**
240
+ * Validation of credit card numbers.
241
+ * Returns true if $check is in the proper credit card format.
242
+ *
243
+ * @param mixed $check credit card number to validate
244
+ * @param mixed $type 'all' may be passed as a sting, defaults to fast which checks format of most major credit cards
245
+ * if an array is used only the values of the array are checked.
246
+ * Example: array('amex', 'bankcard', 'maestro')
247
+ * @param boolean $deep set to true this will check the Luhn algorithm of the credit card.
248
+ * @param string $regex A custom regex can also be passed, this will be used instead of the defined regex values
249
+ * @return boolean Success
250
+ * @access public
251
+ * @see Wpcf_Cake_Validation::_luhn()
252
+ */
253
+ function cc($check, $type = 'fast', $deep = false, $regex = null) {
254
+ $_this = & Wpcf_Cake_Validation::getInstance();
255
+ $_this->__reset();
256
+ $_this->check = $check;
257
+ $_this->type = $type;
258
+ $_this->deep = $deep;
259
+ $_this->regex = $regex;
260
+
261
+ if (is_array($check)) {
262
+ $_this->_extract($check);
263
+ }
264
+ $_this->check = str_replace(array('-', ' '), '', $_this->check);
265
+
266
+ if (strlen($_this->check) < 13) {
267
+ return false;
268
+ }
269
+
270
+ if (!is_null($_this->regex)) {
271
+ if ($_this->_check()) {
272
+ return $_this->_luhn();
273
+ }
274
+ }
275
+ $cards = array(
276
+ 'all' => array(
277
+ 'amex' => '/^3[4|7]\\d{13}$/',
278
+ 'bankcard' => '/^56(10\\d\\d|022[1-5])\\d{10}$/',
279
+ 'diners' => '/^(?:3(0[0-5]|[68]\\d)\\d{11})|(?:5[1-5]\\d{14})$/',
280
+ 'disc' => '/^(?:6011|650\\d)\\d{12}$/',
281
+ 'electron' => '/^(?:417500|4917\\d{2}|4913\\d{2})\\d{10}$/',
282
+ 'enroute' => '/^2(?:014|149)\\d{11}$/',
283
+ 'jcb' => '/^(3\\d{4}|2100|1800)\\d{11}$/',
284
+ 'maestro' => '/^(?:5020|6\\d{3})\\d{12}$/',
285
+ 'mc' => '/^5[1-5]\\d{14}$/',
286
+ 'solo' => '/^(6334[5-9][0-9]|6767[0-9]{2})\\d{10}(\\d{2,3})?$/',
287
+ 'switch' => '/^(?:49(03(0[2-9]|3[5-9])|11(0[1-2]|7[4-9]|8[1-2])|36[0-9]{2})\\d{10}(\\d{2,3})?)|(?:564182\\d{10}(\\d{2,3})?)|(6(3(33[0-4][0-9])|759[0-9]{2})\\d{10}(\\d{2,3})?)$/',
288
+ 'visa' => '/^4\\d{12}(\\d{3})?$/',
289
+ 'voyager' => '/^8699[0-9]{11}$/'
290
+ ),
291
+ 'fast' => '/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})$/'
292
+ );
293
+
294
+ if (is_array($_this->type)) {
295
+ foreach ($_this->type as $value) {
296
+ $_this->regex = $cards['all'][strtolower($value)];
297
+
298
+ if ($_this->_check()) {
299
+ return $_this->_luhn();
300
+ }
301
+ }
302
+ } elseif ($_this->type == 'all') {
303
+ foreach ($cards['all'] as $value) {
304
+ $_this->regex = $value;
305
+
306
+ if ($_this->_check()) {
307
+ return $_this->_luhn();
308
+ }
309
+ }
310
+ } else {
311
+ $_this->regex = $cards['fast'];
312
+
313
+ if ($_this->_check()) {
314
+ return $_this->_luhn();
315
+ }
316
+ }
317
+ }
318
+
319
+ /**
320
+ * Used to compare 2 numeric values.
321
+ *
322
+ * @param mixed $check1 if string is passed for a string must also be passed for $check2
323
+ * used as an array it must be passed as array('check1' => value, 'operator' => 'value', 'check2' -> value)
324
+ * @param string $operator Can be either a word or operand
325
+ * is greater >, is less <, greater or equal >=
326
+ * less or equal <=, is less <, equal to ==, not equal !=
327
+ * @param integer $check2 only needed if $check1 is a string
328
+ * @return boolean Success
329
+ * @access public
330
+ */
331
+ function comparison($check1, $operator = null, $check2 = null) {
332
+ if (is_array($check1)) {
333
+ extract($check1, EXTR_OVERWRITE);
334
+ }
335
+ $operator = str_replace(array(' ', "\t", "\n", "\r", "\0", "\x0B"), '', strtolower($operator));
336
+
337
+ switch ($operator) {
338
+ case 'isgreater':
339
+ case '>':
340
+ if ($check1 > $check2) {
341
+ return true;
342
+ }
343
+ break;
344
+ case 'isless':
345
+ case '<':
346
+ if ($check1 < $check2) {
347
+ return true;
348
+ }
349
+ break;
350
+ case 'greaterorequal':
351
+ case '>=':
352
+ if ($check1 >= $check2) {
353
+ return true;
354
+ }
355
+ break;
356
+ case 'lessorequal':
357
+ case '<=':
358
+ if ($check1 <= $check2) {
359
+ return true;
360
+ }
361
+ break;
362
+ case 'equalto':
363
+ case '==':
364
+ if ($check1 == $check2) {
365
+ return true;
366
+ }
367
+ break;
368
+ case 'notequal':
369
+ case '!=':
370
+ if ($check1 != $check2) {
371
+ return true;
372
+ }
373
+ break;
374
+ default:
375
+ $_this = & Wpcf_Cake_Validation::getInstance();
376
+ $_this->errors[] = __('You must define the $operator parameter for Wpcf_Cake_Validation::comparison()', 'wpcf');
377
+ break;
378
+ }
379
+ return false;
380
+ }
381
+
382
+ /**
383
+ * Used when a custom regular expression is needed.
384
+ *
385
+ * @param mixed $check When used as a string, $regex must also be a valid regular expression.
386
+ * As and array: array('check' => value, 'regex' => 'valid regular expression')
387
+ * @param string $regex If $check is passed as a string, $regex must also be set to valid regular expression
388
+ * @return boolean Success
389
+ * @access public
390
+ */
391
+ function custom($check, $regex = null) {
392
+ $_this = & Wpcf_Cake_Validation::getInstance();
393
+ $_this->__reset();
394
+ $_this->check = $check;
395
+ $_this->regex = $regex;
396
+ if (is_array($check)) {
397
+ $_this->_extract($check);
398
+ }
399
+ if ($_this->regex === null) {
400
+ $_this->errors[] = __('You must define a regular expression for Wpcf_Cake_Validation::custom()', 'wpcf');
401
+ return false;
402
+ }
403
+ return $_this->_check();
404
+ }
405
+
406
+ /**
407
+ * Date validation, determines if the string passed is a valid date.
408
+ * keys that expect full month, day and year will validate leap years
409
+ *
410
+ * @param string $check a valid date string
411
+ * @param mixed $format Use a string or an array of the keys below. Arrays should be passed as array('dmy', 'mdy', etc)
412
+ * Keys: dmy 27-12-2006 or 27-12-06 separators can be a space, period, dash, forward slash
413
+ * mdy 12-27-2006 or 12-27-06 separators can be a space, period, dash, forward slash
414
+ * ymd 2006-12-27 or 06-12-27 separators can be a space, period, dash, forward slash
415
+ * dMy 27 December 2006 or 27 Dec 2006
416
+ * Mdy December 27, 2006 or Dec 27, 2006 comma is optional
417
+ * My December 2006 or Dec 2006
418
+ * my 12/2006 separators can be a space, period, dash, forward slash
419
+ * @param string $regex If a custom regular expression is used this is the only validation that will occur.
420
+ * @return boolean Success
421
+ * @access public
422
+ */
423
+ function date($check, $format = 'ymd', $regex = null) {
424
+
425
+ $date_format = wpcf_get_date_format();
 
 
 
426
  $cake_date_formats = array(
427
  'F j, Y' => 'Mdy',
428
+ 'Y/m/d' => 'ymd',
429
+ 'm/d/Y' => 'mdy',
430
+ 'd/m/Y' => 'dmy',
431
+ 'd/m/y' => 'dmy',
432
  );
433
 
434
  $format = $cake_date_formats[$date_format];
435
+
436
+ $_this = & Wpcf_Cake_Validation::getInstance();
437
+ $_this->__reset();
438
+ $_this->check = $check;
439
+ $_this->regex = $regex;
440
+
441
+ if (!is_null($_this->regex)) {
442
+ return $_this->_check();
443
+ }
444
+
445
+ $regex['dmy'] = '%^(?:(?:31(\\/|-|\\.|\\x20)(?:0?[13578]|1[02]))\\1|(?:(?:29|30)(\\/|-|\\.|\\x20)(?:0?[1,3-9]|1[0-2])\\2))(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$|^(?:29(\\/|-|\\.|\\x20)0?2\\3(?:(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\\d|2[0-8])(\\/|-|\\.|\\x20)(?:(?:0?[1-9])|(?:1[0-2]))\\4(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$%';
446
+ $regex['mdy'] = '%^(?:(?:(?:0?[13578]|1[02])(\\/|-|\\.|\\x20)31)\\1|(?:(?:0?[13-9]|1[0-2])(\\/|-|\\.|\\x20)(?:29|30)\\2))(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$|^(?:0?2(\\/|-|\\.|\\x20)29\\3(?:(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:(?:0?[1-9])|(?:1[0-2]))(\\/|-|\\.|\\x20)(?:0?[1-9]|1\\d|2[0-8])\\4(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$%';
447
+ $regex['ymd'] = '%^(?:(?:(?:(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(\\/|-|\\.|\\x20)(?:0?2\\1(?:29)))|(?:(?:(?:1[6-9]|[2-9]\\d)?\\d{2})(\\/|-|\\.|\\x20)(?:(?:(?:0?[13578]|1[02])\\2(?:31))|(?:(?:0?[1,3-9]|1[0-2])\\2(29|30))|(?:(?:0?[1-9])|(?:1[0-2]))\\2(?:0?[1-9]|1\\d|2[0-8]))))$%';
448
+ $regex['dMy'] = '/^((31(?!\\ (Feb(ruary)?|Apr(il)?|June?|(Sep(?=\\b|t)t?|Nov)(ember)?)))|((30|29)(?!\\ Feb(ruary)?))|(29(?=\\ Feb(ruary)?\\ (((1[6-9]|[2-9]\\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))|(0?[1-9])|1\\d|2[0-8])\\ (Jan(uary)?|Feb(ruary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sep(?=\\b|t)t?|Nov|Dec)(ember)?)\\ ((1[6-9]|[2-9]\\d)\\d{2})$/';
449
+ $regex['Mdy'] = '/^(?:(((Jan(uary)?|Ma(r(ch)?|y)|Jul(y)?|Aug(ust)?|Oct(ober)?|Dec(ember)?)\\ 31)|((Jan(uary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sept|Nov|Dec)(ember)?)\\ (0?[1-9]|([12]\\d)|30))|(Feb(ruary)?\\ (0?[1-9]|1\\d|2[0-8]|(29(?=,?\\ ((1[6-9]|[2-9]\\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))))\\,?\\ ((1[6-9]|[2-9]\\d)\\d{2}))$/';
450
+ $regex['My'] = '%^(Jan(uary)?|Feb(ruary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sep(?=\\b|t)t?|Nov|Dec)(ember)?)[ /]((1[6-9]|[2-9]\\d)\\d{2})$%';
451
+ $regex['my'] = '%^(((0[123456789]|10|11|12)([- /.])(([1][9][0-9][0-9])|([2][0-9][0-9][0-9]))))$%';
452
+
453
+ $format = (is_array($format)) ? array_values($format) : array($format);
454
+ foreach ($format as $key) {
455
+ $_this->regex = $regex[$key];
456
+
457
+ if ($_this->_check() === true) {
458
+ return true;
459
+ }
460
+ }
461
+ return false;
462
+ }
463
+
464
+ /**
465
+ * Time validation, determines if the string passed is a valid time.
466
+ * Validates time as 24hr (HH:MM) or am/pm ([H]H:MM[a|p]m)
467
+ * Does not allow/validate seconds.
468
+ *
469
+ * @param string $check a valid time string
470
+ * @return boolean Success
471
+ * @access public
472
+ */
473
+ function time($check) {
474
+ $_this = & Wpcf_Cake_Validation::getInstance();
475
+ $_this->__reset();
476
+ $_this->check = $check;
477
+ $_this->regex = '%^((0?[1-9]|1[012])(:[0-5]\d){0,2}([AP]M|[ap]m))$|^([01]\d|2[0-3])(:[0-5]\d){0,2}$%';
478
+ return $_this->_check();
479
+ }
480
+
481
+ /**
482
+ * Boolean validation, determines if value passed is a boolean integer or true/false.
483
+ *
484
+ * @param string $check a valid boolean
485
+ * @return boolean Success
486
+ * @access public
487
+ */
488
+ function boolean($check) {
489
+ $booleanList = array(0, 1, '0', '1', true, false);
490
+ return in_array($check, $booleanList, true);
491
+ }
492
+
493
+ /**
494
+ * Checks that a value is a valid decimal. If $places is null, the $check is allowed to be a scientific float
495
+ * If no decimal point is found a false will be returned. Both the sign and exponent are optional.
496
+ *
497
+ * @param integer $check The value the test for decimal
498
+ * @param integer $places if set $check value must have exactly $places after the decimal point
499
+ * @param string $regex If a custom regular expression is used this is the only validation that will occur.
500
+ * @return boolean Success
501
+ * @access public
502
+ */
503
+ function decimal($check, $places = null, $regex = null) {
504
+ $_this = & Wpcf_Cake_Validation::getInstance();
505
+ $_this->__reset();
506
+ $_this->regex = $regex;
507
+ $_this->check = $check;
508
+
509
+ if (is_null($_this->regex)) {
510
+ if (is_null($places)) {
511
+ $_this->regex = '/^[-+]?[0-9]*\\.{1}[0-9]+(?:[eE][-+]?[0-9]+)?$/';
512
+ } else {
513
+ $_this->regex = '/^[-+]?[0-9]*\\.{1}[0-9]{' . $places . '}$/';
514
+ }
515
+ }
516
+ return $_this->_check();
517
+ }
518
+
519
+ /**
520
+ * Validates for an email address.
521
+ *
522
+ * @param string $check Value to check
523
+ * @param boolean $deep Perform a deeper validation (if true), by also checking availability of host
524
+ * @param string $regex Regex to use (if none it will use built in regex)
525
+ * @return boolean Success
526
+ * @access public
527
+ */
528
+ function email($check, $deep = false, $regex = null) {
529
+ $_this = & Wpcf_Cake_Validation::getInstance();
530
+ $_this->__reset();
531
+ $_this->check = $check;
532
+ $_this->regex = $regex;
533
+ $_this->deep = $deep;
534
+
535
+ if (is_array($check)) {
536
+ $_this->_extract($check);
537
+ }
538
+
539
+ if (is_null($_this->regex)) {
540
+ $_this->regex = '/^[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+)*@' . $_this->__pattern['hostname'] . '$/i';
541
+ }
542
+ $return = $_this->_check();
543
+
544
+ if ($_this->deep === false || $_this->deep === null) {
545
+ return $return;
546
+ }
547
+
548
+ if ($return === true && preg_match('/@(' . $_this->__pattern['hostname'] . ')$/i', $_this->check, $regs)) {
549
+ if (function_exists('getmxrr') && getmxrr($regs[1], $mxhosts)) {
550
+ return true;
551
+ }
552
+ if (function_exists('checkdnsrr') && checkdnsrr($regs[1], 'MX')) {
553
+ return true;
554
+ }
555
+ return is_array(gethostbynamel($regs[1]));
556
+ }
557
+ return false;
558
+ }
559
+
560
+ /**
561
+ * Check that value is exactly $comparedTo.
562
+ *
563
+ * @param mixed $check Value to check
564
+ * @param mixed $comparedTo Value to compare
565
+ * @return boolean Success
566
+ * @access public
567
+ */
568
+ function equalTo($check, $comparedTo) {
569
+ return ($check === $comparedTo);
570
+ }
571
+
572
+ /**
573
+ * Check that value has a valid file extension.
574
+ *
575
+ * @param mixed $check Value to check
576
+ * @param array $extensions file extenstions to allow
577
+ * @return boolean Success
578
+ * @access public
579
+ */
580
+ function extension($check, $extensions = array('gif', 'jpeg', 'png', 'jpg')) {
581
+ if (is_array($check)) {
582
+ return Wpcf_Cake_Validation::extension(array_shift($check), $extensions);
583
+ }
584
+ $extension = strtolower(array_pop(explode('.', $check)));
585
+ foreach ($extensions as $value) {
586
+ if ($extension == strtolower($value)) {
587
+ return true;
588
+ }
589
+ }
590
+ return false;
591
+ }
592
+
593
+ /**
594
+ * Validation of an IP address.
595
+ *
596
+ * Valid IP version strings for type restriction are:
597
+ * - both: Check both IPv4 and IPv6, return true if the supplied address matches either version
598
+ * - IPv4: Version 4 (Eg: 127.0.0.1, 192.168.10.123, 203.211.24.8)
599
+ * - IPv6: Version 6 (Eg: ::1, 2001:0db8::1428:57ab)
600
+ *
601
+ * @param string $check The string to test.
602
+ * @param string $type The IP Version to test against
603
+ * @return boolean Success
604
+ * @access public
605
+ */
606
+ function ip($check, $type = 'both') {
607
+ $_this = & Wpcf_Cake_Validation::getInstance();
608
+ $success = false;
609
+ $type = strtolower($type);
610
+ if ($type === 'ipv4' || $type === 'both') {
611
+ $success |= $_this->_ipv4($check);
612
+ }
613
+ if ($type === 'ipv6' || $type === 'both') {
614
+ $success |= $_this->_ipv6($check);
615
+ }
616
+ return $success;
617
+ }
618
+
619
+ /**
620
+ * Validation of IPv4 addresses.
621
+ *
622
+ * @param string $check IP Address to test
623
+ * @return boolean Success
624
+ * @access protected
625
+ */
626
+ function _ipv4($check) {
627
+ if (function_exists('filter_var')) {
628
+ return filter_var($check, FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV4)) !== false;
629
+ }
630
+ $this->__populateIp();
631
+ $this->check = $check;
632
+ $this->regex = '/^' . $this->__pattern['IPv4'] . '$/';
633
+ return $this->_check();
634
+ }
635
+
636
+ /**
637
+ * Validation of IPv6 addresses.
638
+ *
639
+ * @param string $check IP Address to test
640
+ * @return boolean Success
641
+ * @access protected
642
+ */
643
+ function _ipv6($check) {
644
+ if (function_exists('filter_var')) {
645
+ return filter_var($check, FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV6)) !== false;
646
+ }
647
+ $this->__populateIp();
648
+ $this->check = $check;
649
+ $this->regex = '/^' . $this->__pattern['IPv6'] . '$/';
650
+ return $this->_check();
651
+ }
652
+
653
+ /**
654
+ * Checks whether the length of a string is greater or equal to a minimal length.
655
+ *
656
+ * @param string $check The string to test
657
+ * @param integer $min The minimal string length
658
+ * @return boolean Success
659
+ * @access public
660
+ */
661
+ function minLength($check, $min) {
662
+ $length = strlen($check);
663
+ return ($length >= $min);
664
+ }
665
+
666
+ /**
667
+ * Checks whether the length of a string is smaller or equal to a maximal length..
668
+ *
669
+ * @param string $check The string to test
670
+ * @param integer $max The maximal string length
671
+ * @return boolean Success
672
+ * @access public
673
+ */
674
+ function maxLength($check, $max) {
675
+ $length = strlen($check);
676
+ return ($length <= $max);
677
+ }
678
+
679
+ /**
680
+ * Checks that a value is a monetary amount.
681
+ *
682
+ * @param string $check Value to check
683
+ * @param string $symbolPosition Where symbol is located (left/right)
684
+ * @return boolean Success
685
+ * @access public
686
+ */
687
+ function money($check, $symbolPosition = 'left') {
688
+ $_this = & Wpcf_Cake_Validation::getInstance();
689
+ $_this->check = $check;
690
+
691
+ if ($symbolPosition == 'right') {
692
+ $_this->regex = '/^(?!0,?\d)(?:\d{1,3}(?:([, .])\d{3})?(?:\1\d{3})*|(?:\d+))((?!\1)[,.]\d{2})?(?<!\x{00a2})\p{Sc}?$/u';
693
+ } else {
694
+ $_this->regex = '/^(?!\x{00a2})\p{Sc}?(?!0,?\d)(?:\d{1,3}(?:([, .])\d{3})?(?:\1\d{3})*|(?:\d+))((?!\1)[,.]\d{2})?$/u';
695
+ }
696
+ return $_this->_check();
697
+ }
698
+
699
+ /**
700
+ * Validate a multiple select.
701
+ *
702
+ * Valid Options
703
+ *
704
+ * - in => provide a list of choices that selections must be made from
705
+ * - max => maximun number of non-zero choices that can be made
706
+ * - min => minimum number of non-zero choices that can be made
707
+ *
708
+ * @param mixed $check Value to check
709
+ * @param mixed $options Options for the check.
710
+ * @return boolean Success
711
+ * @access public
712
+ */
713
+ function multiple($check, $options = array()) {
714
+ $defaults = array('in' => null, 'max' => null, 'min' => null);
715
+ $options = array_merge($defaults, $options);
716
+ $check = array_filter((array) $check);
717
+ if (empty($check)) {
718
+ return false;
719
+ }
720
+ if ($options['max'] && count($check) > $options['max']) {
721
+ return false;
722
+ }
723
+ if ($options['min'] && count($check) < $options['min']) {
724
+ return false;
725
+ }
726
+ if ($options['in'] && is_array($options['in'])) {
727
+ foreach ($check as $val) {
728
+ if (!in_array($val, $options['in'])) {
729
+ return false;
730
+ }
731
+ }
732
+ }
733
+ return true;
734
+ }
735
+
736
+ /**
737
+ * Checks if a value is numeric.
738
+ *
739
+ * @param string $check Value to check
740
+ * @return boolean Succcess
741
+ * @access public
742
+ */
743
+ function numeric($check) {
744
+ return is_numeric($check);
745
+ }
746
+
747
+ /**
748
+ * Checks if a value is integer.
749
+ *
750
+ * @param string $check Value to check
751
+ * @return boolean Succcess
752
+ * @access public
753
+ */
754
+ function integer($check) {
755
+ return is_int(intval($check));
756
+ }
757
+
758
+ /**
759
+ * Check that a value is a valid phone number.
760
+ *
761
+ * @param mixed $check Value to check (string or array)
762
+ * @param string $regex Regular expression to use
763
+ * @param string $country Country code (defaults to 'all')
764
+ * @return boolean Success
765
+ * @access public
766
+ */
767
+ function phone($check, $regex = null, $country = 'all') {
768
+ $_this = & Wpcf_Cake_Validation::getInstance();
769
+ $_this->check = $check;
770
+ $_this->regex = $regex;
771
+ $_this->country = $country;
772
+ if (is_array($check)) {
773
+ $_this->_extract($check);
774
+ }
775
+
776
+ if (is_null($_this->regex)) {
777
+ switch ($_this->country) {
778
+ case 'us':
779
+ case 'all':
780
+ case 'can':
781
+ // includes all NANPA members. see http://en.wikipedia.org/wiki/North_American_Numbering_Plan#List_of_NANPA_countries_and_territories
782
+ $_this->regex = '/^(?:\+?1)?[-. ]?\\(?[2-9][0-8][0-9]\\)?[-. ]?[2-9][0-9]{2}[-. ]?[0-9]{4}$/';
783
+ break;
784
+ }
785
+ }
786
+ if (empty($_this->regex)) {
787
+ return $_this->_pass('phone', $check, $country);
788
+ }
789
+ return $_this->_check();
790
+ }
791
+
792
+ /**
793
+ * Checks that a given value is a valid postal code.
794
+ *
795
+ * @param mixed $check Value to check
796
+ * @param string $regex Regular expression to use
797
+ * @param string $country Country to use for formatting
798
+ * @return boolean Success
799
+ * @access public
800
+ */
801
+ function postal($check, $regex = null, $country = null) {
802
+ $_this = & Wpcf_Cake_Validation::getInstance();
803
+ $_this->check = $check;
804
+ $_this->regex = $regex;
805
+ $_this->country = $country;
806
+ if (is_array($check)) {
807
+ $_this->_extract($check);
808
+ }
809
+ if (empty($country)) {
810
+ $_this->country = 'us';
811
+ }
812
+
813
+ if (is_null($_this->regex)) {
814
+ switch ($_this->country) {
815
+ case 'uk':
816
+ $_this->regex = '/\\A\\b[A-Z]{1,2}[0-9][A-Z0-9]? [0-9][ABD-HJLNP-UW-Z]{2}\\b\\z/i';
817
+ break;
818
+ case 'ca':
819
+ $_this->regex = '/\\A\\b[ABCEGHJKLMNPRSTVXY][0-9][A-Z] ?[0-9][A-Z][0-9]\\b\\z/i';
820
+ break;
821
+ case 'it':
822
+ case 'de':
823
+ $_this->regex = '/^[0-9]{5}$/i';
824
+ break;
825
+ case 'be':
826
+ $_this->regex = '/^[1-9]{1}[0-9]{3}$/i';
827
+ break;
828
+ case 'us':
829
+ $_this->regex = '/\\A\\b[0-9]{5}(?:-[0-9]{4})?\\b\\z/i';
830
+ break;
831
+ }
832
+ }
833
+ if (empty($_this->regex)) {
834
+ return $_this->_pass('postal', $check, $country);
835
+ }
836
+ return $_this->_check();
837
+ }
838
+
839
+ /**
840
+ * Validate that a number is in specified range.
841
+ * if $lower and $upper are not set, will return true if
842
+ * $check is a legal finite on this platform
843
+ *
844
+ * @param string $check Value to check
845
+ * @param integer $lower Lower limit
846
+ * @param integer $upper Upper limit
847
+ * @return boolean Success
848
+ * @access public
849
+ */
850
+ function range($check, $lower = null, $upper = null) {
851
+ if (!is_numeric($check)) {
852
+ return false;
853
+ }
854
+ if (isset($lower) && isset($upper)) {
855
+ return ($check > $lower && $check < $upper);
856
+ }
857
+ return is_finite($check);
858
+ }
859
+
860
+ /**
861
+ * Checks that a value is a valid Social Security Number.
862
+ *
863
+ * @param mixed $check Value to check
864
+ * @param string $regex Regular expression to use
865
+ * @param string $country Country
866
+ * @return boolean Success
867
+ * @access public
868
+ */
869
+ function ssn($check, $regex = null, $country = null) {
870
+ $_this = & Wpcf_Cake_Validation::getInstance();
871
+ $_this->check = $check;
872
+ $_this->regex = $regex;
873
+ $_this->country = $country;
874
+ if (is_array($check)) {
875
+ $_this->_extract($check);
876
+ }
877
+
878
+ if (is_null($_this->regex)) {
879
+ switch ($_this->country) {
880
+ case 'dk':
881
+ $_this->regex = '/\\A\\b[0-9]{6}-[0-9]{4}\\b\\z/i';
882
+ break;
883
+ case 'nl':
884
+ $_this->regex = '/\\A\\b[0-9]{9}\\b\\z/i';
885
+ break;
886
+ case 'us':
887
+ $_this->regex = '/\\A\\b[0-9]{3}-[0-9]{2}-[0-9]{4}\\b\\z/i';
888
+ break;
889
+ }
890
+ }
891
+ if (empty($_this->regex)) {
892
+ return $_this->_pass('ssn', $check, $country);
893
+ }
894
+ return $_this->_check();
895
+ }
896
+
897
+ /**
898
+ * Checks that a value is a valid uuid - http://tools.ietf.org/html/rfc4122
899
+ *
900
+ * @param string $check Value to check
901
+ * @return boolean Success
902
+ * @access public
903
+ */
904
+ function uuid($check) {
905
+ $_this = & Wpcf_Cake_Validation::getInstance();
906
+ $_this->check = $check;
907
+ $_this->regex = '/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i';
908
+ return $_this->_check();
909
+ }
910
+
911
+ /**
912
+ * Checks that a value is a valid URL according to http://www.w3.org/Addressing/URL/url-spec.txt
913
+ *
914
+ * The regex checks for the following component parts:
915
+ *
916
+ * - a valid, optional, scheme
917
+ * - a valid ip address OR
918
+ * a valid domain name as defined by section 2.3.1 of http://www.ietf.org/rfc/rfc1035.txt
919
+ * with an optional port number
920
+ * - an optional valid path
921
+ * - an optional query string (get parameters)
922
+ * - an optional fragment (anchor tag)
923
+ *
924
+ * @param string $check Value to check
925
+ * @param boolean $strict Require URL to be prefixed by a valid scheme (one of http(s)/ftp(s)/file/news/gopher)
926
+ * @return boolean Success
927
+ * @access public
928
+ */
929
+ function url($check, $strict = false) {
930
+ $_this = & Wpcf_Cake_Validation::getInstance();
931
+ $_this->__populateIp();
932
+ $_this->check = $check;
933
+ $validChars = '([' . preg_quote('!"$&\'()*+,-.@_:;=~[]') . '\/0-9a-z\p{L}\p{N}]|(%[0-9a-f]{2}))';
934
+ $_this->regex = '/^(?:(?:https?|ftps?|file|news|gopher):\/\/)' . (!empty($strict) ? '' : '?') .
935
+ '(?:' . $_this->__pattern['IPv4'] . '|\[' . $_this->__pattern['IPv6'] . '\]|' . $_this->__pattern['hostname'] . ')' .
936
+ '(?::[1-9][0-9]{0,4})?' .
937
+ '(?:\/?|\/' . $validChars . '*)?' .
938
+ '(?:\?' . $validChars . '*)?' .
939
+ '(?:#' . $validChars . '*)?$/iu';
940
+ return $_this->_check();
941
+ }
942
+
943
+ /**
944
+ * Checks if a value is in a given list.
945
+ *
946
+ * @param string $check Value to check
947
+ * @param array $list List to check against
948
+ * @return boolean Succcess
949
+ * @access public
950
+ */
951
+ function inList($check, $list) {
952
+ return in_array($check, $list);
953
+ }
954
+
955
+ /**
956
+ * Runs an user-defined validation.
957
+ *
958
+ * @param mixed $check value that will be validated in user-defined methods.
959
+ * @param object $object class that holds validation method
960
+ * @param string $method class method name for validation to run
961
+ * @param array $args arguments to send to method
962
+ * @return mixed user-defined class class method returns
963
+ * @access public
964
+ */
965
+ function userDefined($check, $object, $method, $args = null) {
966
+ return call_user_func_array(array(&$object, $method), array($check, $args));
967
+ }
968
+
969
+ function noSpecialChars($check) {
970
+ return preg_match('#[^a-zA-Z0-9\s\_\-]#', $check) ? false : true;
971
+ }
972
+
973
+ function rewriteSlug($check) {
974
+ return preg_match('#[^a-zA-Z0-9\s\_\-\%]#', $check) ? false : true;
975
+ }
976
+
977
+ /**
978
+ * Attempts to pass unhandled Validation locales to a class starting with $classPrefix
979
+ * and ending with Validation. For example $classPrefix = 'nl', the class would be
980
+ * `NlValidation`.
981
+ *
982
+ * @param string $method The method to call on the other class.
983
+ * @param mixed $check The value to check or an array of parameters for the method to be called.
984
+ * @param string $classPrefix The prefix for the class to do the validation.
985
+ * @return mixed Return of Passed method, false on failure
986
+ * @access protected
987
+ * */
988
+ function _pass($method, $check, $classPrefix) {
989
+ $className = ucwords($classPrefix) . 'Validation';
990
+ if (!class_exists($className)) {
991
+ trigger_error(sprintf(__('Could not find %s class, unable to complete validation.', true), $className), E_USER_WARNING);
992
+ return false;
993
+ }
994
+ if (!is_callable(array($className, $method))) {
995
+ trigger_error(sprintf(__('Method %s does not exist on %s unable to complete validation.', true), $method, $className), E_USER_WARNING);
996
+ return false;
997
+ }
998
+ $check = (array) $check;
999
+ return call_user_func_array(array($className, $method), $check);
1000
+ }
1001
+
1002
+ /**
1003
+ * Runs a regular expression match.
1004
+ *
1005
+ * @return boolean Success of match
1006
+ * @access protected
1007
+ */
1008
+ function _check() {
1009
+ $_this = & Wpcf_Cake_Validation::getInstance();
1010
+ if (preg_match($_this->regex, $_this->check)) {
1011
+ $_this->error[] = false;
1012
+ return true;
1013
+ } else {
1014
+ $_this->error[] = true;
1015
+ return false;
1016
+ }
1017
+ }
1018
+
1019
+ /**
1020
+ * Get the values to use when value sent to validation method is
1021
+ * an array.
1022
+ *
1023
+ * @param array $params Parameters sent to validation method
1024
+ * @return void
1025
+ * @access protected
1026
+ */
1027
+ function _extract($params) {
1028
+ $_this = & Wpcf_Cake_Validation::getInstance();
1029
+ extract($params, EXTR_OVERWRITE);
1030
+
1031
+ if (isset($check)) {
1032
+ $_this->check = $check;
1033
+ }
1034
+ if (isset($regex)) {
1035
+ $_this->regex = $regex;
1036
+ }
1037
+ if (isset($country)) {
1038
+ $_this->country = strtolower($country);
1039
+ }
1040
+ if (isset($deep)) {
1041
+ $_this->deep = $deep;
1042
+ }
1043
+ if (isset($type)) {
1044
+ $_this->type = $type;
1045
+ }
1046
+ }
1047
+
1048
+ /**
1049
+ * Luhn algorithm
1050
+ *
1051
+ * @see http://en.wikipedia.org/wiki/Luhn_algorithm
1052
+ * @return boolean Success
1053
+ * @access protected
1054
+ */
1055
+ function _luhn() {
1056
+ $_this = & Wpcf_Cake_Validation::getInstance();
1057
+ if ($_this->deep !== true) {
1058
+ return true;
1059
+ }
1060
+ if ($_this->check == 0) {
1061
+ return false;
1062
+ }
1063
+ $sum = 0;
1064
+ $length = strlen($_this->check);
1065
+
1066
+ for ($position = 1 - ($length % 2); $position < $length; $position += 2) {
1067
+ $sum += $_this->check[$position];
1068
+ }
1069
+
1070
+ for ($position = ($length % 2); $position < $length; $position += 2) {
1071
+ $number = $_this->check[$position] * 2;
1072
+ $sum += ($number < 10) ? $number : $number - 9;
1073
+ }
1074
+
1075
+ return ($sum % 10 == 0);
1076
+ }
1077
+
1078
+ /*
1079
+ * Lazily popualate the IP address patterns used for validations
1080
+ *
1081
+ * @return void
1082
+ * @access private
1083
+ */
1084
+
1085
+ function __populateIp() {
1086
+ if (!isset($this->__pattern['IPv6'])) {
1087
+ $pattern = '((([0-9A-Fa-f]{1,4}:){7}(([0-9A-Fa-f]{1,4})|:))|(([0-9A-Fa-f]{1,4}:){6}';
1088
+ $pattern .= '(:|((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})';
1089
+ $pattern .= '|(:[0-9A-Fa-f]{1,4})))|(([0-9A-Fa-f]{1,4}:){5}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})';
1090
+ $pattern .= '(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:)';
1091
+ $pattern .= '{4}(:[0-9A-Fa-f]{1,4}){0,1}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2}))';
1092
+ $pattern .= '{3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){3}(:[0-9A-Fa-f]{1,4}){0,2}';
1093
+ $pattern .= '((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|';
1094
+ $pattern .= '((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){2}(:[0-9A-Fa-f]{1,4}){0,3}';
1095
+ $pattern .= '((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2}))';
1096
+ $pattern .= '{3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:)(:[0-9A-Fa-f]{1,4})';
1097
+ $pattern .= '{0,4}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)';
1098
+ $pattern .= '|((:[0-9A-Fa-f]{1,4}){1,2})))|(:(:[0-9A-Fa-f]{1,4}){0,5}((:((25[0-5]|2[0-4]';
1099
+ $pattern .= '\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4})';
1100
+ $pattern .= '{1,2})))|(((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})))(%.+)?';
1101
+
1102
+ $this->__pattern['IPv6'] = $pattern;
1103
+ }
1104
+ if (!isset($this->__pattern['IPv4'])) {
1105
+ $pattern = '(?:(?:25[0-5]|2[0-4][0-9]|(?:(?:1[0-9])?|[1-9]?)[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|(?:(?:1[0-9])?|[1-9]?)[0-9])';
1106
+ $this->__pattern['IPv4'] = $pattern;
1107
+ }
1108
+ }
1109
+
1110
+ /**
1111
+ * Reset internal variables for another validation run.
1112
+ *
1113
+ * @return void
1114
+ * @access private
1115
+ */
1116
+ function __reset() {
1117
+ $this->check = null;
1118
+ $this->regex = null;
1119
+ $this->country = null;
1120
+ $this->deep = null;
1121
+ $this->type = null;
1122
+ $this->error = array();
1123
+ $this->errors = array();
1124
+ }
1125
+
1126
+ }
1127
+
1128
  }
embedded/common/debug/debug-information.php CHANGED
@@ -3,9 +3,9 @@
3
  /**
4
  * produce debug information
5
  *
6
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/debug/debug-information.php $
7
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
8
- * $LastChangedRevision: 1012704 $
9
  * $LastChangedBy: iworks $
10
  *
11
  */
3
  /**
4
  * produce debug information
5
  *
6
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/debug/debug-information.php $
7
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
8
+ * $LastChangedRevision: 1027712 $
9
  * $LastChangedBy: iworks $
10
  *
11
  */
embedded/common/debug/functions_debug_information.php CHANGED
@@ -2,9 +2,9 @@
2
  /**
3
  * produce debug information
4
  *
5
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/debug/functions_debug_information.php $
6
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
7
- * $LastChangedRevision: 1012704 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
@@ -132,23 +132,28 @@ class ICL_Debug_Information
132
  }
133
 
134
 
135
- function do_json_encode($data) {
136
- $json_options = 0;
137
- if (defined('JSON_HEX_TAG')) {
138
- $json_options += JSON_HEX_TAG;
139
- }
140
- if (defined('JSON_HEX_APOS')) {
141
- $json_options += JSON_HEX_APOS;
142
- }
143
- if (defined('JSON_HEX_QUOT')) {
144
- $json_options += JSON_HEX_QUOT;
145
- }
146
- if (defined('JSON_HEX_AMP')) {
147
- $json_options += JSON_HEX_AMP;
148
- }
149
- if (defined('JSON_UNESCAPED_UNICODE')) {
150
- $json_options += JSON_UNESCAPED_UNICODE;
151
- }
152
- return json_encode($data, $json_options);
153
- }
 
 
 
 
 
154
  }
2
  /**
3
  * produce debug information
4
  *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/debug/functions_debug_information.php $
6
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
7
+ * $LastChangedRevision: 1027712 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
132
  }
133
 
134
 
135
+ function do_json_encode($data)
136
+ {
137
+ if (version_compare(phpversion(), '5.3.0', '<')) {
138
+ return json_encode($data);
139
+ }
140
+ $json_options = 0;
141
+ if (defined('JSON_HEX_TAG')) {
142
+ $json_options += JSON_HEX_TAG;
143
+ }
144
+ if (defined('JSON_HEX_APOS')) {
145
+ $json_options += JSON_HEX_APOS;
146
+ }
147
+ if (defined('JSON_HEX_QUOT')) {
148
+ $json_options += JSON_HEX_QUOT;
149
+ }
150
+ if (defined('JSON_HEX_AMP')) {
151
+ $json_options += JSON_HEX_AMP;
152
+ }
153
+ if (defined('JSON_UNESCAPED_UNICODE')) {
154
+ $json_options += JSON_UNESCAPED_UNICODE;
155
+ }
156
+ return json_encode($data, $json_options);
157
+ }
158
+
159
  }
embedded/common/functions.php CHANGED
@@ -4,6 +4,15 @@
4
  */
5
  define( 'ICL_COMMON_FUNCTIONS', true );
6
 
 
 
 
 
 
 
 
 
 
7
  /**
8
  * Calculates relative path for given file.
9
  *
@@ -11,24 +20,28 @@ define( 'ICL_COMMON_FUNCTIONS', true );
11
  * @return string Relative path
12
  */
13
  function icl_get_file_relpath( $file ) {
14
- $is_https = isset( $_SERVER['HTTPS'] ) && strtolower( $_SERVER['HTTPS'] ) == 'on';
15
- $http_protocol = $is_https ? 'https' : 'http';
16
- $base_root = $http_protocol . '://' . $_SERVER['HTTP_HOST'];
17
- $base_url = $base_root;
18
- $dir = rtrim( dirname( $file ), '\/' );
19
- if ( $dir ) {
20
- $base_path = $dir;
21
- $base_url .= $base_path;
22
- $base_path .= '/';
23
- } else {
24
- $base_path = '/';
25
- }
26
- $relpath = $base_root
27
- . str_replace(
28
- str_replace( '\\', '/',
29
- realpath( $_SERVER['DOCUMENT_ROOT'] ) )
30
- , '', str_replace( '\\', '/', dirname( $file ) )
31
- );
 
 
 
 
32
  return $relpath;
33
  }
34
 
4
  */
5
  define( 'ICL_COMMON_FUNCTIONS', true );
6
 
7
+ // for retro compatibility with WP < 3.5
8
+ if( !function_exists('wp_normalize_path') ){
9
+ function wp_normalize_path( $path ) {
10
+ $path = str_replace( '\\', '/', $path );
11
+ $path = preg_replace( '|/+|','/', $path );
12
+ return $path;
13
+ }
14
+ }
15
+
16
  /**
17
  * Calculates relative path for given file.
18
  *
20
  * @return string Relative path
21
  */
22
  function icl_get_file_relpath( $file ) {
23
+ // website url form DB
24
+ $url = get_option('siteurl');
25
+ // fix the protocol
26
+ $base_root = set_url_scheme( $url );
27
+
28
+ // normalise windows paths
29
+ $path_to_file = wp_normalize_path($file);
30
+ // get file directory
31
+ $file_dir = wp_normalize_path( dirname( $path_to_file ) );
32
+ // get the path to 'wp-content'
33
+ $from_content_dir = wp_normalize_path( realpath( WP_CONTENT_DIR ) );
34
+ // get wp-content dirname
35
+ $content_dir = wp_normalize_path( basename(WP_CONTENT_DIR) );
36
+
37
+ // remove absolute path part until 'wp-content' folder
38
+ $path = str_replace( $from_content_dir, '', $file_dir);
39
+ // add wp-content dir to path
40
+ $path = wp_normalize_path( $content_dir.$path );
41
+
42
+ // build url
43
+ $relpath = $base_root . '/' . $path;
44
+
45
  return $relpath;
46
  }
47
 
embedded/common/installer/changelog.txt ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ = 1.3 =
2
+ * Added a new repository: Toolset
3
+ * The product packages can be displayed hierarchically and ordered
4
+ * The link to automatically create site keys will follow through login on the account site (e.g. wpml.org, wp-types.com)
5
+ * Fixed animination issues (not showing in most browsers) when downloading plugins.
6
+ * Created an admin screen on the repository end (icl-mpp) to sho registration stats (site keys, site keys usage, components usage etc..).
7
+ * Bug fix: Renew and Upgrade buttons were not entirely clickable
8
+ * Bug fix: Action buttons (buy, renew, upgrade) were not displayed correctly when WPML was not active (Installer embedded in theme)
9
+ * Support for site-wide registration. Products can be registered on the network instead of on each site separately.
10
+ * Users are able to add either http or https version for any site urls. There will be one site key that will work with both http and https versions.
11
+
12
+ = 1.2 =
13
+ * Added pagination for site keys list of Account -> My Sites
14
+ * Reversed the order in which the site keys are displayed.
15
+ * Fixed problem with WPML registration information (site key) not being saved when the option_value field in the wp_options table used a different charset than the default WordPress charset defined in wp-config.php
16
+ * Allow registering new sites by clicking a link in the WordPress admin instead of copying and pasting the site url in the Account -> My Sites section
17
+ * Display more detailed debug information related to connectivity issues with the WPML repository
embedded/common/installer/includes/installer-upgrader-skins.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Installer_Upgrader_Skins extends WP_Upgrader_Skin{
3
+
4
+ function __construct($args = array()){
5
+ $defaults = array( 'url' => '', 'nonce' => '', 'title' => '', 'context' => false );
6
+ $this->options = wp_parse_args($args, $defaults);
7
+ }
8
+
9
+ function header(){
10
+
11
+ }
12
+
13
+ function footer(){
14
+
15
+ }
16
+
17
+ function add_strings(){
18
+
19
+ }
20
+
21
+ function feedback($string){
22
+
23
+ }
24
+
25
+ function before(){
26
+
27
+ }
28
+
29
+ function after(){
30
+
31
+ }
32
+
33
+ }
embedded/common/installer/includes/installer.class.php ADDED
@@ -0,0 +1,1590 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ final class WP_Installer{
4
+ protected static $_instance = null;
5
+
6
+ private $repositories = array();
7
+
8
+ protected $api_debug = '';
9
+
10
+ private $config = array();
11
+
12
+ protected $_plugins_renew_warnings = array();
13
+
14
+ protected $_gz_on = false;
15
+
16
+ public static function instance() {
17
+
18
+ if ( is_null( self::$_instance ) ) {
19
+ self::$_instance = new self();
20
+ }
21
+
22
+ return self::$_instance;
23
+ }
24
+
25
+ public function __construct(){
26
+
27
+ $this->_gz_on = function_exists('gzuncompress') && function_exists('gzcompress');
28
+
29
+ $this->settings = $this->get_settings();
30
+
31
+ // register repositories
32
+ $this->load_repositories_list();
33
+
34
+ // default config
35
+ $this->config['plugins_install_tab'] = false;
36
+
37
+ add_action('init', array($this, 'init'));
38
+
39
+ add_action('admin_menu', array($this, 'menu_setup'));
40
+ add_action('network_admin_menu', array($this, 'menu_setup'));
41
+
42
+ add_filter('wp_installer_buy_url', array($this, 'append_parameters_to_buy_url'));
43
+
44
+ add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'plugins_upgrade_check') );
45
+
46
+ if(defined('DOING_AJAX') && isset($_POST['action']) && $_POST['action'] == 'installer_download_plugin'){
47
+ add_filter( 'site_transient_update_plugins', array( $this, 'plugins_upgrade_check') );
48
+ }
49
+ add_filter( 'plugins_api', array( $this, 'custom_plugins_api_call'), 10, 3 );
50
+
51
+ add_action('admin_notices', array($this, 'show_site_key_nags'));
52
+
53
+ }
54
+
55
+ public function set_config($key, $value){
56
+
57
+ $this->config[$key] = $value;
58
+
59
+ }
60
+
61
+ public function init(){
62
+ global $pagenow;
63
+
64
+ if(empty($this->settings['_pre_1_0_clean_up'])) {
65
+ $this->_pre_1_0_clean_up();
66
+ }
67
+
68
+ if(empty($this->settings['last_repositories_update']) || time() - $this->settings['last_repositories_update'] > 86400){
69
+ $this->refresh_repositories_data();
70
+ }
71
+
72
+ // refresh repositories data on WP update schedule
73
+ // add_action('wp_maybe_auto_update', array($this, 'refresh_repositories_data'));
74
+
75
+ if(is_admin()){
76
+ wp_enqueue_script('installer-admin', $this->res_url() . '/res/js/admin.js', array('jquery'), $this->version());
77
+ wp_enqueue_style('installer-admin', $this->res_url() . '/res/css/admin.css', array(), $this->version());
78
+ }
79
+
80
+ if(is_admin() && $pagenow == 'plugins.php'){
81
+ add_action('admin_notices', array($this, 'setup_plugins_page_notices'));
82
+ add_action('admin_notices', array($this, 'setup_plugins_renew_warnings'), 10);
83
+ add_action('admin_notices', array($this, 'queue_plugins_renew_warnings'), 20);
84
+
85
+ add_action('admin_init', array($this, 'setup_plugins_action_links'));
86
+
87
+ }
88
+
89
+ if(defined('DOING_AJAX')){
90
+ add_action('wp_ajax_save_site_key', array($this, 'save_site_key'));
91
+ add_action('wp_ajax_remove_site_key', array($this, 'remove_site_key'));
92
+ add_action('wp_ajax_update_site_key', array($this, 'update_site_key'));
93
+
94
+ add_action('wp_ajax_installer_download_plugin', array($this, 'download_plugin'));
95
+ add_action('wp_ajax_installer_activate_plugin', array($this, 'activate_plugin'));
96
+
97
+ add_action('wp_ajax_installer_dismiss_nag', array($this, 'dismiss_nag'));
98
+
99
+
100
+ }
101
+
102
+ }
103
+
104
+ public function menu_setup(){
105
+ global $pagenow;
106
+
107
+ if(is_multisite() && !is_network_admin()){
108
+ $this->menu_multisite_redirect();
109
+ add_options_page(__('Installer', 'installer'), __('Installer', 'installer'), 'manage_options', 'installer', array($this, 'show_products')) ;
110
+ }else{
111
+ if($this->config['plugins_install_tab'] && is_admin() && $pagenow == 'plugin-install.php'){
112
+ // Default GUI, under Plugins -> Install
113
+ add_filter('install_plugins_tabs', array($this, 'add_install_plugins_tab'));
114
+ add_action('install_plugins_commercial', array($this, 'show_products'));
115
+ }
116
+ }
117
+
118
+ }
119
+
120
+ public function menu_url(){
121
+ if(is_multisite()){
122
+ if(is_network_admin()){
123
+ $url = network_admin_url('plugin-install.php?tab=commercial');
124
+ }else{
125
+ $url = admin_url('options-general.php?page=installer');
126
+ }
127
+ }else{
128
+ $url = admin_url('plugin-install.php?tab=commercial');
129
+ }
130
+ return $url;
131
+ }
132
+
133
+ private function menu_multisite_redirect(){
134
+ global $pagenow;
135
+
136
+ if($pagenow == 'plugin-install.php' && isset($_GET['tab']) && $_GET['tab'] == 'commercial'){
137
+ wp_redirect($this->menu_url());
138
+ exit;
139
+ }
140
+
141
+ }
142
+
143
+ private function _pre_1_0_clean_up(){
144
+ global $wpdb;
145
+
146
+ if(!defined('WPRC_VERSION')){
147
+ $old_tables = array(
148
+ $wpdb->prefix . 'wprc_cached_requests',
149
+ $wpdb->prefix . 'wprc_extension_types',
150
+ $wpdb->prefix . 'wprc_extensions',
151
+ $wpdb->prefix . 'wprc_repositories',
152
+ $wpdb->prefix . 'wprc_repositories_relationships',
153
+ );
154
+
155
+ foreach($old_tables as $table){
156
+ $wpdb->query(sprintf("DROP TABLE IF EXISTS %s", $table));
157
+ }
158
+
159
+ }
160
+
161
+ $this->settings['_pre_1_0_clean_up'] = true;
162
+ $this->save_settings();
163
+ }
164
+
165
+ public function setup_plugins_action_links(){
166
+
167
+ $plugins = get_plugins();
168
+
169
+ foreach($this->settings['repositories'] as $repository_id => $repository){
170
+
171
+ foreach($repository['data']['packages'] as $package){
172
+
173
+ foreach($package['products'] as $product){
174
+
175
+ foreach($product['downloads'] as $download){
176
+
177
+ if(!isset($rep_plugins[$download['basename']])){
178
+ $r_plugins[$download['basename']] = $download['name'];
179
+ }
180
+
181
+ }
182
+
183
+ }
184
+
185
+ }
186
+
187
+ $site_key = $this->get_site_key($repository_id);
188
+ $repositories_plugins[$repository_id] = array( 'plugins' => $r_plugins, 'registered' => !empty($site_key));
189
+
190
+ foreach($plugins as $plugin_id => $plugin){
191
+
192
+ foreach($repositories_plugins as $repository_id => $r_plugins){
193
+
194
+ foreach($r_plugins['plugins'] as $basename => $name){
195
+
196
+ if($name == $plugin['Name'] && dirname($plugin_id) == $basename){
197
+
198
+ if($r_plugins['registered']){
199
+ add_filter( 'plugin_action_links_' . $plugin_id, array($this, 'plugins_action_links_registered'));
200
+ }else{
201
+ add_filter( 'plugin_action_links_' . $plugin_id, array($this, 'plugins_action_links_not_registered'));
202
+ }
203
+
204
+ }
205
+
206
+ }
207
+
208
+ }
209
+
210
+ }
211
+
212
+ }
213
+
214
+ }
215
+
216
+ public function plugins_action_links_registered($links){
217
+ $links[] = '<a href="' . $this->menu_url() . '">' . __('Registered', 'installer') . '</a>';
218
+ return $links;
219
+ }
220
+
221
+ public function plugins_action_links_not_registered($links){
222
+ $links[] = '<a href="' . $this->menu_url() . '">' . __('Register', 'installer') . '</a>';
223
+ return $links;
224
+ }
225
+
226
+ public function version(){
227
+ return WP_INSTALLER_VERSION;
228
+ }
229
+
230
+ public function plugin_path() {
231
+ return untrailingslashit( plugin_dir_path( dirname(__FILE__) ) );
232
+ }
233
+
234
+ public function plugin_url() {
235
+ return untrailingslashit( plugins_url( '/', dirname(__FILE__) ) );
236
+ }
237
+
238
+ public function res_url(){
239
+ if(isset($this->config['in_theme_folder']) && !empty($this->config['in_theme_folder'])){
240
+ $url = untrailingslashit(get_template_directory_uri() . '/' . $this->config['in_theme_folder']);
241
+ }else{
242
+ $url = $this->plugin_url();
243
+ }
244
+ return $url;
245
+ }
246
+
247
+ public function save_settings(){
248
+
249
+ $_settings = serialize($this->settings);
250
+ if($this->_gz_on){
251
+ $_settings = gzcompress($_settings);
252
+ }
253
+ $_settings = base64_encode($_settings);
254
+
255
+ update_option( 'wp_installer_settings', $_settings );
256
+
257
+ if( is_multisite() && is_main_site() && isset($this->settings['repositories']) ){
258
+ $network_settings = array();
259
+
260
+ foreach( $this->settings['repositories'] as $rep_id => $repository ){
261
+ if( isset($repository['subscription']) )
262
+ $network_settings[$rep_id] = $repository['subscription'];
263
+ }
264
+
265
+ update_site_option( 'wp_installer_network', $network_settings );
266
+ }
267
+
268
+ }
269
+
270
+ public function get_settings(){
271
+
272
+ $_settings = get_option( 'wp_installer_settings' );
273
+
274
+ if( is_array( $_settings ) || empty( $_settings ) ){ //backward compatibility 1.1
275
+ $settings = $_settings;
276
+ return $settings;
277
+ }else{
278
+ $_settings = base64_decode( $_settings );
279
+ if($this->_gz_on){
280
+ $_settings = gzuncompress( $_settings );
281
+ }
282
+ $settings = unserialize( $_settings );
283
+ }
284
+
285
+ if( is_multisite() && isset($settings['repositories']) ) {
286
+ $network_settings = maybe_unserialize( get_site_option('wp_installer_network') );
287
+ if( $network_settings ){
288
+ foreach( $settings['repositories'] as $rep_id => $repository ) {
289
+ if( isset($network_settings[$rep_id] ) ) {
290
+ $settings['repositories'][$rep_id]['subscription'] = $network_settings[$rep_id];
291
+ }
292
+ }
293
+ }
294
+ }
295
+
296
+ return $settings;
297
+ }
298
+
299
+ public function get_installer_site_url( $repository_id = false ){
300
+ $site_url = get_site_url();
301
+
302
+ if( $repository_id && is_multisite() && isset( $this->settings['repositories'] ) ){
303
+ $network_settings = maybe_unserialize( get_site_option('wp_installer_network') );
304
+
305
+ if ( isset( $network_settings[$repository_id] ) ) {
306
+ $site_url = network_site_url();
307
+ }
308
+ }
309
+
310
+ return $site_url;
311
+ }
312
+
313
+ public function show_site_key_nags(){
314
+ $screen = get_current_screen();
315
+
316
+ if($screen->base == 'settings_page_installer' || ($screen->base == 'plugin-install' && isset($_GET['tab']) && $_GET['tab'] == 'commercial')){
317
+ return;
318
+ }
319
+
320
+ if(!empty($this->config['site_key_nags'])){
321
+
322
+ foreach($this->config['site_key_nags'] as $nag){
323
+
324
+ if(!$this->repository_has_subscription($nag['repository_id'] )){
325
+ $show = true;
326
+ if(!empty($nag['condition_cb'])){
327
+ $show = call_user_func($nag['condition_cb']);
328
+ }
329
+
330
+ if(empty($this->settings['dismissed_nags'][$nag['repository_id']]) && $show){
331
+ echo '<div class="updated error"><p>';
332
+ printf(__("To get automatic updates, you need to register %s for this site. %sRegister %s%s", 'sitepress'),
333
+ $nag['product_name'], '<a class="button-primary" href="' . $this->menu_url() . '">', $nag['product_name'], '</a>');
334
+
335
+ echo '<br /><a class="alignright installer-dismiss-nag" href="#" data-repository="' . $nag['repository_id'] . '">' . __('Dismiss', 'sitepress') . '</a><br clear="all" />';
336
+ echo '</p></div>';
337
+ }
338
+ }
339
+
340
+ }
341
+
342
+ }
343
+
344
+ }
345
+
346
+ public function dismiss_nag(){
347
+ $this->settings['dismissed_nags'][$_POST['repository']] = 1;
348
+
349
+ $this->save_settings();
350
+
351
+ echo json_encode(array());
352
+ exit;
353
+ }
354
+
355
+ public function add_install_plugins_tab($tabs){
356
+
357
+ $tabs['commercial'] = __('Commercial', 'installer');
358
+
359
+ return $tabs;
360
+ }
361
+
362
+ public function load_repositories_list(){
363
+
364
+ $config_file = $this->plugin_path() . '/repositories.xml';
365
+
366
+ if(file_exists($this->plugin_path() . '/repositories.sandbox.xml')){
367
+ $config_file = $this->plugin_path() . '/repositories.sandbox.xml';
368
+ }
369
+
370
+ $repos = simplexml_load_file($config_file);
371
+
372
+ foreach($repos as $repo){
373
+ $id = strval($repo->id);
374
+
375
+ $data['api-url'] = strval($repo->apiurl);
376
+ $data['products'] = strval($repo->products);
377
+
378
+ // excludes rule;
379
+ if(isset($this->config['repositories_exclude']) && in_array($id, $this->config['repositories_exclude'])){
380
+ return;
381
+ }
382
+
383
+ // includes rule;
384
+ if(isset($this->config['repositories_include']) && !in_array($id, $this->config['repositories_include'])){
385
+ return;
386
+ }
387
+
388
+ $this->repositories[$id] = $data;
389
+
390
+
391
+ }
392
+
393
+ }
394
+
395
+ public function filter_repositories_list(){
396
+
397
+ foreach($this->settings['repositories'] as $id => $repo_data){
398
+
399
+ // excludes rule;
400
+ if(isset($this->config['repositories_exclude']) && in_array($id, $this->config['repositories_exclude'])){
401
+ unset($this->settings['repositories'][$id]);
402
+ }
403
+
404
+ // includes rule;
405
+ if(isset($this->config['repositories_include']) && !in_array($id, $this->config['repositories_include'])){
406
+ unset($this->settings['repositories'][$id]);
407
+ }
408
+
409
+
410
+ }
411
+
412
+
413
+ }
414
+
415
+ public function refresh_repositories_data(){
416
+
417
+ foreach($this->repositories as $id => $data){
418
+
419
+ $response = wp_remote_get($data['products']);
420
+
421
+ if(is_wp_error($response)){
422
+ // http fallback
423
+ $data['products'] = preg_replace("@^https://@", 'http://', $data['products']);
424
+ $response = wp_remote_get($data['products']);
425
+ }
426
+
427
+ if(is_wp_error($response)){
428
+ $error = sprintf(__("Can't connect to %s") . "\n", $data['products']);
429
+ if(WP_DEBUG){
430
+ trigger_error($error, E_USER_WARNING);
431
+ }else{
432
+ error_log($error, E_USER_WARNING);
433
+ }
434
+
435
+ continue;
436
+ }
437
+
438
+ if($response && isset($response['response']['code']) && $response['response']['code'] == 200){
439
+ $body = wp_remote_retrieve_body($response);
440
+ if($body){
441
+ $products = json_decode($body, true);
442
+
443
+ if(is_array($products)){
444
+ $this->settings['repositories'][$id]['data'] = $products;
445
+ }
446
+ }
447
+
448
+ }
449
+
450
+ }
451
+
452
+ // cleanup
453
+ if(empty($this->settings['repositories'])){
454
+ $this->settings['repositories'] = array();
455
+ }
456
+ foreach($this->settings['repositories'] as $id => $data){
457
+ if(!in_array($id, array_keys($this->repositories))){
458
+ unset($this->settings['repositories'][$id]);
459
+ }
460
+ }
461
+
462
+ $this->settings['last_repositories_update']= time();
463
+
464
+ $this->save_settings();
465
+
466
+ }
467
+
468
+ public function show_products($args = array()){
469
+
470
+ $screen = get_current_screen();
471
+
472
+ if($screen->base == 'settings_page_installer'){ // settings page
473
+ echo '<div class="wrap">';
474
+ echo '<h2>' . __('Installer', 'installer') . '</h2>';
475
+ echo '<br />';
476
+ }
477
+
478
+ if(!is_array($args)) $args = array();
479
+ if(empty($args['template'])) $args['template'] = 'default';
480
+
481
+ $this->filter_repositories_list();
482
+
483
+ if(!empty($this->settings['repositories'])){
484
+
485
+ $this->localize_strings();
486
+ $this->set_filtered_prices($args);
487
+ $this->set_hierarchy_and_order();
488
+
489
+ foreach($this->settings['repositories'] as $repository_id => $repository){
490
+
491
+ if($args['template'] == 'compact'){
492
+
493
+ if(isset($args['repository']) && $args['repository'] == $repository_id){
494
+ include $this->plugin_path() . '/templates/products-compact.php';
495
+ }
496
+
497
+ }else{
498
+
499
+ include $this->plugin_path() . '/templates/repository-listing.php';
500
+
501
+ }
502
+
503
+ unset($site_key, $subscription_type, $expired, $upgrade_options, $products_avaliable);
504
+
505
+ }
506
+
507
+ }else{
508
+
509
+ echo '<center>' . __('No repositories defined.', 'installer') . '</center>';
510
+
511
+ }
512
+
513
+ if($screen->base == 'settings_page_installer'){ // settings page
514
+ echo '</div>';
515
+ }
516
+
517
+
518
+ }
519
+
520
+ private function _render_product_packages($packages, $subscription_type, $expired, $upgrade_options){
521
+
522
+ $data = array();
523
+
524
+ foreach($packages as $package_id => $package){
525
+
526
+ $row = array('products' => array(), 'downloads' => array());
527
+ foreach($package['products'] as $product){
528
+
529
+ // buy base
530
+ if(empty($subscription_type) || $expired) {
531
+
532
+ $p['url'] = $this->append_parameters_to_buy_url($product['url']);
533
+ if (!empty($product['price_disc'])) {
534
+ $p['label'] = $product['call2action'] . ' - ' . sprintf('$%s %s$%d%s (USD)', $product['price_disc'], '&nbsp;&nbsp;<del>', $product['price'], '</del>');
535
+ } else {
536
+ $p['label'] = $product['call2action'] . ' - ' . sprintf('$%d (USD)', $product['price']);
537
+ }
538
+ $row['products'][] = $p;
539
+
540
+ // renew
541
+ } elseif(isset($subscription_type) && $product['subscription_type'] == $subscription_type){
542
+
543
+ if($product['renewals']) {
544
+ foreach ($product['renewals'] as $renewal) {
545
+ $p['url'] = $this->append_parameters_to_buy_url($renewal['url']);
546
+ $p['label'] = $renewal['call2action'] . ' - ' . sprintf('$%d (USD)', $renewal['price']);
547
+ }
548
+
549
+ $row['products'][] = $p;
550
+ }
551
+
552
+ }
553
+
554
+ // upgrades
555
+ if(!empty($upgrade_options[$product['subscription_type']])){
556
+
557
+ foreach($upgrade_options[$product['subscription_type']] as $stype => $upgrade){
558
+ if($stype != $subscription_type) continue;
559
+
560
+ $p['url'] = $this->append_parameters_to_buy_url($upgrade['url']);
561
+ if (!empty($upgrade['price_disc'])) {
562
+ $p['label'] = $upgrade['call2action'] . ' - ' . sprintf('$%s %s$%d%s (USD)', $upgrade['price_disc'], '&nbsp;&nbsp;<del>', $upgrade['price'], '</del>');
563
+ } else {
564
+ $p['label'] = $upgrade['call2action'] . ' - ' . sprintf('$%d (USD)', $upgrade['price']);
565
+ }
566
+ $row['products'][] = $p;
567
+
568
+ }
569
+
570
+ }
571
+
572
+ // downloads
573
+ if(isset($subscription_type) && !$expired && $product['subscription_type'] == $subscription_type){
574
+ $row['downloads'] = $product['downloads'];
575
+ }
576
+
577
+ //subpackages
578
+ if(!empty($package['sub-packages'])){
579
+ $row['sub-packages'] = $package['sub-packages'];
580
+ }
581
+
582
+ }
583
+
584
+ $row['image_url'] = $package['image_url'];
585
+ $row['name'] = $package['name'];
586
+ $row['description'] = $package['description'];
587
+
588
+ if(!empty($row['products']) || !empty($row['downloads']) || !empty($row['sub-packages'])){
589
+ $data[] = $row;
590
+ }
591
+
592
+
593
+ }
594
+
595
+ return $data;
596
+
597
+ }
598
+
599
+ public function append_parameters_to_buy_url($url, $args = array()){
600
+
601
+ $url = add_query_arg( array('icl_site_url' => $this->get_installer_site_url() ), $url );
602
+
603
+ $affiliate_id = false;
604
+ $affiliate_key = false;
605
+
606
+ if(isset($this->config['affiliate_id']) && isset($this->config['affiliate_key'])){
607
+
608
+ $affiliate_id = $this->config['affiliate_id'];
609
+ $affiliate_key = $this->config['affiliate_key'];
610
+
611
+ }elseif(isset($args['affiliate_id']) && isset($args['affiliate_key'])){
612
+
613
+ $affiliate_id = $args['affiliate_id'];
614
+ $affiliate_key = $args['affiliate_key'];
615
+
616
+ }elseif(defined('ICL_AFFILIATE_ID') && defined('ICL_AFFILIATE_KEY')){
617
+
618
+ $affiliate_id = ICL_AFFILIATE_ID;
619
+ $affiliate_key = ICL_AFFILIATE_KEY;
620
+
621
+ }
622
+
623
+ if($affiliate_id && $affiliate_key){
624
+ $url = add_query_arg(array('affiliate_id' => $affiliate_id, 'affiliate_key' => $affiliate_key), $url);
625
+ }
626
+
627
+ return $url;
628
+
629
+ }
630
+
631
+ public function save_site_key($args = array()){
632
+
633
+ $error = '';
634
+
635
+ $repository_id = isset($args['repository_id']) ? $args['repository_id'] : (isset($_POST['repository_id']) ? $_POST['repository_id'] : false);
636
+ $nonce = isset($args['nonce']) ? $args['nonce'] : (isset($_POST['nonce']) ? $_POST['nonce'] : '');
637
+ $site_key = isset($args['site_key']) ? $args['site_key'] : $_POST['site_key_' . $repository_id];
638
+
639
+ $site_key = preg_replace("/[^A-Za-z0-9]/", '', $site_key);
640
+
641
+ if($repository_id && $nonce && wp_create_nonce('save_site_key_' . $repository_id) == $nonce){
642
+
643
+ $subscription_data = $this->fetch_subscription_data($repository_id, $site_key);
644
+
645
+ if($subscription_data){
646
+ $this->settings['repositories'][$repository_id]['subscription'] = array('key' => $site_key, 'data' => $subscription_data);
647
+ $this->save_settings();
648
+ }else{
649
+
650
+ $error = __('Invalid site key for the current site.', 'installer');
651
+
652
+ }
653
+
654
+ }
655
+
656
+ $return = array('error' => $error);
657
+
658
+ if($this->api_debug){
659
+ $return['debug'] = $this->api_debug;
660
+ }
661
+
662
+ if(!empty($args['return'])){
663
+ return $return;
664
+ }else{
665
+ echo json_encode($return);
666
+ exit;
667
+ }
668
+
669
+ }
670
+
671
+ public function get_site_key($repository_id){
672
+
673
+ if(isset($this->settings['repositories'][$repository_id]['subscription'])){
674
+ $site_key = $this->settings['repositories'][$repository_id]['subscription']['key'];
675
+ }else{
676
+ $site_key = false;
677
+ }
678
+
679
+ return $site_key;
680
+ }
681
+
682
+ public function remove_site_key(){
683
+ if($_POST['nonce'] == wp_create_nonce('remove_site_key_' . $_POST['repository_id'])){
684
+ unset($this->settings['repositories'][$_POST['repository_id']]['subscription']);
685
+ $this->save_settings();
686
+
687
+ $this->refresh_repositories_data();
688
+ }
689
+ exit;
690
+ }
691
+
692
+ public function update_site_key(){
693
+
694
+ $error = '';
695
+
696
+ if($_POST['nonce'] == wp_create_nonce('update_site_key_' . $_POST['repository_id'])){
697
+
698
+ $repository_id = $_POST['repository_id'];
699
+ $site_key = $this->get_site_key($_POST['repository_id']);
700
+
701
+ if($site_key){
702
+ $subscription_data = $this->fetch_subscription_data($repository_id, $site_key);
703
+
704
+ if($subscription_data){
705
+ $this->settings['repositories'][$repository_id]['subscription'] = array('key' => $site_key, 'data' => $subscription_data);
706
+ }else{
707
+ unset($this->settings['repositories'][$repository_id]['subscription']);
708
+ $error = __('Invalid site key for the current site.', 'installer');
709
+ }
710
+
711
+ $this->save_settings();
712
+
713
+ }
714
+
715
+ }
716
+
717
+ echo json_encode(array('error' => $error));
718
+
719
+ exit;
720
+ }
721
+
722
+ public function api_debug_log($text){
723
+
724
+ if(defined('WPML_DEBUG_INSTALLER') && WPML_DEBUG_INSTALLER){
725
+
726
+ if(!is_scalar($text)){
727
+ $text = print_r($text, 1);
728
+ }
729
+
730
+ $this->api_debug .= $text . "\n";
731
+
732
+ }
733
+
734
+ }
735
+
736
+ public function fetch_subscription_data($repository_id, $site_key){
737
+
738
+ $subscription_data = false;
739
+
740
+ $args['body'] = array('action' => 'site_key_validation', 'site_key' => $site_key, 'site_url' => $this->get_installer_site_url($repository_id) );
741
+ $response = wp_remote_post($this->repositories[$repository_id]['api-url'], $args);
742
+
743
+ $this->api_debug_log("POST {$this->repositories[$repository_id]['api-url']}");
744
+ $this->api_debug_log($args);
745
+
746
+ if(!is_wp_error($response)){
747
+ $datas = wp_remote_retrieve_body($response);
748
+
749
+ if(is_serialized($datas)){
750
+ $data = unserialize($datas);
751
+ $this->api_debug_log($data);
752
+ }else{
753
+ $this->api_debug_log($datas);
754
+ }
755
+
756
+ if(!empty($data->subscription_data)){
757
+ $subscription_data = $data->subscription_data;
758
+ }
759
+ }else{
760
+
761
+ $this->api_debug_log($response);
762
+
763
+ }
764
+
765
+ return $subscription_data;
766
+
767
+ }
768
+
769
+ public function repository_has_valid_subscription($repository_id){
770
+
771
+ $valid = false;
772
+
773
+ if(!empty($this->settings['repositories'][$repository_id]['subscription'])){
774
+
775
+ $subscription = $this->settings['repositories'][$repository_id]['subscription']['data'];
776
+ $valid = ( $subscription->status == 1 && (strtotime($subscription->expires) > time() || empty($subscription->expires)) ) || $subscription->status == 4;
777
+
778
+ }
779
+ return $valid;
780
+
781
+ }
782
+
783
+ public function repository_has_subscription($repository_id){
784
+ $key = false;
785
+ if(!empty($this->settings['repositories'][$repository_id]['subscription']['key'])){
786
+ $key = $this->settings['repositories'][$repository_id]['subscription']['key'];
787
+ }
788
+
789
+ return $key;
790
+
791
+ }
792
+
793
+ public function repository_has_expired_subscription($repository_id){
794
+
795
+ return $this->repository_has_subscription($repository_id) && !$this->repository_has_valid_subscription($repository_id);
796
+
797
+ }
798
+
799
+ public function show_subscription_renew_warning($repository_id, $subscription_id){
800
+
801
+ $show = false;
802
+
803
+ $data = $this->settings['repositories'][$repository_id]['data'];
804
+ if(!empty($data['subscriptions_meta'])){
805
+ if(isset($data['subscriptions_meta']['expiration'])){
806
+
807
+ if(!empty($data['subscriptions_meta']['expiration'][$subscription_id])){
808
+
809
+ $days = $data['subscriptions_meta']['expiration'][$subscription_id]['days_warning'];
810
+ $message = $data['subscriptions_meta']['expiration'][$subscription_id]['warning_message'];
811
+
812
+ }else{
813
+
814
+ //defaults
815
+ $days = 30;
816
+ $message = __('You will have to renew your subscription in order to continue getting the updates and support.', 'installer');
817
+
818
+ }
819
+
820
+ if(!empty($this->settings['repositories'][$repository_id]['subscription'])){
821
+ $subscription = $this->settings['repositories'][$repository_id]['subscription'];
822
+
823
+ if($subscription['data']->subscription_type == $subscription_id && !empty($subscription['data']->expires)){
824
+
825
+ if(strtotime($subscription['data']->expires) < strtotime(sprintf("+%d day", $days))){
826
+
827
+ $days_to_expiration = ceil((strtotime($subscription['data']->expires) - time()) / 86400);
828
+
829
+ echo '<div><p class="installer-warn-box">' .
830
+ sprintf(_n('Your subscription expires in %d day.', 'Your subscription expires in %d days.', $days_to_expiration, 'installer'), $days_to_expiration) .
831
+ '<br />' . $message .
832
+ '</p></div>';
833
+
834
+ $show = true;
835
+
836
+ }
837
+
838
+ }
839
+
840
+ }
841
+
842
+
843
+ }
844
+ }
845
+
846
+
847
+ return $show;
848
+
849
+ }
850
+
851
+ public function setup_plugins_renew_warnings(){
852
+
853
+ $plugins = get_plugins();
854
+
855
+ $subscriptions_with_warnings = array();
856
+ foreach($this->settings['repositories'] as $repository_id => $repository){
857
+
858
+ if($this->repository_has_valid_subscription($repository_id)){
859
+ $subscription_type = $this->settings['repositories'][$repository_id]['subscription']['data']->subscription_type;
860
+ $expires = $this->settings['repositories'][$repository_id]['subscription']['data']->expires;
861
+
862
+ $never_expires = isset($this->settings['repositories'][$repository_id]['subscription'])
863
+ && empty($this->settings['repositories'][$repository_id]['subscription']['data']->expires)
864
+ && (
865
+ $this->settings['repositories'][$repository_id]['subscription']['data']->status == 4 ||
866
+ $this->settings['repositories'][$repository_id]['subscription']['data']->status == 1
867
+ );
868
+
869
+ if(!$never_expires){
870
+ if(isset($this->settings['repositories'][$repository_id]['data']['subscriptions_meta']['expiration'][$subscription_type])){
871
+
872
+ $days_warning = $this->settings['repositories'][$repository_id]['data']['subscriptions_meta']['expiration'][$subscription_type]['days_warning'];
873
+ $custom_message = $this->settings['repositories'][$repository_id]['data']['subscriptions_meta']['expiration'][$subscription_type]['warning_message'];
874
+
875
+ }else{
876
+ //defaults
877
+ $days_warning = 30;
878
+ $custom_message = __('You will have to renew your subscription in order to continue getting the updates and support.', 'installer');
879
+ }
880
+
881
+ if(strtotime($expires) < strtotime(sprintf('+%d day', $days_warning)) ){
882
+
883
+ $days_to_expiration = ceil((strtotime($expires) - time()) / 86400);
884
+
885
+ $message = sprintf(_n('Your subscription expires in %d day.', 'Your subscription expires in %d days.', $days_to_expiration, 'installer'), $days_to_expiration);
886
+ $subscriptions_with_warnings[$subscription_type] = $message . ' ' . $custom_message;
887
+
888
+ }
889
+ }
890
+
891
+ }
892
+
893
+ }
894
+
895
+
896
+
897
+ foreach($plugins as $plugin_id => $plugin){
898
+ $slug = dirname($plugin_id);
899
+ if(empty($slug)) continue;
900
+
901
+ $name = $plugin['Name'];
902
+
903
+ foreach($this->settings['repositories'] as $repository_id => $repository){
904
+
905
+ if($this->repository_has_valid_subscription($repository_id)){
906
+
907
+ foreach($repository['data']['packages'] as $package){
908
+
909
+ foreach($package['products'] as $product){
910
+
911
+ foreach($product['downloads'] as $download){
912
+
913
+ if($download['name'] == $name && $download['basename'] == $slug){
914
+
915
+ if(isset($subscriptions_with_warnings[$product['subscription_type']])){
916
+
917
+ $this->_plugins_renew_warnings[$plugin_id] = $subscriptions_with_warnings[$product['subscription_type']];
918
+
919
+ }
920
+
921
+ }
922
+
923
+ }
924
+
925
+ }
926
+
927
+ }
928
+
929
+ }
930
+
931
+ }
932
+
933
+ }
934
+
935
+ }
936
+
937
+ public function queue_plugins_renew_warnings() {
938
+
939
+ if(!empty($this->_plugins_renew_warnings)){
940
+
941
+ foreach($this->_plugins_renew_warnings as $plugin_id => $message){
942
+
943
+ add_action( "after_plugin_row_" . $plugin_id, array($this, 'plugins_renew_warning'), 10, 3 );
944
+ }
945
+
946
+ }
947
+
948
+ }
949
+
950
+ public function plugins_renew_warning($plugin_file, $plugin_data, $status){
951
+
952
+ if(empty($this->_plugins_renew_warnings[$plugin_file])) return;
953
+
954
+ $wp_list_table = _get_list_table('WP_Plugins_List_Table');
955
+ ?>
956
+
957
+ <tr class="plugin-update-tr"><td colspan="<?php echo $wp_list_table->get_column_count(); ?>" class="plugin-update colspanchange">
958
+ <div class="update-message">
959
+ <?php
960
+ echo $this->_plugins_renew_warnings[$plugin_file]. ' ';
961
+ printf(__('%sRenew here%s.', 'installer'),
962
+ '<a href="' . $this->menu_url() . '">', '</a>');
963
+ ?>
964
+ </div>
965
+ </tr>
966
+
967
+ <?php
968
+
969
+ }
970
+
971
+ public function get_subscription_type_for_repository($repository_id){
972
+
973
+ $subscription_type = false;
974
+
975
+ if(!empty($this->settings['repositories'][$repository_id]['subscription'])){
976
+ $subscription_type = $this->settings['repositories'][$repository_id]['subscription']['data']->subscription_type;
977
+ }
978
+
979
+ return $subscription_type;
980
+
981
+ }
982
+
983
+ public function have_superior_subscription($subscription_type, $product){
984
+
985
+ $have = false;
986
+
987
+ if(is_array($product['upgrades'])){
988
+ foreach($product['upgrades'] as $u){
989
+ if($u['subscription_type'] == $subscription_type){
990
+ $have = true;
991
+ break;
992
+ }
993
+ }
994
+ }
995
+
996
+ return $have;
997
+ }
998
+
999
+ public function get_upgrade_options($repository_id){
1000
+ $all_upgrades = array();
1001
+
1002
+ //get all products: packages and subpackages
1003
+ $all_products = array();
1004
+ foreach($this->settings['repositories'][$repository_id]['data']['packages'] as $package){
1005
+ foreach($package['products'] as $product) {
1006
+ $all_products[] = $product;
1007
+ }
1008
+ if(!empty($package['sub-packages'])){
1009
+ foreach($package['sub-packages'] as $subpackage){
1010
+ foreach($subpackage['products'] as $product) {
1011
+ $all_products[] = $product;
1012
+ }
1013
+
1014
+ }
1015
+
1016
+ }
1017
+
1018
+ }
1019
+
1020
+ foreach($all_products as $product) {
1021
+ if ($product['upgrades']) {
1022
+ foreach ($product['upgrades'] as $upgrade) {
1023
+ if ($this->repository_has_valid_subscription($repository_id) || ($this->repository_has_subscription($repository_id) && $upgrade['including_expired'])) {
1024
+ $all_upgrades[$upgrade['subscription_type']][$product['subscription_type']] = $upgrade;
1025
+ }
1026
+ }
1027
+ }
1028
+ }
1029
+
1030
+ return $all_upgrades;
1031
+
1032
+ }
1033
+
1034
+ public function append_site_key_to_download_url($url, $key, $repository_id){
1035
+
1036
+ $url = add_query_arg(array('site_key' => $key, 'site_url' => $this->get_installer_site_url($repository_id) ), $url);
1037
+
1038
+ return $url;
1039
+
1040
+ }
1041
+
1042
+ public function plugin_is_installed($name, $folder, $version = null){
1043
+
1044
+ $is = false;
1045
+
1046
+ $plugins = get_plugins();
1047
+
1048
+ foreach($plugins as $plugin_id => $plugin){
1049
+
1050
+ if($plugin['Name'] == $name && dirname($plugin_id) == $folder){
1051
+
1052
+ if($version){
1053
+ if(version_compare($plugin['Version'], $version, '>=')){
1054
+ $is = $plugin['Version'];
1055
+ }
1056
+ }else{
1057
+ $is = $plugin['Version'];
1058
+ }
1059
+
1060
+ break;
1061
+ }
1062
+
1063
+ }
1064
+
1065
+ return $is;
1066
+ }
1067
+
1068
+ public function download_plugin(){
1069
+
1070
+ require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
1071
+ require_once $this->plugin_path() . '/includes/installer-upgrader-skins.php';
1072
+
1073
+ if(isset($_POST['data'])){
1074
+ $data = json_decode( base64_decode( $_POST['data'] ), true );
1075
+ }
1076
+
1077
+ $ret = false;
1078
+ $plugin_id = false;
1079
+
1080
+ if($data['nonce'] == wp_create_nonce('install_plugin_' . $data['url'])){
1081
+
1082
+ $upgrader_skins = new Installer_Upgrader_Skins(); //use our custom (mute) Skin
1083
+ $upgrader = new Plugin_Upgrader($upgrader_skins);
1084
+
1085
+ remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
1086
+
1087
+ $plugins = get_plugins();
1088
+
1089
+ //upgrade or install?
1090
+ foreach($plugins as $id => $plugin){
1091
+ if(dirname($id) == $data['basename']){
1092
+ $plugin_id = $id;
1093
+ break;
1094
+ }
1095
+ }
1096
+
1097
+ if($plugin_id){ //upgrade
1098
+ $response['upgrade'] = 1;
1099
+
1100
+ $plugin_is_active = is_plugin_active($plugin_id);
1101
+
1102
+ $ret = $upgrader->upgrade($plugin_id);
1103
+
1104
+ if($plugin_is_active){
1105
+ activate_plugin($plugin_id);
1106
+ }
1107
+
1108
+ }else{ //install
1109
+
1110
+ $response['install'] = 1;
1111
+ $ret = $upgrader->install($data['url']);
1112
+ }
1113
+
1114
+ $plugins = get_plugins(); //read again
1115
+ if($ret && !empty($_POST['activate'])){
1116
+ foreach($plugins as $id => $plugin){
1117
+ if(dirname($id) == $data['basename']){
1118
+ $plugin_version = $plugin['Version'];
1119
+ $plugin_id = $id;
1120
+ break;
1121
+ }
1122
+ }
1123
+
1124
+ }
1125
+
1126
+ }
1127
+
1128
+ $response['version'] = isset($plugin_version) ? $plugin_version : 0;
1129
+ $response['plugin_id'] = $plugin_id;
1130
+ $response['nonce'] = wp_create_nonce('activate_' . $plugin_id);
1131
+ $response['success'] = $ret;
1132
+
1133
+ echo json_encode( $response );
1134
+ exit;
1135
+
1136
+ }
1137
+
1138
+ public function activate_plugin(){
1139
+
1140
+ $error = '';
1141
+
1142
+ if(isset($_POST['nonce']) && isset($_POST['plugin_id']) && $_POST['nonce'] == wp_create_nonce('activate_' . $_POST['plugin_id'])){
1143
+
1144
+ $plugin_id = $_POST['plugin_id'];
1145
+ $return = activate_plugin($plugin_id);
1146
+
1147
+ if(is_wp_error($return)){
1148
+ $error = $return->get_error_message();
1149
+ }
1150
+
1151
+ }else{
1152
+ $error = 'error';
1153
+ }
1154
+
1155
+ $ret = array('error' => $error);
1156
+
1157
+ echo json_encode($ret);
1158
+ exit;
1159
+
1160
+ }
1161
+
1162
+ public function custom_plugins_api_call($false = false, $action, $args){
1163
+
1164
+ if($action == 'plugin_information'){
1165
+
1166
+ $slug = $args->slug;
1167
+
1168
+ foreach($this->settings['repositories'] as $repository_id => $repository){
1169
+
1170
+ foreach($repository['data']['packages'] as $package){
1171
+
1172
+ foreach($package['products'] as $product){
1173
+
1174
+ foreach($product['downloads'] as $download){
1175
+
1176
+ if($download['basename'] == $slug){
1177
+
1178
+ $res = new stdClass();
1179
+ $res->external = true;
1180
+
1181
+ $res->name = $download['name'];
1182
+ $res->slug = $slug;
1183
+ $res->version = $download['version'];
1184
+ $res->author = '';
1185
+ $res->author_profile = '';
1186
+ $res->last_updated = $download['date'];
1187
+ //$res->homepage = $download['url'];
1188
+ $res->homepage = $repository['data']['url'];
1189
+ $res->sections = array('Description' => $download['description'], 'Changelog' => $download['changelog']);
1190
+
1191
+ return $res;
1192
+
1193
+ }
1194
+
1195
+ }
1196
+
1197
+ }
1198
+
1199
+ }
1200
+
1201
+ }
1202
+
1203
+ }
1204
+
1205
+ return false;
1206
+
1207
+ }
1208
+
1209
+ public function plugins_upgrade_check($update_plugins){
1210
+
1211
+ $this->refresh_repositories_data();
1212
+
1213
+ if(!empty($this->settings['repositories'])){
1214
+ $plugins = get_plugins();
1215
+
1216
+ foreach($plugins as $plugin_id => $plugin){
1217
+
1218
+ $slug = dirname($plugin_id);
1219
+ if(empty($slug)) continue;
1220
+
1221
+ $version = $plugin['Version'];
1222
+ $name = $plugin['Name'];
1223
+
1224
+ foreach($this->settings['repositories'] as $repository_id => $repository){
1225
+
1226
+ if(!$this->repository_has_valid_subscription($repository_id)){
1227
+ $site_key = false;
1228
+ }else{
1229
+ $site_key = $repository['subscription']['key'];
1230
+ //$subscription_type = $this->get_subscription_type_for_repository($repository_id);
1231
+ }
1232
+
1233
+ foreach($repository['data']['packages'] as $package){
1234
+
1235
+ foreach($package['products'] as $product){
1236
+
1237
+ foreach($product['downloads'] as $download){
1238
+
1239
+ if(empty($update_plugins->response[$plugin_id]) && $download['name'] == $name && $download['basename'] == $slug && version_compare($download['version'], $version, '>')){
1240
+
1241
+ $response = new stdClass();
1242
+ $response->id = 0;
1243
+ $response->slug = $slug;
1244
+ $response->plugin = $plugin_id;
1245
+ $response->new_version = $download['version'];
1246
+ $response->upgrade_notice = '';
1247
+ $response->url = $download['url'];
1248
+ if($site_key){
1249
+ $response->package = $this->append_site_key_to_download_url($download['url'], $site_key, $repository_id);
1250
+ }
1251
+ $update_plugins->checked[$plugin_id] = $version;
1252
+ $update_plugins->response[$plugin_id] = $response;
1253
+
1254
+ }
1255
+
1256
+ }
1257
+
1258
+ }
1259
+
1260
+ }
1261
+
1262
+ }
1263
+
1264
+ }
1265
+
1266
+ }
1267
+
1268
+ return $update_plugins;
1269
+
1270
+ }
1271
+
1272
+ public function setup_plugins_page_notices(){
1273
+
1274
+ $plugins = get_plugins();
1275
+
1276
+ foreach($plugins as $plugin_id => $plugin){
1277
+
1278
+ $slug = dirname($plugin_id);
1279
+ if(empty($slug)) continue;
1280
+
1281
+ $name = $plugin['Name'];
1282
+
1283
+ foreach($this->settings['repositories'] as $repository_id => $repository){
1284
+
1285
+ if(!$this->repository_has_valid_subscription($repository_id)){
1286
+ $site_key = false;
1287
+ }else{
1288
+ $site_key = $repository['subscription']['key'];
1289
+ }
1290
+
1291
+ foreach($repository['data']['packages'] as $package){
1292
+
1293
+ foreach($package['products'] as $product){
1294
+
1295
+ foreach($product['downloads'] as $download){
1296
+
1297
+ if($download['name'] == $name && $download['basename'] == $slug){
1298
+
1299
+ if(!$site_key){
1300
+ add_action( "after_plugin_row_" . $plugin_id, array($this, 'show_purchase_notice_under_plugin'), 10, 3 );
1301
+ }
1302
+
1303
+ }
1304
+
1305
+ }
1306
+
1307
+ }
1308
+
1309
+ }
1310
+
1311
+ }
1312
+
1313
+ }
1314
+
1315
+ }
1316
+
1317
+ public function show_purchase_notice_under_plugin($plugin_file, $plugin_data, $status){
1318
+
1319
+ $wp_list_table = _get_list_table('WP_Plugins_List_Table');
1320
+ ?>
1321
+
1322
+ <tr class="plugin-update-tr"><td colspan="<?php echo $wp_list_table->get_column_count(); ?>" class="plugin-update colspanchange">
1323
+ <div class="update-message installer-q-icon">
1324
+ <?php
1325
+ printf(__('You need to have a valid subscription in order to get upgrades or support for this plugin. %sPurchase a subscription or enter an existing site key%s.', 'installer'),
1326
+ '<a href="' . $this->menu_url() . '">', '</a>');
1327
+ ?>
1328
+ </div>
1329
+ </tr>
1330
+
1331
+ <?php
1332
+
1333
+ }
1334
+
1335
+ public function localize_strings(){
1336
+ global $sitepress;
1337
+
1338
+
1339
+
1340
+ if(!empty($this->settings['repositories'])){
1341
+ foreach($this->settings['repositories'] as $repository_id => $repository){
1342
+ //set name as call2action when don't have any
1343
+ //products
1344
+ foreach($repository['data']['packages'] as $package_id => $package){
1345
+ foreach($package['products'] as $product_id => $product){
1346
+ if(empty($product['call2action'])){
1347
+ $this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['products'][$product_id]['call2action'] = $product['name'];
1348
+ }
1349
+
1350
+ foreach($product['upgrades'] as $idx => $upg){
1351
+ if(empty($upg['call2action'])){
1352
+ $this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['products'][$product_id]['upgrades'][$idx]['call2action'] = $upg['name'];
1353
+ }
1354
+ }
1355
+
1356
+ foreach($product['renewals'] as $idx => $rnw){
1357
+ if(empty($rnw['call2action'])){
1358
+ $this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['products'][$product_id]['renewals'][$idx]['call2action'] = $rnw['name'];
1359
+ }
1360
+
1361
+ }
1362
+
1363
+ }
1364
+ }
1365
+ }
1366
+ }
1367
+
1368
+ if(is_null($sitepress)) return;
1369
+
1370
+ // default strings are always in English
1371
+ $user_admin_language = $sitepress->get_admin_language();
1372
+
1373
+ if($user_admin_language != 'en'){
1374
+ foreach($this->settings['repositories'] as $repository_id => $repository){
1375
+
1376
+ $localization = $repository['data']['localization'];
1377
+
1378
+ //packages
1379
+ foreach($repository['data']['packages'] as $package_id => $package){
1380
+
1381
+ if( isset($localization['packages'][$package_id]['name'][$user_admin_language]) ){
1382
+ $this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['name'] = $localization['packages'][$package_id]['name'][$user_admin_language];
1383
+ }
1384
+ if( isset($localization['packages'][$package_id]['description'][$user_admin_language]) ){
1385
+ $this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['description'] = $localization['packages'][$package_id]['description'][$user_admin_language];
1386
+ }
1387
+
1388
+ }
1389
+
1390
+ //products
1391
+ foreach($repository['data']['packages'] as $package_id => $package){
1392
+ foreach($package['products'] as $product_id => $product){
1393
+
1394
+ if( isset($localization['products'][$product_id]['name'][$user_admin_language]) ){
1395
+ $this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['products'][$product_id]['name']
1396
+ = $localization['products'][$product_id]['name'][$user_admin_language];
1397
+ }
1398
+ if( isset($localization['products'][$product_id]['description'][$user_admin_language]) ){
1399
+ $this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['products'][$product_id]['description']
1400
+ = $localization['products'][$product_id]['description'][$user_admin_language];
1401
+ }
1402
+ if( isset($localization['products'][$product_id]['call2action'][$user_admin_language]) ){
1403
+ $this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['products'][$product_id]['name']
1404
+ = $localization['products'][$product_id]['call2action'][$user_admin_language];
1405
+ }
1406
+
1407
+
1408
+ }
1409
+ }
1410
+
1411
+ //subscription info
1412
+ if(isset($repository['data']['subscriptions_meta']['expiration'])){
1413
+ foreach($repository['data']['subscriptions_meta']['expiration'] as $subscription_id => $note){
1414
+ if(isset($localization['subscriptions-notes'][$subscription_id]['expiration-warning'][$user_admin_language])){
1415
+ $this->settings['repositories'][$repository_id]['data']['subscriptions_meta']['expiration'][$subscription_id]['warning_message']
1416
+ = $localization['subscriptions-notes'][$subscription_id]['expiration-warning'][$user_admin_language];
1417
+ }
1418
+ }
1419
+ }
1420
+
1421
+ }
1422
+ }
1423
+
1424
+ }
1425
+
1426
+ public function get_matching_cp($repository, $args = array()){
1427
+ $match = false;
1428
+
1429
+
1430
+ $cp_name = $cp_author = false;
1431
+
1432
+ if(isset($this->config['src_name']) && isset($this->config['src_author'])){
1433
+
1434
+ $cp_name = $this->config['src_name'];
1435
+ $cp_author = $this->config['src_author'];
1436
+
1437
+ }elseif(isset($args['src_name']) && isset($args['src_author'])){
1438
+
1439
+ $cp_name = $args['src_name'];
1440
+ $cp_author = $args['src_author'];
1441
+
1442
+ }
1443
+
1444
+ if(isset($repository['data']['marketing_cp'])){
1445
+
1446
+ foreach($repository['data']['marketing_cp'] as $cp){
1447
+
1448
+ if(!empty($cp['exp']) && time() > $cp['exp']){
1449
+ continue;
1450
+ }
1451
+
1452
+ //Use theme_name for plugins too
1453
+ if(!empty($cp['theme_name'])){
1454
+ if($cp['author_name'] == $cp_author && $cp['theme_name'] == $cp_name){
1455
+ $match = $cp;
1456
+ continue;
1457
+ }
1458
+ }else{
1459
+ if($cp['author_name'] == $cp_author){
1460
+ $match = $cp;
1461
+ continue;
1462
+ }
1463
+ }
1464
+
1465
+ }
1466
+
1467
+ }
1468
+
1469
+ return $match;
1470
+ }
1471
+
1472
+ public function set_filtered_prices($args = array()){
1473
+
1474
+ foreach($this->settings['repositories'] as $repository_id => $repository){
1475
+
1476
+ $match = $this->get_matching_cp($repository, $args);
1477
+
1478
+ if(empty($match)) continue;
1479
+
1480
+ foreach($repository['data']['packages'] as $package_id => $package){
1481
+
1482
+ foreach($package['products'] as $product_id => $product){
1483
+
1484
+ $fprice = false;
1485
+ if($match['dtp'] == '%'){
1486
+ $fprice = round( $product['price'] * (1 - $match['amt']/100), 2 );
1487
+ $fprice = $fprice != round($fprice) ? sprintf('%.2f', $fprice) : round($fprice, 0);
1488
+ }elseif($match['dpt'] == '-'){
1489
+ $fprice = $product['price'] - $match['amt'];
1490
+ }
1491
+
1492
+ if($fprice){
1493
+ $this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['products'][$product_id]['price_disc'] = $fprice;
1494
+
1495
+ $url_glue = false !== strpos($this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['products'][$product_id]['url'], '?') ? '&' : '?';
1496
+ $cpndata = base64_encode(json_encode(array('theme_author' => $match['author_name'], 'theme_name' => $match['theme_name'], 'vlc' => $match['vlc'])));
1497
+ $this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['products'][$product_id]['url'] .= $url_glue . 'cpn=' . $cpndata;
1498
+
1499
+ foreach($product['upgrades'] as $upgrade_id => $upgrade){
1500
+
1501
+ $fprice = false;
1502
+ if($match['dtp'] == '%'){
1503
+ $fprice = round( $upgrade['price'] * (1 - $match['amt']/100), 2 );
1504
+ $fprice = $fprice != round($fprice) ? sprintf('%.2f', $fprice) : round($fprice, 0);
1505
+ }elseif($match['dpt'] == '-'){
1506
+ $fprice = $upgrade['price'] - $match['amt'];
1507
+ }
1508
+ if($fprice){
1509
+ $this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['products'][$product_id]['upgrades'][$upgrade_id]['price_disc'] = $fprice;
1510
+ $this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['products'][$product_id]['upgrades'][$upgrade_id]['url'] .= $url_glue . 'cpn=' . $cpndata;
1511
+ }
1512
+
1513
+
1514
+ }
1515
+
1516
+ }
1517
+
1518
+ }
1519
+
1520
+ }
1521
+
1522
+ }
1523
+
1524
+ }
1525
+
1526
+ public function set_hierarchy_and_order(){
1527
+
1528
+ //2 levels
1529
+ if(!empty($this->settings['repositories'])) {
1530
+ foreach ($this->settings['repositories'] as $repository_id => $repository) {
1531
+
1532
+ if( empty( $repository['data']['packages'] ) ) continue;
1533
+
1534
+ $all_packages = $repository['data']['packages'];
1535
+ $ordered_packages = array();
1536
+
1537
+ //backward compatibility - 'order'
1538
+ foreach($all_packages as $k => $v){
1539
+ if(!isset($v['order'])){
1540
+ $all_packages[$k]['order'] = 0;
1541
+ }
1542
+ }
1543
+
1544
+ //select parents
1545
+ foreach ($all_packages as $package_id => $package) {
1546
+ if(empty($package['parent'])){
1547
+ $ordered_packages[$package_id] = $package;
1548
+ }
1549
+ }
1550
+
1551
+ //add sub-packages
1552
+ foreach($all_packages as $package_id => $package){
1553
+ if(!empty($package['parent'])) {
1554
+ if(isset($ordered_packages[$package['parent']])){
1555
+ $ordered_packages[$package['parent']]['sub-packages'][$package_id] = $package;
1556
+ }
1557
+ }
1558
+ }
1559
+
1560
+ // order parents
1561
+ usort($ordered_packages, create_function('$a, $b', 'return $a[\'order\'] > $b[\'order\'];'));
1562
+ //order sub-packages
1563
+ foreach($ordered_packages as $package_id => $package){
1564
+ if(!empty($package['sub-packages'])) {
1565
+ usort($ordered_packages[$package_id]['sub-packages'], create_function('$a, $b', 'return $a[\'order\'] > $b[\'order\'];'));
1566
+ }
1567
+ }
1568
+
1569
+ $this->settings['repositories'][$repository_id]['data']['packages'] = $ordered_packages;
1570
+
1571
+
1572
+ }
1573
+ }
1574
+
1575
+
1576
+ }
1577
+
1578
+ public function get_support_tag_by_name( $name, $repository ){
1579
+
1580
+ if( is_array($this->settings['repositories'][$repository]['data']['support_tags'] )){
1581
+ foreach( $this->settings['repositories'][$repository]['data']['support_tags'] as $support_tag){
1582
+ if( $support_tag['name'] == $name ){
1583
+ return $support_tag['url'];
1584
+ }
1585
+ }
1586
+ }
1587
+
1588
+ return false;
1589
+ }
1590
+ }
embedded/common/installer/installer.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ define('WP_INSTALLER_VERSION', '1.3');
3
+
4
+ include_once dirname(__FILE__) . '/includes/installer.class.php';
5
+
6
+ function WP_Installer() {
7
+ return WP_Installer::instance();
8
+ }
9
+
10
+
11
+ WP_Installer();
12
+
13
+
14
+ // Ext function
15
+ function WP_Installer_Show_Products($args = array()){
16
+
17
+ WP_Installer()->show_products($args);
18
+
19
+ }
20
+
21
+
embedded/common/installer/loader.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Installer
4
+ Plugin URI: http://wp-compatibility.com/installer-plugin/
5
+ Description: Need help buying, installing and upgrading commercial themes and plugins? **Installer** handles all this for you, right from the WordPress admin. Installer lets you find themes and plugins from different sources, then, buy them from within the WordPress admin. Instead of manually uploading and unpacking, you'll see those themes and plugins available, just like any other plugin you're getting from WordPress.org.
6
+ Version: 1.3
7
+ Author: OnTheGoSystems Inc.
8
+ Author URI: http://www.onthegosystems.com/
9
+ */
10
+
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit; // Exit if accessed directly
14
+ }
15
+
16
+
17
+ $wp_installer_instance = dirname(__FILE__) . '/installer.php';
18
+
19
+ // Global stack of instances
20
+ $wp_installer_instances[$wp_installer_instance] = array(
21
+ 'bootfile' => $wp_installer_instance,
22
+ 'version' => 1.3
23
+ );
24
+
25
+ // Only one of these in the end
26
+ remove_action('after_setup_theme', 'wpml_installer_instance_delegator', 1);
27
+ add_action('after_setup_theme', 'wpml_installer_instance_delegator', 1);
28
+
29
+ // When all plugins load pick the newest version
30
+ if(!function_exists('wpml_installer_instance_delegator')){
31
+ function wpml_installer_instance_delegator(){
32
+ global $wp_installer_instances;
33
+
34
+ foreach($wp_installer_instances as $instance){
35
+
36
+ if(!isset($delegate)){
37
+ $delegate = $instance;
38
+ continue;
39
+ }
40
+
41
+ if(version_compare($instance['version'], $delegate['version'], '>')){
42
+ $delegate = $instance;
43
+ }
44
+ }
45
+
46
+ include_once $delegate['bootfile'];
47
+
48
+ // set configuration
49
+ if(strpos(realpath($delegate['bootfile']), realpath(TEMPLATEPATH)) === 0){
50
+ $delegate['args']['in_theme_folder'] = dirname(ltrim(str_replace(realpath(TEMPLATEPATH), '', realpath($delegate['bootfile'])), '\\/'));
51
+ }
52
+ if(isset($delegate['args']) && is_array($delegate['args'])){
53
+ foreach($delegate['args'] as $key => $value){
54
+ WP_Installer()->set_config($key, $value);
55
+ }
56
+ }
57
+
58
+ }
59
+ }
60
+
61
+ if(!function_exists('WP_Installer_Setup')){
62
+
63
+ // $args:
64
+ // plugins_install_tab = true|false (default: true)
65
+ // repositories_include = array() (default: all)
66
+ // repositories_exclude = array() (default: none)
67
+ // template = name (default: default)
68
+ //
69
+ // Ext function
70
+ function WP_Installer_Setup($wp_installer_instance, $args = array()){
71
+ global $wp_installer_instances;
72
+
73
+ //if(isset($wp_installer_instances[$wp_installer_instance])){
74
+ $wp_installer_instances[$wp_installer_instance]['args'] = $args;
75
+ //}
76
+
77
+ }
78
+
79
+ }
80
+
embedded/common/installer/repositories.xml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <repositories>
3
+ <repository>
4
+ <id>wpml</id>
5
+ <apiurl>http://api.wpml.org/</apiurl>
6
+ <products>https://wpmlorg.s3.amazonaws.com/wpml-products.json</products>
7
+ </repository>
8
+ <repository>
9
+ <id>toolset</id>
10
+ <apiurl>http://api.wp-types.com/</apiurl>
11
+ <products>https://wptypes.s3.amazonaws.com/toolset-products.json</products>
12
+ </repository>
13
+ </repositories>
embedded/common/installer/res/css/admin.css ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .otgsi_site_key_form{
2
+ display:none;
3
+ /*display:inline;*/
4
+ }
5
+
6
+ .installer-status-installing, .installer-status-installed, .installer-status-updating, .installer-status-updated, .installer-status-activating, .installer-status-activated, .installer-status-success{
7
+ display: none;
8
+ }
9
+ .installer-status-installing{color: #FF9900; }
10
+ .installer-status-installed{color: #003300; font-weight: bold; }
11
+ .installer-status-updating{color: #FF9900; }
12
+ .installer-status-updated{color: #003300; font-weight: bold; }
13
+
14
+ .installer-status-activating{color: #996666 }
15
+ .installer-status-activated{color: #333366; font-weight: bold; }
16
+
17
+ .js-status-success p{
18
+ color: #FF9900;
19
+ padding: 4px;
20
+ }
21
+
22
+ .installer-green-text{
23
+ color:#006600;
24
+ font-weight:bold;
25
+ }
26
+
27
+ .installer-red-text{
28
+ color:#b22121;
29
+ font-weight:bold;
30
+ }
31
+
32
+ .installer-products-list li{
33
+ display: inline;
34
+ margin-right: 20px;
35
+ }
36
+
37
+ .otgs_wp_installer_table a.disabled{
38
+ color:#888;
39
+ }
40
+
41
+ .otgs_wp_installer_subtable{
42
+ clear: both;
43
+ margin-left:-20px;
44
+ }
45
+ .otgs_wp_installer_subtable td p{
46
+ font-size: 92%;
47
+ }
48
+
49
+ .installer-status-error{
50
+ color: #f00;
51
+ }
52
+
53
+ .installer-warn-box{
54
+ -webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px;border:1px solid #962722;background-color:#F5C8C6;
55
+ color: #333;
56
+ padding: 5px;
57
+ }
58
+
59
+ .spinner-inline{
60
+ float: none;
61
+ display: inline-block;
62
+ }
63
+
64
+ .installer-q-icon:before{
65
+ content: '\f223' !important;
66
+ }
67
+
68
+ .otgsi_yellow_bg{
69
+ background-color: #f2f46b;
70
+ }
71
+
72
+ .otgs_wp_installer_table_compact{
73
+ width:480px;
74
+ border: solid 1px #999;
75
+ padding:10px;
76
+ border-radius: 5px;
77
+ }
78
+
79
+ .installer-plugins-list-compact{
80
+ background-color: #fff;
81
+ border-collapse: collapse;
82
+ border:solid 1px #C1DAD7;
83
+ width:100%;
84
+ }
85
+
86
+ .installer-plugins-list-compact tr th{
87
+ padding-top:3px;
88
+ background-color: #ccc;
89
+ }
90
+
91
+ .installer-plugins-list-compact tr{
92
+ background-color: #ddd;
93
+ }
94
+
95
+ .installer-plugins-list-compact tr.even{
96
+ background-color: #eee;
97
+ }
98
+
99
+ .installer-plugins-list-compact td{
100
+ padding:2px 5px 2px 5px;
101
+ border-right: 1px solid #C1DAD7;
102
+ border-bottom: 1px solid #C1DAD7;
103
+ }
104
+
105
+ .installer-plugins-list-compact td.twelve{
106
+ width:16px;
107
+ }
108
+
109
+ .otgs_wp_installer_table_compact .installer-status-downloading,
110
+ .otgs_wp_installer_table_compact .installer-status-downloaded,
111
+ .otgs_wp_installer_table_compact .installer-status-activating,
112
+ .otgs_wp_installer_table_compact .installer-status-activated{
113
+ display: none;
114
+ color:transparent; width: 12px; padding:2px;
115
+ }
116
+
117
+ .otgs_wp_installer_table_compact .installer-status-success,
118
+ .otgs_wp_installer_table_compact .installer-status-fail{
119
+ display: none;
120
+ }
121
+
122
+ .otgs_wp_installer_table_compact .installer-status-downloading{background: url(../img/dn.gif) no-repeat center; }
123
+ .otgs_wp_installer_table_compact .installer-status-downloaded{background: url(../img/complete.png) no-repeat center;}
124
+ .otgs_wp_installer_table_compact .installer-status-activating{background: url(../img/dn.gif) no-repeat center; }
125
+ .otgs_wp_installer_table_compact .installer-status-activated{background: url(../img/complete.png) no-repeat center; }
126
+ .otgs_wp_installer_table_compact .installer-status-error{background: url(../img/icon_error.gif) no-repeat center; }
127
+
128
+ .installer_highlight{
129
+ color:#c5510b;
130
+ }
embedded/common/installer/res/img/complete.png ADDED
Binary file
embedded/common/installer/res/img/computer.png ADDED
Binary file
embedded/common/installer/res/img/dn.gif ADDED
Binary file
embedded/common/installer/res/img/dn2.gif ADDED
Binary file
embedded/common/installer/res/img/globe.png ADDED
Binary file
embedded/common/installer/res/img/icon_error.gif ADDED
Binary file
embedded/common/installer/res/img/on.png ADDED
Binary file
embedded/common/installer/res/js/admin.js ADDED
@@ -0,0 +1,286 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var otgs_wp_installer = {
2
+
3
+ init: function(){
4
+
5
+ jQuery('.otgs_wp_installer_table').on('click', '.enter_site_key_js', otgs_wp_installer.show_site_key_form);
6
+ jQuery('.otgs_wp_installer_table').on('click', '.cancel_site_key_js', otgs_wp_installer.hide_site_key_form);
7
+
8
+ jQuery('.otgs_wp_installer_table').on('click', '.remove_site_key_js', otgs_wp_installer.remove_site_key);
9
+ jQuery('.otgs_wp_installer_table').on('click', '.update_site_key_js', otgs_wp_installer.update_site_key);
10
+
11
+ jQuery('.otgs_wp_installer_table').on('submit', '.otgsi_site_key_form', otgs_wp_installer.save_site_key);
12
+ jQuery('.otgs_wp_installer_table').on('submit', '.otgsi_downloads_form', otgs_wp_installer.download_downloads);
13
+ jQuery('.otgs_wp_installer_table').on('change', '.otgsi_downloads_form :checkbox[name="downloads[]"]', otgs_wp_installer.update_downloads_form);
14
+
15
+ jQuery('.installer-dismiss-nag').click(otgs_wp_installer.dismiss_nag);
16
+
17
+ jQuery('.otgs_wp_installer_table').on('click', '.installer_expand_button', otgs_wp_installer.toggle_subpackages);
18
+
19
+ },
20
+
21
+
22
+ show_site_key_form: function(){
23
+ var form = jQuery(this).parent().find('form.otgsi_site_key_form');
24
+ jQuery(this).prev().hide();
25
+ jQuery(this).hide();
26
+ form.css('display', 'inline');
27
+ form.find('input[name^=site_key_]').focus().val('');
28
+ form.find('input').removeAttr('disabled');
29
+
30
+ form.closest('.otgsi_register_product_wrap').addClass('otgsi_yellow_bg');
31
+
32
+ return false;
33
+ },
34
+
35
+ hide_site_key_form: function(){
36
+ var form = jQuery(this).closest('form');
37
+ form.hide();
38
+ form.parent().find('.enter_site_key_js').show();
39
+ form.parent().find('.enter_site_key_js').prev().show();
40
+
41
+ form.closest('.otgsi_register_product_wrap').removeClass('otgsi_yellow_bg');
42
+ return false;
43
+ },
44
+
45
+ save_site_key: function(){
46
+
47
+ var thisf = jQuery(this);
48
+ var data = jQuery(this).serialize();
49
+ jQuery(this).find('input').attr('disabled', 'disabled');
50
+
51
+ var spinner = jQuery('<span class="spinner"></span>');
52
+ spinner.css({display: 'inline-block', float: 'none'}).prependTo(jQuery(this));
53
+
54
+ jQuery.ajax({url: ajaxurl, type: 'POST', dataType:'json', data: data, success:
55
+ function(ret){
56
+ if(!ret.error){
57
+ otgs_wp_installer.saved_site_key();
58
+ }else{
59
+ alert(ret.error);
60
+ thisf.find('input').removeAttr('disabled');
61
+ }
62
+
63
+ if(typeof ret.debug != 'undefined'){
64
+ thisf.append('<textarea style="width:100%" rows="20">' + ret.debug + '</textarea>');
65
+ }
66
+
67
+ spinner.remove();
68
+ }
69
+ });
70
+
71
+ return false;
72
+
73
+ },
74
+
75
+ saved_site_key: function(){
76
+ location.reload();
77
+ },
78
+
79
+ remove_site_key: function(){
80
+
81
+ if(confirm(jQuery(this).data('confirmation'))){
82
+
83
+ jQuery('<span class="spinner"></span>').css({display: 'inline-block', float: 'none'}).prependTo(jQuery(this).parent());
84
+ data = {action: 'remove_site_key', repository_id: jQuery(this).data('repository'), nonce: jQuery(this).data('nonce')}
85
+ jQuery.ajax({url: ajaxurl, type: 'POST', data: data, success: otgs_wp_installer.removed_site_key});
86
+ }
87
+
88
+ },
89
+
90
+ removed_site_key: function(){
91
+ location.reload();
92
+ },
93
+
94
+ update_site_key: function(){
95
+
96
+ var spinner = jQuery('<span class="spinner"></span>');
97
+ spinner.css({display: 'inline-block', float: 'none'}).prependTo(jQuery(this).parent());
98
+ data = {action: 'update_site_key', repository_id: jQuery(this).data('repository'), nonce: jQuery(this).data('nonce')}
99
+ jQuery.ajax({
100
+ url: ajaxurl,
101
+ type: 'POST',
102
+ data: data,
103
+ dataType: 'json',
104
+ success: function(ret){
105
+ if(ret.error){
106
+ alert(ret.error);
107
+ spinner.remove();
108
+ }
109
+ otgs_wp_installer.updated_site_key(ret);
110
+ }
111
+ });
112
+
113
+ },
114
+
115
+ updated_site_key: function(ret){
116
+ location.reload();
117
+ },
118
+
119
+ update_downloads_form: function(){
120
+
121
+ var checked = jQuery('.otgsi_downloads_form :checkbox:checked[name="downloads[]"]').length;
122
+
123
+ if(checked){
124
+ jQuery(this).closest('form').find(':submit, :checkbox[name=activate]').removeAttr('disabled');
125
+ }else{
126
+ jQuery(this).closest('form').find(':submit, :checkbox[name=activate]').attr('disabled', 'disabled');
127
+ }
128
+
129
+
130
+ },
131
+
132
+ download_downloads: function(){
133
+
134
+ var activate = jQuery(this).find(":checkbox:checked[name=activate]").val(),
135
+ action_button = jQuery(this).find('input[type="submit"]');
136
+ downloads_form = jQuery(this),
137
+ idx = 0,
138
+ checkboxes = [];
139
+
140
+ jQuery(this).find(':checkbox:checked[name="downloads[]"]').each(function(){
141
+ if(jQuery(this).attr('disabled')) return;
142
+ checkboxes[idx] = jQuery(this);
143
+ idx++;
144
+ jQuery(this).attr('disabled', 'disabled');
145
+ });
146
+
147
+ idx = 0;
148
+
149
+ if( typeof checkboxes[idx] != 'undefined' ){
150
+ download_and_activate( checkboxes[idx] );
151
+ action_button.attr('disabled', 'disabled');
152
+ }
153
+
154
+ function download_and_activate( elem ){
155
+
156
+ var this_tr = elem.closest('tr');
157
+ var is_update = this_tr.find('.installer-red-text').length;
158
+ if(is_update){
159
+ var installing = this_tr.find('.installer-status-updating');
160
+ var installed = this_tr.find('.installer-status-updated');
161
+ }else{
162
+ var installing = this_tr.find('.installer-status-installing');
163
+ var installed = this_tr.find('.installer-status-installed');
164
+
165
+ }
166
+ if(activate){
167
+ var activating = this_tr.find('.installer-status-activating');
168
+ var activated = this_tr.find('.installer-status-activated');
169
+ }
170
+
171
+
172
+ if( this_tr.find('.for_spinner_js .spinner').size() > 0 ){
173
+ var spinner = this_tr.find('.for_spinner_js .spinner');
174
+ }else{
175
+ var spinner = this_tr.find('.installer-status-downloading');
176
+ }
177
+
178
+ spinner.show();
179
+
180
+ installing.show();
181
+
182
+ data = {action: 'installer_download_plugin', data: elem.val(), activate: activate}
183
+
184
+ jQuery.ajax({
185
+ url: ajaxurl,
186
+ type: 'POST',
187
+ dataType: 'json',
188
+ data: data,
189
+ success: function(ret){
190
+ installing.hide();
191
+
192
+ if(!ret.success){
193
+ installed.addClass('installer-status-error');
194
+ installed.html(installed.data('fail'));
195
+
196
+ var revalidate_message = downloads_form.find('.installer-revalidate-message').html();
197
+ if(confirm(revalidate_message)){
198
+ downloads_form.closest('.otgs_wp_installer_table').find('.update_site_key_js').click();
199
+ }
200
+
201
+ }
202
+
203
+ installed.show();
204
+ spinner.hide();
205
+
206
+ if(ret.success && activate){
207
+ activating.show();
208
+ spinner.show();
209
+ this_tr.find('.installer-red-text').removeClass('installer-red-text').addClass('installer-green-text').html(ret.version);
210
+
211
+ jQuery.ajax({
212
+ url: ajaxurl,
213
+ type: 'POST',
214
+ dataType: 'json',
215
+ data: {action: 'installer_activate_plugin', plugin_id: ret.plugin_id, nonce: ret.nonce},
216
+ success: function(ret){
217
+ activating.hide();
218
+ if(! ret.error ){
219
+ activated.show();
220
+ }
221
+ spinner.hide();
222
+
223
+ idx++;
224
+ if( typeof checkboxes[idx] != 'undefined' ){
225
+ download_and_activate( checkboxes[idx] );
226
+ }else{
227
+ downloads_form.find('div.installer-status-success').show();
228
+ action_button.removeAttr('disabled');
229
+ }
230
+ }
231
+ });
232
+ }else{
233
+ idx++;
234
+ if( typeof checkboxes[idx] != 'undefined' ){
235
+ download_and_activate( checkboxes[idx] );
236
+ }else{
237
+ downloads_form.find('div.installer-status-success').show();
238
+ action_button.removeAttr('disabled');
239
+ }
240
+ }
241
+ }
242
+
243
+ });
244
+
245
+ };
246
+
247
+ return false;
248
+ },
249
+
250
+ dismiss_nag: function(){
251
+
252
+ var thisa = jQuery(this);
253
+
254
+ jQuery('<span class="spinner"></span>').css({display: 'inline-block', float: 'left'}).appendTo(thisa);
255
+
256
+ data = {action: 'installer_dismiss_nag', repository: jQuery(this).data('repository')}
257
+
258
+ jQuery.ajax({url: ajaxurl, type: 'POST', dataType:'json', data: data, success:
259
+ function(ret){
260
+ thisa.parent().parent().remove();
261
+ }
262
+ });
263
+
264
+ return false;
265
+
266
+
267
+ },
268
+
269
+ toggle_subpackages: function(){
270
+ var list = jQuery(this).closest('td').find('.otgs_wp_installer_subtable');
271
+
272
+ if(list.is(':visible')){
273
+ list.slideUp('fast');
274
+ }else{
275
+ list.slideDown('fast');
276
+ }
277
+
278
+
279
+ return false;
280
+
281
+ }
282
+
283
+
284
+ }
285
+
286
+ jQuery(document).ready(otgs_wp_installer.init);
embedded/common/installer/res/js/iframeResizer.min.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ /*! iFrame Resizer (iframeSizer.min.js ) - v2.6.1 - 2014-09-03
2
+ * Desc: Force cross domain iframes to size to content.
3
+ * Requires: iframeResizer.contentWindow.min.js to be loaded into the target frame.
4
+ * Copyright: (c) 2014 David J. Bradshaw - dave@bradshaw.net
5
+ * License: MIT
6
+ */
7
+
8
+ !function(){"use strict";function a(a,b,c){"addEventListener"in window?a.addEventListener(b,c,!1):"attachEvent"in window&&a.attachEvent("on"+b,c)}function b(){var a,b=["moz","webkit","o","ms"];for(a=0;a<b.length&&!w;a+=1)w=window[b[a]+"RequestAnimationFrame"];w||c(" RequestAnimationFrame not supported")}function c(a){y.log&&"object"==typeof console&&console.log(s+"[Host page"+u+"]"+a)}function d(a){function b(){function a(){h(z),f(),y.resizedCallback(z)}i(a,z,"resetPage")}function d(a){var b=a.id;c(" Removing iFrame: "+b),a.parentNode.removeChild(a),y.closedCallback(b),c(" --")}function e(){var a=x.substr(t).split(":");return{iframe:document.getElementById(a[0]),id:a[0],height:a[1],width:a[2],type:a[3]}}function j(a){var b=Number(y["max"+a]),d=Number(y["min"+a]),e=a.toLowerCase(),f=Number(z[e]);if(d>b)throw new Error("Value for min"+a+" can not be greater than max"+a);c(" Checking "+e+" is in range "+d+"-"+b),d>f&&(f=d,c(" Set "+e+" to min value")),f>b&&(f=b,c(" Set "+e+" to max value")),z[e]=""+f}function k(){var b=a.origin,d=z.iframe.src.split("/").slice(0,3).join("/");if(y.checkOrigin&&(c(" Checking connection is from: "+d),""+b!="null"&&b!==d))throw new Error("Unexpected message received from: "+b+" for "+z.iframe.id+". Message was: "+a.data+". This error can be disabled by adding the checkOrigin: false option.");return!0}function l(){return s===(""+x).substr(0,t)}function m(){var a=z.type in{"true":1,"false":1};return a&&c(" Ignoring init message from meta parent page"),a}function n(){var a=x.substr(x.indexOf(":")+r+6);c(" MessageCallback passed: {iframe: "+z.iframe.id+", message: "+a+"}"),y.messageCallback({iframe:z.iframe,message:a}),c(" --")}function o(){if(null===z.iframe)throw new Error("iFrame ("+z.id+") does not exist on "+u);return!0}function q(){c(" Reposition requested from iFrame"),v={x:z.width,y:z.height},f()}function w(){switch(z.type){case"close":d(z.iframe),y.resizedCallback(z);break;case"message":n();break;case"scrollTo":q();break;case"reset":g(z);break;case"init":b(),y.initCallback(z.iframe);break;default:b()}}var x=a.data,z={};l()&&(c(" Received: "+x),z=e(),j("Height"),j("Width"),!m()&&o()&&k()&&(w(),p=!1))}function e(){null===v&&(v={x:void 0!==window.pageXOffset?window.pageXOffset:document.documentElement.scrollLeft,y:void 0!==window.pageYOffset?window.pageYOffset:document.documentElement.scrollTop},c(" Get position: "+v.x+","+v.y))}function f(){null!==v&&(window.scrollTo(v.x,v.y),c(" Set position: "+v.x+","+v.y),v=null)}function g(a){function b(){h(a),j("reset","reset",a.iframe)}c(" Size reset requested by "+("init"===a.type?"host page":"iFrame")),e(),i(b,a,"init")}function h(a){function b(b){a.iframe.style[b]=a[b]+"px",c(" IFrame ("+a.iframe.id+") "+b+" set to "+a[b]+"px")}y.sizeHeight&&b("height"),y.sizeWidth&&b("width")}function i(a,b,d){d!==b.type&&w?(c(" Requesting animation frame"),w(a)):a()}function j(a,b,d){c("["+a+"] Sending msg to iframe ("+b+")"),d.contentWindow.postMessage(s+b,"*")}function k(){function b(){function a(a){1/0!==y[a]&&0!==y[a]&&(k.style[a]=y[a]+"px",c(" Set "+a+" = "+y[a]+"px"))}a("maxHeight"),a("minHeight"),a("maxWidth"),a("minWidth")}function d(a){return""===a&&(k.id=a="iFrameResizer"+o++,c(" Added missing iframe ID: "+a+" ("+k.src+")")),a}function e(){c(" IFrame scrolling "+(y.scrolling?"enabled":"disabled")+" for "+l),k.style.overflow=!1===y.scrolling?"hidden":"auto",k.scrolling=!1===y.scrolling?"no":"yes"}function f(){("number"==typeof y.bodyMargin||"0"===y.bodyMargin)&&(y.bodyMarginV1=y.bodyMargin,y.bodyMargin=""+y.bodyMargin+"px")}function h(){return l+":"+y.bodyMarginV1+":"+y.sizeWidth+":"+y.log+":"+y.interval+":"+y.enablePublicMethods+":"+y.autoResize+":"+y.bodyMargin+":"+y.heightCalculationMethod+":"+y.bodyBackground+":"+y.bodyPadding+":"+y.tolerance}function i(b){a(k,"load",function(){var a=p;j("iFrame.onload",b,k),!a&&y.heightCalculationMethod in x&&g({iframe:k,height:0,width:0,type:"init"})}),j("init",b,k)}var k=this,l=d(k.id);e(),b(),f(),i(h())}function l(a){if("object"!=typeof a)throw new TypeError("Options is not an object.")}function m(){function a(a){if("IFRAME"!==a.tagName.toUpperCase())throw new TypeError("Expected <IFRAME> tag, found <"+a.tagName+">.");k.call(a)}function b(a){a=a||{},l(a);for(var b in z)z.hasOwnProperty(b)&&(y[b]=a.hasOwnProperty(b)?a[b]:z[b])}return function(c,d){b(c),Array.prototype.forEach.call(document.querySelectorAll(d||"iframe"),a)}}function n(a){a.fn.iFrameResize=function(b){return b=b||{},l(b),y=a.extend({},z,b),this.filter("iframe").each(k).end()}}var o=0,p=!0,q="message",r=q.length,s="[iFrameSizer]",t=s.length,u="",v=null,w=window.requestAnimationFrame,x={max:1,scroll:1,bodyScroll:1,documentElementScroll:1},y={},z={autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,enablePublicMethods:!1,heightCalculationMethod:"offset",interval:32,log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,scrolling:!1,sizeHeight:!0,sizeWidth:!1,tolerance:0,closedCallback:function(){},initCallback:function(){},messageCallback:function(){},resizedCallback:function(){}};b(),a(window,"message",d),"jQuery"in window&&n(jQuery),"function"==typeof define&&define.amd?define(function(){return m()}):window.iFrameResize=m()}();
9
+ //# sourceMappingURL=../src/iframeResizer.map
10
+
embedded/common/installer/templates/downloads-list-compact.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <form method="post" class="otgsi_downloads_form">
3
+
4
+ <table class="installer-plugins-list-compact">
5
+ <thead>
6
+ <tr>
7
+ <th>&nbsp;</th>
8
+ <th><?php _e('Plugin', 'installer') ?></th>
9
+ <th><img src="<?php echo $this->plugin_url() ?>/res/img/globe.png" alt="<?php esc_attr_e('Available', 'installer') ?>" width="16" height="16"></th>
10
+ <th><img src="<?php echo $this->plugin_url() ?>/res/img/computer.png" alt="<?php esc_attr_e('Installed', 'installer') ?>" width="16" height="16"></th>
11
+ <th><img src="<?php echo $this->plugin_url() ?>/res/img/dn2.gif" alt="<?php esc_attr_e('Downloading', 'installer') ?>" width="16" height="16"></th>
12
+ <th><img src="<?php echo $this->plugin_url() ?>/res/img/on.png" alt="<?php esc_attr_e('Activate', 'installer') ?>" width="16" height="16"></th>
13
+ </tr>
14
+ </thead>
15
+ <tbody>
16
+ <?php foreach($product['downloads'] as $download): ?>
17
+ <?php if(empty($tr_oddeven) || $tr_oddeven == 'even') $tr_oddeven = 'odd'; else $tr_oddeven = 'even'; ?>
18
+ <tr class="<?php echo $tr_oddeven ?>">
19
+ <td>
20
+ <label>
21
+ <?php
22
+ $url = $this->append_site_key_to_download_url($download['url'], $site_key, $repository_id );
23
+ ?>
24
+ <input type="checkbox" name="downloads[]" value="<?php echo base64_encode(json_encode(array('url' => $url,
25
+ 'basename' => $download['basename'], 'nonce' => wp_create_nonce('install_plugin_' . $url)))); ?>" <?php
26
+ if($expired || $this->plugin_is_installed($download['name'], $download['basename'], $download['version'])): ?>disabled="disabled"<?php endif; ?> />&nbsp;
27
+
28
+ </label>
29
+ </td>
30
+ <td><?php echo $download['name'] ?></td>
31
+ <td><?php echo $download['version'] ?></td>
32
+ <td>
33
+ <?php if($v = $this->plugin_is_installed($download['name'], $download['basename'])): $class = version_compare($v, $download['version'], '>=') ? 'installer-green-text' : 'installer-red-text'; ?>
34
+ <span class="<?php echo $class ?>"><?php echo $v; ?></span>
35
+ <?php endif; ?>
36
+ </td>
37
+ <td class="twelve">
38
+ <div class="installer-status-downloading"><?php _e('downloading...', 'installer') ?></div>
39
+ <div class="installer-status-downloaded" data-fail="<?php _e('failed!', 'installer') ?>"><?php _e('downloaded', 'installer') ?></div>
40
+ </td>
41
+ <td class="twelve">
42
+ <div class="installer-status-activating"><?php _e('activating', 'installer') ?></div>
43
+ <div class="installer-status-activated"><?php _e('activated', 'installer') ?></div>
44
+ </td>
45
+ </tr>
46
+ <?php endforeach; ?>
47
+ </tbody>
48
+ </table>
49
+
50
+ <br />
51
+ <input type="submit" class="button-secondary" value="<?php esc_attr_e('Download', 'installer') ?>" disabled="disabled" />
52
+ &nbsp;
53
+ <label><input name="activate" type="checkbox" value="1" disabled="disabled" />&nbsp;<?php _e('Activate after download', 'installer') ?></label>
54
+
55
+ <div class="installer-status-success"><p><?php _e('Operation complete!', 'installer') ?></p></div>
56
+
57
+ <span class="installer-revalidate-message hidden"><?php _e("Download failed!\n\nClick OK to revalidate your subscription or CANCEL to try again.", 'installer') ?></span>
58
+ </form>
embedded/common/installer/templates/downloads-list.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <br clear="all" /><br />
2
+ <strong><?php _e('Downloads:', 'installer') ?></strong>
3
+
4
+ <form method="post" class="otgsi_downloads_form">
5
+
6
+ <table class="widefat">
7
+ <thead>
8
+ <tr>
9
+ <th>&nbsp;</th>
10
+ <th><?php _e('Plugin', 'installer') ?></th>
11
+ <th><?php _e('Current version', 'installer') ?></th>
12
+ <th><?php _e('Released', 'installer') ?></th>
13
+ <th><?php _e('Installed version', 'installer') ?></th>
14
+ <th>&nbsp;</th>
15
+ <th>&nbsp;</th>
16
+ <th>&nbsp;</th>
17
+ </tr>
18
+ </thead>
19
+ <tbody>
20
+ <?php foreach($package['downloads'] as $download): ?>
21
+ <tr>
22
+ <td>
23
+ <label>
24
+ <?php
25
+ $url = $this->append_site_key_to_download_url($download['url'], $site_key, $repository_id);
26
+ ?>
27
+ <input type="checkbox" name="downloads[]" value="<?php echo base64_encode(json_encode(array('url' => $url,
28
+ 'basename' => $download['basename'], 'nonce' => wp_create_nonce('install_plugin_' . $url)))); ?>" <?php
29
+ if($this->plugin_is_installed($download['name'], $download['basename'], $download['version'])): ?>disabled="disabled"<?php endif; ?> />&nbsp;
30
+
31
+ </label>
32
+ </td>
33
+ <td><?php echo $download['name'] ?></td>
34
+ <td><?php echo $download['version'] ?></td>
35
+ <td><?php echo date_i18n('F j, Y', strtotime($download['date'])) ?></td>
36
+ <td>
37
+ <?php if($v = $this->plugin_is_installed($download['name'], $download['basename'])): $class = version_compare($v, $download['version'], '>=') ? 'installer-green-text' : 'installer-red-text'; ?>
38
+ <span class="<?php echo $class ?>"><?php echo $v; ?></span>
39
+ <?php endif; ?>
40
+ </td>
41
+ <td>
42
+ <span class="installer-status-installing"><?php _e('installing...', 'installer') ?></span>
43
+ <span class="installer-status-updating"><?php _e('updating...', 'installer') ?></span>
44
+ <span class="installer-status-installed" data-fail="<?php _e('failed!', 'installer') ?>"><?php _e('installed', 'installer') ?></span>
45
+ <span class="installer-status-updated" data-fail="<?php _e('failed!', 'installer') ?>"><?php _e('updated', 'installer') ?></span>
46
+ </td>
47
+ <td>
48
+ <span class="installer-status-activating"><?php _e('activating', 'installer') ?></span>
49
+ <span class="installer-status-activated"><?php _e('activated', 'installer') ?></span>
50
+ </td>
51
+ <td class="for_spinner_js"><span class="spinner"></span></td>
52
+ </tr>
53
+ <?php endforeach; ?>
54
+ </tbody>
55
+ </table>
56
+
57
+ <br />
58
+ <input type="submit" class="button-secondary" value="<?php esc_attr_e('Download', 'installer') ?>" disabled="disabled" />
59
+ &nbsp;
60
+ <label><input name="activate" type="checkbox" value="1" disabled="disabled" />&nbsp;<?php _e('Activate after download', 'installer') ?></label>
61
+
62
+ <div class="installer-status-success"><p><?php _e('Operation complete!', 'installer') ?></p></div>
63
+
64
+ <span class="installer-revalidate-message hidden"><?php _e("Download failed!\n\nClick OK to revalidate your subscription or CANCEL to try again.", 'installer') ?></span>
65
+ </form>
embedded/common/installer/templates/products-compact.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h3><?php echo $args['box_title'] ?></h3>
2
+
3
+ <?php
4
+ if(empty($args['repository']) || empty($args['package']) || empty($args['product'])){
5
+ echo __('Incorrect setup', 'installer');
6
+ return;
7
+ }
8
+
9
+ $product = false;
10
+ foreach($this->settings['repositories'][$repository_id]['data']['packages'] as $package_idx => $package){
11
+
12
+ //pre 1.3 backwardds compatibility
13
+ if(!isset($package['id'])){
14
+ $package['id'] = sanitize_title_with_dashes($package['name']);
15
+ }
16
+
17
+ if($package['id'] == $args['package']){
18
+ $product = $this->settings['repositories'][$repository_id]['data']['packages'][$package_idx]['products'][$args['product']];
19
+ break;
20
+ }
21
+ }
22
+
23
+
24
+ if(!$product){
25
+ echo __('Invalid product', 'installer');
26
+ return;
27
+ }
28
+
29
+ if(isset($this->settings['repositories'][$repository_id])){
30
+ if(isset($this->settings['repositories'][$repository_id]['subscription']['key'])){
31
+ $site_key = $this->settings['repositories'][$repository_id]['subscription']['key'];
32
+ }else{
33
+ $site_key = false;
34
+ }
35
+ }else{
36
+ echo __('Unknown repository', 'installer');
37
+ return;
38
+ }
39
+
40
+ $subscription_type = $this->get_subscription_type_for_repository($repository_id);
41
+ $expired = false;
42
+
43
+ if($subscription_type != $product['subscription_type'] && !$this->have_superior_subscription($subscription_type, $product) && $site_key){
44
+ $subscription_no_match = sprintf(__(' Your current site key (%s) does not match the selected product (%s).', 'installer'), $site_key, $product['name']);
45
+ }
46
+
47
+ if(!isset($args['product_name'])) $args['product_name'] = $product['name'];
48
+
49
+ ?>
50
+
51
+ <div class="otgs_wp_installer_table otgs_wp_installer_table_compact">
52
+
53
+ <p><?php echo $args['box_description'] ?></p>
54
+
55
+
56
+ <?php if(!$this->repository_has_subscription($repository_id) || !empty($subscription_no_match)): ?>
57
+
58
+ <?php if(!empty($subscription_no_match)): ?>
59
+ <div class="installer-warn-box">
60
+ <?php echo $subscription_no_match; ?>
61
+ </div>
62
+ <br />
63
+ <?php endif; ?>
64
+
65
+ <a class="button-primary" href="<?php echo $this->append_parameters_to_buy_url($product['url'], $args) ?>"><?php printf(__('Buy %s', 'installer'), $args['product_name']) ?></a>
66
+
67
+ <div>
68
+ <br />
69
+ <?php printf(__('Already bought %s?', 'installer'), $args['product_name']) ?>
70
+ <a class="enter_site_key_js" href="#"><?php _e('Enter site key', 'installer') ?></a>&nbsp;&nbsp;
71
+
72
+ <form class="otgsi_site_key_form" method="post">
73
+ <input type="hidden" name="action" value="save_site_key" />
74
+ <input type="hidden" name="nonce" value="<?php echo wp_create_nonce('save_site_key_' . $repository_id) ?>" />
75
+ <input type="hidden" name="repository_id" value="<?php echo $repository_id ?>">
76
+ <input type="text" size="10" name="site_key_<?php echo $repository_id ?>" />
77
+ <input class="button-secondary" type="submit" value="<?php esc_attr_e('Add', 'installer') ?>" />
78
+ </form>
79
+ </div>
80
+
81
+ <?php else: ?>
82
+
83
+ <?php if($this->repository_has_expired_subscription($repository_id)): $expired = true; ?>
84
+
85
+ <div><p class="installer-warn-box"><?php _e('Subscription is expired.', 'installer') ?></p></div>
86
+
87
+ <?php else: ?>
88
+
89
+ <?php if($this->show_subscription_renew_warning($repository_id, $subscription_type)): ?>
90
+
91
+ <ul class="installer-products-list">
92
+ <?php foreach($product['renewals'] as $renewal): ?>
93
+ <li>
94
+ <a href="<?php echo $this->append_parameters_to_buy_url($renewal['url'], $args) ?>"><?php printf(__('Renew %s', 'installer'), $args['product_name']) ?></a>
95
+ </li>
96
+ <?php endforeach; ?>
97
+ </ul>
98
+
99
+ <?php endif; ?>
100
+
101
+ <?php endif; ?>
102
+
103
+ <center>
104
+ <a class="remove_site_key_js" href="#" data-repository=<?php echo $repository_id ?> data-confirmation="<?php esc_attr_e('Are you sure you want to remove this site key?', 'installer') ?>" data-nonce="<?php echo wp_create_nonce('remove_site_key_' . $repository_id) ?>"><?php printf(__("Remove current site key (%s)", 'installer'), $site_key) ?></a>
105
+ </center>
106
+ <br />
107
+
108
+ <?php include $this->plugin_path() . '/templates/downloads-list-compact.php'; ?>
109
+
110
+
111
+
112
+ <?php endif; ?>
113
+
114
+ <?php
115
+ if( isset( $args[ 'name' ] ) ):
116
+ $support_link = $this->get_support_tag_by_name($args['name'], $args['repository']); ?>
117
+
118
+ <?php if($support_link): ?>
119
+ <p><a href="<?php echo $support_link ?>" target="_blank"><?php printf(__('%s support on wpml.org', 'installer'), $args['name'] ) ?></a></p>
120
+
121
+ <?php endif; ?>
122
+ <?php
123
+ // compatibility for installer 1.1
124
+ elseif( isset( $args[ 'support_link' ] ) ): ?>
125
+ <p><?php echo $args[ 'support_link' ]; ?></p>
126
+ <?php endif; ?>
127
+
128
+ </div>
embedded/common/installer/templates/repository-listing.php ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if(($match = $this->get_matching_cp($repository)) && $match['exp']): ?>
2
+ <p class="alignright installer_highlight"><strong><?php printf('Price offers available until %s', date_i18n(get_option( 'date_format' ), $match['exp'])) ?></strong></p>
3
+ <?php endif; ?>
4
+
5
+ <h3><?php echo $repository['data']['name'] ?></h3>
6
+
7
+ <?php
8
+ $generic_product_name = $this->settings['repositories'][$repository_id]['data']['product-name'];
9
+
10
+
11
+
12
+
13
+
14
+ ?>
15
+
16
+ <table class="widefat otgs_wp_installer_table">
17
+
18
+ <tr>
19
+ <td>&nbsp;</td>
20
+ <td class="otgsi_register_product_wrap" align="center" valign="top">
21
+ <?php // IF NO SUBSCRIPTION ?>
22
+ <?php if(!$this->repository_has_subscription($repository_id)): ?>
23
+
24
+ <div style="text-align: right;">
25
+ <span><?php _e('Already bought?', 'installer'); ?>&nbsp;</span>
26
+ <a class="enter_site_key_js button-primary" href="#"><?php printf(__('Register %s', 'installer'), $generic_product_name); ?></a>&nbsp;&nbsp;
27
+ <form class="otgsi_site_key_form" method="post">
28
+ <input type="hidden" name="action" value="save_site_key" />
29
+ <input type="hidden" name="nonce" value="<?php echo wp_create_nonce('save_site_key_' . $repository_id) ?>" />
30
+ <input type="hidden" name="repository_id" value="<?php echo $repository_id ?>">
31
+ <?php _e('2. Enter your site key', 'installer'); ?>
32
+ <input type="text" size="10" name="site_key_<?php echo $repository_id ?>" placeholder="<?php echo esc_attr('site key') ?>" />
33
+ <input class="button-primary" type="submit" value="<?php esc_attr_e('OK', 'installer') ?>" />
34
+ <input class="button-secondary cancel_site_key_js" type="button" value="<?php esc_attr_e('Cancel', 'installer') ?>" />
35
+
36
+ <div class="alignleft" style="margin-top:6px;"><?php printf(__('1. Go to your %s%s account%s and add this site URL: %s', 'installer'),
37
+ '<a href="' . $this->settings['repositories'][$repository_id]['data']['site_keys_management_url'] . '?add='.urlencode($this->get_installer_site_url()).'">',
38
+ $generic_product_name, '</a>', $this->get_installer_site_url()); ?></div>
39
+ </form>
40
+ </div>
41
+
42
+ <?php
43
+ $site_key = false;
44
+
45
+ // IF SUBSCRIPTION
46
+ else:
47
+
48
+ $site_key = $this->settings['repositories'][$repository_id]['subscription']['key'];
49
+ $subscription_type = $this->get_subscription_type_for_repository($repository_id);
50
+
51
+ $upgrade_options = $this->get_upgrade_options($repository_id);
52
+ $expired = false;
53
+
54
+ ?>
55
+
56
+ <?php if($this->repository_has_expired_subscription($repository_id)): $expired = true; ?>
57
+ <div><p class="installer-warn-box"><?php _e('Subscription is expired. You need to either purchase a new subscription or upgrade if available.', 'installer') ?></p></div>
58
+ <?php else: ?>
59
+ <?php $this->show_subscription_renew_warning($repository_id, $subscription_type); ?>
60
+ <?php endif; ?>
61
+
62
+ <div class="alignright">
63
+ <a class="remove_site_key_js button-secondary" href="#" data-repository=<?php echo $repository_id ?> data-confirmation="<?php esc_attr_e('Are you sure you want to unregister?', 'installer') ?>" data-nonce="<?php echo wp_create_nonce('remove_site_key_' . $repository_id) ?>"><?php printf(__("Unregister %s from this site", 'installer'), $generic_product_name) ?></a>&nbsp;
64
+ <a class="update_site_key_js button-secondary" href="#" data-repository=<?php echo $repository_id ?> data-nonce="<?php echo wp_create_nonce('update_site_key_' . $repository_id) ?>"><?php _e('Update this info', 'installer') ?></a>
65
+ </div>
66
+
67
+ <?php if(empty($expired)): ?>
68
+ <div class="alignleft">
69
+ <?php if($expires = $this->settings['repositories'][$repository_id]['subscription']['data']->expires): ?>
70
+ <?php printf(__('%s is registered on this site. You will receive automatic updates until %s', 'installer'), $generic_product_name, date_i18n('F j, Y', strtotime($expires))); ?>
71
+ <?php else: ?>
72
+ <?php printf(__('%s is registered on this site. Your Lifetime account gives you updates for life.', 'installer'), $generic_product_name); ?>
73
+ <?php endif; ?>
74
+ </div>
75
+ <?php endif; //if(empty($expired)) ?>
76
+
77
+ <?php endif; // if(!repository_has_subscription) ?>
78
+
79
+ </td>
80
+ </tr>
81
+
82
+ <?php
83
+
84
+ $subscription_type = isset($subscription_type) ? $subscription_type : null;
85
+ $expired = isset($expired) ? $expired : null;
86
+ $upgrade_options = isset($upgrade_options) ? $upgrade_options : null;
87
+ $packages = $this->_render_product_packages($repository['data']['packages'], $subscription_type, $expired, $upgrade_options);
88
+ if(empty($subscription_type) || $expired){
89
+ $subpackages_expandable = true;
90
+ }else{
91
+ $subpackages_expandable = false;
92
+ }
93
+ ?>
94
+
95
+ <?php foreach($packages as $package): ?>
96
+ <tr>
97
+ <td><img width="140" height="140" src="<?php echo $package['image_url'] ?>" /></td>
98
+ <td>
99
+ <p><strong><?php echo $package['name'] ?></strong></p>
100
+ <p><?php echo $package['description'] ?></p>
101
+
102
+ <?php if($package['products']): ?>
103
+ <?php foreach($package['products'] as $product): ?>
104
+ <ul class="installer-products-list" style="display:inline">
105
+ <li>
106
+ <a class="button-secondary" href="<?php echo $product['url'] ?>"><?php echo $product['label'] ?></a>
107
+ </li>
108
+ </ul>
109
+ <?php endforeach; ?>
110
+ <?php endif; ?>
111
+
112
+ <?php if($package['downloads']): ?>
113
+ <?php include $this->plugin_path() . '/templates/downloads-list.php'; ?>
114
+ <?php endif; ?>
115
+
116
+ <?php if(!empty($package['sub-packages'])): ?>
117
+
118
+ <?php $subpackages = $this->_render_product_packages($package['sub-packages'], $subscription_type, $expired, $upgrade_options); ?>
119
+
120
+ <?php if($subpackages): ?>
121
+
122
+ <?php if($subpackages_expandable): ?>
123
+ <h5><a class="installer_expand_button" href="#" title="<?php esc_attr_e('Click to see individual components options.', 'installer') ?>"><?php _e('Individual components', 'installer') ?></a></h5>
124
+ <?php endif; ?>
125
+
126
+ <table class="otgs_wp_installer_subtable" style="<?php if($subpackages_expandable) echo 'display:none' ?>">
127
+ <?php foreach($subpackages as $package): ?>
128
+ <tr>
129
+ <td><img width="70" height="70" src="<?php echo $package['image_url'] ?>" /></td>
130
+ <td>
131
+ <p><strong><?php echo $package['name'] ?></strong></p>
132
+ <p><?php echo $package['description'] ?></p>
133
+
134
+ <?php if($package['products']): ?>
135
+ <?php foreach($package['products'] as $product): ?>
136
+ <ul class="installer-products-list" style="display:inline">
137
+ <li>
138
+ <a class="button-secondary" href="<?php echo $product['url'] ?>"><?php echo $product['label'] ?></a>
139
+ </li>
140
+ </ul>
141
+ <?php endforeach; ?>
142
+ <?php endif; ?>
143
+
144
+ <?php if($package['downloads']): ?>
145
+ <?php include $this->plugin_path() . '/templates/downloads-list.php'; ?>
146
+ <?php endif; ?>
147
+ </td>
148
+ </tr>
149
+ <?php endforeach; ?>
150
+ </table>
151
+ <?php endif; ?>
152
+
153
+ <?php endif; ?>
154
+
155
+
156
+ </td>
157
+ </tr>
158
+
159
+ <?php endforeach; ?>
160
+
161
+ </table>
162
+
163
+
164
+ <p><i><?php printf(__('This page lets you install plugins and update existing plugins. To remove any of these plugins, go to the %splugins%s page and if you have the permission to remove plugins you should be able to do this.', 'installer'), '<a href="' . admin_url('plugins.php') . '">' , '</a>'); ?></i></p>
165
+
166
+
167
+
168
+ <br />
embedded/common/toolset-forms/api.php CHANGED
@@ -2,9 +2,9 @@
2
 
3
  /**
4
  *
5
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/api.php $
6
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
7
- * $LastChangedRevision: 1012704 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
2
 
3
  /**
4
  *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/api.php $
6
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
7
+ * $LastChangedRevision: 1027712 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
embedded/common/toolset-forms/bootstrap.php CHANGED
@@ -2,9 +2,9 @@
2
 
3
  /**
4
  *
5
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/bootstrap.php $
6
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
7
- * $LastChangedRevision: 1012704 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
@@ -44,10 +44,10 @@ class WPToolset_Forms_Bootstrap
44
  // Date conditinal AJAX check
45
  add_action( 'wp_ajax_wptoolset_conditional',
46
  array($this, 'ajaxConditional') );
47
-
48
- // Date extended localization AJAX callback
49
- add_action( 'wp_ajax_wpt_localize_extended_date', array( $this, 'wpt_localize_extended_date' ) );
50
- add_action( 'wp_ajax_nopriv_wpt_localize_extended_date', array( $this, 'wpt_localize_extended_date' ) );
51
 
52
  // File media popup
53
  if ( (isset( $_GET['context'] ) && $_GET['context'] == 'wpt-fields-media-insert') || (isset( $_SERVER['HTTP_REFERER'] ) && strpos( $_SERVER['HTTP_REFERER'],
@@ -57,13 +57,15 @@ class WPToolset_Forms_Bootstrap
57
  add_action( 'init', array('WPToolset_Field_File', 'mediaPopup') );
58
  }
59
  add_filter('sanitize_file_name', array( $this, 'sanitize_file_name' ) );
60
-
61
- add_filter( 'wptoolset_filter_wptoolset_repdrag_image', array( $this, 'set_default_repdrag_image' ), 10, 1 );
62
  /**
63
  * common class for calendar
64
  */
65
  require_once WPTOOLSET_FORMS_ABSPATH.'/classes/class.date.scripts.php';
66
  new WPToolset_Field_Date_Scripts();
 
 
67
  }
68
 
69
  // returns HTML
@@ -124,19 +126,19 @@ class WPToolset_Forms_Bootstrap
124
  echo $this->checkConditional( array('conditional' => $data) );
125
  die();
126
  }
127
-
128
- public function wpt_localize_extended_date()
129
- {
130
- $date_format = $_POST['date-format'];
131
- if ($date_format == '') {
132
- $date_format = get_option('date_format');
133
- }
134
- $date = $_POST['date'];
135
- $date = adodb_mktime(0, 0, 0, substr($date, 2, 2), substr($date, 0, 2), substr($date, 4, 4));
136
- $date_format = str_replace('\\\\', '\\', $date_format);
137
- echo json_encode(array('display' => adodb_date($date_format, $date),'timestamp' => $date));
138
- die();
139
- }
140
 
141
  public function filterTypesField($field, $post_id = null, $_post_wpcf = array())
142
  {
@@ -169,7 +171,7 @@ class WPToolset_Forms_Bootstrap
169
  return WPToolset_Field_Date::timetodate( $timestamp, $format );
170
  }
171
 
172
- public function sanitize_file_name( $filename )
173
  {
174
  /**
175
  * replace german special characters
@@ -186,15 +188,80 @@ class WPToolset_Forms_Bootstrap
186
  /**
187
  * remove special characters
188
  */
189
- $filename = preg_replace( '/[^A-Za-z0-9\._]/', '-', $filename);
190
- $filename = preg_replace( '/[_ ]+/', '-', $filename);
191
  $filename = preg_replace( '/%20/', '-', $filename);
192
  return $filename;
193
  }
194
-
195
- public function set_default_repdrag_image( $image ) {
196
- return WPTOOLSET_FORMS_RELPATH . '/images/move.png';
197
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  }
199
 
200
  $GLOBALS['wptoolset_forms'] = new WPToolset_Forms_Bootstrap();
2
 
3
  /**
4
  *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/bootstrap.php $
6
+ * $LastChangedDate: 2014-10-23 10:33:39 +0000 (Thu, 23 Oct 2014) $
7
+ * $LastChangedRevision: 1012677 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
44
  // Date conditinal AJAX check
45
  add_action( 'wp_ajax_wptoolset_conditional',
46
  array($this, 'ajaxConditional') );
47
+
48
+ // Date extended localization AJAX callback
49
+ add_action( 'wp_ajax_wpt_localize_extended_date', array( $this, 'wpt_localize_extended_date' ) );
50
+ add_action( 'wp_ajax_nopriv_wpt_localize_extended_date', array( $this, 'wpt_localize_extended_date' ) );
51
 
52
  // File media popup
53
  if ( (isset( $_GET['context'] ) && $_GET['context'] == 'wpt-fields-media-insert') || (isset( $_SERVER['HTTP_REFERER'] ) && strpos( $_SERVER['HTTP_REFERER'],
57
  add_action( 'init', array('WPToolset_Field_File', 'mediaPopup') );
58
  }
59
  add_filter('sanitize_file_name', array( $this, 'sanitize_file_name' ) );
60
+
61
+ add_filter( 'wptoolset_filter_wptoolset_repdrag_image', array( $this, 'set_default_repdrag_image' ), 10, 1 );
62
  /**
63
  * common class for calendar
64
  */
65
  require_once WPTOOLSET_FORMS_ABSPATH.'/classes/class.date.scripts.php';
66
  new WPToolset_Field_Date_Scripts();
67
+
68
+ add_action('pre_get_posts', array($this,'pre_get_posts'));
69
  }
70
 
71
  // returns HTML
126
  echo $this->checkConditional( array('conditional' => $data) );
127
  die();
128
  }
129
+
130
+ public function wpt_localize_extended_date()
131
+ {
132
+ $date_format = $_POST['date-format'];
133
+ if ($date_format == '') {
134
+ $date_format = get_option('date_format');
135
+ }
136
+ $date = $_POST['date'];
137
+ $date = adodb_mktime(0, 0, 0, substr($date, 2, 2), substr($date, 0, 2), substr($date, 4, 4));
138
+ $date_format = str_replace('\\\\', '\\', $date_format);
139
+ echo json_encode(array('display' => adodb_date($date_format, $date),'timestamp' => $date));
140
+ die();
141
+ }
142
 
143
  public function filterTypesField($field, $post_id = null, $_post_wpcf = array())
144
  {
171
  return WPToolset_Field_Date::timetodate( $timestamp, $format );
172
  }
173
 
174
+ public function sanitize_file_name($filename)
175
  {
176
  /**
177
  * replace german special characters
188
  /**
189
  * remove special characters
190
  */
191
+ $filename = preg_replace( '/[^A-Za-z0-9\._@]/', '-', $filename);
 
192
  $filename = preg_replace( '/%20/', '-', $filename);
193
  return $filename;
194
  }
195
+
196
+ public function set_default_repdrag_image($image)
197
+ {
198
+ return WPTOOLSET_FORMS_RELPATH . '/images/move.png';
199
+ }
200
+
201
+ /**
202
+ * add custom post type to query when they use category or tags taxonomy.
203
+ */
204
+ public function pre_get_posts($query)
205
+ {
206
+ if ( is_admin() ) {
207
+ return;
208
+ }
209
+ /**
210
+ * do that only for main query
211
+ */
212
+ if (!$query->is_main_query()) {
213
+ return;
214
+ }
215
+
216
+ $types_cpt = get_option( 'wpcf-custom-types');
217
+ if (!is_array($types_cpt) || empty($types_cpt)) {
218
+ return;
219
+ }
220
+ $cpt_to_add = array();
221
+ /**
222
+ * check category
223
+ */
224
+ if ( is_category() ) {
225
+ foreach($types_cpt as $cpt_slug => $cpt) {
226
+ if (array_key_exists('taxonomies', $cpt) && is_array($cpt['taxonomies'])) {
227
+ foreach($cpt['taxonomies'] as $tax_slug => $value) {
228
+ if ('category' == $tax_slug && $value) {
229
+ $cpt_to_add[] = $cpt_slug;
230
+ }
231
+ }
232
+ }
233
+ }
234
+ }
235
+ /**
236
+ * check tags
237
+ */
238
+ if ( is_tag() ) {
239
+ foreach($types_cpt as $cpt_slug => $cpt) {
240
+ if (array_key_exists('taxonomies', $cpt) && is_array($cpt['taxonomies'])) {
241
+ foreach($cpt['taxonomies'] as $tax_slug => $value) {
242
+ if ('post_tag' == $tax_slug && $value) {
243
+ $cpt_to_add[] = $cpt_slug;
244
+ }
245
+ }
246
+ }
247
+ }
248
+ }
249
+ /**
250
+ * change query if some CPT use this
251
+ */
252
+ if (!empty($cpt_to_add)) {
253
+ /**
254
+ * remeber if is empty, then is post
255
+ */
256
+ $current_types = $query->get('post_type');
257
+ if(empty($current_types)) {
258
+ $cpt_to_add[] = 'post';
259
+ } else {
260
+ $cpt_to_add = array_merge($current_types, $cpt_to_add);
261
+ }
262
+ $query->set('post_type', $cpt_to_add);
263
+ }
264
+ }
265
  }
266
 
267
  $GLOBALS['wptoolset_forms'] = new WPToolset_Forms_Bootstrap();
embedded/common/toolset-forms/classes/class.audio.php CHANGED
@@ -6,9 +6,9 @@ require_once 'class.file.php';
6
  *
7
  * @author Srdjan
8
  *
9
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.audio.php $
10
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
11
- * $LastChangedRevision: 1012704 $
12
  * $LastChangedBy: iworks $
13
  *
14
  */
6
  *
7
  * @author Srdjan
8
  *
9
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.audio.php $
10
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
11
+ * $LastChangedRevision: 1027712 $
12
  * $LastChangedBy: iworks $
13
  *
14
  */
embedded/common/toolset-forms/classes/class.checkbox.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  *
4
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.checkbox.php $
5
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
6
- * $LastChangedRevision: 1012704 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
@@ -35,10 +35,16 @@ class WPToolset_Field_Checkbox extends FieldFactory
35
  if ( isset($data['options']) && array_key_exists( 'checked', $data['options'] ) ) {
36
  $checked = $data['options']['checked'];
37
  }
38
- if ( array_key_exists('default_value', $data) && $value == $data['default_value'] ) {
 
 
 
 
 
 
39
  $checked = true;
40
  }
41
-
42
  // Comment out broken code. This tries to set the previous state after validation fails
43
  //if (!$checked&&$this->getValue()==1) {
44
  // $checked=true;
1
  <?php
2
  /**
3
  *
4
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.checkbox.php $
5
+ * $LastChangedDate: 2014-10-23 10:33:39 +0000 (Thu, 23 Oct 2014) $
6
+ * $LastChangedRevision: 1012677 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
35
  if ( isset($data['options']) && array_key_exists( 'checked', $data['options'] ) ) {
36
  $checked = $data['options']['checked'];
37
  }
38
+ /**
39
+ * if is a default value, there value is 1 or default_value
40
+ */
41
+ if (
42
+ array_key_exists('default_value', $data)
43
+ && ( '1' === $value || $value == $data['default_value'] )
44
+ ) {
45
  $checked = true;
46
  }
47
+
48
  // Comment out broken code. This tries to set the previous state after validation fails
49
  //if (!$checked&&$this->getValue()==1) {
50
  // $checked=true;
embedded/common/toolset-forms/classes/class.checkboxes.php CHANGED
@@ -4,9 +4,9 @@
4
  *
5
  * @author Srdjan
6
  *
7
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.checkboxes.php $
8
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
9
- * $LastChangedRevision: 1012704 $
10
  * $LastChangedBy: iworks $
11
  *
12
  */
@@ -25,13 +25,13 @@ class WPToolset_Field_Checkboxes extends FieldFactory
25
  $_options = array();
26
  if (isset($data['options'])) {
27
  foreach ( $data['options'] as $option_key => $option ) {
28
-
29
  $checked = isset( $option['checked'] ) ? $option['checked'] : !empty( $value[$option_key] );
30
-
31
  if (isset($post) && 'auto-draft' == $post->post_status && array_key_exists( 'checked', $option ) && $option['checked']) {
32
  $checked = true;
33
  }
34
-
35
  // Comment out broken code. This tries to set the previous state after validation fails
36
  //$_values=$this->getValue();
37
  //if (!$checked&&isset($value)&&!empty($value)&&is_array($value)&&in_array($option['value'],$value)) {
@@ -46,14 +46,31 @@ class WPToolset_Field_Checkboxes extends FieldFactory
46
  '#name' => $option['name']."[]",
47
  //'#inline' => true,
48
  );
49
-
50
  if ( isset( $option['data-value'] ) ) {
51
  //Fixing https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/188528502/comments
52
  $_options[$option_key]['#attributes'] = array('data-value' => $option['data-value']);
53
  }
54
-
55
- if ( !is_admin() ) {// TODO maybe add a doing_ajax() check too, what if we want to load a form using AJAX?
56
- $_options[$option_key]['#before'] = '<li class="wpt-form-item wpt-form-item-checkbox">';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  $_options[$option_key]['#after'] = '</li>';
58
  $_options[$option_key]['#pattern'] = '<BEFORE><PREFIX><ELEMENT><LABEL><ERROR><SUFFIX><DESCRIPTION><AFTER>';
59
  }
4
  *
5
  * @author Srdjan
6
  *
7
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.checkboxes.php $
8
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
9
+ * $LastChangedRevision: 1027712 $
10
  * $LastChangedBy: iworks $
11
  *
12
  */
25
  $_options = array();
26
  if (isset($data['options'])) {
27
  foreach ( $data['options'] as $option_key => $option ) {
28
+
29
  $checked = isset( $option['checked'] ) ? $option['checked'] : !empty( $value[$option_key] );
30
+
31
  if (isset($post) && 'auto-draft' == $post->post_status && array_key_exists( 'checked', $option ) && $option['checked']) {
32
  $checked = true;
33
  }
34
+
35
  // Comment out broken code. This tries to set the previous state after validation fails
36
  //$_values=$this->getValue();
37
  //if (!$checked&&isset($value)&&!empty($value)&&is_array($value)&&in_array($option['value'],$value)) {
46
  '#name' => $option['name']."[]",
47
  //'#inline' => true,
48
  );
49
+
50
  if ( isset( $option['data-value'] ) ) {
51
  //Fixing https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/188528502/comments
52
  $_options[$option_key]['#attributes'] = array('data-value' => $option['data-value']);
53
  }
54
+
55
+ if ( !is_admin() ) {// TODO maybe add a doing_ajax() check too, what if we want to load a form using AJAX?
56
+ $clases = array(
57
+ 'wpt-form-item',
58
+ 'wpt-form-item-checkbox',
59
+ 'checkbox-'.sanitize_title($option['title'])
60
+ );
61
+ /**
62
+ * filter: cred_checkboxes_class
63
+ * @param array $clases current array of classes
64
+ * @parem array $option current option
65
+ * @param string field type
66
+ *
67
+ * @return array
68
+ */
69
+ $clases = apply_filters( 'cred_item_li_class', $clases, $option, 'checkboxes' );
70
+ $_options[$option_key]['#before'] = sprintf(
71
+ '<li class="%s">',
72
+ implode(' ', $clases)
73
+ );
74
  $_options[$option_key]['#after'] = '</li>';
75
  $_options[$option_key]['#pattern'] = '<BEFORE><PREFIX><ELEMENT><LABEL><ERROR><SUFFIX><DESCRIPTION><AFTER>';
76
  }
embedded/common/toolset-forms/classes/class.colorpicker.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  *
4
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.colorpicker.php $
5
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
6
- * $LastChangedRevision: 1012704 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
1
  <?php
2
  /**
3
  *
4
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.colorpicker.php $
5
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
6
+ * $LastChangedRevision: 1027712 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
embedded/common/toolset-forms/classes/class.conditional.php CHANGED
@@ -82,7 +82,7 @@ class WPToolset_Forms_Conditional
82
  wp_localize_script( 'wptoolset-form-conditional', 'wptConditional', $js_data );
83
 
84
  wp_register_script( 'wptoolset-parser',
85
- icl_get_file_relpath(__FILE__) . '/../../expression-parser/js/parser.js', array('jquery'),
86
  WPTOOLSET_FORMS_VERSION, true );
87
  wp_enqueue_script( 'wptoolset-parser' );
88
  $js_data = array(
@@ -190,7 +190,7 @@ class WPToolset_Forms_Conditional
190
  * check conditions
191
  */
192
  if ( !array_key_exists( 'conditions', $config ) ) {
193
- return false;
194
  }
195
 
196
  $passedOne = false;
82
  wp_localize_script( 'wptoolset-form-conditional', 'wptConditional', $js_data );
83
 
84
  wp_register_script( 'wptoolset-parser',
85
+ icl_get_file_relpath( dirname( dirname(__FILE__) ) ) . '/expression-parser/js/parser.js', array('jquery'),
86
  WPTOOLSET_FORMS_VERSION, true );
87
  wp_enqueue_script( 'wptoolset-parser' );
88
  $js_data = array(
190
  * check conditions
191
  */
192
  if ( !array_key_exists( 'conditions', $config ) ) {
193
+ return true;
194
  }
195
 
196
  $passedOne = false;
embedded/common/toolset-forms/classes/class.credaudio.php CHANGED
@@ -7,9 +7,9 @@ require_once 'class.audio.php';
7
  *
8
  * @author Srdjan
9
  *
10
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.credaudio.php $
11
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
12
- * $LastChangedRevision: 1012704 $
13
  * $LastChangedBy: iworks $
14
  *
15
  */
7
  *
8
  * @author Srdjan
9
  *
10
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.credaudio.php $
11
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
12
+ * $LastChangedRevision: 1027712 $
13
  * $LastChangedBy: iworks $
14
  *
15
  */
embedded/common/toolset-forms/classes/class.credfile.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  *
4
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.credfile.php $
5
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
6
- * $LastChangedRevision: 1012704 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
@@ -111,7 +111,7 @@ class WPToolset_Field_Credfile extends WPToolset_Field_Textfield
111
  );
112
  $form[] = array(
113
  '#type' => 'markup',
114
- '#markup' => '<input type="button"' . $delete_input_showhide . ' data-action="delete" class="js-wpt-credfile-delete wpt-credfile-delete' . $button_extra_classnames . '" value="' . esc_attr( __( 'Delete', 'wpv-views' ) ) . '" />',
115
  );
116
  $form[] = array(
117
  '#type' => 'hidden',
1
  <?php
2
  /**
3
  *
4
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.credfile.php $
5
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
6
+ * $LastChangedRevision: 1027712 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
111
  );
112
  $form[] = array(
113
  '#type' => 'markup',
114
+ '#markup' => '<input type="button"' . $delete_input_showhide . ' data-action="delete" class="js-wpt-credfile-delete wpt-credfile-delete' . $button_extra_classnames . '" value="' . esc_attr( __( 'Clear', 'wpv-views' ) ) . '" />',
115
  );
116
  $form[] = array(
117
  '#type' => 'hidden',
embedded/common/toolset-forms/classes/class.credimage.php CHANGED
@@ -7,9 +7,9 @@ require_once 'class.image.php';
7
  *
8
  * @author Srdjan
9
  *
10
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.credimage.php $
11
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
12
- * $LastChangedRevision: 1012704 $
13
  * $LastChangedBy: iworks $
14
  *
15
  */
7
  *
8
  * @author Srdjan
9
  *
10
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.credimage.php $
11
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
12
+ * $LastChangedRevision: 1027712 $
13
  * $LastChangedBy: iworks $
14
  *
15
  */
embedded/common/toolset-forms/classes/class.credvideo.php CHANGED
@@ -7,9 +7,9 @@ require_once 'class.video.php';
7
  *
8
  * @author Srdjan
9
  *
10
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.credvideo.php $
11
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
12
- * $LastChangedRevision: 1012704 $
13
  * $LastChangedBy: iworks $
14
  *
15
  */
7
  *
8
  * @author Srdjan
9
  *
10
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.credvideo.php $
11
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
12
+ * $LastChangedRevision: 1027712 $
13
  * $LastChangedBy: iworks $
14
  *
15
  */
embedded/common/toolset-forms/classes/class.date.php CHANGED
@@ -1,7 +1,8 @@
1
  <?php
 
2
  require_once 'class.field_factory.php';
3
  if (!function_exists('adodb_mktime')) {
4
- require_once WPTOOLSET_FORMS_ABSPATH . '/lib/adodb-time.inc.php';
5
  }
6
 
7
  /**
@@ -11,13 +12,12 @@ if (!function_exists('adodb_mktime')) {
11
  */
12
  class WPToolset_Field_Date extends FieldFactory
13
  {
14
-
15
  // 15/10/1582 00:00 - 31/12/3000 23:59
16
  protected static $_mintimestamp = -12219292800, $_maxtimestamp = 32535215940;
17
 
18
  public function init()
19
  {
20
- }
21
 
22
  public static function registerScripts()
23
  {
@@ -27,25 +27,18 @@ class WPToolset_Field_Date extends FieldFactory
27
  {
28
  }
29
 
30
- public static function addFilters(){
31
- if ( has_filter( 'wptoolset_validation_value_date',
32
- array('WPToolset_Field_Date', 'filterValidationValue') ) )
33
- return;
34
  // Filter validation
35
- add_filter( 'wptoolset_validation_value_date',
36
- array('WPToolset_Field_Date', 'filterValidationValue') );
37
- add_filter( 'wptoolset_validation_rule_js',
38
- array('WPToolset_Field_Date', 'filterValidationRuleJs') );
39
- add_filter( 'wptoolset_validation_args_php',
40
- array('WPToolset_Field_Date', 'filterValidationArgsPhp'), 10, 2 );
41
  // Filter conditional
42
- add_filter( 'wptoolset_conditional_args_php',
43
- array('WPToolset_Field_Date', 'filterConditionalArgsPhp'), 10, 2 );
44
- add_filter( 'wptoolset_conditional_value_php',
45
- array('WPToolset_Field_Date', 'filterConditionalValuePhp'), 10,
46
- 2 );
47
- add_filter( 'wptoolset_conditional_args_js',
48
- array('WPToolset_Field_Date', 'filterConditionalArgsJs'), 10, 2 );
49
  }
50
 
51
  public function enqueueScripts()
@@ -56,194 +49,193 @@ class WPToolset_Field_Date extends FieldFactory
56
  {
57
  }
58
 
59
- public function metaform() {
 
60
  $time_value = $this->getValue();
61
  $datepicker = $hour = $minute = null;
62
- $timestamp = false;
63
- $readonly = false;
64
- $clear_date_showhide = '';
65
- if ( is_admin() ) {
66
- // In this case, getValue returns the timestamp stored as postmeta value on the database
67
- // So we compose $timestamp, $datepicker, $hour and $minute based on that value
68
- if ( !empty( $time_value ) && $time_value != '0' ) {
69
- if ( !is_numeric( $time_value ) ) {
70
- $timestamp = self::strtotime( $time_value );
71
- } else {
72
- $timestamp = $time_value;
73
- }
74
- if ( $timestamp !== false && self::_isTimestampInRange( $timestamp ) ) {
75
- $datepicker = self::timetodate( $timestamp );
76
- $hour = self::timetodate( $timestamp, 'H' );
77
- $minute = self::timetodate( $timestamp, 'i' );
78
- }
79
- }
80
- } else {
81
- // We are on a CRED form, on frontend, so getVAlue returns nothing or a string or an array of the kind array( 'datepicker' =>, 'hour' =>, 'minute' => )
82
- // Note that even if the array is passed, 'hour' and 'minute' will only be passed if there are any
83
- if ( !empty( $time_value ) ) {
84
- if ( is_array( $time_value ) ) {
85
- if ( isset ( $time_value['timestamp'] ) && is_numeric( $time_value['timestamp'] ) && self::_isTimestampInRange( $time_value['timestamp'] ) ) {
86
- $timestamp = $time_value['timestamp'];
87
- $datepicker = self::timetodate( $timestamp );
88
- } else if ( isset( $time_value['datepicker'] ) && $time_value['datepicker'] !== false && is_numeric( $time_value['datepicker'] ) && self::_isTimestampInRange( $time_value['datepicker'] ) ) {
89
- $timestamp = $time_value['datepicker'];
90
- $datepicker = self::timetodate( $timestamp );
91
- }
92
- if ( isset( $time_value['hour'] ) && is_numeric( $time_value['hour'] ) ) {
93
- $hour = $time_value['hour'];
94
- }
95
- if ( isset( $time_value['minute'] ) && is_numeric( $time_value['minute'] ) ) {
96
- $minute = $time_value['minute'];
97
- }
98
- } else {
99
- if ( is_numeric( $time_value ) && self::_isTimestampInRange( $time_value ) ) {
100
- $timestamp = $time_value;
101
- $datepicker = self::timetodate( $timestamp );
102
- } else {
103
- $timestamp = self::strtotime( $time_value );
104
- $datepicker = $time_value;
105
- }
106
- }
107
- }
108
- }
109
  $data = $this->getData();
110
- if ( !$timestamp ) {
111
- // If there is no timestamp, we need to make it an empty string
112
- // A false value would render the hidden field with a value of 1
113
- $timestamp = '';
114
- $datepicker = null;
115
- $clear_date_showhide = ' style="display:none"';
116
- }
117
-
118
  $def_class = 'js-wpt-date';
119
-
120
- $def_class_aux = 'js-wpt-date-auxiliar';
121
-
122
- if ( isset( $data['attribute'] ) && isset( $data['attribute']['readonly'] ) && $data['attribute']['readonly'] == 'readonly' ) {
123
- $def_class .= ' js-wpv-date-readonly';
124
- $def_class_aux .= ' js-wpt-date-readonly';
125
- $readonly = true;
126
- }
127
-
128
  $form = array();
129
-
130
- $validate = $this->getValidationData();
131
- $title = $this->getTitle();
132
-
133
- if ( isset( $validate['required'] ) && !empty( $title ) ) {
134
- // Asterisk
135
- $title .= '&#42;';
136
- }
137
-
138
- $attr_visible = array(
139
- 'class' => $def_class,
140
- 'style' => 'display:inline;width:150px;position:relative;z-index:20;',
141
- 'readonly' => 'readonly',
142
- 'title' => esc_attr( __( 'Select date', 'wpv-views' ) )
143
- );
144
- $attr_hidden = array('class' => $def_class_aux, 'data-ts' => $timestamp, 'data-wpt-type' => 'date' );
145
-
146
- if ( isset( $data['attribute'] ) && isset( $data['attribute']['placeholder'] ) ) {
147
- $attr_visible['placeholder'] = $data['attribute']['placeholder'];
148
- }
149
-
150
- $form[] = array(
151
  '#type' => 'textfield',
152
  '#title' => $title,
153
- '#description' => $this->getDescription(),
154
  '#attributes' => $attr_visible,
155
  '#name' => '',
156
  '#value' => $datepicker,
157
- '#inline' => true,
158
  );
159
- $form[] = array(
160
  '#type' => 'hidden',
161
  '#title' => $title,
162
  '#attributes' => $attr_hidden,
163
  '#name' => $this->getName() . '[datepicker]',
164
  '#value' => $timestamp,
165
- '#validate' => $validate,
166
  '#repetitive' => $this->isRepetitive(),
167
  );
168
-
169
- /*
170
- // This was the old implementaton
171
- // We have implemented the above one because we need a hidden field to hold the timestamp
172
- // And the visible text input field to display the date string to the user
173
- $form[] = array(
174
- '#type' => 'textfield',
175
- '#title' => $this->getTitle(),
176
- '#attributes' => array('class' => $def_class, 'style' => 'width:150px;'),
177
- '#name' => $this->getName() . '[datepicker]',
178
- '#value' => $timestamp,
179
- '#validate' => $this->getValidationData(),
180
- '#repetitive' => $this->isRepetitive(),
181
- );
182
- */
183
- if ( !empty( $data['add_time'] ) ) {
184
  // Shared attributes
185
- $attributes_hour_minute = array();
186
- if ( $readonly ) {
187
- $attributes_hour_minute['disabled'] = 'disabled' ;
188
- }
189
- if ( array_key_exists( 'use_bootstrap', $this->_data ) && $this->_data['use_bootstrap'] ) {
190
- $attributes_hour_minute['style'] = 'display:inline;width:auto;' ;
191
  }
192
-
193
- // Hour
194
  $hours = 24;
195
  $options = array();
196
- for ( $index = 0; $index < $hours; $index++ ) {
197
  $prefix = $index < 10 ? '0' : '';
198
  $options[$index] = array(
199
- '#title' => $prefix . strval( $index ),
200
  '#value' => $index,
201
  );
202
  }
203
  $hour_element = array(
204
  '#type' => 'select',
205
- '#before' => '<span class="wpt-form-label">' . __( 'Hour', 'wpv-views' ) . '</span>',
206
  '#options' => $options,
207
  '#default_value' => $hour,
208
  '#name' => $this->getName() . '[hour]',
209
  '#inline' => true,
210
- '#attributes' => array( 'title' => esc_attr( __( 'Select hour', 'wpv-views' ) ) ),
211
  );
212
- if ( !empty( $attributes_hour_minute ) ) {
213
- $hour_element['#attributes'] = $attributes_hour_minute;
214
- }
215
  $form[] = $hour_element;
216
  // Minutes
217
  $minutes = 60;
218
  $options = array();
219
- for ( $index = 0; $index < $minutes; $index++ ) {
220
  $prefix = $index < 10 ? '0' : '';
221
  $options[$index] = array(
222
- '#title' => $prefix . strval( $index ),
223
  '#value' => $index,
224
  );
225
  }
226
- $minute_element = array(
227
  '#type' => 'select',
228
- '#before' => '<span class="wpt-form-label">' . __( 'Minute', 'wpv-views' ) . '</span>',
229
  '#options' => $options,
230
  '#default_value' => $minute,
231
  '#name' => $this->getName() . '[minute]',
232
  '#inline' => true,
233
- '#attributes' => array( 'title' => esc_attr( __( 'Select minute', 'wpv-views' ) ) ),
234
  );
235
- if ( !empty( $attributes_hour_minute ) ) {
236
- $minute_element['#attributes'] = $attributes_hour_minute;
237
- }
238
  $form[] = $minute_element;
239
  }
240
-
241
- $form[] = array(
242
- '#type' => 'markup',
243
- '#inline' => true,
244
- '#markup' => '<input type="button"' . $clear_date_showhide . ' class="button button-secondary js-wpt-date-clear wpt-date-clear" value="' . esc_attr( __( 'Clear date', 'wpv-views' ) ) . '" />',
245
- );
246
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  return $form;
248
  }
249
 
@@ -252,141 +244,148 @@ class WPToolset_Field_Date extends FieldFactory
252
  return WPToolset_Field_Date_Scripts::getDateFormat();
253
  }
254
 
255
- protected function _dateToStrftime( $format ) {
256
- $format = str_replace( 'd', '%d', $format );
257
- $format = str_replace( 'D', '%a', $format );
258
- $format = str_replace( 'j', '%e', $format );
259
- $format = str_replace( 'l', '%A', $format );
260
- $format = str_replace( 'N', '%u', $format );
261
- $format = str_replace( 'w', '%w', $format );
 
262
 
263
- $format = str_replace( 'W', '%W', $format );
264
 
265
- $format = str_replace( 'F', '%B', $format );
266
- $format = str_replace( 'm', '%m', $format );
267
- $format = str_replace( 'M', '%b', $format );
268
- $format = str_replace( 'n', '%m', $format );
269
 
270
- $format = str_replace( 'o', '%g', $format );
271
- $format = str_replace( 'Y', '%Y', $format );
272
- $format = str_replace( 'y', '%y', $format );
273
 
274
  return $format;
275
  }
276
 
277
- public static function filterValidationValue( $value ) {
278
- if ( isset( $value['datepicker'] ) ) {
 
279
  return $value['datepicker'];
280
  }
281
  return $value;
282
  }
283
 
284
- public static function filterValidationRuleJs( $rule ) {
285
- if ( $rule == 'date' ) {
286
- return 'dateADODB_STAMP';
287
- } else {
288
- return $rule;
289
- }
 
290
  }
291
 
292
- public static function filterValidationArgsPhp( $args, $rule ) {
293
- if ( $rule == 'date' ) {
 
294
  return array('$value', self::getDateFormat());
295
  }
296
  return $args;
297
  }
298
 
299
- public static function filterConditionalArgsJs( $args, $type ) {
300
- if ( $type == 'date' ) {
301
- foreach ( $args as &$arg ) {
302
- if ( !is_numeric( $arg ) ) {
303
- // Well it should be a numeric timestamp indeed
304
- $arg = self::strtotime( $arg );
 
305
  }
306
  }
307
  }
308
  return $args;
309
  }
310
 
311
- public static function filterConditionalArgsPhp( $args, $type ) {
312
- if ( $type == 'date' ) {
313
- foreach ( $args as &$arg ) {
314
- $arg = self::filterConditionalValuePhp( $arg, $type );
 
315
  }
316
  }
317
  return $args;
318
  }
319
 
320
- public static function filterConditionalValuePhp( $value, $type ) {
321
- if ( $type == 'date' ) {
322
- if ( !is_numeric( $value ) ) {
323
- // Well it should be a numeric timestamp indeed
324
- $value = self::strtotime( $value );
 
325
  }
326
  // Use timestamp with PHP
327
  // Convert back/forward to have rounded timestamp (no H and i)
328
- // TODO review this because we should not play with timestamps generated on adodb_xxx functions
329
  //$value = self::strtotime( self::timetodate( $value ) );
330
  }
331
  return $value;
332
  }
333
 
334
- // We need to keep this for backwards compatibility
335
- // Note that this function will only convert dates coming on a string:
336
- // - in english
337
- // - inside the valid PHP date range
338
- // We are only using this when the value being checked is not a timestamp
339
- // And we have tried to avoid that situation from happening
340
- // But for old implementation, this happens for date conditions on conditional fields
341
- public static function strtotime( $value, $format = null )
342
  {
343
- if ( is_null( $format ) ) {
344
  $format = self::getDateFormat();
345
  }
346
  /**
347
  * add exception to handle short year
348
  */
349
- if ( 'd/m/y' == $format ) {
350
- preg_match_all( '/(\d{2})/', $value, $value );
351
- $value[0][2] += $value[0][2] < 70? 2000:1900;
352
- $value = implode('-', $value[0] );
353
  }
354
- if ( strpos($format, 'd/m/Y') !== false ) {
355
  // strtotime requires a dash or dot separator to determine dd/mm/yyyy format
356
- preg_match( '/\d{2}\/\d{2}\/\d{4}/', $value, $matches );
357
- if ( !empty( $matches ) ) {
358
- foreach ( $matches as $match ) {
359
- $value = str_replace( $match,
360
- str_replace( '/', '-', $match ), $value );
361
  }
362
  }
363
  }
364
  try {
365
- $date = new DateTime( $value );
366
- } catch ( Exception $e ) {
367
  return false;
368
  }
369
- $timestamp = $date->format( "U" );
370
- return self::_isTimestampInRange( $timestamp ) ? $timestamp : false;
371
  }
372
 
373
- // TODO review this because we should not play with timestamps generated on adodb_xxx functions
374
- public static function timetodate( $timestamp, $format = null )
375
  {
376
- return WPToolset_Field_Date_Scripts::timetodate( $timestamp, $format );
377
  }
378
 
379
- protected static function _isTimestampInRange( $timestamp )
380
  {
381
  return WPToolset_Field_Date_Scripts::_isTimestampInRange($timestamp);
382
  }
383
 
384
  /**
385
  * DEPRECATED
386
- *
387
- * This is not used anymore
388
  */
389
- public static function timeIsValid( $time ) {
 
390
  /*
391
  * http://php.net/manual/en/function.strtotime.php
392
  * The valid range of a timestamp is typically
@@ -400,23 +399,24 @@ class WPToolset_Field_Date extends FieldFactory
400
  * This means that e.g. dates prior to Jan 1, 1970 will not
401
  * work on Windows, some Linux distributions,
402
  * and a few other operating systems.
403
- * PHP 5.1.0 and newer versions overcome this limitation though.
404
  */
405
  // MIN 'Jan 1, 1970' - 0 | Fri, 13 Dec 1901 20:45:54 UTC
406
  $_min_time = self::timeNegativeSupported() ? -2147483646 : 0;
407
  // MAX 'Tue, 19 Jan 2038 03:14:07 UTC' - 2147483647
408
  $_max_time = 2147483647;
409
 
410
- return is_numeric( $time ) && $_min_time <= intval( $time ) && intval( $time ) <= $_max_time;
411
  }
412
 
413
  /**
414
  * DEPRECATED
415
- *
416
- * This is not used anymore
417
  */
418
- public static function timeNegativeSupported() {
419
- return strtotime( 'Fri, 13 Dec 1950 20:45:54 UTC' ) === -601010046;
 
420
  }
421
 
422
  }
1
  <?php
2
+
3
  require_once 'class.field_factory.php';
4
  if (!function_exists('adodb_mktime')) {
5
+ require_once WPTOOLSET_FORMS_ABSPATH . '/lib/adodb-time.inc.php';
6
  }
7
 
8
  /**
12
  */
13
  class WPToolset_Field_Date extends FieldFactory
14
  {
 
15
  // 15/10/1582 00:00 - 31/12/3000 23:59
16
  protected static $_mintimestamp = -12219292800, $_maxtimestamp = 32535215940;
17
 
18
  public function init()
19
  {
20
+ }
21
 
22
  public static function registerScripts()
23
  {
27
  {
28
  }
29
 
30
+ public static function addFilters()
31
+ {
32
+ if (has_filter('wptoolset_validation_value_date', array('WPToolset_Field_Date', 'filterValidationValue')))
33
+ return;
34
  // Filter validation
35
+ add_filter('wptoolset_validation_value_date', array('WPToolset_Field_Date', 'filterValidationValue'));
36
+ add_filter('wptoolset_validation_rule_js', array('WPToolset_Field_Date', 'filterValidationRuleJs'));
37
+ add_filter('wptoolset_validation_args_php', array('WPToolset_Field_Date', 'filterValidationArgsPhp'), 10, 2);
 
 
 
38
  // Filter conditional
39
+ add_filter('wptoolset_conditional_args_php', array('WPToolset_Field_Date', 'filterConditionalArgsPhp'), 10, 2);
40
+ add_filter('wptoolset_conditional_value_php', array('WPToolset_Field_Date', 'filterConditionalValuePhp'), 10, 2);
41
+ add_filter('wptoolset_conditional_args_js', array('WPToolset_Field_Date', 'filterConditionalArgsJs'), 10, 2);
 
 
 
 
42
  }
43
 
44
  public function enqueueScripts()
49
  {
50
  }
51
 
52
+ public function metaform()
53
+ {
54
  $time_value = $this->getValue();
55
  $datepicker = $hour = $minute = null;
56
+ $timestamp = null;
57
+ $readonly = false;
58
+ if (is_admin()) {
59
+ if (is_array($time_value) && array_key_exists('timestamp', $time_value) && $time_value ) {
60
+ $timestamp = $time_value['timestamp'];
61
+ }
62
+ $datepicker = self::timetodate($timestamp);
63
+ $hour = self::timetodate($timestamp, 'H');
64
+ $minute = self::timetodate($timestamp, 'i');
65
+ } else {
66
+ // We are on a CRED form, on frontend, so getVAlue returns nothing or a string or an array of the kind array( 'datepicker' =>, 'hour' =>, 'minute' => )
67
+ // Note that even if the array is passed, 'hour' and 'minute' will only be passed if there are any
68
+ if (!empty($time_value)) {
69
+ if (is_array($time_value)) {
70
+ if (isset($time_value['timestamp']) && is_numeric($time_value['timestamp']) && self::_isTimestampInRange($time_value['timestamp'])) {
71
+ $timestamp = $time_value['timestamp'];
72
+ $datepicker = self::timetodate($timestamp);
73
+ } elseif (isset($time_value['datepicker']) && $time_value['datepicker'] !== false && is_numeric($time_value['datepicker']) && self::_isTimestampInRange($time_value['datepicker'])) {
74
+ $timestamp = $time_value['datepicker'];
75
+ $datepicker = self::timetodate($timestamp);
76
+ }
77
+ if (isset($time_value['hour']) && is_numeric($time_value['hour'])) {
78
+ $hour = $time_value['hour'];
79
+ }
80
+ if (isset($time_value['minute']) && is_numeric($time_value['minute'])) {
81
+ $minute = $time_value['minute'];
82
+ }
83
+ } else {
84
+ if (is_numeric($time_value) && self::_isTimestampInRange($time_value)) {
85
+ $timestamp = $time_value;
86
+ $datepicker = self::timetodate($timestamp);
87
+ } else {
88
+ $timestamp = self::strtotime($time_value);
89
+ $datepicker = $time_value;
90
+ }
91
+ }
92
+ }
93
+ }
 
 
 
 
 
 
 
 
 
94
  $data = $this->getData();
95
+
96
+ if (!$timestamp) {
97
+ // If there is no timestamp, we need to make it an empty string
98
+ // A false value would render the hidden field with a value of 1
99
+ $timestamp = '';
100
+ $datepicker = null;
101
+ }
102
+
103
  $def_class = 'js-wpt-date';
104
+
105
+ $def_class_aux = 'js-wpt-date-auxiliar';
106
+
107
+ if (isset($data['attribute']) && isset($data['attribute']['readonly']) && $data['attribute']['readonly'] == 'readonly') {
108
+ $def_class .= ' js-wpv-date-readonly';
109
+ $def_class_aux .= ' js-wpt-date-readonly';
110
+ $readonly = true;
111
+ }
112
+
113
  $form = array();
114
+
115
+ $validate = $this->getValidationData();
116
+ $title = $this->getTitle();
117
+
118
+ if (isset($validate['required']) && !empty($title)) {
119
+ // Asterisk
120
+ $title .= '&#42;';
121
+ }
122
+
123
+ $attr_visible = array(
124
+ 'class' => $def_class,
125
+ 'style' => 'display:inline;width:150px;position:relative;z-index:20;',
126
+ 'readonly' => 'readonly',
127
+ 'title' => esc_attr(__('Select date', 'wpv-views'))
128
+ );
129
+ $attr_hidden = array('class' => $def_class_aux, 'data-ts' => $timestamp, 'data-wpt-type' => 'date');
130
+
131
+ if (isset($data['attribute']) && isset($data['attribute']['placeholder'])) {
132
+ $attr_visible['placeholder'] = $data['attribute']['placeholder'];
133
+ }
134
+
135
+ $form[] = array(
136
  '#type' => 'textfield',
137
  '#title' => $title,
138
+ '#description' => $this->getDescription(),
139
  '#attributes' => $attr_visible,
140
  '#name' => '',
141
  '#value' => $datepicker,
142
+ '#inline' => true,
143
  );
144
+ $form[] = array(
145
  '#type' => 'hidden',
146
  '#title' => $title,
147
  '#attributes' => $attr_hidden,
148
  '#name' => $this->getName() . '[datepicker]',
149
  '#value' => $timestamp,
150
+ '#validate' => $validate,
151
  '#repetitive' => $this->isRepetitive(),
152
  );
153
+
154
+ /*
155
+ // This was the old implementaton
156
+ // We have implemented the above one because we need a hidden field to hold the timestamp
157
+ // And the visible text input field to display the date string to the user
158
+ $form[] = array(
159
+ '#type' => 'textfield',
160
+ '#title' => $this->getTitle(),
161
+ '#attributes' => array('class' => $def_class, 'style' => 'width:150px;'),
162
+ '#name' => $this->getName() . '[datepicker]',
163
+ '#value' => $timestamp,
164
+ '#validate' => $this->getValidationData(),
165
+ '#repetitive' => $this->isRepetitive(),
166
+ );
167
+ */
168
+ if (!empty($data['add_time'])) {
169
  // Shared attributes
170
+ $attributes_hour_minute = array();
171
+ if ($readonly) {
172
+ $attributes_hour_minute['disabled'] = 'disabled';
173
+ }
174
+ if (array_key_exists('use_bootstrap', $this->_data) && $this->_data['use_bootstrap']) {
175
+ $attributes_hour_minute['style'] = 'display:inline;width:auto;';
176
  }
177
+
178
+ // Hour
179
  $hours = 24;
180
  $options = array();
181
+ for ($index = 0; $index < $hours; $index++) {
182
  $prefix = $index < 10 ? '0' : '';
183
  $options[$index] = array(
184
+ '#title' => $prefix . strval($index),
185
  '#value' => $index,
186
  );
187
  }
188
  $hour_element = array(
189
  '#type' => 'select',
190
+ '#before' => '<span class="wpt-form-label">' . __('Hour', 'wpv-views') . '</span>',
191
  '#options' => $options,
192
  '#default_value' => $hour,
193
  '#name' => $this->getName() . '[hour]',
194
  '#inline' => true,
195
+ '#attributes' => array('title' => esc_attr(__('Select hour', 'wpv-views'))),
196
  );
197
+ if (!empty($attributes_hour_minute)) {
198
+ $hour_element['#attributes'] = $attributes_hour_minute;
199
+ }
200
  $form[] = $hour_element;
201
  // Minutes
202
  $minutes = 60;
203
  $options = array();
204
+ for ($index = 0; $index < $minutes; $index++) {
205
  $prefix = $index < 10 ? '0' : '';
206
  $options[$index] = array(
207
+ '#title' => $prefix . strval($index),
208
  '#value' => $index,
209
  );
210
  }
211
+ $minute_element = array(
212
  '#type' => 'select',
213
+ '#before' => '<span class="wpt-form-label">' . __('Minute', 'wpv-views') . '</span>',
214
  '#options' => $options,
215
  '#default_value' => $minute,
216
  '#name' => $this->getName() . '[minute]',
217
  '#inline' => true,
218
+ '#attributes' => array('title' => esc_attr(__('Select minute', 'wpv-views'))),
219
  );
220
+ if (!empty($attributes_hour_minute)) {
221
+ $minute_element['#attributes'] = $attributes_hour_minute;
222
+ }
223
  $form[] = $minute_element;
224
  }
 
 
 
 
 
 
225
 
226
+ $form[] = array(
227
+ '#type' => 'markup',
228
+ '#inline' => true,
229
+ '#markup' => sprintf(
230
+ '<input type="button" class="button button-secondary js-wpt-date-clear wpt-date-clear" value="%s" %s/>',
231
+ esc_attr(__('Clear date', 'wpv-views')),
232
+ /**
233
+ * show button if array is empty or timestamp in array is
234
+ * empty
235
+ */
236
+ empty($time_value) || ( array_key_exists('timestamp', $time_value) && empty($time_value['timestamp']))? 'style="display:none" ':''
237
+ ),
238
+ );
239
  return $form;
240
  }
241
 
244
  return WPToolset_Field_Date_Scripts::getDateFormat();
245
  }
246
 
247
+ protected function _dateToStrftime($format)
248
+ {
249
+ $format = str_replace('d', '%d', $format);
250
+ $format = str_replace('D', '%a', $format);
251
+ $format = str_replace('j', '%e', $format);
252
+ $format = str_replace('l', '%A', $format);
253
+ $format = str_replace('N', '%u', $format);
254
+ $format = str_replace('w', '%w', $format);
255
 
256
+ $format = str_replace('W', '%W', $format);
257
 
258
+ $format = str_replace('F', '%B', $format);
259
+ $format = str_replace('m', '%m', $format);
260
+ $format = str_replace('M', '%b', $format);
261
+ $format = str_replace('n', '%m', $format);
262
 
263
+ $format = str_replace('o', '%g', $format);
264
+ $format = str_replace('Y', '%Y', $format);
265
+ $format = str_replace('y', '%y', $format);
266
 
267
  return $format;
268
  }
269
 
270
+ public static function filterValidationValue($value)
271
+ {
272
+ if (isset($value['datepicker'])) {
273
  return $value['datepicker'];
274
  }
275
  return $value;
276
  }
277
 
278
+ public static function filterValidationRuleJs($rule)
279
+ {
280
+ if ($rule == 'date') {
281
+ return 'dateADODB_STAMP';
282
+ } else {
283
+ return $rule;
284
+ }
285
  }
286
 
287
+ public static function filterValidationArgsPhp($args, $rule)
288
+ {
289
+ if ($rule == 'date') {
290
  return array('$value', self::getDateFormat());
291
  }
292
  return $args;
293
  }
294
 
295
+ public static function filterConditionalArgsJs($args, $type)
296
+ {
297
+ if ($type == 'date') {
298
+ foreach ($args as &$arg) {
299
+ if (!is_numeric($arg)) {
300
+ // Well it should be a numeric timestamp indeed
301
+ $arg = self::strtotime($arg);
302
  }
303
  }
304
  }
305
  return $args;
306
  }
307
 
308
+ public static function filterConditionalArgsPhp($args, $type)
309
+ {
310
+ if ($type == 'date') {
311
+ foreach ($args as &$arg) {
312
+ $arg = self::filterConditionalValuePhp($arg, $type);
313
  }
314
  }
315
  return $args;
316
  }
317
 
318
+ public static function filterConditionalValuePhp($value, $type)
319
+ {
320
+ if ($type == 'date') {
321
+ if (!is_numeric($value)) {
322
+ // Well it should be a numeric timestamp indeed
323
+ $value = self::strtotime($value);
324
  }
325
  // Use timestamp with PHP
326
  // Convert back/forward to have rounded timestamp (no H and i)
327
+ // TODO review this because we should not play with timestamps generated on adodb_xxx functions
328
  //$value = self::strtotime( self::timetodate( $value ) );
329
  }
330
  return $value;
331
  }
332
 
333
+ // We need to keep this for backwards compatibility
334
+ // Note that this function will only convert dates coming on a string:
335
+ // - in english
336
+ // - inside the valid PHP date range
337
+ // We are only using this when the value being checked is not a timestamp
338
+ // And we have tried to avoid that situation from happening
339
+ // But for old implementation, this happens for date conditions on conditional fields
340
+ public static function strtotime($value, $format = null)
341
  {
342
+ if (is_null($format)) {
343
  $format = self::getDateFormat();
344
  }
345
  /**
346
  * add exception to handle short year
347
  */
348
+ if ('d/m/y' == $format) {
349
+ preg_match_all('/(\d{2})/', $value, $value);
350
+ $value[0][2] += $value[0][2] < 70 ? 2000 : 1900;
351
+ $value = implode('-', $value[0]);
352
  }
353
+ if (strpos($format, 'd/m/Y') !== false) {
354
  // strtotime requires a dash or dot separator to determine dd/mm/yyyy format
355
+ preg_match('/\d{2}\/\d{2}\/\d{4}/', $value, $matches);
356
+ if (!empty($matches)) {
357
+ foreach ($matches as $match) {
358
+ $value = str_replace($match, str_replace('/', '-', $match), $value);
 
359
  }
360
  }
361
  }
362
  try {
363
+ $date = new DateTime($value);
364
+ } catch (Exception $e) {
365
  return false;
366
  }
367
+ $timestamp = $date->format("U");
368
+ return self::_isTimestampInRange($timestamp) ? $timestamp : false;
369
  }
370
 
371
+ // TODO review this because we should not play with timestamps generated on adodb_xxx functions
372
+ public static function timetodate($timestamp, $format = null)
373
  {
374
+ return WPToolset_Field_Date_Scripts::timetodate($timestamp, $format);
375
  }
376
 
377
+ protected static function _isTimestampInRange($timestamp)
378
  {
379
  return WPToolset_Field_Date_Scripts::_isTimestampInRange($timestamp);
380
  }
381
 
382
  /**
383
  * DEPRECATED
384
+ *
385
+ * This is not used anymore
386
  */
387
+ public static function timeIsValid($time)
388
+ {
389
  /*
390
  * http://php.net/manual/en/function.strtotime.php
391
  * The valid range of a timestamp is typically
399
  * This means that e.g. dates prior to Jan 1, 1970 will not
400
  * work on Windows, some Linux distributions,
401
  * and a few other operating systems.
402
+ * PHP 5.1.0 and newer versions overcome this limitation though.
403
  */
404
  // MIN 'Jan 1, 1970' - 0 | Fri, 13 Dec 1901 20:45:54 UTC
405
  $_min_time = self::timeNegativeSupported() ? -2147483646 : 0;
406
  // MAX 'Tue, 19 Jan 2038 03:14:07 UTC' - 2147483647
407
  $_max_time = 2147483647;
408
 
409
+ return is_numeric($time) && $_min_time <= intval($time) && intval($time) <= $_max_time;
410
  }
411
 
412
  /**
413
  * DEPRECATED
414
+ *
415
+ * This is not used anymore
416
  */
417
+ public static function timeNegativeSupported()
418
+ {
419
+ return strtotime('Fri, 13 Dec 1950 20:45:54 UTC') === -601010046;
420
  }
421
 
422
  }
embedded/common/toolset-forms/classes/class.date.scripts.php CHANGED
@@ -36,10 +36,10 @@ class WPToolset_Field_Date_Scripts
36
  ( ( isset($_GET['page']) && ($_GET['page'] == 'wpcf-edit-usermeta' || $_GET['page'] == 'wpcf-edit') ) ||
37
  //for edit pages including profile pages
38
  ($pagenow == 'profile.php' || $pagenow == 'post-new.php' || $pagenow == 'user-edit.php' || $pagenow == 'user-new.php' || $pagenow == 'post.php' || $pagenow == 'admin-ajax.php') && is_admin() ) ){
39
- add_action( 'admin_enqueue_scripts', array( $this,'date_enqueue_scripts' ) );
40
- if ( defined('CRED_FE_VERSION')) {
41
- add_action( 'wp_enqueue_scripts', array( $this, 'date_enqueue_scripts' ) );
42
- }
43
  }
44
  $this->localization_slug = false;
45
  }
36
  ( ( isset($_GET['page']) && ($_GET['page'] == 'wpcf-edit-usermeta' || $_GET['page'] == 'wpcf-edit') ) ||
37
  //for edit pages including profile pages
38
  ($pagenow == 'profile.php' || $pagenow == 'post-new.php' || $pagenow == 'user-edit.php' || $pagenow == 'user-new.php' || $pagenow == 'post.php' || $pagenow == 'admin-ajax.php') && is_admin() ) ){
39
+ add_action( 'admin_enqueue_scripts', array( $this,'date_enqueue_scripts' ) );
40
+ if ( defined('CRED_FE_VERSION')) {
41
+ add_action( 'wp_enqueue_scripts', array( $this, 'date_enqueue_scripts' ) );
42
+ }
43
  }
44
  $this->localization_slug = false;
45
  }
embedded/common/toolset-forms/classes/class.eforms.php CHANGED
@@ -27,9 +27,9 @@
27
  * @link http://enlimbo.net/forms
28
  * @author srdjan <srdjan@enlimbo.net>
29
  *
30
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.eforms.php $
31
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
32
- * $LastChangedRevision: 1012704 $
33
  * $LastChangedBy: iworks $
34
  *
35
  */
@@ -406,6 +406,18 @@ class Enlimbo_Forms
406
  }
407
  }
408
  }
 
 
 
 
 
 
 
 
 
 
 
 
409
  return $this->{$method}($element);
410
  }
411
  }
@@ -437,7 +449,9 @@ class Enlimbo_Forms
437
  $classes[] = 'form-control';
438
  }
439
  } else {
440
- $classes[] = $element['#type'];
 
 
441
  }
442
 
443
  if ( isset( $element['#attributes'] )
@@ -452,7 +466,8 @@ class Enlimbo_Forms
452
  $element['#attributes'] = array(
453
  'class' => implode( ' ', $classes )
454
  );
455
- }
 
456
 
457
  foreach ($element['#attributes'] as $attribute => $value) {
458
  // Prevent undesired elements
@@ -465,7 +480,7 @@ class Enlimbo_Forms
465
  }
466
  // Set return string
467
  $attributes .= ' ' . $attribute . '="' . $value . '"';
468
- }
469
 
470
  return $attributes;
471
  }
@@ -517,7 +532,6 @@ class Enlimbo_Forms
517
  $element['_render']['label'] .= stripslashes($element['#title']);
518
  $element['_render']['label'] .= '</label>';
519
  }
520
-
521
  return $element;
522
  }
523
 
27
  * @link http://enlimbo.net/forms
28
  * @author srdjan <srdjan@enlimbo.net>
29
  *
30
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.eforms.php $
31
+ * $LastChangedDate: 2014-10-29 15:57:36 +0000 (Wed, 29 Oct 2014) $
32
+ * $LastChangedRevision: 1016002 $
33
  * $LastChangedBy: iworks $
34
  *
35
  */
406
  }
407
  }
408
  }
409
+ /**
410
+ * WPML - lock CF is has option "copy from original".
411
+ */
412
+ if ( is_admin() && function_exists('wpcf_wpml_field_is_copied') && wpcf_wpml_field_is_copied($element) ) {
413
+ $element['#title'] .= sprintf(
414
+ '<img src="%s/images/locked.png" alt="%s" title="%s" style="position:relative;left:2px;top:2px;" />',
415
+ WPCF_EMBEDDED_RES_RELPATH,
416
+ __( 'This field is locked for editing because WPML will copy its value from the original language.', 'wpcf' ),
417
+ __( 'This field is locked for editing because WPML will copy its value from the original language.', 'wpcf' )
418
+ );
419
+ $element['#attributes']['readonly'] = true;
420
+ }
421
  return $this->{$method}($element);
422
  }
423
  }
449
  $classes[] = 'form-control';
450
  }
451
  } else {
452
+ if ( 'hidden' != $element['#type'] ) {
453
+ $classes[] = $element['#type'];
454
+ }
455
  }
456
 
457
  if ( isset( $element['#attributes'] )
466
  $element['#attributes'] = array(
467
  'class' => implode( ' ', $classes )
468
  );
469
+ }
470
+
471
 
472
  foreach ($element['#attributes'] as $attribute => $value) {
473
  // Prevent undesired elements
480
  }
481
  // Set return string
482
  $attributes .= ' ' . $attribute . '="' . $value . '"';
483
+ }
484
 
485
  return $attributes;
486
  }
532
  $element['_render']['label'] .= stripslashes($element['#title']);
533
  $element['_render']['label'] .= '</label>';
534
  }
 
535
  return $element;
536
  }
537
 
embedded/common/toolset-forms/classes/class.field_factory.php CHANGED
@@ -2,9 +2,9 @@
2
 
3
  /**
4
  *
5
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.field_factory.php $
6
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
7
- * $LastChangedRevision: 1012704 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
@@ -72,7 +72,14 @@ abstract class FieldFactory extends FieldAbstract
72
 
73
  public function getValue()
74
  {
75
- return $this->_value;
 
 
 
 
 
 
 
76
  }
77
 
78
  public function getTitle()
@@ -122,6 +129,14 @@ abstract class FieldFactory extends FieldAbstract
122
  return array();
123
  }
124
 
 
 
 
 
 
 
 
 
125
  public static function registerScripts() {}
126
  public static function registerStyles() {}
127
  public static function addFilters() {}
2
 
3
  /**
4
  *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.field_factory.php $
6
+ * $LastChangedDate: 2014-10-23 10:33:39 +0000 (Thu, 23 Oct 2014) $
7
+ * $LastChangedRevision: 1012677 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
72
 
73
  public function getValue()
74
  {
75
+ global $post;
76
+ $value = $this->_value;
77
+ $value = apply_filters( 'wpcf_fields_value_get', $value, $post );
78
+ if ( array_key_exists('slug', $this->_data ) ) {
79
+ $value = apply_filters( 'wpcf_fields_slug_' . $this->_data['slug'] . '_value_get', $value, $post );
80
+ }
81
+ $value = apply_filters( 'wpcf_fields_type_' . $this->_data['type'] . '_value_get', $value, $post );
82
+ return $value;
83
  }
84
 
85
  public function getTitle()
129
  return array();
130
  }
131
 
132
+ public function getWPMLAction()
133
+ {
134
+ if ( array_key_exists( 'wpml_action', $this->_data ) ) {
135
+ return $this->_data['wpml_action'];
136
+ }
137
+ return 0;
138
+ }
139
+
140
  public static function registerScripts() {}
141
  public static function registerStyles() {}
142
  public static function addFilters() {}
embedded/common/toolset-forms/classes/class.fieldconfig.php CHANGED
@@ -1,10 +1,10 @@
1
  <?php
2
  /**
3
  *
4
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.fieldconfig.php $
5
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
6
- * $LastChangedRevision: 1012704 $
7
- * $LastChangedBy: iworks $
8
  *
9
  */
10
  if (!class_exists("FieldConfig")) {
1
  <?php
2
  /**
3
  *
4
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.fieldconfig.php $
5
+ * $LastChangedDate: 2014-09-18 09:37:16 +0000 (Thu, 18 Sep 2014) $
6
+ * $LastChangedRevision: 992466 $
7
+ * $LastChangedBy: brucepearson $
8
  *
9
  */
10
  if (!class_exists("FieldConfig")) {
embedded/common/toolset-forms/classes/class.file.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  *
4
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.file.php $
5
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
6
- * $LastChangedRevision: 1012704 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
1
  <?php
2
  /**
3
  *
4
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.file.php $
5
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
6
+ * $LastChangedRevision: 1027712 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
embedded/common/toolset-forms/classes/class.form_factory.php CHANGED
@@ -10,9 +10,9 @@ define( "CLASS_NAME_PREFIX", "WPToolset_Field_" );
10
  * Creation Form Class
11
  * @author onTheGo System
12
  *
13
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.form_factory.php $
14
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
15
- * $LastChangedRevision: 1012704 $
16
  * $LastChangedBy: iworks $
17
  *
18
  *
@@ -52,10 +52,22 @@ class FormFactory extends FormAbstract
52
  $cred_cred_settings = get_option( 'cred_cred_settings' );
53
  /**
54
  * load or not cred.css
 
55
  */
56
  $load_cred_css = true;
57
- if ( is_array($cred_cred_settings) && array_key_exists('dont_load_cred_css', $cred_cred_settings ) && $cred_cred_settings['dont_load_cred_css'] ) {
58
- $load_cred_css = false;
 
 
 
 
 
 
 
 
 
 
 
59
  }
60
  /**
61
  * register
@@ -69,10 +81,6 @@ class FormFactory extends FormAbstract
69
  );
70
  wp_enqueue_style( 'wptoolset-forms-cred' );
71
  }
72
-
73
- if ( array_key_exists( 'use_bootstrap', $cred_cred_settings ) && $cred_cred_settings['use_bootstrap'] ) {
74
- $this->_use_bootstrap = true;
75
- }
76
  }
77
  }
78
 
@@ -170,6 +178,11 @@ class FormFactory extends FormAbstract
170
  */
171
  $config['use_bootstrap'] = $this->theForm->form_settings['use_bootstrap'];
172
  $config['has_media_button'] = $this->theForm->form_settings['has_media_button'];
 
 
 
 
 
173
  $htmlArray = array();
174
  $_gnf = $global_name_field;
175
  $_cfg = $config;
@@ -214,7 +227,19 @@ class FormFactory extends FormAbstract
214
  $htmlArray[] = $this->theForm->renderElements( $form );
215
  if ( empty( $config['repetitive'] ) ) break;
216
  $count++;
217
- } else echo "error";
 
 
 
 
 
 
 
 
 
 
 
 
218
  }
219
  if ( !empty( $htmlArray ) && isset($config['repetitive']) && $config['repetitive'] ) {
220
  $_gnf = $_cfg['name'] = "{$global_name_field}[%%{$count}%%]";
@@ -224,6 +249,7 @@ class FormFactory extends FormAbstract
224
  $this->_repetitive()->add( $config, $tpl );
225
  }
226
  }
 
227
  return !empty( $htmlArray ) ? $this->_tpl( $config, $htmlArray ) : '';
228
  }
229
 
@@ -380,6 +406,15 @@ class FormFactory extends FormAbstract
380
  public function loadFieldClass( $type ) {
381
  $type = strtolower( $type );
382
  $class = $this->getClassFromType( $type );
 
 
 
 
 
 
 
 
 
383
  if ( !class_exists( $class ) ) {
384
  $file = WPTOOLSET_FORMS_ABSPATH . "/classes/class.{$type}.php";
385
  if ( file_exists( $file ) ) {
@@ -398,4 +433,16 @@ class FormFactory extends FormAbstract
398
  return class_exists( $class ) ? $class : false;
399
  }
400
 
 
 
 
 
 
 
 
 
 
 
 
 
401
  }
10
  * Creation Form Class
11
  * @author onTheGo System
12
  *
13
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.form_factory.php $
14
+ * $LastChangedDate: 2014-10-23 10:33:39 +0000 (Thu, 23 Oct 2014) $
15
+ * $LastChangedRevision: 1012677 $
16
  * $LastChangedBy: iworks $
17
  *
18
  *
52
  $cred_cred_settings = get_option( 'cred_cred_settings' );
53
  /**
54
  * load or not cred.css
55
+ * and check use bootstrap
56
  */
57
  $load_cred_css = true;
58
+ if ( is_array($cred_cred_settings) ) {
59
+ if (
60
+ array_key_exists('dont_load_cred_css', $cred_cred_settings )
61
+ && $cred_cred_settings['dont_load_cred_css']
62
+ ) {
63
+ $load_cred_css = false;
64
+ }
65
+ if (
66
+ array_key_exists( 'use_bootstrap', $cred_cred_settings )
67
+ && $cred_cred_settings['use_bootstrap']
68
+ ) {
69
+ $this->_use_bootstrap = true;
70
+ }
71
  }
72
  /**
73
  * register
81
  );
82
  wp_enqueue_style( 'wptoolset-forms-cred' );
83
  }
 
 
 
 
84
  }
85
  }
86
 
178
  */
179
  $config['use_bootstrap'] = $this->theForm->form_settings['use_bootstrap'];
180
  $config['has_media_button'] = $this->theForm->form_settings['has_media_button'];
181
+ /**
182
+ * WMPL configuration
183
+ */
184
+ $config['wpml_action'] = $this->get_wpml_action($config['id']);
185
+
186
  $htmlArray = array();
187
  $_gnf = $global_name_field;
188
  $_cfg = $config;
227
  $htmlArray[] = $this->theForm->renderElements( $form );
228
  if ( empty( $config['repetitive'] ) ) break;
229
  $count++;
230
+ } else {
231
+ if ( current_user_can('manage_options') ) {
232
+ $htmlArray[] = sprintf(
233
+ '<div id="message" class="error"><p>%s</p><p>%s</p></div>',
234
+ sprintf(
235
+ __('There is a problem with render <strong>%s (%s)</strong> field.', 'wpv-views'),
236
+ $_cfg['title'],
237
+ $_cfg['type']
238
+ ),
239
+ $field->get_error_message()
240
+ );
241
+ }
242
+ }
243
  }
244
  if ( !empty( $htmlArray ) && isset($config['repetitive']) && $config['repetitive'] ) {
245
  $_gnf = $_cfg['name'] = "{$global_name_field}[%%{$count}%%]";
249
  $this->_repetitive()->add( $config, $tpl );
250
  }
251
  }
252
+
253
  return !empty( $htmlArray ) ? $this->_tpl( $config, $htmlArray ) : '';
254
  }
255
 
406
  public function loadFieldClass( $type ) {
407
  $type = strtolower( $type );
408
  $class = $this->getClassFromType( $type );
409
+
410
+ /**
411
+ * try to load custom class
412
+ */
413
+ $loader = $class.'_loader';
414
+ if ( function_exists($loader) ) {
415
+ $loader();
416
+ }
417
+
418
  if ( !class_exists( $class ) ) {
419
  $file = WPTOOLSET_FORMS_ABSPATH . "/classes/class.{$type}.php";
420
  if ( file_exists( $file ) ) {
433
  return class_exists( $class ) ? $class : false;
434
  }
435
 
436
+ private function get_wpml_action($id)
437
+ {
438
+ global $iclTranslationManagement;
439
+ if (
440
+ is_object($iclTranslationManagement)
441
+ && 'TranslationManagement' == get_class($iclTranslationManagement)
442
+ && isset($iclTranslationManagement->settings['custom_fields_translation'][$id])
443
+ ) {
444
+ return $iclTranslationManagement->settings['custom_fields_translation'][$id];
445
+ }
446
+ return 0;
447
+ }
448
  }
embedded/common/toolset-forms/classes/class.image.php CHANGED
@@ -6,9 +6,9 @@ require_once 'class.file.php';
6
  *
7
  * @author Srdjan
8
  *
9
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.image.php $
10
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
11
- * $LastChangedRevision: 1012704 $
12
  * $LastChangedBy: iworks $
13
  *
14
  */
@@ -19,17 +19,28 @@ class WPToolset_Field_Image extends WPToolset_Field_File
19
  $validation = $this->getValidationData();
20
  $validation = self::addTypeValidation($validation);
21
  $this->setValidationData($validation);
22
- return parent::metaform();
23
  }
24
 
25
- public static function addTypeValidation($validation) {
 
 
 
 
 
 
 
 
 
 
 
26
  $validation['extension'] = array(
27
  'args' => array(
28
  'extension',
29
- 'jpg|jpeg|gif|png|bmp|webp',
30
  ),
31
  'message' => __( 'You can add only images.', 'wpv-views' ),
32
  );
33
  return $validation;
34
- }
35
  }
6
  *
7
  * @author Srdjan
8
  *
9
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.image.php $
10
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
11
+ * $LastChangedRevision: 1027712 $
12
  * $LastChangedBy: iworks $
13
  *
14
  */
19
  $validation = $this->getValidationData();
20
  $validation = self::addTypeValidation($validation);
21
  $this->setValidationData($validation);
22
+ return parent::metaform();
23
  }
24
 
25
+ public static function addTypeValidation($validation)
26
+ {
27
+ $valid_extensions = array(
28
+ 'bmp',
29
+ 'gif',
30
+ 'jpeg',
31
+ 'jpg',
32
+ 'png',
33
+ 'svg',
34
+ 'webp',
35
+ );
36
+ $valid_extensions = apply_filters( 'toolset_valid_image_extentions', $valid_extensions);
37
  $validation['extension'] = array(
38
  'args' => array(
39
  'extension',
40
+ implode('|', $valid_extensions),
41
  ),
42
  'message' => __( 'You can add only images.', 'wpv-views' ),
43
  );
44
  return $validation;
45
+ }
46
  }
embedded/common/toolset-forms/classes/class.integer.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once 'class.textfield.php';
3
+
4
+ /**
5
+ * Description of class
6
+ *
7
+ * @author Srdjan
8
+ */
9
+ class WPToolset_Field_Integer extends WPToolset_Field_Textfield
10
+ {
11
+
12
+ }
embedded/common/toolset-forms/classes/class.password.php CHANGED
@@ -1,10 +1,10 @@
1
  <?php
2
  /**
3
  *
4
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.password.php $
5
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
6
- * $LastChangedRevision: 1012704 $
7
- * $LastChangedBy: iworks $
8
  *
9
  */
10
  require_once 'class.field_factory.php';
1
  <?php
2
  /**
3
  *
4
+ * $HeadURL: https://www.onthegosystems.com/misc_svn/common/trunk/toolset-forms/classes/class.password.php $
5
+ * $LastChangedDate: 2014-07-10 11:46:40 +0300 (Чт, 10 июл 2014) $
6
+ * $LastChangedRevision: 24820 $
7
+ * $LastChangedBy: francesco $
8
  *
9
  */
10
  require_once 'class.field_factory.php';
embedded/common/toolset-forms/classes/class.radios.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  *
4
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.radios.php $
5
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
6
- * $LastChangedRevision: 1012704 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
@@ -30,11 +30,28 @@ class WPToolset_Field_Radios extends FieldFactory
30
  '#title' => $option['title'],
31
  '#validate' => $this->getValidationData()
32
  );
33
- if ( !is_admin() ) {// TODO maybe add a doing_ajax() check too, what if we want to load a form using AJAX?
34
- $one_option_data['#before'] = '<li class="wpt-form-item wpt-form-item-radio">';
35
- $one_option_data['#after'] = '</li>';
36
- $one_option_data['#pattern'] = '<BEFORE><PREFIX><ELEMENT><LABEL><ERROR><SUFFIX><DESCRIPTION><AFTER>';
37
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  /**
39
  * add default value if needed
40
  * issue: frontend, multiforms CRED
@@ -67,12 +84,12 @@ class WPToolset_Field_Radios extends FieldFactory
67
  '#repetitive' => $this->isRepetitive(),
68
  '#validate' => $this->getValidationData(),
69
  );
70
-
71
  if ( !is_admin() ) {// TODO maybe add a doing_ajax() check too, what if we want to load a form using AJAX?
72
  $form_attr['#before'] = '<ul class="wpt-form-set wpt-form-set-radios wpt-form-set-radios-' . $name . '">';
73
  $form_attr['#after'] = '</ul>';
74
  }
75
-
76
  $form[] = $form_attr;
77
 
78
  return $form;
1
  <?php
2
  /**
3
  *
4
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.radios.php $
5
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
6
+ * $LastChangedRevision: 1027712 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
30
  '#title' => $option['title'],
31
  '#validate' => $this->getValidationData()
32
  );
33
+ if ( !is_admin() ) {// TODO maybe add a doing_ajax() check too, what if we want to load a form using AJAX?
34
+ $clases = array(
35
+ 'wpt-form-item',
36
+ 'wpt-form-item-radio',
37
+ 'radio-'.sanitize_title($option['title'])
38
+ );
39
+ /**
40
+ * filter: cred_checkboxes_class
41
+ * @param array $clases current array of classes
42
+ * @parem array $option current option
43
+ * @param string field type
44
+ *
45
+ * @return array
46
+ */
47
+ $clases = apply_filters( 'cred_item_li_class', $clases, $option, 'radio' );
48
+ $one_option_data['#before'] = sprintf(
49
+ '<li class="%s">',
50
+ implode(' ', $clases)
51
+ );
52
+ $one_option_data['#after'] = '</li>';
53
+ $one_option_data['#pattern'] = '<BEFORE><PREFIX><ELEMENT><LABEL><ERROR><SUFFIX><DESCRIPTION><AFTER>';
54
+ }
55
  /**
56
  * add default value if needed
57
  * issue: frontend, multiforms CRED
84
  '#repetitive' => $this->isRepetitive(),
85
  '#validate' => $this->getValidationData(),
86
  );
87
+
88
  if ( !is_admin() ) {// TODO maybe add a doing_ajax() check too, what if we want to load a form using AJAX?
89
  $form_attr['#before'] = '<ul class="wpt-form-set wpt-form-set-radios wpt-form-set-radios-' . $name . '">';
90
  $form_attr['#after'] = '</ul>';
91
  }
92
+
93
  $form[] = $form_attr;
94
 
95
  return $form;
embedded/common/toolset-forms/classes/class.repetitive.php CHANGED
@@ -2,9 +2,9 @@
2
  /*
3
  * Repetitive controller
4
  *
5
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.repetitive.php $
6
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
7
- * $LastChangedRevision: 1012704 $
8
  * $LastChangedBy: iworks $
9
  *
10
  * If field is repetitive
2
  /*
3
  * Repetitive controller
4
  *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.repetitive.php $
6
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
7
+ * $LastChangedRevision: 1027712 $
8
  * $LastChangedBy: iworks $
9
  *
10
  * If field is repetitive
embedded/common/toolset-forms/classes/class.select.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  *
4
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.select.php $
5
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
6
- * $LastChangedRevision: 1012704 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
1
  <?php
2
  /**
3
  *
4
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.select.php $
5
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
6
+ * $LastChangedRevision: 1027712 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
embedded/common/toolset-forms/classes/class.skype.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  *
4
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.skype.php $
5
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
6
- * $LastChangedRevision: 1012704 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
1
  <?php
2
  /**
3
  *
4
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.skype.php $
5
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
6
+ * $LastChangedRevision: 1027712 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
embedded/common/toolset-forms/classes/class.submit.php CHANGED
@@ -1,29 +1,41 @@
1
- <?php
2
- require_once 'class.textfield.php';
3
-
4
- /**
5
- * Description of class
6
- *
7
- * @author Franko
8
- */
9
- class WPToolset_Field_Submit extends WPToolset_Field_Textfield
10
- {
11
-
12
- public function metaform() {
13
- $metaform = array();
14
- $metaform[] = array(
15
- '#type' => 'submit',
16
- '#title' => $this->getTitle(),
17
- '#description' => $this->getDescription(),
18
- '#name' => $this->getName(),
19
- '#value' => $this->getValue(),
20
- '#validate' => $this->getValidationData()
21
- );
22
- if ( array_key_exists( 'use_bootstrap', $this->_data ) && $this->_data['use_bootstrap'] ) {
23
- $metaform[0]['#attributes']['class'] = 'btn btn-primary';
24
- }
25
- $this->set_metaform($metaform);
26
- return $metaform;
27
- }
28
-
29
- }
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.submit.php $
5
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
6
+ * $LastChangedRevision: 1027712 $
7
+ * $LastChangedBy: iworks $
8
+ *
9
+ */
10
+ require_once 'class.textfield.php';
11
+
12
+ class WPToolset_Field_Submit extends WPToolset_Field_Textfield
13
+ {
14
+
15
+ public function metaform()
16
+ {
17
+ $attributes = $this->getAttr();
18
+
19
+ $metaform = array();
20
+ $metaform[] = array(
21
+ '#type' => 'submit',
22
+ '#title' => $this->getTitle(),
23
+ '#description' => $this->getDescription(),
24
+ '#name' => $this->getName(),
25
+ '#value' => $this->getValue(),
26
+ '#validate' => $this->getValidationData(),
27
+ '#attributes' => array(
28
+ 'class' => '',
29
+ ),
30
+ );
31
+ if (array_key_exists( 'class', $attributes )) {
32
+ $metaform[0]['#attributes']['class'] = $attributes['class'];
33
+ }
34
+ if ( array_key_exists( 'use_bootstrap', $this->_data ) && $this->_data['use_bootstrap'] ) {
35
+ $metaform[0]['#attributes']['class'] .= ' btn btn-primary';
36
+ }
37
+ $this->set_metaform($metaform);
38
+ return $metaform;
39
+ }
40
+
41
+ }
embedded/common/toolset-forms/classes/class.taxonomy.php CHANGED
@@ -2,9 +2,9 @@
2
 
3
  /**
4
  *
5
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.taxonomy.php $
6
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
7
- * $LastChangedRevision: 1012704 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
@@ -104,7 +104,7 @@ class WPToolset_Field_Taxonomy extends WPToolset_Field_Textfield
104
  '#title' => '',
105
  '#description' => '',
106
  '#name' => "new_tax_button_".$taxonomy,
107
- '#value' => esc_attr( $attributes['add_text'] ),
108
  '#attributes' => array(
109
  'class' => $use_bootstrap ? 'btn btn-default wpt-taxonomy-add-new js-wpt-taxonomy-add-new' : 'wpt-taxonomy-add-new js-wpt-taxonomy-add-new',
110
  'data-taxonomy' => $taxonomy,
@@ -132,12 +132,12 @@ class WPToolset_Field_Taxonomy extends WPToolset_Field_Textfield
132
  '#title' => '',
133
  '#description' => '',
134
  '#name' => "sh_".$taxonomy,
135
- '#value' => esc_attr( $attributes['show_popular_text'] ),
136
  '#attributes' => array(
137
  'class' => $use_bootstrap ? 'btn btn-default popular wpt-taxonomy-popular-show-hide js-wpt-taxonomy-popular-show-hide' : 'popular wpt-taxonomy-popular-show-hide js-wpt-taxonomy-popular-show-hide',
138
  'data-taxonomy' => $this->getName(),
139
- 'data-show-popular-text' => esc_attr( $attributes['show_popular_text'] ),
140
- 'data-hide-popular-text' => esc_attr( $attributes['hide_popular_text'] ),
141
  'data-after-selector' => 'js-show-popular-after',
142
  'style' => $show ? '' : 'display:none;'
143
  ),
@@ -222,14 +222,18 @@ class WPToolset_Field_Taxonomy extends WPToolset_Field_Textfield
222
  );
223
  }
224
 
225
- $style = '';
226
  foreach($terms as $term) {
 
227
  if ( $add_sizes ) {
228
- $font_size = ( ( $term->count - $min ) * 10 ) / ( $max - $min ) + 5;
229
- $style = sprintf( ' style="font-size:1.%dem;"', $font_size );
230
  }
 
 
 
231
  $content .= sprintf(
232
- '<a href="#" class="wpt-taxonomy-popular-add js-wpt-taxonomy-popular-add" data-slug="%s" data-name="%s" data-taxonomy="%s"%s>%s</a> ',
 
233
  $term->slug,
234
  $term->name,
235
  $this->getName(),
2
 
3
  /**
4
  *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.taxonomy.php $
6
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
7
+ * $LastChangedRevision: 1027712 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
104
  '#title' => '',
105
  '#description' => '',
106
  '#name' => "new_tax_button_".$taxonomy,
107
+ '#value' => apply_filters('toolset_button_add_text', esc_attr( $attributes['add_text'] )),
108
  '#attributes' => array(
109
  'class' => $use_bootstrap ? 'btn btn-default wpt-taxonomy-add-new js-wpt-taxonomy-add-new' : 'wpt-taxonomy-add-new js-wpt-taxonomy-add-new',
110
  'data-taxonomy' => $taxonomy,
132
  '#title' => '',
133
  '#description' => '',
134
  '#name' => "sh_".$taxonomy,
135
+ '#value' => apply_filters('toolset_button_show_popular_text', esc_attr( $attributes['show_popular_text'] )),
136
  '#attributes' => array(
137
  'class' => $use_bootstrap ? 'btn btn-default popular wpt-taxonomy-popular-show-hide js-wpt-taxonomy-popular-show-hide' : 'popular wpt-taxonomy-popular-show-hide js-wpt-taxonomy-popular-show-hide',
138
  'data-taxonomy' => $this->getName(),
139
+ 'data-show-popular-text' => apply_filters('toolset_button_show_popular_text', esc_attr( $attributes['show_popular_text'] )),
140
+ 'data-hide-popular-text' => apply_filters('toolset_button_hide_popular_text', esc_attr( $attributes['hide_popular_text'] )),
141
  'data-after-selector' => 'js-show-popular-after',
142
  'style' => $show ? '' : 'display:none;'
143
  ),
222
  );
223
  }
224
 
 
225
  foreach($terms as $term) {
226
+ $style = '';
227
  if ( $add_sizes ) {
228
+ $font_size = ( ( $term->count - $min ) * 10 ) / ( $max - $min ) + 8;
229
+ $style = sprintf( ' style="font-size:%fem;"', $font_size/10 );
230
  }
231
+ $clases = array('wpt-taxonomy-popular-add', 'js-wpt-taxonomy-popular-add');
232
+ $clases[] = 'tax-'.$term->slug;
233
+ $clases[] = 'taxonomy-'.$this->getName().'-'.$term->term_id;
234
  $content .= sprintf(
235
+ '<a href="#" class="%s" data-slug="%s" data-name="%s" data-taxonomy="%s"%s>%s</a> ',
236
+ implode(' ', $clases ),
237
  $term->slug,
238
  $term->name,
239
  $this->getName(),
embedded/common/toolset-forms/classes/class.taxonomyhierarchical.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  *
4
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.taxonomyhierarchical.php $
5
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
6
- * $LastChangedRevision: 1012704 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
@@ -31,11 +31,11 @@ class WPToolset_Field_Taxonomyhierarchical extends WPToolset_Field_Textfield
31
  $this->objValues[$term->slug] = $term;
32
  }
33
  }
34
-
35
  $all = $this->buildTerms(get_terms($this->getName(),array('hide_empty'=>0,'fields'=>'all')));
36
 
37
-
38
-
39
  $childs=array();
40
  $names=array();
41
  foreach ($all as $term) {
@@ -46,7 +46,7 @@ class WPToolset_Field_Taxonomyhierarchical extends WPToolset_Field_Textfield
46
  }
47
 
48
  // ksort($childs);
49
-
50
  $this->childs = $childs;
51
  $this->names = $names;
52
  }
@@ -67,7 +67,7 @@ class WPToolset_Field_Taxonomyhierarchical extends WPToolset_Field_Textfield
67
  $res = '';
68
  $metaform = array();
69
  $build_what = '';
70
-
71
  if ( array_key_exists( 'display', $this->_data ) && 'select' == $this->_data['display'] ) {
72
  $metaform = $this->buildSelect();
73
  $build_what = 'select';
@@ -76,7 +76,7 @@ class WPToolset_Field_Taxonomyhierarchical extends WPToolset_Field_Textfield
76
  $this->set_metaform($res);
77
  $build_what = 'checkboxes';
78
  }
79
-
80
  /**
81
  * TODO
82
  *
@@ -84,7 +84,7 @@ class WPToolset_Field_Taxonomyhierarchical extends WPToolset_Field_Textfield
84
  *
85
  * $taxobject = get_taxonomy( $taxname );
86
  */
87
-
88
  /**
89
  * "Add new" button
90
  */
@@ -93,13 +93,14 @@ class WPToolset_Field_Taxonomyhierarchical extends WPToolset_Field_Textfield
93
  '#title' => '',
94
  '#description' => '',
95
  '#name' => "btn_".$taxname,
96
- '#value' => esc_attr( $attributes['add_new_text'] ),
97
  '#attributes' => array(
98
  'style' => 'display:none;',
99
  'data-taxonomy' => $taxname,
100
  'data-build_what' => $build_what,
101
- 'data-after-selector' => 'js-wpt-hierarchical-taxonomy-add-new-' . $taxname,
102
- 'data-close' => esc_attr( __( 'Cancel', 'wpv-views' ) ),// TODO adjust the button value depending on open/close action
 
103
  'class' => $use_bootstrap? 'btn btn-default wpt-hierarchical-taxonomy-add-new-show-hide js-wpt-hierarchical-taxonomy-add-new-show-hide' : 'wpt-hierarchical-taxonomy-add-new-show-hide js-wpt-hierarchical-taxonomy-add-new-show-hide',
104
  ),
105
 
@@ -107,13 +108,13 @@ class WPToolset_Field_Taxonomyhierarchical extends WPToolset_Field_Textfield
107
  );
108
 
109
  // Input for new taxonomy
110
-
111
  if ( $use_bootstrap ) {
112
  $container = '<div style="display:none" class="form-group wpt-hierarchical-taxonomy-add-new js-wpt-hierarchical-taxonomy-add-new-' . $taxname . '" data-taxonomy="' . $taxname . '">';
113
  } else {
114
  $container = '<div style="display:none" class="wpt-hierarchical-taxonomy-add-new js-wpt-hierarchical-taxonomy-add-new-' . $taxname . '" data-taxonomy="' . $taxname . '">';
115
  }
116
-
117
  /**
118
  * The textfield input
119
  */
@@ -130,9 +131,9 @@ class WPToolset_Field_Taxonomyhierarchical extends WPToolset_Field_Textfield
130
  ),
131
  '#validate' => $this->getValidationData(),
132
  '#before' => $container,
133
-
134
  );
135
-
136
  /**
137
  * The select for parent
138
  */
@@ -149,7 +150,7 @@ class WPToolset_Field_Taxonomyhierarchical extends WPToolset_Field_Textfield
149
  '#attributes' => array(
150
  'data-parent-text' => $attributes['parent_text'],
151
  'data-taxonomy' => $taxname,
152
- 'class' => 'js-taxonomy-parent'
153
  ),
154
 
155
  '#validate' => $this->getValidationData(),
@@ -163,7 +164,7 @@ class WPToolset_Field_Taxonomyhierarchical extends WPToolset_Field_Textfield
163
  '#title' => '',
164
  '#description' => '',
165
  '#name' => "new_tax_button_".$taxname,
166
- '#value' => esc_attr( $attributes['add_text'] ),
167
  '#attributes' => array(
168
  'data-taxonomy' => $taxname,
169
  'data-build_what' => $build_what,
@@ -172,10 +173,10 @@ class WPToolset_Field_Taxonomyhierarchical extends WPToolset_Field_Textfield
172
 
173
  '#validate' => $this->getValidationData(),
174
  '#after' => '</div>',
175
- );
176
-
177
  return $metaform;
178
-
179
  }
180
 
181
  private function buildTerms($obj_terms)
@@ -196,9 +197,9 @@ class WPToolset_Field_Taxonomyhierarchical extends WPToolset_Field_Textfield
196
  private function buildSelect()
197
  {
198
  $attributes = $this->getAttr();
199
-
200
  $multiple = !isset($attributes['single_select']) || !$attributes['single_select'];
201
-
202
  $curr_options = $this->getOptions();
203
  $values = $this->valuesId;
204
  $options = array();
@@ -240,11 +241,11 @@ class WPToolset_Field_Taxonomyhierarchical extends WPToolset_Field_Textfield
240
  '#class' => 'form-inline',
241
  '#repetitive' => $this->isRepetitive(),
242
  );
243
-
244
  if ($multiple) {
245
  $select['#attributes'] = array('multiple' => 'multiple');
246
  }
247
-
248
  if (count($options) == 0) {
249
  if (isset($select['#attributes'])) {
250
  $select['#attributes']['style'] = 'display:none';
@@ -291,42 +292,55 @@ class WPToolset_Field_Taxonomyhierarchical extends WPToolset_Field_Textfield
291
  } else if ( is_array( $this->getValue() ) ) {
292
  $default_value = in_array( $tid, $this->getValue() );
293
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
294
  $item = array(
295
- '#type' => 'checkbox',
296
- '#title' => $names[$tid],
297
- '#description' => '',
298
- '#name' => $this->getName()."[]",
299
- '#value' => $tid,
300
- '#default_value' => $default_value,
301
- '#validate' => $this->getValidationData(),
302
- '#before' => '<li>',
303
- '#after' => '</li>',
304
- '#attributes' => array(
305
- 'data-parent' => $parent
306
- ),
307
- '#pattern' => '<BEFORE><PREFIX><ELEMENT><LABEL><ERROR><SUFFIX><DESCRIPTION><AFTER>'
308
- );
309
-
310
  if ( $tkey == 0 ) {
311
  if ($level > 0) {
312
- $item['#before'] = '<li><ul class="wpt-form-set-children wpt-form-set-children-level-' . $level . '" data-level="' . $level . '"><li>';
313
  } else {
314
- $item['#before'] = '<ul class="wpt-form-set wpt-form-set-checkboxes wpt-form-set-checkboxes-' . $this->getName() . '" data-level="0"><li>';
315
  }
316
  }
317
  if ( $tkey == ( $level_count - 1 ) ) {
318
  $item['#after'] = '</li>';
319
  }
320
-
321
  $metaform[] = $item;
322
 
323
- if ( isset( $childs[$tid] ) ) {
324
  $metaform = $this->buildCheckboxes( $tid, $childs, $names, $metaform, $level + 1, $tid );
325
  }
326
-
327
  }
328
  }
329
-
330
  if (count($metaform)) {
331
  if ($level == 0) {
332
  $metaform[count($metaform) - 1]['#after'] .= '</ul>';
@@ -334,7 +348,7 @@ class WPToolset_Field_Taxonomyhierarchical extends WPToolset_Field_Textfield
334
  $metaform[count($metaform) - 1]['#after'] .= '</ul></li>';
335
  }
336
  }
337
-
338
  return $metaform;
339
  }
340
  }
1
  <?php
2
  /**
3
  *
4
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.taxonomyhierarchical.php $
5
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
6
+ * $LastChangedRevision: 1027712 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
31
  $this->objValues[$term->slug] = $term;
32
  }
33
  }
34
+
35
  $all = $this->buildTerms(get_terms($this->getName(),array('hide_empty'=>0,'fields'=>'all')));
36
 
37
+
38
+
39
  $childs=array();
40
  $names=array();
41
  foreach ($all as $term) {
46
  }
47
 
48
  // ksort($childs);
49
+
50
  $this->childs = $childs;
51
  $this->names = $names;
52
  }
67
  $res = '';
68
  $metaform = array();
69
  $build_what = '';
70
+
71
  if ( array_key_exists( 'display', $this->_data ) && 'select' == $this->_data['display'] ) {
72
  $metaform = $this->buildSelect();
73
  $build_what = 'select';
76
  $this->set_metaform($res);
77
  $build_what = 'checkboxes';
78
  }
79
+
80
  /**
81
  * TODO
82
  *
84
  *
85
  * $taxobject = get_taxonomy( $taxname );
86
  */
87
+
88
  /**
89
  * "Add new" button
90
  */
93
  '#title' => '',
94
  '#description' => '',
95
  '#name' => "btn_".$taxname,
96
+ '#value' => apply_filters('toolset_button_add_new_text', esc_attr( $attributes['add_new_text'] )),
97
  '#attributes' => array(
98
  'style' => 'display:none;',
99
  'data-taxonomy' => $taxname,
100
  'data-build_what' => $build_what,
101
+ 'data-after-selector' => 'js-wpt-hierarchical-taxonomy-add-new-' . $taxname,
102
+ 'data-open' => apply_filters('toolset_button_add_new_text', esc_attr( $attributes['add_new_text'] )),
103
+ 'data-close' => apply_filters('toolset_button_cancel_text', esc_attr( __( 'Cancel', 'wpv-views' ) )),// TODO adjust the button value depending on open/close action
104
  'class' => $use_bootstrap? 'btn btn-default wpt-hierarchical-taxonomy-add-new-show-hide js-wpt-hierarchical-taxonomy-add-new-show-hide' : 'wpt-hierarchical-taxonomy-add-new-show-hide js-wpt-hierarchical-taxonomy-add-new-show-hide',
105
  ),
106
 
108
  );
109
 
110
  // Input for new taxonomy
111
+
112
  if ( $use_bootstrap ) {
113
  $container = '<div style="display:none" class="form-group wpt-hierarchical-taxonomy-add-new js-wpt-hierarchical-taxonomy-add-new-' . $taxname . '" data-taxonomy="' . $taxname . '">';
114
  } else {
115
  $container = '<div style="display:none" class="wpt-hierarchical-taxonomy-add-new js-wpt-hierarchical-taxonomy-add-new-' . $taxname . '" data-taxonomy="' . $taxname . '">';
116
  }
117
+
118
  /**
119
  * The textfield input
120
  */
131
  ),
132
  '#validate' => $this->getValidationData(),
133
  '#before' => $container,
134
+
135
  );
136
+
137
  /**
138
  * The select for parent
139
  */
150
  '#attributes' => array(
151
  'data-parent-text' => $attributes['parent_text'],
152
  'data-taxonomy' => $taxname,
153
+ 'class' => 'js-taxonomy-parent wpt-taxonomy-parent'
154
  ),
155
 
156
  '#validate' => $this->getValidationData(),
164
  '#title' => '',
165
  '#description' => '',
166
  '#name' => "new_tax_button_".$taxname,
167
+ '#value' => apply_filters('toolset_button_add_text', esc_attr( $attributes['add_text'] )),
168
  '#attributes' => array(
169
  'data-taxonomy' => $taxname,
170
  'data-build_what' => $build_what,
173
 
174
  '#validate' => $this->getValidationData(),
175
  '#after' => '</div>',
176
+ );
177
+
178
  return $metaform;
179
+
180
  }
181
 
182
  private function buildTerms($obj_terms)
197
  private function buildSelect()
198
  {
199
  $attributes = $this->getAttr();
200
+
201
  $multiple = !isset($attributes['single_select']) || !$attributes['single_select'];
202
+
203
  $curr_options = $this->getOptions();
204
  $values = $this->valuesId;
205
  $options = array();
241
  '#class' => 'form-inline',
242
  '#repetitive' => $this->isRepetitive(),
243
  );
244
+
245
  if ($multiple) {
246
  $select['#attributes'] = array('multiple' => 'multiple');
247
  }
248
+
249
  if (count($options) == 0) {
250
  if (isset($select['#attributes'])) {
251
  $select['#attributes']['style'] = 'display:none';
292
  } else if ( is_array( $this->getValue() ) ) {
293
  $default_value = in_array( $tid, $this->getValue() );
294
  }
295
+ $clases = array();
296
+ $clases[] = 'tax-'.sanitize_title($names[$tid]);
297
+ $clases[] = 'tax-'.$this->_data['name'].'-'.$tid;
298
+ /**
299
+ * filter: cred_checkboxes_class
300
+ * @param array $clases current array of classes
301
+ * @parem array $option current option
302
+ * @param string field type
303
+ *
304
+ * @return array
305
+ */
306
+ $clases = apply_filters( 'cred_item_li_class', $clases, array( 'id' => $tid, 'name' => $name ), 'taxonomyhierarchical' );
307
+
308
  $item = array(
309
+ '#type' => 'checkbox',
310
+ '#title' => $names[$tid],
311
+ '#description' => '',
312
+ '#name' => $this->getName()."[]",
313
+ '#value' => $tid,
314
+ '#default_value' => $default_value,
315
+ '#validate' => $this->getValidationData(),
316
+ '#before' => sprintf( '<li class="%s">', implode( ' ', $clases )),
317
+ '#after' => '</li>',
318
+ '#attributes' => array(
319
+ 'data-parent' => $parent
320
+ ),
321
+ '#pattern' => '<BEFORE><PREFIX><ELEMENT><LABEL><ERROR><SUFFIX><DESCRIPTION><AFTER>',
322
+ );
323
+
324
  if ( $tkey == 0 ) {
325
  if ($level > 0) {
326
+ $item['#before'] = '<li class="tax-children-of-'.$parent.'"><ul class="wpt-form-set-children wpt-form-set-children-level-' . $level . '" data-level="' . $level . '">'.$item['#before'];
327
  } else {
328
+ $item['#before'] = '<ul class="wpt-form-set wpt-form-set-checkboxes wpt-form-set-checkboxes-' . $this->getName() . '" data-level="0">'.$item['#before'];
329
  }
330
  }
331
  if ( $tkey == ( $level_count - 1 ) ) {
332
  $item['#after'] = '</li>';
333
  }
334
+
335
  $metaform[] = $item;
336
 
337
+ if ( isset( $childs[$tid] ) ) {
338
  $metaform = $this->buildCheckboxes( $tid, $childs, $names, $metaform, $level + 1, $tid );
339
  }
340
+
341
  }
342
  }
343
+
344
  if (count($metaform)) {
345
  if ($level == 0) {
346
  $metaform[count($metaform) - 1]['#after'] .= '</ul>';
348
  $metaform[count($metaform) - 1]['#after'] .= '</ul></li>';
349
  }
350
  }
351
+
352
  return $metaform;
353
  }
354
  }
embedded/common/toolset-forms/classes/class.textarea.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  *
4
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.textarea.php $
5
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
6
- * $LastChangedRevision: 1012704 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
1
  <?php
2
  /**
3
  *
4
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.textarea.php $
5
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
6
+ * $LastChangedRevision: 1027712 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
embedded/common/toolset-forms/classes/class.textfield.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  *
4
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.textfield.php $
5
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
6
- * $LastChangedRevision: 1012704 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
@@ -34,6 +34,7 @@ class WPToolset_Field_Textfield extends FieldFactory
34
  '#validate' => $this->getValidationData(),
35
  '#repetitive' => $this->isRepetitive(),
36
  '#attributes' => $attributes,
 
37
  );
38
  return $metaform;
39
  }
1
  <?php
2
  /**
3
  *
4
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.textfield.php $
5
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
6
+ * $LastChangedRevision: 1027712 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
34
  '#validate' => $this->getValidationData(),
35
  '#repetitive' => $this->isRepetitive(),
36
  '#attributes' => $attributes,
37
+ 'wpml_action' => $this->getWPMLAction(),
38
  );
39
  return $metaform;
40
  }
embedded/common/toolset-forms/classes/class.types.php CHANGED
@@ -2,9 +2,9 @@
2
  /**
3
  * Types fields specific
4
  *
5
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.types.php $
6
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
7
- * $LastChangedRevision: 1012704 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
@@ -314,7 +314,7 @@ class WPToolset_Types
314
 
315
  // Get [values]
316
  $cond_values = self::getConditionalValues($post_id, $field['meta_type']);
317
-
318
  if ( function_exists('wpcf_fields_get_field_by_slug') ){
319
  // Update the conditional values according to what's being saved.
320
  foreach ( $_post_wpcf as $field_slug => $field_value ) {
@@ -323,11 +323,10 @@ class WPToolset_Types
323
  if ( empty( $field ) ) {
324
  continue;
325
  }
326
-
327
- $field_value = apply_filters( 'wpcf_fields_type_' . $field['type']
328
- . '_value_save', $field_value, $field, null );
329
-
330
- $cond_values[$field['meta_key']] = $field_value;
331
  }
332
  }
333
 
@@ -382,7 +381,7 @@ class WPToolset_Types
382
  unset( $cond_values, $c_values, $c_field );
383
  return $cache[$cache_key] = $cond;
384
  }
385
-
386
  public static function getConditionalValues($post_id, $meta_type = 'postmeta') {
387
  $cond_values = array();
388
  if ( !empty( $post_id ) ) {
@@ -396,10 +395,10 @@ class WPToolset_Types
396
  $v = self::getStringFromArray($v);
397
  }
398
  }
399
-
400
  return $cond_values;
401
  }
402
-
403
  public static function getCustomConditional($custom, $suffix = '', $cond_values = array()) {
404
  $c_fields = WPToolset_Forms_Conditional::extractFields( $custom );
405
  $c_values = array();
@@ -439,7 +438,7 @@ class WPToolset_Types
439
  'custom' => $custom,
440
  'values' => $c_values,
441
  );
442
-
443
  return $cond;
444
  }
445
 
2
  /**
3
  * Types fields specific
4
  *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.types.php $
6
+ * $LastChangedDate: 2014-10-23 10:33:39 +0000 (Thu, 23 Oct 2014) $
7
+ * $LastChangedRevision: 1012677 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
314
 
315
  // Get [values]
316
  $cond_values = self::getConditionalValues($post_id, $field['meta_type']);
317
+
318
  if ( function_exists('wpcf_fields_get_field_by_slug') ){
319
  // Update the conditional values according to what's being saved.
320
  foreach ( $_post_wpcf as $field_slug => $field_value ) {
323
  if ( empty( $field ) ) {
324
  continue;
325
  }
326
+
327
+ $field_value = apply_filters( 'wpcf_fields_type_' . $field['type'] . '_value_save', $field_value, $field, null );
328
+
329
+ $cond_values[$field['meta_key']] = $field_value;
 
330
  }
331
  }
332
 
381
  unset( $cond_values, $c_values, $c_field );
382
  return $cache[$cache_key] = $cond;
383
  }
384
+
385
  public static function getConditionalValues($post_id, $meta_type = 'postmeta') {
386
  $cond_values = array();
387
  if ( !empty( $post_id ) ) {
395
  $v = self::getStringFromArray($v);
396
  }
397
  }
398
+
399
  return $cond_values;
400
  }
401
+
402
  public static function getCustomConditional($custom, $suffix = '', $cond_values = array()) {
403
  $c_fields = WPToolset_Forms_Conditional::extractFields( $custom );
404
  $c_values = array();
438
  'custom' => $custom,
439
  'values' => $c_values,
440
  );
441
+
442
  return $cond;
443
  }
444
 
embedded/common/toolset-forms/classes/class.video.php CHANGED
@@ -6,9 +6,9 @@ require_once 'class.file.php';
6
  *
7
  * @author Srdjan
8
  *
9
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.video.php $
10
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
11
- * $LastChangedRevision: 1012704 $
12
  * $LastChangedBy: iworks $
13
  *
14
  */
@@ -23,15 +23,51 @@ class WPToolset_Field_Video extends WPToolset_Field_File
23
  $this->setValidationData($validation);
24
  return parent::metaform();
25
  }
26
-
27
- public static function addTypeValidation($validation) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  $validation['extension'] = array(
29
  'args' => array(
30
  'extension',
31
- '3gp|aaf|asf|avchd|avi|cam|dat|dsh|fla|flr|flv|m1v|m2v|m4v|mng|mp4|mxf|nsv|ogg|rm|roq|smi|sol|svi|swf|wmv|wrap|mkv|mov|mpe|mpeg|mpg',
32
  ),
33
  'message' => __( 'You can add only video.', 'wpv-views' ),
34
  );
35
  return $validation;
36
- }
37
  }
6
  *
7
  * @author Srdjan
8
  *
9
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.video.php $
10
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
11
+ * $LastChangedRevision: 1027712 $
12
  * $LastChangedBy: iworks $
13
  *
14
  */
23
  $this->setValidationData($validation);
24
  return parent::metaform();
25
  }
26
+
27
+ public static function addTypeValidation($validation)
28
+ {
29
+ $valid_extensions = array(
30
+ '3gp',
31
+ 'aaf',
32
+ 'asf',
33
+ 'avchd',
34
+ 'avi',
35
+ 'cam',
36
+ 'dat',
37
+ 'dsh',
38
+ 'fla',
39
+ 'flr',
40
+ 'flv',
41
+ 'm1v',
42
+ 'm2v',
43
+ 'm4v',
44
+ 'mng',
45
+ 'mp4',
46
+ 'mxf',
47
+ 'nsv',
48
+ 'ogg',
49
+ 'rm',
50
+ 'roq',
51
+ 'smi',
52
+ 'sol',
53
+ 'svi',
54
+ 'swf',
55
+ 'wmv',
56
+ 'wrap',
57
+ 'mkv',
58
+ 'mov',
59
+ 'mpe',
60
+ 'mpeg',
61
+ 'mpg',
62
+ );
63
+ $valid_extensions = apply_filters( 'toolset_valid_video_extentions', $valid_extensions);
64
  $validation['extension'] = array(
65
  'args' => array(
66
  'extension',
67
+ implode('|', $valid_extensions),
68
  ),
69
  'message' => __( 'You can add only video.', 'wpv-views' ),
70
  );
71
  return $validation;
72
+ }
73
  }
embedded/common/toolset-forms/classes/class.wysiwyg.php CHANGED
@@ -6,19 +6,19 @@ require_once 'class.textarea.php';
6
  *
7
  * @author Srdjan
8
  *
9
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/classes/class.wysiwyg.php $
10
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
11
- * $LastChangedRevision: 1012704 $
12
  * $LastChangedBy: iworks $
13
  *
14
  */
15
  class WPToolset_Field_Wysiwyg extends WPToolset_Field_Textarea
16
- {
17
  protected $_settings = array('min_wp_version' => '3.3');
18
 
19
  public function metaform()
20
  {
21
-
22
  $attributes = $this->getAttr();
23
  $form = array();
24
  $markup = '';
@@ -26,7 +26,7 @@ class WPToolset_Field_Wysiwyg extends WPToolset_Field_Textarea
26
  $markup .= '<div class="form-item form-item-markup">';
27
  $markup .= sprintf( '<label class="wpt-form-label wpt-form-textfield-label">%s</label>', $this->getTitle() );
28
  }
29
- $markup .= $this->getDescription();
30
  $markup .= $this->_editor($attributes);
31
  if ( is_admin() ) {
32
  $markup .= '</div>';
@@ -41,15 +41,14 @@ class WPToolset_Field_Wysiwyg extends WPToolset_Field_Textarea
41
  protected function _editor(&$attributes)
42
  {
43
 
44
-
45
  if (isset($attributes['readonly'])&&$attributes['readonly']=='readonly') {
46
  add_filter( 'tiny_mce_before_init', array(&$this, 'tiny_mce_before_init_callback'));
47
  }
48
 
49
- //EMERSON: Rewritten to set do_concat to TRUE so WordPress won't echo styles directly to the browser
50
  //This will fix a lot of issues as WordPress will not be echoing content to the browser before header() is called
51
  //This fix is important so we will not be necessarily adding ob_start() here in this todo:
52
- //https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/185336518/comments#282283111
53
  //Using ob_start in that code will have some side effects of some styles from other plugins not being properly loaded.
54
 
55
  global $wp_styles;
@@ -74,7 +73,8 @@ class WPToolset_Field_Wysiwyg extends WPToolset_Field_Textarea
74
  }
75
 
76
  /*RICCARDO: removed anonymous function for retrocompatibility */
77
- public function tiny_mce_before_init_callback( $args ) {
 
78
  // do you existing check for published here
79
  if ( 1 == 1 )
80
  $args['readonly'] = 1;
6
  *
7
  * @author Srdjan
8
  *
9
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/classes/class.wysiwyg.php $
10
+ * $LastChangedDate: 2014-10-29 15:57:36 +0000 (Wed, 29 Oct 2014) $
11
+ * $LastChangedRevision: 1016002 $
12
  * $LastChangedBy: iworks $
13
  *
14
  */
15
  class WPToolset_Field_Wysiwyg extends WPToolset_Field_Textarea
16
+ {
17
  protected $_settings = array('min_wp_version' => '3.3');
18
 
19
  public function metaform()
20
  {
21
+
22
  $attributes = $this->getAttr();
23
  $form = array();
24
  $markup = '';
26
  $markup .= '<div class="form-item form-item-markup">';
27
  $markup .= sprintf( '<label class="wpt-form-label wpt-form-textfield-label">%s</label>', $this->getTitle() );
28
  }
29
+ $markup .= stripcslashes($this->getDescription());
30
  $markup .= $this->_editor($attributes);
31
  if ( is_admin() ) {
32
  $markup .= '</div>';
41
  protected function _editor(&$attributes)
42
  {
43
 
 
44
  if (isset($attributes['readonly'])&&$attributes['readonly']=='readonly') {
45
  add_filter( 'tiny_mce_before_init', array(&$this, 'tiny_mce_before_init_callback'));
46
  }
47
 
48
+ //EMERSON: Rewritten to set do_concat to TRUE so WordPress won't echo styles directly to the browser
49
  //This will fix a lot of issues as WordPress will not be echoing content to the browser before header() is called
50
  //This fix is important so we will not be necessarily adding ob_start() here in this todo:
51
+ //https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/185336518/comments#282283111
52
  //Using ob_start in that code will have some side effects of some styles from other plugins not being properly loaded.
53
 
54
  global $wp_styles;
73
  }
74
 
75
  /*RICCARDO: removed anonymous function for retrocompatibility */
76
+ public function tiny_mce_before_init_callback($args)
77
+ {
78
  // do you existing check for published here
79
  if ( 1 == 1 )
80
  $args['readonly'] = 1;
embedded/common/toolset-forms/css/wpt-jquery-ui/datepicker.css CHANGED
@@ -133,7 +133,7 @@
133
  .ui-datepicker .ui-datepicker-next-hover { right:1px; }
134
  .ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
135
  .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
136
- .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
137
  .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
138
  .ui-datepicker select.ui-datepicker-month,
139
  .ui-datepicker select.ui-datepicker-year { width: 49%;}
133
  .ui-datepicker .ui-datepicker-next-hover { right:1px; }
134
  .ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
135
  .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
136
+ .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; color: #333333; }
137
  .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
138
  .ui-datepicker select.ui-datepicker-month,
139
  .ui-datepicker select.ui-datepicker-year { width: 49%;}
embedded/common/toolset-forms/external/autocompleter.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  *
4
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/external/autocompleter.php $
5
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
6
- * $LastChangedRevision: 1012704 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
1
  <?php
2
  /**
3
  *
4
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/external/autocompleter.php $
5
+ * $LastChangedDate: 2014-05-29 08:44:10 +0000 (Thu, 29 May 2014) $
6
+ * $LastChangedRevision: 922956 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
embedded/common/toolset-forms/js/conditional.js CHANGED
@@ -1,10 +1,10 @@
1
  /**
2
  * @see WPToolset_Forms_Conditional (classes/conditional.php)
3
  *
4
- * $HeadURL: https://www.onthegosystems.com/misc_svn/common/tags/Views-1.6.4-CRED-1.3.2-Types-1.6.4-Acces-1.2.3/toolset-forms/js/conditional.js $
5
- * $LastChangedDate: 2014-08-27 17:35:29 +0200 (Wed, 27 Aug 2014) $
6
- * $LastChangedRevision: 26501 $
7
- * $LastChangedBy: riccardo $ Riccardo
8
  *
9
  */
10
  var wptCondTriggers = {}
@@ -132,6 +132,9 @@ var wptCond = (function($) {
132
  } else {
133
  val = radio.data('types-value');
134
  }
 
 
 
135
  break;
136
  case 'select':
137
  option = $('[name="' + $trigger.attr('name') + '"] option:selected', formID);
@@ -463,7 +466,10 @@ var wptCond = (function($) {
463
  break;
464
  case 'radio':
465
  case 'radios':
466
- $('[name="' + $trigger.attr('name') + '"]').on('click', func);
 
 
 
467
  break;
468
  case 'select':
469
  $trigger.on('change', func);
@@ -485,17 +491,26 @@ var wptCond = (function($) {
485
 
486
  function _custom(formID, fields)
487
  {
 
 
 
 
 
 
 
 
488
  _.each(fields, function(field) {
489
  var c = wptCondCustomFields[formID][field];
490
  var expression = c.custom;
491
 
492
  // Get the values and update the expression.
493
  _.each(c.triggers, function(t) {
494
- var $trigger = _getTrigger(t),
495
- value = _getTriggerValue($trigger),
496
  is_array = $trigger.length > 1 ? true : false;
497
-
498
- console.log(":::: AND THE VALUE??????", value, " for t: ", t, $trigger );
 
499
 
500
  if (typeof value != 'undefined') {
501
 
@@ -507,12 +522,13 @@ var wptCond = (function($) {
507
  // then convert value to ARRAY(...)
508
 
509
 
510
- if( is_array === true )
511
- {
512
 
513
- var val_array = '';
514
 
515
- console.log();
 
 
516
 
517
  if (value instanceof Array) {
518
  for(var i = 0; i < value.length; i++) {
1
  /**
2
  * @see WPToolset_Forms_Conditional (classes/conditional.php)
3
  *
4
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/js/conditional.js $
5
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
6
+ * $LastChangedRevision: 1027712 $
7
+ * $LastChangedBy: iworks $ Riccardo
8
  *
9
  */
10
  var wptCondTriggers = {}
132
  } else {
133
  val = radio.data('types-value');
134
  }
135
+ if ( wptCondDebug ) {
136
+ console.log( 'radio', radio );
137
+ }
138
  break;
139
  case 'select':
140
  option = $('[name="' + $trigger.attr('name') + '"] option:selected', formID);
466
  break;
467
  case 'radio':
468
  case 'radios':
469
+ /**
470
+ * when selecting again, do not forget about formID
471
+ */
472
+ $('[name="' + $trigger.attr('name') + '"]', formID).on('click', func);
473
  break;
474
  case 'select':
475
  $trigger.on('change', func);
491
 
492
  function _custom(formID, fields)
493
  {
494
+ /**
495
+ * debug
496
+ */
497
+ if ( wptCondDebug ) {
498
+ console.log('_custom');
499
+ console.log('formID', formID);
500
+ console.log('fields', fields);
501
+ }
502
  _.each(fields, function(field) {
503
  var c = wptCondCustomFields[formID][field];
504
  var expression = c.custom;
505
 
506
  // Get the values and update the expression.
507
  _.each(c.triggers, function(t) {
508
+ var $trigger = _getTrigger(t, formID),
509
+ value = _getTriggerValue($trigger, formID),
510
  is_array = $trigger.length > 1 ? true : false;
511
+ if ( wptCondDebug ) {
512
+ console.log("The value is ", value, " for element: ", t, $trigger );
513
+ }
514
 
515
  if (typeof value != 'undefined') {
516
 
522
  // then convert value to ARRAY(...)
523
 
524
 
525
+ if( is_array === true ) {
 
526
 
527
+ var val_array = '';
528
 
529
+ if ( wptCondDebug ) {
530
+ console.log();
531
+ }
532
 
533
  if (value instanceof Array) {
534
  for(var i = 0; i < value.length; i++) {
embedded/common/toolset-forms/js/date.js CHANGED
@@ -1,105 +1,109 @@
1
-
2
- var wptDate = (function($) {
3
  var _tempConditions, _tempField;
4
  function init(parent) {
5
  if ($.isFunction($.fn.datepicker)) {
6
- $('input.js-wpt-date', $(parent)).each(function(index) {
7
  if (!$(this).is(':disabled') && !$(this).hasClass('hasDatepicker')) {
8
  a = wptDate.add($(this));
9
  //a.next().after('<span style="margin-left:10px"><i>' + wptDateData.dateFormatNote + '</i></span>').data( 'dateFormatNote', true );
10
  }
11
  });
12
  }
13
-
14
- $(document).on( 'click', '.js-wpt-date-clear', function() {
15
- var thiz = $(this), thiz_close, el, el_aux, el_select;
16
- if ( thiz.closest('.js-wpt-field-item').length > 0 ) {
17
- thiz_close = thiz.closest('.js-wpt-field-item');
18
- el_aux = thiz_close.find('.js-wpt-date-auxiliar');
19
- el = thiz_close.find('.js-wpt-date');
20
- el_select = thiz_close.find('select');
21
- } else if ( thiz.closest('.wpt-repctl').length > 0 ) {
22
- thiz_close = thiz.closest('.wpt-repctl');
23
- el_aux = thiz_close.find('.js-wpt-date-auxiliar');
24
- el = thiz_close.find('.js-wpt-date');
25
- el_select = thiz_close.find('select');
26
- } else if ( thiz.closest('.js-wpt-field-items').length > 0 ) {
27
- thiz_close = thiz.closest('.js-wpt-field-items');
28
- el_aux = thiz_close.find('.js-wpt-date-auxiliar');
29
- el = thiz_close.find('.js-wpt-date');
30
- el_select = thiz_close.find('select');
31
- } else {
32
- // This should be an empty object, but as we use the variable later we need to set it
33
- el_aux = thiz.closest('.js-wpt-field-items');
34
- el = thiz.closest('.js-wpt-date');
35
- el_select = thiz.closest('select');
36
- }
37
- el_aux.val( '' ).trigger( 'change' );
38
- el.val( '' );
39
- el_select.val('0');
40
- thiz.hide();
41
- });
42
  }
43
 
44
  function add(el)
45
  {
46
  // Before anything, return if this is readonly
47
- if ( el.hasClass('js-wpv-date-readonly') ) {
48
- if ( !el.hasClass('js-wpv-date-readonly-added') ) {
49
- el.addClass('js-wpv-date-readonly-added').after('<img src="' + wptDateData.readonly_image + '" alt="' + wptDateData.readonly + '" title="' + wptDateData.readonly + '" class="ui-datepicker-readonly" />');
50
- }
51
- return;
52
- }
53
- // First, a hacky hack: make the id of each el unique, because the way they are produced on repetitive date fields does not ensure it
54
- var rand_number = 1 + Math.floor(Math.random() * 150),
55
- old_id = el.attr('id');
56
- el.attr('id', old_id + '-' + rand_number);
57
- // Walk along, nothing to see here...
58
- return el.datepicker({
59
- onSelect: function( dateText, inst ) {
60
- // The el_aux element depends on the scenario: backend or frontend
61
- var el_close, el_aux, el_clear;
62
- el.val('');
63
- if ( el.closest('.js-wpt-field-item').length > 0 ) {
64
- el_close = el.closest('.js-wpt-field-item');
65
- el_aux = el_close.find('.js-wpt-date-auxiliar');
66
- el_clear = el_close.find('.js-wpt-date-clear');
67
- } else if ( el.closest('.wpt-repctl').length > 0 ) {
68
- el_close = el.closest('.wpt-repctl');
69
- el_aux = el_close.find('.js-wpt-date-auxiliar');
70
- el_clear = el_close.find('.js-wpt-date-clear');
71
- } else if ( el.closest('.js-wpt-field-items').length > 0 ) {
72
- el_close = el.closest('.js-wpt-field-items');
73
- el_aux = el_close.find('.js-wpt-date-auxiliar');
74
- el_clear = el_close.find('.js-wpt-date-clear');
75
- } else {
76
- // This should be an empty object, but as we use the variable later we need to set it
77
- el_aux = el.closest('.js-wpt-field-items');
78
- el_clear = el.closest('.js-wpt-date-clear');
79
- }
80
- var data = 'date=' + dateText;
81
- data += '&date-format=' + wptDateData.dateFormatPhp;
82
- data += '&action=wpt_localize_extended_date';
83
- $.post( wptDateData.ajaxurl, data, function( response ) {
84
- response = $.parseJSON( response );
85
- if ( el_aux.length > 0 ) {
86
- el_aux.val( response['timestamp'] ).trigger('wptDateSelect');
87
- }
88
- el.val( response['display'] );
89
- el_clear.show();
90
- });
91
- //el.trigger('wptDateSelect');
92
- },
93
- showOn: "both",
94
- buttonImage: wptDateData.buttonImage,
95
- buttonImageOnly: true,
96
- buttonText: wptDateData.buttonText,
97
- dateFormat: 'ddmmyy',
98
- //dateFormat: wptDateData.dateFormat,
99
- //altFormat: wptDateData.dateFormat,
100
- changeMonth: true,
101
- changeYear: true,
102
- yearRange: wptDateData.yearMin+':'+wptDateData.yearMax
 
 
 
 
 
103
  });
104
  }
105
 
@@ -113,10 +117,10 @@ var wptDate = (function($) {
113
  wptCond.ajaxCheck(formID, _tempField, _tempConditions);
114
  }
115
  function ignoreConditional(val) {
116
- if ( '' == val ) {
117
  return '__ignore_negative';
118
  }
119
- return val;
120
  //return Date.parse(val);
121
  }
122
  function bindConditionalChange($trigger, func, formID) {
@@ -125,8 +129,9 @@ var wptDate = (function($) {
125
  //$trigger.on('keyup', lazy);
126
  return false;
127
  }
128
- function triggerAjax(func){
129
- if ($(this).val().length >= wptDateData.dateFormatPhp.length) func();
 
130
  }
131
  return {
132
  init: init,
@@ -139,23 +144,23 @@ var wptDate = (function($) {
139
  };
140
  })(jQuery);
141
 
142
- jQuery(document).ready(function() {
143
  wptDate.init('body');
144
  //fixing unknown Srdjan error
145
  jQuery('.ui-datepicker-inline').hide();
146
  });
147
 
148
- if ( 'undefined' != typeof(wptCallbacks) ) {
149
- wptCallbacks.reset.add(function(parent) {
150
  wptDate.init(parent);
151
  });
152
  wptCallbacks.addRepetitive.add(wptDate.init);
153
  }
154
 
155
  //add_action('conditional_check_date', wptDate.ajaxConditional, 10, 3);
156
- if ( 'function' == typeof(add_filter) ) {
157
  add_filter('conditional_value_date', wptDate.ignoreConditional, 10, 1);
158
  }
159
- if ( 'function' == typeof(add_action) ) {
160
  add_action('conditional_trigger_bind_date', wptDate.bindConditionalChange, 10, 3);
161
  }
1
+ var wptDate = (function ($) {
 
2
  var _tempConditions, _tempField;
3
  function init(parent) {
4
  if ($.isFunction($.fn.datepicker)) {
5
+ $('input.js-wpt-date', $(parent)).each(function (index) {
6
  if (!$(this).is(':disabled') && !$(this).hasClass('hasDatepicker')) {
7
  a = wptDate.add($(this));
8
  //a.next().after('<span style="margin-left:10px"><i>' + wptDateData.dateFormatNote + '</i></span>').data( 'dateFormatNote', true );
9
  }
10
  });
11
  }
12
+
13
+ $(document).on('click', '.js-wpt-date-clear', function () {
14
+ var thiz = $(this), thiz_close, el, el_aux, el_select;
15
+ if (thiz.closest('.js-wpt-field-item').length > 0) {
16
+ thiz_close = thiz.closest('.js-wpt-field-item');
17
+ el_aux = thiz_close.find('.js-wpt-date-auxiliar');
18
+ el = thiz_close.find('.js-wpt-date');
19
+ el_select = thiz_close.find('select');
20
+ } else if (thiz.closest('.wpt-repctl').length > 0) {
21
+ thiz_close = thiz.closest('.wpt-repctl');
22
+ el_aux = thiz_close.find('.js-wpt-date-auxiliar');
23
+ el = thiz_close.find('.js-wpt-date');
24
+ el_select = thiz_close.find('select');
25
+ } else if (thiz.closest('.js-wpt-field-items').length > 0) {
26
+ thiz_close = thiz.closest('.js-wpt-field-items');
27
+ el_aux = thiz_close.find('.js-wpt-date-auxiliar');
28
+ el = thiz_close.find('.js-wpt-date');
29
+ el_select = thiz_close.find('select');
30
+ } else {
31
+ // This should be an empty object, but as we use the variable later we need to set it
32
+ el_aux = thiz.closest('.js-wpt-field-items');
33
+ el = thiz.closest('.js-wpt-date');
34
+ el_select = thiz.closest('select');
35
+ }
36
+ el_aux.val('').trigger('change');
37
+ el.val('');
38
+ el_select.val('0');
39
+ thiz.hide();
40
+ });
41
  }
42
 
43
  function add(el)
44
  {
45
  // Before anything, return if this is readonly
46
+ if (el.hasClass('js-wpv-date-readonly')) {
47
+ if (!el.hasClass('js-wpv-date-readonly-added')) {
48
+ el.addClass('js-wpv-date-readonly-added').after('<img src="' + wptDateData.readonly_image + '" alt="' + wptDateData.readonly + '" title="' + wptDateData.readonly + '" class="ui-datepicker-readonly" />');
49
+ }
50
+ return;
51
+ }
52
+ // First, a hacky hack: make the id of each el unique, because the way they are produced on repetitive date fields does not ensure it
53
+ var rand_number = 1 + Math.floor(Math.random() * 150),
54
+ old_id = el.attr('id');
55
+ el.attr('id', old_id + '-' + rand_number);
56
+ // Walk along, nothing to see here...
57
+ return el.datepicker({
58
+ onSelect: function (dateText, inst) {
59
+ // The el_aux element depends on the scenario: backend or frontend
60
+ var el_close, el_aux, el_clear;
61
+ el.val('');
62
+ if (el.closest('.js-wpt-field-item').length > 0) {
63
+ el_close = el.closest('.js-wpt-field-item');
64
+ el_aux = el_close.find('.js-wpt-date-auxiliar');
65
+ el_clear = el_close.find('.js-wpt-date-clear');
66
+ } else if (el.closest('.wpt-repctl').length > 0) {
67
+ el_close = el.closest('.wpt-repctl');
68
+ el_aux = el_close.find('.js-wpt-date-auxiliar');
69
+ el_clear = el_close.find('.js-wpt-date-clear');
70
+ } else if (el.closest('.js-wpt-field-items').length > 0) {
71
+ el_close = el.closest('.js-wpt-field-items');
72
+ el_aux = el_close.find('.js-wpt-date-auxiliar');
73
+ el_clear = el_close.find('.js-wpt-date-clear');
74
+ } else {
75
+ // This should be an empty object, but as we use the variable later we need to set it
76
+ el_aux = el.closest('.js-wpt-field-items');
77
+ el_clear = el.closest('.js-wpt-date-clear');
78
+ }
79
+ var data = 'date=' + dateText;
80
+ data += '&date-format=' + wptDateData.dateFormatPhp;
81
+ data += '&action=wpt_localize_extended_date';
82
+ $.post(wptDateData.ajaxurl, data, function (response) {
83
+ response = $.parseJSON(response);
84
+ if (el_aux.length > 0) {
85
+ el_aux.val(response['timestamp']).trigger('wptDateSelect');
86
+ }
87
+ el.val(response['display']);
88
+ el_clear.show();
89
+ });
90
+ //el.trigger('wptDateSelect');
91
+ },
92
+ showOn: "both",
93
+ buttonImage: wptDateData.buttonImage,
94
+ buttonImageOnly: true,
95
+ buttonText: wptDateData.buttonText,
96
+ dateFormat: 'ddmmyy',
97
+ //dateFormat: wptDateData.dateFormat,
98
+ //altFormat: wptDateData.dateFormat,
99
+ changeMonth: true,
100
+ changeYear: true,
101
+ yearRange: wptDateData.yearMin + ':' + wptDateData.yearMax,
102
+ beforeShow: function(input) {
103
+ $(input).css({
104
+ zIndex: 999999
105
+ })
106
+ }
107
  });
108
  }
109
 
117
  wptCond.ajaxCheck(formID, _tempField, _tempConditions);
118
  }
119
  function ignoreConditional(val) {
120
+ if ('' == val) {
121
  return '__ignore_negative';
122
  }
123
+ return val;
124
  //return Date.parse(val);
125
  }
126
  function bindConditionalChange($trigger, func, formID) {
129
  //$trigger.on('keyup', lazy);
130
  return false;
131
  }
132
+ function triggerAjax(func) {
133
+ if ($(this).val().length >= wptDateData.dateFormatPhp.length)
134
+ func();
135
  }
136
  return {
137
  init: init,
144
  };
145
  })(jQuery);
146
 
147
+ jQuery(document).ready(function () {
148
  wptDate.init('body');
149
  //fixing unknown Srdjan error
150
  jQuery('.ui-datepicker-inline').hide();
151
  });
152
 
153
+ if ('undefined' != typeof (wptCallbacks)) {
154
+ wptCallbacks.reset.add(function (parent) {
155
  wptDate.init(parent);
156
  });
157
  wptCallbacks.addRepetitive.add(wptDate.init);
158
  }
159
 
160
  //add_action('conditional_check_date', wptDate.ajaxConditional, 10, 3);
161
+ if ('function' == typeof (add_filter)) {
162
  add_filter('conditional_value_date', wptDate.ignoreConditional, 10, 1);
163
  }
164
+ if ('function' == typeof (add_action)) {
165
  add_action('conditional_trigger_bind_date', wptDate.bindConditionalChange, 10, 3);
166
  }
embedded/common/toolset-forms/js/file.js CHANGED
@@ -1,9 +1,9 @@
1
  /**
2
  *
3
- * $HeadURL: https://www.onthegosystems.com/misc_svn/common/tags/Views-1.6.4-CRED-1.3.2-Types-1.6.4-Acces-1.2.3/toolset-forms/js/file.js $
4
- * $LastChangedDate: 2014-07-11 14:41:02 +0200 (Fri, 11 Jul 2014) $
5
- * $LastChangedRevision: 24880 $
6
- * $LastChangedBy: marcin $
7
  *
8
  */
9
  var wptFile = (function($, w) {
1
  /**
2
  *
3
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/js/file.js $
4
+ * $LastChangedDate: 2014-08-22 01:02:43 +0000 (Fri, 22 Aug 2014) $
5
+ * $LastChangedRevision: 970205 $
6
+ * $LastChangedBy: brucepearson $
7
  *
8
  */
9
  var wptFile = (function($, w) {
embedded/common/toolset-forms/js/main.js CHANGED
@@ -19,6 +19,13 @@ jQuery(document).ready(function() {
19
  } else {
20
  wptCallbacks.validationInit.fire();
21
  }
 
 
 
 
 
 
 
22
  });
23
 
24
 
@@ -80,7 +87,7 @@ function showHideMostPopularButton(taxonomy)
80
  return false;
81
  }
82
  }
83
-
84
  jQuery(document).on('click', '.js-wpt-taxonomy-popular-show-hide', function() {
85
  showHideMostPopularTaxonomy(this);
86
  });
@@ -91,9 +98,9 @@ function showHideMostPopularTaxonomy(el)
91
  jQuery('.shmpt-'+taxonomy, jQuery(el).closest('form')).toggle();
92
  var curr = jQuery(el).val();
93
  if (curr==jQuery(el).data('show-popular-text')) {
94
- jQuery(el).val(jQuery(el).data('hide-popular-text'));
95
  } else {
96
- jQuery(el).val(jQuery(el).data('show-popular-text'));
97
  }
98
  }
99
 
@@ -213,27 +220,27 @@ function initTaxonomies(values, taxonomy, url, fieldId)
213
  }
214
 
215
  toolsetForms.CRED_taxonomy = function () {
216
-
217
  var self = this;
218
-
219
  self.init = function () {
220
  self._new_taxonomy = new Array();
221
  jQuery(document).ready(self._document_ready);
222
  }
223
-
224
  self._document_ready = function () {
225
  self._initialize_taxonomy_buttons();
226
  self._initialize_hierachical();
227
  }
228
-
229
  self._initialize_hierachical = function () {
230
  self._fill_parent_drop_down()
231
  }
232
-
233
  self._fill_parent_drop_down = function () {
234
  jQuery('select.js-taxonomy-parent').each ( function () {
235
  var select = jQuery(this);
236
-
237
  // remove all the options
238
  jQuery(this).find('option').each (function () {
239
  if (jQuery(this).val() != '-1') {
@@ -242,7 +249,7 @@ toolsetForms.CRED_taxonomy = function () {
242
  })
243
 
244
  var taxonomy = jQuery(this).data('taxonomy');
245
-
246
  // Copy all the checkbox values if it's checkbox mode
247
  jQuery('input[name="' + taxonomy + '\[\]"]').each (function () {
248
  var id = jQuery(this).attr('id');
@@ -254,19 +261,19 @@ toolsetForms.CRED_taxonomy = function () {
254
  }
255
  select.append('<option value="' + jQuery(this).val() + '">' + prefix + label.text() + '</option>');
256
  })
257
-
258
  // Copy all the select option values if it's select mode
259
  jQuery('select[name="' + taxonomy + '\[\]"]').find('option').each (function () {
260
  var id = jQuery(this).val();
261
  var text = jQuery(this).text();
262
  select.append('<option value="' + id + '">' + text + '</option>');
263
  })
264
-
265
-
266
  });
267
-
268
  }
269
-
270
  self._initialize_taxonomy_buttons = function () {
271
  // replace the taxonomy button placeholders with the actual buttons.
272
  jQuery('.js-taxonomy-button-placeholder').each(function () {
@@ -276,7 +283,7 @@ toolsetForms.CRED_taxonomy = function () {
276
  selectors = [];
277
 
278
  if (buttons.length) {
279
-
280
  buttons.each(function () {
281
  var button = jQuery(this);
282
 
@@ -290,8 +297,8 @@ toolsetForms.CRED_taxonomy = function () {
290
  } else {
291
  button.show();
292
  }
293
-
294
- // move anything else that should be moved with the button
295
  //Responsible of the issue https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/188673095/comments
296
  //changed selector
297
  //var selector = button.data('after-selector');
@@ -306,14 +313,18 @@ toolsetForms.CRED_taxonomy = function () {
306
  })
307
  }
308
  });
309
- }
 
 
 
 
 
 
 
 
 
 
310
 
311
- jQuery(document).on('click', '.js-wpt-hierarchical-taxonomy-add-new-show-hide', function() {
312
- var thiz = jQuery(this),
313
- taxonomy = thiz.data( 'taxonomy' );
314
- self.add_new_show_hide( taxonomy, this );
315
- });
316
-
317
  self.add_new_show_hide = function ( taxonomy, button ) {
318
  jQuery('.js-wpt-hierarchical-taxonomy-add-new-' + taxonomy).toggle();
319
  self.hide_parent_button_if_no_terms( taxonomy, button );
@@ -356,7 +367,7 @@ toolsetForms.CRED_taxonomy = function () {
356
  {
357
  self._add_new_flag=!self._add_new_flag;
358
  //if( self.terms_exist(taxonomy, button) === false ) {
359
- if( self._add_new_flag === false ) {
360
  jQuery('[name="new_tax_select_' + taxonomy + '"]').hide();
361
  }
362
  else
@@ -388,13 +399,13 @@ toolsetForms.CRED_taxonomy = function () {
388
  }
389
  });
390
 
391
- jQuery('select[name="' + taxonomy + '\[\]"]').find('option').each (function () {
392
  if (new_taxonomy == jQuery(this).text()) {
393
  exists = true;
394
  self._flash_it(jQuery(this));
395
  }
396
  });
397
-
398
  if (exists) {
399
  jQuery('[name="new_tax_text_' + taxonomy + '"]').val('');
400
  return;
@@ -404,7 +415,7 @@ toolsetForms.CRED_taxonomy = function () {
404
  add_position = null,
405
  add_before = true,
406
  div_fields_wrap = jQuery('div[data-item_name="taxonomyhierarchical-'+taxonomy+'"]'),
407
- level = 0;
408
 
409
  if ( build_what === 'checkboxes' ){
410
  //Fix add new leaf
@@ -415,7 +426,7 @@ toolsetForms.CRED_taxonomy = function () {
415
  }
416
  });
417
  //#########################################################################################
418
-
419
  var new_checkbox = '<li><input data-parent="' + parent + '" class="wpt-form-checkbox form-checkbox checkbox" type="checkbox" name="' + taxonomy + '[]" checked="checked" value="' + new_taxonomy + '"></input><label>' + new_taxonomy + '</label></li>';
420
  // find the first checkbox sharing parent
421
  var first_checkbox = jQuery('input[name="' + taxonomy + '\[\]"][data-parent="' + parent + '"]:first');
@@ -439,9 +450,9 @@ toolsetForms.CRED_taxonomy = function () {
439
  jQuery('[name="new_tax_select_' + taxonomy + '"]').show();
440
  } else if( build_what === 'select' ) {
441
  // Select control
442
-
443
  jQuery('select[name="' + taxonomy + '\[\]"]').show();
444
-
445
  var indent = '';
446
  var first_option = jQuery('select[name="' + taxonomy + '\[\]"]').find('option[data-parent="' + parent + '"]:first');
447
  if (first_option.length == 0) {
@@ -471,7 +482,7 @@ toolsetForms.CRED_taxonomy = function () {
471
  }
472
  }
473
  }
474
-
475
  if (add_position) {
476
  var new_option = '<option value="' + new_taxonomy + '" selected>' + indent + new_taxonomy + '</option>';
477
  if (add_before) {
@@ -482,19 +493,19 @@ toolsetForms.CRED_taxonomy = function () {
482
  }
483
  jQuery('[name="new_tax_select_' + taxonomy + '"]').show()
484
  }
485
-
486
-
487
-
488
-
489
  self._update_hierachy(taxonomy, new_taxonomy);
490
-
491
  jQuery('[name="new_tax_text_' + taxonomy + '"]').val('');
492
-
493
  self._fill_parent_drop_down();
494
-
495
-
496
  }
497
-
498
  self._update_hierachy = function (taxonomy, new_taxonomy) {
499
  var new_taxonomy_input = jQuery('input[name="' + taxonomy + '_hierarchy"]');
500
  if (!new_taxonomy_input.length) {
@@ -502,24 +513,24 @@ toolsetForms.CRED_taxonomy = function () {
502
  jQuery('<input name="' + taxonomy + '_hierarchy" style="display:none" type="hidden">').insertAfter(jQuery('[name="new_tax_text_' + taxonomy + '"]'));
503
  new_taxonomy_input = jQuery('input[name="' + taxonomy + '_hierarchy"]');
504
  }
505
-
506
  var parent = jQuery('[name="new_tax_select_' + taxonomy + '"]').val();
507
  self._new_taxonomy.push(parent + ',' + new_taxonomy);
508
-
509
  var value = '';
510
  for (var i = 0; i < self._new_taxonomy.length; i++) {
511
  value += '{' + self._new_taxonomy[i] + '}';
512
  }
513
  new_taxonomy_input.val(value);
514
-
515
  }
516
-
517
  self._flash_it = function (element) {
518
  element.fadeOut(300).fadeIn(300).fadeOut(300).fadeIn(300);
519
  }
520
-
521
  self.init();
522
-
523
  }
524
 
525
  toolsetForms.cred_tax = new toolsetForms.CRED_taxonomy();
@@ -529,7 +540,7 @@ toolsetForms.cred_tax = new toolsetForms.CRED_taxonomy();
529
  jQuery(function(){
530
  var keyStop = {
531
  8: ":not(input:text, textarea, input:file, input:password)", // stop backspace = back
532
- 13: "input:text, input:password", // stop enter = submit
533
 
534
  end: null
535
  };
19
  } else {
20
  wptCallbacks.validationInit.fire();
21
  }
22
+ /**
23
+ * check taxonmies on submitted forms
24
+ */
25
+ jQuery('.cred-taxonomy', jQuery('form.is_submitted')).each(function(){
26
+ parent = jQuery(this);
27
+ setTimeout( function(){jQuery('input.wpt-taxonomy-add-new', parent).click();}, 50);
28
+ });
29
  });
30
 
31
 
87
  return false;
88
  }
89
  }
90
+
91
  jQuery(document).on('click', '.js-wpt-taxonomy-popular-show-hide', function() {
92
  showHideMostPopularTaxonomy(this);
93
  });
98
  jQuery('.shmpt-'+taxonomy, jQuery(el).closest('form')).toggle();
99
  var curr = jQuery(el).val();
100
  if (curr==jQuery(el).data('show-popular-text')) {
101
+ jQuery(el).val(jQuery(el).data('hide-popular-text')).addClass('btn-cancel');
102
  } else {
103
+ jQuery(el).val(jQuery(el).data('show-popular-text')).removeClass('btn-cancel');
104
  }
105
  }
106
 
220
  }
221
 
222
  toolsetForms.CRED_taxonomy = function () {
223
+
224
  var self = this;
225
+
226
  self.init = function () {
227
  self._new_taxonomy = new Array();
228
  jQuery(document).ready(self._document_ready);
229
  }
230
+
231
  self._document_ready = function () {
232
  self._initialize_taxonomy_buttons();
233
  self._initialize_hierachical();
234
  }
235
+
236
  self._initialize_hierachical = function () {
237
  self._fill_parent_drop_down()
238
  }
239
+
240
  self._fill_parent_drop_down = function () {
241
  jQuery('select.js-taxonomy-parent').each ( function () {
242
  var select = jQuery(this);
243
+
244
  // remove all the options
245
  jQuery(this).find('option').each (function () {
246
  if (jQuery(this).val() != '-1') {
249
  })
250
 
251
  var taxonomy = jQuery(this).data('taxonomy');
252
+
253
  // Copy all the checkbox values if it's checkbox mode
254
  jQuery('input[name="' + taxonomy + '\[\]"]').each (function () {
255
  var id = jQuery(this).attr('id');
261
  }
262
  select.append('<option value="' + jQuery(this).val() + '">' + prefix + label.text() + '</option>');
263
  })
264
+
265
  // Copy all the select option values if it's select mode
266
  jQuery('select[name="' + taxonomy + '\[\]"]').find('option').each (function () {
267
  var id = jQuery(this).val();
268
  var text = jQuery(this).text();
269
  select.append('<option value="' + id + '">' + text + '</option>');
270
  })
271
+
272
+
273
  });
274
+
275
  }
276
+
277
  self._initialize_taxonomy_buttons = function () {
278
  // replace the taxonomy button placeholders with the actual buttons.
279
  jQuery('.js-taxonomy-button-placeholder').each(function () {
283
  selectors = [];
284
 
285
  if (buttons.length) {
286
+
287
  buttons.each(function () {
288
  var button = jQuery(this);
289
 
297
  } else {
298
  button.show();
299
  }
300
+
301
+ // move anything else that should be moved with the button
302
  //Responsible of the issue https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/188673095/comments
303
  //changed selector
304
  //var selector = button.data('after-selector');
313
  })
314
  }
315
  });
316
+ }
317
+
318
+ jQuery(document).on('click', '.js-wpt-hierarchical-taxonomy-add-new-show-hide', function() {
319
+ if ( jQuery(this).val() == jQuery(this).data('close') ) {
320
+ jQuery(this).val(jQuery(this).data('open')).removeClass('btn-cancel');
321
+ } else {
322
+ jQuery(this).val(jQuery(this).data('close')).addClass('btn-cancel');
323
+ }
324
+ var thiz = jQuery(this), taxonomy = thiz.data( 'taxonomy' );
325
+ self.add_new_show_hide( taxonomy, this );
326
+ });
327
 
 
 
 
 
 
 
328
  self.add_new_show_hide = function ( taxonomy, button ) {
329
  jQuery('.js-wpt-hierarchical-taxonomy-add-new-' + taxonomy).toggle();
330
  self.hide_parent_button_if_no_terms( taxonomy, button );
367
  {
368
  self._add_new_flag=!self._add_new_flag;
369
  //if( self.terms_exist(taxonomy, button) === false ) {
370
+ if( self._add_new_flag === false ) {
371
  jQuery('[name="new_tax_select_' + taxonomy + '"]').hide();
372
  }
373
  else
399
  }
400
  });
401
 
402
+ jQuery('select[name="' + taxonomy + '\[\]"]').find('option').each (function () {
403
  if (new_taxonomy == jQuery(this).text()) {
404
  exists = true;
405
  self._flash_it(jQuery(this));
406
  }
407
  });
408
+
409
  if (exists) {
410
  jQuery('[name="new_tax_text_' + taxonomy + '"]').val('');
411
  return;
415
  add_position = null,
416
  add_before = true,
417
  div_fields_wrap = jQuery('div[data-item_name="taxonomyhierarchical-'+taxonomy+'"]'),
418
+ level = 0;
419
 
420
  if ( build_what === 'checkboxes' ){
421
  //Fix add new leaf
426
  }
427
  });
428
  //#########################################################################################
429
+
430
  var new_checkbox = '<li><input data-parent="' + parent + '" class="wpt-form-checkbox form-checkbox checkbox" type="checkbox" name="' + taxonomy + '[]" checked="checked" value="' + new_taxonomy + '"></input><label>' + new_taxonomy + '</label></li>';
431
  // find the first checkbox sharing parent
432
  var first_checkbox = jQuery('input[name="' + taxonomy + '\[\]"][data-parent="' + parent + '"]:first');
450
  jQuery('[name="new_tax_select_' + taxonomy + '"]').show();
451
  } else if( build_what === 'select' ) {
452
  // Select control
453
+
454
  jQuery('select[name="' + taxonomy + '\[\]"]').show();
455
+
456
  var indent = '';
457
  var first_option = jQuery('select[name="' + taxonomy + '\[\]"]').find('option[data-parent="' + parent + '"]:first');
458
  if (first_option.length == 0) {
482
  }
483
  }
484
  }
485
+
486
  if (add_position) {
487
  var new_option = '<option value="' + new_taxonomy + '" selected>' + indent + new_taxonomy + '</option>';
488
  if (add_before) {
493
  }
494
  jQuery('[name="new_tax_select_' + taxonomy + '"]').show()
495
  }
496
+
497
+
498
+
499
+
500
  self._update_hierachy(taxonomy, new_taxonomy);
501
+
502
  jQuery('[name="new_tax_text_' + taxonomy + '"]').val('');
503
+
504
  self._fill_parent_drop_down();
505
+
506
+
507
  }
508
+
509
  self._update_hierachy = function (taxonomy, new_taxonomy) {
510
  var new_taxonomy_input = jQuery('input[name="' + taxonomy + '_hierarchy"]');
511
  if (!new_taxonomy_input.length) {
513
  jQuery('<input name="' + taxonomy + '_hierarchy" style="display:none" type="hidden">').insertAfter(jQuery('[name="new_tax_text_' + taxonomy + '"]'));
514
  new_taxonomy_input = jQuery('input[name="' + taxonomy + '_hierarchy"]');
515
  }
516
+
517
  var parent = jQuery('[name="new_tax_select_' + taxonomy + '"]').val();
518
  self._new_taxonomy.push(parent + ',' + new_taxonomy);
519
+
520
  var value = '';
521
  for (var i = 0; i < self._new_taxonomy.length; i++) {
522
  value += '{' + self._new_taxonomy[i] + '}';
523
  }
524
  new_taxonomy_input.val(value);
525
+
526
  }
527
+
528
  self._flash_it = function (element) {
529
  element.fadeOut(300).fadeIn(300).fadeOut(300).fadeIn(300);
530
  }
531
+
532
  self.init();
533
+
534
  }
535
 
536
  toolsetForms.cred_tax = new toolsetForms.CRED_taxonomy();
540
  jQuery(function(){
541
  var keyStop = {
542
  8: ":not(input:text, textarea, input:file, input:password)", // stop backspace = back
543
+ 13: "input:text, input:password", // stop enter = submit
544
 
545
  end: null
546
  };
embedded/common/toolset-forms/js/repetitive.js CHANGED
@@ -1,10 +1,10 @@
1
  /*
2
  * Repetitive JS.
3
  *
4
- * $HeadURL: https://www.onthegosystems.com/misc_svn/common/tags/Views-1.6.4-CRED-1.3.2-Types-1.6.4-Acces-1.2.3/toolset-forms/js/repetitive.js $
5
- * $LastChangedDate: 2014-08-06 16:48:27 +0200 (Wed, 06 Aug 2014) $
6
- * $LastChangedRevision: 25705 $
7
- * $LastChangedBy: juan $
8
  *
9
  */
10
  var wptRep = (function($) {
1
  /*
2
  * Repetitive JS.
3
  *
4
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/js/repetitive.js $
5
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
6
+ * $LastChangedRevision: 1027712 $
7
+ * $LastChangedBy: iworks $
8
  *
9
  */
10
  var wptRep = (function($) {
embedded/common/toolset-forms/js/validation.js CHANGED
@@ -7,10 +7,10 @@
7
  *
8
  * @see class WPToolset_Validation
9
  *
10
- * $HeadURL: https://www.onthegosystems.com/misc_svn/common/tags/Views-1.6.4-CRED-1.3.2-Types-1.6.4-Acces-1.2.3/toolset-forms/js/validation.js $
11
- * $LastChangedDate: 2014-09-12 11:57:24 +0200 (Fri, 12 Sep 2014) $
12
- * $LastChangedRevision: 27017 $
13
- * $LastChangedBy: francesco $
14
  *
15
  */
16
  //var wptValidationData = {};
7
  *
8
  * @see class WPToolset_Validation
9
  *
10
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/js/validation.js $
11
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
12
+ * $LastChangedRevision: 1027712 $
13
+ * $LastChangedBy: iworks $
14
  *
15
  */
16
  //var wptValidationData = {};
embedded/common/toolset-forms/lib/CakePHP-Validation.php CHANGED
@@ -29,8 +29,7 @@
29
  * @since CakePHP v 1.2.0.3830
30
  */
31
  //class Validation extends Object {
32
- class WPToolset_Cake_Validation
33
- {
34
 
35
  /**
36
  * Set the value of methods $check param.
@@ -103,7 +102,7 @@ class WPToolset_Cake_Validation
103
  function &getInstance() {
104
  static $instance = array();
105
 
106
- if ( !$instance ) {
107
  $instance[0] = new WPToolset_Cake_Validation();
108
  }
109
  return $instance[0];
@@ -121,16 +120,16 @@ class WPToolset_Cake_Validation
121
  * @return boolean Success
122
  * @access public
123
  */
124
- function notEmpty( $check ) {
125
  $_this = &WPToolset_Cake_Validation::getInstance();
126
  $_this->__reset();
127
  $_this->check = $check;
128
 
129
- if ( is_array( $check ) ) {
130
- $_this->_extract( $check );
131
  }
132
 
133
- if ( empty( $_this->check ) && $_this->check != '0' ) {
134
  return false;
135
  }
136
  $_this->regex = '/[^\s]+/m';
@@ -149,22 +148,22 @@ class WPToolset_Cake_Validation
149
  * @return boolean Success
150
  * @access public
151
  */
152
- function alphaNumeric( $check ) {
153
  $_this = &WPToolset_Cake_Validation::getInstance();
154
  $_this->__reset();
155
  $_this->check = $check;
156
 
157
- if ( is_array( $check ) ) {
158
- $_this->_extract( $check );
159
  }
160
 
161
- if ( empty( $_this->check ) && $_this->check != '0' ) {
162
  return false;
163
  }
164
  $_this->regex = '/^[a-zA-Z0-9]*$/mu';
165
  $return = $_this->_check();
166
 
167
- if ( !$return ) {
168
  $_this->regex = '/^[\p{Ll}\p{Lm}\p{Lo}\p{Lt}\p{Lu}\p{Nd}]+$/mu';
169
  $return = $_this->_check();
170
  }
@@ -172,22 +171,22 @@ class WPToolset_Cake_Validation
172
  return $_this->_check();
173
  }
174
 
175
- function alphaNumericWhitespaces( $check ) {
176
  $_this = &WPToolset_Cake_Validation::getInstance();
177
  $_this->__reset();
178
  $_this->check = $check;
179
 
180
- if ( is_array( $check ) ) {
181
- $_this->_extract( $check );
182
  }
183
 
184
- if ( empty( $_this->check ) && $_this->check != '0' ) {
185
  return false;
186
  }
187
  $_this->regex = '/^[a-zA-Z0-9\s\-\_]*$/mu';
188
  $return = $_this->_check();
189
 
190
- if ( !$return ) {
191
  $_this->regex = '/^[\p{Ll}\p{Lm}\p{Lo}\p{Lt}\p{Lu}\p{Nd}\s\-\_]+$/mu';
192
  $return = $_this->_check();
193
  }
@@ -206,8 +205,8 @@ class WPToolset_Cake_Validation
206
  * @return boolean Success
207
  * @access public
208
  */
209
- function between( $check, $min, $max ) {
210
- $length = strlen( $check );
211
  return ($length >= $min && $length <= $max);
212
  }
213
 
@@ -222,13 +221,13 @@ class WPToolset_Cake_Validation
222
  * @return boolean Success
223
  * @access public
224
  */
225
- function blank( $check ) {
226
  $_this = &WPToolset_Cake_Validation::getInstance();
227
  $_this->__reset();
228
  $_this->check = $check;
229
 
230
- if ( is_array( $check ) ) {
231
- $_this->_extract( $check );
232
  }
233
 
234
  $_this->regex = '/[^\\s]/';
@@ -249,7 +248,7 @@ class WPToolset_Cake_Validation
249
  * @access public
250
  * @see WPToolset_Cake_Validation::_luhn()
251
  */
252
- function cc( $check, $type = 'fast', $deep = false, $regex = null ) {
253
  $_this = &WPToolset_Cake_Validation::getInstance();
254
  $_this->__reset();
255
  $_this->check = $check;
@@ -257,17 +256,17 @@ class WPToolset_Cake_Validation
257
  $_this->deep = $deep;
258
  $_this->regex = $regex;
259
 
260
- if ( is_array( $check ) ) {
261
- $_this->_extract( $check );
262
  }
263
- $_this->check = str_replace( array('-', ' '), '', $_this->check );
264
 
265
- if ( strlen( $_this->check ) < 13 ) {
266
  return false;
267
  }
268
 
269
- if ( !is_null( $_this->regex ) ) {
270
- if ( $_this->_check() ) {
271
  return $_this->_luhn();
272
  }
273
  }
@@ -290,26 +289,26 @@ class WPToolset_Cake_Validation
290
  'fast' => '/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})$/'
291
  );
292
 
293
- if ( is_array( $_this->type ) ) {
294
- foreach ( $_this->type as $value ) {
295
- $_this->regex = $cards['all'][strtolower( $value )];
296
 
297
- if ( $_this->_check() ) {
298
  return $_this->_luhn();
299
  }
300
  }
301
- } elseif ( $_this->type == 'all' ) {
302
- foreach ( $cards['all'] as $value ) {
303
  $_this->regex = $value;
304
 
305
- if ( $_this->_check() ) {
306
  return $_this->_luhn();
307
  }
308
  }
309
  } else {
310
  $_this->regex = $cards['fast'];
311
 
312
- if ( $_this->_check() ) {
313
  return $_this->_luhn();
314
  }
315
  }
@@ -327,54 +326,52 @@ class WPToolset_Cake_Validation
327
  * @return boolean Success
328
  * @access public
329
  */
330
- function comparison( $check1, $operator = null, $check2 = null ) {
331
- if ( is_array( $check1 ) ) {
332
- extract( $check1, EXTR_OVERWRITE );
333
  }
334
- $operator = str_replace( array(' ', "\t", "\n", "\r", "\0", "\x0B"), '',
335
- strtolower( $operator ) );
336
 
337
- switch ( $operator ) {
338
  case 'isgreater':
339
  case '>':
340
- if ( $check1 > $check2 ) {
341
  return true;
342
  }
343
  break;
344
  case 'isless':
345
  case '<':
346
- if ( $check1 < $check2 ) {
347
  return true;
348
  }
349
  break;
350
  case 'greaterorequal':
351
  case '>=':
352
- if ( $check1 >= $check2 ) {
353
  return true;
354
  }
355
  break;
356
  case 'lessorequal':
357
  case '<=':
358
- if ( $check1 <= $check2 ) {
359
  return true;
360
  }
361
  break;
362
  case 'equalto':
363
  case '==':
364
- if ( $check1 == $check2 ) {
365
  return true;
366
  }
367
  break;
368
  case 'notequal':
369
  case '!=':
370
- if ( $check1 != $check2 ) {
371
  return true;
372
  }
373
  break;
374
  default:
375
  $_this = &WPToolset_Cake_Validation::getInstance();
376
- $_this->errors[] = __( 'You must define the $operator parameter for WPToolset_Cake_Validation::comparison()',
377
- 'wpcf' );
378
  break;
379
  }
380
  return false;
@@ -389,17 +386,16 @@ class WPToolset_Cake_Validation
389
  * @return boolean Success
390
  * @access public
391
  */
392
- function custom( $check, $regex = null ) {
393
  $_this = &WPToolset_Cake_Validation::getInstance();
394
  $_this->__reset();
395
  $_this->check = $check;
396
  $_this->regex = $regex;
397
- if ( is_array( $check ) ) {
398
- $_this->_extract( $check );
399
  }
400
- if ( $_this->regex === null ) {
401
- $_this->errors[] = __( 'You must define a regular expression for WPToolset_Cake_Validation::custom()',
402
- 'wpcf' );
403
  return false;
404
  }
405
  return $_this->_check();
@@ -422,13 +418,13 @@ class WPToolset_Cake_Validation
422
  * @return boolean Success
423
  * @access public
424
  */
425
- function date( $check, $format = 'ymd', $regex = null ) {
426
-
427
- if ( is_numeric( $check ) ) {
428
- return WPToolset_Field_Date_Scripts::_isTimestampInRange($check);
429
- }
430
- // TODO Change to use date strtotime
431
- $valid = wptoolset_strtotime( $check );
432
  return $valid !== false;
433
 
434
  $cake_date_formats = array('F j, Y' => 'Mdy',
@@ -443,7 +439,7 @@ class WPToolset_Cake_Validation
443
  $_this->check = $check;
444
  $_this->regex = $regex;
445
 
446
- if ( !is_null( $_this->regex ) ) {
447
  return $_this->_check();
448
  }
449
 
@@ -455,11 +451,11 @@ class WPToolset_Cake_Validation
455
  $regex['My'] = '%^(Jan(uary)?|Feb(ruary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sep(?=\\b|t)t?|Nov|Dec)(ember)?)[ /]((1[6-9]|[2-9]\\d)\\d{2})$%';
456
  $regex['my'] = '%^(((0[123456789]|10|11|12)([- /.])(([1][9][0-9][0-9])|([2][0-9][0-9][0-9]))))$%';
457
 
458
- $format = (is_array( $format )) ? array_values( $format ) : array($format);
459
- foreach ( $format as $key ) {
460
  $_this->regex = $regex[$key];
461
 
462
- if ( $_this->_check() === true ) {
463
  return true;
464
  }
465
  }
@@ -475,7 +471,7 @@ class WPToolset_Cake_Validation
475
  * @return boolean Success
476
  * @access public
477
  */
478
- function time( $check ) {
479
  $_this = &WPToolset_Cake_Validation::getInstance();
480
  $_this->__reset();
481
  $_this->check = $check;
@@ -490,9 +486,9 @@ class WPToolset_Cake_Validation
490
  * @return boolean Success
491
  * @access public
492
  */
493
- function boolean( $check ) {
494
  $booleanList = array(0, 1, '0', '1', true, false);
495
- return in_array( $check, $booleanList, true );
496
  }
497
 
498
  /**
@@ -505,14 +501,14 @@ class WPToolset_Cake_Validation
505
  * @return boolean Success
506
  * @access public
507
  */
508
- function decimal( $check, $places = null, $regex = null ) {
509
  $_this = &WPToolset_Cake_Validation::getInstance();
510
  $_this->__reset();
511
  $_this->regex = $regex;
512
  $_this->check = $check;
513
 
514
- if ( is_null( $_this->regex ) ) {
515
- if ( is_null( $places ) ) {
516
  $_this->regex = '/^[-+]?[0-9]*\\.{1}[0-9]+(?:[eE][-+]?[0-9]+)?$/';
517
  } else {
518
  $_this->regex = '/^[-+]?[0-9]*\\.{1}[0-9]{' . $places . '}$/';
@@ -530,35 +526,34 @@ class WPToolset_Cake_Validation
530
  * @return boolean Success
531
  * @access public
532
  */
533
- function email( $check, $deep = false, $regex = null ) {
534
  $_this = &WPToolset_Cake_Validation::getInstance();
535
  $_this->__reset();
536
  $_this->check = $check;
537
  $_this->regex = $regex;
538
  $_this->deep = $deep;
539
 
540
- if ( is_array( $check ) ) {
541
- $_this->_extract( $check );
542
  }
543
 
544
- if ( is_null( $_this->regex ) ) {
545
  $_this->regex = '/^[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+)*@' . $_this->__pattern['hostname'] . '$/i';
546
  }
547
  $return = $_this->_check();
548
 
549
- if ( $_this->deep === false || $_this->deep === null ) {
550
  return $return;
551
  }
552
 
553
- if ( $return === true && preg_match( '/@(' . $_this->__pattern['hostname'] . ')$/i',
554
- $_this->check, $regs ) ) {
555
- if ( function_exists( 'getmxrr' ) && getmxrr( $regs[1], $mxhosts ) ) {
556
  return true;
557
  }
558
- if ( function_exists( 'checkdnsrr' ) && checkdnsrr( $regs[1], 'MX' ) ) {
559
  return true;
560
  }
561
- return is_array( gethostbynamel( $regs[1] ) );
562
  }
563
  return false;
564
  }
@@ -571,7 +566,7 @@ class WPToolset_Cake_Validation
571
  * @return boolean Success
572
  * @access public
573
  */
574
- function equalTo( $check, $comparedTo ) {
575
  return ($check === $comparedTo);
576
  }
577
 
@@ -583,17 +578,21 @@ class WPToolset_Cake_Validation
583
  * @return boolean Success
584
  * @access public
585
  */
586
- function extension( $check, $extensions = array('gif', 'jpeg', 'png', 'jpg') ) {
587
  //https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/188215131/comments
588
- if (!isset($check)||empty($check)) return false;
 
589
  //##########################################################################################
590
- if ( is_array( $check ) ) {
591
- return WPToolset_Cake_Validation::extension( array_shift( $check ),
592
- $extensions );
593
- }
594
- $extension = strtolower( array_pop( explode( '.', $check ) ) );
595
- foreach ( $extensions as $value ) {
596
- if ( $extension == strtolower( $value ) ) {
 
 
 
597
  return true;
598
  }
599
  }
@@ -613,15 +612,15 @@ class WPToolset_Cake_Validation
613
  * @return boolean Success
614
  * @access public
615
  */
616
- function ip( $check, $type = 'both' ) {
617
  $_this = &WPToolset_Cake_Validation::getInstance();
618
  $success = false;
619
- $type = strtolower( $type );
620
- if ( $type === 'ipv4' || $type === 'both' ) {
621
- $success |= $_this->_ipv4( $check );
622
  }
623
- if ( $type === 'ipv6' || $type === 'both' ) {
624
- $success |= $_this->_ipv6( $check );
625
  }
626
  return $success;
627
  }
@@ -633,10 +632,9 @@ class WPToolset_Cake_Validation
633
  * @return boolean Success
634
  * @access protected
635
  */
636
- function _ipv4( $check ) {
637
- if ( function_exists( 'filter_var' ) ) {
638
- return filter_var( $check, FILTER_VALIDATE_IP,
639
- array('flags' => FILTER_FLAG_IPV4) ) !== false;
640
  }
641
  $this->__populateIp();
642
  $this->check = $check;
@@ -651,10 +649,9 @@ class WPToolset_Cake_Validation
651
  * @return boolean Success
652
  * @access protected
653
  */
654
- function _ipv6( $check ) {
655
- if ( function_exists( 'filter_var' ) ) {
656
- return filter_var( $check, FILTER_VALIDATE_IP,
657
- array('flags' => FILTER_FLAG_IPV6) ) !== false;
658
  }
659
  $this->__populateIp();
660
  $this->check = $check;
@@ -670,8 +667,8 @@ class WPToolset_Cake_Validation
670
  * @return boolean Success
671
  * @access public
672
  */
673
- function minLength( $check, $min ) {
674
- $length = strlen( $check );
675
  return ($length >= $min);
676
  }
677
 
@@ -683,8 +680,8 @@ class WPToolset_Cake_Validation
683
  * @return boolean Success
684
  * @access public
685
  */
686
- function maxLength( $check, $max ) {
687
- $length = strlen( $check );
688
  return ($length <= $max);
689
  }
690
 
@@ -696,11 +693,11 @@ class WPToolset_Cake_Validation
696
  * @return boolean Success
697
  * @access public
698
  */
699
- function money( $check, $symbolPosition = 'left' ) {
700
  $_this = &WPToolset_Cake_Validation::getInstance();
701
  $_this->check = $check;
702
 
703
- if ( $symbolPosition == 'right' ) {
704
  $_this->regex = '/^(?!0,?\d)(?:\d{1,3}(?:([, .])\d{3})?(?:\1\d{3})*|(?:\d+))((?!\1)[,.]\d{2})?(?<!\x{00a2})\p{Sc}?$/u';
705
  } else {
706
  $_this->regex = '/^(?!\x{00a2})\p{Sc}?(?!0,?\d)(?:\d{1,3}(?:([, .])\d{3})?(?:\1\d{3})*|(?:\d+))((?!\1)[,.]\d{2})?$/u';
@@ -722,22 +719,22 @@ class WPToolset_Cake_Validation
722
  * @return boolean Success
723
  * @access public
724
  */
725
- function multiple( $check, $options = array() ) {
726
  $defaults = array('in' => null, 'max' => null, 'min' => null);
727
- $options = array_merge( $defaults, $options );
728
- $check = array_filter( (array) $check );
729
- if ( empty( $check ) ) {
730
  return false;
731
  }
732
- if ( $options['max'] && count( $check ) > $options['max'] ) {
733
  return false;
734
  }
735
- if ( $options['min'] && count( $check ) < $options['min'] ) {
736
  return false;
737
  }
738
- if ( $options['in'] && is_array( $options['in'] ) ) {
739
- foreach ( $check as $val ) {
740
- if ( !in_array( $val, $options['in'] ) ) {
741
  return false;
742
  }
743
  }
@@ -752,8 +749,19 @@ class WPToolset_Cake_Validation
752
  * @return boolean Succcess
753
  * @access public
754
  */
755
- function numeric( $check ) {
756
- return is_numeric( $check );
 
 
 
 
 
 
 
 
 
 
 
757
  }
758
 
759
  /**
@@ -765,17 +773,17 @@ class WPToolset_Cake_Validation
765
  * @return boolean Success
766
  * @access public
767
  */
768
- function phone( $check, $regex = null, $country = 'all' ) {
769
  $_this = &WPToolset_Cake_Validation::getInstance();
770
  $_this->check = $check;
771
  $_this->regex = $regex;
772
  $_this->country = $country;
773
- if ( is_array( $check ) ) {
774
- $_this->_extract( $check );
775
  }
776
 
777
- if ( is_null( $_this->regex ) ) {
778
- switch ( $_this->country ) {
779
  case 'us':
780
  case 'all':
781
  case 'can':
@@ -784,8 +792,8 @@ class WPToolset_Cake_Validation
784
  break;
785
  }
786
  }
787
- if ( empty( $_this->regex ) ) {
788
- return $_this->_pass( 'phone', $check, $country );
789
  }
790
  return $_this->_check();
791
  }
@@ -799,20 +807,20 @@ class WPToolset_Cake_Validation
799
  * @return boolean Success
800
  * @access public
801
  */
802
- function postal( $check, $regex = null, $country = null ) {
803
  $_this = &WPToolset_Cake_Validation::getInstance();
804
  $_this->check = $check;
805
  $_this->regex = $regex;
806
  $_this->country = $country;
807
- if ( is_array( $check ) ) {
808
- $_this->_extract( $check );
809
  }
810
- if ( empty( $country ) ) {
811
  $_this->country = 'us';
812
  }
813
 
814
- if ( is_null( $_this->regex ) ) {
815
- switch ( $_this->country ) {
816
  case 'uk':
817
  $_this->regex = '/\\A\\b[A-Z]{1,2}[0-9][A-Z0-9]? [0-9][ABD-HJLNP-UW-Z]{2}\\b\\z/i';
818
  break;
@@ -831,8 +839,8 @@ class WPToolset_Cake_Validation
831
  break;
832
  }
833
  }
834
- if ( empty( $_this->regex ) ) {
835
- return $_this->_pass( 'postal', $check, $country );
836
  }
837
  return $_this->_check();
838
  }
@@ -848,14 +856,14 @@ class WPToolset_Cake_Validation
848
  * @return boolean Success
849
  * @access public
850
  */
851
- function range( $check, $lower = null, $upper = null ) {
852
- if ( !is_numeric( $check ) ) {
853
  return false;
854
  }
855
- if ( isset( $lower ) && isset( $upper ) ) {
856
  return ($check > $lower && $check < $upper);
857
  }
858
- return is_finite( $check );
859
  }
860
 
861
  /**
@@ -867,17 +875,17 @@ class WPToolset_Cake_Validation
867
  * @return boolean Success
868
  * @access public
869
  */
870
- function ssn( $check, $regex = null, $country = null ) {
871
  $_this = &WPToolset_Cake_Validation::getInstance();
872
  $_this->check = $check;
873
  $_this->regex = $regex;
874
  $_this->country = $country;
875
- if ( is_array( $check ) ) {
876
- $_this->_extract( $check );
877
  }
878
 
879
- if ( is_null( $_this->regex ) ) {
880
- switch ( $_this->country ) {
881
  case 'dk':
882
  $_this->regex = '/\\A\\b[0-9]{6}-[0-9]{4}\\b\\z/i';
883
  break;
@@ -889,8 +897,8 @@ class WPToolset_Cake_Validation
889
  break;
890
  }
891
  }
892
- if ( empty( $_this->regex ) ) {
893
- return $_this->_pass( 'ssn', $check, $country );
894
  }
895
  return $_this->_check();
896
  }
@@ -902,7 +910,7 @@ class WPToolset_Cake_Validation
902
  * @return boolean Success
903
  * @access public
904
  */
905
- function uuid( $check ) {
906
  $_this = &WPToolset_Cake_Validation::getInstance();
907
  $_this->check = $check;
908
  $_this->regex = '/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i';
@@ -927,12 +935,12 @@ class WPToolset_Cake_Validation
927
  * @return boolean Success
928
  * @access public
929
  */
930
- function url( $check, $strict = false ) {
931
  $_this = &WPToolset_Cake_Validation::getInstance();
932
  $_this->__populateIp();
933
  $_this->check = $check;
934
- $validChars = '([' . preg_quote( '!"$&\'()*+,-.@_:;=~[]' ) . '\/0-9a-z\p{L}\p{N}]|(%[0-9a-f]{2}))';
935
- $_this->regex = '/^(?:(?:https?|ftps?|file|news|gopher):\/\/)' . (!empty( $strict ) ? '' : '?') .
936
  '(?:' . $_this->__pattern['IPv4'] . '|\[' . $_this->__pattern['IPv6'] . '\]|' . $_this->__pattern['hostname'] . ')' .
937
  '(?::[1-9][0-9]{0,4})?' .
938
  '(?:\/?|\/' . $validChars . '*)?' .
@@ -949,8 +957,8 @@ class WPToolset_Cake_Validation
949
  * @return boolean Succcess
950
  * @access public
951
  */
952
- function inList( $check, $list ) {
953
- return in_array( $check, $list );
954
  }
955
 
956
  /**
@@ -963,17 +971,16 @@ class WPToolset_Cake_Validation
963
  * @return mixed user-defined class class method returns
964
  * @access public
965
  */
966
- function userDefined( $check, $object, $method, $args = null ) {
967
- return call_user_func_array( array(&$object, $method),
968
- array($check, $args) );
969
  }
970
 
971
- function noSpecialChars( $check ) {
972
- return preg_match( '#[^a-zA-Z0-9\s\_\-]#', $check ) ? false : true;
973
  }
974
 
975
- function rewriteSlug( $check ) {
976
- return preg_match( '#[^a-zA-Z0-9\s\_\-\%]#', $check ) ? false : true;
977
  }
978
 
979
  /**
@@ -987,21 +994,18 @@ class WPToolset_Cake_Validation
987
  * @return mixed Return of Passed method, false on failure
988
  * @access protected
989
  * */
990
- function _pass( $method, $check, $classPrefix ) {
991
- $className = ucwords( $classPrefix ) . 'Validation';
992
- if ( !class_exists( $className ) ) {
993
- trigger_error( sprintf( __( 'Could not find %s class, unable to complete validation.',
994
- true ), $className ), E_USER_WARNING );
995
  return false;
996
  }
997
- if ( !is_callable( array($className, $method) ) ) {
998
- trigger_error( sprintf( __( 'Method %s does not exist on %s unable to complete validation.',
999
- true ), $method, $className ),
1000
- E_USER_WARNING );
1001
  return false;
1002
  }
1003
  $check = (array) $check;
1004
- return call_user_func_array( array($className, $method), $check );
1005
  }
1006
 
1007
  /**
@@ -1012,7 +1016,7 @@ class WPToolset_Cake_Validation
1012
  */
1013
  function _check() {
1014
  $_this = &WPToolset_Cake_Validation::getInstance();
1015
- if ( preg_match( $_this->regex, $_this->check ) ) {
1016
  $_this->error[] = false;
1017
  return true;
1018
  } else {
@@ -1029,23 +1033,23 @@ class WPToolset_Cake_Validation
1029
  * @return void
1030
  * @access protected
1031
  */
1032
- function _extract( $params ) {
1033
  $_this = &WPToolset_Cake_Validation::getInstance();
1034
- extract( $params, EXTR_OVERWRITE );
1035
 
1036
- if ( isset( $check ) ) {
1037
  $_this->check = $check;
1038
  }
1039
- if ( isset( $regex ) ) {
1040
  $_this->regex = $regex;
1041
  }
1042
- if ( isset( $country ) ) {
1043
- $_this->country = strtolower( $country );
1044
  }
1045
- if ( isset( $deep ) ) {
1046
  $_this->deep = $deep;
1047
  }
1048
- if ( isset( $type ) ) {
1049
  $_this->type = $type;
1050
  }
1051
  }
@@ -1059,20 +1063,20 @@ class WPToolset_Cake_Validation
1059
  */
1060
  function _luhn() {
1061
  $_this = &WPToolset_Cake_Validation::getInstance();
1062
- if ( $_this->deep !== true ) {
1063
  return true;
1064
  }
1065
- if ( $_this->check == 0 ) {
1066
  return false;
1067
  }
1068
  $sum = 0;
1069
- $length = strlen( $_this->check );
1070
 
1071
- for ( $position = 1 - ($length % 2); $position < $length; $position += 2 ) {
1072
  $sum += $_this->check[$position];
1073
  }
1074
 
1075
- for ( $position = ($length % 2); $position < $length; $position += 2 ) {
1076
  $number = $_this->check[$position] * 2;
1077
  $sum += ($number < 10) ? $number : $number - 9;
1078
  }
@@ -1088,7 +1092,7 @@ class WPToolset_Cake_Validation
1088
  */
1089
 
1090
  function __populateIp() {
1091
- if ( !isset( $this->__pattern['IPv6'] ) ) {
1092
  $pattern = '((([0-9A-Fa-f]{1,4}:){7}(([0-9A-Fa-f]{1,4})|:))|(([0-9A-Fa-f]{1,4}:){6}';
1093
  $pattern .= '(:|((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})';
1094
  $pattern .= '|(:[0-9A-Fa-f]{1,4})))|(([0-9A-Fa-f]{1,4}:){5}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})';
@@ -1106,7 +1110,7 @@ class WPToolset_Cake_Validation
1106
 
1107
  $this->__pattern['IPv6'] = $pattern;
1108
  }
1109
- if ( !isset( $this->__pattern['IPv4'] ) ) {
1110
  $pattern = '(?:(?:25[0-5]|2[0-4][0-9]|(?:(?:1[0-9])?|[1-9]?)[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|(?:(?:1[0-9])?|[1-9]?)[0-9])';
1111
  $this->__pattern['IPv4'] = $pattern;
1112
  }
@@ -1127,10 +1131,9 @@ class WPToolset_Cake_Validation
1127
  $this->error = array();
1128
  $this->errors = array();
1129
  }
1130
-
1131
- public static function required( $value )
1132
- {
1133
- return !( is_null( $value ) || $value === false || $value === '' );
1134
  }
1135
 
1136
  }
29
  * @since CakePHP v 1.2.0.3830
30
  */
31
  //class Validation extends Object {
32
+ class WPToolset_Cake_Validation {
 
33
 
34
  /**
35
  * Set the value of methods $check param.
102
  function &getInstance() {
103
  static $instance = array();
104
 
105
+ if (!$instance) {
106
  $instance[0] = new WPToolset_Cake_Validation();
107
  }
108
  return $instance[0];
120
  * @return boolean Success
121
  * @access public
122
  */
123
+ function notEmpty($check) {
124
  $_this = &WPToolset_Cake_Validation::getInstance();
125
  $_this->__reset();
126
  $_this->check = $check;
127
 
128
+ if (is_array($check)) {
129
+ $_this->_extract($check);
130
  }
131
 
132
+ if (empty($_this->check) && $_this->check != '0') {
133
  return false;
134
  }
135
  $_this->regex = '/[^\s]+/m';
148
  * @return boolean Success
149
  * @access public
150
  */
151
+ function alphaNumeric($check) {
152
  $_this = &WPToolset_Cake_Validation::getInstance();
153
  $_this->__reset();
154
  $_this->check = $check;
155
 
156
+ if (is_array($check)) {
157
+ $_this->_extract($check);
158
  }
159
 
160
+ if (empty($_this->check) && $_this->check != '0') {
161
  return false;
162
  }
163
  $_this->regex = '/^[a-zA-Z0-9]*$/mu';
164
  $return = $_this->_check();
165
 
166
+ if (!$return) {
167
  $_this->regex = '/^[\p{Ll}\p{Lm}\p{Lo}\p{Lt}\p{Lu}\p{Nd}]+$/mu';
168
  $return = $_this->_check();
169
  }
171
  return $_this->_check();
172
  }
173
 
174
+ function alphaNumericWhitespaces($check) {
175
  $_this = &WPToolset_Cake_Validation::getInstance();
176
  $_this->__reset();
177
  $_this->check = $check;
178
 
179
+ if (is_array($check)) {
180
+ $_this->_extract($check);
181
  }
182
 
183
+ if (empty($_this->check) && $_this->check != '0') {
184
  return false;
185
  }
186
  $_this->regex = '/^[a-zA-Z0-9\s\-\_]*$/mu';
187
  $return = $_this->_check();
188
 
189
+ if (!$return) {
190
  $_this->regex = '/^[\p{Ll}\p{Lm}\p{Lo}\p{Lt}\p{Lu}\p{Nd}\s\-\_]+$/mu';
191
  $return = $_this->_check();
192
  }
205
  * @return boolean Success
206
  * @access public
207
  */
208
+ function between($check, $min, $max) {
209
+ $length = strlen($check);
210
  return ($length >= $min && $length <= $max);
211
  }
212
 
221
  * @return boolean Success
222
  * @access public
223
  */
224
+ function blank($check) {
225
  $_this = &WPToolset_Cake_Validation::getInstance();
226
  $_this->__reset();
227
  $_this->check = $check;
228
 
229
+ if (is_array($check)) {
230
+ $_this->_extract($check);
231
  }
232
 
233
  $_this->regex = '/[^\\s]/';
248
  * @access public
249
  * @see WPToolset_Cake_Validation::_luhn()
250
  */
251
+ function cc($check, $type = 'fast', $deep = false, $regex = null) {
252
  $_this = &WPToolset_Cake_Validation::getInstance();
253
  $_this->__reset();
254
  $_this->check = $check;
256
  $_this->deep = $deep;
257
  $_this->regex = $regex;
258
 
259
+ if (is_array($check)) {
260
+ $_this->_extract($check);
261
  }
262
+ $_this->check = str_replace(array('-', ' '), '', $_this->check);
263
 
264
+ if (strlen($_this->check) < 13) {
265
  return false;
266
  }
267
 
268
+ if (!is_null($_this->regex)) {
269
+ if ($_this->_check()) {
270
  return $_this->_luhn();
271
  }
272
  }
289
  'fast' => '/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})$/'
290
  );
291
 
292
+ if (is_array($_this->type)) {
293
+ foreach ($_this->type as $value) {
294
+ $_this->regex = $cards['all'][strtolower($value)];
295
 
296
+ if ($_this->_check()) {
297
  return $_this->_luhn();
298
  }
299
  }
300
+ } elseif ($_this->type == 'all') {
301
+ foreach ($cards['all'] as $value) {
302
  $_this->regex = $value;
303
 
304
+ if ($_this->_check()) {
305
  return $_this->_luhn();
306
  }
307
  }
308
  } else {
309
  $_this->regex = $cards['fast'];
310
 
311
+ if ($_this->_check()) {
312
  return $_this->_luhn();
313
  }
314
  }
326
  * @return boolean Success
327
  * @access public
328
  */
329
+ function comparison($check1, $operator = null, $check2 = null) {
330
+ if (is_array($check1)) {
331
+ extract($check1, EXTR_OVERWRITE);
332
  }
333
+ $operator = str_replace(array(' ', "\t", "\n", "\r", "\0", "\x0B"), '', strtolower($operator));
 
334
 
335
+ switch ($operator) {
336
  case 'isgreater':
337
  case '>':
338
+ if ($check1 > $check2) {
339
  return true;
340
  }
341
  break;
342
  case 'isless':
343
  case '<':
344
+ if ($check1 < $check2) {
345
  return true;
346
  }
347
  break;
348
  case 'greaterorequal':
349
  case '>=':
350
+ if ($check1 >= $check2) {
351
  return true;
352
  }
353
  break;
354
  case 'lessorequal':
355
  case '<=':
356
+ if ($check1 <= $check2) {
357
  return true;
358
  }
359
  break;
360
  case 'equalto':
361
  case '==':
362
+ if ($check1 == $check2) {
363
  return true;
364
  }
365
  break;
366
  case 'notequal':
367
  case '!=':
368
+ if ($check1 != $check2) {
369
  return true;
370
  }
371
  break;
372
  default:
373
  $_this = &WPToolset_Cake_Validation::getInstance();
374
+ $_this->errors[] = __('You must define the $operator parameter for WPToolset_Cake_Validation::comparison()', 'wpcf');
 
375
  break;
376
  }
377
  return false;
386
  * @return boolean Success
387
  * @access public
388
  */
389
+ function custom($check, $regex = null) {
390
  $_this = &WPToolset_Cake_Validation::getInstance();
391
  $_this->__reset();
392
  $_this->check = $check;
393
  $_this->regex = $regex;
394
+ if (is_array($check)) {
395
+ $_this->_extract($check);
396
  }
397
+ if ($_this->regex === null) {
398
+ $_this->errors[] = __('You must define a regular expression for WPToolset_Cake_Validation::custom()', 'wpcf');
 
399
  return false;
400
  }
401
  return $_this->_check();
418
  * @return boolean Success
419
  * @access public
420
  */
421
+ function date($check, $format = 'ymd', $regex = null) {
422
+
423
+ if (is_numeric($check)) {
424
+ return WPToolset_Field_Date_Scripts::_isTimestampInRange($check);
425
+ }
426
+ // TODO Change to use date strtotime
427
+ $valid = wptoolset_strtotime($check);
428
  return $valid !== false;
429
 
430
  $cake_date_formats = array('F j, Y' => 'Mdy',
439
  $_this->check = $check;
440
  $_this->regex = $regex;
441
 
442
+ if (!is_null($_this->regex)) {
443
  return $_this->_check();
444
  }
445
 
451
  $regex['My'] = '%^(Jan(uary)?|Feb(ruary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sep(?=\\b|t)t?|Nov|Dec)(ember)?)[ /]((1[6-9]|[2-9]\\d)\\d{2})$%';
452
  $regex['my'] = '%^(((0[123456789]|10|11|12)([- /.])(([1][9][0-9][0-9])|([2][0-9][0-9][0-9]))))$%';
453
 
454
+ $format = (is_array($format)) ? array_values($format) : array($format);
455
+ foreach ($format as $key) {
456
  $_this->regex = $regex[$key];
457
 
458
+ if ($_this->_check() === true) {
459
  return true;
460
  }
461
  }
471
  * @return boolean Success
472
  * @access public
473
  */
474
+ function time($check) {
475
  $_this = &WPToolset_Cake_Validation::getInstance();
476
  $_this->__reset();
477
  $_this->check = $check;
486
  * @return boolean Success
487
  * @access public
488
  */
489
+ function boolean($check) {
490
  $booleanList = array(0, 1, '0', '1', true, false);
491
+ return in_array($check, $booleanList, true);
492
  }
493
 
494
  /**
501
  * @return boolean Success
502
  * @access public
503
  */
504
+ function decimal($check, $places = null, $regex = null) {
505
  $_this = &WPToolset_Cake_Validation::getInstance();
506
  $_this->__reset();
507
  $_this->regex = $regex;
508
  $_this->check = $check;
509
 
510
+ if (is_null($_this->regex)) {
511
+ if (is_null($places)) {
512
  $_this->regex = '/^[-+]?[0-9]*\\.{1}[0-9]+(?:[eE][-+]?[0-9]+)?$/';
513
  } else {
514
  $_this->regex = '/^[-+]?[0-9]*\\.{1}[0-9]{' . $places . '}$/';
526
  * @return boolean Success
527
  * @access public
528
  */
529
+ function email($check, $deep = false, $regex = null) {
530
  $_this = &WPToolset_Cake_Validation::getInstance();
531
  $_this->__reset();
532
  $_this->check = $check;
533
  $_this->regex = $regex;
534
  $_this->deep = $deep;
535
 
536
+ if (is_array($check)) {
537
+ $_this->_extract($check);
538
  }
539
 
540
+ if (is_null($_this->regex)) {
541
  $_this->regex = '/^[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+)*@' . $_this->__pattern['hostname'] . '$/i';
542
  }
543
  $return = $_this->_check();
544
 
545
+ if ($_this->deep === false || $_this->deep === null) {
546
  return $return;
547
  }
548
 
549
+ if ($return === true && preg_match('/@(' . $_this->__pattern['hostname'] . ')$/i', $_this->check, $regs)) {
550
+ if (function_exists('getmxrr') && getmxrr($regs[1], $mxhosts)) {
 
551
  return true;
552
  }
553
+ if (function_exists('checkdnsrr') && checkdnsrr($regs[1], 'MX')) {
554
  return true;
555
  }
556
+ return is_array(gethostbynamel($regs[1]));
557
  }
558
  return false;
559
  }
566
  * @return boolean Success
567
  * @access public
568
  */
569
+ function equalTo($check, $comparedTo) {
570
  return ($check === $comparedTo);
571
  }
572
 
578
  * @return boolean Success
579
  * @access public
580
  */
581
+ function extension($check, $extensions = array('gif', 'jpeg', 'png', 'jpg')) {
582
  //https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/188215131/comments
583
+ if (!isset($check) || empty($check))
584
+ return false;
585
  //##########################################################################################
586
+ if (is_array($check)) {
587
+ return WPToolset_Cake_Validation::extension(array_shift($check), $extensions);
588
+ }
589
+ if (!is_array($extensions)) {
590
+ $extensions = explode('|', $extensions);
591
+ }
592
+ $check = strtolower($check);
593
+ $extension = pathinfo($check, PATHINFO_EXTENSION);
594
+ foreach ($extensions as $value) {
595
+ if ($extension == strtolower($value)) {
596
  return true;
597
  }
598
  }
612
  * @return boolean Success
613
  * @access public
614
  */
615
+ function ip($check, $type = 'both') {
616
  $_this = &WPToolset_Cake_Validation::getInstance();
617
  $success = false;
618
+ $type = strtolower($type);
619
+ if ($type === 'ipv4' || $type === 'both') {
620
+ $success |= $_this->_ipv4($check);
621
  }
622
+ if ($type === 'ipv6' || $type === 'both') {
623
+ $success |= $_this->_ipv6($check);
624
  }
625
  return $success;
626
  }
632
  * @return boolean Success
633
  * @access protected
634
  */
635
+ function _ipv4($check) {
636
+ if (function_exists('filter_var')) {
637
+ return filter_var($check, FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV4)) !== false;
 
638
  }
639
  $this->__populateIp();
640
  $this->check = $check;
649
  * @return boolean Success
650
  * @access protected
651
  */
652
+ function _ipv6($check) {
653
+ if (function_exists('filter_var')) {
654
+ return filter_var($check, FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV6)) !== false;
 
655
  }
656
  $this->__populateIp();
657
  $this->check = $check;
667
  * @return boolean Success
668
  * @access public
669
  */
670
+ function minLength($check, $min) {
671
+ $length = strlen($check);
672
  return ($length >= $min);
673
  }
674
 
680
  * @return boolean Success
681
  * @access public
682
  */
683
+ function maxLength($check, $max) {
684
+ $length = strlen($check);
685
  return ($length <= $max);
686
  }
687
 
693
  * @return boolean Success
694
  * @access public
695
  */
696
+ function money($check, $symbolPosition = 'left') {
697
  $_this = &WPToolset_Cake_Validation::getInstance();
698
  $_this->check = $check;
699
 
700
+ if ($symbolPosition == 'right') {
701
  $_this->regex = '/^(?!0,?\d)(?:\d{1,3}(?:([, .])\d{3})?(?:\1\d{3})*|(?:\d+))((?!\1)[,.]\d{2})?(?<!\x{00a2})\p{Sc}?$/u';
702
  } else {
703
  $_this->regex = '/^(?!\x{00a2})\p{Sc}?(?!0,?\d)(?:\d{1,3}(?:([, .])\d{3})?(?:\1\d{3})*|(?:\d+))((?!\1)[,.]\d{2})?$/u';
719
  * @return boolean Success
720
  * @access public
721
  */
722
+ function multiple($check, $options = array()) {
723
  $defaults = array('in' => null, 'max' => null, 'min' => null);
724
+ $options = array_merge($defaults, $options);
725
+ $check = array_filter((array) $check);
726
+ if (empty($check)) {
727
  return false;
728
  }
729
+ if ($options['max'] && count($check) > $options['max']) {
730
  return false;
731
  }
732
+ if ($options['min'] && count($check) < $options['min']) {
733
  return false;
734
  }
735
+ if ($options['in'] && is_array($options['in'])) {
736
+ foreach ($check as $val) {
737
+ if (!in_array($val, $options['in'])) {
738
  return false;
739
  }
740
  }
749
  * @return boolean Succcess
750
  * @access public
751
  */
752
+ function numeric($check) {
753
+ return is_numeric($check);
754
+ }
755
+
756
+ /**
757
+ * Checks if a value is integer.
758
+ *
759
+ * @param string $check Value to check
760
+ * @return boolean Succcess
761
+ * @access public
762
+ */
763
+ function integer($check) {
764
+ return is_int(intval($check));
765
  }
766
 
767
  /**
773
  * @return boolean Success
774
  * @access public
775
  */
776
+ function phone($check, $regex = null, $country = 'all') {
777
  $_this = &WPToolset_Cake_Validation::getInstance();
778
  $_this->check = $check;
779
  $_this->regex = $regex;
780
  $_this->country = $country;
781
+ if (is_array($check)) {
782
+ $_this->_extract($check);
783
  }
784
 
785
+ if (is_null($_this->regex)) {
786
+ switch ($_this->country) {
787
  case 'us':
788
  case 'all':
789
  case 'can':
792
  break;
793
  }
794
  }
795
+ if (empty($_this->regex)) {
796
+ return $_this->_pass('phone', $check, $country);
797
  }
798
  return $_this->_check();
799
  }
807
  * @return boolean Success
808
  * @access public
809
  */
810
+ function postal($check, $regex = null, $country = null) {
811
  $_this = &WPToolset_Cake_Validation::getInstance();
812
  $_this->check = $check;
813
  $_this->regex = $regex;
814
  $_this->country = $country;
815
+ if (is_array($check)) {
816
+ $_this->_extract($check);
817
  }
818
+ if (empty($country)) {
819
  $_this->country = 'us';
820
  }
821
 
822
+ if (is_null($_this->regex)) {
823
+ switch ($_this->country) {
824
  case 'uk':
825
  $_this->regex = '/\\A\\b[A-Z]{1,2}[0-9][A-Z0-9]? [0-9][ABD-HJLNP-UW-Z]{2}\\b\\z/i';
826
  break;
839
  break;
840
  }
841
  }
842
+ if (empty($_this->regex)) {
843
+ return $_this->_pass('postal', $check, $country);
844
  }
845
  return $_this->_check();
846
  }
856
  * @return boolean Success
857
  * @access public
858
  */
859
+ function range($check, $lower = null, $upper = null) {
860
+ if (!is_numeric($check)) {
861
  return false;
862
  }
863
+ if (isset($lower) && isset($upper)) {
864
  return ($check > $lower && $check < $upper);
865
  }
866
+ return is_finite($check);
867
  }
868
 
869
  /**
875
  * @return boolean Success
876
  * @access public
877
  */
878
+ function ssn($check, $regex = null, $country = null) {
879
  $_this = &WPToolset_Cake_Validation::getInstance();
880
  $_this->check = $check;
881
  $_this->regex = $regex;
882
  $_this->country = $country;
883
+ if (is_array($check)) {
884
+ $_this->_extract($check);
885
  }
886
 
887
+ if (is_null($_this->regex)) {
888
+ switch ($_this->country) {
889
  case 'dk':
890
  $_this->regex = '/\\A\\b[0-9]{6}-[0-9]{4}\\b\\z/i';
891
  break;
897
  break;
898
  }
899
  }
900
+ if (empty($_this->regex)) {
901
+ return $_this->_pass('ssn', $check, $country);
902
  }
903
  return $_this->_check();
904
  }
910
  * @return boolean Success
911
  * @access public
912
  */
913
+ function uuid($check) {
914
  $_this = &WPToolset_Cake_Validation::getInstance();
915
  $_this->check = $check;
916
  $_this->regex = '/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i';
935
  * @return boolean Success
936
  * @access public
937
  */
938
+ function url($check, $strict = false) {
939
  $_this = &WPToolset_Cake_Validation::getInstance();
940
  $_this->__populateIp();
941
  $_this->check = $check;
942
+ $validChars = '([' . preg_quote('!"$&\'()*+,-.@_:;=~[]') . '\/0-9a-z\p{L}\p{N}]|(%[0-9a-f]{2}))';
943
+ $_this->regex = '/^(?:(?:https?|ftps?|file|news|gopher):\/\/)' . (!empty($strict) ? '' : '?') .
944
  '(?:' . $_this->__pattern['IPv4'] . '|\[' . $_this->__pattern['IPv6'] . '\]|' . $_this->__pattern['hostname'] . ')' .
945
  '(?::[1-9][0-9]{0,4})?' .
946
  '(?:\/?|\/' . $validChars . '*)?' .
957
  * @return boolean Succcess
958
  * @access public
959
  */
960
+ function inList($check, $list) {
961
+ return in_array($check, $list);
962
  }
963
 
964
  /**
971
  * @return mixed user-defined class class method returns
972
  * @access public
973
  */
974
+ function userDefined($check, $object, $method, $args = null) {
975
+ return call_user_func_array(array(&$object, $method), array($check, $args));
 
976
  }
977
 
978
+ function noSpecialChars($check) {
979
+ return preg_match('#[^a-zA-Z0-9\s\_\-]#', $check) ? false : true;
980
  }
981
 
982
+ function rewriteSlug($check) {
983
+ return preg_match('#[^a-zA-Z0-9\s\_\-\%]#', $check) ? false : true;
984
  }
985
 
986
  /**
994
  * @return mixed Return of Passed method, false on failure
995
  * @access protected
996
  * */
997
+ function _pass($method, $check, $classPrefix) {
998
+ $className = ucwords($classPrefix) . 'Validation';
999
+ if (!class_exists($className)) {
1000
+ trigger_error(sprintf(__('Could not find %s class, unable to complete validation.', true), $className), E_USER_WARNING);
 
1001
  return false;
1002
  }
1003
+ if (!is_callable(array($className, $method))) {
1004
+ trigger_error(sprintf(__('Method %s does not exist on %s unable to complete validation.', true), $method, $className), E_USER_WARNING);
 
 
1005
  return false;
1006
  }
1007
  $check = (array) $check;
1008
+ return call_user_func_array(array($className, $method), $check);
1009
  }
1010
 
1011
  /**
1016
  */
1017
  function _check() {
1018
  $_this = &WPToolset_Cake_Validation::getInstance();
1019
+ if (preg_match($_this->regex, $_this->check)) {
1020
  $_this->error[] = false;
1021
  return true;
1022
  } else {
1033
  * @return void
1034
  * @access protected
1035
  */
1036
+ function _extract($params) {
1037
  $_this = &WPToolset_Cake_Validation::getInstance();
1038
+ extract($params, EXTR_OVERWRITE);
1039
 
1040
+ if (isset($check)) {
1041
  $_this->check = $check;
1042
  }
1043
+ if (isset($regex)) {
1044
  $_this->regex = $regex;
1045
  }
1046
+ if (isset($country)) {
1047
+ $_this->country = strtolower($country);
1048
  }
1049
+ if (isset($deep)) {
1050
  $_this->deep = $deep;
1051
  }
1052
+ if (isset($type)) {
1053
  $_this->type = $type;
1054
  }
1055
  }
1063
  */
1064
  function _luhn() {
1065
  $_this = &WPToolset_Cake_Validation::getInstance();
1066
+ if ($_this->deep !== true) {
1067
  return true;
1068
  }
1069
+ if ($_this->check == 0) {
1070
  return false;
1071
  }
1072
  $sum = 0;
1073
+ $length = strlen($_this->check);
1074
 
1075
+ for ($position = 1 - ($length % 2); $position < $length; $position += 2) {
1076
  $sum += $_this->check[$position];
1077
  }
1078
 
1079
+ for ($position = ($length % 2); $position < $length; $position += 2) {
1080
  $number = $_this->check[$position] * 2;
1081
  $sum += ($number < 10) ? $number : $number - 9;
1082
  }
1092
  */
1093
 
1094
  function __populateIp() {
1095
+ if (!isset($this->__pattern['IPv6'])) {
1096
  $pattern = '((([0-9A-Fa-f]{1,4}:){7}(([0-9A-Fa-f]{1,4})|:))|(([0-9A-Fa-f]{1,4}:){6}';
1097
  $pattern .= '(:|((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})';
1098
  $pattern .= '|(:[0-9A-Fa-f]{1,4})))|(([0-9A-Fa-f]{1,4}:){5}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})';
1110
 
1111
  $this->__pattern['IPv6'] = $pattern;
1112
  }
1113
+ if (!isset($this->__pattern['IPv4'])) {
1114
  $pattern = '(?:(?:25[0-5]|2[0-4][0-9]|(?:(?:1[0-9])?|[1-9]?)[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|(?:(?:1[0-9])?|[1-9]?)[0-9])';
1115
  $this->__pattern['IPv4'] = $pattern;
1116
  }
1131
  $this->error = array();
1132
  $this->errors = array();
1133
  }
1134
+
1135
+ public static function required($value) {
1136
+ return !( is_null($value) || $value === false || $value === '' );
 
1137
  }
1138
 
1139
  }
embedded/common/toolset-forms/lib/js/jquery-form-validation/jquery.validate.js CHANGED
@@ -676,10 +676,14 @@ $.extend($.validator, {
676
  // actually showing the wrapped element is handled elsewhere
677
  label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent();
678
  }
679
- if ( !this.labelContainer.append(label).length )
 
 
 
680
  this.settings.errorPlacement
681
  ? this.settings.errorPlacement(label, $(element) )
682
  : label.insertAfter(element);
 
683
  }
684
  if ( !message && this.settings.success ) {
685
  label.text("");
676
  // actually showing the wrapped element is handled elsewhere
677
  label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent();
678
  }
679
+ if ( !this.labelContainer.append(label).length ) {
680
+ if ( 'date' == $(element).data('wpt-type') ) {
681
+ element = $('input[type=text]', $(element).parent());
682
+ }
683
  this.settings.errorPlacement
684
  ? this.settings.errorPlacement(label, $(element) )
685
  : label.insertAfter(element);
686
+ }
687
  }
688
  if ( !message && this.settings.success ) {
689
  label.text("");
embedded/common/toolset-forms/readme.txt CHANGED
@@ -8,5 +8,132 @@ To get HTML and rest of the scripts queued,
8
  call function before queue_styles WP hook.
9
 
10
 
 
11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
8
  call function before queue_styles WP hook.
9
 
10
 
11
+ Filters:
12
 
13
+ toolset_valid_image_extentions
14
+ toolset_valid_video_extentions
15
+
16
+ Parameters:
17
+ - array - valid extension to be filtered
18
+
19
+ Output:
20
+ - array - filtered extension array
21
+
22
+ Example: add jfif extension:
23
+
24
+ add_filter( 'toolset_valid_image_extentions', 'my_toolset_valid_image_extentions' );
25
+ function my_toolset_valid_image_extentions($valid_extensions)
26
+ {
27
+ $valid_extensions[] = 'jfif';
28
+ return $valid_extensions;
29
+ }
30
+
31
+ = Changelog =
32
+
33
+ 2014-11-13
34
+
35
+ - Fixed a problem with missing taxonomies after form fail:
36
+ https://wp-types.com/forums/topic/cred-featured-image-and-tag-selector-empty-after-validation-refresh/
37
+
38
+ 2014-11-10
39
+
40
+ - Fixed a problem with datepicker witch do not working inside a modal
41
+ dialog
42
+ https://wp-types.com/forums/topic/cred-forms-not-displaying-on-tabletmobile-browsers/
43
+
44
+ 2014-11-03
45
+
46
+ - add filters to change taxonomies buttons text:
47
+ - toolset_button_show_popular_text
48
+ - toolset_button_hide_popular_text
49
+ - toolset_button_add_new_text
50
+ - toolset_button_cancel_text
51
+ - toolset_button_add_text
52
+
53
+ - add filters to change repetitive buttons text:
54
+ - toolset_button_delete_repetition_text
55
+ - toolset_button_add_repetition_text
56
+ https://wp-types.com/forums/topic/format-form-field-as-list/#post-255070
57
+ https://wp-types.com/forums/topic/hi/
58
+ https://wp-types.com/forums/topic/how-to-change-wpt-repdelete-button-value/
59
+
60
+ 2014-10-23
61
+ - Fixed issue with missing previously saved data.
62
+ https://wp-types.com/forums/topic/date-not-recorded-in-a-postype
63
+ https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/191003870/comments#comment_296586170
64
+
65
+ - Fixed a problem with not working build-in taxonomies (category,
66
+ post_tag) when we use this in CPT and this post are not included on
67
+ frontend.
68
+ https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/190833102/comments
69
+
70
+ - Fixed a problem with WYSIWYG field description.
71
+ https://wp-types.com/forums/topic/add-a-link-in-the-custom-field-description/
72
+ https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/191030746/comments
73
+
74
+ 2014-10-21
75
+ - Fixed issue on checkbox after submit - there was wrong condition to
76
+ display checked checkbox.
77
+ https://wp-types.com/forums/topic/checkbox-value-not-saved/
78
+ https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/190834414/comments
79
+
80
+ 2014-10-13
81
+
82
+ - Fixed a wrong error message position, was under date field.
83
+ https://wp-types.com/forums/topic/some-issues-and-feedback-on-cred-1-3-3/
84
+ https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/190493441/comments
85
+
86
+ 2014-10-10
87
+
88
+ - Improved - add class for li element for checkboxes, radio, taxonomy
89
+ (both: flat and hierarchical), this class is based on checkbox label
90
+ and is sanitizet by "sanitize_title" function.
91
+ https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/170609656/comments
92
+ http://wp-types.com/forums/topic/ugly-cred-taxonomy-cannot-style/
93
+
94
+ - Added filter "cred_item_li_class" which allow to change class of LI
95
+ element in checkboxes, radio and hierarchical taxonomy field.
96
+
97
+ 2014-10-09
98
+
99
+ - Fixed warning on user site, when CRED is not installed and we check
100
+ CRED setting
101
+ https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/190474262/comments
102
+ https://wp-types.com/forums/topic/i-just-updated-types-and-im-getting-this-error/
103
+
104
+ - Fixed problem with validation if is empty conditions, validation
105
+ should return true, not false.
106
+ https://wp-types.com/forums/topic/custom-types-fields-not-saving-changes/
107
+ https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/190347235/comments#295158276
108
+
109
+ - Improved taxonomy buttons by adding extra class "btn-cancel" when it
110
+ is needed - on "Cancel" for hierarchical and on "Hide" on
111
+ non-hierarchical.
112
+ https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/190492232/comments
113
+
114
+ 2014-10-07
115
+
116
+ - Fixed problem with replacing @ char from filename
117
+ https://wp-types.com/forums/topic/types-sanitizes-sign-from-file-names/
118
+
119
+ 2014-10-03
120
+
121
+ - Fixed a problem with abandon filter wpcf_fields_*_value_get - this
122
+ groups of filters was not copy to common library.
123
+ https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/189095886/comments
124
+ http://wp-types.com/forums/topic/default-field-value-custom-function-no-longer-works/
125
+
126
+ 2014-10-01
127
+
128
+ - Fixed a problem with not changed label, when adding new taxonomy.
129
+ https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/190086914/comments
130
+
131
+ - Fixed changing the file name when upload the file
132
+ https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/189560556/comments
133
+ http://wp-types.com/forums/topic/types-1-6-update-breaks-layout-that-worked-in-types-1-5-7/
134
+
135
+ 2014-09-30
136
+ - Fixed a problem with multiple CRED form on one screen.
137
+ https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/189954041/comments
138
+ http://wp-types.com/forums/topic/cred-conditional-group-3/
139
 
embedded/common/toolset-forms/templates/metaform-item.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  *
4
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/templates/metaform-item.php $
5
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
6
- * $LastChangedRevision: 1012704 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
@@ -14,7 +14,7 @@ if ( is_admin() ) {
14
  <?php if ( @$cfg['repetitive'] ): ?>
15
  <div class="wpt-repctl">
16
  <div class="js-wpt-repdrag wpt-repdrag">&nbsp;</div>
17
- <a class="js-wpt-repdelete button button-small" data-wpt-type="<?php echo $cfg['type']; ?>" data-wpt-id="<?php echo $cfg['id']; ?>"><?php printf(__('Delete %s', 'wpv-views'), strtolower( $cfg['title'])); ?></a>
18
  </div>
19
  <?php endif; ?>
20
  </div>
@@ -33,7 +33,7 @@ if ( is_admin() ) {
33
  $button_extra_classnames = ' btn btn-default btn-sm';
34
  }
35
  echo '<input type="button" href="#" class="js-wpt-repdelete wpt-repdelete' . $button_extra_classnames . '" value="';
36
- echo esc_attr( sprintf( __( 'Delete %s repetition', 'wpv-views' ), $cfg['title'] ) );
37
  echo '" />';
38
  echo '</div>';
39
  }
1
  <?php
2
  /**
3
  *
4
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/templates/metaform-item.php $
5
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
6
+ * $LastChangedRevision: 1027712 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
14
  <?php if ( @$cfg['repetitive'] ): ?>
15
  <div class="wpt-repctl">
16
  <div class="js-wpt-repdrag wpt-repdrag">&nbsp;</div>
17
+ <a class="js-wpt-repdelete button button-small" data-wpt-type="<?php echo $cfg['type']; ?>" data-wpt-id="<?php echo $cfg['id']; ?>"><?php apply_filters( 'toolset_button_delete_repetition_text', printf(__('Delete %s', 'wpv-views'), strtolower( $cfg['title'])), $cfg); ?></a>
18
  </div>
19
  <?php endif; ?>
20
  </div>
33
  $button_extra_classnames = ' btn btn-default btn-sm';
34
  }
35
  echo '<input type="button" href="#" class="js-wpt-repdelete wpt-repdelete' . $button_extra_classnames . '" value="';
36
+ echo apply_filters( 'toolset_button_delete_repetition_text', esc_attr( sprintf( __( 'Delete %s repetition', 'wpv-views' ), $cfg['title'] ) ), $cfg );
37
  echo '" />';
38
  echo '</div>';
39
  }
embedded/common/toolset-forms/templates/metaform.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  *
4
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/common/toolset-forms/templates/metaform.php $
5
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
6
- * $LastChangedRevision: 1012704 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
@@ -19,7 +19,7 @@ if ( is_admin() ) {
19
  include 'metaform-item.php';
20
  endforeach; ?>
21
  <?php if ( @$cfg['repetitive'] ): ?>
22
- <a href="#" class="js-wpt-repadd wpt-repadd button button-small button-primary-toolset" data-wpt-type="<?php echo $cfg['type']; ?>" data-wpt-id="<?php echo $cfg['id']; ?>"><?php printf(__('Add new %s', 'wpv-views'), $cfg['title']); ?></a>
23
  <?php endif; ?>
24
  </div>
25
  </div>
@@ -60,7 +60,7 @@ if ( is_admin() ) {
60
  }
61
  if ( $cfg['repetitive'] ) {
62
  echo '<input type="button" class="js-wpt-repadd wpt-repadd' . $button_extra_classnames . '" data-wpt-type="' . $cfg['type'] . '" data-wpt-id="' . $cfg['id'] . '" value="';
63
- echo esc_attr( sprintf( __( 'Add new %s', 'wpv-views' ), $cfg['title'] ) );
64
  echo '" />';
65
  }
66
  if ( $needs_wrapper) {
1
  <?php
2
  /**
3
  *
4
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/common/toolset-forms/templates/metaform.php $
5
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
6
+ * $LastChangedRevision: 1027712 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
19
  include 'metaform-item.php';
20
  endforeach; ?>
21
  <?php if ( @$cfg['repetitive'] ): ?>
22
+ <a href="#" class="js-wpt-repadd wpt-repadd button button-small button-primary-toolset" data-wpt-type="<?php echo $cfg['type']; ?>" data-wpt-id="<?php echo $cfg['id']; ?>"><?php echo apply_filters( 'toolset_button_add_repetition_text', sprintf(__('Add new %s', 'wpv-views'), $cfg['title']), $cfg); ?></a>
23
  <?php endif; ?>
24
  </div>
25
  </div>
60
  }
61
  if ( $cfg['repetitive'] ) {
62
  echo '<input type="button" class="js-wpt-repadd wpt-repadd' . $button_extra_classnames . '" data-wpt-type="' . $cfg['type'] . '" data-wpt-id="' . $cfg['id'] . '" value="';
63
+ echo apply_filters( 'toolset_button_add_repetition_text', esc_attr( sprintf( __( 'Add new %s', 'wpv-views' ), $cfg['title'] ) ), $cfg );
64
  echo '" />';
65
  }
66
  if ( $needs_wrapper) {
embedded/common/visual-editor/editor-addon.class.php CHANGED
@@ -120,7 +120,7 @@ if ( file_exists( dirname(__FILE__) . '/editor-addon-generic.class.php') && !cla
120
  // Codemirror (new layout) button
121
  if ( $codemirror_button ){
122
  $addon_button = '<button class="js-code-editor-toolbar-button js-code-editor-toolbar-button-v-icon button-secondary">'.
123
- '<i class="icon-views-logo ont-icon-18"></i><span class="button-label">'. __('Fields', 'wpv-views') .'</span></button>';
124
  }
125
  // add search box
126
  $searchbar = $this->get_search_bar();
@@ -192,8 +192,9 @@ if ( file_exists( dirname(__FILE__) . '/editor-addon-generic.class.php') && !cla
192
  );
193
 
194
  if ( isset( $sitepress ) && function_exists( 'wpml_string_shortcode' ) ) {
195
- $this->items[] = array(__('Translatable string', 'wpv-views'), 'wpml-string',__('Basic', 'wpv-views'),'wpv_insert_translatable_string_popup()');
196
- }
 
197
 
198
 
199
 
@@ -332,7 +333,7 @@ if ( file_exists( dirname(__FILE__) . '/editor-addon-generic.class.php') && !cla
332
  // Codemirrir (new layout) button
333
  if ( $codemirror_button ){
334
  $addon_button = '<button class="js-code-editor-toolbar-button js-code-editor-toolbar-button-v-icon button-secondary">'.
335
- '<i class="icon-views-logo ont-icon-18"></i><span class="button-label">'. __('Fields', 'wpv-views') .'</span></button>';
336
  }
337
  // add search box
338
  $searchbar = $this->get_search_bar();
@@ -672,13 +673,13 @@ if ( file_exists( dirname(__FILE__) . '/editor-addon-generic.class.php') && !cla
672
  '_wpv_settings', true );
673
  $title = $vtemplate->post_title . ' - ' . __( 'Post View',
674
  'wpv-views' );
675
- if ( isset( $view_settings['query_type'][0] ) && $view_settings['query_type'][0] == 'taxonomy' ) {
676
  $title = $vtemplate->post_title . ' - ' . __( 'Taxonomy View',
677
  'wpv-views' );
678
  if ( $post_name == __( 'Post View', 'wpv-views' ) || $post_name == __( 'User View', 'wpv-views' ) ) {
679
  continue;
680
  }
681
- } elseif ( isset( $view_settings['query_type'][0] ) && $view_settings['query_type'][0] == 'users' ) {
682
  $title = $vtemplate->post_title . ' - ' . __( 'User View',
683
  'wpv-views' );
684
  if ( $post_name == __( 'Post View', 'wpv-views' ) || $post_name == __( 'Taxonomy View', 'wpv-views' ) ) {
120
  // Codemirror (new layout) button
121
  if ( $codemirror_button ){
122
  $addon_button = '<button class="js-code-editor-toolbar-button js-code-editor-toolbar-button-v-icon button-secondary">'.
123
+ '<i class="icon-views-logo ont-icon-18"></i><span class="button-label">'. __('Fields and Views', 'wpv-views') .'</span></button>';
124
  }
125
  // add search box
126
  $searchbar = $this->get_search_bar();
192
  );
193
 
194
  if ( isset( $sitepress ) && function_exists( 'wpml_string_shortcode' ) ) {
195
+ $nonce = wp_create_nonce('wpv_editor_callback');
196
+ $this->items[] = array(__('Translatable string', 'wpv-views'), 'wpml-string',__('Basic', 'wpv-views'),'WPViews.shortcodes_gui.wpv_insert_translatable_string_popup(\'' . $nonce . '\')');
197
+ }
198
 
199
 
200
 
333
  // Codemirrir (new layout) button
334
  if ( $codemirror_button ){
335
  $addon_button = '<button class="js-code-editor-toolbar-button js-code-editor-toolbar-button-v-icon button-secondary">'.
336
+ '<i class="icon-views-logo ont-icon-18"></i><span class="button-label">'. __('Fields and Views', 'wpv-views') .'</span></button>';
337
  }
338
  // add search box
339
  $searchbar = $this->get_search_bar();
673
  '_wpv_settings', true );
674
  $title = $vtemplate->post_title . ' - ' . __( 'Post View',
675
  'wpv-views' );
676
+ if ( isset( $view_settings['query_type'] ) && isset( $view_settings['query_type'][0] ) && $view_settings['query_type'][0] == 'taxonomy' ) {
677
  $title = $vtemplate->post_title . ' - ' . __( 'Taxonomy View',
678
  'wpv-views' );
679
  if ( $post_name == __( 'Post View', 'wpv-views' ) || $post_name == __( 'User View', 'wpv-views' ) ) {
680
  continue;
681
  }
682
+ } elseif ( isset( $view_settings['query_type'] ) && isset( $view_settings['query_type'][0] ) && $view_settings['query_type'][0] == 'users' ) {
683
  $title = $vtemplate->post_title . ' - ' . __( 'User View',
684
  'wpv-views' );
685
  if ( $post_name == __( 'Post View', 'wpv-views' ) || $post_name == __( 'Taxonomy View', 'wpv-views' ) ) {
embedded/common/wpv-filter-date-embedded.php CHANGED
@@ -124,7 +124,7 @@ if (!function_exists('wpv_filter_parse_date')) {
124
  $date = Toolset_DateParser::parseDate( $date_string, $format );
125
  if( is_object($date) && method_exists( $date, 'getTimestamp' ) )
126
  {
127
- $timestamp = $date->getTimestamp();
128
  return $timestamp;
129
  }
130
 
124
  $date = Toolset_DateParser::parseDate( $date_string, $format );
125
  if( is_object($date) && method_exists( $date, 'getTimestamp' ) )
126
  {
127
+ $timestamp = $date->getTimestamp();// NOTE this timestamp construction should be compatible with the adodb_xxx functions
128
  return $timestamp;
129
  }
130
 
embedded/frontend.php CHANGED
@@ -2,9 +2,9 @@
2
  /*
3
  * Frontend functions.
4
  *
5
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/frontend.php $
6
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
7
- * $LastChangedRevision: 1012704 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
@@ -236,14 +236,11 @@ function types_render_field_single( $field, $params, $content = null, $code = ''
236
  $params = apply_filters( 'types_field_shortcode_parameters', $params,
237
  $field, $post, $meta_id );
238
 
239
- $params['field_value'] = apply_filters( 'wpcf_fields_value_display',
240
- $params['field_value'], $params, $post->ID, $field['id'], $meta_id );
241
 
242
- $params['field_value'] = apply_filters( 'wpcf_fields_slug_' . $field['slug'] . '_value_display',
243
- $params['field_value'], $params, $post->ID, $field['id'], $meta_id );
244
 
245
- $params['field_value'] = apply_filters( 'wpcf_fields_type_' . $field['type'] . '_value_display',
246
- $params['field_value'], $params, $post->ID, $field['id'], $meta_id );
247
  // To make sure
248
  if ( is_string( $params['field_value'] ) ) {
249
  $params['field_value'] = addslashes( stripslashes( strval( $params['field_value'] ) ) );
@@ -535,7 +532,17 @@ function wpcf_views_query( $query, $view_settings ) {
535
  $meta_filter_required = true;
536
  $meta['compare'] = '=';
537
 
538
- $values = explode( ',', $meta['value'] );
 
 
 
 
 
 
 
 
 
 
539
 
540
  $meta['value'] = ' REGEXP(';
541
 
2
  /*
3
  * Frontend functions.
4
  *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/frontend.php $
6
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
7
+ * $LastChangedRevision: 1027712 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
236
  $params = apply_filters( 'types_field_shortcode_parameters', $params,
237
  $field, $post, $meta_id );
238
 
239
+ $params['field_value'] = apply_filters( 'wpcf_fields_value_display', $params['field_value'], $params, $post->ID, $field['id'], $meta_id );
 
240
 
241
+ $params['field_value'] = apply_filters( 'wpcf_fields_slug_' . $field['slug'] . '_value_display', $params['field_value'], $params, $post->ID, $field['id'], $meta_id );
 
242
 
243
+ $params['field_value'] = apply_filters( 'wpcf_fields_type_' . $field['type'] . '_value_display', $params['field_value'], $params, $post->ID, $field['id'], $meta_id );
 
244
  // To make sure
245
  if ( is_string( $params['field_value'] ) ) {
246
  $params['field_value'] = addslashes( stripslashes( strval( $params['field_value'] ) ) );
532
  $meta_filter_required = true;
533
  $meta['compare'] = '=';
534
 
535
+ /* According to http://codex.wordpress.org/Class_Reference/WP_Meta_Query#Accepted_Arguments,
536
+ * $meta['value'] can be an array or a string. In case of a string we additionally allow
537
+ * multiple comma-separated values. */
538
+ if( is_array( $meta['value'] ) ) {
539
+ $values = $meta['value'];
540
+ } elseif( is_string( $meta['value'] ) ) {
541
+ $values = explode( ',', $meta['value'] );
542
+ } else {
543
+ // This can happen if $meta['value'] is a number, for example.
544
+ $values = array( $meta['value'] );
545
+ }
546
 
547
  $meta['value'] = ' REGEXP(';
548
 
embedded/functions.php CHANGED
@@ -3,9 +3,9 @@
3
  * Basic and init functions.
4
  * Since Types 1.2 moved from /embedded/types.php
5
  *
6
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/functions.php $
7
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
8
- * $LastChangedRevision: 1012704 $
9
  * $LastChangedBy: iworks $
10
  *
11
  */
@@ -175,7 +175,7 @@ function wpcf_promote_types_admin() {
175
 
176
  <?php
177
  if ( sizeof( $custom_types ) > 0 ) {
178
- echo '<p>' . __( 'Types creates Custom Post Types. These are user-defined WordPress content types. On your theme the following Types are defined:',
179
  'wpcf' ) . "</p>\n";
180
  echo "<ul style='margin-left:20px;'>\n";
181
  foreach ( $custom_types as $type ) {
3
  * Basic and init functions.
4
  * Since Types 1.2 moved from /embedded/types.php
5
  *
6
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/functions.php $
7
+ * $LastChangedDate: 2014-10-23 10:33:39 +0000 (Thu, 23 Oct 2014) $
8
+ * $LastChangedRevision: 1012677 $
9
  * $LastChangedBy: iworks $
10
  *
11
  */
175
 
176
  <?php
177
  if ( sizeof( $custom_types ) > 0 ) {
178
+ echo '<p>' . __( 'Types creates Custom Post Types. These are user-defined WordPress content types. On your theme the following types are defined:',
179
  'wpcf' ) . "</p>\n";
180
  echo "<ul style='margin-left:20px;'>\n";
181
  foreach ( $custom_types as $type ) {
embedded/includes/custom-types.php CHANGED
@@ -3,9 +3,9 @@
3
  *
4
  * Custom Post Types embedded code.
5
  *
6
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/includes/custom-types.php $
7
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
8
- * $LastChangedRevision: 1012704 $
9
  * $LastChangedBy: iworks $
10
  *
11
  */
@@ -163,6 +163,7 @@ function wpcf_custom_types_register( $post_type, $data ) {
163
  }
164
  if ( !empty( $data['show_in_menu_page'] ) ) {
165
  $data['show_in_menu'] = $data['show_in_menu_page'];
 
166
  }
167
  /**
168
  * menu_icon
3
  *
4
  * Custom Post Types embedded code.
5
  *
6
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/includes/custom-types.php $
7
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
8
+ * $LastChangedRevision: 1027712 $
9
  * $LastChangedBy: iworks $
10
  *
11
  */
163
  }
164
  if ( !empty( $data['show_in_menu_page'] ) ) {
165
  $data['show_in_menu'] = $data['show_in_menu_page'];
166
+ $data['labels']['all_items'] = $data['labels']['name'];
167
  }
168
  /**
169
  * menu_icon
embedded/includes/examples/google_map.php CHANGED
@@ -159,7 +159,6 @@ function wpcf_fields_google_map_editor_callback( $field, $settings ) {
159
  $form = ob_get_contents();
160
  ob_get_clean();
161
  return array(
162
- // 'supports' => array('styling', 'style'),
163
  'tabs' => array(
164
  'display' => array(
165
  'menu_title' => __( 'Display', 'wpcf' ),
@@ -211,4 +210,34 @@ function wpcf_fields_google_map_view( $data ) {
211
  . '&amp;source=embed" style="color:#0000FF;text-align:left">'
212
  . __( 'View Larger Map', 'wpcf' )
213
  . '</a></small><br />';
214
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  $form = ob_get_contents();
160
  ob_get_clean();
161
  return array(
 
162
  'tabs' => array(
163
  'display' => array(
164
  'menu_title' => __( 'Display', 'wpcf' ),
210
  . '&amp;source=embed" style="color:#0000FF;text-align:left">'
211
  . __( 'View Larger Map', 'wpcf' )
212
  . '</a></small><br />';
213
+ }
214
+
215
+ function WPToolset_Field_Google_Map_loader()
216
+ {
217
+
218
+ if ( class_exists('WPToolset_Field_Google_Map' ) ) {
219
+ return;
220
+ }
221
+
222
+ class WPToolset_Field_Google_Map extends FieldFactory
223
+ {
224
+ public function metaform()
225
+ {
226
+ $attributes = $this->getAttr();
227
+
228
+ $metaform = array();
229
+ $metaform[] = array(
230
+ '#type' => 'textfield',
231
+ '#title' => $this->getTitle(),
232
+ '#description' => $this->getDescription(),
233
+ '#name' => $this->getName(),
234
+ '#value' => $this->getValue(),
235
+ '#validate' => $this->getValidationData(),
236
+ '#repetitive' => $this->isRepetitive(),
237
+ '#attributes' => $attributes,
238
+ );
239
+ return $metaform;
240
+ }
241
+
242
+ }
243
+ }
embedded/includes/fields-post.php CHANGED
@@ -4,9 +4,9 @@
4
  * Edit post page functions
5
  *
6
  *
7
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/includes/fields-post.php $
8
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
9
- * $LastChangedRevision: 1012704 $
10
  * $LastChangedBy: iworks $
11
  *
12
  * Core file with stable and working functions.
@@ -20,11 +20,11 @@ require_once WPCF_EMBEDDED_ABSPATH . '/includes/conditional-display.php';
20
 
21
  /**
22
  * Init functions for post edit pages.
23
- *
24
  * Core function. Works and stable. Do not move or change.
25
  * If required, add hooks only.
26
- *
27
- * @param type $post
28
  */
29
  function wpcf_admin_post_init( $post ) {
30
  add_action( 'admin_footer', 'wpcf_admin_fields_postfields_styles' );
@@ -37,7 +37,7 @@ function wpcf_admin_post_init( $post ) {
37
  $post_type = wpcf_admin_get_edited_post_type( $post );
38
 
39
  /*
40
- *
41
  * This is left to maintain compatibility with older versions
42
  * TODO Remove
43
  */
@@ -121,9 +121,9 @@ function wpcf_admin_post_init( $post ) {
121
  * TODO Review
122
  * This is forced because of various Child cases
123
  * and when field are rendered via AJAX but not registered yet.
124
- *
125
  * Basically all fields that require additional JS should be added here.
126
- *
127
  * This is a must for now.
128
  * These fields need init JS in various cases.
129
  */
@@ -138,7 +138,7 @@ function wpcf_admin_post_init( $post ) {
138
 
139
  /**
140
  * Add meta boxes.
141
- *
142
  * @param type $post_type
143
  * @param type $post
144
  * @return boolean
@@ -224,11 +224,11 @@ function wpcf_add_meta_boxes( $post_type, $post ) {
224
 
225
  /**
226
  * Renders meta box content (preview).
227
- *
228
- *
229
- *
230
  * @param type $post
231
- * @param type $group
232
  */
233
  function wpcf_admin_post_meta_box_preview( $post, $group, $echo = '' ){
234
 
@@ -282,7 +282,7 @@ function wpcf_admin_post_meta_box_preview( $post, $group, $echo = '' ){
282
  $meta_id = key( $meta );
283
  $_temp = array_shift( $meta );
284
  if (!is_array($_temp) && strval( $_temp ) == '' ) {
285
-
286
  } else {
287
  $params['field_value'] = $_temp;
288
  if ( !empty( $params['field_value'] ) ) {
@@ -379,14 +379,14 @@ function wpcf_admin_post_meta_box_preview( $post, $group, $echo = '' ){
379
 
380
  /**
381
  * Renders meta box content.
382
- *
383
  * Core function. Works and stable.
384
  * If required, add hooks only.
385
- *
386
  * @todo Revise this 1.1.5
387
- *
388
  * @param type $post
389
- * @param type $group
390
  * @param type $echo
391
  * @param type boolean $open_style_editor if true use code for open style editor when edit group
392
  */
@@ -395,7 +395,7 @@ function wpcf_admin_post_meta_box( $post, $group, $echo = '', $open_style_editor
395
 
396
  if (
397
  false === $open_style_editor
398
- && defined( 'WPTOOLSET_FORMS_VERSION' )
399
  ) {
400
  if ( isset( $group['args']['html'] ) ) {
401
  /**
@@ -452,7 +452,7 @@ function wpcf_admin_post_meta_box( $post, $group, $echo = '', $open_style_editor
452
  $group_output .= "\n\n" . '<div id="wpcf-group-metabox-id-' . $group['args']['slug'] . '">' . "\n";
453
  /*
454
  * TODO Move to Conditional code
455
- *
456
  * This is already checked. Use hook to add wrapper DIVS and apply CSS.
457
  */
458
  if ( !empty( $group['args']['_conditional_display'] ) ) {
@@ -495,7 +495,7 @@ function wpcf_admin_post_meta_box( $post, $group, $echo = '', $open_style_editor
495
  wpcf_compare_wp_version()
496
  && array_key_exists( '#type', $field )
497
  && 'wysiwyg' == $field['#type']
498
- && !isset( $field['#attributes']['disabled'] )
499
  ) {
500
  // if ( isset( $field['#attributes']['disabled'] ) ) {
501
  // $field['#editor_settings']['tinymce'] = false;
@@ -536,15 +536,14 @@ function wpcf_admin_post_meta_box( $post, $group, $echo = '', $open_style_editor
536
  }
537
  do_action( 'wpcf_fields_' . $field_slug . '_meta_box_form', $field );
538
  if ( isset( $field['wpcf-type'] ) ) { // May be ignored
539
- do_action( 'wpcf_fields_' . $field['wpcf-type'] . '_meta_box_form',
540
- $field );
541
  }
542
  }
543
  }
544
 
545
  /*
546
  * TODO Move to Conditional code
547
- *
548
  * This is already checked. Use hook to add wrapper DIVS and apply CSS.
549
  */
550
  if ( !empty( $group['args']['_conditional_display'] ) ) {
@@ -563,13 +562,13 @@ function wpcf_admin_post_meta_box( $post, $group, $echo = '', $open_style_editor
563
 
564
  /**
565
  * Important save_post hook.
566
- *
567
  * Core function. Works and stable. Do not move or change.
568
  * If required, add hooks only.
569
- *
570
  * @internal breakpoint
571
  * @param type $post_ID
572
- * @param type $post
573
  */
574
  function wpcf_admin_post_save_post_hook( $post_ID, $post )
575
  {
@@ -715,11 +714,11 @@ function wpcf_admin_post_save_post_hook( $post_ID, $post )
715
  do_action( 'wpcf_post_saved', $post_ID );
716
  return;
717
  }
718
-
719
-
720
-
721
  // OLD
722
-
723
  global $wpcf;
724
 
725
  // Basic cheks
@@ -744,8 +743,8 @@ function wpcf_admin_post_save_post_hook( $post_ID, $post )
744
  }
745
 
746
  /*
747
- *
748
- *
749
  * Get all groups connected to this $post
750
  */
751
  $groups = wpcf_admin_post_get_post_groups_fields( $post );
@@ -757,10 +756,10 @@ function wpcf_admin_post_save_post_hook( $post_ID, $post )
757
  $_error = false;
758
 
759
  /*
760
- *
761
- *
762
  * Loop over each group
763
- *
764
  * TODO Document this
765
  * Connect 'wpcf-invalid-fields' with all fields
766
  */
@@ -801,15 +800,13 @@ function wpcf_admin_post_save_post_hook( $post_ID, $post )
801
  }
802
 
803
  /*
804
- *
805
  * Allow interaction here.
806
  * Conditional will set $error to false if field is conditional
807
  * and not submitted.
808
  */
809
- $error = apply_filters( 'wpcf_post_form_error', $_error, $_not_valid,
810
- $all_fields );
811
- $not_valid = apply_filters( 'wpcf_post_form_not_valid', $_not_valid,
812
- $_error, $all_fields );
813
 
814
  // Notify user about error
815
  if ( $error ) {
@@ -825,10 +822,10 @@ function wpcf_admin_post_save_post_hook( $post_ID, $post )
825
  }
826
 
827
  /*
828
- *
829
- *
830
- *
831
- *
832
  * Save meta fields
833
  */
834
  if ( !empty( $_POST['wpcf'] ) ) {
@@ -857,18 +854,18 @@ function wpcf_admin_post_save_post_hook( $post_ID, $post )
857
 
858
 
859
  /*
860
- *
861
- *
862
  * Saving fields
863
  * @since 1.2
864
- *
865
  * We changed way repetitive fields are saved.
866
  * On each save fields are rewritten and order is saved in
867
  * '_$slug-sort-order' meta field.
868
  */
869
 
870
  /*
871
- *
872
  * We marked fields as repetitive in POST['__wpcf_repetitive']
873
  * Without this check we won't save any.
874
  * @see WPCF_Repeater::get_fields_form()
@@ -894,7 +891,7 @@ function wpcf_admin_post_save_post_hook( $post_ID, $post )
894
 
895
  /*
896
  * Process checkboxes
897
- *
898
  * TODO Revise and remove
899
  * Since Types 1.1.5 we moved this check to embedded/includes/checkbox.php
900
  * checkbox.php added permanently to bootstrap.
@@ -929,9 +926,7 @@ function wpcf_admin_post_save_post_hook( $post_ID, $post )
929
  $update_data[$option_id] = $_POST['wpcf'][$field['wpcf-slug']][$option_id];
930
  }
931
  }
932
- update_post_meta( $post_ID,
933
- wpcf_types_get_meta_prefix( $field ) . $field['wpcf-slug'],
934
- $update_data );
935
  }
936
  }
937
  }
@@ -945,7 +940,7 @@ function wpcf_admin_post_save_post_hook( $post_ID, $post )
945
  *
946
  * @internal breakpoint
947
  * @param type $post_ID
948
- * @param type $post
949
  */
950
  function wpcf_admin_post_add_attachment_hook( $post_ID, $post )
951
  {
@@ -1053,13 +1048,13 @@ function wpcf_admin_post_js_validation() {
1053
 
1054
  /**
1055
  * Creates form elements.
1056
- *
1057
  * Core function. Works and stable. Do not move or change.
1058
  * If required, add hooks only.
1059
- *
1060
  * @param type $post
1061
  * @param type $fields
1062
- * @return type
1063
  */
1064
  function wpcf_admin_post_process_fields( $post = false, $fields = array(),
1065
  $use_cache = true, $add_to_editor = true, $context = 'group' ) {
@@ -1087,7 +1082,7 @@ function wpcf_admin_post_process_fields( $post = false, $fields = array(),
1087
  delete_post_meta( $post->ID, 'wpcf-invalid-fields' );
1088
 
1089
  /*
1090
- *
1091
  * Add it to global $wpcf
1092
  * From now on take it there.
1093
  */
@@ -1112,7 +1107,7 @@ function wpcf_admin_post_process_fields( $post = false, $fields = array(),
1112
  /*
1113
  * TODO All WPML specific code needs moving to
1114
  * /embedded/includes/wpml.php
1115
- *
1116
  * @since Types 1.2
1117
  */
1118
  // TODO WPML move
@@ -1127,17 +1122,17 @@ function wpcf_admin_post_process_fields( $post = false, $fields = array(),
1127
  } else {
1128
  // Set repeater
1129
  /*
1130
- *
1131
- *
1132
  * @since Types 1.2
1133
  * Now we're using repeater class to handle repetitive forms.
1134
  * Main change is - use form from $field_meta_box_form() without
1135
  * re-processing form elements.
1136
- *
1137
  * Field should pass form as array:
1138
  * 'my_checkbox' => array('#type' => 'checkbox' ...),
1139
  * 'my_textfield' => array('#type' => 'textfield' ...),
1140
- *
1141
  * In form it should set values to be stored.
1142
  * Use hooks to adjust saved data.
1143
  */
@@ -1145,21 +1140,21 @@ function wpcf_admin_post_process_fields( $post = false, $fields = array(),
1145
  $fields_processed = $fields_processed + $wpcf->repeater->get_fields_form();
1146
  }
1147
  /*
1148
- *
1149
- *
1150
- *
1151
- *
1152
- *
1153
- *
1154
- *
1155
- *
1156
- *
1157
- *
1158
- *
1159
- *
1160
- *
1161
- *
1162
- *
1163
  * Non-repetitive fields
1164
  */
1165
  } else {
@@ -1168,14 +1163,14 @@ function wpcf_admin_post_process_fields( $post = false, $fields = array(),
1168
  * meta_form will be treated as normal form.
1169
  * See if any obstacles prevent us from using completed
1170
  * form from config files.
1171
- *
1172
  * Main change is - use form from $field_meta_box_form() without
1173
  * re-processing form elements.
1174
- *
1175
  * Field should pass form as array:
1176
  * 'my_checkbox' => array('#type' => 'checkbox' ...),
1177
  * 'my_textfield' => array('#type' => 'textfield' ...),
1178
- *
1179
  * In form it should set values to be stored.
1180
  * Use hooks to adjust saved data.
1181
  */
@@ -1206,16 +1201,16 @@ function wpcf_admin_post_process_fields( $post = false, $fields = array(),
1206
 
1207
  /**
1208
  * Processes single field.
1209
- *
1210
  * Since Types 1.2 this function changed. It handles single form element.
1211
  * Form element is already fetched, also meta values using class WPCF_Field.
1212
- *
1213
  * Core function. Works and stable. Do not move or change.
1214
  * If required, add hooks only.
1215
- *
1216
  * @todo gradually remove usage of inherited fields
1217
  * @todo Cleanup
1218
- *
1219
  * @staticvar array $repetitive_started
1220
  * @param type $field_object
1221
  * @return mixed boolean|array
@@ -1241,9 +1236,9 @@ function wpcf_admin_post_process_field( $field_object ) {
1241
 
1242
  /*
1243
  * Get inherited field
1244
- *
1245
  * TODO Deprecated
1246
- *
1247
  * Since Types 1.2 we encourage developers to completely define fields.
1248
  */
1249
  $inherited_field_data = false;
@@ -1267,27 +1262,27 @@ function wpcf_admin_post_process_field( $field_object ) {
1267
  /*
1268
  * CHECKPOINT
1269
  * APPLY FILTERS
1270
- *
1271
- *
1272
  * Moved to WPCF_Field
1273
  * Field value should be already filtered
1274
- *
1275
  * Explanation:
1276
  * When WPCF_Field::set() is called, all these properties are set.
1277
  * WPCF_Field::$cf['value']
1278
  * WPCF_Field::$__meta (single value from DB)
1279
  * WPCF_Field::$meta (single or multiple values if single/repetitive)
1280
- *
1281
  * TODO Make sure value is already filtered and not overwritten
1282
  */
1283
 
1284
  /*
1285
  * Set generic values
1286
- *
1287
  * FUTURE BREAKPOINT
1288
  * Since Types 1.2 we do not encourage relying on generic field data.
1289
  * Only core fields should use this.
1290
- *
1291
  * TODO Open 3rd party fields dir
1292
  */
1293
  $_element = array(
@@ -1303,9 +1298,9 @@ function wpcf_admin_post_process_field( $field_object ) {
1303
 
1304
  /*
1305
  * TODO Add explanation about creating duplicated fields
1306
- *
1307
  * NOT USED YET
1308
- *
1309
  * Explain users that fields are added if slug is changed
1310
  */
1311
  wpcf_admin_add_js_settings( 'wpcfFieldNewInstanceWarning',
@@ -1313,7 +1308,7 @@ function wpcf_admin_post_process_field( $field_object ) {
1313
 
1314
  /*
1315
  * Merge with default element
1316
- *
1317
  * Deprecated from Types 1.2
1318
  * Only core fields use this.
1319
  */
@@ -1321,21 +1316,21 @@ function wpcf_admin_post_process_field( $field_object ) {
1321
 
1322
 
1323
  /*
1324
- *
1325
- *
1326
- *
1327
- *
1328
- *
1329
- *
1330
- *
1331
- *
1332
- *
1333
- *
1334
- *
1335
- *
1336
- *
1337
- *
1338
- *
1339
  * TODO From this point code should be simplified.
1340
  */
1341
 
@@ -1362,8 +1357,8 @@ function wpcf_admin_post_process_field( $field_object ) {
1362
  // Set validation element
1363
  if ( isset( $field['data']['validate'] ) ) {
1364
  /*
1365
- *
1366
- *
1367
  * TODO First two check are not needed anymore
1368
  */
1369
  // If array has more than one field - see which one is marked
@@ -1429,12 +1424,12 @@ function wpcf_admin_post_process_field( $field_object ) {
1429
  $element['#attributes']['class'] = isset( $element['#attributes']['class'] ) ? $element['#attributes']['class'] . ' wpcf-repetitive' : 'wpcf-repetitive';
1430
  }
1431
  /*
1432
- *
1433
- *
1434
  * Since Types 1.2 we allow same field values
1435
- *
1436
  * TODO Remove
1437
- *
1438
  * wpcf_admin_add_js_settings('wpcfFormRepetitiveUniqueValuesCheckText',
1439
  '\'' . __('Warning: same values set', 'wpcf') . '\'');
1440
  */
@@ -1513,20 +1508,20 @@ function wpcf_admin_post_process_field( $field_object ) {
1513
 
1514
  /**
1515
  * Gets all groups and fields for post.
1516
- *
1517
  * Core function. Works and stable. Do not move or change.
1518
  * If required, add hooks only.
1519
- *
1520
  * @param type $post_ID
1521
- * @return type
1522
  */
1523
  function wpcf_admin_post_get_post_groups_fields( $post = false,
1524
  $context = 'group' ) {
1525
 
1526
  // Get post_type
1527
  /*
1528
- *
1529
- *
1530
  * Since WP 3.5 | Types 1.2
1531
  * Looks like $post is altered with get_post_type()
1532
  * We do not want that if post is already set
@@ -1585,8 +1580,7 @@ function wpcf_admin_post_get_post_groups_fields( $post = false,
1585
 
1586
  // Filter groups
1587
  $groups = array();
1588
- $groups_all = apply_filters( 'wpcf_post_groups_all',
1589
- wpcf_admin_fields_get_groups(), $post, $context );
1590
  foreach ( $groups_all as $temp_key => $temp_group ) {
1591
  if ( empty( $temp_group['is_active'] ) ) {
1592
  unset( $groups_all[$temp_key] );
@@ -1607,8 +1601,7 @@ function wpcf_admin_post_get_post_groups_fields( $post = false,
1607
  $taxonomy_filter = $groups_all[$temp_key]['_wp_types_group_terms'][0] == 'all' ? -1 : 0;
1608
  $template_filter = $groups_all[$temp_key]['_wp_types_group_templates'][0] == 'all' ? -1 : 0;
1609
 
1610
- $groups_all[$temp_key] = apply_filters( 'wpcf_post_group_filter_settings',
1611
- $groups_all[$temp_key], $post, $context, $post->_wpcf_post_terms );
1612
 
1613
  // See if post type matches
1614
  if ( $post_type_filter == 0 && in_array( $post_type,
@@ -1662,13 +1655,13 @@ function wpcf_admin_post_get_post_groups_fields( $post = false,
1662
 
1663
  /**
1664
  * Stores fields for editor menu.
1665
- *
1666
  * Core function. Works and stable. Do not move or change.
1667
  * If required, add hooks only.
1668
- *
1669
  * @staticvar array $fields
1670
  * @param type $field
1671
- * @return array
1672
  */
1673
  function wpcf_admin_post_add_to_editor( $field ) {
1674
  static $fields = array();
@@ -1683,11 +1676,11 @@ function wpcf_admin_post_add_to_editor( $field ) {
1683
 
1684
  /**
1685
  * Renders JS for editor menu.
1686
- *
1687
  * Core function. Works and stable. Do not move or change.
1688
  * If required, add hooks only.
1689
- *
1690
- * @return type
1691
  */
1692
  function wpcf_admin_post_add_to_editor_js() {
1693
 
@@ -1728,14 +1721,14 @@ function wpcf_admin_post_add_to_editor_js() {
1728
 
1729
  /**
1730
  * Adds items to view dropdown.
1731
- *
1732
  * Core function. Works and stable. Do not move or change.
1733
  * If required, add hooks only.
1734
- *
1735
  * @todo Remove (to WPCF_WPViews)
1736
- *
1737
  * @param type $items
1738
- * @return type
1739
  */
1740
  function wpcf_admin_post_editor_addon_menus_filter( $items ) {
1741
 
@@ -1838,7 +1831,7 @@ function wpcf_admin_post_editor_addon_menus_filter( $items ) {
1838
 
1839
  /**
1840
  * Marketing meta-box
1841
- *
1842
  * Core function. Works and stable. Do not move or change.
1843
  * If required, add hooks only.
1844
  */
@@ -1888,7 +1881,7 @@ function wpcf_post_preview_warning() {
1888
  array('auto-draft', 'draft') ) && !in_array( $post->post_type,
1889
  array('cred', 'view', 'view-template') ) ) {
1890
  // require_once WPCF_EMBEDDED_ABSPATH . '/common/wp-pointer.php';
1891
- //
1892
  // $pointer = new WPV_wp_pointer('types-post-preview-warning');
1893
  // $pointer->add_pointer(__('Preview warning'),
1894
  // sprintf(__('Custom field changes cannot be previewed until %s is updated'), $post->post_type),
4
  * Edit post page functions
5
  *
6
  *
7
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/includes/fields-post.php $
8
+ * $LastChangedDate: 2014-10-29 15:57:36 +0000 (Wed, 29 Oct 2014) $
9
+ * $LastChangedRevision: 1016002 $
10
  * $LastChangedBy: iworks $
11
  *
12
  * Core file with stable and working functions.
20
 
21
  /**
22
  * Init functions for post edit pages.
23
+ *
24
  * Core function. Works and stable. Do not move or change.
25
  * If required, add hooks only.
26
+ *
27
+ * @param type $post
28
  */
29
  function wpcf_admin_post_init( $post ) {
30
  add_action( 'admin_footer', 'wpcf_admin_fields_postfields_styles' );
37
  $post_type = wpcf_admin_get_edited_post_type( $post );
38
 
39
  /*
40
+ *
41
  * This is left to maintain compatibility with older versions
42
  * TODO Remove
43
  */
121
  * TODO Review
122
  * This is forced because of various Child cases
123
  * and when field are rendered via AJAX but not registered yet.
124
+ *
125
  * Basically all fields that require additional JS should be added here.
126
+ *
127
  * This is a must for now.
128
  * These fields need init JS in various cases.
129
  */
138
 
139
  /**
140
  * Add meta boxes.
141
+ *
142
  * @param type $post_type
143
  * @param type $post
144
  * @return boolean
224
 
225
  /**
226
  * Renders meta box content (preview).
227
+ *
228
+ *
229
+ *
230
  * @param type $post
231
+ * @param type $group
232
  */
233
  function wpcf_admin_post_meta_box_preview( $post, $group, $echo = '' ){
234
 
282
  $meta_id = key( $meta );
283
  $_temp = array_shift( $meta );
284
  if (!is_array($_temp) && strval( $_temp ) == '' ) {
285
+
286
  } else {
287
  $params['field_value'] = $_temp;
288
  if ( !empty( $params['field_value'] ) ) {
379
 
380
  /**
381
  * Renders meta box content.
382
+ *
383
  * Core function. Works and stable.
384
  * If required, add hooks only.
385
+ *
386
  * @todo Revise this 1.1.5
387
+ *
388
  * @param type $post
389
+ * @param type $group
390
  * @param type $echo
391
  * @param type boolean $open_style_editor if true use code for open style editor when edit group
392
  */
395
 
396
  if (
397
  false === $open_style_editor
398
+ && defined( 'WPTOOLSET_FORMS_VERSION' )
399
  ) {
400
  if ( isset( $group['args']['html'] ) ) {
401
  /**
452
  $group_output .= "\n\n" . '<div id="wpcf-group-metabox-id-' . $group['args']['slug'] . '">' . "\n";
453
  /*
454
  * TODO Move to Conditional code
455
+ *
456
  * This is already checked. Use hook to add wrapper DIVS and apply CSS.
457
  */
458
  if ( !empty( $group['args']['_conditional_display'] ) ) {
495
  wpcf_compare_wp_version()
496
  && array_key_exists( '#type', $field )
497
  && 'wysiwyg' == $field['#type']
498
+ && !isset( $field['#attributes']['disabled'] )
499
  ) {
500
  // if ( isset( $field['#attributes']['disabled'] ) ) {
501
  // $field['#editor_settings']['tinymce'] = false;
536
  }
537
  do_action( 'wpcf_fields_' . $field_slug . '_meta_box_form', $field );
538
  if ( isset( $field['wpcf-type'] ) ) { // May be ignored
539
+ do_action( 'wpcf_fields_' . $field['wpcf-type'] . '_meta_box_form', $field );
 
540
  }
541
  }
542
  }
543
 
544
  /*
545
  * TODO Move to Conditional code
546
+ *
547
  * This is already checked. Use hook to add wrapper DIVS and apply CSS.
548
  */
549
  if ( !empty( $group['args']['_conditional_display'] ) ) {
562
 
563
  /**
564
  * Important save_post hook.
565
+ *
566
  * Core function. Works and stable. Do not move or change.
567
  * If required, add hooks only.
568
+ *
569
  * @internal breakpoint
570
  * @param type $post_ID
571
+ * @param type $post
572
  */
573
  function wpcf_admin_post_save_post_hook( $post_ID, $post )
574
  {
714
  do_action( 'wpcf_post_saved', $post_ID );
715
  return;
716
  }
717
+
718
+
719
+
720
  // OLD
721
+
722
  global $wpcf;
723
 
724
  // Basic cheks
743
  }
744
 
745
  /*
746
+ *
747
+ *
748
  * Get all groups connected to this $post
749
  */
750
  $groups = wpcf_admin_post_get_post_groups_fields( $post );
756
  $_error = false;
757
 
758
  /*
759
+ *
760
+ *
761
  * Loop over each group
762
+ *
763
  * TODO Document this
764
  * Connect 'wpcf-invalid-fields' with all fields
765
  */
800
  }
801
 
802
  /*
803
+ *
804
  * Allow interaction here.
805
  * Conditional will set $error to false if field is conditional
806
  * and not submitted.
807
  */
808
+ $error = apply_filters( 'wpcf_post_form_error', $_error, $_not_valid, $all_fields );
809
+ $not_valid = apply_filters( 'wpcf_post_form_not_valid', $_not_valid, $_error, $all_fields );
 
 
810
 
811
  // Notify user about error
812
  if ( $error ) {
822
  }
823
 
824
  /*
825
+ *
826
+ *
827
+ *
828
+ *
829
  * Save meta fields
830
  */
831
  if ( !empty( $_POST['wpcf'] ) ) {
854
 
855
 
856
  /*
857
+ *
858
+ *
859
  * Saving fields
860
  * @since 1.2
861
+ *
862
  * We changed way repetitive fields are saved.
863
  * On each save fields are rewritten and order is saved in
864
  * '_$slug-sort-order' meta field.
865
  */
866
 
867
  /*
868
+ *
869
  * We marked fields as repetitive in POST['__wpcf_repetitive']
870
  * Without this check we won't save any.
871
  * @see WPCF_Repeater::get_fields_form()
891
 
892
  /*
893
  * Process checkboxes
894
+ *
895
  * TODO Revise and remove
896
  * Since Types 1.1.5 we moved this check to embedded/includes/checkbox.php
897
  * checkbox.php added permanently to bootstrap.
926
  $update_data[$option_id] = $_POST['wpcf'][$field['wpcf-slug']][$option_id];
927
  }
928
  }
929
+ update_post_meta( $post_ID, wpcf_types_get_meta_prefix( $field ) . $field['wpcf-slug'], $update_data );
 
 
930
  }
931
  }
932
  }
940
  *
941
  * @internal breakpoint
942
  * @param type $post_ID
943
+ * @param type $post
944
  */
945
  function wpcf_admin_post_add_attachment_hook( $post_ID, $post )
946
  {
1048
 
1049
  /**
1050
  * Creates form elements.
1051
+ *
1052
  * Core function. Works and stable. Do not move or change.
1053
  * If required, add hooks only.
1054
+ *
1055
  * @param type $post
1056
  * @param type $fields
1057
+ * @return type
1058
  */
1059
  function wpcf_admin_post_process_fields( $post = false, $fields = array(),
1060
  $use_cache = true, $add_to_editor = true, $context = 'group' ) {
1082
  delete_post_meta( $post->ID, 'wpcf-invalid-fields' );
1083
 
1084
  /*
1085
+ *
1086
  * Add it to global $wpcf
1087
  * From now on take it there.
1088
  */
1107
  /*
1108
  * TODO All WPML specific code needs moving to
1109
  * /embedded/includes/wpml.php
1110
+ *
1111
  * @since Types 1.2
1112
  */
1113
  // TODO WPML move
1122
  } else {
1123
  // Set repeater
1124
  /*
1125
+ *
1126
+ *
1127
  * @since Types 1.2
1128
  * Now we're using repeater class to handle repetitive forms.
1129
  * Main change is - use form from $field_meta_box_form() without
1130
  * re-processing form elements.
1131
+ *
1132
  * Field should pass form as array:
1133
  * 'my_checkbox' => array('#type' => 'checkbox' ...),
1134
  * 'my_textfield' => array('#type' => 'textfield' ...),
1135
+ *
1136
  * In form it should set values to be stored.
1137
  * Use hooks to adjust saved data.
1138
  */
1140
  $fields_processed = $fields_processed + $wpcf->repeater->get_fields_form();
1141
  }
1142
  /*
1143
+ *
1144
+ *
1145
+ *
1146
+ *
1147
+ *
1148
+ *
1149
+ *
1150
+ *
1151
+ *
1152
+ *
1153
+ *
1154
+ *
1155
+ *
1156
+ *
1157
+ *
1158
  * Non-repetitive fields
1159
  */
1160
  } else {
1163
  * meta_form will be treated as normal form.
1164
  * See if any obstacles prevent us from using completed
1165
  * form from config files.
1166
+ *
1167
  * Main change is - use form from $field_meta_box_form() without
1168
  * re-processing form elements.
1169
+ *
1170
  * Field should pass form as array:
1171
  * 'my_checkbox' => array('#type' => 'checkbox' ...),
1172
  * 'my_textfield' => array('#type' => 'textfield' ...),
1173
+ *
1174
  * In form it should set values to be stored.
1175
  * Use hooks to adjust saved data.
1176
  */
1201
 
1202
  /**
1203
  * Processes single field.
1204
+ *
1205
  * Since Types 1.2 this function changed. It handles single form element.
1206
  * Form element is already fetched, also meta values using class WPCF_Field.
1207
+ *
1208
  * Core function. Works and stable. Do not move or change.
1209
  * If required, add hooks only.
1210
+ *
1211
  * @todo gradually remove usage of inherited fields
1212
  * @todo Cleanup
1213
+ *
1214
  * @staticvar array $repetitive_started
1215
  * @param type $field_object
1216
  * @return mixed boolean|array
1236
 
1237
  /*
1238
  * Get inherited field
1239
+ *
1240
  * TODO Deprecated
1241
+ *
1242
  * Since Types 1.2 we encourage developers to completely define fields.
1243
  */
1244
  $inherited_field_data = false;
1262
  /*
1263
  * CHECKPOINT
1264
  * APPLY FILTERS
1265
+ *
1266
+ *
1267
  * Moved to WPCF_Field
1268
  * Field value should be already filtered
1269
+ *
1270
  * Explanation:
1271
  * When WPCF_Field::set() is called, all these properties are set.
1272
  * WPCF_Field::$cf['value']
1273
  * WPCF_Field::$__meta (single value from DB)
1274
  * WPCF_Field::$meta (single or multiple values if single/repetitive)
1275
+ *
1276
  * TODO Make sure value is already filtered and not overwritten
1277
  */
1278
 
1279
  /*
1280
  * Set generic values
1281
+ *
1282
  * FUTURE BREAKPOINT
1283
  * Since Types 1.2 we do not encourage relying on generic field data.
1284
  * Only core fields should use this.
1285
+ *
1286
  * TODO Open 3rd party fields dir
1287
  */
1288
  $_element = array(
1298
 
1299
  /*
1300
  * TODO Add explanation about creating duplicated fields
1301
+ *
1302
  * NOT USED YET
1303
+ *
1304
  * Explain users that fields are added if slug is changed
1305
  */
1306
  wpcf_admin_add_js_settings( 'wpcfFieldNewInstanceWarning',
1308
 
1309
  /*
1310
  * Merge with default element
1311
+ *
1312
  * Deprecated from Types 1.2
1313
  * Only core fields use this.
1314
  */
1316
 
1317
 
1318
  /*
1319
+ *
1320
+ *
1321
+ *
1322
+ *
1323
+ *
1324
+ *
1325
+ *
1326
+ *
1327
+ *
1328
+ *
1329
+ *
1330
+ *
1331
+ *
1332
+ *
1333
+ *
1334
  * TODO From this point code should be simplified.
1335
  */
1336
 
1357
  // Set validation element
1358
  if ( isset( $field['data']['validate'] ) ) {
1359
  /*
1360
+ *
1361
+ *
1362
  * TODO First two check are not needed anymore
1363
  */
1364
  // If array has more than one field - see which one is marked
1424
  $element['#attributes']['class'] = isset( $element['#attributes']['class'] ) ? $element['#attributes']['class'] . ' wpcf-repetitive' : 'wpcf-repetitive';
1425
  }
1426
  /*
1427
+ *
1428
+ *
1429
  * Since Types 1.2 we allow same field values
1430
+ *
1431
  * TODO Remove
1432
+ *
1433
  * wpcf_admin_add_js_settings('wpcfFormRepetitiveUniqueValuesCheckText',
1434
  '\'' . __('Warning: same values set', 'wpcf') . '\'');
1435
  */
1508
 
1509
  /**
1510
  * Gets all groups and fields for post.
1511
+ *
1512
  * Core function. Works and stable. Do not move or change.
1513
  * If required, add hooks only.
1514
+ *
1515
  * @param type $post_ID
1516
+ * @return type
1517
  */
1518
  function wpcf_admin_post_get_post_groups_fields( $post = false,
1519
  $context = 'group' ) {
1520
 
1521
  // Get post_type
1522
  /*
1523
+ *
1524
+ *
1525
  * Since WP 3.5 | Types 1.2
1526
  * Looks like $post is altered with get_post_type()
1527
  * We do not want that if post is already set
1580
 
1581
  // Filter groups
1582
  $groups = array();
1583
+ $groups_all = apply_filters( 'wpcf_post_groups_all', wpcf_admin_fields_get_groups(), $post, $context );
 
1584
  foreach ( $groups_all as $temp_key => $temp_group ) {
1585
  if ( empty( $temp_group['is_active'] ) ) {
1586
  unset( $groups_all[$temp_key] );
1601
  $taxonomy_filter = $groups_all[$temp_key]['_wp_types_group_terms'][0] == 'all' ? -1 : 0;
1602
  $template_filter = $groups_all[$temp_key]['_wp_types_group_templates'][0] == 'all' ? -1 : 0;
1603
 
1604
+ $groups_all[$temp_key] = apply_filters( 'wpcf_post_group_filter_settings', $groups_all[$temp_key], $post, $context, $post->_wpcf_post_terms );
 
1605
 
1606
  // See if post type matches
1607
  if ( $post_type_filter == 0 && in_array( $post_type,
1655
 
1656
  /**
1657
  * Stores fields for editor menu.
1658
+ *
1659
  * Core function. Works and stable. Do not move or change.
1660
  * If required, add hooks only.
1661
+ *
1662
  * @staticvar array $fields
1663
  * @param type $field
1664
+ * @return array
1665
  */
1666
  function wpcf_admin_post_add_to_editor( $field ) {
1667
  static $fields = array();
1676
 
1677
  /**
1678
  * Renders JS for editor menu.
1679
+ *
1680
  * Core function. Works and stable. Do not move or change.
1681
  * If required, add hooks only.
1682
+ *
1683
+ * @return type
1684
  */
1685
  function wpcf_admin_post_add_to_editor_js() {
1686
 
1721
 
1722
  /**
1723
  * Adds items to view dropdown.
1724
+ *
1725
  * Core function. Works and stable. Do not move or change.
1726
  * If required, add hooks only.
1727
+ *
1728
  * @todo Remove (to WPCF_WPViews)
1729
+ *
1730
  * @param type $items
1731
+ * @return type
1732
  */
1733
  function wpcf_admin_post_editor_addon_menus_filter( $items ) {
1734
 
1831
 
1832
  /**
1833
  * Marketing meta-box
1834
+ *
1835
  * Core function. Works and stable. Do not move or change.
1836
  * If required, add hooks only.
1837
  */
1881
  array('auto-draft', 'draft') ) && !in_array( $post->post_type,
1882
  array('cred', 'view', 'view-template') ) ) {
1883
  // require_once WPCF_EMBEDDED_ABSPATH . '/common/wp-pointer.php';
1884
+ //
1885
  // $pointer = new WPV_wp_pointer('types-post-preview-warning');
1886
  // $pointer->add_pointer(__('Preview warning'),
1887
  // sprintf(__('Custom field changes cannot be previewed until %s is updated'), $post->post_type),
embedded/includes/fields.php CHANGED
@@ -2,12 +2,12 @@
2
 
3
  /**
4
  * Gets all groups.
5
- *
6
  * @global type $wpdb
7
  * @param string $post_type
8
  * @param boolean|string $only_active
9
  * @param boolean|string $add_fields - 'field_active', 'field_all', false (to omitt fields)
10
- * @return type
11
  */
12
  function wpcf_admin_fields_get_groups( $post_type = 'wp-types-group',
13
  $only_active = false, $add_fields = false ) {
@@ -35,12 +35,12 @@ function wpcf_admin_fields_get_groups( $post_type = 'wp-types-group',
35
 
36
  /**
37
  * Gets group by ID.
38
- *
39
  * Since 1.2 we enabled fetching by post title.
40
- *
41
  * @global type $wpdb
42
  * @param type $group_id
43
- * @return type
44
  */
45
  function wpcf_admin_fields_get_group( $group_id, $post_type = 'wp-types-group',
46
  $add_fields = false ) {
@@ -59,9 +59,9 @@ function wpcf_admin_fields_get_group( $group_id, $post_type = 'wp-types-group',
59
 
60
  /**
61
  * Converts post data.
62
- *
63
  * @param type $post
64
- * @return type
65
  */
66
  function wpcf_admin_fields_adjust_group( $post, $add_fields = false ) {
67
  if ( empty( $post ) ) {
@@ -90,10 +90,10 @@ function wpcf_admin_fields_adjust_group( $post, $add_fields = false ) {
90
 
91
  /**
92
  * Gets Fields Admin Styles supported by specific group.
93
- *
94
  * @global type $wpdb
95
  * @param type $group_id
96
- * @return type
97
  */
98
  function wpcf_admin_get_groups_admin_styles_by_group( $group_id ) {
99
  $admin_styles = get_post_meta( $group_id, '_wp_types_group_admin_styles',
@@ -103,10 +103,10 @@ function wpcf_admin_get_groups_admin_styles_by_group( $group_id ) {
103
 
104
  /**
105
  * Saves group's admin styles
106
- *
107
  * @global type $wpdb
108
  * @param type $group_id
109
- * @param type $padmin_styles
110
  */
111
  function wpcf_admin_fields_save_group_admin_styles( $group_id, $admin_styles ) {
112
  update_post_meta( $group_id, '_wp_types_group_admin_styles', $admin_styles );
@@ -114,10 +114,10 @@ function wpcf_admin_fields_save_group_admin_styles( $group_id, $admin_styles ) {
114
 
115
  /**
116
  * Gets all fields.
117
- *
118
  * @todo Move to WPCF_Fields
119
  * @global type $wpdb
120
- * @return type
121
  * added param $use_cache by Gen (used when adding new fields to group)
122
  */
123
  function wpcf_admin_fields_get_fields( $only_active = false,
@@ -180,7 +180,7 @@ function wpcf_admin_fields_get_fields( $only_active = false,
180
  }
181
  $v['id'] = $k;
182
  $v['meta_key'] = wpcf_types_get_meta_prefix( $v ) . $k;
183
- $v['meta_type'] = $option_name == 'wpcf-fields' ? 'postmeta' : 'usermeta';
184
  $fields[$k] = wpcf_sanitize_field( $v );
185
  }
186
  $cache[$cache_key] = apply_filters( 'types_fields', $fields );
@@ -190,11 +190,11 @@ function wpcf_admin_fields_get_fields( $only_active = false,
190
  /**
191
  * Gets field by ID.
192
  * Modified by Gen, 13.02.2013
193
- *
194
  * @global type $wpdb
195
  * @param type $field_id
196
  * @param type $only_active
197
- * @return type
198
  */
199
  function wpcf_admin_fields_get_field( $field_id, $only_active = false,
200
  $disabled_by_type = false, $strictly_active = false,
@@ -211,10 +211,10 @@ function wpcf_admin_fields_get_field( $field_id, $only_active = false,
211
  /**
212
  * Gets field by slug.
213
  * Modified by Gen, 13.02.2013
214
- *
215
  * @global type $wpdb
216
  * @param type $slug
217
- * @return type
218
  */
219
  function wpcf_fields_get_field_by_slug( $slug, $meta_name = 'wpcf-fields' ) {
220
  return wpcf_admin_fields_get_field( $slug, false, false, false, $meta_name );
@@ -222,7 +222,7 @@ function wpcf_fields_get_field_by_slug( $slug, $meta_name = 'wpcf-fields' ) {
222
 
223
  /**
224
  * Gets all fields that belong to specific group.
225
- *
226
  * @global type $wpdb
227
  * @param type $group_id
228
  * @param type $key
@@ -230,7 +230,7 @@ function wpcf_fields_get_field_by_slug( $slug, $meta_name = 'wpcf-fields' ) {
230
  * @param type $post_type
231
  * @param type $meta_name
232
  * @param type $use_cache
233
- * @return type
234
  */
235
  function wpcf_admin_fields_get_fields_by_group( $group_id, $key = 'slug',
236
  $only_active = false, $disabled_by_type = false,
@@ -263,12 +263,12 @@ function wpcf_admin_fields_get_fields_by_group( $group_id, $key = 'slug',
263
 
264
  /**
265
  * Gets groups that have specific term.
266
- *
267
  * @global type $wpdb
268
  * @param type $term_id
269
  * @param type $fetch_empty
270
  * @param type $only_active
271
- * @return type
272
  */
273
  function wpcf_admin_fields_get_groups_by_term( $term_id = false,
274
  $fetch_empty = true, $post_type = false, $only_active = true ) {
@@ -321,12 +321,12 @@ function wpcf_admin_fields_get_groups_by_term( $term_id = false,
321
 
322
  /**
323
  * Gets groups that have specific post_type.
324
- *
325
  * @global type $wpdb
326
  * @param type $post_type
327
  * @param type $fetch_empty
328
  * @param type $only_active
329
- * @return type
330
  */
331
  function wpcf_admin_get_groups_by_post_type( $post_type, $fetch_empty = true,
332
  $terms = null, $only_active = true ) {
@@ -414,12 +414,12 @@ function wpcf_admin_get_groups_by_post_type( $post_type, $fetch_empty = true,
414
 
415
  /**
416
  * Gets groups that have specific template.
417
- *
418
  * @global type $wpdb
419
  * @param type $post_type
420
  * @param type $fetch_empty
421
  * @param type $only_active
422
- * @return type
423
  */
424
  function wpcf_admin_get_groups_by_template( $templates = array('default'),
425
  $fetch_empty = true, $only_active = true ) {
@@ -487,10 +487,10 @@ function wpcf_get_fullpath_by_field_type($basename)
487
 
488
  /**
489
  * Loads type configuration file and calls action.
490
- *
491
  * @param type $type
492
  * @param type $action
493
- * @param type $args
494
  */
495
  function wpcf_fields_type_action( $type, $func = '', $args = array() ) {
496
  static $actions = array();
@@ -535,20 +535,19 @@ function wpcf_fields_type_action( $type, $func = '', $args = array() ) {
535
 
536
  /**
537
  * Returns shortcode for specified field.
538
- *
539
  * @param type $field
540
  * @param type $add Additional attributes
541
  * @param string $content
542
  */
543
- function wpcf_fields_get_shortcode( $field, $add = '', $content = '' ) {
 
544
  $shortcode = '[';
545
  $shortcode .= 'types field="' . $field['slug'] . '"' . $add;
546
  $shortcode .= ']' . $content . '[/types]';
547
  $shortcode = apply_filters( 'wpcf_fields_shortcode', $shortcode, $field );
548
- $shortcode = apply_filters( 'wpcf_fields_shortcode_type_' . $field['type'],
549
- $shortcode, $field );
550
- $shortcode = apply_filters( 'wpcf_fields_shortcode_slug_' . $field['slug'],
551
- $shortcode, $field );
552
  return $shortcode;
553
  }
554
 
@@ -561,7 +560,7 @@ function wpcf_admin_fields_get_available_types() {
561
 
562
  /**
563
  * Sanitizes field.
564
- *
565
  * @param type $field
566
  */
567
  function wpcf_sanitize_field( $field ) {
@@ -581,9 +580,9 @@ function wpcf_sanitize_field( $field ) {
581
 
582
  /**
583
  * Gets all groups that contain specified field.
584
- *
585
  * @static $cache
586
- * @param type $field_id
587
  */
588
  function wpcf_admin_fields_get_groups_by_field( $field_id,
589
  $post_type = 'wp-types-group' ) {
@@ -608,9 +607,9 @@ function wpcf_admin_fields_get_groups_by_field( $field_id,
608
 
609
  /**
610
  * Saves last field settings when inserting from toolbar.
611
- *
612
  * @param type $field_id
613
- * @param type $settings
614
  * @param type $append
615
  */
616
  function wpcf_admin_fields_save_field_last_settings( $field_id, $settings,
@@ -627,7 +626,7 @@ function wpcf_admin_fields_save_field_last_settings( $field_id, $settings,
627
 
628
  /**
629
  * Gets last field settings when inserting from toolbar.
630
- *
631
  * @param type $field_id
632
  */
633
  function wpcf_admin_fields_get_field_last_settings( $field_id ) {
2
 
3
  /**
4
  * Gets all groups.
5
+ *
6
  * @global type $wpdb
7
  * @param string $post_type
8
  * @param boolean|string $only_active
9
  * @param boolean|string $add_fields - 'field_active', 'field_all', false (to omitt fields)
10
+ * @return type
11
  */
12
  function wpcf_admin_fields_get_groups( $post_type = 'wp-types-group',
13
  $only_active = false, $add_fields = false ) {
35
 
36
  /**
37
  * Gets group by ID.
38
+ *
39
  * Since 1.2 we enabled fetching by post title.
40
+ *
41
  * @global type $wpdb
42
  * @param type $group_id
43
+ * @return type
44
  */
45
  function wpcf_admin_fields_get_group( $group_id, $post_type = 'wp-types-group',
46
  $add_fields = false ) {
59
 
60
  /**
61
  * Converts post data.
62
+ *
63
  * @param type $post
64
+ * @return type
65
  */
66
  function wpcf_admin_fields_adjust_group( $post, $add_fields = false ) {
67
  if ( empty( $post ) ) {
90
 
91
  /**
92
  * Gets Fields Admin Styles supported by specific group.
93
+ *
94
  * @global type $wpdb
95
  * @param type $group_id
96
+ * @return type
97
  */
98
  function wpcf_admin_get_groups_admin_styles_by_group( $group_id ) {
99
  $admin_styles = get_post_meta( $group_id, '_wp_types_group_admin_styles',
103
 
104
  /**
105
  * Saves group's admin styles
106
+ *
107
  * @global type $wpdb
108
  * @param type $group_id
109
+ * @param type $padmin_styles
110
  */
111
  function wpcf_admin_fields_save_group_admin_styles( $group_id, $admin_styles ) {
112
  update_post_meta( $group_id, '_wp_types_group_admin_styles', $admin_styles );
114
 
115
  /**
116
  * Gets all fields.
117
+ *
118
  * @todo Move to WPCF_Fields
119
  * @global type $wpdb
120
+ * @return type
121
  * added param $use_cache by Gen (used when adding new fields to group)
122
  */
123
  function wpcf_admin_fields_get_fields( $only_active = false,
180
  }
181
  $v['id'] = $k;
182
  $v['meta_key'] = wpcf_types_get_meta_prefix( $v ) . $k;
183
+ $v['meta_type'] = $option_name == 'wpcf-fields' ? 'postmeta' : 'usermeta';
184
  $fields[$k] = wpcf_sanitize_field( $v );
185
  }
186
  $cache[$cache_key] = apply_filters( 'types_fields', $fields );
190
  /**
191
  * Gets field by ID.
192
  * Modified by Gen, 13.02.2013
193
+ *
194
  * @global type $wpdb
195
  * @param type $field_id
196
  * @param type $only_active
197
+ * @return type
198
  */
199
  function wpcf_admin_fields_get_field( $field_id, $only_active = false,
200
  $disabled_by_type = false, $strictly_active = false,
211
  /**
212
  * Gets field by slug.
213
  * Modified by Gen, 13.02.2013
214
+ *
215
  * @global type $wpdb
216
  * @param type $slug
217
+ * @return type
218
  */
219
  function wpcf_fields_get_field_by_slug( $slug, $meta_name = 'wpcf-fields' ) {
220
  return wpcf_admin_fields_get_field( $slug, false, false, false, $meta_name );
222
 
223
  /**
224
  * Gets all fields that belong to specific group.
225
+ *
226
  * @global type $wpdb
227
  * @param type $group_id
228
  * @param type $key
230
  * @param type $post_type
231
  * @param type $meta_name
232
  * @param type $use_cache
233
+ * @return type
234
  */
235
  function wpcf_admin_fields_get_fields_by_group( $group_id, $key = 'slug',
236
  $only_active = false, $disabled_by_type = false,
263
 
264
  /**
265
  * Gets groups that have specific term.
266
+ *
267
  * @global type $wpdb
268
  * @param type $term_id
269
  * @param type $fetch_empty
270
  * @param type $only_active
271
+ * @return type
272
  */
273
  function wpcf_admin_fields_get_groups_by_term( $term_id = false,
274
  $fetch_empty = true, $post_type = false, $only_active = true ) {
321
 
322
  /**
323
  * Gets groups that have specific post_type.
324
+ *
325
  * @global type $wpdb
326
  * @param type $post_type
327
  * @param type $fetch_empty
328
  * @param type $only_active
329
+ * @return type
330
  */
331
  function wpcf_admin_get_groups_by_post_type( $post_type, $fetch_empty = true,
332
  $terms = null, $only_active = true ) {
414
 
415
  /**
416
  * Gets groups that have specific template.
417
+ *
418
  * @global type $wpdb
419
  * @param type $post_type
420
  * @param type $fetch_empty
421
  * @param type $only_active
422
+ * @return type
423
  */
424
  function wpcf_admin_get_groups_by_template( $templates = array('default'),
425
  $fetch_empty = true, $only_active = true ) {
487
 
488
  /**
489
  * Loads type configuration file and calls action.
490
+ *
491
  * @param type $type
492
  * @param type $action
493
+ * @param type $args
494
  */
495
  function wpcf_fields_type_action( $type, $func = '', $args = array() ) {
496
  static $actions = array();
535
 
536
  /**
537
  * Returns shortcode for specified field.
538
+ *
539
  * @param type $field
540
  * @param type $add Additional attributes
541
  * @param string $content
542
  */
543
+ function wpcf_fields_get_shortcode( $field, $add = '', $content = '' )
544
+ {
545
  $shortcode = '[';
546
  $shortcode .= 'types field="' . $field['slug'] . '"' . $add;
547
  $shortcode .= ']' . $content . '[/types]';
548
  $shortcode = apply_filters( 'wpcf_fields_shortcode', $shortcode, $field );
549
+ $shortcode = apply_filters( 'wpcf_fields_shortcode_type_' . $field['type'], $shortcode, $field );
550
+ $shortcode = apply_filters( 'wpcf_fields_shortcode_slug_' . $field['slug'], $shortcode, $field );
 
 
551
  return $shortcode;
552
  }
553
 
560
 
561
  /**
562
  * Sanitizes field.
563
+ *
564
  * @param type $field
565
  */
566
  function wpcf_sanitize_field( $field ) {
580
 
581
  /**
582
  * Gets all groups that contain specified field.
583
+ *
584
  * @static $cache
585
+ * @param type $field_id
586
  */
587
  function wpcf_admin_fields_get_groups_by_field( $field_id,
588
  $post_type = 'wp-types-group' ) {
607
 
608
  /**
609
  * Saves last field settings when inserting from toolbar.
610
+ *
611
  * @param type $field_id
612
+ * @param type $settings
613
  * @param type $append
614
  */
615
  function wpcf_admin_fields_save_field_last_settings( $field_id, $settings,
626
 
627
  /**
628
  * Gets last field settings when inserting from toolbar.
629
+ *
630
  * @param type $field_id
631
  */
632
  function wpcf_admin_fields_get_field_last_settings( $field_id ) {
embedded/includes/fields/audio.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  *
4
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/includes/fields/audio.php $
5
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
6
- * $LastChangedRevision: 1012704 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
1
  <?php
2
  /**
3
  *
4
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/includes/fields/audio.php $
5
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
6
+ * $LastChangedRevision: 1027712 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
embedded/includes/fields/checkbox.php CHANGED
@@ -1,292 +1,410 @@
1
- <?php
2
- /**
3
- *
4
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/includes/fields/checkbox.php $
5
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
6
- * $LastChangedRevision: 1012704 $
7
- * $LastChangedBy: iworks $
8
- *
9
- */
10
-
11
- add_action( 'save_post', 'wpcf_fields_checkbox_save_check', 15, 1 );
12
- add_action( 'edit_attachment', 'wpcf_fields_checkbox_save_check', 15, 1 );
13
-
14
- /**
15
- * Register data (called automatically).
16
- *
17
- * @return type
18
- */
19
- function wpcf_fields_checkbox() {
20
- return array(
21
- 'id' => 'wpcf-checkbox',
22
- 'title' => __( 'Checkbox', 'wpcf' ),
23
- 'description' => __( 'Checkbox', 'wpcf' ),
24
- 'validate' => array('required'),
25
- 'meta_key_type' => 'BINARY',
26
- );
27
- }
28
-
29
- /**
30
- * Form data for post edit page.
31
- *
32
- * @param type $field
33
- */
34
- function wpcf_fields_checkbox_meta_box_form( $field, $field_object ) {
35
- global $wpcf;
36
- $checked = false;
37
- $field['data']['set_value'] = stripslashes( $field['data']['set_value'] );
38
- if ( $field['value'] == $field['data']['set_value'] ) {
39
- $checked = true;
40
- }
41
- // If post is new check if it's checked by default
42
- global $pagenow;
43
- if ( $pagenow == 'post-new.php' && !empty( $field['data']['checked'] ) ) {
44
- $checked = true;
45
- }
46
- // This means post is new
47
- if ( !isset( $field_object->post->ID ) ) {
48
- $field_object->post = (object) array('ID' => 0);
49
- }
50
- return array(
51
- '#type' => 'checkbox',
52
- '#value' => $field['data']['set_value'],
53
- '#default_value' => $checked,
54
- '#after' => '<input type="hidden" name="_wpcf_check_checkbox['
55
- . $field_object->post->ID . '][' . $field_object->slug
56
- . ']" value="1" />',
57
- );
58
- }
59
-
60
- /**
61
- * Editor callback form.
62
- */
63
- function wpcf_fields_checkbox_editor_callback( $field, $settings ) {
64
-
65
- $value_not_selected = '';
66
- $value_selected = '';
67
-
68
- if ( isset( $field['data']['display_value_not_selected'] ) ) {
69
- $value_not_selected = $field['data']['display_value_not_selected'];
70
- }
71
- if ( isset( $field['data']['display_value_selected'] ) ) {
72
- $value_selected = $field['data']['display_value_selected'];
73
- }
74
-
75
- $data = array_merge( array(
76
- 'selected' => WPCF_Editor::sanitizeParams( $value_selected ),
77
- 'not_selected' => WPCF_Editor::sanitizeParams( $value_not_selected ),
78
- ), $settings );
79
-
80
- return array(
81
- 'supports' => array('style'),
82
- 'tabs' => array(
83
- 'display' => array(
84
- 'menu_title' => __( 'Display', 'wpcf' ),
85
- 'title' => __( 'Display', 'wpcf' ),
86
- 'content' => WPCF_Loader::template( 'editor-modal-checkbox',
87
- $data ),
88
- )
89
- ),
90
- );
91
- }
92
-
93
- /**
94
- * Editor callback form submit.
95
- */
96
- function wpcf_fields_checkbox_editor_submit( $data, $field, $context ) {
97
- $add = '';
98
- $types_attr = 'field';
99
- if ( $context == 'usermeta' ) {
100
- $add .= wpcf_get_usermeta_form_addon_submit();
101
- $types_attr = 'usermeta';
102
- }
103
-
104
- if ( isset($data['display']) && $data['display'] == 'value' ) {
105
-
106
- $checked_add = $add . ' state="checked"';
107
- $unchecked_add = $add . ' state="unchecked"';
108
-
109
- if ( $context == 'usermeta' ) {
110
- $shortcode_checked = wpcf_usermeta_get_shortcode( $field,
111
- $checked_add, $data['selected'] );
112
- $shortcode_unchecked = wpcf_usermeta_get_shortcode( $field,
113
- $unchecked_add, $data['not_selected'] );
114
- } else {
115
- $shortcode_checked = wpcf_fields_get_shortcode( $field,
116
- $checked_add, $data['selected'] );
117
- $shortcode_unchecked = wpcf_fields_get_shortcode( $field,
118
- $unchecked_add, $data['not_selected'] );
119
- }
120
- $shortcode = $shortcode_checked . $shortcode_unchecked;
121
- } else {
122
- if ( $context == 'usermeta' ) {
123
- $shortcode = wpcf_usermeta_get_shortcode( $field, $add );
124
- } else {
125
- $shortcode = wpcf_fields_get_shortcode( $field, $add );
126
- }
127
- }
128
-
129
- return $shortcode;
130
-
131
- }
132
-
133
- /**
134
- * View function.
135
- *
136
- * @param type $params
137
- */
138
- function wpcf_fields_checkbox_view( $params ) {
139
- $output = '';
140
- $option_name = 'wpcf-fields';
141
- if ( isset( $params['usermeta'] ) && !empty( $params['usermeta'] ) ) {
142
- $option_name = 'wpcf-usermeta';
143
- }
144
- if ( isset( $params['option_name'] ) ) {
145
- $option_name = $params['option_name'];
146
- }
147
- if ( isset( $params['state'] )
148
- && $params['state'] == 'unchecked'
149
- && empty( $params['field_value'] ) ) {
150
- if ( empty( $params['#content'] ) ) {
151
- return '__wpcf_skip_empty';
152
- }
153
- return htmlspecialchars_decode( $params['#content'] );
154
- } else if ( isset( $params['state'] ) && $params['state'] == 'unchecked' ) {
155
- return '__wpcf_skip_empty';
156
- }
157
-
158
- if ( isset( $params['state'] ) && $params['state'] == 'checked' && !empty( $params['field_value'] ) ) {
159
- if ( empty( $params['#content'] ) ) {
160
- return '__wpcf_skip_empty';
161
- }
162
- return htmlspecialchars_decode( $params['#content'] );
163
- } else if ( isset( $params['state'] ) && $params['state'] == 'checked' ) {
164
- return '__wpcf_skip_empty';
165
- }
166
- if ( !empty( $params['#content'] )
167
- && !empty( $params['field_value'] ) ) {
168
- return htmlspecialchars_decode( $params['#content'] );
169
- }
170
-
171
- // Check if 'save_empty' is yes and if value is 0 - set value to empty string
172
- if ( isset( $params['field']['data']['save_empty'] )
173
- && $params['field']['data']['save_empty'] == 'yes'
174
- && $params['field_value'] == '0' ) {
175
- $params['field_value'] = '';
176
- }
177
-
178
- if ( $params['field']['data']['display'] == 'db' && $params['field_value'] != '' ) {
179
- $field = wpcf_fields_get_field_by_slug( $params['field']['slug'],
180
- $option_name );
181
- $output = $field['data']['set_value'];
182
-
183
- // Show the translated value if we have one.
184
- $output = wpcf_translate( 'field ' . $field['id'] . ' checkbox value',
185
- $output );
186
- } else if ( $params['field']['data']['display'] == 'value'
187
- && $params['field_value'] != '' ) {
188
- if ( !empty( $params['field']['data']['display_value_selected'] ) ) {
189
- $output = $params['field']['data']['display_value_selected'];
190
- $output = wpcf_translate( 'field ' . $params['field']['id'] . ' checkbox value selected',
191
- $output );
192
- }
193
- } else if ( $params['field']['data']['display'] == 'value'
194
- && !empty( $params['field']['data']['display_value_not_selected'] ) ) {
195
- $output = $params['field']['data']['display_value_not_selected'];
196
- $output = wpcf_translate( 'field ' . $params['field']['id'] . ' checkbox value not selected', $output );
197
- } else {
198
- return '__wpcf_skip_empty';
199
- }
200
-
201
- return $output;
202
- }
203
-
204
- /**
205
- * Check if checkbox is submitted.
206
- *
207
- * Currently used on Relationship saving. May be expanded to general code.
208
- *
209
- * @param type $post_id
210
- */
211
- function wpcf_fields_checkbox_save_check( $post_id ) {
212
-
213
- $meta_to_unset = array();
214
- $cf = new WPCF_Field();
215
-
216
- /*
217
- *
218
- * We hve several calls on this:
219
- * 1. Saving post with Update
220
- * 2. Saving all children
221
- * 3. Saving child
222
- */
223
-
224
- $mode = 'save_main';
225
- if ( defined( 'DOING_AJAX' ) ) {
226
- if ( isset( $_GET['wpcf_action'] )
227
- && $_GET['wpcf_action'] == 'pr_save_all' ) {
228
- $mode = 'save_all';
229
- } else if ( isset( $_GET['wpcf_action'] )
230
- && $_GET['wpcf_action'] == 'pr_save_child_post' ) {
231
- $mode = 'save_child';
232
- }
233
- }
234
-
235
- // See if any marked for checking
236
- if ( isset( $_POST['_wpcf_check_checkbox'] ) ) {
237
-
238
- // Loop and search in $_POST
239
- foreach ( $_POST['_wpcf_check_checkbox'] as $child_id => $slugs ) {
240
- foreach ( $slugs as $slug => $true ) {
241
-
242
- $cf->set( $child_id, $cf->__get_slug_no_prefix( $slug ) );
243
-
244
- // First check main post
245
- if ( $mode == 'save_main'
246
- && intval( $child_id ) == wpcf_get_post_id() ) {
247
- if ( !isset( $_POST['wpcf'][$cf->cf['slug']] ) ) {
248
- $meta_to_unset[intval( $child_id )][$cf->slug] = true;
249
- }
250
- continue;
251
- }
252
-
253
- // If new post
254
- if ( $mode == 'save_main' && $child_id == 0 ) {
255
- if ( !isset( $_POST['wpcf'][$cf->cf['slug']] ) ) {
256
- $meta_to_unset[$post_id][$cf->slug] = true;
257
- }
258
- continue;
259
- }
260
- /**
261
- * Relationship check
262
- */
263
- if ( $mode == 'save_main' ) {
264
- if ( !isset( $_POST['wpcf'][$cf->cf['slug']] ) ) {
265
- $meta_to_unset[$post_id][$cf->slug] = true;
266
- }
267
- continue;
268
- } else if ( !empty( $_POST['wpcf_post_relationship'] ) ) {
269
- foreach ( $_POST['wpcf_post_relationship'] as $_parent => $_children ) {
270
- foreach ( $_children as $_child_id => $_slugs ) {
271
- if ( !isset( $_slugs[$slug] ) ) {
272
- $meta_to_unset[$_child_id][$cf->slug] = true;
273
- }
274
- }
275
- }
276
- }
277
- }
278
- }
279
- }
280
-
281
- // After collected - delete them
282
- foreach ( $meta_to_unset as $child_id => $slugs ) {
283
- foreach ( $slugs as $slug => $true ) {
284
- $cf->set( $child_id, $cf->__get_slug_no_prefix( $slug ) );
285
- if ( $cf->cf['data']['save_empty'] != 'no' ) {
286
- update_post_meta( $child_id, $slug, 0 );
287
- } else {
288
- delete_post_meta( $child_id, $slug );
289
- }
290
- }
291
- }
292
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/includes/fields/checkbox.php $
5
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
6
+ * $LastChangedRevision: 1027712 $
7
+ * $LastChangedBy: iworks $
8
+ *
9
+ */
10
+
11
+ add_action( 'save_post', 'wpcf_fields_checkbox_save_check', 15, 1 );
12
+ add_action( 'edit_attachment', 'wpcf_fields_checkbox_save_check', 15, 1 );
13
+
14
+ /**
15
+ * Register data (called automatically).
16
+ *
17
+ * @return type
18
+ */
19
+ function wpcf_fields_checkbox()
20
+ {
21
+ return array(
22
+ 'id' => 'wpcf-checkbox',
23
+ 'title' => __( 'Checkbox', 'wpcf' ),
24
+ 'description' => __( 'Checkbox', 'wpcf' ),
25
+ 'validate' => array('required'),
26
+ 'meta_key_type' => 'BINARY',
27
+ );
28
+ }
29
+
30
+ /**
31
+ * Form data for post edit page.
32
+ *
33
+ * @param type $field
34
+ */
35
+ function wpcf_fields_checkbox_meta_box_form($field, $field_object)
36
+ {
37
+ global $wpcf;
38
+ $checked = false;
39
+
40
+ /**
41
+ * sanitize set_value
42
+ */
43
+ if ( array_key_exists('set_value', $field['data'] ) ) {
44
+ $field['data']['set_value'] = stripslashes( $field['data']['set_value'] );
45
+ } else {
46
+ $field['data']['set_value'] = null;
47
+ }
48
+
49
+ if ( $field['value'] == $field['data']['set_value'] ) {
50
+ $checked = true;
51
+ }
52
+ // If post is new check if it's checked by default
53
+ global $pagenow;
54
+ if ( $pagenow == 'post-new.php' && !empty( $field['data']['checked'] ) ) {
55
+ $checked = true;
56
+ }
57
+ // This means post is new
58
+ if ( !isset( $field_object->post->ID ) ) {
59
+ $field_object->post = (object) array('ID' => 0);
60
+ }
61
+ return array(
62
+ '#type' => 'checkbox',
63
+ '#value' => $field['data']['set_value'],
64
+ '#default_value' => $checked,
65
+ '#after' => '<input type="hidden" name="_wpcf_check_checkbox['
66
+ . $field_object->post->ID . '][' . $field_object->slug
67
+ . ']" value="1" />',
68
+ );
69
+ }
70
+
71
+ /**
72
+ * Editor callback form.
73
+ */
74
+ function wpcf_fields_checkbox_editor_callback($field, $settings)
75
+ {
76
+ $value_not_selected = '';
77
+ $value_selected = '';
78
+
79
+ if ( isset( $field['data']['display_value_not_selected'] ) ) {
80
+ $value_not_selected = $field['data']['display_value_not_selected'];
81
+ }
82
+ if ( isset( $field['data']['display_value_selected'] ) ) {
83
+ $value_selected = $field['data']['display_value_selected'];
84
+ }
85
+
86
+ $data = array_merge( array(
87
+ 'selected' => WPCF_Editor::sanitizeParams( $value_selected ),
88
+ 'not_selected' => WPCF_Editor::sanitizeParams( $value_not_selected ),
89
+ ), $settings );
90
+
91
+ return array(
92
+ 'supports' => array('style'),
93
+ 'tabs' => array(
94
+ 'display' => array(
95
+ 'menu_title' => __( 'Display', 'wpcf' ),
96
+ 'title' => __( 'Display', 'wpcf' ),
97
+ 'content' => WPCF_Loader::template( 'editor-modal-checkbox',
98
+ $data ),
99
+ )
100
+ ),
101
+ );
102
+ }
103
+
104
+ /**
105
+ * Editor callback form submit.
106
+ */
107
+ function wpcf_fields_checkbox_editor_submit($data, $field, $context)
108
+ {
109
+ $add = '';
110
+ $types_attr = 'field';
111
+ if ( $context == 'usermeta' ) {
112
+ $add .= wpcf_get_usermeta_form_addon_submit();
113
+ $types_attr = 'usermeta';
114
+ }
115
+
116
+ if ( isset($data['display']) && $data['display'] == 'value' ) {
117
+
118
+ $checked_add = $add . ' state="checked"';
119
+ $unchecked_add = $add . ' state="unchecked"';
120
+
121
+ if ( $context == 'usermeta' ) {
122
+ $shortcode_checked = wpcf_usermeta_get_shortcode( $field,
123
+ $checked_add, $data['selected'] );
124
+ $shortcode_unchecked = wpcf_usermeta_get_shortcode( $field,
125
+ $unchecked_add, $data['not_selected'] );
126
+ } else {
127
+ $shortcode_checked = wpcf_fields_get_shortcode( $field,
128
+ $checked_add, $data['selected'] );
129
+ $shortcode_unchecked = wpcf_fields_get_shortcode( $field,
130
+ $unchecked_add, $data['not_selected'] );
131
+ }
132
+ $shortcode = $shortcode_checked . $shortcode_unchecked;
133
+ } else {
134
+ if ( $context == 'usermeta' ) {
135
+ $shortcode = wpcf_usermeta_get_shortcode( $field, $add );
136
+ } else {
137
+ $shortcode = wpcf_fields_get_shortcode( $field, $add );
138
+ }
139
+ }
140
+
141
+ return $shortcode;
142
+
143
+ }
144
+
145
+ /**
146
+ * View function.
147
+ *
148
+ * @param type $params
149
+ */
150
+ function wpcf_fields_checkbox_view($params)
151
+ {
152
+ $output = '';
153
+ $option_name = 'wpcf-fields';
154
+ if ( isset( $params['usermeta'] ) && !empty( $params['usermeta'] ) ) {
155
+ $option_name = 'wpcf-usermeta';
156
+ }
157
+ if ( isset( $params['option_name'] ) ) {
158
+ $option_name = $params['option_name'];
159
+ }
160
+ if ( isset( $params['state'] )
161
+ && $params['state'] == 'unchecked'
162
+ && empty( $params['field_value'] ) ) {
163
+ if ( empty( $params['#content'] ) ) {
164
+ return '__wpcf_skip_empty';
165
+ }
166
+ return htmlspecialchars_decode( $params['#content'] );
167
+ } elseif ( isset( $params['state'] ) && $params['state'] == 'unchecked' ) {
168
+ return '__wpcf_skip_empty';
169
+ }
170
+
171
+ if ( isset( $params['state'] ) && $params['state'] == 'checked' && !empty( $params['field_value'] ) ) {
172
+ if ( empty( $params['#content'] ) ) {
173
+ return '__wpcf_skip_empty';
174
+ }
175
+ return htmlspecialchars_decode( $params['#content'] );
176
+ } elseif ( isset( $params['state'] ) && $params['state'] == 'checked' ) {
177
+ return '__wpcf_skip_empty';
178
+ }
179
+ if ( !empty( $params['#content'] )
180
+ && !empty( $params['field_value'] ) ) {
181
+ return htmlspecialchars_decode( $params['#content'] );
182
+ }
183
+
184
+ // Check if 'save_empty' is yes and if value is 0 - set value to empty string
185
+ if (
186
+ isset( $params['field']['data']['save_empty'] )
187
+ && $params['field']['data']['save_empty'] == 'yes'
188
+ && $params['field_value'] == '0'
189
+ && 'db' != $params['field']['data']['display']
190
+ ) {
191
+ $params['field_value'] = '';
192
+ }
193
+
194
+ if (
195
+ 'db' == $params['field']['data']['display']
196
+ && $params['field_value'] != ''
197
+ ) {
198
+ $output = $params['field_value'];
199
+ // Show the translated value if we have one.
200
+ $field = wpcf_fields_get_field_by_slug( $params['field']['slug'], $option_name );
201
+ $output = wpcf_translate( 'field ' . $field['id'] . ' checkbox value', $output );
202
+ } elseif ( $params['field']['data']['display'] == 'value'
203
+ && $params['field_value'] != '' ) {
204
+ if ( !empty( $params['field']['data']['display_value_selected'] ) ) {
205
+ $output = $params['field']['data']['display_value_selected'];
206
+ $output = wpcf_translate( 'field ' . $params['field']['id'] . ' checkbox value selected',
207
+ $output );
208
+ }
209
+ } elseif ( $params['field']['data']['display'] == 'value'
210
+ && !empty( $params['field']['data']['display_value_not_selected'] ) ) {
211
+ $output = $params['field']['data']['display_value_not_selected'];
212
+ $output = wpcf_translate( 'field ' . $params['field']['id'] . ' checkbox value not selected', $output );
213
+ } else {
214
+ return '__wpcf_skip_empty';
215
+ }
216
+
217
+ return $output;
218
+ }
219
+
220
+ /**
221
+ * Check if checkbox is submitted.
222
+ *
223
+ * Currently used on Relationship saving. May be expanded to general code.
224
+ *
225
+ * @param type $post_id
226
+ */
227
+ function wpcf_fields_checkbox_save_check($post_id)
228
+ {
229
+ $meta_to_unset = array();
230
+ $meta_to_unset[$post_id] = array();
231
+ $cf = new WPCF_Field();
232
+
233
+ /*
234
+ *
235
+ * We hve several calls on this:
236
+ * 1. Saving post with Update
237
+ * 2. Saving all children
238
+ * 3. Saving child
239
+ */
240
+
241
+ $mode = 'save_main';
242
+ if ( defined( 'DOING_AJAX' ) && isset( $_GET['wpcf_action']) ) {
243
+ switch ( $_GET['wpcf_action']) {
244
+ case 'pr_save_all':
245
+ $mode = 'save_all';
246
+ break;
247
+ case 'pr_save_child_post':
248
+ $mode = 'save_child';
249
+ break;
250
+ }
251
+ }
252
+
253
+ /**
254
+ * update edited post chechboxes
255
+ */
256
+ switch( $mode ) {
257
+ case 'save_main':
258
+ if( isset($_POST['_wptoolset_checkbox']) ){
259
+ foreach ( array_keys( $_POST['_wptoolset_checkbox'] ) as $slug ) {
260
+ if ( array_key_exists( 'wpcf', $_POST ) ) {
261
+ wpcf_fields_checkbox_update_one( $post_id, $slug, $_POST['wpcf'] );
262
+ } else {
263
+ $slug_without_form = preg_replace( '/cred_form_\d+_\d+_/', '', $slug);
264
+ wpcf_fields_checkbox_update_one( $post_id, $slug_without_form, $_POST );
265
+ }
266
+ }
267
+ }
268
+ return;
269
+ case 'save_child':
270
+ case 'save_all':
271
+ if ( !array_key_exists('_wptoolset_checkbox', $_POST) ) {
272
+ break;
273
+ }
274
+ foreach(array_keys($_POST['wpcf_post_relationship']) as $post_id) {
275
+ /**
276
+ * sanitize and check variable
277
+ */
278
+ $post_id = intval($post_id);
279
+ if (0==$post_id) {
280
+ continue;
281
+ }
282
+ /**
283
+ * stop if do not exist arary key
284
+ */
285
+ if ( !array_key_exists($post_id, $_POST['wpcf_post_relationship']) ) {
286
+ continue;
287
+ }
288
+ /**
289
+ * stop if array is empty
290
+ */
291
+ if (!count($_POST['wpcf_post_relationship'][$post_id])) {
292
+ continue;
293
+ }
294
+ /**
295
+ * prepare children id
296
+ */
297
+ $children = array();
298
+ foreach(array_keys($_POST['wpcf_post_relationship'][$post_id]) as $child_id) {
299
+ $children[] = $child_id;
300
+ }
301
+ $re = sprintf('/\-(%s)$/', implode('|', $children));
302
+ $checkboxes = array();
303
+ foreach(array_keys($_POST['_wptoolset_checkbox']) as $key) {
304
+ $checkboxes[] = preg_replace($re, '', $key);
305
+ }
306
+ foreach( $children as $child_id ) {
307
+ foreach( array_unique($checkboxes) as $slug ) {
308
+ wpcf_fields_checkbox_update_one($child_id, $slug, $_POST['wpcf_post_relationship'][$post_id][$child_id]);
309
+ }
310
+ }
311
+ }
312
+ break;
313
+ }
314
+
315
+ // See if any marked for checking
316
+ if ( isset( $_POST['_wpcf_check_checkbox'] ) ) {
317
+
318
+ // Loop and search in $_POST
319
+ foreach ( $_POST['_wpcf_check_checkbox'] as $child_id => $slugs ) {
320
+ foreach ( $slugs as $slug => $true ) {
321
+
322
+ $cf->set( $child_id, $cf->__get_slug_no_prefix( $slug ) );
323
+
324
+ // First check main post
325
+ if ( $mode == 'save_main'
326
+ && intval( $child_id ) == wpcf_get_post_id() ) {
327
+ if ( !isset( $_POST['wpcf'][$cf->cf['slug']] ) ) {
328
+ $meta_to_unset[intval( $child_id )][$cf->slug] = true;
329
+ }
330
+ continue;
331
+ }
332
+
333
+ // If new post
334
+ if ( $mode == 'save_main' && $child_id == 0 ) {
335
+ if ( !isset( $_POST['wpcf'][$cf->cf['slug']] ) ) {
336
+ $meta_to_unset[$post_id][$cf->slug] = true;
337
+ }
338
+ continue;
339
+ }
340
+ /**
341
+ * Relationship check
342
+ */
343
+ if ( $mode == 'save_main' ) {
344
+ if ( !isset( $_POST['wpcf'][$cf->cf['slug']] ) ) {
345
+ $meta_to_unset[$post_id][$cf->slug] = true;
346
+ }
347
+ continue;
348
+ } elseif ( !empty( $_POST['wpcf_post_relationship'] ) ) {
349
+ foreach ( $_POST['wpcf_post_relationship'] as $_parent => $_children ) {
350
+ foreach ( $_children as $_child_id => $_slugs ) {
351
+ if ( !isset( $_slugs[$slug] ) ) {
352
+ $meta_to_unset[$_child_id][$cf->slug] = true;
353
+ }
354
+ }
355
+ }
356
+ }
357
+ }
358
+ }
359
+ }
360
+
361
+ // After collected - delete them
362
+ foreach ( $meta_to_unset as $child_id => $slugs ) {
363
+ foreach ( $slugs as $slug => $true ) {
364
+ $cf->set( $child_id, $cf->__get_slug_no_prefix( $slug ) );
365
+ if ( $cf->cf['data']['save_empty'] != 'no' ) {
366
+ update_post_meta( $child_id, $slug, 0 );
367
+ } else {
368
+ delete_post_meta( $child_id, $slug );
369
+ }
370
+ }
371
+ }
372
+ }
373
+
374
+ function wpcf_fields_checkbox_update_one($post_id, $slug, $array_to_check)
375
+ {
376
+ $cf = new WPCF_Field();
377
+ $cf->set( $post_id, $cf->__get_slug_no_prefix( $slug ) );
378
+ /**
379
+ * return if field do not exists
380
+ */
381
+ if ( !array_key_exists( 'data', $cf->cf ) ) {
382
+ return;
383
+ }
384
+ if ( 'checkbox' == $cf->cf['type'] ) {
385
+ if (
386
+ isset( $array_to_check[$cf->__get_slug_no_prefix( $slug )] )
387
+ || isset( $array_to_check[$slug] )
388
+ ) {
389
+ update_post_meta( $post_id, $slug, $cf->cf['data']['set_value'] );
390
+ return;
391
+ }
392
+ $cf->set( $post_id, $cf->__get_slug_no_prefix( $slug ) );
393
+ if ( $cf->cf['data']['save_empty'] != 'no' ) {
394
+ update_post_meta( $post_id, $cf->slug, 0 );
395
+ } else {
396
+ delete_post_meta( $post_id, $cf->slug );
397
+ }
398
+ } else if ( 'checkboxes' == $cf->cf['type'] ) {
399
+ $value = array();
400
+ if ( isset( $array_to_check[$cf->__get_slug_no_prefix( $slug )] )) {
401
+ foreach($array_to_check[$cf->__get_slug_no_prefix($slug)] as $key => $val ) {
402
+ if ( isset( $cf->cf['data']['options'])) {
403
+ $value[$key] = $val;
404
+ }
405
+ }
406
+ }
407
+ update_post_meta( $post_id, $cf->slug, $value );
408
+ }
409
+ }
410
+
embedded/includes/fields/date.php CHANGED
@@ -318,6 +318,14 @@ function wpcf_fields_date_value_get_filter( $value, $field, $return = 'array',
318
  * Consider this already parsed
319
  * but check anyway.
320
  */
 
 
 
 
 
 
 
 
321
  $value = wpcf_fields_date_value_check( $value );
322
  } else {
323
  $value = array(
@@ -380,6 +388,15 @@ function wpcf_fields_date_view( $params ) {
380
  $output .= wpcf_fields_date_get_calendar( $params, true, false );
381
  break;
382
 
 
 
 
 
 
 
 
 
 
383
  default:
384
  $field_name = '';
385
 
318
  * Consider this already parsed
319
  * but check anyway.
320
  */
321
+ if (
322
+ array_key_exists('datepicker', $value)
323
+ && !array_key_exists('timestamp', $value)
324
+ && preg_match( '/^\d+$/', $value['datepicker'] )
325
+ ) {
326
+ $value['timestamp'] = $value['datepicker'];
327
+ unset($value['datepicker']);
328
+ }
329
  $value = wpcf_fields_date_value_check( $value );
330
  } else {
331
  $value = array(
388
  $output .= wpcf_fields_date_get_calendar( $params, true, false );
389
  break;
390
 
391
+ case 'human-time-diff':
392
+ $date_out = human_time_diff($params['field_value']);
393
+ if ( $params['field_value'] < time() ) {
394
+ $output .= sprintf( __('%s ago', 'wpcf'), $date_out);;
395
+ } else {
396
+ $output .= sprintf( __('%s to go', 'wpcf'), $date_out);;
397
+ }
398
+ break;
399
+
400
  default:
401
  $field_name = '';
402
 
embedded/includes/fields/file.php CHANGED
@@ -1,10 +1,10 @@
1
  <?php
2
  /*
3
  *
4
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/includes/fields/file.php $
5
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
6
- * $LastChangedRevision: 1012704 $
7
- * $LastChangedBy: iworks $
8
  *
9
  */
10
  /**
1
  <?php
2
  /*
3
  *
4
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/includes/fields/file.php $
5
+ * $LastChangedDate: 2014-08-22 01:02:43 +0000 (Fri, 22 Aug 2014) $
6
+ * $LastChangedRevision: 970205 $
7
+ * $LastChangedBy: brucepearson $
8
  *
9
  */
10
  /**
embedded/includes/fields/image.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  *
4
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/includes/fields/image.php $
5
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
6
- * $LastChangedRevision: 1012704 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
@@ -224,7 +224,7 @@ function wpcf_fields_image_editor_submit( $data, $field, $context ) {
224
  $add .= ' onload="' . $data['onload'] . '"';
225
  }
226
 
227
- if ( $data['image_size'] != 'full' ) {
228
  if ( !empty( $data['proportional'] ) ) {
229
  $settings['resize'] = isset( $data['resize'] ) ? $data['resize'] : 'proportional';
230
  $add .= " resize=\"{$settings['resize']}\"";
1
  <?php
2
  /**
3
  *
4
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/includes/fields/image.php $
5
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
6
+ * $LastChangedRevision: 1027712 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
224
  $add .= ' onload="' . $data['onload'] . '"';
225
  }
226
 
227
+ if ( array_key_exists('image_size', $data) && $data['image_size'] != 'full' ) {
228
  if ( !empty( $data['proportional'] ) ) {
229
  $settings['resize'] = isset( $data['resize'] ) ? $data['resize'] : 'proportional';
230
  $add .= " resize=\"{$settings['resize']}\"";
embedded/includes/fields/skype.php CHANGED
@@ -1,480 +1,479 @@
1
- <?php
2
- /**
3
- *
4
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/includes/fields/skype.php $
5
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
6
- * $LastChangedRevision: 1012704 $
7
- * $LastChangedBy: iworks $
8
- *
9
- */
10
-
11
- /**
12
- * Register data (called automatically).
13
- *
14
- * @return type
15
- */
16
- function wpcf_fields_skype() {
17
- return array(
18
- 'id' => 'wpcf-skype',
19
- 'title' => __( 'Skype', 'wpcf' ),
20
- 'description' => __( 'Skype', 'wpcf' ),
21
- 'validate' => array('required'),
22
- );
23
- }
24
-
25
- add_filter( 'wpcf_pr_fields_type_skype_value_save',
26
- 'wpcf_pr_fields_type_skype_value_save_filter', 10, 3 );
27
- add_filter( 'wpcf_repetitive_field', 'wpcf_field_skype_repetitive', 10, 4 );
28
-
29
- // Add filter when using wpv_condition()
30
- add_filter( 'wpv_condition', 'wpcf_fields_skype_wpv_conditional_trigger' );
31
- add_filter( 'wpv_condition_end', 'wpcf_fields_skype_wpv_conditional_trigger_end' );
32
-
33
- /**
34
- * Form data for post edit page.
35
- *
36
- * @param type $field
37
- */
38
- function wpcf_fields_skype_meta_box_form( $field ) {
39
- add_thickbox();
40
- if ( isset( $field['value'] ) ) {
41
- $field['value'] = maybe_unserialize( $field['value'] );
42
- }
43
- $form = array();
44
- add_filter( 'wpcf_fields_shortcode_slug_' . $field['slug'],
45
- 'wpcf_fields_skype_shortcode_filter', 10, 2 );
46
- $rand = wpcf_unique_id( serialize( $field ) );
47
- $form['skypename'] = array(
48
- '#type' => 'textfield',
49
- '#value' => isset( $field['value']['skypename'] ) ? $field['value']['skypename'] : '',
50
- '#name' => 'wpcf[' . $field['slug'] . '][skypename]',
51
- '#id' => 'wpcf-fields-skype-' . $field['slug'] . '-' . $rand . '-skypename',
52
- '#inline' => true,
53
- '#suffix' => '&nbsp;' . __( 'Skype name', 'wpcf' ),
54
- '#description' => '',
55
- '#prefix' => !empty( $field['description'] ) ? wpcf_translate( 'field ' . $field['id'] . ' description',
56
- $field['description'] )
57
- . '<br /><br />' : '',
58
- '#attributes' => array('style' => 'width:60%;'),
59
- '#_validate_this' => true,
60
- '#before' => '<div class="wpcf-skype">',
61
- );
62
-
63
- $form['style'] = array(
64
- '#type' => 'hidden',
65
- '#value' => isset( $field['value']['style'] ) ? $field['value']['style'] : 'btn2',
66
- '#name' => 'wpcf[' . $field['slug'] . '][style]',
67
- '#id' => 'wpcf-fields-skype-' . $field['slug'] . '-' . $rand . '-style',
68
- );
69
-
70
- $preview_skypename = !empty( $field['value']['skypename'] ) ? $field['value']['skypename'] : '--not--';
71
- $preview_style = !empty( $field['value']['style'] ) ? $field['value']['style'] : 'btn2';
72
- $preview = wpcf_fields_skype_get_button_image( $preview_skypename,
73
- $preview_style );
74
-
75
- // Set button
76
- // TODO WPML move
77
- if ( isset( $field['disable'] ) || wpcf_wpml_field_is_copied( $field ) ) {
78
- $edit_button = '';
79
- } else {
80
- $edit_button = ''
81
- . '<a href="'
82
- . admin_url( 'admin-ajax.php?action=wpcf_ajax&amp;'
83
- . 'wpcf_action=insert_skype_button&amp;_wpnonce='
84
- . wp_create_nonce( 'insert_skype_button' )
85
- . '&amp;update=wpcf-fields-skype-'
86
- . $field['slug'] . '-' . $rand . '&amp;skypename=' . $preview_skypename
87
- . '&amp;button_style=' . $preview_style
88
- . '&amp;keepThis=true&amp;TB_iframe=true&amp;width=500&amp;height=500' )
89
- . '"'
90
- . ' class="thickbox wpcf-fields-skype button-secondary"'
91
- . ' title="' . __( 'Edit Skype button', 'wpcf' ) . '"'
92
- . '>'
93
- . __( 'Edit Skype button', 'wpcf' ) . '</a>';
94
- }
95
-
96
- $form['markup'] = array(
97
- '#type' => 'markup',
98
- '#markup' => '<div class="wpcf-form-item">'
99
- . '<div id="wpcf-fields-skype-'
100
- . $field['slug'] . '-' . $rand . '-preview">' . $preview . '</div>'
101
- . $edit_button . '</div>',
102
- );
103
- $form['markup-close'] = array(
104
- '#type' => 'markup',
105
- '#markup' => '</div>',
106
- );
107
- return $form;
108
- }
109
-
110
- /**
111
- * Editor callback form.
112
- */
113
- function wpcf_fields_skype_editor_callback( $field, $settings, $meta_type, $post ) {
114
- // Get saved button style if any
115
- if ( $meta_type == 'usermeta' ) {
116
- global $current_user;
117
- $_field = new WPCF_Usermeta_Field;
118
- $_field->set( $current_user->ID, $field );
119
- } else {
120
- $_field = new WPCF_Field;
121
- $_field->set( $post, $field );
122
- }
123
- $settings['button_style'] = isset( $_field->meta['style'] ) ? $_field->meta['style'] : 'btn2';
124
- return array(
125
- 'supports' => array('styling'),
126
- 'tabs' => array(
127
- 'display' => array(
128
- 'title' => __( 'Display', 'wpcf' ),
129
- 'menu_title' => __( 'Display', 'wpcf' ),
130
- 'content' => WPCF_Loader::template( 'skype-select-button',
131
- $settings ),
132
- ),
133
- ),
134
- );
135
- }
136
-
137
- /**
138
- * Editor submit.
139
- */
140
- function wpcf_fields_skype_editor_submit( $data, $field, $context ) {
141
- $add = '';
142
- if ( !empty( $data['button_style'] ) ) {
143
- $add .= ' button_style="' . strval( $data['button_style'] ) . '"';
144
- }
145
-
146
- if ( $context == 'usermeta' ) {
147
- $add .= wpcf_get_usermeta_form_addon_submit();
148
- $shortcode = wpcf_usermeta_get_shortcode( $field, $add );
149
- } else {
150
- $shortcode = wpcf_fields_get_shortcode( $field, $add );
151
- }
152
-
153
- return $shortcode;
154
- }
155
-
156
- /**
157
- * Shortcode filter.
158
- *
159
- * @param type $shortcode
160
- * @param type $field
161
- * @return type
162
- */
163
- function wpcf_fields_skype_shortcode_filter( $shortcode, $field ) {
164
- return $shortcode;
165
- $add = '';
166
- $add .= isset( $field['value']['skypename'] ) ? ' skypename="' . $field['value']['skypename'] . '"' : '';
167
- // $add .= isset($field['value']['style']) ? ' style="' . $field['value']['style'] . '"' : '';
168
- return str_replace( ']', $add . ']', $shortcode );
169
- }
170
-
171
- /**
172
- * Edit Skype button submit.
173
- */
174
- function wpcf_fields_skype_meta_box_submit() {
175
- $update = esc_attr( $_GET['update'] );
176
- $preview = wpcf_fields_skype_get_button_image( esc_attr( $_POST['skypename'] ),
177
- esc_attr( $_POST['button_style'] ) );
178
-
179
- ?>
180
- <script type="text/javascript">
181
- //<![CDATA[
182
- jQuery(document).ready(function(){
183
- window.parent.jQuery('#<?php echo $update; ?>-skypename').val('<?php echo esc_js( $_POST['skypename'] ); ?>');
184
- window.parent.jQuery('#<?php echo $update; ?>-style').val('<?php echo esc_js( $_POST['button_style'] ); ?>');
185
- window.parent.jQuery('#<?php echo $update; ?>-preview').html('<?php echo $preview; ?>');
186
- window.parent.jQuery('#TB_closeWindowButton').trigger('click');
187
- });
188
- //]]>
189
- </script>
190
- <?php
191
- }
192
-
193
- /**
194
- * Edit Skype button AJAX call.
195
- */
196
- function wpcf_fields_skype_meta_box_ajax() {
197
- if ( isset( $_POST['_wpnonce_wpcf_form'] ) && wp_verify_nonce( $_POST['_wpnonce_wpcf_form'],
198
- 'wpcf-form' ) ) {
199
- add_action( 'admin_head_wpcf_ajax', 'wpcf_fields_skype_meta_box_submit' );
200
- }
201
- wp_enqueue_script( 'jquery' );
202
- wpcf_admin_ajax_head( __( 'Insert skype button', 'wpcf' ) );
203
-
204
- ?>
205
- <form method="post" action="">
206
- <h2><?php
207
- _e( 'Enter your Skype Name', 'wpcf' );
208
-
209
- ?></h2>
210
- <p>
211
- <input id="btn-skypename" name="skypename" value="<?php esc_attr_e($_GET['skypename']); ?>" type="text" />
212
- </p>
213
- <?php
214
- echo WPCF_Loader::template( 'skype-select-button', $_GET );
215
-
216
- ?>
217
- <?php
218
- wp_nonce_field( 'wpcf-form', '_wpnonce_wpcf_form' );
219
-
220
- ?>
221
- <br /><br />
222
- <input type="submit" class="button-primary" value="<?php
223
- _e( 'Insert skype button', 'wpcf' );
224
-
225
- ?>" />
226
- </form>
227
- <?php
228
- $update = esc_attr( $_GET['update'] );
229
-
230
- ?>
231
- <script type="text/javascript">
232
- //<![CDATA[
233
- jQuery(document).ready(function(){
234
- jQuery('#btn-skypename').val(window.parent.jQuery('#<?php echo $update; ?>-skypename').val());
235
- });
236
- //]]>
237
- </script>
238
- <?php
239
- wpcf_admin_ajax_footer();
240
- }
241
-
242
- /**
243
- * Returns HTML formatted skype button.
244
- *
245
- * @param type $skypename
246
- * @param type $template
247
- * @param type $class
248
- * @return type
249
- */
250
- function wpcf_fields_skype_get_button( $skypename, $template = '',
251
- $class = false ) {
252
-
253
- if ( empty( $skypename ) ) {
254
- return '';
255
- }
256
-
257
- $class = !empty( $class ) ? ' class="' . strval( $class ) . '"' : '';
258
-
259
- switch ( $template ) {
260
-
261
- case 'btn1':
262
- // Call me big drawn
263
- $output = '<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>
264
- <a href="skype:' . $skypename . '?call"><img src="http://download.skype.com/share/skypebuttons/buttons/call_green_white_153x63.png" style="border: none;" width="153" height="63" alt="Skype Me™!"' . $class . ' /></a>';
265
- break;
266
-
267
- case 'btn4':
268
- // Call me small
269
- $output = '<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>
270
- <a href="skype:' . $skypename . '?call"><img src="http://download.skype.com/share/skypebuttons/buttons/call_blue_transparent_34x34.png" style="border: none;" width="34" height="34" alt="Skype Me™!"' . $class . ' /></a>';
271
- break;
272
-
273
- case 'btn3':
274
- // Call me small drawn
275
- $output = '<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>
276
- <a href="skype:' . $skypename . '?call"><img src="http://download.skype.com/share/skypebuttons/buttons/call_green_white_92x82.png" style="border: none;" width="92" height="82" alt="Skype Me™!"' . $class . ' /></a>';
277
- break;
278
-
279
- case 'btn6':
280
- // Status
281
- $output = '<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>
282
- <a href="skype:' . $skypename . '?call"><img src="http://mystatus.skype.com/bigclassic/' . $skypename . '" style="border: none;" width="182" height="44" alt="My status"' . $class . ' /></a>';
283
- break;
284
-
285
- case 'btn5':
286
- // Status drawn
287
- $output = '<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>
288
- <a href="skype:' . $skypename . '?call"><img src="http://mystatus.skype.com/balloon/' . $skypename . '" style="border: none;" width="150" height="60" alt="My status"' . $class . ' /></a>';
289
- break;
290
-
291
- default:
292
- // Call me big
293
- $output = '<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>
294
- <a href="skype:' . $skypename . '?call"><img src="http://download.skype.com/share/skypebuttons/buttons/call_blue_white_124x52.png" style="border: none;" width="124" height="52" alt="Skype Me™!"' . $class . ' /></a>';
295
- break;
296
- }
297
-
298
- return $output;
299
- }
300
-
301
- /**
302
- * Returns HTML formatted skype button image.
303
- *
304
- * @param type $skypename
305
- * @param type $template
306
- * @return type
307
- */
308
- function wpcf_fields_skype_get_button_image( $skypename = '', $template = '' ) {
309
-
310
- if ( empty( $skypename ) ) {
311
- $skypename = '--not--';
312
- }
313
-
314
- switch ( $template ) {
315
-
316
- case 'btn1':
317
- // Call me big drawn
318
- $output = '<img src="http://download.skype.com/share/skypebuttons/buttons/call_green_white_153x63.png" style="border: none;" width="153" height="63" alt="Skype Me™!" />';
319
- break;
320
-
321
- case 'btn4':
322
- // Call me small
323
- $output = '<img src="http://download.skype.com/share/skypebuttons/buttons/call_blue_transparent_34x34.png" style="border: none;" width="34" height="34" alt="Skype Me™!" />';
324
- break;
325
-
326
- case 'btn3':
327
- // Call me small drawn
328
- $output = '<img src="http://download.skype.com/share/skypebuttons/buttons/call_green_white_92x82.png" style="border: none;" width="92" height="82" alt="Skype Me™!" />';
329
- break;
330
-
331
- case 'btn6':
332
- // Status
333
- $output = '<img src="http://mystatus.skype.com/bigclassic/' . $skypename . '" style="border: none;" width="182" height="44" alt="My status" />';
334
- break;
335
-
336
- case 'btn5':
337
- // Status drawn
338
- $output = '<img src="http://mystatus.skype.com/balloon/' . $skypename . '" style="border: none;" width="150" height="60" alt="My status" />';
339
- break;
340
-
341
- default:
342
- // Call me big
343
- $output = '<img src="http://download.skype.com/share/skypebuttons/buttons/call_blue_white_124x52.png" style="border: none;" width="124" height="52" alt="Skype Me™!" />';
344
- break;
345
- }
346
-
347
- return $output;
348
- }
349
-
350
- /**
351
- *
352
- * View function.
353
- *
354
- * @param type $params
355
- *
356
- * @return string
357
- *
358
- */
359
- function wpcf_fields_skype_view( $params )
360
- {
361
- if ( empty( $params['field_value']['skypename'] ) ) {
362
- return '__wpcf_skip_empty';
363
- }
364
- // Button style
365
- $button_style = 'default';
366
- // First check if passed by parameter
367
- if ( array_key_exists( 'button_style', $params ) && $params['button_style'] ) {
368
- $button_style = $params['button_style'];
369
- // Otherwise use saved value
370
- } else if ( array_key_exists( 'style', $params['field_value'] ) && $params['field_value']['style'] ) {
371
- $button_style = $params['field_value']['style'];
372
- } else if ( array_key_exists( 'button_style', $params['field_value'] ) && $params['field_value']['button_style'] ) {
373
- $button_style = $params['field_value']['button_style'];
374
- }
375
- // Style can be overrided by params (shortcode)
376
- if ( !isset( $params['field_value']['style'] ) ) {
377
- $params['field_value']['style'] = '';
378
- }
379
- $class = empty( $params['class'] ) ? false : $params['class'];
380
- $content = wpcf_fields_skype_get_button( $params['field_value']['skypename'], $button_style, $class );
381
- return $content;
382
- }
383
-
384
- /**
385
- * Filters post relationship save data.
386
- *
387
- * @param type $data
388
- * @param type $meta_key
389
- * @param type $post_id
390
- * @return type
391
- */
392
- function wpcf_pr_fields_type_skype_value_save_filter( $data, $meta_key = null,
393
- $post_id = null ) {
394
- $meta = (array) get_post_meta( $post_id, $meta_key, true );
395
- $meta['skypename'] = $data;
396
- $data = $meta;
397
- return $data;
398
- }
399
-
400
- /**
401
- * Processes repetitive Skype fields.
402
- *
403
- * Each form element is sent separately.
404
- * Determine which is which and process it.
405
- *
406
- * @staticvar array $repetitive_started
407
- * @staticvar array $repetitive_index
408
- * @param type $post
409
- * @param string $field
410
- * @param type $skype_element
411
- * @return string
412
- */
413
- function wpcf_field_skype_repetitive( $element, $post, $field, $array_key ) {
414
-
415
- global $wpcf;
416
-
417
- if ( $field['type'] != 'skype' ) {
418
- return $element;
419
- }
420
-
421
-
422
- switch ( $array_key ) {
423
- case 'skypename':
424
- // TODO WPML move
425
- if ( wpcf_wpml_field_is_copied( $field ) ) {
426
- $element['#after'] .= '<input type="hidden" name="wpcf_repetitive_copy['
427
- . $field['id'] . '][' . $wpcf->repeater->index
428
- . ']" value="1" />';
429
- }
430
-
431
- /*
432
- *
433
- * If added via AJAX set value
434
- */
435
- if ( defined( 'DOING_AJAX' ) ) {
436
- $field['value'] = '__wpcf_repetitive_new_field';
437
- $element['#value'] = '';
438
- }
439
- break;
440
-
441
-
442
- default:
443
- break;
444
- }
445
-
446
- return $element;
447
- }
448
-
449
- /**
450
- * Triggers post_meta filter.
451
- *
452
- * @param type $post
453
- * @return type
454
- */
455
- function wpcf_fields_skype_wpv_conditional_trigger( $post ) {
456
- add_filter( 'get_post_metadata',
457
- 'wpcf_fields_skype_conditional_filter_post_meta', 10, 4 );
458
- }
459
-
460
- /**
461
- * Returns 'skypename' if available.
462
- *
463
- * @global type $wpcf
464
- * @param type $null
465
- * @param type $object_id
466
- * @param type $meta_key
467
- * @param type $single
468
- * @return type
469
- */
470
- function wpcf_fields_skype_conditional_filter_post_meta( $null, $object_id,
471
- $meta_key, $single ) {
472
-
473
- global $wpcf;
474
- $field = wpcf_admin_fields_get_field( $wpcf->field->__get_slug_no_prefix( $meta_key ) );
475
- if ( !empty( $field ) && $field['type'] == 'skype' ) {
476
- $_meta = maybe_unserialize( wpcf_get_post_meta( $object_id, $meta_key,
477
- $single ) );
478
  if ( is_array( $_meta ) ) {
479
  $null = isset( $_meta['skypename'] ) ? $_meta['skypename'] : '';
480
  }
@@ -488,13 +487,13 @@ function wpcf_fields_skype_conditional_filter_post_meta( $null, $object_id,
488
  return $null;
489
  }
490
 
491
- /**
492
- * Removes trigger post_meta filter.
493
- *
494
- * @param type $evaluate
495
- * @return type
496
- */
497
- function wpcf_fields_skype_wpv_conditional_trigger_end( $post ) {
498
- remove_filter( 'get_post_metadata',
499
- 'wpcf_fields_skype_conditional_filter_post_meta', 10, 4 );
500
- }
1
+ <?php
2
+ /**
3
+ *
4
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/includes/fields/skype.php $
5
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
6
+ * $LastChangedRevision: 1027712 $
7
+ * $LastChangedBy: iworks $
8
+ *
9
+ */
10
+
11
+ /**
12
+ * Register data (called automatically).
13
+ *
14
+ * @return type
15
+ */
16
+ function wpcf_fields_skype() {
17
+ return array(
18
+ 'id' => 'wpcf-skype',
19
+ 'title' => __( 'Skype', 'wpcf' ),
20
+ 'description' => __( 'Skype', 'wpcf' ),
21
+ 'validate' => array('required'),
22
+ );
23
+ }
24
+
25
+ add_filter( 'wpcf_pr_fields_type_skype_value_save',
26
+ 'wpcf_pr_fields_type_skype_value_save_filter', 10, 3 );
27
+ add_filter( 'wpcf_repetitive_field', 'wpcf_field_skype_repetitive', 10, 4 );
28
+
29
+ // Add filter when using wpv_condition()
30
+ add_filter( 'wpv_condition', 'wpcf_fields_skype_wpv_conditional_trigger' );
31
+ add_filter( 'wpv_condition_end', 'wpcf_fields_skype_wpv_conditional_trigger_end' );
32
+
33
+ /**
34
+ * Form data for post edit page.
35
+ *
36
+ * @param type $field
37
+ */
38
+ function wpcf_fields_skype_meta_box_form( $field ) {
39
+ add_thickbox();
40
+ if ( isset( $field['value'] ) ) {
41
+ $field['value'] = maybe_unserialize( $field['value'] );
42
+ }
43
+ $form = array();
44
+ add_filter( 'wpcf_fields_shortcode_slug_' . $field['slug'], 'wpcf_fields_skype_shortcode_filter', 10, 2 );
45
+ $rand = wpcf_unique_id( serialize( $field ) );
46
+ $form['skypename'] = array(
47
+ '#type' => 'textfield',
48
+ '#value' => isset( $field['value']['skypename'] ) ? $field['value']['skypename'] : '',
49
+ '#name' => 'wpcf[' . $field['slug'] . '][skypename]',
50
+ '#id' => 'wpcf-fields-skype-' . $field['slug'] . '-' . $rand . '-skypename',
51
+ '#inline' => true,
52
+ '#suffix' => '&nbsp;' . __( 'Skype name', 'wpcf' ),
53
+ '#description' => '',
54
+ '#prefix' => !empty( $field['description'] ) ? wpcf_translate( 'field ' . $field['id'] . ' description',
55
+ $field['description'] )
56
+ . '<br /><br />' : '',
57
+ '#attributes' => array('style' => 'width:60%;'),
58
+ '#_validate_this' => true,
59
+ '#before' => '<div class="wpcf-skype">',
60
+ );
61
+
62
+ $form['style'] = array(
63
+ '#type' => 'hidden',
64
+ '#value' => isset( $field['value']['style'] ) ? $field['value']['style'] : 'btn2',
65
+ '#name' => 'wpcf[' . $field['slug'] . '][style]',
66
+ '#id' => 'wpcf-fields-skype-' . $field['slug'] . '-' . $rand . '-style',
67
+ );
68
+
69
+ $preview_skypename = !empty( $field['value']['skypename'] ) ? $field['value']['skypename'] : '--not--';
70
+ $preview_style = !empty( $field['value']['style'] ) ? $field['value']['style'] : 'btn2';
71
+ $preview = wpcf_fields_skype_get_button_image( $preview_skypename,
72
+ $preview_style );
73
+
74
+ // Set button
75
+ // TODO WPML move
76
+ if ( isset( $field['disable'] ) || wpcf_wpml_field_is_copied( $field ) ) {
77
+ $edit_button = '';
78
+ } else {
79
+ $edit_button = ''
80
+ . '<a href="'
81
+ . admin_url( 'admin-ajax.php?action=wpcf_ajax&amp;'
82
+ . 'wpcf_action=insert_skype_button&amp;_wpnonce='
83
+ . wp_create_nonce( 'insert_skype_button' )
84
+ . '&amp;update=wpcf-fields-skype-'
85
+ . $field['slug'] . '-' . $rand . '&amp;skypename=' . $preview_skypename
86
+ . '&amp;button_style=' . $preview_style
87
+ . '&amp;keepThis=true&amp;TB_iframe=true&amp;width=500&amp;height=500' )
88
+ . '"'
89
+ . ' class="thickbox wpcf-fields-skype button-secondary"'
90
+ . ' title="' . __( 'Edit Skype button', 'wpcf' ) . '"'
91
+ . '>'
92
+ . __( 'Edit Skype button', 'wpcf' ) . '</a>';
93
+ }
94
+
95
+ $form['markup'] = array(
96
+ '#type' => 'markup',
97
+ '#markup' => '<div class="wpcf-form-item">'
98
+ . '<div id="wpcf-fields-skype-'
99
+ . $field['slug'] . '-' . $rand . '-preview">' . $preview . '</div>'
100
+ . $edit_button . '</div>',
101
+ );
102
+ $form['markup-close'] = array(
103
+ '#type' => 'markup',
104
+ '#markup' => '</div>',
105
+ );
106
+ return $form;
107
+ }
108
+
109
+ /**
110
+ * Editor callback form.
111
+ */
112
+ function wpcf_fields_skype_editor_callback( $field, $settings, $meta_type, $post ) {
113
+ // Get saved button style if any
114
+ if ( $meta_type == 'usermeta' ) {
115
+ global $current_user;
116
+ $_field = new WPCF_Usermeta_Field;
117
+ $_field->set( $current_user->ID, $field );
118
+ } else {
119
+ $_field = new WPCF_Field;
120
+ $_field->set( $post, $field );
121
+ }
122
+ $settings['button_style'] = isset( $_field->meta['style'] ) ? $_field->meta['style'] : 'btn2';
123
+ return array(
124
+ 'supports' => array('styling'),
125
+ 'tabs' => array(
126
+ 'display' => array(
127
+ 'title' => __( 'Display', 'wpcf' ),
128
+ 'menu_title' => __( 'Display', 'wpcf' ),
129
+ 'content' => WPCF_Loader::template( 'skype-select-button',
130
+ $settings ),
131
+ ),
132
+ ),
133
+ );
134
+ }
135
+
136
+ /**
137
+ * Editor submit.
138
+ */
139
+ function wpcf_fields_skype_editor_submit( $data, $field, $context ) {
140
+ $add = '';
141
+ if ( !empty( $data['button_style'] ) ) {
142
+ $add .= ' button_style="' . strval( $data['button_style'] ) . '"';
143
+ }
144
+
145
+ if ( $context == 'usermeta' ) {
146
+ $add .= wpcf_get_usermeta_form_addon_submit();
147
+ $shortcode = wpcf_usermeta_get_shortcode( $field, $add );
148
+ } else {
149
+ $shortcode = wpcf_fields_get_shortcode( $field, $add );
150
+ }
151
+
152
+ return $shortcode;
153
+ }
154
+
155
+ /**
156
+ * Shortcode filter.
157
+ *
158
+ * @param type $shortcode
159
+ * @param type $field
160
+ * @return type
161
+ */
162
+ function wpcf_fields_skype_shortcode_filter( $shortcode, $field ) {
163
+ return $shortcode;
164
+ $add = '';
165
+ $add .= isset( $field['value']['skypename'] ) ? ' skypename="' . $field['value']['skypename'] . '"' : '';
166
+ // $add .= isset($field['value']['style']) ? ' style="' . $field['value']['style'] . '"' : '';
167
+ return str_replace( ']', $add . ']', $shortcode );
168
+ }
169
+
170
+ /**
171
+ * Edit Skype button submit.
172
+ */
173
+ function wpcf_fields_skype_meta_box_submit() {
174
+ $update = esc_attr( $_GET['update'] );
175
+ $preview = wpcf_fields_skype_get_button_image( esc_attr( $_POST['skypename'] ),
176
+ esc_attr( $_POST['button_style'] ) );
177
+
178
+ ?>
179
+ <script type="text/javascript">
180
+ //<![CDATA[
181
+ jQuery(document).ready(function(){
182
+ window.parent.jQuery('#<?php echo $update; ?>-skypename').val('<?php echo esc_js( $_POST['skypename'] ); ?>');
183
+ window.parent.jQuery('#<?php echo $update; ?>-style').val('<?php echo esc_js( $_POST['button_style'] ); ?>');
184
+ window.parent.jQuery('#<?php echo $update; ?>-preview').html('<?php echo $preview; ?>');
185
+ window.parent.jQuery('#TB_closeWindowButton').trigger('click');
186
+ });
187
+ //]]>
188
+ </script>
189
+ <?php
190
+ }
191
+
192
+ /**
193
+ * Edit Skype button AJAX call.
194
+ */
195
+ function wpcf_fields_skype_meta_box_ajax() {
196
+ if ( isset( $_POST['_wpnonce_wpcf_form'] ) && wp_verify_nonce( $_POST['_wpnonce_wpcf_form'],
197
+ 'wpcf-form' ) ) {
198
+ add_action( 'admin_head_wpcf_ajax', 'wpcf_fields_skype_meta_box_submit' );
199
+ }
200
+ wp_enqueue_script( 'jquery' );
201
+ wpcf_admin_ajax_head( __( 'Insert skype button', 'wpcf' ) );
202
+
203
+ ?>
204
+ <form method="post" action="">
205
+ <h2><?php
206
+ _e( 'Enter your Skype Name', 'wpcf' );
207
+
208
+ ?></h2>
209
+ <p>
210
+ <input id="btn-skypename" name="skypename" value="<?php esc_attr_e($_GET['skypename']); ?>" type="text" />
211
+ </p>
212
+ <?php
213
+ echo WPCF_Loader::template( 'skype-select-button', $_GET );
214
+
215
+ ?>
216
+ <?php
217
+ wp_nonce_field( 'wpcf-form', '_wpnonce_wpcf_form' );
218
+
219
+ ?>
220
+ <br /><br />
221
+ <input type="submit" class="button-primary" value="<?php
222
+ _e( 'Insert skype button', 'wpcf' );
223
+
224
+ ?>" />
225
+ </form>
226
+ <?php
227
+ $update = esc_attr( $_GET['update'] );
228
+
229
+ ?>
230
+ <script type="text/javascript">
231
+ //<![CDATA[
232
+ jQuery(document).ready(function(){
233
+ jQuery('#btn-skypename').val(window.parent.jQuery('#<?php echo $update; ?>-skypename').val());
234
+ });
235
+ //]]>
236
+ </script>
237
+ <?php
238
+ wpcf_admin_ajax_footer();
239
+ }
240
+
241
+ /**
242
+ * Returns HTML formatted skype button.
243
+ *
244
+ * @param type $skypename
245
+ * @param type $template
246
+ * @param type $class
247
+ * @return type
248
+ */
249
+ function wpcf_fields_skype_get_button( $skypename, $template = '',
250
+ $class = false ) {
251
+
252
+ if ( empty( $skypename ) ) {
253
+ return '';
254
+ }
255
+
256
+ $class = !empty( $class ) ? ' class="' . strval( $class ) . '"' : '';
257
+
258
+ switch ( $template ) {
259
+
260
+ case 'btn1':
261
+ // Call me big drawn
262
+ $output = '<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>
263
+ <a href="skype:' . $skypename . '?call"><img src="http://download.skype.com/share/skypebuttons/buttons/call_green_white_153x63.png" style="border: none;" width="153" height="63" alt="Skype Me™!"' . $class . ' /></a>';
264
+ break;
265
+
266
+ case 'btn4':
267
+ // Call me small
268
+ $output = '<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>
269
+ <a href="skype:' . $skypename . '?call"><img src="http://download.skype.com/share/skypebuttons/buttons/call_blue_transparent_34x34.png" style="border: none;" width="34" height="34" alt="Skype Me™!"' . $class . ' /></a>';
270
+ break;
271
+
272
+ case 'btn3':
273
+ // Call me small drawn
274
+ $output = '<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>
275
+ <a href="skype:' . $skypename . '?call"><img src="http://download.skype.com/share/skypebuttons/buttons/call_green_white_92x82.png" style="border: none;" width="92" height="82" alt="Skype Me™!"' . $class . ' /></a>';
276
+ break;
277
+
278
+ case 'btn6':
279
+ // Status
280
+ $output = '<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>
281
+ <a href="skype:' . $skypename . '?call"><img src="http://mystatus.skype.com/bigclassic/' . $skypename . '" style="border: none;" width="182" height="44" alt="My status"' . $class . ' /></a>';
282
+ break;
283
+
284
+ case 'btn5':
285
+ // Status drawn
286
+ $output = '<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>
287
+ <a href="skype:' . $skypename . '?call"><img src="http://mystatus.skype.com/balloon/' . $skypename . '" style="border: none;" width="150" height="60" alt="My status"' . $class . ' /></a>';
288
+ break;
289
+
290
+ default:
291
+ // Call me big
292
+ $output = '<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>
293
+ <a href="skype:' . $skypename . '?call"><img src="http://download.skype.com/share/skypebuttons/buttons/call_blue_white_124x52.png" style="border: none;" width="124" height="52" alt="Skype Me™!"' . $class . ' /></a>';
294
+ break;
295
+ }
296
+
297
+ return $output;
298
+ }
299
+
300
+ /**
301
+ * Returns HTML formatted skype button image.
302
+ *
303
+ * @param type $skypename
304
+ * @param type $template
305
+ * @return type
306
+ */
307
+ function wpcf_fields_skype_get_button_image( $skypename = '', $template = '' ) {
308
+
309
+ if ( empty( $skypename ) ) {
310
+ $skypename = '--not--';
311
+ }
312
+
313
+ switch ( $template ) {
314
+
315
+ case 'btn1':
316
+ // Call me big drawn
317
+ $output = '<img src="http://download.skype.com/share/skypebuttons/buttons/call_green_white_153x63.png" style="border: none;" width="153" height="63" alt="Skype Me™!" />';
318
+ break;
319
+
320
+ case 'btn4':
321
+ // Call me small
322
+ $output = '<img src="http://download.skype.com/share/skypebuttons/buttons/call_blue_transparent_34x34.png" style="border: none;" width="34" height="34" alt="Skype Me™!" />';
323
+ break;
324
+
325
+ case 'btn3':
326
+ // Call me small drawn
327
+ $output = '<img src="http://download.skype.com/share/skypebuttons/buttons/call_green_white_92x82.png" style="border: none;" width="92" height="82" alt="Skype Me™!" />';
328
+ break;
329
+
330
+ case 'btn6':
331
+ // Status
332
+ $output = '<img src="http://mystatus.skype.com/bigclassic/' . $skypename . '" style="border: none;" width="182" height="44" alt="My status" />';
333
+ break;
334
+
335
+ case 'btn5':
336
+ // Status drawn
337
+ $output = '<img src="http://mystatus.skype.com/balloon/' . $skypename . '" style="border: none;" width="150" height="60" alt="My status" />';
338
+ break;
339
+
340
+ default:
341
+ // Call me big
342
+ $output = '<img src="http://download.skype.com/share/skypebuttons/buttons/call_blue_white_124x52.png" style="border: none;" width="124" height="52" alt="Skype Me™!" />';
343
+ break;
344
+ }
345
+
346
+ return $output;
347
+ }
348
+
349
+ /**
350
+ *
351
+ * View function.
352
+ *
353
+ * @param type $params
354
+ *
355
+ * @return string
356
+ *
357
+ */
358
+ function wpcf_fields_skype_view( $params )
359
+ {
360
+ if ( empty( $params['field_value']['skypename'] ) ) {
361
+ return '__wpcf_skip_empty';
362
+ }
363
+ // Button style
364
+ $button_style = 'default';
365
+ // First check if passed by parameter
366
+ if ( array_key_exists( 'button_style', $params ) && $params['button_style'] ) {
367
+ $button_style = $params['button_style'];
368
+ // Otherwise use saved value
369
+ } else if ( array_key_exists( 'style', $params['field_value'] ) && $params['field_value']['style'] ) {
370
+ $button_style = $params['field_value']['style'];
371
+ } else if ( array_key_exists( 'button_style', $params['field_value'] ) && $params['field_value']['button_style'] ) {
372
+ $button_style = $params['field_value']['button_style'];
373
+ }
374
+ // Style can be overrided by params (shortcode)
375
+ if ( !isset( $params['field_value']['style'] ) ) {
376
+ $params['field_value']['style'] = '';
377
+ }
378
+ $class = empty( $params['class'] ) ? false : $params['class'];
379
+ $content = wpcf_fields_skype_get_button( $params['field_value']['skypename'], $button_style, $class );
380
+ return $content;
381
+ }
382
+
383
+ /**
384
+ * Filters post relationship save data.
385
+ *
386
+ * @param type $data
387
+ * @param type $meta_key
388
+ * @param type $post_id
389
+ * @return type
390
+ */
391
+ function wpcf_pr_fields_type_skype_value_save_filter( $data, $meta_key = null,
392
+ $post_id = null ) {
393
+ $meta = (array) get_post_meta( $post_id, $meta_key, true );
394
+ $meta['skypename'] = $data;
395
+ $data = $meta;
396
+ return $data;
397
+ }
398
+
399
+ /**
400
+ * Processes repetitive Skype fields.
401
+ *
402
+ * Each form element is sent separately.
403
+ * Determine which is which and process it.
404
+ *
405
+ * @staticvar array $repetitive_started
406
+ * @staticvar array $repetitive_index
407
+ * @param type $post
408
+ * @param string $field
409
+ * @param type $skype_element
410
+ * @return string
411
+ */
412
+ function wpcf_field_skype_repetitive( $element, $post, $field, $array_key ) {
413
+
414
+ global $wpcf;
415
+
416
+ if ( $field['type'] != 'skype' ) {
417
+ return $element;
418
+ }
419
+
420
+
421
+ switch ( $array_key ) {
422
+ case 'skypename':
423
+ // TODO WPML move
424
+ if ( wpcf_wpml_field_is_copied( $field ) ) {
425
+ $element['#after'] .= '<input type="hidden" name="wpcf_repetitive_copy['
426
+ . $field['id'] . '][' . $wpcf->repeater->index
427
+ . ']" value="1" />';
428
+ }
429
+
430
+ /*
431
+ *
432
+ * If added via AJAX set value
433
+ */
434
+ if ( defined( 'DOING_AJAX' ) ) {
435
+ $field['value'] = '__wpcf_repetitive_new_field';
436
+ $element['#value'] = '';
437
+ }
438
+ break;
439
+
440
+
441
+ default:
442
+ break;
443
+ }
444
+
445
+ return $element;
446
+ }
447
+
448
+ /**
449
+ * Triggers post_meta filter.
450
+ *
451
+ * @param type $post
452
+ * @return type
453
+ */
454
+ function wpcf_fields_skype_wpv_conditional_trigger( $post ) {
455
+ add_filter( 'get_post_metadata',
456
+ 'wpcf_fields_skype_conditional_filter_post_meta', 10, 4 );
457
+ }
458
+
459
+ /**
460
+ * Returns 'skypename' if available.
461
+ *
462
+ * @global type $wpcf
463
+ * @param type $null
464
+ * @param type $object_id
465
+ * @param type $meta_key
466
+ * @param type $single
467
+ * @return type
468
+ */
469
+ function wpcf_fields_skype_conditional_filter_post_meta( $null, $object_id,
470
+ $meta_key, $single ) {
471
+
472
+ global $wpcf;
473
+ $field = wpcf_admin_fields_get_field( $wpcf->field->__get_slug_no_prefix( $meta_key ) );
474
+ if ( !empty( $field ) && $field['type'] == 'skype' ) {
475
+ $_meta = maybe_unserialize( wpcf_get_post_meta( $object_id, $meta_key,
476
+ $single ) );
 
477
  if ( is_array( $_meta ) ) {
478
  $null = isset( $_meta['skypename'] ) ? $_meta['skypename'] : '';
479
  }
487
  return $null;
488
  }
489
 
490
+ /**
491
+ * Removes trigger post_meta filter.
492
+ *
493
+ * @param type $evaluate
494
+ * @return type
495
+ */
496
+ function wpcf_fields_skype_wpv_conditional_trigger_end( $post ) {
497
+ remove_filter( 'get_post_metadata',
498
+ 'wpcf_fields_skype_conditional_filter_post_meta', 10, 4 );
499
+ }
embedded/includes/fields/textarea.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  *
4
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/includes/fields/textarea.php $
5
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
6
- * $LastChangedRevision: 1012704 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
1
  <?php
2
  /**
3
  *
4
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/includes/fields/textarea.php $
5
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
6
+ * $LastChangedRevision: 1027712 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
embedded/includes/fields/video.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
  *
4
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/includes/fields/video.php $
5
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
6
- * $LastChangedRevision: 1012704 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
1
  <?php
2
  /**
3
  *
4
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/includes/fields/video.php $
5
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
6
+ * $LastChangedRevision: 1027712 $
7
  * $LastChangedBy: iworks $
8
  *
9
  */
embedded/includes/import-export.php CHANGED
@@ -2,10 +2,10 @@
2
  /*
3
  * Import/export data.
4
  *
5
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/includes/import-export.php $
6
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
7
- * $LastChangedRevision: 1012704 $
8
- * $LastChangedBy: iworks $
9
  *
10
  */
11
 
2
  /*
3
  * Import/export data.
4
  *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/includes/import-export.php $
6
+ * $LastChangedDate: 2014-08-22 01:02:43 +0000 (Fri, 22 Aug 2014) $
7
+ * $LastChangedRevision: 970205 $
8
+ * $LastChangedBy: brucepearson $
9
  *
10
  */
11
 
embedded/includes/module-manager.php CHANGED
@@ -4,9 +4,9 @@
4
  *
5
  * Since Types 1.2
6
  *
7
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/includes/module-manager.php $
8
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
9
- * $LastChangedRevision: 1012704 $
10
  * $LastChangedBy: iworks $
11
  *
12
  */
@@ -1036,21 +1036,20 @@ function wpcf_admin_import_data_from_xmlstring( $data = '', $_type = 'types',
1036
  update_option( 'wpcf-custom-types', $types_existing );
1037
 
1038
  // Add relationships
1039
- if ( !empty( $data->post_relationships ) ) {
1040
- $relationship_existing = get_option( 'wpcf_post_relationship', array() );
1041
- /**
1042
- * be sure, $relationship_existing is a array!
1043
- */
1044
- if ( !is_array( $relationship_existing ) ) {
1045
- $relationship_existing = array();
1046
- }
1047
- foreach ( $data->post_relationships->post_relationship as $relationship ) {
1048
- $relationship = json_decode( $relationship, true );
1049
- $relationship = array_merge( $relationship_existing,
1050
- $relationship );
1051
- update_option( 'wpcf_post_relationship', $relationship );
1052
- break;
1053
- }
1054
  }
1055
  }
1056
 
4
  *
5
  * Since Types 1.2
6
  *
7
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/includes/module-manager.php $
8
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
9
+ * $LastChangedRevision: 1027712 $
10
  * $LastChangedBy: iworks $
11
  *
12
  */
1036
  update_option( 'wpcf-custom-types', $types_existing );
1037
 
1038
  // Add relationships
1039
+ /** EMERSON: Restore Types relationships when importing modules */
1040
+ if ( !empty( $data->post_relationships )) {
1041
+ $relationship_existing = get_option( 'wpcf_post_relationship', array() );
1042
+ /**
1043
+ * be sure, $relationship_existing is a array!
1044
+ */
1045
+ if ( !is_array( $relationship_existing ) ) {
1046
+ $relationship_existing = array();
1047
+ }
1048
+ $relationship = json_decode( $data->post_relationships->data, true );
1049
+ if ( is_array( $relationship ) ) {
1050
+ $relationship = array_merge( $relationship_existing, $relationship );
1051
+ update_option( 'wpcf_post_relationship', $relationship );
1052
+ }
 
1053
  }
1054
  }
1055
 
embedded/includes/post-relationship.php CHANGED
@@ -2,9 +2,9 @@
2
  /*
3
  * Post relationship code.
4
  *
5
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/includes/post-relationship.php $
6
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
7
- * $LastChangedRevision: 1012704 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
@@ -240,8 +240,13 @@ function wpcf_pr_admin_post_meta_box_output( $post, $args )
240
  );
241
  }
242
  if ( !empty( $output_temp ) ) {
243
- $output .= '<div style="margin: 20px 0 10px 0">' . sprintf( __( 'This %s belongs to:',
244
- 'wpcf' ), $current_post_type ) . '</div>' . $output_temp;
 
 
 
 
 
245
  }
246
  }
247
  return $output;
@@ -284,7 +289,7 @@ function wpcf_pr_admin_post_meta_box_belongs_form( $post, $type, $belongs )
284
  'numberposts' => -1,
285
  'orderby' => 'title',
286
  'order' => 'ASC',
287
- 'post_status' => apply_filters( 'wpcf_pr_belongs_post_status', array( 'publish' ) ),
288
  'post_type' => $type,
289
  'suppress_filters' => 0,
290
  );
@@ -310,12 +315,13 @@ function wpcf_pr_admin_post_meta_box_belongs_form( $post, $type, $belongs )
310
  );
311
  }
312
 
 
313
  $form[$type] = array(
314
  '#type' => 'select',
315
  '#name' => 'wpcf_pr_belongs[' . $post->ID . '][' . $type . ']',
316
  '#default_value' => isset( $belongs['belongs'][$type] ) ? $belongs['belongs'][$type] : 0,
317
  '#options' => $options,
318
- '#prefix' => $temp_type->label . '&nbsp;',
319
  '#suffix' => '&nbsp;<a href="'
320
  . admin_url( 'admin-ajax.php?action=wpcf_ajax'
321
  . '&amp;wpcf_action=pr-update-belongs&amp;_wpnonce='
@@ -339,17 +345,23 @@ function wpcf_pr_admin_update_belongs( $post_id, $data ) {
339
  $errors = array();
340
  $post = get_post( intval( $post_id ) );
341
  if ( empty( $post->ID ) ) {
342
- return new WP_Error( 'wpcf_update_belongs',
343
- sprintf( __( 'Missing child post ID %d', 'wpcf' ),
344
- intval( $post_id ) ) );
 
 
 
 
345
  }
346
 
347
  foreach ( $data as $post_type => $post_owner_id ) {
348
  // Check if relationship exists
349
  if ( !wpcf_relationship_is_parent( $post_type, $post->post_type ) ) {
350
- $errors[] = sprintf( __( 'Relationship do not exist %s -> %s',
351
- 'wpcf' ), strval( $post_type ),
352
- strval( $post->post_type ) );
 
 
353
  continue;
354
  }
355
  if ( $post_owner_id == '0' ) {
@@ -359,15 +371,16 @@ function wpcf_pr_admin_update_belongs( $post_id, $data ) {
359
  $post_owner = get_post( intval( $post_owner_id ) );
360
  // Check if owner post exists
361
  if ( empty( $post_owner->ID ) ) {
362
- $errors[] = sprintf( __( 'Missing parent post ID %d', 'wpcf' ),
363
- intval( $post_owner_id ) );
364
  continue;
365
  }
366
  // Check if owner post type matches required
367
  if ( $post_owner->post_type != $post_type ) {
368
- $errors[] = sprintf( __( 'Parent post ID %d is not type of %s',
369
- 'wpcf' ), intval( $post_owner_id ),
370
- strval( $post_type ) );
 
 
371
  continue;
372
  }
373
  update_post_meta( $post_id, "_wpcf_belongs_{$post_type}_id", $post_owner->ID );
@@ -406,45 +419,59 @@ function wpcf_pr_admin_has_pagination( $post, $post_type, $page, $prev, $next,
406
  if ( isset( $_GET['post_type_sort_parent'] ) ) {
407
  $add .= '&post_type_sort_parent=' . $_GET['post_type_sort_parent'];
408
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
409
  if ( $prev ) {
410
- $link .= '<a class="button-secondary wpcf-pr-pagination-link wpcf-pr-prev" href="'
411
- . admin_url( 'admin-ajax.php?action=wpcf_ajax&amp;wpcf_action=pr_pagination&amp;page='
412
- . ($page - 1) . '&amp;dir=prev&amp;post_id=' . $post->ID . '&amp;post_type='
413
- . $post_type
414
- . '&amp;' . $wpcf->relationship->items_per_page_option_name
415
- . '=' . $wpcf->relationship->items_per_page
416
- . '&amp;_wpnonce='
417
- . wp_create_nonce( 'pr_pagination' ) . $add ) . '">'
418
- . __( 'Prev', 'wpcf' ) . '</a>&nbsp;&nbsp;';
419
  }
420
  if ( $per_page < $count ) {
421
  $total_pages = ceil( $count / $per_page );
422
- $link .= '<select class="wpcf-pr-pagination-select" name="wpcf-pr-pagination-select">';
 
 
 
423
  for ( $index = 1; $index <= $total_pages; $index++ ) {
424
  $link .= '<option';
425
  if ( ($index) == $page ) {
426
  $link .= ' selected="selected"';
427
  }
428
- $link .= ' value="' . admin_url( 'admin-ajax.php?action=wpcf_ajax&amp;wpcf_action=pr_pagination&amp;page='
429
- . $index . '&amp;dir=next&amp;post_id=' . $post->ID . '&amp;post_type='
430
- . $post_type
431
- . '&amp;' . $wpcf->relationship->items_per_page_option_name
432
- . '=' . $wpcf->relationship->items_per_page
433
- . '&amp;_wpnonce='
434
- . wp_create_nonce( 'pr_pagination' ) . $add ) . '">' . $index . '</option>';
435
  }
436
  $link .= '</select>';
437
  }
438
  if ( $next ) {
439
- $link .= '<a class="button-secondary wpcf-pr-pagination-link wpcf-pr-next" href="'
440
- . admin_url( 'admin-ajax.php?action=wpcf_ajax&amp;wpcf_action=pr_pagination&amp;page='
441
- . ($page + 1) . '&amp;dir=next&amp;post_id=' . $post->ID . '&amp;post_type='
442
- . $post_type
443
- . '&amp;' . $wpcf->relationship->items_per_page_option_name
444
- . '=' . $wpcf->relationship->items_per_page
445
- . '&amp;_wpnonce='
446
- . wp_create_nonce( 'pr_pagination' ) . $add ) . '">'
447
- . __( 'Next', 'wpcf' ) . '</a>';
448
  }
449
  return !empty( $link ) ? '<div class="wpcf-pagination-top">' . $link . '</div>' : '';
450
  }
2
  /*
3
  * Post relationship code.
4
  *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/includes/post-relationship.php $
6
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
7
+ * $LastChangedRevision: 1027712 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
240
  );
241
  }
242
  if ( !empty( $output_temp ) ) {
243
+ $types_existing = get_option( 'wpcf-custom-types', array() );
244
+ $output .= '<div style="margin: 20px 0 10px 0">';
245
+ $output .= sprintf(
246
+ __( 'This <i>%s</i> belongs to:', 'wpcf' ),
247
+ $types_existing[$current_post_type]['labels']['singular_name']
248
+ );
249
+ $output .= '</div>' . $output_temp;
250
  }
251
  }
252
  return $output;
289
  'numberposts' => -1,
290
  'orderby' => 'title',
291
  'order' => 'ASC',
292
+ 'post_status' => apply_filters( 'wpcf_pr_belongs_post_status', array( 'publish', 'private' ) ),
293
  'post_type' => $type,
294
  'suppress_filters' => 0,
295
  );
315
  );
316
  }
317
 
318
+
319
  $form[$type] = array(
320
  '#type' => 'select',
321
  '#name' => 'wpcf_pr_belongs[' . $post->ID . '][' . $type . ']',
322
  '#default_value' => isset( $belongs['belongs'][$type] ) ? $belongs['belongs'][$type] : 0,
323
  '#options' => $options,
324
+ '#prefix' => $temp_type->labels->singular_name . '&nbsp;',
325
  '#suffix' => '&nbsp;<a href="'
326
  . admin_url( 'admin-ajax.php?action=wpcf_ajax'
327
  . '&amp;wpcf_action=pr-update-belongs&amp;_wpnonce='
345
  $errors = array();
346
  $post = get_post( intval( $post_id ) );
347
  if ( empty( $post->ID ) ) {
348
+ return new WP_Error(
349
+ 'wpcf_update_belongs',
350
+ sprintf(
351
+ __( 'Missing child post ID %d', 'wpcf' ),
352
+ intval( $post_id )
353
+ )
354
+ );
355
  }
356
 
357
  foreach ( $data as $post_type => $post_owner_id ) {
358
  // Check if relationship exists
359
  if ( !wpcf_relationship_is_parent( $post_type, $post->post_type ) ) {
360
+ $errors[] = sprintf(
361
+ __( 'Relationship do not exist %s -> %s', 'wpcf' ),
362
+ strval( $post_type ),
363
+ strval( $post->post_type )
364
+ );
365
  continue;
366
  }
367
  if ( $post_owner_id == '0' ) {
371
  $post_owner = get_post( intval( $post_owner_id ) );
372
  // Check if owner post exists
373
  if ( empty( $post_owner->ID ) ) {
374
+ $errors[] = sprintf( __( 'Missing parent post ID %d', 'wpcf' ), intval( $post_owner_id ) );
 
375
  continue;
376
  }
377
  // Check if owner post type matches required
378
  if ( $post_owner->post_type != $post_type ) {
379
+ $errors[] = sprintf(
380
+ __( 'Parent post ID %d is not type of %s', 'wpcf' ),
381
+ intval( $post_owner_id ),
382
+ strval( $post_type )
383
+ );
384
  continue;
385
  }
386
  update_post_meta( $post_id, "_wpcf_belongs_{$post_type}_id", $post_owner->ID );
419
  if ( isset( $_GET['post_type_sort_parent'] ) ) {
420
  $add .= '&post_type_sort_parent=' . $_GET['post_type_sort_parent'];
421
  }
422
+
423
+ /**
424
+ * default for next
425
+ */
426
+ $url_params = array(
427
+ 'action' => 'wpcf_ajax',
428
+ 'wpcf_action' => 'pr_pagination',
429
+ 'page' => $page + 1,
430
+ 'dir' => 'next',
431
+ 'post_id' => $post->ID,
432
+ 'post_type' => $post_type,
433
+ $wpcf->relationship->items_per_page_option_name => $wpcf->relationship->items_per_page,
434
+ '_wpnonce' => wp_create_nonce( 'pr_pagination' ) . $add,
435
+ );
436
+ $url = admin_url('admin-ajax.php');
437
+
438
+
439
  if ( $prev ) {
440
+ $url_params['page'] = $page - 1;
441
+ $url_params['dir'] = 'prev';
442
+ $link .= sprintf(
443
+ '<a class="button-secondary wpcf-pr-pagination-link wpcf-pr-prev" href="%s" data-pagination-name="%s">',
444
+ add_query_arg( $url_params, $url),
445
+ esc_attr($wpcf->relationship->items_per_page_option_name)
446
+ );
447
+ $link .= __( 'Prev', 'wpcf' ) . '</a>&nbsp;&nbsp;';
 
448
  }
449
  if ( $per_page < $count ) {
450
  $total_pages = ceil( $count / $per_page );
451
+ $link .= sprintf(
452
+ '<select class="wpcf-pr-pagination-select" name="wpcf-pr-pagination-select" data-pagination-name="%s">',
453
+ esc_attr($wpcf->relationship->items_per_page_option_name)
454
+ );
455
  for ( $index = 1; $index <= $total_pages; $index++ ) {
456
  $link .= '<option';
457
  if ( ($index) == $page ) {
458
  $link .= ' selected="selected"';
459
  }
460
+ $url_params['page'] = $index;
461
+
462
+ $link .= sprintf( ' value="%s"', add_query_arg( $url_params, $url));
463
+ $link .= '">' . $index . '</option>';
 
 
 
464
  }
465
  $link .= '</select>';
466
  }
467
  if ( $next ) {
468
+ $url_params['page'] = $page + 1;
469
+ $link .= sprintf(
470
+ '<a class="button-secondary wpcf-pr-pagination-link wpcf-pr-next" href="%s" data-pagination-name="%s">',
471
+ add_query_arg( $url_params, $url),
472
+ esc_attr($wpcf->relationship->items_per_page_option_name)
473
+ );
474
+ $link .= __( 'Next', 'wpcf' ) . '</a>';
 
 
475
  }
476
  return !empty( $link ) ? '<div class="wpcf-pagination-top">' . $link . '</div>' : '';
477
  }
embedded/includes/usermeta-post.php CHANGED
@@ -1,10 +1,10 @@
1
  <?php
2
  /*
3
  * Edit post page functions
4
- *
5
  * Core file with stable and working functions.
6
  * Please add hooks if adjustment needed, do not add any more new code here.
7
- *
8
  * Consider this file half-locked since Types 1.1.4
9
  */
10
 
@@ -33,34 +33,34 @@ function wpcf_admin_userprofile_init($user_id){
33
  $profile_only_preview = '';
34
  if ( count($for_users) != 0){
35
  if ( !in_array($user_role,$for_users)){
36
- continue;
37
  }
38
  else{
39
  //If Access plugin activated
40
  if (function_exists('wpcf_access_register_caps')){
41
-
42
  //If user can't view own profile fields
43
  if (!current_user_can('view_own_in_profile_' . $group['slug'])){
44
- continue;
45
  }
46
  //If user can modify current group in own profile
47
  if (!current_user_can('modify_own_' . $group['slug'])){
48
  $profile_only_preview = 1;
49
  }
50
-
51
-
52
- }
53
  }
54
  }
55
  else{
56
  if (function_exists('wpcf_access_register_caps')){
57
  if (!current_user_can('view_own_in_profile_' . $group['slug'])){
58
- continue;
59
  }
60
  if (!current_user_can('modify_own_' . $group['slug'])){
61
  $profile_only_preview = 1;
62
  }
63
- }
64
  }
65
 
66
  // Process fields
@@ -77,14 +77,14 @@ function wpcf_admin_userprofile_init($user_id){
77
  . $group['slug'] . '">' . "\n\n" . '<h3>'
78
  . wpcf_translate( 'group ' . $group['id'] . ' name',
79
  $group['name'] ) . '</h3>' . "\n\n";
80
-
81
  if ( !empty( $group['description'] ) ) {
82
  $output .= '<span>' . wpautop( wpcf_translate( 'group ' . $group['id'] . ' description', $group['description'] ) )
83
  . '</span>' . "\n\n";
84
  }
85
 
86
  $output .= '<div class="wpcf-profile-field-line">' . "\n\n";
87
-
88
  foreach ( $group['fields'] as $field ) {
89
  $config = wptoolset_form_filter_types_field( $field,
90
  $user_id->ID );
@@ -121,7 +121,7 @@ function wpcf_admin_userprofile_init($user_id){
121
  </div>
122
  </div>';
123
  }
124
-
125
  $output .= '</div></div>';
126
  echo $output;
127
  } else {
@@ -132,14 +132,14 @@ function wpcf_admin_userprofile_init($user_id){
132
  }
133
  else{
134
  // Render profile fields (text only)
135
- wpcf_usermeta_preview_profile( $user_id, $group );
136
  }
137
  }
138
-
139
  }
140
-
141
 
142
-
 
143
  // Activate scripts
144
  if ( $wpcf_active ) {
145
  wp_enqueue_script( 'wpcf-fields-post',
@@ -161,7 +161,7 @@ function wpcf_admin_userprofile_init($user_id){
161
  array('wpcf-fields-basic'), WPCF_VERSION );
162
  wp_enqueue_style( 'wpcf-usermeta',
163
  WPCF_EMBEDDED_RES_RELPATH . '/css/usermeta.css',
164
- array('wpcf-fields-basic'), WPCF_VERSION );
165
  wpcf_enqueue_scripts();
166
  wpcf_field_enqueue_scripts( 'date' );
167
  wpcf_field_enqueue_scripts( 'image' );
@@ -195,9 +195,9 @@ function wpcf_usermeta_preview_profile( $user_id, $group, $echo = ''){
195
  //print_r($group);exit;
196
  $fields = $group['fields'];
197
  $group_output = '<div class="wpcf-group-area wpcf-group-area-' . $group['slug'] . '">' . "\n\n";
198
- $group_output .= '<h3 class="wpcf-group-header-'. $group['slug'] .'">'.wpcf_translate( 'group ' . $group['id'] . ' name', $group['name']).'</h3>'. "\n\n";
 
199
 
200
-
201
  foreach ( $fields as $field ) {
202
  $html = '';
203
  $params['post_type'] = 'wp-types-user-group';
@@ -210,15 +210,15 @@ function wpcf_usermeta_preview_profile( $user_id, $group, $echo = ''){
210
  $meta = $_meta['custom_order'];
211
  }
212
  else{
213
- $meta = array();
214
  }
215
  $content = $code = '';
216
  // Sometimes if meta is empty - array(0 => '') is returned
217
  if ( (count( $meta ) == 1 ) ) {
218
- $meta_id = key( $meta );
219
  $_temp = array_shift( $meta );
220
  if (!is_array($_temp) && strval( $_temp ) == '' ) {
221
-
222
  } else {
223
  $params['field_value'] = $_temp;
224
  if ( !empty($params['field_value']) ){
@@ -273,21 +273,21 @@ function wpcf_usermeta_preview_profile( $user_id, $group, $echo = ''){
273
  $html = $output;
274
  }
275
  } else {
276
-
277
  $params['field_value'] = get_user_meta( $user_id,
278
  wpcf_types_get_meta_prefix( $field ) . $field['slug'], true );
279
-
280
  if ( !empty($params['field_value']) && $field['type'] != 'date' ){
281
  $html = types_render_field_single( $field, $params );
282
  }
283
  if ( $field['type'] == 'date' && !empty($params['field_value']) ){
284
  $html = types_render_field_single( $field, $params );
285
  if ($field['data']['date_and_time'] == 'and_time'){
286
- $html .= ' ' . date("H", $params['field_value']) . ':' . date("i", $params['field_value']);
287
  }
288
  }
289
  }
290
-
291
  // API filter
292
  $wpcf->usermeta_field->set( $user_id, $field );
293
  $field_value = $wpcf->usermeta_field->html( $html, $params );
@@ -299,16 +299,16 @@ $group_output .= '<div class="wpcf-profile-field-line wpcf-profile-field-line-'.
299
  '. $field_value .'
300
  </div>
301
  </div>' . "\n\n";
302
-
303
-
304
  }
305
  $group_output .= "\n\n</div>";
306
  if ( empty($echo) ){
307
- echo $group_output;
308
  }else{
309
- return $group_output;
310
  }
311
-
312
  }
313
 
314
  /*
@@ -323,7 +323,7 @@ function wpcf_admin_profile_js_validation(){
323
  * Save user profile custom fields
324
  */
325
  function wpcf_admin_userprofilesave_init($user_id){
326
-
327
  if ( defined( 'WPTOOLSET_FORMS_VERSION' ) ) {
328
 
329
  global $wpcf;
@@ -433,27 +433,27 @@ function wpcf_admin_userprofilesave_init($user_id){
433
  do_action( 'wpcf_user_saved', $user_id );
434
  return;
435
  }
436
-
437
  global $wpcf;
438
-
439
  $all_fields = array();
440
  $_not_valid = array();
441
  $_error = false;
442
  $error = '';
443
-
444
  $groups = $groups = wpcf_admin_usermeta_get_groups_fields();
445
  if ( empty( $groups ) ) {
446
  return false;
447
  }
448
-
449
  foreach ( $groups as $group ) {
450
  // Process fields
451
-
452
  $fields = wpcf_admin_usermeta_process_fields( $user_id , $group['fields'], true,
453
  false, 'validation' );
454
  // Validate fields
455
  $form = wpcf_form_simple_validate( $fields );
456
-
457
  $all_fields = $all_fields + $fields;
458
 
459
  // Collect all not valid fields
@@ -483,10 +483,10 @@ function wpcf_admin_userprofilesave_init($user_id){
483
  $_temp->set( $user_id, $v['wpcf-id'] );
484
  $_not_valid[$k]['_field'] = $_temp;
485
  }
486
-
487
  $not_valid = apply_filters( 'wpcf_post_form_not_valid', $_not_valid,
488
  $_error, $all_fields );
489
-
490
 
491
  // Notify user about error
492
  if ( $error ) {
@@ -500,37 +500,37 @@ function wpcf_admin_userprofilesave_init($user_id){
500
  if ( !empty( $not_valid ) ) {
501
  update_user_meta( $user_id, 'wpcf-invalid-fields', $not_valid );
502
  }
503
-
504
-
505
  if ( !empty( $_POST['wpcf'] ) ) {
506
  foreach ( $_POST['wpcf'] as $field_slug => $field_value ) {
507
-
508
  $field = wpcf_fields_get_field_by_slug( $field_slug, 'wpcf-usermeta' );
509
  if ( empty( $field ) ) {
510
  continue;
511
  }
512
-
513
-
514
  $wpcf->usermeta_field->set( $user_id, $field );
515
  if ( isset( $_POST['wpcf_repetitive_copy'][$field['slug']] ) ) {
516
  continue;
517
  }
518
-
519
  if ( isset( $_POST['__wpcf_repetitive'][$wpcf->usermeta_field->slug] ) ) {
520
  $wpcf->usermeta_repeater->set( $user_id, $field );
521
  $wpcf->usermeta_repeater->save();
522
  } else {
523
  $wpcf->usermeta_field->usermeta_save();
524
  }
525
-
526
  do_action('wpcf_post_field_saved', '', $field);
527
-
528
 
529
-
 
530
  }//end foreach
531
-
532
  }//end if
533
-
534
  foreach ( $all_fields as $field ) {
535
  if ( !isset( $field['#type'] ) ) {
536
  continue;
@@ -568,7 +568,7 @@ function wpcf_admin_userprofilesave_init($user_id){
568
  }
569
  }
570
  }
571
-
572
 
573
  }
574
 
@@ -577,10 +577,10 @@ function wpcf_admin_userprofilesave_init($user_id){
577
  * Render user profile form fields
578
  */
579
  function wpcf_admin_render_fields( $group, $user_id, $echo = '') {
580
-
581
  global $wpcf;
582
  $output = '<div class="wpcf-group-area wpcf-group-area_' . $group['slug'] . '">' . "\n\n";
583
- $output .= '<h3>'.wpcf_translate( 'group ' . $group['id'] . ' name', $group['name']).'</h3>' . "\n\n";
584
  if ( !empty( $group['fields'] ) ) {
585
  // Display description
586
  if ( !empty( $group['description'] ) ) {
@@ -588,20 +588,19 @@ function wpcf_admin_render_fields( $group, $user_id, $echo = '') {
588
  . wpautop( wpcf_translate( 'group ' . $group['id'] . ' description',
589
  $group['description'] ) ) . '</span>' . "\n\n";
590
  }
591
-
592
  $output .= '<div class="wpcf-profile-field-line">' . "\n\n";
593
  foreach ( $group['fields'] as $field_slug => $field ) {
594
  if ( empty( $field ) || !is_array( $field ) ) {
595
  continue;
596
  }
597
  $field = $wpcf->usermeta_field->_parse_cf_form_element( $field );
598
-
599
  if ( !isset( $field['#id'] ) ) {
600
  $field['#id'] = wpcf_unique_id( serialize( $field ) );
601
  }
602
  if ( isset( $field['wpcf-type'] ) ) { // May be ignored
603
- $field = apply_filters( 'wpcf_fields_' . $field['wpcf-type'] . '_meta_box_form_value_display',
604
- $field );
605
  }
606
  // Render form elements
607
  if ( wpcf_compare_wp_version() && $field['#type'] == 'wysiwyg' ) {
@@ -628,7 +627,7 @@ function wpcf_admin_render_fields( $group, $user_id, $echo = '') {
628
  $output .= isset( $field['#after'] ) ? $field['#after'] : '';
629
  $output .= '</div>' . "\n\n";
630
  $output .= '</div>' . "\n\n";
631
- }
632
  else {
633
  if ( $field['#type'] == 'wysiwyg' ) {
634
  $field['#type'] = 'textarea';
@@ -650,33 +649,33 @@ function wpcf_admin_render_fields( $group, $user_id, $echo = '') {
650
  $field['#pattern'] = "\n".'<div class="wpcf-profile-field-line">
651
  <div class="wpcf-profile-line-left">&nbsp;&nbsp;&nbsp;&nbsp;'.__( 'Time', 'wpcf' ).'</div>
652
  <div class="wpcf-profile-line-right">
653
- <LABEL><DESCRIPTION><ERROR><PREFIX><ELEMENT><SUFFIX><AFTER>' . "\n";
654
  }
655
  else{
656
  $field['#pattern'] = "\n".'
657
  <LABEL><DESCRIPTION><ERROR><PREFIX><ELEMENT><SUFFIX><AFTER></div>
658
- </div>' . "\n\n";
659
  }
660
-
661
  }
662
-
663
  }
664
-
665
  if ( !empty($echo) ){
666
  $field['#validate'] = '';
667
  }
668
  $output .= wpcf_form_simple( array($field['#id'] => $field) );
669
-
670
  }
671
-
672
-
673
  }
674
  $output .= '</div>';
675
  }
676
 
677
  /*
678
  * TODO Move to Conditional code
679
- *
680
  * This is already checked. Use hook to add wrapper DIVS and apply CSS.
681
  */
682
  if ( !empty( $group['_conditional_display'] ) ) {
@@ -684,21 +683,21 @@ function wpcf_admin_render_fields( $group, $user_id, $echo = '') {
684
  }
685
  $output .= "\n\n" . '</div>';
686
  if ( !empty($echo) ){
687
- return $output;
688
  }
689
  else{
690
- echo $output;
691
  }
692
  }
693
 
694
  /**
695
  * Gets all groups and fields for post.
696
- *
697
  * Core function. Works and stable. Do not move or change.
698
  * If required, add hooks only.
699
- *
700
  * @param type $post_ID
701
- * @return type
702
  */
703
  function wpcf_admin_usermeta_get_groups_fields() {
704
  $post = array();
@@ -706,7 +705,7 @@ function wpcf_admin_usermeta_get_groups_fields() {
706
  $groups = array();
707
 
708
  $groups_all = wpcf_admin_fields_get_groups('wp-types-user-group');
709
-
710
  foreach ( $groups_all as $temp_key => $temp_group ) {
711
  if ( empty( $temp_group['is_active'] ) ) {
712
  unset( $groups_all[$temp_key] );
@@ -727,13 +726,13 @@ function wpcf_admin_usermeta_get_groups_fields() {
727
 
728
  /**
729
  * Creates form elements.
730
- *
731
  * Core function. Works and stable. Do not move or change.
732
  * If required, add hooks only.
733
- *
734
  * @param type $post
735
  * @param type $fields
736
- * @return type
737
  */
738
  function wpcf_admin_usermeta_process_fields( $user_id, $fields = array(),
739
  $use_cache = true, $add_to_editor = true, $context = 'group' ) {
@@ -744,10 +743,10 @@ function wpcf_admin_usermeta_process_fields( $user_id, $fields = array(),
744
  $wpcf->usermeta_field->add_to_editor = $add_to_editor;
745
  $wpcf->usermeta_repeater->use_cache = $use_cache;
746
  $wpcf->usermeta_repeater->add_to_editor = $add_to_editor;
747
-
748
-
749
  if( is_object( $user_id ) ){
750
- $user_id = $user_id->ID;
751
  }
752
 
753
  // Get cached
@@ -759,11 +758,11 @@ function wpcf_admin_usermeta_process_fields( $user_id, $fields = array(),
759
 
760
  $fields_processed = array();
761
  $invalid_fields = array();
762
-
763
-
764
-
765
  foreach ( $fields as $field ) {
766
-
767
  if ( !empty( $user_id ) ) {
768
  $invalid_fields = update_user_meta( $user_id, 'wpcf-invalid-fields', true );
769
  delete_user_meta( $user_id, 'wpcf-invalid-fields' );
@@ -773,13 +772,13 @@ function wpcf_admin_usermeta_process_fields( $user_id, $fields = array(),
773
  if ( wpcf_admin_is_repetitive( $field ) && $context != 'post_relationship' ) {
774
  $wpcf->usermeta_repeater->set( $user_id, $field );
775
  $fields_processed = $fields_processed + $wpcf->usermeta_repeater->get_fields_form(1);
776
-
777
  } else {
778
 
779
 
780
  $wpcf->usermeta_field->set( $user_id, $field );
781
 
782
-
783
  /*
784
  * From Types 1.2 use complete form setup
785
  */
@@ -791,6 +790,6 @@ function wpcf_admin_usermeta_process_fields( $user_id, $fields = array(),
791
  if ( $cache_key ) {
792
  $cache[$cache_key] = $fields_processed;
793
  }
794
-
795
  return $fields_processed;
796
  }
1
  <?php
2
  /*
3
  * Edit post page functions
4
+ *
5
  * Core file with stable and working functions.
6
  * Please add hooks if adjustment needed, do not add any more new code here.
7
+ *
8
  * Consider this file half-locked since Types 1.1.4
9
  */
10
 
33
  $profile_only_preview = '';
34
  if ( count($for_users) != 0){
35
  if ( !in_array($user_role,$for_users)){
36
+ continue;
37
  }
38
  else{
39
  //If Access plugin activated
40
  if (function_exists('wpcf_access_register_caps')){
41
+
42
  //If user can't view own profile fields
43
  if (!current_user_can('view_own_in_profile_' . $group['slug'])){
44
+ continue;
45
  }
46
  //If user can modify current group in own profile
47
  if (!current_user_can('modify_own_' . $group['slug'])){
48
  $profile_only_preview = 1;
49
  }
50
+
51
+
52
+ }
53
  }
54
  }
55
  else{
56
  if (function_exists('wpcf_access_register_caps')){
57
  if (!current_user_can('view_own_in_profile_' . $group['slug'])){
58
+ continue;
59
  }
60
  if (!current_user_can('modify_own_' . $group['slug'])){
61
  $profile_only_preview = 1;
62
  }
63
+ }
64
  }
65
 
66
  // Process fields
77
  . $group['slug'] . '">' . "\n\n" . '<h3>'
78
  . wpcf_translate( 'group ' . $group['id'] . ' name',
79
  $group['name'] ) . '</h3>' . "\n\n";
80
+
81
  if ( !empty( $group['description'] ) ) {
82
  $output .= '<span>' . wpautop( wpcf_translate( 'group ' . $group['id'] . ' description', $group['description'] ) )
83
  . '</span>' . "\n\n";
84
  }
85
 
86
  $output .= '<div class="wpcf-profile-field-line">' . "\n\n";
87
+
88
  foreach ( $group['fields'] as $field ) {
89
  $config = wptoolset_form_filter_types_field( $field,
90
  $user_id->ID );
121
  </div>
122
  </div>';
123
  }
124
+
125
  $output .= '</div></div>';
126
  echo $output;
127
  } else {
132
  }
133
  else{
134
  // Render profile fields (text only)
135
+ wpcf_usermeta_preview_profile( $user_id, $group );
136
  }
137
  }
138
+
139
  }
 
140
 
141
+
142
+
143
  // Activate scripts
144
  if ( $wpcf_active ) {
145
  wp_enqueue_script( 'wpcf-fields-post',
161
  array('wpcf-fields-basic'), WPCF_VERSION );
162
  wp_enqueue_style( 'wpcf-usermeta',
163
  WPCF_EMBEDDED_RES_RELPATH . '/css/usermeta.css',
164
+ array('wpcf-fields-basic'), WPCF_VERSION );
165
  wpcf_enqueue_scripts();
166
  wpcf_field_enqueue_scripts( 'date' );
167
  wpcf_field_enqueue_scripts( 'image' );
195
  //print_r($group);exit;
196
  $fields = $group['fields'];
197
  $group_output = '<div class="wpcf-group-area wpcf-group-area-' . $group['slug'] . '">' . "\n\n";
198
+ $group_output .= '<h3 class="wpcf-group-header-'. $group['slug'] .'">'.wpcf_translate( 'group ' . $group['id'] . ' name', $group['name']).'</h3>'. "\n\n";
199
+
200
 
 
201
  foreach ( $fields as $field ) {
202
  $html = '';
203
  $params['post_type'] = 'wp-types-user-group';
210
  $meta = $_meta['custom_order'];
211
  }
212
  else{
213
+ $meta = array();
214
  }
215
  $content = $code = '';
216
  // Sometimes if meta is empty - array(0 => '') is returned
217
  if ( (count( $meta ) == 1 ) ) {
218
+ $meta_id = key( $meta );
219
  $_temp = array_shift( $meta );
220
  if (!is_array($_temp) && strval( $_temp ) == '' ) {
221
+
222
  } else {
223
  $params['field_value'] = $_temp;
224
  if ( !empty($params['field_value']) ){
273
  $html = $output;
274
  }
275
  } else {
276
+
277
  $params['field_value'] = get_user_meta( $user_id,
278
  wpcf_types_get_meta_prefix( $field ) . $field['slug'], true );
279
+
280
  if ( !empty($params['field_value']) && $field['type'] != 'date' ){
281
  $html = types_render_field_single( $field, $params );
282
  }
283
  if ( $field['type'] == 'date' && !empty($params['field_value']) ){
284
  $html = types_render_field_single( $field, $params );
285
  if ($field['data']['date_and_time'] == 'and_time'){
286
+ $html .= ' ' . date("H", $params['field_value']) . ':' . date("i", $params['field_value']);
287
  }
288
  }
289
  }
290
+
291
  // API filter
292
  $wpcf->usermeta_field->set( $user_id, $field );
293
  $field_value = $wpcf->usermeta_field->html( $html, $params );
299
  '. $field_value .'
300
  </div>
301
  </div>' . "\n\n";
302
+
303
+
304
  }
305
  $group_output .= "\n\n</div>";
306
  if ( empty($echo) ){
307
+ echo $group_output;
308
  }else{
309
+ return $group_output;
310
  }
311
+
312
  }
313
 
314
  /*
323
  * Save user profile custom fields
324
  */
325
  function wpcf_admin_userprofilesave_init($user_id){
326
+
327
  if ( defined( 'WPTOOLSET_FORMS_VERSION' ) ) {
328
 
329
  global $wpcf;
433
  do_action( 'wpcf_user_saved', $user_id );
434
  return;
435
  }
436
+
437
  global $wpcf;
438
+
439
  $all_fields = array();
440
  $_not_valid = array();
441
  $_error = false;
442
  $error = '';
443
+
444
  $groups = $groups = wpcf_admin_usermeta_get_groups_fields();
445
  if ( empty( $groups ) ) {
446
  return false;
447
  }
448
+
449
  foreach ( $groups as $group ) {
450
  // Process fields
451
+
452
  $fields = wpcf_admin_usermeta_process_fields( $user_id , $group['fields'], true,
453
  false, 'validation' );
454
  // Validate fields
455
  $form = wpcf_form_simple_validate( $fields );
456
+
457
  $all_fields = $all_fields + $fields;
458
 
459
  // Collect all not valid fields
483
  $_temp->set( $user_id, $v['wpcf-id'] );
484
  $_not_valid[$k]['_field'] = $_temp;
485
  }
486
+
487
  $not_valid = apply_filters( 'wpcf_post_form_not_valid', $_not_valid,
488
  $_error, $all_fields );
489
+
490
 
491
  // Notify user about error
492
  if ( $error ) {
500
  if ( !empty( $not_valid ) ) {
501
  update_user_meta( $user_id, 'wpcf-invalid-fields', $not_valid );
502
  }
503
+
504
+
505
  if ( !empty( $_POST['wpcf'] ) ) {
506
  foreach ( $_POST['wpcf'] as $field_slug => $field_value ) {
507
+
508
  $field = wpcf_fields_get_field_by_slug( $field_slug, 'wpcf-usermeta' );
509
  if ( empty( $field ) ) {
510
  continue;
511
  }
512
+
513
+
514
  $wpcf->usermeta_field->set( $user_id, $field );
515
  if ( isset( $_POST['wpcf_repetitive_copy'][$field['slug']] ) ) {
516
  continue;
517
  }
518
+
519
  if ( isset( $_POST['__wpcf_repetitive'][$wpcf->usermeta_field->slug] ) ) {
520
  $wpcf->usermeta_repeater->set( $user_id, $field );
521
  $wpcf->usermeta_repeater->save();
522
  } else {
523
  $wpcf->usermeta_field->usermeta_save();
524
  }
525
+
526
  do_action('wpcf_post_field_saved', '', $field);
 
527
 
528
+
529
+
530
  }//end foreach
531
+
532
  }//end if
533
+
534
  foreach ( $all_fields as $field ) {
535
  if ( !isset( $field['#type'] ) ) {
536
  continue;
568
  }
569
  }
570
  }
571
+
572
 
573
  }
574
 
577
  * Render user profile form fields
578
  */
579
  function wpcf_admin_render_fields( $group, $user_id, $echo = '') {
580
+
581
  global $wpcf;
582
  $output = '<div class="wpcf-group-area wpcf-group-area_' . $group['slug'] . '">' . "\n\n";
583
+ $output .= '<h3>'.wpcf_translate( 'group ' . $group['id'] . ' name', $group['name']).'</h3>' . "\n\n";
584
  if ( !empty( $group['fields'] ) ) {
585
  // Display description
586
  if ( !empty( $group['description'] ) ) {
588
  . wpautop( wpcf_translate( 'group ' . $group['id'] . ' description',
589
  $group['description'] ) ) . '</span>' . "\n\n";
590
  }
591
+
592
  $output .= '<div class="wpcf-profile-field-line">' . "\n\n";
593
  foreach ( $group['fields'] as $field_slug => $field ) {
594
  if ( empty( $field ) || !is_array( $field ) ) {
595
  continue;
596
  }
597
  $field = $wpcf->usermeta_field->_parse_cf_form_element( $field );
598
+
599
  if ( !isset( $field['#id'] ) ) {
600
  $field['#id'] = wpcf_unique_id( serialize( $field ) );
601
  }
602
  if ( isset( $field['wpcf-type'] ) ) { // May be ignored
603
+ $field = apply_filters( 'wpcf_fields_' . $field['wpcf-type'] . '_meta_box_form_value_display', $field );
 
604
  }
605
  // Render form elements
606
  if ( wpcf_compare_wp_version() && $field['#type'] == 'wysiwyg' ) {
627
  $output .= isset( $field['#after'] ) ? $field['#after'] : '';
628
  $output .= '</div>' . "\n\n";
629
  $output .= '</div>' . "\n\n";
630
+ }
631
  else {
632
  if ( $field['#type'] == 'wysiwyg' ) {
633
  $field['#type'] = 'textarea';
649
  $field['#pattern'] = "\n".'<div class="wpcf-profile-field-line">
650
  <div class="wpcf-profile-line-left">&nbsp;&nbsp;&nbsp;&nbsp;'.__( 'Time', 'wpcf' ).'</div>
651
  <div class="wpcf-profile-line-right">
652
+ <LABEL><DESCRIPTION><ERROR><PREFIX><ELEMENT><SUFFIX><AFTER>' . "\n";
653
  }
654
  else{
655
  $field['#pattern'] = "\n".'
656
  <LABEL><DESCRIPTION><ERROR><PREFIX><ELEMENT><SUFFIX><AFTER></div>
657
+ </div>' . "\n\n";
658
  }
659
+
660
  }
661
+
662
  }
663
+
664
  if ( !empty($echo) ){
665
  $field['#validate'] = '';
666
  }
667
  $output .= wpcf_form_simple( array($field['#id'] => $field) );
668
+
669
  }
670
+
671
+
672
  }
673
  $output .= '</div>';
674
  }
675
 
676
  /*
677
  * TODO Move to Conditional code
678
+ *
679
  * This is already checked. Use hook to add wrapper DIVS and apply CSS.
680
  */
681
  if ( !empty( $group['_conditional_display'] ) ) {
683
  }
684
  $output .= "\n\n" . '</div>';
685
  if ( !empty($echo) ){
686
+ return $output;
687
  }
688
  else{
689
+ echo $output;
690
  }
691
  }
692
 
693
  /**
694
  * Gets all groups and fields for post.
695
+ *
696
  * Core function. Works and stable. Do not move or change.
697
  * If required, add hooks only.
698
+ *
699
  * @param type $post_ID
700
+ * @return type
701
  */
702
  function wpcf_admin_usermeta_get_groups_fields() {
703
  $post = array();
705
  $groups = array();
706
 
707
  $groups_all = wpcf_admin_fields_get_groups('wp-types-user-group');
708
+
709
  foreach ( $groups_all as $temp_key => $temp_group ) {
710
  if ( empty( $temp_group['is_active'] ) ) {
711
  unset( $groups_all[$temp_key] );
726
 
727
  /**
728
  * Creates form elements.
729
+ *
730
  * Core function. Works and stable. Do not move or change.
731
  * If required, add hooks only.
732
+ *
733
  * @param type $post
734
  * @param type $fields
735
+ * @return type
736
  */
737
  function wpcf_admin_usermeta_process_fields( $user_id, $fields = array(),
738
  $use_cache = true, $add_to_editor = true, $context = 'group' ) {
743
  $wpcf->usermeta_field->add_to_editor = $add_to_editor;
744
  $wpcf->usermeta_repeater->use_cache = $use_cache;
745
  $wpcf->usermeta_repeater->add_to_editor = $add_to_editor;
746
+
747
+
748
  if( is_object( $user_id ) ){
749
+ $user_id = $user_id->ID;
750
  }
751
 
752
  // Get cached
758
 
759
  $fields_processed = array();
760
  $invalid_fields = array();
761
+
762
+
763
+
764
  foreach ( $fields as $field ) {
765
+
766
  if ( !empty( $user_id ) ) {
767
  $invalid_fields = update_user_meta( $user_id, 'wpcf-invalid-fields', true );
768
  delete_user_meta( $user_id, 'wpcf-invalid-fields' );
772
  if ( wpcf_admin_is_repetitive( $field ) && $context != 'post_relationship' ) {
773
  $wpcf->usermeta_repeater->set( $user_id, $field );
774
  $fields_processed = $fields_processed + $wpcf->usermeta_repeater->get_fields_form(1);
775
+
776
  } else {
777
 
778
 
779
  $wpcf->usermeta_field->set( $user_id, $field );
780
 
781
+
782
  /*
783
  * From Types 1.2 use complete form setup
784
  */
790
  if ( $cache_key ) {
791
  $cache[$cache_key] = $fields_processed;
792
  }
793
+
794
  return $fields_processed;
795
  }
embedded/includes/wpml.php CHANGED
@@ -8,10 +8,10 @@
8
  * Values:
9
  * 0 nothing (ignore), 1 copy, 2 translate
10
  *
11
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/includes/wpml.php $
12
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
13
- * $LastChangedRevision: 1012704 $
14
- * $LastChangedBy: iworks $
15
  *
16
  */
17
 
8
  * Values:
9
  * 0 nothing (ignore), 1 copy, 2 translate
10
  *
11
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/includes/wpml.php $
12
+ * $LastChangedDate: 2014-08-27 08:49:51 +0000 (Wed, 27 Aug 2014) $
13
+ * $LastChangedRevision: 973824 $
14
+ * $LastChangedBy: brucepearson $
15
  *
16
  */
17
 
embedded/onthego-resources/classes/onthegosystems-styles.class.php CHANGED
@@ -21,8 +21,10 @@ class OnTheGoSystemsStyles_Class{
21
 
22
  public function register_and_enqueue_styles()
23
  {
24
- wp_register_style('onthego-admin-styles', ON_THE_GO_SYSTEMS_BRANDING_REL_PATH .'onthego-styles/onthego-styles.css');
25
- wp_enqueue_style( 'onthego-admin-styles' );
 
 
26
  }
27
 
28
  public static function getInstance( )
@@ -34,4 +36,4 @@ class OnTheGoSystemsStyles_Class{
34
 
35
  return self::$instance;
36
  }
37
- };
21
 
22
  public function register_and_enqueue_styles()
23
  {
24
+ if ( is_admin() || defined('WPDDL_VERSION') ) {
25
+ wp_register_style('onthego-admin-styles', ON_THE_GO_SYSTEMS_BRANDING_REL_PATH .'onthego-styles/onthego-styles.css');
26
+ wp_enqueue_style( 'onthego-admin-styles' );
27
+ }
28
  }
29
 
30
  public static function getInstance( )
36
 
37
  return self::$instance;
38
  }
39
+ };
embedded/onthego-resources/onthegosystems-icons/.fontcustom-manifest.json CHANGED
@@ -1,13 +1,13 @@
1
  {
2
  "checksum": {
3
- "previous": "8d9a6c3bf95bd4630d40a722f192ec47a6dc6367d95e40bb3ee60174fffdfe63",
4
- "current": "8d9a6c3bf95bd4630d40a722f192ec47a6dc6367d95e40bb3ee60174fffdfe63"
5
  },
6
  "fonts": [
7
- "fonts/onthegosystems-icons_8d9a6c3bf95bd4630d40a722f192ec47.ttf",
8
- "fonts/onthegosystems-icons_8d9a6c3bf95bd4630d40a722f192ec47.svg",
9
- "fonts/onthegosystems-icons_8d9a6c3bf95bd4630d40a722f192ec47.woff",
10
- "fonts/onthegosystems-icons_8d9a6c3bf95bd4630d40a722f192ec47.eot"
11
  ],
12
  "glyphs": {
13
  "access": {
@@ -69,36 +69,40 @@
69
  "views-logo": {
70
  "codepoint": 61726,
71
  "source": "vectors/views-logo.svg"
 
 
 
 
72
  }
73
  },
74
  "options": {
75
- "autowidth": false,
76
- "config": "fontcustom.yml",
77
- "css_selector": ".icon-{{glyph}}",
78
- "debug": true,
79
- "file_hash": false,
80
- "font_name": "onthegosystems-icons",
81
- "force": false,
82
  "input": {
83
- "templates": "vectors",
84
- "vectors": "vectors"
85
  },
86
- "no_hash": false,
87
  "output": {
88
- "css": "css",
89
  "fonts": "fonts",
 
90
  "preview": "fonts"
91
  },
92
- "preprocessor_path": null,
93
- "project_root": {
94
- "pwd": null
95
- },
96
- "quiet": false,
97
  "templates": [
98
  "css",
99
  "scss",
100
  "preview"
101
- ]
 
 
 
 
 
 
 
 
 
 
 
 
102
  },
103
  "templates": [
104
  "css/onthegosystems-icons.css",
1
  {
2
  "checksum": {
3
+ "previous": "33da83f67be9c5797490c4baa29104c1311787053a2711571308c2562fc16af7",
4
+ "current": "33da83f67be9c5797490c4baa29104c1311787053a2711571308c2562fc16af7"
5
  },
6
  "fonts": [
7
+ "fonts/onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.ttf",
8
+ "fonts/onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.svg",
9
+ "fonts/onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.woff",
10
+ "fonts/onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.eot"
11
  ],
12
  "glyphs": {
13
  "access": {
69
  "views-logo": {
70
  "codepoint": 61726,
71
  "source": "vectors/views-logo.svg"
72
+ },
73
+ "wpml-logo": {
74
+ "codepoint": 61727,
75
+ "source": "vectors/wpml logo.svg"
76
  }
77
  },
78
  "options": {
 
 
 
 
 
 
 
79
  "input": {
80
+ "vectors": "vectors",
81
+ "templates": "vectors"
82
  },
 
83
  "output": {
 
84
  "fonts": "fonts",
85
+ "css": "css",
86
  "preview": "fonts"
87
  },
88
+ "config": "fontcustom.yml",
 
 
 
 
89
  "templates": [
90
  "css",
91
  "scss",
92
  "preview"
93
+ ],
94
+ "font_name": "onthegosystems-icons",
95
+ "css_selector": ".icon-{{glyph}}",
96
+ "preprocessor_path": null,
97
+ "autowidth": false,
98
+ "no_hash": false,
99
+ "debug": false,
100
+ "force": false,
101
+ "quiet": false,
102
+ "project_root": {
103
+ "pwd": null
104
+ },
105
+ "file_hash": false
106
  },
107
  "templates": [
108
  "css/onthegosystems-icons.css",
embedded/onthego-resources/onthegosystems-icons/css/_onthegosystems-icons.scss CHANGED
@@ -4,11 +4,11 @@
4
 
5
  @font-face {
6
  font-family: "onthegosystems-icons";
7
- src: font-url("../fonts/onthegosystems-icons_8d9a6c3bf95bd4630d40a722f192ec47.eot");
8
- src: font-url("../fonts/onthegosystems-icons_8d9a6c3bf95bd4630d40a722f192ec47.eot?#iefix") format("embedded-opentype"),
9
- font-url("../fonts/onthegosystems-icons_8d9a6c3bf95bd4630d40a722f192ec47.woff") format("woff"),
10
- font-url("../fonts/onthegosystems-icons_8d9a6c3bf95bd4630d40a722f192ec47.ttf") format("truetype"),
11
- font-url("../fonts/onthegosystems-icons_8d9a6c3bf95bd4630d40a722f192ec47.svg#onthegosystems-icons") format("svg");
12
  font-weight: normal;
13
  font-style: normal;
14
  }
@@ -16,7 +16,7 @@
16
  @media screen and (-webkit-min-device-pixel-ratio:0) {
17
  @font-face {
18
  font-family: "onthegosystems-icons";
19
- src: font-url("../fonts/onthegosystems-icons_8d9a6c3bf95bd4630d40a722f192ec47.svg#onthegosystems-icons") format("svg");
20
  }
21
  }
22
 
@@ -37,7 +37,8 @@
37
  .icon-types:before,
38
  .icon-types-logo:before,
39
  .icon-views:before,
40
- .icon-views-logo:before {
 
41
  display: inline-block;
42
  font-family: "onthegosystems-icons";
43
  font-style: normal;
@@ -67,3 +68,4 @@
67
  .icon-types-logo:before { content: "\f11c"; }
68
  .icon-views:before { content: "\f11d"; }
69
  .icon-views-logo:before { content: "\f11e"; }
 
4
 
5
  @font-face {
6
  font-family: "onthegosystems-icons";
7
+ src: font-url("../fonts/onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.eot");
8
+ src: font-url("../fonts/onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.eot?#iefix") format("embedded-opentype"),
9
+ font-url("../fonts/onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.woff") format("woff"),
10
+ font-url("../fonts/onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.ttf") format("truetype"),
11
+ font-url("../fonts/onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.svg#onthegosystems-icons") format("svg");
12
  font-weight: normal;
13
  font-style: normal;
14
  }
16
  @media screen and (-webkit-min-device-pixel-ratio:0) {
17
  @font-face {
18
  font-family: "onthegosystems-icons";
19
+ src: font-url("../fonts/onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.svg#onthegosystems-icons") format("svg");
20
  }
21
  }
22
 
37
  .icon-types:before,
38
  .icon-types-logo:before,
39
  .icon-views:before,
40
+ .icon-views-logo:before,
41
+ .icon-wpml-logo:before {
42
  display: inline-block;
43
  font-family: "onthegosystems-icons";
44
  font-style: normal;
68
  .icon-types-logo:before { content: "\f11c"; }
69
  .icon-views:before { content: "\f11d"; }
70
  .icon-views-logo:before { content: "\f11e"; }
71
+ .icon-wpml-logo:before { content: "\f11f"; }
embedded/onthego-resources/onthegosystems-icons/css/onthegosystems-icons.css CHANGED
@@ -4,11 +4,11 @@
4
 
5
  @font-face {
6
  font-family: "onthegosystems-icons";
7
- src: url("../fonts/onthegosystems-icons_8d9a6c3bf95bd4630d40a722f192ec47.eot");
8
- src: url("../fonts/onthegosystems-icons_8d9a6c3bf95bd4630d40a722f192ec47.eot?#iefix") format("embedded-opentype"),
9
- url("../fonts/onthegosystems-icons_8d9a6c3bf95bd4630d40a722f192ec47.woff") format("woff"),
10
- url("../fonts/onthegosystems-icons_8d9a6c3bf95bd4630d40a722f192ec47.ttf") format("truetype"),
11
- url("../fonts/onthegosystems-icons_8d9a6c3bf95bd4630d40a722f192ec47.svg#onthegosystems-icons") format("svg");
12
  font-weight: normal;
13
  font-style: normal;
14
  }
@@ -16,7 +16,7 @@
16
  @media screen and (-webkit-min-device-pixel-ratio:0) {
17
  @font-face {
18
  font-family: "onthegosystems-icons";
19
- src: url("../fonts/onthegosystems-icons_8d9a6c3bf95bd4630d40a722f192ec47.svg#onthegosystems-icons") format("svg");
20
  }
21
  }
22
 
@@ -37,7 +37,8 @@
37
  .icon-types:before,
38
  .icon-types-logo:before,
39
  .icon-views:before,
40
- .icon-views-logo:before {
 
41
  display: inline-block;
42
  font-family: "onthegosystems-icons";
43
  font-style: normal;
@@ -67,3 +68,4 @@
67
  .icon-types-logo:before { content: "\f11c"; }
68
  .icon-views:before { content: "\f11d"; }
69
  .icon-views-logo:before { content: "\f11e"; }
 
4
 
5
  @font-face {
6
  font-family: "onthegosystems-icons";
7
+ src: url("../fonts/onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.eot");
8
+ src: url("../fonts/onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.eot?#iefix") format("embedded-opentype"),
9
+ url("../fonts/onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.woff") format("woff"),
10
+ url("../fonts/onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.ttf") format("truetype"),
11
+ url("../fonts/onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.svg#onthegosystems-icons") format("svg");
12
  font-weight: normal;
13
  font-style: normal;
14
  }
16
  @media screen and (-webkit-min-device-pixel-ratio:0) {
17
  @font-face {
18
  font-family: "onthegosystems-icons";
19
+ src: url("../fonts/onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.svg#onthegosystems-icons") format("svg");
20
  }
21
  }
22
 
37
  .icon-types:before,
38
  .icon-types-logo:before,
39
  .icon-views:before,
40
+ .icon-views-logo:before,
41
+ .icon-wpml-logo:before {
42
  display: inline-block;
43
  font-family: "onthegosystems-icons";
44
  font-style: normal;
68
  .icon-types-logo:before { content: "\f11c"; }
69
  .icon-views:before { content: "\f11d"; }
70
  .icon-views-logo:before { content: "\f11e"; }
71
+ .icon-wpml-logo:before { content: "\f11f"; }
embedded/onthego-resources/onthegosystems-icons/fonts/onthegosystems-icons-preview.html CHANGED
@@ -141,11 +141,11 @@
141
 
142
  @font-face {
143
  font-family: "onthegosystems-icons";
144
- src: url("./onthegosystems-icons_8d9a6c3bf95bd4630d40a722f192ec47.eot");
145
- src: url("./onthegosystems-icons_8d9a6c3bf95bd4630d40a722f192ec47.eot?#iefix") format("embedded-opentype"),
146
- url("./onthegosystems-icons_8d9a6c3bf95bd4630d40a722f192ec47.woff") format("woff"),
147
- url("./onthegosystems-icons_8d9a6c3bf95bd4630d40a722f192ec47.ttf") format("truetype"),
148
- url("./onthegosystems-icons_8d9a6c3bf95bd4630d40a722f192ec47.svg#onthegosystems-icons") format("svg");
149
  font-weight: normal;
150
  font-style: normal;
151
  }
@@ -153,7 +153,7 @@
153
  @media screen and (-webkit-min-device-pixel-ratio:0) {
154
  @font-face {
155
  font-family: "onthegosystems-icons";
156
- src: url("./onthegosystems-icons_8d9a6c3bf95bd4630d40a722f192ec47.svg#onthegosystems-icons") format("svg");
157
  }
158
  }
159
 
@@ -174,7 +174,8 @@
174
  .icon-types:before,
175
  .icon-types-logo:before,
176
  .icon-views:before,
177
- .icon-views-logo:before {
 
178
  display: inline-block;
179
  font-family: "onthegosystems-icons";
180
  font-style: normal;
@@ -204,6 +205,7 @@
204
  .icon-types-logo:before { content: "\f11c"; }
205
  .icon-views:before { content: "\f11d"; }
206
  .icon-views-logo:before { content: "\f11e"; }
 
207
  </style>
208
 
209
  <!--[if lte IE 8]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
@@ -219,7 +221,7 @@
219
  <body class="characters-off">
220
  <div id="page" class="container">
221
  <header>
222
- <h1>onthegosystems-icons contains 15 glyphs:</h1>
223
  <a onclick="toggleCharacters(); return false;" href="#">Toggle Preview Characters</a>
224
  </header>
225
 
@@ -419,6 +421,19 @@
419
  </div>
420
  </div>
421
 
 
 
 
 
 
 
 
 
 
 
 
 
 
422
 
423
  <footer>
424
  Made with love using <a href="http://fontcustom.com">Font Custom</a>.
141
 
142
  @font-face {
143
  font-family: "onthegosystems-icons";
144
+ src: url("./onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.eot");
145
+ src: url("./onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.eot?#iefix") format("embedded-opentype"),
146
+ url("./onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.woff") format("woff"),
147
+ url("./onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.ttf") format("truetype"),
148
+ url("./onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.svg#onthegosystems-icons") format("svg");
149
  font-weight: normal;
150
  font-style: normal;
151
  }
153
  @media screen and (-webkit-min-device-pixel-ratio:0) {
154
  @font-face {
155
  font-family: "onthegosystems-icons";
156
+ src: url("./onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.svg#onthegosystems-icons") format("svg");
157
  }
158
  }
159
 
174
  .icon-types:before,
175
  .icon-types-logo:before,
176
  .icon-views:before,
177
+ .icon-views-logo:before,
178
+ .icon-wpml-logo:before {
179
  display: inline-block;
180
  font-family: "onthegosystems-icons";
181
  font-style: normal;
205
  .icon-types-logo:before { content: "\f11c"; }
206
  .icon-views:before { content: "\f11d"; }
207
  .icon-views-logo:before { content: "\f11e"; }
208
+ .icon-wpml-logo:before { content: "\f11f"; }
209
  </style>
210
 
211
  <!--[if lte IE 8]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
221
  <body class="characters-off">
222
  <div id="page" class="container">
223
  <header>
224
+ <h1>onthegosystems-icons contains 16 glyphs:</h1>
225
  <a onclick="toggleCharacters(); return false;" href="#">Toggle Preview Characters</a>
226
  </header>
227
 
421
  </div>
422
  </div>
423
 
424
+ <div class="glyph">
425
+ <div class="preview-glyphs">
426
+ <span class="step size-12"><span class="letters">Pp</span><i id="icon-wpml-logo" class="icon-wpml-logo"></i></span><span class="step size-14"><span class="letters">Pp</span><i id="icon-wpml-logo" class="icon-wpml-logo"></i></span><span class="step size-16"><span class="letters">Pp</span><i id="icon-wpml-logo" class="icon-wpml-logo"></i></span><span class="step size-18"><span class="letters">Pp</span><i id="icon-wpml-logo" class="icon-wpml-logo"></i></span><span class="step size-21"><span class="letters">Pp</span><i id="icon-wpml-logo" class="icon-wpml-logo"></i></span><span class="step size-24"><span class="letters">Pp</span><i id="icon-wpml-logo" class="icon-wpml-logo"></i></span><span class="step size-36"><span class="letters">Pp</span><i id="icon-wpml-logo" class="icon-wpml-logo"></i></span><span class="step size-48"><span class="letters">Pp</span><i id="icon-wpml-logo" class="icon-wpml-logo"></i></span><span class="step size-60"><span class="letters">Pp</span><i id="icon-wpml-logo" class="icon-wpml-logo"></i></span><span class="step size-72"><span class="letters">Pp</span><i id="icon-wpml-logo" class="icon-wpml-logo"></i></span>
427
+ </div>
428
+ <div class="preview-scale">
429
+ <span class="step">12</span><span class="step">14</span><span class="step">16</span><span class="step">18</span><span class="step">21</span><span class="step">24</span><span class="step">36</span><span class="step">48</span><span class="step">60</span><span class="step">72</span>
430
+ </div>
431
+ <div class="usage">
432
+ <input class="class" type="text" readonly="readonly" onClick="this.select();" value=".icon-wpml-logo" />
433
+ <input class="point" type="text" readonly="readonly" onClick="this.select();" value="&amp;#xf11f;" />
434
+ </div>
435
+ </div>
436
+
437
 
438
  <footer>
439
  Made with love using <a href="http://fontcustom.com">Font Custom</a>.
embedded/onthego-resources/onthegosystems-icons/fonts/onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.eot ADDED
Binary file
embedded/onthego-resources/onthegosystems-icons/fonts/onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.svg ADDED
@@ -0,0 +1,335 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <!--
4
+ 2014-11-13: Created.
5
+ -->
6
+ <svg xmlns="http://www.w3.org/2000/svg">
7
+ <metadata>
8
+ Created by FontForge 20120731 at Thu Nov 13 16:01:00 2014
9
+ By Riccardo Strobbia
10
+ Created by Riccardo Strobbia with FontForge 2.0 (http://fontforge.sf.net)
11
+ </metadata>
12
+ <defs>
13
+ <font id="onthegosystems-icons" horiz-adv-x="512" >
14
+ <font-face
15
+ font-family="onthegosystems-icons"
16
+ font-weight="500"
17
+ font-stretch="normal"
18
+ units-per-em="512"
19
+ panose-1="2 0 6 9 0 0 0 0 0 0"
20
+ ascent="448"
21
+ descent="-64"
22
+ bbox="53.2423 -38.4004 460.8 422.4"
23
+ underline-thickness="25.6"
24
+ underline-position="-51.2"
25
+ unicode-range="U+F110-F11F"
26
+ />
27
+ <missing-glyph />
28
+ <glyph glyph-name="uniF11F" unicode="&#xf11f;"
29
+ d="M290.016 164.817c-4.47461 68.7988 84.2891 87.7139 78.4258 156.87c-4.24707 50.1035 -80.2324 73.7275 -147.636 59.9795c-60.6689 -12.3672 -118.986 -67.501 -129.18 -133.805c-15.5576 -101.271 65.5107 -229.759 203.001 -198.386
30
+ c20.3506 4.65527 35.7539 23.7031 69.207 18.4502c52.8691 -8.29688 57.0664 -86.6475 13.835 -101.506c-18.0938 -6.21582 -50.876 -1.19043 -65.1006 14.79c-1.88574 1.00586 -3.59082 2.45898 -5.08398 4.2334c-5.67871 4.69043 -9.19727 13.6113 -8.53027 23.6025
31
+ c0.962891 14.2598 10.0381 25.2607 20.2705 24.5752c4.15039 -0.273438 7.83887 -2.45508 10.709 -5.86914c3.64551 -3.00781 6.39258 -7.75293 7.72363 -13.4102c6.13281 -13.9424 4.26855 -35.9004 16.9492 -43.3105c67.0361 3.93066 41.5225 113.459 -18.457 87.6562
32
+ c-138.73 -59.6406 -268.003 29.2598 -281.441 143.039c-15.0859 127.578 89.6006 208.035 161.485 216.851c132.461 16.2393 243.918 -94.3057 216.851 -239.923c-6.51562 -34.9307 -27.2803 -78.3857 -73.8223 -78.4297
33
+ c-34.4258 -0.0498047 -66.7617 27.042 -69.2061 64.5918z" />
34
+ <glyph glyph-name="uniF119" unicode="&#xf119;"
35
+ d="M371.2 345.6h76.7998v-384h-384v384h76.7998v76.8008h76.7998v-76.8008h76.8008v76.8008h76.7998v-76.8008zM243.782 3.33398v122.164l-117.459 69.5742v-123.917zM384.007 71.1553v121.439l-116.979 -70.0088v-118.977zM384.007 219.667v0.268555l-128.846 74.3877
36
+ l-127.008 -73.3311l129.689 -76.8193z" />
37
+ <glyph glyph-name="uniF11D" unicode="&#xf11d;"
38
+ d="M119.507 152.666c0 0 123.872 168.55 276.192 0c0 0 -123.872 -172.615 -276.192 0zM257.594 99.7119c28.7549 0 52.0576 23.3154 52.0576 52.0381c0 28.749 -23.2959 52.0576 -52.0576 52.0576c-28.7295 0 -52.0322 -23.3086 -52.0322 -52.0576
39
+ c0 -28.7227 23.3027 -52.0381 52.0322 -52.0381zM257.594 117.453c-18.9316 0 -34.2979 15.3594 -34.2979 34.2969c0 18.957 15.3662 34.3105 34.2979 34.3105c18.957 0 34.3164 -15.3535 34.3164 -34.3105c0 -18.9375 -15.3594 -34.2969 -34.3164 -34.2969z
40
+ M257.594 186.061c18.957 0 34.3164 -15.3535 34.3164 -34.3105c0 -18.9375 -15.3594 -34.2969 -34.3164 -34.2969c-18.9316 0 -34.2979 15.3594 -34.2979 34.2969c0 18.957 15.3662 34.3105 34.2979 34.3105z" />
41
+ <glyph glyph-name="uniF113" unicode="&#xf113;"
42
+ d="M318.489 170.215v16.1211l30.0742 -30.0859l-30.0742 -30.0742v16.1094h-120.902v-16.1094l-30.0732 30.0742l30.0732 30.0859v-16.1211h120.902zM371.2 345.6h76.7998v-384h-384v384h76.7998v76.8008h76.7998v-76.8008h76.8008v76.8008h76.7998v-76.8008z
43
+ M388.448 76.8252v0v157.606c0 11.2256 -9.08789 20.3135 -20.3008 20.3135h-225.376c-11.2197 0 -20.3076 -9.09375 -20.3076 -20.3135v-157.606c0 -11.2256 9.08789 -20.3193 20.3076 -20.3193h97.3633c-1.27441 -7.69922 -7.61035 -28.666 -39.002 -28.666v-10.0479
44
+ h50.4316h10.7461h50.4258v10.0479c-31.3984 0 -37.7471 20.9727 -39.002 28.666h94.4004c11.2256 0 20.3135 9.09375 20.3135 20.3193z" />
45
+ <glyph glyph-name="uniF112" unicode="&#xf112;"
46
+ d="M368.135 254.745c11.2256 0 20.3135 -9.09375 20.3135 -20.3135v-157.606c0 -11.2256 -9.08789 -20.3193 -20.3008 -20.3193h-94.4131c1.27344 -7.69922 7.61621 -28.666 39.0078 -28.666v-10.0479h-50.4316h-10.7393h-50.4316v10.0479
47
+ c31.3984 0 37.7275 20.9727 39.001 28.666h-97.3691c-11.2197 0 -20.3076 9.09375 -20.3076 20.3193v157.606c0 11.2256 9.08789 20.3135 20.3076 20.3135h225.363zM318.489 126.176l30.0742 30.0742l-30.0742 30.0859v-16.1279h-120.902v16.1279l-30.0732 -30.0859
48
+ l30.0732 -30.0742v16.1152h120.902v-16.1152z" />
49
+ <glyph glyph-name="uniF111" unicode="&#xf111;"
50
+ d="M258.637 256.013c18.6494 0 33.8242 -15.1738 33.8242 -33.8242v-22.5342h-67.6484v22.5342c0 18.6504 15.1748 33.8242 33.8242 33.8242zM371.2 345.6h76.7998v-384h-384v384h76.7998v76.8008h76.7998v-76.8008h76.8008v76.8008h76.7998v-76.8008zM344.313 43.6348
51
+ v138.451c0 9.70312 -7.85938 17.5752 -17.5742 17.5752h-7.21289v22.5342c0 33.5684 -27.3154 60.877 -60.8896 60.877c-33.5615 0 -60.877 -27.3086 -60.877 -60.877v-22.5342h-9.47168c-9.69629 0 -17.5615 -7.87207 -17.5615 -17.5752v-138.451
52
+ c0 -9.70215 7.85938 -17.5742 17.5615 -17.5742h138.451c9.70898 0 17.5742 7.87207 17.5742 17.5742z" />
53
+ <glyph glyph-name="uniF118" unicode="&#xf118;"
54
+ d="M384.007 219.667l-126.164 -75.4941l-129.689 76.8193l127.008 73.3311l128.846 -74.3877v-0.268555zM384.007 192.595v-121.439l-116.979 -67.5459v118.977zM126.323 195.072l117.459 -69.5742v-122.164l-117.459 67.8213v123.917z" />
55
+ <glyph glyph-name="uniF117" unicode="&#xf117;"
56
+ d="M371.2 345.6h76.7998v-384h-384v384h76.7998v76.8008h76.7998v-76.8008h76.8008v76.8008h76.7998v-76.8008zM183.577 12.877v174.188h-70.3359v-174.188h70.3359zM396.8 12.877v174.188h-195.501v-174.188h195.501zM396.8 205.178v74.6494h-283.559v-74.6494h283.559z
57
+ " />
58
+ <glyph glyph-name="uniF110" unicode="&#xf110;"
59
+ d="M344.313 43.6348c0 -9.70215 -7.86523 -17.5742 -17.5742 -17.5742h-138.451c-9.70215 0 -17.5615 7.87207 -17.5615 17.5742v138.451c0 9.70312 7.86523 17.5752 17.5615 17.5752h138.451c9.71484 0 17.5742 -7.87207 17.5742 -17.5752v-138.451zM319.526 155.699
60
+ h-27.0654v66.4893c0 18.6504 -15.1748 33.8242 -33.8242 33.8242s-33.8242 -15.1738 -33.8242 -33.8242v-57.4717h-27.0527v57.4717c0 33.5684 27.3154 60.877 60.877 60.877c33.5742 0 60.8896 -27.3086 60.8896 -60.877v-66.4893z" />
61
+ <glyph glyph-name="uniF116" unicode="&#xf116;"
62
+ d="M113.241 205.178v74.6494h283.559v-74.6494h-283.559zM201.299 12.877v174.188h195.501v-174.188h-195.501zM113.241 12.877v174.188h70.3359v-174.188h-70.3359z" />
63
+ <glyph glyph-name="uniF11C" unicode="&#xf11c;"
64
+ d="M371.2 345.6h76.7998v-384h-384v384h76.7998v76.8008h76.7998v-76.8008h76.8008v76.8008h76.7998v-76.8008zM108.8 219.04v-133.626l55.9746 105.543c3.96777 7.68652 8.62109 11.667 10.8027 12.915c2.20215 1.28027 7.8916 0.927734 17.0889 0.927734h146.534v14.1182
65
+ c0 6.49609 -2.40039 11.4824 -8.73633 11.4824h-87.9355c-7.92969 0 -12.8262 -0.269531 -14.6816 0.665039c-1.85645 0.921875 -3.37988 3.07227 -4.55664 7.8916l-1.51758 6.11133c-1.09375 4.12891 -2.3418 7.29688 -3.7373 8.2627
66
+ c-1.39551 0.966797 -4.49316 2.66895 -9.29297 2.66895h-46.8281c-5.38965 0 -9.01758 -1.60645 -10.8672 -2.61719c-1.86328 -1.08887 -3.2832 -4.57031 -4.29492 -8.19922l-1.52344 -5.59961c-1.35059 -4.79395 -2.84766 -7.32812 -4.49902 -8.40918
67
+ c-1.64453 -1.10742 -5.29297 -0.774414 -10.9375 -0.774414h-7.85254c-4.05762 0 -8.29492 -1.49121 -9.60645 -2.70801c-1.31836 -1.24121 -3.5332 -4.69043 -3.5332 -8.65234zM409.715 175.731c1.8623 4.05762 2.78418 6.52148 2.79688 7.0459
68
+ c-0.255859 1.75391 -2.88574 2.82227 -7.8457 2.82227h-204.23c-4.90234 0 -8.26953 -0.742188 -10.125 -1.83008c-1.85645 -1.10059 -3.75684 -3.76953 -5.69629 -7.6416l-57.3242 -112.128h226.374z" />
69
+ <glyph glyph-name="uniF11A" unicode="&#xf11a;"
70
+ d="M399.36 330.24h61.4395v-368.641h-399.359v368.641h61.4395v92.1602h92.1602v-92.1602h92.1602v92.1602h92.1602v-92.1602zM116.173 121.979c0 2.90332 -0.839844 5.0791 -2.51953 6.54395c-1.68359 1.45898 -4.1875 2.19141 -7.50586 2.19141h-7.26465
71
+ l-6.72266 -31.8008h5.16113l2.49805 11.8887h2.3916c4.39258 0 7.81738 0.962891 10.2754 2.89258c2.45801 1.93066 3.68652 4.69043 3.68652 8.28418zM100.751 115.175l2.38672 11.1865h2.58984c1.75684 0 3.05176 -0.368164 3.90234 -1.0957
72
+ c0.849609 -0.726562 1.27441 -1.87402 1.27441 -3.45605c0 -2.11914 -0.706055 -3.74707 -2.12012 -4.9043c-1.40723 -1.15723 -3.40918 -1.73047 -5.99023 -1.73047h-2.04297zM121.841 98.8975l7.19824 33.8486h-5.10938l-7.17871 -33.8486h5.08984zM138.537 122.962
73
+ v-0.00488281h-5.14062l-2.67285 -12.6982c-0.173828 -0.895508 -0.347656 -1.78613 -0.522461 -2.6875c-0.173828 -0.885742 -0.260742 -1.78223 -0.260742 -2.69824c0 -2.06836 0.527344 -3.64062 1.58691 -4.74121c1.05469 -1.11133 2.55566 -1.65918 4.50098 -1.65918
74
+ c1.49023 0 2.88281 0.384766 4.17285 1.18262c1.29004 0.798828 2.53418 2.02832 3.72168 3.71777h0.174805l-0.456055 -4.45996h4.02441l5.06836 24.0488h-5.06836l-2.15039 -10.1992c-0.435547 -2.06348 -1.0498 -3.86035 -1.84863 -5.38086
75
+ c-0.798828 -1.52539 -1.70996 -2.70898 -2.73926 -3.53809c-1.0293 -0.819336 -2.06348 -1.2334 -3.10742 -1.2334c-1.84375 0 -2.76465 0.961914 -2.76465 2.89258c0 0.74707 0.224609 2.15039 0.675781 4.19336zM178.217 122.962h-8.33008
76
+ c-1.16211 0.291992 -2.31934 0.44043 -3.48145 0.44043c-2.91309 0 -5.25879 -0.870117 -7.03516 -2.61621c-1.78125 -1.74121 -2.66699 -4.02441 -2.66699 -6.87598c0 -2.46777 0.977539 -4.30664 2.93359 -5.47852
77
+ c-1.44922 -0.681641 -2.51367 -1.37793 -3.18457 -2.12012c-0.675781 -0.732422 -1.01367 -1.60254 -1.01367 -2.60059c0 -1.17773 0.552734 -2.10938 1.65332 -2.75977c-2.23242 -0.748047 -3.85059 -1.66895 -4.8584 -2.76465
78
+ c-1.00391 -1.08594 -1.51074 -2.37598 -1.51074 -3.87109c0 -1.89941 0.814453 -3.38965 2.42676 -4.47949c1.61816 -1.08594 3.89648 -1.62305 6.84082 -1.62305c4.03418 0 7.1416 0.767578 9.33301 2.31934c2.19141 1.56152 3.28223 3.74707 3.28223 6.58887
79
+ c0 1.77148 -0.552734 3.13379 -1.65332 4.08105c-1.10156 0.947266 -2.92383 1.58691 -5.47852 1.90918l-2.76562 0.337891c-0.870117 0.123047 -1.53516 0.277344 -1.99121 0.481445c-0.460938 0.200195 -0.686523 0.588867 -0.686523 1.13184
80
+ c0 0.926758 0.80957 1.67969 2.41699 2.25781c0.583984 -0.107422 1.24902 -0.168945 2.00195 -0.168945c2.89844 0 5.21191 0.814453 6.9375 2.46289s2.59082 3.87012 2.59082 6.6709c0 1.14746 -0.205078 2.13574 -0.609375 2.98047l4.17285 0.716797zM160.404 99.3027
81
+ l2.98047 -0.307617c1.6377 -0.168945 2.78516 -0.470703 3.43555 -0.890625c0.649414 -0.419922 0.977539 -0.999023 0.977539 -1.74121c0 -1.46387 -0.666016 -2.59082 -2.00195 -3.36914c-1.33105 -0.788086 -3.18457 -1.17188 -5.54492 -1.17188
82
+ c-1.6543 0 -2.88281 0.28125 -3.68652 0.829102c-0.803711 0.558594 -1.20801 1.30566 -1.20801 2.25293c0 1.13184 0.43457 2.08887 1.30566 2.84668c0.870117 0.77832 2.11914 1.28516 3.74219 1.55176zM166.277 119.982c1.92969 0 2.89258 -1.03418 2.89258 -3.08301
83
+ c0 -1.17676 -0.194336 -2.25781 -0.578125 -3.24609c-0.384766 -0.977539 -0.921875 -1.76074 -1.6084 -2.31934c-0.691406 -0.5625 -1.50488 -0.849609 -2.44727 -0.849609c-0.957031 0 -1.68945 0.276367 -2.20605 0.839844
84
+ c-0.517578 0.563477 -0.773438 1.35156 -0.773438 2.38086c0 1.13672 0.194336 2.20117 0.588867 3.16406c0.388672 0.962891 0.941406 1.72559 1.65332 2.2832c0.707031 0.547852 1.53613 0.830078 2.47852 0.830078zM182.277 98.8975l5.11426 24.0596h-5.11426
85
+ l-5.13086 -24.0596h5.13086zM183.296 128.876c0 -0.804688 0.255859 -1.4082 0.762695 -1.78711c0.506836 -0.374023 1.14746 -0.563477 1.91504 -0.563477c0.942383 0 1.70508 0.291992 2.2832 0.896484c0.579102 0.603516 0.871094 1.41309 0.871094 2.44141
86
+ c0 0.789062 -0.241211 1.36719 -0.722656 1.75098c-0.475586 0.378906 -1.10059 0.568359 -1.86816 0.568359c-1.0293 0 -1.82324 -0.301758 -2.3916 -0.911133s-0.849609 -1.41309 -0.849609 -2.39551zM203.188 98.8975v0.015625h5.14062l2.97949 14.208
87
+ c0.333008 1.62305 0.501953 2.93945 0.501953 3.93262c0 2.03223 -0.538086 3.59863 -1.60254 4.7002c-1.06543 1.10547 -2.57031 1.64844 -4.51074 1.64844c-1.49512 0 -2.87793 -0.394531 -4.1582 -1.16699c-1.27441 -0.773438 -2.51855 -2.0127 -3.72168 -3.7334
88
+ h-0.194336l0.455078 4.45996h-4.00391l-5.12988 -24.0488h5.12988l2.13574 10.1992c0.404297 1.97168 1.01367 3.73242 1.82227 5.28906c0.814453 1.55664 1.73047 2.75488 2.74414 3.5791s2.04297 1.23828 3.08789 1.23828c1.86816 0 2.80566 -0.952148 2.80566 -2.85156
89
+ c0 -0.603516 -0.12793 -1.55078 -0.389648 -2.85645zM230.753 106.302c0 0.936523 -0.163086 1.76562 -0.491211 2.46777c-0.333008 0.72168 -0.819336 1.38184 -1.45898 1.99121c-0.640625 0.609375 -1.7207 1.3418 -3.24121 2.20215
90
+ c-1.47949 0.798828 -2.45801 1.44824 -2.93359 1.96094c-0.481445 0.506836 -0.72168 1.08496 -0.72168 1.74023c0 0.855469 0.332031 1.52051 0.988281 2.00195c0.655273 0.481445 1.51465 0.72168 2.5752 0.72168c1.82715 0 3.75781 -0.547852 5.78516 -1.64844
91
+ l1.6543 3.83008c-2.17676 1.20801 -4.68555 1.81738 -7.52637 1.81738c-2.64258 0 -4.73633 -0.639648 -6.28809 -1.90918c-1.55078 -1.28027 -2.3291 -3.04199 -2.3291 -5.28906c0 -1.36719 0.374023 -2.57031 1.12109 -3.56934
92
+ c0.74707 -1.00781 2.02734 -2.00195 3.83984 -2.96875c1.55176 -0.886719 2.58105 -1.58789 3.07715 -2.12012c0.49707 -0.527344 0.748047 -1.15723 0.748047 -1.9043c0 -0.994141 -0.435547 -1.79785 -1.30566 -2.37109
93
+ c-0.871094 -0.573242 -2.00781 -0.870117 -3.41504 -0.870117c-2.30469 0 -4.56738 0.650391 -6.78418 1.95605v-4.4082c1.91504 -0.967773 4.24902 -1.45996 7.00391 -1.45996c3.04688 0 5.42773 0.675781 7.1377 2.0332c1.70996 1.35645 2.56445 3.28711 2.56445 5.7959z
94
+ M242.826 88.2129c2.12988 0 3.86035 0.639648 5.16602 1.90918c1.32129 1.29004 2.27344 3.3125 2.85156 6.05176l4.84863 22.9072h4.98242l0.803711 3.87598h-4.97656l0.394531 1.86328c0.317383 1.42871 0.777344 2.44727 1.38184 3.07715
95
+ c0.598633 0.620117 1.40332 0.9375 2.40137 0.9375c0.901367 0 1.88379 -0.205078 2.95898 -0.609375l1.32617 3.82422c-1.39746 0.625 -2.92871 0.942383 -4.58691 0.942383c-2.40625 0 -4.27051 -0.609375 -5.58105 -1.8125
96
+ c-1.31055 -1.20801 -2.2832 -3.24121 -2.92383 -6.11816l-0.455078 -2.00781l-4.21973 -1.64844l-0.455078 -2.29883h3.89062l-4.71973 -22.2363c-0.625 -2.96973 -1.90527 -4.45898 -3.85059 -4.45898c-0.727539 0 -1.55176 0.143555 -2.47852 0.43457v-4.13184
97
+ c0.855469 -0.342773 1.93555 -0.500977 3.24121 -0.500977zM282.772 113.956c0 2.89258 -0.798828 5.19141 -2.38086 6.87598c-1.60254 1.67969 -3.80957 2.51855 -6.64062 2.51855c-2.45215 0 -4.61328 -0.669922 -6.48145 -2.01172
98
+ c-1.88477 -1.3418 -3.33398 -3.2207 -4.37305 -5.62207c-1.0293 -2.41602 -1.55078 -5.06348 -1.55078 -7.94629c0 -2.85156 0.818359 -5.11426 2.45215 -6.77344c1.63867 -1.65918 3.85059 -2.4834 6.64062 -2.4834c2.40625 0 4.53613 0.640625 6.37988 1.92578
99
+ c1.85254 1.2793 3.30664 3.11719 4.36719 5.51855c1.05469 2.40723 1.58691 5.07422 1.58691 7.99805zM277.622 114.176c0 -2.13477 -0.296875 -4.08594 -0.871094 -5.8623c-0.588867 -1.77148 -1.39746 -3.15918 -2.43652 -4.1416
100
+ c-1.0498 -0.988281 -2.22266 -1.48047 -3.52246 -1.48047c-1.4082 0 -2.46289 0.430664 -3.19043 1.29102c-0.72168 0.849609 -1.06934 2.08887 -1.06934 3.69141c0 2.01172 0.291016 3.90625 0.879883 5.68848c0.579102 1.76562 1.4082 3.17871 2.47363 4.21289
101
+ c1.06445 1.04004 2.2627 1.55664 3.61914 1.55664c1.32129 0 2.33496 -0.429688 3.04688 -1.31055s1.07031 -2.08887 1.07031 -3.64551zM301.731 123.402c-1.35645 0 -2.63086 -0.394531 -3.84473 -1.14746c-1.19336 -0.762695 -2.40625 -2.01172 -3.60938 -3.75293
102
+ h-0.189453l0.450195 4.45996h-3.99316l-5.13574 -24.0488h5.13574l2.30371 10.8701c0.557617 2.66211 1.56641 4.80762 3 6.44629c1.43945 1.63281 3.07227 2.45215 4.88965 2.45215c0.702148 0 1.44434 -0.107422 2.22754 -0.3125l1.11621 4.7666
103
+ c-0.675781 0.174805 -1.44922 0.266602 -2.35059 0.266602zM119.286 43.2178l14.249 31.8008h-5.35059l-7.78809 -18.4014c-0.276367 -0.620117 -0.716797 -1.71582 -1.32617 -3.3125c-0.608398 -1.58789 -1.11621 -3.02637 -1.52051 -4.2959h-0.173828l0.0664062 4.09082
104
+ l-0.0664062 3.67578l-0.670898 18.2432h-4.89453l-8.41699 -18.2891c-0.855469 -1.94043 -1.88477 -4.52051 -3.08789 -7.7207h-0.12793c0.18457 3.0459 0.282227 5.5498 0.282227 7.52637l-0.415039 18.4834h-4.98145l1.15137 -31.8008h5.56543l8.37695 18.3193
105
+ c1.01367 2.12988 1.86328 4.23926 2.54395 6.32324h0.12793l-0.0869141 -2.30371l0.12793 -4.01953l0.803711 -18.3193h5.6123zM152.551 58.2754c0 2.89355 -0.798828 5.19727 -2.3916 6.87695c-1.5918 1.67871 -3.80371 2.51855 -6.62988 2.51855
106
+ c-2.44727 0 -4.6084 -0.670898 -6.48242 -2.01172c-1.87402 -1.3418 -3.32812 -3.2207 -4.3623 -5.62207c-1.03906 -2.41699 -1.55664 -5.06348 -1.55664 -7.94629c0 -2.85156 0.819336 -5.11523 2.45801 -6.77344c1.63281 -1.65918 3.85059 -2.4834 6.63086 -2.4834
107
+ c2.40625 0 4.53613 0.639648 6.38379 1.9248c1.84863 1.28027 3.30273 3.11816 4.3623 5.51953c1.06055 2.40625 1.58789 5.07422 1.58789 7.99707zM147.395 58.4961c0 -2.13477 -0.291992 -4.08594 -0.865234 -5.8623
108
+ c-0.583984 -1.77148 -1.39258 -3.15918 -2.4375 -4.14258c-1.04395 -0.988281 -2.2168 -1.47949 -3.52246 -1.47949c-1.4082 0 -2.47266 0.430664 -3.18945 1.29004c-0.716797 0.850586 -1.0752 2.08887 -1.0752 3.69141c0 2.0127 0.291992 3.90723 0.880859 5.68848
109
+ c0.583008 1.7666 1.41309 3.17969 2.47754 4.21387c1.06543 1.03906 2.27344 1.55664 3.62012 1.55664c1.32129 0 2.33496 -0.429688 3.04688 -1.31055c0.710938 -0.880859 1.06445 -2.08887 1.06445 -3.64551zM171.51 67.7227
110
+ c-1.35156 0 -2.62695 -0.394531 -3.82422 -1.14746c-1.20898 -0.762695 -2.41211 -2.01172 -3.61523 -3.75293h-0.194336l0.455078 4.45996h-4.00293l-5.13086 -24.0488h5.13086l2.30371 10.8701c0.563477 2.66211 1.56641 4.80762 3 6.44531
111
+ c1.43848 1.63379 3.07227 2.45312 4.89453 2.45312c0.702148 0 1.43945 -0.107422 2.22266 -0.3125l1.10547 4.7666c-0.660156 0.173828 -1.44922 0.266602 -2.34473 0.266602zM185.462 67.7227c-2.12012 0 -4.04492 -0.711914 -5.78027 -2.125
112
+ c-1.73633 -1.41309 -3.12891 -3.41992 -4.16309 -6.00098c-1.03906 -2.58594 -1.55664 -5.36035 -1.55664 -8.33008c0 -2.70312 0.588867 -4.78711 1.76172 -6.25684c1.17773 -1.47461 2.80078 -2.2168 4.87402 -2.2168c1.33105 0 2.5957 0.322266 3.78418 0.977539
113
+ c1.1875 0.650391 2.4209 1.75098 3.69629 3.29297h0.15332l-0.414062 -3.83008h3.99805l7.17871 33.8379h-5.06934l-1.65332 -7.78711c-0.348633 -1.50098 -0.614258 -3.32324 -0.803711 -5.43262h-0.174805c-1.29492 2.58008 -3.23535 3.87109 -5.83105 3.87109z
114
+ M182.543 46.9199c-2.27246 0 -3.41504 1.47461 -3.41504 4.41797c0 2.0127 0.323242 3.99902 0.958008 5.93945s1.49512 3.47168 2.56543 4.58789c1.06934 1.11621 2.22168 1.67383 3.45508 1.67383c1.29102 0 2.25293 -0.399414 2.88281 -1.1875
115
+ c0.629883 -0.798828 0.947266 -1.8584 0.947266 -3.17969c0 -1.96094 -0.347656 -3.89648 -1.05469 -5.81152c-0.701172 -1.91504 -1.63867 -3.46094 -2.80566 -4.64844c-1.16699 -1.20312 -2.34473 -1.79199 -3.5332 -1.79199zM223.053 66.2988
116
+ c0 2.90332 -0.839844 5.0791 -2.51367 6.54297c-1.68457 1.45996 -4.18848 2.19141 -7.50586 2.19141h-7.26562l-6.72266 -31.7998h5.15625l2.49805 11.8887h2.3916c4.39258 0 7.81836 0.962891 10.2754 2.89258c2.45801 1.93066 3.68652 4.69043 3.68652 8.28418z
117
+ M207.632 59.4941l2.38574 11.1875h2.59082c1.75586 0 3.05078 -0.369141 3.90137 -1.0957c0.849609 -0.727539 1.27441 -1.87402 1.27441 -3.45605c0 -2.12012 -0.706055 -3.74805 -2.11914 -4.90527c-1.4082 -1.15723 -3.41016 -1.73047 -5.99121 -1.73047h-2.04199z
118
+ M239.943 67.7227c-1.34668 0 -2.62109 -0.394531 -3.82422 -1.14746c-1.20801 -0.762695 -2.41113 -2.01172 -3.61523 -3.75293h-0.194336l0.456055 4.45996h-4.00391l-5.12988 -24.0488h5.12988l2.30371 10.8701c0.563477 2.66211 1.56641 4.80762 3.00098 6.44531
119
+ c1.43848 1.63379 3.07129 2.45312 4.89453 2.45312c0.701172 0 1.43848 -0.107422 2.22168 -0.3125l1.10645 4.7666c-0.661133 0.173828 -1.44922 0.266602 -2.3457 0.266602zM251.484 42.7881c1.43359 0 2.7334 0.137695 3.89062 0.378906
120
+ c1.16797 0.271484 2.44727 0.726562 3.84082 1.36133v4.07031c-1.4082 -0.665039 -2.62695 -1.13672 -3.65625 -1.40723c-1.0293 -0.282227 -2.06348 -0.419922 -3.10742 -0.419922c-1.62891 0 -2.84668 0.460938 -3.66602 1.37207s-1.22949 2.18066 -1.22949 3.78906
121
+ v0.628906l0.046875 0.670898h0.936523c4.46484 0 7.90527 0.75293 10.3271 2.2373c2.41699 1.48535 3.62012 3.54297 3.62012 6.19043c0 1.9248 -0.650391 3.41504 -1.94043 4.46973c-1.2959 1.0498 -3.11328 1.57715 -5.44824 1.57715
122
+ c-2.38086 0 -4.53125 -0.670898 -6.45117 -2.02246s-3.44531 -3.26172 -4.56641 -5.73438c-1.12207 -2.46289 -1.68457 -5.13574 -1.68457 -8.0127c0 -2.87793 0.798828 -5.11523 2.40137 -6.7334c1.60254 -1.61719 3.8291 -2.41602 6.68652 -2.41602zM254.792 63.8008
123
+ c0.911133 0 1.60254 -0.205078 2.07324 -0.609375c0.46582 -0.415039 0.696289 -0.983398 0.696289 -1.73047c0 -1.42871 -0.773438 -2.5293 -2.30859 -3.29785c-1.53613 -0.783203 -3.67188 -1.16699 -6.39551 -1.16699h-0.634766
124
+ c0.538086 2.04785 1.41797 3.69629 2.6416 4.93555c1.22363 1.24414 2.53516 1.86914 3.92773 1.86914zM280.289 50.6211c0 0.9375 -0.168945 1.7666 -0.496094 2.46777c-0.328125 0.722656 -0.819336 1.38281 -1.45996 1.99219
125
+ c-0.628906 0.609375 -1.70996 1.3418 -3.24023 2.20117c-1.47949 0.798828 -2.45312 1.44922 -2.92871 1.96094c-0.481445 0.506836 -0.72168 1.08594 -0.72168 1.74121c0 0.855469 0.322266 1.52051 0.982422 2.00195s1.52051 0.72168 2.58105 0.72168
126
+ c1.82715 0 3.75781 -0.547852 5.78516 -1.64844l1.64844 3.83008c-2.18066 1.20801 -4.67969 1.81738 -7.53125 1.81738c-2.6416 0 -4.73047 -0.640625 -6.28711 -1.91016c-1.55176 -1.2793 -2.3252 -3.04102 -2.3252 -5.28906
127
+ c0 -1.36621 0.374023 -2.57031 1.12207 -3.56836c0.74707 -1.00879 2.02734 -2.00195 3.83984 -2.96973c1.55664 -0.885742 2.58496 -1.5918 3.08203 -2.11914s0.74707 -1.15723 0.74707 -1.90527c0 -0.993164 -0.439453 -1.79688 -1.31055 -2.37012
128
+ c-0.870117 -0.573242 -2.01172 -0.870117 -3.40918 -0.870117c-2.30957 0 -4.5625 0.649414 -6.79004 1.95508v-4.4082c1.9209 -0.967773 4.25 -1.45898 7.00977 -1.45898c3.04102 0 5.42188 0.675781 7.13184 2.03223c1.71582 1.35742 2.57031 3.28711 2.57031 5.7959z
129
+ M299.898 50.6211c0 0.9375 -0.168945 1.7666 -0.496094 2.46777c-0.328125 0.722656 -0.819336 1.38281 -1.45898 1.99219c-0.629883 0.609375 -1.70996 1.3418 -3.24121 2.20117c-1.47949 0.798828 -2.45215 1.44922 -2.92871 1.96094
130
+ c-0.481445 0.506836 -0.72168 1.08594 -0.72168 1.74121c0 0.855469 0.322266 1.52051 0.982422 2.00195c0.661133 0.481445 1.52148 0.72168 2.58105 0.72168c1.82812 0 3.75781 -0.547852 5.78516 -1.64844l1.64844 3.83008
131
+ c-2.18066 1.20801 -4.67969 1.81738 -7.53125 1.81738c-2.6416 0 -4.73047 -0.640625 -6.28711 -1.91016c-1.55176 -1.2793 -2.32422 -3.04102 -2.32422 -5.28906c0 -1.36621 0.373047 -2.57031 1.12109 -3.56836c0.74707 -1.00879 2.02734 -2.00195 3.83984 -2.96973
132
+ c1.55176 -0.885742 2.58008 -1.58691 3.08203 -2.11914c0.492188 -0.527344 0.748047 -1.15723 0.748047 -1.90527c0 -0.993164 -0.44043 -1.79688 -1.31055 -2.37012c-0.871094 -0.573242 -2.0127 -0.870117 -3.41016 -0.870117
133
+ c-2.30957 0 -4.5625 0.649414 -6.78906 1.95508v-4.4082c1.91992 -0.967773 4.24902 -1.45898 7.00879 -1.45898c3.04102 0 5.42188 0.675781 7.13281 2.03223c1.71484 1.35742 2.56934 3.28711 2.56934 5.7959zM119.152 6.96875
134
+ c0 4.03906 -1.05957 7.11621 -3.17383 9.2207c-2.11523 2.09961 -5.14062 3.14844 -9.06738 3.14844h-8.02832l-6.72266 -31.7998h8.72461c3.7373 0 6.99316 0.798828 9.76367 2.37012c2.76953 1.57715 4.87891 3.83984 6.32812 6.76855s2.17578 6.35938 2.17578 10.292z
135
+ M101.146 -8.08496v0l-2.93848 -0.00976562l4.93555 23.0811h3.17969c2.43164 0 4.28516 -0.701172 5.56543 -2.09961c1.27441 -1.39258 1.91406 -3.4248 1.91406 -6.09277c0 -2.9082 -0.506836 -5.48828 -1.53027 -7.74609
136
+ c-1.01855 -2.25781 -2.48828 -4.01953 -4.40332 -5.26367s-4.15723 -1.86914 -6.72266 -1.86914zM131.216 -12.8926c1.43848 0 2.73828 0.138672 3.89551 0.378906c1.16797 0.271484 2.44727 0.727539 3.84082 1.3623v4.07031
137
+ c-1.4082 -0.665039 -2.62695 -1.13672 -3.65625 -1.4082c-1.0293 -0.28125 -2.06348 -0.419922 -3.10742 -0.419922c-1.62891 0 -2.84668 0.460938 -3.66602 1.37207c-0.819336 0.912109 -1.22949 2.18164 -1.22949 3.78906v0.629883l0.046875 0.670898h0.936523
138
+ c4.46484 0 7.90527 0.75293 10.3223 2.2373c2.41602 1.48438 3.625 3.54297 3.625 6.19043c0 1.9248 -0.650391 3.41504 -1.94629 4.46973c-1.29492 1.0498 -3.1123 1.57715 -5.44727 1.57715c-2.38086 0 -4.53125 -0.670898 -6.45117 -2.02246
139
+ c-1.91992 -1.35254 -3.44531 -3.26172 -4.56738 -5.73438c-1.12109 -2.46289 -1.68457 -5.13574 -1.68457 -8.01367c0 -2.87695 0.798828 -5.11426 2.40137 -6.73242s3.83008 -2.41699 6.6875 -2.41699zM134.522 8.12012c0.912109 0 1.60254 -0.205078 2.07422 -0.609375
140
+ c0.46582 -0.414062 0.696289 -0.982422 0.696289 -1.73047c0 -1.42871 -0.773438 -2.5293 -2.30957 -3.29688c-1.53613 -0.783203 -3.6709 -1.16797 -6.39453 -1.16797h-0.634766c0.537109 2.04883 1.41797 3.69727 2.6416 4.93652
141
+ c1.22852 1.24414 2.53418 1.86816 3.92676 1.86816zM148.04 -12.4619v0h5.97461l13.0098 24.0586h-5.4375l-6.76367 -13.0098c-0.332031 -0.604492 -0.803711 -1.55664 -1.41309 -2.87207c-0.608398 -1.32129 -1.11621 -2.51953 -1.52051 -3.58984h-0.15332
142
+ c0 2.00195 -0.102539 4.16309 -0.307617 6.46191l-1.19727 13.0098h-5.04395zM175.391 -12.8926c1.43848 0 2.73926 0.138672 3.90137 0.378906c1.16797 0.271484 2.44727 0.727539 3.83984 1.3623v4.07031c-1.40723 -0.665039 -2.62598 -1.13672 -3.65527 -1.4082
143
+ c-1.0293 -0.28125 -2.06348 -0.419922 -3.1084 -0.419922c-1.62793 0 -2.84668 0.460938 -3.66504 1.37207c-0.819336 0.912109 -1.22949 2.18164 -1.22949 3.78906v0.629883l0.0458984 0.670898h0.932617c4.46387 0 7.90527 0.75293 10.3213 2.2373
144
+ c2.41699 1.48438 3.625 3.54297 3.625 6.19043c0 1.9248 -0.650391 3.41504 -1.94531 4.46973c-1.29492 1.0498 -3.11328 1.57715 -5.44727 1.57715c-2.38086 0 -4.53125 -0.670898 -6.45117 -2.02246c-1.9209 -1.35254 -3.44629 -3.26172 -4.56738 -5.73438
145
+ c-1.12109 -2.46289 -1.68457 -5.13574 -1.68457 -8.01367c0 -2.87695 0.798828 -5.11426 2.40137 -6.73242s3.83008 -2.41699 6.68652 -2.41699zM178.698 8.12012c0.911133 0 1.60254 -0.205078 2.07324 -0.609375c0.46582 -0.414062 0.696289 -0.982422 0.696289 -1.73047
146
+ c0 -1.42871 -0.772461 -2.5293 -2.30859 -3.29688c-1.53613 -0.783203 -3.6709 -1.16797 -6.39551 -1.16797h-0.634766c0.538086 2.04883 1.41895 3.69727 2.64258 4.93652c1.22852 1.24414 2.53418 1.86816 3.92676 1.86816zM193.301 -12.4619l7.19824 33.8486h-5.10938
147
+ l-7.17871 -33.8486h5.08984zM222.459 2.5957c0 2.89258 -0.798828 5.19727 -2.3916 6.87598c-1.5918 1.67969 -3.80371 2.51953 -6.62988 2.51953c-2.44727 0 -4.6084 -0.670898 -6.48242 -2.0127c-1.87305 -1.34082 -3.32715 -3.21973 -4.36133 -5.62109
148
+ c-1.04004 -2.41699 -1.55664 -5.06445 -1.55664 -7.94629c0 -2.85254 0.819336 -5.11523 2.45703 -6.77441c1.63379 -1.6582 3.85059 -2.48242 6.63086 -2.48242c2.40625 0 4.53613 0.639648 6.38477 1.9248c1.84766 1.28027 3.30762 3.11816 4.3623 5.51953
149
+ c1.05469 2.40625 1.58691 5.07324 1.58691 7.99707zM217.303 2.81641c0 -2.13574 -0.291992 -4.08594 -0.865234 -5.86328c-0.583008 -1.77148 -1.39258 -3.1582 -2.43652 -4.1416c-1.04492 -0.988281 -2.21777 -1.47949 -3.52246 -1.47949
150
+ c-1.4082 0 -2.47363 0.429688 -3.19043 1.29004c-0.716797 0.849609 -1.0752 2.08887 -1.0752 3.69141c0 2.0127 0.291992 3.90625 0.880859 5.68848c0.583984 1.7666 1.41309 3.17969 2.47852 4.21387c1.06445 1.03906 2.27246 1.55664 3.61914 1.55664
151
+ c1.32129 0 2.33496 -0.430664 3.04688 -1.31055c0.711914 -0.880859 1.06445 -2.08984 1.06445 -3.64551zM236.651 -12.8926c2.09961 0 4.02441 0.716797 5.77539 2.14551s3.13379 3.44043 4.14746 6.01074c1.01367 2.57617 1.52051 5.34082 1.52051 8.2998
152
+ c0 2.65723 -0.583984 4.72559 -1.76172 6.2207c-1.17676 1.49512 -2.7998 2.24316 -4.87402 2.24316c-2.70801 0 -5.20215 -1.51074 -7.48047 -4.52637h-0.194336l0.456055 4.0957h-4.00391l-7.35254 -34.7598h5.06934l2.08887 10.0713
153
+ c0.260742 1.28027 0.439453 2.62109 0.541992 4.0293h0.21582c1.27441 -2.55957 3.22559 -3.83008 5.85156 -3.83008zM239.544 7.85938c2.24805 0 3.36914 -1.45898 3.37402 -4.37305c0 -2.07812 -0.311523 -4.07031 -0.936523 -5.97949
154
+ c-0.625 -1.89941 -1.47461 -3.4209 -2.54492 -4.56738c-1.06934 -1.14648 -2.22168 -1.70996 -3.45605 -1.70996c-1.2334 0 -2.18555 0.388672 -2.86133 1.16699c-0.675781 0.783203 -1.01465 1.86914 -1.01465 3.26172c0 2.02246 0.369141 3.98828 1.10156 5.8877
155
+ c0.726562 1.90527 1.67383 3.43066 2.83594 4.58301c1.15723 1.15723 2.33008 1.73047 3.50195 1.73047zM267.279 12.042c-2.9541 0 -5.50879 -1.64355 -7.66504 -4.89453h-0.194336l0.456055 4.45996h-4.00391l-5.12988 -24.0596h5.12988l2.13477 10.1992
156
+ c0.645508 3.06152 1.64844 5.52441 3.00586 7.35742c1.35156 1.84375 2.82617 2.76465 4.42871 2.76465c1.68945 0 2.53906 -0.977539 2.53906 -2.93359c0 -0.655273 -0.117188 -1.57715 -0.368164 -2.76465l-3.10254 -14.6123h5.10938l2.20117 10.46
157
+ c0.620117 2.96973 1.60352 5.3457 2.96484 7.14746c1.34668 1.79688 2.81641 2.69824 4.37793 2.69824c1.76074 0 2.63672 -0.942383 2.63672 -2.81055c0 -0.542969 -0.132812 -1.50586 -0.410156 -2.8877l-3.10254 -14.6123h5.11035l3.04102 14.1973
158
+ c0.327148 1.7002 0.481445 3.01074 0.481445 3.94238c0 2.0127 -0.501953 3.56836 -1.51074 4.67969c-1.00391 1.11621 -2.46777 1.66895 -4.40332 1.66895c-1.48926 0 -2.92871 -0.429688 -4.31641 -1.2998c-1.39258 -0.860352 -2.62109 -2.12988 -3.71191 -3.80957
159
+ h-0.173828c-0.496094 3.39941 -2.33496 5.10938 -5.52441 5.10938zM299.986 -12.8926c1.43359 0 2.73926 0.138672 3.88574 0.378906c1.17285 0.271484 2.45215 0.727539 3.83984 1.3623v4.07031c-1.4082 -0.665039 -2.62695 -1.13672 -3.65039 -1.4082
160
+ c-1.0293 -0.28125 -2.06836 -0.419922 -3.1084 -0.419922c-1.63281 0 -2.85156 0.460938 -3.6709 1.37207c-0.819336 0.912109 -1.22363 2.18164 -1.22363 3.78906v0.629883l0.0458984 0.670898h0.942383c4.45996 0 7.90039 0.75293 10.3223 2.2373
161
+ c2.41602 1.48438 3.62012 3.54297 3.62012 6.19043c0 1.9248 -0.650391 3.41504 -1.95117 4.46973c-1.28516 1.0498 -3.10742 1.57715 -5.44238 1.57715c-2.37598 0 -4.52637 -0.670898 -6.44629 -2.02246c-1.9248 -1.35254 -3.45117 -3.26172 -4.57227 -5.73438
162
+ c-1.13184 -2.46289 -1.68945 -5.13574 -1.68945 -8.01367c0 -2.87695 0.808594 -5.12988 2.41113 -6.73242c1.60254 -1.61816 3.83008 -2.41699 6.6875 -2.41699zM303.288 8.12012c0.916992 0 1.6084 -0.205078 2.05371 -0.609375
163
+ c0.459961 -0.414062 0.701172 -0.982422 0.701172 -1.73047c0 -1.42871 -0.768555 -2.5293 -2.30371 -3.29688c-1.54688 -0.783203 -3.67676 -1.16797 -6.39551 -1.16797h-0.629883c0.542969 2.04883 1.41309 3.69727 2.64258 4.93652
164
+ c1.2334 1.24414 2.54395 1.86816 3.93164 1.86816zM327.056 -12.4619h0.00488281v0.015625h5.13574l2.97949 14.208c0.342773 1.62305 0.501953 2.93848 0.501953 3.93164c0 2.0332 -0.533203 3.59961 -1.59766 4.7002c-1.07031 1.10645 -2.57031 1.64844 -4.51562 1.64844
165
+ c-1.49512 0 -2.88281 -0.393555 -4.16309 -1.16699c-1.26953 -0.773438 -2.52441 -2.0127 -3.72168 -3.73242h-0.195312l0.456055 4.45898h-3.99902l-5.12988 -24.0479h5.12988l2.12988 10.1982c0.410156 1.97168 1.01367 3.73242 1.82812 5.28906
166
+ c0.808594 1.55664 1.71484 2.75488 2.73926 3.5791s2.05273 1.23926 3.09277 1.23926c1.86816 0 2.81055 -0.952148 2.81055 -2.85156c0 -0.604492 -0.12793 -1.55176 -0.399414 -2.85742zM347.51 -8.76074c-0.737305 0 -1.29004 0.18457 -1.65332 0.547852
167
+ c-0.358398 0.369141 -0.538086 0.871094 -0.538086 1.49023c0 0.547852 0.0976562 1.21387 0.28125 2.0127l2.66309 12.4414h6.02051l0.850586 3.87012h-6.07227l1.13086 5.35059h-3.16895l-2.81055 -5.03809l-4.13184 -1.79199l-0.460938 -2.39062h3.52246
168
+ l-2.63184 -12.4014c-0.235352 -1.06934 -0.348633 -2.02148 -0.348633 -2.85156c0 -3.5791 1.99219 -5.37109 5.95996 -5.37109c0.870117 0 1.74121 0.0976562 2.61133 0.287109c0.875977 0.18457 1.55664 0.404297 2.06836 0.650391v3.87012
169
+ c-1.21289 -0.450195 -2.31445 -0.675781 -3.29199 -0.675781zM116.858 188.001l11.6797 56.1611h15.6816l3.50293 15.9287h-50.6885l-3.4043 -15.9287h15.6309l-11.6836 -56.1611h19.2812zM164.168 187.019c6.3125 0 11.8369 1.54102 16.5684 4.62793
170
+ c4.73047 3.08789 8.40137 7.42383 11.0176 12.9951c2.61621 5.5752 3.92188 11.8115 3.92188 18.7129c0 6.90234 -1.86328 12.2119 -5.5957 15.9287c-3.73242 3.71191 -9.03223 5.57031 -15.9023 5.57031c-6.31348 0 -11.833 -1.54102 -16.5684 -4.63379
171
+ c-4.73145 -3.0918 -8.40723 -7.42383 -11.0186 -12.9941c-2.61621 -5.5752 -3.92188 -11.8115 -3.92188 -18.7139c0 -6.90137 1.86328 -12.2109 5.5957 -15.9277c3.73242 -3.71777 9.03223 -5.56543 15.9033 -5.56543zM171.96 230.508
172
+ c1.31641 0 2.35059 -0.547852 3.1084 -1.6543c0.757812 -1.10059 1.13672 -2.73926 1.13672 -4.9043c0 -5.9502 -0.988281 -11.208 -2.95996 -15.7803c-1.9707 -4.57227 -4.28516 -6.85547 -6.95312 -6.85547c-2.75879 0 -4.1416 2.18652 -4.1416 6.55859
173
+ c0 5.91895 0.957031 11.167 2.88281 15.7539c1.91992 4.58789 4.22852 6.88184 6.92676 6.88184zM222.331 187.019c6.3125 0 11.832 1.54102 16.5684 4.62793c4.73047 3.08789 8.40137 7.42383 11.0176 12.9951c2.61719 5.5752 3.92285 11.8115 3.92285 18.7129
174
+ c0 6.90234 -1.86426 12.2119 -5.59668 15.9287c-3.73242 3.71191 -9.03125 5.57031 -15.9023 5.57031c-6.31348 0 -11.833 -1.54102 -16.5684 -4.63379c-4.73145 -3.0918 -8.40723 -7.42383 -11.0186 -12.9941c-2.61621 -5.5752 -3.92188 -11.8115 -3.92188 -18.7139
175
+ c0 -6.90137 1.86328 -12.2109 5.5957 -15.9277c3.73242 -3.71777 9.03223 -5.56543 15.9033 -5.56543zM230.123 230.508c1.31152 0 2.35059 -0.547852 3.1084 -1.6543c0.757812 -1.10059 1.13672 -2.73926 1.13672 -4.9043c0 -5.9502 -0.988281 -11.208 -2.95996 -15.7803
176
+ c-1.9707 -4.57227 -4.28516 -6.85547 -6.95215 -6.85547c-2.75977 0 -4.14258 2.18652 -4.14258 6.55859c0 5.91895 0.958008 11.167 2.88281 15.7539c1.91992 4.58789 4.22852 6.88184 6.92676 6.88184zM275.072 188.001l16.2197 76.7236h-19.0869l-16.2207 -76.7236
177
+ h19.0879zM328.494 207.381c0 6.83496 -3.69141 12.0986 -11.0947 15.7744c-2.33496 1.15234 -4.01953 2.08887 -5.05371 2.81055c-1.03418 0.722656 -1.55176 1.56152 -1.55176 2.51465c0 2.2373 1.23926 3.35352 3.73828 3.35352
178
+ c1.67383 0 3.68066 -0.419922 5.99023 -1.25977c2.31934 -0.839844 4.55664 -1.96582 6.72754 -3.37891l5.96973 12.4258c-2.8623 1.77637 -5.80566 3.09277 -8.83203 3.94727c-3.03125 0.855469 -6.37891 1.28027 -10.0605 1.28027
179
+ c-7.33203 0 -12.9844 -1.53125 -16.9629 -4.58789c-3.96777 -3.05664 -5.96484 -7.41309 -5.96484 -13.0654c0 -3.54883 0.793945 -6.55371 2.3916 -9.02148c1.5918 -2.46777 4.13184 -4.6543 7.61816 -6.55957c3.41504 -1.94043 5.55566 -3.32715 6.41016 -4.16699
180
+ c0.855469 -0.839844 1.28027 -1.83301 1.28027 -2.98535c0 -1.08496 -0.552734 -1.92969 -1.6748 -2.53906c-1.11035 -0.609375 -2.78516 -0.912109 -5.02734 -0.912109c-2.66211 0 -5.28906 0.328125 -7.88965 0.988281
181
+ c-2.59082 0.655273 -5.40234 1.80762 -8.42773 3.45117v-15.334c4.4082 -2.06934 10.2549 -3.09766 17.5566 -3.09766c8.02832 0 14.1719 1.75586 18.4473 5.27344c4.26953 3.51758 6.41016 8.5498 6.41016 15.0889zM358.349 187.019
182
+ c4.17285 0 7.84961 0.373047 11.0391 1.10059c3.18945 0.742188 6.62012 2.04785 10.3115 3.92188v13.5117c-3.18945 -1.67969 -6.04199 -2.90332 -8.53027 -3.67578c-2.49805 -0.773438 -5.04785 -1.15723 -7.64355 -1.15723c-5.3916 0 -8.08496 2.43164 -8.08496 7.2959
183
+ v0.788086h2.9082c9.72852 0 17.1572 1.77148 22.3076 5.30469c5.14062 3.53223 7.71094 8.60645 7.71094 15.2109c0 4.70605 -1.79199 8.46875 -5.37109 11.2949c-3.57812 2.82617 -8.49902 4.23926 -14.7451 4.23926c-6.27246 0 -11.8018 -1.43359 -16.5938 -4.31055
184
+ c-4.78223 -2.87793 -8.54004 -7.10156 -11.29 -12.6719c-2.73926 -5.57617 -4.12109 -11.833 -4.12109 -18.7656c0 -6.9375 1.94043 -12.3486 5.82129 -16.2451s9.31348 -5.8418 16.2812 -5.8418zM366.142 231.936c1.44336 0 2.49316 -0.363281 3.15332 -1.08496
185
+ c0.65625 -0.72168 0.983398 -1.60742 0.983398 -2.66211c0 -2.2373 -1.0293 -4.03516 -3.06152 -5.40234c-2.0332 -1.36133 -4.84863 -2.04199 -8.42773 -2.04199h-1.42871c0.364258 2.89258 1.41309 5.4834 3.1543 7.7666c1.74609 2.2832 3.62012 3.4248 5.62695 3.4248z
186
+ M415.432 202.353c-2.08398 0 -3.11328 1.03418 -3.09277 3.11328c0 0.916016 0.255859 2.64648 0.789062 5.17578l4.14648 18.8828h14.2441l3.1084 14.3516h-14.1982l2.41699 11.1924h-12.7129l-6.75391 -11.832l-10.7568 -4.3418l-2.02734 -9.37012h7.59277
187
+ l-4.14746 -19.8242c-0.783203 -3.68164 -1.18262 -6.77441 -1.18262 -9.27246c0 -4.7666 1.25977 -8.19727 3.76855 -10.2812c2.51367 -2.08887 6.20508 -3.12793 11.0693 -3.12793c6.70703 0 12.2881 1.10059 16.7578 3.30176v14.3516
188
+ c-3.83984 -1.55078 -6.85059 -2.31934 -9.02148 -2.31934z" />
189
+ <glyph glyph-name="uniF11E" unicode="&#xf11e;"
190
+ d="M371.2 345.6h76.7998v-384h-384v384h76.7998v76.8008h76.7998v-76.8008h76.8008v76.8008h76.7998v-76.8008zM119.507 152.666c152.32 -172.615 276.192 0 276.192 0c-152.32 168.55 -276.192 0 -276.192 0zM257.594 203.808c28.7549 0 52.0576 -23.3086 52.0576 -52.0576
191
+ c0 -28.7227 -23.2959 -52.0381 -52.0576 -52.0381c-28.7295 0 -52.0322 23.3154 -52.0322 52.0381c0 28.749 23.3027 52.0576 52.0322 52.0576zM257.594 117.453c18.957 0 34.3164 15.3594 34.3164 34.2969c0 18.957 -15.3594 34.3105 -34.3164 34.3105
192
+ c-18.9316 0 -34.2979 -15.3535 -34.2979 -34.3105c0 -18.9375 15.3662 -34.2969 34.2979 -34.2969z" />
193
+ <glyph glyph-name="uniF115" unicode="&#xf115;"
194
+ d="M371.2 345.6h76.7998v-384h-384v384h76.7998v76.8008h76.7998v-76.8008h76.8008v76.8008h76.7998v-76.8008zM342.624 49.6641l0.0126953 1.03027l-0.441406 50.0029l-0.0703125 -1.29199c-0.0830078 -0.793945 -0.210938 -1.58789 -0.397461 -2.36816
195
+ l-0.0761719 -0.230469c-0.185547 -0.678711 -0.422852 -1.36328 -0.710938 -2.0293l-0.236328 -0.5625c-0.313477 -0.672852 -0.65918 -1.33789 -1.0625 -2.00391l-0.102539 -0.15332c-0.435547 -0.697266 -0.972656 -1.38867 -1.49707 -2.07324l-0.442383 -0.525391
196
+ c-0.524414 -0.594727 -1.06836 -1.19629 -1.66406 -1.79785l-0.306641 -0.300781c-0.723633 -0.704102 -1.5293 -1.40234 -2.3877 -2.08691l-0.537109 -0.40332c-0.954102 -0.729492 -1.93945 -1.47168 -3.02734 -2.16309l-0.185547 -0.133789
197
+ c-1.33789 -0.864258 -2.77734 -1.70898 -4.30078 -2.51562c-0.889648 -0.480469 -1.84961 -0.954102 -2.80371 -1.41406l-0.978516 -0.448242c-0.671875 -0.307617 -1.33789 -0.601562 -2.03516 -0.896484l-0.876953 -0.371094
198
+ c-1.62598 -0.671875 -3.32812 -1.31152 -5.0752 -1.92578l-0.710938 -0.237305c-1.79199 -0.601562 -3.63477 -1.18359 -5.54883 -1.73438l-0.703125 -0.185547c-2.18262 -0.614258 -4.46777 -1.19043 -6.8291 -1.69629l-0.838867 -0.185547
199
+ c-2.38672 -0.511719 -4.83203 -0.998047 -7.36621 -1.41406l-0.774414 -0.134766c-2.04785 -0.332031 -4.12109 -0.626953 -6.2207 -0.889648l-1.08789 -0.133789c-2.125 -0.255859 -4.28809 -0.480469 -6.47656 -0.65918l-1.02441 -0.0966797
200
+ c-2.56641 -0.178711 -5.16504 -0.332031 -7.80176 -0.447266l-1.20898 -0.0449219c-2.1377 -0.0703125 -4.33984 -0.12207 -6.52832 -0.12207c-1.26758 0 -2.54102 0 -3.81445 0.0126953c-1.31836 0.0263672 -2.61719 0.0644531 -3.91016 0.109375
201
+ c-1.8623 0.0634766 -3.71875 0.140625 -5.54883 0.262695l-1.46582 0.0957031c-1.4209 0.115234 -2.82227 0.205078 -4.21777 0.338867l-1.43359 0.115234c-1.74023 0.15332 -3.44922 0.333008 -5.13867 0.538086l-1.03711 0.140625
202
+ c-1.44043 0.178711 -2.84766 0.383789 -4.25586 0.588867l-1.37598 0.198242c-1.72168 0.275391 -3.41797 0.563477 -5.08789 0.876953l-0.40332 0.0830078c-1.65137 0.313477 -3.27734 0.652344 -4.87695 1.01074l-1.1709 0.256836
203
+ c-1.79199 0.40918 -3.55273 0.857422 -5.28027 1.31152l-0.857422 0.237305c-2.02246 0.543945 -3.9873 1.12598 -5.8877 1.74707l-1.2041 0.40332c-0.780273 0.261719 -1.56152 0.537109 -2.31641 0.8125l-1.35645 0.499023
204
+ c-0.743164 0.275391 -1.47852 0.563477 -2.20215 0.851562l-1.26074 0.511719l-1.47168 0.633789l-1.4082 0.633789l-1.4209 0.665039l-1.33789 0.65918l-1.33105 0.691406l-1.26074 0.666016l-1.26074 0.729492l-1.17773 0.665039l-1.18359 0.761719l-1.08203 0.704102
205
+ l-1.08789 0.774414l-1.01074 0.729492l-1.00488 0.799805l-0.93457 0.749023l-0.915039 0.825195l-0.844727 0.761719l-0.813477 0.826172l-0.760742 0.787109l-0.691406 0.864258l-0.671875 0.8125l-0.601562 0.851562l-0.576172 0.837891l-0.511719 0.864258
206
+ l-0.5 0.850586l-0.383789 0.896484l-0.37793 0.870117l-0.293945 0.915039l-0.268555 0.864258l-0.198242 1.02441l-0.147461 0.761719c-0.0830078 0.614258 -0.12207 1.20898 -0.12207 1.82324l0.435547 -50.0098c0 -0.614258 0.0449219 -1.20898 0.121094 -1.81738
207
+ l0.102539 -0.543945l0.25 -1.24805l0.210938 -0.665039l0.352539 -1.11426l0.300781 -0.697266l0.473633 -1.0498l0.40332 -0.722656l0.569336 -0.999023l0.518555 -0.729492l0.65918 -0.94043l0.607422 -0.736328l0.78125 -0.953125l0.697266 -0.729492l0.864258 -0.889648
208
+ l0.806641 -0.723633l0.947266 -0.857422l0.895508 -0.729492l1.03711 -0.813477l0.998047 -0.722656l1.10742 -0.787109l1.10742 -0.716797l1.16406 -0.729492l1.20312 -0.698242l1.22949 -0.709961l1.29297 -0.68457l1.30566 -0.671875l1.40137 -0.672852
209
+ l1.32422 -0.632812l1.51074 -0.666016l1.38281 -0.588867l0.459961 -0.198242l0.845703 -0.326172c0.722656 -0.294922 1.43359 -0.583008 2.17578 -0.851562l1.36328 -0.505859c0.780273 -0.274414 1.54883 -0.537109 2.3418 -0.8125l0.896484 -0.307617l0.28125 -0.101562
210
+ c1.89453 -0.601562 3.85254 -1.17773 5.86914 -1.73438l0.505859 -0.154297l0.402344 -0.0957031c1.70312 -0.454102 3.45605 -0.889648 5.23535 -1.30566l0.499023 -0.134766l0.716797 -0.140625c1.60645 -0.333008 3.21289 -0.68457 4.87109 -0.998047
211
+ l0.300781 -0.0644531l0.0761719 -0.0126953c1.66406 -0.319336 3.35352 -0.607422 5.05664 -0.870117l0.652344 -0.12207l0.793945 -0.101562c1.37598 -0.211914 2.76465 -0.416016 4.17871 -0.588867l0.826172 -0.12793l0.268555 -0.0136719
212
+ c1.67676 -0.210938 3.37891 -0.396484 5.10059 -0.5625l0.53125 -0.0576172l0.959961 -0.0771484c1.37012 -0.134766 2.75195 -0.223633 4.14746 -0.333008l1.00488 -0.0761719l0.499023 -0.0263672c1.82422 -0.114258 3.67383 -0.198242 5.53613 -0.261719
213
+ l0.396484 -0.0126953c1.17188 -0.0449219 2.34277 -0.0644531 3.51367 -0.0839844c1.16504 -0.03125 2.29785 -0.03125 3.44336 -0.03125h0.383789c2.20215 0.0126953 4.37109 0.0576172 6.53418 0.133789l0.672852 0.0126953l0.517578 0.0263672
214
+ c2.65625 0.0957031 5.26074 0.249023 7.80859 0.454102l0.543945 0.0449219l0.486328 0.0380859c2.20117 0.198242 4.35156 0.416016 6.46387 0.65918l1.08789 0.134766c2.10547 0.261719 4.19238 0.563477 6.2207 0.889648l0.40332 0.0703125l0.473633 0.0957031
215
+ c2.48926 0.416016 4.92188 0.876953 7.27734 1.38867l0.844727 0.179688c2.34863 0.511719 4.60742 1.08105 6.80273 1.70898l0.441406 0.101562l0.300781 0.102539c1.88867 0.538086 3.73828 1.11426 5.49121 1.72168l0.761719 0.243164
216
+ c1.7666 0.621094 3.46875 1.28027 5.09473 1.95215l0.390625 0.134766l0.416016 0.191406c0.716797 0.300781 1.42676 0.614258 2.11816 0.941406l0.953125 0.43457c0.871094 0.40332 1.73438 0.838867 2.56055 1.26758l0.261719 0.134766l0.0517578 0.0253906
217
+ c1.48438 0.787109 2.86719 1.625 4.16016 2.45117l0.217773 0.12793l0.0703125 0.0634766c1.05566 0.678711 2.02832 1.40234 2.95605 2.125l0.358398 0.25l0.25 0.210938c0.838867 0.666016 1.62598 1.35059 2.34863 2.04199l0.102539 0.0830078l0.223633 0.275391
218
+ c0.588867 0.556641 1.13965 1.14551 1.63867 1.75293l0.275391 0.307617l0.160156 0.217773c0.563477 0.677734 1.0752 1.37598 1.50391 2.08008l0.0253906 0.03125l0.0703125 0.102539c0.410156 0.65332 0.755859 1.34473 1.0752 2.0166l0.134766 0.275391
219
+ l0.115234 0.293945c0.275391 0.652344 0.537109 1.35059 0.691406 2.02832l0.0761719 0.179688v0.0576172c0.210938 0.774414 0.333008 1.57422 0.397461 2.36133zM342.624 121.312l0.0253906 1.05664l-0.441406 50.0029l-0.0703125 -1.29883
220
+ c-0.0771484 -0.787109 -0.210938 -1.57422 -0.396484 -2.3623l-0.0771484 -0.236328c-0.185547 -0.671875 -0.422852 -1.35059 -0.710938 -2.02246l-0.236328 -0.563477c-0.313477 -0.677734 -0.652344 -1.33691 -1.05566 -2.00293l-0.109375 -0.160156
221
+ c-0.43457 -0.68457 -0.972656 -1.40137 -1.49707 -2.07324l-0.441406 -0.518555c-0.525391 -0.601562 -1.06934 -1.20312 -1.66406 -1.79199l-0.307617 -0.313477c-0.723633 -0.697266 -1.5293 -1.4082 -2.38086 -2.07422l-0.543945 -0.40918
222
+ c-0.953125 -0.742188 -1.93945 -1.47852 -3.02734 -2.16992l-0.185547 -0.133789c-1.33789 -0.864258 -2.77734 -1.70898 -4.30078 -2.50879c-0.889648 -0.486328 -1.84961 -0.972656 -2.80273 -1.4209l-0.979492 -0.448242
223
+ c-0.671875 -0.293945 -1.33789 -0.614258 -2.03516 -0.915039l-0.876953 -0.352539c-1.62598 -0.677734 -3.32812 -1.31152 -5.0752 -1.91992l-0.709961 -0.243164c-1.79199 -0.614258 -3.63574 -1.19043 -5.54883 -1.72754l-0.698242 -0.192383
224
+ c-2.18848 -0.607422 -4.47363 -1.18359 -6.83496 -1.70898l-0.838867 -0.178711c-2.38672 -0.518555 -4.83105 -0.992188 -7.36621 -1.4209l-0.774414 -0.134766c-2.04785 -0.326172 -4.12109 -0.620117 -6.2207 -0.882812l-1.08789 -0.134766
225
+ c-2.125 -0.249023 -4.28809 -0.479492 -6.47656 -0.652344l-1.02441 -0.0898438c-2.56641 -0.198242 -5.16406 -0.345703 -7.80176 -0.448242l-1.20898 -0.0634766c-2.1377 -0.0644531 -4.33984 -0.12207 -6.52832 -0.12207c-1.2666 0 -2.54102 0 -3.81445 0.0263672
226
+ c-1.31836 0.0126953 -2.61719 0.0576172 -3.91016 0.0957031c-1.8623 0.0634766 -3.71875 0.15332 -5.54883 0.275391l-1.47852 0.0185547c-1.4209 0.102539 -2.82227 0.211914 -4.21777 0.339844l-1.43359 0.12793c-1.74023 0.160156 -3.44922 0.358398 -5.13867 0.549805
227
+ l-1.03711 0.134766c-1.44043 0.198242 -2.84766 0.396484 -4.25586 0.608398l-1.37598 0.204102c-1.72168 0.275391 -3.41797 0.550781 -5.08789 0.871094l-0.40332 0.0761719c-1.65137 0.327148 -3.27734 0.65332 -4.87695 1.02441l-1.1709 0.249023
228
+ c-1.79199 0.416016 -3.55273 0.851562 -5.28027 1.3125l-0.857422 0.230469c-2.02246 0.549805 -3.9873 1.13867 -5.8877 1.75391l-1.2041 0.40918c-0.780273 0.262695 -1.56152 0.524414 -2.31641 0.8125l-1.35645 0.480469
229
+ c-0.743164 0.288086 -1.47852 0.582031 -2.20215 0.870117l-1.26074 0.511719l-1.47168 0.62793l-1.4082 0.626953l-1.4209 0.671875l-1.33789 0.652344l-1.33105 0.698242l-1.26074 0.665039l-1.26074 0.730469l-1.17773 0.677734l-1.18359 0.742188l-1.08203 0.710938
230
+ l-1.08789 0.780273l-1.01074 0.710938l-1.00488 0.8125l-0.93457 0.736328l-0.915039 0.825195l-0.844727 0.761719l-0.813477 0.838867l-0.760742 0.787109l-0.691406 0.850586l-0.671875 0.813477l-0.601562 0.850586l-0.576172 0.844727l-0.511719 0.876953
231
+ l-0.5 0.857422l-0.383789 0.889648l-0.37793 0.864258l-0.293945 0.915039l-0.268555 0.864258l-0.198242 1.01074l-0.147461 0.774414c-0.0830078 0.601562 -0.12207 1.20996 -0.12207 1.81836l0.435547 -50.0039c0 -0.614258 0.0449219 -1.20312 0.121094 -1.81738
232
+ l0.102539 -0.556641l0.25 -1.23535l0.210938 -0.665039l0.352539 -1.11426l0.300781 -0.709961l0.473633 -1.04297l0.40332 -0.723633l0.569336 -0.992188l0.518555 -0.735352l0.65918 -0.947266l0.607422 -0.736328l0.787109 -0.927734l0.698242 -0.723633
233
+ l0.863281 -0.889648l0.806641 -0.736328l0.947266 -0.850586l0.896484 -0.723633l1.03613 -0.819336l0.999023 -0.729492l1.10645 -0.761719l1.10742 -0.722656l1.16504 -0.736328l1.20312 -0.697266l1.22852 -0.710938l1.29297 -0.68457l1.30566 -0.665039
234
+ l1.40137 -0.685547l1.3252 -0.639648l1.51074 -0.666016l1.38184 -0.587891l0.460938 -0.199219l0.844727 -0.338867c0.723633 -0.28125 1.43359 -0.569336 2.17578 -0.844727l1.36328 -0.493164c0.78125 -0.28125 1.54883 -0.549805 2.34277 -0.832031l0.895508 -0.300781
235
+ l0.282227 -0.0761719c1.89453 -0.621094 3.85254 -1.20312 5.86816 -1.76074l0.505859 -0.140625l0.396484 -0.0830078c1.70312 -0.460938 3.45605 -0.895508 5.23535 -1.29883l0.499023 -0.134766l0.716797 -0.134766c1.60645 -0.351562 3.21289 -0.69043 4.87109 -1.01074
236
+ l0.300781 -0.0644531l0.0761719 -0.0126953c1.66406 -0.319336 3.35352 -0.607422 5.05664 -0.870117l0.652344 -0.121094l0.793945 -0.109375c1.37598 -0.210938 2.76465 -0.40332 4.17871 -0.588867l0.826172 -0.121094l0.268555 -0.0263672
237
+ c1.67676 -0.204102 3.37891 -0.396484 5.10059 -0.549805l0.53125 -0.0703125l0.959961 -0.0644531c1.37012 -0.12793 2.75195 -0.236328 4.14746 -0.326172l1.00488 -0.0771484l0.499023 -0.03125c1.82422 -0.109375 3.67383 -0.192383 5.53613 -0.256836
238
+ l0.396484 -0.0253906c1.17188 -0.0380859 2.34277 -0.0634766 3.51367 -0.0898438c1.16504 -0.0126953 2.29785 -0.0126953 3.44336 -0.0126953h0.383789c2.20215 0 4.37109 0.0644531 6.53418 0.12793l0.672852 0.0136719l0.517578 0.0380859
239
+ c2.65625 0.0957031 5.26074 0.249023 7.80859 0.454102l0.543945 0.0322266l0.486328 0.0507812c2.20117 0.192383 4.35156 0.40332 6.46387 0.65332l1.08789 0.133789c2.10547 0.269531 4.19238 0.557617 6.2207 0.90332l0.40332 0.0507812l0.473633 0.0898438
240
+ c2.48926 0.428711 4.92188 0.889648 7.27734 1.40137l0.844727 0.178711c2.34863 0.518555 4.60742 1.08203 6.80273 1.69629l0.448242 0.0957031l0.300781 0.12207c1.8877 0.524414 3.7373 1.10059 5.49121 1.70898l0.761719 0.249023
241
+ c1.7666 0.62793 3.46875 1.26758 5.09375 1.95215l0.390625 0.134766l0.40332 0.191406c0.716797 0.288086 1.43359 0.595703 2.11816 0.93457l0.959961 0.422852c0.864258 0.40918 1.72852 0.837891 2.56055 1.28027l0.261719 0.133789l0.0517578 0.0253906
242
+ c1.47852 0.787109 2.86035 1.61328 4.15332 2.45117l0.217773 0.12207l0.0771484 0.0703125c1.05566 0.671875 2.02832 1.38867 2.95605 2.1123l0.358398 0.243164l0.25 0.223633c0.838867 0.666016 1.62598 1.34375 2.34863 2.04199l0.102539 0.0888672l0.223633 0.256836
243
+ c0.588867 0.5625 1.13965 1.16406 1.63867 1.76562l0.275391 0.300781l0.160156 0.224609c0.563477 0.677734 1.0752 1.37598 1.50391 2.08594l0.0253906 0.0126953l0.0703125 0.12207c0.410156 0.652344 0.755859 1.33789 1.0752 2.01562l0.134766 0.262695
244
+ l0.115234 0.300781c0.275391 0.65918 0.537109 1.33789 0.691406 2.02246l0.0761719 0.192383v0.0439453c0.210938 0.78125 0.333008 1.5752 0.397461 2.3623zM342.624 192.947l0.0253906 0.998047l-0.43457 50.0166l-0.0771484 -1.2998
245
+ c-0.0576172 -0.607422 -0.172852 -1.21582 -0.300781 -1.81738c-3.66113 18.0225 -40.5762 32.7168 -85.5742 33.4082c-44.96 0.691406 -81.7344 -12.8262 -85.3701 -30.7012l-0.0898438 0.448242l-0.146484 0.774414
246
+ c-0.0830078 0.608398 -0.12207 1.21582 -0.12207 1.82422l0.0517578 -5.60059c-0.00683594 -0.133789 -0.0517578 -0.268555 -0.0517578 -0.40332c0 -0.15332 0.0517578 -0.293945 0.0576172 -0.441406l0.37793 -43.5645c0 -0.614258 0.0449219 -1.22266 0.121094 -1.81738
247
+ l0.102539 -0.550781l0.25 -1.24805l0.210938 -0.652344l0.352539 -1.12012l0.300781 -0.698242l0.473633 -1.04297l0.402344 -0.729492l0.570312 -0.998047l0.518555 -0.736328l0.65918 -0.93457l0.607422 -0.742188l0.787109 -0.93457l0.698242 -0.722656
248
+ l0.863281 -0.889648l0.806641 -0.736328l0.947266 -0.851562l0.896484 -0.722656l1.03613 -0.826172l0.999023 -0.716797l1.10645 -0.774414l1.10742 -0.716797l1.16504 -0.735352l1.20312 -0.704102l1.22852 -0.704102l1.29297 -0.68457l1.30566 -0.666016
249
+ l1.40137 -0.677734l1.3252 -0.62793l1.50977 -0.671875l1.38281 -0.588867l0.460938 -0.191406l0.844727 -0.345703c0.723633 -0.275391 1.43359 -0.563477 2.17578 -0.838867l1.36328 -0.499023c0.78125 -0.275391 1.54883 -0.550781 2.34277 -0.8125l0.895508 -0.313477
250
+ l0.282227 -0.0839844c1.89355 -0.614258 3.85254 -1.19043 5.86816 -1.74023l0.505859 -0.154297l0.40332 -0.0957031c1.70215 -0.473633 3.45605 -0.908203 5.23535 -1.31152l0.499023 -0.12207l0.716797 -0.140625c1.60645 -0.345703 3.21289 -0.68457 4.87012 -1.00488
251
+ l0.300781 -0.0703125l0.0771484 -0.0126953c1.66406 -0.313477 3.35352 -0.601562 5.05566 -0.864258l0.65332 -0.121094l0.792969 -0.12207c1.37598 -0.198242 2.76465 -0.396484 4.17969 -0.576172l0.825195 -0.115234l0.268555 -0.0380859
252
+ c1.67773 -0.198242 3.37988 -0.37793 5.10156 -0.537109l0.53125 -0.0644531l0.959961 -0.0830078c1.36914 -0.12207 2.75195 -0.217773 4.14648 -0.326172l1.00488 -0.0712891l0.499023 -0.0253906c1.82422 -0.12793 3.67383 -0.198242 5.53613 -0.261719
253
+ l0.397461 -0.0263672c1.1709 -0.0380859 2.3418 -0.0761719 3.51367 -0.0830078c1.16406 -0.0195312 2.29688 -0.0253906 3.44238 -0.0253906l0.384766 0.00585938c2.20117 0.00683594 4.37109 0.0517578 6.53418 0.128906h0.671875l0.518555 0.0380859
254
+ c2.65625 0.0957031 5.26074 0.262695 7.80762 0.460938l0.543945 0.0253906l0.486328 0.0507812c2.20215 0.199219 4.35254 0.410156 6.46484 0.671875l1.08789 0.128906c2.10547 0.261719 4.19141 0.5625 6.2207 0.889648l0.40918 0.0380859l0.473633 0.102539
255
+ c2.48926 0.421875 4.92188 0.895508 7.27734 1.40723l0.844727 0.154297c2.34863 0.524414 4.60742 1.10059 6.80273 1.71484l0.441406 0.115234l0.300781 0.102539c1.88867 0.537109 3.73828 1.11328 5.49121 1.71484l0.761719 0.25
256
+ c1.7666 0.626953 3.46875 1.27344 5.09473 1.93945l0.390625 0.133789l0.40918 0.192383c0.716797 0.293945 1.43359 0.607422 2.11816 0.93457l0.959961 0.421875c0.864258 0.422852 1.72852 0.851562 2.56055 1.28711l0.261719 0.12793l0.0517578 0.0380859
257
+ c1.47852 0.787109 2.86035 1.59961 4.15332 2.45117l0.217773 0.115234l0.0771484 0.0576172c1.05566 0.678711 2.02832 1.40137 2.95605 2.125l0.358398 0.249023l0.25 0.217773c0.838867 0.65918 1.62598 1.35059 2.34863 2.03516l0.102539 0.0898438l0.223633 0.249023
258
+ c0.588867 0.583008 1.13965 1.17188 1.63867 1.78613l0.275391 0.288086l0.160156 0.223633c0.563477 0.68457 1.0752 1.38867 1.50391 2.08691l0.0253906 0.0253906l0.0703125 0.102539c0.410156 0.671875 0.755859 1.35059 1.0752 2.02246l0.134766 0.275391
259
+ l0.115234 0.300781c0.275391 0.65918 0.537109 1.33105 0.691406 2.02148l0.0761719 0.186523v0.0439453c0.210938 0.78125 0.333008 1.5752 0.397461 2.375z" />
260
+ <glyph glyph-name="uniF114" unicode="&#xf114;"
261
+ d="M342.15 99.4111l0.0898438 1.29883l0.43457 -50.0029l-0.0380859 -1.03027l-0.0507812 -0.262695c-0.0644531 -0.799805 -0.199219 -1.58691 -0.397461 -2.37402v-0.0322266l-0.0761719 -0.172852c-0.154297 -0.68457 -0.416016 -1.36914 -0.691406 -2.03516
262
+ l-0.115234 -0.293945l-0.134766 -0.269531c-0.319336 -0.671875 -0.671875 -1.35645 -1.0752 -2.02148l-0.0703125 -0.102539l-0.0253906 -0.0263672c-0.428711 -0.709961 -0.94043 -1.40137 -1.50391 -2.08594l-0.15332 -0.217773l-0.275391 -0.306641
263
+ c-0.505859 -0.595703 -1.05664 -1.18457 -1.64453 -1.76074l-0.224609 -0.261719l-0.102539 -0.0898438c-0.722656 -0.68457 -1.50977 -1.37598 -2.34863 -2.04785l-0.249023 -0.211914l-0.352539 -0.249023c-0.93457 -0.716797 -1.90723 -1.44043 -2.96289 -2.1123
264
+ l-0.0771484 -0.0634766l-0.217773 -0.12793c-1.29297 -0.826172 -2.6748 -1.66406 -4.15332 -2.44531l-0.0507812 -0.0322266l-0.262695 -0.133789c-0.826172 -0.428711 -1.68359 -0.864258 -2.56055 -1.26758l-0.959961 -0.435547
265
+ c-0.68457 -0.306641 -1.40137 -0.620117 -2.11816 -0.933594l-0.40332 -0.185547l-0.383789 -0.134766c-1.62598 -0.68457 -3.32129 -1.33105 -5.09473 -1.94531l-0.760742 -0.25c-1.76074 -0.601562 -3.59082 -1.19043 -5.48535 -1.71484l-0.313477 -0.109375
266
+ l-0.435547 -0.108398c-2.18848 -0.614258 -4.4668 -1.19043 -6.80273 -1.70215l-0.851562 -0.185547c-2.36133 -0.512695 -4.78711 -0.979492 -7.27637 -1.38965l-0.473633 -0.0888672l-0.410156 -0.0644531c-2.03516 -0.338867 -4.1084 -0.626953 -6.21387 -0.889648
267
+ l-1.08789 -0.133789c-2.1123 -0.25 -4.2627 -0.473633 -6.46387 -0.65332l-0.486328 -0.0507812l-0.544922 -0.0390625c-2.55957 -0.198242 -5.15137 -0.345703 -7.80762 -0.447266l-0.518555 -0.0263672l-0.665039 -0.0126953
268
+ c-2.15723 -0.0761719 -4.32715 -0.121094 -6.53516 -0.133789l-0.389648 -0.00683594c-1.13965 0 -2.27832 0.00683594 -3.4375 0.0322266c-1.1709 0.0195312 -2.3418 0.0380859 -3.51367 0.0898438l-0.396484 0.0126953
269
+ c-1.8623 0.0634766 -3.71191 0.140625 -5.53613 0.261719l-0.499023 0.0263672l-1.00488 0.0761719c-1.39551 0.102539 -2.77734 0.198242 -4.14746 0.327148l-0.959961 0.0761719l-0.53125 0.0644531c-1.7207 0.160156 -3.41699 0.338867 -5.10059 0.549805
270
+ l-0.268555 0.0263672l-0.825195 0.121094c-1.41504 0.185547 -2.80371 0.383789 -4.17969 0.588867l-0.793945 0.108398l-0.652344 0.115234c-1.70215 0.262695 -3.3916 0.550781 -5.05566 0.876953h-0.0771484l-0.300781 0.0771484
271
+ c-1.65723 0.313477 -3.26367 0.646484 -4.87012 0.998047l-0.716797 0.134766l-0.5 0.12793c-1.77832 0.421875 -3.53223 0.851562 -5.23438 1.31152l-0.40332 0.0898438l-0.505859 0.160156c-2.02246 0.543945 -3.98047 1.12012 -5.86914 1.73438l-0.28125 0.0957031
272
+ l-0.896484 0.307617c-0.792969 0.275391 -1.56152 0.537109 -2.3418 0.8125l-1.36328 0.505859c-0.736328 0.268555 -1.44629 0.556641 -2.17578 0.844727l-0.844727 0.326172l-0.460938 0.211914l-1.38281 0.587891l-1.50977 0.666016l-1.3252 0.639648l-1.40137 0.666016
273
+ l-1.30566 0.678711l-1.29297 0.677734l-1.22852 0.704102l-1.20312 0.710938l-1.16504 0.722656l-1.10742 0.723633l-1.10742 0.774414l-0.998047 0.722656l-1.03711 0.826172l-0.895508 0.722656l-0.947266 0.851562l-0.806641 0.729492l-0.864258 0.882812
274
+ l-0.697266 0.736328l-0.787109 0.927734l-0.608398 0.736328l-0.65918 0.947266l-0.518555 0.736328l-0.569336 0.985352l-0.40332 0.729492l-0.473633 1.0498l-0.300781 0.697266l-0.351562 1.11328l-0.210938 0.666016l-0.25 1.24121l-0.102539 0.543945
275
+ c-0.0830078 0.615234 -0.121094 1.19727 -0.121094 1.81836l-0.435547 50.0029c0 -0.601562 0.0380859 -1.20312 0.12207 -1.81152l0.146484 -0.767578l0.198242 -1.02441l0.269531 -0.870117l0.293945 -0.902344l0.37793 -0.876953l0.383789 -0.889648l0.499023 -0.850586
276
+ l0.511719 -0.876953l0.576172 -0.832031l0.601562 -0.851562l0.671875 -0.8125l0.691406 -0.871094l0.761719 -0.787109l0.8125 -0.825195l0.845703 -0.754883l0.915039 -0.832031l0.93457 -0.743164l1.00391 -0.799805l1.01172 -0.729492l1.08789 -0.774414
277
+ l1.08203 -0.697266l1.18359 -0.761719l1.17773 -0.671875l1.26074 -0.736328l1.26074 -0.665039l1.33105 -0.685547l1.33789 -0.65918l1.4209 -0.665039l1.40723 -0.640625l1.47266 -0.639648l1.26074 -0.499023c0.722656 -0.300781 1.45312 -0.588867 2.20117 -0.864258
278
+ l1.35742 -0.505859c0.754883 -0.261719 1.5293 -0.537109 2.31641 -0.799805l1.20312 -0.40332c1.90137 -0.607422 3.86621 -1.19043 5.8877 -1.74023l0.858398 -0.237305c1.72168 -0.460938 3.4873 -0.902344 5.2793 -1.31152l1.17188 -0.262695
279
+ c1.59961 -0.345703 3.22559 -0.697266 4.87695 -1.01074l0.40918 -0.102539c1.66406 -0.313477 3.36621 -0.601562 5.08789 -0.876953l1.37598 -0.210938c1.4082 -0.199219 2.81641 -0.416016 4.25586 -0.588867l1.03711 -0.134766
280
+ c1.68945 -0.205078 3.39844 -0.390625 5.13867 -0.537109l1.43359 -0.134766c1.39551 -0.12793 2.79688 -0.223633 4.21777 -0.333008l1.46582 -0.0957031c1.83008 -0.115234 3.68652 -0.198242 5.54883 -0.262695c1.29297 -0.0380859 2.5918 -0.0761719 3.91016 -0.102539
281
+ c1.28027 -0.0126953 2.55371 -0.0126953 3.81445 -0.0126953c2.19531 0 4.38379 0.0517578 6.53418 0.115234l1.2041 0.0449219c2.63672 0.102539 5.24707 0.268555 7.80762 0.454102l1.02441 0.0898438c2.18848 0.192383 4.33887 0.40332 6.46387 0.666016
282
+ l1.10059 0.133789c2.09863 0.262695 4.17871 0.556641 6.21387 0.896484l0.774414 0.12793c2.53516 0.428711 4.98633 0.902344 7.37305 1.41406l0.826172 0.185547c2.36133 0.512695 4.63965 1.08203 6.83496 1.69629l0.704102 0.185547
283
+ c1.91309 0.550781 3.75684 1.13281 5.54199 1.73438l0.710938 0.237305c1.75293 0.614258 3.44922 1.26074 5.0752 1.92578l0.875977 0.37793c0.698242 0.293945 1.37012 0.588867 2.03516 0.895508l0.986328 0.448242c0.959961 0.473633 1.90039 0.93457 2.80957 1.41406
284
+ c1.52246 0.806641 2.96289 1.6582 4.28809 2.52246l0.198242 0.12793c1.08789 0.697266 2.08008 1.42676 3.02734 2.16309l0.537109 0.416016c0.851562 0.68457 1.6582 1.37598 2.3877 2.08594l0.300781 0.300781c0.594727 0.595703 1.13867 1.19043 1.66406 1.79883
285
+ l0.441406 0.524414c0.53125 0.678711 1.06836 1.37598 1.49121 2.06738l0.115234 0.15332c0.396484 0.666016 0.735352 1.33789 1.0625 2.00391l0.236328 0.575195c0.288086 0.65332 0.525391 1.33789 0.710938 2.02246l0.0761719 0.230469
286
+ c0.192383 0.78125 0.313477 1.57422 0.390625 2.36816zM342.15 171.053l0.0898438 1.33105l0.43457 -50.0029l-0.0380859 -1.03027l-0.0507812 -0.275391c-0.0644531 -0.787109 -0.199219 -1.58105 -0.397461 -2.36133v-0.0449219l-0.0761719 -0.185547
287
+ c-0.154297 -0.68457 -0.416016 -1.35742 -0.691406 -2.02246l-0.115234 -0.300781l-0.134766 -0.262695c-0.319336 -0.68457 -0.671875 -1.35645 -1.0752 -2.02246l-0.0703125 -0.115234l-0.0253906 -0.0253906c-0.428711 -0.697266 -0.94043 -1.40137 -1.50391 -2.08594
288
+ l-0.15332 -0.211914l-0.275391 -0.300781c-0.505859 -0.594727 -1.05664 -1.19629 -1.64453 -1.77246l-0.224609 -0.255859l-0.102539 -0.0830078c-0.722656 -0.704102 -1.50977 -1.37598 -2.34863 -2.04883l-0.249023 -0.223633l-0.352539 -0.236328
289
+ c-0.93457 -0.723633 -1.90723 -1.44727 -2.96289 -2.125l-0.0771484 -0.0644531l-0.217773 -0.115234c-1.29297 -0.837891 -2.6748 -1.66406 -4.15332 -2.45117l-0.0507812 -0.0380859l-0.262695 -0.12793c-0.826172 -0.435547 -1.68359 -0.864258 -2.56055 -1.28027
290
+ l-0.959961 -0.428711c-0.68457 -0.326172 -1.40137 -0.633789 -2.11816 -0.93457l-0.40332 -0.178711l-0.383789 -0.134766c-1.62598 -0.697266 -3.32129 -1.3252 -5.09473 -1.95215l-0.760742 -0.249023c-1.76074 -0.601562 -3.59082 -1.18457 -5.48535 -1.70898
291
+ l-0.313477 -0.12207l-0.435547 -0.102539c-2.18848 -0.614258 -4.4668 -1.17676 -6.80273 -1.69531l-0.851562 -0.179688c-2.36133 -0.511719 -4.78711 -0.992188 -7.27637 -1.40137l-0.473633 -0.0898438l-0.410156 -0.0507812
292
+ c-2.03516 -0.339844 -4.1084 -0.633789 -6.21387 -0.902344l-1.08789 -0.134766c-2.1123 -0.249023 -4.2627 -0.473633 -6.46387 -0.652344l-0.486328 -0.0517578l-0.544922 -0.0322266c-2.55957 -0.204102 -5.15137 -0.351562 -7.80762 -0.454102l-0.518555 -0.0380859
293
+ l-0.665039 -0.0126953c-2.15723 -0.0644531 -4.32715 -0.12793 -6.53516 -0.12793h-0.389648c-1.13965 0 -2.27832 0 -3.4375 0.0126953c-1.1709 0.0253906 -2.3418 0.0576172 -3.51367 0.0898438l-0.396484 0.0253906
294
+ c-1.8623 0.0634766 -3.71191 0.146484 -5.53613 0.255859l-0.499023 0.0322266l-1.00488 0.0761719c-1.39551 0.0898438 -2.77734 0.198242 -4.14746 0.327148l-0.959961 0.0703125l-0.53125 0.0634766c-1.7207 0.15332 -3.41699 0.345703 -5.10059 0.550781
295
+ l-0.268555 0.0322266l-0.825195 0.115234c-1.41504 0.185547 -2.80371 0.376953 -4.17969 0.587891l-0.793945 0.115234l-0.652344 0.115234c-1.70215 0.262695 -3.3916 0.557617 -5.05566 0.871094l-0.0771484 0.0126953l-0.300781 0.0703125
296
+ c-1.65723 0.313477 -3.26367 0.633789 -4.87012 1.00488l-0.716797 0.133789l-0.5 0.134766c-1.77832 0.40332 -3.53223 0.838867 -5.23438 1.29883l-0.40332 0.109375l-0.505859 0.140625c-2.02246 0.550781 -3.98047 1.12012 -5.86914 1.75391l-0.28125 0.0761719
297
+ l-0.896484 0.307617c-0.792969 0.275391 -1.56152 0.543945 -2.3418 0.825195l-1.36328 0.499023c-0.736328 0.275391 -1.44629 0.557617 -2.17578 0.838867l-0.844727 0.345703l-0.460938 0.192383l-1.38281 0.587891l-1.50977 0.666016l-1.3252 0.639648
298
+ l-1.40137 0.685547l-1.30566 0.665039l-1.29297 0.68457l-1.22852 0.710938l-1.20312 0.697266l-1.16504 0.736328l-1.10742 0.722656l-1.10742 0.761719l-0.998047 0.729492l-1.03711 0.819336l-0.895508 0.723633l-0.947266 0.850586l-0.806641 0.736328
299
+ l-0.864258 0.889648l-0.697266 0.723633l-0.787109 0.927734l-0.608398 0.736328l-0.65918 0.947266l-0.518555 0.735352l-0.569336 0.992188l-0.40332 0.723633l-0.473633 1.04883l-0.300781 0.704102l-0.351562 1.11426l-0.210938 0.665039l-0.25 1.24219
300
+ l-0.102539 0.549805c-0.0830078 0.614258 -0.121094 1.20312 -0.121094 1.81738l-0.435547 50.0098c0 -0.614258 0.0380859 -1.22266 0.12207 -1.82422l0.146484 -0.774414l0.198242 -1.01074l0.269531 -0.864258l0.293945 -0.915039l0.37793 -0.864258l0.383789 -0.889648
301
+ l0.499023 -0.850586l0.511719 -0.883789l0.576172 -0.837891l0.601562 -0.857422l0.671875 -0.813477l0.691406 -0.850586l0.761719 -0.787109l0.8125 -0.838867l0.845703 -0.761719l0.915039 -0.825195l0.93457 -0.736328l1.00391 -0.8125l1.01172 -0.710938
302
+ l1.08789 -0.780273l1.08203 -0.704102l1.18359 -0.749023l1.17773 -0.678711l1.26074 -0.729492l1.26074 -0.665039l1.33105 -0.698242l1.33789 -0.652344l1.4209 -0.671875l1.40723 -0.621094l1.47266 -0.633789l1.26074 -0.511719
303
+ c0.722656 -0.288086 1.45312 -0.576172 2.20117 -0.864258l1.36328 -0.492188c0.755859 -0.288086 1.53027 -0.550781 2.31738 -0.813477l1.20312 -0.402344c1.90039 -0.602539 3.86523 -1.2041 5.8877 -1.75391l0.857422 -0.237305
304
+ c1.72168 -0.459961 3.48828 -0.895508 5.28027 -1.31152l1.1709 -0.25c1.60059 -0.358398 3.22559 -0.697266 4.87695 -1.02344l0.40332 -0.0771484c1.66406 -0.320312 3.36621 -0.594727 5.08789 -0.870117l1.37598 -0.205078
305
+ c1.4082 -0.210938 2.81641 -0.421875 4.25586 -0.608398l1.03711 -0.133789c1.68945 -0.192383 3.39844 -0.390625 5.13867 -0.550781l1.43359 -0.12793c1.39551 -0.12793 2.79688 -0.236328 4.21777 -0.338867l1.46582 -0.0898438
306
+ c1.83008 -0.121094 3.68652 -0.210938 5.54883 -0.275391c1.29297 -0.0380859 2.5918 -0.0830078 3.91016 -0.0957031c1.28027 -0.0253906 2.55371 -0.0253906 3.81445 -0.0253906c2.19531 0 4.38379 0.0507812 6.53418 0.121094l1.2041 0.0644531
307
+ c2.63672 0.0898438 5.24707 0.249023 7.80762 0.448242l1.02441 0.0888672c2.18848 0.192383 4.33887 0.40332 6.46387 0.65332l1.10059 0.133789c2.09863 0.262695 4.17871 0.550781 6.21387 0.883789l0.774414 0.133789c2.53516 0.442383 4.98633 0.902344 7.37305 1.4209
308
+ l0.826172 0.179688c2.36133 0.524414 4.63965 1.10059 6.83496 1.70898l0.704102 0.191406c1.91309 0.538086 3.75684 1.11426 5.54199 1.72852l0.710938 0.243164c1.75293 0.607422 3.44922 1.24805 5.0752 1.91992l0.875977 0.351562
309
+ c0.698242 0.300781 1.37012 0.621094 2.03516 0.915039l0.986328 0.448242c0.959961 0.467773 1.90039 0.93457 2.80957 1.4209c1.52246 0.799805 2.96289 1.64453 4.28809 2.50879l0.198242 0.134766c1.08789 0.704102 2.08008 1.42676 3.02734 2.16895l0.537109 0.410156
310
+ c0.851562 0.665039 1.6582 1.37598 2.3877 2.07324l0.300781 0.313477c0.594727 0.588867 1.13867 1.17773 1.66406 1.79199l0.441406 0.518555c0.53125 0.671875 1.06836 1.38867 1.49121 2.07422l0.115234 0.15918c0.396484 0.666016 0.735352 1.33203 1.0625 2.00391
311
+ l0.236328 0.5625c0.288086 0.671875 0.525391 1.35059 0.710938 2.02246l0.0761719 0.237305c0.192383 0.787109 0.313477 1.57422 0.390625 2.36133zM342.15 242.694l0.0703125 1.31836l0.441406 -50.0156l-0.0380859 -1.03027l-0.0576172 -0.256836
312
+ c-0.0644531 -0.805664 -0.192383 -1.59277 -0.390625 -2.37402v-0.0253906l-0.0761719 -0.185547c-0.160156 -0.68457 -0.410156 -1.35059 -0.698242 -2.0166l-0.108398 -0.306641l-0.140625 -0.275391c-0.313477 -0.678711 -0.671875 -1.35059 -1.0752 -2.01562
313
+ l-0.0644531 -0.109375l-0.0253906 -0.0253906c-0.435547 -0.704102 -0.947266 -1.40137 -1.51074 -2.08008l-0.146484 -0.223633l-0.275391 -0.288086c-0.505859 -0.608398 -1.0625 -1.19727 -1.63867 -1.78613l-0.236328 -0.249023l-0.102539 -0.0898438
314
+ c-0.723633 -0.691406 -1.51074 -1.36914 -2.34961 -2.03516l-0.249023 -0.223633l-0.352539 -0.25c-0.927734 -0.723633 -1.90039 -1.44043 -2.95605 -2.125l-0.0771484 -0.0507812l-0.217773 -0.12793c-1.29297 -0.844727 -2.6748 -1.6582 -4.16016 -2.44531
315
+ l-0.0507812 -0.0380859l-0.262695 -0.134766c-0.825195 -0.428711 -1.67676 -0.850586 -2.55957 -1.28613l-0.954102 -0.416016c-0.69043 -0.320312 -1.40137 -0.633789 -2.11816 -0.93457l-0.40332 -0.185547l-0.390625 -0.133789
316
+ c-1.625 -0.678711 -3.32715 -1.3125 -5.09375 -1.93945l-0.761719 -0.25c-1.75391 -0.601562 -3.59082 -1.17773 -5.49121 -1.71484l-0.300781 -0.102539l-0.441406 -0.115234c-2.18945 -0.614258 -4.46094 -1.19043 -6.80371 -1.71484l-0.844727 -0.154297
317
+ c-2.35547 -0.511719 -4.78711 -0.998047 -7.27637 -1.40137l-0.473633 -0.108398l-0.40332 -0.0517578c-2.04199 -0.326172 -4.11523 -0.620117 -6.2207 -0.889648l-1.08789 -0.12793c-2.1123 -0.261719 -4.2627 -0.486328 -6.46484 -0.665039l-0.486328 -0.0576172
318
+ l-0.543945 -0.0263672c-2.56641 -0.191406 -5.15137 -0.344727 -7.80762 -0.454102l-0.518555 -0.0449219h-0.671875c-2.15723 -0.0761719 -4.32617 -0.115234 -6.53418 -0.12793l-0.383789 -0.00585938c-1.14648 0 -2.28516 0.00585938 -3.44336 0.03125
319
+ c-1.17188 0 -2.34277 0.0390625 -3.51367 0.0771484l-0.397461 0.0253906c-1.8623 0.0644531 -3.71191 0.134766 -5.53516 0.262695l-0.5 0.0253906l-1.00391 0.0703125c-1.39551 0.109375 -2.77832 0.205078 -4.14746 0.333008l-0.959961 0.0771484l-0.53125 0.0634766
320
+ c-1.72168 0.160156 -3.41797 0.339844 -5.10059 0.538086l-0.269531 0.0380859l-0.825195 0.115234c-1.41406 0.179688 -2.80371 0.383789 -4.17969 0.576172l-0.792969 0.121094l-0.65332 0.12207c-1.70215 0.262695 -3.3916 0.550781 -5.05566 0.864258
321
+ l-0.0771484 0.0126953l-0.300781 0.0703125c-1.65723 0.320312 -3.26367 0.652344 -4.87012 1.00488l-0.716797 0.147461l-0.499023 0.114258c-1.7793 0.410156 -3.5332 0.845703 -5.23535 1.3125l-0.40332 0.0957031l-0.505859 0.154297
322
+ c-2.02246 0.537109 -3.98047 1.11328 -5.86816 1.74023l-0.282227 0.0830078l-0.895508 0.313477c-0.793945 0.262695 -1.56152 0.538086 -2.34277 0.813477l-1.36328 0.499023c-0.735352 0.275391 -1.44629 0.563477 -2.17578 0.837891l-0.844727 0.345703
323
+ l-0.460938 0.192383l-1.38184 0.588867l-1.51074 0.671875l-1.3252 0.633789l-1.40137 0.678711l-1.30566 0.665039l-1.29297 0.678711l-1.22852 0.704102l-1.20312 0.704102l-1.16504 0.735352l-1.10742 0.716797l-1.10645 0.774414l-0.999023 0.716797l-1.03613 0.832031
324
+ l-0.896484 0.716797l-0.947266 0.851562l-0.806641 0.735352l-0.863281 0.896484l-0.698242 0.716797l-0.787109 0.93457l-0.607422 0.742188l-0.65918 0.93457l-0.518555 0.736328l-0.569336 0.998047l-0.40332 0.729492l-0.473633 1.04297l-0.300781 0.698242
325
+ l-0.352539 1.11914l-0.210938 0.65332l-0.25 1.24805l-0.102539 0.549805c-0.0830078 0.602539 -0.121094 1.2041 -0.121094 1.81836l-0.37793 43.5645c-0.00585938 0.147461 -0.0576172 0.294922 -0.0576172 0.441406c0 0.134766 0.0517578 0.269531 0.0517578 0.40332
326
+ l-0.0517578 5.60059c0 -0.608398 0.0390625 -1.2168 0.12207 -1.82422l0.147461 -0.774414l0.0888672 -0.448242c3.63574 17.875 40.4102 31.3916 85.3701 30.7012c44.998 -0.691406 81.9131 -15.3857 85.5742 -33.4082c0.12793 0.607422 0.243164 1.20898 0.300781 1.81738
327
+ z" />
328
+ <glyph glyph-name="uniF11B" unicode="&#xf11b;"
329
+ d="M404.666 185.6c4.95996 0 7.57715 -1.06836 7.8457 -2.82227c0 -0.524414 -0.93457 -2.98828 -2.79688 -7.0459l-56.0508 -111.731h-226.374l57.3184 112.378c1.94531 3.87207 3.83984 5.97754 5.69531 7.07812c1.8623 1.08789 5.22949 2.14355 10.1318 2.14355h204.23z
330
+ M175.584 203.872c-2.18848 -1.24805 -6.8418 -5.22852 -10.8027 -12.9092l-55.9814 -105.549v133.626c0 3.96191 2.21484 7.41113 3.52637 8.64648c1.31836 1.22266 5.55566 2.71387 9.60645 2.71387h7.85254c5.65137 0 9.29297 -0.179688 10.9385 0.920898
331
+ c1.65039 1.08203 3.1543 3.33496 4.49902 8.12793l1.52246 6.11914c1.01172 3.63477 2.43262 6.61719 4.29492 7.70508c1.8623 1.00488 5.49121 2.72656 10.8799 2.72656h46.8291c4.7998 0 7.89746 -1.59375 9.29297 -2.55371
332
+ c1.39453 -0.972656 2.64258 -4.63379 3.7373 -8.76172l1.5166 -5.59375c1.17773 -4.81836 2.70117 -7.25098 4.55664 -8.17285c1.85645 -0.94043 6.74609 -0.517578 14.6758 -0.517578h87.9355c6.33594 0 8.73633 -4.98633 8.73633 -11.4824v-14.1182h-146.534
333
+ c-9.19043 0 -14.8809 0.352539 -17.082 -0.927734z" />
334
+ </font>
335
+ </defs></svg>
embedded/onthego-resources/onthegosystems-icons/fonts/onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.ttf ADDED
Binary file
embedded/onthego-resources/onthegosystems-icons/fonts/onthegosystems-icons_33da83f67be9c5797490c4baa29104c1.woff ADDED
Binary file
embedded/onthego-resources/onthegosystems-icons/vectors/wpml logo.svg ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
4
+ <svg version="1.1" baseProfile="tiny" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
5
+ x="0px" y="0px" width="136px" height="142px" viewBox="0 0 136 142" xml:space="preserve">
6
+ <path fill="#58595B" d="M80.434,78.539c0.678,10.414,9.646,17.928,19.194,17.914c12.908-0.012,18.667-12.064,20.474-21.752
7
+ C127.609,34.315,96.697,3.656,59.96,8.16c-19.937,2.445-48.971,24.759-44.787,60.142c3.727,31.556,39.58,56.212,78.056,39.671
8
+ c16.635-7.156,23.711,23.221,5.119,24.311c-3.517-2.055-3-8.145-4.701-12.012c-0.369-1.569-1.131-2.885-2.142-3.719
9
+ c-0.796-0.947-1.819-1.552-2.97-1.628c-2.838-0.19-5.355,2.861-5.622,6.816c-0.185,2.771,0.791,5.245,2.366,6.546
10
+ c0.414,0.492,0.887,0.895,1.41,1.174c3.945,4.432,13.037,5.826,18.055,4.102c11.99-4.121,10.826-25.851-3.837-28.152
11
+ c-9.278-1.457-13.55,3.826-19.194,5.117c-38.132,8.701-60.616-26.934-56.301-55.021c2.827-18.389,19.001-33.68,35.827-37.11
12
+ c18.694-3.813,39.768,2.739,40.946,16.635C103.811,54.212,79.193,59.458,80.434,78.539z"/>
13
+ </svg>
embedded/resources/css/basic.css CHANGED
@@ -94,6 +94,10 @@ NO DUPLICATES
94
  .wpcf-form-label {
95
  white-space: nowrap;
96
  }
 
 
 
 
97
  .wpcf-form-textfield-label {
98
  font-size: 1em;
99
  font-weight: bold;
@@ -424,7 +428,11 @@ input.wpcf-form-error {
424
  display: none;
425
  }
426
  .ac_results{
427
- width:200px !important;
 
 
 
 
428
  }
429
 
430
  /* temp */
94
  .wpcf-form-label {
95
  white-space: nowrap;
96
  }
97
+ .wpcf-form-fieldset .wpcf-form-label
98
+ {
99
+ white-space: normal;
100
+ }
101
  .wpcf-form-textfield-label {
102
  font-size: 1em;
103
  font-weight: bold;
428
  display: none;
429
  }
430
  .ac_results{
431
+ /**
432
+ * Commented out because it breaks autocomplete suggestions in, well, everywhere, if any result is longer.
433
+ * Adjust to specific place if needed, using the resultsClass option.
434
+ */
435
+ /*width:200px !important;*/
436
  }
437
 
438
  /* temp */
embedded/resources/css/dashicons.css CHANGED
@@ -1,9 +1,9 @@
1
  /**
2
  *
3
- * $HeadURL: https://www.onthegosystems.com/misc_svn/cck/tags/1.6.3/embedded/resources/css/dashicons.css $
4
- * $LastChangedDate: 2014-05-08 15:13:42 +0200 (Thu, 08 May 2014) $
5
- * $LastChangedRevision: 22156 $
6
- * $LastChangedBy: marcin $
7
  *
8
  */
9
 
1
  /**
2
  *
3
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/resources/css/dashicons.css $
4
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
5
+ * $LastChangedRevision: 1027712 $
6
+ * $LastChangedBy: iworks $
7
  *
8
  */
9
 
embedded/resources/js/basic.js CHANGED
@@ -4,10 +4,10 @@
4
  * For now full and embedded version use this script.
5
  * Before moving full-version-only code - make sure it's not needed here.
6
  *
7
- * $HeadURL: https://www.onthegosystems.com/misc_svn/cck/tags/1.6.3/embedded/resources/js/basic.js $
8
- * $LastChangedDate: 2014-09-11 10:36:28 +0200 (Thu, 11 Sep 2014) $
9
- * $LastChangedRevision: 26949 $
10
- * $LastChangedBy: marcin $
11
  *
12
  */
13
 
@@ -202,6 +202,12 @@ jQuery(document).ready(function(){
202
  // Check field slugs unique
203
  passed = true;
204
  checkedArr = new Array();
 
 
 
 
 
 
205
  jQuery('.wpcf-forms-field-slug').each(function(index){
206
  var currentValue = jQuery(this).val().toLowerCase();
207
  if (currentValue != ''
4
  * For now full and embedded version use this script.
5
  * Before moving full-version-only code - make sure it's not needed here.
6
  *
7
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/resources/js/basic.js $
8
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
9
+ * $LastChangedRevision: 1027712 $
10
+ * $LastChangedBy: iworks $
11
  *
12
  */
13
 
202
  // Check field slugs unique
203
  passed = true;
204
  checkedArr = new Array();
205
+ /**
206
+ * first fill array with defined, but unused fields
207
+ */
208
+ jQuery('#wpcf-form-groups-user-fields .wpcf-fields-add-ajax-link:visible').each(function(){
209
+ checkedArr.push(jQuery(this).data('slug'));
210
+ });
211
  jQuery('.wpcf-forms-field-slug').each(function(index){
212
  var currentValue = jQuery(this).val().toLowerCase();
213
  if (currentValue != ''
embedded/resources/js/fields-form.js CHANGED
@@ -9,10 +9,10 @@
9
  * @since Types 1.1.5
10
  * @autor srdjan
11
  *
12
- * $HeadURL: https://www.onthegosystems.com/misc_svn/cck/tags/1.6.3/embedded/resources/js/fields-form.js $
13
- * $LastChangedDate: 2014-07-11 06:20:46 +0200 (Fri, 11 Jul 2014) $
14
- * $LastChangedRevision: 24859 $
15
- * $LastChangedBy: bruce $
16
  *
17
  */
18
 
9
  * @since Types 1.1.5
10
  * @autor srdjan
11
  *
12
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/resources/js/fields-form.js $
13
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
14
+ * $LastChangedRevision: 1027712 $
15
+ * $LastChangedBy: iworks $
16
  *
17
  */
18
 
embedded/resources/js/post-relationship.js CHANGED
@@ -19,6 +19,21 @@ var tChildTable = (function($) {
19
  .bind('wpListAddEnd', taxAdjust);
20
  // Init non-hierarchical taxonomies
21
  tTagBox.init(selector);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  }
23
 
24
  function taxAdjust() {
@@ -34,9 +49,6 @@ var tChildTable = (function($) {
34
  }
35
  })(jQuery, undefined);
36
 
37
-
38
-
39
-
40
  /*
41
  * Hierarchical taxonomies form handling on post edit screen.
42
  */
@@ -791,4 +803,4 @@ function wpcfRelationshipInit(selector, context) {
791
  }
792
  });
793
  });
794
- }
19
  .bind('wpListAddEnd', taxAdjust);
20
  // Init non-hierarchical taxonomies
21
  tTagBox.init(selector);
22
+ /**
23
+ * bind to children pagination buttons
24
+ */
25
+ $('.wpcf-pr-pagination-link').on('click', function() {
26
+ param_pagination_name = $(this).data('pagination-name');
27
+ if ( param_pagination_name ) {
28
+ number_of_posts = $('select[name="'+param_pagination_name+'"]').val();
29
+ re = new RegExp(param_pagination_name+'=\\d+');
30
+ $(this).attr(
31
+ 'href',
32
+ $(this).attr('href').replace(re, param_pagination_name+'='+number_of_posts)
33
+ );
34
+ }
35
+ return true;
36
+ });
37
  }
38
 
39
  function taxAdjust() {
49
  }
50
  })(jQuery, undefined);
51
 
 
 
 
52
  /*
53
  * Hierarchical taxonomies form handling on post edit screen.
54
  */
803
  }
804
  });
805
  });
806
+ }
embedded/usermeta-init.php CHANGED
@@ -10,9 +10,9 @@ $fields_access = new Post_Fields_Access;
10
  * @author Gen gen.i@icanlocalize.com
11
  * @since Types 1.3
12
  *
13
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/embedded/usermeta-init.php $
14
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
15
- * $LastChangedRevision: 1012704 $
16
  * $LastChangedBy: iworks $
17
  *
18
  */
@@ -64,7 +64,7 @@ function wpcf_admin_menu_edit_user_fields_hook() {
64
  WPCF_RELPATH . '/resources/js/jquery_ui/jquery.ui.theme.min.css' );
65
  wp_enqueue_style( 'wpcf-usermeta',
66
  WPCF_EMBEDDED_RES_RELPATH . '/css/usermeta.css' );
67
-
68
  // MAIN
69
  wp_enqueue_script( 'wpcf-fields-form',
70
  WPCF_EMBEDDED_RES_RELPATH
@@ -282,7 +282,7 @@ if ( !isset( $_GET['post_type'] ) && isset( $_GET['post'] ) ) {
282
  }
283
 
284
  /*
285
- *
286
  * This is not needed for Views 1.3
287
  * Kept for compatibility with older versions
288
  */
@@ -353,12 +353,12 @@ function wpcf_admin_post_add_usermeta_to_editor_js( $items, $views_callback = fa
353
 
354
  $callback = 'wpcfFieldsEditorCallback(\'' . $field['id']
355
  . '\', \'usermeta\', ' . $post->ID . ')';
356
-
357
  // Added for Views:users filter Vicon popup
358
  if ( $views_callback ){
359
  $callback = 'wpcfFieldsEditorCallback(\'' . $field['id']
360
  . '\', \'views-usermeta\', ' . $post->ID . ')';
361
- }
362
 
363
  $add[$group['name']][stripslashes( $field['name'] )] = array(stripslashes( $field['name'] ), trim( wpcf_usermeta_get_shortcode( $field ),
364
  '[]' ), $group['name'], $callback);
@@ -392,10 +392,8 @@ function wpcf_usermeta_get_shortcode( $field, $add = '', $content = '' ) {
392
  $shortcode .= 'types usermeta="' . $field['slug'] . '"' . $add;
393
  $shortcode .= ']' . $content . '[/types]';
394
  $shortcode = apply_filters( 'wpcf_fields_shortcode', $shortcode, $field );
395
- $shortcode = apply_filters( 'wpcf_fields_shortcode_type_' . $field['type'],
396
- $shortcode, $field );
397
- $shortcode = apply_filters( 'wpcf_fields_shortcode_slug_' . $field['slug'],
398
- $shortcode, $field );
399
  return $shortcode;
400
  }
401
 
@@ -409,7 +407,7 @@ function wpcf_usermeta_get_shortcode( $field, $add = '', $content = '' ) {
409
  function types_render_usermeta( $field_id, $params, $content = null, $code = '' ) {
410
 
411
  require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php';
412
-
413
  global $wpcf, $post, $wpdb, $WP_Views;
414
  // HTML var holds actual output
415
  $html = '';
@@ -425,7 +423,7 @@ function types_render_usermeta( $field_id, $params, $content = null, $code = ''
425
  if ( isset( $params['post_id'] ) && !empty( $params['post_id'] ) ) {
426
  $post_id = $params['post_id'];
427
  }
428
-
429
  //Get User id from views loop
430
  if ( isset($WP_Views->users_data['term']->ID) && !empty($WP_Views->users_data['term']->ID) ){
431
  $params['user_id'] = $WP_Views->users_data['term']->ID;
@@ -455,7 +453,7 @@ function types_render_usermeta( $field_id, $params, $content = null, $code = ''
455
  // Get field
456
  $field = wpcf_fields_get_field_by_slug( $field_id, 'wpcf-usermeta' );
457
 
458
-
459
  // If field not found return empty string
460
  if ( empty( $field ) ) {
461
 
@@ -786,7 +784,7 @@ class Usermeta_Access
786
  {
787
 
788
  public static $user_groups = '';
789
-
790
  /**
791
  * Initialize plugin enviroment
792
  */
@@ -902,7 +900,7 @@ class Post_Fields_Access
902
  * Initialize plugin enviroment
903
  */
904
  public static $fields_groups = '';
905
-
906
  public function __construct() {
907
  //Get list of groups
908
  self::$fields_groups = wpcf_admin_fields_get_groups();
@@ -918,12 +916,12 @@ class Post_Fields_Access
918
  add_filter( 'types-access-group',
919
  array('Post_Fields_Access', 'register_access_fields_groups'),
920
  10, 2 );
921
-
922
  //Add Fields caps to groups
923
  add_filter( 'types-access-cap',
924
  array('Post_Fields_Access', 'register_access_fields_caps'),
925
  10, 3 );
926
- //}
927
  }
928
  }
929
  }
@@ -972,7 +970,7 @@ class Post_Fields_Access
972
  {
973
  $FIELDS_ACCESS_AREA_NAME = __( 'Post Fields Frontend Access', 'wpcf' );
974
  $FIELDS_ACCESS_AREA_ID = '__FIELDS';
975
-
976
  if ( $id == $FIELDS_ACCESS_AREA_ID ) {
977
  if ( !empty( self::$fields_groups ) ) {
978
  foreach ( self::$fields_groups as $group ) {
10
  * @author Gen gen.i@icanlocalize.com
11
  * @since Types 1.3
12
  *
13
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/embedded/usermeta-init.php $
14
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
15
+ * $LastChangedRevision: 1027712 $
16
  * $LastChangedBy: iworks $
17
  *
18
  */
64
  WPCF_RELPATH . '/resources/js/jquery_ui/jquery.ui.theme.min.css' );
65
  wp_enqueue_style( 'wpcf-usermeta',
66
  WPCF_EMBEDDED_RES_RELPATH . '/css/usermeta.css' );
67
+
68
  // MAIN
69
  wp_enqueue_script( 'wpcf-fields-form',
70
  WPCF_EMBEDDED_RES_RELPATH
282
  }
283
 
284
  /*
285
+ *
286
  * This is not needed for Views 1.3
287
  * Kept for compatibility with older versions
288
  */
353
 
354
  $callback = 'wpcfFieldsEditorCallback(\'' . $field['id']
355
  . '\', \'usermeta\', ' . $post->ID . ')';
356
+
357
  // Added for Views:users filter Vicon popup
358
  if ( $views_callback ){
359
  $callback = 'wpcfFieldsEditorCallback(\'' . $field['id']
360
  . '\', \'views-usermeta\', ' . $post->ID . ')';
361
+ }
362
 
363
  $add[$group['name']][stripslashes( $field['name'] )] = array(stripslashes( $field['name'] ), trim( wpcf_usermeta_get_shortcode( $field ),
364
  '[]' ), $group['name'], $callback);
392
  $shortcode .= 'types usermeta="' . $field['slug'] . '"' . $add;
393
  $shortcode .= ']' . $content . '[/types]';
394
  $shortcode = apply_filters( 'wpcf_fields_shortcode', $shortcode, $field );
395
+ $shortcode = apply_filters( 'wpcf_fields_shortcode_type_' . $field['type'], $shortcode, $field );
396
+ $shortcode = apply_filters( 'wpcf_fields_shortcode_slug_' . $field['slug'], $shortcode, $field );
 
 
397
  return $shortcode;
398
  }
399
 
407
  function types_render_usermeta( $field_id, $params, $content = null, $code = '' ) {
408
 
409
  require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php';
410
+
411
  global $wpcf, $post, $wpdb, $WP_Views;
412
  // HTML var holds actual output
413
  $html = '';
423
  if ( isset( $params['post_id'] ) && !empty( $params['post_id'] ) ) {
424
  $post_id = $params['post_id'];
425
  }
426
+
427
  //Get User id from views loop
428
  if ( isset($WP_Views->users_data['term']->ID) && !empty($WP_Views->users_data['term']->ID) ){
429
  $params['user_id'] = $WP_Views->users_data['term']->ID;
453
  // Get field
454
  $field = wpcf_fields_get_field_by_slug( $field_id, 'wpcf-usermeta' );
455
 
456
+
457
  // If field not found return empty string
458
  if ( empty( $field ) ) {
459
 
784
  {
785
 
786
  public static $user_groups = '';
787
+
788
  /**
789
  * Initialize plugin enviroment
790
  */
900
  * Initialize plugin enviroment
901
  */
902
  public static $fields_groups = '';
903
+
904
  public function __construct() {
905
  //Get list of groups
906
  self::$fields_groups = wpcf_admin_fields_get_groups();
916
  add_filter( 'types-access-group',
917
  array('Post_Fields_Access', 'register_access_fields_groups'),
918
  10, 2 );
919
+
920
  //Add Fields caps to groups
921
  add_filter( 'types-access-cap',
922
  array('Post_Fields_Access', 'register_access_fields_caps'),
923
  10, 3 );
924
+ //}
925
  }
926
  }
927
  }
970
  {
971
  $FIELDS_ACCESS_AREA_NAME = __( 'Post Fields Frontend Access', 'wpcf' );
972
  $FIELDS_ACCESS_AREA_ID = '__FIELDS';
973
+
974
  if ( $id == $FIELDS_ACCESS_AREA_ID ) {
975
  if ( !empty( self::$fields_groups ) ) {
976
  foreach ( self::$fields_groups as $group ) {
embedded/views/image.php CHANGED
@@ -682,21 +682,31 @@ class Types_Image_Utils
682
  * @param type $imgUrl
683
  * @return type
684
  */
685
- public static function onDomain( $imgUrl ) {
 
686
  $parsed = parse_url( $imgUrl );
 
 
 
 
 
 
 
 
 
 
 
687
  $parsed_wp = parse_url( get_site_url() );
688
- if ( preg_match( '/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i',
689
- $parsed['host'], $regs ) ) {
690
  $parsed['domain'] = $regs['domain'];
691
  } else {
692
  $parsed['domain'] = $parsed['host'];
693
  }
694
- if ( preg_match( '/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i',
695
- $parsed_wp['host'], $regs ) ) {
696
  $parsed_wp['domain'] = $regs['domain'];
697
  } else {
698
  $parsed_wp['domain'] = $parsed_wp['host'];
699
- }
700
  return $parsed['domain'] == $parsed_wp['domain'];
701
  }
702
 
682
  * @param type $imgUrl
683
  * @return type
684
  */
685
+ public static function onDomain( $imgUrl )
686
+ {
687
  $parsed = parse_url( $imgUrl );
688
+ /**
689
+ * if 'host' do not exists as key in array $parsed,
690
+ * then it is relative url and is always on same
691
+ * domain, then return true
692
+ */
693
+ if ( !array_key_exists('host', $parsed) ) {
694
+ return true;
695
+ }
696
+ /**
697
+ * compare site url to $imgUrl to check is on domain
698
+ */
699
  $parsed_wp = parse_url( get_site_url() );
700
+ if ( preg_match( '/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $parsed['host'], $regs ) ) {
 
701
  $parsed['domain'] = $regs['domain'];
702
  } else {
703
  $parsed['domain'] = $parsed['host'];
704
  }
705
+ if ( preg_match( '/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $parsed_wp['host'], $regs ) ) {
 
706
  $parsed_wp['domain'] = $regs['domain'];
707
  } else {
708
  $parsed_wp['domain'] = $parsed_wp['host'];
709
+ }
710
  return $parsed['domain'] == $parsed_wp['domain'];
711
  }
712
 
embedded/views/templates/editor-modal-date.tpl.php CHANGED
@@ -27,6 +27,10 @@ $data = array_merge( array(
27
  <input id="date-calendar" type="radio" name="style" value="calendar" data-bind="checked: date_mode, click: dateStyling" />
28
  <label for="date-calendar"><?php _e( 'Show as calendar ', 'wpcf' ); ?></label>
29
  </li>
 
 
 
 
30
  <li>
31
  <input id="date-text" type="radio" name="style" value="text" data-bind="checked: date_mode, click: dateStyling" />
32
  <label for="date-text"><?php _e( 'Show as text', 'wpcf' ); ?></label>
@@ -57,4 +61,4 @@ $data = array_merge( array(
57
  </ul>
58
  </div>
59
 
60
- </script><!--END TYPES MODAL DATE-->
27
  <input id="date-calendar" type="radio" name="style" value="calendar" data-bind="checked: date_mode, click: dateStyling" />
28
  <label for="date-calendar"><?php _e( 'Show as calendar ', 'wpcf' ); ?></label>
29
  </li>
30
+ <li>
31
+ <input id="date-human-time-diff" type="radio" name="style" value="human-time-diff" data-bind="checked: date_mode, click: dateStyling" />
32
+ <label for="date-human-time-diff"><?php _e( 'Show as human time diff ', 'wpcf' ); ?></label>
33
+ </li>
34
  <li>
35
  <input id="date-text" type="radio" name="style" value="text" data-bind="checked: date_mode, click: dateStyling" />
36
  <label for="date-text"><?php _e( 'Show as text', 'wpcf' ); ?></label>
61
  </ul>
62
  </div>
63
 
64
+ </script><!--END TYPES MODAL DATE-->
help.php CHANGED
@@ -2,9 +2,9 @@
2
  /*
3
  * Plugin contextual help
4
  *
5
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/help.php $
6
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
7
- * $LastChangedRevision: 1012704 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
2
  /*
3
  * Plugin contextual help
4
  *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/help.php $
6
+ * $LastChangedDate: 2014-05-29 08:44:10 +0000 (Thu, 29 May 2014) $
7
+ * $LastChangedRevision: 922956 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
includes/ajax.php CHANGED
@@ -243,6 +243,19 @@ function wpcf_ajax() {
243
  }
244
  $custom_types = get_option('wpcf-custom-types', array());
245
  $custom_type = strval($_GET['wpcf-post-type']);
 
 
 
 
 
 
 
 
 
 
 
 
 
246
  unset($custom_types[$custom_type]);
247
  /**
248
  * remove post relation
243
  }
244
  $custom_types = get_option('wpcf-custom-types', array());
245
  $custom_type = strval($_GET['wpcf-post-type']);
246
+
247
+ /**
248
+ * delete relataion?
249
+ */
250
+ if ( apply_filters('wpcf_delete_relation_meta', false) ) {
251
+ global $wpdb;
252
+ $wpdb->delete(
253
+ $wpdb->postmeta,
254
+ array( 'meta_key' => sprintf( '_wpcf_belongs_%s_id', $custom_type ) ),
255
+ array( '%s' )
256
+ );
257
+ }
258
+
259
  unset($custom_types[$custom_type]);
260
  /**
261
  * remove post relation
includes/conditional-display.php CHANGED
@@ -7,8 +7,7 @@ require_once WPCF_EMBEDDED_ABSPATH . '/includes/conditional-display.php';
7
  add_filter( 'wpcf_form_field', 'wpcf_cd_form_field_filter', 10, 2 );
8
  add_filter( 'wpcf_field_pre_save', 'wpcf_cd_field_pre_save_filter' );
9
  add_filter( 'wpcf_group_pre_save', 'wpcf_cd_group_pre_save_filter' );
10
- add_filter( 'wpcf_fields_form_additional_filters',
11
- 'wpcf_cd_fields_form_additional_filters', 10, 2 );
12
  add_action( 'wpcf_save_group', 'wpcf_cd_save_group_action' );
13
 
14
  global $wp_version;
7
  add_filter( 'wpcf_form_field', 'wpcf_cd_form_field_filter', 10, 2 );
8
  add_filter( 'wpcf_field_pre_save', 'wpcf_cd_field_pre_save_filter' );
9
  add_filter( 'wpcf_group_pre_save', 'wpcf_cd_group_pre_save_filter' );
10
+ add_filter( 'wpcf_fields_form_additional_filters', 'wpcf_cd_fields_form_additional_filters', 10, 2 );
 
11
  add_action( 'wpcf_save_group', 'wpcf_cd_save_group_action' );
12
 
13
  global $wp_version;
includes/custom-taxonomies-form.php CHANGED
@@ -3,9 +3,9 @@
3
  *
4
  * Custom taxonomies form
5
  *
6
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/includes/custom-taxonomies-form.php $
7
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
8
- * $LastChangedRevision: 1012704 $
9
  * $LastChangedBy: iworks $
10
  *
11
  */
@@ -234,7 +234,7 @@ function wpcf_admin_custom_taxonomies_form() {
234
  'separate_items_with_commas' => array('title' => __( 'Separate %s with commas',
235
  'wpcf' ), 'description' => __( "The separate item with commas text used in the taxonomy meta box. This string isn't used on hierarchical taxonomies. Default is __( 'Separate tags with commas' ), or null.",
236
  'wpcf' )),
237
- 'add_or_remove_items' => array('title' => __( 'Add or remove %s', 'wpcf' ), 'description' => __( "the add or remove items text and used in the meta box when JavaScript is disabled. This string isn't used on hierarchical taxonomies. Default is __( 'Add or remove tags' ) or null.",
238
  'wpcf' )),
239
  'choose_from_most_used' => array('title' => __( 'Choose from the most used %s',
240
  'wpcf' ), 'description' => __( "The choose from most used text used in the taxonomy meta box. This string isn't used on hierarchical taxonomies. Default is __( 'Choose from the most used tags' ) or null.",
@@ -259,8 +259,7 @@ function wpcf_admin_custom_taxonomies_form() {
259
  );
260
  $form['table-6-open'] = array(
261
  '#type' => 'markup',
262
- '#markup' => '<table id="wpcf-types-form-supports-table" class="wpcf-types-form-table widefat"><thead><tr><th>' . __( 'Advanced',
263
- 'wpcf' ) . '</th></tr></thead><tbody><tr><td>',
264
  );
265
  $form['make-hierarchical'] = array(
266
  '#type' => 'radios',
3
  *
4
  * Custom taxonomies form
5
  *
6
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/includes/custom-taxonomies-form.php $
7
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
8
+ * $LastChangedRevision: 1027712 $
9
  * $LastChangedBy: iworks $
10
  *
11
  */
234
  'separate_items_with_commas' => array('title' => __( 'Separate %s with commas',
235
  'wpcf' ), 'description' => __( "The separate item with commas text used in the taxonomy meta box. This string isn't used on hierarchical taxonomies. Default is __( 'Separate tags with commas' ), or null.",
236
  'wpcf' )),
237
+ 'add_or_remove_items' => array('title' => __( 'Add or remove %s', 'wpcf' ), 'description' => __( "the add or remove items text used in the meta box when JavaScript is disabled. This string isn't used on hierarchical taxonomies. Default is __( 'Add or remove tags' ) or null.",
238
  'wpcf' )),
239
  'choose_from_most_used' => array('title' => __( 'Choose from the most used %s',
240
  'wpcf' ), 'description' => __( "The choose from most used text used in the taxonomy meta box. This string isn't used on hierarchical taxonomies. Default is __( 'Choose from the most used tags' ) or null.",
259
  );
260
  $form['table-6-open'] = array(
261
  '#type' => 'markup',
262
+ '#markup' => '<table id="wpcf-types-form-supports-table" class="wpcf-types-form-table widefat"><thead><tr><th>' . __( 'Options', 'wpcf' ) . '</th></tr></thead><tbody><tr><td>',
 
263
  );
264
  $form['make-hierarchical'] = array(
265
  '#type' => 'radios',
includes/custom-types-form.php CHANGED
@@ -3,9 +3,9 @@
3
  *
4
  * Custom types form
5
  *
6
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/includes/custom-types-form.php $
7
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
8
- * $LastChangedRevision: 1012704 $
9
  * $LastChangedBy: iworks $
10
  *
11
  */
@@ -55,6 +55,26 @@ function wpcf_admin_custom_types_form() {
55
  '#value' => $id,
56
  '#name' => 'ct[wpcf-post-type]',
57
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  }
59
 
60
  $form['table-1-open'] = array(
@@ -615,8 +635,7 @@ function wpcf_admin_custom_types_form() {
615
  );
616
  $form['table-6-open'] = array(
617
  '#type' => 'markup',
618
- '#markup' => '<table id="wpcf-types-form-supports-table" class="wpcf-types-form-table widefat"><thead><tr><th>' . __( 'Advanced',
619
- 'wpcf' ) . '</th></tr></thead><tbody><tr><td>',
620
  );
621
  $form['rewrite-enabled'] = array(
622
  '#type' => 'checkbox',
3
  *
4
  * Custom types form
5
  *
6
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/includes/custom-types-form.php $
7
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
8
+ * $LastChangedRevision: 1027712 $
9
  * $LastChangedBy: iworks $
10
  *
11
  */
55
  '#value' => $id,
56
  '#name' => 'ct[wpcf-post-type]',
57
  );
58
+ /**
59
+ * update taxonomy too
60
+ */
61
+ $custom_taxonomies = get_option( 'wpcf-custom-taxonomies', array() );
62
+ foreach( $custom_taxonomies as $slug => $data ) {
63
+ if ( !array_key_exists('supports', $data)) {
64
+ continue;
65
+ }
66
+ if ( !array_key_exists($id, $data['supports']) ) {
67
+ continue;
68
+ }
69
+ if (
70
+ array_key_exists('taxonomies', $ct)
71
+ && array_key_exists($slug, $ct['taxonomies'])
72
+ ) {
73
+ continue;
74
+ }
75
+ unset($custom_taxonomies[$slug]['supports'][$id]);
76
+ }
77
+ update_option( 'wpcf-custom-taxonomies', $custom_taxonomies);
78
  }
79
 
80
  $form['table-1-open'] = array(
635
  );
636
  $form['table-6-open'] = array(
637
  '#type' => 'markup',
638
+ '#markup' => '<table id="wpcf-types-form-supports-table" class="wpcf-types-form-table widefat"><thead><tr><th>' . __( 'Options', 'wpcf' ) . '</th></tr></thead><tbody><tr><td>',
 
639
  );
640
  $form['rewrite-enabled'] = array(
641
  '#type' => 'checkbox',
includes/fields-control.php CHANGED
@@ -2,9 +2,9 @@
2
  /*
3
  * Custom Fields Control Screen
4
  *
5
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/includes/fields-control.php $
6
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
7
- * $LastChangedRevision: 1012704 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
2
  /*
3
  * Custom Fields Control Screen
4
  *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/includes/fields-control.php $
6
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
7
+ * $LastChangedRevision: 1027712 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
includes/fields-form.php CHANGED
@@ -2,9 +2,9 @@
2
  /*
3
  * Fields and groups form functions.
4
  *
5
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/includes/fields-form.php $
6
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
7
- * $LastChangedRevision: 1012704 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
@@ -319,7 +319,8 @@ function wpcf_admin_fields_form() {
319
  . '&amp;page=wpcf-edit'
320
  . '&amp;field=' . $field['id'] ) . '&amp;_wpnonce='
321
  . wp_create_nonce( 'fields_insert_existing' ) . '" '
322
- . 'class="wpcf-fields-add-ajax-link button-secondary" onclick="jQuery(this).parent().fadeOut();">'
 
323
  . htmlspecialchars( stripslashes( $field['name'] ) ) . '</a>'
324
  . '<a href="' . admin_url( 'admin-ajax.php'
325
  . '?action=wpcf_ajax'
@@ -768,8 +769,7 @@ function wpcf_admin_fields_form() {
768
  wpcf_admin_add_js_settings( 'wpcf_filters_association_all_templates',
769
  '\'' . __( 'any', 'wpcf' ) . '\'' );
770
 
771
- $additional_filters = apply_filters( 'wpcf_fields_form_additional_filters',
772
- array(), $update );
773
  $form = $form + $additional_filters;
774
 
775
  $form['supports-table-close'] = array(
2
  /*
3
  * Fields and groups form functions.
4
  *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/includes/fields-form.php $
6
+ * $LastChangedDate: 2014-10-23 10:33:39 +0000 (Thu, 23 Oct 2014) $
7
+ * $LastChangedRevision: 1012677 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
319
  . '&amp;page=wpcf-edit'
320
  . '&amp;field=' . $field['id'] ) . '&amp;_wpnonce='
321
  . wp_create_nonce( 'fields_insert_existing' ) . '" '
322
+ . 'class="wpcf-fields-add-ajax-link button-secondary" onclick="jQuery(this).parent().fadeOut();" '
323
+ . ' data-slug="' . $field['id'] . '">'
324
  . htmlspecialchars( stripslashes( $field['name'] ) ) . '</a>'
325
  . '<a href="' . admin_url( 'admin-ajax.php'
326
  . '?action=wpcf_ajax'
769
  wpcf_admin_add_js_settings( 'wpcf_filters_association_all_templates',
770
  '\'' . __( 'any', 'wpcf' ) . '\'' );
771
 
772
+ $additional_filters = apply_filters( 'wpcf_fields_form_additional_filters', array(), $update );
 
773
  $form = $form + $additional_filters;
774
 
775
  $form['supports-table-close'] = array(
includes/fields-list.php CHANGED
@@ -2,10 +2,10 @@
2
  /*
3
  * Fields and groups list functions
4
  *
5
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/includes/fields-list.php $
6
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
7
- * $LastChangedRevision: 1012704 $
8
- * $LastChangedBy: iworks $
9
  *
10
  */
11
 
2
  /*
3
  * Fields and groups list functions
4
  *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/includes/fields-list.php $
6
+ * $LastChangedDate: 2014-08-22 01:02:43 +0000 (Fri, 22 Aug 2014) $
7
+ * $LastChangedRevision: 970205 $
8
+ * $LastChangedBy: brucepearson $
9
  *
10
  */
11
 
includes/fields.php CHANGED
@@ -2,9 +2,9 @@
2
  /*
3
  * Fields and groups functions
4
  *
5
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/includes/fields.php $
6
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
7
- * $LastChangedRevision: 1012704 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
@@ -12,10 +12,10 @@ require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php';
12
 
13
  /**
14
  * Gets post_types supported by specific group.
15
- *
16
  * @global type $wpdb
17
  * @param type $group_id
18
- * @return type
19
  */
20
  function wpcf_admin_get_post_types_by_group( $group_id ) {
21
  $post_types = get_post_meta( $group_id, '_wp_types_group_post_types', true );
@@ -28,10 +28,10 @@ function wpcf_admin_get_post_types_by_group( $group_id ) {
28
 
29
  /**
30
  * Gets taxonomies supported by specific group.
31
- *
32
  * @global type $wpdb
33
  * @param type $group_id
34
- * @return type
35
  */
36
  function wpcf_admin_get_taxonomies_by_group( $group_id ) {
37
  global $wpdb;
@@ -61,10 +61,10 @@ function wpcf_admin_get_taxonomies_by_group( $group_id ) {
61
 
62
  /**
63
  * Gets templates supported by specific group.
64
- *
65
  * @global type $wpdb
66
  * @param type $group_id
67
- * @return type
68
  */
69
  function wpcf_admin_get_templates_by_group( $group_id ) {
70
  global $wpdb;
@@ -93,10 +93,10 @@ function wpcf_admin_get_templates_by_group( $group_id ) {
93
  /**
94
  * Activates group.
95
  * Modified by Gen, 13.02.2013
96
- *
97
  * @global type $wpdb
98
  * @param type $group_id
99
- * @return type
100
  */
101
  function wpcf_admin_fields_activate_group( $group_id,
102
  $post_type = 'wp-types-group' ) {
@@ -110,10 +110,10 @@ function wpcf_admin_fields_activate_group( $group_id,
110
  /**
111
  * Deactivates group.
112
  * Modified by Gen, 13.02.2013
113
- *
114
  * @global type $wpdb
115
  * @param type $group_id
116
- * @return type
117
  */
118
  function wpcf_admin_fields_deactivate_group( $group_id,
119
  $post_type = 'wp-types-group' ) {
@@ -126,12 +126,12 @@ function wpcf_admin_fields_deactivate_group( $group_id,
126
 
127
  /**
128
  * Removes specific field from group.
129
- *
130
  * @global type $wpdb
131
  * @global type $wpdb
132
  * @param type $group_id
133
  * @param type $field_id
134
- * @return type
135
  */
136
  function wpcf_admin_fields_remove_field_from_group( $group_id, $field_id ) {
137
  $group_fields = get_post_meta( $group_id, '_wp_types_group_fields', true );
@@ -144,10 +144,10 @@ function wpcf_admin_fields_remove_field_from_group( $group_id, $field_id ) {
144
 
145
  /**
146
  * Bulk removal
147
- *
148
  * @param type $group_id
149
  * @param type $fields
150
- * @return type
151
  */
152
  function wpcf_admin_fields_remove_field_from_group_bulk( $group_id, $fields ) {
153
  foreach ( $fields as $field_id ) {
@@ -158,7 +158,7 @@ function wpcf_admin_fields_remove_field_from_group_bulk( $group_id, $fields ) {
158
  /**
159
  * Deletes field.
160
  * Modified by Gen, 13.02.2013
161
- *
162
  * @param type $field_id
163
  */
164
  function wpcf_admin_fields_delete_field( $field_id,
@@ -190,10 +190,10 @@ function wpcf_admin_fields_delete_field( $field_id,
190
  /**
191
  * Deletes group by ID.
192
  * Modified by Gen, 13.02.2013
193
- *
194
  * @global type $wpdb
195
  * @param type $group_id
196
- * @return type
197
  */
198
  function wpcf_admin_fields_delete_group( $group_id,
199
  $post_type = 'wp-types-group' ) {
@@ -207,9 +207,9 @@ function wpcf_admin_fields_delete_group( $group_id,
207
  /**
208
  * Saves group.
209
  * Modified by Gen, 13.02.2013
210
- *
211
  * @param type $group
212
- * @return type
213
  */
214
  function wpcf_admin_fields_save_group( $group, $post_type = 'wp-types-group' ) {
215
  if ( !isset( $group['name'] ) ) {
@@ -248,8 +248,7 @@ function wpcf_admin_fields_save_group( $group, $post_type = 'wp-types-group' ) {
248
  }
249
 
250
  if ( !empty( $group['filters_association'] ) ) {
251
- update_post_meta( $group_id, '_wp_types_group_filters_association',
252
- $group['filters_association'] );
253
  } else {
254
  delete_post_meta( $group_id, '_wp_types_group_filters_association' );
255
  }
@@ -268,8 +267,8 @@ function wpcf_admin_fields_save_group( $group, $post_type = 'wp-types-group' ) {
268
  /**
269
  * Saves all fields.
270
  * Modified by Gen, 13.02.2013
271
- *
272
- * @param type $fields
273
  */
274
  function wpcf_admin_fields_save_fields( $fields, $forced = false,
275
  $option_name = 'wpcf-fields' ) {
@@ -283,9 +282,9 @@ function wpcf_admin_fields_save_fields( $fields, $forced = false,
283
  /**
284
  * Saves field.
285
  * Modified by Gen, 13.02.2013
286
- *
287
  * @param type $field
288
- * @return type
289
  */
290
  function wpcf_admin_fields_save_field( $field, $post_type = 'wp-types-group',
291
  $meta_name = 'wpcf-fields' ) {
@@ -327,8 +326,7 @@ function wpcf_admin_fields_save_field( $field, $post_type = 'wp-types-group',
327
  }
328
  }
329
 
330
- $field['data'] = apply_filters( 'wpcf_fields_' . $field['type'] . '_meta_data',
331
- $field['data'], $field );
332
 
333
  // Check validation
334
  if ( isset( $field['data']['validate'] ) ) {
@@ -492,9 +490,9 @@ function wpcf_admin_fields_save_field( $field, $post_type = 'wp-types-group',
492
  /**
493
  * Changes field type.
494
  * Modified by Gen, 13.02.2013
495
- *
496
  * @param type $fields
497
- * @param type $type
498
  */
499
  function wpcf_admin_custom_fields_change_type( $fields, $type,
500
  $post_type = 'wp-types-group', $meta_name = 'wpcf-fields' ) {
@@ -551,10 +549,10 @@ function wpcf_admin_custom_fields_change_type( $fields, $type,
551
  /**
552
  * Saves group's fields.
553
  * Modified by Gen, 13.02.2013
554
- *
555
  * @global type $wpdb
556
  * @param type $group_id
557
- * @param type $fields
558
  */
559
  function wpcf_admin_fields_save_group_fields( $group_id, $fields, $add = false,
560
  $post_type = 'wp-types-group' ) {
@@ -588,10 +586,10 @@ function wpcf_admin_fields_save_group_fields( $group_id, $fields, $add = false,
588
 
589
  /**
590
  * Saves group's post types.
591
- *
592
  * @global type $wpdb
593
  * @param type $group_id
594
- * @param type $post_types
595
  */
596
  function wpcf_admin_fields_save_group_post_types( $group_id, $post_types ) {
597
  if ( empty( $post_types ) ) {
@@ -604,10 +602,10 @@ function wpcf_admin_fields_save_group_post_types( $group_id, $post_types ) {
604
 
605
  /**
606
  * Saves group's terms.
607
- *
608
  * @global type $wpdb
609
  * @param type $group_id
610
- * @param type $terms
611
  */
612
  function wpcf_admin_fields_save_group_terms( $group_id, $terms ) {
613
  if ( empty( $terms ) ) {
@@ -620,10 +618,10 @@ function wpcf_admin_fields_save_group_terms( $group_id, $terms ) {
620
 
621
  /**
622
  * Saves group's templates.
623
- *
624
  * @global type $wpdb
625
  * @param type $group_id
626
- * @param type $terms
627
  */
628
  function wpcf_admin_fields_save_group_templates( $group_id, $templates ) {
629
  if ( empty( $templates ) ) {
@@ -636,9 +634,9 @@ function wpcf_admin_fields_save_group_templates( $group_id, $templates ) {
636
 
637
  /**
638
  * Returns HTML formatted AJAX activation link.
639
- *
640
  * @param type $group_id
641
- * @return type
642
  */
643
  function wpcf_admin_fields_get_ajax_activation_link( $group_id ) {
644
  return '<a href="' . admin_url( 'admin-ajax.php?action=wpcf_ajax&amp;'
@@ -653,7 +651,7 @@ function wpcf_admin_fields_get_ajax_activation_link( $group_id ) {
653
  /**
654
  * Returns HTML formatted AJAX deactivation link.
655
  * @param type $group_id
656
- * @return type
657
  */
658
  function wpcf_admin_fields_get_ajax_deactivation_link( $group_id ) {
659
  return '<a href="' . admin_url( 'admin-ajax.php?action=wpcf_ajax&amp;'
@@ -667,10 +665,10 @@ function wpcf_admin_fields_get_ajax_deactivation_link( $group_id ) {
667
 
668
  /**
669
  * Check how many posts needs checkbox update.
670
- *
671
  * @param type $field
672
  * @param type $action
673
- * @return boolean|int
674
  */
675
  function wpcf_admin_fields_checkbox_migrate_empty_check( $field, $action ) {
676
  if ( $field['type'] != 'checkbox' ) {
@@ -716,10 +714,10 @@ function wpcf_admin_fields_checkbox_migrate_empty_check( $field, $action ) {
716
 
717
  /**
718
  * Update posts checkboxes fields.
719
- *
720
  * @param type $field
721
  * @param type $action
722
- * @return boolean|int
723
  */
724
  function wpcf_admin_fields_checkbox_migrate_empty( $field, $action ) {
725
  if ( $field['type'] != 'checkbox' ) {
@@ -819,9 +817,9 @@ function wpcf_admin_fields_checkbox_migrate_empty( $field, $action ) {
819
 
820
  /**
821
  * Gets all filters required for field to be used.
822
- *
823
  * @param type $field
824
- * @return boolean|string
825
  */
826
  function wpcf_admin_fields_get_filter_by_field( $field ) {
827
  $field = wpcf_admin_fields_get_field( $field );
@@ -865,10 +863,10 @@ function wpcf_admin_fields_get_filter_by_field( $field ) {
865
 
866
  /**
867
  * Gets posts by filter fetched with wpcf_admin_fields_get_filter_by_field().
868
- *
869
  * @global type $wpdb
870
  * @param type $filter
871
- * @return type
872
  */
873
  function wpcf_admin_fields_get_posts_by_filter( $filter, $meta_query = '' ) {
874
  global $wpdb, $wpcf;
@@ -924,10 +922,10 @@ function wpcf_admin_fields_get_posts_by_filter( $filter, $meta_query = '' ) {
924
  /**
925
  * Gets posts by filter with missing meta fetched
926
  * with wpcf_admin_fields_get_filter_by_field().
927
- *
928
  * @global type $wpdb
929
  * @param type $filter
930
- * @return type
931
  */
932
  function wpcf_admin_fields_get_posts_by_filter_missing_meta( $filter,
933
  $meta_key = '' ) {
@@ -974,10 +972,10 @@ function wpcf_admin_fields_get_posts_by_filter_missing_meta( $filter,
974
 
975
  /**
976
  * Check how many posts needs checkboxes update.
977
- *
978
  * @param type $field
979
  * @param type $action
980
- * @return boolean|int
981
  */
982
  function wpcf_admin_fields_checkboxes_migrate_empty_check( $field, $action ) {
983
  if ( $field['type'] != 'checkboxes' || empty( $field['data']['options'] ) ) {
@@ -992,7 +990,7 @@ function wpcf_admin_fields_checkboxes_migrate_empty_check( $field, $action ) {
992
  $query[] = '\"' . $option_id . '\";i:0;';
993
  }
994
  $meta_query = "SELECT u.ID FROM {$wpdb->users} u
995
- LEFT JOIN {$wpdb->usermeta} um ON u.ID = um.user_id
996
  WHERE (um.meta_key = '%s' AND (um.meta_value LIKE '%%"
997
  . implode( "%%' OR um.meta_value LIKE '%%", $query ) . "%%'))";
998
  } else if ( $action == 'save_check' ) {
@@ -1003,7 +1001,7 @@ function wpcf_admin_fields_checkboxes_migrate_empty_check( $field, $action ) {
1003
  $query[] = '\"' . $option_id . '\"';
1004
  }
1005
  $meta_query = "SELECT u.ID FROM {$wpdb->users} u
1006
- LEFT JOIN {$wpdb->usermeta} um ON u.ID = um.user_id
1007
  WHERE (um.meta_key = '%s' AND (um.meta_value NOT LIKE '%%"
1008
  . implode( "%%' OR um.meta_value NOT LIKE '%%", $query ) . "%%'))";
1009
  }
@@ -1049,10 +1047,10 @@ function wpcf_admin_fields_checkboxes_migrate_empty_check( $field, $action ) {
1049
 
1050
  /**
1051
  * Update posts checkboxes fields.
1052
- *
1053
  * @param type $field
1054
  * @param type $action
1055
- * @return boolean|int
1056
  */
1057
  function wpcf_admin_fields_checkboxes_migrate_empty( $field, $action ) {
1058
  if ( $field['type'] != 'checkboxes' || empty( $field['data']['options'] ) ) {
@@ -1171,8 +1169,7 @@ function wpcf_admin_fields_checkboxes_migrate_empty( $field, $action ) {
1171
  unset( $value_check[$option_id] );
1172
  }
1173
  }
1174
- update_post_meta( $post_id, $meta_key, $value_check,
1175
- $value );
1176
  }
1177
  }
1178
  unset( $posts[$temp_key] );
@@ -1206,8 +1203,7 @@ function wpcf_admin_fields_checkboxes_migrate_empty( $field, $action ) {
1206
  }
1207
  }
1208
  $updated_value = $value_check + $set_value;
1209
- update_post_meta( $post_id, $meta_key, $updated_value,
1210
- $value );
1211
  }
1212
  }
1213
  unset( $posts[$temp_key] );
2
  /*
3
  * Fields and groups functions
4
  *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/includes/fields.php $
6
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
7
+ * $LastChangedRevision: 1027712 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
12
 
13
  /**
14
  * Gets post_types supported by specific group.
15
+ *
16
  * @global type $wpdb
17
  * @param type $group_id
18
+ * @return type
19
  */
20
  function wpcf_admin_get_post_types_by_group( $group_id ) {
21
  $post_types = get_post_meta( $group_id, '_wp_types_group_post_types', true );
28
 
29
  /**
30
  * Gets taxonomies supported by specific group.
31
+ *
32
  * @global type $wpdb
33
  * @param type $group_id
34
+ * @return type
35
  */
36
  function wpcf_admin_get_taxonomies_by_group( $group_id ) {
37
  global $wpdb;
61
 
62
  /**
63
  * Gets templates supported by specific group.
64
+ *
65
  * @global type $wpdb
66
  * @param type $group_id
67
+ * @return type
68
  */
69
  function wpcf_admin_get_templates_by_group( $group_id ) {
70
  global $wpdb;
93
  /**
94
  * Activates group.
95
  * Modified by Gen, 13.02.2013
96
+ *
97
  * @global type $wpdb
98
  * @param type $group_id
99
+ * @return type
100
  */
101
  function wpcf_admin_fields_activate_group( $group_id,
102
  $post_type = 'wp-types-group' ) {
110
  /**
111
  * Deactivates group.
112
  * Modified by Gen, 13.02.2013
113
+ *
114
  * @global type $wpdb
115
  * @param type $group_id
116
+ * @return type
117
  */
118
  function wpcf_admin_fields_deactivate_group( $group_id,
119
  $post_type = 'wp-types-group' ) {
126
 
127
  /**
128
  * Removes specific field from group.
129
+ *
130
  * @global type $wpdb
131
  * @global type $wpdb
132
  * @param type $group_id
133
  * @param type $field_id
134
+ * @return type
135
  */
136
  function wpcf_admin_fields_remove_field_from_group( $group_id, $field_id ) {
137
  $group_fields = get_post_meta( $group_id, '_wp_types_group_fields', true );
144
 
145
  /**
146
  * Bulk removal
147
+ *
148
  * @param type $group_id
149
  * @param type $fields
150
+ * @return type
151
  */
152
  function wpcf_admin_fields_remove_field_from_group_bulk( $group_id, $fields ) {
153
  foreach ( $fields as $field_id ) {
158
  /**
159
  * Deletes field.
160
  * Modified by Gen, 13.02.2013
161
+ *
162
  * @param type $field_id
163
  */
164
  function wpcf_admin_fields_delete_field( $field_id,
190
  /**
191
  * Deletes group by ID.
192
  * Modified by Gen, 13.02.2013
193
+ *
194
  * @global type $wpdb
195
  * @param type $group_id
196
+ * @return type
197
  */
198
  function wpcf_admin_fields_delete_group( $group_id,
199
  $post_type = 'wp-types-group' ) {
207
  /**
208
  * Saves group.
209
  * Modified by Gen, 13.02.2013
210
+ *
211
  * @param type $group
212
+ * @return type
213
  */
214
  function wpcf_admin_fields_save_group( $group, $post_type = 'wp-types-group' ) {
215
  if ( !isset( $group['name'] ) ) {
248
  }
249
 
250
  if ( !empty( $group['filters_association'] ) ) {
251
+ update_post_meta( $group_id, '_wp_types_group_filters_association', $group['filters_association'] );
 
252
  } else {
253
  delete_post_meta( $group_id, '_wp_types_group_filters_association' );
254
  }
267
  /**
268
  * Saves all fields.
269
  * Modified by Gen, 13.02.2013
270
+ *
271
+ * @param type $fields
272
  */
273
  function wpcf_admin_fields_save_fields( $fields, $forced = false,
274
  $option_name = 'wpcf-fields' ) {
282
  /**
283
  * Saves field.
284
  * Modified by Gen, 13.02.2013
285
+ *
286
  * @param type $field
287
+ * @return type
288
  */
289
  function wpcf_admin_fields_save_field( $field, $post_type = 'wp-types-group',
290
  $meta_name = 'wpcf-fields' ) {
326
  }
327
  }
328
 
329
+ $field['data'] = apply_filters( 'wpcf_fields_' . $field['type'] . '_meta_data', $field['data'], $field );
 
330
 
331
  // Check validation
332
  if ( isset( $field['data']['validate'] ) ) {
490
  /**
491
  * Changes field type.
492
  * Modified by Gen, 13.02.2013
493
+ *
494
  * @param type $fields
495
+ * @param type $type
496
  */
497
  function wpcf_admin_custom_fields_change_type( $fields, $type,
498
  $post_type = 'wp-types-group', $meta_name = 'wpcf-fields' ) {
549
  /**
550
  * Saves group's fields.
551
  * Modified by Gen, 13.02.2013
552
+ *
553
  * @global type $wpdb
554
  * @param type $group_id
555
+ * @param type $fields
556
  */
557
  function wpcf_admin_fields_save_group_fields( $group_id, $fields, $add = false,
558
  $post_type = 'wp-types-group' ) {
586
 
587
  /**
588
  * Saves group's post types.
589
+ *
590
  * @global type $wpdb
591
  * @param type $group_id
592
+ * @param type $post_types
593
  */
594
  function wpcf_admin_fields_save_group_post_types( $group_id, $post_types ) {
595
  if ( empty( $post_types ) ) {
602
 
603
  /**
604
  * Saves group's terms.
605
+ *
606
  * @global type $wpdb
607
  * @param type $group_id
608
+ * @param type $terms
609
  */
610
  function wpcf_admin_fields_save_group_terms( $group_id, $terms ) {
611
  if ( empty( $terms ) ) {
618
 
619
  /**
620
  * Saves group's templates.
621
+ *
622
  * @global type $wpdb
623
  * @param type $group_id
624
+ * @param type $terms
625
  */
626
  function wpcf_admin_fields_save_group_templates( $group_id, $templates ) {
627
  if ( empty( $templates ) ) {
634
 
635
  /**
636
  * Returns HTML formatted AJAX activation link.
637
+ *
638
  * @param type $group_id
639
+ * @return type
640
  */
641
  function wpcf_admin_fields_get_ajax_activation_link( $group_id ) {
642
  return '<a href="' . admin_url( 'admin-ajax.php?action=wpcf_ajax&amp;'
651
  /**
652
  * Returns HTML formatted AJAX deactivation link.
653
  * @param type $group_id
654
+ * @return type
655
  */
656
  function wpcf_admin_fields_get_ajax_deactivation_link( $group_id ) {
657
  return '<a href="' . admin_url( 'admin-ajax.php?action=wpcf_ajax&amp;'
665
 
666
  /**
667
  * Check how many posts needs checkbox update.
668
+ *
669
  * @param type $field
670
  * @param type $action
671
+ * @return boolean|int
672
  */
673
  function wpcf_admin_fields_checkbox_migrate_empty_check( $field, $action ) {
674
  if ( $field['type'] != 'checkbox' ) {
714
 
715
  /**
716
  * Update posts checkboxes fields.
717
+ *
718
  * @param type $field
719
  * @param type $action
720
+ * @return boolean|int
721
  */
722
  function wpcf_admin_fields_checkbox_migrate_empty( $field, $action ) {
723
  if ( $field['type'] != 'checkbox' ) {
817
 
818
  /**
819
  * Gets all filters required for field to be used.
820
+ *
821
  * @param type $field
822
+ * @return boolean|string
823
  */
824
  function wpcf_admin_fields_get_filter_by_field( $field ) {
825
  $field = wpcf_admin_fields_get_field( $field );
863
 
864
  /**
865
  * Gets posts by filter fetched with wpcf_admin_fields_get_filter_by_field().
866
+ *
867
  * @global type $wpdb
868
  * @param type $filter
869
+ * @return type
870
  */
871
  function wpcf_admin_fields_get_posts_by_filter( $filter, $meta_query = '' ) {
872
  global $wpdb, $wpcf;
922
  /**
923
  * Gets posts by filter with missing meta fetched
924
  * with wpcf_admin_fields_get_filter_by_field().
925
+ *
926
  * @global type $wpdb
927
  * @param type $filter
928
+ * @return type
929
  */
930
  function wpcf_admin_fields_get_posts_by_filter_missing_meta( $filter,
931
  $meta_key = '' ) {
972
 
973
  /**
974
  * Check how many posts needs checkboxes update.
975
+ *
976
  * @param type $field
977
  * @param type $action
978
+ * @return boolean|int
979
  */
980
  function wpcf_admin_fields_checkboxes_migrate_empty_check( $field, $action ) {
981
  if ( $field['type'] != 'checkboxes' || empty( $field['data']['options'] ) ) {
990
  $query[] = '\"' . $option_id . '\";i:0;';
991
  }
992
  $meta_query = "SELECT u.ID FROM {$wpdb->users} u
993
+ LEFT JOIN {$wpdb->usermeta} um ON u.ID = um.user_id
994
  WHERE (um.meta_key = '%s' AND (um.meta_value LIKE '%%"
995
  . implode( "%%' OR um.meta_value LIKE '%%", $query ) . "%%'))";
996
  } else if ( $action == 'save_check' ) {
1001
  $query[] = '\"' . $option_id . '\"';
1002
  }
1003
  $meta_query = "SELECT u.ID FROM {$wpdb->users} u
1004
+ LEFT JOIN {$wpdb->usermeta} um ON u.ID = um.user_id
1005
  WHERE (um.meta_key = '%s' AND (um.meta_value NOT LIKE '%%"
1006
  . implode( "%%' OR um.meta_value NOT LIKE '%%", $query ) . "%%'))";
1007
  }
1047
 
1048
  /**
1049
  * Update posts checkboxes fields.
1050
+ *
1051
  * @param type $field
1052
  * @param type $action
1053
+ * @return boolean|int
1054
  */
1055
  function wpcf_admin_fields_checkboxes_migrate_empty( $field, $action ) {
1056
  if ( $field['type'] != 'checkboxes' || empty( $field['data']['options'] ) ) {
1169
  unset( $value_check[$option_id] );
1170
  }
1171
  }
1172
+ update_post_meta( $post_id, $meta_key, $value_check, $value );
 
1173
  }
1174
  }
1175
  unset( $posts[$temp_key] );
1203
  }
1204
  }
1205
  $updated_value = $value_check + $set_value;
1206
+ update_post_meta( $post_id, $meta_key, $updated_value, $value );
 
1207
  }
1208
  }
1209
  unset( $posts[$temp_key] );
includes/import-export.php CHANGED
@@ -2,9 +2,9 @@
2
  /*
3
  * Import/export data.
4
  *
5
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/includes/import-export.php $
6
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
7
- * $LastChangedRevision: 1012704 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
2
  /*
3
  * Import/export data.
4
  *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/includes/import-export.php $
6
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
7
+ * $LastChangedRevision: 1027712 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
includes/introduction.php CHANGED
@@ -2,10 +2,10 @@
2
  /*
3
  * Introduction page.
4
  *
5
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/includes/introduction.php $
6
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
7
- * $LastChangedRevision: 1012704 $
8
- * $LastChangedBy: iworks $
9
  *
10
  */
11
 
2
  /*
3
  * Introduction page.
4
  *
5
+ * $HeadURL: $
6
+ * $LastChangedDate: $
7
+ * $LastChangedRevision: $
8
+ * $LastChangedBy: $
9
  *
10
  */
11
 
includes/migration.php CHANGED
@@ -1,14 +1,22 @@
1
  <?php
2
  /*
3
  * Migration functions
 
 
 
 
 
 
4
  */
5
 
6
  /**
7
  * Migration form.
8
- *
9
- * @return array
10
  */
11
  function wpcf_admin_migration_form() {
 
 
12
  global $wpdb;
13
  $wpcf_types = get_option('wpcf-custom-types', array());
14
  $wpcf_taxonomies = get_option('wpcf-custom-taxonomies', array());
@@ -327,14 +335,14 @@ function wpcf_admin_migration_form_submit() {
327
  foreach ($cfui_types as $cfui_type) {
328
  if (sanitize_title($cfui_type['name']) == $types_slug) {
329
  $data[$types_slug] = wpcf_admin_migrate_get_cfui_type_data($cfui_type);
330
- wpcf_admin_message_store(sprintf(__("Post Type %s added",
331
- 'wpcf'),
332
- '<em>' . $cfui_type['name'] . '</em>'));
 
333
  }
334
  }
335
  }
336
  $wpcf_types = array_merge($wpcf_types, $data);
337
- update_option('wpcf-custom-types', $wpcf_types);
338
  }
339
  if (!empty($_POST['cfui']['tax'])) {
340
  $data = array();
@@ -345,15 +353,33 @@ function wpcf_admin_migration_form_submit() {
345
  foreach ($cfui_taxonomies as $cfui_tax) {
346
  if (sanitize_title($cfui_tax['name']) == $tax_slug) {
347
  $data[$tax_slug] = wpcf_admin_migrate_get_cfui_tax_data($cfui_tax);
348
- wpcf_admin_message_store(sprintf(__("Taxonomy %s added",
349
- 'wpcf'),
350
- '<em>' . $cfui_tax['name'] . '</em>'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
351
  }
352
  }
353
  }
354
  $wpcf_taxonomies = array_merge($wpcf_taxonomies, $data);
355
  update_option('wpcf-custom-taxonomies', $wpcf_taxonomies);
356
  }
 
357
 
358
  // ACF
359
 
@@ -581,4 +607,4 @@ function wpcf_admin_migrate_get_cfui_tax_data($cfui_tax) {
581
  array_merge($cfui_tax, $cfui_tax_migrated[$slug]));
582
 
583
  return $cfui_tax_migrated[$slug];
584
- }
1
  <?php
2
  /*
3
  * Migration functions
4
+ *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/includes/migration.php $
6
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
7
+ * $LastChangedRevision: 1027712 $
8
+ * $LastChangedBy: iworks $
9
+ *
10
  */
11
 
12
  /**
13
  * Migration form.
14
+ *
15
+ * @return array
16
  */
17
  function wpcf_admin_migration_form() {
18
+
19
+
20
  global $wpdb;
21
  $wpcf_types = get_option('wpcf-custom-types', array());
22
  $wpcf_taxonomies = get_option('wpcf-custom-taxonomies', array());
335
  foreach ($cfui_types as $cfui_type) {
336
  if (sanitize_title($cfui_type['name']) == $types_slug) {
337
  $data[$types_slug] = wpcf_admin_migrate_get_cfui_type_data($cfui_type);
338
+ wpcf_admin_message_store(
339
+ sprintf(__("Post Type %s added", 'wpcf'),
340
+ '<em>' . $cfui_type['name'] . '</em>')
341
+ );
342
  }
343
  }
344
  }
345
  $wpcf_types = array_merge($wpcf_types, $data);
 
346
  }
347
  if (!empty($_POST['cfui']['tax'])) {
348
  $data = array();
353
  foreach ($cfui_taxonomies as $cfui_tax) {
354
  if (sanitize_title($cfui_tax['name']) == $tax_slug) {
355
  $data[$tax_slug] = wpcf_admin_migrate_get_cfui_tax_data($cfui_tax);
356
+ wpcf_admin_message_store(
357
+ sprintf(__("Taxonomy %s added", 'wpcf'),
358
+ '<em>' . $cfui_tax['name'] . '</em>')
359
+ );
360
+ if (
361
+ array_key_exists(1,$cfui_tax)
362
+ && !empty($cfui_tax[1])
363
+ && is_array($cfui_tax[1])
364
+ ) {
365
+ foreach( $cfui_tax[1] as $key) {
366
+ $types_slug = sanitize_title($key);
367
+ if ( array_key_exists($types_slug, $wpcf_types) ) {
368
+ if ( !array_key_exists('taxonomies', $wpcf_types[$types_slug] )) {
369
+ $wpcf_types[$types_slug]['taxonomies'] = array();
370
+ }
371
+ $wpcf_types[$types_slug]['taxonomies'][$tax_slug] = 1;
372
+ }
373
+ }
374
+
375
+ }
376
  }
377
  }
378
  }
379
  $wpcf_taxonomies = array_merge($wpcf_taxonomies, $data);
380
  update_option('wpcf-custom-taxonomies', $wpcf_taxonomies);
381
  }
382
+ update_option('wpcf-custom-types', $wpcf_types);
383
 
384
  // ACF
385
 
607
  array_merge($cfui_tax, $cfui_tax_migrated[$slug]));
608
 
609
  return $cfui_tax_migrated[$slug];
610
+ }
includes/post-relationship.php CHANGED
@@ -286,7 +286,10 @@ function wpcf_pr_admin_edit_fields( $parent, $child ) {
286
  $options_cf[$__key]['#after'] = !isset( $data['fields'][$__key] ) ? '<div class="message error" style="display:none;"><p>' : '<div class="message error"><p>';
287
  $options_cf[$__key]['#after'] .= $repetitive_warning_txt;
288
  $options_cf[$__key]['#after'] .= '</p></div>';
289
- $options_cf[$__key]['#attributes'] = array('onclick' => 'jQuery(this).parent().find(\'.message\').toggle();');
 
 
 
290
  }
291
  }
292
  }
@@ -382,4 +385,4 @@ function wpcf_pr_admin_edit_fields( $parent, $child ) {
382
  </script>
383
  <?php
384
  wpcf_admin_ajax_footer();
385
- }
286
  $options_cf[$__key]['#after'] = !isset( $data['fields'][$__key] ) ? '<div class="message error" style="display:none;"><p>' : '<div class="message error"><p>';
287
  $options_cf[$__key]['#after'] .= $repetitive_warning_txt;
288
  $options_cf[$__key]['#after'] .= '</p></div>';
289
+ $options_cf[$__key]['#attributes'] = array(
290
+ 'onclick' => 'jQuery(this).parent().find(\'.message\').toggle();',
291
+ 'disabled' => 'disabled',
292
+ );
293
  }
294
  }
295
  }
385
  </script>
386
  <?php
387
  wpcf_admin_ajax_footer();
388
+ }
includes/usermeta-control.php CHANGED
@@ -2,9 +2,9 @@
2
  /*
3
  * Custom Fields Control Screen
4
  *
5
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/includes/usermeta-control.php $
6
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
7
- * $LastChangedRevision: 1012704 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
2
  /*
3
  * Custom Fields Control Screen
4
  *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/includes/usermeta-control.php $
6
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
7
+ * $LastChangedRevision: 1027712 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
includes/usermeta-form.php CHANGED
@@ -2,9 +2,9 @@
2
  /*
3
  * Fields and groups form functions.
4
  *
5
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/includes/usermeta-form.php $
6
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
7
- * $LastChangedRevision: 1012704 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
@@ -297,7 +297,8 @@ function wpcf_admin_usermeta_form() {
297
  . '&amp;wpcf_action=usermeta_insert_existing'
298
  . '&amp;field=' . $field['id'] ) . '&amp;_wpnonce='
299
  . wp_create_nonce( 'usermeta_insert_existing' ) . '" '
300
- . 'class="wpcf-fields-add-ajax-link button-secondary" onclick="jQuery(this).parent().fadeOut();">'
 
301
  . htmlspecialchars( stripslashes( $field['name'] ) ) . '</a>'
302
  . '<a href="' . admin_url( 'admin-ajax.php'
303
  . '?action=wpcf_ajax'
2
  /*
3
  * Fields and groups form functions.
4
  *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/includes/usermeta-form.php $
6
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
7
+ * $LastChangedRevision: 1027712 $
8
  * $LastChangedBy: iworks $
9
  *
10
  */
297
  . '&amp;wpcf_action=usermeta_insert_existing'
298
  . '&amp;field=' . $field['id'] ) . '&amp;_wpnonce='
299
  . wp_create_nonce( 'usermeta_insert_existing' ) . '" '
300
+ . 'class="wpcf-fields-add-ajax-link button-secondary" onclick="jQuery(this).parent().fadeOut();" '
301
+ . 'data-slug="' . $field['id'] . '">'
302
  . htmlspecialchars( stripslashes( $field['name'] ) ) . '</a>'
303
  . '<a href="' . admin_url( 'admin-ajax.php'
304
  . '?action=wpcf_ajax'
marketing/types_marketing_message_survey_2014_09.php CHANGED
@@ -4,9 +4,9 @@
4
  * Ask Types users for feedback on their work
5
  * https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/188885189/comments
6
  *
7
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/marketing/types_marketing_message_survey_2014_09.php $
8
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
9
- * $LastChangedRevision: 1012704 $
10
  * $LastChangedBy: iworks $
11
  *
12
  */
4
  * Ask Types users for feedback on their work
5
  * https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/188885189/comments
6
  *
7
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/marketing/types_marketing_message_survey_2014_09.php $
8
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
9
+ * $LastChangedRevision: 1027712 $
10
  * $LastChangedBy: iworks $
11
  *
12
  */
readme.txt CHANGED
@@ -4,8 +4,8 @@ Donate link: http://wp-types.com
4
  Tags: CMS, custom field, custom fields, custom post type, custom post types, post, post type, post types, cck, taxonomy, fields
5
  License: GPLv2
6
  Requires at least: 3.4
7
- Tested up to: 4.0
8
- Stable tag: 1.6.3
9
 
10
  The complete and reliable plugin for managing custom post types, custom taxonomy and custom fields.
11
 
@@ -13,7 +13,7 @@ The complete and reliable plugin for managing custom post types, custom taxonomy
13
 
14
  Types let's you customize the WordPress admin by adding content types, custom fields and taxonomy. You will be able to craft the WordPress admin and turn it into your very own content management system.
15
 
16
- [vimeo http://vimeo.com/43104695]
17
 
18
  = POWERFUL PHP API, SIMPLE GUI FOR NON-CODERS =
19
  If you're an experienced PHP developer, you'll appreciate Types comprehensive [PHP API](http://wp-types.com/documentation/functions/) and [documentation](http://wp-types.com/documentation/user-guides/).
@@ -85,7 +85,7 @@ Types is the only custom fields and post types plugin that's built multilingual-
85
 
86
  = BUILT FOR STABILITY =
87
 
88
- Types is part of a family of plugins, including WPML and Toolset, developed and maintained by [OnTheGoSystems](http://www.onthegosystems.com). Our plugins power over 100,000 commercial sites, using WordPress as a complete CMS. While we love features, we know that stability, performance, usability and security are critical. All our plugins go through comprehensive testing, QA and security analysis before every release.
89
 
90
  == Installation ==
91
 
@@ -151,6 +151,28 @@ Additionally, Types is the only plugin that lets you define parent/child relatio
151
 
152
  == Changelog ==
153
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  = 1.6.3 =
155
 
156
  * Added the message to ask users to answer a short survey for feedback on their work using the Types plugin.
@@ -169,6 +191,7 @@ Additionally, Types is the only plugin that lets you define parent/child relatio
169
 
170
  * Fixed a problem where date picker scripts were being enqueued in the front end. https://wordpress.org/support/topic/datepicker-css-enqueued-on-public
171
 
 
172
  = 1.6.2 =
173
 
174
  * Fix addslashes warning
4
  Tags: CMS, custom field, custom fields, custom post type, custom post types, post, post type, post types, cck, taxonomy, fields
5
  License: GPLv2
6
  Requires at least: 3.4
7
+ Tested up to: 4.1
8
+ Stable tag: 1.6.4
9
 
10
  The complete and reliable plugin for managing custom post types, custom taxonomy and custom fields.
11
 
13
 
14
  Types let's you customize the WordPress admin by adding content types, custom fields and taxonomy. You will be able to craft the WordPress admin and turn it into your very own content management system.
15
 
16
+ [vimeo http://vimeo.com/112053938]
17
 
18
  = POWERFUL PHP API, SIMPLE GUI FOR NON-CODERS =
19
  If you're an experienced PHP developer, you'll appreciate Types comprehensive [PHP API](http://wp-types.com/documentation/functions/) and [documentation](http://wp-types.com/documentation/user-guides/).
85
 
86
  = BUILT FOR STABILITY =
87
 
88
+ Types is part of a family of plugins, including WPML and Toolset, developed and maintained by [OnTheGoSystems](http://www.onthegosystems.com). Our plugins power over 500,000 commercial sites, using WordPress as a complete CMS. While we love features, we know that stability, performance, usability and security are critical. All our plugins go through comprehensive testing, QA and security analysis before every release.
89
 
90
  == Installation ==
91
 
151
 
152
  == Changelog ==
153
 
154
+ = 1.6.4 =
155
+
156
+ * Fixed an issue with dependency between custom taxonomy and custom posts when importing data from the "Custom Post Type UI" plugin.
157
+ * Fixed an issue with editing checkboxes with the option "save 0 to the database" selected, created for Custom Posts. http://wp-types.com/forums/topic/checkbox-custom-field-doesnt-save-value-since-upgrade-to-version-1-6-2/ http://wp-types.com/forums/topic/types-checkbox-field-not-saving-after-save-0-to-the-database/
158
+ * Fixed an issue with PHP notices being thrown when relative URLs to images were used. http://wp-types.com/forums/topic/php-notice-undefined-index-host-in-image-php/
159
+ * Fixed the example file which adds the Google Map field to Types and allows users to enter coordinates to display a map on the front-end.
160
+ * Added the "wpcf_delete_relation_meta" filter which allows deletion of all post relationships when deleting a custom post type.
161
+ * Fixed an issue with the file name being changed when the file was uploaded. https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/189560556/comments http://wp-types.com/forums/topic/types-1-6-update-breaks-layout-that-worked-in-types-1-5-7/
162
+ * Fixed a problem with duplicate slugs on "Edit Group" screen. https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/187118123/comments http://wp-types.com/forums/topic/cant-add-more-custom-fields/
163
+ * Fixed a problem with default description not disappearing for non-English placeholders. https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/189787190/comments
164
+ * Fixed a problem with Custom Taxonomy metaboxes still appearing on the Custom Post editing page even after removing a Custom Taxonomy from a Custom Post Type.
165
+ * Fixed embedding OTGS CSS for the admin area. https://wordpress.org/support/topic/four-stylesheets-being-loaded-at-frontend
166
+ * Fixed a problem with Checkbox field value not being saved. https://wp-types.com/forums/topic/checkbox-value-not-saved/
167
+ * Added the option to select posts with the "Private" post status as parents in a parent-child Custom Post Types relationships. http://wp-types.com/forums/topic/cred-child-form-not-working-with-private-ctp/
168
+ * Fixed a problem with the date-picker. https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/191190651/comments
169
+ * Fixed a problem with label menu in wp-admin for child posts.
170
+ * Fixed a problem with child table when edit parent post and children do not have title.
171
+ * Prevent to chose repetitive field in child table on edit parent screen. http://wp-types.com/forums/topic/wp-types-select-child-fields-to-be-displayed-specific-fields-not-working/
172
+ * Added a dynamic "posted x minutes/hours ago" for Types fields. https://wp-types.com/forums/topic/adding-a-dynamic-posted-x-minuteshours-ago-in-a-view/
173
+ * Improved post relation table by using more precise labels. http://wp-types.com/forums/topic/displaying-the-best-names-of-cpts-in-applicable-contexts/
174
+ * Fixed a problem with display checkbox value from database if checkbox is empty.
175
+
176
  = 1.6.3 =
177
 
178
  * Added the message to ask users to answer a short survey for feedback on their work using the Types plugin.
191
 
192
  * Fixed a problem where date picker scripts were being enqueued in the front end. https://wordpress.org/support/topic/datepicker-css-enqueued-on-public
193
 
194
+
195
  = 1.6.2 =
196
 
197
  * Fix addslashes warning
resources/js/basic.js CHANGED
@@ -3,10 +3,10 @@
3
  * Use this file only for scripts needed in full version.
4
  * Before moving from embedded JS - make sure it's needed only here.
5
  *
6
- * $HeadURL: https://www.onthegosystems.com/misc_svn/cck/tags/1.6.3/resources/js/basic.js $
7
- * $LastChangedDate: 2014-07-04 12:19:40 +0200 (Fri, 04 Jul 2014) $
8
- * $LastChangedRevision: 24633 $
9
- * $LastChangedBy: marcin $
10
  *
11
  */
12
  jQuery(document).ready(function($){
3
  * Use this file only for scripts needed in full version.
4
  * Before moving from embedded JS - make sure it's needed only here.
5
  *
6
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/resources/js/basic.js $
7
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
8
+ * $LastChangedRevision: 1027712 $
9
+ * $LastChangedBy: iworks $
10
  *
11
  */
12
  jQuery(document).ready(function($){
resources/js/custom-types-form.js CHANGED
@@ -2,10 +2,10 @@
2
  *
3
  * Custom Types form JS
4
  *
5
- * $HeadURL: https://www.onthegosystems.com/misc_svn/cck/tags/1.6.3/resources/js/custom-types-form.js $
6
- * $LastChangedDate: 2014-05-13 12:49:25 +0200 (Tue, 13 May 2014) $
7
- * $LastChangedRevision: 22267 $
8
- * $LastChangedBy: marcin $
9
  *
10
  */
11
 
2
  *
3
  * Custom Types form JS
4
  *
5
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/resources/js/custom-types-form.js $
6
+ * $LastChangedDate: 2014-11-18 06:47:25 +0000 (Tue, 18 Nov 2014) $
7
+ * $LastChangedRevision: 1027712 $
8
+ * $LastChangedBy: iworks $
9
  *
10
  */
11
 
wpcf.php CHANGED
@@ -5,13 +5,13 @@
5
  Description: Define custom post types, custom taxonomy and custom fields.
6
  Author: OnTheGoSystems
7
  Author URI: http://www.onthegosystems.com
8
- Version: 1.6.3
9
  */
10
  /**
11
  *
12
- * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.3/wpcf.php $
13
- * $LastChangedDate: 2014-10-23 10:56:37 +0000 (Thu, 23 Oct 2014) $
14
- * $LastChangedRevision: 1012704 $
15
  * $LastChangedBy: iworks $
16
  *
17
  */
@@ -20,7 +20,7 @@ if ( !defined( 'WPCF_VERSION' ) ) {
20
  /**
21
  * make sure that WPCF_VERSION in embedded/bootstrap.php is the same!
22
  */
23
- define( 'WPCF_VERSION', '1.6.3' );
24
  }
25
 
26
  define( 'WPCF_REPOSITORY', 'http://api.wp-types.com/' );
@@ -32,6 +32,14 @@ define( 'WPCF_INC_RELPATH', WPCF_RELPATH . '/includes' );
32
  define( 'WPCF_RES_ABSPATH', WPCF_ABSPATH . '/resources' );
33
  define( 'WPCF_RES_RELPATH', WPCF_RELPATH . '/resources' );
34
 
 
 
 
 
 
 
 
 
35
  require_once WPCF_INC_ABSPATH . '/constants.php';
36
  /*
37
  * Since Types 1.2 we load all embedded code without conflicts
@@ -77,8 +85,19 @@ function wpcf_init()
77
  }
78
 
79
  if ( is_admin() ) {
 
80
  require_once WPCF_ABSPATH . '/admin.php';
81
  }
 
 
 
 
 
 
 
 
 
 
82
  }
83
 
84
  /**
@@ -87,8 +106,14 @@ function wpcf_init()
87
  function wpcf_wp_init()
88
  {
89
  if ( is_admin() ) {
90
- require_once WPCF_ABSPATH . '/admin.php';
91
- }
 
 
 
 
 
 
92
  }
93
 
94
  /**
5
  Description: Define custom post types, custom taxonomy and custom fields.
6
  Author: OnTheGoSystems
7
  Author URI: http://www.onthegosystems.com
8
+ Version: 1.6.4
9
  */
10
  /**
11
  *
12
+ * $HeadURL: http://plugins.svn.wordpress.org/types/tags/1.6.4/wpcf.php $
13
+ * $LastChangedDate: 2014-11-18 06:52:14 +0000 (Tue, 18 Nov 2014) $
14
+ * $LastChangedRevision: 1027716 $
15
  * $LastChangedBy: iworks $
16
  *
17
  */
20
  /**
21
  * make sure that WPCF_VERSION in embedded/bootstrap.php is the same!
22
  */
23
+ define( 'WPCF_VERSION', '1.6.4' );
24
  }
25
 
26
  define( 'WPCF_REPOSITORY', 'http://api.wp-types.com/' );
32
  define( 'WPCF_RES_ABSPATH', WPCF_ABSPATH . '/resources' );
33
  define( 'WPCF_RES_RELPATH', WPCF_RELPATH . '/resources' );
34
 
35
+ //Add installer
36
+ include dirname( __FILE__ ) . '/embedded/common/installer/loader.php';
37
+ WP_Installer_Setup($wp_installer_instance,
38
+ array(
39
+ 'plugins_install_tab' => '1',
40
+ 'repositories_include' => array('toolset', 'wpml')
41
+ ));
42
+
43
  require_once WPCF_INC_ABSPATH . '/constants.php';
44
  /*
45
  * Since Types 1.2 we load all embedded code without conflicts
85
  }
86
 
87
  if ( is_admin() ) {
88
+
89
  require_once WPCF_ABSPATH . '/admin.php';
90
  }
91
+
92
+
93
+ }
94
+
95
+ //Render Installer packages
96
+ function installer_content(){
97
+ echo '<div class="wrap">';
98
+ $config['repository'] = array(); // required
99
+ WP_Installer_Show_Products($config);
100
+ echo "</div>";
101
  }
102
 
103
  /**
106
  function wpcf_wp_init()
107
  {
108
  if ( is_admin() ) {
109
+
110
+ require_once WPCF_ABSPATH . '/admin.php';
111
+ add_action('admin_menu', 'setup_installer');
112
+ //Add submenu Installer to Types
113
+ function setup_installer(){
114
+ add_submenu_page('wpcf', 'Installer', 'Installer', 'manage_options', 'installer', 'installer_content');
115
+ }
116
+ }
117
  }
118
 
119
  /**