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

Version Description

  • Fixed a blank screen on the post editing page when using Types versions older than 2.3.4 on a site running Wordpress 5.0 (or using a Gutenberg plugin).
Download this release

Release Info

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

Code changes from version 2.2.24 to 2.3.5

Files changed (300) hide show
  1. application/autoload_classmap.php +1 -0
  2. application/bootstrap.php +1 -2
  3. application/controllers/admin.php +3 -0
  4. application/controllers/admin_notice/free-version.php +99 -0
  5. application/controllers/page/dashboard.php +2 -2
  6. application/views/admin-notices/free-version/types-3-0.phtml +95 -0
  7. application/views/admin-notices/free-version/types-3-1.phtml +18 -0
  8. public/css/information.css +0 -0
  9. public/images/ajax-loader-overlay.gif +0 -0
  10. public/img/toolset-logo-no-margin.png +0 -0
  11. public/js/feedback-on-deactivation.js +0 -0
  12. public/js/information.js +0 -0
  13. public/js/notice-dismiss.js +0 -0
  14. public/js/settings.js +0 -0
  15. public/js/slug_conflict_checker.js +0 -0
  16. public/page/add_term.js +0 -0
  17. public/page/adjust_submenu_links.js +0 -0
  18. public/page/edit_post_type/main.js +0 -0
  19. public/page/edit_taxonomy/main.js +0 -0
  20. public/page/field_control/main.js +0 -0
  21. public/page/field_control/style.css +0 -0
  22. public/page/field_control/viewmodels/BulkChangeManagementStatusDialogViewModel.js +0 -0
  23. public/page/field_control/viewmodels/ChangeAssignDialogViewModel.js +0 -0
  24. public/page/field_control/viewmodels/ChangeFieldTypeDialogViewModel.js +0 -0
  25. public/page/field_control/viewmodels/DeleteDialogViewModel.js +0 -0
  26. public/page/field_control/viewmodels/FieldDefinitionViewModel.js +0 -0
  27. public/page/field_control/viewmodels/ListingViewModel.js +0 -0
  28. readme.txt +83 -49
  29. vendor/autoload.php +1 -1
  30. vendor/composer/ClassLoader.php +2 -2
  31. vendor/composer/autoload_classmap.php +42 -22
  32. vendor/composer/autoload_real.php +7 -7
  33. vendor/composer/autoload_static.php +47 -27
  34. vendor/composer/installed.json +112 -116
  35. vendor/otgs/installer/changelog.txt +64 -0
  36. vendor/otgs/installer/dist/css/ui/styles.css +1 -0
  37. vendor/otgs/installer/dist/js/ui/app.js +1 -0
  38. vendor/otgs/installer/includes/class-otgs-installer-factory.php +147 -0
  39. vendor/otgs/installer/includes/class-otgs-installer-icons.php +7 -12
  40. vendor/otgs/installer/includes/class-otgs-installer-php-functions.php +4 -0
  41. vendor/otgs/installer/includes/class-otgs-installer-plugin-factory.php +13 -0
  42. vendor/otgs/installer/includes/class-otgs-installer-plugin-finder.php +58 -0
  43. vendor/otgs/installer/includes/class-otgs-installer-plugin.php +117 -0
  44. vendor/otgs/installer/includes/class-otgs-installer-plugins-page-notice.php +55 -51
  45. vendor/otgs/installer/includes/class-otgs-installer-subscription.php +81 -0
  46. vendor/otgs/installer/includes/class-otgs-installer-wp-components-hooks.php +37 -24
  47. vendor/otgs/installer/includes/class-otgs-installer-wp-components-sender.php +5 -3
  48. vendor/otgs/installer/includes/class-otgs-installer-wp-components-setting-ajax.php +10 -7
  49. vendor/otgs/installer/includes/class-otgs-installer-wp-components-setting-resources.php +12 -0
  50. vendor/otgs/installer/includes/class-otgs-installer-wp-components-setting-templates.php +0 -83
  51. vendor/otgs/installer/includes/class-otgs-installer-wp-components-storage.php +26 -10
  52. vendor/otgs/installer/includes/class-otgs-installer-wp-share-local-components-setting-hooks.php +177 -0
  53. vendor/otgs/installer/includes/class-otgs-installer-wp-share-local-components-setting.php +7 -0
  54. vendor/otgs/installer/includes/class-otgs-twig-autoloader.php +40 -0
  55. vendor/otgs/installer/includes/class-wp-installer-api.php +0 -2
  56. vendor/otgs/installer/includes/class-wp-installer.php +204 -59
  57. vendor/otgs/installer/includes/functions-core.php +10 -1
  58. vendor/otgs/installer/includes/functions-templates.php +10 -0
  59. vendor/otgs/installer/installer.php +57 -49
  60. vendor/otgs/installer/loader.php +107 -106
  61. vendor/otgs/installer/locale/installer-ar.mo +0 -0
  62. vendor/otgs/installer/locale/installer-de_DE.mo +0 -0
  63. vendor/otgs/installer/locale/installer-el.mo +0 -0
  64. vendor/otgs/installer/locale/installer-es_ES.mo +0 -0
  65. vendor/otgs/installer/locale/installer-fr_FR.mo +0 -0
  66. vendor/otgs/installer/locale/installer-he_IL.mo +0 -0
  67. vendor/otgs/installer/locale/installer-it_IT.mo +0 -0
  68. vendor/otgs/installer/locale/installer-ja.mo +0 -0
  69. vendor/otgs/installer/locale/installer-ko_KR.mo +0 -0
  70. vendor/otgs/installer/locale/installer-nl_NL.mo +0 -0
  71. vendor/otgs/installer/locale/installer-pl_PL.mo +0 -0
  72. vendor/otgs/installer/locale/installer-pt_BR.mo +0 -0
  73. vendor/otgs/installer/locale/installer-pt_PT.mo +0 -0
  74. vendor/otgs/installer/locale/installer-ru_RU.mo +0 -0
  75. vendor/otgs/installer/locale/installer-sv_SE.mo +0 -0
  76. vendor/otgs/installer/locale/installer-uk_UA.mo +0 -0
  77. vendor/otgs/installer/locale/installer-vi.mo +0 -0
  78. vendor/otgs/installer/locale/installer-zh_CN.mo +0 -0
  79. vendor/otgs/installer/locale/installer-zh_TW.mo +0 -0
  80. vendor/otgs/installer/repositories.xml +1 -1
  81. vendor/otgs/installer/res/css/admin.css +7 -0
  82. vendor/otgs/installer/res/js/save-components-setting.js +22 -14
  83. vendor/otgs/installer/src/js/ui/Switcher.js +44 -0
  84. vendor/otgs/installer/src/js/ui/UI.js +14 -0
  85. vendor/otgs/installer/src/js/ui/app.js +11 -0
  86. vendor/otgs/installer/src/package.json +55 -0
  87. vendor/otgs/installer/src/postcss.config.js +5 -0
  88. vendor/otgs/installer/src/scss/ui/styles.scss +141 -0
  89. vendor/otgs/installer/src/webpack.config.js +56 -0
  90. vendor/otgs/installer/templates/channel-selector.php +2 -2
  91. vendor/otgs/installer/templates/components-setting/commercial-tab.twig +1 -1
  92. vendor/otgs/installer/templates/components-setting/plugins-page.twig +9 -24
  93. vendor/otgs/installer/templates/components-setting/share-local-data-setting-radio.twig +66 -0
  94. vendor/otgs/installer/templates/components-setting/share-local-data-setting.twig +50 -0
  95. vendor/otgs/installer/templates/downloads-list.php +1 -1
  96. vendor/otgs/installer/templates/repository-listing.php +73 -45
  97. vendor/otgs/installer/templates/template-service/class-otgs-installer-twig-template-service-loader.php +4 -0
  98. vendor/toolset/toolset-common/autoload_classmap.php +20 -1
  99. vendor/toolset/toolset-common/bootstrap.php +22 -0
  100. vendor/toolset/toolset-common/changelog.md +60 -1
  101. vendor/toolset/toolset-common/classes/validation-cakephp.php +45 -16
  102. vendor/toolset/toolset-common/inc/autoloaded/admin.php +6 -0
  103. vendor/toolset/toolset-common/inc/autoloaded/admin/notices.php +1 -91
  104. vendor/toolset/toolset-common/inc/autoloaded/ajax_handler/migrate_to_m2m.php +64 -7
  105. vendor/toolset/toolset-common/inc/autoloaded/ajax_handler/select2_suggest_posts_by_post_type.php +117 -0
  106. vendor/toolset/toolset-common/inc/autoloaded/ajax_handler/select2_suggest_posts_by_title.php +67 -36
  107. vendor/toolset/toolset-common/inc/autoloaded/element/domain.php +1 -1
  108. vendor/toolset/toolset-common/inc/autoloaded/element/element.php +0 -12
  109. vendor/toolset/toolset-common/inc/autoloaded/element/element_factory.php +1 -0
  110. vendor/toolset/toolset-common/inc/autoloaded/element/i_post.php +0 -7
  111. vendor/toolset/toolset-common/inc/autoloaded/element/post.php +1 -1
  112. vendor/toolset/toolset-common/inc/autoloaded/element/post_translation_set.php +5 -1
  113. vendor/toolset/toolset-common/inc/autoloaded/field/definition_abstract.php +0 -36
  114. vendor/toolset/toolset-common/inc/autoloaded/field/definition_factory.php +0 -6
  115. vendor/toolset/toolset-common/inc/autoloaded/field/definition_factory_interface.php +1 -0
  116. vendor/toolset/toolset-common/inc/autoloaded/field/group.php +13 -0
  117. vendor/toolset/toolset-common/inc/autoloaded/field/group/post.php +1 -2
  118. vendor/toolset/toolset-common/inc/autoloaded/field/group/post_factory.php +1 -0
  119. vendor/toolset/toolset-common/inc/autoloaded/field/renderer/preview/post.php +32 -0
  120. vendor/toolset/toolset-common/inc/autoloaded/field/renderer/toolset_forms_repeatable_group.php +112 -16
  121. vendor/toolset/toolset-common/inc/autoloaded/field/type/definition.php +20 -17
  122. vendor/toolset/toolset-common/inc/autoloaded/field/type/definition_factory.php +5 -4
  123. vendor/toolset/toolset-common/inc/autoloaded/i_query.php +0 -16
  124. vendor/toolset/toolset-common/inc/autoloaded/interop/handler/installer_compatibility_reporting.php +315 -0
  125. vendor/toolset/toolset-common/inc/autoloaded/interop/handler_interface.php +15 -0
  126. vendor/toolset/toolset-common/inc/autoloaded/interop/mediator.php +24 -0
  127. vendor/toolset/toolset-common/inc/autoloaded/maintenance_mode/controller.php +112 -0
  128. vendor/toolset/toolset-common/inc/autoloaded/post_type/abstract.php +13 -6
  129. vendor/toolset/toolset-common/inc/autoloaded/post_type/excluded_list.php +11 -10
  130. vendor/toolset/toolset-common/inc/autoloaded/post_type/from_types.php +14 -1
  131. vendor/toolset/toolset-common/inc/autoloaded/post_type/i_post_type.php +2 -2
  132. vendor/toolset/toolset-common/inc/autoloaded/post_type/i_post_type_from_types.php +14 -0
  133. vendor/toolset/toolset-common/inc/autoloaded/post_type/list.php +25 -0
  134. vendor/toolset/toolset-common/inc/autoloaded/post_type/repository.php +43 -1
  135. vendor/toolset/toolset-common/inc/autoloaded/postmeta_access/loader.php +23 -0
  136. vendor/toolset/toolset-common/inc/autoloaded/postmeta_access/m2m.php +348 -0
  137. vendor/toolset/toolset-common/inc/autoloaded/relationship_service.php +192 -71
  138. vendor/toolset/toolset-common/inc/autoloaded/renderer/output_template_repository.php +26 -6
  139. vendor/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/gui/base.php +160 -0
  140. vendor/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/gui/factory.php +106 -0
  141. vendor/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/gui/m2m.php +474 -0
  142. vendor/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/gui/o2m.php +96 -0
  143. vendor/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/gui/o2o.php +83 -0
  144. vendor/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/gui/option.php +186 -0
  145. vendor/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/legacy.php +33 -0
  146. vendor/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/m2m.php +148 -5
  147. vendor/toolset/toolset-common/inc/autoloaded/upgrade/command/delete_obsolete_version_number_option.php +26 -0
  148. vendor/toolset/toolset-common/inc/autoloaded/upgrade/command/m2m_v1_database_structure_upgrade.php +97 -26
  149. vendor/toolset/toolset-common/inc/autoloaded/upgrade/command/m2m_v2_database_structure_upgrade.php +118 -0
  150. vendor/toolset/toolset-common/inc/autoloaded/upgrade/command_definition.php +1 -1
  151. vendor/toolset/toolset-common/inc/autoloaded/upgrade/command_definition_repository.php +22 -4
  152. vendor/toolset/toolset-common/inc/autoloaded/upgrade/command_interface.php +2 -0
  153. vendor/toolset/toolset-common/inc/autoloaded/upgrade/controller.php +65 -18
  154. vendor/toolset/toolset-common/inc/autoloaded/upgrade/executed_commands.php +6 -0
  155. vendor/toolset/toolset-common/inc/autoloaded/wp_query_adjustments/abstract.php +7 -1
  156. vendor/toolset/toolset-common/inc/autoloaded/wp_query_adjustments/m2m.php +316 -10
  157. vendor/toolset/toolset-common/inc/autoloaded/wp_query_adjustments/table_join_manager.php +97 -29
  158. vendor/toolset/toolset-common/inc/m2m/association/Repository.php +193 -0
  159. vendor/toolset/toolset-common/inc/m2m/association/association.php +18 -48
  160. vendor/toolset/toolset-common/inc/m2m/association/cleanup/cron_handler.php +0 -3
  161. vendor/toolset/toolset-common/inc/m2m/association/cleanup/post.php +10 -1
  162. vendor/toolset/toolset-common/inc/m2m/association/cleanup/post_type.php +75 -0
  163. vendor/toolset/toolset-common/inc/m2m/association/intermediary_post_persistence.php +27 -0
  164. vendor/toolset/toolset-common/inc/m2m/association/persistence.php +62 -0
  165. vendor/toolset/toolset-common/inc/m2m/association/query/association_query.php +7 -0
  166. vendor/toolset/toolset-common/inc/m2m/association/query/association_query_v2.php +152 -5
  167. vendor/toolset/toolset-common/inc/m2m/association/query/condition/exclude_relationship.php +21 -0
  168. vendor/toolset/toolset-common/inc/m2m/association/query/condition/has_intermediary_id.php +20 -0
  169. vendor/toolset/toolset-common/inc/m2m/association/query/condition/intermediary_id.php +41 -0
  170. vendor/toolset/toolset-common/inc/m2m/association/query/condition/relationship_id.php +12 -2
  171. vendor/toolset/toolset-common/inc/m2m/association/query/condition/relationship_origin.php +45 -0
  172. vendor/toolset/toolset-common/inc/m2m/association/query/condition_factory.php +46 -2
  173. vendor/toolset/toolset-common/inc/m2m/association/query/element_selector/abstract.php +51 -0
  174. vendor/toolset/toolset-common/inc/m2m/association/query/element_selector/default.php +1 -1
  175. vendor/toolset/toolset-common/inc/m2m/association/query/element_selector/interface.php +27 -0
  176. vendor/toolset/toolset-common/inc/m2m/association/query/element_selector/provider.php +50 -2
  177. vendor/toolset/toolset-common/inc/m2m/association/query/element_selector/wpml.php +16 -3
  178. vendor/toolset/toolset-common/inc/m2m/association/query/element_selector/wpml_lang_all.php +59 -0
  179. vendor/toolset/toolset-common/inc/m2m/association/query/result_transformation/association_instance.php +4 -0
  180. vendor/toolset/toolset-common/inc/m2m/association/query/result_transformation/association_uid.php +2 -2
  181. vendor/toolset/toolset-common/inc/m2m/association/query/result_transformation/element_id.php +3 -1
  182. vendor/toolset/toolset-common/inc/m2m/association/query/result_transformation/element_instance.php +3 -1
  183. vendor/toolset/toolset-common/inc/m2m/association/query/sql_expression_builder.php +4 -5
  184. vendor/toolset/toolset-common/inc/m2m/autoload_classmap.php +19 -0
  185. vendor/toolset/toolset-common/inc/m2m/cardinality.php +22 -4
  186. vendor/toolset/toolset-common/inc/m2m/controller.php +1 -1
  187. vendor/toolset/toolset-common/inc/m2m/database/operations.php +12 -3
  188. vendor/toolset/toolset-common/inc/m2m/migration/associations.php +29 -17
  189. vendor/toolset/toolset-common/inc/m2m/migration/controller.php +101 -20
  190. vendor/toolset/toolset-common/inc/m2m/potential_association/cardinality_post_query.php +126 -0
  191. vendor/toolset/toolset-common/inc/m2m/potential_association/distinct_post_query.php +6 -133
  192. vendor/toolset/toolset-common/inc/m2m/potential_association/filters/interface.php +17 -0
  193. vendor/toolset/toolset-common/inc/m2m/potential_association/filters/post/author.php +85 -0
  194. vendor/toolset/toolset-common/inc/m2m/potential_association/filters/search_string.php +28 -0
  195. vendor/toolset/toolset-common/inc/m2m/potential_association/join_manager.php +242 -0
  196. vendor/toolset/toolset-common/inc/m2m/potential_association/query_arguments.php +45 -0
  197. vendor/toolset/toolset-common/inc/m2m/potential_association/query_interface.php +6 -2
  198. vendor/toolset/toolset-common/inc/m2m/potential_association/query_posts.php +89 -17
  199. vendor/toolset/toolset-common/inc/m2m/potential_association/wp_query_adjustment.php +120 -0
  200. vendor/toolset/toolset-common/inc/m2m/public_api_service.php +84 -0
  201. vendor/toolset/toolset-common/inc/m2m/query/condition/not.php +48 -0
  202. vendor/toolset/toolset-common/inc/m2m/query/factory.php +41 -1
  203. vendor/toolset/toolset-common/inc/m2m/relationship/definition/definition.php +213 -13
  204. vendor/toolset/toolset-common/inc/m2m/relationship/definition/persistence.php +9 -6
  205. vendor/toolset/toolset-common/inc/m2m/relationship/definition/translator.php +19 -3
  206. vendor/toolset/toolset-common/inc/m2m/relationship/query/condition/exclude_relationship.php +38 -0
  207. vendor/toolset/toolset-common/inc/m2m/relationship/query/condition/exclude_type.php +25 -0
  208. vendor/toolset/toolset-common/inc/m2m/relationship/query/condition/has_active_types.php +2 -1
  209. vendor/toolset/toolset-common/inc/m2m/relationship/query/condition/intermediary_type.php +44 -0
  210. vendor/toolset/toolset-common/inc/m2m/relationship/query/condition/origin.php +6 -2
  211. vendor/toolset/toolset-common/inc/m2m/relationship/query/condition/type.php +3 -3
  212. vendor/toolset/toolset-common/inc/m2m/relationship/query/condition_factory.php +44 -1
  213. vendor/toolset/toolset-common/inc/m2m/relationship/query/relationship_query_v2.php +56 -3
  214. vendor/toolset/toolset-common/inc/m2m/relationship/role/role.php +1 -2
  215. vendor/toolset/toolset-common/inc/public_api/legacy_relationships.php +196 -0
  216. vendor/toolset/toolset-common/inc/public_api/m2m.php +471 -2
  217. vendor/toolset/toolset-common/inc/toolset.ajax.class.php +4 -1
  218. vendor/toolset/toolset-common/inc/toolset.assets.manager.class.php +83 -12
  219. vendor/toolset/toolset-common/inc/toolset.css.component.class.php +1 -1
  220. vendor/toolset/toolset-common/inc/toolset.internal.compatibility.class.php +0 -2
  221. vendor/toolset/toolset-common/inc/toolset.menu.class.php +2 -2
  222. vendor/toolset/toolset-common/inc/toolset.object.relationship.class.php +5 -0
  223. vendor/toolset/toolset-common/inc/toolset.promotion.class.php +2 -2
  224. vendor/toolset/toolset-common/inc/toolset.relevanssi.compatibility.class.php +1 -1
  225. vendor/toolset/toolset-common/inc/toolset.settings.screen.class.php +1 -1
  226. vendor/toolset/toolset-common/inc/toolset.shortcode.generator.class.php +213 -222
  227. vendor/toolset/toolset-common/inc/toolset.wpml.compatibility.class.php +58 -3
  228. vendor/toolset/toolset-common/lib/Twig/Compiler.php +1 -9
  229. vendor/toolset/toolset-common/lib/Twig/Lexer.php +1 -6
  230. vendor/toolset/toolset-common/lib/cakephp.validation.class.php +44 -15
  231. vendor/toolset/toolset-common/loader.php +7 -2
  232. vendor/toolset/toolset-common/res/css/toolset-admin-notices.css +23 -0
  233. vendor/toolset/toolset-common/res/css/toolset-common.css +5 -1
  234. vendor/toolset/toolset-common/res/css/toolset-notifications.css +173 -101
  235. vendor/toolset/toolset-common/res/js/toolset-admin-notices.js +20 -3
  236. vendor/toolset/toolset-common/res/js/toolset-bs-component-buttons.js +4 -0
  237. vendor/toolset/toolset-common/res/js/toolset-chosen-wrapper.js +62 -0
  238. vendor/toolset/toolset-common/res/js/toolset-select2-compatibility.js +5 -0
  239. vendor/toolset/toolset-common/res/js/toolset-shortcode.js +79 -9
  240. vendor/toolset/toolset-common/templates/admin/notice/commercial-plugin-installed/types-views-or-layouts-missing.phtml +0 -25
  241. vendor/toolset/toolset-common/templates/admin/notice/installer/compatibility-reporting-setting-needed.phtml +49 -0
  242. vendor/toolset/toolset-common/templates/admin/notice/only-types-installed/layouts-support-missing.phtml +0 -19
  243. vendor/toolset/toolset-common/templates/admin/notice/toolset-based-themes/active/dashboard.phtml +2 -2
  244. vendor/toolset/toolset-common/templates/admin/notice/toolset-based-themes/active/plugin.phtml +2 -2
  245. vendor/toolset/toolset-common/templates/admin/notice/toolset-based-themes/inactive/dashboard.phtml +2 -2
  246. vendor/toolset/toolset-common/templates/admin/notice/toolset-based-themes/inactive/plugin.phtml +2 -2
  247. vendor/toolset/toolset-common/templates/admin/notice/toolset-robot.phtml +14 -0
  248. vendor/toolset/toolset-common/templates/admin/notice/types-free-version-ends.phtml +0 -61
  249. vendor/toolset/toolset-common/templates/admin/notice/types-move-to-toolset.phtml +0 -18
  250. vendor/toolset/toolset-common/templates/maintenance.twig +31 -0
  251. vendor/toolset/toolset-common/toolset-common-loader.php +12 -2
  252. vendor/toolset/toolset-common/toolset-forms/autoload_classmap.php +1 -0
  253. vendor/toolset/toolset-common/toolset-forms/classes/class.conditional.php +37 -11
  254. vendor/toolset/toolset-common/toolset-forms/classes/class.conditional.rfg.php +50 -0
  255. vendor/toolset/toolset-common/toolset-forms/classes/class.eforms.php +7 -9
  256. vendor/toolset/toolset-common/toolset-forms/classes/class.file.php +5 -1
  257. vendor/toolset/toolset-common/toolset-forms/classes/class.repetitive.php +8 -3
  258. vendor/toolset/toolset-common/toolset-forms/classes/class.validation.php +0 -1
  259. vendor/toolset/toolset-common/toolset-forms/classes/class.wysiwyg.php +9 -1
  260. vendor/toolset/toolset-common/toolset-forms/js/conditional.js +23 -2
  261. vendor/toolset/toolset-common/toolset-forms/js/recaptcha-php-1.11/recaptchalib.php +35 -16
  262. vendor/toolset/toolset-common/toolset-forms/js/validation.js +9 -1
  263. vendor/toolset/toolset-common/toolset-forms/lib/CakePHP-Validation.php +44 -15
  264. vendor/toolset/toolset-common/toolset-forms/lib/js/jquery-form-validation/jquery.validate.js +4 -0
  265. vendor/toolset/toolset-common/toolset-forms/plugin.php +2 -2
  266. vendor/toolset/toolset-common/toolset-forms/readme.txt +0 -29
  267. vendor/toolset/toolset-common/user-editors/editor/divi.php +23 -0
  268. vendor/toolset/toolset-common/user-editors/editor/screen/visual-composer/frontend.php +5 -0
  269. vendor/toolset/toolset-common/user-editors/editor/templates/inline-ct-overlay.tpl.php +5 -1
  270. vendor/toolset/toolset-common/user-editors/editor/templates/inline-ct-saving-overlay.tpl.php +5 -1
  271. vendor/toolset/toolset-common/utility/admin/notice/abstract.php +101 -6
  272. vendor/toolset/toolset-common/utility/admin/notice/interface.php +47 -0
  273. vendor/toolset/toolset-common/utility/admin/notices/Builder.php +114 -0
  274. vendor/toolset/toolset-common/utility/admin/notices/manager.php +138 -19
  275. vendor/toolset/toolset-common/utility/condition/plugin/installer/is_available.php +42 -0
  276. vendor/toolset/toolset-common/utility/condition/plugin/installer/is_toolset_subscription_valid.php +43 -0
  277. vendor/toolset/toolset-common/utility/condition/plugin/wpml/doesnt_support_m2m.php +1 -5
  278. vendor/toolset/toolset-common/utility/condition/theme/layouts-support/plugin/available.php +8 -8
  279. vendor/toolset/toolset-common/utility/dialogs/toolset.dialog-boxes.class.php +1 -1
  280. vendor/toolset/toolset-common/utility/gui-base/js/ItemViewModel.js +10 -10
  281. vendor/toolset/toolset-common/utility/gui-base/js/ListingViewModel.js +15 -0
  282. vendor/toolset/toolset-common/utility/gui-base/twig-templates/listing.twig +4 -4
  283. vendor/toolset/toolset-common/utility/js/utils.js +1 -1
  284. vendor/toolset/toolset-common/utility/singleton_factory.php +81 -0
  285. vendor/toolset/toolset-common/utility/singleton_factory_pre_php_5_6.php +90 -0
  286. vendor/toolset/toolset-common/utility/utils.php +84 -0
  287. vendor/toolset/types/embedded/admin.php +6 -2
  288. vendor/toolset/types/embedded/bootstrap.php +3 -1
  289. vendor/toolset/types/embedded/classes/class.wpcf-post-types.php +10 -7
  290. vendor/toolset/types/embedded/classes/field.php +2 -0
  291. vendor/toolset/types/embedded/classes/relationship.php +10 -2
  292. vendor/toolset/types/embedded/includes/ajax.php +2 -0
  293. vendor/toolset/types/embedded/includes/custom-taxonomies.php +7 -0
  294. vendor/toolset/types/embedded/includes/fields-post.php +17 -9
  295. vendor/toolset/types/embedded/includes/fields/checkbox.php +41 -6
  296. vendor/toolset/types/embedded/includes/post-relationship.php +1 -0
  297. vendor/toolset/types/embedded/includes/wpml.php +10 -8
  298. vendor/toolset/types/includes/classes/class.types.admin.edit.custom.fields.group.php +4 -5
  299. vendor/toolset/types/includes/classes/class.types.admin.edit.taxonomy.php +24 -7
  300. wpcf.php +3 -3
application/autoload_classmap.php CHANGED
@@ -134,6 +134,7 @@ return array(
134
  'Types_Twig_Autoloader' => dirname( __FILE__ ) . '/controllers/twig_autoloader.php',
135
  'Types_Upgrade' => dirname( __FILE__ ) . '/controllers/upgrade.php',
136
  'Types_Utils' => dirname( __FILE__ ) . '/controllers/admin_notice/utils.php',
 
137
  'Types_Utils_Post_Type_Option' => dirname( __FILE__ ) . '/controllers/utils/post_type_option.php',
138
  'Types_Wpml_Field_Group' => dirname( __FILE__ ) . '/models/wpml/field_group.php',
139
  'Types_Wpml_Field_Group_String_Description' => dirname( __FILE__ ) . '/models/wpml/field/group/string/description.php',
134
  'Types_Twig_Autoloader' => dirname( __FILE__ ) . '/controllers/twig_autoloader.php',
135
  'Types_Upgrade' => dirname( __FILE__ ) . '/controllers/upgrade.php',
136
  'Types_Utils' => dirname( __FILE__ ) . '/controllers/admin_notice/utils.php',
137
+ 'Types_Admin_Notices_Free_Version' => dirname( __FILE__ ) . '/controllers/admin_notice/free-version.php',
138
  'Types_Utils_Post_Type_Option' => dirname( __FILE__ ) . '/controllers/utils/post_type_option.php',
139
  'Types_Wpml_Field_Group' => dirname( __FILE__ ) . '/models/wpml/field_group.php',
140
  'Types_Wpml_Field_Group_String_Description' => dirname( __FILE__ ) . '/models/wpml/field/group/string/description.php',
application/bootstrap.php CHANGED
@@ -43,8 +43,7 @@ if ( file_exists( $installer ) ) {
43
  $wp_installer_instance,
44
  array(
45
  'plugins_install_tab' => '1',
46
- 'repositories_include' => array('toolset', 'wpml'),
47
- 'high_priority' => '0',
48
  )
49
  );
50
  }
43
  $wp_installer_instance,
44
  array(
45
  'plugins_install_tab' => '1',
46
+ 'repositories_include' => array('toolset', 'wpml')
 
47
  )
48
  );
49
  }
application/controllers/admin.php CHANGED
@@ -41,6 +41,9 @@ final class Types_Admin {
41
  }
42
 
43
  $this->init_page_extensions();
 
 
 
44
  }
45
 
46
 
41
  }
42
 
43
  $this->init_page_extensions();
44
+
45
+ // admin notices
46
+ Toolset_Singleton_Factory::get( 'Types_Admin_Notices_Free_Version' );
47
  }
48
 
49
 
application/controllers/admin_notice/free-version.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class Types_Admin_Notices_Free_Version
5
+ *
6
+ * Controls all admin notices which are only relevant for the free version of Types
7
+ *
8
+ * @since 2.3
9
+ */
10
+ class Types_Admin_Notices_Free_Version extends Toolset_Controller_Admin_Notices {
11
+
12
+ const NOTICE_TYPES_3_0 = 'types-3-0-features';
13
+ const NOTICE_TYPES_3_1 = 'types-3-1-features';
14
+
15
+ /**
16
+ * Types_Admin_Notices_Free_Version constructor.
17
+ * (same as parent, but as we use $this to call the action it's important to overwrite it)
18
+ *
19
+ * @param Toolset_Constants|null $constants
20
+ */
21
+ public function __construct( Toolset_Constants $constants = null ) {
22
+ if ( null === $constants ) {
23
+ $constants = new Toolset_Constants();
24
+ }
25
+ $this->constants = $constants;
26
+
27
+ add_action( 'init', array( $this, 'init' ), 1000 );
28
+ }
29
+
30
+ /**
31
+ * Init notices by screen
32
+ */
33
+ public function init_screens() {
34
+ if( ! function_exists( 'get_current_screen' ) ) {
35
+ // loaded to early
36
+ return;
37
+ }
38
+
39
+ $this->current_screen = get_current_screen();
40
+
41
+ $this->screen_wordpress_dashboard();
42
+ }
43
+
44
+ /**
45
+ * Notices for the Wordpress Dashboard Page
46
+ */
47
+ protected function screen_wordpress_dashboard() {
48
+ if( $this->get_current_screen_id() != 'dashboard' ) {
49
+ return;
50
+ }
51
+
52
+ $this->new_features_of_paid_types();
53
+ }
54
+
55
+ /**
56
+ * New feature of paid types
57
+ * Will only show notices if only types is active
58
+ */
59
+ private function new_features_of_paid_types() {
60
+ if( ! $this->only_types_active() ) {
61
+ // not only types active
62
+ return;
63
+ }
64
+
65
+ // new features of paid types (here should only be the newest version,
66
+ // otherwise new clients or old on new installations see all release notices)
67
+ $this->notice_types_release_3_0();
68
+ }
69
+
70
+ /**
71
+ * Notice about Types 3.0 features
72
+ *
73
+ * @return bool|Toolset_Admin_Notice_Dismissible
74
+ */
75
+ private function notice_types_release_3_0() {
76
+ $notice = new Toolset_Admin_Notice_Dismissible( self::NOTICE_TYPES_3_0, '', $this->constants );
77
+ $notice->set_similar_notices_key( Toolset_Admin_Notices_Manager::SIMILAR_NOTICES_FREE_PLUGIN_SHOWS_PAID_FEATURES );
78
+ $notice->set_content( TYPES_ABSPATH . '/application/views/admin-notices/free-version/types-3-0.phtml' );
79
+ Toolset_Admin_Notices_Manager::add_notice( $notice );
80
+
81
+ return $notice;
82
+ }
83
+
84
+ /**
85
+ * Notice about Types 3.1 features
86
+ *
87
+ * NOT USED YET - ADDED FOR TESTING AND KEPT IT FOR NEXT RELEASE
88
+ *
89
+ * @return bool|Toolset_Admin_Notice_Dismissible
90
+ */
91
+ private function notice_types_release_3_1() {
92
+ $notice = new Toolset_Admin_Notice_Dismissible( self::NOTICE_TYPES_3_1, '', $this->constants );
93
+ $notice->set_similar_notices_key( Toolset_Admin_Notices_Manager::SIMILAR_NOTICES_FREE_PLUGIN_SHOWS_PAID_FEATURES );
94
+ $notice->set_content( TYPES_ABSPATH . '/application/views/admin-notices/free-version/types-3-1.phtml' );
95
+ Toolset_Admin_Notices_Manager::add_notice( $notice );
96
+
97
+ return $notice;
98
+ }
99
+ }
application/controllers/page/dashboard.php CHANGED
@@ -414,7 +414,7 @@ final class Types_Page_Dashboard extends Types_Page_Abstract {
414
  return $string;
415
  }
416
 
417
- public function screen_settings_save($status, $option, $value) {
418
  if ( 'toolset_dashboard_screen_post_types' == $option ) {
419
  if ( is_array( $_POST['toolset_dashboard_screen_post_types'] ) ) {
420
  $toolset_dashboard_screen_post_types = array();
@@ -429,7 +429,7 @@ final class Types_Page_Dashboard extends Types_Page_Abstract {
429
  $value = $toolset_dashboard_screen_post_types;
430
  return $value;
431
  }
432
- return $status;
433
  }
434
 
435
 
414
  return $string;
415
  }
416
 
417
+ public function screen_settings_save($pre_save_value, $option, $value) {
418
  if ( 'toolset_dashboard_screen_post_types' == $option ) {
419
  if ( is_array( $_POST['toolset_dashboard_screen_post_types'] ) ) {
420
  $toolset_dashboard_screen_post_types = array();
429
  $value = $toolset_dashboard_screen_post_types;
430
  return $value;
431
  }
432
+ return $pre_save_value;
433
  }
434
 
435
 
application/views/admin-notices/free-version/types-3-0.phtml ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="toolset-notice-wp-no-external-link-highlighting">
2
+ <h3>
3
+ <?php _e( 'A major new release of Types is available', 'wpcf' ); ?>
4
+ </h3>
5
+
6
+ <p class="toolset-list-title">
7
+ <?php _e( 'Types 3.0, released on 28th May 2018, includes major new features that will help you build advanced sites faster and easier.' , 'wpcf' ); ?>
8
+ </p>
9
+
10
+
11
+ <ul class="toolset-list">
12
+ <li>
13
+ <?php
14
+ echo Toolset_Admin_Notices_Manager::tpl_link(
15
+ __( 'Repeatable field groups', 'wpcf' ),
16
+ 'https://toolset.com/documentation/getting-started-with-toolset/creating-and-displaying-repeatable-field-groups/' .
17
+ '?utm_source=typesplugin' .
18
+ '&utm_campaign=moving-types-to-toolset' .
19
+ '&utm_medium=message-about-types-3-0' .
20
+ '&utm_term=repeatable-field-groups',
21
+ true
22
+ );
23
+ ?>
24
+ </li>
25
+ <li>
26
+ <?php
27
+ echo Toolset_Admin_Notices_Manager::tpl_link(
28
+ __( 'Post reference fields', 'wpcf' ),
29
+ 'https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/using-post-reference-fields-to-display-information-from-a-related-post/' .
30
+ '?utm_source=typesplugin' .
31
+ '&utm_campaign=moving-types-to-toolset' .
32
+ '&utm_medium=message-about-types-3-0' .
33
+ '&utm_term=post-reference-fields',
34
+ true
35
+ );
36
+ ?>
37
+ </li>
38
+ <li>
39
+ <?php
40
+ echo Toolset_Admin_Notices_Manager::tpl_link(
41
+ __( 'Many-to-many relationships', 'wpcf' ),
42
+ 'https://toolset.com/documentation/post-relationships/' .
43
+ '?utm_source=typesplugin' .
44
+ '&utm_campaign=moving-types-to-toolset' .
45
+ '&utm_medium=message-about-types-3-0' .
46
+ '&utm_term=many-to-many-relationships',
47
+ true
48
+ );
49
+ ?>
50
+ </li>
51
+ </ul>
52
+
53
+
54
+ <p>
55
+ <?php _e( 'This release is part of the paid Toolset package. It costs some money, but worth every penny (if you’re not 100% happy, you get your money back).', 'wpcf' ); ?>
56
+ </p>
57
+
58
+ <p>
59
+ <?php
60
+ echo Toolset_Admin_Notices_Manager::tpl_link(
61
+ __( 'Learn what’s new', 'wpcf' ),
62
+ 'https://toolset.com/2018/05/toolset-post-relationships-release/' .
63
+ '?utm_source=typesplugin' .
64
+ '&utm_campaign=moving-types-to-toolset' .
65
+ '&utm_medium=message-about-types-3-0' .
66
+ '&utm_term=learn-whats-new',
67
+ true
68
+ );
69
+ ?>
70
+
71
+ &nbsp;
72
+
73
+ <?php
74
+ echo Toolset_Admin_Notices_Manager::tpl_link(
75
+ __( 'Pricing', 'wpcf' ),
76
+ 'https://toolset.com/buy/' .
77
+ '?utm_source=typesplugin' .
78
+ '&utm_campaign=moving-types-to-toolset' .
79
+ '&utm_medium=message-about-types-3-0' .
80
+ '&utm_term=pricing',
81
+ true
82
+ );
83
+ ?>
84
+ </p>
85
+
86
+ <p>
87
+ <input type="checkbox" id="free-plugin-offers" name="dismiss-similar-notices[]" value="<?php echo Toolset_Admin_Notices_Manager::SIMILAR_NOTICES_FREE_PLUGIN_SHOWS_PAID_FEATURES; ?>" />
88
+ <label for="free-plugin-offers"><?php _e( 'Don’t show similar offers again', 'wpcf' ); ?></label>
89
+ </p>
90
+
91
+ <p>
92
+ <span data-toolset-dismissible="<?php echo Types_Admin_Notices_Free_Version::NOTICE_TYPES_3_0; ?>"
93
+ class="toolset-button toolset-button-primary"><?php _e( 'Got it', 'wpcf' ); ?></span>
94
+ </p>
95
+ </div>
application/views/admin-notices/free-version/types-3-1.phtml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php /* not used for production yet */ ?>
2
+ <h3>
3
+ <?php _e( 'A major new release of Types is available', 'wpcf' ); ?>
4
+ </h3>
5
+
6
+ <p class="toolset-list-title">
7
+ <?php _e( 'Types 3.1, released on ...' , 'wpcf' ); ?>
8
+ </p>
9
+
10
+ <p>
11
+ <input type="checkbox" id="free-plugin-offers" name="dismiss-similar-notices[]" value="<?php echo Toolset_Admin_Notices_Manager::SIMILAR_NOTICES_FREE_PLUGIN_SHOWS_PAID_FEATURES; ?>" />
12
+ <label for="free-plugin-offers"><?php _e( 'Don’t show similar offers again', 'wpcf' ); ?></label>
13
+ </p>
14
+
15
+ <p>
16
+ <span data-toolset-dismissible="<?php echo Types_Admin_Notices_Free_Version::NOTICE_TYPES_3_1; ?>"
17
+ class="toolset-button toolset-button-primary"><?php _e( 'Got it', 'wpcf' ); ?></span>
18
+ </p>
public/css/information.css CHANGED
File without changes
public/images/ajax-loader-overlay.gif CHANGED
File without changes
public/img/toolset-logo-no-margin.png CHANGED
File without changes
public/js/feedback-on-deactivation.js CHANGED
File without changes
public/js/information.js CHANGED
File without changes
public/js/notice-dismiss.js CHANGED
File without changes
public/js/settings.js CHANGED
File without changes
public/js/slug_conflict_checker.js CHANGED
File without changes
public/page/add_term.js CHANGED
File without changes
public/page/adjust_submenu_links.js CHANGED
File without changes
public/page/edit_post_type/main.js CHANGED
File without changes
public/page/edit_taxonomy/main.js CHANGED
File without changes
public/page/field_control/main.js CHANGED
File without changes
public/page/field_control/style.css CHANGED
File without changes
public/page/field_control/viewmodels/BulkChangeManagementStatusDialogViewModel.js CHANGED
File without changes
public/page/field_control/viewmodels/ChangeAssignDialogViewModel.js CHANGED
File without changes
public/page/field_control/viewmodels/ChangeFieldTypeDialogViewModel.js CHANGED
File without changes
public/page/field_control/viewmodels/DeleteDialogViewModel.js CHANGED
File without changes
public/page/field_control/viewmodels/FieldDefinitionViewModel.js CHANGED
File without changes
public/page/field_control/viewmodels/ListingViewModel.js CHANGED
File without changes
readme.txt CHANGED
@@ -1,13 +1,14 @@
1
  === Toolset Types - Custom Post Types, Custom Fields and Taxonomies ===
2
  Contributors: AmirHelzer, brucepearson, christianglingener, jadpm, zaantar, jmilczarek, kouratoras, displaynone
3
- Donate link: http://wp-types.com
4
  Tags: CMS, custom field, custom fields, custom post type, custom post types, field, fields post, post type, post types, taxonomies, taxonomy, toolset
5
  Text Domain: wpcf
6
  Domain Path: /embedded/locale
7
  License: GPLv2
8
  Requires at least: 3.7
 
9
  Tested up to: 4.9
10
- Stable tag: 2.2.24
11
 
12
  The complete and reliable plugin for managing custom post types, custom taxonomies and custom fields.
13
 
@@ -15,32 +16,39 @@ The complete and reliable plugin for managing custom post types, custom taxonomi
15
 
16
  **Toolset Types let’s you add custom post types, custom fields and custom taxonomies to the WordPress admin. A convenient dashboard lets you control everything from one place.**
17
 
18
- [vimeo https://vimeo.com/176428571]
 
 
 
 
 
 
 
19
 
20
  = COMPLETE DOCUMENTATION, POWERFUL API, SIMPLE GUI FOR NON-CODERS =
21
- If you're an experienced PHP developer, you'll appreciate Types comprehensive [fields API](https://wp-types.com/documentation/customizing-sites-using-php/functions/).
22
 
23
- You will find detailed guides on [adding custom post types, fields and taxonomy to the front-end](https://wp-types.com/documentation/customizing-sites-using-php/), including:
24
 
25
- * [Creating templates for single custom posts](https://wp-types.com/documentation/customizing-sites-using-php/creating-templates-single-custom-posts/)
26
- * [Creating templates for custom post type archives](https://wp-types.com/documentation/customizing-sites-using-php/creating-templates-custom-post-type-archives/)
27
- * [Creating custom user profiles](https://wp-types.com/documentation/customizing-sites-using-php/creating-custom-user-profiles/)
28
- * [Create taxonomy term archives](https://wp-types.com/documentation/customizing-sites-using-php/creating-taxonomy-term-archives/)
29
 
30
- and [more](https://wp-types.com/documentation/customizing-sites-using-php/).
31
 
32
- **Too much technical stuff to learn?** The full [Toolset](http://wp-types.com) package lets you build complete WordPress sites from within the admin dashboard.
33
 
34
  = CUSTOM FIELDS FOR CONTENT, TAXONOMY TERMS AND USERS =
35
  Types lets you add custom fields for posts (meaning, WordPress posts, pages and custom content types), taxonomy terms and users. You can add any field types to different user profiles.
36
 
37
  = ACCESS CONTROL FOR FIELDS =
38
- Using [Access](https://wp-types.com/home/toolset-components/#access), you will be able to control what fields different users can edit and view. This way, you can make some field groups read-only for certain users, and fully-editable for other users.
39
 
40
  For example, when you build a membership site, the site admin will be able to change membership levels for everyone and users will see their membership fields as read-only.
41
 
42
  = RELIABLE SUPPORT =
43
- To get support for Types, please join our [technical support forum](http://wp-types.com/forums/). You will receive support directly from our developers, helping you deliver great sites on time and correctly.
44
 
45
  = CUSTOM FIELDS =
46
 
@@ -83,7 +91,7 @@ Types lets you define parent / child relationship between different post types.
83
 
84
  = MULTILINGUAL READY =
85
 
86
- Types is the only custom fields and post types plugin that's built multilingual-ready. It plays perfectly with [WPML](http://wpml.org). You'll be able to translate everything, including texts and labels in the WordPress admin and user-content for front-page.
87
 
88
  = BUILT FOR STABILITY =
89
 
@@ -104,10 +112,15 @@ By default, WordPress will either display your blog posts or a specific page on
104
  To display custom post types on the home-page, you have two options:
105
 
106
  1. If you're comfortable with PHP and WordPress API, edit the site's template files (probably index.php) and load the custom post types there. Different themes do this differently, so we can't really say what single approach works best. You should look at [get_posts](http://codex.wordpress.org/Template_Tags/get_posts), which is part of the WordPress Template Tags system.
107
- 2. If you want to build sites right away, without becoming an expert in WordPress API and try our [Toolset Views](http://wp-types.com/). You'll be able to load whatever content you need from the database and display it anywhere and in whatever way you choose.
 
108
 
109
  We're sorry, but we don't know of any third option which is both free and requires no coding.
110
 
 
 
 
 
111
  = Can I use Types without Views? =
112
 
113
  Sure you can! Types, by itself, replaces several other plugins that define custom types and fields. We believe that it does it much better, but it's up to you to decide.
@@ -158,6 +171,27 @@ Additionally, Types is the only plugin that lets you define parent/child relatio
158
 
159
  == Changelog ==
160
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  = 2.2.24 =
162
  * Security Update
163
 
@@ -566,7 +600,7 @@ Additionally, Types is the only plugin that lets you define parent/child relatio
566
  = 1.7.5 =
567
 
568
  * Release date: 2015-07-15
569
- * Fixed a problem with Custom Fields Group edit screen to allow (again) underscore in Custom Fields names. https://wp-types.com/forums/topic/underscores-in-custom-field-names-possible-bug/
570
 
571
  = 1.7.4 =
572
 
@@ -576,7 +610,7 @@ Additionally, Types is the only plugin that lets you define parent/child relatio
576
  = 1.7.3 =
577
 
578
  * Release date: 2015-06-25
579
- * Fixed problem with "View All" in menu builder for Custom Post Types. https://wp-types.com/forums/topic/appearance-menu-php-errornotice/
580
 
581
  = 1.7.2 =
582
 
@@ -593,7 +627,7 @@ Additionally, Types is the only plugin that lets you define parent/child relatio
593
  = 1.7 =
594
 
595
  * Release date: 2015-06-15
596
- * Added the word "mode" to the list of words reserved by WordPress. https://wp-types.com/forums/topic/when-types-is-activated-i-cant-filter-articles-by-category-in-the-wp-backend/
597
  * Added the feature that automatically creates a slug for the Custom Post Type and Custom Taxonomy.
598
  * Added bulk delete options to Custom Field Groups listing page.
599
  * Added bulk delete options to Custom Post Types listing page.
@@ -602,24 +636,24 @@ Additionally, Types is the only plugin that lets you define parent/child relatio
602
  * Added the duplicate option for Custom Post Type and Custom Taxonomy.
603
  * Added the "Excerpt" field to the Child Posts table.
604
  * Added the "wpcf_field_image_max_width" filter which allows user to change image width on admin listing pages.
605
- * Added the option to specify the custom archive slug for the Custom Post Type http://wp-types.com/forums/topic/specify-cpt-archive-slug-as-string/
606
  * All custom fields on Custom Post Type listing pages are now sortable.
607
  * Changes to the Types fields GUI for easier support.
608
  * Fixed a problem with Custom Post Type, Custom Taxonomy and Custom Fields Group editing pages where forms would "freeze" after validation fails.
609
- * Fixed a problem with selecting an image for the Custom Image Field in the Child Posts table, after using the "Add New", "Save All" and "Save" buttons. https://wp-types.com/forums/topic/featured-image-cannot-be-changed-after-first-save/
610
- * Fixed a problem with multi-line field not being wrapped with P (paragraph) HTML tag https://wp-types.com/forums/topic/multi-line-text-fields-are-missing-paragraph-tags/
611
  * Fixed problem with fields being covered by colorbox on the Custom Post Type editing page.
612
  * Fixed an issue where a wrong message was displayed when minimum number of characters has not been reached.
613
 
614
  = 1.6.6.6 =
615
 
616
  * Release date: 2015-06-10
617
- * Fixed problem with "playlist" word. https://wp-types.com/forums/topic/front-end-warning-from-wysiwyg-php/
618
 
619
  = 1.6.6.5 =
620
 
621
  * Release date: 2015-05-20
622
- * Fixed problem with Uncaught ReferenceError: pagenow is not defined. http://wp-types.com/forums/topic/nextgen-gallery-broken-urgent/
623
 
624
  = 1.6.6.4 =
625
 
@@ -634,7 +668,7 @@ Additionally, Types is the only plugin that lets you define parent/child relatio
634
  = 1.6.6.2 =
635
 
636
  * Release date: 2015-04-10
637
- * Fixed problem with File Field which do not work when edited from the Parent Post Type. https://wp-types.com/forums/topic/1-6-6-seems-to-break-child-fields-when-parent-has-an-image-field/
638
 
639
  = 1.6.6.1 =
640
 
@@ -644,16 +678,16 @@ Additionally, Types is the only plugin that lets you define parent/child relatio
644
  = 1.6.6 =
645
 
646
  * Release date: 2015-04-02
647
- * Fixed problem with shortcode "playlist" used in WYSIWYG field. http://wp-types.com/forums/topic/media-play-list-not-outputting-from-custom-wysiwyg-field-js-error/
648
- * Fixed empty title problem for filter "wpt_field_options" on user edit/add screen https://wp-types.com/forums/topic/populate-select-field-in-wpcf-um-group/
649
- * Added ability to create CPT without title and editor. https://wp-types.com/forums/topic/inaccurate-warning-message-when-creatingediting-a-cpt/
650
  * Added Skype field validation.
651
  * Fixed problem with loading custom CSS when user meta group is inactive or not assign to certain user role.
652
  * Added ability to add to menu link to archive of post type.
653
- * Added ability to setup meta box callback function. https://wp-types.com/forums/topic/add-support-for-meta_box_cb-in-custom-taxonomy/
654
  * Added ability to add HTML5 placeholder attribute for custom post fields.
655
- * Fixed problem with CPT labels. https://wp-types.com/forums/topic/after-save-cpts-cutom-labels-always-revert-to-default-label/
656
- * Added a filters to the post title as option text in the select dropdown for post parents. wpcf_pr_belongs_items for array of options and wpcf_pr_belongs_item for one option. https://wp-types.com/forums/topic/help-to-distinguish-duplicate-titles-in-post-relationship/
657
  * Added ability to choose custom fields to display it on custom posts admin list.
658
  * Fixed problem with saving parent data into child data. On parent edit screen.
659
  * Added check group name for Custom Fields and User Fields.
@@ -663,57 +697,57 @@ Additionally, Types is the only plugin that lets you define parent/child relatio
663
 
664
  * Release date: 2015-02-24
665
  * Fixed Installer patch to plugins.
666
- * Fixed problem with "Access Control and User Roles" menu in Types, when Access is active http://wp-types.com/forums/topic/update-issues-fatal-error-require_once-failed-opening-required-wpcf_access_/
667
  * Changed utm_media used in links on "Getting Started" pages.
668
 
669
  = 1.6.5 =
670
 
671
  * Release date: 2015-02-10
672
  * Changed in relationships, now all posts are showed, even those which have show_ui to false.
673
- * Added ability to hide custom post types on post relationships list. https://wp-types.com/forums/topic/post-relationship-doesnt-show-post-type-events-created-by-events-espresso/ using filter add_filter('wpcf_show_ui_hide_in_relationships', '__return_false');
674
  * Fixed a problem with deleting last children on post relationships table.
675
- * Added filter to allow use "?" in image url. https://wp-types.com/forums/topic/image-custom-field-is-not-storing-image-path-with-parameters/
676
- * Added option for child table, when editing parent to allow show only list of children instead edit form. http://wp-types.com/forums/topic/miss-settings-for-post-relationship-child-options/
677
  * Fixed a problem with slug in custom fields, when field have special chars.
678
  * Fixed wrong display message about custom fields not manageable by Types.
679
- * Fixed a conflict with Formidable-Pro plugin https://wp-types.com/forums/topic/plugin-conflict/
680
  * Fixed creating new post in relationships. WP 4.1 need real title not faked by one space.
681
- * Fixed problem with validate fields on user create page. http://wp-types.com/forums/topic/custom-usermeta-bypassed-even-required-is-set/
682
  * Improved Edit CPT and Edit CT screens to be more compatible with WP Admin UI
683
- * Fixed problem with default label which contains single quote character (eg. French) https://wp-types.com/forums/topic/default-label-always-shown/
684
  * Improved display list of custom fields groups.
685
 
686
  = 1.6.4 =
687
 
688
  * Release date: 2014-11-17
689
  * Fixed an issue with dependency between custom taxonomies and custom posts when importing data from the "Custom Post Type UI" plugin.
690
- * 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/
691
- * 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/
692
  * 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.
693
  * Added the "wpcf_delete_relation_meta" filter which allows deletion of all post relationships when deleting a custom post type.
694
- * 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/
695
- * 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/
696
  * Fixed a problem with default description not disappearing for non-English placeholders. https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/189787190/comments
697
  * 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.
698
  * Fixed embedding OTGS CSS for the admin area. https://wordpress.org/support/topic/four-stylesheets-being-loaded-at-frontend
699
- * Fixed a problem with Checkbox field value not being saved. https://wp-types.com/forums/topic/checkbox-value-not-saved/
700
- * 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/
701
  * Fixed a problem with the date-picker. https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/191190651/comments
702
  * Fixed a problem with label menu in wp-admin for child posts.
703
  * Fixed a problem with child table when edit parent post and children do not have title.
704
- * 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/
705
- * 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/
706
- * Improved post relation table by using more precise labels. http://wp-types.com/forums/topic/displaying-the-best-names-of-cpts-in-applicable-contexts/
707
  * Fixed a problem with display checkbox value from database if checkbox is empty.
708
 
709
  = 1.6.3 =
710
 
711
  * Release date: 2014-10-23
712
  * Added the message to ask users to answer a short survey for feedback on their work using the Types plugin.
713
- * Fixed a problem where the custom field group’s description was missing from the post/page editing page. http://wp-types.com/forums/topic/custom-field-group-descriptions-no-longer-visible-in-cpt-add-newedit-screen/
714
- * Fixed a problem where the field descriptions weren’t displayed on the user profile editing page. http://wp-types.com/forums/topic/checkbox-description-fields-no-longer-display-in-types-1-6-2/
715
  * Fixed a problem where users weren’t able to untick the single and multiple checkbox fields on the user profile editing page.
716
- * Fixed a problem where the value of date field couldn’t be cleared and added new button which clears the date field value. http://wp-types.com/forums/topic/problem-2-after-update/
717
  * Replaced the deprecated like_escape function with the wpdb::esc_like function.
718
  * Fixed a problem where the parent-child relations between custom post types persisted after deleting and re-creating a custom post type.
719
  * Fixed a problem where date picker scripts were being enqueued in the front end. https://wordpress.org/support/topic/datepicker-css-enqueued-on-public
1
  === Toolset Types - Custom Post Types, Custom Fields and Taxonomies ===
2
  Contributors: AmirHelzer, brucepearson, christianglingener, jadpm, zaantar, jmilczarek, kouratoras, displaynone
3
+ Donate link: http://toolset.com
4
  Tags: CMS, custom field, custom fields, custom post type, custom post types, field, fields post, post type, post types, taxonomies, taxonomy, toolset
5
  Text Domain: wpcf
6
  Domain Path: /embedded/locale
7
  License: GPLv2
8
  Requires at least: 3.7
9
+ Requires PHP: 5.3
10
  Tested up to: 4.9
11
+ Stable tag: 2.3.5
12
 
13
  The complete and reliable plugin for managing custom post types, custom taxonomies and custom fields.
14
 
16
 
17
  **Toolset Types let’s you add custom post types, custom fields and custom taxonomies to the WordPress admin. A convenient dashboard lets you control everything from one place.**
18
 
19
+ [youtube https://www.youtube.com/watch?v=Akzybh3uyXA]
20
+
21
+ = TYPES 3.0 AVAILABLE =
22
+ We have [released Types 3.0](https://toolset.com/2018/05/toolset-post-relationships-release/) with completely rewritten post relationships (many-to-many post relationships, repeatable field groups and much more).
23
+
24
+ However, Types since version 3.0 is a [part of the complete Toolset package](https://toolset.com/2017/11/types-plugin-is-moving-to-be-a-part-of-the-complete-toolset-package/) and it is available only with a [Toolset account](https://toolset.com).
25
+
26
+ We will keep supporting the free version of Types with security and compatibility updates and bug fixes through 2018.
27
 
28
  = COMPLETE DOCUMENTATION, POWERFUL API, SIMPLE GUI FOR NON-CODERS =
29
+ If you're an experienced PHP developer, you'll appreciate Types comprehensive [fields API](https://toolset.com/documentation/customizing-sites-using-php/functions/).
30
 
31
+ You will find detailed guides on [adding custom post types, fields and taxonomy to the front-end](https://toolset.com/documentation/customizing-sites-using-php/), including:
32
 
33
+ * [Creating templates for single custom posts](https://toolset.com/documentation/customizing-sites-using-php/creating-templates-single-custom-posts/)
34
+ * [Creating templates for custom post type archives](https://toolset.com/documentation/customizing-sites-using-php/creating-templates-custom-post-type-archives/)
35
+ * [Creating custom user profiles](https://toolset.com/documentation/customizing-sites-using-php/creating-custom-user-profiles/)
36
+ * [Create taxonomy term archives](https://toolset.com/documentation/customizing-sites-using-php/creating-taxonomy-term-archives/)
37
 
38
+ and [more](https://toolset.com/documentation/customizing-sites-using-php/).
39
 
40
+ **Too much technical stuff to learn?** The full [Toolset](https://toolset.com) package lets you build complete WordPress sites from within the admin dashboard.
41
 
42
  = CUSTOM FIELDS FOR CONTENT, TAXONOMY TERMS AND USERS =
43
  Types lets you add custom fields for posts (meaning, WordPress posts, pages and custom content types), taxonomy terms and users. You can add any field types to different user profiles.
44
 
45
  = ACCESS CONTROL FOR FIELDS =
46
+ Using [Access](https://toolset.com/home/toolset-components/#access), you will be able to control what fields different users can edit and view. This way, you can make some field groups read-only for certain users, and fully-editable for other users.
47
 
48
  For example, when you build a membership site, the site admin will be able to change membership levels for everyone and users will see their membership fields as read-only.
49
 
50
  = RELIABLE SUPPORT =
51
+ To get support for Types, please join our [technical support forum](https://toolset.com/forums/). You will receive support directly from our developers, helping you deliver great sites on time and correctly.
52
 
53
  = CUSTOM FIELDS =
54
 
91
 
92
  = MULTILINGUAL READY =
93
 
94
+ Types is the only custom fields and post types plugin that's built multilingual-ready. It plays perfectly with [WPML](http://wpml.org). You'll be able to translate everything, including texts and labels in the WordPress admin and user-content for front-page. See the [guide for translating Toolset](https://toolset.com/documentation/translating-sites-built-with-toolset/).
95
 
96
  = BUILT FOR STABILITY =
97
 
112
  To display custom post types on the home-page, you have two options:
113
 
114
  1. If you're comfortable with PHP and WordPress API, edit the site's template files (probably index.php) and load the custom post types there. Different themes do this differently, so we can't really say what single approach works best. You should look at [get_posts](http://codex.wordpress.org/Template_Tags/get_posts), which is part of the WordPress Template Tags system.
115
+
116
+ 2. If you want to build sites right away, without becoming an expert in WordPress API and try our [Toolset Views](https://toolset.com/home/views-create-elegant-displays-for-your-content/). You'll be able to load whatever content you need from the database and display it anywhere and in whatever way you choose.
117
 
118
  We're sorry, but we don't know of any third option which is both free and requires no coding.
119
 
120
+ = How can I create repeating field groups?=
121
+
122
+ The paid version of Types, available through [Toolset](https://toolset.com) Website lets you create infinitely nested groups of repeating fields.
123
+
124
  = Can I use Types without Views? =
125
 
126
  Sure you can! Types, by itself, replaces several other plugins that define custom types and fields. We believe that it does it much better, but it's up to you to decide.
171
 
172
  == Changelog ==
173
 
174
+ = 2.3.5 =
175
+ * Fixed a blank screen on the post editing page when using Types versions older than 2.3.4 on a site running Wordpress 5.0 (or using a Gutenberg plugin).
176
+
177
+ = 2.3.4 =
178
+ * Security Update
179
+
180
+ = 2.3.3 =
181
+ * Fixed an issue when saving checkboxes while relationship posts also contains checkboxes.
182
+
183
+ = 2.3.2 =
184
+ * An upgrade to the Installer component to prevent the notification about a possible upgrade to Types 3.0 for non-subscription users.
185
+
186
+ = 2.3.1 =
187
+ * Bring back the upgraded Installer in order to remedy upgrade issues for both subscription and non-subscription clients.
188
+
189
+ = 2.3 =
190
+ * Free Types version which will be available on wordpress.org only.
191
+ * Added a dismissable notice about what is going on with Types development.
192
+ * Removed the Installer dependency. Clients who buy Toolset will have to download Types 3.0+ manually for the first time.
193
+ * Users should no longer be asked to buy a subscription in order to upgrade (sorry about that).
194
+
195
  = 2.2.24 =
196
  * Security Update
197
 
600
  = 1.7.5 =
601
 
602
  * Release date: 2015-07-15
603
+ * Fixed a problem with Custom Fields Group edit screen to allow (again) underscore in Custom Fields names. https://toolset.com/forums/topic/underscores-in-custom-field-names-possible-bug/
604
 
605
  = 1.7.4 =
606
 
610
  = 1.7.3 =
611
 
612
  * Release date: 2015-06-25
613
+ * Fixed problem with "View All" in menu builder for Custom Post Types. https://toolset.com/forums/topic/appearance-menu-php-errornotice/
614
 
615
  = 1.7.2 =
616
 
627
  = 1.7 =
628
 
629
  * Release date: 2015-06-15
630
+ * Added the word "mode" to the list of words reserved by WordPress. https://toolset.com/forums/topic/when-types-is-activated-i-cant-filter-articles-by-category-in-the-wp-backend/
631
  * Added the feature that automatically creates a slug for the Custom Post Type and Custom Taxonomy.
632
  * Added bulk delete options to Custom Field Groups listing page.
633
  * Added bulk delete options to Custom Post Types listing page.
636
  * Added the duplicate option for Custom Post Type and Custom Taxonomy.
637
  * Added the "Excerpt" field to the Child Posts table.
638
  * Added the "wpcf_field_image_max_width" filter which allows user to change image width on admin listing pages.
639
+ * Added the option to specify the custom archive slug for the Custom Post Type http://toolset.com/forums/topic/specify-cpt-archive-slug-as-string/
640
  * All custom fields on Custom Post Type listing pages are now sortable.
641
  * Changes to the Types fields GUI for easier support.
642
  * Fixed a problem with Custom Post Type, Custom Taxonomy and Custom Fields Group editing pages where forms would "freeze" after validation fails.
643
+ * Fixed a problem with selecting an image for the Custom Image Field in the Child Posts table, after using the "Add New", "Save All" and "Save" buttons. https://toolset.com/forums/topic/featured-image-cannot-be-changed-after-first-save/
644
+ * Fixed a problem with multi-line field not being wrapped with P (paragraph) HTML tag https://toolset.com/forums/topic/multi-line-text-fields-are-missing-paragraph-tags/
645
  * Fixed problem with fields being covered by colorbox on the Custom Post Type editing page.
646
  * Fixed an issue where a wrong message was displayed when minimum number of characters has not been reached.
647
 
648
  = 1.6.6.6 =
649
 
650
  * Release date: 2015-06-10
651
+ * Fixed problem with "playlist" word. https://toolset.com/forums/topic/front-end-warning-from-wysiwyg-php/
652
 
653
  = 1.6.6.5 =
654
 
655
  * Release date: 2015-05-20
656
+ * Fixed problem with Uncaught ReferenceError: pagenow is not defined. http://toolset.com/forums/topic/nextgen-gallery-broken-urgent/
657
 
658
  = 1.6.6.4 =
659
 
668
  = 1.6.6.2 =
669
 
670
  * Release date: 2015-04-10
671
+ * Fixed problem with File Field which do not work when edited from the Parent Post Type. https://toolset.com/forums/topic/1-6-6-seems-to-break-child-fields-when-parent-has-an-image-field/
672
 
673
  = 1.6.6.1 =
674
 
678
  = 1.6.6 =
679
 
680
  * Release date: 2015-04-02
681
+ * Fixed problem with shortcode "playlist" used in WYSIWYG field. http://toolset.com/forums/topic/media-play-list-not-outputting-from-custom-wysiwyg-field-js-error/
682
+ * Fixed empty title problem for filter "wpt_field_options" on user edit/add screen https://toolset.com/forums/topic/populate-select-field-in-wpcf-um-group/
683
+ * Added ability to create CPT without title and editor. https://toolset.com/forums/topic/inaccurate-warning-message-when-creatingediting-a-cpt/
684
  * Added Skype field validation.
685
  * Fixed problem with loading custom CSS when user meta group is inactive or not assign to certain user role.
686
  * Added ability to add to menu link to archive of post type.
687
+ * Added ability to setup meta box callback function. https://toolset.com/forums/topic/add-support-for-meta_box_cb-in-custom-taxonomy/
688
  * Added ability to add HTML5 placeholder attribute for custom post fields.
689
+ * Fixed problem with CPT labels. https://toolset.com/forums/topic/after-save-cpts-cutom-labels-always-revert-to-default-label/
690
+ * Added a filters to the post title as option text in the select dropdown for post parents. wpcf_pr_belongs_items for array of options and wpcf_pr_belongs_item for one option. https://toolset.com/forums/topic/help-to-distinguish-duplicate-titles-in-post-relationship/
691
  * Added ability to choose custom fields to display it on custom posts admin list.
692
  * Fixed problem with saving parent data into child data. On parent edit screen.
693
  * Added check group name for Custom Fields and User Fields.
697
 
698
  * Release date: 2015-02-24
699
  * Fixed Installer patch to plugins.
700
+ * Fixed problem with "Access Control and User Roles" menu in Types, when Access is active http://toolset.com/forums/topic/update-issues-fatal-error-require_once-failed-opening-required-wpcf_access_/
701
  * Changed utm_media used in links on "Getting Started" pages.
702
 
703
  = 1.6.5 =
704
 
705
  * Release date: 2015-02-10
706
  * Changed in relationships, now all posts are showed, even those which have show_ui to false.
707
+ * Added ability to hide custom post types on post relationships list. https://toolset.com/forums/topic/post-relationship-doesnt-show-post-type-events-created-by-events-espresso/ using filter add_filter('wpcf_show_ui_hide_in_relationships', '__return_false');
708
  * Fixed a problem with deleting last children on post relationships table.
709
+ * Added filter to allow use "?" in image url. https://toolset.com/forums/topic/image-custom-field-is-not-storing-image-path-with-parameters/
710
+ * Added option for child table, when editing parent to allow show only list of children instead edit form. http://toolset.com/forums/topic/miss-settings-for-post-relationship-child-options/
711
  * Fixed a problem with slug in custom fields, when field have special chars.
712
  * Fixed wrong display message about custom fields not manageable by Types.
713
+ * Fixed a conflict with Formidable-Pro plugin https://toolset.com/forums/topic/plugin-conflict/
714
  * Fixed creating new post in relationships. WP 4.1 need real title not faked by one space.
715
+ * Fixed problem with validate fields on user create page. http://toolset.com/forums/topic/custom-usermeta-bypassed-even-required-is-set/
716
  * Improved Edit CPT and Edit CT screens to be more compatible with WP Admin UI
717
+ * Fixed problem with default label which contains single quote character (eg. French) https://toolset.com/forums/topic/default-label-always-shown/
718
  * Improved display list of custom fields groups.
719
 
720
  = 1.6.4 =
721
 
722
  * Release date: 2014-11-17
723
  * Fixed an issue with dependency between custom taxonomies and custom posts when importing data from the "Custom Post Type UI" plugin.
724
+ * Fixed an issue with editing checkboxes with the option "save 0 to the database" selected, created for Custom Posts. http://toolset.com/forums/topic/checkbox-custom-field-doesnt-save-value-since-upgrade-to-version-1-6-2/ http://toolset.com/forums/topic/types-checkbox-field-not-saving-after-save-0-to-the-database/
725
+ * Fixed an issue with PHP notices being thrown when relative URLs to images were used. http://toolset.com/forums/topic/php-notice-undefined-index-host-in-image-php/
726
  * 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.
727
  * Added the "wpcf_delete_relation_meta" filter which allows deletion of all post relationships when deleting a custom post type.
728
+ * 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://toolset.com/forums/topic/types-1-6-update-breaks-layout-that-worked-in-types-1-5-7/
729
+ * Fixed a problem with duplicate slugs on "Edit Group" screen. https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/187118123/comments http://toolset.com/forums/topic/cant-add-more-custom-fields/
730
  * Fixed a problem with default description not disappearing for non-English placeholders. https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/189787190/comments
731
  * 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.
732
  * Fixed embedding OTGS CSS for the admin area. https://wordpress.org/support/topic/four-stylesheets-being-loaded-at-frontend
733
+ * Fixed a problem with Checkbox field value not being saved. https://toolset.com/forums/topic/checkbox-value-not-saved/
734
+ * Added the option to select posts with the "Private" post status as parents in a parent-child Custom Post Types relationships. http://toolset.com/forums/topic/cred-child-form-not-working-with-private-ctp/
735
  * Fixed a problem with the date-picker. https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/191190651/comments
736
  * Fixed a problem with label menu in wp-admin for child posts.
737
  * Fixed a problem with child table when edit parent post and children do not have title.
738
+ * Prevent to chose repetitive field in child table on edit parent screen. http://toolset.com/forums/topic/wp-types-select-child-fields-to-be-displayed-specific-fields-not-working/
739
+ * Added a dynamic "posted x minutes/hours ago" for Types fields. https://toolset.com/forums/topic/adding-a-dynamic-posted-x-minuteshours-ago-in-a-view/
740
+ * Improved post relation table by using more precise labels. http://toolset.com/forums/topic/displaying-the-best-names-of-cpts-in-applicable-contexts/
741
  * Fixed a problem with display checkbox value from database if checkbox is empty.
742
 
743
  = 1.6.3 =
744
 
745
  * Release date: 2014-10-23
746
  * Added the message to ask users to answer a short survey for feedback on their work using the Types plugin.
747
+ * Fixed a problem where the custom field group’s description was missing from the post/page editing page. http://toolset.com/forums/topic/custom-field-group-descriptions-no-longer-visible-in-cpt-add-newedit-screen/
748
+ * Fixed a problem where the field descriptions weren’t displayed on the user profile editing page. http://toolset.com/forums/topic/checkbox-description-fields-no-longer-display-in-types-1-6-2/
749
  * Fixed a problem where users weren’t able to untick the single and multiple checkbox fields on the user profile editing page.
750
+ * Fixed a problem where the value of date field couldn’t be cleared and added new button which clears the date field value. http://toolset.com/forums/topic/problem-2-after-update/
751
  * Replaced the deprecated like_escape function with the wpdb::esc_like function.
752
  * Fixed a problem where the parent-child relations between custom post types persisted after deleting and re-creating a custom post type.
753
  * Fixed a problem where date picker scripts were being enqueued in the front end. https://wordpress.org/support/topic/datepicker-css-enqueued-on-public
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitb4ac95941783ab1f27185069ef17cdb2::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit3ef203360daf9a3f27f03c8cdcceee49::getLoader();
vendor/composer/ClassLoader.php CHANGED
@@ -379,9 +379,9 @@ class ClassLoader
379
  $subPath = substr($subPath, 0, $lastPos);
380
  $search = $subPath.'\\';
381
  if (isset($this->prefixDirsPsr4[$search])) {
 
382
  foreach ($this->prefixDirsPsr4[$search] as $dir) {
383
- $length = $this->prefixLengthsPsr4[$first][$search];
384
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
385
  return $file;
386
  }
387
  }
379
  $subPath = substr($subPath, 0, $lastPos);
380
  $search = $subPath.'\\';
381
  if (isset($this->prefixDirsPsr4[$search])) {
382
+ $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
383
  foreach ($this->prefixDirsPsr4[$search] as $dir) {
384
+ if (file_exists($file = $dir . $pathEnd)) {
 
385
  return $file;
386
  }
387
  }
vendor/composer/autoload_classmap.php CHANGED
@@ -96,7 +96,6 @@ return array(
96
  'FieldFactory' => $vendorDir . '/toolset/toolset-common/toolset-forms/classes/class.field_factory.php',
97
  'FormAbstract' => $vendorDir . '/toolset/toolset-common/toolset-forms/classes/abstract.form.php',
98
  'FormFactory' => $vendorDir . '/toolset/toolset-common/toolset-forms/classes/class.form_factory.php',
99
- 'IOTGS_Installer_Template_Service' => $vendorDir . '/otgs/installer/templates/template-service/interface-iotgs-installer-template-service.php',
100
  'IToolset_Association' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/interface.php',
101
  'IToolset_Association_Query_Condition' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/interface.php',
102
  'IToolset_Association_Query_Element_Selector' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/element_selector/interface.php',
@@ -111,7 +110,6 @@ return array(
111
  'IToolset_Post_Type_From_Types' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/post_type/i_post_type_from_types.php',
112
  'IToolset_Post_Type_Registered' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/post_type/i_post_type_registered.php',
113
  'IToolset_Potential_Association_Query' => $vendorDir . '/toolset/toolset-common/inc/m2m/potential_association/query_interface.php',
114
- 'IToolset_Query' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/i_query.php',
115
  'IToolset_Query_Condition' => $vendorDir . '/toolset/toolset-common/inc/m2m/query/condition/interface.php',
116
  'IToolset_Relationship_Database_Issue' => $vendorDir . '/toolset/toolset-common/inc/m2m/database/issue/interface.php',
117
  'IToolset_Relationship_Definition' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/definition/interface.php',
@@ -121,22 +119,18 @@ return array(
121
  'IToolset_Relationship_Role' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/role/interface.php',
122
  'IToolset_Relationship_Role_Parent_Child' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/role/parent_child_interface.php',
123
  'IToolset_Upgrade_Command' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/upgrade/command_interface.php',
124
- 'Installer_Dependencies' => $vendorDir . '/otgs/installer/includes/class-installer-dependencies.php',
125
- 'Installer_Theme_Class' => $vendorDir . '/otgs/installer/includes/class-installer-theme.php',
126
- 'Installer_Upgrader_Skins' => $vendorDir . '/otgs/installer/includes/class-installer-upgrader-skins.php',
127
- 'OTGS_Installer_Filename_Hooks' => $vendorDir . '/otgs/installer/includes/class-otgs-installer-filename-hooks.php',
128
- 'OTGS_Installer_Icons' => $vendorDir . '/otgs/installer/includes/class-otgs-installer-icons.php',
129
- 'OTGS_Installer_PHP_Functions' => $vendorDir . '/otgs/installer/includes/class-otgs-installer-php-functions.php',
130
- 'OTGS_Installer_Plugins_Page_Notice' => $vendorDir . '/otgs/installer/includes/class-otgs-installer-plugins-page-notice.php',
131
- 'OTGS_Installer_Twig_Template_Service' => $vendorDir . '/otgs/installer/templates/template-service/class-otgs-installer-twig-template-service.php',
132
- 'OTGS_Installer_Twig_Template_Service_Loader' => $vendorDir . '/otgs/installer/templates/template-service/class-otgs-installer-twig-template-service-loader.php',
133
- 'OTGS_Installer_WP_Components_Hooks' => $vendorDir . '/otgs/installer/includes/class-otgs-installer-wp-components-hooks.php',
134
- 'OTGS_Installer_WP_Components_Sender' => $vendorDir . '/otgs/installer/includes/class-otgs-installer-wp-components-sender.php',
135
- 'OTGS_Installer_WP_Components_Setting_Ajax' => $vendorDir . '/otgs/installer/includes/class-otgs-installer-wp-components-setting-ajax.php',
136
- 'OTGS_Installer_WP_Components_Setting_Resources' => $vendorDir . '/otgs/installer/includes/class-otgs-installer-wp-components-setting-resources.php',
137
- 'OTGS_Installer_WP_Components_Setting_Templates' => $vendorDir . '/otgs/installer/includes/class-otgs-installer-wp-components-setting-templates.php',
138
- 'OTGS_Installer_WP_Components_Storage' => $vendorDir . '/otgs/installer/includes/class-otgs-installer-wp-components-storage.php',
139
- 'OTGS_Installer_WP_Share_Local_Components_Setting' => $vendorDir . '/otgs/installer/includes/class-otgs-installer-wp-share-local-components-setting.php',
140
  'ReCaptchaResponse' => $vendorDir . '/toolset/toolset-common/toolset-forms/js/recaptcha-php-1.11/recaptchalib.php',
141
  'Toolset_Admin_Bar_Menu' => $vendorDir . '/toolset/toolset-common/inc/toolset.admin.bar.menu.class.php',
142
  'Toolset_Admin_Controller' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/admin.php',
@@ -160,6 +154,7 @@ return array(
160
  'Toolset_Ajax_Handler_Interface' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/ajax_handler/interface.php',
161
  'Toolset_Ajax_Handler_Intermediary_Post_Cleanup' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/ajax_handler/intermediary_post_cleanup.php',
162
  'Toolset_Ajax_Handler_Migrate_To_M2M' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/ajax_handler/migrate_to_m2m.php',
 
163
  'Toolset_Ajax_Handler_Select2_Suggest_Posts_By_Title' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/ajax_handler/select2_suggest_posts_by_title.php',
164
  'Toolset_Ajax_Handler_Select2_Suggest_Terms' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/ajax_handler/select2_suggest_terms.php',
165
  'Toolset_Ajax_Handler_Select2_Suggest_Users' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/ajax_handler/select2_suggest_users.php',
@@ -173,6 +168,7 @@ return array(
173
  'Toolset_Association_Cleanup_Dangling_Intermediary_Posts' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/cleanup/dangling_intermediary_posts.php',
174
  'Toolset_Association_Cleanup_Factory' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/cleanup/factory.php',
175
  'Toolset_Association_Cleanup_Post' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/cleanup/post.php',
 
176
  'Toolset_Association_Cleanup_Troubleshooting_Section' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/cleanup/troubleshooting_section.php',
177
  'Toolset_Association_Factory' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/factory.php',
178
  'Toolset_Association_Intermediary_Post_Persistence' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/intermediary_post_persistence.php',
@@ -185,21 +181,26 @@ return array(
185
  'Toolset_Association_Query_Condition_Element_Status' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/element_status.php',
186
  'Toolset_Association_Query_Condition_Empty_Intermediary' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/empty_intermediary.php',
187
  'Toolset_Association_Query_Condition_Exclude_Element' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/exclude_element.php',
 
188
  'Toolset_Association_Query_Condition_Factory' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition_factory.php',
189
  'Toolset_Association_Query_Condition_Has_Active_Relationship' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/has_active_relationship.php',
190
  'Toolset_Association_Query_Condition_Has_Domain' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/has_domain.php',
191
  'Toolset_Association_Query_Condition_Has_Domain_And_Type' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/has_domain_and_type.php',
 
192
  'Toolset_Association_Query_Condition_Has_Legacy_Relationship' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/has_legacy_relationship.php',
193
  'Toolset_Association_Query_Condition_Has_Type' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/has_type.php',
 
194
  'Toolset_Association_Query_Condition_Postmeta' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/postmeta.php',
195
  'Toolset_Association_Query_Condition_Relationship_Flag' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/relationship_flag.php',
196
  'Toolset_Association_Query_Condition_Relationship_Id' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/relationship_id.php',
 
197
  'Toolset_Association_Query_Condition_Search' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/search.php',
198
  'Toolset_Association_Query_Condition_Wp_Query' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/wp_query.php',
199
  'Toolset_Association_Query_Element_Selector_Abstract' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/element_selector/abstract.php',
200
  'Toolset_Association_Query_Element_Selector_Default' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/element_selector/default.php',
201
  'Toolset_Association_Query_Element_Selector_Provider' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/element_selector/provider.php',
202
  'Toolset_Association_Query_Element_Selector_Wpml' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/element_selector/wpml.php',
 
203
  'Toolset_Association_Query_Orderby' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/orderby/abstract.php',
204
  'Toolset_Association_Query_Orderby_Factory' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/orderby_factory.php',
205
  'Toolset_Association_Query_Orderby_Nothing' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/orderby/nothing.php',
@@ -316,6 +317,7 @@ return array(
316
  'Toolset_Field_Renderer_Preview_Date' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/date.php',
317
  'Toolset_Field_Renderer_Preview_File' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/file.php',
318
  'Toolset_Field_Renderer_Preview_Image' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/image.php',
 
319
  'Toolset_Field_Renderer_Preview_Radio' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/radio.php',
320
  'Toolset_Field_Renderer_Preview_Skype' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/skype.php',
321
  'Toolset_Field_Renderer_Preview_Textfield' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/textfield.php',
@@ -358,17 +360,25 @@ return array(
358
  'Toolset_Post_Type_Factory' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/post_type/factory.php',
359
  'Toolset_Post_Type_From_Types' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/post_type/from_types.php',
360
  'Toolset_Post_Type_Labels' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/post_type/labels.php',
 
361
  'Toolset_Post_Type_Query' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/post_type/query.php',
362
  'Toolset_Post_Type_Query_Factory' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/post_type/query_factory.php',
363
  'Toolset_Post_Type_Registered' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/post_type/registered.php',
364
  'Toolset_Post_Type_Repository' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/post_type/repository.php',
 
 
 
365
  'Toolset_Potential_Association_Query_Factory' => $vendorDir . '/toolset/toolset-common/inc/m2m/potential_association/query_factory.php',
 
 
 
366
  'Toolset_Potential_Association_Query_Posts' => $vendorDir . '/toolset/toolset-common/inc/m2m/potential_association/query_posts.php',
367
  'Toolset_Promotion' => $vendorDir . '/toolset/toolset-common/inc/toolset.promotion.class.php',
368
  'Toolset_Public_API_Loader' => $vendorDir . '/toolset/toolset-common/inc/public_api/loader.php',
369
  'Toolset_Query_Comparison_Operator' => $vendorDir . '/toolset/toolset-common/inc/m2m/query/comparison_operator.php',
370
  'Toolset_Query_Condition_And' => $vendorDir . '/toolset/toolset-common/inc/m2m/query/condition/and.php',
371
  'Toolset_Query_Condition_Contradiction' => $vendorDir . '/toolset/toolset-common/inc/m2m/query/condition/contradiction.php',
 
372
  'Toolset_Query_Condition_Operator' => $vendorDir . '/toolset/toolset-common/inc/m2m/query/condition/operator.php',
373
  'Toolset_Query_Condition_Or' => $vendorDir . '/toolset/toolset-common/inc/m2m/query/condition/or.php',
374
  'Toolset_Query_Condition_Tautology' => $vendorDir . '/toolset/toolset-common/inc/m2m/query/condition/tautology.php',
@@ -402,10 +412,13 @@ return array(
402
  'Toolset_Relationship_Query_Cardinality_Match_Operators' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/query/cardinality_match/operators.php',
403
  'Toolset_Relationship_Query_Cardinality_Match_Single' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/query/cardinality_match/single.php',
404
  'Toolset_Relationship_Query_Condition' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/query/condition/abstract.php',
 
 
405
  'Toolset_Relationship_Query_Condition_Factory' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/query/condition_factory.php',
406
  'Toolset_Relationship_Query_Condition_Has_Active_Types' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/query/condition/has_active_types.php',
407
  'Toolset_Relationship_Query_Condition_Has_Cardinality' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/query/condition/has_cardinality.php',
408
  'Toolset_Relationship_Query_Condition_Has_Domain' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/query/condition/has_domain.php',
 
409
  'Toolset_Relationship_Query_Condition_Is_Active' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/query/condition/is_active.php',
410
  'Toolset_Relationship_Query_Condition_Is_Boolean_Flag' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/query/condition/is_boolean_flag.php',
411
  'Toolset_Relationship_Query_Condition_Is_Legacy' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/query/condition/is_legacy.php',
@@ -434,11 +447,18 @@ return array(
434
  'Toolset_Settings_Screen' => $vendorDir . '/toolset/toolset-common/inc/toolset.settings.screen.class.php',
435
  'Toolset_Shortcode_Attr_Field' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/field.php',
436
  'Toolset_Shortcode_Attr_Interface' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/interface.php',
 
 
 
 
 
 
437
  'Toolset_Shortcode_Attr_Item_Id' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/id.php',
438
  'Toolset_Shortcode_Attr_Item_Legacy' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/legacy.php',
439
  'Toolset_Shortcode_Attr_Item_M2M' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/m2m.php',
440
  'Toolset_Shortcode_Generator' => $vendorDir . '/toolset/toolset-common/inc/toolset.shortcode.generator.class.php',
441
  'Toolset_Shortcode_Transformer' => $vendorDir . '/toolset/toolset-common/inc/toolset.shortcode.transformer.class.php',
 
442
  'Toolset_Stack' => $vendorDir . '/toolset/toolset-common/expression-parser/parser.php',
443
  'Toolset_Style' => $vendorDir . '/toolset/toolset-common/inc/toolset.assets.manager.class.php',
444
  'Toolset_Template_Dialog_Box' => $vendorDir . '/toolset/toolset-common/utility/gui-base/template_dialog_box.php',
@@ -449,8 +469,10 @@ return array(
449
  'Toolset_Twig_Extensions' => $vendorDir . '/toolset/toolset-common/utility/gui-base/twig_extensions.php',
450
  'Toolset_Upgrade_Command_Definition' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/upgrade/command_definition.php',
451
  'Toolset_Upgrade_Command_Definition_Repository' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/upgrade/command_definition_repository.php',
 
452
  'Toolset_Upgrade_Command_Factory' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/upgrade/command_factory.php',
453
  'Toolset_Upgrade_Command_M2M_V1_Database_Structure_Upgrade' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/upgrade/command/m2m_v1_database_structure_upgrade.php',
 
454
  'Toolset_Upgrade_Controller' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/upgrade/controller.php',
455
  'Toolset_Upgrade_Executed_Commands' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/upgrade/executed_commands.php',
456
  'Toolset_User_Editors_Editor_Abstract' => $vendorDir . '/toolset/toolset-common/user-editors/editor/abstract.php',
@@ -496,7 +518,6 @@ return array(
496
  'Toolset_Wp_Query_Adjustments_Table_Join_Manager' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/wp_query_adjustments/table_join_manager.php',
497
  'Toolset_Wpdb_User' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/wpdb_user.php',
498
  'Toolset_Wpml_Utils' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/wpml_utils.php',
499
- 'Translation_Service_Info' => $vendorDir . '/otgs/installer/includes/class-translation-service-info.php',
500
  'Twig_Autoloader' => $vendorDir . '/twig/twig/lib/Twig/Autoloader.php',
501
  'Twig_BaseNodeVisitor' => $vendorDir . '/twig/twig/lib/Twig/BaseNodeVisitor.php',
502
  'Twig_CacheInterface' => $vendorDir . '/twig/twig/lib/Twig/CacheInterface.php',
@@ -696,6 +717,7 @@ return array(
696
  'Twig_Util_TemplateDirIterator' => $vendorDir . '/twig/twig/lib/Twig/Util/TemplateDirIterator.php',
697
  'Types_Admin' => $baseDir . '/application/controllers/admin.php',
698
  'Types_Admin_Menu' => $baseDir . '/application/controllers/admin_menu.php',
 
699
  'Types_Ajax' => $baseDir . '/application/controllers/ajax.php',
700
  'Types_Ajax_Handler_Abstract' => $baseDir . '/application/controllers/ajax/handler/abstract.php',
701
  'Types_Ajax_Handler_Check_Slug_Conflicts' => $baseDir . '/application/controllers/ajax/handler/check_slug_conflicts.php',
@@ -848,14 +870,12 @@ return array(
848
  'WPToolset_Field_Wysiwyg' => $vendorDir . '/toolset/toolset-common/toolset-forms/classes/class.wysiwyg.php',
849
  'WPToolset_Forms_Bootstrap' => $vendorDir . '/toolset/toolset-common/toolset-forms/bootstrap.php',
850
  'WPToolset_Forms_Conditional' => $vendorDir . '/toolset/toolset-common/toolset-forms/classes/class.conditional.php',
 
851
  'WPToolset_Forms_Repetitive' => $vendorDir . '/toolset/toolset-common/toolset-forms/classes/class.repetitive.php',
852
  'WPToolset_Forms_Validation' => $vendorDir . '/toolset/toolset-common/toolset-forms/classes/class.validation.php',
853
  'WPToolset_Types' => $vendorDir . '/toolset/toolset-common/toolset-forms/classes/class.types.php',
854
  'WPV_Handle_Users_Functions' => $vendorDir . '/toolset/toolset-common/toolset-forms/classes/class.conditional.php',
855
  'WPV_wpcf_switch_post_from_attr_id' => $vendorDir . '/toolset/toolset-common/inc/toolset.object.relationship.class.php',
856
- 'WP_Installer' => $vendorDir . '/otgs/installer/includes/class-wp-installer.php',
857
- 'WP_Installer_API' => $vendorDir . '/otgs/installer/includes/class-wp-installer-api.php',
858
- 'WP_Installer_Channels' => $vendorDir . '/otgs/installer/includes/class-wp-installer-channels.php',
859
  'xrstf\\Composer52\\AutoloadGenerator' => $vendorDir . '/xrstf/composer-php52/lib/xrstf/Composer52/AutoloadGenerator.php',
860
  'xrstf\\Composer52\\Generator' => $vendorDir . '/xrstf/composer-php52/lib/xrstf/Composer52/Generator.php',
861
  );
96
  'FieldFactory' => $vendorDir . '/toolset/toolset-common/toolset-forms/classes/class.field_factory.php',
97
  'FormAbstract' => $vendorDir . '/toolset/toolset-common/toolset-forms/classes/abstract.form.php',
98
  'FormFactory' => $vendorDir . '/toolset/toolset-common/toolset-forms/classes/class.form_factory.php',
 
99
  'IToolset_Association' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/interface.php',
100
  'IToolset_Association_Query_Condition' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/interface.php',
101
  'IToolset_Association_Query_Element_Selector' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/element_selector/interface.php',
110
  'IToolset_Post_Type_From_Types' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/post_type/i_post_type_from_types.php',
111
  'IToolset_Post_Type_Registered' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/post_type/i_post_type_registered.php',
112
  'IToolset_Potential_Association_Query' => $vendorDir . '/toolset/toolset-common/inc/m2m/potential_association/query_interface.php',
 
113
  'IToolset_Query_Condition' => $vendorDir . '/toolset/toolset-common/inc/m2m/query/condition/interface.php',
114
  'IToolset_Relationship_Database_Issue' => $vendorDir . '/toolset/toolset-common/inc/m2m/database/issue/interface.php',
115
  'IToolset_Relationship_Definition' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/definition/interface.php',
119
  'IToolset_Relationship_Role' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/role/interface.php',
120
  'IToolset_Relationship_Role_Parent_Child' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/role/parent_child_interface.php',
121
  'IToolset_Upgrade_Command' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/upgrade/command_interface.php',
122
+ 'OTGS\\Toolset\\Common\\Condition\\Installer\\IsAvailable' => $vendorDir . '/toolset/toolset-common/utility/condition/plugin/installer/is_available.php',
123
+ 'OTGS\\Toolset\\Common\\Condition\\Installer\\IsToolsetSubscriptionValid' => $vendorDir . '/toolset/toolset-common/utility/condition/plugin/installer/is_toolset_subscription_valid.php',
124
+ 'OTGS\\Toolset\\Common\\Interop\\HandlerInterface' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/interop/handler_interface.php',
125
+ 'OTGS\\Toolset\\Common\\Interop\\Handler\\InstallerCompatibilityReporting' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/interop/handler/installer_compatibility_reporting.php',
126
+ 'OTGS\\Toolset\\Common\\Interop\\Mediator' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/interop/mediator.php',
127
+ 'OTGS\\Toolset\\Common\\M2M\\Association\\Repository' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/Repository.php',
128
+ 'OTGS\\Toolset\\Common\\M2M\\PotentialAssociation\\CardinalityPostQuery' => $vendorDir . '/toolset/toolset-common/inc/m2m/potential_association/cardinality_post_query.php',
129
+ 'OTGS\\Toolset\\Common\\M2M\\PotentialAssociation\\JoinManager' => $vendorDir . '/toolset/toolset-common/inc/m2m/potential_association/join_manager.php',
130
+ 'OTGS\\Toolset\\Common\\M2M\\PotentialAssociation\\WpQueryAdjustment' => $vendorDir . '/toolset/toolset-common/inc/m2m/potential_association/wp_query_adjustment.php',
131
+ 'OTGS\\Toolset\\Common\\M2M\\PublicApiService' => $vendorDir . '/toolset/toolset-common/inc/m2m/public_api_service.php',
132
+ 'OTGS\\Toolset\\Common\\MaintenanceMode\\Controller' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/maintenance_mode/controller.php',
133
+ 'OTGS\\Toolset\\Common\\Utility\\Admin\\Notices\\Builder' => $vendorDir . '/toolset/toolset-common/utility/admin/notices/Builder.php',
 
 
 
 
134
  'ReCaptchaResponse' => $vendorDir . '/toolset/toolset-common/toolset-forms/js/recaptcha-php-1.11/recaptchalib.php',
135
  'Toolset_Admin_Bar_Menu' => $vendorDir . '/toolset/toolset-common/inc/toolset.admin.bar.menu.class.php',
136
  'Toolset_Admin_Controller' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/admin.php',
154
  'Toolset_Ajax_Handler_Interface' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/ajax_handler/interface.php',
155
  'Toolset_Ajax_Handler_Intermediary_Post_Cleanup' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/ajax_handler/intermediary_post_cleanup.php',
156
  'Toolset_Ajax_Handler_Migrate_To_M2M' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/ajax_handler/migrate_to_m2m.php',
157
+ 'Toolset_Ajax_Handler_Select2_Suggest_Posts_By_Post_Type' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/ajax_handler/select2_suggest_posts_by_post_type.php',
158
  'Toolset_Ajax_Handler_Select2_Suggest_Posts_By_Title' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/ajax_handler/select2_suggest_posts_by_title.php',
159
  'Toolset_Ajax_Handler_Select2_Suggest_Terms' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/ajax_handler/select2_suggest_terms.php',
160
  'Toolset_Ajax_Handler_Select2_Suggest_Users' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/ajax_handler/select2_suggest_users.php',
168
  'Toolset_Association_Cleanup_Dangling_Intermediary_Posts' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/cleanup/dangling_intermediary_posts.php',
169
  'Toolset_Association_Cleanup_Factory' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/cleanup/factory.php',
170
  'Toolset_Association_Cleanup_Post' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/cleanup/post.php',
171
+ 'Toolset_Association_Cleanup_Post_Type' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/cleanup/post_type.php',
172
  'Toolset_Association_Cleanup_Troubleshooting_Section' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/cleanup/troubleshooting_section.php',
173
  'Toolset_Association_Factory' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/factory.php',
174
  'Toolset_Association_Intermediary_Post_Persistence' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/intermediary_post_persistence.php',
181
  'Toolset_Association_Query_Condition_Element_Status' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/element_status.php',
182
  'Toolset_Association_Query_Condition_Empty_Intermediary' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/empty_intermediary.php',
183
  'Toolset_Association_Query_Condition_Exclude_Element' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/exclude_element.php',
184
+ 'Toolset_Association_Query_Condition_Exclude_Relationship' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/exclude_relationship.php',
185
  'Toolset_Association_Query_Condition_Factory' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition_factory.php',
186
  'Toolset_Association_Query_Condition_Has_Active_Relationship' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/has_active_relationship.php',
187
  'Toolset_Association_Query_Condition_Has_Domain' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/has_domain.php',
188
  'Toolset_Association_Query_Condition_Has_Domain_And_Type' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/has_domain_and_type.php',
189
+ 'Toolset_Association_Query_Condition_Has_Intermediary_Id' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/has_intermediary_id.php',
190
  'Toolset_Association_Query_Condition_Has_Legacy_Relationship' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/has_legacy_relationship.php',
191
  'Toolset_Association_Query_Condition_Has_Type' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/has_type.php',
192
+ 'Toolset_Association_Query_Condition_Intermediary_Id' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/intermediary_id.php',
193
  'Toolset_Association_Query_Condition_Postmeta' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/postmeta.php',
194
  'Toolset_Association_Query_Condition_Relationship_Flag' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/relationship_flag.php',
195
  'Toolset_Association_Query_Condition_Relationship_Id' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/relationship_id.php',
196
+ 'Toolset_Association_Query_Condition_Relationship_Origin' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/relationship_origin.php',
197
  'Toolset_Association_Query_Condition_Search' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/search.php',
198
  'Toolset_Association_Query_Condition_Wp_Query' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/condition/wp_query.php',
199
  'Toolset_Association_Query_Element_Selector_Abstract' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/element_selector/abstract.php',
200
  'Toolset_Association_Query_Element_Selector_Default' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/element_selector/default.php',
201
  'Toolset_Association_Query_Element_Selector_Provider' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/element_selector/provider.php',
202
  'Toolset_Association_Query_Element_Selector_Wpml' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/element_selector/wpml.php',
203
+ 'Toolset_Association_Query_Element_Selector_Wpml_Lang_All' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/element_selector/wpml_lang_all.php',
204
  'Toolset_Association_Query_Orderby' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/orderby/abstract.php',
205
  'Toolset_Association_Query_Orderby_Factory' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/orderby_factory.php',
206
  'Toolset_Association_Query_Orderby_Nothing' => $vendorDir . '/toolset/toolset-common/inc/m2m/association/query/orderby/nothing.php',
317
  'Toolset_Field_Renderer_Preview_Date' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/date.php',
318
  'Toolset_Field_Renderer_Preview_File' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/file.php',
319
  'Toolset_Field_Renderer_Preview_Image' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/image.php',
320
+ 'Toolset_Field_Renderer_Preview_Post' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/post.php',
321
  'Toolset_Field_Renderer_Preview_Radio' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/radio.php',
322
  'Toolset_Field_Renderer_Preview_Skype' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/skype.php',
323
  'Toolset_Field_Renderer_Preview_Textfield' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/textfield.php',
360
  'Toolset_Post_Type_Factory' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/post_type/factory.php',
361
  'Toolset_Post_Type_From_Types' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/post_type/from_types.php',
362
  'Toolset_Post_Type_Labels' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/post_type/labels.php',
363
+ 'Toolset_Post_Type_List' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/post_type/list.php',
364
  'Toolset_Post_Type_Query' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/post_type/query.php',
365
  'Toolset_Post_Type_Query_Factory' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/post_type/query_factory.php',
366
  'Toolset_Post_Type_Registered' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/post_type/registered.php',
367
  'Toolset_Post_Type_Repository' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/post_type/repository.php',
368
+ 'Toolset_Postmeta_Access_Loader' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/postmeta_access/loader.php',
369
+ 'Toolset_Postmeta_Access_M2m' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/postmeta_access/m2m.php',
370
+ 'Toolset_Potential_Association_Query_Arguments' => $vendorDir . '/toolset/toolset-common/inc/m2m/potential_association/query_arguments.php',
371
  'Toolset_Potential_Association_Query_Factory' => $vendorDir . '/toolset/toolset-common/inc/m2m/potential_association/query_factory.php',
372
+ 'Toolset_Potential_Association_Query_Filter_Interface' => $vendorDir . '/toolset/toolset-common/inc/m2m/potential_association/filters/interface.php',
373
+ 'Toolset_Potential_Association_Query_Filter_Posts_Author' => $vendorDir . '/toolset/toolset-common/inc/m2m/potential_association/filters/post/author.php',
374
+ 'Toolset_Potential_Association_Query_Filter_Search_String' => $vendorDir . '/toolset/toolset-common/inc/m2m/potential_association/filters/search_string.php',
375
  'Toolset_Potential_Association_Query_Posts' => $vendorDir . '/toolset/toolset-common/inc/m2m/potential_association/query_posts.php',
376
  'Toolset_Promotion' => $vendorDir . '/toolset/toolset-common/inc/toolset.promotion.class.php',
377
  'Toolset_Public_API_Loader' => $vendorDir . '/toolset/toolset-common/inc/public_api/loader.php',
378
  'Toolset_Query_Comparison_Operator' => $vendorDir . '/toolset/toolset-common/inc/m2m/query/comparison_operator.php',
379
  'Toolset_Query_Condition_And' => $vendorDir . '/toolset/toolset-common/inc/m2m/query/condition/and.php',
380
  'Toolset_Query_Condition_Contradiction' => $vendorDir . '/toolset/toolset-common/inc/m2m/query/condition/contradiction.php',
381
+ 'Toolset_Query_Condition_Not' => $vendorDir . '/toolset/toolset-common/inc/m2m/query/condition/not.php',
382
  'Toolset_Query_Condition_Operator' => $vendorDir . '/toolset/toolset-common/inc/m2m/query/condition/operator.php',
383
  'Toolset_Query_Condition_Or' => $vendorDir . '/toolset/toolset-common/inc/m2m/query/condition/or.php',
384
  'Toolset_Query_Condition_Tautology' => $vendorDir . '/toolset/toolset-common/inc/m2m/query/condition/tautology.php',
412
  'Toolset_Relationship_Query_Cardinality_Match_Operators' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/query/cardinality_match/operators.php',
413
  'Toolset_Relationship_Query_Cardinality_Match_Single' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/query/cardinality_match/single.php',
414
  'Toolset_Relationship_Query_Condition' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/query/condition/abstract.php',
415
+ 'Toolset_Relationship_Query_Condition_Exclude_Relationship' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/query/condition/exclude_relationship.php',
416
+ 'Toolset_Relationship_Query_Condition_Exclude_Type' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/query/condition/exclude_type.php',
417
  'Toolset_Relationship_Query_Condition_Factory' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/query/condition_factory.php',
418
  'Toolset_Relationship_Query_Condition_Has_Active_Types' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/query/condition/has_active_types.php',
419
  'Toolset_Relationship_Query_Condition_Has_Cardinality' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/query/condition/has_cardinality.php',
420
  'Toolset_Relationship_Query_Condition_Has_Domain' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/query/condition/has_domain.php',
421
+ 'Toolset_Relationship_Query_Condition_Intermediary_Type' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/query/condition/intermediary_type.php',
422
  'Toolset_Relationship_Query_Condition_Is_Active' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/query/condition/is_active.php',
423
  'Toolset_Relationship_Query_Condition_Is_Boolean_Flag' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/query/condition/is_boolean_flag.php',
424
  'Toolset_Relationship_Query_Condition_Is_Legacy' => $vendorDir . '/toolset/toolset-common/inc/m2m/relationship/query/condition/is_legacy.php',
447
  'Toolset_Settings_Screen' => $vendorDir . '/toolset/toolset-common/inc/toolset.settings.screen.class.php',
448
  'Toolset_Shortcode_Attr_Field' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/field.php',
449
  'Toolset_Shortcode_Attr_Interface' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/interface.php',
450
+ 'Toolset_Shortcode_Attr_Item_Gui_Base' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/gui/base.php',
451
+ 'Toolset_Shortcode_Attr_Item_Gui_Factory' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/gui/factory.php',
452
+ 'Toolset_Shortcode_Attr_Item_Gui_M2m' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/gui/m2m.php',
453
+ 'Toolset_Shortcode_Attr_Item_Gui_O2m' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/gui/o2m.php',
454
+ 'Toolset_Shortcode_Attr_Item_Gui_O2o' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/gui/o2o.php',
455
+ 'Toolset_Shortcode_Attr_Item_Gui_Option' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/gui/option.php',
456
  'Toolset_Shortcode_Attr_Item_Id' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/id.php',
457
  'Toolset_Shortcode_Attr_Item_Legacy' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/legacy.php',
458
  'Toolset_Shortcode_Attr_Item_M2M' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/m2m.php',
459
  'Toolset_Shortcode_Generator' => $vendorDir . '/toolset/toolset-common/inc/toolset.shortcode.generator.class.php',
460
  'Toolset_Shortcode_Transformer' => $vendorDir . '/toolset/toolset-common/inc/toolset.shortcode.transformer.class.php',
461
+ 'Toolset_Singleton_Factory' => $vendorDir . '/toolset/toolset-common/utility/singleton_factory_pre_php_5_6.php',
462
  'Toolset_Stack' => $vendorDir . '/toolset/toolset-common/expression-parser/parser.php',
463
  'Toolset_Style' => $vendorDir . '/toolset/toolset-common/inc/toolset.assets.manager.class.php',
464
  'Toolset_Template_Dialog_Box' => $vendorDir . '/toolset/toolset-common/utility/gui-base/template_dialog_box.php',
469
  'Toolset_Twig_Extensions' => $vendorDir . '/toolset/toolset-common/utility/gui-base/twig_extensions.php',
470
  'Toolset_Upgrade_Command_Definition' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/upgrade/command_definition.php',
471
  'Toolset_Upgrade_Command_Definition_Repository' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/upgrade/command_definition_repository.php',
472
+ 'Toolset_Upgrade_Command_Delete_Obsolete_Upgrade_Options' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/upgrade/command/delete_obsolete_version_number_option.php',
473
  'Toolset_Upgrade_Command_Factory' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/upgrade/command_factory.php',
474
  'Toolset_Upgrade_Command_M2M_V1_Database_Structure_Upgrade' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/upgrade/command/m2m_v1_database_structure_upgrade.php',
475
+ 'Toolset_Upgrade_Command_M2M_V2_Database_Structure_Upgrade' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/upgrade/command/m2m_v2_database_structure_upgrade.php',
476
  'Toolset_Upgrade_Controller' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/upgrade/controller.php',
477
  'Toolset_Upgrade_Executed_Commands' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/upgrade/executed_commands.php',
478
  'Toolset_User_Editors_Editor_Abstract' => $vendorDir . '/toolset/toolset-common/user-editors/editor/abstract.php',
518
  'Toolset_Wp_Query_Adjustments_Table_Join_Manager' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/wp_query_adjustments/table_join_manager.php',
519
  'Toolset_Wpdb_User' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/wpdb_user.php',
520
  'Toolset_Wpml_Utils' => $vendorDir . '/toolset/toolset-common/inc/autoloaded/wpml_utils.php',
 
521
  'Twig_Autoloader' => $vendorDir . '/twig/twig/lib/Twig/Autoloader.php',
522
  'Twig_BaseNodeVisitor' => $vendorDir . '/twig/twig/lib/Twig/BaseNodeVisitor.php',
523
  'Twig_CacheInterface' => $vendorDir . '/twig/twig/lib/Twig/CacheInterface.php',
717
  'Twig_Util_TemplateDirIterator' => $vendorDir . '/twig/twig/lib/Twig/Util/TemplateDirIterator.php',
718
  'Types_Admin' => $baseDir . '/application/controllers/admin.php',
719
  'Types_Admin_Menu' => $baseDir . '/application/controllers/admin_menu.php',
720
+ 'Types_Admin_Notices_Free_Version' => $baseDir . '/application/controllers/admin_notice/free-version.php',
721
  'Types_Ajax' => $baseDir . '/application/controllers/ajax.php',
722
  'Types_Ajax_Handler_Abstract' => $baseDir . '/application/controllers/ajax/handler/abstract.php',
723
  'Types_Ajax_Handler_Check_Slug_Conflicts' => $baseDir . '/application/controllers/ajax/handler/check_slug_conflicts.php',
870
  'WPToolset_Field_Wysiwyg' => $vendorDir . '/toolset/toolset-common/toolset-forms/classes/class.wysiwyg.php',
871
  'WPToolset_Forms_Bootstrap' => $vendorDir . '/toolset/toolset-common/toolset-forms/bootstrap.php',
872
  'WPToolset_Forms_Conditional' => $vendorDir . '/toolset/toolset-common/toolset-forms/classes/class.conditional.php',
873
+ 'WPToolset_Forms_Conditional_RFG' => $vendorDir . '/toolset/toolset-common/toolset-forms/classes/class.conditional.rfg.php',
874
  'WPToolset_Forms_Repetitive' => $vendorDir . '/toolset/toolset-common/toolset-forms/classes/class.repetitive.php',
875
  'WPToolset_Forms_Validation' => $vendorDir . '/toolset/toolset-common/toolset-forms/classes/class.validation.php',
876
  'WPToolset_Types' => $vendorDir . '/toolset/toolset-common/toolset-forms/classes/class.types.php',
877
  'WPV_Handle_Users_Functions' => $vendorDir . '/toolset/toolset-common/toolset-forms/classes/class.conditional.php',
878
  'WPV_wpcf_switch_post_from_attr_id' => $vendorDir . '/toolset/toolset-common/inc/toolset.object.relationship.class.php',
 
 
 
879
  'xrstf\\Composer52\\AutoloadGenerator' => $vendorDir . '/xrstf/composer-php52/lib/xrstf/Composer52/AutoloadGenerator.php',
880
  'xrstf\\Composer52\\Generator' => $vendorDir . '/xrstf/composer-php52/lib/xrstf/Composer52/Generator.php',
881
  );
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitb4ac95941783ab1f27185069ef17cdb2
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInitb4ac95941783ab1f27185069ef17cdb2
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInitb4ac95941783ab1f27185069ef17cdb2', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInitb4ac95941783ab1f27185069ef17cdb2', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
- call_user_func(\Composer\Autoload\ComposerStaticInitb4ac95941783ab1f27185069ef17cdb2::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
@@ -48,19 +48,19 @@ class ComposerAutoloaderInitb4ac95941783ab1f27185069ef17cdb2
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
- $includeFiles = Composer\Autoload\ComposerStaticInitb4ac95941783ab1f27185069ef17cdb2::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
- composerRequireb4ac95941783ab1f27185069ef17cdb2($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
- function composerRequireb4ac95941783ab1f27185069ef17cdb2($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit3ef203360daf9a3f27f03c8cdcceee49
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit3ef203360daf9a3f27f03c8cdcceee49', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit3ef203360daf9a3f27f03c8cdcceee49', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit3ef203360daf9a3f27f03c8cdcceee49::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
+ $includeFiles = Composer\Autoload\ComposerStaticInit3ef203360daf9a3f27f03c8cdcceee49::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
+ composerRequire3ef203360daf9a3f27f03c8cdcceee49($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
+ function composerRequire3ef203360daf9a3f27f03c8cdcceee49($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInitb4ac95941783ab1f27185069ef17cdb2
8
  {
9
  public static $files = array (
10
  'a52c1eba913b4ecdd3571194b37baea9' => __DIR__ . '/../..' . '/application/functions.php',
@@ -132,7 +132,6 @@ class ComposerStaticInitb4ac95941783ab1f27185069ef17cdb2
132
  'FieldFactory' => __DIR__ . '/..' . '/toolset/toolset-common/toolset-forms/classes/class.field_factory.php',
133
  'FormAbstract' => __DIR__ . '/..' . '/toolset/toolset-common/toolset-forms/classes/abstract.form.php',
134
  'FormFactory' => __DIR__ . '/..' . '/toolset/toolset-common/toolset-forms/classes/class.form_factory.php',
135
- 'IOTGS_Installer_Template_Service' => __DIR__ . '/..' . '/otgs/installer/templates/template-service/interface-iotgs-installer-template-service.php',
136
  'IToolset_Association' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/interface.php',
137
  'IToolset_Association_Query_Condition' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/interface.php',
138
  'IToolset_Association_Query_Element_Selector' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/element_selector/interface.php',
@@ -147,7 +146,6 @@ class ComposerStaticInitb4ac95941783ab1f27185069ef17cdb2
147
  'IToolset_Post_Type_From_Types' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/post_type/i_post_type_from_types.php',
148
  'IToolset_Post_Type_Registered' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/post_type/i_post_type_registered.php',
149
  'IToolset_Potential_Association_Query' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/potential_association/query_interface.php',
150
- 'IToolset_Query' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/i_query.php',
151
  'IToolset_Query_Condition' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/query/condition/interface.php',
152
  'IToolset_Relationship_Database_Issue' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/database/issue/interface.php',
153
  'IToolset_Relationship_Definition' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/definition/interface.php',
@@ -157,22 +155,18 @@ class ComposerStaticInitb4ac95941783ab1f27185069ef17cdb2
157
  'IToolset_Relationship_Role' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/role/interface.php',
158
  'IToolset_Relationship_Role_Parent_Child' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/role/parent_child_interface.php',
159
  'IToolset_Upgrade_Command' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/upgrade/command_interface.php',
160
- 'Installer_Dependencies' => __DIR__ . '/..' . '/otgs/installer/includes/class-installer-dependencies.php',
161
- 'Installer_Theme_Class' => __DIR__ . '/..' . '/otgs/installer/includes/class-installer-theme.php',
162
- 'Installer_Upgrader_Skins' => __DIR__ . '/..' . '/otgs/installer/includes/class-installer-upgrader-skins.php',
163
- 'OTGS_Installer_Filename_Hooks' => __DIR__ . '/..' . '/otgs/installer/includes/class-otgs-installer-filename-hooks.php',
164
- 'OTGS_Installer_Icons' => __DIR__ . '/..' . '/otgs/installer/includes/class-otgs-installer-icons.php',
165
- 'OTGS_Installer_PHP_Functions' => __DIR__ . '/..' . '/otgs/installer/includes/class-otgs-installer-php-functions.php',
166
- 'OTGS_Installer_Plugins_Page_Notice' => __DIR__ . '/..' . '/otgs/installer/includes/class-otgs-installer-plugins-page-notice.php',
167
- 'OTGS_Installer_Twig_Template_Service' => __DIR__ . '/..' . '/otgs/installer/templates/template-service/class-otgs-installer-twig-template-service.php',
168
- 'OTGS_Installer_Twig_Template_Service_Loader' => __DIR__ . '/..' . '/otgs/installer/templates/template-service/class-otgs-installer-twig-template-service-loader.php',
169
- 'OTGS_Installer_WP_Components_Hooks' => __DIR__ . '/..' . '/otgs/installer/includes/class-otgs-installer-wp-components-hooks.php',
170
- 'OTGS_Installer_WP_Components_Sender' => __DIR__ . '/..' . '/otgs/installer/includes/class-otgs-installer-wp-components-sender.php',
171
- 'OTGS_Installer_WP_Components_Setting_Ajax' => __DIR__ . '/..' . '/otgs/installer/includes/class-otgs-installer-wp-components-setting-ajax.php',
172
- 'OTGS_Installer_WP_Components_Setting_Resources' => __DIR__ . '/..' . '/otgs/installer/includes/class-otgs-installer-wp-components-setting-resources.php',
173
- 'OTGS_Installer_WP_Components_Setting_Templates' => __DIR__ . '/..' . '/otgs/installer/includes/class-otgs-installer-wp-components-setting-templates.php',
174
- 'OTGS_Installer_WP_Components_Storage' => __DIR__ . '/..' . '/otgs/installer/includes/class-otgs-installer-wp-components-storage.php',
175
- 'OTGS_Installer_WP_Share_Local_Components_Setting' => __DIR__ . '/..' . '/otgs/installer/includes/class-otgs-installer-wp-share-local-components-setting.php',
176
  'ReCaptchaResponse' => __DIR__ . '/..' . '/toolset/toolset-common/toolset-forms/js/recaptcha-php-1.11/recaptchalib.php',
177
  'Toolset_Admin_Bar_Menu' => __DIR__ . '/..' . '/toolset/toolset-common/inc/toolset.admin.bar.menu.class.php',
178
  'Toolset_Admin_Controller' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/admin.php',
@@ -196,6 +190,7 @@ class ComposerStaticInitb4ac95941783ab1f27185069ef17cdb2
196
  'Toolset_Ajax_Handler_Interface' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/ajax_handler/interface.php',
197
  'Toolset_Ajax_Handler_Intermediary_Post_Cleanup' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/ajax_handler/intermediary_post_cleanup.php',
198
  'Toolset_Ajax_Handler_Migrate_To_M2M' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/ajax_handler/migrate_to_m2m.php',
 
199
  'Toolset_Ajax_Handler_Select2_Suggest_Posts_By_Title' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/ajax_handler/select2_suggest_posts_by_title.php',
200
  'Toolset_Ajax_Handler_Select2_Suggest_Terms' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/ajax_handler/select2_suggest_terms.php',
201
  'Toolset_Ajax_Handler_Select2_Suggest_Users' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/ajax_handler/select2_suggest_users.php',
@@ -209,6 +204,7 @@ class ComposerStaticInitb4ac95941783ab1f27185069ef17cdb2
209
  'Toolset_Association_Cleanup_Dangling_Intermediary_Posts' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/cleanup/dangling_intermediary_posts.php',
210
  'Toolset_Association_Cleanup_Factory' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/cleanup/factory.php',
211
  'Toolset_Association_Cleanup_Post' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/cleanup/post.php',
 
212
  'Toolset_Association_Cleanup_Troubleshooting_Section' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/cleanup/troubleshooting_section.php',
213
  'Toolset_Association_Factory' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/factory.php',
214
  'Toolset_Association_Intermediary_Post_Persistence' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/intermediary_post_persistence.php',
@@ -221,21 +217,26 @@ class ComposerStaticInitb4ac95941783ab1f27185069ef17cdb2
221
  'Toolset_Association_Query_Condition_Element_Status' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/element_status.php',
222
  'Toolset_Association_Query_Condition_Empty_Intermediary' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/empty_intermediary.php',
223
  'Toolset_Association_Query_Condition_Exclude_Element' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/exclude_element.php',
 
224
  'Toolset_Association_Query_Condition_Factory' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition_factory.php',
225
  'Toolset_Association_Query_Condition_Has_Active_Relationship' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/has_active_relationship.php',
226
  'Toolset_Association_Query_Condition_Has_Domain' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/has_domain.php',
227
  'Toolset_Association_Query_Condition_Has_Domain_And_Type' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/has_domain_and_type.php',
 
228
  'Toolset_Association_Query_Condition_Has_Legacy_Relationship' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/has_legacy_relationship.php',
229
  'Toolset_Association_Query_Condition_Has_Type' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/has_type.php',
 
230
  'Toolset_Association_Query_Condition_Postmeta' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/postmeta.php',
231
  'Toolset_Association_Query_Condition_Relationship_Flag' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/relationship_flag.php',
232
  'Toolset_Association_Query_Condition_Relationship_Id' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/relationship_id.php',
 
233
  'Toolset_Association_Query_Condition_Search' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/search.php',
234
  'Toolset_Association_Query_Condition_Wp_Query' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/wp_query.php',
235
  'Toolset_Association_Query_Element_Selector_Abstract' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/element_selector/abstract.php',
236
  'Toolset_Association_Query_Element_Selector_Default' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/element_selector/default.php',
237
  'Toolset_Association_Query_Element_Selector_Provider' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/element_selector/provider.php',
238
  'Toolset_Association_Query_Element_Selector_Wpml' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/element_selector/wpml.php',
 
239
  'Toolset_Association_Query_Orderby' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/orderby/abstract.php',
240
  'Toolset_Association_Query_Orderby_Factory' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/orderby_factory.php',
241
  'Toolset_Association_Query_Orderby_Nothing' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/orderby/nothing.php',
@@ -352,6 +353,7 @@ class ComposerStaticInitb4ac95941783ab1f27185069ef17cdb2
352
  'Toolset_Field_Renderer_Preview_Date' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/date.php',
353
  'Toolset_Field_Renderer_Preview_File' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/file.php',
354
  'Toolset_Field_Renderer_Preview_Image' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/image.php',
 
355
  'Toolset_Field_Renderer_Preview_Radio' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/radio.php',
356
  'Toolset_Field_Renderer_Preview_Skype' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/skype.php',
357
  'Toolset_Field_Renderer_Preview_Textfield' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/textfield.php',
@@ -394,17 +396,25 @@ class ComposerStaticInitb4ac95941783ab1f27185069ef17cdb2
394
  'Toolset_Post_Type_Factory' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/post_type/factory.php',
395
  'Toolset_Post_Type_From_Types' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/post_type/from_types.php',
396
  'Toolset_Post_Type_Labels' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/post_type/labels.php',
 
397
  'Toolset_Post_Type_Query' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/post_type/query.php',
398
  'Toolset_Post_Type_Query_Factory' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/post_type/query_factory.php',
399
  'Toolset_Post_Type_Registered' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/post_type/registered.php',
400
  'Toolset_Post_Type_Repository' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/post_type/repository.php',
 
 
 
401
  'Toolset_Potential_Association_Query_Factory' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/potential_association/query_factory.php',
 
 
 
402
  'Toolset_Potential_Association_Query_Posts' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/potential_association/query_posts.php',
403
  'Toolset_Promotion' => __DIR__ . '/..' . '/toolset/toolset-common/inc/toolset.promotion.class.php',
404
  'Toolset_Public_API_Loader' => __DIR__ . '/..' . '/toolset/toolset-common/inc/public_api/loader.php',
405
  'Toolset_Query_Comparison_Operator' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/query/comparison_operator.php',
406
  'Toolset_Query_Condition_And' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/query/condition/and.php',
407
  'Toolset_Query_Condition_Contradiction' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/query/condition/contradiction.php',
 
408
  'Toolset_Query_Condition_Operator' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/query/condition/operator.php',
409
  'Toolset_Query_Condition_Or' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/query/condition/or.php',
410
  'Toolset_Query_Condition_Tautology' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/query/condition/tautology.php',
@@ -438,10 +448,13 @@ class ComposerStaticInitb4ac95941783ab1f27185069ef17cdb2
438
  'Toolset_Relationship_Query_Cardinality_Match_Operators' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/query/cardinality_match/operators.php',
439
  'Toolset_Relationship_Query_Cardinality_Match_Single' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/query/cardinality_match/single.php',
440
  'Toolset_Relationship_Query_Condition' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/query/condition/abstract.php',
 
 
441
  'Toolset_Relationship_Query_Condition_Factory' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/query/condition_factory.php',
442
  'Toolset_Relationship_Query_Condition_Has_Active_Types' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/query/condition/has_active_types.php',
443
  'Toolset_Relationship_Query_Condition_Has_Cardinality' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/query/condition/has_cardinality.php',
444
  'Toolset_Relationship_Query_Condition_Has_Domain' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/query/condition/has_domain.php',
 
445
  'Toolset_Relationship_Query_Condition_Is_Active' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/query/condition/is_active.php',
446
  'Toolset_Relationship_Query_Condition_Is_Boolean_Flag' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/query/condition/is_boolean_flag.php',
447
  'Toolset_Relationship_Query_Condition_Is_Legacy' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/query/condition/is_legacy.php',
@@ -470,11 +483,18 @@ class ComposerStaticInitb4ac95941783ab1f27185069ef17cdb2
470
  'Toolset_Settings_Screen' => __DIR__ . '/..' . '/toolset/toolset-common/inc/toolset.settings.screen.class.php',
471
  'Toolset_Shortcode_Attr_Field' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/field.php',
472
  'Toolset_Shortcode_Attr_Interface' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/interface.php',
 
 
 
 
 
 
473
  'Toolset_Shortcode_Attr_Item_Id' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/id.php',
474
  'Toolset_Shortcode_Attr_Item_Legacy' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/legacy.php',
475
  'Toolset_Shortcode_Attr_Item_M2M' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/m2m.php',
476
  'Toolset_Shortcode_Generator' => __DIR__ . '/..' . '/toolset/toolset-common/inc/toolset.shortcode.generator.class.php',
477
  'Toolset_Shortcode_Transformer' => __DIR__ . '/..' . '/toolset/toolset-common/inc/toolset.shortcode.transformer.class.php',
 
478
  'Toolset_Stack' => __DIR__ . '/..' . '/toolset/toolset-common/expression-parser/parser.php',
479
  'Toolset_Style' => __DIR__ . '/..' . '/toolset/toolset-common/inc/toolset.assets.manager.class.php',
480
  'Toolset_Template_Dialog_Box' => __DIR__ . '/..' . '/toolset/toolset-common/utility/gui-base/template_dialog_box.php',
@@ -485,8 +505,10 @@ class ComposerStaticInitb4ac95941783ab1f27185069ef17cdb2
485
  'Toolset_Twig_Extensions' => __DIR__ . '/..' . '/toolset/toolset-common/utility/gui-base/twig_extensions.php',
486
  'Toolset_Upgrade_Command_Definition' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/upgrade/command_definition.php',
487
  'Toolset_Upgrade_Command_Definition_Repository' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/upgrade/command_definition_repository.php',
 
488
  'Toolset_Upgrade_Command_Factory' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/upgrade/command_factory.php',
489
  'Toolset_Upgrade_Command_M2M_V1_Database_Structure_Upgrade' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/upgrade/command/m2m_v1_database_structure_upgrade.php',
 
490
  'Toolset_Upgrade_Controller' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/upgrade/controller.php',
491
  'Toolset_Upgrade_Executed_Commands' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/upgrade/executed_commands.php',
492
  'Toolset_User_Editors_Editor_Abstract' => __DIR__ . '/..' . '/toolset/toolset-common/user-editors/editor/abstract.php',
@@ -532,7 +554,6 @@ class ComposerStaticInitb4ac95941783ab1f27185069ef17cdb2
532
  'Toolset_Wp_Query_Adjustments_Table_Join_Manager' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/wp_query_adjustments/table_join_manager.php',
533
  'Toolset_Wpdb_User' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/wpdb_user.php',
534
  'Toolset_Wpml_Utils' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/wpml_utils.php',
535
- 'Translation_Service_Info' => __DIR__ . '/..' . '/otgs/installer/includes/class-translation-service-info.php',
536
  'Twig_Autoloader' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Autoloader.php',
537
  'Twig_BaseNodeVisitor' => __DIR__ . '/..' . '/twig/twig/lib/Twig/BaseNodeVisitor.php',
538
  'Twig_CacheInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/CacheInterface.php',
@@ -732,6 +753,7 @@ class ComposerStaticInitb4ac95941783ab1f27185069ef17cdb2
732
  'Twig_Util_TemplateDirIterator' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Util/TemplateDirIterator.php',
733
  'Types_Admin' => __DIR__ . '/../..' . '/application/controllers/admin.php',
734
  'Types_Admin_Menu' => __DIR__ . '/../..' . '/application/controllers/admin_menu.php',
 
735
  'Types_Ajax' => __DIR__ . '/../..' . '/application/controllers/ajax.php',
736
  'Types_Ajax_Handler_Abstract' => __DIR__ . '/../..' . '/application/controllers/ajax/handler/abstract.php',
737
  'Types_Ajax_Handler_Check_Slug_Conflicts' => __DIR__ . '/../..' . '/application/controllers/ajax/handler/check_slug_conflicts.php',
@@ -884,14 +906,12 @@ class ComposerStaticInitb4ac95941783ab1f27185069ef17cdb2
884
  'WPToolset_Field_Wysiwyg' => __DIR__ . '/..' . '/toolset/toolset-common/toolset-forms/classes/class.wysiwyg.php',
885
  'WPToolset_Forms_Bootstrap' => __DIR__ . '/..' . '/toolset/toolset-common/toolset-forms/bootstrap.php',
886
  'WPToolset_Forms_Conditional' => __DIR__ . '/..' . '/toolset/toolset-common/toolset-forms/classes/class.conditional.php',
 
887
  'WPToolset_Forms_Repetitive' => __DIR__ . '/..' . '/toolset/toolset-common/toolset-forms/classes/class.repetitive.php',
888
  'WPToolset_Forms_Validation' => __DIR__ . '/..' . '/toolset/toolset-common/toolset-forms/classes/class.validation.php',
889
  'WPToolset_Types' => __DIR__ . '/..' . '/toolset/toolset-common/toolset-forms/classes/class.types.php',
890
  'WPV_Handle_Users_Functions' => __DIR__ . '/..' . '/toolset/toolset-common/toolset-forms/classes/class.conditional.php',
891
  'WPV_wpcf_switch_post_from_attr_id' => __DIR__ . '/..' . '/toolset/toolset-common/inc/toolset.object.relationship.class.php',
892
- 'WP_Installer' => __DIR__ . '/..' . '/otgs/installer/includes/class-wp-installer.php',
893
- 'WP_Installer_API' => __DIR__ . '/..' . '/otgs/installer/includes/class-wp-installer-api.php',
894
- 'WP_Installer_Channels' => __DIR__ . '/..' . '/otgs/installer/includes/class-wp-installer-channels.php',
895
  'xrstf\\Composer52\\AutoloadGenerator' => __DIR__ . '/..' . '/xrstf/composer-php52/lib/xrstf/Composer52/AutoloadGenerator.php',
896
  'xrstf\\Composer52\\Generator' => __DIR__ . '/..' . '/xrstf/composer-php52/lib/xrstf/Composer52/Generator.php',
897
  );
@@ -899,10 +919,10 @@ class ComposerStaticInitb4ac95941783ab1f27185069ef17cdb2
899
  public static function getInitializer(ClassLoader $loader)
900
  {
901
  return \Closure::bind(function () use ($loader) {
902
- $loader->prefixLengthsPsr4 = ComposerStaticInitb4ac95941783ab1f27185069ef17cdb2::$prefixLengthsPsr4;
903
- $loader->prefixDirsPsr4 = ComposerStaticInitb4ac95941783ab1f27185069ef17cdb2::$prefixDirsPsr4;
904
- $loader->prefixesPsr0 = ComposerStaticInitb4ac95941783ab1f27185069ef17cdb2::$prefixesPsr0;
905
- $loader->classMap = ComposerStaticInitb4ac95941783ab1f27185069ef17cdb2::$classMap;
906
 
907
  }, null, ClassLoader::class);
908
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit3ef203360daf9a3f27f03c8cdcceee49
8
  {
9
  public static $files = array (
10
  'a52c1eba913b4ecdd3571194b37baea9' => __DIR__ . '/../..' . '/application/functions.php',
132
  'FieldFactory' => __DIR__ . '/..' . '/toolset/toolset-common/toolset-forms/classes/class.field_factory.php',
133
  'FormAbstract' => __DIR__ . '/..' . '/toolset/toolset-common/toolset-forms/classes/abstract.form.php',
134
  'FormFactory' => __DIR__ . '/..' . '/toolset/toolset-common/toolset-forms/classes/class.form_factory.php',
 
135
  'IToolset_Association' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/interface.php',
136
  'IToolset_Association_Query_Condition' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/interface.php',
137
  'IToolset_Association_Query_Element_Selector' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/element_selector/interface.php',
146
  'IToolset_Post_Type_From_Types' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/post_type/i_post_type_from_types.php',
147
  'IToolset_Post_Type_Registered' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/post_type/i_post_type_registered.php',
148
  'IToolset_Potential_Association_Query' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/potential_association/query_interface.php',
 
149
  'IToolset_Query_Condition' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/query/condition/interface.php',
150
  'IToolset_Relationship_Database_Issue' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/database/issue/interface.php',
151
  'IToolset_Relationship_Definition' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/definition/interface.php',
155
  'IToolset_Relationship_Role' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/role/interface.php',
156
  'IToolset_Relationship_Role_Parent_Child' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/role/parent_child_interface.php',
157
  'IToolset_Upgrade_Command' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/upgrade/command_interface.php',
158
+ 'OTGS\\Toolset\\Common\\Condition\\Installer\\IsAvailable' => __DIR__ . '/..' . '/toolset/toolset-common/utility/condition/plugin/installer/is_available.php',
159
+ 'OTGS\\Toolset\\Common\\Condition\\Installer\\IsToolsetSubscriptionValid' => __DIR__ . '/..' . '/toolset/toolset-common/utility/condition/plugin/installer/is_toolset_subscription_valid.php',
160
+ 'OTGS\\Toolset\\Common\\Interop\\HandlerInterface' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/interop/handler_interface.php',
161
+ 'OTGS\\Toolset\\Common\\Interop\\Handler\\InstallerCompatibilityReporting' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/interop/handler/installer_compatibility_reporting.php',
162
+ 'OTGS\\Toolset\\Common\\Interop\\Mediator' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/interop/mediator.php',
163
+ 'OTGS\\Toolset\\Common\\M2M\\Association\\Repository' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/Repository.php',
164
+ 'OTGS\\Toolset\\Common\\M2M\\PotentialAssociation\\CardinalityPostQuery' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/potential_association/cardinality_post_query.php',
165
+ 'OTGS\\Toolset\\Common\\M2M\\PotentialAssociation\\JoinManager' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/potential_association/join_manager.php',
166
+ 'OTGS\\Toolset\\Common\\M2M\\PotentialAssociation\\WpQueryAdjustment' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/potential_association/wp_query_adjustment.php',
167
+ 'OTGS\\Toolset\\Common\\M2M\\PublicApiService' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/public_api_service.php',
168
+ 'OTGS\\Toolset\\Common\\MaintenanceMode\\Controller' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/maintenance_mode/controller.php',
169
+ 'OTGS\\Toolset\\Common\\Utility\\Admin\\Notices\\Builder' => __DIR__ . '/..' . '/toolset/toolset-common/utility/admin/notices/Builder.php',
 
 
 
 
170
  'ReCaptchaResponse' => __DIR__ . '/..' . '/toolset/toolset-common/toolset-forms/js/recaptcha-php-1.11/recaptchalib.php',
171
  'Toolset_Admin_Bar_Menu' => __DIR__ . '/..' . '/toolset/toolset-common/inc/toolset.admin.bar.menu.class.php',
172
  'Toolset_Admin_Controller' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/admin.php',
190
  'Toolset_Ajax_Handler_Interface' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/ajax_handler/interface.php',
191
  'Toolset_Ajax_Handler_Intermediary_Post_Cleanup' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/ajax_handler/intermediary_post_cleanup.php',
192
  'Toolset_Ajax_Handler_Migrate_To_M2M' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/ajax_handler/migrate_to_m2m.php',
193
+ 'Toolset_Ajax_Handler_Select2_Suggest_Posts_By_Post_Type' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/ajax_handler/select2_suggest_posts_by_post_type.php',
194
  'Toolset_Ajax_Handler_Select2_Suggest_Posts_By_Title' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/ajax_handler/select2_suggest_posts_by_title.php',
195
  'Toolset_Ajax_Handler_Select2_Suggest_Terms' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/ajax_handler/select2_suggest_terms.php',
196
  'Toolset_Ajax_Handler_Select2_Suggest_Users' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/ajax_handler/select2_suggest_users.php',
204
  'Toolset_Association_Cleanup_Dangling_Intermediary_Posts' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/cleanup/dangling_intermediary_posts.php',
205
  'Toolset_Association_Cleanup_Factory' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/cleanup/factory.php',
206
  'Toolset_Association_Cleanup_Post' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/cleanup/post.php',
207
+ 'Toolset_Association_Cleanup_Post_Type' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/cleanup/post_type.php',
208
  'Toolset_Association_Cleanup_Troubleshooting_Section' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/cleanup/troubleshooting_section.php',
209
  'Toolset_Association_Factory' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/factory.php',
210
  'Toolset_Association_Intermediary_Post_Persistence' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/intermediary_post_persistence.php',
217
  'Toolset_Association_Query_Condition_Element_Status' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/element_status.php',
218
  'Toolset_Association_Query_Condition_Empty_Intermediary' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/empty_intermediary.php',
219
  'Toolset_Association_Query_Condition_Exclude_Element' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/exclude_element.php',
220
+ 'Toolset_Association_Query_Condition_Exclude_Relationship' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/exclude_relationship.php',
221
  'Toolset_Association_Query_Condition_Factory' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition_factory.php',
222
  'Toolset_Association_Query_Condition_Has_Active_Relationship' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/has_active_relationship.php',
223
  'Toolset_Association_Query_Condition_Has_Domain' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/has_domain.php',
224
  'Toolset_Association_Query_Condition_Has_Domain_And_Type' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/has_domain_and_type.php',
225
+ 'Toolset_Association_Query_Condition_Has_Intermediary_Id' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/has_intermediary_id.php',
226
  'Toolset_Association_Query_Condition_Has_Legacy_Relationship' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/has_legacy_relationship.php',
227
  'Toolset_Association_Query_Condition_Has_Type' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/has_type.php',
228
+ 'Toolset_Association_Query_Condition_Intermediary_Id' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/intermediary_id.php',
229
  'Toolset_Association_Query_Condition_Postmeta' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/postmeta.php',
230
  'Toolset_Association_Query_Condition_Relationship_Flag' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/relationship_flag.php',
231
  'Toolset_Association_Query_Condition_Relationship_Id' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/relationship_id.php',
232
+ 'Toolset_Association_Query_Condition_Relationship_Origin' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/relationship_origin.php',
233
  'Toolset_Association_Query_Condition_Search' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/search.php',
234
  'Toolset_Association_Query_Condition_Wp_Query' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/condition/wp_query.php',
235
  'Toolset_Association_Query_Element_Selector_Abstract' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/element_selector/abstract.php',
236
  'Toolset_Association_Query_Element_Selector_Default' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/element_selector/default.php',
237
  'Toolset_Association_Query_Element_Selector_Provider' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/element_selector/provider.php',
238
  'Toolset_Association_Query_Element_Selector_Wpml' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/element_selector/wpml.php',
239
+ 'Toolset_Association_Query_Element_Selector_Wpml_Lang_All' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/element_selector/wpml_lang_all.php',
240
  'Toolset_Association_Query_Orderby' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/orderby/abstract.php',
241
  'Toolset_Association_Query_Orderby_Factory' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/orderby_factory.php',
242
  'Toolset_Association_Query_Orderby_Nothing' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/association/query/orderby/nothing.php',
353
  'Toolset_Field_Renderer_Preview_Date' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/date.php',
354
  'Toolset_Field_Renderer_Preview_File' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/file.php',
355
  'Toolset_Field_Renderer_Preview_Image' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/image.php',
356
+ 'Toolset_Field_Renderer_Preview_Post' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/post.php',
357
  'Toolset_Field_Renderer_Preview_Radio' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/radio.php',
358
  'Toolset_Field_Renderer_Preview_Skype' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/skype.php',
359
  'Toolset_Field_Renderer_Preview_Textfield' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/field/renderer/preview/textfield.php',
396
  'Toolset_Post_Type_Factory' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/post_type/factory.php',
397
  'Toolset_Post_Type_From_Types' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/post_type/from_types.php',
398
  'Toolset_Post_Type_Labels' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/post_type/labels.php',
399
+ 'Toolset_Post_Type_List' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/post_type/list.php',
400
  'Toolset_Post_Type_Query' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/post_type/query.php',
401
  'Toolset_Post_Type_Query_Factory' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/post_type/query_factory.php',
402
  'Toolset_Post_Type_Registered' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/post_type/registered.php',
403
  'Toolset_Post_Type_Repository' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/post_type/repository.php',
404
+ 'Toolset_Postmeta_Access_Loader' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/postmeta_access/loader.php',
405
+ 'Toolset_Postmeta_Access_M2m' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/postmeta_access/m2m.php',
406
+ 'Toolset_Potential_Association_Query_Arguments' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/potential_association/query_arguments.php',
407
  'Toolset_Potential_Association_Query_Factory' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/potential_association/query_factory.php',
408
+ 'Toolset_Potential_Association_Query_Filter_Interface' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/potential_association/filters/interface.php',
409
+ 'Toolset_Potential_Association_Query_Filter_Posts_Author' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/potential_association/filters/post/author.php',
410
+ 'Toolset_Potential_Association_Query_Filter_Search_String' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/potential_association/filters/search_string.php',
411
  'Toolset_Potential_Association_Query_Posts' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/potential_association/query_posts.php',
412
  'Toolset_Promotion' => __DIR__ . '/..' . '/toolset/toolset-common/inc/toolset.promotion.class.php',
413
  'Toolset_Public_API_Loader' => __DIR__ . '/..' . '/toolset/toolset-common/inc/public_api/loader.php',
414
  'Toolset_Query_Comparison_Operator' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/query/comparison_operator.php',
415
  'Toolset_Query_Condition_And' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/query/condition/and.php',
416
  'Toolset_Query_Condition_Contradiction' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/query/condition/contradiction.php',
417
+ 'Toolset_Query_Condition_Not' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/query/condition/not.php',
418
  'Toolset_Query_Condition_Operator' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/query/condition/operator.php',
419
  'Toolset_Query_Condition_Or' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/query/condition/or.php',
420
  'Toolset_Query_Condition_Tautology' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/query/condition/tautology.php',
448
  'Toolset_Relationship_Query_Cardinality_Match_Operators' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/query/cardinality_match/operators.php',
449
  'Toolset_Relationship_Query_Cardinality_Match_Single' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/query/cardinality_match/single.php',
450
  'Toolset_Relationship_Query_Condition' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/query/condition/abstract.php',
451
+ 'Toolset_Relationship_Query_Condition_Exclude_Relationship' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/query/condition/exclude_relationship.php',
452
+ 'Toolset_Relationship_Query_Condition_Exclude_Type' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/query/condition/exclude_type.php',
453
  'Toolset_Relationship_Query_Condition_Factory' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/query/condition_factory.php',
454
  'Toolset_Relationship_Query_Condition_Has_Active_Types' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/query/condition/has_active_types.php',
455
  'Toolset_Relationship_Query_Condition_Has_Cardinality' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/query/condition/has_cardinality.php',
456
  'Toolset_Relationship_Query_Condition_Has_Domain' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/query/condition/has_domain.php',
457
+ 'Toolset_Relationship_Query_Condition_Intermediary_Type' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/query/condition/intermediary_type.php',
458
  'Toolset_Relationship_Query_Condition_Is_Active' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/query/condition/is_active.php',
459
  'Toolset_Relationship_Query_Condition_Is_Boolean_Flag' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/query/condition/is_boolean_flag.php',
460
  'Toolset_Relationship_Query_Condition_Is_Legacy' => __DIR__ . '/..' . '/toolset/toolset-common/inc/m2m/relationship/query/condition/is_legacy.php',
483
  'Toolset_Settings_Screen' => __DIR__ . '/..' . '/toolset/toolset-common/inc/toolset.settings.screen.class.php',
484
  'Toolset_Shortcode_Attr_Field' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/field.php',
485
  'Toolset_Shortcode_Attr_Interface' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/interface.php',
486
+ 'Toolset_Shortcode_Attr_Item_Gui_Base' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/gui/base.php',
487
+ 'Toolset_Shortcode_Attr_Item_Gui_Factory' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/gui/factory.php',
488
+ 'Toolset_Shortcode_Attr_Item_Gui_M2m' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/gui/m2m.php',
489
+ 'Toolset_Shortcode_Attr_Item_Gui_O2m' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/gui/o2m.php',
490
+ 'Toolset_Shortcode_Attr_Item_Gui_O2o' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/gui/o2o.php',
491
+ 'Toolset_Shortcode_Attr_Item_Gui_Option' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/gui/option.php',
492
  'Toolset_Shortcode_Attr_Item_Id' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/id.php',
493
  'Toolset_Shortcode_Attr_Item_Legacy' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/legacy.php',
494
  'Toolset_Shortcode_Attr_Item_M2M' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/m2m.php',
495
  'Toolset_Shortcode_Generator' => __DIR__ . '/..' . '/toolset/toolset-common/inc/toolset.shortcode.generator.class.php',
496
  'Toolset_Shortcode_Transformer' => __DIR__ . '/..' . '/toolset/toolset-common/inc/toolset.shortcode.transformer.class.php',
497
+ 'Toolset_Singleton_Factory' => __DIR__ . '/..' . '/toolset/toolset-common/utility/singleton_factory_pre_php_5_6.php',
498
  'Toolset_Stack' => __DIR__ . '/..' . '/toolset/toolset-common/expression-parser/parser.php',
499
  'Toolset_Style' => __DIR__ . '/..' . '/toolset/toolset-common/inc/toolset.assets.manager.class.php',
500
  'Toolset_Template_Dialog_Box' => __DIR__ . '/..' . '/toolset/toolset-common/utility/gui-base/template_dialog_box.php',
505
  'Toolset_Twig_Extensions' => __DIR__ . '/..' . '/toolset/toolset-common/utility/gui-base/twig_extensions.php',
506
  'Toolset_Upgrade_Command_Definition' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/upgrade/command_definition.php',
507
  'Toolset_Upgrade_Command_Definition_Repository' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/upgrade/command_definition_repository.php',
508
+ 'Toolset_Upgrade_Command_Delete_Obsolete_Upgrade_Options' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/upgrade/command/delete_obsolete_version_number_option.php',
509
  'Toolset_Upgrade_Command_Factory' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/upgrade/command_factory.php',
510
  'Toolset_Upgrade_Command_M2M_V1_Database_Structure_Upgrade' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/upgrade/command/m2m_v1_database_structure_upgrade.php',
511
+ 'Toolset_Upgrade_Command_M2M_V2_Database_Structure_Upgrade' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/upgrade/command/m2m_v2_database_structure_upgrade.php',
512
  'Toolset_Upgrade_Controller' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/upgrade/controller.php',
513
  'Toolset_Upgrade_Executed_Commands' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/upgrade/executed_commands.php',
514
  'Toolset_User_Editors_Editor_Abstract' => __DIR__ . '/..' . '/toolset/toolset-common/user-editors/editor/abstract.php',
554
  'Toolset_Wp_Query_Adjustments_Table_Join_Manager' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/wp_query_adjustments/table_join_manager.php',
555
  'Toolset_Wpdb_User' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/wpdb_user.php',
556
  'Toolset_Wpml_Utils' => __DIR__ . '/..' . '/toolset/toolset-common/inc/autoloaded/wpml_utils.php',
 
557
  'Twig_Autoloader' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Autoloader.php',
558
  'Twig_BaseNodeVisitor' => __DIR__ . '/..' . '/twig/twig/lib/Twig/BaseNodeVisitor.php',
559
  'Twig_CacheInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/CacheInterface.php',
753
  'Twig_Util_TemplateDirIterator' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Util/TemplateDirIterator.php',
754
  'Types_Admin' => __DIR__ . '/../..' . '/application/controllers/admin.php',
755
  'Types_Admin_Menu' => __DIR__ . '/../..' . '/application/controllers/admin_menu.php',
756
+ 'Types_Admin_Notices_Free_Version' => __DIR__ . '/../..' . '/application/controllers/admin_notice/free-version.php',
757
  'Types_Ajax' => __DIR__ . '/../..' . '/application/controllers/ajax.php',
758
  'Types_Ajax_Handler_Abstract' => __DIR__ . '/../..' . '/application/controllers/ajax/handler/abstract.php',
759
  'Types_Ajax_Handler_Check_Slug_Conflicts' => __DIR__ . '/../..' . '/application/controllers/ajax/handler/check_slug_conflicts.php',
906
  'WPToolset_Field_Wysiwyg' => __DIR__ . '/..' . '/toolset/toolset-common/toolset-forms/classes/class.wysiwyg.php',
907
  'WPToolset_Forms_Bootstrap' => __DIR__ . '/..' . '/toolset/toolset-common/toolset-forms/bootstrap.php',
908
  'WPToolset_Forms_Conditional' => __DIR__ . '/..' . '/toolset/toolset-common/toolset-forms/classes/class.conditional.php',
909
+ 'WPToolset_Forms_Conditional_RFG' => __DIR__ . '/..' . '/toolset/toolset-common/toolset-forms/classes/class.conditional.rfg.php',
910
  'WPToolset_Forms_Repetitive' => __DIR__ . '/..' . '/toolset/toolset-common/toolset-forms/classes/class.repetitive.php',
911
  'WPToolset_Forms_Validation' => __DIR__ . '/..' . '/toolset/toolset-common/toolset-forms/classes/class.validation.php',
912
  'WPToolset_Types' => __DIR__ . '/..' . '/toolset/toolset-common/toolset-forms/classes/class.types.php',
913
  'WPV_Handle_Users_Functions' => __DIR__ . '/..' . '/toolset/toolset-common/toolset-forms/classes/class.conditional.php',
914
  'WPV_wpcf_switch_post_from_attr_id' => __DIR__ . '/..' . '/toolset/toolset-common/inc/toolset.object.relationship.class.php',
 
 
 
915
  'xrstf\\Composer52\\AutoloadGenerator' => __DIR__ . '/..' . '/xrstf/composer-php52/lib/xrstf/Composer52/AutoloadGenerator.php',
916
  'xrstf\\Composer52\\Generator' => __DIR__ . '/..' . '/xrstf/composer-php52/lib/xrstf/Composer52/Generator.php',
917
  );
919
  public static function getInitializer(ClassLoader $loader)
920
  {
921
  return \Closure::bind(function () use ($loader) {
922
+ $loader->prefixLengthsPsr4 = ComposerStaticInit3ef203360daf9a3f27f03c8cdcceee49::$prefixLengthsPsr4;
923
+ $loader->prefixDirsPsr4 = ComposerStaticInit3ef203360daf9a3f27f03c8cdcceee49::$prefixDirsPsr4;
924
+ $loader->prefixesPsr0 = ComposerStaticInit3ef203360daf9a3f27f03c8cdcceee49::$prefixesPsr0;
925
+ $loader->classMap = ComposerStaticInit3ef203360daf9a3f27f03c8cdcceee49::$classMap;
926
 
927
  }, null, ClassLoader::class);
928
  }
vendor/composer/installed.json CHANGED
@@ -119,36 +119,88 @@
119
  ]
120
  },
121
  {
122
- "name": "xrstf/composer-php52",
123
- "version": "v1.0.20",
124
- "version_normalized": "1.0.20.0",
125
  "source": {
126
  "type": "git",
127
- "url": "https://github.com/composer-php52/composer-php52.git",
128
- "reference": "bd41459d5e27df8d33057842b32377c39e97a5a8"
129
  },
130
- "dist": {
131
- "type": "zip",
132
- "url": "https://api.github.com/repos/composer-php52/composer-php52/zipball/bd41459d5e27df8d33057842b32377c39e97a5a8",
133
- "reference": "bd41459d5e27df8d33057842b32377c39e97a5a8",
134
- "shasum": ""
 
 
 
 
 
 
 
 
 
 
 
 
135
  },
136
- "time": "2016-04-16T21:52:24+00:00",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  "type": "library",
138
  "extra": {
139
  "branch-alias": {
140
- "dev-default": "1.x-dev"
 
141
  }
142
  },
143
- "installation-source": "dist",
144
- "autoload": {
145
- "psr-0": {
146
- "xrstf\\Composer52": "lib/"
147
- }
 
 
 
 
 
 
 
 
 
 
 
148
  },
149
- "notification-url": "https://packagist.org/downloads/",
150
  "license": [
151
- "MIT"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  ]
153
  },
154
  {
@@ -291,96 +343,6 @@
291
  ],
292
  "description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it"
293
  },
294
- {
295
- "name": "otgs/icons",
296
- "version": "dev-master",
297
- "version_normalized": "9999999-dev",
298
- "source": {
299
- "type": "git",
300
- "url": "https://git.onthegosystems.com/otgs-public/otgs-icons.git",
301
- "reference": "622ab3c0549b70c87fa20de1c302ffcc07ea8f9c"
302
- },
303
- "time": "2018-04-06T08:47:19+00:00",
304
- "type": "library",
305
- "installation-source": "source",
306
- "notification-url": "https://packagist.org/downloads/",
307
- "license": [
308
- "GPL-2.0"
309
- ],
310
- "description": "Toolset and WPML icons"
311
- },
312
- {
313
- "name": "otgs/installer",
314
- "version": "1.8.10",
315
- "version_normalized": "1.8.10.0",
316
- "source": {
317
- "type": "git",
318
- "url": "ssh://git@git.onthegosystems.com:10022/installer/installer.git",
319
- "reference": "28bcba8a8d54c28c8f4a51f095b438dfb3a3fdfd"
320
- },
321
- "require": {
322
- "composer/installers": "~1.0",
323
- "otgs/icons": "dev-master",
324
- "php": ">=5.2.0",
325
- "roave/security-advisories": "dev-master",
326
- "xrstf/composer-php52": "1.*"
327
- },
328
- "require-dev": {
329
- "otgs/build-tools": "~0.1",
330
- "otgs/build-tools-ci": "~0.7",
331
- "otgs/unit-tests-framework": "~1.2.0",
332
- "sebastian/phpcpd": "^3.0"
333
- },
334
- "time": "2018-04-06T09:28:44+00:00",
335
- "type": "library",
336
- "extra": {
337
- "branch-alias": {
338
- "dev-master": "1.8.x-dev",
339
- "dev-develop": "1.8.x-dev"
340
- }
341
- },
342
- "installation-source": "source",
343
- "autoload": {
344
- "classmap": [
345
- "includes/",
346
- "templates/"
347
- ]
348
- },
349
- "scripts": {
350
- "test": [
351
- "phpunit"
352
- ],
353
- "post-install-cmd": [
354
- "xrstf\\Composer52\\Generator::onPostInstallCmd",
355
- "OTGS\\Composer\\Scripts\\Install::PHPCSStandards"
356
- ],
357
- "post-update-cmd": [
358
- "xrstf\\Composer52\\Generator::onPostInstallCmd",
359
- "OTGS\\Composer\\Scripts\\Install::PHPCSStandards"
360
- ],
361
- "post-autoload-dump": [
362
- "xrstf\\Composer52\\Generator::onPostInstallCmd"
363
- ]
364
- },
365
- "license": [
366
- "GPL-2.0-or-later"
367
- ],
368
- "authors": [
369
- {
370
- "name": "Mihai Grigori",
371
- "email": "mihai@wpml.org",
372
- "homepage": "http://www.wp-types.com"
373
- }
374
- ],
375
- "description": "Installs and updates WPML and Toolset dependencies automatically",
376
- "homepage": "https://git.onthegosystems.com/installer/installer",
377
- "keywords": [
378
- "install",
379
- "plugins",
380
- "update",
381
- "utils"
382
- ]
383
- },
384
  {
385
  "name": "toolset/onthego-resources",
386
  "version": "dev-master",
@@ -431,12 +393,12 @@
431
  },
432
  {
433
  "name": "toolset/toolset-common",
434
- "version": "2.6.2",
435
- "version_normalized": "2.6.2.0",
436
  "source": {
437
  "type": "git",
438
  "url": "ssh://git@git.onthegosystems.com:10022/toolset/toolset-common.git",
439
- "reference": "f8084f2b13708b5589842bb8b1ab6a4c77a8e9ac"
440
  },
441
  "require": {
442
  "php": ">=5.2.0"
@@ -445,9 +407,10 @@
445
  "10up/wp_mock": "~0.2.0",
446
  "otgs/build-tools-ci": "~0.7.0",
447
  "otgs/unit-tests-framework": "~1.2.0",
448
- "phpunit/php-token-stream": "<2.0"
 
449
  },
450
- "time": "2018-03-01T14:00:14+00:00",
451
  "type": "library",
452
  "extra": {
453
  "branch-alias": {
@@ -490,8 +453,8 @@
490
  "authors": [
491
  {
492
  "name": "Bruce Pearson, Juan de Paco, Riccardo Strobbia, Francesco Livolsi, Jan Štětina, Christian Glingener",
493
- "email": "riccardo.s@icanlocalize.com",
494
- "homepage": "http://www.wp-types.com"
495
  }
496
  ],
497
  "description": "A set of libraries for Toolset Plugins",
@@ -566,5 +529,38 @@
566
  "keywords": [
567
  "templating"
568
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
569
  }
570
  ]
119
  ]
120
  },
121
  {
122
+ "name": "otgs/icons",
123
+ "version": "dev-master",
124
+ "version_normalized": "9999999-dev",
125
  "source": {
126
  "type": "git",
127
+ "url": "https://git.onthegosystems.com/otgs-public/otgs-icons.git",
128
+ "reference": "622ab3c0549b70c87fa20de1c302ffcc07ea8f9c"
129
  },
130
+ "time": "2018-04-06T08:47:19+00:00",
131
+ "type": "library",
132
+ "installation-source": "source",
133
+ "notification-url": "https://packagist.org/downloads/",
134
+ "license": [
135
+ "GPL-2.0"
136
+ ],
137
+ "description": "Toolset and WPML icons"
138
+ },
139
+ {
140
+ "name": "otgs/installer",
141
+ "version": "1.8.25",
142
+ "version_normalized": "1.8.25.0",
143
+ "source": {
144
+ "type": "git",
145
+ "url": "ssh://git@git.onthegosystems.com:10022/installer/installer.git",
146
+ "reference": "612bbc5045b6cd60145fc1f3f909981fde70ec3b"
147
  },
148
+ "require": {
149
+ "composer/installers": "~1.0",
150
+ "otgs/icons": "dev-master",
151
+ "php": ">=5.2.0",
152
+ "roave/security-advisories": "dev-master",
153
+ "twig/twig": "~1.32.0",
154
+ "xrstf/composer-php52": "1.*"
155
+ },
156
+ "require-dev": {
157
+ "otgs/build-tools": "~0.1",
158
+ "otgs/build-tools-ci": "~0.7",
159
+ "otgs/unit-tests-framework": "~1.2.0",
160
+ "sebastian/phpcpd": "^3.0"
161
+ },
162
+ "time": "2018-07-13T10:51:21+00:00",
163
  "type": "library",
164
  "extra": {
165
  "branch-alias": {
166
+ "dev-master": "1.8.x-dev",
167
+ "dev-develop": "1.8.x-dev"
168
  }
169
  },
170
+ "installation-source": "source",
171
+ "scripts": {
172
+ "test": [
173
+ "phpunit"
174
+ ],
175
+ "post-install-cmd": [
176
+ "xrstf\\Composer52\\Generator::onPostInstallCmd",
177
+ "OTGS\\Composer\\Scripts\\Install::PHPCSStandards"
178
+ ],
179
+ "post-update-cmd": [
180
+ "xrstf\\Composer52\\Generator::onPostInstallCmd",
181
+ "OTGS\\Composer\\Scripts\\Install::PHPCSStandards"
182
+ ],
183
+ "post-autoload-dump": [
184
+ "xrstf\\Composer52\\Generator::onPostInstallCmd"
185
+ ]
186
  },
 
187
  "license": [
188
+ "GPL-2.0-or-later"
189
+ ],
190
+ "authors": [
191
+ {
192
+ "name": "Mihai Grigori",
193
+ "email": "mihai@wpml.org",
194
+ "homepage": "http://www.wp-types.com"
195
+ }
196
+ ],
197
+ "description": "Installs and updates WPML and Toolset dependencies automatically",
198
+ "homepage": "https://git.onthegosystems.com/installer/installer",
199
+ "keywords": [
200
+ "install",
201
+ "plugins",
202
+ "update",
203
+ "utils"
204
  ]
205
  },
206
  {
343
  ],
344
  "description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it"
345
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
346
  {
347
  "name": "toolset/onthego-resources",
348
  "version": "dev-master",
393
  },
394
  {
395
  "name": "toolset/toolset-common",
396
+ "version": "2.8.1",
397
+ "version_normalized": "2.8.1.0",
398
  "source": {
399
  "type": "git",
400
  "url": "ssh://git@git.onthegosystems.com:10022/toolset/toolset-common.git",
401
+ "reference": "ff9291e1a518f4b3c4ba36bd1a211751d370b8b5"
402
  },
403
  "require": {
404
  "php": ">=5.2.0"
407
  "10up/wp_mock": "~0.2.0",
408
  "otgs/build-tools-ci": "~0.7.0",
409
  "otgs/unit-tests-framework": "~1.2.0",
410
+ "phpunit/php-token-stream": "<2.0",
411
+ "sebastian/phpcpd": "^3.0"
412
  },
413
+ "time": "2018-06-06T11:29:44+00:00",
414
  "type": "library",
415
  "extra": {
416
  "branch-alias": {
453
  "authors": [
454
  {
455
  "name": "Bruce Pearson, Juan de Paco, Riccardo Strobbia, Francesco Livolsi, Jan Štětina, Christian Glingener",
456
+ "email": "juan.d@onthegosystems.com",
457
+ "homepage": "https://toolset.com"
458
  }
459
  ],
460
  "description": "A set of libraries for Toolset Plugins",
529
  "keywords": [
530
  "templating"
531
  ]
532
+ },
533
+ {
534
+ "name": "xrstf/composer-php52",
535
+ "version": "v1.0.20",
536
+ "version_normalized": "1.0.20.0",
537
+ "source": {
538
+ "type": "git",
539
+ "url": "https://github.com/composer-php52/composer-php52.git",
540
+ "reference": "bd41459d5e27df8d33057842b32377c39e97a5a8"
541
+ },
542
+ "dist": {
543
+ "type": "zip",
544
+ "url": "https://api.github.com/repos/composer-php52/composer-php52/zipball/bd41459d5e27df8d33057842b32377c39e97a5a8",
545
+ "reference": "bd41459d5e27df8d33057842b32377c39e97a5a8",
546
+ "shasum": ""
547
+ },
548
+ "time": "2016-04-16T21:52:24+00:00",
549
+ "type": "library",
550
+ "extra": {
551
+ "branch-alias": {
552
+ "dev-default": "1.x-dev"
553
+ }
554
+ },
555
+ "installation-source": "dist",
556
+ "autoload": {
557
+ "psr-0": {
558
+ "xrstf\\Composer52": "lib/"
559
+ }
560
+ },
561
+ "notification-url": "https://packagist.org/downloads/",
562
+ "license": [
563
+ "MIT"
564
+ ]
565
  }
566
  ]
vendor/otgs/installer/changelog.txt CHANGED
@@ -1,3 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  = 1.8.10 =
2
  * Removed wrongly added dependencies and repositories
3
 
1
+ = 1.8.25 =
2
+ * Fix display notice for Lite products
3
+ * Fix error in plugin page
4
+
5
+ = 1.8.24 =
6
+ * Fixed wrong notice displayed for Toolset Types in plugins page
7
+ * Fixed missing Register / Registered links for some Toolset products
8
+ * Fixed wrong link in the notice of Toolset Views Lite
9
+ * Removed notice in Toolset Views Lite and Toolset Types asking to register when they registered
10
+
11
+ = 1.8.23 =
12
+ * Improved message when switching between production and beta channels
13
+ * Fixed random error thrown from Installer during plugin activation on slow connection
14
+
15
+ = 1.8.22 =
16
+ * Adjustments for distributing Views Lite and Types through the WPML repository
17
+ * Fixed JavaScript errors occurring on WPML pages in IE 11
18
+
19
+ = 1.8.21 =
20
+ * Removed source maps for transpiled JS and CSS files which were causing some false positive alerts from malware softwares
21
+
22
+ = 1.8.20 =
23
+ * Display a link for Toolset Types upgrade if there is an available paid update
24
+ * Do not include the plugin in the list of updates if it is not part of the current user subscription
25
+
26
+ = 1.8.19 =
27
+ * Fixed a bug that was preventing Types from being downloaded from wordpress.org
28
+
29
+ = 1.8.18 =
30
+ * Fixed a scenario where the `get_plugins` function might not be defined yet
31
+
32
+ = 1.8.17 =
33
+ * Implemented a notice for non-subscription users if an update is available on our site, without blocking updates from wordpress.org
34
+
35
+ = 1.8.16 =
36
+ * Improved sending of components data to be sent separately than the product registration
37
+
38
+ = 1.8.15 =
39
+ * Fixed message displayed even after sitekey gets validated
40
+ * Resolved PHP Notice Undefined index: version in specific client's dump
41
+ * Fixed incorrect comparison in the verification of subscriptions
42
+ * Improved incorrect message when trying to download a plugin but the connection times out
43
+
44
+ = 1.8.14.1 =
45
+ * Fixed Warning when components storage cache is empty
46
+
47
+ = 1.8.14 =
48
+ * Optionally collect some site information and send to our Toolset and WPML servers, such as PHP version, theme and plugins
49
+ * Resolved PHP fatal error when Types release/3.0 was active with WPML 3.9.4
50
+ * Skipped sending reports when site key is missing
51
+ * Changed the UI allowing users to send site's data
52
+ * Send Installer reports when user clicks in "How to translate" link
53
+ * Fixed Uncaught exception cURL error 35
54
+ * Fixed a PHP notice when two instances of Installer exist
55
+ * Refactored HTML to be more reusable and improved JS
56
+ * Replaced Installer setting from plugins list with an action
57
+ * Added Custom autoloader for Twig
58
+ * Started using only one version number for Installer
59
+ * Sanitized return of phpversion() in order to avoid registration issues when the option to send plugin/theme info is enabled
60
+ * Include Installer reports settings class in the beginning
61
+ * Removed autoloaded classes: replaced with custom autoloader only in `bootstrap.php`
62
+ * Included a check for equivalent subscription type for each plugin/product
63
+ * Added icons into upgrade response for WPML/Toolset plugins
64
+
65
  = 1.8.10 =
66
  * Removed wrongly added dependencies and repositories
67
 
vendor/otgs/installer/dist/css/ui/styles.css ADDED
@@ -0,0 +1 @@
 
1
+ .otgs-installer-component-setting{margin:1em 0}.otgs-installer-component-setting h4{margin:0}.otgs-settings-container .otgs-installer-component-setting .spinner{position:absolute;margin:5px 0 0}.otgs-on-off-switch+.otgs-switch__onoff,.otgs-switch__onoff+.otgs-on-off-switch{-webkit-margin-start:7px;margin-inline-start:7px}.otgs-switch__onoff{position:relative;width:55px;display:inline-block;vertical-align:middle;-webkit-box-flex:0;-ms-flex:0 0 55px;flex:0 0 55px}.otgs-switch__onoff.otgs-pull-right{right:0}.otgs-switch__onoff .otgs-switch__onoff-label{display:block;overflow:hidden;cursor:pointer;border:1px solid #e6e6e6;border-radius:16px;margin:0}.otgs-switch__onoff .otgs-switch__onoff-inner{width:200%;margin-left:-100%;-webkit-transition:margin .15s ease-in-out;transition:margin .15s ease-in-out}.otgs-switch__onoff .otgs-switch__onoff-inner:after,.otgs-switch__onoff .otgs-switch__onoff-inner:before{float:left;width:50%;height:22px;padding:0;line-height:22px;font-size:11px;-webkit-box-sizing:border-box;box-sizing:border-box}.otgs-switch__onoff .otgs-switch__onoff-inner:before{content:"ON";padding-left:10px;background-color:#21759b;color:#fff}.otgs-switch__onoff .otgs-switch__onoff-inner:after{content:"OFF";padding-right:8px;background-color:#fafafa;color:#3d3d3d;text-align:right}.otgs-switch__onoff .otgs-switch__onoff-switch{width:18px;height:18px;margin:0;background:#fff;-webkit-box-shadow:0 0 3px rgba(0,0,0,.3);box-shadow:0 0 3px rgba(0,0,0,.3);border-radius:50%;position:absolute;top:3px;bottom:0;right:34px;-webkit-transition:right .15s ease-in-out;transition:right .15s ease-in-out}.otgs-toggle-group{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.otgs-toggle-group .otgs-switch__onoff-inner{display:block}.otgs-toggle-group input[type=checkbox]{display:none}.otgs-toggle-group input[type=checkbox]:checked~.otgs-switch__onoff .otgs-switch__onoff-label .otgs-switch__onoff-inner{margin-left:0}.otgs-toggle-group input[type=checkbox]:checked~.otgs-switch__onoff .otgs-switch__onoff-label .otgs-switch__onoff-switch{right:3px;-webkit-box-shadow:0 0 3px rgba(0,0,0,.5);box-shadow:0 0 3px rgba(0,0,0,.5)}.otgs-toggle-group input[type=checkbox]:focus~.otgs-switch__onoff{outline:thin dotted #333}.otgs-toggle-group .otgs-on-off-switch{cursor:pointer;display:inline-block}.otgs-external-link:after{font-family:dashicons!important;content:"\A0\F504";vertical-align:baseline;line-height:1;display:inline-block}
vendor/otgs/installer/dist/js/ui/app.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(t){var n={};function r(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=n,r.d=function(t,n,e){r.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:e})},r.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="",r(r.s=208)}([function(t,n,r){var e=r(2),o=r(26),i=r(10),u=r(18),c=r(16),a=function(t,n,r){var f,s,l,h,p=t&a.F,v=t&a.G,d=t&a.S,y=t&a.P,g=t&a.B,m=v?e:d?e[n]||(e[n]={}):(e[n]||{}).prototype,b=v?o:o[n]||(o[n]={}),w=b.prototype||(b.prototype={});for(f in v&&(r=n),r)l=((s=!p&&m&&void 0!==m[f])?m:r)[f],h=g&&s?c(l,e):y&&"function"==typeof l?c(Function.call,l):l,m&&u(m,f,l,t&a.U),b[f]!=l&&i(b,f,h),y&&w[f]!=l&&(w[f]=l)};e.core=o,a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,a.U=64,a.R=128,t.exports=a},function(t,n){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,n){var r=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(t,n,r){var e=r(1);t.exports=function(t){if(!e(t))throw TypeError(t+" is not an object!");return t}},function(t,n,r){var e=r(63)("wks"),o=r(24),i=r(2).Symbol,u="function"==typeof i;(t.exports=function(t){return e[t]||(e[t]=u&&i[t]||(u?i:o)("Symbol."+t))}).store=e},function(t,n){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,n,r){var e=r(3),o=r(91),i=r(40),u=Object.defineProperty;n.f=r(8)?Object.defineProperty:function(t,n,r){if(e(t),n=i(n,!0),e(r),o)try{return u(t,n,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[n]=r.value),t}},function(t,n,r){var e=r(21),o=Math.min;t.exports=function(t){return t>0?o(e(t),9007199254740991):0}},function(t,n,r){t.exports=!r(5)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,n){var r={}.hasOwnProperty;t.exports=function(t,n){return r.call(t,n)}},function(t,n,r){var e=r(6),o=r(25);t.exports=r(8)?function(t,n,r){return e.f(t,n,o(1,r))}:function(t,n,r){return t[n]=r,t}},function(t,n,r){var e=r(0),o=r(26),i=r(5);t.exports=function(t,n){var r=(o.Object||{})[t]||Object[t],u={};u[t]=n(r),e(e.S+e.F*i(function(){r(1)}),"Object",u)}},function(t,n,r){var e=r(66),o=r(20);t.exports=function(t){return e(o(t))}},function(t,n,r){var e=r(36),o=r(25),i=r(12),u=r(40),c=r(9),a=r(91),f=Object.getOwnPropertyDescriptor;n.f=r(8)?f:function(t,n){if(t=i(t),n=u(n,!0),a)try{return f(t,n)}catch(t){}if(c(t,n))return o(!e.f.call(t,n),t[n])}},function(t,n,r){"use strict";if(r(8)){var e=r(22),o=r(2),i=r(5),u=r(0),c=r(48),a=r(67),f=r(16),s=r(34),l=r(25),h=r(10),p=r(35),v=r(21),d=r(7),y=r(90),g=r(32),m=r(40),b=r(9),w=r(59),_=r(1),x=r(15),S=r(58),E=r(38),O=r(29),P=r(39).f,A=r(57),M=r(24),j=r(4),F=r(37),L=r(65),T=r(60),I=r(56),B=r(30),R=r(46),N=r(47),k=r(61),C=r(84),U=r(6),D=r(13),W=U.f,V=D.f,G=o.RangeError,q=o.TypeError,z=o.Uint8Array,H=Array.prototype,Y=a.ArrayBuffer,K=a.DataView,J=F(0),X=F(2),$=F(3),Q=F(4),Z=F(5),tt=F(6),nt=L(!0),rt=L(!1),et=I.values,ot=I.keys,it=I.entries,ut=H.lastIndexOf,ct=H.reduce,at=H.reduceRight,ft=H.join,st=H.sort,lt=H.slice,ht=H.toString,pt=H.toLocaleString,vt=j("iterator"),dt=j("toStringTag"),yt=M("typed_constructor"),gt=M("def_constructor"),mt=c.CONSTR,bt=c.TYPED,wt=c.VIEW,_t=F(1,function(t,n){return Pt(T(t,t[gt]),n)}),xt=i(function(){return 1===new z(new Uint16Array([1]).buffer)[0]}),St=!!z&&!!z.prototype.set&&i(function(){new z(1).set({})}),Et=function(t,n){var r=v(t);if(r<0||r%n)throw G("Wrong offset!");return r},Ot=function(t){if(_(t)&&bt in t)return t;throw q(t+" is not a typed array!")},Pt=function(t,n){if(!(_(t)&&yt in t))throw q("It is not a typed array constructor!");return new t(n)},At=function(t,n){return Mt(T(t,t[gt]),n)},Mt=function(t,n){for(var r=0,e=n.length,o=Pt(t,e);e>r;)o[r]=n[r++];return o},jt=function(t,n,r){W(t,n,{get:function(){return this._d[r]}})},Ft=function(t){var n,r,e,o,i,u,c=x(t),a=arguments.length,s=a>1?arguments[1]:void 0,l=void 0!==s,h=A(c);if(void 0!=h&&!S(h)){for(u=h.call(c),e=[],n=0;!(i=u.next()).done;n++)e.push(i.value);c=e}for(l&&a>2&&(s=f(s,arguments[2],2)),n=0,r=d(c.length),o=Pt(this,r);r>n;n++)o[n]=l?s(c[n],n):c[n];return o},Lt=function(){for(var t=0,n=arguments.length,r=Pt(this,n);n>t;)r[t]=arguments[t++];return r},Tt=!!z&&i(function(){pt.call(new z(1))}),It=function(){return pt.apply(Tt?lt.call(Ot(this)):Ot(this),arguments)},Bt={copyWithin:function(t,n){return C.call(Ot(this),t,n,arguments.length>2?arguments[2]:void 0)},every:function(t){return Q(Ot(this),t,arguments.length>1?arguments[1]:void 0)},fill:function(t){return k.apply(Ot(this),arguments)},filter:function(t){return At(this,X(Ot(this),t,arguments.length>1?arguments[1]:void 0))},find:function(t){return Z(Ot(this),t,arguments.length>1?arguments[1]:void 0)},findIndex:function(t){return tt(Ot(this),t,arguments.length>1?arguments[1]:void 0)},forEach:function(t){J(Ot(this),t,arguments.length>1?arguments[1]:void 0)},indexOf:function(t){return rt(Ot(this),t,arguments.length>1?arguments[1]:void 0)},includes:function(t){return nt(Ot(this),t,arguments.length>1?arguments[1]:void 0)},join:function(t){return ft.apply(Ot(this),arguments)},lastIndexOf:function(t){return ut.apply(Ot(this),arguments)},map:function(t){return _t(Ot(this),t,arguments.length>1?arguments[1]:void 0)},reduce:function(t){return ct.apply(Ot(this),arguments)},reduceRight:function(t){return at.apply(Ot(this),arguments)},reverse:function(){for(var t,n=Ot(this).length,r=Math.floor(n/2),e=0;e<r;)t=this[e],this[e++]=this[--n],this[n]=t;return this},some:function(t){return $(Ot(this),t,arguments.length>1?arguments[1]:void 0)},sort:function(t){return st.call(Ot(this),t)},subarray:function(t,n){var r=Ot(this),e=r.length,o=g(t,e);return new(T(r,r[gt]))(r.buffer,r.byteOffset+o*r.BYTES_PER_ELEMENT,d((void 0===n?e:g(n,e))-o))}},Rt=function(t,n){return At(this,lt.call(Ot(this),t,n))},Nt=function(t){Ot(this);var n=Et(arguments[1],1),r=this.length,e=x(t),o=d(e.length),i=0;if(o+n>r)throw G("Wrong length!");for(;i<o;)this[n+i]=e[i++]},kt={entries:function(){return it.call(Ot(this))},keys:function(){return ot.call(Ot(this))},values:function(){return et.call(Ot(this))}},Ct=function(t,n){return _(t)&&t[bt]&&"symbol"!=typeof n&&n in t&&String(+n)==String(n)},Ut=function(t,n){return Ct(t,n=m(n,!0))?l(2,t[n]):V(t,n)},Dt=function(t,n,r){return!(Ct(t,n=m(n,!0))&&_(r)&&b(r,"value"))||b(r,"get")||b(r,"set")||r.configurable||b(r,"writable")&&!r.writable||b(r,"enumerable")&&!r.enumerable?W(t,n,r):(t[n]=r.value,t)};mt||(D.f=Ut,U.f=Dt),u(u.S+u.F*!mt,"Object",{getOwnPropertyDescriptor:Ut,defineProperty:Dt}),i(function(){ht.call({})})&&(ht=pt=function(){return ft.call(this)});var Wt=p({},Bt);p(Wt,kt),h(Wt,vt,kt.values),p(Wt,{slice:Rt,set:Nt,constructor:function(){},toString:ht,toLocaleString:It}),jt(Wt,"buffer","b"),jt(Wt,"byteOffset","o"),jt(Wt,"byteLength","l"),jt(Wt,"length","e"),W(Wt,dt,{get:function(){return this[bt]}}),t.exports=function(t,n,r,a){var f=t+((a=!!a)?"Clamped":"")+"Array",l="get"+t,p="set"+t,v=o[f],g=v||{},m=v&&O(v),b=!v||!c.ABV,x={},S=v&&v.prototype,A=function(t,r){W(t,r,{get:function(){return function(t,r){var e=t._d;return e.v[l](r*n+e.o,xt)}(this,r)},set:function(t){return function(t,r,e){var o=t._d;a&&(e=(e=Math.round(e))<0?0:e>255?255:255&e),o.v[p](r*n+o.o,e,xt)}(this,r,t)},enumerable:!0})};b?(v=r(function(t,r,e,o){s(t,v,f,"_d");var i,u,c,a,l=0,p=0;if(_(r)){if(!(r instanceof Y||"ArrayBuffer"==(a=w(r))||"SharedArrayBuffer"==a))return bt in r?Mt(v,r):Ft.call(v,r);i=r,p=Et(e,n);var g=r.byteLength;if(void 0===o){if(g%n)throw G("Wrong length!");if((u=g-p)<0)throw G("Wrong length!")}else if((u=d(o)*n)+p>g)throw G("Wrong length!");c=u/n}else c=y(r),i=new Y(u=c*n);for(h(t,"_d",{b:i,o:p,l:u,e:c,v:new K(i)});l<c;)A(t,l++)}),S=v.prototype=E(Wt),h(S,"constructor",v)):i(function(){v(1)})&&i(function(){new v(-1)})&&R(function(t){new v,new v(null),new v(1.5),new v(t)},!0)||(v=r(function(t,r,e,o){var i;return s(t,v,f),_(r)?r instanceof Y||"ArrayBuffer"==(i=w(r))||"SharedArrayBuffer"==i?void 0!==o?new g(r,Et(e,n),o):void 0!==e?new g(r,Et(e,n)):new g(r):bt in r?Mt(v,r):Ft.call(v,r):new g(y(r))}),J(m!==Function.prototype?P(g).concat(P(m)):P(g),function(t){t in v||h(v,t,g[t])}),v.prototype=S,e||(S.constructor=v));var M=S[vt],j=!!M&&("values"==M.name||void 0==M.name),F=kt.values;h(v,yt,!0),h(S,bt,f),h(S,wt,!0),h(S,gt,v),(a?new v(1)[dt]==f:dt in S)||W(S,dt,{get:function(){return f}}),x[f]=v,u(u.G+u.W+u.F*(v!=g),x),u(u.S,f,{BYTES_PER_ELEMENT:n}),u(u.S+u.F*i(function(){g.of.call(v,1)}),f,{from:Ft,of:Lt}),"BYTES_PER_ELEMENT"in S||h(S,"BYTES_PER_ELEMENT",n),u(u.P,f,Bt),N(f),u(u.P+u.F*St,f,{set:Nt}),u(u.P+u.F*!j,f,kt),e||S.toString==ht||(S.toString=ht),u(u.P+u.F*i(function(){new v(1).slice()}),f,{slice:Rt}),u(u.P+u.F*(i(function(){return[1,2].toLocaleString()!=new v([1,2]).toLocaleString()})||!i(function(){S.toLocaleString.call([1,2])})),f,{toLocaleString:It}),B[f]=j?M:F,e||j||h(S,vt,F)}}else t.exports=function(){}},function(t,n,r){var e=r(20);t.exports=function(t){return Object(e(t))}},function(t,n,r){var e=r(23);t.exports=function(t,n,r){if(e(t),void 0===n)return t;switch(r){case 1:return function(r){return t.call(n,r)};case 2:return function(r,e){return t.call(n,r,e)};case 3:return function(r,e,o){return t.call(n,r,e,o)}}return function(){return t.apply(n,arguments)}}},function(t,n,r){var e=r(24)("meta"),o=r(1),i=r(9),u=r(6).f,c=0,a=Object.isExtensible||function(){return!0},f=!r(5)(function(){return a(Object.preventExtensions({}))}),s=function(t){u(t,e,{value:{i:"O"+ ++c,w:{}}})},l=t.exports={KEY:e,NEED:!1,fastKey:function(t,n){if(!o(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!i(t,e)){if(!a(t))return"F";if(!n)return"E";s(t)}return t[e].i},getWeak:function(t,n){if(!i(t,e)){if(!a(t))return!0;if(!n)return!1;s(t)}return t[e].w},onFreeze:function(t){return f&&l.NEED&&a(t)&&!i(t,e)&&s(t),t}}},function(t,n,r){var e=r(2),o=r(10),i=r(9),u=r(24)("src"),c=Function.toString,a=(""+c).split("toString");r(26).inspectSource=function(t){return c.call(t)},(t.exports=function(t,n,r,c){var f="function"==typeof r;f&&(i(r,"name")||o(r,"name",n)),t[n]!==r&&(f&&(i(r,u)||o(r,u,t[n]?""+t[n]:a.join(String(n)))),t===e?t[n]=r:c?t[n]?t[n]=r:o(t,n,r):(delete t[n],o(t,n,r)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[u]||c.call(this)})},function(t,n,r){var e=r(89),o=r(62);t.exports=Object.keys||function(t){return e(t,o)}},function(t,n){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,n){var r=Math.ceil,e=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?e:r)(t)}},function(t,n){t.exports=!1},function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,n){var r=0,e=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++r+e).toString(36))}},function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},function(t,n){var r=t.exports={version:"2.5.7"};"number"==typeof __e&&(__e=r)},function(t,n,r){var e=r(1);t.exports=function(t,n){if(!e(t)||t._t!==n)throw TypeError("Incompatible receiver, "+n+" required!");return t}},function(t,n,r){var e=r(4)("unscopables"),o=Array.prototype;void 0==o[e]&&r(10)(o,e,{}),t.exports=function(t){o[e][t]=!0}},function(t,n,r){var e=r(9),o=r(15),i=r(64)("IE_PROTO"),u=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=o(t),e(t,i)?t[i]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?u:null}},function(t,n){t.exports={}},function(t,n,r){var e=r(6).f,o=r(9),i=r(4)("toStringTag");t.exports=function(t,n,r){t&&!o(t=r?t:t.prototype,i)&&e(t,i,{configurable:!0,value:n})}},function(t,n,r){var e=r(21),o=Math.max,i=Math.min;t.exports=function(t,n){return(t=e(t))<0?o(t+n,0):i(t,n)}},function(t,n){var r={}.toString;t.exports=function(t){return r.call(t).slice(8,-1)}},function(t,n){t.exports=function(t,n,r,e){if(!(t instanceof n)||void 0!==e&&e in t)throw TypeError(r+": incorrect invocation!");return t}},function(t,n,r){var e=r(18);t.exports=function(t,n,r){for(var o in n)e(t,o,n[o],r);return t}},function(t,n){n.f={}.propertyIsEnumerable},function(t,n,r){var e=r(16),o=r(66),i=r(15),u=r(7),c=r(201);t.exports=function(t,n){var r=1==t,a=2==t,f=3==t,s=4==t,l=6==t,h=5==t||l,p=n||c;return function(n,c,v){for(var d,y,g=i(n),m=o(g),b=e(c,v,3),w=u(m.length),_=0,x=r?p(n,w):a?p(n,0):void 0;w>_;_++)if((h||_ in m)&&(y=b(d=m[_],_,g),t))if(r)x[_]=y;else if(y)switch(t){case 3:return!0;case 5:return d;case 6:return _;case 2:x.push(d)}else if(s)return!1;return l?-1:f||s?s:x}}},function(t,n,r){var e=r(3),o=r(202),i=r(62),u=r(64)("IE_PROTO"),c=function(){},a=function(){var t,n=r(68)("iframe"),e=i.length;for(n.style.display="none",r(88).appendChild(n),n.src="javascript:",(t=n.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),a=t.F;e--;)delete a.prototype[i[e]];return a()};t.exports=Object.create||function(t,n){var r;return null!==t?(c.prototype=e(t),r=new c,c.prototype=null,r[u]=t):r=a(),void 0===n?r:o(r,n)}},function(t,n,r){var e=r(89),o=r(62).concat("length","prototype");n.f=Object.getOwnPropertyNames||function(t){return e(t,o)}},function(t,n,r){var e=r(1);t.exports=function(t,n){if(!e(t))return t;var r,o;if(n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;if("function"==typeof(r=t.valueOf)&&!e(o=r.call(t)))return o;if(!n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,n,r){"use strict";var e=r(10),o=r(18),i=r(5),u=r(20),c=r(4);t.exports=function(t,n,r){var a=c(t),f=r(u,a,""[t]),s=f[0],l=f[1];i(function(){var n={};return n[a]=function(){return 7},7!=""[t](n)})&&(o(String.prototype,t,s),e(RegExp.prototype,a,2==n?function(t,n){return l.call(t,this,n)}:function(t){return l.call(t,this)}))}},function(t,n,r){var e=r(2).navigator;t.exports=e&&e.userAgent||""},function(t,n){n.f=Object.getOwnPropertySymbols},function(t,n,r){"use strict";var e=r(2),o=r(0),i=r(18),u=r(35),c=r(17),a=r(45),f=r(34),s=r(1),l=r(5),h=r(46),p=r(31),v=r(189);t.exports=function(t,n,r,d,y,g){var m=e[t],b=m,w=y?"set":"add",_=b&&b.prototype,x={},S=function(t){var n=_[t];i(_,t,"delete"==t?function(t){return!(g&&!s(t))&&n.call(this,0===t?0:t)}:"has"==t?function(t){return!(g&&!s(t))&&n.call(this,0===t?0:t)}:"get"==t?function(t){return g&&!s(t)?void 0:n.call(this,0===t?0:t)}:"add"==t?function(t){return n.call(this,0===t?0:t),this}:function(t,r){return n.call(this,0===t?0:t,r),this})};if("function"==typeof b&&(g||_.forEach&&!l(function(){(new b).entries().next()}))){var E=new b,O=E[w](g?{}:-0,1)!=E,P=l(function(){E.has(1)}),A=h(function(t){new b(t)}),M=!g&&l(function(){for(var t=new b,n=5;n--;)t[w](n,n);return!t.has(-0)});A||((b=n(function(n,r){f(n,b,t);var e=v(new m,n,b);return void 0!=r&&a(r,y,e[w],e),e})).prototype=_,_.constructor=b),(P||M)&&(S("delete"),S("has"),y&&S("get")),(M||O)&&S(w),g&&_.clear&&delete _.clear}else b=d.getConstructor(n,t,y,w),u(b.prototype,r),c.NEED=!0;return p(b,t),x[t]=b,o(o.G+o.W+o.F*(b!=m),x),g||d.setStrong(b,t,y),b}},function(t,n,r){var e=r(16),o=r(82),i=r(58),u=r(3),c=r(7),a=r(57),f={},s={};(n=t.exports=function(t,n,r,l,h){var p,v,d,y,g=h?function(){return t}:a(t),m=e(r,l,n?2:1),b=0;if("function"!=typeof g)throw TypeError(t+" is not iterable!");if(i(g)){for(p=c(t.length);p>b;b++)if((y=n?m(u(v=t[b])[0],v[1]):m(t[b]))===f||y===s)return y}else for(d=g.call(t);!(v=d.next()).done;)if((y=o(d,m,v.value,n))===f||y===s)return y}).BREAK=f,n.RETURN=s},function(t,n,r){var e=r(4)("iterator"),o=!1;try{var i=[7][e]();i.return=function(){o=!0},Array.from(i,function(){throw 2})}catch(t){}t.exports=function(t,n){if(!n&&!o)return!1;var r=!1;try{var i=[7],u=i[e]();u.next=function(){return{done:r=!0}},i[e]=function(){return u},t(i)}catch(t){}return r}},function(t,n,r){"use strict";var e=r(2),o=r(6),i=r(8),u=r(4)("species");t.exports=function(t){var n=e[t];i&&n&&!n[u]&&o.f(n,u,{configurable:!0,get:function(){return this}})}},function(t,n,r){for(var e,o=r(2),i=r(10),u=r(24),c=u("typed_array"),a=u("view"),f=!(!o.ArrayBuffer||!o.DataView),s=f,l=0,h="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");l<9;)(e=o[h[l++]])?(i(e.prototype,c,!0),i(e.prototype,a,!0)):s=!1;t.exports={ABV:f,CONSTR:s,TYPED:c,VIEW:a}},function(t,n){var r=Math.expm1;t.exports=!r||r(10)>22025.465794806718||r(10)<22025.465794806718||-2e-17!=r(-2e-17)?function(t){return 0==(t=+t)?t:t>-1e-6&&t<1e-6?t+t*t/2:Math.exp(t)-1}:r},function(t,n){t.exports=Math.sign||function(t){return 0==(t=+t)||t!=t?t:t<0?-1:1}},function(t,n,r){"use strict";var e=r(6),o=r(25);t.exports=function(t,n,r){n in t?e.f(t,n,o(0,r)):t[n]=r}},function(t,n,r){var e=r(4)("match");t.exports=function(t){var n=/./;try{"/./"[t](n)}catch(r){try{return n[e]=!1,!"/./"[t](n)}catch(t){}}return!0}},function(t,n,r){var e=r(73),o=r(20);t.exports=function(t,n,r){if(e(n))throw TypeError("String#"+r+" doesn't accept regex!");return String(o(t))}},function(t,n,r){var e,o,i,u=r(16),c=r(79),a=r(88),f=r(68),s=r(2),l=s.process,h=s.setImmediate,p=s.clearImmediate,v=s.MessageChannel,d=s.Dispatch,y=0,g={},m=function(){var t=+this;if(g.hasOwnProperty(t)){var n=g[t];delete g[t],n()}},b=function(t){m.call(t.data)};h&&p||(h=function(t){for(var n=[],r=1;arguments.length>r;)n.push(arguments[r++]);return g[++y]=function(){c("function"==typeof t?t:Function(t),n)},e(y),y},p=function(t){delete g[t]},"process"==r(33)(l)?e=function(t){l.nextTick(u(m,t,1))}:d&&d.now?e=function(t){d.now(u(m,t,1))}:v?(i=(o=new v).port2,o.port1.onmessage=b,e=u(i.postMessage,i,1)):s.addEventListener&&"function"==typeof postMessage&&!s.importScripts?(e=function(t){s.postMessage(t+"","*")},s.addEventListener("message",b,!1)):e="onreadystatechange"in f("script")?function(t){a.appendChild(f("script")).onreadystatechange=function(){a.removeChild(this),m.call(t)}}:function(t){setTimeout(u(m,t,1),0)}),t.exports={set:h,clear:p}},function(t,n,r){var e=r(1),o=r(3),i=function(t,n){if(o(t),!e(n)&&null!==n)throw TypeError(n+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,n,e){try{(e=r(16)(Function.call,r(13).f(Object.prototype,"__proto__").set,2))(t,[]),n=!(t instanceof Array)}catch(t){n=!0}return function(t,r){return i(t,r),n?t.__proto__=r:e(t,r),t}}({},!1):void 0),check:i}},function(t,n,r){"use strict";var e=r(28),o=r(86),i=r(30),u=r(12);t.exports=r(85)(Array,"Array",function(t,n){this._t=u(t),this._i=0,this._k=n},function(){var t=this._t,n=this._k,r=this._i++;return!t||r>=t.length?(this._t=void 0,o(1)):o(0,"keys"==n?r:"values"==n?t[r]:[r,t[r]])},"values"),i.Arguments=i.Array,e("keys"),e("values"),e("entries")},function(t,n,r){var e=r(59),o=r(4)("iterator"),i=r(30);t.exports=r(26).getIteratorMethod=function(t){if(void 0!=t)return t[o]||t["@@iterator"]||i[e(t)]}},function(t,n,r){var e=r(30),o=r(4)("iterator"),i=Array.prototype;t.exports=function(t){return void 0!==t&&(e.Array===t||i[o]===t)}},function(t,n,r){var e=r(33),o=r(4)("toStringTag"),i="Arguments"==e(function(){return arguments}());t.exports=function(t){var n,r,u;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=function(t,n){try{return t[n]}catch(t){}}(n=Object(t),o))?r:i?e(n):"Object"==(u=e(n))&&"function"==typeof n.callee?"Arguments":u}},function(t,n,r){var e=r(3),o=r(23),i=r(4)("species");t.exports=function(t,n){var r,u=e(t).constructor;return void 0===u||void 0==(r=e(u)[i])?n:o(r)}},function(t,n,r){"use strict";var e=r(15),o=r(32),i=r(7);t.exports=function(t){for(var n=e(this),r=i(n.length),u=arguments.length,c=o(u>1?arguments[1]:void 0,r),a=u>2?arguments[2]:void 0,f=void 0===a?r:o(a,r);f>c;)n[c++]=t;return n}},function(t,n){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,n,r){var e=r(26),o=r(2),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(t.exports=function(t,n){return i[t]||(i[t]=void 0!==n?n:{})})("versions",[]).push({version:e.version,mode:r(22)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(t,n,r){var e=r(63)("keys"),o=r(24);t.exports=function(t){return e[t]||(e[t]=o(t))}},function(t,n,r){var e=r(12),o=r(7),i=r(32);t.exports=function(t){return function(n,r,u){var c,a=e(n),f=o(a.length),s=i(u,f);if(t&&r!=r){for(;f>s;)if((c=a[s++])!=c)return!0}else for(;f>s;s++)if((t||s in a)&&a[s]===r)return t||s||0;return!t&&-1}}},function(t,n,r){var e=r(33);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==e(t)?t.split(""):Object(t)}},function(t,n,r){"use strict";var e=r(2),o=r(8),i=r(22),u=r(48),c=r(10),a=r(35),f=r(5),s=r(34),l=r(21),h=r(7),p=r(90),v=r(39).f,d=r(6).f,y=r(61),g=r(31),m="prototype",b="Wrong index!",w=e.ArrayBuffer,_=e.DataView,x=e.Math,S=e.RangeError,E=e.Infinity,O=w,P=x.abs,A=x.pow,M=x.floor,j=x.log,F=x.LN2,L=o?"_b":"buffer",T=o?"_l":"byteLength",I=o?"_o":"byteOffset";function B(t,n,r){var e,o,i,u=new Array(r),c=8*r-n-1,a=(1<<c)-1,f=a>>1,s=23===n?A(2,-24)-A(2,-77):0,l=0,h=t<0||0===t&&1/t<0?1:0;for((t=P(t))!=t||t===E?(o=t!=t?1:0,e=a):(e=M(j(t)/F),t*(i=A(2,-e))<1&&(e--,i*=2),(t+=e+f>=1?s/i:s*A(2,1-f))*i>=2&&(e++,i/=2),e+f>=a?(o=0,e=a):e+f>=1?(o=(t*i-1)*A(2,n),e+=f):(o=t*A(2,f-1)*A(2,n),e=0));n>=8;u[l++]=255&o,o/=256,n-=8);for(e=e<<n|o,c+=n;c>0;u[l++]=255&e,e/=256,c-=8);return u[--l]|=128*h,u}function R(t,n,r){var e,o=8*r-n-1,i=(1<<o)-1,u=i>>1,c=o-7,a=r-1,f=t[a--],s=127&f;for(f>>=7;c>0;s=256*s+t[a],a--,c-=8);for(e=s&(1<<-c)-1,s>>=-c,c+=n;c>0;e=256*e+t[a],a--,c-=8);if(0===s)s=1-u;else{if(s===i)return e?NaN:f?-E:E;e+=A(2,n),s-=u}return(f?-1:1)*e*A(2,s-n)}function N(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]}function k(t){return[255&t]}function C(t){return[255&t,t>>8&255]}function U(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]}function D(t){return B(t,52,8)}function W(t){return B(t,23,4)}function V(t,n,r){d(t[m],n,{get:function(){return this[r]}})}function G(t,n,r,e){var o=p(+r);if(o+n>t[T])throw S(b);var i=t[L]._b,u=o+t[I],c=i.slice(u,u+n);return e?c:c.reverse()}function q(t,n,r,e,o,i){var u=p(+r);if(u+n>t[T])throw S(b);for(var c=t[L]._b,a=u+t[I],f=e(+o),s=0;s<n;s++)c[a+s]=f[i?s:n-s-1]}if(u.ABV){if(!f(function(){w(1)})||!f(function(){new w(-1)})||f(function(){return new w,new w(1.5),new w(NaN),"ArrayBuffer"!=w.name})){for(var z,H=(w=function(t){return s(this,w),new O(p(t))})[m]=O[m],Y=v(O),K=0;Y.length>K;)(z=Y[K++])in w||c(w,z,O[z]);i||(H.constructor=w)}var J=new _(new w(2)),X=_[m].setInt8;J.setInt8(0,2147483648),J.setInt8(1,2147483649),!J.getInt8(0)&&J.getInt8(1)||a(_[m],{setInt8:function(t,n){X.call(this,t,n<<24>>24)},setUint8:function(t,n){X.call(this,t,n<<24>>24)}},!0)}else w=function(t){s(this,w,"ArrayBuffer");var n=p(t);this._b=y.call(new Array(n),0),this[T]=n},_=function(t,n,r){s(this,_,"DataView"),s(t,w,"DataView");var e=t[T],o=l(n);if(o<0||o>e)throw S("Wrong offset!");if(o+(r=void 0===r?e-o:h(r))>e)throw S("Wrong length!");this[L]=t,this[I]=o,this[T]=r},o&&(V(w,"byteLength","_l"),V(_,"buffer","_b"),V(_,"byteLength","_l"),V(_,"byteOffset","_o")),a(_[m],{getInt8:function(t){return G(this,1,t)[0]<<24>>24},getUint8:function(t){return G(this,1,t)[0]},getInt16:function(t){var n=G(this,2,t,arguments[1]);return(n[1]<<8|n[0])<<16>>16},getUint16:function(t){var n=G(this,2,t,arguments[1]);return n[1]<<8|n[0]},getInt32:function(t){return N(G(this,4,t,arguments[1]))},getUint32:function(t){return N(G(this,4,t,arguments[1]))>>>0},getFloat32:function(t){return R(G(this,4,t,arguments[1]),23,4)},getFloat64:function(t){return R(G(this,8,t,arguments[1]),52,8)},setInt8:function(t,n){q(this,1,t,k,n)},setUint8:function(t,n){q(this,1,t,k,n)},setInt16:function(t,n){q(this,2,t,C,n,arguments[2])},setUint16:function(t,n){q(this,2,t,C,n,arguments[2])},setInt32:function(t,n){q(this,4,t,U,n,arguments[2])},setUint32:function(t,n){q(this,4,t,U,n,arguments[2])},setFloat32:function(t,n){q(this,4,t,W,n,arguments[2])},setFloat64:function(t,n){q(this,8,t,D,n,arguments[2])}});g(w,"ArrayBuffer"),g(_,"DataView"),c(_[m],u.VIEW,!0),n.ArrayBuffer=w,n.DataView=_},function(t,n,r){var e=r(1),o=r(2).document,i=e(o)&&e(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,n,r){var e=r(7),o=r(74),i=r(20);t.exports=function(t,n,r,u){var c=String(i(t)),a=c.length,f=void 0===r?" ":String(r),s=e(n);if(s<=a||""==f)return c;var l=s-a,h=o.call(f,Math.ceil(l/f.length));return h.length>l&&(h=h.slice(0,l)),u?h+c:c+h}},function(t,n,r){var e=r(19),o=r(12),i=r(36).f;t.exports=function(t){return function(n){for(var r,u=o(n),c=e(u),a=c.length,f=0,s=[];a>f;)i.call(u,r=c[f++])&&s.push(t?[r,u[r]]:u[r]);return s}}},function(t,n){t.exports=Math.log1p||function(t){return(t=+t)>-1e-8&&t<1e-8?t-t*t/2:Math.log(1+t)}},function(t,n,r){var e=r(1),o=Math.floor;t.exports=function(t){return!e(t)&&isFinite(t)&&o(t)===t}},function(t,n,r){var e=r(1),o=r(33),i=r(4)("match");t.exports=function(t){var n;return e(t)&&(void 0!==(n=t[i])?!!n:"RegExp"==o(t))}},function(t,n,r){"use strict";var e=r(21),o=r(20);t.exports=function(t){var n=String(o(this)),r="",i=e(t);if(i<0||i==1/0)throw RangeError("Count can't be negative");for(;i>0;(i>>>=1)&&(n+=n))1&i&&(r+=n);return r}},function(t,n,r){var e=r(12),o=r(39).f,i={}.toString,u="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return u&&"[object Window]"==i.call(t)?function(t){try{return o(t)}catch(t){return u.slice()}}(t):o(e(t))}},function(t,n,r){n.f=r(4)},function(t,n,r){"use strict";var e=r(23);t.exports.f=function(t){return new function(t){var n,r;this.promise=new t(function(t,e){if(void 0!==n||void 0!==r)throw TypeError("Bad Promise constructor");n=t,r=e}),this.resolve=e(n),this.reject=e(r)}(t)}},function(t,n,r){var e=r(39),o=r(43),i=r(3),u=r(2).Reflect;t.exports=u&&u.ownKeys||function(t){var n=e.f(i(t)),r=o.f;return r?n.concat(r(t)):n}},function(t,n){t.exports=function(t,n,r){var e=void 0===r;switch(n.length){case 0:return e?t():t.call(r);case 1:return e?t(n[0]):t.call(r,n[0]);case 2:return e?t(n[0],n[1]):t.call(r,n[0],n[1]);case 3:return e?t(n[0],n[1],n[2]):t.call(r,n[0],n[1],n[2]);case 4:return e?t(n[0],n[1],n[2],n[3]):t.call(r,n[0],n[1],n[2],n[3])}return t.apply(r,n)}},function(t,n,r){"use strict";var e=r(35),o=r(17).getWeak,i=r(3),u=r(1),c=r(34),a=r(45),f=r(37),s=r(9),l=r(27),h=f(5),p=f(6),v=0,d=function(t){return t._l||(t._l=new y)},y=function(){this.a=[]},g=function(t,n){return h(t.a,function(t){return t[0]===n})};y.prototype={get:function(t){var n=g(this,t);if(n)return n[1]},has:function(t){return!!g(this,t)},set:function(t,n){var r=g(this,t);r?r[1]=n:this.a.push([t,n])},delete:function(t){var n=p(this.a,function(n){return n[0]===t});return~n&&this.a.splice(n,1),!!~n}},t.exports={getConstructor:function(t,n,r,i){var f=t(function(t,e){c(t,f,n,"_i"),t._t=n,t._i=v++,t._l=void 0,void 0!=e&&a(e,r,t[i],t)});return e(f.prototype,{delete:function(t){if(!u(t))return!1;var r=o(t);return!0===r?d(l(this,n)).delete(t):r&&s(r,this._i)&&delete r[this._i]},has:function(t){if(!u(t))return!1;var r=o(t);return!0===r?d(l(this,n)).has(t):r&&s(r,this._i)}}),f},def:function(t,n,r){var e=o(i(n),!0);return!0===e?d(t).set(n,r):e[t._i]=r,t},ufstore:d}},function(t,n,r){"use strict";var e=r(19),o=r(43),i=r(36),u=r(15),c=r(66),a=Object.assign;t.exports=!a||r(5)(function(){var t={},n={},r=Symbol(),e="abcdefghijklmnopqrst";return t[r]=7,e.split("").forEach(function(t){n[t]=t}),7!=a({},t)[r]||Object.keys(a({},n)).join("")!=e})?function(t,n){for(var r=u(t),a=arguments.length,f=1,s=o.f,l=i.f;a>f;)for(var h,p=c(arguments[f++]),v=s?e(p).concat(s(p)):e(p),d=v.length,y=0;d>y;)l.call(p,h=v[y++])&&(r[h]=p[h]);return r}:a},function(t,n,r){var e=r(3);t.exports=function(t,n,r,o){try{return o?n(e(r)[0],r[1]):n(r)}catch(n){var i=t.return;throw void 0!==i&&e(i.call(t)),n}}},function(t,n,r){"use strict";var e=r(6).f,o=r(38),i=r(35),u=r(16),c=r(34),a=r(45),f=r(85),s=r(86),l=r(47),h=r(8),p=r(17).fastKey,v=r(27),d=h?"_s":"size",y=function(t,n){var r,e=p(n);if("F"!==e)return t._i[e];for(r=t._f;r;r=r.n)if(r.k==n)return r};t.exports={getConstructor:function(t,n,r,f){var s=t(function(t,e){c(t,s,n,"_i"),t._t=n,t._i=o(null),t._f=void 0,t._l=void 0,t[d]=0,void 0!=e&&a(e,r,t[f],t)});return i(s.prototype,{clear:function(){for(var t=v(this,n),r=t._i,e=t._f;e;e=e.n)e.r=!0,e.p&&(e.p=e.p.n=void 0),delete r[e.i];t._f=t._l=void 0,t[d]=0},delete:function(t){var r=v(this,n),e=y(r,t);if(e){var o=e.n,i=e.p;delete r._i[e.i],e.r=!0,i&&(i.n=o),o&&(o.p=i),r._f==e&&(r._f=o),r._l==e&&(r._l=i),r[d]--}return!!e},forEach:function(t){v(this,n);for(var r,e=u(t,arguments.length>1?arguments[1]:void 0,3);r=r?r.n:this._f;)for(e(r.v,r.k,this);r&&r.r;)r=r.p},has:function(t){return!!y(v(this,n),t)}}),h&&e(s.prototype,"size",{get:function(){return v(this,n)[d]}}),s},def:function(t,n,r){var e,o,i=y(t,n);return i?i.v=r:(t._l=i={i:o=p(n,!0),k:n,v:r,p:e=t._l,n:void 0,r:!1},t._f||(t._f=i),e&&(e.n=i),t[d]++,"F"!==o&&(t._i[o]=i)),t},getEntry:y,setStrong:function(t,n,r){f(t,n,function(t,r){this._t=v(t,n),this._k=r,this._l=void 0},function(){for(var t=this._k,n=this._l;n&&n.r;)n=n.p;return this._t&&(this._l=n=n?n.n:this._t._f)?s(0,"keys"==t?n.k:"values"==t?n.v:[n.k,n.v]):(this._t=void 0,s(1))},r?"entries":"values",!r,!0),l(n)}}},function(t,n,r){"use strict";var e=r(15),o=r(32),i=r(7);t.exports=[].copyWithin||function(t,n){var r=e(this),u=i(r.length),c=o(t,u),a=o(n,u),f=arguments.length>2?arguments[2]:void 0,s=Math.min((void 0===f?u:o(f,u))-a,u-c),l=1;for(a<c&&c<a+s&&(l=-1,a+=s-1,c+=s-1);s-- >0;)a in r?r[c]=r[a]:delete r[c],c+=l,a+=l;return r}},function(t,n,r){"use strict";var e=r(22),o=r(0),i=r(18),u=r(10),c=r(30),a=r(199),f=r(31),s=r(29),l=r(4)("iterator"),h=!([].keys&&"next"in[].keys()),p=function(){return this};t.exports=function(t,n,r,v,d,y,g){a(r,n,v);var m,b,w,_=function(t){if(!h&&t in O)return O[t];switch(t){case"keys":case"values":return function(){return new r(this,t)}}return function(){return new r(this,t)}},x=n+" Iterator",S="values"==d,E=!1,O=t.prototype,P=O[l]||O["@@iterator"]||d&&O[d],A=P||_(d),M=d?S?_("entries"):A:void 0,j="Array"==n&&O.entries||P;if(j&&(w=s(j.call(new t)))!==Object.prototype&&w.next&&(f(w,x,!0),e||"function"==typeof w[l]||u(w,l,p)),S&&P&&"values"!==P.name&&(E=!0,A=function(){return P.call(this)}),e&&!g||!h&&!E&&O[l]||u(O,l,A),c[n]=A,c[x]=p,d)if(m={values:S?A:_("values"),keys:y?A:_("keys"),entries:M},g)for(b in m)b in O||i(O,b,m[b]);else o(o.P+o.F*(h||E),n,m);return m}},function(t,n){t.exports=function(t,n){return{value:n,done:!!t}}},function(t,n,r){var e=r(33);t.exports=Array.isArray||function(t){return"Array"==e(t)}},function(t,n,r){var e=r(2).document;t.exports=e&&e.documentElement},function(t,n,r){var e=r(9),o=r(12),i=r(65)(!1),u=r(64)("IE_PROTO");t.exports=function(t,n){var r,c=o(t),a=0,f=[];for(r in c)r!=u&&e(c,r)&&f.push(r);for(;n.length>a;)e(c,r=n[a++])&&(~i(f,r)||f.push(r));return f}},function(t,n,r){var e=r(21),o=r(7);t.exports=function(t){if(void 0===t)return 0;var n=e(t),r=o(n);if(n!==r)throw RangeError("Wrong length!");return r}},function(t,n,r){t.exports=!r(8)&&!r(5)(function(){return 7!=Object.defineProperty(r(68)("div"),"a",{get:function(){return 7}}).a})},function(t,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.default=function t(n){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t);var r=n.parentElement,e=r.getElementsByClassName("heading"),o=r.getElementsByTagName("label").item(0);o&&o.classList.add("otgs-on-off-switch");var i=document.createElement("label");i.classList.add("otgs-toggle-group"),i.appendChild(n),i.appendChild(o);var u=document.createElement("span");u.classList.add("otgs-switch__onoff");var c=document.createElement("span");c.classList.add("otgs-switch__onoff-label");var a=document.createElement("span");a.classList.add("otgs-switch__onoff-inner");var f=document.createElement("span");f.classList.add("otgs-switch__onoff-switch"),c.appendChild(a),c.appendChild(f),u.appendChild(c),i.appendChild(u),r.appendChild(i),e.length?e.item(e.length-1).parentNode.insertBefore(i,e.item(e.length-1).nextSibling):r.insertBefore(i,r.firstChild)}},function(t,n,r){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),r(213);var e,o=r(92),i=(e=o)&&e.__esModule?e:{default:e};n.default=function t(n){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t);var r=n.querySelectorAll('input[type="checkbox"]');r&&Array.from(r).map(function(t){return new i.default(t)})}},function(t,n){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,n,r){(function(n){!function(n){"use strict";var r,e=Object.prototype,o=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag",f="object"==typeof t,s=n.regeneratorRuntime;if(s)f&&(t.exports=s);else{(s=n.regeneratorRuntime=f?t.exports:{}).wrap=w;var l="suspendedStart",h="suspendedYield",p="executing",v="completed",d={},y={};y[u]=function(){return this};var g=Object.getPrototypeOf,m=g&&g(g(L([])));m&&m!==e&&o.call(m,u)&&(y=m);var b=E.prototype=x.prototype=Object.create(y);S.prototype=b.constructor=E,E.constructor=S,E[a]=S.displayName="GeneratorFunction",s.isGeneratorFunction=function(t){var n="function"==typeof t&&t.constructor;return!!n&&(n===S||"GeneratorFunction"===(n.displayName||n.name))},s.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,a in t||(t[a]="GeneratorFunction")),t.prototype=Object.create(b),t},s.awrap=function(t){return{__await:t}},O(P.prototype),P.prototype[c]=function(){return this},s.AsyncIterator=P,s.async=function(t,n,r,e){var o=new P(w(t,n,r,e));return s.isGeneratorFunction(n)?o:o.next().then(function(t){return t.done?t.value:o.next()})},O(b),b[a]="Generator",b[u]=function(){return this},b.toString=function(){return"[object Generator]"},s.keys=function(t){var n=[];for(var r in t)n.push(r);return n.reverse(),function r(){for(;n.length;){var e=n.pop();if(e in t)return r.value=e,r.done=!1,r}return r.done=!0,r}},s.values=L,F.prototype={constructor:F,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(j),!t)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function e(e,o){return c.type="throw",c.arg=t,n.next=e,o&&(n.method="next",n.arg=r),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],c=u.completion;if("root"===u.tryLoc)return e("end");if(u.tryLoc<=this.prev){var a=o.call(u,"catchLoc"),f=o.call(u,"finallyLoc");if(a&&f){if(this.prev<u.catchLoc)return e(u.catchLoc,!0);if(this.prev<u.finallyLoc)return e(u.finallyLoc)}else if(a){if(this.prev<u.catchLoc)return e(u.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return e(u.finallyLoc)}}}},abrupt:function(t,n){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc<=this.prev&&o.call(e,"finallyLoc")&&this.prev<e.finallyLoc){var i=e;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=n&&n<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=n,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(u)},complete:function(t,n){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&n&&(this.next=n),d},finish:function(t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),j(r),d}},catch:function(t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc===t){var e=r.completion;if("throw"===e.type){var o=e.arg;j(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,e){return this.delegate={iterator:L(t),resultName:n,nextLoc:e},"next"===this.method&&(this.arg=r),d}}}function w(t,n,r,e){var o=n&&n.prototype instanceof x?n:x,i=Object.create(o.prototype),u=new F(e||[]);return i._invoke=function(t,n,r){var e=l;return function(o,i){if(e===p)throw new Error("Generator is already running");if(e===v){if("throw"===o)throw i;return T()}for(r.method=o,r.arg=i;;){var u=r.delegate;if(u){var c=A(u,r);if(c){if(c===d)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(e===l)throw e=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);e=p;var a=_(t,n,r);if("normal"===a.type){if(e=r.done?v:h,a.arg===d)continue;return{value:a.arg,done:r.done}}"throw"===a.type&&(e=v,r.method="throw",r.arg=a.arg)}}}(t,r,u),i}function _(t,n,r){try{return{type:"normal",arg:t.call(n,r)}}catch(t){return{type:"throw",arg:t}}}function x(){}function S(){}function E(){}function O(t){["next","throw","return"].forEach(function(n){t[n]=function(t){return this._invoke(n,t)}})}function P(t){function r(n,e,i,u){var c=_(t[n],t,e);if("throw"!==c.type){var a=c.arg,f=a.value;return f&&"object"==typeof f&&o.call(f,"__await")?Promise.resolve(f.__await).then(function(t){r("next",t,i,u)},function(t){r("throw",t,i,u)}):Promise.resolve(f).then(function(t){a.value=t,i(a)},u)}u(c.arg)}var e;"object"==typeof n.process&&n.process.domain&&(r=n.process.domain.bind(r)),this._invoke=function(t,n){function o(){return new Promise(function(e,o){r(t,n,e,o)})}return e=e?e.then(o,o):o()}}function A(t,n){var e=t.iterator[n.method];if(e===r){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=r,A(t,n),"throw"===n.method))return d;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var o=_(e,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,d;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=r),n.delegate=null,d):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function M(t){var n={tryLoc:t[0]};1 in t&&(n.catchLoc=t[1]),2 in t&&(n.finallyLoc=t[2],n.afterLoc=t[3]),this.tryEntries.push(n)}function j(t){var n=t.completion||{};n.type="normal",delete n.arg,t.completion=n}function F(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(M,this),this.reset(!0)}function L(t){if(t){var n=t[u];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var e=-1,i=function n(){for(;++e<t.length;)if(o.call(t,e))return n.value=t[e],n.done=!1,n;return n.value=r,n.done=!0,n};return i.next=i}}return{next:T}}function T(){return{value:r,done:!0}}}("object"==typeof n?n:"object"==typeof window?window:"object"==typeof self?self:this)}).call(this,r(94))},function(t,n,r){for(var e=r(56),o=r(19),i=r(18),u=r(2),c=r(10),a=r(30),f=r(4),s=f("iterator"),l=f("toStringTag"),h=a.Array,p={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},v=o(p),d=0;d<v.length;d++){var y,g=v[d],m=p[g],b=u[g],w=b&&b.prototype;if(w&&(w[s]||c(w,s,h),w[l]||c(w,l,g),a[g]=h,m))for(y in e)w[y]||i(w,y,e[y],!0)}},function(t,n,r){var e=r(0),o=r(54);e(e.G+e.B,{setImmediate:o.set,clearImmediate:o.clear})},function(t,n,r){var e=r(2),o=r(0),i=r(42),u=[].slice,c=/MSIE .\./.test(i),a=function(t){return function(n,r){var e=arguments.length>2,o=!!e&&u.call(arguments,2);return t(e?function(){("function"==typeof n?n:Function(n)).apply(this,o)}:n,r)}};o(o.G+o.B+o.F*c,{setTimeout:a(e.setTimeout),setInterval:a(e.setInterval)})},function(t,n,r){"use strict";var e=r(0),o=r(69),i=r(42);e(e.P+e.F*/Version\/10\.\d+(\.\d+)? Safari\//.test(i),"String",{padEnd:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0,!1)}})},function(t,n,r){"use strict";var e=r(0),o=r(69),i=r(42);e(e.P+e.F*/Version\/10\.\d+(\.\d+)? Safari\//.test(i),"String",{padStart:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0,!0)}})},function(t,n,r){var e=r(0),o=r(78),i=r(12),u=r(13),c=r(51);e(e.S,"Object",{getOwnPropertyDescriptors:function(t){for(var n,r,e=i(t),a=u.f,f=o(e),s={},l=0;f.length>l;)void 0!==(r=a(e,n=f[l++]))&&c(s,n,r);return s}})},function(t,n,r){var e=r(0),o=r(70)(!0);e(e.S,"Object",{entries:function(t){return o(t)}})},function(t,n,r){var e=r(0),o=r(70)(!1);e(e.S,"Object",{values:function(t){return o(t)}})},function(t,n,r){"use strict";var e=r(0),o=r(65)(!0);e(e.P,"Array",{includes:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),r(28)("includes")},function(t,n,r){var e=r(0);e(e.S,"Math",{trunc:function(t){return(t>0?Math.floor:Math.ceil)(t)}})},function(t,n,r){var e=r(0),o=r(49),i=Math.exp;e(e.S,"Math",{tanh:function(t){var n=o(t=+t),r=o(-t);return n==1/0?1:r==1/0?-1:(n-r)/(i(t)+i(-t))}})},function(t,n,r){var e=r(0),o=r(49),i=Math.exp;e(e.S+e.F*r(5)(function(){return-2e-17!=!Math.sinh(-2e-17)}),"Math",{sinh:function(t){return Math.abs(t=+t)<1?(o(t)-o(-t))/2:(i(t-1)-i(-t-1))*(Math.E/2)}})},function(t,n,r){var e=r(0);e(e.S,"Math",{sign:r(50)})},function(t,n,r){var e=r(0);e(e.S,"Math",{log2:function(t){return Math.log(t)/Math.LN2}})},function(t,n,r){var e=r(0);e(e.S,"Math",{log10:function(t){return Math.log(t)*Math.LOG10E}})},function(t,n,r){var e=r(0);e(e.S,"Math",{log1p:r(71)})},function(t,n,r){var e=r(0),o=Math.imul;e(e.S+e.F*r(5)(function(){return-5!=o(4294967295,5)||2!=o.length}),"Math",{imul:function(t,n){var r=+t,e=+n,o=65535&r,i=65535&e;return 0|o*i+((65535&r>>>16)*i+o*(65535&e>>>16)<<16>>>0)}})},function(t,n,r){var e=r(0),o=Math.abs;e(e.S,"Math",{hypot:function(t,n){for(var r,e,i=0,u=0,c=arguments.length,a=0;u<c;)a<(r=o(arguments[u++]))?(i=i*(e=a/r)*e+1,a=r):i+=r>0?(e=r/a)*e:r;return a===1/0?1/0:a*Math.sqrt(i)}})},function(t,n,r){var e=r(50),o=Math.pow,i=o(2,-52),u=o(2,-23),c=o(2,127)*(2-u),a=o(2,-126);t.exports=Math.fround||function(t){var n,r,o=Math.abs(t),f=e(t);return o<a?f*(o/a/u+1/i-1/i)*a*u:(r=(n=(1+u/i)*o)-(n-o))>c||r!=r?f*(1/0):f*r}},function(t,n,r){var e=r(0);e(e.S,"Math",{fround:r(114)})},function(t,n,r){var e=r(0),o=r(49);e(e.S+e.F*(o!=Math.expm1),"Math",{expm1:o})},function(t,n,r){var e=r(0),o=Math.exp;e(e.S,"Math",{cosh:function(t){return(o(t=+t)+o(-t))/2}})},function(t,n,r){var e=r(0);e(e.S,"Math",{clz32:function(t){return(t>>>=0)?31-Math.floor(Math.log(t+.5)*Math.LOG2E):32}})},function(t,n,r){var e=r(0),o=r(50);e(e.S,"Math",{cbrt:function(t){return o(t=+t)*Math.pow(Math.abs(t),1/3)}})},function(t,n,r){var e=r(0),o=Math.atanh;e(e.S+e.F*!(o&&1/o(-0)<0),"Math",{atanh:function(t){return 0==(t=+t)?t:Math.log((1+t)/(1-t))/2}})},function(t,n,r){var e=r(0),o=Math.asinh;e(e.S+e.F*!(o&&1/o(0)>0),"Math",{asinh:function t(n){return isFinite(n=+n)&&0!=n?n<0?-t(-n):Math.log(n+Math.sqrt(n*n+1)):n}})},function(t,n,r){var e=r(0),o=r(71),i=Math.sqrt,u=Math.acosh;e(e.S+e.F*!(u&&710==Math.floor(u(Number.MAX_VALUE))&&u(1/0)==1/0),"Math",{acosh:function(t){return(t=+t)<1?NaN:t>94906265.62425156?Math.log(t)+Math.LN2:o(t-1+i(t-1)*i(t+1))}})},function(t,n,r){var e=r(0);e(e.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},function(t,n,r){var e=r(0);e(e.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},function(t,n,r){var e=r(0);e(e.S,"Number",{EPSILON:Math.pow(2,-52)})},function(t,n,r){var e=r(0);e(e.S,"Number",{isNaN:function(t){return t!=t}})},function(t,n,r){var e=r(0),o=r(72),i=Math.abs;e(e.S,"Number",{isSafeInteger:function(t){return o(t)&&i(t)<=9007199254740991}})},function(t,n,r){var e=r(0);e(e.S,"Number",{isInteger:r(72)})},function(t,n,r){var e=r(0),o=r(2).isFinite;e(e.S,"Number",{isFinite:function(t){return"number"==typeof t&&o(t)}})},function(t,n,r){var e=r(0);e(e.P,"Array",{fill:r(61)}),r(28)("fill")},function(t,n,r){"use strict";var e=r(0),o=r(37)(6),i="findIndex",u=!0;i in[]&&Array(1)[i](function(){u=!1}),e(e.P+e.F*u,"Array",{findIndex:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),r(28)(i)},function(t,n,r){"use strict";var e=r(0),o=r(37)(5),i=!0;"find"in[]&&Array(1).find(function(){i=!1}),e(e.P+e.F*i,"Array",{find:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),r(28)("find")},function(t,n,r){var e=r(0);e(e.P,"Array",{copyWithin:r(84)}),r(28)("copyWithin")},function(t,n,r){"use strict";var e=r(0),o=r(51);e(e.S+e.F*r(5)(function(){function t(){}return!(Array.of.call(t)instanceof t)}),"Array",{of:function(){for(var t=0,n=arguments.length,r=new("function"==typeof this?this:Array)(n);n>t;)o(r,t,arguments[t++]);return r.length=n,r}})},function(t,n,r){"use strict";var e=r(16),o=r(0),i=r(15),u=r(82),c=r(58),a=r(7),f=r(51),s=r(57);o(o.S+o.F*!r(46)(function(t){Array.from(t)}),"Array",{from:function(t){var n,r,o,l,h=i(t),p="function"==typeof this?this:Array,v=arguments.length,d=v>1?arguments[1]:void 0,y=void 0!==d,g=0,m=s(h);if(y&&(d=e(d,v>2?arguments[2]:void 0,2)),void 0==m||p==Array&&c(m))for(r=new p(n=a(h.length));n>g;g++)f(r,g,y?d(h[g],g):h[g]);else for(l=m.call(h),r=new p;!(o=l.next()).done;g++)f(r,g,y?u(l,d,[o.value,g],!0):o.value);return r.length=g,r}})},function(t,n,r){r(41)("search",1,function(t,n,r){return[function(r){"use strict";var e=t(this),o=void 0==r?void 0:r[n];return void 0!==o?o.call(r,e):new RegExp(r)[n](String(e))},r]})},function(t,n,r){r(41)("split",2,function(t,n,e){"use strict";var o=r(73),i=e,u=[].push;if("c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length){var c=void 0===/()??/.exec("")[1];e=function(t,n){var r=String(this);if(void 0===t&&0===n)return[];if(!o(t))return i.call(r,t,n);var e,a,f,s,l,h=[],p=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),v=0,d=void 0===n?4294967295:n>>>0,y=new RegExp(t.source,p+"g");for(c||(e=new RegExp("^"+y.source+"$(?!\\s)",p));(a=y.exec(r))&&!((f=a.index+a[0].length)>v&&(h.push(r.slice(v,a.index)),!c&&a.length>1&&a[0].replace(e,function(){for(l=1;l<arguments.length-2;l++)void 0===arguments[l]&&(a[l]=void 0)}),a.length>1&&a.index<r.length&&u.apply(h,a.slice(1)),s=a[0].length,v=f,h.length>=d));)y.lastIndex===a.index&&y.lastIndex++;return v===r.length?!s&&y.test("")||h.push(""):h.push(r.slice(v)),h.length>d?h.slice(0,d):h}}else"0".split(void 0,0).length&&(e=function(t,n){return void 0===t&&0===n?[]:i.call(this,t,n)});return[function(r,o){var i=t(this),u=void 0==r?void 0:r[n];return void 0!==u?u.call(r,i,o):e.call(String(i),r,o)},e]})},function(t,n,r){r(41)("replace",2,function(t,n,r){return[function(e,o){"use strict";var i=t(this),u=void 0==e?void 0:e[n];return void 0!==u?u.call(e,i,o):r.call(String(i),e,o)},r]})},function(t,n,r){r(41)("match",1,function(t,n,r){return[function(r){"use strict";var e=t(this),o=void 0==r?void 0:r[n];return void 0!==o?o.call(r,e):new RegExp(r)[n](String(e))},r]})},function(t,n,r){"use strict";var e=r(3);t.exports=function(){var t=e(this),n="";return t.global&&(n+="g"),t.ignoreCase&&(n+="i"),t.multiline&&(n+="m"),t.unicode&&(n+="u"),t.sticky&&(n+="y"),n}},function(t,n,r){r(8)&&"g"!=/./g.flags&&r(6).f(RegExp.prototype,"flags",{configurable:!0,get:r(140)})},function(t,n,r){"use strict";var e=r(0),o=r(53);e(e.P+e.F*r(52)("includes"),"String",{includes:function(t){return!!~o(this,t,"includes").indexOf(t,arguments.length>1?arguments[1]:void 0)}})},function(t,n,r){"use strict";var e=r(0),o=r(7),i=r(53),u="".endsWith;e(e.P+e.F*r(52)("endsWith"),"String",{endsWith:function(t){var n=i(this,t,"endsWith"),r=arguments.length>1?arguments[1]:void 0,e=o(n.length),c=void 0===r?e:Math.min(o(r),e),a=String(t);return u?u.call(n,a,c):n.slice(c-a.length,c)===a}})},function(t,n,r){"use strict";var e=r(0),o=r(7),i=r(53),u="".startsWith;e(e.P+e.F*r(52)("startsWith"),"String",{startsWith:function(t){var n=i(this,t,"startsWith"),r=o(Math.min(arguments.length>1?arguments[1]:void 0,n.length)),e=String(t);return u?u.call(n,e,r):n.slice(r,r+e.length)===e}})},function(t,n,r){var e=r(0);e(e.P,"String",{repeat:r(74)})},function(t,n,r){var e=r(21),o=r(20);t.exports=function(t){return function(n,r){var i,u,c=String(o(n)),a=e(r),f=c.length;return a<0||a>=f?t?"":void 0:(i=c.charCodeAt(a))<55296||i>56319||a+1===f||(u=c.charCodeAt(a+1))<56320||u>57343?t?c.charAt(a):i:t?c.slice(a,a+2):u-56320+(i-55296<<10)+65536}}},function(t,n,r){"use strict";var e=r(0),o=r(146)(!1);e(e.P,"String",{codePointAt:function(t){return o(this,t)}})},function(t,n,r){var e=r(0),o=r(32),i=String.fromCharCode,u=String.fromCodePoint;e(e.S+e.F*(!!u&&1!=u.length),"String",{fromCodePoint:function(t){for(var n,r=[],e=arguments.length,u=0;e>u;){if(n=+arguments[u++],o(n,1114111)!==n)throw RangeError(n+" is not a valid code point");r.push(n<65536?i(n):i(55296+((n-=65536)>>10),n%1024+56320))}return r.join("")}})},function(t,n,r){var e=r(0),o=r(12),i=r(7);e(e.S,"String",{raw:function(t){for(var n=o(t.raw),r=i(n.length),e=arguments.length,u=[],c=0;r>c;)u.push(String(n[c++])),c<e&&u.push(String(arguments[c]));return u.join("")}})},function(t,n,r){var e=r(6).f,o=Function.prototype,i=/^\s*function ([^ (]*)/;"name"in o||r(8)&&e(o,"name",{configurable:!0,get:function(){try{return(""+this).match(i)[1]}catch(t){return""}}})},function(t,n,r){var e=r(0);e(e.S,"Object",{setPrototypeOf:r(55).set})},function(t,n){t.exports=Object.is||function(t,n){return t===n?0!==t||1/t==1/n:t!=t&&n!=n}},function(t,n,r){var e=r(0);e(e.S,"Object",{is:r(152)})},function(t,n,r){var e=r(0);e(e.S+e.F,"Object",{assign:r(81)})},function(t,n,r){r(11)("getOwnPropertyNames",function(){return r(75).f})},function(t,n,r){var e=r(15),o=r(19);r(11)("keys",function(){return function(t){return o(e(t))}})},function(t,n,r){var e=r(15),o=r(29);r(11)("getPrototypeOf",function(){return function(t){return o(e(t))}})},function(t,n,r){var e=r(12),o=r(13).f;r(11)("getOwnPropertyDescriptor",function(){return function(t,n){return o(e(t),n)}})},function(t,n,r){var e=r(1);r(11)("isExtensible",function(t){return function(n){return!!e(n)&&(!t||t(n))}})},function(t,n,r){var e=r(1);r(11)("isSealed",function(t){return function(n){return!e(n)||!!t&&t(n)}})},function(t,n,r){var e=r(1);r(11)("isFrozen",function(t){return function(n){return!e(n)||!!t&&t(n)}})},function(t,n,r){var e=r(1),o=r(17).onFreeze;r(11)("preventExtensions",function(t){return function(n){return t&&e(n)?t(o(n)):n}})},function(t,n,r){var e=r(1),o=r(17).onFreeze;r(11)("seal",function(t){return function(n){return t&&e(n)?t(o(n)):n}})},function(t,n,r){var e=r(1),o=r(17).onFreeze;r(11)("freeze",function(t){return function(n){return t&&e(n)?t(o(n)):n}})},function(t,n,r){var e=r(19),o=r(43),i=r(36);t.exports=function(t){var n=e(t),r=o.f;if(r)for(var u,c=r(t),a=i.f,f=0;c.length>f;)a.call(t,u=c[f++])&&n.push(u);return n}},function(t,n,r){var e=r(2),o=r(26),i=r(22),u=r(76),c=r(6).f;t.exports=function(t){var n=o.Symbol||(o.Symbol=i?{}:e.Symbol||{});"_"==t.charAt(0)||t in n||c(n,t,{value:u.f(t)})}},function(t,n,r){"use strict";var e=r(2),o=r(9),i=r(8),u=r(0),c=r(18),a=r(17).KEY,f=r(5),s=r(63),l=r(31),h=r(24),p=r(4),v=r(76),d=r(166),y=r(165),g=r(87),m=r(3),b=r(1),w=r(12),_=r(40),x=r(25),S=r(38),E=r(75),O=r(13),P=r(6),A=r(19),M=O.f,j=P.f,F=E.f,L=e.Symbol,T=e.JSON,I=T&&T.stringify,B=p("_hidden"),R=p("toPrimitive"),N={}.propertyIsEnumerable,k=s("symbol-registry"),C=s("symbols"),U=s("op-symbols"),D=Object.prototype,W="function"==typeof L,V=e.QObject,G=!V||!V.prototype||!V.prototype.findChild,q=i&&f(function(){return 7!=S(j({},"a",{get:function(){return j(this,"a",{value:7}).a}})).a})?function(t,n,r){var e=M(D,n);e&&delete D[n],j(t,n,r),e&&t!==D&&j(D,n,e)}:j,z=function(t){var n=C[t]=S(L.prototype);return n._k=t,n},H=W&&"symbol"==typeof L.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof L},Y=function(t,n,r){return t===D&&Y(U,n,r),m(t),n=_(n,!0),m(r),o(C,n)?(r.enumerable?(o(t,B)&&t[B][n]&&(t[B][n]=!1),r=S(r,{enumerable:x(0,!1)})):(o(t,B)||j(t,B,x(1,{})),t[B][n]=!0),q(t,n,r)):j(t,n,r)},K=function(t,n){m(t);for(var r,e=y(n=w(n)),o=0,i=e.length;i>o;)Y(t,r=e[o++],n[r]);return t},J=function(t){var n=N.call(this,t=_(t,!0));return!(this===D&&o(C,t)&&!o(U,t))&&(!(n||!o(this,t)||!o(C,t)||o(this,B)&&this[B][t])||n)},X=function(t,n){if(t=w(t),n=_(n,!0),t!==D||!o(C,n)||o(U,n)){var r=M(t,n);return!r||!o(C,n)||o(t,B)&&t[B][n]||(r.enumerable=!0),r}},$=function(t){for(var n,r=F(w(t)),e=[],i=0;r.length>i;)o(C,n=r[i++])||n==B||n==a||e.push(n);return e},Q=function(t){for(var n,r=t===D,e=F(r?U:w(t)),i=[],u=0;e.length>u;)!o(C,n=e[u++])||r&&!o(D,n)||i.push(C[n]);return i};W||(c((L=function(){if(this instanceof L)throw TypeError("Symbol is not a constructor!");var t=h(arguments.length>0?arguments[0]:void 0),n=function(r){this===D&&n.call(U,r),o(this,B)&&o(this[B],t)&&(this[B][t]=!1),q(this,t,x(1,r))};return i&&G&&q(D,t,{configurable:!0,set:n}),z(t)}).prototype,"toString",function(){return this._k}),O.f=X,P.f=Y,r(39).f=E.f=$,r(36).f=J,r(43).f=Q,i&&!r(22)&&c(D,"propertyIsEnumerable",J,!0),v.f=function(t){return z(p(t))}),u(u.G+u.W+u.F*!W,{Symbol:L});for(var Z="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),tt=0;Z.length>tt;)p(Z[tt++]);for(var nt=A(p.store),rt=0;nt.length>rt;)d(nt[rt++]);u(u.S+u.F*!W,"Symbol",{for:function(t){return o(k,t+="")?k[t]:k[t]=L(t)},keyFor:function(t){if(!H(t))throw TypeError(t+" is not a symbol!");for(var n in k)if(k[n]===t)return n},useSetter:function(){G=!0},useSimple:function(){G=!1}}),u(u.S+u.F*!W,"Object",{create:function(t,n){return void 0===n?S(t):K(S(t),n)},defineProperty:Y,defineProperties:K,getOwnPropertyDescriptor:X,getOwnPropertyNames:$,getOwnPropertySymbols:Q}),T&&u(u.S+u.F*(!W||f(function(){var t=L();return"[null]"!=I([t])||"{}"!=I({a:t})||"{}"!=I(Object(t))})),"JSON",{stringify:function(t){for(var n,r,e=[t],o=1;arguments.length>o;)e.push(arguments[o++]);if(r=n=e[1],(b(n)||void 0!==t)&&!H(t))return g(n)||(n=function(t,n){if("function"==typeof r&&(n=r.call(this,t,n)),!H(n))return n}),e[1]=n,I.apply(T,e)}}),L.prototype[R]||r(10)(L.prototype,R,L.prototype.valueOf),l(L,"Symbol"),l(Math,"Math",!0),l(e.JSON,"JSON",!0)},function(t,n,r){var e=r(3),o=r(1),i=r(77);t.exports=function(t,n){if(e(t),o(n)&&n.constructor===t)return n;var r=i.f(t);return(0,r.resolve)(n),r.promise}},function(t,n){t.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},function(t,n,r){var e=r(2),o=r(54).set,i=e.MutationObserver||e.WebKitMutationObserver,u=e.process,c=e.Promise,a="process"==r(33)(u);t.exports=function(){var t,n,r,f=function(){var e,o;for(a&&(e=u.domain)&&e.exit();t;){o=t.fn,t=t.next;try{o()}catch(e){throw t?r():n=void 0,e}}n=void 0,e&&e.enter()};if(a)r=function(){u.nextTick(f)};else if(!i||e.navigator&&e.navigator.standalone)if(c&&c.resolve){var s=c.resolve(void 0);r=function(){s.then(f)}}else r=function(){o.call(e,f)};else{var l=!0,h=document.createTextNode("");new i(f).observe(h,{characterData:!0}),r=function(){h.data=l=!l}}return function(e){var o={fn:e,next:void 0};n&&(n.next=o),t||(t=o,r()),n=o}}},function(t,n,r){"use strict";var e,o,i,u,c=r(22),a=r(2),f=r(16),s=r(59),l=r(0),h=r(1),p=r(23),v=r(34),d=r(45),y=r(60),g=r(54).set,m=r(170)(),b=r(77),w=r(169),_=r(42),x=r(168),S=a.TypeError,E=a.process,O=E&&E.versions,P=O&&O.v8||"",A=a.Promise,M="process"==s(E),j=function(){},F=o=b.f,L=!!function(){try{var t=A.resolve(1),n=(t.constructor={})[r(4)("species")]=function(t){t(j,j)};return(M||"function"==typeof PromiseRejectionEvent)&&t.then(j)instanceof n&&0!==P.indexOf("6.6")&&-1===_.indexOf("Chrome/66")}catch(t){}}(),T=function(t){var n;return!(!h(t)||"function"!=typeof(n=t.then))&&n},I=function(t,n){if(!t._n){t._n=!0;var r=t._c;m(function(){for(var e=t._v,o=1==t._s,i=0,u=function(n){var r,i,u,c=o?n.ok:n.fail,a=n.resolve,f=n.reject,s=n.domain;try{c?(o||(2==t._h&&N(t),t._h=1),!0===c?r=e:(s&&s.enter(),r=c(e),s&&(s.exit(),u=!0)),r===n.promise?f(S("Promise-chain cycle")):(i=T(r))?i.call(r,a,f):a(r)):f(e)}catch(t){s&&!u&&s.exit(),f(t)}};r.length>i;)u(r[i++]);t._c=[],t._n=!1,n&&!t._h&&B(t)})}},B=function(t){g.call(a,function(){var n,r,e,o=t._v,i=R(t);if(i&&(n=w(function(){M?E.emit("unhandledRejection",o,t):(r=a.onunhandledrejection)?r({promise:t,reason:o}):(e=a.console)&&e.error&&e.error("Unhandled promise rejection",o)}),t._h=M||R(t)?2:1),t._a=void 0,i&&n.e)throw n.v})},R=function(t){return 1!==t._h&&0===(t._a||t._c).length},N=function(t){g.call(a,function(){var n;M?E.emit("rejectionHandled",t):(n=a.onrejectionhandled)&&n({promise:t,reason:t._v})})},k=function(t){var n=this;n._d||(n._d=!0,(n=n._w||n)._v=t,n._s=2,n._a||(n._a=n._c.slice()),I(n,!0))},C=function(t){var n,r=this;if(!r._d){r._d=!0,r=r._w||r;try{if(r===t)throw S("Promise can't be resolved itself");(n=T(t))?m(function(){var e={_w:r,_d:!1};try{n.call(t,f(C,e,1),f(k,e,1))}catch(t){k.call(e,t)}}):(r._v=t,r._s=1,I(r,!1))}catch(t){k.call({_w:r,_d:!1},t)}}};L||(A=function(t){v(this,A,"Promise","_h"),p(t),e.call(this);try{t(f(C,this,1),f(k,this,1))}catch(t){k.call(this,t)}},(e=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=r(35)(A.prototype,{then:function(t,n){var r=F(y(this,A));return r.ok="function"!=typeof t||t,r.fail="function"==typeof n&&n,r.domain=M?E.domain:void 0,this._c.push(r),this._a&&this._a.push(r),this._s&&I(this,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),i=function(){var t=new e;this.promise=t,this.resolve=f(C,t,1),this.reject=f(k,t,1)},b.f=F=function(t){return t===A||t===u?new i(t):o(t)}),l(l.G+l.W+l.F*!L,{Promise:A}),r(31)(A,"Promise"),r(47)("Promise"),u=r(26).Promise,l(l.S+l.F*!L,"Promise",{reject:function(t){var n=F(this);return(0,n.reject)(t),n.promise}}),l(l.S+l.F*(c||!L),"Promise",{resolve:function(t){return x(c&&this===u?A:this,t)}}),l(l.S+l.F*!(L&&r(46)(function(t){A.all(t).catch(j)})),"Promise",{all:function(t){var n=this,r=F(n),e=r.resolve,o=r.reject,i=w(function(){var r=[],i=0,u=1;d(t,!1,function(t){var c=i++,a=!1;r.push(void 0),u++,n.resolve(t).then(function(t){a||(a=!0,r[c]=t,--u||e(r))},o)}),--u||e(r)});return i.e&&o(i.v),r.promise},race:function(t){var n=this,r=F(n),e=r.reject,o=w(function(){d(t,!1,function(t){n.resolve(t).then(r.resolve,e)})});return o.e&&e(o.v),r.promise}})},function(t,n,r){var e=r(0),o=r(55);o&&e(e.S,"Reflect",{setPrototypeOf:function(t,n){o.check(t,n);try{return o.set(t,n),!0}catch(t){return!1}}})},function(t,n,r){var e=r(6),o=r(13),i=r(29),u=r(9),c=r(0),a=r(25),f=r(3),s=r(1);c(c.S,"Reflect",{set:function t(n,r,c){var l,h,p=arguments.length<4?n:arguments[3],v=o.f(f(n),r);if(!v){if(s(h=i(n)))return t(h,r,c,p);v=a(0)}if(u(v,"value")){if(!1===v.writable||!s(p))return!1;if(l=o.f(p,r)){if(l.get||l.set||!1===l.writable)return!1;l.value=c,e.f(p,r,l)}else e.f(p,r,a(0,c));return!0}return void 0!==v.set&&(v.set.call(p,c),!0)}})},function(t,n,r){var e=r(0),o=r(3),i=Object.preventExtensions;e(e.S,"Reflect",{preventExtensions:function(t){o(t);try{return i&&i(t),!0}catch(t){return!1}}})},function(t,n,r){var e=r(0);e(e.S,"Reflect",{ownKeys:r(78)})},function(t,n,r){var e=r(0),o=r(3),i=Object.isExtensible;e(e.S,"Reflect",{isExtensible:function(t){return o(t),!i||i(t)}})},function(t,n,r){var e=r(0);e(e.S,"Reflect",{has:function(t,n){return n in t}})},function(t,n,r){var e=r(0),o=r(29),i=r(3);e(e.S,"Reflect",{getPrototypeOf:function(t){return o(i(t))}})},function(t,n,r){var e=r(13),o=r(0),i=r(3);o(o.S,"Reflect",{getOwnPropertyDescriptor:function(t,n){return e.f(i(t),n)}})},function(t,n,r){var e=r(13),o=r(29),i=r(9),u=r(0),c=r(1),a=r(3);u(u.S,"Reflect",{get:function t(n,r){var u,f,s=arguments.length<3?n:arguments[2];return a(n)===s?n[r]:(u=e.f(n,r))?i(u,"value")?u.value:void 0!==u.get?u.get.call(s):void 0:c(f=o(n))?t(f,r,s):void 0}})},function(t,n,r){var e=r(0),o=r(13).f,i=r(3);e(e.S,"Reflect",{deleteProperty:function(t,n){var r=o(i(t),n);return!(r&&!r.configurable)&&delete t[n]}})},function(t,n,r){var e=r(6),o=r(0),i=r(3),u=r(40);o(o.S+o.F*r(5)(function(){Reflect.defineProperty(e.f({},1,{value:1}),1,{value:2})}),"Reflect",{defineProperty:function(t,n,r){i(t),n=u(n,!0),i(r);try{return e.f(t,n,r),!0}catch(t){return!1}}})},function(t,n,r){"use strict";var e=r(23),o=r(1),i=r(79),u=[].slice,c={};t.exports=Function.bind||function(t){var n=e(this),r=u.call(arguments,1),a=function(){var e=r.concat(u.call(arguments));return this instanceof a?function(t,n,r){if(!(n in c)){for(var e=[],o=0;o<n;o++)e[o]="a["+o+"]";c[n]=Function("F,a","return new F("+e.join(",")+")")}return c[n](t,r)}(n,e.length,e):i(n,e,t)};return o(n.prototype)&&(a.prototype=n.prototype),a}},function(t,n,r){var e=r(0),o=r(38),i=r(23),u=r(3),c=r(1),a=r(5),f=r(183),s=(r(2).Reflect||{}).construct,l=a(function(){function t(){}return!(s(function(){},[],t)instanceof t)}),h=!a(function(){s(function(){})});e(e.S+e.F*(l||h),"Reflect",{construct:function(t,n){i(t),u(n);var r=arguments.length<3?t:i(arguments[2]);if(h&&!l)return s(t,n,r);if(t==r){switch(n.length){case 0:return new t;case 1:return new t(n[0]);case 2:return new t(n[0],n[1]);case 3:return new t(n[0],n[1],n[2]);case 4:return new t(n[0],n[1],n[2],n[3])}var e=[null];return e.push.apply(e,n),new(f.apply(t,e))}var a=r.prototype,p=o(c(a)?a:Object.prototype),v=Function.apply.call(t,p,n);return c(v)?v:p}})},function(t,n,r){var e=r(0),o=r(23),i=r(3),u=(r(2).Reflect||{}).apply,c=Function.apply;e(e.S+e.F*!r(5)(function(){u(function(){})}),"Reflect",{apply:function(t,n,r){var e=o(t),a=i(r);return u?u(e,n,a):c.call(e,n,a)}})},function(t,n,r){"use strict";var e=r(80),o=r(27);r(44)("WeakSet",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{add:function(t){return e.def(o(this,"WeakSet"),t,!0)}},e,!1,!0)},function(t,n,r){"use strict";var e,o=r(37)(0),i=r(18),u=r(17),c=r(81),a=r(80),f=r(1),s=r(5),l=r(27),h=u.getWeak,p=Object.isExtensible,v=a.ufstore,d={},y=function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},g={get:function(t){if(f(t)){var n=h(t);return!0===n?v(l(this,"WeakMap")).get(t):n?n[this._i]:void 0}},set:function(t,n){return a.def(l(this,"WeakMap"),t,n)}},m=t.exports=r(44)("WeakMap",y,g,a,!0,!0);s(function(){return 7!=(new m).set((Object.freeze||Object)(d),7).get(d)})&&(c((e=a.getConstructor(y,"WeakMap")).prototype,g),u.NEED=!0,o(["delete","has","get","set"],function(t){var n=m.prototype,r=n[t];i(n,t,function(n,o){if(f(n)&&!p(n)){this._f||(this._f=new e);var i=this._f[t](n,o);return"set"==t?this:i}return r.call(this,n,o)})}))},function(t,n,r){"use strict";var e=r(83),o=r(27);t.exports=r(44)("Set",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{add:function(t){return e.def(o(this,"Set"),t=0===t?0:t,t)}},e)},function(t,n,r){var e=r(1),o=r(55).set;t.exports=function(t,n,r){var i,u=n.constructor;return u!==r&&"function"==typeof u&&(i=u.prototype)!==r.prototype&&e(i)&&o&&o(t,i),t}},function(t,n,r){"use strict";var e=r(83),o=r(27);t.exports=r(44)("Map",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{get:function(t){var n=e.getEntry(o(this,"Map"),t);return n&&n.v},set:function(t,n){return e.def(o(this,"Map"),0===t?0:t,n)}},e,!0)},function(t,n,r){r(14)("Float64",8,function(t){return function(n,r,e){return t(this,n,r,e)}})},function(t,n,r){r(14)("Float32",4,function(t){return function(n,r,e){return t(this,n,r,e)}})},function(t,n,r){r(14)("Uint32",4,function(t){return function(n,r,e){return t(this,n,r,e)}})},function(t,n,r){r(14)("Int32",4,function(t){return function(n,r,e){return t(this,n,r,e)}})},function(t,n,r){r(14)("Uint16",2,function(t){return function(n,r,e){return t(this,n,r,e)}})},function(t,n,r){r(14)("Int16",2,function(t){return function(n,r,e){return t(this,n,r,e)}})},function(t,n,r){r(14)("Uint8",1,function(t){return function(n,r,e){return t(this,n,r,e)}},!0)},function(t,n,r){r(14)("Uint8",1,function(t){return function(n,r,e){return t(this,n,r,e)}})},function(t,n,r){"use strict";var e=r(38),o=r(25),i=r(31),u={};r(10)(u,r(4)("iterator"),function(){return this}),t.exports=function(t,n,r){t.prototype=e(u,{next:o(1,r)}),i(t,n+" Iterator")}},function(t,n,r){var e=r(1),o=r(87),i=r(4)("species");t.exports=function(t){var n;return o(t)&&("function"!=typeof(n=t.constructor)||n!==Array&&!o(n.prototype)||(n=void 0),e(n)&&null===(n=n[i])&&(n=void 0)),void 0===n?Array:n}},function(t,n,r){var e=r(200);t.exports=function(t,n){return new(e(t))(n)}},function(t,n,r){var e=r(6),o=r(3),i=r(19);t.exports=r(8)?Object.defineProperties:function(t,n){o(t);for(var r,u=i(n),c=u.length,a=0;c>a;)e.f(t,r=u[a++],n[r]);return t}},function(t,n,r){r(14)("Int8",1,function(t){return function(n,r,e){return t(this,n,r,e)}})},function(t,n,r){var e=r(0);e(e.G+e.W+e.F*!r(48).ABV,{DataView:r(67).DataView})},function(t,n,r){"use strict";var e=r(0),o=r(48),i=r(67),u=r(3),c=r(32),a=r(7),f=r(1),s=r(2).ArrayBuffer,l=r(60),h=i.ArrayBuffer,p=i.DataView,v=o.ABV&&s.isView,d=h.prototype.slice,y=o.VIEW;e(e.G+e.W+e.F*(s!==h),{ArrayBuffer:h}),e(e.S+e.F*!o.CONSTR,"ArrayBuffer",{isView:function(t){return v&&v(t)||f(t)&&y in t}}),e(e.P+e.U+e.F*r(5)(function(){return!new h(2).slice(1,void 0).byteLength}),"ArrayBuffer",{slice:function(t,n){if(void 0!==d&&void 0===n)return d.call(u(this),t);for(var r=u(this).byteLength,e=c(t,r),o=c(void 0===n?r:n,r),i=new(l(this,h))(a(o-e)),f=new p(this),s=new p(i),v=0;e<o;)s.setUint8(v++,f.getUint8(e++));return i}}),r(47)("ArrayBuffer")},function(t,n,r){"use strict";r(205),r(204),r(203),r(198),r(197),r(196),r(195),r(194),r(193),r(192),r(191),r(190),r(188),r(187),r(186),r(185),r(184),r(182),r(181),r(180),r(179),r(178),r(177),r(176),r(175),r(174),r(173),r(172),r(171),r(167),r(164),r(163),r(162),r(161),r(160),r(159),r(158),r(157),r(156),r(155),r(154),r(153),r(151),r(150),r(149),r(148),r(147),r(145),r(144),r(143),r(142),r(141),r(139),r(138),r(137),r(136),r(135),r(134),r(133),r(132),r(131),r(130),r(56),r(129),r(128),r(127),r(126),r(125),r(124),r(123),r(122),r(121),r(120),r(119),r(118),r(117),r(116),r(115),r(113),r(112),r(111),r(110),r(109),r(108),r(107),r(106),r(105),r(104),r(103),r(102),r(101),r(100),r(99),r(98),r(97),r(96),r(95);var e,o=r(93),i=(e=o)&&e.__esModule?e:{default:e};window.addEventListener("DOMContentLoaded",function(){var t=document.querySelectorAll(".otgs-ui");t&&Array.from(t).map(function(t){return new i.default(t)})})},function(t,n){!function(t){"use strict";if(!t.fetch){var n={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(n.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],e=function(t){return t&&DataView.prototype.isPrototypeOf(t)},o=ArrayBuffer.isView||function(t){return t&&r.indexOf(Object.prototype.toString.call(t))>-1};s.prototype.append=function(t,n){t=c(t),n=a(n);var r=this.map[t];this.map[t]=r?r+","+n:n},s.prototype.delete=function(t){delete this.map[c(t)]},s.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},s.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},s.prototype.set=function(t,n){this.map[c(t)]=a(n)},s.prototype.forEach=function(t,n){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(n,this.map[r],r,this)},s.prototype.keys=function(){var t=[];return this.forEach(function(n,r){t.push(r)}),f(t)},s.prototype.values=function(){var t=[];return this.forEach(function(n){t.push(n)}),f(t)},s.prototype.entries=function(){var t=[];return this.forEach(function(n,r){t.push([r,n])}),f(t)},n.iterable&&(s.prototype[Symbol.iterator]=s.prototype.entries);var i=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},d.call(y.prototype),d.call(m.prototype),m.prototype.clone=function(){return new m(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new s(this.headers),url:this.url})},m.error=function(){var t=new m(null,{status:0,statusText:""});return t.type="error",t};var u=[301,302,303,307,308];m.redirect=function(t,n){if(-1===u.indexOf(n))throw new RangeError("Invalid status code");return new m(null,{status:n,headers:{location:t}})},t.Headers=s,t.Request=y,t.Response=m,t.fetch=function(t,r){return new Promise(function(e,o){var i=new y(t,r),u=new XMLHttpRequest;u.onload=function(){var t,n,r={status:u.status,statusText:u.statusText,headers:(t=u.getAllResponseHeaders()||"",n=new s,t.split(/\r?\n/).forEach(function(t){var r=t.split(":"),e=r.shift().trim();if(e){var o=r.join(":").trim();n.append(e,o)}}),n)};r.url="responseURL"in u?u.responseURL:r.headers.get("X-Request-URL");var o="response"in u?u.response:u.responseText;e(new m(o,r))},u.onerror=function(){o(new TypeError("Network request failed"))},u.ontimeout=function(){o(new TypeError("Network request failed"))},u.open(i.method,i.url,!0),"include"===i.credentials&&(u.withCredentials=!0),"responseType"in u&&n.blob&&(u.responseType="blob"),i.headers.forEach(function(t,n){u.setRequestHeader(n,t)}),u.send(void 0===i._bodyInit?null:i._bodyInit)})},t.fetch.polyfill=!0}function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function a(t){return"string"!=typeof t&&(t=String(t)),t}function f(t){var r={next:function(){var n=t.shift();return{done:void 0===n,value:n}}};return n.iterable&&(r[Symbol.iterator]=function(){return r}),r}function s(t){this.map={},t instanceof s?t.forEach(function(t,n){this.append(n,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(n){this.append(n,t[n])},this)}function l(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function h(t){return new Promise(function(n,r){t.onload=function(){n(t.result)},t.onerror=function(){r(t.error)}})}function p(t){var n=new FileReader,r=h(n);return n.readAsArrayBuffer(t),r}function v(t){if(t.slice)return t.slice(0);var n=new Uint8Array(t.byteLength);return n.set(new Uint8Array(t)),n.buffer}function d(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,t)if("string"==typeof t)this._bodyText=t;else if(n.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(n.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(n.searchParams&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(n.arrayBuffer&&n.blob&&e(t))this._bodyArrayBuffer=v(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!n.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t)&&!o(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=v(t)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n.blob&&(this.blob=function(){var t=l(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?l(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(p)}),this.text=function(){var t,n,r,e=l(this);if(e)return e;if(this._bodyBlob)return t=this._bodyBlob,n=new FileReader,r=h(n),n.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var n=new Uint8Array(t),r=new Array(n.length),e=0;e<n.length;e++)r[e]=String.fromCharCode(n[e]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},n.formData&&(this.formData=function(){return this.text().then(g)}),this.json=function(){return this.text().then(JSON.parse)},this}function y(t,n){var r,e,o=(n=n||{}).body;if(t instanceof y){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,n.headers||(this.headers=new s(t.headers)),this.method=t.method,this.mode=t.mode,o||null==t._bodyInit||(o=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=n.credentials||this.credentials||"omit",!n.headers&&this.headers||(this.headers=new s(n.headers)),this.method=(r=n.method||this.method||"GET",e=r.toUpperCase(),i.indexOf(e)>-1?e:r),this.mode=n.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function g(t){var n=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),e=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");n.append(decodeURIComponent(e),decodeURIComponent(o))}}),n}function m(t,n){n||(n={}),this.type="default",this.status="status"in n?n.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in n?n.statusText:"OK",this.headers=new s(n.headers),this.url=n.url||"",this._initBody(t)}}("undefined"!=typeof self?self:this)},function(t,n,r){r(207),t.exports=r(206)},,,,,function(t,n){}]);
vendor/otgs/installer/includes/class-otgs-installer-factory.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author OnTheGo Systems
5
+ */
6
+ class OTGS_Installer_Factory {
7
+
8
+ private $installer;
9
+ private $filename_hooks;
10
+ private $icons;
11
+ private $installer_php_functions;
12
+ private $local_components_ajax_setting;
13
+ private $settings;
14
+ private $template_service_loader;
15
+ private $wp_components_hooks;
16
+ private $wp_components_sender;
17
+ private $wp_components_storage;
18
+
19
+ public function __construct( WP_Installer $installer ) {
20
+ $this->installer = $installer;
21
+ }
22
+
23
+ /**
24
+ * @return OTGS_Installer_Filename_Hooks
25
+ */
26
+ public function create_filename_hooks() {
27
+ if ( ! $this->filename_hooks ) {
28
+ $this->filename_hooks = new OTGS_Installer_Filename_Hooks( $this->create_installer_php_functions() );
29
+ }
30
+
31
+ return $this->filename_hooks;
32
+ }
33
+
34
+ /**
35
+ * @return OTGS_Installer_Icons
36
+ */
37
+ public function create_icons() {
38
+ if ( ! $this->icons ) {
39
+ $this->icons = new OTGS_Installer_Icons( $this->get_installer() );
40
+ }
41
+
42
+ return $this->icons;
43
+ }
44
+
45
+ /**
46
+ * @return OTGS_Installer_WP_Components_Setting_Ajax
47
+ */
48
+ public function create_local_components_ajax_setting() {
49
+ if ( ! $this->local_components_ajax_setting ) {
50
+ $this->local_components_ajax_setting = new OTGS_Installer_WP_Components_Setting_Ajax( $this->create_settings(),
51
+ $this->get_installer() );
52
+ }
53
+
54
+ return $this->local_components_ajax_setting;
55
+ }
56
+
57
+ public function create_resources() {
58
+ return new OTGS_Installer_WP_Components_Setting_Resources( $this->get_installer() );
59
+ }
60
+
61
+ public function create_settings_hooks() {
62
+ return new OTGS_Installer_WP_Share_Local_Components_Setting_Hooks( $this->create_template_service_loader()
63
+ ->get_service(),
64
+ $this->create_settings() );
65
+ }
66
+
67
+ /**
68
+ * @return OTGS_Installer_Twig_Template_Service_Loader
69
+ */
70
+ private function create_template_service_loader() {
71
+ if ( ! $this->template_service_loader ) {
72
+ $this->template_service_loader = new OTGS_Installer_Twig_Template_Service_Loader( array(
73
+ $this->get_installer()
74
+ ->plugin_path()
75
+ . '/templates/components-setting/'
76
+ ) );
77
+ }
78
+
79
+ return $this->template_service_loader;
80
+ }
81
+
82
+ /**
83
+ * @return OTGS_Installer_WP_Share_Local_Components_Setting
84
+ */
85
+ public function create_settings() {
86
+ if ( ! $this->settings ) {
87
+ $this->settings = new OTGS_Installer_WP_Share_Local_Components_Setting();
88
+ }
89
+
90
+ return $this->settings;
91
+ }
92
+
93
+ /**
94
+ * @return OTGS_Installer_WP_Components_Hooks
95
+ */
96
+ public function create_wp_components_hooks() {
97
+ if ( ! $this->wp_components_hooks ) {
98
+ $this->wp_components_hooks = new OTGS_Installer_WP_Components_Hooks( $this->create_wp_components_storage(),
99
+ $this->create_wp_components_sender(),
100
+ $this->create_settings(),
101
+ $this->create_installer_php_functions() );
102
+ }
103
+
104
+ return $this->wp_components_hooks;
105
+ }
106
+
107
+ /**
108
+ * @return OTGS_Installer_WP_Components_Storage
109
+ */
110
+ public function create_wp_components_storage() {
111
+ if ( ! $this->wp_components_storage ) {
112
+ $this->wp_components_storage = new OTGS_Installer_WP_Components_Storage();
113
+ }
114
+
115
+ return $this->wp_components_storage;
116
+ }
117
+
118
+ /**
119
+ * @return OTGS_Installer_WP_Components_Sender
120
+ */
121
+ public function create_wp_components_sender() {
122
+ if ( ! $this->wp_components_sender ) {
123
+ $this->wp_components_sender = new OTGS_Installer_WP_Components_Sender( $this->get_installer(),
124
+ $this->create_settings() );
125
+ }
126
+
127
+ return $this->wp_components_sender;
128
+ }
129
+
130
+ /**
131
+ * @return OTGS_Installer_PHP_Functions
132
+ */
133
+ public function create_installer_php_functions() {
134
+ if ( ! $this->installer_php_functions ) {
135
+ $this->installer_php_functions = new OTGS_Installer_PHP_Functions();
136
+ }
137
+
138
+ return $this->installer_php_functions;
139
+ }
140
+
141
+ /**
142
+ * @return WP_Installer
143
+ */
144
+ private function get_installer() {
145
+ return $this->installer;
146
+ }
147
+ }
vendor/otgs/installer/includes/class-otgs-installer-icons.php CHANGED
@@ -7,11 +7,6 @@ class OTGS_Installer_Icons {
7
  */
8
  private $installer;
9
 
10
- /**
11
- * @var array
12
- */
13
- private $products_map;
14
-
15
  public function __construct( WP_Installer $installer ) {
16
  $this->installer = $installer;
17
  }
@@ -22,21 +17,21 @@ class OTGS_Installer_Icons {
22
 
23
  /**
24
  * @param stdClass $response
25
- * @param string $plugin_id
26
  *
27
  * @return stdClass
28
  */
29
- public function add_icons_on_response( $response, $plugin_id, $repository ) {
30
- $product = isset( $this->installer->settings['repositories'][ $repository ]['data']['products-map'][ $plugin_id ] )
31
- ? $this->installer->settings['repositories'][ $repository ]['data']['products-map'][ $plugin_id ]
32
  : '';
33
 
34
  if ( $product ) {
35
- $base = $this->installer->plugin_url() . '/vendor/otgs/icons/plugin-icons/' . $repository . '/' . $product . '/icon';
36
  $response->icons = array(
37
  'svg' => $base . '.svg',
38
- '1x' => $base . '.png',
39
- '2x' => $base . '.png',
40
  );
41
  }
42
 
7
  */
8
  private $installer;
9
 
 
 
 
 
 
10
  public function __construct( WP_Installer $installer ) {
11
  $this->installer = $installer;
12
  }
17
 
18
  /**
19
  * @param stdClass $response
20
+ * @param string $name
21
  *
22
  * @return stdClass
23
  */
24
+ public function add_icons_on_response( $response, $name, $repository ) {
25
+ $product = isset( $this->installer->settings['repositories'][ $repository ]['data']['products-map'][ $name ] )
26
+ ? $this->installer->settings['repositories'][ $repository ]['data']['products-map'][ $name ]
27
  : '';
28
 
29
  if ( $product ) {
30
+ $base = $this->installer->plugin_url() . '/../icons/plugin-icons/' . $repository . '/' . $product . '/icon';
31
  $response->icons = array(
32
  'svg' => $base . '.svg',
33
+ '1x' => $base . '-128x128.png',
34
+ '2x' => $base . '-256x256.png',
35
  );
36
  }
37
 
vendor/otgs/installer/includes/class-otgs-installer-php-functions.php CHANGED
@@ -26,4 +26,8 @@ class OTGS_Installer_PHP_Functions {
26
  public function time() {
27
  return time();
28
  }
 
 
 
 
29
  }
26
  public function time() {
27
  return time();
28
  }
29
+
30
+ public function phpversion() {
31
+ return phpversion();
32
+ }
33
  }
vendor/otgs/installer/includes/class-otgs-installer-plugin-factory.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class OTGS_Installer_Plugin_Factory {
4
+
5
+ /**
6
+ * @param array $params
7
+ *
8
+ * @return OTGS_Installer_Plugin
9
+ */
10
+ public function create( array $params = array() ) {
11
+ return new OTGS_Installer_Plugin( $params );
12
+ }
13
+ }
vendor/otgs/installer/includes/class-otgs-installer-plugin-finder.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class OTGS_Installer_Plugin_Finder {
4
+
5
+ private $plugins;
6
+ private $plugin_factory;
7
+ private $repositories;
8
+
9
+ public function __construct( OTGS_Installer_Plugin_Factory $plugin_factory, array $repositories ) {
10
+ $this->plugin_factory = $plugin_factory;
11
+ $this->repositories = $repositories;
12
+ $this->load();
13
+ }
14
+
15
+ private function load() {
16
+ if ( ! $this->plugins ) {
17
+ foreach ( $this->repositories as $repo_key => $repository ) {
18
+ foreach ( $repository['data']['downloads']['plugins'] as $slug => $plugin ) {
19
+ $this->plugins[ $repo_key ][ $slug ] = $this->plugin_factory->create( array(
20
+ 'name' => $plugin['name'],
21
+ 'slug' => $plugin['slug'],
22
+ 'description' => $plugin['description'],
23
+ 'changelog' => $plugin['changelog'],
24
+ 'version' => $plugin['version'],
25
+ 'date' => $plugin['date'],
26
+ 'url' => $plugin['url'],
27
+ 'free_on_wporg' => isset( $plugin['free-on-wporg'] ) ? $plugin['free-on-wporg'] : '',
28
+ 'fallback_on_wporg' => isset( $plugin['fallback-free-on-wporg'] ) ? $plugin['fallback-free-on-wporg'] : '',
29
+ 'basename' => $plugin['basename'],
30
+ 'external_repo' => isset( $plugin['external-repo'] ) ? $plugin['external-repo'] : '',
31
+ 'is_lite' => isset( $plugin['is-lite'] ) ? $plugin['is-lite'] : '',
32
+ 'repo' => $repo_key,
33
+ ) );
34
+ }
35
+ }
36
+ }
37
+ }
38
+
39
+ public function get_plugin( $slug, $repo ) {
40
+ foreach ( $this->plugins[ $repo ] as $plugin ) {
41
+ if ( $slug === $plugin->get_slug() ) {
42
+ return $plugin;
43
+ }
44
+ }
45
+ return null;
46
+ }
47
+
48
+ public function get_plugin_by_name( $name ) {
49
+ foreach ( $this->plugins as $repo ) {
50
+ foreach ( $repo as $plugin ) {
51
+ if ( $name === $plugin->get_name() ) {
52
+ return $plugin;
53
+ }
54
+ }
55
+ }
56
+ return null;
57
+ }
58
+ }
vendor/otgs/installer/includes/class-otgs-installer-plugin.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class OTGS_Installer_Plugin {
4
+
5
+ private $name;
6
+ private $slug;
7
+ private $description;
8
+ private $changelog;
9
+ private $version;
10
+ private $date;
11
+ private $url;
12
+ private $free_on_wporg;
13
+ private $fallback_on_wporg;
14
+ private $basename;
15
+ private $external_repo;
16
+ private $is_lite;
17
+ private $repo;
18
+
19
+ public function __construct( array $params = array() ) {
20
+ foreach ( get_object_vars( $this ) as $property => $value ) {
21
+ if ( array_key_exists( $property, $params ) ) {
22
+ $this->$property = $params[ $property ];
23
+ }
24
+ }
25
+ }
26
+
27
+ /**
28
+ * @return string
29
+ */
30
+ public function get_name() {
31
+ return $this->name;
32
+ }
33
+
34
+ /**
35
+ * @return string
36
+ */
37
+ public function get_slug() {
38
+ return $this->slug;
39
+ }
40
+
41
+ /**
42
+ * @return string
43
+ */
44
+ public function get_description() {
45
+ return $this->description;
46
+ }
47
+
48
+ /**
49
+ * @return string
50
+ */
51
+ public function get_changelog() {
52
+ return $this->changelog;
53
+ }
54
+
55
+ /**
56
+ * @return string
57
+ */
58
+ public function get_version() {
59
+ return $this->version;
60
+ }
61
+
62
+ /**
63
+ * @return string
64
+ */
65
+ public function get_date() {
66
+ return $this->date;
67
+ }
68
+
69
+ /**
70
+ * @return string
71
+ */
72
+ public function get_url() {
73
+ return $this->url;
74
+ }
75
+
76
+ /**
77
+ * @return string
78
+ */
79
+ public function get_repo() {
80
+ return $this->repo;
81
+ }
82
+
83
+ /**
84
+ * @return bool
85
+ */
86
+ public function is_free_on_wporg() {
87
+ return (bool) $this->free_on_wporg;
88
+ }
89
+
90
+ /**
91
+ * @return bool
92
+ */
93
+ public function has_fallback_on_wporg() {
94
+ return (bool) $this->fallback_on_wporg;
95
+ }
96
+
97
+ /**
98
+ * @return string
99
+ */
100
+ public function get_basename() {
101
+ return $this->basename;
102
+ }
103
+
104
+ /**
105
+ * @return string
106
+ */
107
+ public function get_external_repo() {
108
+ return $this->external_repo;
109
+ }
110
+
111
+ /**
112
+ * @return string
113
+ */
114
+ public function is_lite() {
115
+ return $this->is_lite;
116
+ }
117
+ }
vendor/otgs/installer/includes/class-otgs-installer-plugins-page-notice.php CHANGED
@@ -2,9 +2,9 @@
2
 
3
  class OTGS_Installer_Plugins_Page_Notice {
4
 
5
- const TEMPLATE = 'plugins-page';
6
  const DISPLAY_SUBSCRIPTION_NOTICE_KEY = 'display_subscription_notice';
7
- const DISPLAY_SETTING_NOTICE_KEY = 'display_setting_notice';
8
 
9
  private $plugins = array();
10
 
@@ -13,14 +13,11 @@ class OTGS_Installer_Plugins_Page_Notice {
13
  */
14
  private $template_service;
15
 
16
- /**
17
- * @var OTGS_Installer_WP_Share_Local_Components_Setting
18
- */
19
- private $setting;
20
 
21
- public function __construct( OTGS_Installer_Twig_Template_Service $template_service, OTGS_Installer_WP_Share_Local_Components_Setting $setting ) {
22
  $this->template_service = $template_service;
23
- $this->setting = $setting;
24
  }
25
 
26
  public function add_hooks() {
@@ -28,7 +25,7 @@ class OTGS_Installer_Plugins_Page_Notice {
28
  add_action( 'after_plugin_row_' . $plugin_id, array(
29
  $this,
30
  'show_purchase_notice_under_plugin'
31
- ), 10, 3 );
32
  }
33
  }
34
 
@@ -45,28 +42,30 @@ class OTGS_Installer_Plugins_Page_Notice {
45
 
46
  /**
47
  * @param string $plugin_file
48
- * @param array $plugin_data
49
- * @param string $status
50
  */
51
- public function show_purchase_notice_under_plugin( $plugin_file, $plugin_data, $status ) {
52
- echo $this->template_service->show( $this->get_model( $plugin_data, $plugin_file ), self::TEMPLATE );
 
 
 
 
 
 
 
 
 
 
 
 
53
  }
54
 
55
  /**
56
- * @param array $plugin_data
57
- *
58
  * @return array
59
  */
60
- private function get_model( $plugin_data, $plugin_file ) {
61
  $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
62
 
63
- $tr_classes = 'plugin-update-tr';
64
- $notice_classes = 'update-message installer-q-icon';
65
-
66
- if ( version_compare( get_bloginfo( 'version' ), '4.6', '>=' ) ) {
67
- $tr_classes = 'plugin-update-tr installer-plugin-update-tr';
68
- $notice_classes = 'notice inline notice-warning notice-alt';
69
- }
70
 
71
  if ( is_multisite() ) {
72
  if ( is_network_admin() ) {
@@ -78,41 +77,46 @@ class OTGS_Installer_Plugins_Page_Notice {
78
  $menu_url = admin_url( 'plugin-install.php?tab=commercial' );
79
  }
80
 
81
- $plugin_name = false !== strpos( $plugin_data['Name'], 'WPML' ) ? 'WPML' : 'Toolset';
82
- $plugin_site = 'wpml.org';
83
-
84
- if ( 'Toolset' === $plugin_name ) {
85
- $plugin_site = 'wp-types.com';
86
- }
87
-
88
- $repo = strtolower( $plugin_name );
89
-
90
  return array(
91
- 'strings' => array(
92
  'valid_subscription' => sprintf( __( 'You must 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' ),
93
  '<a href="' . $menu_url . '">', '</a>' ),
94
- 'send_report' => sprintf( __( '%1$s can report to your %2$s account which theme and plugins you are using. This information allows us to give you more accurate and faster support.', 'installer' ),
95
- $plugin_name,
96
- '<a target="_blank" href="' . $plugin_data['PluginURI'] . '">' . $plugin_site . '</a>'
97
- ),
98
  ),
99
- 'css' => array(
100
- 'tr_classes' => $tr_classes,
101
  'notice_classes' => $notice_classes,
102
  ),
103
- 'col_count' => $wp_list_table->get_column_count(),
104
- 'nonce' => array(
105
- 'action' => OTGS_Installer_WP_Components_Setting_Ajax::AJAX_ACTION,
106
- 'value' => wp_create_nonce( OTGS_Installer_WP_Components_Setting_Ajax::AJAX_ACTION ),
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  ),
108
- 'repo' => $repo,
109
- 'repo_checked' => checked( $this->setting->is_repo_allowed( $repo ), true, false ),
110
- 'should_display_subscription_notice' => isset( $this->plugins[ $plugin_file ][ self::DISPLAY_SUBSCRIPTION_NOTICE_KEY ] )
111
- ? $this->plugins[ $plugin_file ][ self::DISPLAY_SUBSCRIPTION_NOTICE_KEY ]
112
- : false,
113
- 'should_display_setting_notice' => isset( $this->plugins[ $plugin_file ][ self::DISPLAY_SETTING_NOTICE_KEY ] )
114
- ? $this->plugins[ $plugin_file ][ self::DISPLAY_SETTING_NOTICE_KEY ]
115
- : false,
116
  );
117
  }
 
 
 
 
 
 
 
 
 
 
 
 
118
  }
2
 
3
  class OTGS_Installer_Plugins_Page_Notice {
4
 
5
+ const TEMPLATE = 'plugins-page';
6
  const DISPLAY_SUBSCRIPTION_NOTICE_KEY = 'display_subscription_notice';
7
+ const DISPLAY_SETTING_NOTICE_KEY = 'display_setting_notice';
8
 
9
  private $plugins = array();
10
 
13
  */
14
  private $template_service;
15
 
16
+ private $plugin_finder;
 
 
 
17
 
18
+ public function __construct( OTGS_Installer_Twig_Template_Service $template_service, OTGS_Installer_Plugin_Finder $plugin_finder ) {
19
  $this->template_service = $template_service;
20
+ $this->plugin_finder = $plugin_finder;
21
  }
22
 
23
  public function add_hooks() {
25
  add_action( 'after_plugin_row_' . $plugin_id, array(
26
  $this,
27
  'show_purchase_notice_under_plugin'
28
+ ), 10, 2 );
29
  }
30
  }
31
 
42
 
43
  /**
44
  * @param string $plugin_file
 
 
45
  */
46
+ public function show_purchase_notice_under_plugin( $plugin_file, $plugin_data ) {
47
+ $should_display_subscription_notice = isset( $this->plugins[ $plugin_file ][ self::DISPLAY_SUBSCRIPTION_NOTICE_KEY ] )
48
+ ? $this->plugins[ $plugin_file ][ self::DISPLAY_SUBSCRIPTION_NOTICE_KEY ]
49
+ : false;
50
+
51
+ $plugin = $this->plugin_finder->get_plugin_by_name( $plugin_data['Name'] );
52
+
53
+ if ( $should_display_subscription_notice ) {
54
+ if ( $plugin && 'toolset' === $plugin->get_external_repo() && $plugin->is_lite() ) {
55
+ echo $this->template_service->show( $this->get_toolset_lite_notice_model( $plugin->get_name() ), self::TEMPLATE );
56
+ } else {
57
+ echo $this->template_service->show( $this->get_model(), self::TEMPLATE );
58
+ }
59
+ }
60
  }
61
 
62
  /**
 
 
63
  * @return array
64
  */
65
+ private function get_model() {
66
  $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
67
 
68
+ list( $tr_classes, $notice_classes ) = $this->get_classes();
 
 
 
 
 
 
69
 
70
  if ( is_multisite() ) {
71
  if ( is_network_admin() ) {
77
  $menu_url = admin_url( 'plugin-install.php?tab=commercial' );
78
  }
79
 
 
 
 
 
 
 
 
 
 
80
  return array(
81
+ 'strings' => array(
82
  'valid_subscription' => sprintf( __( 'You must 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' ),
83
  '<a href="' . $menu_url . '">', '</a>' ),
 
 
 
 
84
  ),
85
+ 'css' => array(
86
+ 'tr_classes' => $tr_classes,
87
  'notice_classes' => $notice_classes,
88
  ),
89
+ 'col_count' => $wp_list_table->get_column_count(),
90
+ );
91
+ }
92
+
93
+ private function get_toolset_lite_notice_model( $plugin_name ) {
94
+ $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
95
+
96
+ list( $tr_classes, $notice_classes ) = $this->get_classes();
97
+
98
+ return array(
99
+ 'strings' => array(
100
+ 'valid_subscription' => sprintf( __( 'You are using the complementary %1$s. For the %2$s, %3$s.', 'installer' ),
101
+ $plugin_name, '<a href="https://wpml.org/documentation/developing-custom-multilingual-sites/types-and-views-lite/?utm_source=viewsplugin&utm_campaign=wpml-toolset-lite&utm_medium=plugins-page&utm_term=features-link">' . __( 'complete set of features', 'installer' ) . '</a>', '<a href="https://toolset.com/?add-to-cart=631305&buy_now=1&apply_coupon=eyJjb3Vwb25fbmFtZSI6IndwbWwgY291cG9uIGJhc2ljIiwiY291cG9uX2lkIjoiODAyMDE2In0=">' . __( 'upgrade to Toolset', 'installer' ) . '</a>' ),
102
+ ),
103
+ 'css' => array(
104
+ 'tr_classes' => $tr_classes,
105
+ 'notice_classes' => $notice_classes,
106
  ),
107
+ 'col_count' => $wp_list_table->get_column_count(),
 
 
 
 
 
 
 
108
  );
109
  }
110
+
111
+ private function get_classes() {
112
+ $tr_classes = 'plugin-update-tr';
113
+ $notice_classes = 'update-message installer-q-icon';
114
+
115
+ if ( version_compare( get_bloginfo( 'version' ), '4.6', '>=' ) ) {
116
+ $tr_classes = 'plugin-update-tr installer-plugin-update-tr';
117
+ $notice_classes = 'notice inline notice-warning notice-alt';
118
+ }
119
+
120
+ return array( $tr_classes, $notice_classes );
121
+ }
122
  }
vendor/otgs/installer/includes/class-otgs-installer-subscription.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @author OnTheGo Systems
5
+ */
6
+ class OTGS_Installer_Subscription {
7
+ const SUBSCRIPTION_STATUS_INACTIVE = 0;
8
+ const SUBSCRIPTION_STATUS_ACTIVE = 1;
9
+ const SUBSCRIPTION_STATUS_EXPIRED = 2;
10
+ const SUBSCRIPTION_STATUS_INACTIVE_UPGRADED = 3;
11
+ const SUBSCRIPTION_STATUS_ACTIVE_NO_EXPIRATION = 4;
12
+
13
+ const SUBSCRIPTION_STATUS_TEXT_EXPIRED = 'expired';
14
+ const SUBSCRIPTION_STATUS_TEXT_VALID = 'valid';
15
+ const SUBSCRIPTION_STATUS_TEXT_MISSING = 'missing';
16
+
17
+ private $status;
18
+ private $expires;
19
+
20
+ /**
21
+ * WPML_Installer_Subscription constructor.
22
+ *
23
+ * @param stdClass|null $data
24
+ */
25
+ public function __construct( stdClass $data = null ) {
26
+ if ( $data ) {
27
+ if ( isset( $data->status ) ) {
28
+ $this->status = (int) $data->status;
29
+ }
30
+ if ( isset( $data->expires ) ) {
31
+ $this->expires = $data->expires;
32
+ }
33
+ }
34
+ }
35
+
36
+ public function get_subscription_status_text() {
37
+ if ( $this->is_expired() ) {
38
+ return self::SUBSCRIPTION_STATUS_TEXT_EXPIRED;
39
+ }
40
+
41
+ if ( $this->is_valid() ) {
42
+ return self::SUBSCRIPTION_STATUS_TEXT_VALID;
43
+ }
44
+
45
+ return self::SUBSCRIPTION_STATUS_TEXT_MISSING;
46
+ }
47
+
48
+ /**
49
+ * @return bool
50
+ */
51
+ private function is_expired() {
52
+ return ! $this->is_lifetime()
53
+ && (
54
+ self::SUBSCRIPTION_STATUS_EXPIRED === $this->get_status()
55
+ || ( $this->get_expiration() && strtotime( $this->get_expiration() ) <= time() )
56
+ );
57
+ }
58
+
59
+ /**
60
+ * @return bool
61
+ */
62
+ private function is_lifetime() {
63
+ return $this->get_status() === self::SUBSCRIPTION_STATUS_ACTIVE_NO_EXPIRATION;
64
+ }
65
+
66
+ private function get_status() {
67
+ return $this->status;
68
+ }
69
+
70
+ private function get_expiration() {
71
+ return $this->expires;
72
+ }
73
+
74
+ /**
75
+ * @return bool
76
+ */
77
+ public function is_valid() {
78
+ return ( $this->is_lifetime()
79
+ || ( $this->get_status() === self::SUBSCRIPTION_STATUS_ACTIVE && ! $this->is_expired() ) );
80
+ }
81
+ }
vendor/otgs/installer/includes/class-otgs-installer-wp-components-hooks.php CHANGED
@@ -2,7 +2,9 @@
2
 
3
  class OTGS_Installer_WP_Components_Hooks {
4
 
5
- const EVENT_HOOK = 'otgs_send_components_data';
 
 
6
 
7
  /**
8
  * @var OTGS_Installer_WP_Components_Storage
@@ -19,47 +21,58 @@ class OTGS_Installer_WP_Components_Hooks {
19
  */
20
  private $setting;
21
 
 
 
 
 
 
22
  public function __construct(
23
  OTGS_Installer_WP_Components_Storage $storage,
24
  OTGS_Installer_WP_Components_Sender $sender,
25
- OTGS_Installer_WP_Share_Local_Components_Setting $setting
 
26
  ) {
27
- $this->storage = $storage;
28
- $this->sender = $sender;
29
- $this->setting = $setting;
 
30
  }
31
 
32
  public function add_hooks() {
33
- add_action( self::EVENT_HOOK, array( $this, 'send_components_data' ) );
 
 
 
34
  add_action( 'init', array( $this, 'schedule_components_report' ) );
35
- add_filter( 'installer_fetch_subscription_data_request', array( $this, 'add_components_into_subscription_request' ) );
36
  }
37
 
38
  public function schedule_components_report() {
39
- if ( ! wp_next_scheduled( self::EVENT_HOOK ) ) {
40
- wp_schedule_single_event( strtotime( '+1 week' ), self::EVENT_HOOK );
41
  }
42
  }
43
 
44
- public function send_components_data() {
45
- if ( $this->storage->is_outdated() ) {
46
- $this->storage->refresh_cache();
47
- $this->sender->send( $this->storage->get() );
48
  }
49
  }
50
 
51
- /**
52
- * @param array $args
53
- *
54
- * @return array
55
- */
56
- public function add_components_into_subscription_request( $args ) {
57
- if ( isset( $args['body']['repository_id'] ) && $this->setting->is_repo_allowed( $args['body']['repository_id'] ) ) {
 
 
 
 
 
58
  $this->storage->refresh_cache();
59
- $args['body']['components'] = $this->storage->get();
60
- $args['body']['phpversion'] = phpversion();
61
  }
62
-
63
- return $args;
64
  }
65
  }
2
 
3
  class OTGS_Installer_WP_Components_Hooks {
4
 
5
+ const EVENT_SEND_COMPONENTS_MONTHLY = 'otgs_send_components_data';
6
+ const EVENT_SEND_COMPONENTS_AFTER_REGISTRATION = 'otgs_send_components_data_on_product_registration';
7
+ const REPORT_SCHEDULING_PERIOD = '+1 month';
8
 
9
  /**
10
  * @var OTGS_Installer_WP_Components_Storage
21
  */
22
  private $setting;
23
 
24
+ /**
25
+ * @var OTGS_Installer_PHP_Functions
26
+ */
27
+ private $php_functions;
28
+
29
  public function __construct(
30
  OTGS_Installer_WP_Components_Storage $storage,
31
  OTGS_Installer_WP_Components_Sender $sender,
32
+ OTGS_Installer_WP_Share_Local_Components_Setting $setting,
33
+ OTGS_Installer_PHP_Functions $php_functions
34
  ) {
35
+ $this->storage = $storage;
36
+ $this->sender = $sender;
37
+ $this->setting = $setting;
38
+ $this->php_functions = $php_functions;
39
  }
40
 
41
  public function add_hooks() {
42
+ add_action( 'wp_ajax_end_user_get_info', array( $this, 'process_report_instantly' ) );
43
+ add_action( 'wp_ajax_' . OTGS_Installer_WP_Components_Setting_Ajax::AJAX_ACTION, array( $this, 'force_send_components_data' ), OTGS_Installer_WP_Components_Setting_Ajax::SAVE_SETTING_PRIORITY + 1 );
44
+ add_action( self::EVENT_SEND_COMPONENTS_MONTHLY, array( $this, 'send_components_data' ) );
45
+ add_action( self::EVENT_SEND_COMPONENTS_AFTER_REGISTRATION, array( $this, 'send_components_data' ) );
46
  add_action( 'init', array( $this, 'schedule_components_report' ) );
47
+ add_action( 'wp_ajax_save_site_key', array( $this, 'schedule_components_report_when_product_is_registered' ) );
48
  }
49
 
50
  public function schedule_components_report() {
51
+ if ( ! wp_next_scheduled( self::EVENT_SEND_COMPONENTS_MONTHLY ) ) {
52
+ wp_schedule_single_event( strtotime( self::REPORT_SCHEDULING_PERIOD ), self::EVENT_SEND_COMPONENTS_MONTHLY );
53
  }
54
  }
55
 
56
+ public function schedule_components_report_when_product_is_registered() {
57
+ if ( ! wp_next_scheduled( self::EVENT_SEND_COMPONENTS_AFTER_REGISTRATION ) ) {
58
+ wp_schedule_single_event( time() + 60, self::EVENT_SEND_COMPONENTS_AFTER_REGISTRATION );
 
59
  }
60
  }
61
 
62
+ public function process_report_instantly() {
63
+ $this->storage->refresh_cache();
64
+ $this->sender->send( $this->storage->get(), true );
65
+ }
66
+
67
+ public function force_send_components_data() {
68
+ $this->storage->refresh_cache();
69
+ $this->sender->send( $this->storage->get() );
70
+ }
71
+
72
+ public function send_components_data() {
73
+ if ( $this->storage->is_outdated() ) {
74
  $this->storage->refresh_cache();
75
+ $this->sender->send( $this->storage->get() );
 
76
  }
 
 
77
  }
78
  }
vendor/otgs/installer/includes/class-otgs-installer-wp-components-sender.php CHANGED
@@ -17,7 +17,7 @@ class OTGS_Installer_WP_Components_Sender {
17
  $this->settings = $settings;
18
  }
19
 
20
- public function send( array $components ) {
21
 
22
  if ( ! $this->installer->get_repositories() ) {
23
  $this->installer->load_repositories_list();
@@ -28,16 +28,18 @@ class OTGS_Installer_WP_Components_Sender {
28
  }
29
 
30
  foreach ( $this->installer->get_repositories() as $key => $repository ) {
31
- if ( $this->settings->is_repo_allowed( $key ) ) {
 
32
  wp_remote_post(
33
  $repository['api-url'] . '?action=update_site_components',
34
  apply_filters( 'installer_fetch_components_data_request', array(
35
  'body' => array(
36
  'action' => 'update_site_components',
37
- 'site_key' => $this->installer->get_site_key( $key ),
38
  'site_url' => get_site_url(),
39
  'components' => $components,
40
  'phpversion' => phpversion(),
 
41
  ),
42
  ) )
43
  );
17
  $this->settings = $settings;
18
  }
19
 
20
+ public function send( array $components, $force = false ) {
21
 
22
  if ( ! $this->installer->get_repositories() ) {
23
  $this->installer->load_repositories_list();
28
  }
29
 
30
  foreach ( $this->installer->get_repositories() as $key => $repository ) {
31
+ $site_key = $this->installer->get_site_key( $key );
32
+ if ( $site_key && $this->settings->is_repo_allowed( $key ) ) {
33
  wp_remote_post(
34
  $repository['api-url'] . '?action=update_site_components',
35
  apply_filters( 'installer_fetch_components_data_request', array(
36
  'body' => array(
37
  'action' => 'update_site_components',
38
+ 'site_key' => $site_key,
39
  'site_url' => get_site_url(),
40
  'components' => $components,
41
  'phpversion' => phpversion(),
42
+ 'force' => $force,
43
  ),
44
  ) )
45
  );
vendor/otgs/installer/includes/class-otgs-installer-wp-components-setting-ajax.php CHANGED
@@ -2,7 +2,8 @@
2
 
3
  class OTGS_Installer_WP_Components_Setting_Ajax {
4
 
5
- const AJAX_ACTION = 'otgs_save_setting_share_local_components';
 
6
 
7
  /**
8
  * @var OTGS_Installer_WP_Share_Local_Components_Setting
@@ -20,20 +21,22 @@ class OTGS_Installer_WP_Components_Setting_Ajax {
20
  }
21
 
22
  public function add_hooks() {
23
- add_action( 'wp_ajax_' . self::AJAX_ACTION, array( $this, 'save' ) );
24
  }
25
 
26
  public function save() {
27
  if ( $this->is_valid_request() ) {
28
  $user_agree = (int) filter_var( $_POST['agree'], FILTER_SANITIZE_FULL_SPECIAL_CHARS );
29
  $repo_request = filter_var( $_POST['repo'], FILTER_SANITIZE_FULL_SPECIAL_CHARS );
30
- $repos = array();
31
- foreach ( $this->installer->get_repositories() as $repo_id => $repository ) {
32
- if ( $repo_id === $repo_request ) {
33
- $repos[ $repo_id ] = $user_agree;
 
 
34
  }
 
35
  }
36
- $this->setting->save( $repos );
37
  }
38
  }
39
 
2
 
3
  class OTGS_Installer_WP_Components_Setting_Ajax {
4
 
5
+ const AJAX_ACTION = 'otgs_save_setting_share_local_components';
6
+ const SAVE_SETTING_PRIORITY = 1;
7
 
8
  /**
9
  * @var OTGS_Installer_WP_Share_Local_Components_Setting
21
  }
22
 
23
  public function add_hooks() {
24
+ add_action( 'wp_ajax_' . self::AJAX_ACTION, array( $this, 'save' ), self::SAVE_SETTING_PRIORITY );
25
  }
26
 
27
  public function save() {
28
  if ( $this->is_valid_request() ) {
29
  $user_agree = (int) filter_var( $_POST['agree'], FILTER_SANITIZE_FULL_SPECIAL_CHARS );
30
  $repo_request = filter_var( $_POST['repo'], FILTER_SANITIZE_FULL_SPECIAL_CHARS );
31
+ if ( $repo_request ) {
32
+ $repos = array();
33
+ foreach ( $this->installer->get_repositories() as $repo_id => $repository ) {
34
+ if ( $repo_id === $repo_request ) {
35
+ $repos[ $repo_id ] = $user_agree;
36
+ }
37
  }
38
+ $this->setting->save( $repos );
39
  }
 
40
  }
41
  }
42
 
vendor/otgs/installer/includes/class-otgs-installer-wp-components-setting-resources.php CHANGED
@@ -7,6 +7,8 @@ class OTGS_Installer_WP_Components_Setting_Resources {
7
  */
8
  private $installer;
9
 
 
 
10
  public function __construct( WP_Installer $installer ) {
11
  $this->installer = $installer;
12
  }
@@ -16,6 +18,16 @@ class OTGS_Installer_WP_Components_Setting_Resources {
16
  }
17
 
18
  public function enqueue_resources() {
 
 
 
 
 
 
 
 
 
 
19
  wp_enqueue_style( 'otgs-installer-tooltip', $this->installer->res_url() . '/res/css/tooltip/tooltip.css', array( 'wp-pointer' ), WP_INSTALLER_VERSION );
20
  wp_enqueue_script( 'otgs-installer-tooltip', $this->installer->res_url() . '/res/js/tooltip/tooltip.js', array(
21
  'wp-pointer',
7
  */
8
  private $installer;
9
 
10
+ const HANDLES_OTGS_INSTALLER_UI = 'otgs-installer-ui';
11
+
12
  public function __construct( WP_Installer $installer ) {
13
  $this->installer = $installer;
14
  }
18
  }
19
 
20
  public function enqueue_resources() {
21
+ wp_register_style( self::HANDLES_OTGS_INSTALLER_UI,
22
+ $this->installer->res_url() . '/dist/css/ui/styles.css',
23
+ array(),
24
+ WP_INSTALLER_VERSION );
25
+ wp_register_script( self::HANDLES_OTGS_INSTALLER_UI,
26
+ $this->installer->res_url() . '/dist/js/ui/app.js',
27
+ array(),
28
+ WP_INSTALLER_VERSION,
29
+ true );
30
+
31
  wp_enqueue_style( 'otgs-installer-tooltip', $this->installer->res_url() . '/res/css/tooltip/tooltip.css', array( 'wp-pointer' ), WP_INSTALLER_VERSION );
32
  wp_enqueue_script( 'otgs-installer-tooltip', $this->installer->res_url() . '/res/js/tooltip/tooltip.js', array(
33
  'wp-pointer',
vendor/otgs/installer/includes/class-otgs-installer-wp-components-setting-templates.php DELETED
@@ -1,83 +0,0 @@
1
- <?php
2
-
3
- class OTGS_Installer_WP_Components_Setting_Templates {
4
-
5
- const COMMERCIAL_TAB_TEMPLATE = 'commercial-tab';
6
- const NOTICE_TEMPLATE = 'notice';
7
-
8
- /**
9
- * @var IOTGS_Installer_Template_Service
10
- */
11
- private $template_service;
12
-
13
- public function __construct( IOTGS_Installer_Template_Service $template_service ) {
14
- $this->template_service = $template_service;
15
- }
16
-
17
- /**
18
- * @param string $site_url
19
- * @param string $site_name
20
- */
21
- public function render_commercial( $site_url, $site_name, $repo_id ) {
22
- echo $this->template_service->show( $this->get_commercial_tab_model( $site_url, $site_name, $repo_id ), self::COMMERCIAL_TAB_TEMPLATE );
23
- }
24
-
25
- /**
26
- * @param array $sites
27
- */
28
- public function render_notice( $sites ) {
29
- echo $this->template_service->show( $this->get_notice_model( $sites ), self::NOTICE_TEMPLATE );
30
- }
31
-
32
- /**
33
- * @param string $site_url
34
- * @param string $site_name
35
- * @param string $repo_id
36
- *
37
- * @return array
38
- */
39
- private function get_commercial_tab_model( $site_url, $site_name, $repo_id ) {
40
- return array(
41
- 'strings' => array(
42
- 'message' => sprintf( __( 'Keep %s up-to-date about which theme and plugins I use', 'installer' ), $site_url ),
43
- 'stop_sending' => sprintf(
44
- __( 'If you ever want to stop sending the information about active plugins and theme to %1$s, please visit the Plugins admin screen. You will see a checkbox to control this in %2$s plugin section.', 'installer' ),
45
- $site_url,
46
- $site_name
47
- ),
48
- 'tooltip' => sprintf(
49
- __( 'Almost always, %s support team can help you resolve issues faster and better when we know which theme and plugin you use. When this option is selected, we will include this information in your %s account profile (which only you and %s support can access) and update it as needed.', 'installer' ),
50
- $site_name,
51
- $site_url,
52
- $site_name
53
- ),
54
- ),
55
- 'repo_id' => $repo_id,
56
- );
57
- }
58
-
59
- /**
60
- * @param array $site_names
61
- *
62
- * @return array
63
- */
64
- private function get_notice_model( array $site_names ) {
65
- $model = array(
66
- 'strings' => array(
67
- 'title' => sprintf( __( 'Want faster support for %s?', 'installer' ), implode( $site_names, '' ) ),
68
- 'message' => sprintf( __( '%s plugin can report to your wpml.org account which theme and plugins you are using. This information allows us to give you more accurate and faster support.', 'installer' ), implode( $site_names, '' ) ),
69
- ),
70
- );
71
-
72
- if ( 2 === count( $site_names ) ) {
73
- $model['strings']['title'] = __( 'Want faster support for WPML and Toolset?', 'installer' );
74
- $model['strings']['message'] = __( 'WPML and Toolset plugins can report to your wpml.org and wp-types.com accounts which theme and plugins you are using. This information allows us to give you more accurate and faster support.', 'installer' );
75
- }
76
-
77
- $model['strings']['agree'] = __( "I'm in", 'installer' );
78
- $model['strings']['disagree'] = __( 'No thanks', 'installer' );
79
- $model['strings']['tell_me_more'] = __( 'Tell me more', 'installer' );
80
-
81
- return $model;
82
- }
83
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/otgs/installer/includes/class-otgs-installer-wp-components-storage.php CHANGED
@@ -6,7 +6,7 @@ class OTGS_Installer_WP_Components_Storage {
6
 
7
  public function refresh_cache() {
8
  $active_theme = wp_get_theme();
9
- $installed_plugins = get_plugins();
10
  $components = array();
11
 
12
  foreach ( $installed_plugins as $file => $plugin ) {
@@ -29,7 +29,12 @@ class OTGS_Installer_WP_Components_Storage {
29
  }
30
 
31
  public function is_outdated() {
32
- $components = $this->get();
 
 
 
 
 
33
  $current_theme = wp_get_theme();
34
  $active_plugins = get_option( 'active_plugins' );
35
 
@@ -37,7 +42,7 @@ class OTGS_Installer_WP_Components_Storage {
37
  require_once ABSPATH . 'wp-admin/includes/plugin.php';
38
  }
39
 
40
- $installed_plugins = get_plugins();
41
 
42
  if ( isset( $components['theme'] ) ) {
43
  if ( $components['theme'][0]['Template'] !== $current_theme->get_template() ||
@@ -47,15 +52,15 @@ class OTGS_Installer_WP_Components_Storage {
47
  }
48
  }
49
 
50
- $cached_activated_plugins = wp_list_pluck( $components['plugin'], 'File' );
51
- sort( $cached_activated_plugins );
52
- sort( $active_plugins );
 
53
 
54
- if ( $cached_activated_plugins !== $active_plugins ) {
55
- return true;
56
- }
57
 
58
- if ( isset( $components['plugin'] ) ) {
59
  foreach ( $components['plugin'] as $plugin ) {
60
  if ( $plugin['Version'] !== $installed_plugins[ $plugin['File'] ]['Version'] ||
61
  ! is_plugin_active( $plugin['File'] )
@@ -71,4 +76,15 @@ class OTGS_Installer_WP_Components_Storage {
71
  public function get() {
72
  return get_option( self::COMPONENTS_CACHE_OPTION_KEY );
73
  }
 
 
 
 
 
 
 
 
 
 
 
74
  }
6
 
7
  public function refresh_cache() {
8
  $active_theme = wp_get_theme();
9
+ $installed_plugins = $this->get_plugins();
10
  $components = array();
11
 
12
  foreach ( $installed_plugins as $file => $plugin ) {
29
  }
30
 
31
  public function is_outdated() {
32
+ $components = $this->get();
33
+
34
+ if ( ! $components ) {
35
+ return true;
36
+ }
37
+
38
  $current_theme = wp_get_theme();
39
  $active_plugins = get_option( 'active_plugins' );
40
 
42
  require_once ABSPATH . 'wp-admin/includes/plugin.php';
43
  }
44
 
45
+ $installed_plugins = $this->get_plugins();
46
 
47
  if ( isset( $components['theme'] ) ) {
48
  if ( $components['theme'][0]['Template'] !== $current_theme->get_template() ||
52
  }
53
  }
54
 
55
+ if ( array_key_exists( 'plugin', $components ) ) {
56
+ $cached_activated_plugins = wp_list_pluck( $components['plugin'], 'File' );
57
+ sort( $cached_activated_plugins );
58
+ sort( $active_plugins );
59
 
60
+ if ( $cached_activated_plugins !== $active_plugins ) {
61
+ return true;
62
+ }
63
 
 
64
  foreach ( $components['plugin'] as $plugin ) {
65
  if ( $plugin['Version'] !== $installed_plugins[ $plugin['File'] ]['Version'] ||
66
  ! is_plugin_active( $plugin['File'] )
76
  public function get() {
77
  return get_option( self::COMPONENTS_CACHE_OPTION_KEY );
78
  }
79
+
80
+ /**
81
+ * @return array
82
+ */
83
+ public function get_plugins() {
84
+ if ( ! function_exists( 'get_plugins' ) ) {
85
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
86
+ }
87
+
88
+ return get_plugins();
89
+ }
90
  }
vendor/otgs/installer/includes/class-otgs-installer-wp-share-local-components-setting-hooks.php ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class OTGS_Installer_WP_Share_Local_Components_Setting_Hooks {
4
+
5
+ const TEMPLATE_CHECKBOX = 'share-local-data-setting';
6
+ const TEMPLATE_RADIO = 'share-local-data-setting-radio';
7
+
8
+ /**
9
+ * @var OTGS_Installer_Twig_Template_Service
10
+ */
11
+ private $template_service;
12
+
13
+ /**
14
+ * @var OTGS_Installer_WP_Share_Local_Components_Setting
15
+ */
16
+ private $setting;
17
+
18
+ public function __construct(
19
+ OTGS_Installer_Twig_Template_Service $template_service,
20
+ OTGS_Installer_WP_Share_Local_Components_Setting $setting
21
+ ) {
22
+ $this->template_service = $template_service;
23
+ $this->setting = $setting;
24
+ }
25
+
26
+ public function add_hooks() {
27
+ add_action( 'otgs_installer_render_local_components_setting',
28
+ array(
29
+ $this,
30
+ 'render_local_components_setting',
31
+ ),
32
+ 10,
33
+ 5 );
34
+ add_filter( 'otgs_installer_has_local_components_setting',
35
+ array( $this, 'has_local_components_setting_filter' ),
36
+ 10,
37
+ 2 );
38
+ add_filter( 'otgs_installer_repository_subscription_status',
39
+ array( $this, 'get_installer_repository_subscription_status' ),
40
+ 10,
41
+ 2 );
42
+ }
43
+
44
+ /**
45
+ * @param array $args
46
+ *
47
+ * @throws \InvalidArgumentException
48
+ */
49
+ public function render_local_components_setting( array $args ) {
50
+ $params = $this->validate_arguments( $args );
51
+
52
+ if ( (bool) $params['use_styles'] ) {
53
+ wp_enqueue_style( OTGS_Installer_WP_Components_Setting_Resources::HANDLES_OTGS_INSTALLER_UI );
54
+ wp_enqueue_script( OTGS_Installer_WP_Components_Setting_Resources::HANDLES_OTGS_INSTALLER_UI );
55
+ }
56
+
57
+ $template = self::TEMPLATE_CHECKBOX;
58
+ if ( (bool) $params['use_radio'] ) {
59
+ $template = self::TEMPLATE_RADIO;
60
+ }
61
+
62
+ echo $this->template_service->show( $this->get_model( $params ), $template );
63
+ }
64
+
65
+ /**
66
+ * @param $ignore
67
+ * @param string $repo (wpml|toolset)
68
+ *
69
+ * @return bool
70
+ */
71
+ public function has_local_components_setting_filter( $ignore, $repo ) {
72
+ return $this->setting->has_setting( $repo );
73
+ }
74
+
75
+ public function get_installer_repository_subscription_status( $ignore, $repo ) {
76
+ $subscription = WP_Installer()->get_subscription( $repo );
77
+
78
+ return $subscription->get_subscription_status_text();
79
+ }
80
+
81
+ private function get_model( $params ) {
82
+ $plugin_name = $params['plugin_name'];
83
+ $plugin_uri = $params['plugin_uri'];
84
+ $plugin_site = $params['plugin_site'];
85
+ $custom_heading = $params['custom_heading'];
86
+ $custom_label = $params['custom_label'];
87
+ $privacy_policy_url = $params['privacy_policy_url'];
88
+ $privacy_policy_text = $params['privacy_policy_text'];
89
+ $custom_privacy_policy_text = $params['custom_privacy_policy_text'];
90
+ $repo = isset( $params['plugin_repository'] ) ? $params['plugin_repository'] : strtolower( $plugin_name );
91
+
92
+ return array(
93
+ 'strings' => array(
94
+ 'heading' => __( 'Reporting to', 'installer' ),
95
+ 'report_to' => __( 'Report to', 'installer' ),
96
+ 'radio_report_yes' => __( 'Send theme and plugins info, in order to get faster support and compatibility alerts',
97
+ 'installer' ),
98
+ 'radio_report_no' => __( "Don't send this information and skip compatibility notes",
99
+ 'installer' ),
100
+ 'which_theme_and_plugins' => __( 'which theme and plugins you are using.', 'installer' ),
101
+ ),
102
+ 'custom_raw_heading' => $custom_heading,
103
+ 'custom_raw_label' => $custom_label,
104
+ 'custom_privacy_policy_text' => $custom_privacy_policy_text,
105
+ 'privacy_policy_url' => $privacy_policy_url,
106
+ 'privacy_policy_text' => $privacy_policy_text,
107
+ 'component_name' => $plugin_name,
108
+ 'company_url' => $plugin_uri,
109
+ 'company_site' => $plugin_site,
110
+ 'nonce' => array(
111
+ 'action' => OTGS_Installer_WP_Components_Setting_Ajax::AJAX_ACTION,
112
+ 'value' => wp_create_nonce( OTGS_Installer_WP_Components_Setting_Ajax::AJAX_ACTION ),
113
+ ),
114
+ 'repo' => $repo,
115
+ 'is_repo_allowed' => $this->setting->is_repo_allowed( $repo ),
116
+ 'has_setting' => (int) $this->setting->has_setting( $repo ),
117
+ );
118
+ }
119
+
120
+ /**
121
+ * @param array $args
122
+ *
123
+ * @return array
124
+ * @throws \InvalidArgumentException
125
+ */
126
+ private function validate_arguments( array $args ) {
127
+ if ( ! $args ) {
128
+ throw new InvalidArgumentException( 'Arguments are missing' );
129
+ }
130
+
131
+ $defaults = array(
132
+ 'custom_heading' => null,
133
+ 'custom_label' => null,
134
+ 'custom_radio_label_yes' => null,
135
+ 'custom_radio_label_no' => null,
136
+ 'custom_privacy_policy_text' => null,
137
+ 'use_styles' => false,
138
+ 'use_radio' => false,
139
+ 'privacy_policy_text' => __( 'Privacy and data usage policy', 'installer' ),
140
+ 'plugin_site' => null,
141
+ 'plugin_uri' => null,
142
+ );
143
+
144
+ $required_arguments = array( 'plugin_name', 'privacy_policy_url' );
145
+
146
+ if ( ! $this->must_use_radios( $args ) ) {
147
+ $required_arguments = array( 'plugin_uri', 'plugin_site' );
148
+ }
149
+
150
+ foreach ( $required_arguments as $required_argument ) {
151
+ if ( ! $this->has_required_argument( $args, $required_argument ) ) {
152
+ throw new InvalidArgumentException( $required_argument . ' is missing' );
153
+ }
154
+ }
155
+
156
+ return array_merge( $defaults, $args );
157
+ }
158
+
159
+ /**
160
+ * @param array $args
161
+ *
162
+ * @return bool
163
+ */
164
+ private function must_use_radios( array $args ) {
165
+ return array_key_exists( 'use_radio', $args ) && $args['use_radio'];
166
+ }
167
+
168
+ /**
169
+ * @param array $args
170
+ * @param string $required_argument
171
+ *
172
+ * @return bool
173
+ */
174
+ private function has_required_argument( array $args, $required_argument ) {
175
+ return array_key_exists( $required_argument, $args ) && $args[ $required_argument ];
176
+ }
177
+ }
vendor/otgs/installer/includes/class-otgs-installer-wp-share-local-components-setting.php CHANGED
@@ -20,6 +20,13 @@ class OTGS_Installer_WP_Share_Local_Components_Setting {
20
  return isset( $allowed_repos[ $repo ] ) && $allowed_repos[ $repo ];
21
  }
22
 
 
 
 
 
 
 
 
23
  private function get() {
24
  $setting = get_option( self::OPTION_KEY );
25
  return $setting ? $setting : array();
20
  return isset( $allowed_repos[ $repo ] ) && $allowed_repos[ $repo ];
21
  }
22
 
23
+ public function has_setting( $repo ) {
24
+ $current_value = $this->get();
25
+
26
+ return $current_value
27
+ && array_key_exists( $repo, $current_value );
28
+ }
29
+
30
  private function get() {
31
  $setting = get_option( self::OPTION_KEY );
32
  return $setting ? $setting : array();
vendor/otgs/installer/includes/class-otgs-twig-autoloader.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Twig.
5
+ *
6
+ * (c) Fabien Potencier
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ class OTGS_Twig_Autoloader {
13
+
14
+ /**
15
+ * @param bool $prepend
16
+ */
17
+ public static function register( $prepend = false ) {
18
+ if ( PHP_VERSION_ID < 50300 ) {
19
+ spl_autoload_register( array( __CLASS__, 'autoload' ) );
20
+ } else {
21
+ spl_autoload_register( array( __CLASS__, 'autoload' ), true, $prepend );
22
+ }
23
+
24
+ }
25
+
26
+ /**
27
+ * @param string $class
28
+ */
29
+ public static function autoload( $class ) {
30
+ if ( 0 !== strpos( $class, 'Twig' ) ) {
31
+ return;
32
+ }
33
+
34
+ $file = WP_Installer()->plugin_path() . '/../../twig/twig/lib/' . str_replace( array( '_', "\0" ), array( '/', '' ), $class . '.php' );
35
+
36
+ if ( is_file( $file ) ) {
37
+ require $file;
38
+ }
39
+ }
40
+ }
vendor/otgs/installer/includes/class-wp-installer-api.php CHANGED
@@ -129,6 +129,4 @@ class WP_Installer_API{
129
 
130
  return $user_id;
131
  }
132
-
133
-
134
  }
129
 
130
  return $user_id;
131
  }
 
 
132
  }
vendor/otgs/installer/includes/class-wp-installer.php CHANGED
@@ -1,6 +1,9 @@
1
  <?php
2
 
3
  final class WP_Installer {
 
 
 
4
  protected static $_instance = null;
5
 
6
  public $settings = array();
@@ -20,6 +23,8 @@ final class WP_Installer {
20
 
21
  private $package_source = array();
22
 
 
 
23
  const SITE_KEY_VALIDATION_SOURCE_OTHER = 0;
24
  const SITE_KEY_VALIDATION_SOURCE_DOWNLOAD_SPECIFIC = 1;
25
  const SITE_KEY_VALIDATION_SOURCE_DOWNLOAD_REPORT = 2;
@@ -29,6 +34,8 @@ final class WP_Installer {
29
 
30
  public $dependencies;
31
 
 
 
32
  public static function instance() {
33
 
34
  if ( is_null( self::$_instance ) ) {
@@ -146,8 +153,8 @@ final class WP_Installer {
146
  add_action( 'wp_ajax_installer_dismiss_nag', array( $this, 'dismiss_nag' ) );
147
  }
148
 
149
- if ( $pagenow == 'update.php' ) {
150
- if ( isset( $_GET['action'] ) && $_GET['action'] == 'update-selected' ) {
151
  add_action( 'admin_head', array( $this, 'plugin_upgrade_custom_errors' ) ); //iframe/bulk
152
  } else {
153
  add_action( 'all_admin_notices', array( $this, 'plugin_upgrade_custom_errors' ) ); //regular/singular
@@ -191,7 +198,7 @@ final class WP_Installer {
191
  if ( ! empty( $this->admin_messages ) ) {
192
  $types = array( 'error', 'updated', 'notice' );
193
  foreach ( $this->admin_messages as $message ) {
194
- $class = in_array( $message['type'], $types ) ? $message['type'] : 'updated';
195
  ?>
196
  <div class="<?php echo $class ?>">
197
  <p>
@@ -233,7 +240,7 @@ final class WP_Installer {
233
  'show_products'
234
  ) );
235
  } else {
236
- if ( $this->config['plugins_install_tab'] && is_admin() && $pagenow == 'plugin-install.php' ) {
237
  // Default GUI, under Plugins -> Install
238
  add_filter( 'install_plugins_tabs', array( $this, 'add_install_plugins_tab' ) );
239
  add_action( 'install_plugins_commercial', array( $this, 'show_products' ) );
@@ -259,7 +266,7 @@ final class WP_Installer {
259
  private function menu_multisite_redirect() {
260
  global $pagenow;
261
 
262
- if ( $pagenow == 'plugin-install.php' && isset( $_GET['tab'] ) && $_GET['tab'] == 'commercial' ) {
263
  wp_redirect( $this->menu_url() );
264
  exit;
265
  }
@@ -300,21 +307,27 @@ final class WP_Installer {
300
 
301
  foreach ( $repository['data']['packages'] as $package ) {
302
 
303
- foreach ( $package['products'] as $product ) {
 
 
 
304
 
305
- foreach ( $product['plugins'] as $plugin_slug ) {
306
 
307
- $download = $this->settings['repositories'][ $repository_id ]['data']['downloads']['plugins'][ $plugin_slug ];
 
 
 
 
 
308
 
309
- if ( ! isset( $repositories_plugins[ $repository_id ][ $download['slug'] ] ) ) {
310
- $repositories_plugins[ $repository_id ][ $download['slug'] ] = array(
311
- 'name' => $download['name'],
312
- 'registered' => $this->plugin_is_registered( $repository_id, $download['slug'] ) ? 1 : 0
313
- );
314
  }
315
-
316
  }
317
-
 
318
  }
319
 
320
  }
@@ -330,20 +343,46 @@ final class WP_Installer {
330
 
331
  foreach ( $r_plugins as $slug => $r_plugin ) {
332
 
333
- if ( $wp_plugin_slug == $slug || $r_plugin['name'] == $plugin['Name'] || $r_plugin['name'] == $plugin['Title'] ) { //match order: slug, name, title
 
 
 
 
 
 
 
334
 
335
  if ( $r_plugin['registered'] ) {
 
 
 
 
 
 
336
  add_filter( 'plugin_action_links_' . $plugin_id, array(
337
  $this,
338
  'plugins_action_links_registered'
339
  ) );
340
  } else {
 
 
 
 
 
 
 
 
 
 
341
  add_filter( 'plugin_action_links_' . $plugin_id, array(
342
  $this,
343
  'plugins_action_links_not_registered'
344
  ) );
345
- }
346
 
 
 
 
 
347
  }
348
 
349
  }
@@ -358,6 +397,15 @@ final class WP_Installer {
358
 
359
  }
360
 
 
 
 
 
 
 
 
 
 
361
  public function plugins_action_links_registered( $links ) {
362
  $links[] = '<a href="' . $this->menu_url() . '">' . __( 'Registered', 'installer' ) . '</a>';
363
 
@@ -388,7 +436,11 @@ final class WP_Installer {
388
  $product['subscription_type_equivalent'] = '';
389
  }
390
 
391
- if ( $product['subscription_type'] == $subscription_type || $product['subscription_type_equivalent'] == $subscription_type || $this->have_superior_subscription( $subscription_type, $product ) ) {
 
 
 
 
392
 
393
  foreach ( $product['plugins'] as $plugin_slug ) {
394
 
@@ -1036,6 +1088,14 @@ final class WP_Installer {
1036
  if ( isset( $subscription_type ) && ! $expired && ( $product['subscription_type'] == $subscription_type || $product['subscription_type_equivalent'] == $subscription_type ) ) {
1037
 
1038
  foreach ( $product['plugins'] as $plugin_slug ) {
 
 
 
 
 
 
 
 
1039
  $row['downloads'][ $plugin_slug ] = $this->settings['repositories'][ $repository_id ]['data']['downloads']['plugins'][ $plugin_slug ];
1040
  }
1041
 
@@ -1145,6 +1205,17 @@ final class WP_Installer {
1145
 
1146
  }
1147
 
 
 
 
 
 
 
 
 
 
 
 
1148
  public function save_site_key( $args = array() ) {
1149
 
1150
  $error = '';
@@ -1172,13 +1243,9 @@ final class WP_Installer {
1172
  }
1173
  $site_key = preg_replace( "/[^A-Za-z0-9]/", '', $site_key );
1174
 
1175
- if ( $repository_id && $nonce && wp_create_nonce( 'save_site_key_' . $repository_id ) == $nonce ) {
1176
 
1177
  try {
1178
- $should_send_components_data = (int) isset( $_POST['repo_allowed_to_send_data'] );
1179
- $components_setting = new OTGS_Installer_WP_Share_Local_Components_Setting();
1180
- $components_setting->save( array( $repository_id => $should_send_components_data ) );
1181
-
1182
  $subscription_data = $this->fetch_subscription_data( $repository_id, $site_key, self::SITE_KEY_VALIDATION_SOURCE_REGISTRATION );
1183
 
1184
  if ( $subscription_data ) {
@@ -1256,7 +1323,12 @@ final class WP_Installer {
1256
 
1257
  $site_key = $this->get_site_key( $repository_id );
1258
  if ( $site_key ) {
1259
- $subscription_data = $this->fetch_subscription_data( $repository_id, $site_key, self::SITE_KEY_VALIDATION_SOURCE_REVALIDATION );
 
 
 
 
 
1260
  if ( empty( $subscription_data ) ) {
1261
  unset( $this->settings['repositories'][ $repository_id ]['subscription'] );
1262
  delete_site_transient( 'update_plugins' );
@@ -1382,7 +1454,7 @@ final class WP_Installer {
1382
  $this->log( "POST {$this->repositories[$repository_id]['api-url']} - fetch subscription data" );
1383
 
1384
  if ( ! is_wp_error( $response ) ) {
1385
- $datas = wp_remote_retrieve_body( $response );
1386
 
1387
  if ( is_serialized( $datas ) ) {
1388
  $data = unserialize( $datas );
@@ -1446,19 +1518,24 @@ final class WP_Installer {
1446
  return $site_key;
1447
  }
1448
 
1449
- public function repository_has_valid_subscription( $repository_id ) {
1450
-
1451
- $valid = false;
1452
-
 
 
 
1453
  if ( ! empty( $this->settings['repositories'][ $repository_id ]['subscription'] ) ) {
1454
-
1455
- $subscription = $this->settings['repositories'][ $repository_id ]['subscription']['data'];
1456
- $valid = ( $subscription->status == 1 && ( strtotime( $subscription->expires ) > time() || empty( $subscription->expires ) ) ) || $subscription->status == 4;
1457
-
1458
  }
1459
 
1460
- return $valid;
 
 
 
 
1461
 
 
1462
  }
1463
 
1464
  public function repository_has_subscription( $repository_id ) {
@@ -1468,7 +1545,6 @@ final class WP_Installer {
1468
  }
1469
 
1470
  return $key;
1471
-
1472
  }
1473
 
1474
  public function repository_has_expired_subscription( $repository_id ) {
@@ -1549,8 +1625,8 @@ final class WP_Installer {
1549
  $never_expires = isset( $this->settings['repositories'][ $repository_id ]['subscription'] )
1550
  && empty( $this->settings['repositories'][ $repository_id ]['subscription']['data']->expires )
1551
  && (
1552
- $this->settings['repositories'][ $repository_id ]['subscription']['data']->status == 4 ||
1553
- $this->settings['repositories'][ $repository_id ]['subscription']['data']->status == 1
1554
  );
1555
 
1556
  if ( ! $never_expires ) {
@@ -1695,7 +1771,7 @@ final class WP_Installer {
1695
  $subscription_type = $this->get_subscription_type_for_repository( $repository_id );
1696
  $expired = $this->repository_has_expired_subscription( $repository_id );
1697
 
1698
- if ( $this->repository_has_subscription( $repository_id ) && ! $expired ) {
1699
 
1700
  $this->set_hierarchy_and_order();
1701
 
@@ -1911,13 +1987,19 @@ final class WP_Installer {
1911
 
1912
  $data = json_decode( base64_decode( sanitize_text_field( $_POST['data'] ) ), true );
1913
 
1914
- $ret = false;
1915
- $plugin_id = false;
1916
- $message = '';
 
1917
 
1918
- //validate subscription
1919
- $site_key = $this->get_repository_site_key( $data['repository_id'] );
1920
- $subscription_data = $this->fetch_subscription_data( $data['repository_id'], $site_key, self::SITE_KEY_VALIDATION_SOURCE_DOWNLOAD_REPORT );
 
 
 
 
 
1921
 
1922
  if ( $subscription_data && ! is_wp_error( $subscription_data ) && $this->repository_has_valid_subscription( $data['repository_id'] ) ) {
1923
 
@@ -2000,8 +2082,10 @@ final class WP_Installer {
2000
 
2001
  }
2002
 
 
 
 
2003
  } else { //subscription not valid
2004
-
2005
  $ret = false;
2006
  $message = __( 'Your subscription appears to no longer be valid. Please try to register again using a valid site key.', 'installer' );
2007
  }
@@ -2137,7 +2221,7 @@ final class WP_Installer {
2137
  )
2138
  ) {
2139
 
2140
- if ( ! empty( $download['free-on-wporg'] ) && $download['channel'] == WP_Installer_Channels::CHANNEL_PRODUCTION ) {
2141
  return false; // use data from wordpress.org
2142
  }
2143
 
@@ -2150,6 +2234,7 @@ final class WP_Installer {
2150
  $res->author = '';
2151
  $res->author_profile = '';
2152
  $res->last_updated = $download['date'];
 
2153
 
2154
  if ( $site_key ) {
2155
  $res->download_link = $this->append_site_key_to_download_url( $download['url'], $site_key, $repository_id );
@@ -2211,9 +2296,22 @@ final class WP_Installer {
2211
 
2212
  foreach ( $product['plugins'] as $plugin_slug ) {
2213
 
 
 
 
 
 
 
 
 
2214
  $download = $this->settings['repositories'][ $repository_id ]['data']['downloads']['plugins'][ $plugin_slug ];
2215
 
2216
- if ( ! empty( $download['free-on-wporg'] ) && $download['channel'] == WP_Installer_Channels::CHANNEL_PRODUCTION ) {
 
 
 
 
 
2217
  continue;
2218
  }
2219
 
@@ -2221,7 +2319,7 @@ final class WP_Installer {
2221
  ! empty( $_POST['reset_to_channel'] );
2222
 
2223
  if (
2224
- empty( $update_plugins->response[ $plugin_id ] ) &&
2225
  ( $download['slug'] == $slug || $download['name'] == $name ) &&
2226
  $needs_version_update
2227
  ) {
@@ -2230,13 +2328,14 @@ final class WP_Installer {
2230
  $response->slug = $slug;
2231
  $response->plugin = $plugin_id;
2232
  $response->new_version = $download['version'];
 
2233
  $response->upgrade_notice = '';
2234
  $response->url = $download['url'];
2235
  if ( $site_key ) {
2236
  $response->package = $this->append_site_key_to_download_url( $download['url'], $site_key, $repository_id );
2237
  }
2238
 
2239
- $response = apply_filters( 'otgs_installer_upgrade_check_response', $response, $plugin_id, $repository_id );
2240
 
2241
  $update_plugins->checked[ $plugin_id ] = $version;
2242
  $update_plugins->response[ $plugin_id ] = $response;
@@ -2259,13 +2358,24 @@ final class WP_Installer {
2259
 
2260
  }
2261
 
 
 
 
 
 
 
 
 
 
 
 
2262
  public function setup_plugins_page_notices() {
2263
  $plugins = get_plugins();
2264
  $template_service = new OTGS_Installer_Twig_Template_Service_Loader(
2265
  array( $this->plugin_path() . '/templates/components-setting/' )
2266
  );
2267
  $local_components_setting = new OTGS_Installer_WP_Share_Local_Components_Setting();
2268
- $plugin_page_notice = new OTGS_Installer_Plugins_Page_Notice( $template_service->get_service(), $local_components_setting );
2269
 
2270
  foreach ( $plugins as $plugin_id => $plugin ) {
2271
 
@@ -2290,10 +2400,17 @@ final class WP_Installer {
2290
 
2291
  foreach ( $product['plugins'] as $plugin_slug ) {
2292
 
 
 
 
 
 
 
 
 
2293
  $download = $this->settings['repositories'][ $repository_id ]['data']['downloads']['plugins'][ $plugin_slug ];
2294
  $display_subscription_notice = false;
2295
  $display_setting_notice = false;
2296
- $is_free_and_production = ! empty( $download['free-on-wporg'] ) && $download['channel'] == WP_Installer_Channels::CHANNEL_PRODUCTION;
2297
 
2298
  if ( $download['slug'] == $slug || $download['name'] == $name ) {
2299
  if ( in_array( $name, array( 'Toolset Types', 'WPML Multilingual CMS' ), true ) ) {
@@ -2303,9 +2420,17 @@ final class WP_Installer {
2303
  if ( ! $site_key || ! $this->plugin_is_registered( $repository_id, $download['slug'] ) ) {
2304
  $display_setting_notice = false;
2305
 
2306
- if ( ! $is_free_and_production ) {
 
 
 
 
2307
  $display_subscription_notice = true;
2308
  }
 
 
 
 
2309
  }
2310
  }
2311
 
@@ -2596,6 +2721,17 @@ final class WP_Installer {
2596
  return false;
2597
  }
2598
 
 
 
 
 
 
 
 
 
 
 
 
2599
  public function plugin_upgrade_custom_errors() {
2600
 
2601
  if ( isset( $_REQUEST['action'] ) ) {
@@ -2646,18 +2782,20 @@ final class WP_Installer {
2646
  static $sub_cache = array();
2647
 
2648
  if ( empty( $sub_cache[ $plugin_repository ] ) ) {
2649
- $site_key = $this->get_repository_site_key( $plugin_repository );
 
2650
  if ( $site_key ) {
2651
- $subscription_data = $this->fetch_subscription_data( $plugin_repository, $site_key, self::SITE_KEY_VALIDATION_SOURCE_REVALIDATION );
 
 
 
2652
  }
2653
 
2654
  $sub_cache[ $plugin_repository ]['site_key'] = $site_key;
2655
- $sub_cache[ $plugin_repository ]['subscription_data'] = isset( $subscription_data ) ? $subscription_data : false;
2656
  } else {
2657
-
2658
  $site_key = $sub_cache[ $plugin_repository ]['site_key'];
2659
  $subscription_data = $sub_cache[ $plugin_repository ]['subscription_data'];
2660
-
2661
  }
2662
 
2663
  if ( ! $site_key && ! empty( $free_on_wporg ) ) { // allow the download from wp.org
@@ -2726,10 +2864,17 @@ final class WP_Installer {
2726
  //validate subscription
2727
  $site_key = $this->get_repository_site_key( $plugin_repository );
2728
  if ( $site_key ) {
2729
- $subscription_data = $this->fetch_subscription_data( $plugin_repository, $site_key, self::SITE_KEY_VALIDATION_SOURCE_REVALIDATION );
 
 
 
 
2730
  }
2731
 
2732
- if ( ( empty( $site_key ) || empty( $subscription_data ) ) && empty( $free_on_wporg ) ) {
 
 
 
2733
 
2734
  $error_message = sprintf( __( "%s cannot update because your site's registration is not valid. Please %sregister %s%s again for this site first.", 'installer' ),
2735
  '<strong>' . $plugin_name . '</strong>', '<a href="' . $this->menu_url() . '&validate_repository=' . $plugin_repository .
1
  <?php
2
 
3
  final class WP_Installer {
4
+
5
+ const TOOLSET_TYPES = 'Toolset Types';
6
+
7
  protected static $_instance = null;
8
 
9
  public $settings = array();
23
 
24
  private $package_source = array();
25
 
26
+ private $plugin_finder;
27
+
28
  const SITE_KEY_VALIDATION_SOURCE_OTHER = 0;
29
  const SITE_KEY_VALIDATION_SOURCE_DOWNLOAD_SPECIFIC = 1;
30
  const SITE_KEY_VALIDATION_SOURCE_DOWNLOAD_REPORT = 2;
34
 
35
  public $dependencies;
36
 
37
+ private $components_setting;
38
+
39
  public static function instance() {
40
 
41
  if ( is_null( self::$_instance ) ) {
153
  add_action( 'wp_ajax_installer_dismiss_nag', array( $this, 'dismiss_nag' ) );
154
  }
155
 
156
+ if ( $pagenow === 'update.php' ) {
157
+ if ( isset( $_GET['action'] ) && $_GET['action'] === 'update-selected' ) {
158
  add_action( 'admin_head', array( $this, 'plugin_upgrade_custom_errors' ) ); //iframe/bulk
159
  } else {
160
  add_action( 'all_admin_notices', array( $this, 'plugin_upgrade_custom_errors' ) ); //regular/singular
198
  if ( ! empty( $this->admin_messages ) ) {
199
  $types = array( 'error', 'updated', 'notice' );
200
  foreach ( $this->admin_messages as $message ) {
201
+ $class = in_array( $message['type'], $types, true ) ? $message['type'] : 'updated';
202
  ?>
203
  <div class="<?php echo $class ?>">
204
  <p>
240
  'show_products'
241
  ) );
242
  } else {
243
+ if ( $this->config['plugins_install_tab'] && is_admin() && $pagenow === 'plugin-install.php' ) {
244
  // Default GUI, under Plugins -> Install
245
  add_filter( 'install_plugins_tabs', array( $this, 'add_install_plugins_tab' ) );
246
  add_action( 'install_plugins_commercial', array( $this, 'show_products' ) );
266
  private function menu_multisite_redirect() {
267
  global $pagenow;
268
 
269
+ if ( $pagenow === 'plugin-install.php' && isset( $_GET['tab'] ) && $_GET['tab'] === 'commercial' ) {
270
  wp_redirect( $this->menu_url() );
271
  exit;
272
  }
307
 
308
  foreach ( $repository['data']['packages'] as $package ) {
309
 
310
+ if ( array_key_exists( 'products', $package ) ) {
311
+ foreach ( $package['products'] as $product ) {
312
+ if ( array_key_exists( 'plugins', $product ) ) {
313
+ foreach ( $product['plugins'] as $plugin_slug ) {
314
 
315
+ $download = $this->settings['repositories'][ $repository_id ]['data']['downloads']['plugins'][ $plugin_slug ];
316
 
317
+ if ( ! isset( $repositories_plugins[ $repository_id ][ $download['slug'] ] ) ) {
318
+ $repositories_plugins[ $repository_id ][ $download['slug'] ] = array(
319
+ 'name' => $download['name'],
320
+ 'registered' => $this->plugin_is_registered( $repository_id, $download['slug'] ) ? 1 : 0
321
+ );
322
+ }
323
 
324
+ }
325
+ } else {
326
+ $this->refresh_repositories_data();
 
 
327
  }
 
328
  }
329
+ } else {
330
+ $this->refresh_repositories_data();
331
  }
332
 
333
  }
343
 
344
  foreach ( $r_plugins as $slug => $r_plugin ) {
345
 
346
+ if ( $wp_plugin_slug === $slug || $r_plugin['name'] === $plugin['Name'] || $r_plugin['name'] === $plugin['Title'] ) { //match order: slug, name, title
347
+
348
+ $plugin_finder = $this->get_plugin_finder();
349
+ $plugin_obj = $plugin_finder->get_plugin( $slug, $repository_id );
350
+
351
+ if ( $plugin_obj && $plugin_obj->get_external_repo() && $plugin_obj->is_lite() ) {
352
+ continue;
353
+ }
354
 
355
  if ( $r_plugin['registered'] ) {
356
+
357
+ remove_filter( 'plugin_action_links_' . $plugin_id, array(
358
+ $this,
359
+ 'plugins_action_links_not_registered'
360
+ ) );
361
+
362
  add_filter( 'plugin_action_links_' . $plugin_id, array(
363
  $this,
364
  'plugins_action_links_registered'
365
  ) );
366
  } else {
367
+
368
+ if ( $this->plugin_is_registered( $plugin_obj->get_external_repo(), $slug ) || $this->plugin_is_registered( 'wpml', $slug ) ) {
369
+ continue;
370
+ }
371
+
372
+ remove_filter( 'plugin_action_links_' . $plugin_id, array(
373
+ $this,
374
+ 'plugins_action_links_registered'
375
+ ) );
376
+
377
  add_filter( 'plugin_action_links_' . $plugin_id, array(
378
  $this,
379
  'plugins_action_links_not_registered'
380
  ) );
 
381
 
382
+ if ( $this->should_display_types_upgrade_link( $r_plugin['name'], $plugin['Version'] ) ) {
383
+ add_filter( 'plugin_action_links_' . $plugin_id, array( $this, 'types_upgrade_link' ) );
384
+ }
385
+ }
386
  }
387
 
388
  }
397
 
398
  }
399
 
400
+ private function should_display_types_upgrade_link( $name, $version ) {
401
+ return $name === self::TOOLSET_TYPES && version_compare( $version, '3.0', '<' );
402
+ }
403
+
404
+ public function types_upgrade_link( $links ) {
405
+ $links[] = '<a style="color: #55AA55" target="_blank" href="'. esc_url( 'https://toolset.com/buy/?utm_source=typesplugin&utm_campaign=moving-types-to-toolset&utm_medium=plugins-page&utm_term=upgrade-link' ) .'">' . __( 'Upgrade', 'installer' ) . '</a>';
406
+ return $links;
407
+ }
408
+
409
  public function plugins_action_links_registered( $links ) {
410
  $links[] = '<a href="' . $this->menu_url() . '">' . __( 'Registered', 'installer' ) . '</a>';
411
 
436
  $product['subscription_type_equivalent'] = '';
437
  }
438
 
439
+ if (
440
+ $product['subscription_type'] === (int) $subscription_type ||
441
+ (int) $product['subscription_type_equivalent'] === (int) $subscription_type ||
442
+ $this->have_superior_subscription( $subscription_type, $product )
443
+ ) {
444
 
445
  foreach ( $product['plugins'] as $plugin_slug ) {
446
 
1088
  if ( isset( $subscription_type ) && ! $expired && ( $product['subscription_type'] == $subscription_type || $product['subscription_type_equivalent'] == $subscription_type ) ) {
1089
 
1090
  foreach ( $product['plugins'] as $plugin_slug ) {
1091
+ $plugin_finder = $this->get_plugin_finder();
1092
+ $plugin = $plugin_finder->get_plugin( $plugin_slug, $repository_id );
1093
+ $external_repo = $plugin->get_external_repo();
1094
+
1095
+ if ( $external_repo && $this->repository_has_valid_subscription( $external_repo ) ) {
1096
+ continue;
1097
+ }
1098
+
1099
  $row['downloads'][ $plugin_slug ] = $this->settings['repositories'][ $repository_id ]['data']['downloads']['plugins'][ $plugin_slug ];
1100
  }
1101
 
1205
 
1206
  }
1207
 
1208
+ /**
1209
+ * @return OTGS_Installer_WP_Share_Local_Components_Setting
1210
+ */
1211
+ private function get_component_setting() {
1212
+ if ( ! $this->components_setting ) {
1213
+ $this->components_setting = new OTGS_Installer_WP_Share_Local_Components_Setting();
1214
+ }
1215
+
1216
+ return $this->components_setting;
1217
+ }
1218
+
1219
  public function save_site_key( $args = array() ) {
1220
 
1221
  $error = '';
1243
  }
1244
  $site_key = preg_replace( "/[^A-Za-z0-9]/", '', $site_key );
1245
 
1246
+ if ( $repository_id && $nonce && wp_create_nonce( 'save_site_key_' . $repository_id ) === $nonce ) {
1247
 
1248
  try {
 
 
 
 
1249
  $subscription_data = $this->fetch_subscription_data( $repository_id, $site_key, self::SITE_KEY_VALIDATION_SOURCE_REGISTRATION );
1250
 
1251
  if ( $subscription_data ) {
1323
 
1324
  $site_key = $this->get_site_key( $repository_id );
1325
  if ( $site_key ) {
1326
+ try {
1327
+ $subscription_data = $this->fetch_subscription_data( $repository_id, $site_key, self::SITE_KEY_VALIDATION_SOURCE_REVALIDATION );
1328
+ } catch ( Exception $e ) {
1329
+ $subscription_data = false;
1330
+ }
1331
+
1332
  if ( empty( $subscription_data ) ) {
1333
  unset( $this->settings['repositories'][ $repository_id ]['subscription'] );
1334
  delete_site_transient( 'update_plugins' );
1454
  $this->log( "POST {$this->repositories[$repository_id]['api-url']} - fetch subscription data" );
1455
 
1456
  if ( ! is_wp_error( $response ) ) {
1457
+ $datas = trim ( wp_remote_retrieve_body( $response ) );
1458
 
1459
  if ( is_serialized( $datas ) ) {
1460
  $data = unserialize( $datas );
1518
  return $site_key;
1519
  }
1520
 
1521
+ /**
1522
+ * @param $repository_id
1523
+ *
1524
+ * @return OTGS_Installer_Subscription
1525
+ */
1526
+ public function get_subscription( $repository_id ) {
1527
+ $data = null;
1528
  if ( ! empty( $this->settings['repositories'][ $repository_id ]['subscription'] ) ) {
1529
+ $data = $this->settings['repositories'][ $repository_id ]['subscription']['data'];
 
 
 
1530
  }
1531
 
1532
+ return new OTGS_Installer_Subscription( $data );
1533
+ }
1534
+
1535
+ public function repository_has_valid_subscription( $repository_id ) {
1536
+ $subscription = $this->get_subscription( $repository_id );
1537
 
1538
+ return $subscription->is_valid();
1539
  }
1540
 
1541
  public function repository_has_subscription( $repository_id ) {
1545
  }
1546
 
1547
  return $key;
 
1548
  }
1549
 
1550
  public function repository_has_expired_subscription( $repository_id ) {
1625
  $never_expires = isset( $this->settings['repositories'][ $repository_id ]['subscription'] )
1626
  && empty( $this->settings['repositories'][ $repository_id ]['subscription']['data']->expires )
1627
  && (
1628
+ (int) $this->settings['repositories'][ $repository_id ]['subscription']['data']->status === OTGS_Installer_Subscription::SUBSCRIPTION_STATUS_ACTIVE_NO_EXPIRATION ||
1629
+ (int) $this->settings['repositories'][ $repository_id ]['subscription']['data']->status === OTGS_Installer_Subscription::SUBSCRIPTION_STATUS_ACTIVE
1630
  );
1631
 
1632
  if ( ! $never_expires ) {
1771
  $subscription_type = $this->get_subscription_type_for_repository( $repository_id );
1772
  $expired = $this->repository_has_expired_subscription( $repository_id );
1773
 
1774
+ if ( ! $expired && $this->repository_has_subscription( $repository_id ) ) {
1775
 
1776
  $this->set_hierarchy_and_order();
1777
 
1987
 
1988
  $data = json_decode( base64_decode( sanitize_text_field( $_POST['data'] ) ), true );
1989
 
1990
+ $ret = false;
1991
+ $plugin_id = false;
1992
+ $message = '';
1993
+ $connection_error = false;
1994
 
1995
+ //validate subscription
1996
+ $site_key = $this->get_repository_site_key($data['repository_id']);
1997
+ try {
1998
+ $subscription_data = $this->fetch_subscription_data( $data['repository_id'], $site_key, self::SITE_KEY_VALIDATION_SOURCE_DOWNLOAD_REPORT );
1999
+ } catch ( Exception $e ) {
2000
+ $connection_error = $e->getMessage();
2001
+ $subscription_data = false;
2002
+ }
2003
 
2004
  if ( $subscription_data && ! is_wp_error( $subscription_data ) && $this->repository_has_valid_subscription( $data['repository_id'] ) ) {
2005
 
2082
 
2083
  }
2084
 
2085
+ } elseif ( $connection_error ) {
2086
+ $ret = false;
2087
+ $message = sprintf( __( 'Connection failed! Please refresh the page and try again. (%s)', 'installer' ), '<i>' . $connection_error . '</i>' );
2088
  } else { //subscription not valid
 
2089
  $ret = false;
2090
  $message = __( 'Your subscription appears to no longer be valid. Please try to register again using a valid site key.', 'installer' );
2091
  }
2221
  )
2222
  ) {
2223
 
2224
+ if ( $this->should_fallback_under_wp_org_repo( $download, $site_key ) ) {
2225
  return false; // use data from wordpress.org
2226
  }
2227
 
2234
  $res->author = '';
2235
  $res->author_profile = '';
2236
  $res->last_updated = $download['date'];
2237
+ $res->tested = isset($download['tested'])?$download['tested']:'';
2238
 
2239
  if ( $site_key ) {
2240
  $res->download_link = $this->append_site_key_to_download_url( $download['url'], $site_key, $repository_id );
2296
 
2297
  foreach ( $product['plugins'] as $plugin_slug ) {
2298
 
2299
+ $plugin_finder = $this->get_plugin_finder();
2300
+ $plugin_data = $plugin_finder->get_plugin( $plugin_slug, $repository_id );
2301
+ $external_repo = $plugin_data->get_external_repo();
2302
+
2303
+ if ( $external_repo && $this->plugin_is_registered( $external_repo, $plugin_slug ) ) {
2304
+ continue;
2305
+ }
2306
+
2307
  $download = $this->settings['repositories'][ $repository_id ]['data']['downloads']['plugins'][ $plugin_slug ];
2308
 
2309
+ if ( ! $this->plugin_is_registered( $repository_id, $download['slug'] ) ) {
2310
+ continue;
2311
+ }
2312
+
2313
+ $has_wporg_update = ! empty( $update_plugins->response[ $plugin_id ] );
2314
+ if ( $this->should_fallback_under_wp_org_repo( $download, $site_key ) && $has_wporg_update ) {
2315
  continue;
2316
  }
2317
 
2319
  ! empty( $_POST['reset_to_channel'] );
2320
 
2321
  if (
2322
+ ( empty( $update_plugins->response[ $plugin_id ] ) || ! $this->should_fallback_under_wp_org_repo( $download, $site_key ) ) &&
2323
  ( $download['slug'] == $slug || $download['name'] == $name ) &&
2324
  $needs_version_update
2325
  ) {
2328
  $response->slug = $slug;
2329
  $response->plugin = $plugin_id;
2330
  $response->new_version = $download['version'];
2331
+ $response->tested = isset($download['tested'])?$download['tested']:'';
2332
  $response->upgrade_notice = '';
2333
  $response->url = $download['url'];
2334
  if ( $site_key ) {
2335
  $response->package = $this->append_site_key_to_download_url( $download['url'], $site_key, $repository_id );
2336
  }
2337
 
2338
+ $response = apply_filters( 'otgs_installer_upgrade_check_response', $response, $name, $repository_id );
2339
 
2340
  $update_plugins->checked[ $plugin_id ] = $version;
2341
  $update_plugins->response[ $plugin_id ] = $response;
2358
 
2359
  }
2360
 
2361
+ private function should_fallback_under_wp_org_repo( $download, $site_key ) {
2362
+ return ( ! empty( $download['free-on-wporg'] ) || isset( $download['fallback-free-on-wporg'] ) && $download['fallback-free-on-wporg'] && ! $site_key ) && $download['channel'] == WP_Installer_Channels::CHANNEL_PRODUCTION;
2363
+ }
2364
+
2365
+ private function has_non_wporg_upgrade_available( $plugin_id ){
2366
+ $plugins_update_data = get_site_transient( 'update_plugins' );
2367
+
2368
+ return ! empty( $plugins_update_data->response[ $plugin_id ] ) &&
2369
+ ! preg_match('/w\.org/', $plugins_update_data->response[ $plugin_id ]->id );
2370
+ }
2371
+
2372
  public function setup_plugins_page_notices() {
2373
  $plugins = get_plugins();
2374
  $template_service = new OTGS_Installer_Twig_Template_Service_Loader(
2375
  array( $this->plugin_path() . '/templates/components-setting/' )
2376
  );
2377
  $local_components_setting = new OTGS_Installer_WP_Share_Local_Components_Setting();
2378
+ $plugin_page_notice = new OTGS_Installer_Plugins_Page_Notice( $template_service->get_service(), $this->get_plugin_finder() );
2379
 
2380
  foreach ( $plugins as $plugin_id => $plugin ) {
2381
 
2400
 
2401
  foreach ( $product['plugins'] as $plugin_slug ) {
2402
 
2403
+ $plugin_finder = $this->get_plugin_finder();
2404
+ $plugin_found = $plugin_finder->get_plugin( $plugin_slug, $repository_id );
2405
+ $external_repo = $plugin_found->get_external_repo();
2406
+
2407
+ if ( $external_repo && $this->plugin_is_registered( $external_repo, $plugin_slug ) ) {
2408
+ continue;
2409
+ }
2410
+
2411
  $download = $this->settings['repositories'][ $repository_id ]['data']['downloads']['plugins'][ $plugin_slug ];
2412
  $display_subscription_notice = false;
2413
  $display_setting_notice = false;
 
2414
 
2415
  if ( $download['slug'] == $slug || $download['name'] == $name ) {
2416
  if ( in_array( $name, array( 'Toolset Types', 'WPML Multilingual CMS' ), true ) ) {
2420
  if ( ! $site_key || ! $this->plugin_is_registered( $repository_id, $download['slug'] ) ) {
2421
  $display_setting_notice = false;
2422
 
2423
+ if ( ! $this->should_fallback_under_wp_org_repo( $download, $site_key ) || $this->has_non_wporg_upgrade_available( $plugin_id ) ) {
2424
+ $display_subscription_notice = true;
2425
+ }
2426
+
2427
+ if ( $external_repo && ! $this->plugin_is_registered( $external_repo, $plugin_slug ) && ! $this->plugin_is_registered( $plugin_found->get_repo(), $plugin_slug ) ) {
2428
  $display_subscription_notice = true;
2429
  }
2430
+
2431
+ if ( 'Toolset Types' === $name && version_compare( $plugin['Version'], '3.0', '<' ) ) {
2432
+ $display_subscription_notice = false;
2433
+ }
2434
  }
2435
  }
2436
 
2721
  return false;
2722
  }
2723
 
2724
+ /**
2725
+ * @return OTGS_Installer_Plugin_Finder
2726
+ */
2727
+ private function get_plugin_finder() {
2728
+ if ( ! $this->plugin_finder ) {
2729
+ $this->plugin_finder = new OTGS_Installer_Plugin_Finder( new OTGS_Installer_Plugin_Factory(), $this->settings['repositories'] );
2730
+ }
2731
+
2732
+ return $this->plugin_finder;
2733
+ }
2734
+
2735
  public function plugin_upgrade_custom_errors() {
2736
 
2737
  if ( isset( $_REQUEST['action'] ) ) {
2782
  static $sub_cache = array();
2783
 
2784
  if ( empty( $sub_cache[ $plugin_repository ] ) ) {
2785
+ $subscription_data = false;
2786
+ $site_key = $this->get_repository_site_key( $plugin_repository );
2787
  if ( $site_key ) {
2788
+ try {
2789
+ $subscription_data = $this->fetch_subscription_data( $plugin_repository, $site_key, self::SITE_KEY_VALIDATION_SOURCE_REVALIDATION );
2790
+ } catch ( Exception $e ) {
2791
+ }
2792
  }
2793
 
2794
  $sub_cache[ $plugin_repository ]['site_key'] = $site_key;
2795
+ $sub_cache[ $plugin_repository ]['subscription_data'] = $subscription_data;
2796
  } else {
 
2797
  $site_key = $sub_cache[ $plugin_repository ]['site_key'];
2798
  $subscription_data = $sub_cache[ $plugin_repository ]['subscription_data'];
 
2799
  }
2800
 
2801
  if ( ! $site_key && ! empty( $free_on_wporg ) ) { // allow the download from wp.org
2864
  //validate subscription
2865
  $site_key = $this->get_repository_site_key( $plugin_repository );
2866
  if ( $site_key ) {
2867
+ try {
2868
+ $subscription_data = $this->fetch_subscription_data( $plugin_repository, $site_key, self::SITE_KEY_VALIDATION_SOURCE_REVALIDATION );
2869
+ } catch ( Exception $e ) {
2870
+ $subscription_data = false;
2871
+ }
2872
  }
2873
 
2874
+ $no_subscription = empty( $site_key ) || empty( $subscription_data );
2875
+ $not_on_wporg = empty( $free_on_wporg ) && ! $this->should_fallback_under_wp_org_repo( $download, $site_key );
2876
+
2877
+ if ( $no_subscription && $not_on_wporg ) {
2878
 
2879
  $error_message = sprintf( __( "%s cannot update because your site's registration is not valid. Please %sregister %s%s again for this site first.", 'installer' ),
2880
  '<strong>' . $plugin_name . '</strong>', '<a href="' . $this->menu_url() . '&validate_repository=' . $plugin_repository .
vendor/otgs/installer/includes/functions-core.php CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
-
3
  function WP_Installer(){
4
  return WP_Installer::instance();
5
  }
@@ -7,3 +6,13 @@ function WP_Installer(){
7
  function WP_Installer_Channels(){
8
  return WP_Installer_Channels::instance();
9
  }
 
 
 
 
 
 
 
 
 
 
1
  <?php
 
2
  function WP_Installer(){
3
  return WP_Installer::instance();
4
  }
6
  function WP_Installer_Channels(){
7
  return WP_Installer_Channels::instance();
8
  }
9
+
10
+ function get_OTGS_Installer_Factory() {
11
+ static $installer_factory;
12
+
13
+ if ( ! $installer_factory ) {
14
+ $installer_factory = new OTGS_Installer_Factory( WP_Installer() );
15
+ }
16
+
17
+ return $installer_factory;
18
+ }
vendor/otgs/installer/includes/functions-templates.php CHANGED
@@ -4,3 +4,13 @@
4
  function WP_Installer_Show_Products($args = array()){
5
  WP_Installer()->show_products($args);
6
  }
 
 
 
 
 
 
 
 
 
 
4
  function WP_Installer_Show_Products($args = array()){
5
  WP_Installer()->show_products($args);
6
  }
7
+
8
+ function WP_Installer_get_local_components_setting_ui( $args ) {
9
+ $installer_factory = get_OTGS_Installer_Factory();
10
+
11
+ ob_start();
12
+ $installer_factory->create_settings_hooks()
13
+ ->render_local_components_setting( $args );
14
+
15
+ return ob_get_clean();
16
+ }
vendor/otgs/installer/installer.php CHANGED
@@ -1,57 +1,65 @@
1
  <?php
2
- define( 'WP_INSTALLER_VERSION', '1.8.10' );
3
-
4
- include_once dirname( __FILE__ ) . '/includes/functions-core.php';
5
- include_once dirname( __FILE__ ) . '/includes/class-wp-installer.php';
6
-
7
- include_once WP_Installer()->plugin_path() . '/includes/class-wp-installer-api.php';
8
- include_once WP_Installer()->plugin_path() . '/includes/class-translation-service-info.php';
9
- include_once WP_Installer()->plugin_path() . '/includes/class-installer-dependencies.php';
10
- include_once WP_Installer()->plugin_path() . '/includes/class-wp-installer-channels.php';
11
-
12
- include_once WP_Installer()->plugin_path() . '/includes/class-otgs-installer-wp-components-sender.php';
13
- include_once WP_Installer()->plugin_path() . '/includes/class-otgs-installer-wp-components-storage.php';
14
- include_once WP_Installer()->plugin_path() . '/includes/class-otgs-installer-wp-components-hooks.php';
15
- include_once WP_Installer()->plugin_path() . '/includes/class-otgs-installer-wp-share-local-components-setting.php';
16
-
17
- include_once WP_Installer()->plugin_path() . '/templates/template-service/interface-iotgs-installer-template-service.php';
18
- include_once WP_Installer()->plugin_path() . '/templates/template-service/class-otgs-installer-twig-template-service.php';
19
- include_once WP_Installer()->plugin_path() . '/templates/template-service/class-otgs-installer-twig-template-service-loader.php';
20
- include_once WP_Installer()->plugin_path() . '/includes/class-otgs-installer-wp-components-setting-templates.php';
21
- include_once WP_Installer()->plugin_path() . '/includes/class-otgs-installer-wp-components-setting-resources.php';
22
- include_once WP_Installer()->plugin_path() . '/includes/class-otgs-installer-plugins-page-notice.php';
23
- include_once WP_Installer()->plugin_path() . '/includes/class-otgs-installer-wp-components-setting-ajax.php';
24
- include_once WP_Installer()->plugin_path() . '/includes/class-otgs-installer-filename-hooks.php';
25
- include_once WP_Installer()->plugin_path() . '/includes/class-otgs-installer-php-functions.php';
26
- include_once WP_Installer()->plugin_path() . '/includes/class-otgs-installer-icons.php';
27
-
28
- include_once WP_Installer()->plugin_path() . '/includes/functions-templates.php';
29
 
30
- // Initialization
31
- WP_Installer();
32
- WP_Installer_Channels();
 
 
 
 
 
 
 
 
 
 
33
 
34
- $local_components_resources = new OTGS_Installer_WP_Components_Setting_Resources( WP_Installer() );
35
- $local_components_resources->add_hooks();
 
 
36
 
37
- $local_components_setting = new OTGS_Installer_WP_Share_Local_Components_Setting();
38
- $local_components_sender = new OTGS_Installer_WP_Components_Sender(
39
- WP_Installer(),
40
- $local_components_setting
41
- );
42
 
43
- $local_components_storage = new OTGS_Installer_WP_Components_Storage();
44
- $local_components_hooks = new OTGS_Installer_WP_Components_Hooks( $local_components_storage, $local_components_sender, $local_components_setting );
45
- $local_components_hooks->add_hooks();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
- $local_components_ajax_setting = new OTGS_Installer_WP_Components_Setting_Ajax(
48
- $local_components_setting,
49
- WP_Installer()
50
- );
51
- $local_components_ajax_setting->add_hooks();
52
 
53
- $filename_hooks = new OTGS_Installer_Filename_Hooks( new OTGS_Installer_PHP_Functions() );
54
- $filename_hooks->add_hooks();
 
 
 
 
 
 
 
 
 
 
55
 
56
- $icons = new OTGS_Installer_Icons( WP_Installer() );
57
- $icons->add_hooks();
1
  <?php
2
+ // included from \wpml_installer_instance_delegator
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
+ include_once untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/includes/class-otgs-installer-wp-share-local-components-setting.php';
5
+
6
+ if ( version_compare( $delegate['version'], '1.8.12', '>=' ) ) {
7
+ define( 'WP_INSTALLER_VERSION', $delegate['version'] );
8
+ }
9
+
10
+ $plugin_path = dirname( __FILE__ );
11
+
12
+ include_once $plugin_path . '/includes/functions-core.php';
13
+ include_once $plugin_path . '/includes/class-otgs-installer-subscription.php';
14
+ include_once $plugin_path . '/includes/class-wp-installer.php';
15
+
16
+ $installer_plugin_path = WP_Installer()->plugin_path();
17
 
18
+ include_once $installer_plugin_path . '/includes/class-wp-installer-api.php';
19
+ include_once $installer_plugin_path . '/includes/class-translation-service-info.php';
20
+ include_once $installer_plugin_path . '/includes/class-installer-dependencies.php';
21
+ include_once $installer_plugin_path . '/includes/class-wp-installer-channels.php';
22
 
23
+ include_once $installer_plugin_path . '/includes/class-otgs-installer-php-functions.php';
 
 
 
 
24
 
25
+ include_once $installer_plugin_path . '/includes/class-otgs-installer-wp-components-sender.php';
26
+ include_once $installer_plugin_path . '/includes/class-otgs-installer-wp-components-storage.php';
27
+ include_once $installer_plugin_path . '/includes/class-otgs-installer-wp-components-hooks.php';
28
+
29
+ include_once $installer_plugin_path . '/templates/template-service/interface-iotgs-installer-template-service.php';
30
+ include_once $installer_plugin_path . '/templates/template-service/class-otgs-installer-twig-template-service.php';
31
+ include_once $installer_plugin_path . '/templates/template-service/class-otgs-installer-twig-template-service-loader.php';
32
+
33
+ include_once $installer_plugin_path . '/includes/class-otgs-installer-wp-components-setting-resources.php';
34
+ include_once $installer_plugin_path . '/includes/class-otgs-installer-plugins-page-notice.php';
35
+ include_once $installer_plugin_path . '/includes/class-otgs-installer-wp-components-setting-ajax.php';
36
+ include_once $installer_plugin_path . '/includes/class-otgs-installer-filename-hooks.php';
37
+ include_once $installer_plugin_path . '/includes/class-otgs-installer-icons.php';
38
+ include_once $installer_plugin_path . '/includes/class-otgs-installer-wp-share-local-components-setting-hooks.php';
39
+ include_once $installer_plugin_path . '/includes/class-otgs-installer-factory.php';
40
+ include_once $installer_plugin_path . '/includes/class-otgs-installer-plugin.php';
41
+ include_once $installer_plugin_path . '/includes/class-otgs-installer-plugin-factory.php';
42
+ include_once $installer_plugin_path . '/includes/class-otgs-installer-plugin-finder.php';
43
+
44
+ include_once $installer_plugin_path . '/includes/functions-templates.php';
45
+ include_once $installer_plugin_path . '/includes/class-otgs-twig-autoloader.php';
46
+
47
+ // Initialization
48
+ WP_Installer();
49
+ WP_Installer_Channels();
50
 
51
+ $installer_factory = get_OTGS_Installer_Factory();
 
 
 
 
52
 
53
+ $installer_factory->create_resources()
54
+ ->add_hooks();
55
+ $installer_factory->create_settings_hooks()
56
+ ->add_hooks();
57
+ $installer_factory->create_wp_components_hooks()
58
+ ->add_hooks();
59
+ $installer_factory->create_local_components_ajax_setting()
60
+ ->add_hooks();
61
+ $installer_factory->create_filename_hooks()
62
+ ->add_hooks();
63
+ $installer_factory->create_icons()
64
+ ->add_hooks();
65
 
 
 
vendor/otgs/installer/loader.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  if ( ! defined( 'ABSPATH' ) ) {
4
- exit; // Exit if accessed directly
5
  }
6
 
7
  //It should only be loaded on the admin side
@@ -15,140 +15,141 @@ if ( ! ( defined( 'DOING_CRON' ) && DOING_CRON ) && ! is_admin() ) {
15
  return;
16
  }
17
 
18
- $wp_installer_instance = dirname(__FILE__) . '/installer.php';
19
 
20
 
21
  // Global stack of instances
22
  global $wp_installer_instances;
23
- $wp_installer_instances[$wp_installer_instance] = array(
24
- 'bootfile' => $wp_installer_instance,
25
- 'version' => '1.8.10'
26
  );
27
 
28
 
29
  /* EXCEPTIONS ********************************************************************************************/
30
  // Exception: When WPML prior 3.2 is used, that instance must be used regardless of another newer instance
31
  // Case 1: WPML loaded before Types - eliminate other instances
32
- if( defined('ICL_SITEPRESS_VERSION') && version_compare(ICL_SITEPRESS_VERSION, '3.2', '<') ) {
33
- foreach($wp_installer_instances as $key => $instance) {
34
- if(isset($instance['args']['site_key_nags'])){
35
- $wp_installer_instances[$key]['version'] = '9.9';
36
- }else{
37
- $wp_installer_instances[$key]['version'] = '0';
38
- }
39
- }
40
  }
41
 
42
  // Exception: Types 1.8.9 (Installer 1.7.0) with WPML before 3.3 (Installer before 1.7.0)
43
  // New products file http://d2salfytceyqoe.cloudfront.net/wpml-products33.json overrides the old one
44
  // while the WPML's instance is being used
45
  // => Force using the new Installer Instance
46
- if( defined('ICL_SITEPRESS_VERSION') && version_compare(ICL_SITEPRESS_VERSION, '3.3.1', '<') ) {
47
-
48
- // if Installer 1.7.0+ is present, unregister Installer from old WPML
49
- // Force Installer 1.7.0+ being used over older Installer versions
50
- $installer_171_plus_on = false;
51
- foreach($wp_installer_instances as $key => $instance) {
52
- if( version_compare( $instance['version'], '1.7.1', '>=' ) ){
53
- $installer_171_plus_on = true;
54
- break;
55
- }
56
- }
57
 
58
- if( $installer_171_plus_on ){
59
- foreach($wp_installer_instances as $key => $instance) {
60
 
61
- if( version_compare( $instance['version'], '1.7.0', '<' ) ){
62
- unset( $wp_installer_instances[$key] );
63
- }
64
 
65
- }
66
- }
67
 
68
  }
69
 
70
  // Exception: When using the embedded plugins module allow the set up to run completely with the
71
  // Installer instance that triggers it
72
- if( isset( $_POST['installer_instance'] ) && isset( $wp_installer_instances[$_POST['installer_instance']] ) ){
73
- $wp_installer_instances[$_POST['installer_instance']]['version'] = '999';
74
  }
75
  /* EXCEPTIONS ********************************************************************************************/
76
 
77
 
78
  // Only one of these in the end
79
- remove_action('after_setup_theme', 'wpml_installer_instance_delegator', 1);
80
- add_action('after_setup_theme', 'wpml_installer_instance_delegator', 1);
81
 
82
  // When all plugins load pick the newest version
83
- if(!function_exists('wpml_installer_instance_delegator')){
84
- function wpml_installer_instance_delegator(){
85
- global $wp_installer_instances;
86
-
87
- // version based election
88
- foreach($wp_installer_instances as $instance){
89
-
90
- if(!isset($delegate)){
91
- $delegate = $instance;
92
- continue;
93
- }
94
-
95
- if(version_compare($instance['version'], $delegate['version'], '>')){
96
- $delegate = $instance;
97
- }
98
- }
99
-
100
- // priority based election
101
- $highest_priority = null;
102
- foreach($wp_installer_instances as $instance) {
103
- if(isset($instance['args']['high_priority'])){
104
- if(is_null($highest_priority) || $instance['args']['high_priority'] <= $highest_priority){
105
- $highest_priority = $instance['args']['high_priority'];
106
- $delegate = $instance;
107
- }
108
- }
109
- }
110
-
111
- // Exception: When WPML prior 3.2 is used, that instance must be used regardless of another newer instance
112
- // Case 2: WPML loaded after Types
113
- if( defined('ICL_SITEPRESS_VERSION') && version_compare(ICL_SITEPRESS_VERSION, '3.2', '<') ) {
114
- foreach($wp_installer_instances as $key => $instance) {
115
- if(isset($instance['args']['site_key_nags'])){
116
- $delegate = $instance;
117
- $wp_installer_instances = array($key => $delegate); //Eliminate other instances
118
- break;
119
- }
120
- }
121
- }
122
-
123
- include_once $delegate['bootfile'];
124
-
125
- // set configuration
126
- if(strpos(realpath($delegate['bootfile']), realpath(TEMPLATEPATH)) === 0){
127
- $delegate['args']['in_theme_folder'] = dirname(ltrim(str_replace(realpath(TEMPLATEPATH), '', realpath($delegate['bootfile'])), '\\/'));
128
- }
129
- if(isset($delegate['args']) && is_array($delegate['args'])){
130
- foreach($delegate['args'] as $key => $value){
131
- WP_Installer()->set_config($key, $value);
132
- }
133
- }
134
-
135
- }
136
- }
137
-
138
- if(!function_exists('WP_Installer_Setup')){
139
-
140
- // $args:
141
- // plugins_install_tab = true|false (default: true)
142
- // repositories_include = array() (default: all)
143
- // repositories_exclude = array() (default: none)
144
- // template = name (default: default)
145
- //
146
- // Ext function
147
- function WP_Installer_Setup($wp_installer_instance, $args = array()){
148
- global $wp_installer_instances;
149
-
150
- $wp_installer_instances[$wp_installer_instance]['args'] = $args;
151
-
152
- }
153
-
 
154
  }
1
  <?php
2
 
3
  if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // Exit if accessed directly
5
  }
6
 
7
  //It should only be loaded on the admin side
15
  return;
16
  }
17
 
18
+ $wp_installer_instance = dirname( __FILE__ ) . '/installer.php';
19
 
20
 
21
  // Global stack of instances
22
  global $wp_installer_instances;
23
+ $wp_installer_instances[ $wp_installer_instance ] = array(
24
+ 'bootfile' => $wp_installer_instance,
25
+ 'version' => '1.8.25'
26
  );
27
 
28
 
29
  /* EXCEPTIONS ********************************************************************************************/
30
  // Exception: When WPML prior 3.2 is used, that instance must be used regardless of another newer instance
31
  // Case 1: WPML loaded before Types - eliminate other instances
32
+ if ( defined( 'ICL_SITEPRESS_VERSION' ) && version_compare( ICL_SITEPRESS_VERSION, '3.2', '<' ) ) {
33
+ foreach ( $wp_installer_instances as $key => $instance ) {
34
+ if ( isset( $instance['args']['site_key_nags'] ) ) {
35
+ $wp_installer_instances[ $key ]['version'] = '9.9';
36
+ } else {
37
+ $wp_installer_instances[ $key ]['version'] = '0';
38
+ }
39
+ }
40
  }
41
 
42
  // Exception: Types 1.8.9 (Installer 1.7.0) with WPML before 3.3 (Installer before 1.7.0)
43
  // New products file http://d2salfytceyqoe.cloudfront.net/wpml-products33.json overrides the old one
44
  // while the WPML's instance is being used
45
  // => Force using the new Installer Instance
46
+ if ( defined( 'ICL_SITEPRESS_VERSION' ) && version_compare( ICL_SITEPRESS_VERSION, '3.3.1', '<' ) ) {
47
+
48
+ // if Installer 1.7.0+ is present, unregister Installer from old WPML
49
+ // Force Installer 1.7.0+ being used over older Installer versions
50
+ $installer_171_plus_on = false;
51
+ foreach ( $wp_installer_instances as $key => $instance ) {
52
+ if ( version_compare( $instance['version'], '1.7.1', '>=' ) ) {
53
+ $installer_171_plus_on = true;
54
+ break;
55
+ }
56
+ }
57
 
58
+ if ( $installer_171_plus_on ) {
59
+ foreach ( $wp_installer_instances as $key => $instance ) {
60
 
61
+ if ( version_compare( $instance['version'], '1.7.0', '<' ) ) {
62
+ unset( $wp_installer_instances[ $key ] );
63
+ }
64
 
65
+ }
66
+ }
67
 
68
  }
69
 
70
  // Exception: When using the embedded plugins module allow the set up to run completely with the
71
  // Installer instance that triggers it
72
+ if ( isset( $_POST['installer_instance'] ) && isset( $wp_installer_instances[ $_POST['installer_instance'] ] ) ) {
73
+ $wp_installer_instances[ $_POST['installer_instance'] ]['version'] = '999';
74
  }
75
  /* EXCEPTIONS ********************************************************************************************/
76
 
77
 
78
  // Only one of these in the end
79
+ remove_action( 'after_setup_theme', 'wpml_installer_instance_delegator', 1 );
80
+ add_action( 'after_setup_theme', 'wpml_installer_instance_delegator', 1 );
81
 
82
  // When all plugins load pick the newest version
83
+ if ( ! function_exists( 'wpml_installer_instance_delegator' ) ) {
84
+ function wpml_installer_instance_delegator() {
85
+ global $wp_installer_instances;
86
+
87
+ // version based election
88
+ foreach ( $wp_installer_instances as $instance ) {
89
+
90
+ if ( ! isset( $delegate ) ) {
91
+ $delegate = $instance;
92
+ continue;
93
+ }
94
+
95
+ if ( version_compare( $instance['version'], $delegate['version'], '>' ) ) {
96
+ $delegate = $instance;
97
+ }
98
+ }
99
+
100
+ // priority based election
101
+ $highest_priority = null;
102
+ foreach ( $wp_installer_instances as $instance ) {
103
+ if ( isset( $instance['args']['high_priority'] ) ) {
104
+ if ( is_null( $highest_priority ) || $instance['args']['high_priority'] <= $highest_priority ) {
105
+ $highest_priority = $instance['args']['high_priority'];
106
+ $delegate = $instance;
107
+ }
108
+ }
109
+ }
110
+
111
+ // Exception: When WPML prior 3.2 is used, that instance must be used regardless of another newer instance
112
+ // Case 2: WPML loaded after Types
113
+ if ( defined( 'ICL_SITEPRESS_VERSION' ) && version_compare( ICL_SITEPRESS_VERSION, '3.2', '<' ) ) {
114
+ foreach ( $wp_installer_instances as $key => $instance ) {
115
+ if ( isset( $instance['args']['site_key_nags'] ) ) {
116
+ $delegate = $instance;
117
+ $wp_installer_instances = array( $key => $delegate ); //Eliminate other instances
118
+ break;
119
+ }
120
+ }
121
+ }
122
+
123
+ include_once $delegate['bootfile'];
124
+
125
+ // set configuration
126
+ if ( strpos( realpath( $delegate['bootfile'] ), realpath( TEMPLATEPATH ) ) === 0 ) {
127
+ $delegate['args']['in_theme_folder'] = dirname( ltrim( str_replace( realpath( TEMPLATEPATH ), '', realpath( $delegate['bootfile'] ) ), '\\/' ) );
128
+ }
129
+ if ( isset( $delegate['args'] ) && is_array( $delegate['args'] ) ) {
130
+ foreach ( $delegate['args'] as $key => $value ) {
131
+ WP_Installer()->set_config( $key, $value );
132
+ }
133
+ }
134
+
135
+ }
136
+ }
137
+
138
+ if ( ! function_exists( 'WP_Installer_Setup' ) ) {
139
+
140
+ // $args:
141
+ // plugins_install_tab = true|false (default: true)
142
+ // repositories_include = array() (default: all)
143
+ // repositories_exclude = array() (default: none)
144
+ // template = name (default: default)
145
+ //
146
+ // Ext function
147
+ function WP_Installer_Setup( $wp_installer_instance, $args = array() ) {
148
+ global $wp_installer_instances;
149
+
150
+ if ( $wp_installer_instance ) {
151
+ $wp_installer_instances[ $wp_installer_instance ]['args'] = $args;
152
+ }
153
+ }
154
+
155
  }
vendor/otgs/installer/locale/installer-ar.mo CHANGED
Binary file
vendor/otgs/installer/locale/installer-de_DE.mo CHANGED
Binary file
vendor/otgs/installer/locale/installer-el.mo CHANGED
Binary file
vendor/otgs/installer/locale/installer-es_ES.mo CHANGED
Binary file
vendor/otgs/installer/locale/installer-fr_FR.mo CHANGED
Binary file
vendor/otgs/installer/locale/installer-he_IL.mo CHANGED
Binary file
vendor/otgs/installer/locale/installer-it_IT.mo CHANGED
Binary file
vendor/otgs/installer/locale/installer-ja.mo CHANGED
Binary file
vendor/otgs/installer/locale/installer-ko_KR.mo CHANGED
Binary file
vendor/otgs/installer/locale/installer-nl_NL.mo CHANGED
Binary file
vendor/otgs/installer/locale/installer-pl_PL.mo CHANGED
Binary file
vendor/otgs/installer/locale/installer-pt_BR.mo CHANGED
Binary file
vendor/otgs/installer/locale/installer-pt_PT.mo CHANGED
Binary file
vendor/otgs/installer/locale/installer-ru_RU.mo CHANGED
Binary file
vendor/otgs/installer/locale/installer-sv_SE.mo CHANGED
Binary file
vendor/otgs/installer/locale/installer-uk_UA.mo CHANGED
Binary file
vendor/otgs/installer/locale/installer-vi.mo CHANGED
Binary file
vendor/otgs/installer/locale/installer-zh_CN.mo CHANGED
Binary file
vendor/otgs/installer/locale/installer-zh_TW.mo CHANGED
Binary file
vendor/otgs/installer/repositories.xml CHANGED
@@ -7,7 +7,7 @@
7
  </repository>
8
  <repository>
9
  <id>toolset</id>
10
- <apiurl>https://api.wp-types.com/</apiurl>
11
  <products>http://d7j863fr5jhrr.cloudfront.net/toolset33-products.json</products>
12
  </repository>
13
  </repositories>
7
  </repository>
8
  <repository>
9
  <id>toolset</id>
10
+ <apiurl>https://api.toolset.com/</apiurl>
11
  <products>http://d7j863fr5jhrr.cloudfront.net/toolset33-products.json</products>
12
  </repository>
13
  </repositories>
vendor/otgs/installer/res/css/admin.css CHANGED
@@ -336,4 +336,11 @@
336
  -moz-margin-start: 25px;
337
  margin-start: 25px;
338
  }
 
 
 
 
 
 
 
339
  }
336
  -moz-margin-start: 25px;
337
  margin-start: 25px;
338
  }
339
+ }
340
+
341
+ .otgs-installer-component-setting .spinner.otgs-components-report-setting-spinner {
342
+ float: right;
343
+ }
344
+ .otgs-installer-component-privacy-policy {
345
+ margin-top: 30px;
346
  }
vendor/otgs/installer/res/js/save-components-setting.js CHANGED
@@ -1,21 +1,29 @@
1
  jQuery(document).ready(function () {
2
- jQuery( '.js-otgs-components-report-user-choice' ).click(function () {
3
- var spinner = jQuery(this).parent().prev();
 
4
 
5
  spinner.addClass('is-active');
6
 
 
 
 
 
 
 
 
7
  jQuery.ajax({
8
- url: ajaxurl,
9
- type: 'POST',
10
- data: {
11
- action: jQuery(this).data('nonce-action'),
12
- nonce: jQuery(this).data('nonce-value'),
13
- agree: jQuery(this).is(':checked') ? 1 : 0,
14
- repo: jQuery(this).data('repo')
15
- },
16
- success: function () {
17
- spinner.removeClass('is-active');
18
- }
19
- });
20
  });
21
  });
1
  jQuery(document).ready(function () {
2
+ var container = jQuery('.otgs-installer-component-setting');
3
+ container.find('.js-otgs-components-report-user-choice').click(function () {
4
+ var spinner = container.find('.spinner');
5
 
6
  spinner.addClass('is-active');
7
 
8
+ var element = jQuery(this);
9
+
10
+ var agree = element.is(':checked') ? 1 : 0;
11
+ if (element.is(':radio')) {
12
+ agree = element.val();
13
+ }
14
+
15
  jQuery.ajax({
16
+ url: ajaxurl,
17
+ type: 'POST',
18
+ data: {
19
+ action: element.data('nonce-action'),
20
+ nonce: element.data('nonce-value'),
21
+ agree: agree,
22
+ repo: element.data('repo'),
23
+ },
24
+ success: function () {
25
+ spinner.removeClass('is-active');
26
+ },
27
+ });
28
  });
29
  });
vendor/otgs/installer/src/js/ui/Switcher.js ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class Switcher {
2
+ constructor (element) {
3
+ const checkBoxContainer = element.parentElement;
4
+ const heading = checkBoxContainer.getElementsByClassName('heading');
5
+ const label = checkBoxContainer.getElementsByTagName('label').item(0);
6
+
7
+ if (label) {
8
+ label.classList.add('otgs-on-off-switch');
9
+ }
10
+
11
+ const toggleGroup = document.createElement('label');
12
+ toggleGroup.classList.add('otgs-toggle-group');
13
+ toggleGroup.appendChild(element);
14
+ toggleGroup.appendChild(label);
15
+
16
+ const switcherContainer = document.createElement('span');
17
+ switcherContainer.classList.add('otgs-switch__onoff');
18
+ const switcherBorder = document.createElement('span');
19
+ switcherBorder.classList.add('otgs-switch__onoff-label');
20
+ const switcherInner = document.createElement('span');
21
+ switcherInner.classList.add('otgs-switch__onoff-inner');
22
+ const switcherSwitch = document.createElement('span');
23
+ switcherSwitch.classList.add('otgs-switch__onoff-switch');
24
+
25
+ switcherBorder.appendChild(switcherInner);
26
+ switcherBorder.appendChild(switcherSwitch);
27
+
28
+ switcherContainer.appendChild(switcherBorder);
29
+
30
+ toggleGroup.appendChild(switcherContainer);
31
+
32
+ checkBoxContainer.appendChild(toggleGroup);
33
+
34
+ if (heading.length) {
35
+ heading.item(heading.length - 1).parentNode
36
+ .insertBefore(toggleGroup, heading.item(heading.length - 1).nextSibling);
37
+ } else {
38
+ checkBoxContainer.insertBefore(toggleGroup, checkBoxContainer.firstChild);
39
+ }
40
+ }
41
+
42
+ }
43
+
44
+ export default Switcher;
vendor/otgs/installer/src/js/ui/UI.js ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import '../../scss/ui/styles.scss';
2
+ import Switcher from './Switcher';
3
+
4
+ class UI {
5
+ constructor (element) {
6
+ const checkBoxes = element.querySelectorAll('input[type="checkbox"]');
7
+
8
+ if(checkBoxes) {
9
+ Array.from(checkBoxes).map(checkBox => new Switcher(checkBox));
10
+ }
11
+ }
12
+ }
13
+
14
+ export default UI;
vendor/otgs/installer/src/js/ui/app.js ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ import 'babel-polyfill';
2
+ import UI from './UI';
3
+
4
+ window.addEventListener('DOMContentLoaded', () => {
5
+
6
+ const otgsUIElements = document.querySelectorAll('.otgs-ui');
7
+
8
+ if (otgsUIElements) {
9
+ Array.from(otgsUIElements).map(otgsUI => new UI(otgsUI));
10
+ }
11
+ });
vendor/otgs/installer/src/package.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "wpml-core",
3
+ "license": "MIT",
4
+ "scripts": {
5
+ "build:dev": "webpack --mode development",
6
+ "build:prod": "webpack -p --env production --mode production",
7
+ "test": "jest"
8
+ },
9
+ "jest": {
10
+ "automock": false,
11
+ "setupFiles": [
12
+ "raf/polyfill",
13
+ "<rootDir>/tests/setupTests.js"
14
+ ]
15
+ },
16
+ "dependencies": {
17
+ "classnames": "~2.2.0",
18
+ "cross-fetch": "~1.1.0",
19
+ "moment": "~2.20.0",
20
+ "numeral": "~2.0.0",
21
+ "query-string": "~5.1.0",
22
+ "sprintf-js": "~1.1.0",
23
+ "tippy.js": "~2.2.0"
24
+ },
25
+ "devDependencies": {
26
+ "autoprefixer": "~8.3.0",
27
+ "babel-cli": "~6.26.0",
28
+ "babel-core": "~6.26.0",
29
+ "babel-jest": "~22.4.0",
30
+ "babel-loader": "~7.1.0",
31
+ "babel-plugin-transform-class-properties": "~6.24.0",
32
+ "babel-plugin-transform-object-rest-spread": "~6.26.0",
33
+ "babel-preset-env": "~1.6.0",
34
+ "css-loader": "~0.28.0",
35
+ "enzyme": "~3.3.0",
36
+ "enzyme-to-json": "~3.3.0",
37
+ "eslint": "~4.19.0",
38
+ "eslint-config-standard": "~11.0.0",
39
+ "eslint-plugin-import": "~2.11.0",
40
+ "eslint-plugin-node": "~6.0.0",
41
+ "eslint-plugin-promise": "~3.7.0",
42
+ "eslint-plugin-standard": "~3.0.0",
43
+ "extract-text-webpack-plugin": "~4.0.0-beta.0",
44
+ "jest": "~22.4.0",
45
+ "jest-fetch-mock": "~1.5.0",
46
+ "node-sass": "~4.8.0",
47
+ "postcss": "~6.0.0",
48
+ "postcss-loader": "~2.1.0",
49
+ "raf": "~3.4.0",
50
+ "sass-loader": "~7.0.0",
51
+ "style-loader": "~0.20.0",
52
+ "webpack": "~4.5.0",
53
+ "webpack-cli": "~2.0.0"
54
+ }
55
+ }
vendor/otgs/installer/src/postcss.config.js ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ module.exports = {
2
+ plugins: [
3
+ require('autoprefixer'),
4
+ ]
5
+ }
vendor/otgs/installer/src/scss/ui/styles.scss ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // COLORS
2
+ $white: #fff;
3
+ $darkgray: #3D3D3D;
4
+ $base-gray: #45555F;
5
+ $gray-saturate-85: saturate($base-gray, 85%);
6
+ $otgs-blue: #21759b;
7
+
8
+ // TRANSITION SPEEDS
9
+ $transition-fast: 0.15s;
10
+
11
+ // ON OFF SWITCH
12
+ $switch-height: 18px;
13
+ $switch-width: 55px;
14
+ $switch-group-height: $switch-height + 4;
15
+ $toggle-group-height: $switch-height + 5;
16
+
17
+ .otgs-installer-component-setting {
18
+ margin: 1em 0;
19
+ h4 {
20
+ margin: 0;
21
+ }
22
+ .otgs-settings-container & {
23
+ .spinner {
24
+ position: absolute;
25
+ margin: 5px 0 0;
26
+ }
27
+ }
28
+ }
29
+
30
+ .otgs-on-off-switch + .otgs-switch__onoff,
31
+ .otgs-switch__onoff + .otgs-on-off-switch {
32
+ margin-inline-start: 7px;
33
+ }
34
+
35
+ /* ON/OFF Switch */
36
+ .otgs-switch__onoff {
37
+ position: relative;
38
+ width: $switch-width;
39
+ display: inline-block;
40
+ vertical-align: middle;
41
+ flex: 0 0 $switch-width;
42
+
43
+ &.otgs-pull-right {
44
+ right: 0;
45
+ }
46
+
47
+ .otgs-switch__onoff-label {
48
+ display: block;
49
+ overflow: hidden;
50
+ cursor: pointer;
51
+ border: 1px solid darken($white, 10%);
52
+ border-radius: $switch-height - 2;
53
+ margin: 0;
54
+ }
55
+
56
+ .otgs-switch__onoff-inner {
57
+ width: 200%;
58
+ margin-left: -100%;
59
+ transition: margin $transition-fast ease-in-out;
60
+
61
+ &:before,
62
+ &:after {
63
+ float: left;
64
+ width: 50%;
65
+ height: $switch-group-height;
66
+ padding: 0;
67
+ line-height: $switch-group-height;
68
+ font-size: 11px;
69
+ box-sizing: border-box;
70
+ }
71
+
72
+ &:before {
73
+ content: "ON";
74
+ padding-left: 10px;
75
+ background-color: $otgs-blue;
76
+ color: $white;
77
+ }
78
+
79
+ &:after {
80
+ content: "OFF";
81
+ padding-right: 8px;
82
+ background-color: darken($white, 2%);
83
+ color: $darkgray;
84
+ text-align: right;
85
+ }
86
+ }
87
+
88
+ .otgs-switch__onoff-switch {
89
+ width: $switch-height;
90
+ height: $switch-height;
91
+ margin: 0;
92
+ background: $white;
93
+ box-shadow: 0 0 3px rgba(0, 0, 0, .3);
94
+ border-radius: 50%;
95
+ position: absolute;
96
+ top: 3px;
97
+ bottom: 0;
98
+ right: $switch-height + 16;
99
+ transition: right $transition-fast ease-in-out;
100
+ }
101
+ }
102
+
103
+ .otgs-toggle-group {
104
+ position: relative;
105
+ display: flex;
106
+ align-items: center;
107
+
108
+ .otgs-switch__onoff-inner {
109
+ display: block;
110
+ }
111
+
112
+ input[type=checkbox] {
113
+ display: none;
114
+
115
+ &:checked ~ .otgs-switch__onoff .otgs-switch__onoff-label .otgs-switch__onoff-inner {
116
+ margin-left: 0;
117
+ }
118
+
119
+ &:checked ~ .otgs-switch__onoff .otgs-switch__onoff-label .otgs-switch__onoff-switch {
120
+ right: 3px;
121
+ box-shadow: 0 0 3px rgba(0, 0, 0, .5);
122
+ }
123
+
124
+ &:focus ~ .otgs-switch__onoff {
125
+ outline: thin dotted #333;
126
+ }
127
+ }
128
+
129
+ .otgs-on-off-switch {
130
+ cursor: pointer;
131
+ display: inline-block;
132
+ }
133
+ }
134
+
135
+ .otgs-external-link:after {
136
+ font-family: dashicons !important;
137
+ content: "\00a0\f504";
138
+ vertical-align: baseline;
139
+ line-height: 1;
140
+ display: inline-block;
141
+ }
vendor/otgs/installer/src/webpack.config.js ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const path = require('path');
2
+ const ExtractTextPlugin = require('extract-text-webpack-plugin');
3
+
4
+ const webPackModule = {
5
+ rules: [
6
+ {
7
+ loader: 'babel-loader',
8
+ test: /\.js$/,
9
+ exclude: /node_modules/,
10
+ query: {
11
+ presets: ['es2015'],
12
+ },
13
+ }, {
14
+ test: /\.s?css$/,
15
+ use: ExtractTextPlugin.extract({
16
+ fallback: 'style-loader',
17
+ use: [
18
+ {
19
+ loader: 'css-loader',
20
+ options: {
21
+ sourceMap: true,
22
+ },
23
+ }, {
24
+ loader: 'sass-loader',
25
+ options: {
26
+ sourceMap: true,
27
+ },
28
+ }, {
29
+ loader: 'postcss-loader',
30
+ },
31
+ ],
32
+ }),
33
+ },
34
+ ],
35
+ };
36
+
37
+ const ui = (env) => {
38
+ const isProduction = env === 'production';
39
+
40
+ return {
41
+ entry: ['whatwg-fetch', './js/ui/app.js'],
42
+ output: {
43
+ path: path.join(__dirname, '..', 'dist'),
44
+ filename: path.join('js', 'ui', 'app.js'),
45
+ },
46
+ module: webPackModule,
47
+ plugins: [
48
+ new ExtractTextPlugin(path.join('css', 'ui', 'styles.css')),
49
+ ],
50
+ devtool: isProduction ? '' : 'inline-source-map',
51
+ };
52
+ };
53
+
54
+ module.exports = [
55
+ ui,
56
+ ];
vendor/otgs/installer/templates/channel-selector.php CHANGED
@@ -48,11 +48,11 @@
48
  <button class="button-primary js-proceed"><?php _e("Switch", 'installer') ?></button>
49
  </p>
50
  <p>
51
- <?php _e("Plugins will be updated to their most advanced version in the channel that you selected.", 'installer') ?>
52
  </p>
53
  <label>
54
  <input type="checkbox" value="1" class="js-remember"/>
55
- &nbsp;<?php _e("Remember my preference.", 'installer') ?><br />
56
  </label>
57
  </div>
58
  <?php endif; ?>
48
  <button class="button-primary js-proceed"><?php _e("Switch", 'installer') ?></button>
49
  </p>
50
  <p>
51
+ <?php _e( 'The plugins will update to the most recent version in the channel that you selected.', 'installer') ?>
52
  </p>
53
  <label>
54
  <input type="checkbox" value="1" class="js-remember"/>
55
+ &nbsp;<?php _e( 'Remember my preference.', 'installer') ?><br />
56
  </label>
57
  </div>
58
  <?php endif; ?>
vendor/otgs/installer/templates/components-setting/commercial-tab.twig CHANGED
@@ -3,5 +3,5 @@
3
  <a class="js-otgs-installer-tooltip-open otgs-ico-help">
4
  {{ strings.tooltip }}
5
  </a>
6
- <small>{{ strings.stop_sending }}</small>
7
  </p>
3
  <a class="js-otgs-installer-tooltip-open otgs-ico-help">
4
  {{ strings.tooltip }}
5
  </a>
6
+ <small>{{ strings.stop_sending|raw }}</small>
7
  </p>
vendor/otgs/installer/templates/components-setting/plugins-page.twig CHANGED
@@ -1,24 +1,9 @@
1
- {% if should_display_subscription_notice or should_display_setting_notice %}
2
- <tr class="{{ css.tr_classes }}">
3
- <td colspan="{{ col_count }}" class="plugin-update colspanchange">
4
- <div class="{{ css.notice_classes }}">
5
-
6
- {% if should_display_subscription_notice %}
7
-
8
- <p class="installer-q-icon">
9
- {{ strings.valid_subscription|raw }}
10
- </p>
11
-
12
- {% endif %}
13
-
14
- {% if should_display_setting_notice %}
15
- <div class="spinner otgs-components-report-setting-spinner"></div>
16
- <p>
17
- <input type="checkbox" {{ repo_checked }} class="js-otgs-components-report-user-choice" value="1" data-nonce-action="{{ nonce.action }}" data-nonce-value="{{ nonce.value }}" data-repo="{{ repo }}" />
18
- {{ strings.send_report|raw }}
19
- </p>
20
- {% endif %}
21
- </div>
22
- </td>
23
- </tr>
24
- {% endif %}
1
+ <tr class="{{ css.tr_classes }}">
2
+ <td colspan="{{ col_count }}" class="plugin-update colspanchange">
3
+ <div class="{{ css.notice_classes }}">
4
+ <p class="installer-q-icon">
5
+ {{ strings.valid_subscription|raw }}
6
+ </p>
7
+ </div>
8
+ </td>
9
+ </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/otgs/installer/templates/components-setting/share-local-data-setting-radio.twig ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="otgs-installer-component-setting otgs-ui" data-has-setting="{{ has_setting }}">
2
+ <span class="spinner otgs-components-report-setting-spinner"></span>
3
+ <ul>
4
+ <li>
5
+ <label for="{{ nonce.action }}{{ nonce.value }}-yes">
6
+ <input
7
+ type="radio"
8
+ {% if has_setting and is_repo_allowed %}
9
+ checked="checked"
10
+ {% endif %}
11
+ id="{{ nonce.action }}{{ nonce.value }}-yes"
12
+ class="js-otgs-components-report-user-choice"
13
+ value="1"
14
+ name="otgs-components-report-user-choice"
15
+ data-nonce-action="{{ nonce.action }}"
16
+ data-nonce-value="{{ nonce.value }}"
17
+ data-repo="{{ repo }}"
18
+ />
19
+
20
+ {% if custom_radio_label_yes is defined and custom_radio_label_yes is not null %}
21
+ {{ custom_radio_label_yes|raw }}
22
+ {% else %}
23
+ {{ strings.radio_report_yes }}
24
+ {% endif %}
25
+ </label>
26
+ </li>
27
+ <li>
28
+ <label for="{{ nonce.action }}{{ nonce.value }}-no">
29
+ <input
30
+ type="radio"
31
+ {% if has_setting and not is_repo_allowed %}
32
+ checked="checked"
33
+ {% endif %}
34
+ id="{{ nonce.action }}{{ nonce.value }}-no"
35
+ class="js-otgs-components-report-user-choice"
36
+ value="0"
37
+ name="otgs-components-report-user-choice"
38
+ data-nonce-action="{{ nonce.action }}"
39
+ data-nonce-value="{{ nonce.value }}"
40
+ data-repo="{{ repo }}"
41
+ />
42
+
43
+ {% if custom_radio_label_no is defined and custom_radio_label_no is not null %}
44
+ {{ custom_radio_label_no|raw }}
45
+ {% else %}
46
+ {{ strings.radio_report_no }}
47
+ {% endif %}
48
+ </label>
49
+ </li>
50
+ </ul>
51
+
52
+ <p class="otgs-installer-component-privacy-policy">
53
+ <a
54
+ href="{{ privacy_policy_url }}"
55
+ target="_blank"
56
+ rel="noopener"
57
+ class="otgs-external-link"
58
+ >
59
+ {%- if custom_privacy_policy_text is defined and custom_privacy_policy_text is not null -%}
60
+ {{- custom_privacy_policy_text|raw -}}
61
+ {%- else -%}
62
+ {{- privacy_policy_text -}}
63
+ {%- endif -%}
64
+ </a>
65
+ </p>
66
+ </div>
vendor/otgs/installer/templates/components-setting/share-local-data-setting.twig ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="otgs-installer-component-setting otgs-ui" data-has-setting="{{ has_setting }}">
2
+ {% if custom_raw_heading is defined and custom_raw_heading is not null %}
3
+ {{ custom_raw_heading|raw }}
4
+ {% else %}
5
+ <h4 class="heading">{{ strings.heading }}
6
+ <a
7
+ href="{{ company_url }}"
8
+ target="_blank"
9
+ rel="noopener"
10
+ class="otgs-external-link"
11
+ >
12
+ {{- company_site -}}
13
+ </a>
14
+ </h4>
15
+ {% endif %}
16
+ <p>
17
+ <a
18
+ href="{{ privacy_policy_url }}"
19
+ target="_blank"
20
+ rel="noopener"
21
+ class="otgs-external-link"
22
+ >
23
+ {%- if custom_privacy_policy_text is defined and custom_privacy_policy_text is not null -%}
24
+ {{- custom_privacy_policy_text|raw -}}
25
+ {%- else -%}
26
+ {{- privacy_policy_text -}}
27
+ {%- endif -%}
28
+ </a>
29
+ </p>
30
+ <input
31
+ type="checkbox"
32
+ {% if is_repo_allowed %}
33
+ checked="checked"
34
+ {% endif %}
35
+ id="{{ nonce.action }}{{ nonce.value }}"
36
+ class="js-otgs-components-report-user-choice"
37
+ value="1"
38
+ data-nonce-action="{{ nonce.action }}"
39
+ data-nonce-value="{{ nonce.value }}"
40
+ data-repo="{{ repo }}"
41
+ />
42
+ <label for="{{ nonce.action }}{{ nonce.value }}">
43
+ {% if custom_raw_label is defined and custom_raw_label is not null %}
44
+ {{ custom_raw_label|raw }}
45
+ {% else %}
46
+ {{ strings.report_to }} {{ company_site }} {{ strings.which_theme_and_plugins }}
47
+ {% endif %}
48
+ </label>
49
+ <div class="spinner otgs-components-report-setting-spinner"></div>
50
+ </div>
vendor/otgs/installer/templates/downloads-list.php CHANGED
@@ -32,7 +32,7 @@
32
  'repository_id' => $repository_id
33
  );
34
  ?>
35
- <input type="checkbox" name="downloads[]" value="<?php echo base64_encode(json_encode($download_data)); ?>" <?php
36
  if( $this->plugin_is_installed($download['name'], $download['slug'], $download['version'] )
37
  && ! $this->plugin_is_embedded_version( $download['name'], $download['slug'] )
38
  || WP_Installer()->dependencies->cant_download( $repository_id ) ): ?>disabled="disabled"<?php endif; ?> />&nbsp;
32
  'repository_id' => $repository_id
33
  );
34
  ?>
35
+ <input type="checkbox" name="downloads[]" value="<?php echo base64_encode(json_encode($download_data)); ?>" data-slug="<?php echo $download['slug'] ?>" <?php
36
  if( $this->plugin_is_installed($download['name'], $download['slug'], $download['version'] )
37
  && ! $this->plugin_is_embedded_version( $download['name'], $download['slug'] )
38
  || WP_Installer()->dependencies->cant_download( $repository_id ) ): ?>disabled="disabled"<?php endif; ?> />&nbsp;
vendor/otgs/installer/templates/repository-listing.php CHANGED
@@ -33,53 +33,81 @@
33
  <input type="hidden" name="nonce" value="<?php echo wp_create_nonce('save_site_key_' . $repository_id) ?>" />
34
  <input type="hidden" name="repository_id" value="<?php echo $repository_id ?>">
35
 
36
- <p >
37
- <?php
38
- $repo_site = str_replace( array(
39
- 'https://',
40
- 'http://'
41
- ), '', $this->settings['repositories'][ $repository_id ]['data']['url'] );
42
-
43
- printf(
44
- __( '1. Get your site-key for %1$s. If you already have a key, get it from %2$s. Otherwise', 'installer' ),
45
- str_replace( array(
46
- 'https://',
47
- 'http://'
48
- ), '', $this->get_installer_site_url( $repository_id ) ),
49
- '<a target="_blank" href="'. $this->settings['repositories'][ $repository_id ]['data']['site_keys_management_url'] . '?add=' . urlencode( $this->get_installer_site_url( $repository_id ) ) . '">' . __( 'your account', 'installer' ) . '</a>'
50
- );
51
- ?>
52
- <a target="_blank"
53
- href="<?php echo $this->settings['repositories'][ $repository_id ]['data']['url'] ?>"> <?php printf( esc_attr( 'register on %s.', 'installer' ), $repo_site ) ?> </a>
54
- </p>
55
-
56
- <p>
57
- <?php
58
- printf(
59
- __( '2. Insert your key and activate automatic updates:', 'installer' ),
60
- '<a href="' . $this->settings['repositories'][ $repository_id ]['data']['site_keys_management_url'] . '?add=' . urlencode( $this->get_installer_site_url( $repository_id ) ) . '">',
61
- $generic_product_name, '</a>', $this->get_installer_site_url( $repository_id )
62
- );
63
- ?>
64
- <span class="otgs-installer-register-inputs">
65
- <input type="text" size="20" name="site_key_<?php echo $repository_id ?>" placeholder="<?php echo esc_attr('site key') ?>" />
66
- <input class="button-primary" type="submit" value="<?php esc_attr_e('OK', 'installer') ?>" />
67
- <input class="button-secondary cancel_site_key_js" type="button" value="<?php esc_attr_e('Cancel registration', 'installer') ?>" />
68
- </span>
69
- </p>
70
-
71
- <?php
72
- $template_service = new OTGS_Installer_Twig_Template_Service_Loader(
73
- array( WP_Installer()->plugin_path() . '/templates/components-setting/' )
74
- );
75
- $components_setting_template = new OTGS_Installer_WP_Components_Setting_Templates( $template_service->get_service() );
76
- $components_setting_template->render_commercial( $repo_site, $generic_product_name, $repository_id );
77
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  </form>
79
 
80
-
81
-
82
-
83
  <?php
84
  $site_key = false;
85
 
33
  <input type="hidden" name="nonce" value="<?php echo wp_create_nonce('save_site_key_' . $repository_id) ?>" />
34
  <input type="hidden" name="repository_id" value="<?php echo $repository_id ?>">
35
 
36
+ <?php
37
+ $repo_site = str_replace( array(
38
+ 'https://',
39
+ 'http://'
40
+ ),
41
+ '',
42
+ $this->settings['repositories'][ $repository_id ]['data']['url'] );
43
+
44
+ $current_site_domain = str_replace( array(
45
+ 'https://',
46
+ 'http://'
47
+ ),
48
+ '',
49
+ $this->get_installer_site_url( $repository_id ) );
50
+
51
+ $your_account_link = '<a target="_blank" rel="nofollow" href="'
52
+ . $this->settings['repositories'][ $repository_id ]['data']['site_keys_management_url']
53
+ . '?add='
54
+ . urlencode( $this->get_installer_site_url( $repository_id ) )
55
+ . '">'
56
+ . __( 'your account', 'installer' )
57
+ . '</a>';
58
+
59
+ $register_link = '<a target="_blank" rel="nofollow" href="'
60
+ . $this->settings['repositories'][ $repository_id ]['data']['url']
61
+ . '">'
62
+ . sprintf( esc_attr( 'register on %s.', 'installer' ), $repo_site )
63
+ . '</a>';
64
+
65
+ $steps = array(
66
+ 1 => sprintf( __( 'Get your site-key for %1$s. If you already have a key, get it from %2$s. Otherwise, %3$s',
67
+ 'installer' ),
68
+ $current_site_domain,
69
+ $your_account_link,
70
+ $register_link ),
71
+ 2 => __( 'Insert your key and activate automatic updates:', 'installer' )
72
+ . '<span class="otgs-installer-register-inputs">'
73
+ . '<input type="text" size="20" name="site_key_'
74
+ . $repository_id
75
+ . '" placeholder="'
76
+ . esc_attr( 'site key' )
77
+ . '" />'
78
+ . '<input class="button-primary" type="submit" value="'
79
+ . esc_attr__( 'OK', 'installer' )
80
+ . '" />'
81
+ . '<input class="button-secondary cancel_site_key_js" type="button" value="'
82
+ . esc_attr__( 'Cancel registration', 'installer' )
83
+ . '" />'
84
+ . '</span>'
85
+
86
+ );
87
+
88
+ $required_items_count = count( $steps );
89
+
90
+ $filtered_items = apply_filters( 'otgs_installer_repository_registration_steps', $steps, $repository_id );
91
+ if ( ! $filtered_items || ! is_array( $filtered_items ) || $required_items_count < 2 ) {
92
+ $filtered_items = $steps;
93
+ }
94
+
95
+ $steps = $filtered_items;
96
+ ksort( $steps );
97
+ ?>
98
+ <ol>
99
+ <?php
100
+ foreach ( $steps as $item ) {
101
+ ?>
102
+ <li>
103
+ <?php echo $item; ?>
104
+ </li>
105
+ <?php
106
+ }
107
+ ?>
108
+ </ol>
109
  </form>
110
 
 
 
 
111
  <?php
112
  $site_key = false;
113
 
vendor/otgs/installer/templates/template-service/class-otgs-installer-twig-template-service-loader.php CHANGED
@@ -20,6 +20,10 @@ class OTGS_Installer_Twig_Template_Service_Loader {
20
  * @return OTGS_Installer_Twig_Template_Service
21
  */
22
  public function get_service() {
 
 
 
 
23
  $twig_loader = new Twig_Loader_Filesystem( $this->paths );
24
  $environment_args = array();
25
  if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
20
  * @return OTGS_Installer_Twig_Template_Service
21
  */
22
  public function get_service() {
23
+ if ( ! class_exists( 'Twig_Loader_Filesystem' ) ) {
24
+ OTGS_Twig_Autoloader::register();
25
+ }
26
+
27
  $twig_loader = new Twig_Loader_Filesystem( $this->paths );
28
  $environment_args = array();
29
  if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
vendor/toolset/toolset-common/autoload_classmap.php CHANGED
@@ -8,8 +8,14 @@ return array(
8
  'IToolset_Post_Type' => dirname( __FILE__ ) . '/inc/autoloaded/post_type/i_post_type.php',
9
  'IToolset_Post_Type_From_Types' => dirname( __FILE__ ) . '/inc/autoloaded/post_type/i_post_type_from_types.php',
10
  'IToolset_Post_Type_Registered' => dirname( __FILE__ ) . '/inc/autoloaded/post_type/i_post_type_registered.php',
11
- 'IToolset_Query' => dirname( __FILE__ ) . '/inc/autoloaded/i_query.php',
12
  'IToolset_Upgrade_Command' => dirname( __FILE__ ) . '/inc/autoloaded/upgrade/command_interface.php',
 
 
 
 
 
 
 
13
  'Toolset_Admin_Controller' => dirname( __FILE__ ) . '/inc/autoloaded/admin.php',
14
  'Toolset_Admin_Notice_Abstract' => dirname( __FILE__ ) . '/utility/admin/notice/abstract.php',
15
  'Toolset_Admin_Notice_Dismissible' => dirname( __FILE__ ) . '/utility/admin/notice/dismissible.php',
@@ -30,6 +36,7 @@ return array(
30
  'Toolset_Ajax_Handler_Interface' => dirname( __FILE__ ) . '/inc/autoloaded/ajax_handler/interface.php',
31
  'Toolset_Ajax_Handler_Intermediary_Post_Cleanup' => dirname( __FILE__ ) . '/inc/autoloaded/ajax_handler/intermediary_post_cleanup.php',
32
  'Toolset_Ajax_Handler_Migrate_To_M2M' => dirname( __FILE__ ) . '/inc/autoloaded/ajax_handler/migrate_to_m2m.php',
 
33
  'Toolset_Ajax_Handler_Select2_Suggest_Posts_By_Title' => dirname( __FILE__ ) . '/inc/autoloaded/ajax_handler/select2_suggest_posts_by_title.php',
34
  'Toolset_Ajax_Handler_Select2_Suggest_Terms' => dirname( __FILE__ ) . '/inc/autoloaded/ajax_handler/select2_suggest_terms.php',
35
  'Toolset_Ajax_Handler_Select2_Suggest_Users' => dirname( __FILE__ ) . '/inc/autoloaded/ajax_handler/select2_suggest_users.php',
@@ -129,6 +136,7 @@ return array(
129
  'Toolset_Field_Renderer_Preview_Date' => dirname( __FILE__ ) . '/inc/autoloaded/field/renderer/preview/date.php',
130
  'Toolset_Field_Renderer_Preview_File' => dirname( __FILE__ ) . '/inc/autoloaded/field/renderer/preview/file.php',
131
  'Toolset_Field_Renderer_Preview_Image' => dirname( __FILE__ ) . '/inc/autoloaded/field/renderer/preview/image.php',
 
132
  'Toolset_Field_Renderer_Preview_Radio' => dirname( __FILE__ ) . '/inc/autoloaded/field/renderer/preview/radio.php',
133
  'Toolset_Field_Renderer_Preview_Skype' => dirname( __FILE__ ) . '/inc/autoloaded/field/renderer/preview/skype.php',
134
  'Toolset_Field_Renderer_Preview_Textfield' => dirname( __FILE__ ) . '/inc/autoloaded/field/renderer/preview/textfield.php',
@@ -164,10 +172,13 @@ return array(
164
  'Toolset_Post_Type_Factory' => dirname( __FILE__ ) . '/inc/autoloaded/post_type/factory.php',
165
  'Toolset_Post_Type_From_Types' => dirname( __FILE__ ) . '/inc/autoloaded/post_type/from_types.php',
166
  'Toolset_Post_Type_Labels' => dirname( __FILE__ ) . '/inc/autoloaded/post_type/labels.php',
 
167
  'Toolset_Post_Type_Query' => dirname( __FILE__ ) . '/inc/autoloaded/post_type/query.php',
168
  'Toolset_Post_Type_Query_Factory' => dirname( __FILE__ ) . '/inc/autoloaded/post_type/query_factory.php',
169
  'Toolset_Post_Type_Registered' => dirname( __FILE__ ) . '/inc/autoloaded/post_type/registered.php',
170
  'Toolset_Post_Type_Repository' => dirname( __FILE__ ) . '/inc/autoloaded/post_type/repository.php',
 
 
171
  'Toolset_Regex' => dirname( __FILE__ ) . '/expression-parser/parser.php',
172
  'Toolset_Relationship_Service' => dirname( __FILE__ ) . '/inc/autoloaded/relationship_service.php',
173
  'Toolset_Renderer' => dirname( __FILE__ ) . '/inc/autoloaded/renderer/renderer.php',
@@ -176,6 +187,12 @@ return array(
176
  'Toolset_Result_Updated' => dirname( __FILE__ ) . '/inc/autoloaded/result_updated.php',
177
  'Toolset_Shortcode_Attr_Field' => dirname( __FILE__ ) . '/inc/autoloaded/shortcode/attr/field.php',
178
  'Toolset_Shortcode_Attr_Interface' => dirname( __FILE__ ) . '/inc/autoloaded/shortcode/attr/interface.php',
 
 
 
 
 
 
179
  'Toolset_Shortcode_Attr_Item_Id' => dirname( __FILE__ ) . '/inc/autoloaded/shortcode/attr/item/id.php',
180
  'Toolset_Shortcode_Attr_Item_Legacy' => dirname( __FILE__ ) . '/inc/autoloaded/shortcode/attr/item/legacy.php',
181
  'Toolset_Shortcode_Attr_Item_M2M' => dirname( __FILE__ ) . '/inc/autoloaded/shortcode/attr/item/m2m.php',
@@ -183,8 +200,10 @@ return array(
183
  'Toolset_Tokenizer' => dirname( __FILE__ ) . '/expression-parser/parser.php',
184
  'Toolset_Upgrade_Command_Definition' => dirname( __FILE__ ) . '/inc/autoloaded/upgrade/command_definition.php',
185
  'Toolset_Upgrade_Command_Definition_Repository' => dirname( __FILE__ ) . '/inc/autoloaded/upgrade/command_definition_repository.php',
 
186
  'Toolset_Upgrade_Command_Factory' => dirname( __FILE__ ) . '/inc/autoloaded/upgrade/command_factory.php',
187
  'Toolset_Upgrade_Command_M2M_V1_Database_Structure_Upgrade' => dirname( __FILE__ ) . '/inc/autoloaded/upgrade/command/m2m_v1_database_structure_upgrade.php',
 
188
  'Toolset_Upgrade_Controller' => dirname( __FILE__ ) . '/inc/autoloaded/upgrade/controller.php',
189
  'Toolset_Upgrade_Executed_Commands' => dirname( __FILE__ ) . '/inc/autoloaded/upgrade/executed_commands.php',
190
  'Toolset_User_Editors_Editor_Abstract' => dirname( __FILE__ ) . '/user-editors/editor/abstract.php',
8
  'IToolset_Post_Type' => dirname( __FILE__ ) . '/inc/autoloaded/post_type/i_post_type.php',
9
  'IToolset_Post_Type_From_Types' => dirname( __FILE__ ) . '/inc/autoloaded/post_type/i_post_type_from_types.php',
10
  'IToolset_Post_Type_Registered' => dirname( __FILE__ ) . '/inc/autoloaded/post_type/i_post_type_registered.php',
 
11
  'IToolset_Upgrade_Command' => dirname( __FILE__ ) . '/inc/autoloaded/upgrade/command_interface.php',
12
+ 'OTGS\Toolset\Common\Condition\Installer\IsAvailable' => dirname( __FILE__ ) . '/utility/condition/plugin/installer/is_available.php',
13
+ 'OTGS\Toolset\Common\Condition\Installer\IsToolsetSubscriptionValid' => dirname( __FILE__ ) . '/utility/condition/plugin/installer/is_toolset_subscription_valid.php',
14
+ 'OTGS\Toolset\Common\Interop\HandlerInterface' => dirname( __FILE__ ) . '/inc/autoloaded/interop/handler_interface.php',
15
+ 'OTGS\Toolset\Common\Interop\Handler\InstallerCompatibilityReporting' => dirname( __FILE__ ) . '/inc/autoloaded/interop/handler/installer_compatibility_reporting.php',
16
+ 'OTGS\Toolset\Common\Interop\Mediator' => dirname( __FILE__ ) . '/inc/autoloaded/interop/mediator.php',
17
+ 'OTGS\Toolset\Common\MaintenanceMode\Controller' => dirname( __FILE__ ) . '/inc/autoloaded/maintenance_mode/controller.php',
18
+ 'OTGS\Toolset\Common\Utility\Admin\Notices\Builder' => dirname( __FILE__ ) . '/utility/admin/notices/Builder.php',
19
  'Toolset_Admin_Controller' => dirname( __FILE__ ) . '/inc/autoloaded/admin.php',
20
  'Toolset_Admin_Notice_Abstract' => dirname( __FILE__ ) . '/utility/admin/notice/abstract.php',
21
  'Toolset_Admin_Notice_Dismissible' => dirname( __FILE__ ) . '/utility/admin/notice/dismissible.php',
36
  'Toolset_Ajax_Handler_Interface' => dirname( __FILE__ ) . '/inc/autoloaded/ajax_handler/interface.php',
37
  'Toolset_Ajax_Handler_Intermediary_Post_Cleanup' => dirname( __FILE__ ) . '/inc/autoloaded/ajax_handler/intermediary_post_cleanup.php',
38
  'Toolset_Ajax_Handler_Migrate_To_M2M' => dirname( __FILE__ ) . '/inc/autoloaded/ajax_handler/migrate_to_m2m.php',
39
+ 'Toolset_Ajax_Handler_Select2_Suggest_Posts_By_Post_Type' => dirname( __FILE__ ) . '/inc/autoloaded/ajax_handler/select2_suggest_posts_by_post_type.php',
40
  'Toolset_Ajax_Handler_Select2_Suggest_Posts_By_Title' => dirname( __FILE__ ) . '/inc/autoloaded/ajax_handler/select2_suggest_posts_by_title.php',
41
  'Toolset_Ajax_Handler_Select2_Suggest_Terms' => dirname( __FILE__ ) . '/inc/autoloaded/ajax_handler/select2_suggest_terms.php',
42
  'Toolset_Ajax_Handler_Select2_Suggest_Users' => dirname( __FILE__ ) . '/inc/autoloaded/ajax_handler/select2_suggest_users.php',
136
  'Toolset_Field_Renderer_Preview_Date' => dirname( __FILE__ ) . '/inc/autoloaded/field/renderer/preview/date.php',
137
  'Toolset_Field_Renderer_Preview_File' => dirname( __FILE__ ) . '/inc/autoloaded/field/renderer/preview/file.php',
138
  'Toolset_Field_Renderer_Preview_Image' => dirname( __FILE__ ) . '/inc/autoloaded/field/renderer/preview/image.php',
139
+ 'Toolset_Field_Renderer_Preview_Post' => dirname( __FILE__ ) . '/inc/autoloaded/field/renderer/preview/post.php',
140
  'Toolset_Field_Renderer_Preview_Radio' => dirname( __FILE__ ) . '/inc/autoloaded/field/renderer/preview/radio.php',
141
  'Toolset_Field_Renderer_Preview_Skype' => dirname( __FILE__ ) . '/inc/autoloaded/field/renderer/preview/skype.php',
142
  'Toolset_Field_Renderer_Preview_Textfield' => dirname( __FILE__ ) . '/inc/autoloaded/field/renderer/preview/textfield.php',
172
  'Toolset_Post_Type_Factory' => dirname( __FILE__ ) . '/inc/autoloaded/post_type/factory.php',
173
  'Toolset_Post_Type_From_Types' => dirname( __FILE__ ) . '/inc/autoloaded/post_type/from_types.php',
174
  'Toolset_Post_Type_Labels' => dirname( __FILE__ ) . '/inc/autoloaded/post_type/labels.php',
175
+ 'Toolset_Post_Type_List' => dirname( __FILE__ ) . '/inc/autoloaded/post_type/list.php',
176
  'Toolset_Post_Type_Query' => dirname( __FILE__ ) . '/inc/autoloaded/post_type/query.php',
177
  'Toolset_Post_Type_Query_Factory' => dirname( __FILE__ ) . '/inc/autoloaded/post_type/query_factory.php',
178
  'Toolset_Post_Type_Registered' => dirname( __FILE__ ) . '/inc/autoloaded/post_type/registered.php',
179
  'Toolset_Post_Type_Repository' => dirname( __FILE__ ) . '/inc/autoloaded/post_type/repository.php',
180
+ 'Toolset_Postmeta_Access_Loader' => dirname( __FILE__ ) . '/inc/autoloaded/postmeta_access/loader.php',
181
+ 'Toolset_Postmeta_Access_M2m' => dirname( __FILE__ ) . '/inc/autoloaded/postmeta_access/m2m.php',
182
  'Toolset_Regex' => dirname( __FILE__ ) . '/expression-parser/parser.php',
183
  'Toolset_Relationship_Service' => dirname( __FILE__ ) . '/inc/autoloaded/relationship_service.php',
184
  'Toolset_Renderer' => dirname( __FILE__ ) . '/inc/autoloaded/renderer/renderer.php',
187
  'Toolset_Result_Updated' => dirname( __FILE__ ) . '/inc/autoloaded/result_updated.php',
188
  'Toolset_Shortcode_Attr_Field' => dirname( __FILE__ ) . '/inc/autoloaded/shortcode/attr/field.php',
189
  'Toolset_Shortcode_Attr_Interface' => dirname( __FILE__ ) . '/inc/autoloaded/shortcode/attr/interface.php',
190
+ 'Toolset_Shortcode_Attr_Item_Gui_Base' => dirname( __FILE__ ) . '/inc/autoloaded/shortcode/attr/item/gui/base.php',
191
+ 'Toolset_Shortcode_Attr_Item_Gui_Factory' => dirname( __FILE__ ) . '/inc/autoloaded/shortcode/attr/item/gui/factory.php',
192
+ 'Toolset_Shortcode_Attr_Item_Gui_M2m' => dirname( __FILE__ ) . '/inc/autoloaded/shortcode/attr/item/gui/m2m.php',
193
+ 'Toolset_Shortcode_Attr_Item_Gui_O2m' => dirname( __FILE__ ) . '/inc/autoloaded/shortcode/attr/item/gui/o2m.php',
194
+ 'Toolset_Shortcode_Attr_Item_Gui_O2o' => dirname( __FILE__ ) . '/inc/autoloaded/shortcode/attr/item/gui/o2o.php',
195
+ 'Toolset_Shortcode_Attr_Item_Gui_Option' => dirname( __FILE__ ) . '/inc/autoloaded/shortcode/attr/item/gui/option.php',
196
  'Toolset_Shortcode_Attr_Item_Id' => dirname( __FILE__ ) . '/inc/autoloaded/shortcode/attr/item/id.php',
197
  'Toolset_Shortcode_Attr_Item_Legacy' => dirname( __FILE__ ) . '/inc/autoloaded/shortcode/attr/item/legacy.php',
198
  'Toolset_Shortcode_Attr_Item_M2M' => dirname( __FILE__ ) . '/inc/autoloaded/shortcode/attr/item/m2m.php',
200
  'Toolset_Tokenizer' => dirname( __FILE__ ) . '/expression-parser/parser.php',
201
  'Toolset_Upgrade_Command_Definition' => dirname( __FILE__ ) . '/inc/autoloaded/upgrade/command_definition.php',
202
  'Toolset_Upgrade_Command_Definition_Repository' => dirname( __FILE__ ) . '/inc/autoloaded/upgrade/command_definition_repository.php',
203
+ 'Toolset_Upgrade_Command_Delete_Obsolete_Upgrade_Options' => dirname( __FILE__ ) . '/inc/autoloaded/upgrade/command/delete_obsolete_version_number_option.php',
204
  'Toolset_Upgrade_Command_Factory' => dirname( __FILE__ ) . '/inc/autoloaded/upgrade/command_factory.php',
205
  'Toolset_Upgrade_Command_M2M_V1_Database_Structure_Upgrade' => dirname( __FILE__ ) . '/inc/autoloaded/upgrade/command/m2m_v1_database_structure_upgrade.php',
206
+ 'Toolset_Upgrade_Command_M2M_V2_Database_Structure_Upgrade' => dirname( __FILE__ ) . '/inc/autoloaded/upgrade/command/m2m_v2_database_structure_upgrade.php',
207
  'Toolset_Upgrade_Controller' => dirname( __FILE__ ) . '/inc/autoloaded/upgrade/controller.php',
208
  'Toolset_Upgrade_Executed_Commands' => dirname( __FILE__ ) . '/inc/autoloaded/upgrade/executed_commands.php',
209
  'Toolset_User_Editors_Editor_Abstract' => dirname( __FILE__ ) . '/user-editors/editor/abstract.php',
vendor/toolset/toolset-common/bootstrap.php CHANGED
@@ -342,6 +342,15 @@ class Toolset_Common_Bootstrap {
342
  new Toolset_Controller_Admin_Notices();
343
  }
344
 
 
 
 
 
 
 
 
 
 
345
  require_once( TOOLSET_COMMON_PATH . '/inc/toolset.compatibility.php' );
346
  require_once( TOOLSET_COMMON_PATH . '/inc/toolset.function.helpers.php' );
347
  require_once( TOOLSET_COMMON_PATH . '/deprecated.php' );
@@ -376,6 +385,19 @@ class Toolset_Common_Bootstrap {
376
  $wp_query_adjustments = new Toolset_Wp_Query_Adjustments_Loader();
377
  $wp_query_adjustments->initialize();
378
 
 
 
 
 
 
 
 
 
 
 
 
 
 
379
  $this->apply_filters_on_sections_loaded( 'toolset_register_include_section' );
380
  }
381
  }
342
  new Toolset_Controller_Admin_Notices();
343
  }
344
 
345
+ // Load Toolset Singleton Factory based on PHP_Version
346
+ if( ! class_exists( 'Toolset_Singleton_Factory', false ) ) {
347
+ if( version_compare( PHP_VERSION, '5.6.0', '>=' ) ) {
348
+ require_once( TOOLSET_COMMON_PATH . '/utility/singleton_factory.php' );
349
+ } else {
350
+ require_once( TOOLSET_COMMON_PATH . '/utility/singleton_factory_pre_php_5_6.php' );
351
+ }
352
+ }
353
+
354
  require_once( TOOLSET_COMMON_PATH . '/inc/toolset.compatibility.php' );
355
  require_once( TOOLSET_COMMON_PATH . '/inc/toolset.function.helpers.php' );
356
  require_once( TOOLSET_COMMON_PATH . '/deprecated.php' );
385
  $wp_query_adjustments = new Toolset_Wp_Query_Adjustments_Loader();
386
  $wp_query_adjustments->initialize();
387
 
388
+ $interop_mediator = new \OTGS\Toolset\Common\Interop\Mediator();
389
+ $interop_mediator->initialize();
390
+
391
+ /**
392
+ * Avoid the initialization of this class.
393
+ *
394
+ * @since m2m
395
+ */
396
+ if ( ! apply_filters( 'toolset_disable_legacy_relationships_meta_access', false ) ) {
397
+ $postmeta_access = new Toolset_Postmeta_Access_Loader();
398
+ $postmeta_access->initialize();
399
+ }
400
+
401
  $this->apply_filters_on_sections_loaded( 'toolset_register_include_section' );
402
  }
403
  }
vendor/toolset/toolset-common/changelog.md CHANGED
@@ -1,5 +1,65 @@
1
  # Toolset Common Library
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ## 2.6.2
4
  * Various minor bugfixes.
5
  * (toolsetcommon-290) First version of the public relationship API for both legacy and m2m relationships.
@@ -248,7 +308,6 @@
248
  - Fixed issue when there is more than one CRED form on a page with the same taxonomy.
249
  - Fixed a little problem with edit skype button modal window - was too narrow.
250
  - Fixed empty title problem for filter "wpt_field_options" on user edit/add screen.
251
- https://wp-types.com/forums/topic/populate-select-field-in-wpcf-um-group/
252
  - Added filter "toolset_editor_add_form_buttons" to disable Toolset buttons on the post editor.
253
  - Added placeholder attributes to fields.
254
  - Updated CakePHP validation URL method to allow new TLD's.
1
  # Toolset Common Library
2
 
3
+ ## 2.8
4
+ * Legacy branch of the library created to support Types 2.3. Contains all fixes up until 3.0.1.
5
+
6
+ ## 3.0.1
7
+ * Adjust the shortcodes GUI API so it generates attributes wrapped in single quotes.
8
+
9
+ ## 3.0
10
+ * (types-1537) Display the Installer's Compatibility Reporting setting wherever necessary.
11
+ * (toolsetcommon-406) Add new actions to inform about associations being created and deleted.
12
+ * (types-1583) Fix: Errors in PHP 5.3.6.
13
+ * (types-1553) Fix: Do not assume that an option for post type definitions is set.
14
+ * Migration: do not enforce a specific translation mode between posts involved in relationships to migrate.
15
+ * API: fails gracefully when trying to get a relationship by a non existing slug.
16
+ * API: two new public functions to create associations.
17
+ * WPML: support defining associations between posts without enforcing a specific translation mode for them.
18
+ * WPML: ensure that data from a post reference field can be rendered.
19
+
20
+ ## 2.7.1
21
+ * Tag for Forms 2.0-RC3
22
+ * Better validation methods in shared forms.
23
+ * Fixed styling issue in the Toolset shared admin pages.
24
+ * Fixed the shortcodes API GUI on items that have a content and include instructions for it.
25
+
26
+ ## 2.7.0
27
+ * Tag for upcoming Toolset releases.
28
+ * Fix a PHP 5.3 compatibility issue.
29
+
30
+ ## 2.6.9.1
31
+ * Restore compatibility with Toolset plugins using previous versions of the assets manager shared class.
32
+
33
+ ## 2.6.9
34
+ * Restore the $current_page value for the post selector shortcode attribute.
35
+ * Remove an admin notice about using Toolset plugins together.
36
+
37
+ ## 2.6.8
38
+ * (types-1444) Fixed inconsistent API call results when WPML switcher is set to "All languages".
39
+
40
+ ## 2.6.7
41
+ * Improve the shortcodes GUI post selector for better m2m compatibility.
42
+ * Extend the m2m relationships query API so it can play with intermediary post types.
43
+
44
+ ## 2.6.6
45
+ * (toolsetcommon-390) Make sure that there are no potential posts for association when the other (known) post has reached its cardinality limit.
46
+ * (toolsetcommon-381) Make the `_wpcf_belongs_{$post_type}_id` usage in WP_Query meta queries safe to use also in m2m.
47
+ * (types-1467) Fixes in the data structure upgrade mechanism and in the upgrade command for m2m-v1 tables.
48
+
49
+ ## 2.6.5
50
+ * Released with CRED 2.0-b2 and Layouts 2.3-b1
51
+ * Include a compatibility layer for xxx_post_meta native functions usage on legacy relationships postmeta keys.
52
+
53
+ ## 2.6.4
54
+ * Added a set of checks to avoid errors with third parties also loading the Recaptcha v1.11 library.
55
+ * (toolsetcommon-382) Fix issues with the Toolset_Post_Type_Repository too early initialization.
56
+ * (toolsetcommon-369) Fix: Avoid repeated results in the association query.
57
+
58
+ ## 2.6.3
59
+ * Compatibility for Types 2.3-b4
60
+ * Fixed an issue using repeatable File field inside a relationship
61
+ * (types-1374) Fail gracefully if dealing with corrupted `_wpcf_belongs_*_id` postmeta during the m2m migration.
62
+
63
  ## 2.6.2
64
  * Various minor bugfixes.
65
  * (toolsetcommon-290) First version of the public relationship API for both legacy and m2m relationships.
308
  - Fixed issue when there is more than one CRED form on a page with the same taxonomy.
309
  - Fixed a little problem with edit skype button modal window - was too narrow.
310
  - Fixed empty title problem for filter "wpt_field_options" on user edit/add screen.
 
311
  - Added filter "toolset_editor_add_form_buttons" to disable Toolset buttons on the post editor.
312
  - Added placeholder attributes to fields.
313
  - Updated CakePHP validation URL method to allow new TLD's.
vendor/toolset/toolset-common/classes/validation-cakephp.php CHANGED
@@ -126,7 +126,7 @@ if (!class_exists('Wpcf_Cake_Validation')) {
126
  */
127
  function notEmpty($check) {
128
  $_this = & Wpcf_Cake_Validation::getInstance();
129
- $_this->__reset();
130
  $_this->check = $check;
131
 
132
  if (is_array($check)) {
@@ -154,7 +154,7 @@ if (!class_exists('Wpcf_Cake_Validation')) {
154
  */
155
  function alphaNumeric($check) {
156
  $_this = & Wpcf_Cake_Validation::getInstance();
157
- $_this->__reset();
158
  $_this->check = $check;
159
 
160
  if (is_array($check)) {
@@ -177,7 +177,7 @@ if (!class_exists('Wpcf_Cake_Validation')) {
177
 
178
  function alphaNumericWhitespaces($check) {
179
  $_this = & Wpcf_Cake_Validation::getInstance();
180
- $_this->__reset();
181
  $_this->check = $check;
182
 
183
  if (is_array($check)) {
@@ -227,7 +227,7 @@ if (!class_exists('Wpcf_Cake_Validation')) {
227
  */
228
  function blank($check) {
229
  $_this = & Wpcf_Cake_Validation::getInstance();
230
- $_this->__reset();
231
  $_this->check = $check;
232
 
233
  if (is_array($check)) {
@@ -254,7 +254,7 @@ if (!class_exists('Wpcf_Cake_Validation')) {
254
  */
255
  function cc($check, $type = 'fast', $deep = false, $regex = null) {
256
  $_this = & Wpcf_Cake_Validation::getInstance();
257
- $_this->__reset();
258
  $_this->check = $check;
259
  $_this->type = $type;
260
  $_this->deep = $deep;
@@ -392,7 +392,7 @@ if (!class_exists('Wpcf_Cake_Validation')) {
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)) {
@@ -436,7 +436,7 @@ if (!class_exists('Wpcf_Cake_Validation')) {
436
  $format = $cake_date_formats[$date_format];
437
 
438
  $_this = & Wpcf_Cake_Validation::getInstance();
439
- $_this->__reset();
440
  $_this->check = $check;
441
  $_this->regex = $regex;
442
 
@@ -474,7 +474,7 @@ if (!class_exists('Wpcf_Cake_Validation')) {
474
  */
475
  function time($check) {
476
  $_this = & Wpcf_Cake_Validation::getInstance();
477
- $_this->__reset();
478
  $_this->check = $check;
479
  $_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}$%';
480
  return $_this->_check();
@@ -504,7 +504,7 @@ if (!class_exists('Wpcf_Cake_Validation')) {
504
  */
505
  function decimal($check, $places = null, $regex = null) {
506
  $_this = & Wpcf_Cake_Validation::getInstance();
507
- $_this->__reset();
508
  $_this->regex = $regex;
509
  $_this->check = $check;
510
 
@@ -529,7 +529,7 @@ if (!class_exists('Wpcf_Cake_Validation')) {
529
  */
530
  function email($check, $deep = false, $regex = null) {
531
  $_this = & Wpcf_Cake_Validation::getInstance();
532
- $_this->__reset();
533
  $_this->check = $check;
534
  $_this->regex = $regex;
535
  $_this->deep = $deep;
@@ -629,7 +629,7 @@ if (!class_exists('Wpcf_Cake_Validation')) {
629
  if (function_exists('filter_var')) {
630
  return filter_var($check, FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV4)) !== false;
631
  }
632
- $this->__populateIp();
633
  $this->check = $check;
634
  $this->regex = '/^' . $this->__pattern['IPv4'] . '$/';
635
  return $this->_check();
@@ -646,7 +646,7 @@ if (!class_exists('Wpcf_Cake_Validation')) {
646
  if (function_exists('filter_var')) {
647
  return filter_var($check, FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV6)) !== false;
648
  }
649
- $this->__populateIp();
650
  $this->check = $check;
651
  $this->regex = '/^' . $this->__pattern['IPv6'] . '$/';
652
  return $this->_check();
@@ -941,7 +941,7 @@ if (!class_exists('Wpcf_Cake_Validation')) {
941
  */
942
  function url($check, $strict = false) {
943
  $_this = & Wpcf_Cake_Validation::getInstance();
944
- $_this->__populateIp();
945
  $_this->check = $check;
946
  $validChars = '([' . preg_quote('!"$&\'()*+,-.@_:;=~[]') . '\/0-9a-z\p{L}\p{N}]|(%[0-9a-f]{2}))';
947
  $_this->regex = '/^(?:(?:https?|ftps?|file|news|gopher):\/\/)' . (!empty($strict) ? '' : '?') .
@@ -1095,8 +1095,13 @@ if (!class_exists('Wpcf_Cake_Validation')) {
1095
  * @access private
1096
  */
1097
 
1098
- function __populateIp() {
1099
- if (!isset($this->__pattern['IPv6'])) {
 
 
 
 
 
1100
  $pattern = '((([0-9A-Fa-f]{1,4}:){7}(([0-9A-Fa-f]{1,4})|:))|(([0-9A-Fa-f]{1,4}:){6}';
1101
  $pattern .= '(:|((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})';
1102
  $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})';
@@ -1126,7 +1131,13 @@ if (!class_exists('Wpcf_Cake_Validation')) {
1126
  * @return void
1127
  * @access private
1128
  */
1129
- function __reset() {
 
 
 
 
 
 
1130
  $this->check = null;
1131
  $this->regex = null;
1132
  $this->country = null;
@@ -1136,6 +1147,24 @@ if (!class_exists('Wpcf_Cake_Validation')) {
1136
  $this->errors = array();
1137
  }
1138
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1139
  }
1140
 
1141
  }
126
  */
127
  function notEmpty($check) {
128
  $_this = & Wpcf_Cake_Validation::getInstance();
129
+ $_this->reset();
130
  $_this->check = $check;
131
 
132
  if (is_array($check)) {
154
  */
155
  function alphaNumeric($check) {
156
  $_this = & Wpcf_Cake_Validation::getInstance();
157
+ $_this->reset();
158
  $_this->check = $check;
159
 
160
  if (is_array($check)) {
177
 
178
  function alphaNumericWhitespaces($check) {
179
  $_this = & Wpcf_Cake_Validation::getInstance();
180
+ $_this->reset();
181
  $_this->check = $check;
182
 
183
  if (is_array($check)) {
227
  */
228
  function blank($check) {
229
  $_this = & Wpcf_Cake_Validation::getInstance();
230
+ $_this->reset();
231
  $_this->check = $check;
232
 
233
  if (is_array($check)) {
254
  */
255
  function cc($check, $type = 'fast', $deep = false, $regex = null) {
256
  $_this = & Wpcf_Cake_Validation::getInstance();
257
+ $_this->reset();
258
  $_this->check = $check;
259
  $_this->type = $type;
260
  $_this->deep = $deep;
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)) {
436
  $format = $cake_date_formats[$date_format];
437
 
438
  $_this = & Wpcf_Cake_Validation::getInstance();
439
+ $_this->reset();
440
  $_this->check = $check;
441
  $_this->regex = $regex;
442
 
474
  */
475
  function time($check) {
476
  $_this = & Wpcf_Cake_Validation::getInstance();
477
+ $_this->reset();
478
  $_this->check = $check;
479
  $_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}$%';
480
  return $_this->_check();
504
  */
505
  function decimal($check, $places = null, $regex = null) {
506
  $_this = & Wpcf_Cake_Validation::getInstance();
507
+ $_this->reset();
508
  $_this->regex = $regex;
509
  $_this->check = $check;
510
 
529
  */
530
  function email($check, $deep = false, $regex = null) {
531
  $_this = & Wpcf_Cake_Validation::getInstance();
532
+ $_this->reset();
533
  $_this->check = $check;
534
  $_this->regex = $regex;
535
  $_this->deep = $deep;
629
  if (function_exists('filter_var')) {
630
  return filter_var($check, FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV4)) !== false;
631
  }
632
+ $this->populateIp();
633
  $this->check = $check;
634
  $this->regex = '/^' . $this->__pattern['IPv4'] . '$/';
635
  return $this->_check();
646
  if (function_exists('filter_var')) {
647
  return filter_var($check, FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV6)) !== false;
648
  }
649
+ $this->populateIp();
650
  $this->check = $check;
651
  $this->regex = '/^' . $this->__pattern['IPv6'] . '$/';
652
  return $this->_check();
941
  */
942
  function url($check, $strict = false) {
943
  $_this = & Wpcf_Cake_Validation::getInstance();
944
+ $_this->populateIp();
945
  $_this->check = $check;
946
  $validChars = '([' . preg_quote('!"$&\'()*+,-.@_:;=~[]') . '\/0-9a-z\p{L}\p{N}]|(%[0-9a-f]{2}))';
947
  $_this->regex = '/^(?:(?:https?|ftps?|file|news|gopher):\/\/)' . (!empty($strict) ? '' : '?') .
1095
  * @access private
1096
  */
1097
 
1098
+ function populateIp() {
1099
+ if( method_exists( $this, '__populateIp' ) ) {
1100
+ // support for subclasses overwritting the previous __populateIp function
1101
+ return $this->__populateIp();
1102
+ }
1103
+
1104
+ if (!isset($this->__pattern['IPv6'])) {
1105
  $pattern = '((([0-9A-Fa-f]{1,4}:){7}(([0-9A-Fa-f]{1,4})|:))|(([0-9A-Fa-f]{1,4}:){6}';
1106
  $pattern .= '(:|((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})';
1107
  $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})';
1131
  * @return void
1132
  * @access private
1133
  */
1134
+ function reset() {
1135
+ if( method_exists( $this, '__reset' ) ) {
1136
+ // support for subclasses overwritting the previous __reset function
1137
+ return $this->__reset();
1138
+ }
1139
+
1140
+ // no sublcass
1141
  $this->check = null;
1142
  $this->regex = null;
1143
  $this->country = null;
1147
  $this->errors = array();
1148
  }
1149
 
1150
+ /**
1151
+ * Backward compatibility
1152
+ * For PHP 7 we renamed the method __reset() and __populateIp() to reset() and populateIp().
1153
+ * As both are public methods we apply this fallback for the case someone calls the old methods.
1154
+ *
1155
+ * @param $method
1156
+ * @param $arguments
1157
+ */
1158
+ public function __call( $method, $arguments ) {
1159
+ switch( $method ) {
1160
+ case '__reset':
1161
+ $this->reset();
1162
+ break;
1163
+ case '__populateIp':
1164
+ $this->populateIp();
1165
+ break;
1166
+ }
1167
+ }
1168
  }
1169
 
1170
  }
vendor/toolset/toolset-common/inc/autoloaded/admin.php CHANGED
@@ -12,6 +12,7 @@ class Toolset_Admin_Controller {
12
 
13
  public function initialize() {
14
  $this->load_whip();
 
15
  }
16
 
17
 
@@ -29,4 +30,9 @@ class Toolset_Admin_Controller {
29
  whip_wp_check_versions( array( 'php' => '>=5.3' ) );
30
  }
31
 
 
 
 
 
 
32
  }
12
 
13
  public function initialize() {
14
  $this->load_whip();
15
+ $this->init_page_extensions();
16
  }
17
 
18
 
30
  whip_wp_check_versions( array( 'php' => '>=5.3' ) );
31
  }
32
 
33
+
34
+ private function init_page_extensions() {
35
+
36
+ }
37
+
38
  }
vendor/toolset/toolset-common/inc/autoloaded/admin/notices.php CHANGED
@@ -158,16 +158,6 @@ class Toolset_Controller_Admin_Notices {
158
  ) {
159
  $this->notices_compilation_introduction();
160
  $this->notice_wpml_version_doesnt_support_m2m();
161
-
162
- if( $this->only_types_active() || $this->is_commercial_active_but_not_registered( false ) ) {
163
- // notice: types free version support ends
164
- if( $notice = $this->types_free_version_support_ends() ) {
165
- if( $current_screen_id == 'toplevel_page_toolset-dashboard'
166
- && Toolset_Admin_Notices_Manager::is_notice_dismissed( $notice ) ) {
167
- $this->types_free_version_support_ends_undissmisble();
168
- }
169
- };
170
- }
171
  }
172
  }
173
 
@@ -219,11 +209,6 @@ class Toolset_Controller_Admin_Notices {
219
 
220
  $this->notices_compilation_introduction();
221
  $this->notice_wpml_version_doesnt_support_m2m();
222
-
223
- if( $this->only_types_active() || $this->is_commercial_active_but_not_registered( false ) ) {
224
- // notice: types free version support ends
225
- $this->types_free_version_support_ends();
226
- }
227
  }
228
 
229
  /**
@@ -262,8 +247,6 @@ class Toolset_Controller_Admin_Notices {
262
  */
263
  protected function notices_compilation_introduction() {
264
  if( $this->only_types_active() ) {
265
- $this->notice_how_to_design_with_toolset();
266
-
267
  // notice: theme has native layout support
268
  $this->notice_theme_works_best_with_toolset();
269
 
@@ -272,15 +255,6 @@ class Toolset_Controller_Admin_Notices {
272
 
273
  // commercial plugin active + theme we have an integration plugin for
274
  $this->integration_run_installer();
275
-
276
- // + commercial plugin active
277
- // + types || views || layouts missing
278
- if( ! $this->is_views_active
279
- || ! $this->is_types_active
280
- || ! $this->is_layouts_active
281
- ) {
282
- $this->types_views_or_layouts_missing();
283
- }
284
  }
285
 
286
  /**
@@ -297,18 +271,6 @@ class Toolset_Controller_Admin_Notices {
297
  return true;
298
  }
299
 
300
- /**
301
- * @return Toolset_Admin_Notice_Dismissible
302
- */
303
- protected function notice_how_to_design_with_toolset() {
304
- $notice = new Toolset_Admin_Notice_Dismissible( 'how-to-design-with-toolset' );
305
- $notice->set_content( $this->tpl_path . '/only-types-installed/layouts-support-missing.phtml' );
306
- $notice->add_condition( new Toolset_Condition_Theme_Layouts_Support_Native_Missing() );
307
- Toolset_Admin_Notices_Manager::add_notice( $notice );
308
-
309
- return $notice;
310
- }
311
-
312
  /**
313
  * @return Toolset_Admin_Notice_Dismissible
314
  */
@@ -319,19 +281,6 @@ class Toolset_Controller_Admin_Notices {
319
  Toolset_Admin_Notices_Manager::add_notice( $notice );
320
  }
321
 
322
- /**
323
- * @return Toolset_Admin_Notice_Dismissible
324
- */
325
- protected function types_views_or_layouts_missing() {
326
- // The id 'layouts-no-theme-integration' can be irritating as it no longer depends on a theme integration plugin
327
- // But changing the id means users have to dismiss the notice again. So we keep 'layouts-no-theme-integration'.
328
- $notice = new Toolset_Admin_Notice_Dismissible( 'layouts-no-theme-integration' );
329
- $notice->set_content( $this->tpl_path . '/commercial-plugin-installed/types-views-or-layouts-missing.phtml' );
330
- Toolset_Admin_Notices_Manager::add_notice( $notice );
331
-
332
- return $notice;
333
- }
334
-
335
  /**
336
  *
337
  * Display a Toolset_Admin_Notice_Undismissible notice if the user has not registered this site.
@@ -348,45 +297,6 @@ class Toolset_Controller_Admin_Notices {
348
  }
349
 
350
 
351
- /**
352
- * @return Toolset_Admin_Notice_Dismissible
353
- */
354
- protected function types_free_version_support_ends() {
355
- if( class_exists( 'WP_Installer' )
356
- && WP_Installer()->repository_has_valid_subscription( 'toolset' ) ) {
357
- return false;
358
- }
359
-
360
- $is_m2m_ready = new Toolset_Condition_Plugin_Types_Ready_For_M2M();
361
- if ( $is_m2m_ready->is_met() ) {
362
- return false;
363
- }
364
-
365
- $notice = new Toolset_Admin_Notice_Dismissible( 'types_free_version_support_ends', '', $this->constants );
366
- $notice->set_content( $this->tpl_path . '/types-free-version-ends.phtml' );
367
- Toolset_Admin_Notices_Manager::add_notice( $notice );
368
-
369
- return $notice;
370
- }
371
-
372
- /**
373
- * @return Toolset_Admin_Notice_Undismissible
374
- */
375
- protected function types_free_version_support_ends_undissmisble() {
376
- if( class_exists( 'WP_Installer' )
377
- && WP_Installer()->repository_has_valid_subscription( 'toolset' ) ) {
378
- return false;
379
- }
380
-
381
- $notice = new Toolset_Admin_Notice_Undismissible( 'types_free_version_support_ends_undissmisble', '', $this->constants );
382
- $notice->set_template_path( $this->tpl_path . '/types-move-to-toolset.phtml' );
383
- $notice->set_content( $this->tpl_path . '/types-free-version-ends.phtml' );
384
- Toolset_Admin_Notices_Manager::add_notice( $notice );
385
-
386
- return $notice;
387
- }
388
-
389
-
390
 
391
  /**
392
  * @return Toolset_Admin_Notice_Dismissible
@@ -489,7 +399,7 @@ class Toolset_Controller_Admin_Notices {
489
  $notice = new Toolset_Admin_Notice_Required_Action(
490
  'toolset-wpml-version-doesnt-support-m2m',
491
  sprintf(
492
- __( 'Many-to-many post relationships in Toolset require WPML %s or newer to work properly with post translations. Please upgrade WPML.', 'wpcf' ),
493
  sanitize_text_field( Toolset_Relationship_Controller::MINIMAL_WPML_VERSION )
494
  )
495
  );
158
  ) {
159
  $this->notices_compilation_introduction();
160
  $this->notice_wpml_version_doesnt_support_m2m();
 
 
 
 
 
 
 
 
 
 
161
  }
162
  }
163
 
209
 
210
  $this->notices_compilation_introduction();
211
  $this->notice_wpml_version_doesnt_support_m2m();
 
 
 
 
 
212
  }
213
 
214
  /**
247
  */
248
  protected function notices_compilation_introduction() {
249
  if( $this->only_types_active() ) {
 
 
250
  // notice: theme has native layout support
251
  $this->notice_theme_works_best_with_toolset();
252
 
255
 
256
  // commercial plugin active + theme we have an integration plugin for
257
  $this->integration_run_installer();
 
 
 
 
 
 
 
 
 
258
  }
259
 
260
  /**
271
  return true;
272
  }
273
 
 
 
 
 
 
 
 
 
 
 
 
 
274
  /**
275
  * @return Toolset_Admin_Notice_Dismissible
276
  */
281
  Toolset_Admin_Notices_Manager::add_notice( $notice );
282
  }
283
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284
  /**
285
  *
286
  * Display a Toolset_Admin_Notice_Undismissible notice if the user has not registered this site.
297
  }
298
 
299
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
 
301
  /**
302
  * @return Toolset_Admin_Notice_Dismissible
399
  $notice = new Toolset_Admin_Notice_Required_Action(
400
  'toolset-wpml-version-doesnt-support-m2m',
401
  sprintf(
402
+ __( 'Post relationships in Toolset require WPML %s or newer to work properly with post translations. Please upgrade WPML.', 'wpcf' ),
403
  sanitize_text_field( Toolset_Relationship_Controller::MINIMAL_WPML_VERSION )
404
  )
405
  );
vendor/toolset/toolset-common/inc/autoloaded/ajax_handler/migrate_to_m2m.php CHANGED
@@ -18,9 +18,9 @@ class Toolset_Ajax_Handler_Migrate_To_M2M extends Toolset_Ajax_Handler_Abstract
18
 
19
  // Fixed step numbers in the first phase.
20
  // These need to be consecutive numbers.
21
- const STEP_MAYBE_DROP_TABLES = 0;
22
-
23
- const STEP_CREATE_TABLES = 1;
24
 
25
 
26
  /** @var Toolset_Relationship_Controller */
@@ -105,18 +105,39 @@ class Toolset_Ajax_Handler_Migrate_To_M2M extends Toolset_Ajax_Handler_Abstract
105
  // Used for calculating offsets in the last two phases.
106
  $steps_before_association_migration = (int) toolset_getarr( $_POST, 'first_phase_step', 0 );
107
 
 
 
 
 
 
108
  switch ( $current_phase ) {
109
 
110
  case self::PHASE_DBDELTA: {
111
- $continue = $this->phase_dbdelta( $step_number , $migration_controller, $results, $next_phase );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  break;
113
  }
114
 
115
  case self::PHASE_DEFINITION_MIGRATION: {
116
  // Second step - (re)create relationship definitions.
117
 
118
- $definition_migration_result = $migration_controller->migrate_relationship_definitions();
 
119
  if ( $definition_migration_result->is_complete_success() ) {
 
120
  $results->add( true, __( 'Relationship definitions migrated.', 'wpcf' ) );
121
  } else {
122
  $results->add( $definition_migration_result );
@@ -180,12 +201,32 @@ class Toolset_Ajax_Handler_Migrate_To_M2M extends Toolset_Ajax_Handler_Abstract
180
 
181
  }
182
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  $this->ajax_finish(
184
  array(
185
  'message' => $results->concat_messages( "\n> " ),
186
  'continue' => $continue,
187
  'previous_phase' => $current_phase,
 
 
 
188
  'is_complete_success' => $results->is_complete_success(),
 
189
  'ajax_arguments' => array(
190
  'step' => $step_number + 1,
191
  'phase' => $next_phase,
@@ -194,7 +235,7 @@ class Toolset_Ajax_Handler_Migrate_To_M2M extends Toolset_Ajax_Handler_Abstract
194
  'options' => $options
195
  )
196
  ),
197
- true // the call is a success, it doesn't say anything about the actual operation
198
  );
199
  }
200
 
@@ -229,7 +270,7 @@ class Toolset_Ajax_Handler_Migrate_To_M2M extends Toolset_Ajax_Handler_Abstract
229
 
230
  $migration_controller->do_native_dbdelta();
231
 
232
- $results->add( true, __( 'The toolset_associations table created.', 'wpcf' ) );
233
 
234
  $next_phase = self::PHASE_DEFINITION_MIGRATION;
235
 
@@ -241,4 +282,20 @@ class Toolset_Ajax_Handler_Migrate_To_M2M extends Toolset_Ajax_Handler_Abstract
241
  return false;
242
  }
243
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
  }
18
 
19
  // Fixed step numbers in the first phase.
20
  // These need to be consecutive numbers.
21
+ const STEP_MAINTENANCE_ON = 0;
22
+ const STEP_MAYBE_DROP_TABLES = 1;
23
+ const STEP_CREATE_TABLES = 2;
24
 
25
 
26
  /** @var Toolset_Relationship_Controller */
105
  // Used for calculating offsets in the last two phases.
106
  $steps_before_association_migration = (int) toolset_getarr( $_POST, 'first_phase_step', 0 );
107
 
108
+ $has_maintenance_mode = (bool) toolset_getarr( $options, 'use_maintenance_mode', false );
109
+
110
+ $is_fatal_error = false;
111
+ $keep_maintenance_mode = false;
112
+
113
  switch ( $current_phase ) {
114
 
115
  case self::PHASE_DBDELTA: {
116
+ // Putting this here because adding another phase would require more changes to the
117
+ // migration dialog.
118
+ if( $step_number === self::STEP_MAINTENANCE_ON ) {
119
+ if( $has_maintenance_mode ) {
120
+ $results->add( $this->enable_maintenance_mode() );
121
+ $continue = $results->is_complete_success();
122
+ } else {
123
+ $results->add( true, __( 'Not using maintenance mode for the migration.', 'wpcf' ) );
124
+ $continue = true;
125
+ }
126
+ $keep_maintenance_mode = true;
127
+ $is_fatal_error = ! $continue;
128
+ } else {
129
+ $continue = $this->phase_dbdelta( $step_number, $migration_controller, $results, $next_phase );
130
+ }
131
  break;
132
  }
133
 
134
  case self::PHASE_DEFINITION_MIGRATION: {
135
  // Second step - (re)create relationship definitions.
136
 
137
+ $adjust_translation_mode = (bool) toolset_getarr( $options, 'adjust_translation_mode' );
138
+ $definition_migration_result = $migration_controller->migrate_relationship_definitions( $adjust_translation_mode );
139
  if ( $definition_migration_result->is_complete_success() ) {
140
+ $results->add( $definition_migration_result );
141
  $results->add( true, __( 'Relationship definitions migrated.', 'wpcf' ) );
142
  } else {
143
  $results->add( $definition_migration_result );
201
 
202
  }
203
 
204
+ // Never leave the maintenance mode behind unless specifically instructed to do so
205
+ // (when there is an error because the maintenance mode is already active).
206
+ if( $has_maintenance_mode && ! $continue && ! $keep_maintenance_mode ) {
207
+ $results->add( $this->disable_maintenance_mode() );
208
+ }
209
+
210
+ $result_status = 'success';
211
+ if( ! $results->is_complete_success() ) {
212
+ // Something went wrong but we can still continue.
213
+ $result_status = 'warning';
214
+ }
215
+ if( $is_fatal_error ) {
216
+ // Something went wrong and the process cannot continue anymore,
217
+ $result_status = 'error';
218
+ }
219
+
220
  $this->ajax_finish(
221
  array(
222
  'message' => $results->concat_messages( "\n> " ),
223
  'continue' => $continue,
224
  'previous_phase' => $current_phase,
225
+ 'status' => $result_status,
226
+
227
+ // keeping this for backward compatibility - replaced by "status":
228
  'is_complete_success' => $results->is_complete_success(),
229
+
230
  'ajax_arguments' => array(
231
  'step' => $step_number + 1,
232
  'phase' => $next_phase,
235
  'options' => $options
236
  )
237
  ),
238
+ true
239
  );
240
  }
241
 
270
 
271
  $migration_controller->do_native_dbdelta();
272
 
273
+ $results->add( true, __( 'The toolset_associations, toolset_relationships and toolset_post_type_sets tables have been created.', 'wpcf' ) );
274
 
275
  $next_phase = self::PHASE_DEFINITION_MIGRATION;
276
 
282
  return false;
283
  }
284
 
285
+
286
+ private function get_maintenance_mode_controller() {
287
+ $maintenance = new \OTGS\Toolset\Common\MaintenanceMode\Controller();
288
+ return $maintenance;
289
+ }
290
+
291
+
292
+ private function enable_maintenance_mode() {
293
+ return $this->get_maintenance_mode_controller()->enable( true, true, true );
294
+ }
295
+
296
+
297
+ private function disable_maintenance_mode() {
298
+ return $this->get_maintenance_mode_controller()->disable();
299
+ }
300
+
301
  }
vendor/toolset/toolset-common/inc/autoloaded/ajax_handler/select2_suggest_posts_by_post_type.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Handles toolset_select2 instances that suggest post by title.
5
+ *
6
+ * If a given post type is not provided, it will return no results.
7
+ * valueType - If a return value among [ 'ID', 'post_name' ] is not provided, it will return result built upon post ID.
8
+ * orderBy - Can order by 'date', 'title', 'ID'.
9
+ * order - Can order as 'DESC' or 'ASC'.
10
+ * author - Can filter by an author ID, or return no results if passed as zero.
11
+ *
12
+ * @since m2m
13
+ */
14
+ class Toolset_Ajax_Handler_Select2_Suggest_Posts_By_Post_Type extends Toolset_Ajax_Handler_Abstract {
15
+
16
+
17
+ /**
18
+ * @param array $arguments Original action arguments.
19
+ *
20
+ * @return void
21
+ */
22
+ function process_call( $arguments ) {
23
+
24
+ $this->ajax_begin(
25
+ array(
26
+ 'nonce' => Toolset_Ajax::CALLBACK_SELECT2_SUGGEST_POSTS_BY_POST_TYPE,
27
+ 'is_public' => true
28
+ )
29
+ );
30
+
31
+ $post_type = toolset_getpost( 'postType' );
32
+
33
+ if ( empty( $post_type ) ) {
34
+ $this->ajax_finish( array( 'message' => __( 'Wrong or missing query.', 'wpv-views' ) ), false );
35
+ }
36
+
37
+ $return = toolset_getpost( 'valueType' );
38
+ $return = in_array( $return, array( 'ID', 'post_name' ) )
39
+ ? $return
40
+ : 'ID';
41
+
42
+ global $wpdb;
43
+ $values_to_prepare = array();
44
+
45
+ $post_type_query = '';
46
+
47
+
48
+ $post_type_query = "AND post_type = %s ";
49
+ $values_to_prepare[] = $post_type;
50
+
51
+ $author_query = '';
52
+ if ( '' != toolset_getpost('author') ) {
53
+ $author_query = "AND post_author = %s";
54
+ $values_to_prepare[] = (int) toolset_getpost('author');
55
+ }
56
+
57
+ $orderby = toolset_getpost( 'orderBy', 'ID', array( 'date', 'title', 'ID' ) );
58
+ $values_to_prepare[] = $orderby;
59
+
60
+ $order = toolset_getpost( 'order', 'DESC', array( 'ASC', 'DESC' ) );
61
+ $values_to_prepare[] = $order;
62
+
63
+ $results = $wpdb->get_results(
64
+ $wpdb->prepare(
65
+ "SELECT ID, post_type, post_title, post_name
66
+ FROM {$wpdb->posts}
67
+ WHERE post_status = 'publish'
68
+ {$post_type_query}
69
+ {$author_query}
70
+ ORDER BY %s %s
71
+ LIMIT 0, 15",
72
+ $values_to_prepare
73
+ )
74
+ );
75
+
76
+
77
+ if (
78
+ isset( $results )
79
+ && ! empty( $results )
80
+ ) {
81
+
82
+ $final = array();
83
+
84
+ if ( is_array( $results ) ) {
85
+
86
+ foreach ( $results as $result ) {
87
+ $final[] = array(
88
+ 'id' => $result->$return,
89
+ 'text' => $result->post_title
90
+ );
91
+ }
92
+
93
+ $final = array_values( $final );
94
+
95
+ }
96
+ $this->ajax_finish( $final, true );
97
+
98
+ } else {
99
+ // return empty result set
100
+ $result = array();
101
+ $this->ajax_finish( $result, true );
102
+ }
103
+
104
+ $this->ajax_finish( array( 'message' => __( 'Error while retrieving result.', 'wpv-views' ) ), false );
105
+
106
+ }
107
+
108
+ /**
109
+ * Return only post type from post object, used for array_map
110
+ * @param $one_post
111
+ * @return string
112
+ */
113
+ private function get_post_type( $one_post ){
114
+ return $one_post->post_type;
115
+ }
116
+
117
+ }
vendor/toolset/toolset-common/inc/autoloaded/ajax_handler/select2_suggest_posts_by_title.php CHANGED
@@ -3,8 +3,13 @@
3
  /**
4
  * Handles toolset_select2 instances that suggest post by title.
5
  *
6
- * If a given post type is not provided, it will return results in any post type but the excluded ones.
7
- * If a return value among [ 'ID', 'post_name' ] is not provided, it will return result built upon post ID.
 
 
 
 
 
8
  *
9
  * @since m2m
10
  */
@@ -25,11 +30,12 @@ class Toolset_Ajax_Handler_Select2_Suggest_Posts_By_Title extends Toolset_Ajax_H
25
  )
26
  );
27
 
28
- // Read and validate input
29
  $s = toolset_getpost( 's' );
30
 
31
-
32
- if ( empty( $s ) ) {
 
 
33
  $this->ajax_finish( array( 'message' => __( 'Wrong or missing query.', 'wpv-views' ) ), false );
34
  }
35
 
@@ -41,14 +47,19 @@ class Toolset_Ajax_Handler_Select2_Suggest_Posts_By_Title extends Toolset_Ajax_H
41
  global $wpdb;
42
  $values_to_prepare = array();
43
 
44
- if ( method_exists( $wpdb, 'esc_like' ) ) {
45
- $s = '%' . $wpdb->esc_like( $s ) . '%';
46
- } else {
47
- $s = '%' . like_escape( esc_sql( $s ) ) . '%';
 
 
 
 
 
 
 
48
  }
49
 
50
- $values_to_prepare[] = $s;
51
-
52
  $post_type_query = '';
53
  $force_post_type = toolset_getpost( 'postType' );
54
  if ( empty( $force_post_type ) ) {
@@ -62,17 +73,27 @@ class Toolset_Ajax_Handler_Select2_Suggest_Posts_By_Title extends Toolset_Ajax_H
62
  $values_to_prepare[] = $force_post_type;
63
  }
64
 
65
- $toolset_post_type_exclude = new Toolset_Post_Type_Exclude_List();
66
- $toolset_post_type_exclude_list = $toolset_post_type_exclude->get();
67
- $toolset_post_type_exclude_list_string = "'" . implode( "', '", $toolset_post_type_exclude_list ) . "'";
 
 
 
 
 
 
 
 
68
 
69
  $results = $wpdb->get_results(
70
  $wpdb->prepare(
71
  "SELECT ID, post_type, post_title, post_name
72
  FROM {$wpdb->posts}
73
- WHERE post_title LIKE %s
74
  AND post_status = 'publish'
75
- {$post_type_query}
 
 
76
  LIMIT 0, 15",
77
  $values_to_prepare
78
  )
@@ -83,33 +104,43 @@ class Toolset_Ajax_Handler_Select2_Suggest_Posts_By_Title extends Toolset_Ajax_H
83
  isset( $results )
84
  && ! empty( $results )
85
  ) {
86
-
87
  $final = array();
88
 
89
  if ( is_array( $results ) ) {
90
-
91
- // create list of unique post types in result set
92
- $selected_post_types = array_map( array( $this,'get_post_type' ), $results );
93
- $unique_post_types = array_unique( $selected_post_types );
94
-
95
-
96
- foreach ( $unique_post_types as $key => $post_type ) {
97
- $post_type_details = get_post_type_object( $post_type );
98
- $final[ $post_type ] = array(
99
- 'text' => $post_type_details->label,
100
- 'children' => array()
101
- );
102
- }
103
- foreach ( $results as $result ) {
104
- $final[ $result->post_type ]['children'][] = array(
105
- 'id' => $result->$return,
106
- 'text' => $result->post_title
107
- );
 
 
 
 
 
 
 
 
 
108
  }
109
 
110
  $final = array_values( $final );
111
-
112
  }
 
113
  $this->ajax_finish( $final, true );
114
 
115
  } else {
3
  /**
4
  * Handles toolset_select2 instances that suggest post by title.
5
  *
6
+ * This AJAX handler supports the following modifies:
7
+ * postType - If a given post type is not provided, it will return results in any post type but the excluded ones. No validation is done.
8
+ * valueType - If a return value among [ 'ID', 'post_name' ] is not provided, it will return result built upon post ID.
9
+ * loadRecent - If provided as TRUE, a search for the most recent posts will be performed even without a search term.
10
+ * orderBy - Can order by 'date', 'title', 'ID'.
11
+ * order - Can order as 'DESC' or 'ASC'.
12
+ * author - Can filter by an author ID, or return no results if passed as zero.
13
  *
14
  * @since m2m
15
  */
30
  )
31
  );
32
 
 
33
  $s = toolset_getpost( 's' );
34
 
35
+ if (
36
+ empty( $s )
37
+ && ! toolset_getpost( 'loadRecent', false )
38
+ ) {
39
  $this->ajax_finish( array( 'message' => __( 'Wrong or missing query.', 'wpv-views' ) ), false );
40
  }
41
 
47
  global $wpdb;
48
  $values_to_prepare = array();
49
 
50
+ if ( empty( $s ) ) {
51
+ $search_query = '1 = %d';
52
+ $values_to_prepare[] = 1;
53
+ } else {
54
+ $search_query = 'post_title LIKE %s';
55
+ if ( method_exists( $wpdb, 'esc_like' ) ) {
56
+ $s = '%' . $wpdb->esc_like( $s ) . '%';
57
+ } else {
58
+ $s = '%' . like_escape( esc_sql( $s ) ) . '%';
59
+ }
60
+ $values_to_prepare[] = $s;
61
  }
62
 
 
 
63
  $post_type_query = '';
64
  $force_post_type = toolset_getpost( 'postType' );
65
  if ( empty( $force_post_type ) ) {
73
  $values_to_prepare[] = $force_post_type;
74
  }
75
 
76
+ $author_query = '';
77
+ if ( '' != toolset_getpost('author') ) {
78
+ $author_query = "AND post_author = %s";
79
+ $values_to_prepare[] = (int) toolset_getpost('author');
80
+ }
81
+
82
+ $orderby = toolset_getpost( 'orderBy', 'ID', array( 'date', 'title', 'ID' ) );
83
+ $values_to_prepare[] = $orderby;
84
+
85
+ $order = toolset_getpost( 'order', 'DESC', array( 'ASC', 'DESC' ) );
86
+ $values_to_prepare[] = $order;
87
 
88
  $results = $wpdb->get_results(
89
  $wpdb->prepare(
90
  "SELECT ID, post_type, post_title, post_name
91
  FROM {$wpdb->posts}
92
+ WHERE {$search_query}
93
  AND post_status = 'publish'
94
+ {$post_type_query}
95
+ {$author_query}
96
+ ORDER BY %s %s
97
  LIMIT 0, 15",
98
  $values_to_prepare
99
  )
104
  isset( $results )
105
  && ! empty( $results )
106
  ) {
107
+
108
  $final = array();
109
 
110
  if ( is_array( $results ) ) {
111
+
112
+ if ( ! empty( $force_post_type ) ) {
113
+
114
+ foreach ( $results as $result ) {
115
+ $final[] = array(
116
+ 'id' => $result->$return,
117
+ 'text' => $result->post_title
118
+ );
119
+ }
120
+
121
+ } else {
122
+
123
+ foreach ( $results as $result ) {
124
+ if ( ! isset( $final[ $result->post_type ] ) ) {
125
+ $post_type_details = get_post_type_object( $result->post_type );
126
+ $final[ $result->post_type ] = array(
127
+ 'text' => $post_type_details->label,
128
+ 'children' => array()
129
+ );
130
+ }
131
+
132
+ $final[ $result->post_type ]['children'][] = array(
133
+ 'id' => $result->$return,
134
+ 'text' => $result->post_title
135
+ );
136
+ }
137
+
138
  }
139
 
140
  $final = array_values( $final );
141
+
142
  }
143
+
144
  $this->ajax_finish( $final, true );
145
 
146
  } else {
vendor/toolset/toolset-common/inc/autoloaded/element/domain.php CHANGED
@@ -5,7 +5,7 @@
5
  *
6
  * @since 2.5.4
7
  */
8
- abstract class Toolset_Element_Domain {
9
 
10
  const POSTS = 'posts';
11
  const USERS = 'users';
5
  *
6
  * @since 2.5.4
7
  */
8
+ class Toolset_Element_Domain {
9
 
10
  const POSTS = 'posts';
11
  const USERS = 'users';
vendor/toolset/toolset-common/inc/autoloaded/element/element.php CHANGED
@@ -66,18 +66,6 @@ abstract class Toolset_Element implements IToolset_Element {
66
 
67
 
68
 
69
- /**
70
- * @return string One of the Toolset_Field_Utils::get_domains() values.
71
- */
72
- public abstract function get_domain();
73
-
74
-
75
- /**
76
- * @return int ID of the underlying object.
77
- */
78
- public abstract function get_id();
79
-
80
-
81
  /**
82
  * Load custom fields of the element if they're not loaded yet.
83
  *
66
 
67
 
68
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  /**
70
  * Load custom fields of the element if they're not loaded yet.
71
  *
vendor/toolset/toolset-common/inc/autoloaded/element/element_factory.php CHANGED
@@ -113,6 +113,7 @@ class Toolset_Element_Factory {
113
  * @param array|WP_Post|int $object_source
114
  *
115
  * @return Toolset_Post_Translation_Set
 
116
  */
117
  public function get_post_translation_set( $object_source ) {
118
  if( ! is_array( $object_source ) ) {
113
  * @param array|WP_Post|int $object_source
114
  *
115
  * @return Toolset_Post_Translation_Set
116
+ * @throws Toolset_Element_Exception_Element_Doesnt_Exist
117
  */
118
  public function get_post_translation_set( $object_source ) {
119
  if( ! is_array( $object_source ) ) {
vendor/toolset/toolset-common/inc/autoloaded/element/i_post.php CHANGED
@@ -22,13 +22,6 @@ interface IToolset_Post extends IToolset_Element {
22
  public function get_type_object();
23
 
24
 
25
- /**
26
- * @return string Post title
27
- * @since m2m
28
- */
29
- public function get_title();
30
-
31
-
32
  /**
33
  * @param string $title New post title
34
  *
22
  public function get_type_object();
23
 
24
 
 
 
 
 
 
 
 
25
  /**
26
  * @param string $title New post title
27
  *
vendor/toolset/toolset-common/inc/autoloaded/element/post.php CHANGED
@@ -275,4 +275,4 @@ class Toolset_Post extends Toolset_Element implements IToolset_Post {
275
  public function get_trid() {
276
  return $this->wpml_service->get_post_trid( $this->get_id() );
277
  }
278
- }
275
  public function get_trid() {
276
  return $this->wpml_service->get_post_trid( $this->get_id() );
277
  }
278
+ }
vendor/toolset/toolset-common/inc/autoloaded/element/post_translation_set.php CHANGED
@@ -133,7 +133,11 @@ class Toolset_Post_Translation_Set implements IToolset_Post {
133
  if ( ! array_key_exists( $language_code, $this->translations ) ) {
134
  $translated_post_id = $this->fetch_translation( $language_code );
135
  if ( $translated_post_id !== 0 ) {
136
- $translation = $this->element_factory->get_post_untranslated( $translated_post_id, $language_code );
 
 
 
 
137
  } else {
138
  $translation = null;
139
  }
133
  if ( ! array_key_exists( $language_code, $this->translations ) ) {
134
  $translated_post_id = $this->fetch_translation( $language_code );
135
  if ( $translated_post_id !== 0 ) {
136
+ try {
137
+ $translation = $this->element_factory->get_post_untranslated( $translated_post_id, $language_code );
138
+ } catch ( Toolset_Element_Exception_Element_Doesnt_Exist $e ) {
139
+ $translation = null;
140
+ }
141
  } else {
142
  $translation = null;
143
  }
vendor/toolset/toolset-common/inc/autoloaded/field/definition_abstract.php CHANGED
@@ -5,42 +5,6 @@
5
  */
6
  abstract class Toolset_Field_Definition_Abstract implements Toolset_Field_Definition_Interface {
7
 
8
- /**
9
- * @return string Field definition slug.
10
- */
11
- public abstract function get_slug();
12
-
13
-
14
- /**
15
- * @return string Field definition display name.
16
- */
17
- public abstract function get_name();
18
-
19
-
20
- /**
21
- * @return string Description provided by the user.
22
- */
23
- public abstract function get_description();
24
-
25
-
26
- /**
27
- * @return string Meta key used to store values of these fields.
28
- */
29
- public abstract function get_meta_key();
30
-
31
- /**
32
- * Determine whether the field is currently under Types control.
33
- *
34
- * @return mixed
35
- */
36
- public abstract function is_under_types_control();
37
-
38
-
39
- /**
40
- * @return Toolset_Field_Group[]
41
- */
42
- public abstract function get_associated_groups();
43
-
44
 
45
  /**
46
  * Does the field definition match a certain string?
5
  */
6
  abstract class Toolset_Field_Definition_Abstract implements Toolset_Field_Definition_Interface {
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  /**
10
  * Does the field definition match a certain string?
vendor/toolset/toolset-common/inc/autoloaded/field/definition_factory.php CHANGED
@@ -347,12 +347,6 @@ abstract class Toolset_Field_Definition_Factory implements Toolset_Field_Definit
347
  protected abstract function get_existing_meta_keys();
348
 
349
 
350
- /**
351
- * @return Toolset_Field_Group_Factory
352
- * @since 2.0
353
- */
354
- public abstract function get_group_factory();
355
-
356
 
357
  /**
358
  * @var null|Toolset_Field_Definition_Generic[] Cache.
347
  protected abstract function get_existing_meta_keys();
348
 
349
 
 
 
 
 
 
 
350
 
351
  /**
352
  * @var null|Toolset_Field_Definition_Generic[] Cache.
vendor/toolset/toolset-common/inc/autoloaded/field/definition_factory_interface.php CHANGED
@@ -6,6 +6,7 @@
6
  * @since 2.3
7
  */
8
  interface Toolset_Field_Definition_Factory_Interface {
 
9
  /**
10
  * Load an existing field definition.
11
  *
6
  * @since 2.3
7
  */
8
  interface Toolset_Field_Definition_Factory_Interface {
9
+
10
  /**
11
  * Load an existing field definition.
12
  *
vendor/toolset/toolset-common/inc/autoloaded/field/group.php CHANGED
@@ -745,4 +745,17 @@ abstract class Toolset_Field_Group {
745
  return $this->_post_type_repository;
746
  }
747
 
 
 
 
 
 
 
 
 
 
 
 
 
 
748
  }
745
  return $this->_post_type_repository;
746
  }
747
 
748
+
749
+ /**
750
+ * @return bool
751
+ * @since 2.8
752
+ */
753
+ public function contains_repeating_field_group() {
754
+ // Note: Must not be overridden until types-1593 is implemented. @refactoring
755
+ $has_rfg = array_reduce( $this->get_field_slugs(), function( $has_rfg, $field_slug ) {
756
+ return $has_rfg || (bool) preg_match( '/(' . Types_Field_Group_Repeatable::PREFIX . '[a-z0-9_]+)/', $field_slug );
757
+ }, false );
758
+
759
+ return $has_rfg;
760
+ }
761
  }
vendor/toolset/toolset-common/inc/autoloaded/field/group/post.php CHANGED
@@ -152,8 +152,7 @@ class Toolset_Field_Group_Post extends Toolset_Field_Group {
152
  * @deprecated Use is_assigned_to_type() instead.
153
  */
154
  public function has_associated_post_type( $post_type_slug ) {
155
-
156
- return $this->is_assigned_to_type( $post_type_slug);
157
  }
158
 
159
 
152
  * @deprecated Use is_assigned_to_type() instead.
153
  */
154
  public function has_associated_post_type( $post_type_slug ) {
155
+ return $this->is_assigned_to_type( $post_type_slug );
 
156
  }
157
 
158
 
vendor/toolset/toolset-common/inc/autoloaded/field/group/post_factory.php CHANGED
@@ -93,6 +93,7 @@ class Toolset_Field_Group_Post_Factory extends Toolset_Field_Group_Factory {
93
  )
94
  );
95
 
 
96
  $post_types = $post_type_query->get_results();
97
 
98
  $this->post_type_assignment_cache = array();
93
  )
94
  );
95
 
96
+ /** @var string[] $post_types */
97
  $post_types = $post_type_query->get_results();
98
 
99
  $this->post_type_assignment_cache = array();
vendor/toolset/toolset-common/inc/autoloaded/field/renderer/preview/post.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Toolset_Field_Renderer_Preview_Post extends Toolset_Field_Renderer_Preview_Base {
4
+
5
+ /**
6
+ * @param mixed $value Single field value in the intermediate format (see data mappers for details)
7
+ *
8
+ * @return string Rendered HTML
9
+ */
10
+ protected function render_single( $value ) {
11
+ if ( ! $value ) {
12
+ return '';
13
+ }
14
+ $post = get_post( (int) $value);
15
+
16
+ if ( ! $post ) {
17
+ return '';
18
+ }
19
+
20
+ $has_permission = current_user_can( 'edit_posts' );
21
+ $has_permissions = apply_filters( 'toolset_access_api_get_post_type_permissions', $has_permission, $post->post_type, 'publish', get_current_user_id() );
22
+
23
+ if ( $has_permissions ) {
24
+ return sprintf( '<a href="%s" target="_blank">%s</a>',
25
+ esc_attr( get_edit_post_link( $post ) ),
26
+ esc_html( get_the_title( $post ) )
27
+ );
28
+ } else {
29
+ return esc_html( get_the_title( $post ) );
30
+ }
31
+ }
32
+ }
vendor/toolset/toolset-common/inc/autoloaded/field/renderer/toolset_forms_repeatable_group.php CHANGED
@@ -14,36 +14,132 @@
14
  */
15
  class Toolset_Field_Renderer_Toolset_Forms_Repeatable_Group extends Toolset_Field_Renderer_Toolset_Forms {
16
 
17
- public function render( $echo = false ) {
18
- $field_config = $this->get_toolset_forms_config();
19
- if ( $this->hide_field_title ) {
20
- $field_config['title'] = '';
21
- $field_config['hide_field_title'] = true;
22
- }
23
 
24
- if ( $field_config['type'] == 'wysiwyg' ) {
25
- $field_config['type'] = 'textarea';
26
- }
 
27
 
28
- $field_config['repetitive'] = false;
 
 
 
 
 
 
 
 
 
 
 
29
 
30
- // [name] => wpcf[audio-205cb736]
31
- $field_config['name'] = 'types-repeatable-group[' . $this->field->get_object_id() . '][' . $field_config['slug'] . ']';
32
- if( isset( $field_config['options'] ) ) {
33
- foreach ( (array) $field_config['options'] as $option_key => $option_value ) {
34
- if ( isset( $option_value['name'] ) ) {
35
- $field_config['options'][$option_key]['name'] = 'types-repeatable-group[' . $this->field->get_object_id() . '][' . $field_config['slug'] . '][' . $option_key . ']';
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  }
37
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  }
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  $value_in_intermediate_format = $this->field->get_value();
41
  $output = wptoolset_form_field( $this->get_form_id(), $field_config, $value_in_intermediate_format );
42
 
43
  if ( $echo ) {
44
  echo $output;
45
  }
 
 
46
 
47
  return $output;
48
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  }
14
  */
15
  class Toolset_Field_Renderer_Toolset_Forms_Repeatable_Group extends Toolset_Field_Renderer_Toolset_Forms {
16
 
17
+ /**
18
+ * @var array
19
+ */
20
+ private $field_config;
 
 
21
 
22
+ /**
23
+ * @var int
24
+ */
25
+ private $group_id;
26
 
27
+ /**
28
+ * Get the legacy field config and modifiy the field names to work with rfg items.
29
+ *
30
+ * @param null $group_id
31
+ *
32
+ * @return array
33
+ *
34
+ * @since 2.6.5
35
+ */
36
+ public function get_field_config( $group_id = null ) {
37
+ if( $this->field_config === null || ( $group_id !== null && $group_id !== $this->group_id ) ) {
38
+ $this->group_id = $group_id;
39
 
40
+ // done by legacy
41
+ $field_config = $this->get_toolset_forms_config();
42
+
43
+ if ( $this->hide_field_title ) {
44
+ $field_config['title'] = '';
45
+ $field_config['hide_field_title'] = true;
46
+ }
47
+
48
+ // no repetitive fields on rfg
49
+ $field_config['repetitive'] = false;
50
+
51
+ // convert field name to types-repeatable-group[item-id][field-slug]
52
+ $field_config['name'] = 'types-repeatable-group[' . $this->field->get_object_id() . '][' . $field_config['slug'] . ']';
53
+ if( isset( $field_config['options'] ) ) {
54
+ foreach ( (array) $field_config['options'] as $option_key => $option_value ) {
55
+ if ( isset( $option_value['name'] ) ) {
56
+ $field_config['options'][$option_key]['name'] =
57
+ 'types-repeatable-group[' . $this->field->get_object_id() . '][' . $field_config['slug'] . '][' . $option_key . ']';
58
+ }
59
  }
60
  }
61
+
62
+ // check conditionals and rename field names
63
+ if( isset( $field_config['conditional'] ) && isset( $field_config['conditional']['conditions'] ) ) {
64
+ $group_fields = get_post_meta( $group_id, '_wp_types_group_fields', true );
65
+ $group_fields = explode( ',', $group_fields );
66
+
67
+ foreach( $field_config['conditional']['conditions'] as $con_key => $con_value ) {
68
+ $con_field_slug = str_replace( 'wpcf-', '', $con_value['id'] );
69
+
70
+ // only change the conditions field slug if the field is part of the rfg
71
+ if( in_array( $con_field_slug, $group_fields ) ) {
72
+ $field_config['conditional']['conditions'][ $con_key ][ 'id' ] =
73
+ 'types-repeatable-group[' . $this->field->get_object_id() . '][' . $con_field_slug . ']';
74
+ }
75
+ }
76
+
77
+ // we also need to renaeme the keys of the values
78
+ // before 'wpcf-field-slug' => 1 / after: 'types-repeatable-group[item-id][field-slug]' => 1
79
+ if( isset( $field_config['conditional']['values'] ) && is_array( $field_config['conditional']['values'] ) ) {
80
+ foreach( $field_config['conditional']['values'] as $original_field_slug => $field_value ) {
81
+ $field_slug = str_replace( 'wpcf-', '', $original_field_slug );
82
+
83
+ // check if field is part of rfg
84
+ if( in_array( $field_slug, $group_fields ) ) {
85
+ $rfg_item_field_slug = 'types-repeatable-group[' . $this->field->get_object_id() . '][' . $field_slug . ']';
86
+ $field_config['conditional']['values'][$rfg_item_field_slug] = $field_value;
87
+ unset( $field_config['conditional']['values'][$original_field_slug] );
88
+ }
89
+ }
90
+ }
91
+ }
92
+
93
+ $this->field_config = $field_config;
94
  }
95
 
96
+ return $this->field_config;
97
+ }
98
+
99
+ /**
100
+ * Render group
101
+ *
102
+ * @param bool $echo
103
+ * @param null $group_id
104
+ *
105
+ * @return mixed|void
106
+ */
107
+ public function render( $echo = false, $group_id = null ) {
108
+
109
+ /**
110
+ * Use filter to set types-related-content to "true"
111
+ * This is necessary to make sure that all WYSIWYG fields will have unique ID
112
+ */
113
+ add_filter( 'toolset_field_factory_get_attributes', array( $this, 'add_filter_attributes' ), 10, 2 );
114
+
115
+ $field_config = $this->get_field_config( $group_id );
116
+
117
  $value_in_intermediate_format = $this->field->get_value();
118
  $output = wptoolset_form_field( $this->get_form_id(), $field_config, $value_in_intermediate_format );
119
 
120
  if ( $echo ) {
121
  echo $output;
122
  }
123
+ remove_filter( 'toolset_field_factory_get_attributes', array( $this, 'add_filter_attributes' ), 10, 2 );
124
+
125
 
126
  return $output;
127
  }
128
+
129
+
130
+ /**
131
+ * In case of wysiwyg fields set types-related-content to true
132
+ * to make sure that field ID is unique
133
+ * @param $attributes
134
+ * @param $field
135
+ *
136
+ * @return array
137
+ */
138
+ public function add_filter_attributes( $attributes, $field ) {
139
+ $field_type = $field->getType();
140
+ if( 'wysiwyg' == $field_type ){
141
+ $attributes['types-related-content'] = true;
142
+ }
143
+ return $attributes;
144
+ }
145
  }
vendor/toolset/toolset-common/inc/autoloaded/field/type/definition.php CHANGED
@@ -101,9 +101,9 @@ class Toolset_Field_Type_Definition {
101
 
102
  /**
103
  * Retrieve CSS classes for a field type icon.
104
- *
105
  * To be placed in the i tag.
106
- *
107
  * @return string One or more CSS classes separated by spaces.
108
  * @since 2.0
109
  */
@@ -112,19 +112,19 @@ class Toolset_Field_Type_Definition {
112
  if( null != $fa_class ) {
113
  return sprintf( 'fa fa-%s', esc_attr( $fa_class ) );
114
  }
115
-
116
  $types_class = $this->get_args( 'types-field-image', null );
117
  if( null != $types_class ) {
118
  return sprintf( 'types-field-icon types-field-icon-%s', esc_attr( $types_class ) );
119
  }
120
-
121
- return '';
122
  }
123
 
124
 
125
  /**
126
  * Perform field type-specific sanitization of the field definition array.
127
- *
128
  * @link https://git.onthegosystems.com/toolset/types/wikis/database-layer/field-definition-arrays
129
  * @param $definition_array
130
  * @return array Sanitized definition array
@@ -175,7 +175,7 @@ class Toolset_Field_Type_Definition {
175
 
176
  /**
177
  * Make sure that the field definition array contains all necessary information.
178
- *
179
  * Note: This is a WIP, currently it sanitizes only very specific cases. It should be extended in the future.
180
  *
181
  * @link https://git.onthegosystems.com/toolset/types/wikis/database-layer/field-definition-arrays
@@ -199,9 +199,9 @@ class Toolset_Field_Type_Definition {
199
  $definition_array = $this->sanitize_field_definition_array_generic( $definition_array );
200
 
201
  $definition_array = $this->sanitize_numeric_validation( $definition_array );
202
-
203
  $definition_array = $this->sanitize_field_definition_array_type_specific( $definition_array );
204
-
205
  /**
206
  * types_post_sanitize_field_definition_array
207
  *
@@ -212,16 +212,16 @@ class Toolset_Field_Type_Definition {
212
  * @since 2.1
213
  */
214
  $definition_array = toolset_ensarr( apply_filters( 'types_post_sanitize_field_definition_array', $definition_array ) );
215
-
216
  return $definition_array;
217
  }
218
 
219
 
220
  /**
221
  * For all fields, remove the "number" validation option.
222
- *
223
  * Numeric field will override this and do the opposite instead.
224
- *
225
  * @param array $definition_array
226
  * @return array
227
  * @since 2.0
@@ -239,11 +239,11 @@ class Toolset_Field_Type_Definition {
239
 
240
  /**
241
  * Perform a basic "isset" sanitization of an array element.
242
- *
243
- * @param array $source
244
  * @param string $element_name Name of the element to sanitize.
245
  * @param string $default Default value for the element if not set or invalid.
246
- * @param null|array $allowed If an array, defines the set of allowed values for the element.
247
  * @param null|string $nested_key If not null, the element will be taken from $source[$nested_key][$element_name].
248
  * @return array Updated source array.
249
  * @since 2.1
@@ -251,13 +251,13 @@ class Toolset_Field_Type_Definition {
251
  protected function sanitize_element_isset( $source, $element_name, $default = '', $allowed = null, $nested_key = null ) {
252
  $src_array = ( null == $nested_key ? $source : $source[ $nested_key ] );
253
  $value = toolset_getarr( $src_array, $element_name, $default, $allowed );
254
-
255
  if( null == $nested_key ) {
256
  $source[ $element_name ] = $value;
257
  } else {
258
  $source[ $nested_key ][ $element_name ] = $value;
259
  }
260
-
261
  return $source;
262
  }
263
 
@@ -309,6 +309,9 @@ class Toolset_Field_Type_Definition {
309
  case Toolset_Field_Type_Definition_Factory::SKYPE:
310
  return new Toolset_Field_Renderer_Preview_Skype( $field, $renderer_args );
311
 
 
 
 
312
  default:
313
  return new Toolset_Field_Renderer_Preview_Textfield( $field, $renderer_args );
314
  break;
101
 
102
  /**
103
  * Retrieve CSS classes for a field type icon.
104
+ *
105
  * To be placed in the i tag.
106
+ *
107
  * @return string One or more CSS classes separated by spaces.
108
  * @since 2.0
109
  */
112
  if( null != $fa_class ) {
113
  return sprintf( 'fa fa-%s', esc_attr( $fa_class ) );
114
  }
115
+
116
  $types_class = $this->get_args( 'types-field-image', null );
117
  if( null != $types_class ) {
118
  return sprintf( 'types-field-icon types-field-icon-%s', esc_attr( $types_class ) );
119
  }
120
+
121
+ return '';
122
  }
123
 
124
 
125
  /**
126
  * Perform field type-specific sanitization of the field definition array.
127
+ *
128
  * @link https://git.onthegosystems.com/toolset/types/wikis/database-layer/field-definition-arrays
129
  * @param $definition_array
130
  * @return array Sanitized definition array
175
 
176
  /**
177
  * Make sure that the field definition array contains all necessary information.
178
+ *
179
  * Note: This is a WIP, currently it sanitizes only very specific cases. It should be extended in the future.
180
  *
181
  * @link https://git.onthegosystems.com/toolset/types/wikis/database-layer/field-definition-arrays
199
  $definition_array = $this->sanitize_field_definition_array_generic( $definition_array );
200
 
201
  $definition_array = $this->sanitize_numeric_validation( $definition_array );
202
+
203
  $definition_array = $this->sanitize_field_definition_array_type_specific( $definition_array );
204
+
205
  /**
206
  * types_post_sanitize_field_definition_array
207
  *
212
  * @since 2.1
213
  */
214
  $definition_array = toolset_ensarr( apply_filters( 'types_post_sanitize_field_definition_array', $definition_array ) );
215
+
216
  return $definition_array;
217
  }
218
 
219
 
220
  /**
221
  * For all fields, remove the "number" validation option.
222
+ *
223
  * Numeric field will override this and do the opposite instead.
224
+ *
225
  * @param array $definition_array
226
  * @return array
227
  * @since 2.0
239
 
240
  /**
241
  * Perform a basic "isset" sanitization of an array element.
242
+ *
243
+ * @param array $source
244
  * @param string $element_name Name of the element to sanitize.
245
  * @param string $default Default value for the element if not set or invalid.
246
+ * @param null|array $allowed If an array, defines the set of allowed values for the element.
247
  * @param null|string $nested_key If not null, the element will be taken from $source[$nested_key][$element_name].
248
  * @return array Updated source array.
249
  * @since 2.1
251
  protected function sanitize_element_isset( $source, $element_name, $default = '', $allowed = null, $nested_key = null ) {
252
  $src_array = ( null == $nested_key ? $source : $source[ $nested_key ] );
253
  $value = toolset_getarr( $src_array, $element_name, $default, $allowed );
254
+
255
  if( null == $nested_key ) {
256
  $source[ $element_name ] = $value;
257
  } else {
258
  $source[ $nested_key ][ $element_name ] = $value;
259
  }
260
+
261
  return $source;
262
  }
263
 
309
  case Toolset_Field_Type_Definition_Factory::SKYPE:
310
  return new Toolset_Field_Renderer_Preview_Skype( $field, $renderer_args );
311
 
312
+ case Toolset_Field_Type_Definition_Factory::POST:
313
+ return new Toolset_Field_Renderer_Preview_Post( $field, $renderer_args );
314
+
315
  default:
316
  return new Toolset_Field_Renderer_Preview_Textfield( $field, $renderer_args );
317
  break;
vendor/toolset/toolset-common/inc/autoloaded/field/type/definition_factory.php CHANGED
@@ -31,7 +31,8 @@ class Toolset_Field_Type_Definition_Factory {
31
  const URL = 'url';
32
  const VIDEO = 'video';
33
  const WYSIWYG = 'wysiwyg';
34
-
 
35
  private static $instance = null;
36
 
37
  private function __construct() { }
@@ -139,7 +140,7 @@ class Toolset_Field_Type_Definition_Factory {
139
 
140
  /**
141
  * Create the proper instance of a type definition class, based on the type slug.
142
- *
143
  * @param string $field_type_slug
144
  * @param array $field_type_configuration Legacy configuration array
145
  *
@@ -213,7 +214,7 @@ class Toolset_Field_Type_Definition_Factory {
213
 
214
  /**
215
  * Get a map of all field definition slugs to their properties.
216
- *
217
  * @return string[]
218
  * @since 2.0
219
  */
@@ -247,4 +248,4 @@ class Toolset_Field_Type_Definition_Factory {
247
  // ends in an error because of parents (abstract) $var = new self();
248
  return Toolset_Field_Type_Definition_Factory::get_instance()->load_field_type_definition( $field_type_slug );
249
  }
250
- }
31
  const URL = 'url';
32
  const VIDEO = 'video';
33
  const WYSIWYG = 'wysiwyg';
34
+ const POST = 'post';
35
+
36
  private static $instance = null;
37
 
38
  private function __construct() { }
140
 
141
  /**
142
  * Create the proper instance of a type definition class, based on the type slug.
143
+ *
144
  * @param string $field_type_slug
145
  * @param array $field_type_configuration Legacy configuration array
146
  *
214
 
215
  /**
216
  * Get a map of all field definition slugs to their properties.
217
+ *
218
  * @return string[]
219
  * @since 2.0
220
  */
248
  // ends in an error because of parents (abstract) $var = new self();
249
  return Toolset_Field_Type_Definition_Factory::get_instance()->load_field_type_definition( $field_type_slug );
250
  }
251
+ }
vendor/toolset/toolset-common/inc/autoloaded/i_query.php DELETED
@@ -1,16 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Generic interface for queries.
5
- *
6
- * @since m2m
7
- */
8
- interface IToolset_Query {
9
-
10
-
11
- /**
12
- * @return array
13
- */
14
- public function get_results();
15
-
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/toolset/toolset-common/inc/autoloaded/interop/handler/installer_compatibility_reporting.php ADDED
@@ -0,0 +1,315 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OTGS\Toolset\Common\Interop\Handler;
4
+
5
+ use OTGS\Toolset\Common\Condition\Installer as installerCondition;
6
+ use OTGS\Toolset\Common\Interop\HandlerInterface;
7
+
8
+ /**
9
+ * Display the Installer's Compatibility Reporting setting wherever necessary.
10
+ *
11
+ * Specifically, we show it:
12
+ * - as a section in Toolset Settings (General tab)
13
+ * - as a first step if the clicks on the Register button on the repository listing page (Commercial tab)
14
+ * - as a orange Toolset notice if the user didn't make any choice yet
15
+ *
16
+ * @package OTGS\Toolset\Common\Interop\Handler
17
+ * @since 2.8
18
+ */
19
+ class InstallerCompatibilityReporting implements HandlerInterface {
20
+
21
+
22
+ /** @var string Slug of the Toolset Settings section */
23
+ const SECTION_SLUG = 'toolset-installer-component-settings';
24
+
25
+ /** @var string ID of the Installer repository where we need to show the settings. */
26
+ const REPOSITORY_ID = 'toolset';
27
+
28
+ /** @var string ID of the admin notice. */
29
+ const NOTICE_ID = 'toolset-requires-installer-compatibility-reporting-setup';
30
+
31
+ // Different contexts used for rendering slightly different output.
32
+ const CONTEXT_TOOLSET_SETTINGS = 'toolset_settings';
33
+
34
+ const CONTEXT_REPOSITORY_LISTING = 'repository_listing';
35
+
36
+ const CONTEXT_ADMIN_NOTICE = 'admin_notice';
37
+
38
+
39
+ /** @var installerCondition\IsAvailable */
40
+ private $is_installer_available_condition;
41
+
42
+
43
+ /** @var installerCondition\IsToolsetSubscriptionValid */
44
+ private $is_toolset_subscription_valid_condition;
45
+
46
+
47
+ /**
48
+ * InstallerCompatibilityReporting constructor.
49
+ *
50
+ * @param installerCondition\IsAvailable|null $is_installer_available_di
51
+ * @param installerCondition\IsToolsetSubscriptionValid|null $is_toolset_subscription_valid_di
52
+ */
53
+ public function __construct(
54
+ installerCondition\IsAvailable $is_installer_available_di = null,
55
+ installerCondition\IsToolsetSubscriptionValid $is_toolset_subscription_valid_di = null
56
+ ) {
57
+ $this->is_installer_available_condition = $is_installer_available_di ?: new installerCondition\IsAvailable();
58
+ $this->is_toolset_subscription_valid_condition = $is_toolset_subscription_valid_di ?: new installerCondition\IsToolsetSubscriptionValid();
59
+ }
60
+
61
+
62
+ /**
63
+ * Hook into proper actions.
64
+ *
65
+ * This expects to be run during Toolset Common initialization.
66
+ */
67
+ public function initialize() {
68
+
69
+ // Do nothing if there is no installer.
70
+ if( ! $this->is_installer_available_condition->is_met() ) {
71
+ return;
72
+ }
73
+
74
+ $that = $this;
75
+ $is_subscription_valid_condition = $this->is_toolset_subscription_valid_condition;
76
+
77
+ // Add the options for sending compatibility reports to the Toolset repository on the Installer's Commercial
78
+ // Plugins page.
79
+ add_filter( 'otgs_installer_repository_registration_steps', function ( $registration_steps, $repository_id ) use ( $that ) {
80
+ if ( self::REPOSITORY_ID === $repository_id ) {
81
+ $content = __( 'Choose if Toolset plugins should send reports about the active theme and plugins to toolset.com.', 'wpv-views' )
82
+ . $that->build_content( self::CONTEXT_REPOSITORY_LISTING )
83
+ . '* ' . __( 'These reports, if you decide to send them, will allow Toolset team to give you faster support. We will also use this information to send you alerts about potential compatibility issues with the theme and plugins that you use.', 'wpv-views' );
84
+
85
+ array_unshift( $registration_steps, $content );
86
+ }
87
+
88
+ return $registration_steps;
89
+ }, 10, 2 );
90
+
91
+ // Add a custom settings section.
92
+ // Note the priority. 9 means it will come before other usually present sections.
93
+ add_filter(
94
+ 'toolset_filter_toolset_register_settings_general_section',
95
+ function ( $sections ) use ( $that, $is_subscription_valid_condition ) {
96
+ if ( $is_subscription_valid_condition->is_met() ) {
97
+ $sections = $that->build_section( $sections );
98
+ }
99
+ return $sections;
100
+ },
101
+ 9
102
+ );
103
+
104
+ // Show the admin notice if the setting is still missing and the site has a valid Toolset subscription.
105
+ // If the subscription is not valid, the user will need to go through the registration steps will
106
+ // most probably save the setting there.
107
+ add_action( 'admin_init', function () use ( $that, $is_subscription_valid_condition ) {
108
+ if ( ! $that->has_setting() && $is_subscription_valid_condition->is_met() ) {
109
+ $that->show_notice();
110
+ }
111
+ } );
112
+ }
113
+
114
+
115
+ /**
116
+ * Build the content of the setting section, coming from Installer.
117
+ *
118
+ * Note that this may also cause Installer to enqueue some assets.
119
+ *
120
+ * @param string $context One of the CONTEXT_ constants.
121
+ *
122
+ * @return string HTML markup.
123
+ */
124
+ public function build_content( $context ) {
125
+ ob_start();
126
+
127
+ do_action(
128
+ 'otgs_installer_render_local_components_setting',
129
+ array(
130
+ 'plugin_name' => 'Toolset',
131
+ 'use_styles' => true, //Styles not defined yet
132
+ 'use_radio' => true,
133
+ 'privacy_policy_url' => $this->get_privacy_policy_url( $context ),
134
+ 'plugin_uri' => 'https://toolset.com',
135
+ 'plugin_repository' => self::REPOSITORY_ID,
136
+ )
137
+ );
138
+
139
+ return ob_get_clean();
140
+
141
+ }
142
+
143
+
144
+ /**
145
+ * @param string $context One of the CONTEXT_ constants.
146
+ *
147
+ * @return string URL
148
+ */
149
+ private function get_privacy_policy_url( $context ) {
150
+ switch ( $context ) {
151
+ case self::CONTEXT_ADMIN_NOTICE:
152
+ $utm_medium = 'compatibility-message';
153
+ break;
154
+ case self::CONTEXT_REPOSITORY_LISTING:
155
+ $utm_medium = 'commercial-tab';
156
+ break;
157
+ case self::CONTEXT_TOOLSET_SETTINGS:
158
+ default:
159
+ $utm_medium = 'compatibility-settings';
160
+ break;
161
+ }
162
+
163
+ return sprintf(
164
+ 'https://toolset.com/privacy-policy-and-gdpr-compliance/?utm_source=typesplugin&utm_campaign=compatibility-reporting&utm_medium=%s&utm_term=privacy-policy-and-gdpr-compliance',
165
+ $utm_medium
166
+ );
167
+ }
168
+
169
+
170
+ /**
171
+ * Add a new section to the General tab of Toolset Settings.
172
+ *
173
+ * See toolset_filter_toolset_register_settings_general_section for details.
174
+ *
175
+ * @param array $sections
176
+ *
177
+ * @return array
178
+ */
179
+ public function build_section( $sections ) {
180
+ $sections[ self::SECTION_SLUG ] = array(
181
+ 'slug' => self::SECTION_SLUG,
182
+ 'title' => __( 'Fast support and compatibility alerts', 'wpv-views' ),
183
+ 'content' => $this->build_content( self::CONTEXT_TOOLSET_SETTINGS ),
184
+ );
185
+
186
+ return $sections;
187
+ }
188
+
189
+
190
+ /**
191
+ * Check whether the user had aleady made a choice about the compatibility reporting.
192
+ *
193
+ * @return bool
194
+ */
195
+ public function has_setting() {
196
+ return (bool) apply_filters( 'otgs_installer_has_local_components_setting', null, 'toolset' );
197
+ }
198
+
199
+
200
+ /**
201
+ * Build and register the admin notice that alerts about the missing setting of compatibility reporting.
202
+ */
203
+ public function show_notice() {
204
+ $builder = new \OTGS\Toolset\Common\Utility\Admin\Notices\Builder();
205
+
206
+ $notice = $builder->createNotice( self::NOTICE_ID, 'undismissible' );
207
+ $notice->set_is_only_for_administrators( true );
208
+ $notice->set_template_path( TOOLSET_COMMON_PATH . '/templates/admin/notice/installer/compatibility-reporting-setting-needed.phtml' );
209
+ $notice->set_template_context( array(
210
+ 'policy_url' => $this->get_privacy_policy_url( self::CONTEXT_ADMIN_NOTICE ),
211
+ ) );
212
+
213
+ $that = $this;
214
+
215
+ // Enqueue assets only if the notice is actually about to be rendered.
216
+ $notice->add_dependency_callback( function () use ( $that ) {
217
+ $asset_manager = \Toolset_Assets_Manager::get_instance();
218
+ $asset_manager->enqueue_styles( \Toolset_Assets_Manager::STYLE_FONT_AWESOME );
219
+ $asset_manager->enqueue_scripts( \Toolset_Assets_Manager::SCRIPT_UTILS );
220
+ add_action( 'admin_print_footer_scripts', array( $that, 'print_notice_script' ) );
221
+ } );
222
+
223
+ $builder->addNotice( $notice );
224
+ }
225
+
226
+
227
+ /**
228
+ * Print additional script that controls the admin notice behaviour.
229
+ *
230
+ * - Allow to save the setting via yes/no buttons
231
+ * - Hide the notice when the setting is saved, via AJAX or elsewhere on the page
232
+ * - Reload the page if the setting was saved from the notice but there are other instances
233
+ * of the setting elsewhere on the page.
234
+ *
235
+ * Note: Deliberately not putting this into a template, to keep all the functionality in a single class.
236
+ * Basically, it handles a special case and this way we don't have to think about this case outside
237
+ * of the class.
238
+ */
239
+ public function print_notice_script() {
240
+
241
+ // Fallback in case changes have been made in Installer. In the worst case, the action will not work.
242
+ $action_name = 'otgs_save_setting_share_local_components';
243
+ if ( defined( '\OTGS_Installer_WP_Components_Setting_Ajax::AJAX_ACTION' ) ) {
244
+ $action_name = \OTGS_Installer_WP_Components_Setting_Ajax::AJAX_ACTION;
245
+ }
246
+
247
+ $nonce = wp_create_nonce( $action_name );
248
+
249
+ ?>
250
+ <script type="text/javascript">
251
+ jQuery(document).ready(function () {
252
+
253
+ var hideNotice = function () {
254
+ jQuery('div.toolset-notice-installer-compatibility-setting').fadeOut(500);
255
+ };
256
+
257
+ var applyChoice = function (choice) {
258
+ var $spinner = jQuery('.toolset-notice-installer-compatibility-setting__spinner');
259
+ WPV_Toolset.Utils.Spinner.show($spinner);
260
+
261
+ var finishProcess = function () {
262
+ var hasAnotherSettingOnPage = (0 < jQuery('.otgs-installer-component-setting input[type="radio"]').length);
263
+ // Reload the page if it contains the same setting in a different GUI. That way, that GUI will get in sync
264
+ // with the updated option. Not the most fancy solution, but this will happen very very rarely.
265
+ if (hasAnotherSettingOnPage) {
266
+ location.reload();
267
+ } else {
268
+ WPV_Toolset.Utils.Spinner.hide($spinner);
269
+ }
270
+ };
271
+
272
+ var failCallback = function () {
273
+ jQuery('.toolset-notice-installer-compatibility-setting__error').text('<?php _e( 'An error happened when saving the setting.', 'wpv-views' ); ?>');
274
+ finishProcess();
275
+ };
276
+
277
+ // Store the user's choice. Using directly an AJAX call in Installer.
278
+ jQuery.post({
279
+ async: true,
280
+ url: ajaxurl,
281
+ data: {
282
+ action: '<?php echo $action_name ?>',
283
+ nonce: '<?php echo $nonce ?>',
284
+ agree: (choice ? 1 : 0),
285
+ repo: '<?php echo self::REPOSITORY_ID ?>'
286
+ },
287
+ success: function () {
288
+ // Unfortunately, the AJAX call from Installer doesn't return any result. We have to hope.
289
+ hideNotice();
290
+ finishProcess();
291
+ },
292
+ error: failCallback
293
+ })
294
+ };
295
+
296
+ jQuery(document).on('click', '.toolset-notice-installer-compatibility-setting__accept-btn', function (e) {
297
+ e.preventDefault();
298
+ applyChoice(true);
299
+ });
300
+
301
+ jQuery(document).on('click', '.toolset-notice-installer-compatibility-setting__decline-btn', function (e) {
302
+ e.preventDefault();
303
+ applyChoice(false);
304
+ });
305
+
306
+ // If the user makes the choice in another place, e.g. the Commercial tab or Toolset Settings, we just hide the notice.
307
+ jQuery(document).on('click', '.otgs-installer-component-setting input[type="radio"]', function () {
308
+ hideNotice();
309
+ });
310
+ });
311
+ </script>
312
+ <?php
313
+ }
314
+
315
+ }
vendor/toolset/toolset-common/inc/autoloaded/interop/handler_interface.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OTGS\Toolset\Common\Interop;
4
+
5
+ /**
6
+ * Describes a class that handles interoperability issues with third-party software.
7
+ *
8
+ * @package OTGS\Toolset\Common\Interop
9
+ * @since 2.8
10
+ */
11
+ interface HandlerInterface {
12
+
13
+ public function initialize();
14
+
15
+ }
vendor/toolset/toolset-common/inc/autoloaded/interop/mediator.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OTGS\Toolset\Common\Interop;
4
+
5
+ use OTGS\Toolset\Common\Interop\Handler as handler;
6
+
7
+ /**
8
+ * Interoperability mediator.
9
+ *
10
+ * Handle any interop tasks with non-Toolset software - including Installer, but excluding WPML (WPML plugins are
11
+ * handled in the Toolset_WPML_Compatibility class).
12
+ *
13
+ * @package OTGS\Toolset\Common\Interop
14
+ * @since 2.8
15
+ */
16
+ class Mediator {
17
+
18
+ public function initialize() {
19
+ // If the class gets more complex, split it into subclasses, using the same design as in Types_Interop_Mediator.
20
+ $installer_compatibility_reporting = new handler\InstallerCompatibilityReporting();
21
+ $installer_compatibility_reporting->initialize();
22
+ }
23
+
24
+ }
vendor/toolset/toolset-common/inc/autoloaded/maintenance_mode/controller.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OTGS\Toolset\Common\MaintenanceMode;
4
+
5
+ /**
6
+ * Control (enable or disable) the WordPress maintenance mode.
7
+ *
8
+ * @package OTGS\Toolset\Common\MaintenanceMode
9
+ * @since 2.6.8
10
+ */
11
+ class Controller {
12
+
13
+
14
+ private function get_maintenance_file_path() {
15
+ return ABSPATH . '/.maintenance';
16
+ }
17
+
18
+
19
+ /**
20
+ * Note that an existing file doesn't mean the maintenance mode is active - it can also be expired.
21
+ *
22
+ * @return bool
23
+ */
24
+ public function maintenance_file_exists() {
25
+ return file_exists( $this->get_maintenance_file_path() );
26
+ }
27
+
28
+
29
+ /**
30
+ * Create the content of the .maintenance file.
31
+ *
32
+ * @param bool $allow_backend Allow access to backend - wp-admin/ and wp-login.php, but not AJAX calls.
33
+ * @param bool $allow_ajax Allow AJAX calls.
34
+ * @param bool $for_infinity If true, the maintenance mode will never expire. Otherwise, it will expire
35
+ * based on WordPress core logic (10min).
36
+ *
37
+ * @return bool|string Content of the .maintenance file or false on failure.
38
+ */
39
+ private function build_maintenance_file( $allow_backend = true, $allow_ajax = false, $for_infinity = false ) {
40
+ $template = \Toolset_Output_Template_Repository::get_instance()->get( \Toolset_Output_Template_Repository::MAINTENANCE_FILE );
41
+
42
+ $context = array(
43
+ 'allow_backend' => $allow_backend,
44
+ 'allow_ajax' => $allow_ajax,
45
+ 'upgrading_time' => ( $for_infinity ? 'time()' : time() )
46
+ );
47
+
48
+ try {
49
+ $output = \Toolset_Renderer::get_instance()->render( $template, $context, false );
50
+ } catch ( \Exception $e ) {
51
+ return false;
52
+ }
53
+
54
+ return $output;
55
+ }
56
+
57
+
58
+ /**
59
+ * Enable the maintenance mode.
60
+ *
61
+ * Note: If it's already active, the method will fail.
62
+ *
63
+ * @param bool $allow_backend Allow access to backend - wp-admin/ and wp-login.php, but not AJAX calls.
64
+ * @param bool $allow_ajax Allow AJAX calls.
65
+ * @param bool $for_infinity If true, the maintenance mode will never expire. Otherwise, it will expire
66
+ * based on WordPress core logic (10min).
67
+ *
68
+ * @return \Toolset_Result
69
+ */
70
+ public function enable( $allow_backend = true, $allow_ajax = false, $for_infinity = false ) {
71
+ if( $this->maintenance_file_exists() ) {
72
+ return new \Toolset_Result( false, __( 'Maintenance mode is already active (.maintenance file present).', 'wpcf' ) );
73
+ }
74
+
75
+ $content = $this->build_maintenance_file( $allow_backend, $allow_ajax, $for_infinity );
76
+
77
+ if( false === $content ) {
78
+ return new \Toolset_Result( false, __( 'Unable to process the template for the ".maintenance" file.', 'wpcf' ) );
79
+ }
80
+
81
+ $result = file_put_contents( $this->get_maintenance_file_path(), $content );
82
+
83
+ if( false === $result ) {
84
+ return new \Toolset_Result( false, __( 'Couldn\'t write to the ".maintenance" file.', 'wpcf' ) );
85
+ }
86
+
87
+ return new \Toolset_Result( true, __( 'Maintenance mode enabled.', 'wpcf' ) );
88
+ }
89
+
90
+
91
+ /**
92
+ * Disable the maintenance mode.
93
+ *
94
+ * Note: If it's not enabled, the method will fail.
95
+ *
96
+ * @return \Toolset_Result
97
+ */
98
+ public function disable() {
99
+ if( ! $this->maintenance_file_exists() ) {
100
+ return new \Toolset_Result( false, __( 'Maintenance mode is already disabled.', 'wpcf' ) );
101
+ }
102
+
103
+ $result = unlink( $this->get_maintenance_file_path() );
104
+
105
+ if( false === $result ) {
106
+ return new \Toolset_Result( false, __( 'Unable to delete the ".maintenance" file.', 'wpcf' ) );
107
+ }
108
+
109
+ return new \Toolset_Result( true, __( 'Maintenance mode disabled.', 'wpcf' ) );
110
+ }
111
+
112
+ }
vendor/toolset/toolset-common/inc/autoloaded/post_type/abstract.php CHANGED
@@ -79,25 +79,32 @@ abstract class Toolset_Post_Type_Abstract implements IToolset_Post_Type {
79
 
80
  /**
81
  * @inheritdoc
82
- * @return bool
83
  */
84
  public function can_be_used_in_relationship() {
 
 
 
 
 
85
  if( ! $this->get_wpml_compatibility()->is_wpml_active_and_configured() ) {
86
  // no wpml = no limitations on relationships
87
- return true;
88
  }
89
 
90
  if( ! $this->is_translatable() ) {
91
  // no translation mode selected = all good
92
- return true;
93
  }
94
 
95
  if( $this->is_in_display_as_translated_mode() ) {
96
  // "display as translated" mode selected = all good
97
- return true;
98
  }
99
 
100
- return false;
 
 
101
  }
102
 
103
 
@@ -122,4 +129,4 @@ abstract class Toolset_Post_Type_Abstract implements IToolset_Post_Type {
122
  return ( count( $results ) > 0 );
123
  }
124
 
125
- }
79
 
80
  /**
81
  * @inheritdoc
82
+ * @return Toolset_Result
83
  */
84
  public function can_be_used_in_relationship() {
85
+ if ( 'attachment' == $this->get_slug() ) {
86
+ // Media post type can be used in relationships.
87
+ return new Toolset_Result( false, __( 'Media post type can not be part of a relationship.') );
88
+ }
89
+
90
  if( ! $this->get_wpml_compatibility()->is_wpml_active_and_configured() ) {
91
  // no wpml = no limitations on relationships
92
+ return new Toolset_Result( true );
93
  }
94
 
95
  if( ! $this->is_translatable() ) {
96
  // no translation mode selected = all good
97
+ return new Toolset_Result( true );
98
  }
99
 
100
  if( $this->is_in_display_as_translated_mode() ) {
101
  // "display as translated" mode selected = all good
102
+ return new Toolset_Result( true );
103
  }
104
 
105
+ // at the end, we've decided to allow any translation mode for relationships
106
+ return new Toolset_Result( true );
107
+ // return new Toolset_Result( false, __( 'This post type uses the <strong>Translatable - only show translated items</strong> WPML translation mode. In order to use it in a relationship, switch to <strong>Translatable - use translation if available or fallback to default language</strong> mode.', 'wpcf' ) );
108
  }
109
 
110
 
129
  return ( count( $results ) > 0 );
130
  }
131
 
132
+ }
vendor/toolset/toolset-common/inc/autoloaded/post_type/excluded_list.php CHANGED
@@ -8,23 +8,24 @@
8
  class Toolset_Post_Type_Exclude_List {
9
 
10
  private static $initial_list = array(
11
- 'cred-form',
12
- 'cred-user-form',
13
- 'cred_rel_form',
 
 
 
 
 
 
14
  'custom_css',
15
  'customize_changeset',
16
- 'dd_layouts',
17
  'deprecated_log',
18
  'mediapage',
19
  'nav_menu_item',
20
  'revision',
21
- 'view',
22
- 'view-template',
23
- 'wp-types-group',
24
- 'wp-types-user-group',
25
- 'wp-types-term-group',
26
  'acf-field-group',
27
- 'acf'
 
28
  );
29
 
30
 
8
  class Toolset_Post_Type_Exclude_List {
9
 
10
  private static $initial_list = array(
11
+ Toolset_Post_Type_List::CRED_POST_FORM,
12
+ Toolset_Post_Type_List::CRED_USER_FORM,
13
+ Toolset_Post_Type_List::CRED_RELATIONSHIP_FORM,
14
+ Toolset_Post_Type_List::LAYOUT,
15
+ Toolset_Post_Type_List::VIEW_OR_WPA,
16
+ Toolset_Post_Type_List::CONTENT_TEMPLATE,
17
+ Toolset_Post_Type_List::POST_FIELD_GROUP,
18
+ Toolset_Post_Type_List::USER_FIELD_GROUP,
19
+ Toolset_Post_Type_List::TERM_FIELD_GROUP,
20
  'custom_css',
21
  'customize_changeset',
 
22
  'deprecated_log',
23
  'mediapage',
24
  'nav_menu_item',
25
  'revision',
 
 
 
 
 
26
  'acf-field-group',
27
+ 'acf',
28
+ 'otgs_ps_bundles',
29
  );
30
 
31
 
vendor/toolset/toolset-common/inc/autoloaded/post_type/from_types.php CHANGED
@@ -326,6 +326,19 @@ class Toolset_Post_Type_From_Types extends Toolset_Post_Type_Abstract implements
326
  }
327
 
328
 
 
 
 
 
 
 
 
 
 
 
 
 
 
329
  /**
330
  * @inheritdoc
331
  * @return bool
@@ -484,7 +497,7 @@ class Toolset_Post_Type_From_Types extends Toolset_Post_Type_Abstract implements
484
  public function set_is_repeating_field_group( $value ) {
485
  $this->set_flag_to_definition( self::DEF_IS_REPEATING_FIELD_GROUP, (bool) $value );
486
  if ( $value ) {
487
- $this->definition['supports'] = array( 'post_title', 'author', 'custom-fields', 'revisions' );
488
  }
489
  $this->set_is_public( false );
490
  }
326
  }
327
 
328
 
329
+ /**
330
+ * @param IToolset_Post_Type_Registered $registered_post_type
331
+ * @since 2.6.3
332
+ */
333
+ public function set_registered_post_type( IToolset_Post_Type_Registered $registered_post_type ) {
334
+ if( $registered_post_type->get_slug() !== $this->get_slug() ) {
335
+ throw new InvalidArgumentException();
336
+ }
337
+
338
+ $this->registered_post_type = $registered_post_type;
339
+ }
340
+
341
+
342
  /**
343
  * @inheritdoc
344
  * @return bool
497
  public function set_is_repeating_field_group( $value ) {
498
  $this->set_flag_to_definition( self::DEF_IS_REPEATING_FIELD_GROUP, (bool) $value );
499
  if ( $value ) {
500
+ $this->definition['supports'] = array( 'post_title' => 1, 'author' => 1, 'custom-fields' => 1 );
501
  }
502
  $this->set_is_public( false );
503
  }
vendor/toolset/toolset-common/inc/autoloaded/post_type/i_post_type.php CHANGED
@@ -120,7 +120,7 @@ interface IToolset_Post_Type {
120
  /**
121
  * Check if the post type can be used in a relationship.
122
  *
123
- * @return bool
124
  * @since 2.5.10
125
  */
126
  public function can_be_used_in_relationship();
@@ -135,4 +135,4 @@ interface IToolset_Post_Type {
135
  * @since 2.5.11
136
  */
137
  public function is_involved_in_relationship();
138
- }
120
  /**
121
  * Check if the post type can be used in a relationship.
122
  *
123
+ * @return Toolset_Result
124
  * @since 2.5.10
125
  */
126
  public function can_be_used_in_relationship();
135
  * @since 2.5.11
136
  */
137
  public function is_involved_in_relationship();
138
+ }
vendor/toolset/toolset-common/inc/autoloaded/post_type/i_post_type_from_types.php CHANGED
@@ -84,4 +84,18 @@ interface IToolset_Post_Type_From_Types extends IToolset_Post_Type {
84
  * @return bool Corresponds with the disabled status of the post type.
85
  */
86
  public function is_disabled();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  }
84
  * @return bool Corresponds with the disabled status of the post type.
85
  */
86
  public function is_disabled();
87
+
88
+
89
+ /**
90
+ * @return IToolset_Post_Type_Registered|null
91
+ * @since 2.6.3
92
+ */
93
+ public function get_registered_post_type();
94
+
95
+
96
+ /**
97
+ * @param IToolset_Post_Type_Registered $registered_post_type
98
+ * @since 2.6.3
99
+ */
100
+ public function set_registered_post_type( IToolset_Post_Type_Registered $registered_post_type );
101
  }
vendor/toolset/toolset-common/inc/autoloaded/post_type/list.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Enum class for holding a list of special, well-known post types.
5
+ *
6
+ * @since 2.6.4
7
+ */
8
+ abstract class Toolset_Post_Type_List {
9
+
10
+ const VIEW_OR_WPA = 'view';
11
+ const CONTENT_TEMPLATE = 'view-template';
12
+
13
+ const POST_FIELD_GROUP = 'wp-types-group';
14
+ const USER_FIELD_GROUP = 'wp-types-user-group';
15
+ const TERM_FIELD_GROUP = 'wp-types-term-group';
16
+
17
+ const CRED_POST_FORM = 'cred-form';
18
+ const CRED_USER_FORM = 'cred-user-form';
19
+ const CRED_RELATIONSHIP_FORM = 'cred_rel_form';
20
+
21
+ const LAYOUT = 'dd_layouts';
22
+
23
+ const ATTACHMENT = 'attachment';
24
+
25
+ }
vendor/toolset/toolset-common/inc/autoloaded/post_type/repository.php CHANGED
@@ -73,9 +73,24 @@ class Toolset_Post_Type_Repository {
73
 
74
  $this->post_types = $this->load_all_post_types();
75
 
 
 
 
 
 
 
 
 
76
  $this->is_initialized = true;
77
  }
78
 
 
 
 
 
 
 
 
79
  /**
80
  * Load all post types known on the site
81
  *
@@ -91,6 +106,33 @@ class Toolset_Post_Type_Repository {
91
  return $post_types;
92
  }
93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  /**
95
  * Load post types currently registered on the site.
96
  *
@@ -127,7 +169,7 @@ class Toolset_Post_Type_Repository {
127
  */
128
  private function load_post_types_from_types( $registered_post_types ) {
129
 
130
- $custom_types = get_option( self::POST_TYPES_OPTION_NAME, array() );
131
 
132
  $results = $registered_post_types;
133
  foreach ( $custom_types as $slug => $definition ) {
73
 
74
  $this->post_types = $this->load_all_post_types();
75
 
76
+ if( ! did_action( 'init' ) ) {
77
+ // Run immediately after CPTs have been registered by Types.
78
+ //
79
+ // This is necessary if the post type repository gets initialized too early
80
+ // and does the initial loading before CPTs in Types are registered (at init:10 or earlier).
81
+ add_action( 'init', array( $this, 'finish_loading_registered_post_types' ), 11 );
82
+ }
83
+
84
  $this->is_initialized = true;
85
  }
86
 
87
+ /**
88
+ * Reloads all post types to the repository
89
+ */
90
+ public function refresh_all_post_types() {
91
+ $this->post_types = $this->load_all_post_types();
92
+ }
93
+
94
  /**
95
  * Load all post types known on the site
96
  *
106
  return $post_types;
107
  }
108
 
109
+
110
+ /**
111
+ * Load registered post types again and add them where they are missing:
112
+ *
113
+ * - if the CPT is defined in Types, add it to the IToolset_Post_Type_From_Types object (which will
114
+ * let the CPT object know that it's registered (== active))
115
+ * - if the CPT is not from Types but hasn't been stored in the repository at all, add it.
116
+ *
117
+ * @since 2.6.3
118
+ */
119
+ public function finish_loading_registered_post_types() {
120
+ $post_types = $this->load_registered_post_types();
121
+
122
+ foreach( $post_types as $registered_post_type ) {
123
+ // The post type was newly registered, just add it to the repository.
124
+ if( ! array_key_exists( $registered_post_type->get_slug(), $this->post_types ) ) {
125
+ $this->post_types[ $registered_post_type->get_slug() ] = $registered_post_type;
126
+ }
127
+
128
+ /** @var IToolset_Post_Type_From_Types|IToolset_Post_Type $stored_post_type */
129
+ $stored_post_type = $this->post_types[ $registered_post_type->get_slug() ];
130
+ if( $stored_post_type->is_from_types() ) {
131
+ $stored_post_type->set_registered_post_type( $registered_post_type );
132
+ }
133
+ }
134
+ }
135
+
136
  /**
137
  * Load post types currently registered on the site.
138
  *
169
  */
170
  private function load_post_types_from_types( $registered_post_types ) {
171
 
172
+ $custom_types = toolset_ensarr( get_option( self::POST_TYPES_OPTION_NAME, array() ) );
173
 
174
  $results = $registered_post_types;
175
  foreach ( $custom_types as $slug => $definition ) {
vendor/toolset/toolset-common/inc/autoloaded/postmeta_access/loader.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Hijack xxx_postmeta calls.
5
+ *
6
+ * Depending on the status of the m2m functionality, a proper adjustment class will be instantiated
7
+ * to allow for setting or getting legacy relationship postmeta-based entries.
8
+ *
9
+ * @since m2m
10
+ */
11
+ class Toolset_Postmeta_Access_Loader {
12
+
13
+
14
+ public function initialize() {
15
+
16
+ if( apply_filters( 'toolset_is_m2m_enabled', false ) ) {
17
+ $adjustments = new Toolset_Postmeta_Access_M2m();
18
+ $adjustments->initialize();
19
+ }
20
+
21
+ }
22
+
23
+ }
vendor/toolset/toolset-common/inc/autoloaded/postmeta_access/m2m.php ADDED
@@ -0,0 +1,348 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Hijack add/update/get_post_meta native functions for legacy relationships converted to m2m.
5
+ *
6
+ * This assumes m2m is enabled.
7
+ *
8
+ * See Toolset_Postmeta_Access_Loader for details.
9
+ *
10
+ * @since m2m
11
+ */
12
+ class Toolset_Postmeta_Access_M2m {
13
+
14
+ const KEY_START = '_wpcf_belongs_';
15
+ const KEY_START_LENGTH = 14;
16
+
17
+ const KEY_END = '_id';
18
+ const KEY_END_LENGTH = 3;
19
+
20
+ private $legacy_relationships = null;
21
+
22
+ private $array_filter_args = null;
23
+
24
+ public function initialize() {
25
+ $types_has_legacy_relationships_condition = new Toolset_Condition_Plugin_Types_Has_Legacy_Relationships();
26
+ $types_has_legacy_relationships = $types_has_legacy_relationships_condition->is_met();
27
+
28
+ if (
29
+ ! $types_has_legacy_relationships
30
+ /**
31
+ * Force the initialization of this class.
32
+ *
33
+ * @since m2m
34
+ */
35
+ && ! apply_filters( 'toolset_force_legacy_relationships_meta_access', false )
36
+ ) {
37
+ return;
38
+ }
39
+
40
+ /**
41
+ * Init the legacy postmeta access hooks, at init:11 so Types can register its post types at init:10.
42
+ *
43
+ * @since m2m
44
+ */
45
+ add_action( 'init', array( $this, 'init' ), 11 );
46
+ }
47
+
48
+ /**
49
+ * Init the legacy postmeta access hooks.
50
+ *
51
+ * Note that this legacy layer is only available after init:11 since Types post types are registered at init:10.
52
+ *
53
+ * @since m2m
54
+ */
55
+ public function init() {
56
+ do_action( 'toolset_do_m2m_full_init' );
57
+
58
+ // Cache the legacy relationships, and deactivate the hooks above if needed.
59
+ $this->set_legacy_relationships();
60
+ if ( ! empty( $this->legacy_relationships ) ) {
61
+ // Hijack the native set/update/get posteta functions
62
+ add_action( 'add_post_meta', array( $this, 'add_post_meta' ), 10, 3 );
63
+ add_action( 'update_post_meta', array( $this, 'update_post_meta' ), 10, 4 );
64
+ add_filter( 'get_post_metadata', array( $this, 'get_post_metadata' ), 10, 4 );
65
+ add_filter( 'toolset_postmeta_access_m2m_get_post_metadata', array( $this, 'get_post_metadata' ), 10, 4 );
66
+ }
67
+
68
+ // Deactivate this class hijcking in case there is nothing to hijack
69
+ add_action( 'toolset_deactivate_postmeta_access_m2m', array( $this, 'deactivate_postmeta_access_m2m' ) );
70
+ }
71
+
72
+ /**
73
+ * Transform a postmeta adding action into an association creation.
74
+ *
75
+ * @param $object_id int ID of the object metadata is for
76
+ * @param @meta_key string Metadata key
77
+ * @param $_meta_value mixed Metadata value
78
+ *
79
+ * @since m2m
80
+ */
81
+ public function add_post_meta( $object_id, $meta_key, $_meta_value ) {
82
+ // It has to run update_post_meta because the IPT could exist and needs to be deleted.
83
+ $this->update_post_meta( null, $object_id, $meta_key, $_meta_value );
84
+ }
85
+
86
+ /**
87
+ * Transform a postmeta updating action into an association updating.
88
+ *
89
+ * @param $meta_id int ID of the metadata entry to update
90
+ * @param $object_id int ID of the object metadata is for
91
+ * @param @meta_key string Metadata key
92
+ * @param $_meta_value mixed Metadata value
93
+ *
94
+ * @since m2m
95
+ */
96
+ public function update_post_meta( $meta_id, $object_id, $meta_key, $_meta_value ) {
97
+ $parent_type = $this->get_parent_type_from_meta_key( $meta_key );
98
+ if ( ! $parent_type ) {
99
+ return;
100
+ }
101
+
102
+ if ( ! Toolset_Utils::is_nonnegative_numeric( $_meta_value ) ) {
103
+ return;
104
+ }
105
+
106
+ $child_post_type = get_post_type( $object_id );
107
+ $matching_relationships = $this->get_legacy_relationship( $parent_type, $child_post_type );
108
+
109
+ if ( null === $matching_relationships ) {
110
+ return;
111
+ }
112
+
113
+ $current_relationship = key( $matching_relationships );
114
+ $relationship_definition = isset( $this->legacy_relationships[ $current_relationship ] )
115
+ ? $this->legacy_relationships[ $current_relationship ]['definition']
116
+ : null;
117
+
118
+ if ( null === $relationship_definition ) {
119
+ return;
120
+ }
121
+
122
+ $current_association = $this->get_association( $current_relationship, $object_id );
123
+
124
+ if ( $current_association instanceof Toolset_Association ) {
125
+ if ( $_meta_value === $current_association->get_element_id( Toolset_Relationship_Role::PARENT ) ) {
126
+ // There is an association already for those two items, so do nothing else.
127
+ return;
128
+ }
129
+ $relationship_driver = $relationship_definition->get_driver();
130
+ // Delete the previously existing association between child and any parent in the known relationship, if any.
131
+ $relationship_driver->delete_association( $current_association );
132
+ }
133
+
134
+ // Create an association between child and parent in the known relationship.
135
+ // It should be one2many, so no intermediary fields are required.
136
+ try {
137
+ $relationship_definition->create_association( $_meta_value, $object_id );
138
+ } catch( Exception $e ) {
139
+
140
+ }
141
+ }
142
+
143
+ /**
144
+ * Transform a postmeta getting action into an association get.
145
+ *
146
+ * @param $return ull|array|string The value to return
147
+ * @param $object_id int ID of the object metadata is for
148
+ * @param @meta_key string Metadata key
149
+ * @param $single bool Whether to return only the first value of the specified $meta_key
150
+ *
151
+ * @return mixed Will be an array if $single is false. Will be value of meta data field if $single is true.
152
+ *
153
+ * @since m2m
154
+ */
155
+ public function get_post_metadata( $return, $object_id, $meta_key, $single ) {
156
+ $parent_type = $this->get_parent_type_from_meta_key( $meta_key );
157
+ if ( ! $parent_type ) {
158
+ return $return;
159
+ }
160
+
161
+ $child_post_type = get_post_type( $object_id );
162
+ $matching_relationships = $this->get_legacy_relationship( $parent_type, $child_post_type );
163
+
164
+ if ( null === $matching_relationships ) {
165
+ return $return;
166
+ }
167
+
168
+ $current_relationship = key( $matching_relationships );
169
+ $parent_id = $this->get_association_parent_id( $current_relationship, $object_id );
170
+
171
+ if ( null === $parent_id ) {
172
+ return $single
173
+ ? ''
174
+ : array();
175
+ }
176
+
177
+ return $single
178
+ ? $parent_id
179
+ : array( $parent_id );
180
+ }
181
+
182
+ /**
183
+ * Remove the hooks to postmeta functions, on demand.
184
+ * Fired here when after getting legacy relationships, there is none.
185
+ *
186
+ * @since m2m
187
+ */
188
+ public function deactivate_postmeta_access_m2m() {
189
+ remove_action( 'add_post_meta', array( $this, 'add_post_meta' ), 10, 3 );
190
+ remove_action( 'update_post_meta', array( $this, 'update_post_meta' ), 10, 4 );
191
+ remove_filter( 'get_post_metadata', array( $this, 'get_post_metadata' ), 10, 4 );
192
+ remove_filter( 'toolset_postmeta_access_m2m_get_post_metadata', array( $this, 'get_post_metadata' ), 10, 4 );
193
+ }
194
+
195
+ /**
196
+ * Check whether a given postmeta key matches the _wpcf_belongs_{slug}_id structure,
197
+ * and return the parent post type slug if available.
198
+ *
199
+ * @param $meta_key string The meta key
200
+ *
201
+ * @return bool|string False when the meta key does not match the pattern, the parent type slug otherwise.
202
+ *
203
+ * @since m2m
204
+ */
205
+ private function get_parent_type_from_meta_key( $meta_key ) {
206
+ if ( substr( $meta_key, 0, self::KEY_START_LENGTH ) !== self::KEY_START ) {
207
+ return false;
208
+ }
209
+
210
+ if ( substr( $meta_key, - self::KEY_END_LENGTH ) !== self::KEY_END ) {
211
+ return false;
212
+ }
213
+
214
+ $parent_type = substr( $meta_key, self::KEY_START_LENGTH );
215
+ $parent_type = substr( $parent_type, 0, - self::KEY_END_LENGTH );
216
+ return $parent_type;
217
+ }
218
+
219
+ /**
220
+ * Cache the existing legacy relationships on this site.
221
+ *
222
+ * @note It deactivates the hijacking of postmeta functions if no legacy relationships are found.
223
+ *
224
+ * @since m2m
225
+ */
226
+ private function set_legacy_relationships() {
227
+ if ( null !== $this->legacy_relationships ) {
228
+ return;
229
+ }
230
+
231
+ $relationship_query = new Toolset_Relationship_Query_V2();
232
+ $definitions = $relationship_query
233
+ ->add( $relationship_query->is_legacy( true ) )
234
+ ->get_results();
235
+
236
+
237
+ if ( empty( $definitions ) ) {
238
+ $this->legacy_relationships = array();
239
+ }
240
+
241
+ foreach ( $definitions as $definition ) {
242
+ $this->legacy_relationships[ $definition->get_slug() ] = array(
243
+ 'parent' => $definition->get_parent_type()->get_types(),
244
+ 'child' => $definition->get_child_type()->get_types(),
245
+ 'definition' => $definition
246
+ );
247
+ }
248
+ }
249
+
250
+ /**
251
+ * Get a legacy relationship by its parent and child post types.
252
+ *
253
+ * @param $parent_type string The parent post type slug
254
+ * @param $child_type string The child post type slug
255
+ *
256
+ * @return null|array The list of matching legacy relationships, or null otherwise.
257
+ *
258
+ * @since m2m
259
+ */
260
+ private function get_legacy_relationship( $parent_type, $child_type ) {
261
+ if ( empty( $this->legacy_relationships ) ) {
262
+ return null;
263
+ }
264
+
265
+ $this->array_filter_args = array(
266
+ 'parent' => $parent_type,
267
+ 'child' => $child_type
268
+ );
269
+
270
+ $matching_relationships = array_filter( $this->legacy_relationships, array( $this, 'filter_by_roles' ) );
271
+
272
+ $this->array_filter_args = null;
273
+
274
+ if ( empty( $matching_relationships ) ) {
275
+ return null;
276
+ }
277
+
278
+ return $matching_relationships;
279
+ }
280
+
281
+ /**
282
+ * Helper to filter an array of relationships by its parent and child post types.
283
+ *
284
+ * @param $relationship array
285
+ *
286
+ * @return bool
287
+ *
288
+ * @since m2m
289
+ */
290
+ private function filter_by_roles( $relationship ) {
291
+ return (
292
+ in_array( $this->array_filter_args['parent'], $relationship['parent'] )
293
+ && in_array( $this->array_filter_args['child'], $relationship['child'] )
294
+ );
295
+ }
296
+
297
+ /**
298
+ * Get a specific association given a child, and a relationship.
299
+ * Works because legacy relationships are one-to-many, hence the child can only have one associated parent.
300
+ *
301
+ * @param $elationship_slug string The relationship slug
302
+ * @param $child_id int The child ID
303
+ *
304
+ * @return null|Toolset_Association
305
+ *
306
+ * @since m2m
307
+ */
308
+ private function get_association( $relationshup_slug, $child_id ) {
309
+ $association_query = new Toolset_Association_Query_V2();
310
+ $associations = $association_query
311
+ ->add( $association_query->relationship_slug( $relationshup_slug ) )
312
+ ->limit( 1 )
313
+ ->add( $association_query->element_id_and_domain( $child_id, Toolset_Element_Domain::POSTS, new Toolset_Relationship_Role_Child() ) )
314
+ ->get_results();
315
+
316
+ if ( empty( $associations ) ) {
317
+ return null;
318
+ }
319
+ return reset( $associations );
320
+ }
321
+
322
+ /**
323
+ * Get a specific association parent ID given a child, and a relationship.
324
+ * Works because legacy relationships are one-to-many, hence the child can only have one associated parent.
325
+ *
326
+ * @param $elationship_slug string The relationship slug
327
+ * @param $child_id int The child ID
328
+ *
329
+ * @return null|int
330
+ *
331
+ * @since m2m
332
+ */
333
+ private function get_association_parent_id( $relationshup_slug, $child_id ) {
334
+ $association_query = new Toolset_Association_Query_V2();
335
+ $associations_ids = $association_query
336
+ ->add( $association_query->relationship_slug( $relationshup_slug ) )
337
+ ->return_element_ids( new Toolset_Relationship_Role_Parent() )
338
+ ->limit( 1 )
339
+ ->add( $association_query->element_id_and_domain( $child_id, Toolset_Element_Domain::POSTS, new Toolset_Relationship_Role_Child() ) )
340
+ ->get_results();
341
+
342
+ if ( empty( $associations_ids ) ) {
343
+ return null;
344
+ }
345
+ return reset( $associations_ids );
346
+ }
347
+
348
+ }
vendor/toolset/toolset-common/inc/autoloaded/relationship_service.php CHANGED
@@ -54,7 +54,6 @@ class Toolset_Relationship_Service {
54
  * @param IToolset_Relationship_Definition $relationship
55
  * @param $child_id
56
  * @param null $parent_slug
57
- *s
58
  *
59
  * @return bool|int[]|IToolset_Association[]|IToolset_Element[]
60
  */
@@ -66,20 +65,69 @@ class Toolset_Relationship_Service {
66
  if( ! $this->is_m2m_enabled() ) {
67
  return false;
68
  }
 
 
 
 
 
69
 
70
- $qry_args = array(
71
- Toolset_Association_Query::QUERY_RELATIONSHIP_SLUG => $relationship->get_slug(),
72
- Toolset_Association_Query::QUERY_CHILD_ID => $child_id,
73
- Toolset_Association_Query::OPTION_RETURN => Toolset_Association_Query::RETURN_PARENT_IDS
74
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
 
76
  if ( $parent_slug ) {
77
- $qry_args['parent_query'] = array( 'post_type' => $parent_slug );
 
 
 
 
 
 
 
 
 
78
  }
79
 
80
- return $this->query_association( $qry_args );
81
  }
82
 
 
83
  /**
84
  * Function to find parend id by relationship and child id
85
  *
@@ -97,64 +145,129 @@ class Toolset_Relationship_Service {
97
  if( ! $this->is_m2m_enabled() ) {
98
  return false;
99
  }
100
-
101
- $qry_args = array(
102
- Toolset_Association_Query::QUERY_RELATIONSHIP_SLUG => $relationship->get_slug(),
103
- Toolset_Association_Query::QUERY_PARENT_ID => $parent_id,
104
- Toolset_Association_Query::OPTION_RETURN => Toolset_Association_Query::RETURN_CHILD_IDS
105
- );
106
 
107
  if ( $child_slug ) {
108
- $qry_args[ Toolset_Association_Query::QUERY_CHILD_QUERY ] = array( 'post_type' => $child_slug );
 
 
 
 
 
 
 
 
 
109
  }
110
 
111
- return $this->query_association( $qry_args );
112
  }
113
 
114
  /**
115
  * Function to find intermediary post id by relationship and child id
116
  *
117
  * @param IToolset_Relationship_Definition $relationship
118
- * @param $post_id
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  *
120
  * @return bool|int[]|IToolset_Association[]|IToolset_Element[]
121
  *
 
122
  */
123
- public function find_intermediary_by_relationship_and_child_id( IToolset_Relationship_Definition $relationship, $post_id ) {
 
 
 
 
124
  if( ! $this->is_m2m_enabled() ) {
125
  return false;
126
  }
 
 
 
 
 
127
 
128
- $qry_args = array(
129
- Toolset_Association_Query::QUERY_RELATIONSHIP_SLUG => $relationship->get_slug(),
130
- Toolset_Association_Query::QUERY_CHILD_ID => $post_id,
131
- Toolset_Association_Query::OPTION_RETURN => Toolset_Association_Query::RETURN_ASSOCIATIONS
132
- );
 
 
 
 
 
 
 
133
 
134
- return $this->query_association( $qry_args );
135
  }
136
 
137
  /**
138
  * Function to find intermediary post id by relationship and parent id
139
  *
140
  * @param IToolset_Relationship_Definition $relationship
141
- * @param $post_id
142
  *
143
  * @return bool|int[]|IToolset_Association[]|IToolset_Element[]
144
  *
145
  */
146
- public function find_intermediary_by_relationship_and_parent_id( IToolset_Relationship_Definition $relationship, $post_id ) {
147
  if( ! $this->is_m2m_enabled() ) {
148
  return false;
149
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
 
151
- $qry_args = array(
152
- Toolset_Association_Query::QUERY_RELATIONSHIP_SLUG => $relationship->get_slug(),
153
- Toolset_Association_Query::QUERY_PARENT_ID => $post_id,
154
- Toolset_Association_Query::OPTION_RETURN => Toolset_Association_Query::RETURN_ASSOCIATIONS
155
- );
156
-
157
- return $this->query_association( $qry_args );
158
  }
159
 
160
  /**
@@ -189,21 +302,21 @@ class Toolset_Relationship_Service {
189
  if( ! $this->is_m2m_enabled() ) {
190
  return false;
191
  }
192
-
193
- $children_args = wp_parse_args( $children_args, array(
194
- 'post_type' => 'any',
195
- 'post_status' => 'publish',
196
- 'numberposts' => -1,
197
- 'suppress_filters' => 0,
198
- ) );
199
-
200
- $qry_args = array(
201
- Toolset_Association_Query::QUERY_PARENT_ID => $parent_id,
202
- Toolset_Association_Query::OPTION_RETURN => Toolset_Association_Query::RETURN_CHILD_IDS,
203
- Toolset_Association_Query::QUERY_CHILD_QUERY => $children_args,
204
- );
205
-
206
- return $this->query_association( $qry_args );
207
  }
208
 
209
  /**
@@ -225,41 +338,49 @@ class Toolset_Relationship_Service {
225
  /**
226
  * Find associations (IToolset_Associations[]) by parent id
227
  *
228
- * @param $id
229
  *
230
  * @return IToolset_Association[]
231
  */
232
- private function find_associations_by_parent_id( $id ) {
233
- $qry_args = array(
234
- Toolset_Association_Query::QUERY_PARENT_ID => $id,
235
- Toolset_Association_Query::OPTION_RETURN => Toolset_Association_Query::RETURN_ASSOCIATIONS
236
- );
237
-
238
- $associations_parent = $this->query_association( $qry_args );
 
 
 
 
 
 
239
 
240
- return is_array( $associations_parent )
241
- ? $associations_parent
242
- : array();
243
  }
244
 
245
  /**
246
  * Find associations (IToolset_Associations[]) by child id
247
  *
248
- * @param $id
249
  *
250
  * @return IToolset_Association[]
251
  */
252
- private function find_associations_by_child_id( $id ) {
253
- $qry_args = array(
254
- Toolset_Association_Query::QUERY_CHILD_ID => $id,
255
- Toolset_Association_Query::OPTION_RETURN => Toolset_Association_Query::RETURN_ASSOCIATIONS
256
- );
257
-
258
- $associations_child = $this->query_association( $qry_args );
 
 
 
 
 
 
259
 
260
- return is_array( $associations_child )
261
- ? $associations_child
262
- : array();
263
  }
264
 
265
  /**
@@ -305,7 +426,7 @@ class Toolset_Relationship_Service {
305
  * @return bool|int
306
  */
307
  public function legacy_find_parent_id_by_child_id_and_parent_slug( $child_id, $parent_slug ) {
308
- if( ! $this->is_m2m_enabled() ) {
309
  return false;
310
  }
311
 
54
  * @param IToolset_Relationship_Definition $relationship
55
  * @param $child_id
56
  * @param null $parent_slug
 
57
  *
58
  * @return bool|int[]|IToolset_Association[]|IToolset_Element[]
59
  */
65
  if( ! $this->is_m2m_enabled() ) {
66
  return false;
67
  }
68
+
69
+ $query = new Toolset_Association_Query_V2();
70
+
71
+ $query->add( $query->relationship( $relationship ) );
72
+ $query->add( $query->child_id( $child_id, Toolset_Element_Domain::POSTS ) );
73
 
74
+ if ( $parent_slug ) {
75
+ $query->add( $query->has_domain_and_type( Toolset_Element_Domain::POSTS, $parent_slug, new Toolset_Relationship_Role_Parent() ) );
76
+ }
77
+
78
+ $results = $query
79
+ ->return_element_ids( new Toolset_Relationship_Role_Parent() )
80
+ ->limit( 1 )
81
+ ->get_results();
82
+
83
+ if ( ! $results || empty( $results ) ) {
84
+ return false;
85
+ }
86
+
87
+ return $results;
88
+ }
89
+
90
+ /**
91
+ * Function to find parent ID by relationship and intermediary post ID
92
+ * @param IToolset_Relationship_Definition $relationship
93
+ * @param $intermediary_post_id
94
+ * @param null $parent_slug
95
+ *
96
+ * @return bool|int[]|IToolset_Association[]|IToolset_Element[]
97
+ *
98
+ * @since 2.6.7
99
+ */
100
+ public function find_parent_id_by_relationship_and_intermediary_post_id(
101
+ IToolset_Relationship_Definition $relationship,
102
+ $intermediary_post_id,
103
+ $parent_slug = null
104
+ ) {
105
+ if( ! $this->is_m2m_enabled() ) {
106
+ return false;
107
+ }
108
+
109
+ $query = new Toolset_Association_Query_V2();
110
+
111
+ $query->add( $query->relationship( $relationship ) );
112
+ $query->add( $query->intermediary_id( $intermediary_post_id ) );
113
 
114
  if ( $parent_slug ) {
115
+ $query->add( $query->has_domain_and_type( Toolset_Element_Domain::POSTS, $parent_slug, new Toolset_Relationship_Role_Parent() ) );
116
+ }
117
+
118
+ $results = $query
119
+ ->return_element_ids( new Toolset_Relationship_Role_Parent() )
120
+ ->limit( 1 )
121
+ ->get_results();
122
+
123
+ if ( ! $results || empty( $results ) ) {
124
+ return false;
125
  }
126
 
127
+ return $results;
128
  }
129
 
130
+
131
  /**
132
  * Function to find parend id by relationship and child id
133
  *
145
  if( ! $this->is_m2m_enabled() ) {
146
  return false;
147
  }
148
+
149
+ $query = new Toolset_Association_Query_V2();
150
+
151
+ $query->add( $query->relationship( $relationship ) );
152
+ $query->add( $query->parent_id( $parent_id, Toolset_Element_Domain::POSTS ) );
 
153
 
154
  if ( $child_slug ) {
155
+ $query->add( $query->has_domain_and_type( Toolset_Element_Domain::POSTS, $child_slug, new Toolset_Relationship_Role_Child() ) );
156
+ }
157
+
158
+ $results = $query
159
+ ->return_element_ids( new Toolset_Relationship_Role_Child() )
160
+ ->limit( 1 )
161
+ ->get_results();
162
+
163
+ if ( ! $results || empty( $results ) ) {
164
+ return false;
165
  }
166
 
167
+ return $results;
168
  }
169
 
170
  /**
171
  * Function to find intermediary post id by relationship and child id
172
  *
173
  * @param IToolset_Relationship_Definition $relationship
174
+ * @param $child_id
175
+ *
176
+ * @return bool|int[]|IToolset_Association[]|IToolset_Element[]
177
+ *
178
+ */
179
+ public function find_intermediary_by_relationship_and_child_id( IToolset_Relationship_Definition $relationship, $child_id ) {
180
+ if( ! $this->is_m2m_enabled() ) {
181
+ return false;
182
+ }
183
+
184
+ $query = new Toolset_Association_Query_V2();
185
+
186
+ $query->add( $query->relationship( $relationship ) );
187
+ $query->add( $query->child_id( $child_id, Toolset_Element_Domain::POSTS ) );
188
+
189
+ $results = $query
190
+ ->return_association_instances()
191
+ ->limit( 1 )
192
+ ->get_results();
193
+
194
+ if ( ! $results || empty( $results ) ) {
195
+ return false;
196
+ }
197
+
198
+ return $results;
199
+ }
200
+
201
+ /**
202
+ * Function to find Child ID by relationship and intermediary post ID
203
+ *
204
+ * @param IToolset_Relationship_Definition $relationship
205
+ * @param $intermediary_post_id
206
+ * @param null $child_slug
207
  *
208
  * @return bool|int[]|IToolset_Association[]|IToolset_Element[]
209
  *
210
+ * @since 2.6.7
211
  */
212
+ public function find_child_id_by_relationship_and_intermediary_post_id(
213
+ IToolset_Relationship_Definition $relationship,
214
+ $intermediary_post_id,
215
+ $child_slug = null
216
+ ) {
217
  if( ! $this->is_m2m_enabled() ) {
218
  return false;
219
  }
220
+
221
+ $query = new Toolset_Association_Query_V2();
222
+
223
+ $query->add( $query->relationship( $relationship ) );
224
+ $query->add( $query->intermediary_id( $intermediary_post_id ) );
225
 
226
+ if ( $child_slug ) {
227
+ $query->add( $query->has_domain_and_type( Toolset_Element_Domain::POSTS, $child_slug, new Toolset_Relationship_Role_Child() ) );
228
+ }
229
+
230
+ $results = $query
231
+ ->return_element_ids( new Toolset_Relationship_Role_Child() )
232
+ ->limit( 1 )
233
+ ->get_results();
234
+
235
+ if ( ! $results || empty( $results ) ) {
236
+ return false;
237
+ }
238
 
239
+ return $results;
240
  }
241
 
242
  /**
243
  * Function to find intermediary post id by relationship and parent id
244
  *
245
  * @param IToolset_Relationship_Definition $relationship
246
+ * @param $parent_id
247
  *
248
  * @return bool|int[]|IToolset_Association[]|IToolset_Element[]
249
  *
250
  */
251
+ public function find_intermediary_by_relationship_and_parent_id( IToolset_Relationship_Definition $relationship, $parent_id ) {
252
  if( ! $this->is_m2m_enabled() ) {
253
  return false;
254
  }
255
+
256
+ $query = new Toolset_Association_Query_V2();
257
+
258
+ $query->add( $query->relationship( $relationship ) );
259
+ $query->add( $query->parent_id( $parent_id, Toolset_Element_Domain::POSTS ) );
260
+
261
+ $results = $query
262
+ ->return_association_instances()
263
+ ->limit( 1 )
264
+ ->get_results();
265
+
266
+ if ( ! $results || empty( $results ) ) {
267
+ return false;
268
+ }
269
 
270
+ return $results;
 
 
 
 
 
 
271
  }
272
 
273
  /**
302
  if( ! $this->is_m2m_enabled() ) {
303
  return false;
304
  }
305
+
306
+ $query = new Toolset_Association_Query_V2();
307
+
308
+ $query->add( $query->parent_id( $parent_id, Toolset_Element_Domain::POSTS ) );
309
+
310
+ $results = $query
311
+ ->return_element_ids( new Toolset_Relationship_Role_Child() )
312
+ ->limit( PHP_INT_MAX )
313
+ ->get_results();
314
+
315
+ if ( ! $results || empty( $results ) ) {
316
+ return false;
317
+ }
318
+
319
+ return $results;
320
  }
321
 
322
  /**
338
  /**
339
  * Find associations (IToolset_Associations[]) by parent id
340
  *
341
+ * @param $parent_id
342
  *
343
  * @return IToolset_Association[]
344
  */
345
+ private function find_associations_by_parent_id( $parent_id ) {
346
+ $query = new Toolset_Association_Query_V2();
347
+
348
+ $query->add( $query->parent_id( $parent_id, Toolset_Element_Domain::POSTS ) );
349
+
350
+ $results = $query
351
+ ->return_association_instances()
352
+ ->limit( PHP_INT_MAX )
353
+ ->get_results();
354
+
355
+ if ( ! $results || empty( $results ) ) {
356
+ return array();
357
+ }
358
 
359
+ return $results;
 
 
360
  }
361
 
362
  /**
363
  * Find associations (IToolset_Associations[]) by child id
364
  *
365
+ * @param $child_id
366
  *
367
  * @return IToolset_Association[]
368
  */
369
+ private function find_associations_by_child_id( $child_id ) {
370
+ $query = new Toolset_Association_Query_V2();
371
+
372
+ $query->add( $query->child_id( $child_id, Toolset_Element_Domain::POSTS ) );
373
+
374
+ $results = $query
375
+ ->return_association_instances()
376
+ ->limit( PHP_INT_MAX )
377
+ ->get_results();
378
+
379
+ if ( ! $results || empty( $results ) ) {
380
+ return array();
381
+ }
382
 
383
+ return $results;
 
 
384
  }
385
 
386
  /**
426
  * @return bool|int
427
  */
428
  public function legacy_find_parent_id_by_child_id_and_parent_slug( $child_id, $parent_slug ) {
429
+ if( $this->is_m2m_enabled() ) {
430
  return false;
431
  }
432
 
vendor/toolset/toolset-common/inc/autoloaded/renderer/output_template_repository.php CHANGED
@@ -14,17 +14,13 @@ class Toolset_Output_Template_Repository extends Toolset_Output_Template_Reposit
14
  //
15
 
16
  const FAUX_TEMPLATE = 'faux_template.twig';
 
17
 
18
 
19
  /**
20
  * @var array Template definitions.
21
  */
22
- private $templates = array(
23
- self::FAUX_TEMPLATE => array(
24
- 'base_path' => null,
25
- 'namespaces' => array()
26
- )
27
- );
28
 
29
 
30
  /** @var Toolset_Output_Template_Repository */
@@ -43,6 +39,24 @@ class Toolset_Output_Template_Repository extends Toolset_Output_Template_Reposit
43
  }
44
 
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  /**
47
  * @inheritdoc
48
  * @return string
@@ -52,6 +66,12 @@ class Toolset_Output_Template_Repository extends Toolset_Output_Template_Reposit
52
  }
53
 
54
 
 
 
 
 
 
 
55
  /**
56
  * Get the array with template definitions.
57
  *
14
  //
15
 
16
  const FAUX_TEMPLATE = 'faux_template.twig';
17
+ const MAINTENANCE_FILE = 'maintenance.twig';
18
 
19
 
20
  /**
21
  * @var array Template definitions.
22
  */
23
+ private $templates = array();
 
 
 
 
 
24
 
25
 
26
  /** @var Toolset_Output_Template_Repository */
39
  }
40
 
41
 
42
+ public function __construct(
43
+ Toolset_Output_Template_Factory $template_factory_di = null,
44
+ Toolset_Constants $constants_di = null
45
+ ) {
46
+ parent::__construct( $template_factory_di, $constants_di );
47
+
48
+ $this->templates = array(
49
+ self::FAUX_TEMPLATE => array(
50
+ 'base_path' => null,
51
+ 'namespaces' => array()
52
+ ),
53
+ self::MAINTENANCE_FILE => array(
54
+ 'base_path' => $this->get_templates_dir_base_path()
55
+ )
56
+ );
57
+ }
58
+
59
+
60
  /**
61
  * @inheritdoc
62
  * @return string
66
  }
67
 
68
 
69
+ private function get_templates_dir_base_path() {
70
+ return $this->constants->constant( 'TOOLSET_COMMON_PATH' ) . '/templates';
71
+ }
72
+
73
+
74
+
75
  /**
76
  * Get the array with template definitions.
77
  *
vendor/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/gui/base.php ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Abstract factory for the item attribute GUI selector.
5
+ *
6
+ * Extended depending on the relationship cardinality.
7
+ *
8
+ * @since m2m
9
+ */
10
+ abstract class Toolset_Shortcode_Attr_Item_Gui_Base {
11
+
12
+
13
+ /**
14
+ * @var Toolset_Relationship_Definition
15
+ */
16
+ protected $relationship_definition;
17
+
18
+
19
+ /**
20
+ * @var null|WP_Post_Type
21
+ */
22
+ protected $current_post_object;
23
+
24
+
25
+ /**
26
+ * @var string
27
+ */
28
+ protected $option_name;
29
+
30
+
31
+ /**
32
+ * @var Toolset_Post_Type_Repository
33
+ */
34
+ protected $post_type_repository;
35
+
36
+
37
+ /**
38
+ * @var string[]
39
+ */
40
+ protected $parent_types;
41
+
42
+
43
+ /**
44
+ * @var string[]
45
+ */
46
+ protected $child_types;
47
+
48
+
49
+ /**
50
+ * @var string
51
+ */
52
+ protected $intermediary_type;
53
+
54
+
55
+ /**
56
+ * @var string[]
57
+ */
58
+ protected $options = array();
59
+
60
+
61
+ function __construct(
62
+ Toolset_Relationship_Definition $relationship_definition,
63
+ $current_post_object,
64
+ $option_name ,
65
+ Toolset_Post_Type_Repository $post_type_repository
66
+ ) {
67
+ $this->relationship_definition = $relationship_definition;
68
+ $this->current_post_object = $current_post_object;
69
+ $this->option_name = $option_name;
70
+ $this->post_type_repository = $post_type_repository;
71
+
72
+ $this->parent_types = $relationship_definition->get_parent_type()->get_types();
73
+ $this->child_types = $relationship_definition->get_child_type()->get_types();
74
+ $this->intermediary_type = $relationship_definition->get_intermediary_post_type();
75
+
76
+ $this->set_options();
77
+ }
78
+
79
+
80
+ /**
81
+ * Get the option name attribute.
82
+ *
83
+ * @return string
84
+ *
85
+ * @since m2m
86
+ */
87
+ public function get_option_name() {
88
+ return $this->option_name;
89
+ }
90
+
91
+
92
+ /**
93
+ * Get the generated options.
94
+ *
95
+ * @return string[]
96
+ *
97
+ * @since m2m
98
+ */
99
+ public function get_options() {
100
+ return $this->options;
101
+ }
102
+
103
+
104
+ /**
105
+ * Get the label of a given role in the current relationship.
106
+ *
107
+ * @param string $role
108
+ * @param bool $singular
109
+ *
110
+ * @return null|string
111
+ *
112
+ * @since m2m
113
+ */
114
+ public function get_post_type_label_by_role( $role, $singular = false ) {
115
+ $types_for_role = $this->relationship_definition->get_element_type( $role )->get_types();
116
+ $first_type_for_role = reset( $types_for_role );
117
+
118
+ $post_type_for_role = $this->post_type_repository->get( $first_type_for_role );
119
+
120
+ if ( null === $post_type_for_role ) {
121
+ return null;
122
+ }
123
+
124
+ $requested_label_name = ( $singular )
125
+ ? Toolset_Post_Type_Labels::SINGULAR_NAME
126
+ : Toolset_Post_Type_Labels::NAME;
127
+
128
+ return $post_type_for_role->get_label( $requested_label_name );
129
+ }
130
+
131
+
132
+ /**
133
+ * Define options, to be implemnted by children classes.
134
+ *
135
+ * @since m2m
136
+ */
137
+ abstract protected function set_options();
138
+
139
+ /**
140
+ * Compose documentation links and add the GA arguments.
141
+ *
142
+ * @param string $url
143
+ * @param array $args
144
+ * @param string $anchor
145
+ *
146
+ * @return string
147
+ *
148
+ * @since m2m
149
+ */
150
+ protected function get_documentation_link( $url = '', $args = array(), $anchor = '' ) {
151
+ if ( ! empty( $args ) ) {
152
+ $url = esc_url( add_query_arg( $args, $url ) );
153
+ }
154
+ if ( ! empty( $anchor ) ) {
155
+ $url .= '#' . esc_attr( $anchor );
156
+ }
157
+ return $url;
158
+ }
159
+
160
+ }
vendor/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/gui/factory.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Factory for the item attribute GUI selector, based on the relationship cardinality.
5
+ *
6
+ * @since m2m
7
+ */
8
+ class Toolset_Shortcode_Attr_Item_Gui_Factory {
9
+
10
+
11
+ /**
12
+ * @var Toolset_Relationship_Definition
13
+ */
14
+ private $relationship_definition;
15
+
16
+
17
+ /**
18
+ * @var null|WP_Post_Type
19
+ */
20
+ private $current_post_object;
21
+
22
+
23
+ /**
24
+ * @var string
25
+ */
26
+ private $option_name = '';
27
+
28
+
29
+ /**
30
+ * @var string
31
+ */
32
+ private $cardinality;
33
+
34
+
35
+ /**
36
+ * @var Toolset_Post_Type_Repository
37
+ */
38
+ private $post_type_repository;
39
+
40
+
41
+ /**
42
+ * @var Toolset_Shortcode_Attr_Item_Gui_Base
43
+ */
44
+ private $provider;
45
+
46
+
47
+ function __construct( Toolset_Relationship_Definition $relationship_definition, $current_post_object, $option_name ) {
48
+ $this->relationship_definition = $relationship_definition;
49
+ $this->current_post_object = $current_post_object;
50
+ $this->option_name = $option_name;
51
+
52
+ $this->cardinality = $relationship_definition->get_cardinality()->get_type();
53
+
54
+ $this->post_type_repository = Toolset_Post_Type_Repository::get_instance();
55
+
56
+ $this->create();
57
+ }
58
+
59
+
60
+ /**
61
+ * Fill options per relationship cardinality.
62
+ *
63
+ * @since m2m
64
+ */
65
+ private function create() {
66
+ switch( $this->cardinality ) {
67
+ case 'many-to-many':
68
+ $this->provider = new Toolset_Shortcode_Attr_Item_Gui_M2m(
69
+ $this->relationship_definition,
70
+ $this->current_post_object,
71
+ $this->option_name,
72
+ $this->post_type_repository
73
+ );
74
+ break;
75
+ case 'one-to-many':
76
+ $this->provider = new Toolset_Shortcode_Attr_Item_Gui_O2m(
77
+ $this->relationship_definition,
78
+ $this->current_post_object,
79
+ $this->option_name,
80
+ $this->post_type_repository
81
+ );
82
+ break;
83
+ case 'one-to-one':
84
+ $this->provider = new Toolset_Shortcode_Attr_Item_Gui_O2o(
85
+ $this->relationship_definition,
86
+ $this->current_post_object,
87
+ $this->option_name,
88
+ $this->post_type_repository
89
+ );
90
+ break;
91
+ }
92
+ }
93
+
94
+
95
+ /**
96
+ * Get the options registered by the right provider based on the current relationship cardinality.
97
+ *
98
+ * @return string[]
99
+ *
100
+ * @since m2m
101
+ */
102
+ public function get_options() {
103
+ return $this->provider->get_options();
104
+ }
105
+
106
+ }
vendor/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/gui/m2m.php ADDED
@@ -0,0 +1,474 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * item attribute GUI selector provider for many-to-many relationships.
5
+ *
6
+ * @since m2m
7
+ */
8
+ class Toolset_Shortcode_Attr_Item_Gui_M2m extends Toolset_Shortcode_Attr_Item_Gui_Base {
9
+
10
+
11
+ /**
12
+ * Set options for post selectors on M2M relationships.
13
+ *
14
+ * @since m2m
15
+ */
16
+ protected function set_options() {
17
+ if ( null === $this->intermediary_type ) {
18
+ $this->set_many_to_many_disabled();
19
+ return;
20
+ }
21
+
22
+ if ( null === $this->current_post_object ) {
23
+
24
+ if (
25
+ in_array( toolset_getget('get_page'), array( 'views-editor', 'view-archives-editor' ) )
26
+ || (
27
+ is_admin()
28
+ && in_array( toolset_getget('page'), array( 'views-editor', 'view-archives-editor' ) )
29
+ )
30
+ ) {
31
+ $this->set_many_to_many_view_loop();
32
+ return;
33
+ }
34
+
35
+ if (
36
+ in_array( toolset_getget('get_page'), array( 'ct-editor' ) )
37
+ || (
38
+ is_admin()
39
+ && in_array( toolset_getget('page'), array( 'ct-editor' ) )
40
+ )
41
+ ) {
42
+ $this->set_many_to_many_content_template();
43
+ return;
44
+ }
45
+
46
+ $this->set_many_to_many_disabled();
47
+ return;
48
+
49
+ }
50
+
51
+ if ( $this->current_post_object->name === $this->intermediary_type ) {
52
+ $this->set_many_to_many_current_intermediary();
53
+ return;
54
+ }
55
+
56
+ $this->set_many_to_many_disabled();
57
+ return;
58
+ }
59
+
60
+
61
+ /**
62
+ * Set a disabled option.
63
+ *
64
+ * M2M relationships usualy do not allow to display data from related objects,
65
+ * so a disabled option is rendered in most cases.
66
+ *
67
+ * @since m2m
68
+ */
69
+ private function set_many_to_many_disabled() {
70
+ $option_parent = new Toolset_Shortcode_Attr_Item_Gui_Option(
71
+ $this->relationship_definition,
72
+ Toolset_Relationship_Role::PARENT,
73
+ $this
74
+ );
75
+ $option_parent->set_property( 'is_disabled', true );
76
+ $option_parent->set_property(
77
+ 'pointer_content',
78
+ '<h3>' . sprintf(
79
+ __( '%1$s (many-to-many relationship)', 'wpv-views' ),
80
+ $this->relationship_definition->get_display_name()
81
+ ) . '</h3><p>' . sprintf(
82
+ __( 'To display the %1$s that are connected to each %2$s, you will need to create a View.', 'wpv-views' ),
83
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::CHILD ) . '</strong>',
84
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::PARENT, true ) . '</strong>'
85
+ ) . '</p><p>' . sprintf(
86
+ __( '%1$sDocumentation %2$s%3$s', 'wpv-views' ),
87
+ '<a href="'
88
+ . $this->get_documentation_link(
89
+ 'https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/',
90
+ array(
91
+ 'utm_source' => 'postselector',
92
+ 'utm_campaign' => 'm2m',
93
+ 'utm_medium' => 'post-selector-documentation-link',
94
+ 'utm_term' => 'Documentation'
95
+ ),
96
+ 'displaying-many-related-items'
97
+ )
98
+ . '" target="_blank">',
99
+ '<i class="fa fa-external-link"></i>',
100
+ '</a>'
101
+ ) . '</p>'
102
+ );
103
+ $this->options[] = $option_parent->get_option();
104
+
105
+ $option_child = new Toolset_Shortcode_Attr_Item_Gui_Option(
106
+ $this->relationship_definition,
107
+ Toolset_Relationship_Role::CHILD,
108
+ $this
109
+ );
110
+ $option_child->set_property( 'is_disabled', true );
111
+ $option_child->set_property(
112
+ 'pointer_content',
113
+ '<h3>' . sprintf(
114
+ __( '%1$s (many-to-many relationship)', 'wpv-views' ),
115
+ $this->relationship_definition->get_display_name()
116
+ ) . '</h3><p>' . sprintf(
117
+ __( 'To display the %1$s that are connected to each %2$s, you will need to create a View.', 'wpv-views' ),
118
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::PARENT ) . '</strong>',
119
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::CHILD, true ) . '</strong>'
120
+ ) . '</p><p>' . sprintf(
121
+ __( '%1$sDocumentation %2$s%3$s', 'wpv-views' ),
122
+ '<a href="'
123
+ . $this->get_documentation_link(
124
+ 'https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/',
125
+ array(
126
+ 'utm_source' => 'postselector',
127
+ 'utm_campaign' => 'm2m',
128
+ 'utm_medium' => 'post-selector-documentation-link',
129
+ 'utm_term' => 'Documentation'
130
+ ),
131
+ 'displaying-many-related-items'
132
+ )
133
+ . '" target="_blank">',
134
+ '<i class="fa fa-external-link"></i>',
135
+ '</a>'
136
+ ) . '</p>'
137
+ );
138
+ $this->options[] = $option_child->get_option();
139
+
140
+ if ( null != $this->intermediary_type ) {
141
+
142
+ $option_intermediary = new Toolset_Shortcode_Attr_Item_Gui_Option(
143
+ $this->relationship_definition,
144
+ Toolset_Relationship_Role::INTERMEDIARY,
145
+ $this
146
+ );
147
+ $option_intermediary->set_property( 'is_disabled', true );
148
+ $option_intermediary->set_property(
149
+ 'pointer_content',
150
+ '<h3>' . sprintf(
151
+ __( '%1$s (many-to-many relationship)', 'wpv-views' ),
152
+ $this->relationship_definition->get_display_name()
153
+ ) . '</h3><p>' . sprintf(
154
+ __( '%1$s connects with %2$s through %3$s.', 'wpv-views' ),
155
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::PARENT ) . '</strong>',
156
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::CHILD ) . '</strong>',
157
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::INTERMEDIARY ) . '</strong>'
158
+ ) . '</p><p>' . sprintf(
159
+ __( 'To display %1$s you need to use a View that will list %2$s or %3$s and include a filter by the %4$s relationship.', 'wpv-views' ),
160
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::INTERMEDIARY ) . '</strong>',
161
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::PARENT ) . '</strong>',
162
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::CHILD ) . '</strong>',
163
+ $this->relationship_definition->get_display_name()
164
+ ) . '</p><p>' . sprintf(
165
+ __( '%1$sDocumentation %2$s%3$s', 'wpv-views' ),
166
+ '<a href="'
167
+ . $this->get_documentation_link(
168
+ 'https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/',
169
+ array(
170
+ 'utm_source' => 'postselector',
171
+ 'utm_campaign' => 'm2m',
172
+ 'utm_medium' => 'post-selector-documentation-link',
173
+ 'utm_term' => 'Documentation'
174
+ ),
175
+ 'displaying-many-related-items'
176
+ )
177
+ . '" target="_blank">',
178
+ '<i class="fa fa-external-link"></i>',
179
+ '</a>'
180
+ ) . '</p>'
181
+ );
182
+ $this->options[] = $option_intermediary->get_option();
183
+
184
+ }
185
+ }
186
+
187
+
188
+ /**
189
+ * Set the post selector options in Views and WPAs loops.
190
+ *
191
+ * In those cases, you can:
192
+ * - display parent and child data from the IPT.
193
+ * - display the IPT data from parent and child posts when the association is well defined.
194
+ *
195
+ * @since m2m
196
+ */
197
+ private function set_many_to_many_view_loop() {
198
+ $option_parent = new Toolset_Shortcode_Attr_Item_Gui_Option(
199
+ $this->relationship_definition,
200
+ Toolset_Relationship_Role::PARENT,
201
+ $this
202
+ );
203
+ $option_parent->set_property(
204
+ 'pointer_content',
205
+ '<h3>' . sprintf(
206
+ __( '%1$s (many-to-many relationship)', 'wpv-views' ),
207
+ $this->relationship_definition->get_display_name()
208
+ ) . '</h3><p>' . sprintf(
209
+ __( 'You can display the related %1$s if this View is set to display %2$s.', 'wpv-views' ),
210
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::PARENT, true ) . '</strong>',
211
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::INTERMEDIARY ) . '</strong>'
212
+ ) . '</p><p>' . sprintf(
213
+ __( '%1$sDocumentation %2$s%3$s', 'wpv-views' ),
214
+ '<a href="'
215
+ . $this->get_documentation_link(
216
+ 'https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/',
217
+ array(
218
+ 'utm_source' => 'postselector',
219
+ 'utm_campaign' => 'm2m',
220
+ 'utm_medium' => 'post-selector-documentation-link',
221
+ 'utm_term' => 'Documentation'
222
+ ),
223
+ 'displaying-many-related-items'
224
+ )
225
+ . '" target="_blank">',
226
+ '<i class="fa fa-external-link"></i>',
227
+ '</a>'
228
+ ) . '</p>'
229
+ );
230
+ $this->options[] = $option_parent->get_option();
231
+
232
+ $option_child = new Toolset_Shortcode_Attr_Item_Gui_Option(
233
+ $this->relationship_definition,
234
+ Toolset_Relationship_Role::CHILD,
235
+ $this
236
+ );
237
+ $option_child->set_property(
238
+ 'pointer_content',
239
+ '<h3>' . sprintf(
240
+ __( '%1$s (many-to-many relationship)', 'wpv-views' ),
241
+ $this->relationship_definition->get_display_name()
242
+ ) . '</h3><p>' . sprintf(
243
+ __( 'You can display the related %1$s if this View is set to display %2$s.', 'wpv-views' ),
244
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::CHILD, true ) . '</strong>',
245
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::INTERMEDIARY ) . '</strong>'
246
+ ) . '</p><p>' . sprintf(
247
+ __( '%1$sDocumentation %2$s%3$s', 'wpv-views' ),
248
+ '<a href="'
249
+ . $this->get_documentation_link(
250
+ 'https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/',
251
+ array(
252
+ 'utm_source' => 'postselector',
253
+ 'utm_campaign' => 'm2m',
254
+ 'utm_medium' => 'post-selector-documentation-link',
255
+ 'utm_term' => 'Documentation'
256
+ ),
257
+ 'displaying-many-related-items'
258
+ )
259
+ . '" target="_blank">',
260
+ '<i class="fa fa-external-link"></i>',
261
+ '</a>'
262
+ ) . '</p>'
263
+ );
264
+ $this->options[] = $option_child->get_option();
265
+
266
+ $option_intermediary = new Toolset_Shortcode_Attr_Item_Gui_Option(
267
+ $this->relationship_definition,
268
+ Toolset_Relationship_Role::INTERMEDIARY,
269
+ $this
270
+ );
271
+ $option_intermediary->set_property(
272
+ 'pointer_content',
273
+ '<h3>' . sprintf(
274
+ __( '%1$s (many-to-many relationship)', 'wpv-views' ),
275
+ $this->relationship_definition->get_display_name()
276
+ ) . '</h3><p>' . sprintf(
277
+ __( 'You can display the related %1$s if this View is set to display %2$s or %3$s and has a filter by the %4$s relationship.', 'wpv-views' ),
278
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::INTERMEDIARY, true ) . '</strong>',
279
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::PARENT ) . '</strong>',
280
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::CHILD ) . '</strong>',
281
+ $this->relationship_definition->get_display_name()
282
+ ) . '</p><p>' . sprintf(
283
+ __( '%1$sDocumentation %2$s%3$s', 'wpv-views' ),
284
+ '<a href="'
285
+ . $this->get_documentation_link(
286
+ 'https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/',
287
+ array(
288
+ 'utm_source' => 'postselector',
289
+ 'utm_campaign' => 'm2m',
290
+ 'utm_medium' => 'post-selector-documentation-link',
291
+ 'utm_term' => 'Documentation'
292
+ ),
293
+ 'displaying-many-related-items'
294
+ )
295
+ . '" target="_blank">',
296
+ '<i class="fa fa-external-link"></i>',
297
+ '</a>'
298
+ ) . '</p>'
299
+ );
300
+ $this->options[] = $option_intermediary->get_option();
301
+ }
302
+
303
+
304
+ /**
305
+ * Set the post selector options in Content Templates.
306
+ *
307
+ * In this case, you can:
308
+ * - display parent and child data from the IPT.
309
+ *
310
+ * @since m2m
311
+ */
312
+ private function set_many_to_many_content_template() {
313
+ $option_parent = new Toolset_Shortcode_Attr_Item_Gui_Option(
314
+ $this->relationship_definition,
315
+ Toolset_Relationship_Role::PARENT,
316
+ $this
317
+ );
318
+ $option_parent->set_property(
319
+ 'pointer_content',
320
+ '<h3>' . sprintf(
321
+ __( '%1$s (many-to-many relationship)', 'wpv-views' ),
322
+ $this->relationship_definition->get_display_name()
323
+ ) . '</h3><p>' . sprintf(
324
+ __( 'You can display the related %1$s if this Content Template is set to display %2$s.', 'wpv-views' ),
325
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::PARENT, true ) . '</strong>',
326
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::INTERMEDIARY ) . '</strong>'
327
+ ) . '</p><p>' . sprintf(
328
+ __( '%1$sDocumentation %2$s%3$s', 'wpv-views' ),
329
+ '<a href="'
330
+ . $this->get_documentation_link(
331
+ 'https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/',
332
+ array(
333
+ 'utm_source' => 'postselector',
334
+ 'utm_campaign' => 'm2m',
335
+ 'utm_medium' => 'post-selector-documentation-link',
336
+ 'utm_term' => 'Documentation'
337
+ ),
338
+ 'displaying-many-related-items'
339
+ )
340
+ . '" target="_blank">',
341
+ '<i class="fa fa-external-link"></i>',
342
+ '</a>'
343
+ ) . '</p>'
344
+ );
345
+ $this->options[] = $option_parent->get_option();
346
+
347
+ $option_child = new Toolset_Shortcode_Attr_Item_Gui_Option(
348
+ $this->relationship_definition,
349
+ Toolset_Relationship_Role::CHILD,
350
+ $this
351
+ );
352
+ $option_child->set_property(
353
+ 'pointer_content',
354
+ '<h3>' . sprintf(
355
+ __( '%1$s (many-to-many relationship)', 'wpv-views' ),
356
+ $this->relationship_definition->get_display_name()
357
+ ) . '</h3><p>' . sprintf(
358
+ __( 'You can display the related %1$s if this Content Template is set to display %2$s.', 'wpv-views' ),
359
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::CHILD, true ) . '</strong>',
360
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::INTERMEDIARY ) . '</strong>'
361
+ ) . '</p><p>' . sprintf(
362
+ __( '%1$sDocumentation %2$s%3$s', 'wpv-views' ),
363
+ '<a href="'
364
+ . $this->get_documentation_link(
365
+ 'https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/',
366
+ array(
367
+ 'utm_source' => 'postselector',
368
+ 'utm_campaign' => 'm2m',
369
+ 'utm_medium' => 'post-selector-documentation-link',
370
+ 'utm_term' => 'Documentation'
371
+ ),
372
+ 'displaying-many-related-items'
373
+ )
374
+ . '" target="_blank">',
375
+ '<i class="fa fa-external-link"></i>',
376
+ '</a>'
377
+ ) . '</p>'
378
+ );
379
+ $this->options[] = $option_child->get_option();
380
+
381
+ if ( null != $this->intermediary_type ) {
382
+
383
+ $option_intermediary = new Toolset_Shortcode_Attr_Item_Gui_Option(
384
+ $this->relationship_definition,
385
+ Toolset_Relationship_Role::INTERMEDIARY,
386
+ $this
387
+ );
388
+ $option_intermediary->set_property( 'is_disabled', true );
389
+ $option_intermediary->set_property(
390
+ 'pointer_content',
391
+ '<h3>' . sprintf(
392
+ __( '%1$s (many-to-many relationship)', 'wpv-views' ),
393
+ $this->relationship_definition->get_display_name()
394
+ ) . '</h3><p>' . sprintf(
395
+ __( '%1$s connects with %2$s through %3$s.', 'wpv-views' ),
396
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::PARENT ) . '</strong>',
397
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::CHILD ) . '</strong>',
398
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::INTERMEDIARY ) . '</strong>'
399
+ ) . '</p><p>' . sprintf(
400
+ __( 'To display %1$s you need to use a View that will list %2$s or %3$s and include a filter by the %4$s relationship.', 'wpv-views' ),
401
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::INTERMEDIARY ) . '</strong>',
402
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::PARENT ) . '</strong>',
403
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::CHILD ) . '</strong>',
404
+ $this->relationship_definition->get_display_name()
405
+ ) . '</p><p>' . sprintf(
406
+ __( '%1$sDocumentation %2$s%3$s', 'wpv-views' ),
407
+ '<a href="'
408
+ . $this->get_documentation_link(
409
+ 'https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/',
410
+ array(
411
+ 'utm_source' => 'postselector',
412
+ 'utm_campaign' => 'm2m',
413
+ 'utm_medium' => 'post-selector-documentation-link',
414
+ 'utm_term' => 'Documentation'
415
+ )
416
+ )
417
+ . '" target="_blank">',
418
+ '<i class="fa fa-external-link"></i>',
419
+ '</a>'
420
+ ) . '</p>'
421
+ );
422
+ $this->options[] = $option_intermediary->get_option();
423
+
424
+ }
425
+ }
426
+
427
+
428
+ /**
429
+ * Set the post selector options when editing an IPT.
430
+ *
431
+ * In this case, you can:
432
+ * - display parent and child data from the IPT.
433
+ *
434
+ * @since m2m
435
+ */
436
+ private function set_many_to_many_current_intermediary() {
437
+ $option_parent = new Toolset_Shortcode_Attr_Item_Gui_Option(
438
+ $this->relationship_definition,
439
+ Toolset_Relationship_Role::PARENT,
440
+ $this
441
+ );
442
+ $option_parent->set_property(
443
+ 'pointer_content',
444
+ '<h3>' . sprintf(
445
+ __( '%1$s (many-to-many relationship)', 'wpv-views' ),
446
+ $this->relationship_definition->get_display_name()
447
+ ) . '</h3><p>' . sprintf(
448
+ __( 'You can display the related %1$s for the current %2$s.', 'wpv-views' ),
449
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::PARENT, true ) . '</strong>',
450
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::INTERMEDIARY, true ) . '</strong>'
451
+ ) . '</p>'
452
+ );
453
+ $this->options[] = $option_parent->get_option();
454
+
455
+ $option_child = new Toolset_Shortcode_Attr_Item_Gui_Option(
456
+ $this->relationship_definition,
457
+ Toolset_Relationship_Role::CHILD,
458
+ $this
459
+ );
460
+ $option_child->set_property(
461
+ 'pointer_content',
462
+ '<h3>' . sprintf(
463
+ __( '%1$s (many-to-many relationship)', 'wpv-views' ),
464
+ $this->relationship_definition->get_display_name()
465
+ ) . '</h3><p>' . sprintf(
466
+ __( 'You can display the related %1$s for the current %2$s.', 'wpv-views' ),
467
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::CHILD, true ) . '</strong>',
468
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::INTERMEDIARY, true ) . '</strong>'
469
+ ) . '</p>'
470
+ );
471
+ $this->options[] = $option_child->get_option();
472
+ }
473
+
474
+ }
vendor/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/gui/o2m.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * item attribute GUI selector provider for one-to-many relationships.
5
+ *
6
+ * @since m2m
7
+ */
8
+ class Toolset_Shortcode_Attr_Item_Gui_O2m extends Toolset_Shortcode_Attr_Item_Gui_Base {
9
+
10
+
11
+ /**
12
+ * Set options for post selectors on O2M relationships.
13
+ *
14
+ * @since m2m
15
+ */
16
+ protected function set_options() {
17
+ $origin = $this->relationship_definition->get_origin()->get_origin_keyword();
18
+
19
+ if ( Toolset_Relationship_Origin_Post_Reference_Field::ORIGIN_KEYWORD === $origin ) {
20
+ $this->set_parent_reference_option();
21
+ } else {
22
+ $this->set_parent_option();
23
+ $this->set_child_option();
24
+ }
25
+ }
26
+
27
+ protected function set_parent_reference_option() {
28
+ if (
29
+ null === $this->current_post_object
30
+ || ! in_array( $this->current_post_object->name, $this->parent_types )
31
+ ) {
32
+ $option = new Toolset_Shortcode_Attr_Item_Gui_Option(
33
+ $this->relationship_definition,
34
+ Toolset_Relationship_Role::PARENT,
35
+ $this
36
+ );
37
+ $this->options[] = $option->get_option();
38
+
39
+ }
40
+ }
41
+
42
+ protected function set_parent_option() {
43
+ if (
44
+ null === $this->current_post_object
45
+ || ! in_array( $this->current_post_object->name, $this->parent_types )
46
+ ) {
47
+ $option = new Toolset_Shortcode_Attr_Item_Gui_Option(
48
+ $this->relationship_definition,
49
+ Toolset_Relationship_Role::PARENT,
50
+ $this
51
+ );
52
+
53
+ $this->options[] = $option->get_option();
54
+
55
+ }
56
+ }
57
+
58
+ private function set_child_option() {
59
+ $option = new Toolset_Shortcode_Attr_Item_Gui_Option(
60
+ $this->relationship_definition,
61
+ Toolset_Relationship_Role::CHILD,
62
+ $this
63
+ );
64
+ $option->set_property( 'is_disabled', true );
65
+ $option->set_property(
66
+ 'pointer_content',
67
+ '<h3>' . sprintf(
68
+ __( '%1$s (one-to-many relationship)', 'wpv-views' ),
69
+ $this->relationship_definition->get_display_name()
70
+ ) . '</h3><p>' . sprintf(
71
+ __( 'To display the %1$s that are connected to each %2$s, you will need to create a View.', 'wpv-views' ),
72
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::CHILD ) . '</strong>',
73
+ '<strong>' . $this->get_post_type_label_by_role( Toolset_Relationship_Role::PARENT, true ) . '</strong>'
74
+ ) . '</p><p>' . sprintf(
75
+ __( '%1$sDocumentation %2$s%3$s', 'wpv-views' ),
76
+ '<a href="'
77
+ . $this->get_documentation_link(
78
+ 'https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/',
79
+ array(
80
+ 'utm_source' => 'postselector',
81
+ 'utm_campaign' => 'm2m',
82
+ 'utm_medium' => 'post-selector-documentation-link',
83
+ 'utm_term' => 'Documentation'
84
+ ),
85
+ 'displaying-many-related-items'
86
+ )
87
+ . '" target="_blank">',
88
+ '<i class="fa fa-external-link"></i>',
89
+ '</a>'
90
+ ) . '</p>'
91
+ );
92
+
93
+ $this->options[] = $option->get_option();
94
+ }
95
+
96
+ }
vendor/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/gui/o2o.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * item attribute GUI selector provider for one-to-one relationships.
5
+ *
6
+ * @since m2m
7
+ */
8
+ class Toolset_Shortcode_Attr_Item_Gui_O2o extends Toolset_Shortcode_Attr_Item_Gui_Base {
9
+
10
+
11
+ /**
12
+ * Set options for post selectors on O2O relationships.
13
+ *
14
+ * @since m2m
15
+ */
16
+ protected function set_options() {
17
+ if (
18
+ null != $this->current_post_object
19
+ && in_array( $this->current_post_object->name, $this->parent_types )
20
+ ) {
21
+ $this->set_one_to_one_current_parent();
22
+ return;
23
+ }
24
+
25
+ if (
26
+ null != $this->current_post_object
27
+ && in_array( $this->current_post_object->name, $this->child_types )
28
+ ) {
29
+ $this->set_one_to_one_current_child();
30
+ return;
31
+ }
32
+
33
+ $option_parent = new Toolset_Shortcode_Attr_Item_Gui_Option(
34
+ $this->relationship_definition,
35
+ Toolset_Relationship_Role::PARENT,
36
+ $this
37
+ );
38
+ $this->options[] = $option_parent->get_option();
39
+
40
+ $option_child = new Toolset_Shortcode_Attr_Item_Gui_Option(
41
+ $this->relationship_definition,
42
+ Toolset_Relationship_Role::CHILD,
43
+ $this
44
+ );
45
+ $this->options[] = $option_child->get_option();
46
+ return;
47
+ }
48
+
49
+
50
+ /**
51
+ * Set the post selector options when editing a parent post type.
52
+ *
53
+ * In this case, you can display the child post data.
54
+ *
55
+ * @since m2m
56
+ */
57
+ private function set_one_to_one_current_parent() {
58
+ $option_child = new Toolset_Shortcode_Attr_Item_Gui_Option(
59
+ $this->relationship_definition,
60
+ Toolset_Relationship_Role::CHILD,
61
+ $this
62
+ );
63
+ $this->options[] = $option_child->get_option();
64
+ }
65
+
66
+
67
+ /**
68
+ * Set the post selector options when editing a child post type.
69
+ *
70
+ * In this case, you can display the parent post data.
71
+ *
72
+ * @since m2m
73
+ */
74
+ private function set_one_to_one_current_child() {
75
+ $option_parent = new Toolset_Shortcode_Attr_Item_Gui_Option(
76
+ $this->relationship_definition,
77
+ Toolset_Relationship_Role::PARENT,
78
+ $this
79
+ );
80
+ $this->options[] = $option_parent->get_option();
81
+ }
82
+
83
+ }
vendor/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/gui/option.php ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Viewmodel for the item attribute GUI selector options.
5
+ *
6
+ * @since m2m
7
+ *
8
+ * @todo Remove the dependency of the Toolset_Shortcode_Attr_Item_Gui_Base $provider: it only passes a name and a label
9
+ * @todo This should include a method to return and/or print the output using a template, and
10
+ * Toolset_Shortcode_Attr_Item_Gui_Base::$options should be a Toolset_Shortcode_Attr_Item_Gui_Option[]
11
+ */
12
+ class Toolset_Shortcode_Attr_Item_Gui_Option {
13
+
14
+
15
+ /**
16
+ * @var string[]
17
+ */
18
+ private $public_properties = array(
19
+ 'is_checked', 'is_disabled', 'pointer_content'
20
+ );
21
+
22
+
23
+ /**
24
+ * @var string
25
+ */
26
+ private $id;
27
+
28
+
29
+ /**
30
+ * @var string
31
+ */
32
+ private $value;
33
+
34
+
35
+ /**
36
+ * @var bool
37
+ */
38
+ private $is_checked = false;
39
+
40
+
41
+ /**
42
+ * @var bool
43
+ */
44
+ private $is_disabled = false;
45
+
46
+
47
+ /**
48
+ * @var string
49
+ */
50
+ private $pointer_content = '';
51
+
52
+
53
+ /**
54
+ * @var Toolset_Relationship_Definition
55
+ */
56
+ private $relationship_definition;
57
+
58
+
59
+ /**
60
+ * @var string
61
+ */
62
+ private $role;
63
+
64
+
65
+ /**
66
+ * @var string
67
+ */
68
+ private $origin;
69
+
70
+
71
+ /**
72
+ * @var Toolset_Shortcode_Attr_Item_Gui_Base
73
+ */
74
+ private $provider;
75
+
76
+
77
+ function __construct(
78
+ Toolset_Relationship_Definition $relationship_definition,
79
+ $role,
80
+ Toolset_Shortcode_Attr_Item_Gui_Base $provider
81
+ ) {
82
+ $this->relationship_definition = $relationship_definition;
83
+ $this->role = $role;
84
+ $this->provider = $provider;
85
+
86
+ $this->origin = $this->relationship_definition->get_origin()->get_origin_keyword();
87
+
88
+ $this->set_data();
89
+ }
90
+
91
+
92
+ /**
93
+ * Set the basic option data: id and value.
94
+ *
95
+ * @since m2m
96
+ */
97
+ private function set_data() {
98
+ $this->id = $this->relationship_definition->get_slug() . '-' . $this->role;
99
+ $this->value = '@' . $this->relationship_definition->get_slug() . '.' . $this->role;
100
+ }
101
+
102
+
103
+ /**
104
+ * Public setter for expected properties.
105
+ *
106
+ * @param string $property
107
+ * @param mixed $value
108
+ *
109
+ * @since m2m
110
+ */
111
+ public function set_property( $property, $value ) {
112
+ if ( ! in_array( $property, $this->public_properties ) ) {
113
+ return;
114
+ }
115
+ $this->{$property} = $value;
116
+ }
117
+
118
+
119
+ /**
120
+ * Get the option name attribute.
121
+ *
122
+ * @return string
123
+ *
124
+ * @since m2m
125
+ */
126
+ private function get_option_name() {
127
+ return $this->provider->get_option_name();
128
+ }
129
+
130
+
131
+ /**
132
+ * Get the option label.
133
+ *
134
+ * @return string
135
+ *
136
+ * @since m2m
137
+ */
138
+ private function get_label() {
139
+ return ( Toolset_Relationship_Origin_Post_Reference_Field::ORIGIN_KEYWORD === $this->origin )
140
+ ? sprintf(
141
+ __( '%1$s (from %2$s)', 'wpv-views' ),
142
+ $this->provider->get_post_type_label_by_role( $this->role ),
143
+ $this->relationship_definition->get_display_name()
144
+ )
145
+ : $this->provider->get_post_type_label_by_role( $this->role );
146
+ }
147
+
148
+
149
+ /**
150
+ * Get the option output.
151
+ *
152
+ * @return string
153
+ *
154
+ * @since m2m
155
+ */
156
+ public function get_option() {
157
+ $option = '';
158
+
159
+ $option .= sprintf(
160
+ '<label for="toolset-shortcode-gui-item-selector-post-relationship-id-%1$s"%2$s>',
161
+ esc_attr( $this->id ),
162
+ ( $this->is_disabled ? ' class="toolset-option-label-disabled"' : '' )
163
+ );
164
+ $option .= sprintf(
165
+ '<input type="radio" name="%s" id="toolset-shortcode-gui-item-selector-post-relationship-id-%s" value="%s" %s %s />',
166
+ esc_attr( $this->get_option_name() ),
167
+ esc_attr( $this->id ),
168
+ esc_attr( $this->value ),
169
+ checked( $this->is_checked, true, false ),
170
+ disabled( $this->is_disabled, true, false )
171
+ );
172
+ $option .= esc_html( $this->get_label() );
173
+ if ( ! empty( $this->pointer_content ) ) {
174
+ $option .= ' <i class="fa fa-question-circle wp-toolset-pointer-trigger js-wp-toolset-shortcode-pointer-trigger" style="vertical-align:baseline"></i>';
175
+ }
176
+ $option .= '</label>';
177
+ if ( ! empty( $this->pointer_content ) ) {
178
+ $option .= '<div class="js-wp-toolset-shortcode-pointer-content" style="display:none">';
179
+ $option .= $this->pointer_content;
180
+ $option .= '</div>';
181
+ }
182
+
183
+ return $option;
184
+ }
185
+
186
+ }
vendor/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/legacy.php CHANGED
@@ -64,6 +64,39 @@ class Toolset_Shortcode_Attr_Item_Legacy extends Toolset_Shortcode_Attr_Item_Id
64
 
65
  return $this->chain_link->get( $data );
66
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
  if( ! apply_filters( 'toolset_is_m2m_enabled', false ) ) {
69
  // m2m disabled
64
 
65
  return $this->chain_link->get( $data );
66
  }
67
+
68
+ if( $role_slug == 'current_page' ) {
69
+ if ( is_single() || is_page() ) {
70
+ global $wp_query;
71
+ if ( isset( $wp_query->posts[0] ) ) {
72
+ $current_post = $wp_query->posts[0];
73
+ return $this->return_single_id( $current_post->ID );
74
+ }
75
+ }
76
+
77
+ /**
78
+ * Get the current top post.
79
+ *
80
+ * Some Toolset plugins might need to set the top current post under some scenarios,
81
+ * like Toolset Views when doing AJAX pagination or AJAX custom search.
82
+ * In those cases, they can use this filter to get the top current post they are setting
83
+ * and override the ID to apply as the $current_page value.
84
+ *
85
+ * @not Toolset plugins should set this just in time, not globally, when needed, meaning AJAX calls or whatever.
86
+ *
87
+ * @param $top_post null
88
+ *
89
+ * @return $top_post null/WP_Post object The top current post, if set by any Toolset plugin.
90
+ *
91
+ * @since 2.3.0
92
+ */
93
+ $top_current_post = apply_filters( 'toolset_filter_get_top_current_post', null );
94
+ if ( $top_current_post ) {
95
+ return $this->return_single_id( $top_current_post->ID );
96
+ }
97
+
98
+ return $this->chain_link->get( $data );
99
+ }
100
 
101
  if( ! apply_filters( 'toolset_is_m2m_enabled', false ) ) {
102
  // m2m disabled
vendor/toolset/toolset-common/inc/autoloaded/shortcode/attr/item/m2m.php CHANGED
@@ -81,6 +81,11 @@ class Toolset_Shortcode_Attr_Item_M2M extends Toolset_Shortcode_Attr_Item_Id {
81
  }
82
 
83
 
 
 
 
 
 
84
  // no child, check if intermediary is requested
85
  if ( $id = $this->get_intermediary_id( $request_relationship, $request_role_name, $post ) ) {
86
  return $this->return_single_id( $id );
@@ -99,7 +104,10 @@ class Toolset_Shortcode_Attr_Item_M2M extends Toolset_Shortcode_Attr_Item_Id {
99
  private function get_parent_id( $request_relationship, $request_role_name, $post ) {
100
  $parent_types = $request_relationship->get_parent_type()->get_types();
101
 
102
- if ( $request_role_name == 'parent' && count( $parent_types ) == 1 ) {
 
 
 
103
  // 'parent' is used as item slug, only works if there is just one parent type
104
  $request_role_name = current( $parent_types );
105
  }
@@ -107,6 +115,18 @@ class Toolset_Shortcode_Attr_Item_M2M extends Toolset_Shortcode_Attr_Item_Id {
107
  if ( array_key_exists( $request_role_name, $parent_types )
108
  || in_array( $request_role_name, $parent_types )
109
  ) {
 
 
 
 
 
 
 
 
 
 
 
 
110
  $parent_id = $this->service_relationship->find_parent_id_by_relationship_and_child_id(
111
  $request_relationship,
112
  $post->ID,
@@ -116,9 +136,13 @@ class Toolset_Shortcode_Attr_Item_M2M extends Toolset_Shortcode_Attr_Item_Id {
116
  return $this->return_single_id( $parent_id );
117
  }
118
 
 
 
119
  return false;
120
  }
121
 
 
 
122
  /**
123
  * @param $request_relationship
124
  * @param $request_role_name
@@ -129,7 +153,10 @@ class Toolset_Shortcode_Attr_Item_M2M extends Toolset_Shortcode_Attr_Item_Id {
129
  private function get_child_id( IToolset_Relationship_Definition $request_relationship, $request_role_name, $post ) {
130
  $child_types = $request_relationship->get_child_type()->get_types();
131
 
132
- if ( $request_role_name == 'child' && count( $child_types ) == 1 ) {
 
 
 
133
  // 'child' is used as item slug, only works if there is just one child type
134
  $request_role_name = current( $child_types );
135
  }
@@ -137,6 +164,17 @@ class Toolset_Shortcode_Attr_Item_M2M extends Toolset_Shortcode_Attr_Item_Id {
137
  if ( array_key_exists( $request_role_name, $child_types )
138
  || in_array( $request_role_name, $child_types )
139
  ) {
 
 
 
 
 
 
 
 
 
 
 
140
  $child_id = $this->service_relationship->find_child_id_by_relationship_and_parent_id(
141
  $request_relationship,
142
  $post->ID,
@@ -145,6 +183,8 @@ class Toolset_Shortcode_Attr_Item_M2M extends Toolset_Shortcode_Attr_Item_Id {
145
 
146
  return $this->return_single_id( $child_id );
147
  }
 
 
148
  }
149
 
150
  /**
@@ -154,9 +194,15 @@ class Toolset_Shortcode_Attr_Item_M2M extends Toolset_Shortcode_Attr_Item_Id {
154
  *
155
  * @return bool|int
156
  */
157
- private function get_intermediary_id( IToolset_Relationship_Definition $request_relationship, $request_role_name, $post ) {
 
 
 
 
 
 
158
  if ( $request_role_name != 'association'
159
- && $request_role_name != $request_relationship->get_driver()->get_intermediary_post_type()
160
  ) {
161
  return false;
162
  }
@@ -197,6 +243,103 @@ class Toolset_Shortcode_Attr_Item_M2M extends Toolset_Shortcode_Attr_Item_Id {
197
  return false;
198
  }
199
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  /**
201
  * @param $intermediary
202
  *
@@ -213,4 +356,4 @@ class Toolset_Shortcode_Attr_Item_M2M extends Toolset_Shortcode_Attr_Item_Id {
213
 
214
  return $intermediary->get_intermediary_id();
215
  }
216
- }
81
  }
82
 
83
 
84
+ // no child, check if association is requested
85
+ if ( $id = $this->get_association_id( $request_relationship, $request_role_name, $post ) ) {
86
+ return $this->return_single_id( $id );
87
+ }
88
+
89
  // no child, check if intermediary is requested
90
  if ( $id = $this->get_intermediary_id( $request_relationship, $request_role_name, $post ) ) {
91
  return $this->return_single_id( $id );
104
  private function get_parent_id( $request_relationship, $request_role_name, $post ) {
105
  $parent_types = $request_relationship->get_parent_type()->get_types();
106
 
107
+ if (
108
+ ( Toolset_Relationship_Role::PARENT === $request_role_name || $request_relationship->get_role_name( Toolset_Relationship_Role::PARENT ) === $request_role_name )
109
+ && count( $parent_types ) === 1
110
+ ) {
111
  // 'parent' is used as item slug, only works if there is just one parent type
112
  $request_role_name = current( $parent_types );
113
  }
115
  if ( array_key_exists( $request_role_name, $parent_types )
116
  || in_array( $request_role_name, $parent_types )
117
  ) {
118
+ $intermediary_post_type = $request_relationship->get_intermediary_post_type();
119
+
120
+ if ( $intermediary_post_type === $post->post_type ) {
121
+ $parent_id = $this->service_relationship->find_parent_id_by_relationship_and_intermediary_post_id(
122
+ $request_relationship,
123
+ $post->ID
124
+ );
125
+
126
+ return $this->return_single_id( $parent_id );
127
+ }
128
+
129
+
130
  $parent_id = $this->service_relationship->find_parent_id_by_relationship_and_child_id(
131
  $request_relationship,
132
  $post->ID,
136
  return $this->return_single_id( $parent_id );
137
  }
138
 
139
+
140
+
141
  return false;
142
  }
143
 
144
+
145
+
146
  /**
147
  * @param $request_relationship
148
  * @param $request_role_name
153
  private function get_child_id( IToolset_Relationship_Definition $request_relationship, $request_role_name, $post ) {
154
  $child_types = $request_relationship->get_child_type()->get_types();
155
 
156
+ if (
157
+ ( Toolset_Relationship_Role::CHILD === $request_role_name || $request_relationship->get_role_name( Toolset_Relationship_Role::CHILD ) === $request_role_name )
158
+ && count( $child_types ) === 1
159
+ ) {
160
  // 'child' is used as item slug, only works if there is just one child type
161
  $request_role_name = current( $child_types );
162
  }
164
  if ( array_key_exists( $request_role_name, $child_types )
165
  || in_array( $request_role_name, $child_types )
166
  ) {
167
+ $intermediary_post_type = $request_relationship->get_intermediary_post_type();
168
+
169
+ if ( $intermediary_post_type === $post->post_type ) {
170
+ $child_id = $this->service_relationship->find_child_id_by_relationship_and_intermediary_post_id(
171
+ $request_relationship,
172
+ $post->ID
173
+ );
174
+
175
+ return $this->return_single_id( $child_id );
176
+ }
177
+
178
  $child_id = $this->service_relationship->find_child_id_by_relationship_and_parent_id(
179
  $request_relationship,
180
  $post->ID,
183
 
184
  return $this->return_single_id( $child_id );
185
  }
186
+
187
+ return false;
188
  }
189
 
190
  /**
194
  *
195
  * @return bool|int
196
  */
197
+ private function get_association_id( IToolset_Relationship_Definition $request_relationship, $request_role_name, $post ) {
198
+ $intermediary_post_type = $request_relationship->get_driver()->get_intermediary_post_type();
199
+
200
+ if ( null === $intermediary_post_type ) {
201
+ return false;
202
+ }
203
+
204
  if ( $request_role_name != 'association'
205
+ && $request_role_name != $intermediary_post_type
206
  ) {
207
  return false;
208
  }
243
  return false;
244
  }
245
 
246
+ /**
247
+ * Get the intermediary post ID when in a View loop with a filter by post relationship.
248
+ *
249
+ * @param $request_relationship
250
+ * @param $request_role_name
251
+ * @param $post
252
+ *
253
+ * @return bool|int
254
+ */
255
+ private function get_intermediary_id( IToolset_Relationship_Definition $request_relationship, $request_role_name, $post ) {
256
+ $intermediary_post_type = $request_relationship->get_driver()->get_intermediary_post_type();
257
+
258
+ if ( null === $intermediary_post_type ) {
259
+ return false;
260
+ }
261
+
262
+ if (
263
+ $request_role_name != Toolset_Relationship_Role::INTERMEDIARY
264
+ && $request_role_name != $intermediary_post_type
265
+ ) {
266
+ return false;
267
+ }
268
+
269
+ // Try to guess the intermediary post by a Views filter by post relationship
270
+ $post_owner_data = apply_filters( 'wpv_filter_wpv_get_current_post_relationship_frontend_filter_post_owner_data', false );
271
+
272
+ if ( $post_owner_data ) {
273
+ $related_item_one = false;
274
+ foreach( $post_owner_data as $post_type => $post_candidate_list ) {
275
+ if ( count( $post_candidate_list ) > 0 ) {
276
+ $related_item_one = current( $post_candidate_list );
277
+ break;
278
+ }
279
+ }
280
+
281
+ if ( $related_item_one ) {
282
+ $related_item_two = $post->ID;
283
+
284
+ $association_query = new Toolset_Association_Query_V2();
285
+ $association_query->add( $association_query->relationship( $request_relationship ) );
286
+
287
+ // Get associations in this relationship where both:
288
+ // - item one is parent or intermediary or child
289
+ // - item two is parent or intermediary or child
290
+ // Deal with it :-P
291
+ $association_query->add(
292
+ $association_query->do_and(
293
+ $association_query->do_or(
294
+ $association_query->element_id_and_domain(
295
+ $related_item_one,
296
+ Toolset_Element_Domain::POSTS,
297
+ new Toolset_Relationship_Role_Parent()
298
+ ),
299
+ $association_query->element_id_and_domain(
300
+ $related_item_one,
301
+ Toolset_Element_Domain::POSTS,
302
+ new Toolset_Relationship_Role_Intermediary()
303
+ ),
304
+ $association_query->element_id_and_domain(
305
+ $related_item_one,
306
+ Toolset_Element_Domain::POSTS,
307
+ new Toolset_Relationship_Role_Child()
308
+ )
309
+ ),
310
+ $association_query->do_or(
311
+ $association_query->element_id_and_domain(
312
+ $related_item_two,
313
+ Toolset_Element_Domain::POSTS,
314
+ new Toolset_Relationship_Role_Parent()
315
+ ),
316
+ $association_query->element_id_and_domain(
317
+ $related_item_two,
318
+ Toolset_Element_Domain::POSTS,
319
+ new Toolset_Relationship_Role_Intermediary()
320
+ ),
321
+ $association_query->element_id_and_domain(
322
+ $related_item_two,
323
+ Toolset_Element_Domain::POSTS,
324
+ new Toolset_Relationship_Role_Child()
325
+ )
326
+ )
327
+ )
328
+ );
329
+ $association_query->limit( 1 );
330
+
331
+ $associations = $association_query->get_results();
332
+
333
+ if ( $intermediary = $this->get_single_intermediary_id( $associations ) ) {
334
+ return $intermediary;
335
+ };
336
+ }
337
+ }
338
+
339
+ // no unique intermediary post found
340
+ return false;
341
+ }
342
+
343
  /**
344
  * @param $intermediary
345
  *
356
 
357
  return $intermediary->get_intermediary_id();
358
  }
359
+ }
vendor/toolset/toolset-common/inc/autoloaded/upgrade/command/delete_obsolete_version_number_option.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Delete an options which were used in the previous upgrade mechanism implementation.
5
+ *
6
+ * @since 2.6.5
7
+ */
8
+ class Toolset_Upgrade_Command_Delete_Obsolete_Upgrade_Options implements IToolset_Upgrade_Command {
9
+
10
+
11
+ /**
12
+ * Run the command.
13
+ *
14
+ * @return Toolset_Result|Toolset_Result_Set
15
+ */
16
+ public function run() {
17
+ delete_option( 'toolset_database_version' );
18
+
19
+ // This is still used but we need to reset it.
20
+ /** @var Toolset_Upgrade_Executed_Commands $executed_commands */
21
+ $executed_commands = Toolset_Singleton_Factory::get( 'Toolset_Upgrade_Executed_Commands' );
22
+ $executed_commands->reset();
23
+
24
+ return new Toolset_Result( true );
25
+ }
26
+ }
vendor/toolset/toolset-common/inc/autoloaded/upgrade/command/m2m_v1_database_structure_upgrade.php CHANGED
@@ -10,7 +10,7 @@
10
  * command aims at a specific database structure and by using hardcoded values (e.g. for table names)
11
  * we're becoming immune even to unlikely changes like future renaming of tables or columns.
12
  *
13
- * Note: This will fail terribly if executed for the second time.
14
  *
15
  * @since 2.5.4
16
  */
@@ -32,15 +32,20 @@ class Toolset_Upgrade_Command_M2M_V1_Database_Structure_Upgrade implements ITool
32
  private $next_type_set_id = 1;
33
 
34
 
 
 
 
35
  /**
36
  * Toolset_Upgrade_Command_M2M_V1_Database_Structure_Upgrade constructor.
37
  *
38
  * @param wpdb|null $wpdb_di
39
  * @param Toolset_Relationship_Database_Operations|null $relationship_database_operations_di
 
40
  */
41
  public function __construct(
42
  wpdb $wpdb_di = null,
43
- Toolset_Relationship_Database_Operations $relationship_database_operations_di = null
 
44
  ) {
45
  if( null === $wpdb_di ) {
46
  global $wpdb;
@@ -50,6 +55,7 @@ class Toolset_Upgrade_Command_M2M_V1_Database_Structure_Upgrade implements ITool
50
  }
51
 
52
  $this->_database_operations = $relationship_database_operations_di;
 
53
  }
54
 
55
 
@@ -75,24 +81,30 @@ class Toolset_Upgrade_Command_M2M_V1_Database_Structure_Upgrade implements ITool
75
 
76
  $results = new Toolset_Result_Set();
77
 
78
- $this->create_post_type_set_table();
79
- $this->transform_post_type_sets();
80
- $this->change_relationship_type_column_datatypes();
81
 
82
- $this->add_extra_relationship_columns();
83
- $this->transform_extra_relationship_data();
84
- $this->drop_relationship_extra_column();
85
 
86
- $this->add_indexes_for_relationships_table();
87
 
88
- $this->add_relationship_id_column_for_associations();
89
- $this->transform_relationship_references_for_associations();
90
- $this->remove_relationship_slug_column_for_associations();
91
 
92
- $this->add_indexes_for_associations_table();
93
 
94
  error_log( 'The routine Toolset_Upgrade_Command_M2M_V1_Database_Structure_Upgrade::run() has finished' );
95
 
 
 
 
 
 
 
96
  return $results;
97
  }
98
 
@@ -104,13 +116,38 @@ class Toolset_Upgrade_Command_M2M_V1_Database_Structure_Upgrade implements ITool
104
  * @return bool
105
  */
106
  private function is_database_already_up_to_date() {
 
 
 
 
 
 
 
 
107
  $table_name = $this->get_type_set_table_name();
108
- $query = $this->wpdb->prepare( 'SHOW TABLES LIKE %s', $table_name );
109
- $type_set_table_already_exists = ( $this->wpdb->get_var( $query ) == $table_name );
 
110
  return $type_set_table_already_exists;
111
  }
112
 
113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  private function create_post_type_set_table() {
115
 
116
  // Note that dbDelta is very sensitive about details, almost nothing here is arbitrary.
@@ -123,7 +160,9 @@ class Toolset_Upgrade_Command_M2M_V1_Database_Structure_Upgrade implements ITool
123
  KEY type (type)
124
  ) {$this->wpdb->get_charset_collate()};";
125
 
126
- self::dbdelta( $query );
 
 
127
  }
128
 
129
 
@@ -132,11 +171,13 @@ class Toolset_Upgrade_Command_M2M_V1_Database_Structure_Upgrade implements ITool
132
  "SELECT id, parent_types, child_types FROM {$this->get_relationships_table_name()}"
133
  );
134
 
 
 
135
  foreach( $relationships as $relationship ) {
136
  $parent_types = $this->save_post_type_set( maybe_unserialize( $relationship->parent_types ) );
137
  $child_types = $this->save_post_type_set( maybe_unserialize( $relationship->child_types ) );
138
 
139
- $this->wpdb->update(
140
  $this->get_relationships_table_name(),
141
  array(
142
  'parent_types' => $parent_types,
@@ -148,16 +189,22 @@ class Toolset_Upgrade_Command_M2M_V1_Database_Structure_Upgrade implements ITool
148
  '%s',
149
  '%d'
150
  );
 
 
151
  }
 
 
152
  }
153
 
154
 
155
  private function change_relationship_type_column_datatypes() {
156
- $this->wpdb->query(
157
  "ALTER TABLE {$this->get_relationships_table_name()}
158
  MODIFY parent_types bigint(20) UNSIGNED NOT NULL DEFAULT 0,
159
  MODIFY child_types bigint(20) UNSIGNED NOT NULL DEFAULT 0"
160
  );
 
 
161
  }
162
 
163
 
@@ -208,7 +255,7 @@ class Toolset_Upgrade_Command_M2M_V1_Database_Structure_Upgrade implements ITool
208
 
209
 
210
  private function add_extra_relationship_columns() {
211
- $this->wpdb->query(
212
  "ALTER TABLE {$this->get_relationships_table_name()}
213
  CHANGE COLUMN display_name display_name_plural varchar(255) NOT NULL DEFAULT '',
214
  ADD COLUMN display_name_singular varchar(255) NOT NULL DEFAULT '',
@@ -218,6 +265,8 @@ class Toolset_Upgrade_Command_M2M_V1_Database_Structure_Upgrade implements ITool
218
  ADD COLUMN needs_legacy_support tinyint(1) NOT NULL DEFAULT 0,
219
  ADD COLUMN is_active tinyint(1) NOT NULL DEFAULT 0"
220
  );
 
 
221
  }
222
 
223
 
@@ -226,10 +275,12 @@ class Toolset_Upgrade_Command_M2M_V1_Database_Structure_Upgrade implements ITool
226
  "SELECT id, extra FROM {$this->get_relationships_table_name()}"
227
  );
228
 
 
 
229
  foreach( $relationships as $relationship ) {
230
  $extra_data = maybe_unserialize( $relationship->extra );
231
 
232
- $this->wpdb->update(
233
  $this->get_relationships_table_name(),
234
  array(
235
  'role_name_parent' => 'parent',
@@ -243,34 +294,44 @@ class Toolset_Upgrade_Command_M2M_V1_Database_Structure_Upgrade implements ITool
243
  array( '%s', '%s', '%s', '%d', '%d', '%s' ),
244
  '%d'
245
  );
 
 
246
  }
 
 
247
  }
248
 
249
 
250
  private function drop_relationship_extra_column() {
251
- $this->wpdb->query(
252
  "ALTER TABLE {$this->get_relationships_table_name()}
253
  DROP COLUMN extra"
254
  );
 
 
255
  }
256
 
257
 
258
  private function add_indexes_for_relationships_table() {
259
- $this->wpdb->query(
260
  "ALTER TABLE {$this->get_relationships_table_name()}
261
  ADD INDEX is_active (is_active),
262
  ADD INDEX needs_legacy_support (needs_legacy_support),
263
  ADD INDEX parent_type (parent_domain, parent_types),
264
  ADD INDEX child_type (child_domain, child_types)"
265
  );
 
 
266
  }
267
 
268
 
269
  private function add_relationship_id_column_for_associations() {
270
- $this->wpdb->query(
271
  "ALTER TABLE {$this->get_associations_table_name()}
272
  ADD COLUMN relationship_id bigint(20) UNSIGNED NOT NULL"
273
  );
 
 
274
  }
275
 
276
 
@@ -279,32 +340,42 @@ class Toolset_Upgrade_Command_M2M_V1_Database_Structure_Upgrade implements ITool
279
  "SELECT id, slug FROM {$this->get_relationships_table_name()}"
280
  );
281
 
 
 
282
  foreach( $relationships as $relationship ) {
283
- $this->wpdb->update(
284
  $this->get_associations_table_name(),
285
  array( 'relationship_id' => $relationship->id ),
286
  array( 'relationship' => $relationship->slug ),
287
  '%d',
288
  '%s'
289
  );
 
 
290
  }
 
 
291
  }
292
 
293
 
294
  private function remove_relationship_slug_column_for_associations() {
295
- $this->wpdb->query(
296
  "ALTER TABLE {$this->get_associations_table_name()}
297
  DROP COLUMN relationship"
298
  );
 
 
299
  }
300
 
301
 
302
  private function add_indexes_for_associations_table() {
303
- $this->wpdb->query(
304
  "ALTER TABLE {$this->get_associations_table_name()}
305
  ADD INDEX relationship_id (relationship_id),
306
  ADD INDEX parent_id (parent_id, relationship_id),
307
  ADD INDEX child_id (child_id, relationship_id)"
308
  );
 
 
309
  }
310
  }
10
  * command aims at a specific database structure and by using hardcoded values (e.g. for table names)
11
  * we're becoming immune even to unlikely changes like future renaming of tables or columns.
12
  *
13
+ * Note: This might fail terribly if executed for the second time.
14
  *
15
  * @since 2.5.4
16
  */
32
  private $next_type_set_id = 1;
33
 
34
 
35
+ private $constants;
36
+
37
+
38
  /**
39
  * Toolset_Upgrade_Command_M2M_V1_Database_Structure_Upgrade constructor.
40
  *
41
  * @param wpdb|null $wpdb_di
42
  * @param Toolset_Relationship_Database_Operations|null $relationship_database_operations_di
43
+ * @param Toolset_Constants|null $constants_di
44
  */
45
  public function __construct(
46
  wpdb $wpdb_di = null,
47
+ Toolset_Relationship_Database_Operations $relationship_database_operations_di = null,
48
+ Toolset_Constants $constants_di = null
49
  ) {
50
  if( null === $wpdb_di ) {
51
  global $wpdb;
55
  }
56
 
57
  $this->_database_operations = $relationship_database_operations_di;
58
+ $this->constants = $constants_di ?: new Toolset_Constants();
59
  }
60
 
61
 
81
 
82
  $results = new Toolset_Result_Set();
83
 
84
+ $results->add( $this->create_post_type_set_table() );
85
+ $results->add( $this->transform_post_type_sets() );
86
+ $results->add( $this->change_relationship_type_column_datatypes() );
87
 
88
+ $results->add( $this->add_extra_relationship_columns() );
89
+ $results->add( $this->transform_extra_relationship_data() );
90
+ $results->add( $this->drop_relationship_extra_column() );
91
 
92
+ $results->add( $this->add_indexes_for_relationships_table() );
93
 
94
+ $results->add( $this->add_relationship_id_column_for_associations() );
95
+ $results->add( $this->transform_relationship_references_for_associations() );
96
+ $results->add( $this->remove_relationship_slug_column_for_associations() );
97
 
98
+ $results->add( $this->add_indexes_for_associations_table() );
99
 
100
  error_log( 'The routine Toolset_Upgrade_Command_M2M_V1_Database_Structure_Upgrade::run() has finished' );
101
 
102
+ // This is a very basic check since dbDelta has a very bad way of reporting operation results.
103
+ // But if this detects a failure, we *know* for sure something went really wrong.
104
+ if( ! $this->is_database_already_up_to_date() ) {
105
+ $results->add( false, 'The m2m-v1 database structure upgrade to m2m-v2 seems to have failed.' );
106
+ }
107
+
108
  return $results;
109
  }
110
 
116
  * @return bool
117
  */
118
  private function is_database_already_up_to_date() {
119
+ return (
120
+ $this->is_type_set_table_present()
121
+ && $this->are_new_relationship_columns_present()
122
+ );
123
+ }
124
+
125
+
126
+ private function is_type_set_table_present() {
127
  $table_name = $this->get_type_set_table_name();
128
+ $type_set_table_query = $this->wpdb->prepare( 'SHOW TABLES LIKE %s', $table_name );
129
+ $type_set_table_already_exists = ( $this->wpdb->get_var( $type_set_table_query ) == $table_name );
130
+
131
  return $type_set_table_already_exists;
132
  }
133
 
134
 
135
+ private function are_new_relationship_columns_present() {
136
+ $relationship_column_query = "SELECT *
137
+ FROM information_schema.COLUMNS
138
+ WHERE
139
+ TABLE_NAME = '{$this->get_relationships_table_name()}'
140
+ AND TABLE_SCHEMA = '{$this->constants->constant( 'DB_NAME' )}'
141
+ AND COLUMN_NAME IN (
142
+ 'display_name_plural', 'display_name_singular', 'role_name_parent', 'role_name_child',
143
+ 'role_name_intermediary', 'needs_legacy_support', 'is_active'
144
+ )";
145
+
146
+ $results = $this->wpdb->get_results( $relationship_column_query );
147
+ return ( count( $results ) === 7 );
148
+ }
149
+
150
+
151
  private function create_post_type_set_table() {
152
 
153
  // Note that dbDelta is very sensitive about details, almost nothing here is arbitrary.
160
  KEY type (type)
161
  ) {$this->wpdb->get_charset_collate()};";
162
 
163
+ $output = self::dbdelta( $query );
164
+
165
+ return new Toolset_Result( true, implode( "\n", $output ) );
166
  }
167
 
168
 
171
  "SELECT id, parent_types, child_types FROM {$this->get_relationships_table_name()}"
172
  );
173
 
174
+ $results = new Toolset_Result_Set();
175
+
176
  foreach( $relationships as $relationship ) {
177
  $parent_types = $this->save_post_type_set( maybe_unserialize( $relationship->parent_types ) );
178
  $child_types = $this->save_post_type_set( maybe_unserialize( $relationship->child_types ) );
179
 
180
+ $output = $this->wpdb->update(
181
  $this->get_relationships_table_name(),
182
  array(
183
  'parent_types' => $parent_types,
189
  '%s',
190
  '%d'
191
  );
192
+
193
+ $results->add( false !== $output, $this->wpdb->last_error );
194
  }
195
+
196
+ return $results;
197
  }
198
 
199
 
200
  private function change_relationship_type_column_datatypes() {
201
+ $output = $this->wpdb->query(
202
  "ALTER TABLE {$this->get_relationships_table_name()}
203
  MODIFY parent_types bigint(20) UNSIGNED NOT NULL DEFAULT 0,
204
  MODIFY child_types bigint(20) UNSIGNED NOT NULL DEFAULT 0"
205
  );
206
+
207
+ return new Toolset_Result( false !== $output, $this->wpdb->last_error );
208
  }
209
 
210
 
255
 
256
 
257
  private function add_extra_relationship_columns() {
258
+ $output = $this->wpdb->query(
259
  "ALTER TABLE {$this->get_relationships_table_name()}
260
  CHANGE COLUMN display_name display_name_plural varchar(255) NOT NULL DEFAULT '',
261
  ADD COLUMN display_name_singular varchar(255) NOT NULL DEFAULT '',
265
  ADD COLUMN needs_legacy_support tinyint(1) NOT NULL DEFAULT 0,
266
  ADD COLUMN is_active tinyint(1) NOT NULL DEFAULT 0"
267
  );
268
+
269
+ return new Toolset_Result( false !== $output, $this->wpdb->last_error );
270
  }
271
 
272
 
275
  "SELECT id, extra FROM {$this->get_relationships_table_name()}"
276
  );
277
 
278
+ $results = new Toolset_Result_Set();
279
+
280
  foreach( $relationships as $relationship ) {
281
  $extra_data = maybe_unserialize( $relationship->extra );
282
 
283
+ $output = $this->wpdb->update(
284
  $this->get_relationships_table_name(),
285
  array(
286
  'role_name_parent' => 'parent',
294
  array( '%s', '%s', '%s', '%d', '%d', '%s' ),
295
  '%d'
296
  );
297
+
298
+ $results->add( false !== $output, $this->wpdb->last_error );
299
  }
300
+
301
+ return $results;
302
  }
303
 
304
 
305
  private function drop_relationship_extra_column() {
306
+ $output = $this->wpdb->query(
307
  "ALTER TABLE {$this->get_relationships_table_name()}
308
  DROP COLUMN extra"
309
  );
310
+
311
+ return new Toolset_Result( false !== $output, $this->wpdb->last_error );
312
  }
313
 
314
 
315
  private function add_indexes_for_relationships_table() {
316
+ $output = $this->wpdb->query(
317
  "ALTER TABLE {$this->get_relationships_table_name()}
318
  ADD INDEX is_active (is_active),
319
  ADD INDEX needs_legacy_support (needs_legacy_support),
320
  ADD INDEX parent_type (parent_domain, parent_types),
321
  ADD INDEX child_type (child_domain, child_types)"
322
  );
323
+
324
+ return new Toolset_Result( false !== $output, $this->wpdb->last_error );
325
  }
326
 
327
 
328
  private function add_relationship_id_column_for_associations() {
329
+ $output = $this->wpdb->query(
330
  "ALTER TABLE {$this->get_associations_table_name()}
331
  ADD COLUMN relationship_id bigint(20) UNSIGNED NOT NULL"
332
  );
333
+
334
+ return new Toolset_Result( false !== $output, $this->wpdb->last_error );
335
  }
336
 
337
 
340
  "SELECT id, slug FROM {$this->get_relationships_table_name()}"
341
  );
342
 
343
+ $results = new Toolset_Result_Set();
344
+
345
  foreach( $relationships as $relationship ) {
346
+ $output = $this->wpdb->update(
347
  $this->get_associations_table_name(),
348
  array( 'relationship_id' => $relationship->id ),
349
  array( 'relationship' => $relationship->slug ),
350
  '%d',
351
  '%s'
352
  );
353
+
354
+ $results->add( false !== $output, $this->wpdb->last_error );
355
  }
356
+
357
+ return $results;
358
  }
359
 
360
 
361
  private function remove_relationship_slug_column_for_associations() {
362
+ $output = $this->wpdb->query(
363
  "ALTER TABLE {$this->get_associations_table_name()}
364
  DROP COLUMN relationship"
365
  );
366
+
367
+ return new Toolset_Result( false !== $output, $this->wpdb->last_error );
368
  }
369
 
370
 
371
  private function add_indexes_for_associations_table() {
372
+ $output = $this->wpdb->query(
373
  "ALTER TABLE {$this->get_associations_table_name()}
374
  ADD INDEX relationship_id (relationship_id),
375
  ADD INDEX parent_id (parent_id, relationship_id),
376
  ADD INDEX child_id (child_id, relationship_id)"
377
  );
378
+
379
+ return new Toolset_Result( false !== $output, $this->wpdb->last_error );
380
  }
381
  }
vendor/toolset/toolset-common/inc/autoloaded/upgrade/command/m2m_v2_database_structure_upgrade.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Transform the m2m table structures and data from the m2m-v2 beta release to m2m-v3 beta.
5
+ *
6
+ * Note: This will fail terribly if executed for the second time.
7
+ *
8
+ * @since m2m
9
+ */
10
+ class Toolset_Upgrade_Command_M2M_V2_Database_Structure_Upgrade implements IToolset_Upgrade_Command {
11
+
12
+
13
+ /** @var wpdb */
14
+ private $wpdb;
15
+
16
+
17
+ /** @var Toolset_Relationship_Database_Operations|null */
18
+ private $_database_operations;
19
+
20
+
21
+ /**
22
+ * Toolset_Upgrade_Command_M2M_V2_Database_Structure_Upgrade constructor.
23
+ *
24
+ * @param wpdb|null $wpdb_di
25
+ * @param Toolset_Relationship_Database_Operations|null $relationship_database_operations_di
26
+ */
27
+ public function __construct(
28
+ wpdb $wpdb_di = null,
29
+ Toolset_Relationship_Database_Operations $relationship_database_operations_di = null
30
+ ) {
31
+ if( null === $wpdb_di ) {
32
+ global $wpdb;
33
+ $this->wpdb = $wpdb;
34
+ } else {
35
+ $this->wpdb = $wpdb_di;
36
+ }
37
+
38
+ $this->_database_operations = $relationship_database_operations_di;
39
+ }
40
+
41
+
42
+ /**
43
+ * Run the command.
44
+ *
45
+ * @return Toolset_Result|Toolset_Result_Set
46
+ */
47
+ public function run() {
48
+
49
+ if( ! apply_filters( 'toolset_is_m2m_enabled', false ) ) {
50
+ // Nothing to do here: The tables will be created as soon as m2m is activated for the first time.
51
+ return new Toolset_Result( true );
52
+ }
53
+
54
+ if( $this->is_database_already_up_to_date() ) {
55
+ // Nothing to do here: This happens when Types is activated on a fresh site: It creates
56
+ // the tables according to the new structure but runs the upgrade routine at the same time.
57
+ return new Toolset_Result( true );
58
+ }
59
+
60
+ error_log( 'The routine Toolset_Upgrade_Command_M2M_V2_Database_Structure_Upgrade::run() is starting' );
61
+
62
+ $results = new Toolset_Result_Set();
63
+
64
+ $results->add( $this->update_relationships_table() );
65
+
66
+ error_log( 'The routine Toolset_Upgrade_Command_M2M_V2_Database_Structure_Upgrade::run() has finished' );
67
+
68
+ return $results;
69
+ }
70
+
71
+
72
+ /**
73
+ * If role_name_parent_plural exists in relationship database, it means that we're dealing with a more recent database structure than this
74
+ * command aims to improve.
75
+ *
76
+ * @return bool
77
+ * @since m2m
78
+ */
79
+ private function is_database_already_up_to_date() {
80
+ $table_name = $this->get_relationships_table_name();
81
+ $query = $this->wpdb->prepare( "SHOW COLUMNS FROM {$table_name} WHERE field = %s", 'role_label_parent_plural' );
82
+ $row = $this->wpdb->get_row( $query );
83
+ $is_updated = ! empty( $row );
84
+ return $is_updated;
85
+ }
86
+
87
+
88
+ private function update_relationships_table() {
89
+
90
+ $query = "ALTER TABLE `{$this->get_relationships_table_name()}`
91
+ ADD `role_label_parent_singular` VARCHAR(255) NOT NULL AFTER `role_name_intermediary`,
92
+ ADD `role_label_child_singular` VARCHAR(255) NOT NULL AFTER `role_label_parent_singular`,
93
+ ADD `role_label_parent_plural` VARCHAR(255) NOT NULL AFTER `role_label_child_singular`,
94
+ ADD `role_label_child_plural` VARCHAR(255) NOT NULL AFTER `role_label_parent_plural`";
95
+
96
+ $this->wpdb->query( $query );
97
+
98
+ return true;
99
+ }
100
+
101
+
102
+ /**
103
+ * Execute a dbDelta() query, ensuring that the function is available.
104
+ *
105
+ * @param string $query MySQL query.
106
+ *
107
+ * @return array dbDelta return value.
108
+ */
109
+ private static function dbdelta( $query ) {
110
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
111
+ return dbDelta( $query );
112
+ }
113
+
114
+
115
+ private function get_relationships_table_name() {
116
+ return $this->wpdb->prefix . 'toolset_relationships';
117
+ }
118
+ }
vendor/toolset/toolset-common/inc/autoloaded/upgrade/command_definition.php CHANGED
@@ -52,7 +52,7 @@ class Toolset_Upgrade_Command_Definition {
52
  * @return bool
53
  */
54
  public function should_run( $from_version, /** @noinspection PhpUnusedParameterInspection */ $to_version ) {
55
- return ( $from_version < $this->upgrade_version );
56
  }
57
 
58
 
52
  * @return bool
53
  */
54
  public function should_run( $from_version, /** @noinspection PhpUnusedParameterInspection */ $to_version ) {
55
+ return ( $from_version < $this->upgrade_version && $this->upgrade_version <= $to_version );
56
  }
57
 
58
 
vendor/toolset/toolset-common/inc/autoloaded/upgrade/command_definition_repository.php CHANGED
@@ -12,13 +12,31 @@ class Toolset_Upgrade_Command_Definition_Repository {
12
  public function get_commands() {
13
 
14
  $upgrade_commands = array(
15
- new Toolset_Upgrade_Command_Definition(
 
 
 
16
  'Toolset_Upgrade_Command_M2M_V1_Database_Structure_Upgrade',
17
- 254002
18
- )
 
 
19
  );
20
 
21
  return $upgrade_commands;
22
  }
23
 
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  public function get_commands() {
13
 
14
  $upgrade_commands = array(
15
+ $this->definition(
16
+ 'Toolset_Upgrade_Command_Delete_Obsolete_Upgrade_Options',
17
+ 1 ),
18
+ $this->definition(
19
  'Toolset_Upgrade_Command_M2M_V1_Database_Structure_Upgrade',
20
+ 2 ),
21
+ $this->definition(
22
+ 'Toolset_Upgrade_Command_M2M_V2_Database_Structure_Upgrade',
23
+ 3 ),
24
  );
25
 
26
  return $upgrade_commands;
27
  }
28
 
29
+
30
+ /**
31
+ * @param string $command_class_name
32
+ * @param int $upgrade_version
33
+ *
34
+ * @return Toolset_Upgrade_Command_Definition
35
+ */
36
+ private function definition( $command_class_name, $upgrade_version ) {
37
+ return new Toolset_Upgrade_Command_Definition(
38
+ $command_class_name, $upgrade_version
39
+ );
40
+ }
41
+
42
+ }
vendor/toolset/toolset-common/inc/autoloaded/upgrade/command_interface.php CHANGED
@@ -8,6 +8,8 @@
8
  * WARNING: Since it's very difficult to recover from any errors that occur during the upgrade, it is extremely
9
  * important to have the commands thoroughly covered by unit tests and well-tested.
10
  *
 
 
11
  * @since 2.5.3
12
  */
13
  interface IToolset_Upgrade_Command {
8
  * WARNING: Since it's very difficult to recover from any errors that occur during the upgrade, it is extremely
9
  * important to have the commands thoroughly covered by unit tests and well-tested.
10
  *
11
+ * Each command's run() method must be idempotent.
12
+ *
13
  * @since 2.5.3
14
  */
15
  interface IToolset_Upgrade_Command {
vendor/toolset/toolset-common/inc/autoloaded/upgrade/controller.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  /**
4
  * Toolset Common Library upgrade mechanism.
5
- *
6
  * Compares a number of the library version in database with the current one. If the current version is lower,
7
  * it executes all the commands defined in get_upgrade_commands() and updates the database.
8
  *
@@ -16,7 +16,7 @@ class Toolset_Upgrade_Controller {
16
 
17
 
18
  /** Name of the option used to store version number. */
19
- const DATABASE_VERSION_OPTION = 'toolset_database_version';
20
 
21
 
22
  /** @var Toolset_Upgrade_Controller */
@@ -92,9 +92,9 @@ class Toolset_Upgrade_Controller {
92
  }
93
 
94
  // This is required by the tcl-status plugin.
95
- if( apply_filters( 'toolset_disable_upgrade_routine', false ) ) {
96
- return;
97
- }
98
 
99
  $this->do_upgrade( $database_version, $library_version );
100
  }
@@ -109,8 +109,8 @@ class Toolset_Upgrade_Controller {
109
  */
110
  private function get_library_version() {
111
  $version = (
112
- $this->constants->defined( 'TOOLSET_COMMON_VERSION_NUMBER' )
113
- ? (int) $this->constants->constant( 'TOOLSET_COMMON_VERSION_NUMBER' )
114
  : 0
115
  );
116
 
@@ -125,7 +125,7 @@ class Toolset_Upgrade_Controller {
125
  * @since m2m
126
  */
127
  private function get_database_version() {
128
- $version = (int) get_option( self::DATABASE_VERSION_OPTION, 0 );
129
 
130
  return $version;
131
  }
@@ -139,22 +139,21 @@ class Toolset_Upgrade_Controller {
139
  */
140
  private function update_database_version( $version_number ) {
141
  if( is_numeric( $version_number ) ) {
142
- update_option( self::DATABASE_VERSION_OPTION, (int) $version_number, true );
143
  }
144
  }
145
 
146
 
147
  /**
148
  * Perform the actual upgrade.
149
- *
150
  * @param int $from_version
151
  * @param int $to_version
152
  */
153
  private function do_upgrade( $from_version, $to_version ) {
154
 
155
- $this->update_database_version( $to_version );
156
-
157
  $command_definitions = $this->get_upgrade_commands();
 
158
 
159
  foreach ( $command_definitions as $command_definition ) {
160
 
@@ -169,25 +168,73 @@ class Toolset_Upgrade_Controller {
169
  if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
170
 
171
  $command = $command_definition->get_command();
172
- $command->run();
173
 
174
  } else {
175
  // Ignore errors as we don't have a proper way to display any output from this yet.
176
  try {
177
  $command = $command_definition->get_command();
178
- $command->run();
179
  } catch ( Throwable $e ) {
180
  // PHP 7
181
- } catch ( Exception $e ) {
 
 
 
182
  // PHP 5
 
183
  }
184
  }
185
 
186
- $this->get_executed_commands()->add_executed_command( $command_definition->get_command_name() );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  }
188
  }
189
 
190
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  /**
192
  * Get the upgrade commands to consider.
193
  *
@@ -211,11 +258,11 @@ class Toolset_Upgrade_Controller {
211
  */
212
  public function get_executed_commands() {
213
  if( null === $this->_executed_commands ) {
214
- $this->_executed_commands = new Toolset_Upgrade_Executed_Commands();
215
  }
216
 
217
  return $this->_executed_commands;
218
  }
219
 
220
 
221
- }
2
 
3
  /**
4
  * Toolset Common Library upgrade mechanism.
5
+ *
6
  * Compares a number of the library version in database with the current one. If the current version is lower,
7
  * it executes all the commands defined in get_upgrade_commands() and updates the database.
8
  *
16
 
17
 
18
  /** Name of the option used to store version number. */
19
+ const DATABASE_VERSION_OPTION_NUMBER = 'toolset_data_structure_version';
20
 
21
 
22
  /** @var Toolset_Upgrade_Controller */
92
  }
93
 
94
  // This is required by the tcl-status plugin.
95
+ // if( apply_filters( 'toolset_disable_upgrade_routine', false ) ) {
96
+ // return;
97
+ // }
98
 
99
  $this->do_upgrade( $database_version, $library_version );
100
  }
109
  */
110
  private function get_library_version() {
111
  $version = (
112
+ $this->constants->defined( 'TOOLSET_DATA_STRUCTURE_VERSION' )
113
+ ? (int) $this->constants->constant( 'TOOLSET_DATA_STRUCTURE_VERSION' )
114
  : 0
115
  );
116
 
125
  * @since m2m
126
  */
127
  private function get_database_version() {
128
+ $version = (int) get_option( self::DATABASE_VERSION_OPTION_NUMBER, 0 );
129
 
130
  return $version;
131
  }
139
  */
140
  private function update_database_version( $version_number ) {
141
  if( is_numeric( $version_number ) ) {
142
+ update_option( self::DATABASE_VERSION_OPTION_NUMBER, (int) $version_number, true );
143
  }
144
  }
145
 
146
 
147
  /**
148
  * Perform the actual upgrade.
149
+ *
150
  * @param int $from_version
151
  * @param int $to_version
152
  */
153
  private function do_upgrade( $from_version, $to_version ) {
154
 
 
 
155
  $command_definitions = $this->get_upgrade_commands();
156
+ $final_result = new Toolset_Result_Set();
157
 
158
  foreach ( $command_definitions as $command_definition ) {
159
 
168
  if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
169
 
170
  $command = $command_definition->get_command();
171
+ $result = $command->run();
172
 
173
  } else {
174
  // Ignore errors as we don't have a proper way to display any output from this yet.
175
  try {
176
  $command = $command_definition->get_command();
177
+ $result = $command->run();
178
  } catch ( Throwable $e ) {
179
  // PHP 7
180
+ $result = new Toolset_Result( $e );
181
+ } /** @noinspection PhpRedundantCatchClauseInspection */
182
+ /** @noinspection PhpWrongCatchClausesOrderInspection */
183
+ catch ( Exception $e ) {
184
  // PHP 5
185
+ $result = new Toolset_Result( $e );
186
  }
187
  }
188
 
189
+ $is_success = (
190
+ ( $result instanceof Toolset_Result && $result->is_success() )
191
+ || ( $result instanceof Toolset_Result_Set && $result->is_complete_success() )
192
+ );
193
+
194
+ if( $is_success ) {
195
+ $this->get_executed_commands()->add_executed_command( $command_definition->get_command_name() );
196
+ }
197
+
198
+ $final_result->add( $result );
199
+ }
200
+
201
+ // Only consider the database updated when everything has succeeded.
202
+ if( ! $final_result->has_results() || $final_result->is_complete_success() ) {
203
+ $this->update_database_version( $to_version );
204
+ } else {
205
+ $this->show_error_notice( $final_result );
206
  }
207
  }
208
 
209
 
210
+ /**
211
+ * Show an undismissible temporary error message with upgrade results.
212
+ *
213
+ * @param Toolset_Result_Set $results
214
+ * @since 2.6.4
215
+ */
216
+ private function show_error_notice( Toolset_Result_Set $results ) {
217
+ $notice = new Toolset_Admin_Notice_Error(
218
+ 'toolset-database-upgrade-error',
219
+ '<p>'
220
+ . __( 'Oops! There\'s been a problem when upgrading Toolset data structures. Please make sure your current configuration allows WordPress to alter database tables.', 'wpcf' )
221
+ . sprintf(
222
+ __( 'If the problem persists, please don\'t hesitate to contact %sour support%s with this technical information:', 'wpcf' ),
223
+ '<a href="https://toolset.com/forums/forum/professional-support/" target="_blank">',
224
+ ' <i class="fa fa-external-link"></i></a>'
225
+ )
226
+ . '</p>'
227
+ . '<p><code>' . $results->concat_messages( "\n" ) . '</code></p>'
228
+ );
229
+
230
+ $notice->set_is_dismissible_permanent( false );
231
+ $notice->set_is_dismissible_globally( false );
232
+ $notice->set_is_only_for_administrators( true );
233
+
234
+ Toolset_Admin_Notices_Manager::add_notice( $notice );
235
+ }
236
+
237
+
238
  /**
239
  * Get the upgrade commands to consider.
240
  *
258
  */
259
  public function get_executed_commands() {
260
  if( null === $this->_executed_commands ) {
261
+ $this->_executed_commands = Toolset_Singleton_Factory::get( 'Toolset_Upgrade_Executed_Commands' );
262
  }
263
 
264
  return $this->_executed_commands;
265
  }
266
 
267
 
268
+ }
vendor/toolset/toolset-common/inc/autoloaded/upgrade/executed_commands.php CHANGED
@@ -55,4 +55,10 @@ class Toolset_Upgrade_Executed_Commands {
55
  return $this->executed_commands;
56
  }
57
 
 
 
 
 
 
 
58
  }
55
  return $this->executed_commands;
56
  }
57
 
58
+
59
+ public function reset() {
60
+ $this->executed_commands = null;
61
+ delete_option( self::OPTION_NAME );
62
+ }
63
+
64
  }
vendor/toolset/toolset-common/inc/autoloaded/wp_query_adjustments/abstract.php CHANGED
@@ -70,15 +70,21 @@
70
  */
71
  abstract class Toolset_Wp_Query_Adjustments extends Toolset_Wpdb_User {
72
 
 
73
  // Must not be changed, third-party software depends on it.
74
  const RELATIONSHIP_QUERY_ARG = 'toolset_relationships';
75
 
76
 
 
 
 
 
 
77
  /**
78
  * Initialize the query adjustments.
79
  */
80
  public function initialize() {
81
- add_action( 'pre_get_posts', array( $this, 'check_custom_query_args' ) );
82
  }
83
 
84
 
70
  */
71
  abstract class Toolset_Wp_Query_Adjustments extends Toolset_Wpdb_User {
72
 
73
+
74
  // Must not be changed, third-party software depends on it.
75
  const RELATIONSHIP_QUERY_ARG = 'toolset_relationships';
76
 
77
 
78
+ // The time when we store the toolset_relationships query argument during pre_get_posts.
79
+ // It needs to happen late so that other query modifications (also meta_query ones) can happen before.
80
+ const TIME_TO_STORE_RELATIONSHIPS_ARG = 10000;
81
+
82
+
83
  /**
84
  * Initialize the query adjustments.
85
  */
86
  public function initialize() {
87
+ add_action( 'pre_get_posts', array( $this, 'check_custom_query_args' ), self::TIME_TO_STORE_RELATIONSHIPS_ARG );
88
  }
89
 
90
 
vendor/toolset/toolset-common/inc/autoloaded/wp_query_adjustments/m2m.php CHANGED
@@ -7,6 +7,10 @@
7
  *
8
  * See the superclass for details.
9
  *
 
 
 
 
10
  * @since 2.6.1
11
  */
12
  class Toolset_Wp_Query_Adjustments_M2m extends Toolset_Wp_Query_Adjustments {
@@ -20,22 +24,28 @@ class Toolset_Wp_Query_Adjustments_M2m extends Toolset_Wp_Query_Adjustments {
20
  private $_element_factory;
21
 
22
 
 
 
 
 
23
  /**
24
  * Toolset_Wp_Query_Adjustments_M2m constructor.
25
  *
26
  * @param wpdb|null $wpdb_di
27
  * @param Toolset_Relationship_Database_Operations|null $database_operations_di
28
  * @param Toolset_Element_Factory|null $element_factory_di
 
29
  */
30
  public function __construct(
31
  wpdb $wpdb_di = null,
32
  Toolset_Relationship_Database_Operations $database_operations_di = null,
33
- Toolset_Element_Factory $element_factory_di = null
34
-
35
  ) {
36
  parent::__construct( $wpdb_di );
37
  $this->_database_operations = $database_operations_di;
38
  $this->_element_factory = $element_factory_di;
 
39
  }
40
 
41
 
@@ -45,7 +55,11 @@ class Toolset_Wp_Query_Adjustments_M2m extends Toolset_Wp_Query_Adjustments {
45
  public function initialize() {
46
  parent::initialize();
47
 
48
- do_action( 'toolset_do_m2m_full_init' );
 
 
 
 
49
 
50
  add_filter( 'posts_where', array( $this, 'posts_where' ), 10, 2 );
51
  add_filter( 'posts_join', array( $this, 'posts_join' ), 10, 2 );
@@ -59,9 +73,10 @@ class Toolset_Wp_Query_Adjustments_M2m extends Toolset_Wp_Query_Adjustments {
59
  * @param WP_Query $wp_query
60
  *
61
  * @return string
62
- * @throws Toolset_Element_Exception_Element_Doesnt_Exist
63
  */
64
  public function posts_where( $where, $wp_query ) {
 
 
65
  if( property_exists( $wp_query, self::RELATIONSHIP_QUERY_ARG ) ) {
66
  $where = $this->add_relationship_query_where( $where, $wp_query->{self::RELATIONSHIP_QUERY_ARG}, $wp_query );
67
  }
@@ -78,6 +93,8 @@ class Toolset_Wp_Query_Adjustments_M2m extends Toolset_Wp_Query_Adjustments {
78
  * @return string
79
  */
80
  public function posts_join( $join, $wp_query ) {
 
 
81
  if( property_exists( $wp_query, self::RELATIONSHIP_QUERY_ARG ) ) {
82
  $join = $this->add_relationship_query_join( $join, $wp_query );
83
  }
@@ -91,13 +108,12 @@ class Toolset_Wp_Query_Adjustments_M2m extends Toolset_Wp_Query_Adjustments {
91
  * @param WP_Query $wp_query
92
  *
93
  * @return string
94
- * @throws Toolset_Element_Exception_Element_Doesnt_Exist
95
  */
96
  private function add_relationship_query_where( $where, $relationship_query, WP_Query $wp_query ) {
97
  $relationship_query = $this->normalize_relationship_query_args( $relationship_query );
98
 
99
  foreach( $relationship_query as $query_condition ) {
100
- $where .= ' ' . $this->add_relationship_query_condition( $query_condition, $wp_query );
101
  }
102
 
103
  return $where;
@@ -110,7 +126,7 @@ class Toolset_Wp_Query_Adjustments_M2m extends Toolset_Wp_Query_Adjustments {
110
  *
111
  * @return string
112
  */
113
- private function add_relationship_query_condition( $query_condition, WP_Query $wp_query ) {
114
  $relationship_slug = $this->get_relationship_slug( $query_condition );
115
  $related_to_post = $this->get_post( $query_condition );
116
 
@@ -120,15 +136,20 @@ class Toolset_Wp_Query_Adjustments_M2m extends Toolset_Wp_Query_Adjustments {
120
  return ' AND 0 = 1 ';
121
  }
122
 
123
- $role_to_return = $this->get_role( $query_condition, 'role' );
124
- $associations_table = $this->get_table_join_manager( $wp_query )->associations_table( $relationship_slug, $role_to_return );
125
 
 
126
  $role_to_query_by = $this->get_role( $query_condition, 'role_to_query_by', $role_to_return );
 
 
 
 
 
127
  $role_to_query_by_column = $this->get_database_operations()->role_to_column( $role_to_query_by );
128
 
129
  $clause = $this->wpdb->prepare(
130
  " AND $associations_table.$role_to_query_by_column = %d ",
131
- $related_to_post->get_default_language_id()
132
  );
133
 
134
  return $clause;
@@ -222,6 +243,17 @@ class Toolset_Wp_Query_Adjustments_M2m extends Toolset_Wp_Query_Adjustments {
222
  }
223
 
224
 
 
 
 
 
 
 
 
 
 
 
 
225
  /**
226
  * Get the "related_to" post from the query condition array.
227
  *
@@ -248,4 +280,278 @@ class Toolset_Wp_Query_Adjustments_M2m extends Toolset_Wp_Query_Adjustments {
248
  return $post;
249
  }
250
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
  }
7
  *
8
  * See the superclass for details.
9
  *
10
+ * Additionally, we also check for meta_key, meta_value, meta_value_num and meta_query
11
+ * for the legacy relationship postmeta and try to transform it into a toolset_relationships condition.
12
+ * See process_legacy_meta_query() for details.
13
+ *
14
  * @since 2.6.1
15
  */
16
  class Toolset_Wp_Query_Adjustments_M2m extends Toolset_Wp_Query_Adjustments {
24
  private $_element_factory;
25
 
26
 
27
+ /** @var null|Toolset_Relationship_Query_Factory */
28
+ private $_query_factory;
29
+
30
+
31
  /**
32
  * Toolset_Wp_Query_Adjustments_M2m constructor.
33
  *
34
  * @param wpdb|null $wpdb_di
35
  * @param Toolset_Relationship_Database_Operations|null $database_operations_di
36
  * @param Toolset_Element_Factory|null $element_factory_di
37
+ * @param Toolset_Relationship_Query_Factory|null $query_factory_di
38
  */
39
  public function __construct(
40
  wpdb $wpdb_di = null,
41
  Toolset_Relationship_Database_Operations $database_operations_di = null,
42
+ Toolset_Element_Factory $element_factory_di = null,
43
+ Toolset_Relationship_Query_Factory $query_factory_di = null
44
  ) {
45
  parent::__construct( $wpdb_di );
46
  $this->_database_operations = $database_operations_di;
47
  $this->_element_factory = $element_factory_di;
48
+ $this->_query_factory = $query_factory_di;
49
  }
50
 
51
 
55
  public function initialize() {
56
  parent::initialize();
57
 
58
+ add_action(
59
+ 'pre_get_posts',
60
+ array( $this, 'process_legacy_meta_query' ),
61
+ self::TIME_TO_STORE_RELATIONSHIPS_ARG - 1 // do not change this, third-party software might depend on it
62
+ );
63
 
64
  add_filter( 'posts_where', array( $this, 'posts_where' ), 10, 2 );
65
  add_filter( 'posts_join', array( $this, 'posts_join' ), 10, 2 );
73
  * @param WP_Query $wp_query
74
  *
75
  * @return string
 
76
  */
77
  public function posts_where( $where, $wp_query ) {
78
+ do_action( 'toolset_do_m2m_full_init' );
79
+
80
  if( property_exists( $wp_query, self::RELATIONSHIP_QUERY_ARG ) ) {
81
  $where = $this->add_relationship_query_where( $where, $wp_query->{self::RELATIONSHIP_QUERY_ARG}, $wp_query );
82
  }
93
  * @return string
94
  */
95
  public function posts_join( $join, $wp_query ) {
96
+ do_action( 'toolset_do_m2m_full_init' );
97
+
98
  if( property_exists( $wp_query, self::RELATIONSHIP_QUERY_ARG ) ) {
99
  $join = $this->add_relationship_query_join( $join, $wp_query );
100
  }
108
  * @param WP_Query $wp_query
109
  *
110
  * @return string
 
111
  */
112
  private function add_relationship_query_where( $where, $relationship_query, WP_Query $wp_query ) {
113
  $relationship_query = $this->normalize_relationship_query_args( $relationship_query );
114
 
115
  foreach( $relationship_query as $query_condition ) {
116
+ $where .= ' ' . $this->add_single_relationship_query_where_clause( $query_condition, $wp_query );
117
  }
118
 
119
  return $where;
126
  *
127
  * @return string
128
  */
129
+ private function add_single_relationship_query_where_clause( $query_condition, WP_Query $wp_query ) {
130
  $relationship_slug = $this->get_relationship_slug( $query_condition );
131
  $related_to_post = $this->get_post( $query_condition );
132
 
136
  return ' AND 0 = 1 ';
137
  }
138
 
139
+ $related_to_post_id = $related_to_post->get_default_language_id();
 
140
 
141
+ $role_to_return = $this->get_role( $query_condition, 'role' );
142
  $role_to_query_by = $this->get_role( $query_condition, 'role_to_query_by', $role_to_return );
143
+
144
+ $associations_table = $this->get_table_join_manager( $wp_query )->associations_table(
145
+ $relationship_slug, $role_to_return, $role_to_query_by, $related_to_post_id
146
+ );
147
+
148
  $role_to_query_by_column = $this->get_database_operations()->role_to_column( $role_to_query_by );
149
 
150
  $clause = $this->wpdb->prepare(
151
  " AND $associations_table.$role_to_query_by_column = %d ",
152
+ $related_to_post_id
153
  );
154
 
155
  return $clause;
243
  }
244
 
245
 
246
+ /**
247
+ * @return Toolset_Relationship_Query_Factory
248
+ */
249
+ private function get_query_factory() {
250
+ if( null === $this->_query_factory ) {
251
+ $this->_query_factory = new Toolset_Relationship_Query_Factory();
252
+ }
253
+ return $this->_query_factory;
254
+ }
255
+
256
+
257
  /**
258
  * Get the "related_to" post from the query condition array.
259
  *
280
  return $post;
281
  }
282
 
283
+
284
+ /**
285
+ * Check the postmeta query arguments and if we detect an understandable usage of
286
+ * the legacy relationship postmeta, transform it into a toolset_relationships query.
287
+ *
288
+ * We check for:
289
+ * - meta_key and meta_value or meta_value_num
290
+ * - meta_query
291
+ *
292
+ * There are several limitations as to what we can parse:
293
+ *
294
+ * - Only legacy (migrated) relationships are supported.
295
+ * - It must be possible to determine a single relationship from the information passed to the query:
296
+ * - The postmeta already contains the parent post type slug.
297
+ * - For the child slug, either there's some information in the "post_type" query argument, or
298
+ * we check against all post types.
299
+ *
300
+ * For example, if there are legacy relationships between CPTS: A >> B, A >> C, B >> C,
301
+ *
302
+ * we will always succeed with a meta_query for "_wpcf_belongs_b_id" (because there is only a
303
+ * single relationship that has B post type as a parent), but we will succeed with
304
+ * "_wpcf_belongs_a_id" only if the query also contains a post_type argument that doesn't contain
305
+ * both B and C post types.
306
+ *
307
+ * Non-legacy relationships are completely ignored here.
308
+ * - Only the topmost level of the 'meta_query' is processed, and we ignore anything nested.
309
+ * - 'meta_compare' argument or 'compare' within 'meta_query' must be '=' (or missing, since this is the default value)
310
+ * - 'relation' within 'meta_query' must be 'AND' (or missing).
311
+ *
312
+ * If we hit any of these limitations, we don't do anything and let the query run as-is.
313
+ *
314
+ * Otherwise, the condition is turned into a toolset_relationships one and removed.
315
+ *
316
+ * Note that we also remove meta_key together with meta_value/meta_value_num, which is necessary for the
317
+ * query to yield correct results. meta_key might be *theoretically* used for ordering, but it makes
318
+ * very little sense to order by IDs of parent post, so we take the risk.
319
+ *
320
+ * This is WPML-compatible and should yield results according to the allowed translation mode of post types
321
+ * involved in a relationship.
322
+ *
323
+ * @since 2.6.4
324
+ * @param WP_Query $query
325
+ */
326
+ public function process_legacy_meta_query( $query ) {
327
+ if( ! $query instanceof WP_Query ) {
328
+ // Something weird is happening.
329
+ return;
330
+ }
331
+
332
+ $this->maybe_process_meta_value( $query );
333
+ $this->maybe_process_meta_query( $query );
334
+ }
335
+
336
+
337
+ /**
338
+ * Try transforming meta_key + meta_value/meta_value_num into a toolset_relationships condition.
339
+ *
340
+ * @since 2.6.4
341
+ * @param WP_Query $query
342
+ */
343
+ private function maybe_process_meta_value( WP_Query $query ) {
344
+ if(
345
+ ! array_key_exists( 'meta_key', $query->query_vars )
346
+ ) {
347
+ return;
348
+ }
349
+
350
+ $parent_post_type = $this->parse_legacy_meta_key( $query->query_vars['meta_key'] );
351
+ if( null === $parent_post_type ) {
352
+ return; // not our legacy postmeta
353
+ }
354
+
355
+ if( array_key_exists( 'meta_value_num', $query->query_vars ) ) {
356
+ $post_id = (int) $query->query_vars['meta_value_num'];
357
+ } elseif( array_key_exists( 'meta_value', $query->query_vars ) ) {
358
+ $post_id = (int) $query->query_vars['meta_value'];
359
+ } else {
360
+ return;
361
+ }
362
+
363
+ if(
364
+ array_key_exists( 'meta_compare', $query->query_vars )
365
+ && '=' !== $query->query_vars['meta_compare']
366
+ ) {
367
+ return;
368
+ }
369
+
370
+ $was_transformed = $this->try_transforming_legacy_meta_query( $query, $parent_post_type, $post_id );
371
+
372
+ if( $was_transformed ) {
373
+ unset( $query->query_vars['meta_value'] );
374
+ unset( $query->query_vars['meta_value_num'] );
375
+
376
+ // Theoretically, meta_key could be also used for sorting, but it makes very little sense
377
+ // to sort by IDs of parent posts.
378
+ //
379
+ // We need to remove it because it would otherwise cause an inner join on the
380
+ // postmeta table with the legacy postmeta key, effectively excluding
381
+ // all posts with associations created after the migration to m2m.
382
+ unset( $query->query_vars['meta_key'] );
383
+ }
384
+ }
385
+
386
+
387
+ /**
388
+ * Try building a toolset_relationships condition out of the provided information.
389
+ *
390
+ * @param WP_Query $query
391
+ * @param string $parent_post_type
392
+ * @param int $parent_id
393
+ *
394
+ * @return bool True if the transformation took place, false if it couldn't be done.
395
+ * @since 2.6.4
396
+ */
397
+ private function try_transforming_legacy_meta_query( WP_Query $query, $parent_post_type, $parent_id ) {
398
+
399
+ if( 0 === (int) $parent_id ) {
400
+ return false;
401
+ }
402
+
403
+ do_action( 'toolset_do_m2m_full_init' );
404
+
405
+ $relationship = $this->determine_relationship( $query, $parent_post_type );
406
+
407
+ if( null === $relationship ) {
408
+ return false;
409
+ }
410
+
411
+ $relationship_query_arg = array(
412
+ 'role' => 'child', // legacy code had to be querying child posts
413
+ 'related_to' => (int) $parent_id,
414
+ 'relationship' => $relationship->get_slug(),
415
+ );
416
+
417
+ $this->add_relationship_query_condition( $query, $relationship_query_arg );
418
+
419
+ return true;
420
+ }
421
+
422
+
423
+ /**
424
+ * Look for a single matching relationship definition.
425
+ *
426
+ * Use the post_type query argument, parent post type and is_legacy flag of the relationship definition.
427
+ *
428
+ * @param WP_Query $query
429
+ * @param $parent_post_type
430
+ *
431
+ * @return IToolset_Relationship_Definition|null Relationship definition or null if there are more than
432
+ * one results or no results.
433
+ * @since 2.6.4
434
+ */
435
+ private function determine_relationship( WP_Query $query, $parent_post_type ) {
436
+ $child_post_types = toolset_getarr( $query->query_vars, 'post_type' );
437
+ if( ! is_array( $child_post_types ) ) {
438
+ $child_post_types = array( $child_post_types );
439
+ }
440
+ if( in_array( 'any', $child_post_types ) ) {
441
+ $child_post_types = array();
442
+ }
443
+
444
+ $relationship_query = $this->get_query_factory()->relationships_v2();
445
+ $relationships = $relationship_query
446
+ ->add( $relationship_query->is_legacy() )
447
+ ->add( $relationship_query->has_domain_and_type(
448
+ $parent_post_type, Toolset_Element_Domain::POSTS, new Toolset_Relationship_Role_Parent() )
449
+ )
450
+ ->add( $relationship_query->has_domain( Toolset_Element_Domain::POSTS, new Toolset_Relationship_Role_Child() ) )
451
+ ->add(
452
+ // we can afford to add empty or condition
453
+ $relationship_query->do_or(
454
+ array_map(
455
+ function ( $child_post_type ) use ( $relationship_query ) {
456
+ return $relationship_query->has_type( $child_post_type, new Toolset_Relationship_Role_Child() );
457
+ }, $child_post_types
458
+ )
459
+ )
460
+ )
461
+ ->get_results();
462
+
463
+ if( count( $relationships ) !== 1 ) {
464
+ return null;
465
+ }
466
+
467
+ return array_pop( $relationships );
468
+ }
469
+
470
+
471
+ /**
472
+ * Add a single condition to the toolset_relationships query argument.
473
+ *
474
+ * @param WP_Query $query
475
+ * @param $condition
476
+ * @since 2.6.4
477
+ */
478
+ private function add_relationship_query_condition( WP_Query $query, $condition ) {
479
+ if( ! array_key_exists( self::RELATIONSHIP_QUERY_ARG, $query->query_vars ) ) {
480
+ $query->query_vars[ self::RELATIONSHIP_QUERY_ARG ] = array();
481
+ } else {
482
+ $query->query_vars[ self::RELATIONSHIP_QUERY_ARG ] = $this->normalize_relationship_query_args(
483
+ $query->query_vars[ self::RELATIONSHIP_QUERY_ARG ]
484
+ );
485
+ }
486
+
487
+ $query->query_vars[ self::RELATIONSHIP_QUERY_ARG ][] = $condition;
488
+ }
489
+
490
+
491
+ /**
492
+ * Try transforming a top level meta_query into toolset_relationships conditions.
493
+ *
494
+ * @param WP_Query $query
495
+ * @since 2.6.4
496
+ */
497
+ private function maybe_process_meta_query( WP_Query $query ) {
498
+ if( ! array_key_exists( 'meta_query', $query->query_vars ) ) {
499
+ return;
500
+ }
501
+
502
+ $meta_query = $query->query_vars['meta_query'];
503
+
504
+ if( ! is_array( $meta_query ) ) {
505
+ return;
506
+ }
507
+
508
+ if( 'AND' !== toolset_getarr( $meta_query, 'relation', 'AND' ) ) {
509
+ return;
510
+ }
511
+
512
+ foreach( $meta_query as $single_meta_query_key => $single_meta_query ) {
513
+
514
+ if( '=' !== toolset_getarr( $single_meta_query, 'compare', '=' ) ) {
515
+ continue;
516
+ }
517
+
518
+ $parent_post_type = $this->parse_legacy_meta_key( toolset_getarr( $single_meta_query, 'key' ) );
519
+ if( null === $parent_post_type ) {
520
+ continue;
521
+ }
522
+
523
+ $parent_post_id = (int) toolset_getarr( $single_meta_query, 'value' );
524
+
525
+ $was_transformed = $this->try_transforming_legacy_meta_query( $query, $parent_post_type, $parent_post_id );
526
+
527
+ if( ! $was_transformed ) {
528
+ continue;
529
+ }
530
+
531
+ unset( $query->query_vars['meta_query'][ $single_meta_query_key ] );
532
+ }
533
+ }
534
+
535
+
536
+ /**
537
+ * Extract the parent post type from the legacy relationship postmeta key.
538
+ *
539
+ * @param string $meta_key
540
+ *
541
+ * @return string|null Parent post type slug or null if the meta_key stands for something else.
542
+ * @since 2.6.4
543
+ */
544
+ private function parse_legacy_meta_key( $meta_key ) {
545
+ $matches = array();
546
+ preg_match( '/^_wpcf_belongs_([a-z0-9_-]+)_id$/', $meta_key, $matches );
547
+
548
+ if( empty( $matches ) || count( $matches ) < 2 ) {
549
+ return null;
550
+ }
551
+
552
+ return $matches[1];
553
+ }
554
+
555
+
556
+
557
  }
vendor/toolset/toolset-common/inc/autoloaded/wp_query_adjustments/table_join_manager.php CHANGED
@@ -9,7 +9,11 @@ class Toolset_Wp_Query_Adjustments_Table_Join_Manager extends Toolset_Wpdb_User
9
 
10
 
11
  /**
12
- * @var string[][] Unique aliases for the associations table, indexed by a relationship slug and a role name.
 
 
 
 
13
  */
14
  private $joins = array();
15
 
@@ -69,9 +73,21 @@ class Toolset_Wp_Query_Adjustments_Table_Join_Manager extends Toolset_Wpdb_User
69
  public function get_join_clauses() {
70
  $results = '';
71
 
72
- foreach( $this->joins as $relationship_slug => $role_joins ) {
73
- foreach( $role_joins as $role_name => $table_alias ) {
74
- $results .= $this->get_single_join_clause( $relationship_slug, $table_alias, $role_name );
 
 
 
 
 
 
 
 
 
 
 
 
75
  }
76
  }
77
 
@@ -79,9 +95,27 @@ class Toolset_Wp_Query_Adjustments_Table_Join_Manager extends Toolset_Wpdb_User
79
  }
80
 
81
 
82
- private function get_single_join_clause( $relationship_slug, $associations_table_alias, $role_name ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
 
84
- $element_id_column = $this->database_operations->role_to_column( $role_name );
 
85
  $relationship_definition = $this->definition_repository->get_definition( $relationship_slug );
86
 
87
  if( null === $relationship_definition ) {
@@ -92,15 +126,19 @@ class Toolset_Wp_Query_Adjustments_Table_Join_Manager extends Toolset_Wpdb_User
92
  $relationship_id = $relationship_definition->get_row_id();
93
 
94
  if( $this->wpml_service->is_wpml_active_and_configured() ) {
95
- return $this->get_single_join_clause_for_wpml( $relationship_id, $associations_table_alias, $element_id_column );
 
 
96
  }
97
 
98
  return $this->wpdb->prepare(
99
  "JOIN {$this->table_name->association_table()} AS {$associations_table_alias} ON (
100
- wp_posts.ID = {$associations_table_alias}.{$element_id_column}
101
  AND {$associations_table_alias}.relationship_id = %d
 
102
  ) ",
103
- $relationship_id
 
104
  );
105
  }
106
 
@@ -111,35 +149,55 @@ class Toolset_Wp_Query_Adjustments_Table_Join_Manager extends Toolset_Wpdb_User
111
  *
112
  * @param int $relationship_id
113
  * @param string $associations_table_alias
114
- * @param string $element_id_column
 
 
115
  *
116
  * @return string
117
  */
118
- private function get_single_join_clause_for_wpml( $relationship_id, $associations_table_alias, $element_id_column ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
 
120
  $clause = $this->wpdb->prepare(
121
  "
122
  # join the icl_translations table independently from WPML's 't'
123
  # because that one may not be joined at all time, but we
124
  # need it always - this is safer than trying to reuse the 't' one
125
- LEFT JOIN {$this->wpml_service->icl_translations_table_name()} AS toolset_post_t ON (
126
- wp_posts.ID = toolset_post_t.element_id
127
- AND toolset_post_t.element_type = CONCAT('post_', wp_posts.post_type)
128
- ) LEFT JOIN {$this->wpml_service->icl_translations_table_name()} AS toolset_post_dl ON (
129
- toolset_post_t.trid = toolset_post_dl.trid
130
- AND toolset_post_dl.language_code = %s
131
  ) JOIN {$this->table_name->association_table()} AS {$associations_table_alias} ON (
132
  (
133
  # join the association row if either the post ID matches the
134
  # proper column in the associations table or if the ID of the default
135
  # language version of the post matches it
136
- wp_posts.ID = {$associations_table_alias}.{$element_id_column}
137
- OR toolset_post_dl.element_id = {$associations_table_alias}.{$element_id_column}
138
  )
139
  AND {$associations_table_alias}.relationship_id = %d
 
140
  )",
141
  $this->wpml_service->get_default_language(),
142
- $relationship_id
 
143
  );
144
 
145
  return $clause;
@@ -149,24 +207,34 @@ class Toolset_Wp_Query_Adjustments_Table_Join_Manager extends Toolset_Wpdb_User
149
  /**
150
  * Request an alias for the associations table.
151
  *
 
 
152
  * The table will be JOINed on wp_posts.ID by a given relationship slug and element role.
153
  *
154
  * @param string $relationship_slug
155
- * @param IToolset_Relationship_Role $role
 
 
 
156
  *
157
  * @return string
158
  */
159
- public function associations_table( $relationship_slug, IToolset_Relationship_Role $role ) {
160
- if( ! array_key_exists( $relationship_slug, $this->joins ) ) {
161
- $this->joins[ $relationship_slug ] = array();
162
- }
 
 
 
163
 
164
- if( ! array_key_exists( $role->get_name(), $this->joins[ $relationship_slug ] ) ) {
165
- $unique_alias = $this->uniqe_table_alias->generate( $this->table_name->association_table(), true );
166
- $this->joins[ $relationship_slug ][ $role->get_name() ] = $unique_alias;
167
  }
168
 
169
- return $this->joins[ $relationship_slug ][ $role->get_name() ];
 
 
 
170
  }
171
 
172
  }
9
 
10
 
11
  /**
12
+ * @var string[][][][] Unique aliases for the associations table, indexed by:
13
+ * 1. relationship slug,
14
+ * 2. role name to join the table on (to wp_posts.ID) ("role to return")
15
+ * 3. role name to constrain the results with ("role to query by")
16
+ * 4. ID of the associated element in the role to query by
17
  */
18
  private $joins = array();
19
 
73
  public function get_join_clauses() {
74
  $results = '';
75
 
76
+ foreach( $this->joins as $relationship_slug => $data_by_relationship_slug ) {
77
+ foreach( $data_by_relationship_slug as $role_to_return_name => $data_by_role_to_return ) {
78
+ foreach( $data_by_role_to_return as $role_to_query_by => $data_by_role_to_query ) {
79
+ foreach( $data_by_role_to_query as $post_to_query_by => $table_alias ) {
80
+
81
+ $results .= $this->get_single_join_clause(
82
+ $relationship_slug,
83
+ $role_to_return_name,
84
+ $role_to_query_by,
85
+ $post_to_query_by,
86
+ $table_alias
87
+ );
88
+
89
+ }
90
+ }
91
  }
92
  }
93
 
95
  }
96
 
97
 
98
+ /**
99
+ * Build a JOIN clause for one table alias.
100
+ *
101
+ * Note: We need to limit the query by a particular associated element, otherwise we couldn't
102
+ * work with multiple JOINs in one query. This is not a problem because of how this class is used -
103
+ * to query only posts that have associations to all the requested elements (always AND, no OR).
104
+ *
105
+ * @param string $relationship_slug
106
+ * @param string $role_to_return_name
107
+ * @param string $role_to_query_by
108
+ * @param int $element_to_query_by
109
+ * @param string $associations_table_alias
110
+ *
111
+ * @return string
112
+ */
113
+ private function get_single_join_clause(
114
+ $relationship_slug, $role_to_return_name, $role_to_query_by, $element_to_query_by, $associations_table_alias
115
+ ) {
116
 
117
+ $role_to_return_id_column = $this->database_operations->role_to_column( $role_to_return_name );
118
+ $role_to_query_by_id_column = $this->database_operations->role_to_column( $role_to_query_by );
119
  $relationship_definition = $this->definition_repository->get_definition( $relationship_slug );
120
 
121
  if( null === $relationship_definition ) {
126
  $relationship_id = $relationship_definition->get_row_id();
127
 
128
  if( $this->wpml_service->is_wpml_active_and_configured() ) {
129
+ return $this->get_single_join_clause_for_wpml(
130
+ $relationship_id, $associations_table_alias, $role_to_return_id_column, $role_to_query_by_id_column, $element_to_query_by
131
+ );
132
  }
133
 
134
  return $this->wpdb->prepare(
135
  "JOIN {$this->table_name->association_table()} AS {$associations_table_alias} ON (
136
+ wp_posts.ID = {$associations_table_alias}.{$role_to_return_id_column}
137
  AND {$associations_table_alias}.relationship_id = %d
138
+ AND {$associations_table_alias}.{$role_to_query_by_id_column} = %d
139
  ) ",
140
+ $relationship_id,
141
+ $element_to_query_by
142
  );
143
  }
144
 
149
  *
150
  * @param int $relationship_id
151
  * @param string $associations_table_alias
152
+ * @param string $role_to_return_column
153
+ * @param string $role_to_query_by_column
154
+ * @param int $element_to_query_by
155
  *
156
  * @return string
157
  */
158
+ private function get_single_join_clause_for_wpml(
159
+ $relationship_id,
160
+ $associations_table_alias,
161
+ $role_to_return_column,
162
+ $role_to_query_by_column,
163
+ $element_to_query_by
164
+ ) {
165
+
166
+ $alias_translation = 'toolset_t_' . $this->uniqe_table_alias->generate(
167
+ $this->wpml_service->icl_translations_table_name(),
168
+ true
169
+ );
170
+
171
+ $alias_default_lang = 'toolset_dl_' . $this->uniqe_table_alias->generate(
172
+ $this->wpml_service->icl_translations_table_name(),
173
+ true
174
+ );
175
 
176
  $clause = $this->wpdb->prepare(
177
  "
178
  # join the icl_translations table independently from WPML's 't'
179
  # because that one may not be joined at all time, but we
180
  # need it always - this is safer than trying to reuse the 't' one
181
+ LEFT JOIN {$this->wpml_service->icl_translations_table_name()} AS {$alias_translation} ON (
182
+ wp_posts.ID = {$alias_translation}.element_id
183
+ AND {$alias_translation}.element_type = CONCAT('post_', wp_posts.post_type)
184
+ ) LEFT JOIN {$this->wpml_service->icl_translations_table_name()} AS {$alias_default_lang} ON (
185
+ {$alias_translation}.trid = {$alias_default_lang}.trid
186
+ AND {$alias_default_lang}.language_code = %s
187
  ) JOIN {$this->table_name->association_table()} AS {$associations_table_alias} ON (
188
  (
189
  # join the association row if either the post ID matches the
190
  # proper column in the associations table or if the ID of the default
191
  # language version of the post matches it
192
+ wp_posts.ID = {$associations_table_alias}.{$role_to_return_column}
193
+ OR {$alias_default_lang}.element_id = {$associations_table_alias}.{$role_to_return_column}
194
  )
195
  AND {$associations_table_alias}.relationship_id = %d
196
+ AND {$associations_table_alias}.{$role_to_query_by_column} = %d
197
  )",
198
  $this->wpml_service->get_default_language(),
199
+ $relationship_id,
200
+ $element_to_query_by
201
  );
202
 
203
  return $clause;
207
  /**
208
  * Request an alias for the associations table.
209
  *
210
+ * Each call will cause a new JOIN and return a new unique table alias.
211
+ *
212
  * The table will be JOINed on wp_posts.ID by a given relationship slug and element role.
213
  *
214
  * @param string $relationship_slug
215
+ * @param IToolset_Relationship_Role $role_to_return
216
+ *
217
+ * @param IToolset_Relationship_Role $role_to_query_by
218
+ * @param $query_by_element_id
219
  *
220
  * @return string
221
  */
222
+ public function associations_table(
223
+ $relationship_slug, IToolset_Relationship_Role $role_to_return,
224
+ IToolset_Relationship_Role $role_to_query_by,
225
+ $query_by_element_id
226
+ ) {
227
+ $path_to_value = array( $relationship_slug, $role_to_return->get_name(), $role_to_query_by->get_name(), (int) $query_by_element_id );
228
+ $stored_alias = toolset_getnest( $this->joins, $path_to_value, null );
229
 
230
+ if( null !== $stored_alias ) {
231
+ return $stored_alias;
 
232
  }
233
 
234
+ $unique_alias = $this->uniqe_table_alias->generate( $this->table_name->association_table(), true );
235
+ $this->joins = Toolset_Utils::set_nested_value( $this->joins, $path_to_value, $unique_alias );
236
+
237
+ return $unique_alias;
238
  }
239
 
240
  }
vendor/toolset/toolset-common/inc/m2m/association/Repository.php ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ namespace OTGS\Toolset\Common\M2M\Association;
5
+
6
+
7
+ /**
8
+ * Class Repository
9
+ *
10
+ * This is useful when you know you will have to do a lot of association request.
11
+ * Instead of doing a lot of small database queries you load them to this repository by doing bigger queries
12
+ * and use this for the smaller afterwards request instead of asking the database.
13
+ *
14
+ * Example of usage: Types_Import_Export::wp_export_before()
15
+ *
16
+ * It can also be (ab)used as a container of Assocation/Relationship_Query and Roles
17
+ * (to make sure you can still do very specific requests, without the need of additional injection).
18
+ * Always consider to extend this Repository class instead of abusing it as a container.
19
+ *
20
+ * @package OTGS\Toolset\Types\Relationship\Association
21
+ */
22
+ class Repository {
23
+ /** @var \Toolset_Relationship_Role_Parent */
24
+ private $role_parent;
25
+
26
+ /** @var \Toolset_Relationship_Role_Child */
27
+ private $role_child;
28
+
29
+ /** @var \Toolset_Relationship_Role_Intermediary */
30
+ private $role_intermediary;
31
+
32
+ /** @var \Toolset_Relationship_Query_Factory */
33
+ private $query_factory;
34
+
35
+ /** @var \Toolset_Element_Domain */
36
+ private $element_domain;
37
+
38
+ /** @var \Toolset_Association[] */
39
+ private $associations = array();
40
+
41
+ /** @var array log of what's already loaded */
42
+ private $alreadyLoaded = array(
43
+ 'posttype' => array(),
44
+ 'child' => array()
45
+ );
46
+
47
+ /**
48
+ * Repository constructor.
49
+ *
50
+ * @param \Toolset_Relationship_Query_Factory $query_factory
51
+ * @param \Toolset_Relationship_Role_Parent $role_parent
52
+ * @param \Toolset_Relationship_Role_Child $role_child
53
+ * @param \Toolset_Relationship_Role_Intermediary $role_Intermediary
54
+ * @param \Toolset_Element_Domain $element_domain
55
+ */
56
+ public function __construct(
57
+ \Toolset_Relationship_Query_Factory $query_factory,
58
+ \Toolset_Relationship_Role_Parent $role_parent,
59
+ \Toolset_Relationship_Role_Child $role_child,
60
+ \Toolset_Relationship_Role_Intermediary $role_Intermediary,
61
+ \Toolset_Element_Domain $element_domain
62
+ ) {
63
+ $this->query_factory = $query_factory;
64
+ $this->role_parent = $role_parent;
65
+ $this->role_child = $role_child;
66
+ $this->role_intermediary = $role_Intermediary;
67
+ $this->element_domain = $element_domain;
68
+ }
69
+
70
+ /**
71
+ * @param \IToolset_Post $toolset_post
72
+ *
73
+ * @return \Toolset_Association[]
74
+ * @throws \Toolset_Element_Exception_Element_Doesnt_Exist
75
+ */
76
+ public function getAssociationsByChildPost( \IToolset_Post $toolset_post ) {
77
+ $result = array();
78
+
79
+ foreach( $this->associations as $association ){
80
+ if( $association->get_element_id( $this->getRoleChild() ) == $toolset_post->get_id() ) {
81
+ $result[$association->get_uid()] = $association;
82
+ }
83
+ }
84
+
85
+ return $result;
86
+ }
87
+
88
+ /**
89
+ * @param \IToolset_Association $association
90
+ */
91
+ public function addAssociation( \IToolset_Association $association ) {
92
+ $this->associations[ $association->get_uid() ] = $association;
93
+ }
94
+
95
+ public function addAssociationsByChild( \IToolset_Element $child ) {
96
+ if( isset( $this->alreadyLoaded['child'][ $child->get_id() ] ) ) {
97
+ // Associations of $child already applied
98
+ return;
99
+ }
100
+
101
+ // get associations by $child
102
+ $qry = $this->getAssociationQuery();
103
+
104
+ $associations = $qry
105
+ ->add( $qry->element( $child, $this->getRoleChild(), false, false ) )
106
+ ->get_results();
107
+
108
+ foreach( $associations as $association ) {
109
+ $this->addAssociation( $association );
110
+ }
111
+
112
+ // mark $child asoociations $
113
+ $this->alreadyLoaded['child'][ $child->get_id() ] = true;
114
+ }
115
+
116
+ /**
117
+ * Load associations by given post type
118
+ * This methods also tracks what's already loaded, means you don't need to care about loading associations
119
+ * of a post type more than once.
120
+ *
121
+ * @param \IToolset_Post_Type $post_type
122
+ */
123
+ public function addAssociationsByPostType( \IToolset_Post_Type $post_type ) {
124
+ if( isset( $this->alreadyLoaded['posttype'][ $post_type->get_slug() ] ) ) {
125
+ // Associations of $post_type already applied
126
+ return;
127
+ }
128
+
129
+ // extra assignment is needed because PHP 5.3 does not support: $this->var::CONST, but $var::CONST is fine
130
+ $element_domain = $this->element_domain;
131
+
132
+ $qry = $this->getRelationshipQuery();
133
+ $relationships = $qry
134
+ ->add( $qry->has_domain_and_type( $post_type->get_slug(), $element_domain::POSTS ) )
135
+ ->add( $qry->origin( null ) )
136
+ ->get_results();
137
+
138
+ foreach( $relationships as $relationship ) {
139
+ $qry = $this->getAssociationQuery();
140
+ $associations = $qry
141
+ ->add( $qry->relationship( $relationship ) )
142
+ ->get_results();
143
+
144
+ foreach( $associations as $association ) {
145
+ $this->addAssociation( $association );
146
+ }
147
+ }
148
+
149
+ // mark $post_type as loaded
150
+ $this->alreadyLoaded['posttype'][ $post_type->get_slug() ] = true;
151
+ }
152
+
153
+ /**
154
+ * @param int|null $limit Optional (the best feature of Toolset_Association_Query is back)
155
+ *
156
+ * @return \Toolset_Association_Query_V2
157
+ */
158
+ public function getAssociationQuery( $limit = null ) {
159
+ $qry = $this->query_factory->associations_v2();
160
+ $qry->limit( $limit ?: 999999999 );
161
+ return $qry;
162
+ }
163
+
164
+ /**
165
+ * @return \Toolset_Relationship_Query_V2
166
+ */
167
+ public function getRelationshipQuery() {
168
+ return $this->query_factory->relationships_v2();
169
+ }
170
+
171
+ /**
172
+ * @return \Toolset_Relationship_Role_Parent
173
+ */
174
+ public function getRoleParent() {
175
+ return $this->role_parent;
176
+ }
177
+
178
+ /**
179
+ * @return \Toolset_Relationship_Role_Child
180
+ */
181
+ public function getRoleChild() {
182
+ return $this->role_child;
183
+ }
184
+
185
+ /**
186
+ * @return \Toolset_Relationship_Role_Intermediary
187
+ */
188
+ public function getRoleIntermediary() {
189
+ return $this->role_intermediary;
190
+ }
191
+
192
+
193
+ }
vendor/toolset/toolset-common/inc/m2m/association/association.php CHANGED
@@ -8,27 +8,20 @@
8
  * Not to be used directly outside of the m2m API.
9
  *
10
  * @since m2m
11
- * @refactoring!!!! Store intermediary ID and post object in the same way as the other elements.
12
  */
13
  class Toolset_Association implements IToolset_Association {
14
 
15
 
16
  /**
17
- * @var int[] IDs of elements, always complete.
18
  *
19
  * However, in case we deal with translatable elements, this will hold only the IDs
20
  * of the default language versions, so these values can't be always used directly.
21
  * get_element_id() will handle the translation if necessary.
22
- */
23
- private $element_ids = array();
24
-
25
-
26
- /**
27
- * @var int Intermediary post ID or zero if there is no intermediary post at all.
28
  *
29
- * See the note for $element_ids. Same goes here.
30
  */
31
- private $intermediary_id;
32
 
33
 
34
  /** @var Toolset_Relationship_Definition */
@@ -47,12 +40,6 @@ class Toolset_Association implements IToolset_Association {
47
  private $uid;
48
 
49
 
50
- /**
51
- * @var null|IToolset_Post
52
- */
53
- protected $intermediary_post;
54
-
55
-
56
  /** @var Toolset_WPML_Compatibility */
57
  private $wpml_service;
58
 
@@ -141,7 +128,7 @@ class Toolset_Association implements IToolset_Association {
141
  && 0 === (int) $element_source
142
  ) {
143
  // No intermediary post.
144
- $this->intermediary_id = 0;
145
  return;
146
  }
147
 
@@ -180,18 +167,10 @@ class Toolset_Association implements IToolset_Association {
180
  throw new InvalidArgumentException( 'Invalid or missing element source.' );
181
  }
182
 
183
- if( $is_intermediary ) {
184
- $this->intermediary_id = $element_id;
185
- if( null !== $element ) {
186
- $this->intermediary_post = $element;
187
- }
188
- } else {
189
- $this->element_ids[ $role_name ] = $element_id;
190
- if( null !== $element ) {
191
- $this->elements[ $role_name ] = $element;
192
- }
193
  }
194
-
195
  }
196
 
197
 
@@ -237,10 +216,6 @@ class Toolset_Association implements IToolset_Association {
237
  $element_role_name = Toolset_Relationship_Role::name_from_role( $element_role );
238
 
239
  if( ! $this->can_be_translated() ) {
240
- if( Toolset_Relationship_Role::INTERMEDIARY === $element_role_name ) {
241
- return $this->intermediary_id;
242
- }
243
-
244
  return $this->element_ids[ $element_role_name ];
245
  }
246
 
@@ -272,10 +247,15 @@ class Toolset_Association implements IToolset_Association {
272
  public function get_element( $element_role ) {
273
  $element_role_name = Toolset_Relationship_Role::name_from_role( $element_role );
274
 
275
- if( Toolset_Relationship_Role::INTERMEDIARY === $element_role_name ) {
276
- return $this->get_intermediary_post();
 
 
 
 
277
  }
278
 
 
279
  if(
280
  ! array_key_exists( $element_role_name, $this->elements )
281
  || null === $this->elements[ $element_role_name ]
@@ -349,20 +329,10 @@ class Toolset_Association implements IToolset_Association {
349
  * @return null|IToolset_Post
350
  */
351
  protected function get_intermediary_post() {
352
- if( 0 === $this->intermediary_id ) {
353
- return null;
354
- }
355
-
356
- if( null === $this->intermediary_post ) {
357
- try {
358
- $this->intermediary_post = $this->get_element_factory()->get_post( $this->intermediary_id );
359
- } catch( Exception $e ) {
360
- // We couldn't load the post, it probably doesn't exist. Reset the ID to avoid checking again.
361
- $this->intermediary_id = 0;
362
- }
363
- }
364
 
365
- return $this->intermediary_post;
366
  }
367
 
368
 
@@ -403,7 +373,7 @@ class Toolset_Association implements IToolset_Association {
403
  */
404
  public function get_intermediary_id() {
405
  if( ! $this->can_be_translated() ) {
406
- return $this->intermediary_id;
407
  }
408
 
409
  // We have to go through the post object because it might be translated.
8
  * Not to be used directly outside of the m2m API.
9
  *
10
  * @since m2m
 
11
  */
12
  class Toolset_Association implements IToolset_Association {
13
 
14
 
15
  /**
16
+ * @var int[] IDs of elements indexed by role names, always complete.
17
  *
18
  * However, in case we deal with translatable elements, this will hold only the IDs
19
  * of the default language versions, so these values can't be always used directly.
20
  * get_element_id() will handle the translation if necessary.
 
 
 
 
 
 
21
  *
22
+ * If the association has no intermediary post, zero will be stored as its ID.
23
  */
24
+ private $element_ids = array();
25
 
26
 
27
  /** @var Toolset_Relationship_Definition */
40
  private $uid;
41
 
42
 
 
 
 
 
 
 
43
  /** @var Toolset_WPML_Compatibility */
44
  private $wpml_service;
45
 
128
  && 0 === (int) $element_source
129
  ) {
130
  // No intermediary post.
131
+ $this->element_ids[ Toolset_Relationship_Role::INTERMEDIARY ] = 0;
132
  return;
133
  }
134
 
167
  throw new InvalidArgumentException( 'Invalid or missing element source.' );
168
  }
169
 
170
+ $this->element_ids[ $role_name ] = $element_id;
171
+ if( null !== $element ) {
172
+ $this->elements[ $role_name ] = $element;
 
 
 
 
 
 
 
173
  }
 
174
  }
175
 
176
 
216
  $element_role_name = Toolset_Relationship_Role::name_from_role( $element_role );
217
 
218
  if( ! $this->can_be_translated() ) {
 
 
 
 
219
  return $this->element_ids[ $element_role_name ];
220
  }
221
 
247
  public function get_element( $element_role ) {
248
  $element_role_name = Toolset_Relationship_Role::name_from_role( $element_role );
249
 
250
+ if(
251
+ Toolset_Relationship_Role::INTERMEDIARY === $element_role_name
252
+ && 0 === $this->element_ids[ Toolset_Relationship_Role::INTERMEDIARY ]
253
+ ) {
254
+ // If we know that there is no intermediary post at all, we'll not even try.
255
+ return null;
256
  }
257
 
258
+ // Load the element if missing.
259
  if(
260
  ! array_key_exists( $element_role_name, $this->elements )
261
  || null === $this->elements[ $element_role_name ]
329
  * @return null|IToolset_Post
330
  */
331
  protected function get_intermediary_post() {
332
+ /** @var IToolset_Post|null $post */
333
+ $post = $this->get_element( new Toolset_Relationship_Role_Intermediary() );
 
 
 
 
 
 
 
 
 
 
334
 
335
+ return $post;
336
  }
337
 
338
 
373
  */
374
  public function get_intermediary_id() {
375
  if( ! $this->can_be_translated() ) {
376
+ return $this->element_ids[ Toolset_Relationship_Role::INTERMEDIARY ];
377
  }
378
 
379
  // We have to go through the post object because it might be translated.
vendor/toolset/toolset-common/inc/m2m/association/cleanup/cron_handler.php CHANGED
@@ -51,7 +51,4 @@ class Toolset_Association_Cleanup_Cron_Handler {
51
  $event = $this->cleanup_factory->cron_event();
52
  $this->cron->unschedule_event( $event );
53
  }
54
-
55
-
56
-
57
  }
51
  $event = $this->cleanup_factory->cron_event();
52
  $this->cron->unschedule_event( $event );
53
  }
 
 
 
54
  }
vendor/toolset/toolset-common/inc/m2m/association/cleanup/post.php CHANGED
@@ -44,7 +44,7 @@ class Toolset_Association_Cleanup_Post extends Toolset_Wpdb_User {
44
  const DELETE_POSTS_PER_BATCH = 25;
45
 
46
 
47
- const IS_DELETING_FILTER = 'toolset_is_deleting_intermediary_post';
48
 
49
 
50
  /** @var Toolset_Element_Factory */
@@ -114,6 +114,12 @@ class Toolset_Association_Cleanup_Post extends Toolset_Wpdb_User {
114
  * @param int $post_id
115
  */
116
  public function cleanup( $post_id ) {
 
 
 
 
 
 
117
  $is_deleting_association = apply_filters( self::IS_DELETING_FILTER, false );
118
 
119
  if( $is_deleting_association ) {
@@ -121,6 +127,9 @@ class Toolset_Association_Cleanup_Post extends Toolset_Wpdb_User {
121
  // If we got here, it means that the association's intermediary post is about to
122
  // be deleted and everything else is already handled either
123
  // in Toolset_Association_Cleanup_Association, or within this class.
 
 
 
124
  return;
125
  }
126
 
44
  const DELETE_POSTS_PER_BATCH = 25;
45
 
46
 
47
+ const IS_DELETING_FILTER = 'toolset_is_deleting_intermediary_post_purposefully';
48
 
49
 
50
  /** @var Toolset_Element_Factory */
114
  * @param int $post_id
115
  */
116
  public function cleanup( $post_id ) {
117
+ /**
118
+ * Filter that can be used to indicate that an intermediary post is deleted
119
+ * purposefully, and that the association shouldn't be removed.
120
+ *
121
+ * @since 2.6.8
122
+ */
123
  $is_deleting_association = apply_filters( self::IS_DELETING_FILTER, false );
124
 
125
  if( $is_deleting_association ) {
127
  // If we got here, it means that the association's intermediary post is about to
128
  // be deleted and everything else is already handled either
129
  // in Toolset_Association_Cleanup_Association, or within this class.
130
+ //
131
+ // Or there is a different situation where an intermediary post is being deleted
132
+ // but we want to preserve the association.
133
  return;
134
  }
135
 
vendor/toolset/toolset-common/inc/m2m/association/cleanup/post_type.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The class fetches all post ids of all published posts given a post type and deletes them programmatically, without letting m2m API run
5
+ * additional filters to delete Asociations and their data too.
6
+ *
7
+ * Class Toolset_Association_Cleanup_Post_Type
8
+ */
9
+ class Toolset_Association_Cleanup_Post_Type extends Toolset_Wpdb_User {
10
+
11
+
12
+ const DELETE_POSTS_PER_BATCH = 25;
13
+
14
+
15
+ /** @var int */
16
+ private $found_rows = 0;
17
+
18
+
19
+ /**
20
+ * Toolset_Association_Cleanup_Post_Type constructor.
21
+ *
22
+ * @param wpdb|null $wpdb_di
23
+ */
24
+ public function __construct( wpdb $wpdb_di = null ) {
25
+ parent::__construct( $wpdb_di );
26
+ }
27
+
28
+
29
+ /**
30
+ * @param $post_type
31
+ *
32
+ * @return array
33
+ */
34
+ protected function get_post_type_posts_ids( $post_type ) {
35
+
36
+ $limit = (int) self::DELETE_POSTS_PER_BATCH;
37
+
38
+ $query = $this->wpdb->prepare(
39
+ "SELECT SQL_CALC_FOUND_ROWS post.ID FROM {$this->wpdb->posts} AS post
40
+ WHERE post.post_type = %s LIMIT %d", $post_type, $limit
41
+ );
42
+
43
+ $posts_ids = $this->wpdb->get_col( $query );
44
+
45
+ $this->found_rows = (int) $this->wpdb->get_var( 'SELECT FOUND_ROWS()' );
46
+
47
+ return $posts_ids;
48
+ }
49
+
50
+ /**
51
+ * @param $post_type
52
+ *
53
+ * @return array
54
+ */
55
+ public function clean_up_posts( $post_type ) {
56
+ $post_ids = array_map( 'intval', $this->get_post_type_posts_ids( $post_type ) );
57
+
58
+ add_filter( Toolset_Association_Cleanup_Post::IS_DELETING_FILTER, '__return_true' );
59
+
60
+ foreach ( $post_ids as $post_id ) {
61
+ wp_delete_post( $post_id, true );
62
+ }
63
+
64
+ remove_filter( Toolset_Association_Cleanup_Post::IS_DELETING_FILTER, '__return_true' );
65
+
66
+ $results = array();
67
+
68
+ $results['total_posts'] = $this->found_rows;
69
+
70
+ $results['deleted_posts'] = count( $post_ids );
71
+
72
+ return $results;
73
+ }
74
+
75
+ }
vendor/toolset/toolset-common/inc/m2m/association/intermediary_post_persistence.php CHANGED
@@ -180,6 +180,33 @@ class Toolset_Association_Intermediary_Post_Persistence {
180
  }
181
 
182
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
 
184
  /**
185
  * Creates an empty association intermediary post
180
  }
181
 
182
 
183
+ /**
184
+ * Removes intermediary post from associations.
185
+ *
186
+ * @param int $limit The number of associations in a loop.
187
+ * @return int Number of associations updated.
188
+ * @since 2.3
189
+ */
190
+ public function remove_associations_intermediary_posts( $limit = 0 ) {
191
+ if ( (int) $limit <= 0 ) {
192
+ $limit = self::DEFAULT_LIMIT;
193
+ }
194
+
195
+ $association_query = new Toolset_Association_Query_V2();
196
+ $association_query->add( $association_query->relationship( $this->relationship ) )
197
+ ->add( $association_query->has_intermediary_id() )
198
+ ->limit( $limit );
199
+ $associations = $association_query->get_results();
200
+ foreach ( $associations as $association ) {
201
+ // Don't use `maybe_delete_intermediary_post` because it tries to access an object it doesn't exist.
202
+ $intermediary_id = $association->get_intermediary_id();
203
+ if ( $intermediary_id ) {
204
+ $database_operations = new Toolset_Relationship_Database_Operations();
205
+ $database_operations->update_association_intermediary_id( $association->get_uid(), 0 );
206
+ }
207
+ }
208
+ return count( $associations );
209
+ }
210
 
211
  /**
212
  * Creates an empty association intermediary post
vendor/toolset/toolset-common/inc/m2m/association/persistence.php CHANGED
@@ -124,6 +124,8 @@ class Toolset_Association_Persistence {
124
 
125
  $updated_association = $this->association_translator->from_database_row( (object) $row );
126
 
 
 
127
  return $updated_association;
128
  }
129
 
@@ -139,6 +141,7 @@ class Toolset_Association_Persistence {
139
  * @since m2m
140
  */
141
  public function delete_association( IToolset_Association $association ) {
 
142
  $cleanup = $this->get_cleanup_factory()->association();
143
  return $cleanup->delete( $association );
144
  }
@@ -156,5 +159,64 @@ class Toolset_Association_Persistence {
156
  }
157
 
158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
 
160
  }
124
 
125
  $updated_association = $this->association_translator->from_database_row( (object) $row );
126
 
127
+ $this->report_inserted_association( $updated_association );
128
+
129
  return $updated_association;
130
  }
131
 
141
  * @since m2m
142
  */
143
  public function delete_association( IToolset_Association $association ) {
144
+ $this->report_before_association_delete( $association );
145
  $cleanup = $this->get_cleanup_factory()->association();
146
  return $cleanup->delete( $association );
147
  }
159
  }
160
 
161
 
162
+ /**
163
+ * Do the toolset_association_created action.
164
+ *
165
+ * See report_association_change() for action parameter information.
166
+ *
167
+ * @param IToolset_Association $association
168
+ * @since 2.7
169
+ */
170
+ private function report_inserted_association( IToolset_Association $association ) {
171
+ $this->report_association_change( $association, 'toolset_association_created' );
172
+ }
173
+
174
+
175
+
176
+ /**
177
+ * Do the toolset_before_association_delete action.
178
+ *
179
+ * See report_association_change() for action parameter information.
180
+ *
181
+ * @param IToolset_Association $association
182
+ * @since 2.7
183
+ */
184
+ public function report_before_association_delete( IToolset_Association $association ) {
185
+ $this->report_association_change( $association, 'toolset_before_association_delete' );
186
+ }
187
+
188
+
189
+ /**
190
+ * Do an action that indicates a change to an association.
191
+ *
192
+ * Action parameters:
193
+ * - (string) $relationship_slug
194
+ * - (int) $parent_id
195
+ * - (int) $child_id
196
+ * - (int) $intermediary_id, zero if there is none.
197
+ * - (int) $association_uid: An internal identifier for the association. May become useful in the future.
198
+ *
199
+ * Note that all element IDs will come in their default language version.
200
+ *
201
+ * @param IToolset_Association $association
202
+ * @param string $action_name Name of the hook.
203
+ * @since 2.7
204
+ */
205
+ private function report_association_change( IToolset_Association $association, $action_name ) {
206
+
207
+ $intermediary_post_id = ( $association->has_intermediary_post()
208
+ ? $association->get_element( new Toolset_Relationship_Role_Intermediary() )->get_default_language_id()
209
+ : 0
210
+ );
211
+
212
+ do_action(
213
+ $action_name,
214
+ $association->get_definition()->get_slug(),
215
+ $association->get_element( new Toolset_Relationship_Role_Parent() )->get_default_language_id(),
216
+ $association->get_element( new Toolset_Relationship_Role_Child() )->get_default_language_id(),
217
+ $intermediary_post_id,
218
+ $association->get_uid()
219
+ );
220
+ }
221
 
222
  }
vendor/toolset/toolset-common/inc/m2m/association/query/association_query.php CHANGED
@@ -35,6 +35,7 @@ class Toolset_Association_Query extends Toolset_Relationship_Query_Base {
35
  const QUERY_LIMIT = 'limit';
36
  const QUERY_SELECT_FIELDS = 'select_fields';
37
  const QUERY_RELATIONSHIP_SLUG = 'relationship_slug';
 
38
  const QUERY_RELATIONSHIP_ID = 'relationship_id';
39
  const QUERY_PARENT_ID = 'parent_id';
40
  const QUERY_CHILD_ID = 'child_id';
@@ -71,6 +72,7 @@ class Toolset_Association_Query extends Toolset_Relationship_Query_Base {
71
  $this->parse_query_arg( $query, self::QUERY_RELATIONSHIP_ID, 'absint' );
72
  $this->parse_query_arg( $query, self::QUERY_PARENT_ID, 'absint' );
73
  $this->parse_query_arg( $query, self::QUERY_CHILD_ID, 'absint' );
 
74
  $this->parse_query_arg( $query, self::QUERY_LIMIT, 'absint' );
75
  $this->parse_query_arg( $query, self::QUERY_OFFSET, 'absint' );
76
  $this->parse_query_arg( $query, self::QUERY_SELECT_FIELDS, null, array() );
@@ -102,6 +104,11 @@ class Toolset_Association_Query extends Toolset_Relationship_Query_Base {
102
  $q->add( $q->relationship_id( $relationship_id ) );
103
  }
104
 
 
 
 
 
 
105
  if ( $this->has_query_var( self::QUERY_PARENT_ID ) ) {
106
  $q->add( $q->parent_id( $this->get_query_var( self::QUERY_PARENT_ID ) ) );
107
  }
35
  const QUERY_LIMIT = 'limit';
36
  const QUERY_SELECT_FIELDS = 'select_fields';
37
  const QUERY_RELATIONSHIP_SLUG = 'relationship_slug';
38
+ const QUERY_INTERMEDIARY_ID = 'intermediary_id';
39
  const QUERY_RELATIONSHIP_ID = 'relationship_id';
40
  const QUERY_PARENT_ID = 'parent_id';
41
  const QUERY_CHILD_ID = 'child_id';
72
  $this->parse_query_arg( $query, self::QUERY_RELATIONSHIP_ID, 'absint' );
73
  $this->parse_query_arg( $query, self::QUERY_PARENT_ID, 'absint' );
74
  $this->parse_query_arg( $query, self::QUERY_CHILD_ID, 'absint' );
75
+ $this->parse_query_arg( $query, self::QUERY_INTERMEDIARY_ID, 'absint' );
76
  $this->parse_query_arg( $query, self::QUERY_LIMIT, 'absint' );
77
  $this->parse_query_arg( $query, self::QUERY_OFFSET, 'absint' );
78
  $this->parse_query_arg( $query, self::QUERY_SELECT_FIELDS, null, array() );
104
  $q->add( $q->relationship_id( $relationship_id ) );
105
  }
106
 
107
+ if ( $this->has_query_var( self::QUERY_INTERMEDIARY_ID ) ) {
108
+ $intermediary_id = $this->get_query_var( self::QUERY_INTERMEDIARY_ID );
109
+ $q->add( $q->intermediary_id( $intermediary_id ) );
110
+ }
111
+
112
  if ( $this->has_query_var( self::QUERY_PARENT_ID ) ) {
113
  $q->add( $q->parent_id( $this->get_query_var( self::QUERY_PARENT_ID ) ) );
114
  }
vendor/toolset/toolset-common/inc/m2m/association/query/association_query_v2.php CHANGED
@@ -49,7 +49,7 @@
49
  *
50
  * @since 2.5.8
51
  */
52
- class Toolset_Association_Query_V2 extends Toolset_Wpdb_User implements IToolset_Query {
53
 
54
 
55
  /** @var IToolset_Association_Query_Condition[] */
@@ -115,6 +115,12 @@ class Toolset_Association_Query_V2 extends Toolset_Wpdb_User implements IToolset
115
  /** @var IToolset_Association_Query_Restriction[] */
116
  private $restrictions = array();
117
 
 
 
 
 
 
 
118
 
119
  /**
120
  * Toolset_Association_Query_V2 constructor.
@@ -128,6 +134,7 @@ class Toolset_Association_Query_V2 extends Toolset_Wpdb_User implements IToolset
128
  * @param Toolset_Association_Query_Table_Join_Manager|null $join_manager_di
129
  * @param Toolset_Association_Query_Orderby_Factory|null $orderby_factory_di
130
  * @param Toolset_Association_Query_Element_Selector_Provider|null $element_selector_provider_di
 
131
  */
132
  public function __construct(
133
  wpdb $wpdb_di = null,
@@ -138,7 +145,8 @@ class Toolset_Association_Query_V2 extends Toolset_Wpdb_User implements IToolset
138
  Toolset_Relationship_Definition_Repository $definition_repository_di = null,
139
  Toolset_Association_Query_Table_Join_Manager $join_manager_di = null,
140
  Toolset_Association_Query_Orderby_Factory $orderby_factory_di = null,
141
- Toolset_Association_Query_Element_Selector_Provider $element_selector_provider_di = null
 
142
  ) {
143
  parent::__construct( $wpdb_di );
144
  $this->unique_table_alias = $unique_table_alias_di ?: new Toolset_Relationship_Database_Unique_Table_Alias();
@@ -149,6 +157,7 @@ class Toolset_Association_Query_V2 extends Toolset_Wpdb_User implements IToolset
149
  $this->orderby_factory = $orderby_factory_di ?: new Toolset_Association_Query_Orderby_Factory();
150
  $this->element_selector_provider = $element_selector_provider_di ?: new Toolset_Association_Query_Element_Selector_Provider();
151
  $this->_definition_repository = $definition_repository_di;
 
152
  }
153
 
154
 
@@ -273,6 +282,9 @@ class Toolset_Association_Query_V2 extends Toolset_Wpdb_User implements IToolset
273
  $this->return_association_instances();
274
  }
275
 
 
 
 
276
  $this->apply_restrictions();
277
 
278
  // We do this only after restrictions have been applied.
@@ -356,6 +368,10 @@ class Toolset_Association_Query_V2 extends Toolset_Wpdb_User implements IToolset
356
  }
357
 
358
 
 
 
 
 
359
  /**
360
  * Query by a row ID of a relationship definition.
361
  *
@@ -366,6 +382,16 @@ class Toolset_Association_Query_V2 extends Toolset_Wpdb_User implements IToolset
366
  return $this->condition_factory->relationship_id( $relationship_id );
367
  }
368
 
 
 
 
 
 
 
 
 
 
 
369
 
370
  /**
371
  * Query by a relationship definition.
@@ -444,6 +470,8 @@ class Toolset_Association_Query_V2 extends Toolset_Wpdb_User implements IToolset
444
  * as stored in the association table. Default is false.
445
  * @param bool $translate_provided_id If true, this will try to translate the element ID (if
446
  * applicable on the domain) and use the translated one in the final condition. Default is true.
 
 
447
  *
448
  * @return Toolset_Association_Query_Condition_Element_Id_And_Domain
449
  * @since 2.5.10
@@ -453,8 +481,13 @@ class Toolset_Association_Query_V2 extends Toolset_Wpdb_User implements IToolset
453
  $domain,
454
  IToolset_Relationship_Role $for_role,
455
  $query_original_element = false,
456
- $translate_provided_id = true
 
457
  ) {
 
 
 
 
458
  return $this->condition_factory->element_id_and_domain(
459
  $element_id,
460
  $domain,
@@ -475,6 +508,8 @@ class Toolset_Association_Query_V2 extends Toolset_Wpdb_User implements IToolset
475
  * as stored in the association table. Default is false.
476
  * @param bool $translate_provided_id If true, this will try to translate the element ID (if
477
  * applicable on the domain) and use the translated one in the final condition. Default is true.
 
 
478
  *
479
  * @return IToolset_Association_Query_Condition
480
  */
@@ -482,14 +517,18 @@ class Toolset_Association_Query_V2 extends Toolset_Wpdb_User implements IToolset
482
  IToolset_Element $element,
483
  IToolset_Relationship_Role $for_role = null,
484
  $query_original_element = false,
485
- $translate_provided_id = true
 
486
  ) {
 
 
 
487
 
488
  if( null === $for_role ) {
489
  $conditions = array();
490
  foreach( Toolset_Relationship_Role::all() as $role ) {
491
  $conditions[] = $this->element(
492
- $element, $role, $query_original_element, $translate_provided_id
493
  );
494
  }
495
  return $this->do_or( $conditions );
@@ -686,6 +725,28 @@ class Toolset_Association_Query_V2 extends Toolset_Wpdb_User implements IToolset
686
  }
687
 
688
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689
  /**
690
  * Query by a WP_Query arguments applied on an element of a specified role.
691
  *
@@ -977,6 +1038,92 @@ class Toolset_Association_Query_V2 extends Toolset_Wpdb_User implements IToolset
977
  }
978
 
979
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
980
  /**
981
  * Perform the query to only return the number of found rows, if we're not interested in
982
  * the actual results.
49
  *
50
  * @since 2.5.8
51
  */
52
+ class Toolset_Association_Query_V2 extends Toolset_Wpdb_User {
53
 
54
 
55
  /** @var IToolset_Association_Query_Condition[] */
115
  /** @var IToolset_Association_Query_Restriction[] */
116
  private $restrictions = array();
117
 
118
+ /** @var string|null */
119
+ private $translation_language;
120
+
121
+ /** @var Toolset_WPML_Compatibility */
122
+ private $wpml_service;
123
+
124
 
125
  /**
126
  * Toolset_Association_Query_V2 constructor.
134
  * @param Toolset_Association_Query_Table_Join_Manager|null $join_manager_di
135
  * @param Toolset_Association_Query_Orderby_Factory|null $orderby_factory_di
136
  * @param Toolset_Association_Query_Element_Selector_Provider|null $element_selector_provider_di
137
+ * @param Toolset_WPML_Compatibility|null $wpml_service_di
138
  */
139
  public function __construct(
140
  wpdb $wpdb_di = null,
145
  Toolset_Relationship_Definition_Repository $definition_repository_di = null,
146
  Toolset_Association_Query_Table_Join_Manager $join_manager_di = null,
147
  Toolset_Association_Query_Orderby_Factory $orderby_factory_di = null,
148
+ Toolset_Association_Query_Element_Selector_Provider $element_selector_provider_di = null,
149
+ Toolset_WPML_Compatibility $wpml_service_di = null
150
  ) {
151
  parent::__construct( $wpdb_di );
152
  $this->unique_table_alias = $unique_table_alias_di ?: new Toolset_Relationship_Database_Unique_Table_Alias();
157
  $this->orderby_factory = $orderby_factory_di ?: new Toolset_Association_Query_Orderby_Factory();
158
  $this->element_selector_provider = $element_selector_provider_di ?: new Toolset_Association_Query_Element_Selector_Provider();
159
  $this->_definition_repository = $definition_repository_di;
160
+ $this->wpml_service = $wpml_service_di ?: Toolset_WPML_Compatibility::get_instance();
161
  }
162
 
163
 
282
  $this->return_association_instances();
283
  }
284
 
285
+ // Sometimes it's not as straightforward as "get current language"
286
+ $this->determine_translation_language();
287
+
288
  $this->apply_restrictions();
289
 
290
  // We do this only after restrictions have been applied.
368
  }
369
 
370
 
371
+ public function not( IToolset_Association_Query_Condition $condition ) {
372
+ return $this->condition_factory->not( $condition );
373
+ }
374
+
375
  /**
376
  * Query by a row ID of a relationship definition.
377
  *
382
  return $this->condition_factory->relationship_id( $relationship_id );
383
  }
384
 
385
+ /**
386
+ * Query by a row intermediary_id of a relationship definition.
387
+ *
388
+ * @param int $relationship_id
389
+ * @return IToolset_Association_Query_Condition
390
+ */
391
+ public function intermediary_id( $relationship_id ) {
392
+ return $this->condition_factory->intermediary_id( $relationship_id );
393
+ }
394
+
395
 
396
  /**
397
  * Query by a relationship definition.
470
  * as stored in the association table. Default is false.
471
  * @param bool $translate_provided_id If true, this will try to translate the element ID (if
472
  * applicable on the domain) and use the translated one in the final condition. Default is true.
473
+ * @param bool $set_its_translation_language If true, the query may try to use the element's language
474
+ * to determine the desired language of the results (see determine_translation_language() for details)
475
  *
476
  * @return Toolset_Association_Query_Condition_Element_Id_And_Domain
477
  * @since 2.5.10
481
  $domain,
482
  IToolset_Relationship_Role $for_role,
483
  $query_original_element = false,
484
+ $translate_provided_id = true,
485
+ $set_its_translation_language = true
486
  ) {
487
+ if( $set_its_translation_language ) {
488
+ $this->set_translation_language_by_element_id_and_domain( $element_id, $domain );
489
+ }
490
+
491
  return $this->condition_factory->element_id_and_domain(
492
  $element_id,
493
  $domain,
508
  * as stored in the association table. Default is false.
509
  * @param bool $translate_provided_id If true, this will try to translate the element ID (if
510
  * applicable on the domain) and use the translated one in the final condition. Default is true.
511
+ * @param bool $set_its_translation_language If true, the query may try to use the element's language
512
+ * to determine the desired language of the results (see determine_translation_language() for details)
513
  *
514
  * @return IToolset_Association_Query_Condition
515
  */
517
  IToolset_Element $element,
518
  IToolset_Relationship_Role $for_role = null,
519
  $query_original_element = false,
520
+ $translate_provided_id = true,
521
+ $set_its_translation_language = true
522
  ) {
523
+ if( $set_its_translation_language ) {
524
+ $this->set_translation_language_by_element_id_and_domain( $element->get_id(), $element->get_domain() );
525
+ }
526
 
527
  if( null === $for_role ) {
528
  $conditions = array();
529
  foreach( Toolset_Relationship_Role::all() as $role ) {
530
  $conditions[] = $this->element(
531
+ $element, $role, $query_original_element, $translate_provided_id, false
532
  );
533
  }
534
  return $this->do_or( $conditions );
725
  }
726
 
727
 
728
+ /**
729
+ * Condition that a relationship has a certain origin.
730
+ *
731
+ * @param String $origin Origin.
732
+ *
733
+ * @return IToolset_Relationship_Query_Condition
734
+ */
735
+ public function has_origin( $origin ) {
736
+ return $this->condition_factory->has_origin( $origin, $this->join_manager );
737
+ }
738
+
739
+
740
+ /**
741
+ * Condition that the association has an intermediary id.
742
+ *
743
+ * @return IToolset_Relationship_Query_Condition
744
+ */
745
+ public function has_intermediary_id() {
746
+ return $this->condition_factory->has_intermediary_id();
747
+ }
748
+
749
+
750
  /**
751
  * Query by a WP_Query arguments applied on an element of a specified role.
752
  *
1038
  }
1039
 
1040
 
1041
+ /**
1042
+ * Make sure that the elements in results will never get translated.
1043
+ *
1044
+ * @since 2.6.4
1045
+ * @return $this
1046
+ */
1047
+ public function dont_translate_results() {
1048
+ $this->element_selector_provider->attempt_translating_elements( false );
1049
+ return $this;
1050
+ }
1051
+
1052
+
1053
+ /**
1054
+ * Set the preferred translation language.
1055
+ *
1056
+ * See determine_translation_language() for details.
1057
+ *
1058
+ * @param string $lang_code Valid language code.
1059
+ *
1060
+ * @return $this
1061
+ */
1062
+ public function set_translation_language( $lang_code ) {
1063
+ if( ! is_string( $lang_code ) ) {
1064
+ throw new InvalidArgumentException();
1065
+ }
1066
+
1067
+ $this->translation_language = $lang_code;
1068
+
1069
+ return $this;
1070
+ }
1071
+
1072
+
1073
+ /**
1074
+ * Set the preferred translation language from a given element ID and domain.
1075
+ *
1076
+ * See determine_translation_language() for details.
1077
+ *
1078
+ * @param int $element_id ID of the element to take the language from.
1079
+ * @param string $domain Element domain.
1080
+ *
1081
+ * @return $this
1082
+ * @since 2.6.8
1083
+ */
1084
+ public function set_translation_language_by_element_id_and_domain( $element_id, $domain ) {
1085
+ if( Toolset_Element_Domain::POSTS !== $domain ) {
1086
+ // no language information there
1087
+ return $this;
1088
+ }
1089
+
1090
+ $post_language = $this->wpml_service->get_post_language( $element_id );
1091
+ if( ! empty( $post_language ) ) {
1092
+ $this->set_translation_language( $post_language );
1093
+ }
1094
+
1095
+ return $this;
1096
+ }
1097
+
1098
+
1099
+ /**
1100
+ * Determine an alternative to the translation language (what language version of the results should be chosen).
1101
+ *
1102
+ * This will be used only if applicable - if WPML is active and the current language is set to "All languages",
1103
+ * in which case we're forced to pick one.
1104
+ *
1105
+ * If we have a valid lang code, we'll pass it to the element selector. Otherwise, it will use the default language.
1106
+ *
1107
+ * @since 2.6.8
1108
+ */
1109
+ private function determine_translation_language() {
1110
+ if( ! $this->wpml_service->is_wpml_active_and_configured() ) {
1111
+ return;
1112
+ }
1113
+
1114
+ if( ! $this->wpml_service->is_showing_all_languages() ) {
1115
+ return;
1116
+ }
1117
+
1118
+ if( null === $this->translation_language ) {
1119
+ // Here, we may try to determine the language by some other means.
1120
+ return;
1121
+ }
1122
+
1123
+ $this->element_selector_provider->set_translation_language( $this->translation_language );
1124
+ }
1125
+
1126
+
1127
  /**
1128
  * Perform the query to only return the number of found rows, if we're not interested in
1129
  * the actual results.
vendor/toolset/toolset-common/inc/m2m/association/query/condition/exclude_relationship.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Condition to query associations that don't belong to a relationship.
5
+ *
6
+ * @since 2.5.8
7
+ */
8
+ class Toolset_Association_Query_Condition_Exclude_Relationship extends Toolset_Association_Query_Condition_Relationship_Id {
9
+
10
+
11
+ /**
12
+ * Returns condition operator
13
+ *
14
+ * @return string
15
+ * @since m2m
16
+ */
17
+ protected function get_operator() {
18
+ return '!=';
19
+ }
20
+
21
+ }
vendor/toolset/toolset-common/inc/m2m/association/query/condition/has_intermediary_id.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Condition to query associations by a specific intermediary post (row) ID.
5
+ *
6
+ * @since 2.6.7
7
+ */
8
+ class Toolset_Association_Query_Condition_Has_Intermediary_Id extends Toolset_Association_Query_Condition {
9
+
10
+
11
+ /**
12
+ * Get a part of the WHERE clause that applies the condition.
13
+ *
14
+ * @return string Valid part of a MySQL query, so that it can be
15
+ * used in WHERE ( $condition1 ) AND ( $condition2 ) AND ( $condition3 ) ...
16
+ */
17
+ public function get_where_clause() {
18
+ return sprintf( ' ( associations.intermediary_id IS NOT NULL and associations.intermediary_id > 0 ) ' );
19
+ }
20
+ }
vendor/toolset/toolset-common/inc/m2m/association/query/condition/intermediary_id.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Condition to query associations by a specific intermediary post (row) ID.
5
+ *
6
+ * @since 2.6.7
7
+ */
8
+ class Toolset_Association_Query_Condition_Intermediary_Id extends Toolset_Association_Query_Condition {
9
+
10
+
11
+ /** @var int */
12
+ private $intermediary_id;
13
+
14
+
15
+ /**
16
+ * Toolset_Association_Query_Condition_Intermediary_Id constructor.
17
+ *
18
+ * @param int $intermediary_id
19
+ * @throws InvalidArgumentException
20
+ */
21
+ public function __construct( $intermediary_id ) {
22
+ if( ! Toolset_Utils::is_nonnegative_integer( $intermediary_id ) ) {
23
+ throw new InvalidArgumentException();
24
+ }
25
+
26
+ $this->intermediary_id = (int) $intermediary_id;
27
+ }
28
+
29
+
30
+ /**
31
+ * Get a part of the WHERE clause that applies the condition.
32
+ *
33
+ * @return string Valid part of a MySQL query, so that it can be
34
+ * used in WHERE ( $condition1 ) AND ( $condition2 ) AND ( $condition3 ) ...
35
+ */
36
+ public function get_where_clause() {
37
+ return sprintf( 'associations.intermediary_id = %d', $this->intermediary_id );
38
+ }
39
+
40
+
41
+ }
vendor/toolset/toolset-common/inc/m2m/association/query/condition/relationship_id.php CHANGED
@@ -34,8 +34,18 @@ class Toolset_Association_Query_Condition_Relationship_Id extends Toolset_Associ
34
  * used in WHERE ( $condition1 ) AND ( $condition2 ) AND ( $condition3 ) ...
35
  */
36
  public function get_where_clause() {
37
- return sprintf( 'associations.relationship_id = %d', $this->relationship_id );
38
  }
39
 
40
 
41
- }
 
 
 
 
 
 
 
 
 
 
34
  * used in WHERE ( $condition1 ) AND ( $condition2 ) AND ( $condition3 ) ...
35
  */
36
  public function get_where_clause() {
37
+ return sprintf( 'associations.relationship_id %s %d', $this->get_operator(), $this->relationship_id );
38
  }
39
 
40
 
41
+ /**
42
+ * Returns condition operator
43
+ *
44
+ * @return string
45
+ * @since m2m
46
+ */
47
+ protected function get_operator() {
48
+ return '=';
49
+ }
50
+
51
+ }
vendor/toolset/toolset-common/inc/m2m/association/query/condition/relationship_origin.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Query associations by the origin value of a relationship they belong to.
5
+ *
6
+ * @since m2m
7
+ */
8
+ class Toolset_Association_Query_Condition_Relationship_Origin extends Toolset_Association_Query_Condition {
9
+
10
+ /** @var Toolset_Association_Query_Table_Join_Manager */
11
+ private $join_manager;
12
+
13
+
14
+ /** @var bool */
15
+ private $expected_value;
16
+
17
+
18
+ /**
19
+ * Toolset_Association_Query_Condition_Has_Active_Relationship constructor.
20
+ *
21
+ * @param bool $expected_value
22
+ * @param Toolset_Association_Query_Table_Join_Manager $join_manager
23
+ */
24
+ public function __construct( $expected_value, Toolset_Association_Query_Table_Join_Manager $join_manager ) {
25
+ $this->expected_value = $expected_value;
26
+ $this->join_manager = $join_manager;
27
+ }
28
+
29
+
30
+ /**
31
+ * Get a part of the WHERE clause that applies the condition.
32
+ *
33
+ * @return string Valid part of a MySQL query, so that it can be
34
+ * used in WHERE ( $condition1 ) AND ( $condition2 ) AND ( $condition3 ) ...
35
+ */
36
+ public function get_where_clause() {
37
+ $relationships_table = $this->join_manager->relationships();
38
+
39
+ return sprintf(
40
+ '%s.origin = %d',
41
+ $relationships_table,
42
+ esc_sql( $this->expected_value )
43
+ );
44
+ }
45
+ }
vendor/toolset/toolset-common/inc/m2m/association/query/condition_factory.php CHANGED
@@ -65,6 +65,27 @@ class Toolset_Association_Query_Condition_Factory {
65
  return new Toolset_Association_Query_Condition_Relationship_Id( $relationship_id );
66
  }
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
 
69
  /**
70
  * Condition to query associations by a particular element involved in a particular role.
@@ -109,7 +130,7 @@ class Toolset_Association_Query_Condition_Factory {
109
  $element_id, $domain, $for_role, $element_selector_provider, $query_original_element, $translate_provided_id
110
  );
111
  }
112
-
113
 
114
 
115
  /**
@@ -319,4 +340,27 @@ class Toolset_Association_Query_Condition_Factory {
319
  $join_manager
320
  );
321
  }
322
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  return new Toolset_Association_Query_Condition_Relationship_Id( $relationship_id );
66
  }
67
 
68
+ /**
69
+ * Condition to query associations by a specific intermediary (row) ID.
70
+ *
71
+ * @param int $intermediary_id
72
+ *
73
+ * @return IToolset_Association_Query_Condition
74
+ */
75
+ public function intermediary_id( $intermediary_id ) {
76
+ return new Toolset_Association_Query_Condition_Intermediary_Id( $intermediary_id );
77
+ }
78
+
79
+
80
+ /**
81
+ * Condition to query associations having intermediary id.
82
+ *
83
+ * @return IToolset_Association_Query_Condition
84
+ */
85
+ public function has_intermediary_id() {
86
+ return new Toolset_Association_Query_Condition_Has_Intermediary_Id();
87
+ }
88
+
89
 
90
  /**
91
  * Condition to query associations by a particular element involved in a particular role.
130
  $element_id, $domain, $for_role, $element_selector_provider, $query_original_element, $translate_provided_id
131
  );
132
  }
133
+
134
 
135
 
136
  /**
340
  $join_manager
341
  );
342
  }
343
+
344
+
345
+ /**
346
+ * Condition that a relationship has a certain origin.
347
+ *
348
+ * @param string $origin Origin: wizard, ...
349
+ * @param Toolset_Association_Query_Table_Join_Manager $join_manager Join manager.
350
+ *
351
+ * @return IToolset_Relationship_Query_Condition
352
+ */
353
+ public function has_origin( $origin, Toolset_Association_Query_Table_Join_Manager $join_manager ) {
354
+ return new Toolset_Association_Query_Condition_Relationship_Origin( $origin, $join_manager );
355
+ }
356
+
357
+
358
+ /**
359
+ * @param IToolset_Association_Query_Condition $condition
360
+ *
361
+ * @return Toolset_Query_Condition_Not
362
+ */
363
+ public function not( IToolset_Association_Query_Condition $condition ) {
364
+ return new Toolset_Query_Condition_Not( $condition );
365
+ }
366
+ }
vendor/toolset/toolset-common/inc/m2m/association/query/element_selector/abstract.php CHANGED
@@ -33,6 +33,12 @@ abstract class Toolset_Association_Query_Element_Selector_Abstract
33
  protected $requested_roles = array();
34
 
35
 
 
 
 
 
 
 
36
  /**
37
  * Toolset_Association_Query_Element_Selector_Abstract constructor.
38
  *
@@ -92,4 +98,49 @@ abstract class Toolset_Association_Query_Element_Selector_Abstract
92
  }
93
 
94
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  }
33
  protected $requested_roles = array();
34
 
35
 
36
+ private $requested_association_and_relationship = false;
37
+
38
+
39
+ private $requested_distinct_query = false;
40
+
41
+
42
  /**
43
  * Toolset_Association_Query_Element_Selector_Abstract constructor.
44
  *
98
  }
99
 
100
 
101
+ /**
102
+ * @inheritdoc
103
+ */
104
+ public function request_association_and_relationship_in_results() {
105
+ $this->requested_association_and_relationship = true;
106
+ }
107
+
108
+
109
+ /**
110
+ * Get the select clauses for association and relationship IDs if they have been requested.
111
+ *
112
+ * @return string[]
113
+ * @since 2.6.1
114
+ */
115
+ protected function maybe_get_association_and_relationship() {
116
+ if( ! $this->requested_association_and_relationship ) {
117
+ return array();
118
+ }
119
+
120
+ return array(
121
+ 'associations.id AS id',
122
+ 'associations.relationship_id AS relationship_id'
123
+ );
124
+ }
125
+
126
+
127
+ /**
128
+ * @inheritdoc
129
+ *
130
+ * @since 2.6.1
131
+ */
132
+ public function request_distinct_query() {
133
+ $this->requested_distinct_query = true;
134
+ }
135
+
136
+
137
+ /**
138
+ * @inheritdoc
139
+ *
140
+ * @return string
141
+ * @since 2.6.1
142
+ */
143
+ public function maybe_get_distinct_modifier() {
144
+ return ( $this->requested_distinct_query ? 'DISTINCT' : '' );
145
+ }
146
  }
vendor/toolset/toolset-common/inc/m2m/association/query/element_selector/default.php CHANGED
@@ -46,7 +46,7 @@ class Toolset_Association_Query_Element_Selector_Default
46
  * @return string
47
  */
48
  public function get_select_clauses() {
49
- $results = array();
50
  foreach( $this->requested_roles as $role ) {
51
  $results[] = $this->get_select_clause_for_role( $role );
52
  }
46
  * @return string
47
  */
48
  public function get_select_clauses() {
49
+ $results = $this->maybe_get_association_and_relationship();
50
  foreach( $this->requested_roles as $role ) {
51
  $results[] = $this->get_select_clause_for_role( $role );
52
  }
vendor/toolset/toolset-common/inc/m2m/association/query/element_selector/interface.php CHANGED
@@ -90,4 +90,31 @@ interface IToolset_Association_Query_Element_Selector {
90
  * @return void
91
  */
92
  public function request_element_in_results( IToolset_Relationship_Role $role );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  }
90
  * @return void
91
  */
92
  public function request_element_in_results( IToolset_Relationship_Role $role );
93
+
94
+
95
+ /**
96
+ * Call this to make sure the association ID and relationship ID will be included in the SELECT clause.
97
+ *
98
+ * @return void
99
+ * @since 2.6.1
100
+ */
101
+ public function request_association_and_relationship_in_results();
102
+
103
+
104
+ /**
105
+ * Call this to make sure the DISTINCT keyword will be used.
106
+ *
107
+ * @return void
108
+ * @since 2.6.1
109
+ */
110
+ public function request_distinct_query();
111
+
112
+
113
+ /**
114
+ * Get the DISTINCT keyword or an empty string.
115
+ *
116
+ * @return string
117
+ * @since 2.6.1
118
+ */
119
+ public function maybe_get_distinct_modifier();
120
  }
vendor/toolset/toolset-common/inc/m2m/association/query/element_selector/provider.php CHANGED
@@ -31,18 +31,33 @@ class Toolset_Association_Query_Element_Selector_Provider {
31
  private $selector;
32
 
33
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  /**
35
  * Toolset_Association_Query_Element_Selector_Provider constructor.
36
  *
37
  * @param Toolset_Condition_Plugin_Wpml_Is_Active_And_Configured|null $is_wpml_active_di
38
  * @param Toolset_Condition_Plugin_Wpml_Is_Current_Language_Default|null $is_current_language_default_di
 
39
  */
40
  public function __construct(
41
  Toolset_Condition_Plugin_Wpml_Is_Active_And_Configured $is_wpml_active_di = null,
42
- Toolset_Condition_Plugin_Wpml_Is_Current_Language_Default $is_current_language_default_di = null
 
43
  ) {
44
  $this->is_wpml_active = ( null === $is_wpml_active_di ? new Toolset_Condition_Plugin_Wpml_Is_Active_And_Configured() : $is_wpml_active_di );
45
  $this->is_current_language_default = ( null === $is_current_language_default_di ? new Toolset_Condition_Plugin_Wpml_Is_Current_Language_Default() : $is_current_language_default_di );
 
46
  }
47
 
48
 
@@ -84,6 +99,19 @@ class Toolset_Association_Query_Element_Selector_Provider {
84
  }
85
 
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  /**
88
  * @param Toolset_Relationship_Database_Unique_Table_Alias $table_alias
89
  * @param Toolset_Association_Query_Table_Join_Manager $join_manager
@@ -96,12 +124,22 @@ class Toolset_Association_Query_Element_Selector_Provider {
96
  Toolset_Association_Query_V2 $query
97
  ) {
98
  if(
99
- $this->is_wpml_active->is_met()
 
100
  && ! $this->is_current_language_default->is_met()
101
  ) {
102
  $use_wpml_selector = apply_filters( self::FILTER_WPML_SELECTOR, true, $query );
103
 
104
  if( $use_wpml_selector ) {
 
 
 
 
 
 
 
 
 
105
  return new Toolset_Association_Query_Element_Selector_Wpml( $table_alias, $join_manager );
106
  }
107
  }
@@ -110,4 +148,14 @@ class Toolset_Association_Query_Element_Selector_Provider {
110
  }
111
 
112
 
 
 
 
 
 
 
 
 
 
 
113
  }
31
  private $selector;
32
 
33
 
34
+ /** @var bool */
35
+ private $should_translate_elements = true;
36
+
37
+
38
+ /** @var Toolset_WPML_Compatibility */
39
+ private $wpml_service;
40
+
41
+
42
+ /** @var string|null */
43
+ private $translation_language;
44
+
45
+
46
  /**
47
  * Toolset_Association_Query_Element_Selector_Provider constructor.
48
  *
49
  * @param Toolset_Condition_Plugin_Wpml_Is_Active_And_Configured|null $is_wpml_active_di
50
  * @param Toolset_Condition_Plugin_Wpml_Is_Current_Language_Default|null $is_current_language_default_di
51
+ * @param Toolset_WPML_Compatibility|null $wpml_service_di
52
  */
53
  public function __construct(
54
  Toolset_Condition_Plugin_Wpml_Is_Active_And_Configured $is_wpml_active_di = null,
55
+ Toolset_Condition_Plugin_Wpml_Is_Current_Language_Default $is_current_language_default_di = null,
56
+ Toolset_WPML_Compatibility $wpml_service_di = null
57
  ) {
58
  $this->is_wpml_active = ( null === $is_wpml_active_di ? new Toolset_Condition_Plugin_Wpml_Is_Active_And_Configured() : $is_wpml_active_di );
59
  $this->is_current_language_default = ( null === $is_current_language_default_di ? new Toolset_Condition_Plugin_Wpml_Is_Current_Language_Default() : $is_current_language_default_di );
60
+ $this->wpml_service = $wpml_service_di ?: Toolset_WPML_Compatibility::get_instance();
61
  }
62
 
63
 
99
  }
100
 
101
 
102
+ /**
103
+ * Set whether element translation should be attempted at all (by default, it is true).
104
+ *
105
+ * Setting this to false will completely ignore WPML when building the MySQL query.
106
+ *
107
+ * @param bool $should_translate
108
+ * @since 2.6.4
109
+ */
110
+ public function attempt_translating_elements( $should_translate ) {
111
+ $this->should_translate_elements = (bool) $should_translate;
112
+ }
113
+
114
+
115
  /**
116
  * @param Toolset_Relationship_Database_Unique_Table_Alias $table_alias
117
  * @param Toolset_Association_Query_Table_Join_Manager $join_manager
124
  Toolset_Association_Query_V2 $query
125
  ) {
126
  if(
127
+ $this->should_translate_elements
128
+ && $this->is_wpml_active->is_met()
129
  && ! $this->is_current_language_default->is_met()
130
  ) {
131
  $use_wpml_selector = apply_filters( self::FILTER_WPML_SELECTOR, true, $query );
132
 
133
  if( $use_wpml_selector ) {
134
+
135
+ // Handle the special case of lang=all, probably using the manually set/approximated
136
+ // translation language for the results.
137
+ if( $this->wpml_service->is_showing_all_languages() ) {
138
+ return new Toolset_Association_Query_Element_Selector_Wpml_Lang_All(
139
+ $table_alias, $join_manager, $this->translation_language
140
+ );
141
+ }
142
+
143
  return new Toolset_Association_Query_Element_Selector_Wpml( $table_alias, $join_manager );
144
  }
145
  }
148
  }
149
 
150
 
151
+ /**
152
+ * Set the translation language that may be used instead of the current language.
153
+ *
154
+ * @param string $lang_code Valid language code.
155
+ * @since 2.6.8
156
+ */
157
+ public function set_translation_language( $lang_code ) {
158
+ $this->translation_language = $lang_code;
159
+ }
160
+
161
  }
vendor/toolset/toolset-common/inc/m2m/association/query/element_selector/wpml.php CHANGED
@@ -110,7 +110,9 @@ class Toolset_Association_Query_Element_Selector_Wpml
110
  $icl_translations_for_original = $this->table_alias->generate( $icl_translations, true );
111
  $icl_translations_for_translation = $this->table_alias->generate( $icl_translations, true );
112
 
113
- $current_language = esc_sql( $this->wpml_service->get_current_language() );
 
 
114
 
115
  // Generate expressions with element IDs. The translated one will default to the original
116
  // if no translation is available. This will be also extremely important for domains different
@@ -135,7 +137,7 @@ class Toolset_Association_Query_Element_Selector_Wpml
135
  LEFT JOIN $icl_translations AS $icl_translations_for_translation
136
  ON (
137
  $icl_translations_for_original.trid = $icl_translations_for_translation.trid
138
- AND $icl_translations_for_translation.language_code = '$current_language'
139
  )";
140
 
141
  $this->original_element_id_select_aliases[ $for_role->get_name() ] = $original_element_id_alias;
@@ -145,6 +147,17 @@ class Toolset_Association_Query_Element_Selector_Wpml
145
  }
146
 
147
 
 
 
 
 
 
 
 
 
 
 
 
148
  /**
149
  * @inheritdoc
150
  *
@@ -215,7 +228,7 @@ class Toolset_Association_Query_Element_Selector_Wpml
215
  public function get_select_clauses() {
216
  $this->initialize();
217
 
218
- $requested_select_clauses = array();
219
  foreach( $this->requested_roles as $role ) {
220
  $requested_select_clauses[] = $this->select_clauses[ $role->get_name() ];
221
  }
110
  $icl_translations_for_original = $this->table_alias->generate( $icl_translations, true );
111
  $icl_translations_for_translation = $this->table_alias->generate( $icl_translations, true );
112
 
113
+ // In most cases, this will be the current language, but there are special cases,
114
+ // like if displaying all languages - the get_translation_language() method may be overridden.
115
+ $translation_language = esc_sql( $this->get_translation_language() );
116
 
117
  // Generate expressions with element IDs. The translated one will default to the original
118
  // if no translation is available. This will be also extremely important for domains different
137
  LEFT JOIN $icl_translations AS $icl_translations_for_translation
138
  ON (
139
  $icl_translations_for_original.trid = $icl_translations_for_translation.trid
140
+ AND $icl_translations_for_translation.language_code = '$translation_language'
141
  )";
142
 
143
  $this->original_element_id_select_aliases[ $for_role->get_name() ] = $original_element_id_alias;
147
  }
148
 
149
 
150
+ /**
151
+ * Get the language that will be used for the query results (besides the default language).
152
+ *
153
+ * @return string
154
+ * @since 2.6.8
155
+ */
156
+ protected function get_translation_language() {
157
+ return $this->wpml_service->get_current_language();
158
+ }
159
+
160
+
161
  /**
162
  * @inheritdoc
163
  *
228
  public function get_select_clauses() {
229
  $this->initialize();
230
 
231
+ $requested_select_clauses = $this->maybe_get_association_and_relationship();
232
  foreach( $this->requested_roles as $role ) {
233
  $requested_select_clauses[] = $this->select_clauses[ $role->get_name() ];
234
  }
vendor/toolset/toolset-common/inc/m2m/association/query/element_selector/wpml_lang_all.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Element selector that translates post elements and chooses the best element ID
5
+ * when the current language is "all" (to display all content disregarding their language).
6
+ *
7
+ * This selector uses a specific provided language instead, or uses the default language.
8
+ *
9
+ * The Toolset_Association_Query_V2 is responsible for determining the correct language code.
10
+ *
11
+ * @since 2.6.8
12
+ */
13
+ class Toolset_Association_Query_Element_Selector_Wpml_Lang_All
14
+ extends Toolset_Association_Query_Element_Selector_Wpml
15
+ {
16
+
17
+ /** @var string|null Language code (except 'all') or null for default language */
18
+ private $translation_language;
19
+
20
+
21
+ /**
22
+ * Toolset_Association_Query_Element_Selector_Wpml_Lang_All constructor.
23
+ *
24
+ * @param Toolset_Relationship_Database_Unique_Table_Alias $table_alias
25
+ * @param Toolset_Association_Query_Table_Join_Manager $join_manager
26
+ * @param string|null $translation_language Language code (except 'all') or null for default language.
27
+ * @param wpdb|null $wpdb_di
28
+ * @param Toolset_Relationship_Database_Operations|null $database_operations_di
29
+ * @param Toolset_WPML_Compatibility|null $wpml_compatibility_di
30
+ */
31
+ public function __construct(
32
+ Toolset_Relationship_Database_Unique_Table_Alias $table_alias,
33
+ Toolset_Association_Query_Table_Join_Manager $join_manager,
34
+ $translation_language,
35
+ wpdb $wpdb_di = null,
36
+ Toolset_Relationship_Database_Operations $database_operations_di = null,
37
+ Toolset_WPML_Compatibility $wpml_compatibility_di = null
38
+ ) {
39
+ parent::__construct( $table_alias, $join_manager, $wpdb_di, $database_operations_di, $wpml_compatibility_di );
40
+
41
+ $this->translation_language = $translation_language;
42
+ }
43
+
44
+
45
+ /**
46
+ * Get the language that will be used for the query results (besides the default language).
47
+ *
48
+ * @return string
49
+ * @since 2.6.8
50
+ */
51
+ protected function get_translation_language() {
52
+ if( null === $this->translation_language ) {
53
+ return $this->wpml_service->get_default_language();
54
+ }
55
+
56
+ return $this->translation_language;
57
+ }
58
+
59
+ }
vendor/toolset/toolset-common/inc/m2m/association/query/result_transformation/association_instance.php CHANGED
@@ -87,6 +87,7 @@ class Toolset_Association_Query_Result_Transformation_Association_Instance
87
  * @param IToolset_Association_Query_Element_Selector $element_selector
88
  *
89
  * @return IToolset_Association
 
90
  */
91
  private function transform_with_wpml( $database_row, IToolset_Association_Query_Element_Selector $element_selector ) {
92
 
@@ -136,6 +137,9 @@ class Toolset_Association_Query_Result_Transformation_Association_Instance
136
  * @since 2.5.10
137
  */
138
  public function request_element_selection( IToolset_Association_Query_Element_Selector $element_selector ) {
 
 
 
139
  // Request all element IDs so that we can instantiate the association object.
140
  foreach( Toolset_Relationship_Role::all() as $role ) {
141
  $element_selector->request_element_in_results( $role );
87
  * @param IToolset_Association_Query_Element_Selector $element_selector
88
  *
89
  * @return IToolset_Association
90
+ * @throws Toolset_Element_Exception_Element_Doesnt_Exist
91
  */
92
  private function transform_with_wpml( $database_row, IToolset_Association_Query_Element_Selector $element_selector ) {
93
 
137
  * @since 2.5.10
138
  */
139
  public function request_element_selection( IToolset_Association_Query_Element_Selector $element_selector ) {
140
+ // We totally need the association and relationship ID:
141
+ $element_selector->request_association_and_relationship_in_results();
142
+
143
  // Request all element IDs so that we can instantiate the association object.
144
  foreach( Toolset_Relationship_Role::all() as $role ) {
145
  $element_selector->request_element_in_results( $role );
vendor/toolset/toolset-common/inc/m2m/association/query/result_transformation/association_uid.php CHANGED
@@ -32,8 +32,8 @@ class Toolset_Association_Query_Result_Transformation_Association_Uid
32
  * @since 2.5.10
33
  */
34
  public function request_element_selection( IToolset_Association_Query_Element_Selector $element_selector ) {
35
- // Nothing to do here, as we're only returing the association UID and don't care
36
- // about its elements.
37
  }
38
 
39
  }
32
  * @since 2.5.10
33
  */
34
  public function request_element_selection( IToolset_Association_Query_Element_Selector $element_selector ) {
35
+ // We're only returning the association UID but don't care about its elements.
36
+ $element_selector->request_association_and_relationship_in_results();
37
  }
38
 
39
  }
vendor/toolset/toolset-common/inc/m2m/association/query/result_transformation/element_id.php CHANGED
@@ -46,7 +46,9 @@ class Toolset_Association_Query_Result_Transformation_Element_Id
46
  * @since 2.5.10
47
  */
48
  public function request_element_selection( IToolset_Association_Query_Element_Selector $element_selector ) {
49
- // We need only one element here.
 
50
  $element_selector->request_element_in_results( $this->role );
 
51
  }
52
  }
46
  * @since 2.5.10
47
  */
48
  public function request_element_selection( IToolset_Association_Query_Element_Selector $element_selector ) {
49
+ // We need only one element here. Also, we explicitly *don't* want to include association ID
50
+ // so that we can filter out duplicate IDs by the DISTINCT query.
51
  $element_selector->request_element_in_results( $this->role );
52
+ $element_selector->request_distinct_query();
53
  }
54
  }
vendor/toolset/toolset-common/inc/m2m/association/query/result_transformation/element_instance.php CHANGED
@@ -122,8 +122,10 @@ class Toolset_Association_Query_Result_Transformation_Element_Instance
122
  * @since 2.5.10
123
  */
124
  public function request_element_selection( IToolset_Association_Query_Element_Selector $element_selector ) {
125
- // We need only one element here.
 
126
  $element_selector->request_element_in_results( $this->role );
 
127
  }
128
 
129
  }
122
  * @since 2.5.10
123
  */
124
  public function request_element_selection( IToolset_Association_Query_Element_Selector $element_selector ) {
125
+ // We need only one element here. Also, we explicitly *don't* want to include association ID
126
+ // so that we can filter out duplicate IDs by the DISTINCT query.
127
  $element_selector->request_element_in_results( $this->role );
128
+ $element_selector->request_distinct_query();
129
  }
130
 
131
  }
vendor/toolset/toolset-common/inc/m2m/association/query/sql_expression_builder.php CHANGED
@@ -109,12 +109,11 @@ class Toolset_Association_Query_Sql_Expression_Builder {
109
  $limit = (int) $limit;
110
  $offset = (int) $offset;
111
 
 
 
112
  // Make sure we glue the pieces together well and leave no extra comma at the end
113
  // in case $select_elements is empty.
114
- $final_select_elements = array(
115
- 'associations.id AS id',
116
- 'associations.relationship_id AS relationship_id'
117
- );
118
  $select_elements_trimmed = trim( $select_elements );
119
  if( ! empty( $select_elements_trimmed ) ) {
120
  $final_select_elements[] = $select_elements;
@@ -123,7 +122,7 @@ class Toolset_Association_Query_Sql_Expression_Builder {
123
 
124
  // We rely on all the moving parts which are supposed to have provided properly escaped strings.
125
  $query = "
126
- SELECT
127
  {$sql_found_rows}
128
  {$final_select_elements}
129
  FROM {$associations_table} AS associations {$join_clause}
109
  $limit = (int) $limit;
110
  $offset = (int) $offset;
111
 
112
+ $maybe_distinct = $element_selector->maybe_get_distinct_modifier();
113
+
114
  // Make sure we glue the pieces together well and leave no extra comma at the end
115
  // in case $select_elements is empty.
116
+ $final_select_elements = array();
 
 
 
117
  $select_elements_trimmed = trim( $select_elements );
118
  if( ! empty( $select_elements_trimmed ) ) {
119
  $final_select_elements[] = $select_elements;
122
 
123
  // We rely on all the moving parts which are supposed to have provided properly escaped strings.
124
  $query = "
125
+ SELECT {$maybe_distinct}
126
  {$sql_found_rows}
127
  {$final_select_elements}
128
  FROM {$associations_table} AS associations {$join_clause}
vendor/toolset/toolset-common/inc/m2m/autoload_classmap.php CHANGED
@@ -16,6 +16,11 @@ return array(
16
  'IToolset_Relationship_Query_Condition' => dirname( __FILE__ ) . '/relationship/query/condition/interface.php',
17
  'IToolset_Relationship_Role' => dirname( __FILE__ ) . '/relationship/role/interface.php',
18
  'IToolset_Relationship_Role_Parent_Child' => dirname( __FILE__ ) . '/relationship/role/parent_child_interface.php',
 
 
 
 
 
19
  'Toolset_Association' => dirname( __FILE__ ) . '/association/association.php',
20
  'Toolset_Association_Cleanup_Association' => dirname( __FILE__ ) . '/association/cleanup/association.php',
21
  'Toolset_Association_Cleanup_Cron_Event' => dirname( __FILE__ ) . '/association/cleanup/cron_event.php',
@@ -23,6 +28,7 @@ return array(
23
  'Toolset_Association_Cleanup_Dangling_Intermediary_Posts' => dirname( __FILE__ ) . '/association/cleanup/dangling_intermediary_posts.php',
24
  'Toolset_Association_Cleanup_Factory' => dirname( __FILE__ ) . '/association/cleanup/factory.php',
25
  'Toolset_Association_Cleanup_Post' => dirname( __FILE__ ) . '/association/cleanup/post.php',
 
26
  'Toolset_Association_Cleanup_Troubleshooting_Section' => dirname( __FILE__ ) . '/association/cleanup/troubleshooting_section.php',
27
  'Toolset_Association_Factory' => dirname( __FILE__ ) . '/association/factory.php',
28
  'Toolset_Association_Intermediary_Post_Persistence' => dirname( __FILE__ ) . '/association/intermediary_post_persistence.php',
@@ -35,21 +41,26 @@ return array(
35
  'Toolset_Association_Query_Condition_Element_Status' => dirname( __FILE__ ) . '/association/query/condition/element_status.php',
36
  'Toolset_Association_Query_Condition_Empty_Intermediary' => dirname( __FILE__ ) . '/association/query/condition/empty_intermediary.php',
37
  'Toolset_Association_Query_Condition_Exclude_Element' => dirname( __FILE__ ) . '/association/query/condition/exclude_element.php',
 
38
  'Toolset_Association_Query_Condition_Factory' => dirname( __FILE__ ) . '/association/query/condition_factory.php',
39
  'Toolset_Association_Query_Condition_Has_Active_Relationship' => dirname( __FILE__ ) . '/association/query/condition/has_active_relationship.php',
40
  'Toolset_Association_Query_Condition_Has_Domain' => dirname( __FILE__ ) . '/association/query/condition/has_domain.php',
41
  'Toolset_Association_Query_Condition_Has_Domain_And_Type' => dirname( __FILE__ ) . '/association/query/condition/has_domain_and_type.php',
 
42
  'Toolset_Association_Query_Condition_Has_Legacy_Relationship' => dirname( __FILE__ ) . '/association/query/condition/has_legacy_relationship.php',
43
  'Toolset_Association_Query_Condition_Has_Type' => dirname( __FILE__ ) . '/association/query/condition/has_type.php',
 
44
  'Toolset_Association_Query_Condition_Postmeta' => dirname( __FILE__ ) . '/association/query/condition/postmeta.php',
45
  'Toolset_Association_Query_Condition_Relationship_Flag' => dirname( __FILE__ ) . '/association/query/condition/relationship_flag.php',
46
  'Toolset_Association_Query_Condition_Relationship_Id' => dirname( __FILE__ ) . '/association/query/condition/relationship_id.php',
 
47
  'Toolset_Association_Query_Condition_Search' => dirname( __FILE__ ) . '/association/query/condition/search.php',
48
  'Toolset_Association_Query_Condition_Wp_Query' => dirname( __FILE__ ) . '/association/query/condition/wp_query.php',
49
  'Toolset_Association_Query_Element_Selector_Abstract' => dirname( __FILE__ ) . '/association/query/element_selector/abstract.php',
50
  'Toolset_Association_Query_Element_Selector_Default' => dirname( __FILE__ ) . '/association/query/element_selector/default.php',
51
  'Toolset_Association_Query_Element_Selector_Provider' => dirname( __FILE__ ) . '/association/query/element_selector/provider.php',
52
  'Toolset_Association_Query_Element_Selector_Wpml' => dirname( __FILE__ ) . '/association/query/element_selector/wpml.php',
 
53
  'Toolset_Association_Query_Orderby' => dirname( __FILE__ ) . '/association/query/orderby/abstract.php',
54
  'Toolset_Association_Query_Orderby_Factory' => dirname( __FILE__ ) . '/association/query/orderby_factory.php',
55
  'Toolset_Association_Query_Orderby_Nothing' => dirname( __FILE__ ) . '/association/query/orderby/nothing.php',
@@ -64,11 +75,16 @@ return array(
64
  'Toolset_Association_Query_V2' => dirname( __FILE__ ) . '/association/query/association_query_v2.php',
65
  'Toolset_Association_Query_Wpdb_Wrapper' => dirname( __FILE__ ) . '/association/query/wpdb_wrapper.php',
66
  'Toolset_Association_Translator' => dirname( __FILE__ ) . '/association/translator.php',
 
67
  'Toolset_Potential_Association_Query_Factory' => dirname( __FILE__ ) . '/potential_association/query_factory.php',
 
 
 
68
  'Toolset_Potential_Association_Query_Posts' => dirname( __FILE__ ) . '/potential_association/query_posts.php',
69
  'Toolset_Query_Comparison_Operator' => dirname( __FILE__ ) . '/query/comparison_operator.php',
70
  'Toolset_Query_Condition_And' => dirname( __FILE__ ) . '/query/condition/and.php',
71
  'Toolset_Query_Condition_Contradiction' => dirname( __FILE__ ) . '/query/condition/contradiction.php',
 
72
  'Toolset_Query_Condition_Operator' => dirname( __FILE__ ) . '/query/condition/operator.php',
73
  'Toolset_Query_Condition_Or' => dirname( __FILE__ ) . '/query/condition/or.php',
74
  'Toolset_Query_Condition_Tautology' => dirname( __FILE__ ) . '/query/condition/tautology.php',
@@ -101,10 +117,13 @@ return array(
101
  'Toolset_Relationship_Query_Cardinality_Match_Operators' => dirname( __FILE__ ) . '/relationship/query/cardinality_match/operators.php',
102
  'Toolset_Relationship_Query_Cardinality_Match_Single' => dirname( __FILE__ ) . '/relationship/query/cardinality_match/single.php',
103
  'Toolset_Relationship_Query_Condition' => dirname( __FILE__ ) . '/relationship/query/condition/abstract.php',
 
 
104
  'Toolset_Relationship_Query_Condition_Factory' => dirname( __FILE__ ) . '/relationship/query/condition_factory.php',
105
  'Toolset_Relationship_Query_Condition_Has_Active_Types' => dirname( __FILE__ ) . '/relationship/query/condition/has_active_types.php',
106
  'Toolset_Relationship_Query_Condition_Has_Cardinality' => dirname( __FILE__ ) . '/relationship/query/condition/has_cardinality.php',
107
  'Toolset_Relationship_Query_Condition_Has_Domain' => dirname( __FILE__ ) . '/relationship/query/condition/has_domain.php',
 
108
  'Toolset_Relationship_Query_Condition_Is_Active' => dirname( __FILE__ ) . '/relationship/query/condition/is_active.php',
109
  'Toolset_Relationship_Query_Condition_Is_Boolean_Flag' => dirname( __FILE__ ) . '/relationship/query/condition/is_boolean_flag.php',
110
  'Toolset_Relationship_Query_Condition_Is_Legacy' => dirname( __FILE__ ) . '/relationship/query/condition/is_legacy.php',
16
  'IToolset_Relationship_Query_Condition' => dirname( __FILE__ ) . '/relationship/query/condition/interface.php',
17
  'IToolset_Relationship_Role' => dirname( __FILE__ ) . '/relationship/role/interface.php',
18
  'IToolset_Relationship_Role_Parent_Child' => dirname( __FILE__ ) . '/relationship/role/parent_child_interface.php',
19
+ 'OTGS\Toolset\Common\M2M\Association\Repository' => dirname( __FILE__ ) . '/association/Repository.php',
20
+ 'OTGS\Toolset\Common\M2M\PotentialAssociation\CardinalityPostQuery' => dirname( __FILE__ ) . '/potential_association/cardinality_post_query.php',
21
+ 'OTGS\Toolset\Common\M2M\PotentialAssociation\JoinManager' => dirname( __FILE__ ) . '/potential_association/join_manager.php',
22
+ 'OTGS\Toolset\Common\M2M\PotentialAssociation\WpQueryAdjustment' => dirname( __FILE__ ) . '/potential_association/wp_query_adjustment.php',
23
+ 'OTGS\Toolset\Common\M2M\PublicApiService' => dirname( __FILE__ ) . '/public_api_service.php',
24
  'Toolset_Association' => dirname( __FILE__ ) . '/association/association.php',
25
  'Toolset_Association_Cleanup_Association' => dirname( __FILE__ ) . '/association/cleanup/association.php',
26
  'Toolset_Association_Cleanup_Cron_Event' => dirname( __FILE__ ) . '/association/cleanup/cron_event.php',
28
  'Toolset_Association_Cleanup_Dangling_Intermediary_Posts' => dirname( __FILE__ ) . '/association/cleanup/dangling_intermediary_posts.php',
29
  'Toolset_Association_Cleanup_Factory' => dirname( __FILE__ ) . '/association/cleanup/factory.php',
30
  'Toolset_Association_Cleanup_Post' => dirname( __FILE__ ) . '/association/cleanup/post.php',
31
+ 'Toolset_Association_Cleanup_Post_Type' => dirname( __FILE__ ) . '/association/cleanup/post_type.php',
32
  'Toolset_Association_Cleanup_Troubleshooting_Section' => dirname( __FILE__ ) . '/association/cleanup/troubleshooting_section.php',
33
  'Toolset_Association_Factory' => dirname( __FILE__ ) . '/association/factory.php',
34
  'Toolset_Association_Intermediary_Post_Persistence' => dirname( __FILE__ ) . '/association/intermediary_post_persistence.php',
41
  'Toolset_Association_Query_Condition_Element_Status' => dirname( __FILE__ ) . '/association/query/condition/element_status.php',
42
  'Toolset_Association_Query_Condition_Empty_Intermediary' => dirname( __FILE__ ) . '/association/query/condition/empty_intermediary.php',
43
  'Toolset_Association_Query_Condition_Exclude_Element' => dirname( __FILE__ ) . '/association/query/condition/exclude_element.php',
44
+ 'Toolset_Association_Query_Condition_Exclude_Relationship' => dirname( __FILE__ ) . '/association/query/condition/exclude_relationship.php',
45
  'Toolset_Association_Query_Condition_Factory' => dirname( __FILE__ ) . '/association/query/condition_factory.php',
46
  'Toolset_Association_Query_Condition_Has_Active_Relationship' => dirname( __FILE__ ) . '/association/query/condition/has_active_relationship.php',
47
  'Toolset_Association_Query_Condition_Has_Domain' => dirname( __FILE__ ) . '/association/query/condition/has_domain.php',
48
  'Toolset_Association_Query_Condition_Has_Domain_And_Type' => dirname( __FILE__ ) . '/association/query/condition/has_domain_and_type.php',
49
+ 'Toolset_Association_Query_Condition_Has_Intermediary_Id' => dirname( __FILE__ ) . '/association/query/condition/has_intermediary_id.php',
50
  'Toolset_Association_Query_Condition_Has_Legacy_Relationship' => dirname( __FILE__ ) . '/association/query/condition/has_legacy_relationship.php',
51
  'Toolset_Association_Query_Condition_Has_Type' => dirname( __FILE__ ) . '/association/query/condition/has_type.php',
52
+ 'Toolset_Association_Query_Condition_Intermediary_Id' => dirname( __FILE__ ) . '/association/query/condition/intermediary_id.php',
53
  'Toolset_Association_Query_Condition_Postmeta' => dirname( __FILE__ ) . '/association/query/condition/postmeta.php',
54
  'Toolset_Association_Query_Condition_Relationship_Flag' => dirname( __FILE__ ) . '/association/query/condition/relationship_flag.php',
55
  'Toolset_Association_Query_Condition_Relationship_Id' => dirname( __FILE__ ) . '/association/query/condition/relationship_id.php',
56
+ 'Toolset_Association_Query_Condition_Relationship_Origin' => dirname( __FILE__ ) . '/association/query/condition/relationship_origin.php',
57
  'Toolset_Association_Query_Condition_Search' => dirname( __FILE__ ) . '/association/query/condition/search.php',
58
  'Toolset_Association_Query_Condition_Wp_Query' => dirname( __FILE__ ) . '/association/query/condition/wp_query.php',
59
  'Toolset_Association_Query_Element_Selector_Abstract' => dirname( __FILE__ ) . '/association/query/element_selector/abstract.php',
60
  'Toolset_Association_Query_Element_Selector_Default' => dirname( __FILE__ ) . '/association/query/element_selector/default.php',
61
  'Toolset_Association_Query_Element_Selector_Provider' => dirname( __FILE__ ) . '/association/query/element_selector/provider.php',
62
  'Toolset_Association_Query_Element_Selector_Wpml' => dirname( __FILE__ ) . '/association/query/element_selector/wpml.php',
63
+ 'Toolset_Association_Query_Element_Selector_Wpml_Lang_All' => dirname( __FILE__ ) . '/association/query/element_selector/wpml_lang_all.php',
64
  'Toolset_Association_Query_Orderby' => dirname( __FILE__ ) . '/association/query/orderby/abstract.php',
65
  'Toolset_Association_Query_Orderby_Factory' => dirname( __FILE__ ) . '/association/query/orderby_factory.php',
66
  'Toolset_Association_Query_Orderby_Nothing' => dirname( __FILE__ ) . '/association/query/orderby/nothing.php',
75
  'Toolset_Association_Query_V2' => dirname( __FILE__ ) . '/association/query/association_query_v2.php',
76
  'Toolset_Association_Query_Wpdb_Wrapper' => dirname( __FILE__ ) . '/association/query/wpdb_wrapper.php',
77
  'Toolset_Association_Translator' => dirname( __FILE__ ) . '/association/translator.php',
78
+ 'Toolset_Potential_Association_Query_Arguments' => dirname( __FILE__ ) . '/potential_association/query_arguments.php',
79
  'Toolset_Potential_Association_Query_Factory' => dirname( __FILE__ ) . '/potential_association/query_factory.php',
80
+ 'Toolset_Potential_Association_Query_Filter_Interface' => dirname( __FILE__ ) . '/potential_association/filters/interface.php',
81
+ 'Toolset_Potential_Association_Query_Filter_Posts_Author' => dirname( __FILE__ ) . '/potential_association/filters/post/author.php',
82
+ 'Toolset_Potential_Association_Query_Filter_Search_String' => dirname( __FILE__ ) . '/potential_association/filters/search_string.php',
83
  'Toolset_Potential_Association_Query_Posts' => dirname( __FILE__ ) . '/potential_association/query_posts.php',
84
  'Toolset_Query_Comparison_Operator' => dirname( __FILE__ ) . '/query/comparison_operator.php',
85
  'Toolset_Query_Condition_And' => dirname( __FILE__ ) . '/query/condition/and.php',
86
  'Toolset_Query_Condition_Contradiction' => dirname( __FILE__ ) . '/query/condition/contradiction.php',
87
+ 'Toolset_Query_Condition_Not' => dirname( __FILE__ ) . '/query/condition/not.php',
88
  'Toolset_Query_Condition_Operator' => dirname( __FILE__ ) . '/query/condition/operator.php',
89
  'Toolset_Query_Condition_Or' => dirname( __FILE__ ) . '/query/condition/or.php',
90
  'Toolset_Query_Condition_Tautology' => dirname( __FILE__ ) . '/query/condition/tautology.php',
117
  'Toolset_Relationship_Query_Cardinality_Match_Operators' => dirname( __FILE__ ) . '/relationship/query/cardinality_match/operators.php',
118
  'Toolset_Relationship_Query_Cardinality_Match_Single' => dirname( __FILE__ ) . '/relationship/query/cardinality_match/single.php',
119
  'Toolset_Relationship_Query_Condition' => dirname( __FILE__ ) . '/relationship/query/condition/abstract.php',
120
+ 'Toolset_Relationship_Query_Condition_Exclude_Relationship' => dirname( __FILE__ ) . '/relationship/query/condition/exclude_relationship.php',
121
+ 'Toolset_Relationship_Query_Condition_Exclude_Type' => dirname( __FILE__ ) . '/relationship/query/condition/exclude_type.php',
122
  'Toolset_Relationship_Query_Condition_Factory' => dirname( __FILE__ ) . '/relationship/query/condition_factory.php',
123
  'Toolset_Relationship_Query_Condition_Has_Active_Types' => dirname( __FILE__ ) . '/relationship/query/condition/has_active_types.php',
124
  'Toolset_Relationship_Query_Condition_Has_Cardinality' => dirname( __FILE__ ) . '/relationship/query/condition/has_cardinality.php',
125
  'Toolset_Relationship_Query_Condition_Has_Domain' => dirname( __FILE__ ) . '/relationship/query/condition/has_domain.php',
126
+ 'Toolset_Relationship_Query_Condition_Intermediary_Type' => dirname( __FILE__ ) . '/relationship/query/condition/intermediary_type.php',
127
  'Toolset_Relationship_Query_Condition_Is_Active' => dirname( __FILE__ ) . '/relationship/query/condition/is_active.php',
128
  'Toolset_Relationship_Query_Condition_Is_Boolean_Flag' => dirname( __FILE__ ) . '/relationship/query/condition/is_boolean_flag.php',
129
  'Toolset_Relationship_Query_Condition_Is_Legacy' => dirname( __FILE__ ) . '/relationship/query/condition/is_legacy.php',
vendor/toolset/toolset-common/inc/m2m/cardinality.php CHANGED
@@ -150,17 +150,17 @@ class Toolset_Relationship_Cardinality {
150
  /**
151
  * Get a limit value per element and limit key.
152
  *
153
- * @param string $element_role
154
  * @param string $limit_key
155
  *
156
  * @return int Limit value.
157
  * @since m2m
158
  */
159
  public function get_limit( $element_role, $limit_key = self::MAX ) {
160
- Toolset_Association::validate_element_role( $element_role );
161
  self::validate_limit_name( $limit_key );
 
162
 
163
- return $this->limits[ $element_role ][ $limit_key ];
164
  }
165
 
166
 
@@ -282,7 +282,9 @@ class Toolset_Relationship_Cardinality {
282
  }
283
  }
284
 
285
- throw new InvalidArgumentException();
 
 
286
  }
287
 
288
 
@@ -328,4 +330,20 @@ class Toolset_Relationship_Cardinality {
328
  return $this->limits;
329
  }
330
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  }
150
  /**
151
  * Get a limit value per element and limit key.
152
  *
153
+ * @param string|IToolset_Relationship_Role_Parent_Child $element_role
154
  * @param string $limit_key
155
  *
156
  * @return int Limit value.
157
  * @since m2m
158
  */
159
  public function get_limit( $element_role, $limit_key = self::MAX ) {
 
160
  self::validate_limit_name( $limit_key );
161
+ $role_name = Toolset_Relationship_Role::name_from_role( $element_role );
162
 
163
+ return $this->limits[ $role_name ][ $limit_key ];
164
  }
165
 
166
 
282
  }
283
  }
284
 
285
+ throw new InvalidArgumentException(
286
+ 'Invalid cardinality string. Expected format is "{$parent_min}..{$parent_max}:{$child_min}..{$child_max}. Each of these values must be an integer or "*" for infinity.'
287
+ );
288
  }
289
 
290
 
330
  return $this->limits;
331
  }
332
 
333
+
334
+ /**
335
+ * Get a string representation of the cardinality type.
336
+ *
337
+ * @return string 'many-to-many'|'one-to-many'|'one-to-one'
338
+ */
339
+ public function get_type() {
340
+ if( $this->is_many_to_many() ) {
341
+ return 'many-to-many';
342
+ } elseif( $this->is_one_to_many() ) {
343
+ return 'one-to-many';
344
+ } else {
345
+ return 'one-to-one';
346
+ }
347
+ }
348
+
349
  }
vendor/toolset/toolset-common/inc/m2m/controller.php CHANGED
@@ -70,7 +70,7 @@ class Toolset_Relationship_Controller {
70
  /**
71
  * We need WPML to fire certain actions when it updates its icl_translations table.
72
  */
73
- const MINIMAL_WPML_VERSION = '3.9.0';
74
 
75
 
76
  private $is_autoloader_initialized = false;
70
  /**
71
  * We need WPML to fire certain actions when it updates its icl_translations table.
72
  */
73
+ const MINIMAL_WPML_VERSION = '3.9.3';
74
 
75
 
76
  private $is_autoloader_initialized = false;
vendor/toolset/toolset-common/inc/m2m/database/operations.php CHANGED
@@ -260,7 +260,7 @@ class Toolset_Relationship_Database_Operations {
260
  child_domain varchar(20) NOT NULL DEFAULT '',
261
  child_types bigint(20) UNSIGNED NOT NULL DEFAULT 0,
262
  intermediary_type varchar(20) NOT NULL DEFAULT '',
263
- ownership enum('parent', 'child', 'none') NOT NULL DEFAULT 'none',
264
  cardinality_parent_max int(10) NOT NULL DEFAULT -1,
265
  cardinality_parent_min int(10) NOT NULL DEFAULT 0,
266
  cardinality_child_max int(10) NOT NULL DEFAULT -1,
@@ -271,6 +271,10 @@ class Toolset_Relationship_Database_Operations {
271
  role_name_parent varchar(255) NOT NULL DEFAULT '',
272
  role_name_child varchar(255) NOT NULL DEFAULT '',
273
  role_name_intermediary varchar(255) NOT NULL DEFAULT '',
 
 
 
 
274
  needs_legacy_support tinyint(1) NOT NULL DEFAULT 0,
275
  is_active tinyint(1) NOT NULL DEFAULT 0,
276
  PRIMARY KEY id (id),
@@ -344,7 +348,7 @@ class Toolset_Relationship_Database_Operations {
344
  $rows_updated
345
  )
346
  : sprintf(
347
- __( 'There has been an error when updating the assocation table with the new relationship slug: %s', 'wpcf' ),
348
  $this->wpdb->last_error
349
  )
350
  );
@@ -419,6 +423,10 @@ class Toolset_Relationship_Database_Operations {
419
  $relationships_table_alias.role_name_parent AS role_name_parent,
420
  $relationships_table_alias.role_name_child AS role_name_child,
421
  $relationships_table_alias.role_name_intermediary AS role_name_intermediary,
 
 
 
 
422
  $relationships_table_alias.needs_legacy_support AS needs_legacy_support,
423
  $relationships_table_alias.is_active AS is_active,
424
  $relationships_table_alias.parent_types AS parent_types_set_id,
@@ -592,12 +600,13 @@ class Toolset_Relationship_Database_Operations {
592
  if ( ! in_array( $role_name, Toolset_Relationship_Role::parent_child_role_names() ) ) {
593
  throw new InvalidArgumentException( 'Wrong role name' );
594
  }
 
595
  $count = $this->wpdb->get_var(
596
  $this->wpdb->prepare(
597
  "SELECT max(n) count
598
  FROM (
599
  SELECT count(*) n
600
- FROM `wp_toolset_associations`
601
  WHERE relationship_id = %d
602
  GROUP BY {$role_name}_id
603
  ) count", $relationship_id ) );
260
  child_domain varchar(20) NOT NULL DEFAULT '',
261
  child_types bigint(20) UNSIGNED NOT NULL DEFAULT 0,
262
  intermediary_type varchar(20) NOT NULL DEFAULT '',
263
+ ownership varchar(8) NOT NULL DEFAULT 'none',
264
  cardinality_parent_max int(10) NOT NULL DEFAULT -1,
265
  cardinality_parent_min int(10) NOT NULL DEFAULT 0,
266
  cardinality_child_max int(10) NOT NULL DEFAULT -1,
271
  role_name_parent varchar(255) NOT NULL DEFAULT '',
272
  role_name_child varchar(255) NOT NULL DEFAULT '',
273
  role_name_intermediary varchar(255) NOT NULL DEFAULT '',
274
+ role_label_parent_singular VARCHAR(255) NOT NULL DEFAULT '',
275
+ role_label_child_singular VARCHAR(255) NOT NULL DEFAULT '',
276
+ role_label_parent_plural VARCHAR(255) NOT NULL DEFAULT '',
277
+ role_label_child_plural VARCHAR(255) NOT NULL DEFAULT '',
278
  needs_legacy_support tinyint(1) NOT NULL DEFAULT 0,
279
  is_active tinyint(1) NOT NULL DEFAULT 0,
280
  PRIMARY KEY id (id),
348
  $rows_updated
349
  )
350
  : sprintf(
351
+ __( 'There has been an error when updating the association table with the new relationship slug: %s', 'wpcf' ),
352
  $this->wpdb->last_error
353
  )
354
  );
423
  $relationships_table_alias.role_name_parent AS role_name_parent,
424
  $relationships_table_alias.role_name_child AS role_name_child,
425
  $relationships_table_alias.role_name_intermediary AS role_name_intermediary,
426
+ $relationships_table_alias.role_label_parent_singular AS role_label_parent_singular,
427
+ $relationships_table_alias.role_label_child_singular AS role_label_child_singular,
428
+ $relationships_table_alias.role_label_parent_plural AS role_label_parent_plural,
429
+ $relationships_table_alias.role_label_child_plural AS role_label_child_plural,
430
  $relationships_table_alias.needs_legacy_support AS needs_legacy_support,
431
  $relationships_table_alias.is_active AS is_active,
432
  $relationships_table_alias.parent_types AS parent_types_set_id,
600
  if ( ! in_array( $role_name, Toolset_Relationship_Role::parent_child_role_names() ) ) {
601
  throw new InvalidArgumentException( 'Wrong role name' );
602
  }
603
+ $associations_table = Toolset_Relationship_Table_Name::associations();
604
  $count = $this->wpdb->get_var(
605
  $this->wpdb->prepare(
606
  "SELECT max(n) count
607
  FROM (
608
  SELECT count(*) n
609
+ FROM {$associations_table}
610
  WHERE relationship_id = %d
611
  GROUP BY {$role_name}_id
612
  ) count", $relationship_id ) );
vendor/toolset/toolset-common/inc/m2m/migration/associations.php CHANGED
@@ -30,6 +30,10 @@ class Toolset_Relationship_Migration_Associations {
30
  private $copy_post_content_when_creating;
31
 
32
 
 
 
 
 
33
  /**
34
  * Toolset_Relationship_Migration_Associations constructor.
35
  *
@@ -38,19 +42,22 @@ class Toolset_Relationship_Migration_Associations {
38
  * @param bool $copy_post_content_when_creating
39
  * @param Toolset_Element_Factory|null $element_factory_di
40
  * @param Toolset_Potential_Association_Query_Factory|null $potential_association_query_factory_di
 
41
  */
42
  public function __construct(
43
  Toolset_Relationship_Definition_Repository $definition_repository,
44
  $create_default_language_if_missing,
45
  $copy_post_content_when_creating,
46
  Toolset_Element_Factory $element_factory_di = null,
47
- Toolset_Potential_Association_Query_Factory $potential_association_query_factory_di = null
 
48
  ) {
49
  $this->definition_repository = $definition_repository;
50
  $this->create_default_language_if_missing = (bool) $create_default_language_if_missing;
51
  $this->copy_post_content_when_creating = (bool) $copy_post_content_when_creating;
52
  $this->element_factory = $element_factory_di ?: new Toolset_Element_Factory();
53
  $this->potential_association_query_factory = $potential_association_query_factory_di ?: new Toolset_Potential_Association_Query_Factory();
 
54
  }
55
 
56
 
@@ -63,13 +70,13 @@ class Toolset_Relationship_Migration_Associations {
63
  */
64
  public function migrate_association( $parent_id, $child_id, $relationship_slug ) {
65
 
66
- $relationship_definition = $this->definition_repository->get_definition( $relationship_slug );
 
67
 
68
- if( null == $relationship_definition ) {
69
- return new Toolset_Result( false, sprintf( __( 'Relationship definition "%s" not found.', 'wpcf' ), $relationship_slug ) );
70
- }
71
 
72
- try {
73
  // We specifically require individual posts (element_factory->get_post_untranslated())
74
  // and not translation sets (which we might get when using element_factory->get_post()).
75
  //
@@ -190,17 +197,21 @@ class Toolset_Relationship_Migration_Associations {
190
  }
191
 
192
  // Happy end!
193
- $results->add(
194
- true,
195
- sprintf(
196
- __( 'Connected #%d (%s) and #%d (%s) in the relationship "%s".', 'wpcf' ),
197
- $parent->get_id(),
198
- $parent->get_title(),
199
- $child->get_id(),
200
- $child->get_title(),
201
- $relationship_slug
202
- )
203
- );
 
 
 
 
204
 
205
  return $results->aggregate( Toolset_Relationship_Migration_Controller::MESSAGE_SEPARATOR );
206
  }
@@ -219,4 +230,5 @@ class Toolset_Relationship_Migration_Associations {
219
  );
220
  return $translation_migration->run();
221
  }
 
222
  }
30
  private $copy_post_content_when_creating;
31
 
32
 
33
+ /** @var bool */
34
+ private $do_detailed_logging;
35
+
36
+
37
  /**
38
  * Toolset_Relationship_Migration_Associations constructor.
39
  *
42
  * @param bool $copy_post_content_when_creating
43
  * @param Toolset_Element_Factory|null $element_factory_di
44
  * @param Toolset_Potential_Association_Query_Factory|null $potential_association_query_factory_di
45
+ * @param bool $do_detailed_logging
46
  */
47
  public function __construct(
48
  Toolset_Relationship_Definition_Repository $definition_repository,
49
  $create_default_language_if_missing,
50
  $copy_post_content_when_creating,
51
  Toolset_Element_Factory $element_factory_di = null,
52
+ Toolset_Potential_Association_Query_Factory $potential_association_query_factory_di = null,
53
+ $do_detailed_logging = true
54
  ) {
55
  $this->definition_repository = $definition_repository;
56
  $this->create_default_language_if_missing = (bool) $create_default_language_if_missing;
57
  $this->copy_post_content_when_creating = (bool) $copy_post_content_when_creating;
58
  $this->element_factory = $element_factory_di ?: new Toolset_Element_Factory();
59
  $this->potential_association_query_factory = $potential_association_query_factory_di ?: new Toolset_Potential_Association_Query_Factory();
60
+ $this->do_detailed_logging = (bool) $do_detailed_logging;
61
  }
62
 
63
 
70
  */
71
  public function migrate_association( $parent_id, $child_id, $relationship_slug ) {
72
 
73
+ try {
74
+ $relationship_definition = $this->definition_repository->get_definition( $relationship_slug );
75
 
76
+ if( null == $relationship_definition ) {
77
+ throw new RuntimeException( sprintf( __( 'Relationship definition "%s" not found.', 'wpcf' ), $relationship_slug ) );
78
+ }
79
 
 
80
  // We specifically require individual posts (element_factory->get_post_untranslated())
81
  // and not translation sets (which we might get when using element_factory->get_post()).
82
  //
197
  }
198
 
199
  // Happy end!
200
+ if( $this->do_detailed_logging ) {
201
+ $results->add(
202
+ true,
203
+ sprintf(
204
+ __( 'Connected #%d (%s) and #%d (%s) in the relationship "%s".', 'wpcf' ),
205
+ $parent->get_id(),
206
+ $parent->get_title(),
207
+ $child->get_id(),
208
+ $child->get_title(),
209
+ $relationship_slug
210
+ )
211
+ );
212
+ } else {
213
+ $results->add( true );
214
+ }
215
 
216
  return $results->aggregate( Toolset_Relationship_Migration_Controller::MESSAGE_SEPARATOR );
217
  }
230
  );
231
  return $translation_migration->run();
232
  }
233
+
234
  }
vendor/toolset/toolset-common/inc/m2m/migration/controller.php CHANGED
@@ -29,8 +29,12 @@ class Toolset_Relationship_Migration_Controller extends Toolset_Wpdb_User {
29
  private $_association_migrator;
30
 
31
 
32
- /** @var Toolset_Post_Type_Repository */
33
- private $post_type_repository;
 
 
 
 
34
 
35
 
36
  /** @var Toolset_Relationship_Table_Name */
@@ -49,7 +53,7 @@ class Toolset_Relationship_Migration_Controller extends Toolset_Wpdb_User {
49
  * @param Toolset_Relationship_Definition_Repository|null $relationship_definition_repository_di
50
  * @param Toolset_Relationship_Migration_Associations|null $association_migrator_di
51
  * @param Toolset_Relationship_Table_Name|null $table_name_di
52
- * @param Toolset_Post_Type_Repository|null $post_type_repository
53
  * @param Toolset_WPML_Compatibility|null $wpml_service_di
54
  */
55
  public function __construct(
@@ -58,7 +62,7 @@ class Toolset_Relationship_Migration_Controller extends Toolset_Wpdb_User {
58
  Toolset_Relationship_Definition_Repository $relationship_definition_repository_di = null,
59
  Toolset_Relationship_Migration_Associations $association_migrator_di = null,
60
  Toolset_Relationship_Table_Name $table_name_di = null,
61
- Toolset_Post_Type_Repository $post_type_repository = null,
62
  Toolset_WPML_Compatibility $wpml_service_di = null
63
  ) {
64
  parent::__construct( $wpdb_di );
@@ -67,7 +71,7 @@ class Toolset_Relationship_Migration_Controller extends Toolset_Wpdb_User {
67
  $this->_association_migrator = $association_migrator_di;
68
  $this->table_name = $table_name_di ?: new Toolset_Relationship_Table_Name();
69
  $this->wpml_compatibility = $wpml_service_di ?: Toolset_WPML_Compatibility::get_instance();
70
- $this->post_type_repository = $post_type_repository ? $post_type_repository : Toolset_Post_Type_Repository::get_instance();
71
  }
72
 
73
 
@@ -83,7 +87,8 @@ class Toolset_Relationship_Migration_Controller extends Toolset_Wpdb_User {
83
  private function get_association_migrator( $create_default_language_if_missing, $copy_post_content_when_creating ) {
84
  if( null === $this->_association_migrator ) {
85
  $this->_association_migrator = new Toolset_Relationship_Migration_Associations(
86
- $this->get_relationship_repository(), $create_default_language_if_missing, $copy_post_content_when_creating
 
87
  );
88
  }
89
 
@@ -168,10 +173,12 @@ class Toolset_Relationship_Migration_Controller extends Toolset_Wpdb_User {
168
  *
169
  * Relationship slugs will be {$parent_post_type}_{$child_post_type}. Overwrites existing definitions.
170
  *
 
 
171
  * @return Toolset_Result_Set
172
  * @since m2m
173
  */
174
- public function migrate_relationship_definitions() {
175
 
176
  $relationships = $this->get_legacy_relationship_post_type_pairs();
177
 
@@ -187,8 +194,8 @@ class Toolset_Relationship_Migration_Controller extends Toolset_Wpdb_User {
187
  $child_post_type = $post_type_pair['child'];
188
  $relationship_slug = $post_type_pair['slug'];
189
 
190
- $results->add( $this->check_post_type_translation_mode( $parent_post_type ) );
191
- $results->add( $this->check_post_type_translation_mode( $child_post_type ) );
192
 
193
  $result = $this->create_relationship_definition( $parent_post_type, $child_post_type, $relationship_slug );
194
  $results->add( $result );
@@ -206,16 +213,27 @@ class Toolset_Relationship_Migration_Controller extends Toolset_Wpdb_User {
206
  * If WPML is active and the given post type has the standard translation mode, switch it to "display as translated".
207
  *
208
  * @param string $post_type_slug
 
209
  *
210
  * @return Toolset_Result
211
  * @since 2.5.11
212
  */
213
- private function check_post_type_translation_mode( $post_type_slug ) {
214
  if( Toolset_WPML_Compatibility::MODE_TRANSLATE !== $this->wpml_compatibility->get_post_type_translation_mode( $post_type_slug ) ) {
215
  // This will happen also if WPML is not active at all.
216
  return new Toolset_Result( true );
217
  }
218
 
 
 
 
 
 
 
 
 
 
 
219
  // Fix the wrong translation mode.
220
  $this->wpml_compatibility->set_post_type_translation_mode( $post_type_slug, Toolset_WPML_Compatibility::MODE_DISPLAY_AS_TRANSLATED );
221
  return new Toolset_Result(
@@ -255,17 +273,28 @@ class Toolset_Relationship_Migration_Controller extends Toolset_Wpdb_User {
255
  $results = array();
256
 
257
  foreach ( $relationships as $parent_post_type => $relationships_per_post_type ) {
258
- $parent_post_type_obj = $this->post_type_repository->get( $parent_post_type );
 
 
 
259
  $relationships_per_post_type = toolset_ensarr( $relationships_per_post_type );
260
 
261
  foreach ( $relationships_per_post_type as $child_post_type => $temporarily_ignored ) {
262
- $child_post_type_obj = $this->post_type_repository->get( $child_post_type );
 
 
 
 
263
  $results[] = array(
264
  'parent' => $parent_post_type,
265
  'child' => $child_post_type,
266
  'slug' => $this->derive_relationship_slug( $parent_post_type, $child_post_type ),
267
- 'parent_can_be_used_in_relationship' => $parent_post_type_obj->can_be_used_in_relationship() ? 1 : 0,
268
- 'child_can_be_used_in_relationship' => $child_post_type_obj->can_be_used_in_relationship() ? 1 : 0,
 
 
 
 
269
  );
270
  }
271
  }
@@ -274,6 +303,19 @@ class Toolset_Relationship_Migration_Controller extends Toolset_Wpdb_User {
274
  }
275
 
276
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277
  /**
278
  * Create an one-to-many relationship definitions for two provided post types.
279
  *
@@ -322,8 +364,19 @@ class Toolset_Relationship_Migration_Controller extends Toolset_Wpdb_User {
322
  );
323
  }
324
 
325
- return new Toolset_Result( true );
 
 
 
 
 
 
 
 
 
 
326
 
 
327
  }
328
 
329
 
@@ -370,9 +423,9 @@ class Toolset_Relationship_Migration_Controller extends Toolset_Wpdb_User {
370
  if( empty( $associations_to_migrate ) ) {
371
  return new Toolset_Result_Updated( true, 0 );
372
  }
373
-
374
  $results = new Toolset_Result_Set();
375
-
376
  foreach( $associations_to_migrate as $association_to_migrate ) {
377
  $result = $this->get_association_migrator(
378
  $create_default_language_if_missing, $copy_post_content_when_creating
@@ -383,7 +436,7 @@ class Toolset_Relationship_Migration_Controller extends Toolset_Wpdb_User {
383
  );
384
  $results->add( $result );
385
  }
386
-
387
  if( $results->is_complete_success() ) {
388
  return new Toolset_Result_Updated( true, count( $associations_to_migrate ), $results->concat_messages( self::MESSAGE_SEPARATOR ) );
389
  } else {
@@ -437,7 +490,7 @@ class Toolset_Relationship_Migration_Controller extends Toolset_Wpdb_User {
437
  private function get_association_postmeta_records( $offset, $limit ) {
438
 
439
  $query = $this->wpdb->prepare(
440
- "SELECT post.ID AS child_id,
441
  postmeta.meta_key AS relationship_meta_key,
442
  postmeta.meta_value AS parent_id,
443
  post.post_type AS post_type
@@ -453,6 +506,18 @@ class Toolset_Relationship_Migration_Controller extends Toolset_Wpdb_User {
453
  }
454
 
455
 
 
 
 
 
 
 
 
 
 
 
 
 
456
  /**
457
  * Final migration step.
458
  *
@@ -462,6 +527,22 @@ class Toolset_Relationship_Migration_Controller extends Toolset_Wpdb_User {
462
  update_option( Toolset_Relationship_Controller::IS_M2M_ENABLED_OPTION, 'yes', true );
463
  }
464
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
465
  }
466
 
467
 
@@ -470,4 +551,4 @@ class Toolset_Relationship_Migration_Controller extends Toolset_Wpdb_User {
470
  */
471
  class Toolset_Relationship_Migration extends Toolset_Relationship_Migration_Controller {
472
 
473
- }
29
  private $_association_migrator;
30
 
31
 
32
+ /** @var null|Toolset_Post_Type_Repository */
33
+ private $_post_type_repository;
34
+
35
+
36
+ /** @var bool */
37
+ private $_do_detailed_logging;
38
 
39
 
40
  /** @var Toolset_Relationship_Table_Name */
53
  * @param Toolset_Relationship_Definition_Repository|null $relationship_definition_repository_di
54
  * @param Toolset_Relationship_Migration_Associations|null $association_migrator_di
55
  * @param Toolset_Relationship_Table_Name|null $table_name_di
56
+ * @param Toolset_Post_Type_Repository|null $post_type_repository_di
57
  * @param Toolset_WPML_Compatibility|null $wpml_service_di
58
  */
59
  public function __construct(
62
  Toolset_Relationship_Definition_Repository $relationship_definition_repository_di = null,
63
  Toolset_Relationship_Migration_Associations $association_migrator_di = null,
64
  Toolset_Relationship_Table_Name $table_name_di = null,
65
+ Toolset_Post_Type_Repository $post_type_repository_di = null,
66
  Toolset_WPML_Compatibility $wpml_service_di = null
67
  ) {
68
  parent::__construct( $wpdb_di );
71
  $this->_association_migrator = $association_migrator_di;
72
  $this->table_name = $table_name_di ?: new Toolset_Relationship_Table_Name();
73
  $this->wpml_compatibility = $wpml_service_di ?: Toolset_WPML_Compatibility::get_instance();
74
+ $this->_post_type_repository = $post_type_repository_di;
75
  }
76
 
77
 
87
  private function get_association_migrator( $create_default_language_if_missing, $copy_post_content_when_creating ) {
88
  if( null === $this->_association_migrator ) {
89
  $this->_association_migrator = new Toolset_Relationship_Migration_Associations(
90
+ $this->get_relationship_repository(), $create_default_language_if_missing, $copy_post_content_when_creating,
91
+ null, null, $this->do_detailed_logging()
92
  );
93
  }
94
 
173
  *
174
  * Relationship slugs will be {$parent_post_type}_{$child_post_type}. Overwrites existing definitions.
175
  *
176
+ * @param bool $adjust_translation_mode
177
+ *
178
  * @return Toolset_Result_Set
179
  * @since m2m
180
  */
181
+ public function migrate_relationship_definitions( $adjust_translation_mode ) {
182
 
183
  $relationships = $this->get_legacy_relationship_post_type_pairs();
184
 
194
  $child_post_type = $post_type_pair['child'];
195
  $relationship_slug = $post_type_pair['slug'];
196
 
197
+ $results->add( $this->maybe_adjust_post_type_translation_mode( $parent_post_type, $adjust_translation_mode ) );
198
+ $results->add( $this->maybe_adjust_post_type_translation_mode( $child_post_type, $adjust_translation_mode ) );
199
 
200
  $result = $this->create_relationship_definition( $parent_post_type, $child_post_type, $relationship_slug );
201
  $results->add( $result );
213
  * If WPML is active and the given post type has the standard translation mode, switch it to "display as translated".
214
  *
215
  * @param string $post_type_slug
216
+ * @param bool $adjust_translation_mode Whether or not to adjust the translation mode.
217
  *
218
  * @return Toolset_Result
219
  * @since 2.5.11
220
  */
221
+ private function maybe_adjust_post_type_translation_mode( $post_type_slug, $adjust_translation_mode ) {
222
  if( Toolset_WPML_Compatibility::MODE_TRANSLATE !== $this->wpml_compatibility->get_post_type_translation_mode( $post_type_slug ) ) {
223
  // This will happen also if WPML is not active at all.
224
  return new Toolset_Result( true );
225
  }
226
 
227
+ if( ! $adjust_translation_mode ) {
228
+ return new Toolset_Result(
229
+ true,
230
+ sprintf(
231
+ __( 'The post type "%s" has a "show only translated items" translation mode but no adjustments are made as per user\'s choice.', 'wpcf'),
232
+ sanitize_title( $post_type_slug )
233
+ )
234
+ );
235
+ }
236
+
237
  // Fix the wrong translation mode.
238
  $this->wpml_compatibility->set_post_type_translation_mode( $post_type_slug, Toolset_WPML_Compatibility::MODE_DISPLAY_AS_TRANSLATED );
239
  return new Toolset_Result(
273
  $results = array();
274
 
275
  foreach ( $relationships as $parent_post_type => $relationships_per_post_type ) {
276
+ if( ! $parent_post_type_obj = $this->get_post_type_repository()->get( $parent_post_type ) ) {
277
+ // no parent post type object
278
+ continue;
279
+ }
280
  $relationships_per_post_type = toolset_ensarr( $relationships_per_post_type );
281
 
282
  foreach ( $relationships_per_post_type as $child_post_type => $temporarily_ignored ) {
283
+ if( ! $child_post_type_obj = $this->get_post_type_repository()->get( $child_post_type ) ) {
284
+ // no child post type object
285
+ continue;
286
+ }
287
+
288
  $results[] = array(
289
  'parent' => $parent_post_type,
290
  'child' => $child_post_type,
291
  'slug' => $this->derive_relationship_slug( $parent_post_type, $child_post_type ),
292
+ 'parent_has_show_only_translated_mode' => (
293
+ $this->post_type_has_only_show_translated_mode( $parent_post_type ) ? 1 : 0
294
+ ),
295
+ 'child_has_show_only_translated_mode' => (
296
+ $this->post_type_has_only_show_translated_mode( $child_post_type ) ? 1 : 0
297
+ ),
298
  );
299
  }
300
  }
303
  }
304
 
305
 
306
+ private function post_type_has_only_show_translated_mode( $post_type_slug ) {
307
+ if( ! $this->wpml_compatibility->is_wpml_active_and_configured() ) {
308
+ return false;
309
+ }
310
+
311
+ if( ! $this->wpml_compatibility->is_post_type_translatable( $post_type_slug ) ) {
312
+ return false;
313
+ }
314
+
315
+ return ! $this->wpml_compatibility->is_post_type_display_as_translated( $post_type_slug );
316
+ }
317
+
318
+
319
  /**
320
  * Create an one-to-many relationship definitions for two provided post types.
321
  *
364
  );
365
  }
366
 
367
+ if( $this->do_detailed_logging() ) {
368
+ return new Toolset_Result(
369
+ true,
370
+ sprintf(
371
+ __( 'Relationship "%s" between post types "%s" and "%s" was created.', 'wpcf' ),
372
+ $relationship_slug,
373
+ $parent_post_type,
374
+ $child_post_type
375
+ )
376
+ );
377
+ }
378
 
379
+ return new Toolset_Result( true );
380
  }
381
 
382
 
423
  if( empty( $associations_to_migrate ) ) {
424
  return new Toolset_Result_Updated( true, 0 );
425
  }
426
+
427
  $results = new Toolset_Result_Set();
428
+
429
  foreach( $associations_to_migrate as $association_to_migrate ) {
430
  $result = $this->get_association_migrator(
431
  $create_default_language_if_missing, $copy_post_content_when_creating
436
  );
437
  $results->add( $result );
438
  }
439
+
440
  if( $results->is_complete_success() ) {
441
  return new Toolset_Result_Updated( true, count( $associations_to_migrate ), $results->concat_messages( self::MESSAGE_SEPARATOR ) );
442
  } else {
490
  private function get_association_postmeta_records( $offset, $limit ) {
491
 
492
  $query = $this->wpdb->prepare(
493
+ "SELECT post.ID AS child_id,
494
  postmeta.meta_key AS relationship_meta_key,
495
  postmeta.meta_value AS parent_id,
496
  post.post_type AS post_type
506
  }
507
 
508
 
509
+ /**
510
+ * @return Toolset_Post_Type_Repository
511
+ */
512
+ private function get_post_type_repository() {
513
+ if( null === $this->_post_type_repository ) {
514
+ $this->_post_type_repository = Toolset_Post_Type_Repository::get_instance();
515
+ }
516
+
517
+ return $this->_post_type_repository;
518
+ }
519
+
520
+
521
  /**
522
  * Final migration step.
523
  *
527
  update_option( Toolset_Relationship_Controller::IS_M2M_ENABLED_OPTION, 'yes', true );
528
  }
529
 
530
+
531
+ private function do_detailed_logging() {
532
+ if( null === $this->_do_detailed_logging ) {
533
+ /**
534
+ * toolset_m2m_migration_do_detailed_logging
535
+ *
536
+ * Allow for reducing the m2m migration log output by skipping successful associations.
537
+ *
538
+ * @since 3.0
539
+ */
540
+ $this->_do_detailed_logging = apply_filters( 'toolset_m2m_migration_do_detailed_logging', true );
541
+ }
542
+ return $this->_do_detailed_logging;
543
+ }
544
+
545
+
546
  }
547
 
548
 
551
  */
552
  class Toolset_Relationship_Migration extends Toolset_Relationship_Migration_Controller {
553
 
554
+ }
vendor/toolset/toolset-common/inc/m2m/potential_association/cardinality_post_query.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OTGS\Toolset\Common\M2M\PotentialAssociation;
4
+
5
+ /**
6
+ * Augments WP_Query to check whether the posts can accept another association according to the relationship
7
+ * cardinality.
8
+ *
9
+ * This is used in Toolset_Potential_Association_Query_Posts.
10
+ *
11
+ * Both before_query() and after_query() methods need to be called as close to the actual
12
+ * querying as possible, otherwise things will get broken.
13
+ *
14
+ * @package OTGS\Toolset\Common\M2M\PotentialAssociation
15
+ * @since 2.8
16
+ */
17
+ class CardinalityPostQuery extends WpQueryAdjustment {
18
+
19
+ /**
20
+ * CardinalityPostQuery constructor.
21
+ *
22
+ * @param \IToolset_Relationship_Definition $relationship
23
+ * @param \IToolset_Relationship_Role_Parent_Child $target_role
24
+ * @param \IToolset_Element $for_element
25
+ * @param JoinManager $join_manager
26
+ * @param \Toolset_Relationship_Table_Name|null $table_names_di
27
+ * @param \wpdb|null $wpdb_di
28
+ * @param \Toolset_WPML_Compatibility|null $wpml_service_di
29
+ */
30
+ public function __construct(
31
+ \IToolset_Relationship_Definition $relationship,
32
+ \IToolset_Relationship_Role_Parent_Child $target_role,
33
+ \IToolset_Element $for_element,
34
+ JoinManager $join_manager,
35
+ \Toolset_Relationship_Table_Name $table_names_di = null,
36
+ \wpdb $wpdb_di = null,
37
+ \Toolset_WPML_Compatibility $wpml_service_di = null
38
+ ) {
39
+ parent::__construct( $relationship, $target_role, $for_element, $join_manager, $wpml_service_di, $table_names_di, $wpdb_di );
40
+ }
41
+
42
+
43
+ public function is_actionable() {
44
+ return true;
45
+ }
46
+
47
+
48
+ /**
49
+ * Add a JOIN clause to the WP_Query's MySQL query string.
50
+ *
51
+ * If WPML is active, we just need to make sure that we'll have the default language version of the posts available.
52
+ *
53
+ * @param string $join
54
+ * @return string
55
+ */
56
+ public function add_join_clauses( $join ) {
57
+
58
+ if( $this->wpml_service->is_wpml_active_and_configured() ) {
59
+ $this->join_manager->register_join( JoinManager::JOIN_DEFAULT_POST_TRANSLATION );
60
+ }
61
+
62
+ return $join;
63
+ }
64
+
65
+
66
+ /**
67
+ * Add a WHERE clause to the WP_Query's MySQL query string.
68
+ *
69
+ * Excludes elements that have already reached the cardinality limit.
70
+ *
71
+ * @param string $where
72
+ * @return string
73
+ */
74
+ public function add_where_clauses( $where ) {
75
+
76
+ if( $this->needs_cardinality_limit_check() ) {
77
+ // This means we have an association where the source element (for_element) has a cardinality limit (lower
78
+ // than infinity) and we need to check how many associations each potential target element has.
79
+ //
80
+ // In case of WPML being active, we also need to handle post translations - we reuse the translation table
81
+ // which is already JOINed.
82
+ $association_table = $this->get_table_names()->association_table();
83
+ $posts_table_name = $this->get_wpdb()->posts;
84
+ $target_element_column = $this->target_role->get_name() . '_id';
85
+ $relationship_id = (int) $this->relationship->get_row_id();
86
+
87
+ if( $this->wpml_service->is_wpml_active_and_configured() ) {
88
+ $inner_where = " ( cch_associations.$target_element_column = $posts_table_name.ID
89
+ OR cch_associations.$target_element_column = default_lang_translation.element_id )
90
+ AND cch_associations.relationship_id = {$relationship_id} ";
91
+ } else {
92
+ $inner_where = " cch_associations.$target_element_column = $posts_table_name.ID AND cch_associations.relationship_id = {$relationship_id} ";
93
+ }
94
+
95
+ $where .= $this->get_wpdb()->prepare(
96
+ " AND ( %d > (
97
+ SELECT COUNT(*) FROM {$association_table} AS cch_associations
98
+ WHERE ( $inner_where )
99
+ ) )",
100
+ $this->get_for_element_max_cardinality()
101
+ );
102
+
103
+ }
104
+
105
+ return $where;
106
+ }
107
+
108
+
109
+ private function get_for_element_max_cardinality() {
110
+ return $this->relationship->get_cardinality()->get_limit( $this->target_role->other() );
111
+ }
112
+
113
+
114
+ private function needs_cardinality_limit_check() {
115
+ if( ! $this->is_actionable() ) {
116
+ return false;
117
+ }
118
+
119
+ if( \Toolset_Relationship_Cardinality::INFINITY === $this->get_for_element_max_cardinality() ) {
120
+ return false;
121
+ }
122
+
123
+ return true;
124
+ }
125
+
126
+ }
vendor/toolset/toolset-common/inc/m2m/potential_association/distinct_post_query.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  /**
4
  * Augments WP_Query to check whether posts are associated with a particular other element ID,
5
  * and dismisses those posts.
@@ -11,112 +13,14 @@
11
  *
12
  * @since m2m
13
  */
14
- class Toolset_Relationship_Distinct_Post_Query {
15
-
16
- /** @var IToolset_Relationship_Definition */
17
- private $relationship;
18
-
19
- /** @var IToolset_Element */
20
- private $for_element;
21
-
22
- /** @var IToolset_Relationship_Role_Parent_Child */
23
- private $target_role;
24
-
25
- /** @var null|Toolset_Relationship_Table_Name */
26
- private $_table_names;
27
-
28
- /** @var null|wpdb */
29
- private $_wpdb;
30
 
31
- /** @var Toolset_WPML_Compatibility */
32
- private $wpml_service;
33
-
34
-
35
- /**
36
- * Toolset_Relationship_Distinct_Post_Query constructor.
37
- *
38
- * @param IToolset_Relationship_Definition $relationship
39
- * @param IToolset_Relationship_Role_Parent_Child $target_role Target role of the relationships (future role of
40
- * the posts that are being queried)
41
- * @param IToolset_Element $for_element ID of the element to check against.
42
- * @param Toolset_Relationship_Table_Name|null $table_names_di
43
- * @param wpdb|null $wpdb_di
44
- * @param Toolset_WPML_Compatibility|null $wpml_service_di
45
- */
46
- public function __construct(
47
- IToolset_Relationship_Definition $relationship,
48
- IToolset_Relationship_Role_Parent_Child $target_role,
49
- IToolset_Element $for_element,
50
- Toolset_Relationship_Table_Name $table_names_di = null,
51
- wpdb $wpdb_di = null,
52
- Toolset_WPML_Compatibility $wpml_service_di = null
53
- ) {
54
- $this->relationship = $relationship;
55
- $this->for_element = $for_element;
56
- $this->target_role = $target_role;
57
- $this->wpml_service = $wpml_service_di ?: Toolset_WPML_Compatibility::get_instance();
58
 
59
- $this->_table_names = $table_names_di;
60
- $this->_wpdb = $wpdb_di;
61
- }
62
-
63
-
64
- private function is_actionable() {
65
  return $this->relationship->is_distinct();
66
  }
67
 
68
 
69
- /**
70
- * Hooks to filters in order to add extra clauses to the MySQL query.
71
- */
72
- public function before_query() {
73
- if( ! $this->is_actionable() ) {
74
- return;
75
- }
76
-
77
- add_filter( 'posts_join', array( $this, 'add_join_clauses' ) );
78
- add_filter( 'posts_where', array( $this, 'add_where_clauses' ) );
79
-
80
- // WPML in the back-end filters strictly by the current language by default,
81
- // but we need it to include default language posts, too, if the translation to the current language
82
- // doesn't exist. This needs to behave consistently in all contexts.
83
- add_filter( 'wpml_should_use_display_as_translated_snippet', '__return_true' );
84
- }
85
-
86
-
87
- /**
88
- * Cleanup - unhooks the filters added in before_query().
89
- */
90
- public function after_query() {
91
- if( ! $this->is_actionable() ) {
92
- return;
93
- }
94
-
95
- remove_filter( 'posts_join', array( $this, 'add_join_clauses' ) );
96
- remove_filter( 'posts_where', array( $this, 'add_where_clauses' ) );
97
-
98
- remove_filter( 'wpml_should_use_display_as_translated_snippet', '__return_true' );
99
- }
100
-
101
-
102
- private function get_table_names() {
103
- if( null === $this->_table_names ) {
104
- $this->_table_names = new Toolset_Relationship_Table_Name();
105
- }
106
-
107
- return $this->_table_names;
108
- }
109
-
110
-
111
- private function get_wpdb() {
112
- if( null === $this->_wpdb ) {
113
- global $wpdb;
114
- $this->_wpdb = $wpdb;
115
- }
116
-
117
- return $this->_wpdb;
118
- }
119
-
120
 
121
  /**
122
  * Add a JOIN clause to the WP_Query's MySQL query string.
@@ -134,41 +38,10 @@ class Toolset_Relationship_Distinct_Post_Query {
134
  * @return string
135
  */
136
  public function add_join_clauses( $join ) {
137
- $association_table = $this->get_table_names()->association_table();
138
- $posts_table_name = $this->get_wpdb()->posts;
139
- $target_element_column = $this->target_role->get_name() . '_id';
140
- $for_element_column = $this->target_role->other() . '_id';
141
-
142
- $join .= $this->get_wpdb()->prepare(
143
- " LEFT JOIN {$association_table} AS toolset_associations ON (
144
- toolset_associations.relationship_id = %d
145
- AND toolset_associations.{$target_element_column} = {$posts_table_name}.ID
146
- AND toolset_associations.{$for_element_column} = %d
147
- ) ",
148
- $this->relationship->get_row_id(),
149
- $this->for_element->get_default_language_id()
150
- );
151
 
152
  if( $this->wpml_service->is_wpml_active_and_configured() ) {
153
- $icl_translations = $this->get_wpdb()->prefix . 'icl_translations';
154
- $default_language = esc_sql( $this->wpml_service->get_default_language() );
155
- $join .= $this->get_wpdb()->prepare(
156
- " LEFT JOIN {$icl_translations} AS element_lang_info ON (
157
- {$posts_table_name}.ID = element_lang_info.element_id
158
- AND element_lang_info.element_type LIKE %s
159
- ) LEFT JOIN {$icl_translations} AS default_lang_translation ON (
160
- element_lang_info.trid = default_lang_translation.trid
161
- AND default_lang_translation.language_code = %s
162
- ) LEFT JOIN {$association_table} AS default_lang_association ON (
163
- default_lang_association.relationship_id = %d
164
- AND default_lang_translation.element_id = default_lang_association.{$target_element_column}
165
- AND default_lang_association.{$for_element_column} = %d
166
- ) ",
167
- 'post_%',
168
- $default_language,
169
- $this->relationship->get_row_id(),
170
- $this->for_element->get_default_language_id()
171
- );
172
  }
173
 
174
  return $join;
1
  <?php
2
 
3
+ use OTGS\Toolset\Common\M2M\PotentialAssociation as potentialAssociation;
4
+
5
  /**
6
  * Augments WP_Query to check whether posts are associated with a particular other element ID,
7
  * and dismisses those posts.
13
  *
14
  * @since m2m
15
  */
16
+ class Toolset_Relationship_Distinct_Post_Query extends potentialAssociation\WpQueryAdjustment {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
+ protected function is_actionable() {
 
 
 
 
 
20
  return $this->relationship->is_distinct();
21
  }
22
 
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  /**
26
  * Add a JOIN clause to the WP_Query's MySQL query string.
38
  * @return string
39
  */
40
  public function add_join_clauses( $join ) {
41
+ $this->join_manager->register_join( potentialAssociation\JoinManager::JOIN_ASSOCIATIONS_TABLE );
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
  if( $this->wpml_service->is_wpml_active_and_configured() ) {
44
+ $this->join_manager->register_join( potentialAssociation\JoinManager::JOIN_DEFAULT_LANG_ASSOCIATIONS );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  }
46
 
47
  return $join;
vendor/toolset/toolset-common/inc/m2m/potential_association/filters/interface.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Interface for all potential association query filters.
5
+ *
6
+ * @since m2m
7
+ */
8
+ interface Toolset_Potential_Association_Query_Filter_Interface {
9
+
10
+ /**
11
+ * Main method to modiy the query arguments.
12
+ *
13
+ * @since m2m
14
+ */
15
+ public function filter( array $query_arguments);
16
+
17
+ }
vendor/toolset/toolset-common/inc/m2m/potential_association/filters/post/author.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Filter the potential posts association query by the author of the option.
5
+ *
6
+ * Each Toolset individual plugin can extend this filter to add its own API filters, using the filter_by_plugin method.
7
+ *
8
+ * @since m2m
9
+ */
10
+ class Toolset_Potential_Association_Query_Filter_Posts_Author
11
+ implements Toolset_Potential_Association_Query_Filter_Interface {
12
+
13
+ /**
14
+ * Maybe filter the list of available posts to connect to a given post by their post author.
15
+ *
16
+ * Free method for individual Toolset plugins to subclass and implement.
17
+ *
18
+ * @param mixed $force_author The original value is a boolean but it might be filtered to become an integer or a string.
19
+ *
20
+ * @return mixed
21
+ *
22
+ * @since m2m
23
+ */
24
+ protected function filter_by_plugin( $force_author ) {
25
+ return $force_author;
26
+ }
27
+
28
+ /**
29
+ * Maybe filter the list of available posts to connect to a given post by their post author.
30
+ *
31
+ * Decides whether a filter by post author needs to be set by cascading a series of filters:
32
+ * - toolset_force_author_in_related_post
33
+ *
34
+ * Those filters should return either a post author ID or the keyword '$current', which is a placeholder
35
+ * for the currently logged in user; in case no user is logged in, we force empty query results.
36
+ *
37
+ * Note that individual Toolset plugins can include their own filters by subclassing this one
38
+ * and including just a filter_by_plugin method containing their API filters chain.
39
+ *
40
+ * @param array $query_arguments The potential association query arguments.
41
+ *
42
+ * @return array
43
+ *
44
+ * @since m2m
45
+ */
46
+ public function filter( array $query_arguments ) {
47
+ $force_author = false;
48
+
49
+ $force_author = $this->filter_by_plugin( $force_author );
50
+
51
+ /**
52
+ * Force a post author on all Toolset interfaces to set a related post.
53
+ *
54
+ * @since m2m
55
+ */
56
+ $force_author = apply_filters(
57
+ 'toolset_force_author_in_related_post',
58
+ $force_author
59
+ );
60
+
61
+ if ( false === $force_author ) {
62
+ return $query_arguments;
63
+ }
64
+
65
+ if ( '$current' === $force_author ) {
66
+ $force_author = get_current_user_id();
67
+ }
68
+ $force_author = (int) $force_author;
69
+
70
+ if ( ! array_key_exists( 'wp_query_override', $query_arguments ) ) {
71
+ $query_arguments['wp_query_override'] = array();
72
+ }
73
+
74
+ // Setting an author ID with zero value means offer no options
75
+ // (also happens when setting $current and not logged in user exists).
76
+ if ( 0 === $force_author ) {
77
+ $query_arguments['wp_query_override']['post__in'] = array( '0' );
78
+ } else {
79
+ $query_arguments['wp_query_override']['author'] = $force_author;
80
+ }
81
+
82
+ return $query_arguments;
83
+ }
84
+
85
+ }
vendor/toolset/toolset-common/inc/m2m/potential_association/filters/search_string.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Filter the potential association query by a given string.
5
+ *
6
+ * @since m2m
7
+ */
8
+ class Toolset_Potential_Association_Query_Filter_Search_String
9
+ implements Toolset_Potential_Association_Query_Filter_Interface {
10
+
11
+ /**
12
+ * Maybe filter the list of options by a given string.
13
+ *
14
+ * @param array $query_arguments The potential association query arguments.
15
+ *
16
+ * @return array
17
+ *
18
+ * @since m2m
19
+ */
20
+ public function filter( array $query_arguments ) {
21
+ if ( $search_string = toolset_getpost( 'q' ) ) {
22
+ $query_arguments['search_string'] = $search_string;
23
+ }
24
+
25
+ return $query_arguments;
26
+ }
27
+
28
+ }
vendor/toolset/toolset-common/inc/m2m/potential_association/join_manager.php ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OTGS\Toolset\Common\M2M\PotentialAssociation;
4
+
5
+
6
+ /**
7
+ * Handle the MySQL JOIN clause construction when augmenting the WP_Query in Toolset_Potential_Association_Query_Posts.
8
+ *
9
+ * Make sure that JOINs come in the right order and are not duplicated.
10
+ *
11
+ * Note that hook() and unhook() must be called around the WP_Query usage for proper function.
12
+ *
13
+ * @package OTGS\Toolset\Common\M2M\PotentialAssociation
14
+ * @since 2.8
15
+ */
16
+ class JoinManager extends \Toolset_Wpdb_User {
17
+
18
+
19
+ /** @var \IToolset_Relationship_Definition */
20
+ protected $relationship;
21
+
22
+
23
+ /** @var \IToolset_Element */
24
+ protected $for_element;
25
+
26
+
27
+ /** @var \IToolset_Relationship_Role_Parent_Child */
28
+ protected $target_role;
29
+
30
+
31
+ /** @var \Toolset_WPML_Compatibility */
32
+ protected $wpml_service;
33
+
34
+
35
+ /** @var null|\Toolset_Relationship_Table_Name */
36
+ private $_table_names;
37
+
38
+
39
+ /** @var string[] Keywords determining what needs to be joined */
40
+ private $tables_to_join = array();
41
+
42
+
43
+ // Keywords for specific JOINs
44
+ const JOIN_DEFAULT_POST_TRANSLATION = 'default_post_translation';
45
+ const JOIN_ASSOCIATIONS_TABLE = 'associations_table';
46
+ const JOIN_DEFAULT_LANG_ASSOCIATIONS = 'default_lang_associations';
47
+
48
+
49
+ /**
50
+ * JoinManager constructor.
51
+ *
52
+ * @param \IToolset_Relationship_Definition $relationship
53
+ * @param \IToolset_Relationship_Role_Parent_Child $target_role
54
+ * @param \IToolset_Element $for_element
55
+ * @param \Toolset_Relationship_Table_Name|null $table_names_di
56
+ * @param \wpdb|null $wpdb_di
57
+ * @param \Toolset_WPML_Compatibility|null $wpml_service_di
58
+ */
59
+ public function __construct(
60
+ \IToolset_Relationship_Definition $relationship,
61
+ \IToolset_Relationship_Role_Parent_Child $target_role,
62
+ \IToolset_Element $for_element,
63
+ \Toolset_Relationship_Table_Name $table_names_di = null,
64
+ \wpdb $wpdb_di = null,
65
+ \Toolset_WPML_Compatibility $wpml_service_di = null
66
+ ) {
67
+ parent::__construct( $wpdb_di );
68
+ $this->_table_names = $table_names_di;
69
+ $this->relationship = $relationship;
70
+ $this->for_element = $for_element;
71
+ $this->target_role = $target_role;
72
+ $this->wpml_service = $wpml_service_di ?: \Toolset_WPML_Compatibility::get_instance();
73
+ }
74
+
75
+
76
+ public function hook() {
77
+ // The priority is later so that we can add all the JOINs necessary at once.
78
+ add_filter( 'posts_join', array( $this, 'add_join_clauses' ), 20 );
79
+ }
80
+
81
+
82
+ public function unhook() {
83
+ remove_filter( 'posts_join', array( $this, 'add_join_clauses' ), 20 );
84
+ }
85
+
86
+
87
+ /**
88
+ * Indicate that a certain table (or tables) need to be joined.
89
+ *
90
+ * @param string $table_keyword One of the JOIN_ constants
91
+ */
92
+ public function register_join( $table_keyword ) {
93
+ if( in_array( $table_keyword, $this->tables_to_join ) ) {
94
+ return;
95
+ }
96
+
97
+ $this->tables_to_join[] = $table_keyword;
98
+ }
99
+
100
+
101
+ /**
102
+ * Append a JOIN clause if it was not appended previously.
103
+ *
104
+ * @param string $join
105
+ * @param string $table_keyword
106
+ * @param string[] $already_joined Keywords of previously joined tables.
107
+ *
108
+ * @return string
109
+ */
110
+ private function maybe_add_join( $join, $table_keyword, &$already_joined ) {
111
+ if( in_array( $table_keyword, $already_joined ) ) {
112
+ return $join;
113
+ }
114
+
115
+ switch( $table_keyword ) {
116
+ case self::JOIN_DEFAULT_POST_TRANSLATION:
117
+ $join = $this->join_default_post_translation( $join );
118
+ break;
119
+ case self::JOIN_ASSOCIATIONS_TABLE:
120
+ $join = $this->join_associations_table( $join );
121
+ break;
122
+ case self::JOIN_DEFAULT_LANG_ASSOCIATIONS:
123
+ $join = $this->join_association_table_on_default_language( $join, $already_joined );
124
+ break;
125
+ }
126
+
127
+ $already_joined[] = $table_keyword;
128
+
129
+ return $join;
130
+ }
131
+
132
+
133
+ /**
134
+ * Add JOINs for determining the default language version of the post.
135
+ *
136
+ * Note that the correct ID may be either default_lang_translation.element_id or wp_posts.ID, depending
137
+ * on whether the post is translatable & has a translation or not.
138
+ *
139
+ * @param string $join
140
+ * @return string Augmented JOIN clause.
141
+ */
142
+ private function join_default_post_translation( $join ) {
143
+ $icl_translations = $this->wpdb->prefix . 'icl_translations';
144
+ $default_language = esc_sql( $this->wpml_service->get_default_language() );
145
+ $posts_table_name = $this->wpdb->posts;
146
+
147
+ $join .= $this->wpdb->prepare(
148
+ " LEFT JOIN {$icl_translations} AS element_lang_info ON (
149
+ {$posts_table_name}.ID = element_lang_info.element_id
150
+ AND element_lang_info.element_type LIKE %s
151
+ ) LEFT JOIN {$icl_translations} AS default_lang_translation ON (
152
+ element_lang_info.trid = default_lang_translation.trid
153
+ AND default_lang_translation.language_code = %s
154
+ ) ",
155
+ 'post_%',
156
+ $default_language
157
+ );
158
+
159
+ return $join;
160
+ }
161
+
162
+
163
+ /**
164
+ * Join an association table for a particular association (between the post in the row and a given source element).
165
+ *
166
+ * @param string $join
167
+ * @return string Augmented JOIN clause.
168
+ */
169
+ private function join_associations_table( $join ) {
170
+ $association_table = $this->get_table_names()->association_table();
171
+ $posts_table_name = $this->wpdb->posts;
172
+ $target_element_column = $this->target_role->get_name() . '_id';
173
+ $for_element_column = $this->target_role->other() . '_id';
174
+
175
+ $join .= $this->wpdb->prepare(
176
+ " LEFT JOIN {$association_table} AS toolset_associations ON (
177
+ toolset_associations.relationship_id = %d
178
+ AND toolset_associations.{$target_element_column} = {$posts_table_name}.ID
179
+ AND toolset_associations.{$for_element_column} = %d
180
+ ) ",
181
+ $this->relationship->get_row_id(),
182
+ $this->for_element->get_default_language_id()
183
+ );
184
+
185
+ return $join;
186
+ }
187
+
188
+
189
+ /**
190
+ * Same as in join_associations_table(), but this time for the default language version of the target post.
191
+ *
192
+ * @param string $join
193
+ * @param string[] $already_joined
194
+ *
195
+ * @return string
196
+ */
197
+ private function join_association_table_on_default_language( $join, &$already_joined ) {
198
+ $association_table = $this->get_table_names()->association_table();
199
+ $target_element_column = $this->target_role->get_name() . '_id';
200
+ $for_element_column = $this->target_role->other() . '_id';
201
+
202
+ $join = $this->maybe_add_join( $join, self::JOIN_DEFAULT_POST_TRANSLATION, $already_joined );
203
+ $join .= $this->wpdb->prepare(
204
+ " LEFT JOIN {$association_table} AS default_lang_association ON (
205
+ default_lang_association.relationship_id = %d
206
+ AND default_lang_translation.element_id = default_lang_association.{$target_element_column}
207
+ AND default_lang_association.{$for_element_column} = %d
208
+ ) ",
209
+ 'post_%',
210
+ $this->relationship->get_row_id()
211
+ );
212
+
213
+ return $join;
214
+ }
215
+
216
+
217
+ protected function get_table_names() {
218
+ if( null === $this->_table_names ) {
219
+ $this->_table_names = new \Toolset_Relationship_Table_Name();
220
+ }
221
+
222
+ return $this->_table_names;
223
+ }
224
+
225
+
226
+ /**
227
+ * Add all registered JOINs to the JOIN clause.
228
+ *
229
+ * Note that this has to be idempotent since the filter may be applied several times within a single WP_Query instance.
230
+ *
231
+ * @param string $join
232
+ * @return string
233
+ */
234
+ public function add_join_clauses( $join ) {
235
+ $already_joined = array();
236
+ foreach( $this->tables_to_join as $table_keyword ) {
237
+ $join = $this->maybe_add_join( $join, $table_keyword, $already_joined );
238
+ }
239
+ return $join;
240
+ }
241
+
242
+ }
vendor/toolset/toolset-common/inc/m2m/potential_association/query_arguments.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Toolset potential associations query arguments controller.
5
+ *
6
+ * @since m2m
7
+ */
8
+ class Toolset_Potential_Association_Query_Arguments {
9
+
10
+ /**
11
+ * @var Toolset_Potential_Association_Query_Filter_Interface[]
12
+ */
13
+ private $filters = array();
14
+
15
+ /**
16
+ * @var array
17
+ */
18
+ private $query_arguments = array();
19
+
20
+ /**
21
+ * Register a filter to modify the query arguments.
22
+ *
23
+ * @since m2m
24
+ */
25
+ public function addFilter( Toolset_Potential_Association_Query_Filter_Interface $filter ) {
26
+ $this->filters[] = $filter;
27
+ }
28
+
29
+ /**
30
+ * Apply the filters to the query arguments.
31
+ *
32
+ * @since m2m
33
+ */
34
+ public function get() {
35
+ $this->query_arguments = array();
36
+
37
+ foreach( $this->filters as $filter ) {
38
+ $this->query_arguments = $filter->filter( $this->query_arguments );
39
+ }
40
+
41
+ return $this->query_arguments;
42
+ }
43
+
44
+ }
45
+
vendor/toolset/toolset-common/inc/m2m/potential_association/query_interface.php CHANGED
@@ -8,7 +8,7 @@
8
  *
9
  * @since m2m
10
  */
11
- interface IToolset_Potential_Association_Query extends IToolset_Query {
12
 
13
  /**
14
  * IToolset_Potential_Association_Query constructor.
@@ -29,9 +29,13 @@ interface IToolset_Potential_Association_Query extends IToolset_Query {
29
 
30
 
31
  /**
 
 
 
 
32
  * @return IToolset_Element[]
33
  */
34
- public function get_results();
35
 
36
 
37
  /**
8
  *
9
  * @since m2m
10
  */
11
+ interface IToolset_Potential_Association_Query {
12
 
13
  /**
14
  * IToolset_Potential_Association_Query constructor.
29
 
30
 
31
  /**
32
+ * @param bool $check_can_connect_another_element Check wheter it is possible to connect any other element at all,
33
+ * and return an empty result if not.
34
+ * @param bool $check_distinct_relationships Exclude elements that would break the "distinct" property of a relationship.
35
+ * You can set this to false if you're overwriting an existing association.
36
  * @return IToolset_Element[]
37
  */
38
+ public function get_results( $check_can_connect_another_element = true, $check_distinct_relationships = true );
39
 
40
 
41
  /**
vendor/toolset/toolset-common/inc/m2m/potential_association/query_posts.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
 
 
 
 
3
  /**
4
  * When you have a relationship and a specific element in one role, this
5
  * query class will help you to find elements that can be associated with it.
@@ -42,13 +45,15 @@ class Toolset_Potential_Association_Query_Posts implements IToolset_Potential_As
42
  *
43
  * @param IToolset_Relationship_Definition $relationship Relationship to query for.
44
  * @param IToolset_Relationship_Role_Parent_Child $target_role Element role. Only parent or child are accepted.
45
- * @param IToolset_Element $for_element Element that may be corrected with the result of the query.
46
  * @param array $args Additional query arguments:
47
  * - search_string: string
48
  * - count_results: bool
49
  * - items_per_page: int
50
  * - page: int
51
  * - wp_query_override: array
 
 
52
  * @param Toolset_Relationship_Query_Factory|null $query_factory_di
53
  * @param Toolset_Element_Factory|null $element_factory_di
54
  */
@@ -75,14 +80,26 @@ class Toolset_Potential_Association_Query_Posts implements IToolset_Potential_As
75
 
76
 
77
  /**
 
 
 
 
 
78
  * @return IToolset_Post[]
79
  * @throws Toolset_Element_Exception_Element_Doesnt_Exist
80
  */
81
- public function get_results() {
 
 
 
 
 
 
 
82
 
83
  $query_args = array(
84
 
85
- // Performance ptimizations
86
  //
87
  //
88
  'ignore_sticky_posts' => true,
@@ -110,22 +127,62 @@ class Toolset_Potential_Association_Query_Posts implements IToolset_Potential_As
110
  $query_args['s'] = $search_string;
111
  }
112
 
 
 
 
 
 
 
 
113
  $query_args = array_merge( $query_args, $this->get_additional_wp_query_args() );
114
 
 
 
 
 
 
 
115
  // For distinct relationships, we need to make sure that the returned posts
116
  // aren't already associated with $for_element.
117
- $augment_query_for_distinct_relationships = $this->query_factory->distinct_relationship_posts(
118
- $this->relationship,
119
- $this->target_role,
120
- $this->for_element
121
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
 
123
- $augment_query_for_distinct_relationships->before_query();
 
124
 
125
  $query = $this->query_factory->wp_query( $query_args );
126
  $results = $query->get_posts();
127
 
128
- $augment_query_for_distinct_relationships->after_query();
 
 
 
 
 
 
 
 
 
 
129
 
130
  $this->found_results = (int) $query->found_posts;
131
 
@@ -167,6 +224,21 @@ class Toolset_Potential_Association_Query_Posts implements IToolset_Potential_As
167
  }
168
 
169
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  /**
171
  * @param WP_Post[] $wp_posts
172
  *
@@ -330,16 +402,16 @@ class Toolset_Potential_Association_Query_Posts implements IToolset_Potential_As
330
  IToolset_Relationship_Role_Parent_Child $role, IToolset_Element $element
331
  ) {
332
  $query = $this->query_factory->associations_v2();
333
- $query
334
  ->add( $query->relationship_slug( $this->relationship->get_slug() ) )
335
  ->add( $query->element( $element, $role ) )
 
 
 
 
 
336
  ->do_not_add_default_conditions() // include all existing associations
337
- ->need_found_rows()
338
- ->limit( 1 ) // because we're not interested in the actual resuls
339
- ->return_association_uids() // ditto
340
- ->get_results();
341
-
342
- $row_count = $query->get_found_rows();
343
 
344
  return $row_count;
345
  }
1
  <?php
2
 
3
+ use OTGS\Toolset\Common\M2M\PotentialAssociation as potentialAssociation;
4
+
5
+
6
  /**
7
  * When you have a relationship and a specific element in one role, this
8
  * query class will help you to find elements that can be associated with it.
45
  *
46
  * @param IToolset_Relationship_Definition $relationship Relationship to query for.
47
  * @param IToolset_Relationship_Role_Parent_Child $target_role Element role. Only parent or child are accepted.
48
+ * @param IToolset_Element $for_element Element that may be connected with the result of the query.
49
  * @param array $args Additional query arguments:
50
  * - search_string: string
51
  * - count_results: bool
52
  * - items_per_page: int
53
  * - page: int
54
  * - wp_query_override: array
55
+ * - exclude_elements: IToolset_Element[] Elements to exclude from the results and when checking
56
+ * whether the target element ($for_element) can accept another association.
57
  * @param Toolset_Relationship_Query_Factory|null $query_factory_di
58
  * @param Toolset_Element_Factory|null $element_factory_di
59
  */
80
 
81
 
82
  /**
83
+ * @param bool $check_can_connect_another_element Check wheter it is possible to connect any other element at all,
84
+ * and return an empty result if not.
85
+ * @param bool $check_distinct_relationships Exclude elements that would break the "distinct" property of a relationship.
86
+ * You can set this to false if you're overwriting an existing association.
87
+ *
88
  * @return IToolset_Post[]
89
  * @throws Toolset_Element_Exception_Element_Doesnt_Exist
90
  */
91
+ public function get_results( $check_can_connect_another_element = true, $check_distinct_relationships = true ) {
92
+
93
+ // If the element we want to connect the results to is not accepting any
94
+ // associations (as it may have reached its cardinality limit), there's no point
95
+ // in searching any further.
96
+ if( $check_can_connect_another_element && ! $this->can_connect_another_element()->is_success() ) {
97
+ return array();
98
+ }
99
 
100
  $query_args = array(
101
 
102
+ // Performance optimizations
103
  //
104
  //
105
  'ignore_sticky_posts' => true,
127
  $query_args['s'] = $search_string;
128
  }
129
 
130
+ $elements_to_exclude = $this->get_exclude_elements();
131
+ if( ! empty( $elements_to_exclude ) ) {
132
+ $query_args['post__not_in'] = array_map( function( IToolset_Post $post ) {
133
+ return $post->get_id();
134
+ }, $elements_to_exclude );
135
+ }
136
+
137
  $query_args = array_merge( $query_args, $this->get_additional_wp_query_args() );
138
 
139
+ // This is to prevent JOIN clause duplication between the classes that adjust the WP_Query clauses.
140
+ $join_manager = new potentialAssociation\JoinManager(
141
+ $this->relationship, $this->target_role, $this->for_element
142
+ );
143
+ $join_manager->hook();
144
+
145
  // For distinct relationships, we need to make sure that the returned posts
146
  // aren't already associated with $for_element.
147
+ if( $check_distinct_relationships ) {
148
+ $augment_query_for_distinct_relationships = $this->query_factory->distinct_relationship_posts(
149
+ $this->relationship,
150
+ $this->target_role,
151
+ $this->for_element,
152
+ $join_manager
153
+ );
154
+
155
+ $augment_query_for_distinct_relationships->before_query();
156
+ }
157
+
158
+ // Unless we're told not to check for cardinality limits of the target posts, we need to make yet another
159
+ // adjustment. It cannot be implemented directly in Toolset_Relationship_Distinct_Post_Query because
160
+ // we can (theoretically) have non-distinct relationships where this still needs to be checked.
161
+ if( $check_can_connect_another_element ) {
162
+ $augment_query_for_cardinality_limits = $this->query_factory->cardinality_query_posts(
163
+ $this->relationship,
164
+ $this->target_role,
165
+ $this->for_element,
166
+ $join_manager
167
+ );
168
 
169
+ $augment_query_for_cardinality_limits->before_query();
170
+ }
171
 
172
  $query = $this->query_factory->wp_query( $query_args );
173
  $results = $query->get_posts();
174
 
175
+ if( $check_distinct_relationships ) {
176
+ /** @noinspection PhpUndefinedVariableInspection */
177
+ $augment_query_for_distinct_relationships->after_query();
178
+ }
179
+
180
+ if( $check_can_connect_another_element ) {
181
+ /** @noinspection PhpUndefinedVariableInspection */
182
+ $augment_query_for_cardinality_limits->after_query();
183
+ }
184
+
185
+ $join_manager->unhook();
186
 
187
  $this->found_results = (int) $query->found_posts;
188
 
224
  }
225
 
226
 
227
+ private function get_exclude_elements() {
228
+ $elements = array_map( function( $element ) {
229
+ if( ! $element instanceof IToolset_Post ) {
230
+ throw new InvalidArgumentException(
231
+ 'Invalid element provided in the exclude_elements query argument. Only posts are accepted.'
232
+ );
233
+ }
234
+
235
+ return $element;
236
+ }, toolset_ensarr( toolset_getarr( $this->args, 'exclude_elements' ) ) );
237
+
238
+ return $elements;
239
+ }
240
+
241
+
242
  /**
243
  * @param WP_Post[] $wp_posts
244
  *
402
  IToolset_Relationship_Role_Parent_Child $role, IToolset_Element $element
403
  ) {
404
  $query = $this->query_factory->associations_v2();
405
+ $row_count = $query
406
  ->add( $query->relationship_slug( $this->relationship->get_slug() ) )
407
  ->add( $query->element( $element, $role ) )
408
+ ->add( $query->do_and(
409
+ array_map( function( IToolset_Post $post ) use( $query, $role ) {
410
+ return $query->not( $query->element( $post, $role->other() ) );
411
+ }, $this->get_exclude_elements() )
412
+ ) )
413
  ->do_not_add_default_conditions() // include all existing associations
414
+ ->get_found_rows_directly();
 
 
 
 
 
415
 
416
  return $row_count;
417
  }
vendor/toolset/toolset-common/inc/m2m/potential_association/wp_query_adjustment.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OTGS\Toolset\Common\M2M\PotentialAssociation;
4
+
5
+ /**
6
+ * Shared functionality for adjusting the WP_Query behaviour.
7
+ *
8
+ * @package OTGS\Toolset\Common\M2M\PotentialAssociation
9
+ */
10
+ abstract class WpQueryAdjustment extends \Toolset_Wpdb_User {
11
+
12
+
13
+ /** @var \IToolset_Relationship_Definition */
14
+ protected $relationship;
15
+
16
+
17
+ /** @var \IToolset_Element */
18
+ protected $for_element;
19
+
20
+
21
+ /** @var \IToolset_Relationship_Role_Parent_Child */
22
+ protected $target_role;
23
+
24
+
25
+ /** @var \Toolset_WPML_Compatibility */
26
+ protected $wpml_service;
27
+
28
+
29
+ /** @var JoinManager */
30
+ protected $join_manager;
31
+
32
+ /** @var null|\Toolset_Relationship_Table_Name */
33
+ private $_table_names;
34
+
35
+
36
+ /**
37
+ * Determine whether the WP_Query should be augmented.
38
+ *
39
+ * @return bool
40
+ */
41
+ protected abstract function is_actionable();
42
+
43
+
44
+ /**
45
+ * WpQueryAdjustment constructor.
46
+ *
47
+ * @param \IToolset_Relationship_Definition $relationship
48
+ * @param \IToolset_Relationship_Role_Parent_Child $target_role
49
+ * @param \IToolset_Element $for_element
50
+ * @param JoinManager $join_manager
51
+ * @param \Toolset_WPML_Compatibility|null $wpml_service_di
52
+ * @param \Toolset_Relationship_Table_Name|null $table_names_di
53
+ * @param \wpdb|null $wpdb_di
54
+ */
55
+ public function __construct(
56
+ \IToolset_Relationship_Definition $relationship,
57
+ \IToolset_Relationship_Role_Parent_Child $target_role,
58
+ \IToolset_Element $for_element,
59
+ JoinManager $join_manager,
60
+ \Toolset_WPML_Compatibility $wpml_service_di = null,
61
+ \Toolset_Relationship_Table_Name $table_names_di = null,
62
+ \wpdb $wpdb_di = null )
63
+ {
64
+ parent::__construct( $wpdb_di );
65
+ $this->_table_names = $table_names_di;
66
+ $this->relationship = $relationship;
67
+ $this->for_element = $for_element;
68
+ $this->target_role = $target_role;
69
+ $this->wpml_service = $wpml_service_di ?: \Toolset_WPML_Compatibility::get_instance();
70
+ $this->join_manager = $join_manager;
71
+ }
72
+
73
+
74
+ /**
75
+ * Hooks to filters in order to add extra clauses to the MySQL query.
76
+ */
77
+ public function before_query() {
78
+ if( ! $this->is_actionable() ) {
79
+ return;
80
+ }
81
+
82
+ add_filter( 'posts_join', array( $this, 'add_join_clauses' ) );
83
+ add_filter( 'posts_where', array( $this, 'add_where_clauses' ) );
84
+
85
+ // WPML in the back-end filters strictly by the current language by default,
86
+ // but we need it to include default language posts, too, if the translation to the current language
87
+ // doesn't exist. This needs to behave consistently in all contexts.
88
+ add_filter( 'wpml_should_use_display_as_translated_snippet', '__return_true' );
89
+ }
90
+
91
+
92
+ /**
93
+ * Cleanup - unhooks the filters added in before_query().
94
+ */
95
+ public function after_query() {
96
+ if( ! $this->is_actionable() ) {
97
+ return;
98
+ }
99
+
100
+ remove_filter( 'posts_join', array( $this, 'add_join_clauses' ) );
101
+ remove_filter( 'posts_where', array( $this, 'add_where_clauses' ) );
102
+
103
+ remove_filter( 'wpml_should_use_display_as_translated_snippet', '__return_true' );
104
+ }
105
+
106
+
107
+ protected function get_table_names() {
108
+ if( null === $this->_table_names ) {
109
+ $this->_table_names = new \Toolset_Relationship_Table_Name();
110
+ }
111
+
112
+ return $this->_table_names;
113
+ }
114
+
115
+
116
+ protected function get_wpdb() {
117
+ return $this->wpdb;
118
+ }
119
+
120
+ }
vendor/toolset/toolset-common/inc/m2m/public_api_service.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OTGS\Toolset\Common\M2M;
4
+
5
+ /**
6
+ * Helper class for the Public Relationship API.
7
+ *
8
+ * @package OTGS\Toolset\Common\M2M
9
+ * @since 2.6.4
10
+ */
11
+ class PublicApiService {
12
+
13
+ /**
14
+ * @param string|string[] $relationship Relationship slug or a pair of post type slugs identifying a legacy relationship.
15
+ *
16
+ * @return \IToolset_Relationship_Definition|null
17
+ */
18
+ public function get_relationship_definition( $relationship ) {
19
+ $definition_repository = \Toolset_Relationship_Definition_Repository::get_instance();
20
+
21
+ if( is_array( $relationship ) && count( $relationship ) === 2 ) {
22
+ $relationship_definition = $definition_repository->get_legacy_definition( $relationship[0], $relationship[1] );
23
+ } elseif ( is_string( $relationship ) ) {
24
+ $relationship_definition = $definition_repository->get_definition( $relationship );
25
+ } else {
26
+ throw new \InvalidArgumentException( 'The relationship must be a string with the relationship slug or an array with two post types.' );
27
+ }
28
+
29
+ return $relationship_definition;
30
+ }
31
+
32
+
33
+ /**
34
+ * Transform a relationship definition to an associative array that the API will offer to third-party
35
+ * software.
36
+ *
37
+ * @param \IToolset_Relationship_Definition $relationship_definition
38
+ *
39
+ * @return array|null Relationship information or null if the relationship definition doesn't exist.
40
+ */
41
+ public function format_relationship_definition( \IToolset_Relationship_Definition $relationship_definition ) {
42
+ if( null === $relationship_definition ) {
43
+ return null;
44
+ }
45
+
46
+ $origin = $relationship_definition->get_origin()->get_origin_keyword();
47
+ if( 'wizard' === $origin ) {
48
+ $origin = 'standard';
49
+ }
50
+
51
+ $result = array(
52
+ 'slug' => $relationship_definition->get_slug(),
53
+ 'labels' => array(
54
+ 'plural' => $relationship_definition->get_display_name_plural(),
55
+ 'singular' => $relationship_definition->get_display_name_singular()
56
+ ),
57
+ 'roles' => array(
58
+ 'parent' => array(
59
+ 'domain' => $relationship_definition->get_parent_domain(),
60
+ 'types' => $relationship_definition->get_parent_type()->get_types()
61
+ ),
62
+ 'child' => array(
63
+ 'domain' => $relationship_definition->get_child_domain(),
64
+ 'types' => $relationship_definition->get_child_type()->get_types()
65
+ )
66
+ ),
67
+ 'cardinality' => array(
68
+ 'limits' => $relationship_definition->get_cardinality()->to_array(),
69
+ 'type' => $relationship_definition->get_cardinality()->get_type()
70
+ ),
71
+ 'origin' => $origin
72
+ );
73
+
74
+ if( null !== $relationship_definition->get_intermediary_post_type() ) {
75
+ $result['roles']['intermediary'] = array(
76
+ 'domain' => \Toolset_Element_Domain::POSTS,
77
+ 'types' => $relationship_definition->get_intermediary_post_type()
78
+ );
79
+ }
80
+
81
+ return $result;
82
+ }
83
+
84
+ }
vendor/toolset/toolset-common/inc/m2m/query/condition/not.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Negation of a provided condition.
5
+ *
6
+ * @since 2.6.7
7
+ */
8
+ class Toolset_Query_Condition_Not
9
+ implements IToolset_Relationship_Query_Condition, IToolset_Association_Query_Condition
10
+ {
11
+
12
+ /** @var IToolset_Query_Condition */
13
+ private $condition;
14
+
15
+
16
+ /**
17
+ * Toolset_Query_Condition_Not constructor.
18
+ *
19
+ * @param IToolset_Query_Condition $condition
20
+ */
21
+ public function __construct( IToolset_Query_Condition $condition ) {
22
+ $this->condition = $condition;
23
+ }
24
+
25
+ /**
26
+ * Get a part of the WHERE clause that applies the condition.
27
+ *
28
+ * @return string Valid part of a MySQL query, so that it can be
29
+ * used in WHERE ( $condition1 ) AND ( $condition2 ) AND ( $condition3 ) ...
30
+ */
31
+ public function get_where_clause()
32
+ {
33
+ return ' NOT ( ' . $this->condition->get_where_clause() . ' ) ';
34
+ }
35
+
36
+ /**
37
+ * Get a part of the JOIN clause that is required by the condition.
38
+ *
39
+ * @return string Valid part of a MySQL query, so that it can be
40
+ * used as: $table_as_unique_alias_on_condition_1 $table_as_unique_alias_on_condition_2 ...
41
+ * (meaning that every clause should start with its own "JOIN"
42
+ */
43
+ public function get_join_clause()
44
+ {
45
+ return $this->condition->get_join_clause();
46
+ }
47
+
48
+ }
vendor/toolset/toolset-common/inc/m2m/query/factory.php CHANGED
@@ -1,5 +1,6 @@
1
  <?php
2
 
 
3
  /**
4
  * Factory for instantiating query classes.
5
  *
@@ -35,28 +36,67 @@ class Toolset_Relationship_Query_Factory {
35
  * @param IToolset_Relationship_Role_Parent_Child $target_role Target role of the relationships (future role of
36
  * the posts that are being queried)
37
  * @param IToolset_Element $for_element ID of the element to check against.
 
38
  * @param Toolset_Relationship_Table_Name|null $table_names_di
39
  * @param wpdb|null $wpdb_di
40
  *
 
 
41
  * @return Toolset_Relationship_Distinct_Post_Query
42
  */
43
  public function distinct_relationship_posts(
44
  IToolset_Relationship_Definition $relationship,
45
  IToolset_Relationship_Role_Parent_Child $target_role,
46
  IToolset_Element $for_element,
 
47
  Toolset_Relationship_Table_Name $table_names_di = null,
48
- wpdb $wpdb_di = null
 
49
  ) {
50
  return new Toolset_Relationship_Distinct_Post_Query(
51
  $relationship,
52
  $target_role,
53
  $for_element,
 
 
54
  $table_names_di,
55
  $wpdb_di
56
  );
57
  }
58
 
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  /**
61
  * @param array $args Query arguments.
62
  *
1
  <?php
2
 
3
+ use OTGS\Toolset\Common\M2M\PotentialAssociation as potentialAssociation;
4
  /**
5
  * Factory for instantiating query classes.
6
  *
36
  * @param IToolset_Relationship_Role_Parent_Child $target_role Target role of the relationships (future role of
37
  * the posts that are being queried)
38
  * @param IToolset_Element $for_element ID of the element to check against.
39
+ * @param potentialAssociation\JoinManager $join_manager
40
  * @param Toolset_Relationship_Table_Name|null $table_names_di
41
  * @param wpdb|null $wpdb_di
42
  *
43
+ * @param Toolset_WPML_Compatibility|null $wpml_service_di
44
+ *
45
  * @return Toolset_Relationship_Distinct_Post_Query
46
  */
47
  public function distinct_relationship_posts(
48
  IToolset_Relationship_Definition $relationship,
49
  IToolset_Relationship_Role_Parent_Child $target_role,
50
  IToolset_Element $for_element,
51
+ potentialAssociation\JoinManager $join_manager,
52
  Toolset_Relationship_Table_Name $table_names_di = null,
53
+ wpdb $wpdb_di = null,
54
+ Toolset_WPML_Compatibility $wpml_service_di = null
55
  ) {
56
  return new Toolset_Relationship_Distinct_Post_Query(
57
  $relationship,
58
  $target_role,
59
  $for_element,
60
+ $join_manager,
61
+ $wpml_service_di,
62
  $table_names_di,
63
  $wpdb_di
64
  );
65
  }
66
 
67
 
68
+ /**
69
+ * @param IToolset_Relationship_Definition $relationship
70
+ * @param IToolset_Relationship_Role_Parent_Child $target_role
71
+ * @param IToolset_Element $for_element
72
+ * @param potentialAssociation\JoinManager $join_manager
73
+ * @param Toolset_Relationship_Table_Name|null $table_names_di
74
+ * @param wpdb|null $wpdb_di
75
+ * @param Toolset_WPML_Compatibility|null $wpml_service_di
76
+ *
77
+ * @return potentialAssociation\CardinalityPostQuery
78
+ */
79
+ public function cardinality_query_posts(
80
+ IToolset_Relationship_Definition $relationship,
81
+ IToolset_Relationship_Role_Parent_Child $target_role,
82
+ IToolset_Element $for_element,
83
+ potentialAssociation\JoinManager $join_manager,
84
+ Toolset_Relationship_Table_Name $table_names_di = null,
85
+ wpdb $wpdb_di = null,
86
+ Toolset_WPML_Compatibility $wpml_service_di = null
87
+ ) {
88
+ return new potentialAssociation\CardinalityPostQuery(
89
+ $relationship,
90
+ $target_role,
91
+ $for_element,
92
+ $join_manager,
93
+ $table_names_di,
94
+ $wpdb_di,
95
+ $wpml_service_di
96
+ );
97
+ }
98
+
99
+
100
  /**
101
  * @param array $args Query arguments.
102
  *
vendor/toolset/toolset-common/inc/m2m/relationship/definition/definition.php CHANGED
@@ -68,6 +68,15 @@ class Toolset_Relationship_Definition implements IToolset_Relationship_Definitio
68
  /** @var string[] */
69
  private $role_names;
70
 
 
 
 
 
 
 
 
 
 
71
  /** @var bool */
72
  private $is_legacy_support_needed;
73
 
@@ -101,6 +110,8 @@ class Toolset_Relationship_Definition implements IToolset_Relationship_Definitio
101
  const DA_IS_DISTINCT = 'is_distinct';
102
  const DA_SCOPE = 'scope';
103
  const DA_ROLE_NAMES = 'role_names';
 
 
104
  const DA_NEEDS_LEGACY_SUPPORT = 'needs_legacy_support';
105
  const DA_IS_ACTIVE = 'is_active';
106
  const DA_ORIGIN = 'origin';
@@ -114,6 +125,28 @@ class Toolset_Relationship_Definition implements IToolset_Relationship_Definitio
114
  const OWNER_IS_CHILD = 'child';
115
 
116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  /** @var Toolset_Potential_Association_Query_Factory */
118
  private $potential_association_query_factory;
119
 
@@ -205,14 +238,27 @@ class Toolset_Relationship_Definition implements IToolset_Relationship_Definitio
205
  // Can't read scope data, default to no scope.
206
  }
207
 
208
- $role_names_definition = toolset_getarr( $definition_array, self::DA_ROLE_NAMES );
209
- $this->role_names = array();
210
- foreach( Toolset_Relationship_Role::all_role_names() as $role ) {
211
- // For each existing role, we will have a key with a custom name slug that should be recognized
212
- // in shortcodes, etc. Default value is also the role name.
213
- $this->role_names[ $role ] = sanitize_title(
214
- toolset_getarr( $role_names_definition, $role, $this->get_default_role_name( $role ), 'is_string' )
215
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
216
  }
217
 
218
  $this->is_legacy_support_needed = (bool) toolset_getarr( $definition_array, self::DA_NEEDS_LEGACY_SUPPORT, false );
@@ -451,8 +497,10 @@ class Toolset_Relationship_Definition implements IToolset_Relationship_Definitio
451
  self::DA_IS_DISTINCT => $this->is_distinct(),
452
  self::DA_SCOPE => ( $this->has_scope() ? $this->get_scope()->get_scope_data() : null ),
453
  self::DA_ROLE_NAMES => $this->get_role_names(),
454
- self::DA_DISPLAY_NAME_PLURAL => $this->get_display_name_plural(),
455
- self::DA_DISPLAY_NAME_SINGULAR => $this->get_display_name_singular()
 
 
456
  );
457
  }
458
 
@@ -554,7 +602,11 @@ class Toolset_Relationship_Definition implements IToolset_Relationship_Definitio
554
 
555
 
556
  public function get_owner() {
557
- return $this->ownership;
 
 
 
 
558
  }
559
 
560
 
@@ -712,6 +764,43 @@ class Toolset_Relationship_Definition implements IToolset_Relationship_Definitio
712
  }
713
 
714
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
715
  /**
716
  * Get all custom role names as an associative array.
717
  *
@@ -721,6 +810,27 @@ class Toolset_Relationship_Definition implements IToolset_Relationship_Definitio
721
  public function get_role_names() { return $this->role_names; }
722
 
723
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
724
  /**
725
  * Determine the default custom name for a role.
726
  *
@@ -728,13 +838,21 @@ class Toolset_Relationship_Definition implements IToolset_Relationship_Definitio
728
  * slug of the intermediary post type, if one exists.
729
  *
730
  * @param string $role
 
731
  *
732
  * @return string
733
  * @since m2m
734
  */
735
- private function get_default_role_name( $role ) {
736
  if( in_array( $role, Toolset_Relationship_Role::parent_child_role_names() ) ) {
737
- return $role;
 
 
 
 
 
 
 
738
  } elseif( Toolset_Relationship_Role::INTERMEDIARY === $role ) {
739
  return 'association';
740
  }
@@ -743,6 +861,25 @@ class Toolset_Relationship_Definition implements IToolset_Relationship_Definitio
743
  }
744
 
745
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
746
  /**
747
  * Update a custom role name.
748
  *
@@ -766,6 +903,55 @@ class Toolset_Relationship_Definition implements IToolset_Relationship_Definitio
766
  return $sanitized_custom_name;
767
  }
768
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
769
  /**
770
  * If the relationship was migrated from the legacy post relationships, we need to
771
  * provide backward compatibility for it.
@@ -872,4 +1058,18 @@ class Toolset_Relationship_Definition implements IToolset_Relationship_Definitio
872
  $role_name = $this->role_to_role_name( $role );
873
  return $db_operations->count_max_associations( $this->get_row_id(), $role_name );
874
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
875
  }
68
  /** @var string[] */
69
  private $role_names;
70
 
71
+ /** @var string[] */
72
+ private $role_labels_singular;
73
+
74
+ /** @var string[] */
75
+ private $role_labels_plural;
76
+
77
+ /** @var string[] */
78
+ private $role_aliases;
79
+
80
  /** @var bool */
81
  private $is_legacy_support_needed;
82
 
110
  const DA_IS_DISTINCT = 'is_distinct';
111
  const DA_SCOPE = 'scope';
112
  const DA_ROLE_NAMES = 'role_names';
113
+ const DA_ROLE_LABELS_SINGULAR = 'role_labels_singular';
114
+ const DA_ROLE_LABELS_PLURAL = 'role_labels_plural';
115
  const DA_NEEDS_LEGACY_SUPPORT = 'needs_legacy_support';
116
  const DA_IS_ACTIVE = 'is_active';
117
  const DA_ORIGIN = 'origin';
125
  const OWNER_IS_CHILD = 'child';
126
 
127
 
128
+ /**
129
+ * Default plural role names
130
+ *
131
+ * @var string[]
132
+ * @since m2m
133
+ */
134
+ private $default_role_labels_plural = array(
135
+ Toolset_Relationship_Role::PARENT => 'Parents',
136
+ Toolset_Relationship_Role::CHILD => 'Children',
137
+ );
138
+
139
+ /**
140
+ * Default singular role names
141
+ *
142
+ * @var string[]
143
+ * @since m2m
144
+ */
145
+ private $default_role_labels_singular = array(
146
+ Toolset_Relationship_Role::PARENT => 'Parent',
147
+ Toolset_Relationship_Role::CHILD => 'Child',
148
+ );
149
+
150
  /** @var Toolset_Potential_Association_Query_Factory */
151
  private $potential_association_query_factory;
152
 
238
  // Can't read scope data, default to no scope.
239
  }
240
 
241
+ $role_types_and_sanitize = array(
242
+ self::DA_ROLE_NAMES => 'sanitize_title',
243
+ self::DA_ROLE_LABELS_SINGULAR => 'sanitize_text_field',
244
+ self::DA_ROLE_LABELS_PLURAL => 'sanitize_text_field'
245
+ );
246
+ foreach ( $role_types_and_sanitize as $role_type => $sanitize) {
247
+ $role_names_definition = toolset_getarr( $definition_array, $role_type );
248
+
249
+ // Workaround to support PHP 5.3 to 7.*:
250
+ // - can't do $this->$role_type[ $role ] = ... because it's ambiguous in PHP 7.0
251
+ // - can't do ($this->$role_type)[ $role ] = ... because PHP 5.3 considers it a syntax error
252
+ $role_names = array();
253
+
254
+ foreach( Toolset_Relationship_Role::all_role_names() as $role ) {
255
+ // For each existing role, we will have a key with a custom name slug that should be recognized
256
+ // in shortcodes, etc. Default value is also the role name.
257
+ $role_names[ $role ] = $sanitize(
258
+ toolset_getarr( $role_names_definition, $role, $this->get_default_role_name( $role, $role_type ), 'is_string' )
259
+ );
260
+ }
261
+ $this->$role_type = $role_names;
262
  }
263
 
264
  $this->is_legacy_support_needed = (bool) toolset_getarr( $definition_array, self::DA_NEEDS_LEGACY_SUPPORT, false );
497
  self::DA_IS_DISTINCT => $this->is_distinct(),
498
  self::DA_SCOPE => ( $this->has_scope() ? $this->get_scope()->get_scope_data() : null ),
499
  self::DA_ROLE_NAMES => $this->get_role_names(),
500
+ self::DA_ROLE_LABELS_SINGULAR => $this->get_role_labels_singular(),
501
+ self::DA_ROLE_LABELS_PLURAL => $this->get_role_labels_plural(),
502
+ self::DA_DISPLAY_NAME_PLURAL => $this->get_display_name_plural(),
503
+ self::DA_DISPLAY_NAME_SINGULAR => $this->get_display_name_singular()
504
  );
505
  }
506
 
602
 
603
 
604
  public function get_owner() {
605
+ if( in_array( $this->ownership, array( self::OWNER_IS_CHILD, self::OWNER_IS_PARENT ) ) ) {
606
+ return $this->ownership;
607
+ }
608
+
609
+ return 'none';
610
  }
611
 
612
 
764
  }
765
 
766
 
767
+ /**
768
+ * Get a custom role singular name that should be recognized in shortcodes instead of parent, child, etc.
769
+ *
770
+ * @param string|IToolset_Relationship_Role $element_role One of the Toolset_Relationship_Role values.
771
+ * @return string Custom role name.
772
+ * @since m2m
773
+ */
774
+ public function get_role_label_singular( $element_role ) {
775
+ $element_role = $this->role_to_role_name( $element_role );
776
+ if( ! Toolset_Relationship_Role::is_valid( $element_role ) ) {
777
+ throw new InvalidArgumentException();
778
+ }
779
+
780
+ return isset( $this->role_labels_singular[ $element_role ] )
781
+ ? $this->role_labels_singular[ $element_role ]
782
+ : $this->default_role_labels_singular[ $element_role ];
783
+ }
784
+
785
+
786
+ /**
787
+ * Get a custom role plural name that should be recognized in shortcodes instead of parent, child, etc.
788
+ *
789
+ * @param string|IToolset_Relationship_Role $element_role One of the Toolset_Relationship_Role values.
790
+ * @return string Custom role name.
791
+ * @since m2m
792
+ */
793
+ public function get_role_label_plural( $element_role ) {
794
+ $element_role = $this->role_to_role_name( $element_role );
795
+ if( ! Toolset_Relationship_Role::is_valid( $element_role ) ) {
796
+ throw new InvalidArgumentException();
797
+ }
798
+
799
+ return isset( $this->role_labels_plural[ $element_role ] )
800
+ ? $this->role_labels_plural[ $element_role ]
801
+ : $this->default_role_labels_plural[ $element_role ];
802
+ }
803
+
804
  /**
805
  * Get all custom role names as an associative array.
806
  *
810
  public function get_role_names() { return $this->role_names; }
811
 
812
 
813
+ /**
814
+ * Get all custom role singular names as an associative array.
815
+ *
816
+ * @return string[string]
817
+ * @since m2m
818
+ */
819
+ public function get_role_labels_singular() {
820
+ return $this->role_labels_singular;
821
+ }
822
+
823
+
824
+ /**
825
+ * Get all custom role plural names as an associative array.
826
+ *
827
+ * @return string[string]
828
+ * @since m2m
829
+ */
830
+ public function get_role_labels_plural() {
831
+ return $this->role_labels_plural;
832
+ }
833
+
834
  /**
835
  * Determine the default custom name for a role.
836
  *
838
  * slug of the intermediary post type, if one exists.
839
  *
840
  * @param string $role
841
+ * @param string $role_type Grammatical type: plural or singular
842
  *
843
  * @return string
844
  * @since m2m
845
  */
846
+ private function get_default_role_name( $role, $role_type = self::DA_ROLE_NAMES ) {
847
  if( in_array( $role, Toolset_Relationship_Role::parent_child_role_names() ) ) {
848
+ switch ( $role_type ) {
849
+ case self::DA_ROLE_LABELS_SINGULAR:
850
+ return $this->default_role_labels_singular[ $role ];
851
+ case self::DA_ROLE_LABELS_PLURAL:
852
+ return $this->default_role_labels_plural[ $role ];
853
+ default:
854
+ return $role;
855
+ }
856
  } elseif( Toolset_Relationship_Role::INTERMEDIARY === $role ) {
857
  return 'association';
858
  }
861
  }
862
 
863
 
864
+ /**
865
+ * Lists default aliases by role type
866
+ *
867
+ * @return array
868
+ * @since m2m
869
+ */
870
+ public function get_default_labels() {
871
+ $aliases = array();
872
+ foreach ( Toolset_Relationship_Role::parent_child_role_names() as $role ) {
873
+ $aliases[ $role ] = array(
874
+ 'name' => $role,
875
+ );
876
+ foreach ( array( self::DA_ROLE_LABELS_SINGULAR, self::DA_ROLE_LABELS_PLURAL ) as $role_type ) {
877
+ $aliases[ $role ][ $role_type ] = $this->get_default_role_name( $role, $role_type );
878
+ }
879
+ }
880
+ return $aliases;
881
+ }
882
+
883
  /**
884
  * Update a custom role name.
885
  *
903
  return $sanitized_custom_name;
904
  }
905
 
906
+
907
+ /**
908
+ * Update a custom role singular name.
909
+ *
910
+ * The name will be sanitized and the value actually saved will be returned.
911
+ *
912
+ * @param string|IToolset_Relationship_Role $element_role One of the Toolset_Relationship_Role values.
913
+ * @param string $custom_name Custom name for the role.
914
+ *
915
+ * @return string Sanitized custom name
916
+ * @since m2m
917
+ */
918
+ public function set_role_label_singular( $element_role, $custom_name ) {
919
+ $role_name = $this->role_to_role_name( $element_role );
920
+ if( ! Toolset_Relationship_Role::is_valid( $role_name ) ) {
921
+ throw new InvalidArgumentException();
922
+ }
923
+
924
+ $sanitized_custom_name = sanitize_text_field( $custom_name );
925
+ $this->role_labels_singular[ $role_name ] = $sanitized_custom_name;
926
+
927
+ return $sanitized_custom_name;
928
+ }
929
+
930
+
931
+ /**
932
+ * Update a custom role plural name.
933
+ *
934
+ * The name will be sanitized and the value actually saved will be returned.
935
+ *
936
+ * @param string|IToolset_Relationship_Role $element_role One of the Toolset_Relationship_Role values.
937
+ * @param string $custom_name Custom name for the role.
938
+ *
939
+ * @return string Sanitized custom name
940
+ * @since m2m
941
+ */
942
+ public function set_role_label_plural( $element_role, $custom_name ) {
943
+ $role_name = $this->role_to_role_name( $element_role );
944
+ if( ! Toolset_Relationship_Role::is_valid( $role_name ) ) {
945
+ throw new InvalidArgumentException();
946
+ }
947
+
948
+ $sanitized_custom_name = sanitize_text_field( $custom_name );
949
+ $this->role_labels_plural[ $role_name ] = $sanitized_custom_name;
950
+
951
+ return $sanitized_custom_name;
952
+ }
953
+
954
+
955
  /**
956
  * If the relationship was migrated from the legacy post relationships, we need to
957
  * provide backward compatibility for it.
1058
  $role_name = $this->role_to_role_name( $role );
1059
  return $db_operations->count_max_associations( $this->get_row_id(), $role_name );
1060
  }
1061
+
1062
+
1063
+ /**
1064
+ * Set default role aliases
1065
+ *
1066
+ * @since m2m
1067
+ */
1068
+ public function set_default_role_labels() {
1069
+ foreach ( Toolset_Relationship_Role::parent_child_role_names() as $role_name ) {
1070
+ $this->set_role_name( $role_name, $role_name );
1071
+ $this->set_role_label_singular( $role_name, $this->default_role_labels_singular[ $role_name ] );
1072
+ $this->set_role_label_plural( $role_name, $this->default_role_labels_plural[ $role_name ] );
1073
+ }
1074
+ }
1075
  }
vendor/toolset/toolset-common/inc/m2m/relationship/definition/persistence.php CHANGED
@@ -262,7 +262,7 @@ class Toolset_Relationship_Definition_Persistence {
262
  * @var $element_types Toolset_Relationship_Element_Type[]
263
  */
264
  $element_types = array(
265
- $relationship_definition->get_parent_type(),
266
  $relationship_definition->get_child_type()
267
  );
268
 
@@ -286,11 +286,14 @@ class Toolset_Relationship_Definition_Persistence {
286
  continue;
287
  }
288
 
289
- if( ! $rfg_involved && ! $post_type->can_be_used_in_relationship() ) {
290
- $error =
291
- 'The post type "'.$post_type_string.'" uses the "Translatable - only show translated '
292
- . 'items" WPML translation mode. In order to use it in a relationship, switch to '
293
- . '"Translatable - use translation if available or fallback to default language mode".';
 
 
 
294
  }
295
  }
296
  break;
262
  * @var $element_types Toolset_Relationship_Element_Type[]
263
  */
264
  $element_types = array(
265
+ $relationship_definition->get_parent_type(),
266
  $relationship_definition->get_child_type()
267
  );
268
 
286
  continue;
287
  }
288
 
289
+ $can_be_used_in_relationship = $post_type->can_be_used_in_relationship();
290
+ if( ! $rfg_involved && $can_be_used_in_relationship->is_error() ) {
291
+ $message = $can_be_used_in_relationship->get_message();
292
+ $error = strpos( $message, 'WPML' ) !== false
293
+ ? 'The post type "'.$post_type_string.'" uses the "Translatable - only show translated '
294
+ . 'items" WPML translation mode. In order to use it in a relationship, switch to '
295
+ . '"Translatable - use translation if available or fallback to default language mode".'
296
+ : $message;
297
  }
298
  }
299
  break;
vendor/toolset/toolset-common/inc/m2m/relationship/definition/translator.php CHANGED
@@ -56,8 +56,12 @@ class Toolset_Relationship_Definition_Translator {
56
  'role_name_parent' => $definition->get_role_name( Toolset_Relationship_Role::PARENT ),
57
  'role_name_child' => $definition->get_role_name( Toolset_Relationship_Role::CHILD ),
58
  'role_name_intermediary' => $definition->get_role_name( Toolset_Relationship_Role::INTERMEDIARY ),
59
- 'needs_legacy_support' => ( $definition->needs_legacy_support() ? 1 : 0 ),
60
- 'is_active' => ( $definition->is_active() ? 1 : 0 ),
 
 
 
 
61
  );
62
 
63
  return $row;
@@ -110,6 +114,14 @@ class Toolset_Relationship_Definition_Translator {
110
  Toolset_Relationship_Role::CHILD => $row->role_name_child,
111
  Toolset_Relationship_Role::INTERMEDIARY => $row->role_name_intermediary,
112
  ),
 
 
 
 
 
 
 
 
113
  Toolset_Relationship_Definition::DA_NEEDS_LEGACY_SUPPORT => (bool) $row->needs_legacy_support,
114
  Toolset_Relationship_Definition::DA_IS_ACTIVE => (bool) $row->is_active,
115
  Toolset_Relationship_Definition::DA_ORIGIN => maybe_unserialize( $row->origin ),
@@ -161,10 +173,14 @@ class Toolset_Relationship_Definition_Translator {
161
  '%s', // role_name_parent
162
  '%s', // role_name_child
163
  '%s', // role_name_intermediary
 
 
 
 
164
  '%d', // needs_legacy_support
165
  '%d', // is_active
166
  );
167
  }
168
 
169
 
170
- }
56
  'role_name_parent' => $definition->get_role_name( Toolset_Relationship_Role::PARENT ),
57
  'role_name_child' => $definition->get_role_name( Toolset_Relationship_Role::CHILD ),
58
  'role_name_intermediary' => $definition->get_role_name( Toolset_Relationship_Role::INTERMEDIARY ),
59
+ 'role_label_parent_singular' => $definition->get_role_label_singular( Toolset_Relationship_Role::PARENT ),
60
+ 'role_label_child_singular' => $definition->get_role_label_singular( Toolset_Relationship_Role::CHILD ),
61
+ 'role_label_parent_plural' => $definition->get_role_label_plural( Toolset_Relationship_Role::PARENT ),
62
+ 'role_label_child_plural' => $definition->get_role_label_plural( Toolset_Relationship_Role::CHILD ),
63
+ 'needs_legacy_support' => ( $definition->needs_legacy_support() ? 1 : 0 ),
64
+ 'is_active' => ( $definition->is_active() ? 1 : 0 ),
65
  );
66
 
67
  return $row;
114
  Toolset_Relationship_Role::CHILD => $row->role_name_child,
115
  Toolset_Relationship_Role::INTERMEDIARY => $row->role_name_intermediary,
116
  ),
117
+ Toolset_Relationship_Definition::DA_ROLE_LABELS_SINGULAR => array(
118
+ Toolset_Relationship_Role::PARENT => $row->role_label_parent_singular,
119
+ Toolset_Relationship_Role::CHILD => $row->role_label_child_singular,
120
+ ),
121
+ Toolset_Relationship_Definition::DA_ROLE_LABELS_PLURAL => array(
122
+ Toolset_Relationship_Role::PARENT => $row->role_label_parent_plural,
123
+ Toolset_Relationship_Role::CHILD => $row->role_label_child_plural,
124
+ ),
125
  Toolset_Relationship_Definition::DA_NEEDS_LEGACY_SUPPORT => (bool) $row->needs_legacy_support,
126
  Toolset_Relationship_Definition::DA_IS_ACTIVE => (bool) $row->is_active,
127
  Toolset_Relationship_Definition::DA_ORIGIN => maybe_unserialize( $row->origin ),
173
  '%s', // role_name_parent
174
  '%s', // role_name_child
175
  '%s', // role_name_intermediary
176
+ '%s', // role_name_parent_singular
177
+ '%s', // role_name_child_singular
178
+ '%s', // role_name_parent_plural
179
+ '%s', // role_name_child_plural
180
  '%d', // needs_legacy_support
181
  '%d', // is_active
182
  );
183
  }
184
 
185
 
186
+ }
vendor/toolset/toolset-common/inc/m2m/relationship/query/condition/exclude_relationship.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Condition that excludes a relationship.
5
+ *
6
+ * @since m2m
7
+ */
8
+ class Toolset_Relationship_Query_Condition_Exclude_Relationship extends Toolset_Relationship_Query_Condition {
9
+
10
+
11
+ /** @var Toolset_Relationship_Definition */
12
+ private $relationship;
13
+
14
+
15
+ /**
16
+ * Toolset_Relationship_Query_Condition_Exclude_Relationship constructor.
17
+ *
18
+ * @param Toolset_Relationship_Definition $relationship Relationship to be excluded.
19
+ */
20
+ public function __construct( Toolset_Relationship_Definition $relationship ) {
21
+
22
+ $this->relationship = $relationship;
23
+ }
24
+
25
+
26
+ /**
27
+ * @inheritdoc
28
+ *
29
+ * @return string
30
+ */
31
+ public function get_where_clause() {
32
+
33
+ return sprintf(
34
+ "relationships.slug != '%s'",
35
+ esc_sql( $this->relationship->get_slug() )
36
+ );
37
+ }
38
+ }
vendor/toolset/toolset-common/inc/m2m/relationship/query/condition/exclude_type.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Condition that a relationship has not a certain type in a certain relationship role.
5
+ *
6
+ * @since m2m
7
+ */
8
+ class Toolset_Relationship_Query_Condition_Exclude_Type extends Toolset_Relationship_Query_Condition_Type {
9
+
10
+
11
+ /**
12
+ * @inheritdoc
13
+ *
14
+ * @return string
15
+ */
16
+ public function get_where_clause() {
17
+ $where = sprintf(
18
+ "{$this->get_type_set_table_alias( $this->role )}.type != '%s' ",
19
+ esc_sql( $this->type )
20
+ );
21
+
22
+ return $where;
23
+ }
24
+
25
+ }
vendor/toolset/toolset-common/inc/m2m/relationship/query/condition/has_active_types.php CHANGED
@@ -100,7 +100,8 @@ class Toolset_Relationship_Query_Condition_Has_Active_Types extends Toolset_Rela
100
 
101
  $post_type_query = $this->post_type_query_factory->create( array(
102
  Toolset_Post_Type_Query::IS_REGISTERED => true,
103
- Toolset_Post_Type_Query::RETURN_TYPE => 'slug'
 
104
  ) );
105
 
106
  $active_post_types = $post_type_query->get_results();
100
 
101
  $post_type_query = $this->post_type_query_factory->create( array(
102
  Toolset_Post_Type_Query::IS_REGISTERED => true,
103
+ Toolset_Post_Type_Query::RETURN_TYPE => 'slug',
104
+ Toolset_Post_Type_Query::HAS_SPECIAL_PURPOSE => null
105
  ) );
106
 
107
  $active_post_types = $post_type_query->get_results();
vendor/toolset/toolset-common/inc/m2m/relationship/query/condition/intermediary_type.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Condition that a relationship involves a certain intermediary post type.
5
+ *
6
+ * @since 2.6.7
7
+ */
8
+ class Toolset_Relationship_Query_Condition_Intermediary_Type extends Toolset_Relationship_Query_Condition {
9
+
10
+
11
+ /** @var string */
12
+ private $intermediary_type;
13
+
14
+
15
+ /**
16
+ * Toolset_Relationship_Query_Condition_Intermediary_Type constructor.
17
+ *
18
+ * @param string
19
+ * @throws InvalidArgumentException
20
+ */
21
+ public function __construct( $intermediary_type ) {
22
+ if( null !== $intermediary_type && ( ! is_string( $intermediary_type ) || empty( $intermediary_type ) ) ) {
23
+ throw new InvalidArgumentException();
24
+ }
25
+
26
+ $this->intermediary_type = $intermediary_type;
27
+ }
28
+
29
+
30
+ /**
31
+ * @inheritdoc
32
+ * @return string
33
+ */
34
+ public function get_where_clause() {
35
+ if( null === $this->intermediary_type ) {
36
+ return '1 = 1';
37
+ }
38
+
39
+ return sprintf(
40
+ "relationships.intermediary_type = '%s'",
41
+ esc_sql( $this->intermediary_type )
42
+ );
43
+ }
44
+ }
vendor/toolset/toolset-common/inc/m2m/relationship/query/condition/origin.php CHANGED
@@ -16,11 +16,11 @@ class Toolset_Relationship_Query_Condition_Origin extends Toolset_Relationship_Q
16
  /**
17
  * Toolset_Relationship_Query_Condition_Origin constructor.
18
  *
19
- * @param string $origin
20
  * @throws InvalidArgumentException
21
  */
22
  public function __construct( $origin ) {
23
- if( ! is_string( $origin ) || empty( $origin ) ) {
24
  throw new InvalidArgumentException();
25
  }
26
 
@@ -33,6 +33,10 @@ class Toolset_Relationship_Query_Condition_Origin extends Toolset_Relationship_Q
33
  * @return string
34
  */
35
  public function get_where_clause() {
 
 
 
 
36
  return sprintf(
37
  "relationships.origin = '%s'",
38
  esc_sql( $this->origin )
16
  /**
17
  * Toolset_Relationship_Query_Condition_Origin constructor.
18
  *
19
+ * @param string|null $origin Null value to return all origins.
20
  * @throws InvalidArgumentException
21
  */
22
  public function __construct( $origin ) {
23
+ if( null !== $origin && ( ! is_string( $origin ) || empty( $origin ) ) ) {
24
  throw new InvalidArgumentException();
25
  }
26
 
33
  * @return string
34
  */
35
  public function get_where_clause() {
36
+ if( null === $this->origin ) {
37
+ return '1 = 1';
38
+ }
39
+
40
  return sprintf(
41
  "relationships.origin = '%s'",
42
  esc_sql( $this->origin )
vendor/toolset/toolset-common/inc/m2m/relationship/query/condition/type.php CHANGED
@@ -9,10 +9,10 @@ class Toolset_Relationship_Query_Condition_Type extends Toolset_Relationship_Que
9
 
10
 
11
  /** @var IToolset_Relationship_Role_Parent_Child */
12
- private $role;
13
 
14
  /** @var string */
15
- private $type;
16
 
17
 
18
  /**
@@ -47,4 +47,4 @@ class Toolset_Relationship_Query_Condition_Type extends Toolset_Relationship_Que
47
  return $where;
48
  }
49
 
50
- }
9
 
10
 
11
  /** @var IToolset_Relationship_Role_Parent_Child */
12
+ protected $role;
13
 
14
  /** @var string */
15
+ protected $type;
16
 
17
 
18
  /**
47
  return $where;
48
  }
49
 
50
+ }
vendor/toolset/toolset-common/inc/m2m/relationship/query/condition_factory.php CHANGED
@@ -7,6 +7,13 @@
7
  */
8
  class Toolset_Relationship_Query_Condition_Factory {
9
 
 
 
 
 
 
 
 
10
  /**
11
  * Chain multiple conditions with OR.
12
  *
@@ -57,6 +64,19 @@ class Toolset_Relationship_Query_Condition_Factory {
57
  return new Toolset_Relationship_Query_Condition_Origin( $origin );
58
  }
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
 
61
  /**
62
  * Condition that the relationship has a certain type in a given role.
@@ -71,6 +91,19 @@ class Toolset_Relationship_Query_Condition_Factory {
71
  }
72
 
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  /**
75
  * Condition that the relationship was migrated from the legacy implementation.
76
  *
@@ -131,4 +164,14 @@ class Toolset_Relationship_Query_Condition_Factory {
131
  }
132
 
133
 
134
- }
 
 
 
 
 
 
 
 
 
 
7
  */
8
  class Toolset_Relationship_Query_Condition_Factory {
9
 
10
+ /**
11
+ * Join Manager
12
+ *
13
+ * @param Toolset_Association_Query_Table_Join_Manager
14
+ */
15
+ private $join_manager;
16
+
17
  /**
18
  * Chain multiple conditions with OR.
19
  *
64
  return new Toolset_Relationship_Query_Condition_Origin( $origin );
65
  }
66
 
67
+ /**
68
+ * Condition that the relationship uses a given intermediary post type
69
+ *
70
+ * @param string $intermediary_type
71
+ *
72
+ * @return Toolset_Relationship_Query_Condition_Intermediary_Type
73
+ *
74
+ * @since 2.6.7
75
+ */
76
+ public function intermediary_type( $intermediary_type ) {
77
+ return new Toolset_Relationship_Query_Condition_Intermediary_Type( $intermediary_type );
78
+ }
79
+
80
 
81
  /**
82
  * Condition that the relationship has a certain type in a given role.
91
  }
92
 
93
 
94
+ /**
95
+ * Condition that the relationship has not a certain type in a given role.
96
+ *
97
+ * @param string $type
98
+ * @param IToolset_Relationship_Role_Parent_Child $in_role
99
+ *
100
+ * @return IToolset_Relationship_Query_Condition
101
+ */
102
+ public function exclude_type( $type, IToolset_Relationship_Role_Parent_Child $in_role ) {
103
+ return new Toolset_Relationship_Query_Condition_Exclude_Type( $type, $in_role );
104
+ }
105
+
106
+
107
  /**
108
  * Condition that the relationship was migrated from the legacy implementation.
109
  *
164
  }
165
 
166
 
167
+ /**
168
+ * Condition that excludes a relationship.
169
+ *
170
+ * @param Toolset_Relationship_Definition $relationship Relationship Definition.
171
+ *
172
+ * @return IToolset_Relationship_Query_Condition
173
+ */
174
+ public function exclude_relationship( $relationship ) {
175
+ return new Toolset_Relationship_Query_Condition_Exclude_Relationship( $relationship );
176
+ }
177
+ }
vendor/toolset/toolset-common/inc/m2m/relationship/query/relationship_query_v2.php CHANGED
@@ -35,12 +35,13 @@
35
  * active and non-active relationship definitions, you need to manually add is_active('*').
36
  * - If no has_active_post_types() condition is used when constructing the query, has_active_post_types(true)
37
  * is used for both parent and child role.
 
38
  * - This mechanism doesn't recognize where, how and if these conditions are actually applied, so even
39
  * $query->do_if( false, $query->is_active( true ) ) will disable the default is_active() condition.
40
  *
41
  * @since m2m
42
  */
43
- class Toolset_Relationship_Query_V2 implements IToolset_Query {
44
 
45
 
46
  /** @var IToolset_Relationship_Query_Condition[] */
@@ -56,6 +57,7 @@ class Toolset_Relationship_Query_V2 implements IToolset_Query {
56
  private $should_add_default_conditions = true;
57
  private $has_is_active_condition = false;
58
  private $has_is_post_type_active_condition = false;
 
59
 
60
 
61
  /** @var Toolset_Relationship_Database_Unique_Table_Alias */
@@ -179,6 +181,10 @@ class Toolset_Relationship_Query_V2 implements IToolset_Query {
179
  if( ! $this->has_is_post_type_active_condition ) {
180
  $this->add( $this->has_active_post_types() );
181
  }
 
 
 
 
182
  }
183
 
184
 
@@ -305,15 +311,30 @@ class Toolset_Relationship_Query_V2 implements IToolset_Query {
305
  /**
306
  * Condition that the relationship comes from a certain source
307
  *
308
- * @param string $origin
309
  *
310
  * @return Toolset_Relationship_Query_Condition_Origin
311
  */
312
  public function origin( $origin ) {
 
313
  return $this->condition_factory->origin( $origin );
314
  }
315
 
316
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
317
  /**
318
  * Condition that the relationship has a certain type in a given role.
319
  *
@@ -335,6 +356,27 @@ class Toolset_Relationship_Query_V2 implements IToolset_Query {
335
  }
336
 
337
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
338
  /**
339
  * Condition that the relationship has a certain type and a domain in a given role.
340
  *
@@ -499,4 +541,15 @@ class Toolset_Relationship_Query_V2 implements IToolset_Query {
499
  return (int) $this->found_rows;
500
  }
501
 
502
- }
 
 
 
 
 
 
 
 
 
 
 
35
  * active and non-active relationship definitions, you need to manually add is_active('*').
36
  * - If no has_active_post_types() condition is used when constructing the query, has_active_post_types(true)
37
  * is used for both parent and child role.
38
+ * - If no origin() condition is used, origin( 'wizard' ) is added by default.
39
  * - This mechanism doesn't recognize where, how and if these conditions are actually applied, so even
40
  * $query->do_if( false, $query->is_active( true ) ) will disable the default is_active() condition.
41
  *
42
  * @since m2m
43
  */
44
+ class Toolset_Relationship_Query_V2 {
45
 
46
 
47
  /** @var IToolset_Relationship_Query_Condition[] */
57
  private $should_add_default_conditions = true;
58
  private $has_is_active_condition = false;
59
  private $has_is_post_type_active_condition = false;
60
+ private $has_origin_condition = false;
61
 
62
 
63
  /** @var Toolset_Relationship_Database_Unique_Table_Alias */
181
  if( ! $this->has_is_post_type_active_condition ) {
182
  $this->add( $this->has_active_post_types() );
183
  }
184
+
185
+ if( ! $this->has_origin_condition ) {
186
+ $this->add( $this->origin( Toolset_Relationship_Origin_Wizard::ORIGIN_KEYWORD ) );
187
+ }
188
  }
189
 
190
 
311
  /**
312
  * Condition that the relationship comes from a certain source
313
  *
314
+ * @param string|null $origin One of the keywords from IToolset_Relationship_Origin or null to include relationships with all origins.
315
  *
316
  * @return Toolset_Relationship_Query_Condition_Origin
317
  */
318
  public function origin( $origin ) {
319
+ $this->has_origin_condition = true;
320
  return $this->condition_factory->origin( $origin );
321
  }
322
 
323
 
324
+ /**
325
+ * Condition that the relationship includes a certain intermediary object.
326
+ *
327
+ * @param string $intermediary_type An intermediary object slug.
328
+ *
329
+ * @return Toolset_Relationship_Query_Condition_Intermediary
330
+ *
331
+ * @since 2.6.7
332
+ */
333
+ public function intermediary_type( $intermediary_type ) {
334
+ return $this->condition_factory->intermediary_type( $intermediary_type );
335
+ }
336
+
337
+
338
  /**
339
  * Condition that the relationship has a certain type in a given role.
340
  *
356
  }
357
 
358
 
359
+ /**
360
+ * Condition that the relationship has a certain type in a given role.
361
+ *
362
+ * @param string $type
363
+ * @param IToolset_Relationship_Role_Parent_Child|null $in_role If null is provided, the type
364
+ * can be in both parent or child role for the condition to be true.
365
+ *
366
+ * @return IToolset_Relationship_Query_Condition
367
+ */
368
+ public function exclude_type( $type, $in_role = null ) {
369
+ if( null === $in_role ) {
370
+ return $this->do_and(
371
+ $this->exclude_type( $type, new Toolset_Relationship_Role_Parent() ),
372
+ $this->exclude_type( $type, new Toolset_Relationship_Role_Child() )
373
+ );
374
+ }
375
+
376
+ return $this->condition_factory->exclude_type( $type, $in_role );
377
+ }
378
+
379
+
380
  /**
381
  * Condition that the relationship has a certain type and a domain in a given role.
382
  *
541
  return (int) $this->found_rows;
542
  }
543
 
544
+
545
+ /**
546
+ * Condition that excludes a relationship.
547
+ *
548
+ * @param Toolset_Relationship_Definition $relationship Relationship Definition.
549
+ *
550
+ * @return IToolset_Relationship_Query_Condition
551
+ */
552
+ public function exclude_relationship( $relationship ) {
553
+ return $this->condition_factory->exclude_relationship( $relationship );
554
+ }
555
+ }
vendor/toolset/toolset-common/inc/m2m/relationship/role/role.php CHANGED
@@ -200,5 +200,4 @@ abstract class Toolset_Relationship_Role {
200
  return $role_or_name->get_name();
201
  }
202
 
203
-
204
- }
200
  return $role_or_name->get_name();
201
  }
202
 
203
+ }
 
vendor/toolset/toolset-common/inc/public_api/legacy_relationships.php CHANGED
@@ -336,3 +336,199 @@ function toolset_get_parent_post_by_type( $post, $target_type ) {
336
 
337
  return toolset_get_related_post( $post, array( $target_type, $post->post_type ) );
338
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
336
 
337
  return toolset_get_related_post( $post, array( $target_type, $post->post_type ) );
338
  }
339
+
340
+
341
+ /**
342
+ * Please refer to toolset_get_relationship() documentation in inc/public_api/m2m.php.
343
+ *
344
+ * @param string|string[] $identification
345
+ * @return array|null
346
+ * @since 2.6.4
347
+ */
348
+ function toolset_get_relationship( $identification ) {
349
+
350
+ if( ! is_array( $identification ) || count( $identification ) !== 2 ) {
351
+ throw new InvalidArgumentException( 'The relationship must be an array containing parent post type and child post type.' );
352
+ }
353
+
354
+ // Just check if the relationship is defined.
355
+ $legacy_relationships = toolset_ensarr( get_option( 'wpcf_post_relationship', array() ) );
356
+ if(
357
+ ! array_key_exists( $identification[0], $legacy_relationships )
358
+ || ! is_array( $legacy_relationships[ $identification[0] ] )
359
+ || ! array_key_exists( $identification[1], $legacy_relationships[ $identification[0] ] )
360
+ || ! is_array( $legacy_relationships[ $identification[0] ][ $identification[1] ] )
361
+ ) {
362
+ return null;
363
+ }
364
+
365
+ // The only varying part are the two post types.
366
+ $relationship = array(
367
+ 'roles' => array(
368
+ 'parent' => array(
369
+ 'domain' => 'posts',
370
+ 'types' => array( $identification[0] )
371
+ ),
372
+ 'child' => array(
373
+ 'domain' => 'posts',
374
+ 'types' => array( $identification[1] )
375
+ )
376
+ ),
377
+ 'cardinality' => array(
378
+ 'type' => 'one-to-many',
379
+ 'limits' => array(
380
+ 'parent' => array(
381
+ 'max' => 1,
382
+ 'min' => 0
383
+ ),
384
+ 'child' => array(
385
+ 'max' => -1,
386
+ 'min' => 0
387
+ )
388
+ )
389
+ ),
390
+ 'origin' => 'standard'
391
+ );
392
+
393
+ return $relationship;
394
+ }
395
+
396
+
397
+ /**
398
+ * Please refer to toolset_get_relationships() documentation in inc/public_api/m2m.php.
399
+ *
400
+ * @param array $args
401
+ * @return array
402
+ * @since 2.6.4
403
+ */
404
+ function toolset_get_relationships( $args ) {
405
+ if ( ! is_array( $args ) ) {
406
+ throw new InvalidArgumentException( 'Invalid input, expected an array of query arguments.' );
407
+ }
408
+
409
+ // Transform the legacy relationship data into pairs of post types.
410
+ //
411
+ //
412
+ $legacy_relationships_option = toolset_ensarr( get_option( 'wpcf_post_relationship', array() ) );
413
+ $legacy_relationships = array();
414
+ foreach( $legacy_relationships_option as $parent_type => $child_types ) {
415
+ foreach( array_keys( $child_types ) as $child_type ) {
416
+ $legacy_relationships[] = array(
417
+ 'parent' => $parent_type,
418
+ 'child' => $child_type
419
+ );
420
+ }
421
+ }
422
+
423
+
424
+ // Filter out relationships that have an inactive post type.
425
+ //
426
+ //
427
+ if( false === (bool) toolset_getarr( $args, 'include_inactive' ) ) {
428
+ $post_type_repository = Toolset_Post_Type_Repository::get_instance();
429
+ $is_post_type_active = function( $post_type_slug ) use( $post_type_repository ) {
430
+ $post_type = $post_type_repository->get( $post_type_slug );
431
+ if( null === $post_type ) {
432
+ return false;
433
+ }
434
+ return $post_type->is_registered();
435
+ };
436
+
437
+ $legacy_relationships = array_filter(
438
+ $legacy_relationships,
439
+ function( $relationship ) use ( $is_post_type_active ) {
440
+ return ( $is_post_type_active( $relationship['parent'] ) && $is_post_type_active( $relationship['child'] ) );
441
+ } );
442
+ }
443
+
444
+
445
+ // Filter out arguments that have only a single supported value in the legacy implementation.
446
+ //
447
+ //
448
+ if( ! in_array( toolset_getarr( $args, 'origin', 'standard' ), array( 'standard', 'any' ) ) ) {
449
+ return array();
450
+ }
451
+ if( ! in_array( toolset_getarr( $args, 'cardinality', 'one-to-many' ), array( 'one-to-many', 'one-to-something', '0..1:0..*' ) ) ) {
452
+ return array();
453
+ }
454
+
455
+
456
+ // Filter relationships by involved post types.
457
+ //
458
+ $type_constraints = toolset_ensarr( toolset_getarr( $args, 'type_constraints' ) );
459
+ foreach( $type_constraints as $role => $type_constraint ) {
460
+ if( ! in_array( $role, array( 'parent', 'child', 'any' ) ) ) {
461
+ return array();
462
+ }
463
+
464
+ $domain = toolset_getarr( $type_constraint, 'domain', Toolset_Element_Domain::POSTS );
465
+ if( Toolset_Element_Domain::POSTS !== $domain ) {
466
+ return array();
467
+ }
468
+
469
+ if( array_key_exists( 'type', $type_constraint ) ) {
470
+ $types = array( toolset_getarr( $type_constraint, 'type' ) );
471
+ } else {
472
+ $types = toolset_ensarr( toolset_getarr( $type_constraint, 'types' ) );
473
+ }
474
+ if( empty( $types ) ) {
475
+ continue;
476
+ }
477
+
478
+ $legacy_relationships = array_filter( $legacy_relationships, function( $relationship ) use( $role, $types ) {
479
+ switch( $role ) {
480
+ case 'any':
481
+ return ( in_array( $relationship['parent'], $types ) || in_array( $relationship['child'], $types ) );
482
+ default:
483
+ return in_array( $relationship[ $role ], $types );
484
+ }
485
+ });
486
+ }
487
+
488
+ // Format results.
489
+ return array_map( function( $relationship_identification ) {
490
+ return toolset_get_relationship( array( $relationship_identification['parent'], $relationship_identification['child'] ) );
491
+ }, $legacy_relationships );
492
+ }
493
+
494
+
495
+ /**
496
+ * Please refer to toolset_get_related_post_types() documentation in inc/public_api/m2m.php.
497
+ *
498
+ * @param string $return_role
499
+ * @param string $for_post_type
500
+ * @return array
501
+ * @since 2.6.4
502
+ */
503
+ function toolset_get_related_post_types( $return_role, $for_post_type ) {
504
+
505
+ if( ! in_array( $return_role, array( 'parent', 'child' ) ) ) {
506
+ throw new InvalidArgumentException( 'Invalid role value. Accepted values are "parent" and "child".' );
507
+ }
508
+
509
+ $other_role = ( $return_role === 'parent' ? 'child' : 'parent' );
510
+
511
+ $relationships = toolset_get_relationships(
512
+ array(
513
+ 'type_constraints' => array(
514
+ $other_role => array(
515
+ 'type' => $for_post_type
516
+ )
517
+ )
518
+ )
519
+ );
520
+
521
+ $results = array();
522
+ foreach( $relationships as $relationship ) {
523
+ $result_post_type = $relationship['roles'][ $return_role ]['types'][0];
524
+ if( ! array_key_exists( $result_post_type, $results ) ) {
525
+ $results[ $result_post_type ] = array();
526
+ }
527
+ $results[ $result_post_type ][] = array(
528
+ $relationship['roles']['parent']['types'][0],
529
+ $relationship['roles']['child']['types'][0]
530
+ );
531
+ }
532
+
533
+ return $results;
534
+ }
vendor/toolset/toolset-common/inc/public_api/m2m.php CHANGED
@@ -6,6 +6,8 @@
6
  * Note: This file is included only when m2m is active, so there's no point in checking that anymore.
7
  */
8
 
 
 
9
  /**
10
  * Query related post if many-to-many relationship functionality is enabled.
11
  *
@@ -126,7 +128,13 @@ function toolset_get_related_posts(
126
  $query = new \Toolset_Association_Query_V2();
127
 
128
  $query->add( $query->relationship_slug( $relationship ) )
129
- ->add( $query->element_id_and_domain( $element_id, \Toolset_Element_Domain::POSTS, $query_by_role ) )
 
 
 
 
 
 
130
  ->limit( $limit )
131
  ->offset( $offset )
132
  ->order( $order )
@@ -264,7 +272,13 @@ function toolset_get_related_post( $post, $relationship, $role_name_to_return =
264
  $query = new Toolset_Association_Query_V2();
265
 
266
  $results = $query->add( $query->relationship( $relationship_definition ) )
267
- ->add( $query->element_id_and_domain( $post->ID, Toolset_Element_Domain::POSTS, $role_to_return->other() ) )
 
 
 
 
 
 
268
  ->limit( 1 )
269
  ->return_element_ids( $role_to_return )
270
  ->get_results();
@@ -306,4 +320,459 @@ function toolset_get_parent_post_by_type( $post, $target_type ) {
306
  }
307
 
308
  return toolset_get_related_post( $post, array( $target_type, $post->post_type ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
309
  }
6
  * Note: This file is included only when m2m is active, so there's no point in checking that anymore.
7
  */
8
 
9
+ use \OTGS\Toolset\Common\M2M as m2m;
10
+
11
  /**
12
  * Query related post if many-to-many relationship functionality is enabled.
13
  *
128
  $query = new \Toolset_Association_Query_V2();
129
 
130
  $query->add( $query->relationship_slug( $relationship ) )
131
+ ->add(
132
+ $query->element_id_and_domain(
133
+ $element_id,
134
+ \Toolset_Element_Domain::POSTS,
135
+ $query_by_role
136
+ )
137
+ )
138
  ->limit( $limit )
139
  ->offset( $offset )
140
  ->order( $order )
272
  $query = new Toolset_Association_Query_V2();
273
 
274
  $results = $query->add( $query->relationship( $relationship_definition ) )
275
+ ->add(
276
+ $query->element_id_and_domain(
277
+ $post->ID,
278
+ Toolset_Element_Domain::POSTS,
279
+ $role_to_return->other()
280
+ )
281
+ )
282
  ->limit( 1 )
283
  ->return_element_ids( $role_to_return )
284
  ->get_results();
320
  }
321
 
322
  return toolset_get_related_post( $post, array( $target_type, $post->post_type ) );
323
+ }
324
+
325
+
326
+ /**
327
+ * Get extended information about a single relationship definition.
328
+ *
329
+ * The relationship array contains following elements:
330
+ * array(
331
+ * 'slug' (only if m2m is enabled) => Unique slug identifying the relationship.
332
+ * 'labels' (only if m2m is enabled) => array(
333
+ * 'plural' => Plural display name of the relationship.
334
+ * 'singular' => Singular display name of the relationship.
335
+ * ),
336
+ * 'roles' => array(
337
+ * 'parent' => array(
338
+ * 'domain' => Domain of parent elements. Currently, only 'posts' is supported.
339
+ * 'types' => Array of (post) types involved in a single relationship. Currently, there's always
340
+ * only a single post type, but that may change in the future.
341
+ * ),
342
+ * 'child' => Analogic to the parent role information.
343
+ * 'intermediary' (present only if m2m is enabled and if the relationship is of the many-to-many type)
344
+ * => Analogic to the parent role information. The domain is always 'posts' and there is always a single post type.
345
+ * ),
346
+ * 'cardinality' => array(
347
+ * 'type' => 'many-to-many'|'one-to-many'|'one-to-one',
348
+ * 'limits' => array(
349
+ * 'parent' => array(
350
+ * 'min' => The minimal amount of connected parent ("left side") posts for each child ("right side") post.
351
+ * Currently, this is always 0, but it may change in the future.
352
+ * 'max' => The maximal amount of connected parent posts for each child post.
353
+ * If there is no limit, it's represented by the value -1.
354
+ * ),
355
+ * 'child' => Analogic to the parent role information.
356
+ * )
357
+ * ),
358
+ * 'origin' => 'post_reference_field'|'repeatable_group'|'standard' How was the relationship created. "standard" is the standard one.
359
+ * )
360
+ *
361
+ * @param string|string[] $identification Relationship slug or a pair of post type slugs identifying a legacy relationship.
362
+ *
363
+ * @return array|null Relationship information or null if it doesn't exist.
364
+ */
365
+ function toolset_get_relationship( $identification ) {
366
+ do_action( 'toolset_do_m2m_full_init' );
367
+ $service = new m2m\PublicApiService();
368
+ $definition = null;
369
+
370
+ // gently handle invalid argument error and log it
371
+ try{
372
+ $definition = $service->get_relationship_definition( $identification );
373
+ } catch( InvalidArgumentException $exception ){
374
+ error_log( $exception->getMessage() );
375
+ return null;
376
+ }
377
+
378
+ // gently handle case if definition is null without breaking execution
379
+ if( ! $definition instanceof IToolset_Relationship_Definition ) {
380
+ return null;
381
+ }
382
+
383
+ return $service->format_relationship_definition( $definition );
384
+ }
385
+
386
+
387
+ /**
388
+ * Query relationships by provided arguments.
389
+ *
390
+ * @param array $args Query arguments. Accepted values are:
391
+ * - 'include_inactive': If this is true, also relationships which are deactivate or have unregistered post types will appear.
392
+ * - 'type_constraints': Array of constraints where each item has a role as index. Role can be 'parent', 'child', 'intermediary'
393
+ * or 'any' to match relationships where any of its roles fulfills the constrants.
394
+ * Value of the constraint is an array which may contain following elements:
395
+ * - 'domain': Name of the domain. Currently, only 'posts' are supported.
396
+ * - 'type': A single (post) type.
397
+ * - 'types': An array of (post) types. The constraint will be fulfilled if the relationship
398
+ * has one of the provided types in the given role.
399
+ * This is ignored if 'type' is provided.
400
+ * - 'origin': 'post_reference_field'|'repeatable_group'|'standard'|'any' How was the relationship created ("standard" is the standard one).
401
+ * - 'cardinality': Accepted values are 'one-to-one', 'one-to-many', 'one-to-something', 'many-to-many'
402
+ * or a string defining a specific cardinality: "{$parent_min}..{$parent_max}:{$child_min}..{$child_max}.
403
+ * Each of these values must be an integer or "*" for infinity.
404
+ *
405
+ * @return array Array of matching relationship definitions in the same format as in toolset_get_relationship().
406
+ * @since 2.6.4
407
+ */
408
+ function toolset_get_relationships( $args ) {
409
+ if( ! is_array( $args ) ) {
410
+ throw new InvalidArgumentException( 'Invalid input, expected an array of query arguments.' );
411
+ }
412
+
413
+ do_action( 'toolset_do_m2m_full_init' );
414
+
415
+ $query = new Toolset_Relationship_Query_V2();
416
+
417
+ if( true === (bool) toolset_getarr( $args, 'include_inactive' ) ) {
418
+ $query->do_not_add_default_conditions();
419
+ }
420
+
421
+ if( array_key_exists( 'type_constraints', $args ) ) {
422
+ $type_constraints = toolset_ensarr( toolset_getarr( $args, 'type_constraints' ) );
423
+ foreach( $type_constraints as $role_name => $type_query ) {
424
+
425
+ $role = ( 'any' === $role_name ? null : Toolset_Relationship_Role::role_from_name( $role_name ) );
426
+
427
+ $domain = toolset_getarr( $type_query, 'domain', Toolset_Element_Domain::POSTS );
428
+ if( $domain !== Toolset_Element_Domain::POSTS ) {
429
+ throw new InvalidArgumentException( 'Invalid element domain. Only "posts" are allowed at the moment.' );
430
+ }
431
+
432
+ if( array_key_exists( 'type', $type_query ) ) {
433
+ $types = array( toolset_getarr( $type_query, 'type' ) );
434
+ } else {
435
+ $types = toolset_ensarr( toolset_getarr( $type_query, 'types' ) );
436
+ }
437
+ if( empty( $types ) ) {
438
+ continue;
439
+ }
440
+
441
+ if( count( $types ) === 1 ) {
442
+ $query->add( $query->has_domain_and_type( array_pop( $types ), $domain, $role ) );
443
+ } else {
444
+ $query->add( $query->do_or( array_map( function( $type ) use( $domain, $role, $query ) {
445
+ return $query->has_domain_and_type( $type, $domain, $role );
446
+ }, $types ) ) );
447
+ }
448
+ }
449
+ }
450
+
451
+ $origin = toolset_getarr( $args, 'origin', 'standard' );
452
+ if( 'standard' === $origin ) {
453
+ $origin = 'wizard';
454
+ } elseif ( 'any' === $origin ) {
455
+ $origin = null;
456
+ }
457
+ $query->add( $query->origin( $origin ) );
458
+
459
+ if( array_key_exists( 'cardinality', $args ) ) {
460
+ $cardinality_query = toolset_getarr( $args, 'cardinality' );
461
+ switch( $cardinality_query ) {
462
+ case 'one-to-one':
463
+ $cardinality = $query->cardinality()->one_to_one();
464
+ break;
465
+ case 'one-to-many':
466
+ $cardinality = $query->cardinality()->one_to_many();
467
+ break;
468
+ case 'one-to-something':
469
+ $cardinality = $query->cardinality()->one_to_something();
470
+ break;
471
+ case 'many-to-many':
472
+ $cardinality = $query->cardinality()->many_to_many();
473
+ break;
474
+ default:
475
+ $cardinality = $query->cardinality()->by_cardinality(
476
+ Toolset_Relationship_Cardinality::from_string( $cardinality_query )
477
+ );
478
+ break;
479
+ }
480
+
481
+ $query->add( $query->has_cardinality( $cardinality ) );
482
+ }
483
+
484
+ $definitions = $query->get_results();
485
+
486
+ $service = new m2m\PublicApiService();
487
+ return array_map( function( $relationship_definition ) use( $service ) {
488
+ return $service->format_relationship_definition( $relationship_definition );
489
+ }, $definitions );
490
+ }
491
+
492
+
493
+ /**
494
+ * Get post types related to the provided one.
495
+ *
496
+ * @param string $return_role Role that the results have in a relationship.
497
+ * @param string $for_post_type Post type slug in the opposite role.
498
+ *
499
+ * @return string[][] An associative array where each post type has one key, and its value
500
+ * is an array of relationship slugs (in m2m) /post type pairs (in legacy implementation)
501
+ * that have matched the query.
502
+ *
503
+ * For example, if there is a relationship "appointment" between "doctor" and "patient" post types,
504
+ * toolset_get_related_post_types( 'parent', 'patient' ) will return:
505
+ * array( 'doctor' => array( 'appointment' ) )
506
+ *
507
+ * @since 2.6.4
508
+ */
509
+ function toolset_get_related_post_types( $return_role, $for_post_type ) {
510
+ do_action( 'toolset_do_m2m_full_init' );
511
+
512
+ $role = Toolset_Relationship_Role::role_from_name( $return_role );
513
+ if( ! $role instanceof IToolset_Relationship_Role_Parent_Child ) {
514
+ throw new InvalidArgumentException( 'Invalid role value. Accepted values are "parent" and "child".' );
515
+ }
516
+
517
+ $query = new Toolset_Relationship_Query_V2();
518
+ $relationships = $query->add(
519
+ $query->has_domain_and_type( $for_post_type, Toolset_Element_Domain::POSTS, $role->other() )
520
+ )->get_results();
521
+
522
+ $results = array();
523
+
524
+ foreach( $relationships as $relationship ) {
525
+ $post_types = $relationship->get_element_type( $return_role )->get_types();
526
+ foreach( $post_types as $post_type ) {
527
+ if( ! array_key_exists( $post_type, $results ) ) {
528
+ $results[ $post_type ] = array();
529
+ }
530
+ $results[ $post_type ][] = $relationship->get_slug();
531
+ }
532
+ }
533
+
534
+ return $results;
535
+ }
536
+
537
+ /**
538
+ * Will collect all associations of the $child_id and return as a array of relationships and associations
539
+ * These list can be used to export associations as postmeta.
540
+ *
541
+ * @param $child_id
542
+ *
543
+ * @return false|array
544
+ * false if child_id could not be found
545
+ * array empty if no associations there
546
+ *
547
+ * example of response with associations (meta_key => meta_value)
548
+ * '_toolset_associations_%relationship_1_slug%' => "%association_1_parent_guid% + %association_1_intermediary_guid%, %association_2_parent_guid% + %association_2_intermediary_guid%, ..."
549
+ * '_toolset_associations_%relationship_2_slug%' => "%association_1_parent_guid%, %association_2_parent_guid%, ..."
550
+ * '_toolset_associations_%relationship_3_slug%' => "%association_1_parent_guid%, %association_2_parent_guid%, ..."
551
+ *
552
+ * @throws Toolset_Element_Exception_Element_Doesnt_Exist
553
+ */
554
+ function toolset_export_associations_of_child( $child_id ) {
555
+ if ( ! $child_post = get_post( $child_id ) ) {
556
+ return false;
557
+ }
558
+
559
+ do_action( 'toolset_do_m2m_full_init' );
560
+
561
+ /** @var Toolset_Element_Factory $toolset_element_factory */
562
+ $toolset_element_factory = Toolset_Singleton_Factory::get( 'Toolset_Element_Factory' );
563
+
564
+ try {
565
+ $child_element = $toolset_element_factory->get_post( $child_post );
566
+ } catch ( Toolset_Element_Exception_Element_Doesnt_Exist $e ) {
567
+ // element could not be found
568
+ return false;
569
+ }
570
+
571
+ /** @var \OTGS\Toolset\Common\M2M\Association\Repository $association_repository */
572
+ $association_repository = Toolset_Singleton_Factory::get( '\OTGS\Toolset\Common\M2M\Association\Repository',
573
+ Toolset_Singleton_Factory::get( 'Toolset_Relationship_Query_Factory' ),
574
+ Toolset_Singleton_Factory::get( 'Toolset_Relationship_Role_Parent' ),
575
+ Toolset_Singleton_Factory::get( 'Toolset_Relationship_Role_Child' ),
576
+ Toolset_Singleton_Factory::get( 'Toolset_Relationship_Role_Intermediary' ),
577
+ Toolset_Singleton_Factory::get( 'Toolset_Element_Domain' )
578
+ );
579
+
580
+ $association_repository->addAssociationsByChild( $child_element );
581
+
582
+ /** @var \OTGS\Toolset\Types\Post\Export\Associations $export_associations */
583
+ $export_associations = Toolset_Singleton_Factory::get( '\OTGS\Toolset\Types\Post\Export\Associations',
584
+ $association_repository,
585
+ Toolset_Singleton_Factory::get( '\OTGS\Toolset\Types\Post\Meta\Associations' )
586
+ );
587
+
588
+ return $export_associations->getExportArray( $child_element );
589
+ }
590
+
591
+
592
+ /**
593
+ * Will search for associations in meta of $child_id and import them.
594
+ * To make sure the data is correctly formated use toolset_export_associations_of_child to export data.
595
+ *
596
+ * @param $child_id
597
+ *
598
+ * @return array|false
599
+ * false if child_id could not be found
600
+ * 'success' => array of succesfully imported associations
601
+ * 'error' => array of associations which could not be imported
602
+ *
603
+ * @throws Toolset_Element_Exception_Element_Doesnt_Exist
604
+ */
605
+ function toolset_import_associations_of_child( $child_id ) {
606
+ if ( ! $child_post = get_post( $child_id ) ) {
607
+ return false;
608
+ }
609
+
610
+ do_action( 'toolset_do_m2m_full_init' );
611
+ global $wpdb;
612
+
613
+ $association_repository = Toolset_Singleton_Factory::get( '\OTGS\Toolset\Common\M2M\Association\Repository',
614
+ Toolset_Singleton_Factory::get( 'Toolset_Relationship_Query_Factory' ),
615
+ Toolset_Singleton_Factory::get( 'Toolset_Relationship_Role_Parent' ),
616
+ Toolset_Singleton_Factory::get( 'Toolset_Relationship_Role_Child' ),
617
+ Toolset_Singleton_Factory::get( 'Toolset_Relationship_Role_Intermediary' ),
618
+ Toolset_Singleton_Factory::get( 'Toolset_Element_Domain' )
619
+ );
620
+
621
+ /** @var \OTGS\Toolset\Types\Post\Import\Associations $import_associations */
622
+ $import_associations = Toolset_Singleton_Factory::get( '\OTGS\Toolset\Types\Post\Import\Associations',
623
+ Toolset_Singleton_Factory::get( '\OTGS\Toolset\Types\Post\Meta\Associations' ),
624
+ Toolset_Singleton_Factory::get( '\OTGS\Toolset\Types\Wordpress\Post\Storage', $wpdb ),
625
+ Toolset_Singleton_Factory::get( '\OTGS\Toolset\Types\Wordpress\Postmeta\Storage', $wpdb ),
626
+ Toolset_Relationship_Definition_Repository::get_instance(),
627
+ $association_repository,
628
+ Toolset_Singleton_Factory::get( '\OTGS\Toolset\Types\Post\Import\Association\Factory' )
629
+ );
630
+
631
+ // as we use singeleton factory, make sure we start with a clean set of associations
632
+ $import_associations->resetAssociations();
633
+
634
+ // load all associations by child
635
+ $import_associations->loadAssociationsByChildPost( $child_post );
636
+
637
+ return $import_associations->importAssociations( true, false );
638
+ }
639
+
640
+
641
+ /**
642
+ * Connect two posts in a given relationship.
643
+ *
644
+ * @param string|string[] $relationship Slug of the relationship to query by or an array with the parent and the child post type.
645
+ * The array variant can be used only to identify relationships that have been migrated from the legacy implementation.
646
+ * @param int|WP_Post $parent Parent post to connect.
647
+ * @param int|WP_Post $child Child post to connect.
648
+ *
649
+ * @return array
650
+ * - (bool) 'success': Always present.
651
+ * - (string) 'message': A message describing the result. May not be always present.
652
+ * - (int) 'intermediary_post': Present only if the operation has succeeded. ID of the newly created intermediary post
653
+ * or zero if there is none.
654
+ *
655
+ * @since 2.7
656
+ */
657
+ function toolset_connect_posts( $relationship, $parent, $child ) {
658
+
659
+ do_action( 'toolset_do_m2m_full_init' );
660
+
661
+ if( ! is_string( $relationship ) && ! ( is_array( $relationship ) && count( $relationship ) === 2 ) ) {
662
+ throw new InvalidArgumentException( 'The relationship must be a string with the relationship slug or an array with two post types.' );
663
+ }
664
+
665
+ if( ! Toolset_Utils::is_natural_numeric( $parent ) && ! $parent instanceof WP_Post ) {
666
+ throw new InvalidArgumentException( 'The parent must be a post ID or a WP_Post instance.' );
667
+ }
668
+
669
+ if( ! Toolset_Utils::is_natural_numeric( $child ) && ! $child instanceof WP_Post ) {
670
+ throw new InvalidArgumentException( 'The child must be a post ID or a WP_Post instance.' );
671
+ }
672
+
673
+ if( is_array( $relationship ) && count( $relationship ) === 2 ) {
674
+ $relationship_definition = Toolset_Relationship_Definition_Repository::get_instance()->get_legacy_definition( $relationship[0], $relationship[1] );
675
+ } else {
676
+ $relationship_definition = Toolset_Relationship_Definition_Repository::get_instance()->get_definition( $relationship );
677
+ }
678
+
679
+ if( null === $relationship_definition ) {
680
+ return array(
681
+ 'success' => false,
682
+ 'message' => "The relationship doesn't exist."
683
+ );
684
+ }
685
+
686
+ $result = $relationship_definition->create_association( $parent, $child );
687
+ if( $result instanceof Toolset_Result ) {
688
+ return array(
689
+ 'success' => false,
690
+ 'message' => $result->get_message()
691
+ );
692
+ }
693
+
694
+ return array(
695
+ 'success' => true,
696
+ 'intermediary_post' => $result->get_intermediary_id()
697
+ );
698
+ }
699
+
700
+
701
+ /**
702
+ * Disconnect two posts in a given relationship.
703
+ *
704
+ * Note: When we introduce non-distinct relationships in the future, the behaviour of this function might change for them.
705
+ * Keep that in mind.
706
+ *
707
+ * @param string|string[] $relationship Slug of the relationship to query by or an array with the parent and the child post type.
708
+ * The array variant can be used only to identify relationships that have been migrated from the legacy implementation.
709
+ * @param int|WP_Post $parent Parent post to connect.
710
+ * @param int|WP_Post $child Child post to connect.
711
+ *
712
+ * @return array
713
+ * - (bool) 'success': Always present.
714
+ * - (string) 'message': A message describing the result. May not be always present.
715
+ *
716
+ * @since 2.7
717
+ */
718
+ function toolset_disconnect_posts( $relationship, $parent, $child ) {
719
+
720
+ do_action( 'toolset_do_m2m_full_init' );
721
+
722
+ if( ! is_string( $relationship ) && ! ( is_array( $relationship ) && count( $relationship ) === 2 ) ) {
723
+ throw new InvalidArgumentException( 'The relationship must be a string with the relationship slug or an array with two post types.' );
724
+ }
725
+
726
+ if( ! Toolset_Utils::is_natural_numeric( $parent ) && ! $parent instanceof WP_Post ) {
727
+ throw new InvalidArgumentException( 'The parent must be a post ID or a WP_Post instance.' );
728
+ }
729
+
730
+ if( ! Toolset_Utils::is_natural_numeric( $child ) && ! $child instanceof WP_Post ) {
731
+ throw new InvalidArgumentException( 'The child must be a post ID or a WP_Post instance.' );
732
+ }
733
+
734
+ if( is_array( $relationship ) && count( $relationship ) === 2 ) {
735
+ $relationship_definition = Toolset_Relationship_Definition_Repository::get_instance()->get_legacy_definition( $relationship[0], $relationship[1] );
736
+ } else {
737
+ $relationship_definition = Toolset_Relationship_Definition_Repository::get_instance()->get_definition( $relationship );
738
+ }
739
+
740
+ if( null === $relationship_definition ) {
741
+ return array(
742
+ 'success' => false,
743
+ 'message' => "The relationship doesn't exist."
744
+ );
745
+ }
746
+
747
+ $query = new Toolset_Association_Query_V2();
748
+ $results = $query->add( $query->relationship( $relationship_definition ) )
749
+ ->add( $query->parent_id( $parent ) )
750
+ ->add( $query->child_id( $child ) )
751
+ ->limit( 1 )
752
+ ->do_not_add_default_conditions()
753
+ ->return_association_instances()
754
+ ->get_results();
755
+
756
+ if( empty( $results ) ) {
757
+ return array(
758
+ 'success' => false,
759
+ 'message' => __( 'There is no association between the two given posts that can be deleted', 'wpcf' )
760
+ );
761
+ }
762
+
763
+ $association = array_pop( $results );
764
+
765
+ $association_persistence = new Toolset_Association_Persistence();
766
+ $result = $association_persistence->delete_association( $association );
767
+
768
+ if( $result->is_error() ) {
769
+ return array(
770
+ 'success' => false,
771
+ 'message' => $result->get_message(),
772
+ );
773
+ }
774
+
775
+ return array(
776
+ 'success' => true
777
+ );
778
  }
vendor/toolset/toolset-common/inc/toolset.ajax.class.php CHANGED
@@ -74,6 +74,8 @@ class Toolset_Ajax {
74
 
75
  const CALLBACK_SELECT2_SUGGEST_POSTS_BY_TITLE = 'select2_suggest_posts_by_title';
76
 
 
 
77
  const CALLBACK_SELECT2_SUGGEST_TERMS = 'select2_suggest_terms';
78
 
79
  const CALLBACK_SELECT2_SUGGEST_USERS = 'select2_suggest_users';
@@ -102,6 +104,7 @@ class Toolset_Ajax {
102
 
103
  protected function get_public_callback_names() {
104
  return array(
 
105
  self::CALLBACK_SELECT2_SUGGEST_POSTS_BY_TITLE,
106
  self::CALLBACK_SELECT2_SUGGEST_TERMS,
107
  self::CALLBACK_SELECT2_SUGGEST_USERS,
@@ -222,7 +225,7 @@ class Toolset_Ajax {
222
  unset( $name_parts[0] );
223
  $class_name = implode( self::DELIMITER, $name_parts );
224
  $class_name = strtolower( $class_name );
225
- $class_name = mb_convert_case( $class_name, MB_CASE_TITLE );
226
  $class_name = $this->get_handler_class_prefix() . $class_name;
227
 
228
  // Obtain an instance of the handler class.
74
 
75
  const CALLBACK_SELECT2_SUGGEST_POSTS_BY_TITLE = 'select2_suggest_posts_by_title';
76
 
77
+ const CALLBACK_SELECT2_SUGGEST_POSTS_BY_POST_TYPE = 'select2_suggest_posts_by_post_type';
78
+
79
  const CALLBACK_SELECT2_SUGGEST_TERMS = 'select2_suggest_terms';
80
 
81
  const CALLBACK_SELECT2_SUGGEST_USERS = 'select2_suggest_users';
104
 
105
  protected function get_public_callback_names() {
106
  return array(
107
+ self::CALLBACK_SELECT2_SUGGEST_POSTS_BY_POST_TYPE,
108
  self::CALLBACK_SELECT2_SUGGEST_POSTS_BY_TITLE,
109
  self::CALLBACK_SELECT2_SUGGEST_TERMS,
110
  self::CALLBACK_SELECT2_SUGGEST_USERS,
225
  unset( $name_parts[0] );
226
  $class_name = implode( self::DELIMITER, $name_parts );
227
  $class_name = strtolower( $class_name );
228
+ $class_name = Toolset_Utils::resolve_callback_class_name( $class_name );
229
  $class_name = $this->get_handler_class_prefix() . $class_name;
230
 
231
  // Obtain an instance of the handler class.
vendor/toolset/toolset-common/inc/toolset.assets.manager.class.php CHANGED
@@ -263,6 +263,9 @@ class Toolset_Assets_Manager {
263
  */
264
  protected $assets_url = '';
265
 
 
 
 
266
 
267
  protected function __construct() {
268
 
@@ -289,22 +292,22 @@ class Toolset_Assets_Manager {
289
  add_action( 'toolset_localize_script', array( $this, 'localize_script' ), 10, 3 );
290
  }
291
 
 
292
 
293
  /**
294
  * @return Toolset_Assets_Manager
295
  * @deprecated Use get_instance instead().
296
  */
297
  final public static function getInstance() {
298
- static $instances = array();
299
  $called_class = get_called_class();
300
 
301
- if ( isset( $instances[ $called_class ] ) ) {
302
- return $instances[ $called_class ];
303
  } else {
304
  if ( class_exists( $called_class ) ) {
305
- $instances[ $called_class ] = new $called_class();
306
 
307
- return $instances[ $called_class ];
308
  } else {
309
  // This can unfortunately happen when the get_called_class() workaround for PHP 5.2 misbehaves.
310
  return false;
@@ -320,17 +323,44 @@ class Toolset_Assets_Manager {
320
  */
321
  public static function get_instance() {
322
  if( null === self::$instance ) {
323
- self::$instance = new self();
 
 
 
 
 
 
 
 
 
324
  }
325
 
326
  return self::$instance;
327
  }
328
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
329
 
330
 
331
  public function init() {
332
- $this->__initialize_styles();
333
- $this->__initialize_scripts();
334
  }
335
 
336
 
@@ -369,7 +399,27 @@ class Toolset_Assets_Manager {
369
  }
370
 
371
 
372
- protected function __initialize_styles() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
373
 
374
  // Libraries
375
  //
@@ -527,7 +577,27 @@ class Toolset_Assets_Manager {
527
  }
528
 
529
 
530
- protected function __initialize_scripts() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
531
 
532
  // Libraries
533
  //
@@ -840,8 +910,9 @@ class Toolset_Assets_Manager {
840
  self::SCRIPT_TOOLSET_SHORTCODE,
841
  $this->assets_url . "/res/js/toolset-shortcode.js",
842
  array(
843
- 'jquery', 'jquery-ui-dialog', 'jquery-ui-tabs', 'suggest', 'shortcode', 'underscore', 'wp-util',
844
- self::SCRIPT_SELECT2, self::SCRIPT_ICL_EDITOR, self::SCRIPT_UTILS, self::SCRIPT_TOOLSET_EVENT_MANAGER ),
 
845
  TOOLSET_COMMON_VERSION,
846
  true
847
  );
263
  */
264
  protected $assets_url = '';
265
 
266
+ private $did_initialize_scripts = false;
267
+ private $did_initialize_styles = false;
268
+
269
 
270
  protected function __construct() {
271
 
292
  add_action( 'toolset_localize_script', array( $this, 'localize_script' ), 10, 3 );
293
  }
294
 
295
+ private static $instances = array();
296
 
297
  /**
298
  * @return Toolset_Assets_Manager
299
  * @deprecated Use get_instance instead().
300
  */
301
  final public static function getInstance() {
 
302
  $called_class = get_called_class();
303
 
304
+ if ( isset( self::$instances[ $called_class ] ) ) {
305
+ return self::$instances[ $called_class ];
306
  } else {
307
  if ( class_exists( $called_class ) ) {
308
+ self::$instances[ $called_class ] = new $called_class();
309
 
310
+ return self::$instances[ $called_class ];
311
  } else {
312
  // This can unfortunately happen when the get_called_class() workaround for PHP 5.2 misbehaves.
313
  return false;
323
  */
324
  public static function get_instance() {
325
  if( null === self::$instance ) {
326
+ $called_class = get_called_class();
327
+ if( $called_class === 'Toolset_Assets_Manager' && isset( self::$instances[ $called_class ] ) ) {
328
+ // Make sure that we don't re-instantiate the Toolset_Assets_Manager class even if it was instantiated
329
+ // before through the legacy getInstance() method.
330
+ //
331
+ // @refactoring Stop subclassing Toolset_Assets_Manager
332
+ self::$instance = self::$instances[ $called_class ];
333
+ } else {
334
+ self::$instance = new self();
335
+ }
336
  }
337
 
338
  return self::$instance;
339
  }
340
 
341
+ /**
342
+ * Backward compatibility
343
+ * For PHP 7 we renamed the method __initialize_styles() and __initialize_scripts() to initialize_styles() and initialize_scripts().
344
+ * As both are public methods we apply this fallback for the case someone calls the old methods.
345
+ *
346
+ * @param $method
347
+ * @param $arguments
348
+ */
349
+ public function __call( $method, $arguments ) {
350
+ switch( $method ) {
351
+ case '__initialize_styles':
352
+ $this->initialize_styles();
353
+ break;
354
+ case '__initialize_scripts':
355
+ $this->initialize_scripts();
356
+ break;
357
+ }
358
+ }
359
 
360
 
361
  public function init() {
362
+ $this->initialize_styles();
363
+ $this->initialize_scripts();
364
  }
365
 
366
 
399
  }
400
 
401
 
402
+ protected function initialize_styles() {
403
+
404
+ // Prevent an infinite recursion in case we have a subclass of this that has:
405
+ //
406
+ // function __initialize_styles() {
407
+ // // ...
408
+ // return parent::__initialize_styles();
409
+ // }
410
+ if( $this->did_initialize_styles ) {
411
+ return null;
412
+ }
413
+ $this->did_initialize_styles = true;
414
+
415
+ if( method_exists( $this, '__initialize_styles' ) ) {
416
+ // Support for subclasses overwriting the previous __initialize_styles function.
417
+ //
418
+ // This will cause the common assets never to be registered in these subclasses,
419
+ // but we don't mind - these assets are already registered by Toolset_Assets_Manager
420
+ // on every request.
421
+ return $this->__initialize_styles();
422
+ }
423
 
424
  // Libraries
425
  //
577
  }
578
 
579
 
580
+ protected function initialize_scripts() {
581
+
582
+ // Prevent an infinite recursion in case we have a subclass of this that has:
583
+ //
584
+ // function __initialize_scripts() {
585
+ // // ...
586
+ // return parent::__initialize_scripts();
587
+ // }
588
+ if( $this->did_initialize_scripts ) {
589
+ return null;
590
+ }
591
+ $this->did_initialize_scripts = true;
592
+
593
+ if( method_exists( $this, '__initialize_scripts' ) ) {
594
+ // Support for subclasses overwriting the previous __initialize_scripts function.
595
+ //
596
+ // This will cause the common assets never to be registered in these subclasses,
597
+ // but we don't mind - these assets are already registered by Toolset_Assets_Manager
598
+ // on every request.
599
+ return $this->__initialize_scripts();
600
+ }
601
 
602
  // Libraries
603
  //
910
  self::SCRIPT_TOOLSET_SHORTCODE,
911
  $this->assets_url . "/res/js/toolset-shortcode.js",
912
  array(
913
+ 'jquery', 'jquery-ui-dialog', 'jquery-ui-tabs', 'suggest', 'shortcode', 'underscore', 'wp-util', 'wp-pointer',
914
+ self::SCRIPT_SELECT2, self::SCRIPT_ICL_EDITOR, self::SCRIPT_UTILS, self::SCRIPT_TOOLSET_EVENT_MANAGER
915
+ ),
916
  TOOLSET_COMMON_VERSION,
917
  true
918
  );
vendor/toolset/toolset-common/inc/toolset.css.component.class.php CHANGED
@@ -709,7 +709,7 @@ if ( ! class_exists( 'Toolset_CssComponent' ) ) {
709
  <div class="toolset-bs-components-dialog-sides-bottom">
710
  <hr>
711
  <p class="toolset-bs-button-p">
712
- <a href="<?php _e('https://wp-types.com/user-guides/using-bootstrap-css-elements-content?utm_source=layoutsplugin&utm_campaign=layouts&utm_medium=bootstrap-components&utm_term=help-link','ddl-layouts');?>" target="_blank"><?php _e('Learn how to use Bootstrap in layouts','ddl-layouts');?></a>
713
  </p>
714
  </div>
715
  </div>
709
  <div class="toolset-bs-components-dialog-sides-bottom">
710
  <hr>
711
  <p class="toolset-bs-button-p">
712
+ <a href="<?php _e('https://toolset.com/user-guides/using-bootstrap-css-elements-content?utm_source=layoutsplugin&utm_campaign=layouts&utm_medium=bootstrap-components&utm_term=help-link','ddl-layouts');?>" target="_blank"><?php _e('Learn how to use Bootstrap in layouts','ddl-layouts');?></a>
713
  </p>
714
  </div>
715
  </div>
vendor/toolset/toolset-common/inc/toolset.internal.compatibility.class.php CHANGED
@@ -1,11 +1,9 @@
1
  <?php
2
 
3
  /**
4
- * ########################################
5
  * Common internal compatibility
6
  *
7
  * @since 2.3.0
8
- * ########################################
9
  */
10
 
11
  if ( ! class_exists( 'Toolset_Internal_Compatibility' ) ) {
1
  <?php
2
 
3
  /**
 
4
  * Common internal compatibility
5
  *
6
  * @since 2.3.0
 
7
  */
8
 
9
  if ( ! class_exists( 'Toolset_Internal_Compatibility' ) ) {
vendor/toolset/toolset-common/inc/toolset.menu.class.php CHANGED
@@ -163,7 +163,7 @@ if ( ! class_exists( 'Toolset_Menu', false ) ) {
163
  <ul>
164
  <li>
165
  <?php printf(
166
- '<a target="_blank" href="http://wp-types.com/documentation/user-guides/"><strong>%s</strong></a>'.__( ' - everything you need to know about using Toolset', 'wpv-views' ),
167
  __( 'User Guides', 'wpv-views')
168
  ); ?>
169
  </li>
@@ -175,7 +175,7 @@ if ( ! class_exists( 'Toolset_Menu', false ) ) {
175
  </li>
176
  <li>
177
  <?php printf(
178
- '<a target="_blank" href="http://wp-types.com/forums/forum/support-2/"><strong>%s</strong></a>'.__( ' - online help by support staff', 'wpv-views' ),
179
  __( 'Support forum', 'wpv-views' )
180
  ); ?>
181
  </li>
163
  <ul>
164
  <li>
165
  <?php printf(
166
+ '<a target="_blank" href="https://toolset.com/documentation/user-guides/"><strong>%s</strong></a>'.__( ' - everything you need to know about using Toolset', 'wpv-views' ),
167
  __( 'User Guides', 'wpv-views')
168
  ); ?>
169
  </li>
175
  </li>
176
  <li>
177
  <?php printf(
178
+ '<a target="_blank" href="https://toolset.com/forums/forum/support-2/"><strong>%s</strong></a>'.__( ' - online help by support staff', 'wpv-views' ),
179
  __( 'Support forum', 'wpv-views' )
180
  ); ?>
181
  </li>
vendor/toolset/toolset-common/inc/toolset.object.relationship.class.php CHANGED
@@ -66,6 +66,11 @@ if ( ! class_exists( 'Toolset_Object_Relationship', false ) ) {
66
  return;
67
  }
68
 
 
 
 
 
 
69
  $this->post_relationship_depth = ( $this->post_relationship_depth + 1 );
70
 
71
  if (
66
  return;
67
  }
68
 
69
+ // In empty WPAs, we fake a loop with a faked post with no post type
70
+ if ( empty( $post_object->post_type ) ) {
71
+ return;
72
+ }
73
+
74
  $this->post_relationship_depth = ( $this->post_relationship_depth + 1 );
75
 
76
  if (
vendor/toolset/toolset-common/inc/toolset.promotion.class.php CHANGED
@@ -87,8 +87,8 @@ if ( ! class_exists( 'Toolset_Promotion', false ) ) {
87
  $link_button_args = array(
88
  'hash' => 'buy-toolset'
89
  );
90
- $link_learn = $this->get_affiliate_promotional_link( 'http://wp-types.com/' );
91
- $link_button = $this->get_affiliate_promotional_link( 'http://wp-types.com/', $link_button_args );
92
 
93
  ob_start();
94
  ?>
87
  $link_button_args = array(
88
  'hash' => 'buy-toolset'
89
  );
90
+ $link_learn = $this->get_affiliate_promotional_link( 'https://toolset.com/' );
91
+ $link_button = $this->get_affiliate_promotional_link( 'https://toolset.com/', $link_button_args );
92
 
93
  ob_start();
94
  ?>
vendor/toolset/toolset-common/inc/toolset.relevanssi.compatibility.class.php CHANGED
@@ -127,7 +127,7 @@ if ( ! class_exists( 'Toolset_Relevanssi_Compatibility' ) ) {
127
  function toolset_relevanssi_settings( $sections, $toolset_options ) {
128
 
129
  $section_content = '';
130
- $text_search_documentation_link = 'https://wp-types.com/documentation/user-guides/filtering-views-for-a-specific-text-string-search/?utm_source=viewsplugin&utm_campaign=views&utm_medium=views-text-search-settings&utm_term=Text Search documentation';
131
 
132
 
133
  if ( ! $this->relevanssi_installed ) {
127
  function toolset_relevanssi_settings( $sections, $toolset_options ) {
128
 
129
  $section_content = '';
130
+ $text_search_documentation_link = 'https://toolset.com/documentation/user-guides/filtering-views-for-a-specific-text-string-search/?utm_source=viewsplugin&utm_campaign=views&utm_medium=views-text-search-settings&utm_term=Text Search documentation';
131
 
132
 
133
  if ( ! $this->relevanssi_installed ) {
vendor/toolset/toolset-common/inc/toolset.settings.screen.class.php CHANGED
@@ -309,7 +309,7 @@ if ( ! class_exists( 'Toolset_Settings_Screen', false ) ) {
309
  <?php
310
  echo sprintf(
311
  __( 'Get more details in the <a href="%1$s" title="%2$s">documentation page</a>.', 'wpv-views' ),
312
- 'https://wp-types.com/documentation/user-guides/view-layouts-101/' ,
313
  esc_attr( __( 'Documentation on the Bootstrap Layouts', 'wpv-views' ) )
314
  );
315
  ?>
309
  <?php
310
  echo sprintf(
311
  __( 'Get more details in the <a href="%1$s" title="%2$s">documentation page</a>.', 'wpv-views' ),
312
+ 'https://toolset.com/documentation/user-guides/view-layouts-101/' ,
313
  esc_attr( __( 'Documentation on the Bootstrap Layouts', 'wpv-views' ) )
314
  );
315
  ?>
vendor/toolset/toolset-common/inc/toolset.shortcode.generator.class.php CHANGED
@@ -27,27 +27,27 @@
27
  *
28
  * @since 1.9
29
  */
30
-
31
  abstract class Toolset_Shortcode_Generator {
32
 
33
  private static $registered_admin_bar_items = array();
34
  private static $can_show_admin_bar_item = false;
35
  private static $target_dialog_added = false;
36
-
37
  function __construct() {
38
  add_action( 'init', array( $this, 'register_shortcode_transformer' ) );
39
-
40
  add_action( 'admin_init', array( $this, 'register_shortcodes_admin_bar_items' ), 99 );
41
  add_action( 'admin_bar_menu', array( $this, 'display_shortcodes_admin_bar_items' ), 99 );
42
  add_action( 'admin_footer', array( $this, 'display_shortcodes_target_dialog' ) );
43
-
44
  add_action( 'toolset_action_require_shortcodes_templates', array( $this, 'print_shortcodes_templates' ) );
45
-
46
  add_filter( 'toolset_filter_shortcode_script_i18n', array( $this, 'extend_script_i18n' ) );
47
  }
48
-
49
  public function register_shortcodes_admin_bar_items() {
50
-
51
  // Only register sections if the Admin Bar item is to be shown.
52
  $toolset_settings = Toolset_Settings::get_instance();
53
  $toolset_shortcodes_generator = ( isset( $toolset_settings['shortcodes_generator'] ) && in_array( $toolset_settings['shortcodes_generator'], array( 'unset', 'disable', 'editor', 'always' ) ) ) ? $toolset_settings['shortcodes_generator'] : 'unset';
@@ -76,18 +76,18 @@ abstract class Toolset_Shortcode_Generator {
76
  * @param bool $register_section Whether the Toolset Shortcodes menu on the admin bar should be forcibly shown or hidden.
77
  */
78
  $register_section = apply_filters( 'toolset_filter_force_shortcode_generator_display', $register_section );
79
-
80
  if ( ! $register_section ) {
81
  return;
82
  }
83
-
84
  // Now that we know that it will be shown, collect the registered items.
85
  $registered_items = self::$registered_admin_bar_items;
86
  $registered_items = apply_filters( 'toolset_shortcode_generator_register_item', $registered_items );
87
  self::$registered_admin_bar_items = $registered_items;
88
-
89
  }
90
-
91
  /**
92
  * Add admin bar main item for shortcodes
93
  */
@@ -105,7 +105,7 @@ abstract class Toolset_Shortcode_Generator {
105
  $this->create_admin_bar_item( $wp_admin_bar, $item_args['id'], $item_args['title'], $item_args['href'], $item_args['parent'], $item_args['meta'] );
106
  }
107
  }
108
-
109
  /**
110
  * General function for creating admin bar menu items
111
  */
@@ -119,35 +119,35 @@ abstract class Toolset_Shortcode_Generator {
119
  );
120
  $wp_admin_bar->add_node( $args );
121
  }
122
-
123
  /**
124
- * Helper method to check whether we are on an admin editor page.
125
- * This covers edit pages for posts, terms and users,
126
  * as well as Toolset object edit pages.
127
  *
128
  * @since 2.3.0
129
  */
130
-
131
  public function is_admin_editor_page() {
132
  if ( ! is_admin() ) {
133
  return false;
134
  }
135
  global $pagenow, $wp_version;
136
- $allowed_pagenow_array = array( 'post.php', 'post-new.php', 'term.php', 'user-new.php', 'user-edit.php', 'profile.php' );
137
  $allowed_page_array = array( 'views-editor', 'ct-editor', 'view-archives-editor', 'dd_layouts_edit' );
138
  // @todo maybe add a filter here for future Toolset admin pages...
139
  if (
140
- in_array( $pagenow, $allowed_pagenow_array )
141
  || (
142
- $pagenow == 'admin.php'
143
- && isset( $_GET['page'] )
144
  && in_array( $_GET['page'], $allowed_page_array )
145
  )
146
  || (
147
  // In WordPress < 4.5, the edit tag admin page is edit-tags.php?action=edit&taxonomy=category&tag_ID=X
148
- version_compare( $wp_version, '4.5', '<' )
149
- && $pagenow == 'edit-tags.php'
150
- && isset( $_GET['action'] )
151
  && $_GET['action'] == 'edit'
152
  )
153
  ) {
@@ -155,14 +155,14 @@ abstract class Toolset_Shortcode_Generator {
155
  }
156
  return false;
157
  }
158
-
159
  /**
160
- * Helper method to check whether we are on an frontend editor page.
161
  * This should cover as many frontend editors as possible.
162
  *
163
  * @since 2.3.0
164
  */
165
-
166
  public function is_frontend_editor_page() {
167
  if ( is_admin() ) {
168
  return false;
@@ -171,21 +171,21 @@ abstract class Toolset_Shortcode_Generator {
171
  // Layouts frontend editor
172
  isset( $_GET['toolset_editor'] )
173
  // Beaver Builder frontend editor
174
- || isset( $_GET['fl_builder'] )
175
  // CRED frontend editor pages, when discoverable
176
  ) {
177
  return true;
178
  }
179
  return false;
180
  }
181
-
182
  /*
183
  * Dialog Template HTML code
184
  */
185
  public function display_shortcodes_target_dialog() {
186
- if (
187
  self::$can_show_admin_bar_item
188
- && self::$target_dialog_added === false
189
  ) {
190
  ?>
191
  <div class="toolset-dialog-container" style="display:none">
@@ -200,11 +200,11 @@ abstract class Toolset_Shortcode_Generator {
200
  </div>
201
  </div>
202
  <?php
203
- self::$target_dialog_added = true;
204
  }
205
 
206
  }
207
-
208
  /**
209
  * Generate the shared Toolset shortcode GUI templates.
210
  *
@@ -213,11 +213,11 @@ abstract class Toolset_Shortcode_Generator {
213
  * @todo The post and user selector templates are used exclusively by CRED: move to CRED and rename
214
  */
215
  public function print_shortcodes_templates() {
216
-
217
  if ( did_action( 'toolset_action_require_shortcodes_templates_done' ) ) {
218
  return;
219
  }
220
-
221
  ?>
222
  <script type="text/html" id="tmpl-toolset-shortcode-gui">
223
  <input value="{{{data.shortcode}}}" class="toolset-shortcode-gui-shortcode-handle js-toolset-shortcode-gui-shortcode-handle" type="hidden" />
@@ -235,8 +235,8 @@ abstract class Toolset_Shortcode_Generator {
235
  <ul class="js-toolset-shortcode-gui-tabs-list">
236
  <# _.each( data.attributes, function( attributesGroup, groupKey ) { #>
237
  <# if (
238
- _.has( attributesGroup, 'fields' )
239
- && _.size( attributesGroup.fields ) > 0
240
  ) { #>
241
  <li>
242
  <a href="#{{{data.shortcode}}}-{{{groupKey}}}">{{{attributesGroup.header}}}</a>
@@ -247,12 +247,12 @@ abstract class Toolset_Shortcode_Generator {
247
  <# } #>
248
  <# _.each( data.attributes, function( attributesGroup, groupKey ) { #>
249
  <# if (
250
- _.has( attributesGroup, 'fields' )
251
- && _.size( attributesGroup.fields ) > 0
252
  ) { #>
253
  <div id="{{{data.shortcode}}}-{{{groupKey}}}">
254
  <h2>{{{attributesGroup.header}}}</h2>
255
- <# _.each( attributesGroup.fields, function( attributeData, attributeKey ) {
256
  if ( _.has( data.templates, 'attributeWrapper' ) ) {
257
  attributeData = _.extend( { shortcode: data.shortcode, attribute: attributeKey, templates: data.templates }, attributeData );
258
  if ( 'group' == attributeData.type ) {
@@ -269,9 +269,9 @@ abstract class Toolset_Shortcode_Generator {
269
  <div class="toolset-shortcode-gui-messages js-toolset-shortcode-gui-messages"></div>
270
  </script>
271
  <script type="text/html" id="tmpl-toolset-shortcode-attribute-wrapper">
272
- <#
273
- data = _.defaults( data, { defaultValue: '', required: false, hidden: false, placeholder: '' } );
274
- data = _.defaults( data, { defaultForceValue: data.defaultValue } );
275
  #>
276
  <div class="toolset-shortcode-gui-attribute-wrapper js-toolset-shortcode-gui-attribute-wrapper js-toolset-shortcode-gui-attribute-wrapper-for-{{{data.attribute}}}" data-attribute="{{{data.attribute}}}" data-type="{{{data.type}}}" data-default="{{{data.defaultValue}}}"<# if ( data.hidden ) { #> style="display:none"<# } #>>
277
  <# if ( _.has( data, 'label' ) ) { #>
@@ -280,8 +280,8 @@ abstract class Toolset_Shortcode_Generator {
280
  <# if ( _.has( data, 'pseudolabel' ) ) { #>
281
  <strong>{{{data.pseudolabel}}}</strong>
282
  <# } #>
283
- <# if (
284
- _.has( data.templates, 'attributes' )
285
  && _.has( data.templates.attributes, data.type )
286
  ) {
287
  print( data.templates.attributes[ data.type ]( data ) );
@@ -351,30 +351,30 @@ abstract class Toolset_Shortcode_Generator {
351
  <select id="{{{data.shortcode}}}-{{{data.attribute}}}" class="js-shortcode-gui-field js-toolset-shortcode-gui-field-select2<# if ( data.required ) { #> js-toolset-shortcode-gui-required<# } #>">
352
  <#
353
  if ( _.has( data, 'options' ) ) {
354
- _.each( data.options, function( optionLabel, optionKey ) {
355
  #>
356
  <option value="{{{optionKey}}}"<# if ( optionKey == data.defaultForceValue ) { #> selected="selected"<# } #>>
357
  {{{optionLabel}}}
358
  </option>
359
- <#
360
  });
361
- }
362
  #>
363
  </select>
364
  </script>
365
  <script type="text/html" id="tmpl-toolset-shortcode-attribute-ajaxSelect2">
366
- <select
367
- id="{{{data.shortcode}}}-{{{data.attribute}}}"
368
- class="js-shortcode-gui-field js-toolset-shortcode-gui-field-ajax-select2<# if ( data.required ) { #> js-toolset-shortcode-gui-required<# } #>"
369
- data-action="{{{data.action}}}"
370
  data-nonce="{{{data.nonce}}}"
371
  data-placeholder="{{{data.placeholder}}}"
372
  >
373
  </select>
374
  </script>
375
-
376
  <script type="text/html" id="tmpl-toolset-shortcode-content">
377
- <#
378
  data = _.defaults( data, { defaultValue: '', required: false, hidden: false, placeholder: '' } );
379
  data = _.defaults( data, { defaultForceValue: data.defaultValue } );
380
  #>
@@ -385,9 +385,9 @@ abstract class Toolset_Shortcode_Generator {
385
  <# } #>
386
  </div>
387
  </script>
388
-
389
  <?php $toolset_ajax = Toolset_Ajax::get_instance(); ?>
390
-
391
  <script type="text/html" id="tmpl-toolset-shortcode-attribute-postSelector">
392
  <ul id="{{{data.shortcode}}}-{{{data.attribute}}}">
393
  <li class="toolset-shortcode-gui-item-selector-option">
@@ -396,33 +396,47 @@ abstract class Toolset_Shortcode_Generator {
396
  <?php _e( 'The current post being displayed either directly or in a View loop', 'wpv-views' ); ?>
397
  </label>
398
  </li>
399
-
400
  <?php
401
-
402
  global $pagenow, $post;
403
  $current_post_type = null;
404
- if (
405
- in_array( $pagenow, array( 'post.php' ) )
406
- && isset( $_GET["post"] )
407
  ) {
408
  $current_post_id = (int) $_GET["post"];
409
  $current_post_type_slug = get_post_type( $current_post_id );
410
  $current_post_type = get_post_type_object( $current_post_type_slug );
411
  } elseif (
412
- isset( $post )
413
- && is_object( $post )
414
- && isset( $post->ID )
415
- && ( ! in_array( $post->post_type, array( 'view', 'view-template', 'cred-form', 'cred-user-form', 'dd_layouts' ) ) )
416
  ) {
417
  $current_post_type = get_post_type_object( $post->post_type );
418
  }
419
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
420
  // Poost hierarchical relations
421
- if (
422
- is_null( $current_post_type )
423
  || (
424
- is_object( $current_post_type )
425
- && isset( $current_post_type->hierarchical )
426
  && $current_post_type->hierarchical
427
  )
428
  ) {
@@ -435,14 +449,14 @@ abstract class Toolset_Shortcode_Generator {
435
  </li>
436
  <?php
437
  }
438
-
439
-
440
  // Types relations
441
  if ( ! apply_filters( 'toolset_is_m2m_enabled', false ) ) {
442
  // Legacy relationships
443
  $current_post_type_parents = $this->get_legacy_current_post_type_relationships( $current_post_type );
444
  $custom_post_types_relations = get_option( 'wpcf-custom-types', array() );
445
-
446
  if ( ! empty( $current_post_type_parents ) ) {
447
  ?>
448
  <li class="toolset-shortcode-gui-item-selector-option toolset-shortcode-gui-item-selector-has-related js-toolset-shortcode-gui-item-selector-has-related">
@@ -476,48 +490,57 @@ abstract class Toolset_Shortcode_Generator {
476
  </li>
477
  <?php
478
  }
479
-
480
  } else {
481
  // m2m relationships
482
  // Make sure m2m classes are registered in the autoloader
483
  do_action( 'toolset_do_m2m_full_init' );
484
- $current_post_type_relationships = $this->get_m2m_current_post_type_relationships( $current_post_type );
485
 
486
- if ( ! empty( $current_post_type_relationships[ Toolset_Relationship_Origin_Wizard::ORIGIN_KEYWORD ] ) ) {
 
 
 
 
 
 
487
  ?>
488
  <li class="toolset-shortcode-gui-item-selector-option toolset-shortcode-gui-item-selector-has-related js-toolset-shortcode-gui-item-selector-has-related">
489
  <label for="toolset-shortcode-gui-item-selector-post-id-related">
490
  <input type="radio" class="js-toolset-shortcode-gui-item-selector" id="toolset-shortcode-gui-item-selector-post-id-related" name="toolset_shortcode_gui_object_id" value="related" />
491
  <?php echo __( 'A post related to the current post, set by a Types relationship', 'wpv-views' ); ?>
492
  </label>
493
- <div class="toolset-shortcode-gui-item-selector-is-related js-toolset-shortcode-gui-item-selector-is-related" style="display:none">
494
- <ul class="toolset-advanced-setting toolset-mightlong-list" style="padding-top:15px;margin:5px 0 10px;">
495
  <?php
496
- $first = true;
497
- foreach ( $current_post_type_relationships[ Toolset_Relationship_Origin_Wizard::ORIGIN_KEYWORD ] as $relationship_data ) {
 
 
 
 
498
  ?>
499
- <li>
500
- <?php echo sprintf( '<label for="toolset-shortcode-gui-item-selector-post-relationship-id-%s">', $relationship_data['id'] ); ?>
501
- <?php echo sprintf(
502
- '<input type="radio" name="related_object" id="toolset-shortcode-gui-item-selector-post-relationship-id-%s" value="%s" %s />',
503
- esc_attr( $relationship_data['id'] ),
504
- esc_attr( $relationship_data['value'] ),
505
- checked( $first, true, false )
506
- ); ?>
507
- <?php echo esc_html( $relationship_data['name'] ); ?>
508
- </label>
509
- </li>
 
 
510
  <?php
511
- $first = false;
512
  }
513
  ?>
514
- </ul>
515
  </div>
516
  </li>
517
  <?php
518
  }
519
-
520
- if ( ! empty( $current_post_type_relationships[ Toolset_Relationship_Origin_Post_Reference_Field::ORIGIN_KEYWORD ] ) ) {
521
  ?>
522
  <li class="toolset-shortcode-gui-item-selector-option toolset-shortcode-gui-item-selector-has-related js-toolset-shortcode-gui-item-selector-has-related">
523
  <label for="toolset-shortcode-gui-item-selector-post-id-referenced">
@@ -527,22 +550,14 @@ abstract class Toolset_Shortcode_Generator {
527
  <div class="toolset-shortcode-gui-item-selector-is-related js-toolset-shortcode-gui-item-selector-is-related" style="display:none">
528
  <ul class="toolset-advanced-setting toolset-mightlong-list" style="padding-top:15px;margin:5px 0 10px;">
529
  <?php
530
- $first = true;
531
- foreach ( $current_post_type_relationships[ Toolset_Relationship_Origin_Post_Reference_Field::ORIGIN_KEYWORD ] as $relationship_data ) {
532
- ?>
533
- <li>
534
- <?php echo sprintf( '<label for="toolset-shortcode-gui-item-selector-post-relationship-id-%s">', $relationship_data['id'] ); ?>
535
- <?php echo sprintf(
536
- '<input type="radio" name="referenced_object" id="toolset-shortcode-gui-item-selector-post-relationship-id-%s" value="%s" %s />',
537
- esc_attr( $relationship_data['id'] ),
538
- esc_attr( $relationship_data['value'] ),
539
- checked( $first, true, false )
540
- ); ?>
541
- <?php echo esc_html( $relationship_data['name'] ); ?>
542
- </label>
543
- </li>
544
- <?php
545
- $first = false;
546
  }
547
  ?>
548
  </ul>
@@ -550,37 +565,48 @@ abstract class Toolset_Shortcode_Generator {
550
  </li>
551
  <?php
552
  }
553
-
554
  }
555
-
556
  ?>
557
  <li class="toolset-shortcode-gui-item-selector-option toolset-shortcode-gui-item-selector-has-related js-toolset-shortcode-gui-item-selector-has-related">
558
  <label for="toolset-shortcode-gui-item-selector-post-id">
559
  <input type="radio" class="js-toolset-shortcode-gui-item-selector" id="toolset-shortcode-gui-item-selector-post-id" name="toolset_shortcode_gui_object_id" value="object_id" />
560
- <?php _e( 'A specific post', 'wpv-views' ); ?>
561
  </label>
562
  <div class="toolset-advanced-setting toolset-shortcode-gui-item-selector-is-related js-toolset-shortcode-gui-item-selector-is-related" style="display:none;padding-top:10px;">
563
- <select id="toolset-shortcode-gui-item-selector-post-id-object_id"
564
- class="js-toolset-shortcode-gui-item-selector_object_id js-toolset-shortcode-gui-field-ajax-select2"
565
- name="specific_object_id"
566
- data-action="<?php echo esc_attr( $toolset_ajax->get_action_js_name( Toolset_Ajax::CALLBACK_SELECT2_SUGGEST_POSTS_BY_TITLE ) ); ?>"
567
- data-prefill="<?php echo esc_attr( $toolset_ajax->get_action_js_name( Toolset_Ajax::CALLBACK_GET_POST_BY_ID ) ); ?>"
568
- data-nonce="<?php echo wp_create_nonce( Toolset_Ajax::CALLBACK_SELECT2_SUGGEST_POSTS_BY_TITLE ); ?>"
569
- data-prefill-nonce="<?php echo wp_create_nonce( Toolset_Ajax::CALLBACK_GET_POST_BY_ID ); ?>"
570
  data-placeholder="<?php echo esc_attr( __( 'Search for a post by title', 'wpv-views' ) ); ?>">
571
  </select>
572
  </div>
573
  </li>
574
- </ul>
 
 
 
 
 
 
 
 
 
 
 
575
  <p class="description">
576
  <?php echo sprintf(
577
  __( 'Learn about displaying content from parent and other posts in the %sdocumentation page%s.', 'wpv-views' ),
578
- '<a href="http://wp-types.com/documentation/user-guides/displaying-fields-of-parent-pages/" target="_blank">',
579
  '</a>'
580
  ); ?>
581
  </p>
582
  </script>
583
-
584
  <script type="text/html" id="tmpl-toolset-shortcode-attribute-userSelector">
585
  <ul id="{{{data.shortcode}}}-{{{data.attribute}}}">
586
  <li class="toolset-shortcode-gui-item-selector-option">
@@ -589,34 +615,34 @@ abstract class Toolset_Shortcode_Generator {
589
  <?php _e( 'The current user or the one being displayed in a View loop', 'wpv-views' ); ?>
590
  </label>
591
  </li>
592
-
593
  <li class="toolset-shortcode-gui-item-selector-option toolset-shortcode-gui-item-selector-has-related js-toolset-shortcode-gui-item-selector-has-related">
594
  <label for="toolset-shortcode-gui-item-selector-user-id">
595
  <input type="radio" class="js-toolset-shortcode-gui-item-selector" id="toolset-shortcode-gui-item-selector-user-id" name="toolset_shortcode_gui_object_id" value="object_id" />
596
  <?php _e( 'A specific user', 'wpv-views' ); ?>
597
  </label>
598
  <div class="toolset-advanced-setting toolset-shortcode-gui-item-selector-is-related js-toolset-shortcode-gui-item-selector-is-related" style="display:none;padding-top:10px;">
599
- <select id="toolset-shortcode-gui-item-selector-user-id-object_id"
600
- class="js-toolset-shortcode-gui-item-selector_object_id js-toolset-shortcode-gui-field-ajax-select2"
601
- name="specific_object_id"
602
- data-action="<?php echo esc_attr( $toolset_ajax->get_action_js_name( Toolset_Ajax::CALLBACK_SELECT2_SUGGEST_USERS ) ); ?>"
603
- data-prefill="<?php echo esc_attr( $toolset_ajax->get_action_js_name( Toolset_Ajax::CALLBACK_GET_USER_BY_ID ) ); ?>"
604
- data-nonce="<?php echo wp_create_nonce( Toolset_Ajax::CALLBACK_SELECT2_SUGGEST_USERS ); ?>"
605
- data-prefill-nonce="<?php echo wp_create_nonce( Toolset_Ajax::CALLBACK_GET_USER_BY_ID ); ?>"
606
  data-placeholder="<?php echo esc_attr( __( 'Search for a user', 'wpv-views' ) ); ?>">
607
  </select>
608
  </div>
609
  </li>
610
  </ul>
611
  </script>
612
-
613
  <script type="text/html" id="tmpl-toolset-shortcode-attribute-post-selector">
614
  <ul id="{{data.shortcode}}}-{{data.attribute}}}">
615
  <li>
616
  <label>
617
  <input type="radio" name="{{{data.shortcode}}}-select-target-post" class="toolset-shortcode-gui-item-selector js-toolset-shortcode-gui-item-selector" value="current" checked="checked" />
618
  <?php
619
- if (
620
  isset( $_GET['page'] )
621
  && in_array( $_GET['page'], array( 'views-editor', 'view-archives-editor' ) )
622
  ) {
@@ -632,13 +658,13 @@ abstract class Toolset_Shortcode_Generator {
632
  <input type="radio" name="{{{data.shortcode}}}-select-target-post" class="toolset-shortcode-gui-item-selector js-toolset-shortcode-gui-item-selector" value="object_id" />
633
  <?php _e( 'Another post', 'wp-cred' ); ?>
634
  <div class="toolset-shortcode-gui-item-selector-is-related js-toolset-shortcode-gui-item-selector-is-related" style="display:none">
635
- <select id="toolset-shortcode-gui-item-selector-post-id-object_id"
636
- class="js-toolset-shortcode-gui-item-selector_object_id js-toolset-shortcode-gui-field-ajax-select2"
637
- name="specific_object_id"
638
- data-action="<?php echo esc_attr( $toolset_ajax->get_action_js_name( Toolset_Ajax::CALLBACK_SELECT2_SUGGEST_POSTS_BY_TITLE ) ); ?>"
639
- data-prefill="<?php echo esc_attr( $toolset_ajax->get_action_js_name( Toolset_Ajax::CALLBACK_GET_POST_BY_ID ) ); ?>"
640
- data-nonce="<?php echo wp_create_nonce( Toolset_Ajax::CALLBACK_SELECT2_SUGGEST_POSTS_BY_TITLE ); ?>"
641
- data-prefill-nonce="<?php echo wp_create_nonce( Toolset_Ajax::CALLBACK_GET_POST_BY_ID ); ?>"
642
  data-placeholder="<?php echo esc_attr( __( 'Search for a post by title', 'wpv-views' ) ); ?>">
643
  </select>
644
  </div>
@@ -659,13 +685,13 @@ abstract class Toolset_Shortcode_Generator {
659
  <input type="radio" name="{{{data.shortcode}}}-select-target-user" class="toolset-shortcode-gui-item-selector js-toolset-shortcode-gui-item-selector" value="object_id" />
660
  <?php _e( 'Another user', 'wp-cred' ); ?>
661
  <div class="toolset-shortcode-gui-item-selector-is-related js-toolset-shortcode-gui-item-selector-is-related" style="display:none">
662
- <select id="toolset-shortcode-gui-item-selector-user-id-object_id"
663
- class="js-toolset-shortcode-gui-item-selector_object_id js-toolset-shortcode-gui-field-ajax-select2"
664
- name="specific_object_id"
665
- data-action="<?php echo esc_attr( $toolset_ajax->get_action_js_name( Toolset_Ajax::CALLBACK_SELECT2_SUGGEST_USERS ) ); ?>"
666
- data-prefill="<?php echo esc_attr( $toolset_ajax->get_action_js_name( Toolset_Ajax::CALLBACK_GET_USER_BY_ID ) ); ?>"
667
- data-nonce="<?php echo wp_create_nonce( Toolset_Ajax::CALLBACK_SELECT2_SUGGEST_USERS ); ?>"
668
- data-prefill-nonce="<?php echo wp_create_nonce( Toolset_Ajax::CALLBACK_GET_USER_BY_ID ); ?>"
669
  data-placeholder="<?php echo esc_attr( __( 'Search for a user', 'wpv-views' ) ); ?>">
670
  </select>
671
  </div>
@@ -674,11 +700,11 @@ abstract class Toolset_Shortcode_Generator {
674
  </ul>
675
  </script>
676
  <?php
677
-
678
  do_action( 'toolset_action_require_shortcodes_templates_done' );
679
-
680
  }
681
-
682
  public function extend_script_i18n( $toolset_shortcode_i18n ) {
683
  $post_selector_attribute = 'id';
684
  if ( apply_filters( 'toolset_is_m2m_enabled', false ) ) {
@@ -716,10 +742,10 @@ abstract class Toolset_Shortcode_Generator {
716
  )
717
  )
718
  );
719
-
720
  return $toolset_shortcode_i18n;
721
  }
722
-
723
  /**
724
  * Get Types legacy parent relationships for a given post type, or all the existing parents otherwise.
725
  *
@@ -731,21 +757,21 @@ abstract class Toolset_Shortcode_Generator {
731
  */
732
  public function get_legacy_current_post_type_relationships( $current_post_type ) {
733
  $current_post_type_parents = array();
734
-
735
  if ( apply_filters( 'toolset_is_m2m_enabled', false ) ) {
736
  return $current_post_type_parents;
737
  }
738
-
739
  $current_post_type_parents = array();
740
  $custom_post_types_relations = get_option( 'wpcf-custom-types', array() );
741
-
742
  if ( is_null( $current_post_type ) ) {
743
  foreach ( $custom_post_types_relations as $cptr_key => $cptr_data ) {
744
  if ( isset( $cptr_data['post_relationship']['has'] ) ) {
745
  $current_post_type_parents[] = $cptr_key;
746
  }
747
- if (
748
- isset( $cptr_data['post_relationship']['belongs'] )
749
  && is_array( $cptr_data['post_relationship']['belongs'] )
750
  ) {
751
  $this_belongs = array_keys( $cptr_data['post_relationship']['belongs'] );
@@ -762,8 +788,8 @@ abstract class Toolset_Shortcode_Generator {
762
  ) {
763
  // Fix legacy problem, when child CPT has no parents itself, but parent CPT has children
764
  foreach ( $custom_post_types_relations as $cptr_key => $cptr_data ) {
765
- if (
766
- isset( $cptr_data['post_relationship']['has'] )
767
  && in_array( $current_post_type->slug, array_keys( $cptr_data['post_relationship']['has'] ) )
768
  ) {
769
  $current_post_type_parents[] = $cptr_key;
@@ -786,105 +812,70 @@ abstract class Toolset_Shortcode_Generator {
786
  }
787
  }
788
  }
789
-
790
  $current_post_type_parents = array_values( $current_post_type_parents );
791
  $current_post_type_parents = array_unique( $current_post_type_parents );
792
-
793
  return $current_post_type_parents;
794
  }
795
-
796
  /**
797
  * Get Types one-to-many and one-to-one relationships for a given post type, or all the existing otherwise.
798
  *
799
- * For post reference fields relationships, make sure we alwars offer to insert the parent post data,
800
  * as they do support relationships between the same post type, hence the relationship ends get blurred.
801
  *
802
- * @paran $current_post_type string|null
803
  *
804
  * @return array
805
  *
806
  * @since m2m
807
  */
808
- public function get_m2m_current_post_type_relationships( $current_post_type ) {
809
- $current_post_type_relationships = array(
 
810
  Toolset_Relationship_Origin_Wizard::ORIGIN_KEYWORD => array(),
811
  Toolset_Relationship_Origin_Post_Reference_Field::ORIGIN_KEYWORD => array()
812
  );
813
-
814
  $query = new Toolset_Relationship_Query_V2();
815
-
816
- // Note that we can not use $query->do_if() because it actually runs both branches
817
  // and one of them expects $current_post_type->name to exist
818
  if ( $current_post_type instanceof WP_Post_Type ) {
819
  $relationship_definitions = $query
820
  ->add(
821
- $query->do_or(
822
- $query->do_and(
823
- $query->has_type( $current_post_type->name, new Toolset_Relationship_Role_Child() ),
824
- $query->has_cardinality( $query->cardinality()->one_to_many() ),
825
- $query->do_or(
826
- $query->origin( Toolset_Relationship_Origin_Wizard::ORIGIN_KEYWORD ),
827
- $query->origin( Toolset_Relationship_Origin_Post_Reference_Field::ORIGIN_KEYWORD )
828
- )
829
  ),
830
- $query->has_cardinality( $query->cardinality()->one_to_one() )
 
 
 
831
  )
832
  )
833
  ->get_results();
834
  } else {
835
  $relationship_definitions = $query
836
  ->add(
837
- $query->do_and(
838
- $query->do_or(
839
- $query->origin( Toolset_Relationship_Origin_Wizard::ORIGIN_KEYWORD ),
840
- $query->origin( Toolset_Relationship_Origin_Post_Reference_Field::ORIGIN_KEYWORD )
841
- ),
842
- $query->do_or(
843
- $query->has_cardinality( $query->cardinality()->one_to_many() ),
844
- $query->has_cardinality( $query->cardinality()->one_to_one() )
845
- )
846
  )
847
  )
848
  ->get_results();
849
  }
850
-
851
- foreach( $relationship_definitions as $relationship_definition ) {
852
- // Note: This is only safe as long as we don't have self-join relationships enabled
853
- if ( $current_post_type instanceof WP_Post_Type ) {
854
- $given_post_type_role = (
855
- in_array( $current_post_type->name, $relationship_definition->get_parent_type()->get_types() )
856
- ? Toolset_Relationship_Role::PARENT
857
- : Toolset_Relationship_Role::CHILD
858
- );
859
- } else {
860
- $given_post_type_role = Toolset_Relationship_Role::CHILD;
861
- }
862
 
863
- $parents = $relationship_definition->get_parent_type()->get_types();
864
- $parent = $parents[0];
865
  $origin = $relationship_definition->get_origin();
866
-
867
- $current_post_type_relationships[ $origin->get_origin_keyword() ][] = array(
868
- 'name' => $relationship_definition->get_display_name(),
869
- 'slug' => $relationship_definition->get_slug(),
870
- 'value' => '@' . $relationship_definition->get_slug() . '.'
871
- . ( Toolset_Relationship_Origin_Wizard::ORIGIN_KEYWORD === $origin->get_origin_keyword()
872
- ? $relationship_definition->get_role_name(
873
- Toolset_Relationship_Role::other( $given_post_type_role )
874
- )
875
- : Toolset_Relationship_Role::PARENT
876
- ),
877
- 'id' => $relationship_definition->get_slug() . '-' . $parent,
878
- 'role_name' => ( Toolset_Relationship_Origin_Wizard::ORIGIN_KEYWORD === $origin->get_origin_keyword()
879
- ? $relationship_definition->get_role_name(
880
- Toolset_Relationship_Role::other( $given_post_type_role )
881
- )
882
- : Toolset_Relationship_Role::PARENT
883
- )
884
- );
885
  }
886
-
887
- return $current_post_type_relationships;
888
  }
889
 
890
  /**
@@ -897,5 +888,5 @@ abstract class Toolset_Shortcode_Generator {
897
  $shortcode_transformer = new Toolset_Shortcode_Transformer();
898
  $shortcode_transformer->init_hooks();
899
  }
900
-
901
  }
27
  *
28
  * @since 1.9
29
  */
30
+
31
  abstract class Toolset_Shortcode_Generator {
32
 
33
  private static $registered_admin_bar_items = array();
34
  private static $can_show_admin_bar_item = false;
35
  private static $target_dialog_added = false;
36
+
37
  function __construct() {
38
  add_action( 'init', array( $this, 'register_shortcode_transformer' ) );
39
+
40
  add_action( 'admin_init', array( $this, 'register_shortcodes_admin_bar_items' ), 99 );
41
  add_action( 'admin_bar_menu', array( $this, 'display_shortcodes_admin_bar_items' ), 99 );
42
  add_action( 'admin_footer', array( $this, 'display_shortcodes_target_dialog' ) );
43
+
44
  add_action( 'toolset_action_require_shortcodes_templates', array( $this, 'print_shortcodes_templates' ) );
45
+
46
  add_filter( 'toolset_filter_shortcode_script_i18n', array( $this, 'extend_script_i18n' ) );
47
  }
48
+
49
  public function register_shortcodes_admin_bar_items() {
50
+
51
  // Only register sections if the Admin Bar item is to be shown.
52
  $toolset_settings = Toolset_Settings::get_instance();
53
  $toolset_shortcodes_generator = ( isset( $toolset_settings['shortcodes_generator'] ) && in_array( $toolset_settings['shortcodes_generator'], array( 'unset', 'disable', 'editor', 'always' ) ) ) ? $toolset_settings['shortcodes_generator'] : 'unset';
76
  * @param bool $register_section Whether the Toolset Shortcodes menu on the admin bar should be forcibly shown or hidden.
77
  */
78
  $register_section = apply_filters( 'toolset_filter_force_shortcode_generator_display', $register_section );
79
+
80
  if ( ! $register_section ) {
81
  return;
82
  }
83
+
84
  // Now that we know that it will be shown, collect the registered items.
85
  $registered_items = self::$registered_admin_bar_items;
86
  $registered_items = apply_filters( 'toolset_shortcode_generator_register_item', $registered_items );
87
  self::$registered_admin_bar_items = $registered_items;
88
+
89
  }
90
+
91
  /**
92
  * Add admin bar main item for shortcodes
93
  */
105
  $this->create_admin_bar_item( $wp_admin_bar, $item_args['id'], $item_args['title'], $item_args['href'], $item_args['parent'], $item_args['meta'] );
106
  }
107
  }
108
+
109
  /**
110
  * General function for creating admin bar menu items
111
  */
119
  );
120
  $wp_admin_bar->add_node( $args );
121
  }
122
+
123
  /**
124
+ * Helper method to check whether we are on an admin editor page.
125
+ * This covers edit pages for posts, terms and users,
126
  * as well as Toolset object edit pages.
127
  *
128
  * @since 2.3.0
129
  */
130
+
131
  public function is_admin_editor_page() {
132
  if ( ! is_admin() ) {
133
  return false;
134
  }
135
  global $pagenow, $wp_version;
136
+ $allowed_pagenow_array = array( 'post.php', 'post-new.php', 'term.php', 'user-new.php', 'user-edit.php', 'profile.php' );
137
  $allowed_page_array = array( 'views-editor', 'ct-editor', 'view-archives-editor', 'dd_layouts_edit' );
138
  // @todo maybe add a filter here for future Toolset admin pages...
139
  if (
140
+ in_array( $pagenow, $allowed_pagenow_array )
141
  || (
142
+ $pagenow == 'admin.php'
143
+ && isset( $_GET['page'] )
144
  && in_array( $_GET['page'], $allowed_page_array )
145
  )
146
  || (
147
  // In WordPress < 4.5, the edit tag admin page is edit-tags.php?action=edit&taxonomy=category&tag_ID=X
148
+ version_compare( $wp_version, '4.5', '<' )
149
+ && $pagenow == 'edit-tags.php'
150
+ && isset( $_GET['action'] )
151
  && $_GET['action'] == 'edit'
152
  )
153
  ) {
155
  }
156
  return false;
157
  }
158
+
159
  /**
160
+ * Helper method to check whether we are on an frontend editor page.
161
  * This should cover as many frontend editors as possible.
162
  *
163
  * @since 2.3.0
164
  */
165
+
166
  public function is_frontend_editor_page() {
167
  if ( is_admin() ) {
168
  return false;
171
  // Layouts frontend editor
172
  isset( $_GET['toolset_editor'] )
173
  // Beaver Builder frontend editor
174
+ || isset( $_GET['fl_builder'] )
175
  // CRED frontend editor pages, when discoverable
176
  ) {
177
  return true;
178
  }
179
  return false;
180
  }
181
+
182
  /*
183
  * Dialog Template HTML code
184
  */
185
  public function display_shortcodes_target_dialog() {
186
+ if (
187
  self::$can_show_admin_bar_item
188
+ && self::$target_dialog_added === false
189
  ) {
190
  ?>
191
  <div class="toolset-dialog-container" style="display:none">
200
  </div>
201
  </div>
202
  <?php
203
+ self::$target_dialog_added = true;
204
  }
205
 
206
  }
207
+
208
  /**
209
  * Generate the shared Toolset shortcode GUI templates.
210
  *
213
  * @todo The post and user selector templates are used exclusively by CRED: move to CRED and rename
214
  */
215
  public function print_shortcodes_templates() {
216
+
217
  if ( did_action( 'toolset_action_require_shortcodes_templates_done' ) ) {
218
  return;
219
  }
220
+
221
  ?>
222
  <script type="text/html" id="tmpl-toolset-shortcode-gui">
223
  <input value="{{{data.shortcode}}}" class="toolset-shortcode-gui-shortcode-handle js-toolset-shortcode-gui-shortcode-handle" type="hidden" />
235
  <ul class="js-toolset-shortcode-gui-tabs-list">
236
  <# _.each( data.attributes, function( attributesGroup, groupKey ) { #>
237
  <# if (
238
+ _.has( attributesGroup, 'fields' )
239
+ && _.size( attributesGroup.fields ) > 0
240
  ) { #>
241
  <li>
242
  <a href="#{{{data.shortcode}}}-{{{groupKey}}}">{{{attributesGroup.header}}}</a>
247
  <# } #>
248
  <# _.each( data.attributes, function( attributesGroup, groupKey ) { #>
249
  <# if (
250
+ _.has( attributesGroup, 'fields' )
251
+ && _.size( attributesGroup.fields ) > 0
252
  ) { #>
253
  <div id="{{{data.shortcode}}}-{{{groupKey}}}">
254
  <h2>{{{attributesGroup.header}}}</h2>
255
+ <# _.each( attributesGroup.fields, function( attributeData, attributeKey ) {
256
  if ( _.has( data.templates, 'attributeWrapper' ) ) {
257
  attributeData = _.extend( { shortcode: data.shortcode, attribute: attributeKey, templates: data.templates }, attributeData );
258
  if ( 'group' == attributeData.type ) {
269
  <div class="toolset-shortcode-gui-messages js-toolset-shortcode-gui-messages"></div>
270
  </script>
271
  <script type="text/html" id="tmpl-toolset-shortcode-attribute-wrapper">
272
+ <#
273
+ data = _.defaults( data, { defaultValue: '', required: false, hidden: false, placeholder: '' } );
274
+ data = _.defaults( data, { defaultForceValue: data.defaultValue } );
275
  #>
276
  <div class="toolset-shortcode-gui-attribute-wrapper js-toolset-shortcode-gui-attribute-wrapper js-toolset-shortcode-gui-attribute-wrapper-for-{{{data.attribute}}}" data-attribute="{{{data.attribute}}}" data-type="{{{data.type}}}" data-default="{{{data.defaultValue}}}"<# if ( data.hidden ) { #> style="display:none"<# } #>>
277
  <# if ( _.has( data, 'label' ) ) { #>
280
  <# if ( _.has( data, 'pseudolabel' ) ) { #>
281
  <strong>{{{data.pseudolabel}}}</strong>
282
  <# } #>
283
+ <# if (
284
+ _.has( data.templates, 'attributes' )
285
  && _.has( data.templates.attributes, data.type )
286
  ) {
287
  print( data.templates.attributes[ data.type ]( data ) );
351
  <select id="{{{data.shortcode}}}-{{{data.attribute}}}" class="js-shortcode-gui-field js-toolset-shortcode-gui-field-select2<# if ( data.required ) { #> js-toolset-shortcode-gui-required<# } #>">
352
  <#
353
  if ( _.has( data, 'options' ) ) {
354
+ _.each( data.options, function( optionLabel, optionKey ) {
355
  #>
356
  <option value="{{{optionKey}}}"<# if ( optionKey == data.defaultForceValue ) { #> selected="selected"<# } #>>
357
  {{{optionLabel}}}
358
  </option>
359
+ <#
360
  });
361
+ }
362
  #>
363
  </select>
364
  </script>
365
  <script type="text/html" id="tmpl-toolset-shortcode-attribute-ajaxSelect2">
366
+ <select
367
+ id="{{{data.shortcode}}}-{{{data.attribute}}}"
368
+ class="js-shortcode-gui-field js-toolset-shortcode-gui-field-ajax-select2<# if ( data.required ) { #> js-toolset-shortcode-gui-required<# } #>"
369
+ data-action="{{{data.action}}}"
370
  data-nonce="{{{data.nonce}}}"
371
  data-placeholder="{{{data.placeholder}}}"
372
  >
373
  </select>
374
  </script>
375
+
376
  <script type="text/html" id="tmpl-toolset-shortcode-content">
377
+ <#
378
  data = _.defaults( data, { defaultValue: '', required: false, hidden: false, placeholder: '' } );
379
  data = _.defaults( data, { defaultForceValue: data.defaultValue } );
380
  #>
385
  <# } #>
386
  </div>
387
  </script>
388
+
389
  <?php $toolset_ajax = Toolset_Ajax::get_instance(); ?>
390
+
391
  <script type="text/html" id="tmpl-toolset-shortcode-attribute-postSelector">
392
  <ul id="{{{data.shortcode}}}-{{{data.attribute}}}">
393
  <li class="toolset-shortcode-gui-item-selector-option">
396
  <?php _e( 'The current post being displayed either directly or in a View loop', 'wpv-views' ); ?>
397
  </label>
398
  </li>
399
+
400
  <?php
401
+
402
  global $pagenow, $post;
403
  $current_post_type = null;
404
+ if (
405
+ in_array( $pagenow, array( 'post.php' ) )
406
+ && isset( $_GET["post"] )
407
  ) {
408
  $current_post_id = (int) $_GET["post"];
409
  $current_post_type_slug = get_post_type( $current_post_id );
410
  $current_post_type = get_post_type_object( $current_post_type_slug );
411
  } elseif (
412
+ isset( $post )
413
+ && ( $post instanceof WP_Post )
414
+ && ( ! in_array( $post->post_type, array( 'view', 'view-template', 'cred-form', 'cred-user-form', 'dd_layouts' ) ) )
 
415
  ) {
416
  $current_post_type = get_post_type_object( $post->post_type );
417
  }
418
 
419
+ // Current top page when displaying a View loop
420
+ if (
421
+ in_array( $pagenow, array( 'admin.php' ) )
422
+ && 'views-editor' === toolset_getget( 'page' )
423
+ ) {
424
+ ?>
425
+ <li class="toolset-shortcode-gui-item-selector-option">
426
+ <label for="toolset-shortcode-gui-item-selector-post-id-current_page">
427
+ <input type="radio" class="js-toolset-shortcode-gui-item-selector" id="toolset-shortcode-gui-item-selector-post-id-current_page" name="toolset_shortcode_gui_object_id" value="$current_page" />
428
+ <?php echo __( 'The page where this View is shown', 'wpv-views' ); ?>
429
+ </label>
430
+ </li>
431
+ <?php
432
+ }
433
+
434
  // Poost hierarchical relations
435
+ if (
436
+ is_null( $current_post_type )
437
  || (
438
+ is_object( $current_post_type )
439
+ && isset( $current_post_type->hierarchical )
440
  && $current_post_type->hierarchical
441
  )
442
  ) {
449
  </li>
450
  <?php
451
  }
452
+
453
+
454
  // Types relations
455
  if ( ! apply_filters( 'toolset_is_m2m_enabled', false ) ) {
456
  // Legacy relationships
457
  $current_post_type_parents = $this->get_legacy_current_post_type_relationships( $current_post_type );
458
  $custom_post_types_relations = get_option( 'wpcf-custom-types', array() );
459
+
460
  if ( ! empty( $current_post_type_parents ) ) {
461
  ?>
462
  <li class="toolset-shortcode-gui-item-selector-option toolset-shortcode-gui-item-selector-has-related js-toolset-shortcode-gui-item-selector-has-related">
490
  </li>
491
  <?php
492
  }
493
+
494
  } else {
495
  // m2m relationships
496
  // Make sure m2m classes are registered in the autoloader
497
  do_action( 'toolset_do_m2m_full_init' );
498
+ $relationship_definitions_per_origin = $this->get_m2m_current_post_type_relationships_per_origin( $current_post_type );
499
 
500
+ $relationship_section_title_per_cardinality = array(
501
+ 'one-to-one' => __( '%s (one-to-one relationship)', 'wpv-views' ),
502
+ 'one-to-many' => __( '%s (one-to-many relationship)', 'wpv-views' ),
503
+ 'many-to-many' => __( '%s (many-to-many relationship)', 'wpv-views' ),
504
+ );
505
+
506
+ if ( ! empty( $relationship_definitions_per_origin[ Toolset_Relationship_Origin_Wizard::ORIGIN_KEYWORD ] ) ) {
507
  ?>
508
  <li class="toolset-shortcode-gui-item-selector-option toolset-shortcode-gui-item-selector-has-related js-toolset-shortcode-gui-item-selector-has-related">
509
  <label for="toolset-shortcode-gui-item-selector-post-id-related">
510
  <input type="radio" class="js-toolset-shortcode-gui-item-selector" id="toolset-shortcode-gui-item-selector-post-id-related" name="toolset_shortcode_gui_object_id" value="related" />
511
  <?php echo __( 'A post related to the current post, set by a Types relationship', 'wpv-views' ); ?>
512
  </label>
513
+ <div class="toolset-advanced-setting toolset-shortcode-gui-item-selector-is-related js-toolset-shortcode-gui-item-selector-is-related" style="display:none">
 
514
  <?php
515
+ foreach ( $relationship_definitions_per_origin[ Toolset_Relationship_Origin_Wizard::ORIGIN_KEYWORD ] as $relationship_definition ) {
516
+ $cardinality = $relationship_definition->get_cardinality()->get_type();
517
+ $relationship_selectors_factory = new Toolset_Shortcode_Attr_Item_Gui_Factory(
518
+ $relationship_definition, $current_post_type, 'related_object'
519
+ );
520
+ $relationship_selectors = $relationship_selectors_factory->get_options();
521
  ?>
522
+ <div style="margin:5px 0 0;">
523
+ <h3><?php echo sprintf(
524
+ $relationship_section_title_per_cardinality[ $cardinality ],
525
+ $relationship_definition->get_display_name()
526
+ ); ?></h3>
527
+ <ul>
528
+ <?php
529
+ foreach( $relationship_selectors as $relationship_selector_option ) {
530
+ echo '<li style="display:inline-block;width:31%;vertical-align:top;margin-right:1%;>' . $relationship_selector_option . '</li>';
531
+ }
532
+ ?>
533
+ </ul>
534
+ </div>
535
  <?php
 
536
  }
537
  ?>
 
538
  </div>
539
  </li>
540
  <?php
541
  }
542
+
543
+ if ( ! empty( $relationship_definitions_per_origin[ Toolset_Relationship_Origin_Post_Reference_Field::ORIGIN_KEYWORD ] ) ) {
544
  ?>
545
  <li class="toolset-shortcode-gui-item-selector-option toolset-shortcode-gui-item-selector-has-related js-toolset-shortcode-gui-item-selector-has-related">
546
  <label for="toolset-shortcode-gui-item-selector-post-id-referenced">
550
  <div class="toolset-shortcode-gui-item-selector-is-related js-toolset-shortcode-gui-item-selector-is-related" style="display:none">
551
  <ul class="toolset-advanced-setting toolset-mightlong-list" style="padding-top:15px;margin:5px 0 10px;">
552
  <?php
553
+ foreach ( $relationship_definitions_per_origin[ Toolset_Relationship_Origin_Post_Reference_Field::ORIGIN_KEYWORD ] as $relationship_definition ) {
554
+ $relationship_selectors_factory = new Toolset_Shortcode_Attr_Item_Gui_Factory(
555
+ $relationship_definition, $current_post_type, 'referenced_object'
556
+ );
557
+ $relationship_selectors = $relationship_selectors_factory->get_options();
558
+ foreach( $relationship_selectors as $relationship_selector_option ) {
559
+ echo '<li>' . $relationship_selector_option . '</li>';
560
+ }
 
 
 
 
 
 
 
 
561
  }
562
  ?>
563
  </ul>
565
  </li>
566
  <?php
567
  }
568
+
569
  }
570
+
571
  ?>
572
  <li class="toolset-shortcode-gui-item-selector-option toolset-shortcode-gui-item-selector-has-related js-toolset-shortcode-gui-item-selector-has-related">
573
  <label for="toolset-shortcode-gui-item-selector-post-id">
574
  <input type="radio" class="js-toolset-shortcode-gui-item-selector" id="toolset-shortcode-gui-item-selector-post-id" name="toolset_shortcode_gui_object_id" value="object_id" />
575
+ <?php _e( 'A specific post (search by title)', 'wpv-views' ); ?>
576
  </label>
577
  <div class="toolset-advanced-setting toolset-shortcode-gui-item-selector-is-related js-toolset-shortcode-gui-item-selector-is-related" style="display:none;padding-top:10px;">
578
+ <select id="toolset-shortcode-gui-item-selector-post-id-object_id"
579
+ class="js-toolset-shortcode-gui-item-selector_object_id js-toolset-shortcode-gui-field-ajax-select2"
580
+ name="specific_object_id"
581
+ data-action="<?php echo esc_attr( $toolset_ajax->get_action_js_name( Toolset_Ajax::CALLBACK_SELECT2_SUGGEST_POSTS_BY_TITLE ) ); ?>"
582
+ data-prefill="<?php echo esc_attr( $toolset_ajax->get_action_js_name( Toolset_Ajax::CALLBACK_GET_POST_BY_ID ) ); ?>"
583
+ data-nonce="<?php echo wp_create_nonce( Toolset_Ajax::CALLBACK_SELECT2_SUGGEST_POSTS_BY_TITLE ); ?>"
584
+ data-prefill-nonce="<?php echo wp_create_nonce( Toolset_Ajax::CALLBACK_GET_POST_BY_ID ); ?>"
585
  data-placeholder="<?php echo esc_attr( __( 'Search for a post by title', 'wpv-views' ) ); ?>">
586
  </select>
587
  </div>
588
  </li>
589
+
590
+ <li class="toolset-shortcode-gui-item-selector-option toolset-shortcode-gui-item-selector-has-related js-toolset-shortcode-gui-item-selector-has-related">
591
+ <label for="toolset-shortcode-gui-item-selector-post-id-raw">
592
+ <input type="radio" class="js-toolset-shortcode-gui-item-selector" id="toolset-shortcode-gui-item-selector-post-id-raw" name="toolset_shortcode_gui_object_id" value="object_id_raw" />
593
+ <?php _e( 'A specific post (set by post ID)', 'wpv-views' ); ?>
594
+ </label>
595
+ <div class="toolset-advanced-setting toolset-shortcode-gui-item-selector-is-related js-toolset-shortcode-gui-item-selector-is-related" style="display:none;padding-top:10px;">
596
+ <input type="number" placeholder="<?php echo esc_attr( __( 'Please enter post ID', 'wpv-views' ) ); ?>" id="toolset-shortcode-gui-item-selector-post-id-object_id_raw" class="regular-text js-toolset-shortcode-gui-item-selector_object_id_raw" name="specific_object_id_raw">
597
+ </div>
598
+ </li>
599
+
600
+ </ul>
601
  <p class="description">
602
  <?php echo sprintf(
603
  __( 'Learn about displaying content from parent and other posts in the %sdocumentation page%s.', 'wpv-views' ),
604
+ '<a href="https://toolset.com/documentation/user-guides/displaying-fields-of-parent-pages/" target="_blank">',
605
  '</a>'
606
  ); ?>
607
  </p>
608
  </script>
609
+
610
  <script type="text/html" id="tmpl-toolset-shortcode-attribute-userSelector">
611
  <ul id="{{{data.shortcode}}}-{{{data.attribute}}}">
612
  <li class="toolset-shortcode-gui-item-selector-option">
615
  <?php _e( 'The current user or the one being displayed in a View loop', 'wpv-views' ); ?>
616
  </label>
617
  </li>
618
+
619
  <li class="toolset-shortcode-gui-item-selector-option toolset-shortcode-gui-item-selector-has-related js-toolset-shortcode-gui-item-selector-has-related">
620
  <label for="toolset-shortcode-gui-item-selector-user-id">
621
  <input type="radio" class="js-toolset-shortcode-gui-item-selector" id="toolset-shortcode-gui-item-selector-user-id" name="toolset_shortcode_gui_object_id" value="object_id" />
622
  <?php _e( 'A specific user', 'wpv-views' ); ?>
623
  </label>
624
  <div class="toolset-advanced-setting toolset-shortcode-gui-item-selector-is-related js-toolset-shortcode-gui-item-selector-is-related" style="display:none;padding-top:10px;">
625
+ <select id="toolset-shortcode-gui-item-selector-user-id-object_id"
626
+ class="js-toolset-shortcode-gui-item-selector_object_id js-toolset-shortcode-gui-field-ajax-select2"
627
+ name="specific_object_id"
628
+ data-action="<?php echo esc_attr( $toolset_ajax->get_action_js_name( Toolset_Ajax::CALLBACK_SELECT2_SUGGEST_USERS ) ); ?>"
629
+ data-prefill="<?php echo esc_attr( $toolset_ajax->get_action_js_name( Toolset_Ajax::CALLBACK_GET_USER_BY_ID ) ); ?>"
630
+ data-nonce="<?php echo wp_create_nonce( Toolset_Ajax::CALLBACK_SELECT2_SUGGEST_USERS ); ?>"
631
+ data-prefill-nonce="<?php echo wp_create_nonce( Toolset_Ajax::CALLBACK_GET_USER_BY_ID ); ?>"
632
  data-placeholder="<?php echo esc_attr( __( 'Search for a user', 'wpv-views' ) ); ?>">
633
  </select>
634
  </div>
635
  </li>
636
  </ul>
637
  </script>
638
+
639
  <script type="text/html" id="tmpl-toolset-shortcode-attribute-post-selector">
640
  <ul id="{{data.shortcode}}}-{{data.attribute}}}">
641
  <li>
642
  <label>
643
  <input type="radio" name="{{{data.shortcode}}}-select-target-post" class="toolset-shortcode-gui-item-selector js-toolset-shortcode-gui-item-selector" value="current" checked="checked" />
644
  <?php
645
+ if (
646
  isset( $_GET['page'] )
647
  && in_array( $_GET['page'], array( 'views-editor', 'view-archives-editor' ) )
648
  ) {
658
  <input type="radio" name="{{{data.shortcode}}}-select-target-post" class="toolset-shortcode-gui-item-selector js-toolset-shortcode-gui-item-selector" value="object_id" />
659
  <?php _e( 'Another post', 'wp-cred' ); ?>
660
  <div class="toolset-shortcode-gui-item-selector-is-related js-toolset-shortcode-gui-item-selector-is-related" style="display:none">
661
+ <select id="toolset-shortcode-gui-item-selector-post-id-object_id"
662
+ class="js-toolset-shortcode-gui-item-selector_object_id js-toolset-shortcode-gui-field-ajax-select2"
663
+ name="specific_object_id"
664
+ data-action="<?php echo esc_attr( $toolset_ajax->get_action_js_name( Toolset_Ajax::CALLBACK_SELECT2_SUGGEST_POSTS_BY_TITLE ) ); ?>"
665
+ data-prefill="<?php echo esc_attr( $toolset_ajax->get_action_js_name( Toolset_Ajax::CALLBACK_GET_POST_BY_ID ) ); ?>"
666
+ data-nonce="<?php echo wp_create_nonce( Toolset_Ajax::CALLBACK_SELECT2_SUGGEST_POSTS_BY_TITLE ); ?>"
667
+ data-prefill-nonce="<?php echo wp_create_nonce( Toolset_Ajax::CALLBACK_GET_POST_BY_ID ); ?>"
668
  data-placeholder="<?php echo esc_attr( __( 'Search for a post by title', 'wpv-views' ) ); ?>">
669
  </select>
670
  </div>
685
  <input type="radio" name="{{{data.shortcode}}}-select-target-user" class="toolset-shortcode-gui-item-selector js-toolset-shortcode-gui-item-selector" value="object_id" />
686
  <?php _e( 'Another user', 'wp-cred' ); ?>
687
  <div class="toolset-shortcode-gui-item-selector-is-related js-toolset-shortcode-gui-item-selector-is-related" style="display:none">
688
+ <select id="toolset-shortcode-gui-item-selector-user-id-object_id"
689
+ class="js-toolset-shortcode-gui-item-selector_object_id js-toolset-shortcode-gui-field-ajax-select2"
690
+ name="specific_object_id"
691
+ data-action="<?php echo esc_attr( $toolset_ajax->get_action_js_name( Toolset_Ajax::CALLBACK_SELECT2_SUGGEST_USERS ) ); ?>"
692
+ data-prefill="<?php echo esc_attr( $toolset_ajax->get_action_js_name( Toolset_Ajax::CALLBACK_GET_USER_BY_ID ) ); ?>"
693
+ data-nonce="<?php echo wp_create_nonce( Toolset_Ajax::CALLBACK_SELECT2_SUGGEST_USERS ); ?>"
694
+ data-prefill-nonce="<?php echo wp_create_nonce( Toolset_Ajax::CALLBACK_GET_USER_BY_ID ); ?>"
695
  data-placeholder="<?php echo esc_attr( __( 'Search for a user', 'wpv-views' ) ); ?>">
696
  </select>
697
  </div>
700
  </ul>
701
  </script>
702
  <?php
703
+
704
  do_action( 'toolset_action_require_shortcodes_templates_done' );
705
+
706
  }
707
+
708
  public function extend_script_i18n( $toolset_shortcode_i18n ) {
709
  $post_selector_attribute = 'id';
710
  if ( apply_filters( 'toolset_is_m2m_enabled', false ) ) {
742
  )
743
  )
744
  );
745
+
746
  return $toolset_shortcode_i18n;
747
  }
748
+
749
  /**
750
  * Get Types legacy parent relationships for a given post type, or all the existing parents otherwise.
751
  *
757
  */
758
  public function get_legacy_current_post_type_relationships( $current_post_type ) {
759
  $current_post_type_parents = array();
760
+
761
  if ( apply_filters( 'toolset_is_m2m_enabled', false ) ) {
762
  return $current_post_type_parents;
763
  }
764
+
765
  $current_post_type_parents = array();
766
  $custom_post_types_relations = get_option( 'wpcf-custom-types', array() );
767
+
768
  if ( is_null( $current_post_type ) ) {
769
  foreach ( $custom_post_types_relations as $cptr_key => $cptr_data ) {
770
  if ( isset( $cptr_data['post_relationship']['has'] ) ) {
771
  $current_post_type_parents[] = $cptr_key;
772
  }
773
+ if (
774
+ isset( $cptr_data['post_relationship']['belongs'] )
775
  && is_array( $cptr_data['post_relationship']['belongs'] )
776
  ) {
777
  $this_belongs = array_keys( $cptr_data['post_relationship']['belongs'] );
788
  ) {
789
  // Fix legacy problem, when child CPT has no parents itself, but parent CPT has children
790
  foreach ( $custom_post_types_relations as $cptr_key => $cptr_data ) {
791
+ if (
792
+ isset( $cptr_data['post_relationship']['has'] )
793
  && in_array( $current_post_type->slug, array_keys( $cptr_data['post_relationship']['has'] ) )
794
  ) {
795
  $current_post_type_parents[] = $cptr_key;
812
  }
813
  }
814
  }
815
+
816
  $current_post_type_parents = array_values( $current_post_type_parents );
817
  $current_post_type_parents = array_unique( $current_post_type_parents );
818
+
819
  return $current_post_type_parents;
820
  }
821
+
822
  /**
823
  * Get Types one-to-many and one-to-one relationships for a given post type, or all the existing otherwise.
824
  *
825
+ * For post reference fields relationships, make sure we alwars offer to insert the parent post data,
826
  * as they do support relationships between the same post type, hence the relationship ends get blurred.
827
  *
828
+ * @param $current_post_type string|null
829
  *
830
  * @return array
831
  *
832
  * @since m2m
833
  */
834
+ public function get_m2m_current_post_type_relationships_per_origin( $current_post_type ) {
835
+
836
+ $relationship_definitions_per_origin = array(
837
  Toolset_Relationship_Origin_Wizard::ORIGIN_KEYWORD => array(),
838
  Toolset_Relationship_Origin_Post_Reference_Field::ORIGIN_KEYWORD => array()
839
  );
840
+
841
  $query = new Toolset_Relationship_Query_V2();
842
+
843
+ // Note that we can not use $query->do_if() because it actually runs both branches
844
  // and one of them expects $current_post_type->name to exist
845
  if ( $current_post_type instanceof WP_Post_Type ) {
846
  $relationship_definitions = $query
847
  ->add(
848
+ $query->do_and(
849
+ $query->do_or(
850
+ $query->has_domain_and_type( $current_post_type->name, Toolset_Element_Domain::POSTS ),
851
+ $query->intermediary_type( $current_post_type->name )
 
 
 
 
852
  ),
853
+ $query->do_or(
854
+ $query->origin( Toolset_Relationship_Origin_Wizard::ORIGIN_KEYWORD ),
855
+ $query->origin( Toolset_Relationship_Origin_Post_Reference_Field::ORIGIN_KEYWORD )
856
+ )
857
  )
858
  )
859
  ->get_results();
860
  } else {
861
  $relationship_definitions = $query
862
  ->add(
863
+ $query->do_or(
864
+ $query->origin( Toolset_Relationship_Origin_Wizard::ORIGIN_KEYWORD ),
865
+ $query->origin( Toolset_Relationship_Origin_Post_Reference_Field::ORIGIN_KEYWORD )
 
 
 
 
 
 
866
  )
867
  )
868
  ->get_results();
869
  }
 
 
 
 
 
 
 
 
 
 
 
 
870
 
871
+ foreach( $relationship_definitions as $relationship_definition ) {
872
+ $relationship_cardinality = $relationship_definition->get_cardinality();
873
  $origin = $relationship_definition->get_origin();
874
+
875
+ $relationship_definitions_per_origin[ $origin->get_origin_keyword() ][] = $relationship_definition;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
876
  }
877
+
878
+ return $relationship_definitions_per_origin;
879
  }
880
 
881
  /**
888
  $shortcode_transformer = new Toolset_Shortcode_Transformer();
889
  $shortcode_transformer->init_hooks();
890
  }
891
+
892
  }
vendor/toolset/toolset-common/inc/toolset.wpml.compatibility.class.php CHANGED
@@ -76,7 +76,7 @@ if ( ! class_exists( 'Toolset_WPML_Compatibility', false ) ) {
76
  *
77
  * @since m2m
78
  */
79
- add_filter( 'wpml_disable_translation_mode_radio', array( $this, 'wpml_disable_translation_mode_radio' ), 10, 3 );
80
  }
81
 
82
 
@@ -219,6 +219,12 @@ if ( ! class_exists( 'Toolset_WPML_Compatibility', false ) ) {
219
  * @since m2m
220
  */
221
  public function is_post_type_translatable( $post_type_slug ) {
 
 
 
 
 
 
222
  return (bool) apply_filters( 'wpml_is_translated_post_type', false, $post_type_slug );
223
  }
224
 
@@ -286,14 +292,36 @@ if ( ! class_exists( 'Toolset_WPML_Compatibility', false ) ) {
286
  }
287
 
288
 
 
 
 
 
 
 
 
289
  public function get_post_language( $post_id ) {
290
  $post_language_details = apply_filters( 'wpml_post_language_details', null, $post_id );
291
  $lang = toolset_getarr( $post_language_details, 'language_code', '' );
292
 
 
 
 
 
293
  return $lang;
294
  }
295
 
296
 
 
 
 
 
 
 
 
 
 
 
 
297
  /**
298
  * Get an array of post translation IDs from the icl_translations table, indexed by language codes.
299
  *
@@ -486,10 +514,13 @@ if ( ! class_exists( 'Toolset_WPML_Compatibility', false ) ) {
486
  * @since m2m
487
  */
488
  public function wpml_disable_translation_mode_radio( $disabled_state_for_mode, $mode, $content_slug ) {
489
- do_action( 'toolset_do_m2m_full_init' );
490
  if( ! apply_filters( 'toolset_is_m2m_enabled', false ) ) {
491
  return $disabled_state_for_mode;
492
  }
 
 
 
493
  $relationships_query = new Toolset_Relationship_Query_V2();
494
  $relationships_query->add( $relationships_query->has_domain( 'posts' ) )
495
  ->add( $relationships_query->has_type( $content_slug ) )
@@ -505,7 +536,7 @@ if ( ! class_exists( 'Toolset_WPML_Compatibility', false ) ) {
505
  if ( in_array( $content_slug, $types, true ) && defined( 'WPML_CONTENT_TYPE_TRANSLATE' ) && $mode == WPML_CONTENT_TYPE_TRANSLATE ) {
506
  $disabled_state_for_mode['state'] = true;
507
  // translators: Relationship name.
508
- $disabled_state_for_mode['reason_message'] = sprintf( __( 'You cannot set this translation mode because the post type is involved in the relationship "%s".', 'wpcf' ), $relationship->get_display_name() ) . ' <a href="https://wp-types.com/documentation/translating-sites-built-with-toolset/translating-related-content/" target="_blank">' . __( 'Learn more' , 'wpcf' ) . '</a>.';
509
  return $disabled_state_for_mode;
510
  }
511
  }
@@ -540,5 +571,29 @@ if ( ! class_exists( 'Toolset_WPML_Compatibility', false ) ) {
540
  $lang_code = array_pop( $this->previous_languages );
541
  do_action( 'wpml_switch_language', $lang_code );
542
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
543
  }
544
  }
76
  *
77
  * @since m2m
78
  */
79
+ //add_filter( 'wpml_disable_translation_mode_radio', array( $this, 'wpml_disable_translation_mode_radio' ), 10, 3 );
80
  }
81
 
82
 
219
  * @since m2m
220
  */
221
  public function is_post_type_translatable( $post_type_slug ) {
222
+ if( ! $this->is_wpml_active_and_configured() ) {
223
+ // Sometimes, the filter below starts working before the activeness check,
224
+ // creating a little mess - this happens on WPML (re)activation.
225
+ return false;
226
+ }
227
+
228
  return (bool) apply_filters( 'wpml_is_translated_post_type', false, $post_type_slug );
229
  }
230
 
292
  }
293
 
294
 
295
+ /**
296
+ * Get the language of a provided post.
297
+ *
298
+ * @param int $post_id
299
+ *
300
+ * @return string Language code or an empty string if none is defined or WPML is not active.
301
+ */
302
  public function get_post_language( $post_id ) {
303
  $post_language_details = apply_filters( 'wpml_post_language_details', null, $post_id );
304
  $lang = toolset_getarr( $post_language_details, 'language_code', '' );
305
 
306
+ if( ! is_string( $lang ) ) {
307
+ $lang = '';
308
+ }
309
+
310
  return $lang;
311
  }
312
 
313
 
314
+ /**
315
+ * Determine whether the current language is "All languages".
316
+ *
317
+ * @return bool
318
+ * @since 2.6.8
319
+ */
320
+ public function is_showing_all_languages() {
321
+ return $this->get_current_language() === 'all';
322
+ }
323
+
324
+
325
  /**
326
  * Get an array of post translation IDs from the icl_translations table, indexed by language codes.
327
  *
514
  * @since m2m
515
  */
516
  public function wpml_disable_translation_mode_radio( $disabled_state_for_mode, $mode, $content_slug ) {
517
+
518
  if( ! apply_filters( 'toolset_is_m2m_enabled', false ) ) {
519
  return $disabled_state_for_mode;
520
  }
521
+
522
+ do_action( 'toolset_do_m2m_full_init' );
523
+
524
  $relationships_query = new Toolset_Relationship_Query_V2();
525
  $relationships_query->add( $relationships_query->has_domain( 'posts' ) )
526
  ->add( $relationships_query->has_type( $content_slug ) )
536
  if ( in_array( $content_slug, $types, true ) && defined( 'WPML_CONTENT_TYPE_TRANSLATE' ) && $mode == WPML_CONTENT_TYPE_TRANSLATE ) {
537
  $disabled_state_for_mode['state'] = true;
538
  // translators: Relationship name.
539
+ $disabled_state_for_mode['reason_message'] = sprintf( __( 'You cannot set this translation mode because the post type is involved in the relationship "%s".', 'wpcf' ), $relationship->get_display_name() ) . ' <a href="https://toolset.com/documentation/translating-sites-built-with-toolset/translating-related-content/" target="_blank">' . __( 'Learn more' , 'wpcf' ) . '</a>.';
540
  return $disabled_state_for_mode;
541
  }
542
  }
571
  $lang_code = array_pop( $this->previous_languages );
572
  do_action( 'wpml_switch_language', $lang_code );
573
  }
574
+
575
+
576
+ /**
577
+ * Get the URL for the WPML setting of post type translation modes.
578
+ *
579
+ * Note: This works since WPML 3.9.2.
580
+ *
581
+ * @return string Escaped URL.
582
+ * @since 3.8
583
+ * @throws RuntimeException If WPML is not active and configured.
584
+ */
585
+ public function get_post_type_translation_settings_url() {
586
+ if( ! $this->is_wpml_active_and_configured() ) {
587
+ throw new RuntimeException( 'Cannot get the translation options URL until WPML is active and configured.');
588
+ }
589
+
590
+ $url = esc_url_raw( apply_filters( 'wpml_get_post_translation_settings_link', '' ) );
591
+ if( ! is_string( $url ) ) {
592
+ // Something bad happened, but not our fault.
593
+ return '';
594
+ }
595
+
596
+ return $url;
597
+ }
598
  }
599
  }
vendor/toolset/toolset-common/lib/Twig/Compiler.php CHANGED
@@ -210,15 +210,7 @@ class Twig_Compiler implements Twig_CompilerInterface
210
  if ($node->getLine() != $this->lastLine) {
211
  $this->write(sprintf("// line %d\n", $node->getLine()));
212
 
213
- // when mbstring.func_overload is set to 2
214
- // mb_substr_count() replaces substr_count()
215
- // but they have different signatures!
216
- if (((int) ini_get('mbstring.func_overload')) & 2) {
217
- // this is much slower than the "right" version
218
- $this->sourceLine += mb_substr_count(mb_substr($this->source, $this->sourceOffset), "\n");
219
- } else {
220
- $this->sourceLine += substr_count($this->source, "\n", $this->sourceOffset);
221
- }
222
  $this->sourceOffset = strlen($this->source);
223
  $this->debugInfo[$this->sourceLine] = $node->getLine();
224
 
210
  if ($node->getLine() != $this->lastLine) {
211
  $this->write(sprintf("// line %d\n", $node->getLine()));
212
 
213
+ $this->sourceLine += substr_count($this->source, "\n", $this->sourceOffset);
 
 
 
 
 
 
 
 
214
  $this->sourceOffset = strlen($this->source);
215
  $this->debugInfo[$this->sourceLine] = $node->getLine();
216
 
vendor/toolset/toolset-common/lib/Twig/Lexer.php CHANGED
@@ -77,12 +77,7 @@ class Twig_Lexer implements Twig_LexerInterface
77
  */
78
  public function tokenize($code, $filename = null)
79
  {
80
- if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) {
81
- $mbEncoding = mb_internal_encoding();
82
- mb_internal_encoding('ASCII');
83
- } else {
84
- $mbEncoding = null;
85
- }
86
 
87
  $this->code = str_replace(array("\r\n", "\r"), "\n", $code);
88
  $this->filename = $filename;
77
  */
78
  public function tokenize($code, $filename = null)
79
  {
80
+ $mbEncoding = null;
 
 
 
 
 
81
 
82
  $this->code = str_replace(array("\r\n", "\r"), "\n", $code);
83
  $this->filename = $filename;
vendor/toolset/toolset-common/lib/cakephp.validation.class.php CHANGED
@@ -124,7 +124,7 @@ if ( ! class_exists( 'Toolset_CakePHP_Validation', false ) ) {
124
  */
125
  function notEmpty($check) {
126
  $_this = & Toolset_CakePHP_Validation::getInstance();
127
- $_this->__reset();
128
  $_this->check = $check;
129
 
130
  if (is_array($check)) {
@@ -152,7 +152,7 @@ if ( ! class_exists( 'Toolset_CakePHP_Validation', false ) ) {
152
  */
153
  function alphaNumeric($check) {
154
  $_this = & Toolset_CakePHP_Validation::getInstance();
155
- $_this->__reset();
156
  $_this->check = $check;
157
 
158
  if (is_array($check)) {
@@ -175,7 +175,7 @@ if ( ! class_exists( 'Toolset_CakePHP_Validation', false ) ) {
175
 
176
  function alphaNumericWhitespaces($check) {
177
  $_this = & Toolset_CakePHP_Validation::getInstance();
178
- $_this->__reset();
179
  $_this->check = $check;
180
 
181
  if (is_array($check)) {
@@ -225,7 +225,7 @@ if ( ! class_exists( 'Toolset_CakePHP_Validation', false ) ) {
225
  */
226
  function blank($check) {
227
  $_this = & Toolset_CakePHP_Validation::getInstance();
228
- $_this->__reset();
229
  $_this->check = $check;
230
 
231
  if (is_array($check)) {
@@ -252,7 +252,7 @@ if ( ! class_exists( 'Toolset_CakePHP_Validation', false ) ) {
252
  */
253
  function cc($check, $type = 'fast', $deep = false, $regex = null) {
254
  $_this = & Toolset_CakePHP_Validation::getInstance();
255
- $_this->__reset();
256
  $_this->check = $check;
257
  $_this->type = $type;
258
  $_this->deep = $deep;
@@ -390,7 +390,7 @@ if ( ! class_exists( 'Toolset_CakePHP_Validation', false ) ) {
390
  */
391
  function custom($check, $regex = null) {
392
  $_this = & Toolset_CakePHP_Validation::getInstance();
393
- $_this->__reset();
394
  $_this->check = $check;
395
  $_this->regex = $regex;
396
  if (is_array($check)) {
@@ -434,7 +434,7 @@ if ( ! class_exists( 'Toolset_CakePHP_Validation', false ) ) {
434
  $format = $cake_date_formats[$date_format];
435
 
436
  $_this = & Toolset_CakePHP_Validation::getInstance();
437
- $_this->__reset();
438
  $_this->check = $check;
439
  $_this->regex = $regex;
440
 
@@ -472,7 +472,7 @@ if ( ! class_exists( 'Toolset_CakePHP_Validation', false ) ) {
472
  */
473
  function time($check) {
474
  $_this = & Toolset_CakePHP_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();
@@ -502,7 +502,7 @@ if ( ! class_exists( 'Toolset_CakePHP_Validation', false ) ) {
502
  */
503
  function decimal($check, $places = null, $regex = null) {
504
  $_this = & Toolset_CakePHP_Validation::getInstance();
505
- $_this->__reset();
506
  $_this->regex = $regex;
507
  $_this->check = $check;
508
 
@@ -527,7 +527,7 @@ if ( ! class_exists( 'Toolset_CakePHP_Validation', false ) ) {
527
  */
528
  function email($check, $deep = false, $regex = null) {
529
  $_this = & Toolset_CakePHP_Validation::getInstance();
530
- $_this->__reset();
531
  $_this->check = $check;
532
  $_this->regex = $regex;
533
  $_this->deep = $deep;
@@ -627,7 +627,7 @@ if ( ! class_exists( 'Toolset_CakePHP_Validation', false ) ) {
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();
@@ -644,7 +644,7 @@ if ( ! class_exists( 'Toolset_CakePHP_Validation', false ) ) {
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();
@@ -939,7 +939,7 @@ if ( ! class_exists( 'Toolset_CakePHP_Validation', false ) ) {
939
  */
940
  function url($check, $strict = false) {
941
  $_this = & Toolset_CakePHP_Validation::getInstance();
942
- $_this->__populateIp();
943
  $_this->check = $check;
944
  $validChars = '([' . preg_quote('!"$&\'()*+,-.@_:;=~[]') . '\/0-9a-z\p{L}\p{N}]|(%[0-9a-f]{2}))';
945
  $_this->regex = '/^(?:(?:https?|ftps?|file|news|gopher):\/\/)' . (!empty($strict) ? '' : '?') .
@@ -1093,7 +1093,12 @@ if ( ! class_exists( 'Toolset_CakePHP_Validation', false ) ) {
1093
  * @access private
1094
  */
1095
 
1096
- function __populateIp() {
 
 
 
 
 
1097
  if (!isset($this->__pattern['IPv6'])) {
1098
  $pattern = '((([0-9A-Fa-f]{1,4}:){7}(([0-9A-Fa-f]{1,4})|:))|(([0-9A-Fa-f]{1,4}:){6}';
1099
  $pattern .= '(:|((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})';
@@ -1124,7 +1129,11 @@ if ( ! class_exists( 'Toolset_CakePHP_Validation', false ) ) {
1124
  * @return void
1125
  * @access private
1126
  */
1127
- function __reset() {
 
 
 
 
1128
  $this->check = null;
1129
  $this->regex = null;
1130
  $this->country = null;
@@ -1134,6 +1143,26 @@ if ( ! class_exists( 'Toolset_CakePHP_Validation', false ) ) {
1134
  $this->errors = array();
1135
  }
1136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1137
  }
1138
 
1139
  }
124
  */
125
  function notEmpty($check) {
126
  $_this = & Toolset_CakePHP_Validation::getInstance();
127
+ $_this->reset();
128
  $_this->check = $check;
129
 
130
  if (is_array($check)) {
152
  */
153
  function alphaNumeric($check) {
154
  $_this = & Toolset_CakePHP_Validation::getInstance();
155
+ $_this->reset();
156
  $_this->check = $check;
157
 
158
  if (is_array($check)) {
175
 
176
  function alphaNumericWhitespaces($check) {
177
  $_this = & Toolset_CakePHP_Validation::getInstance();
178
+ $_this->reset();
179
  $_this->check = $check;
180
 
181
  if (is_array($check)) {
225
  */
226
  function blank($check) {
227
  $_this = & Toolset_CakePHP_Validation::getInstance();
228
+ $_this->reset();
229
  $_this->check = $check;
230
 
231
  if (is_array($check)) {
252
  */
253
  function cc($check, $type = 'fast', $deep = false, $regex = null) {
254
  $_this = & Toolset_CakePHP_Validation::getInstance();
255
+ $_this->reset();
256
  $_this->check = $check;
257
  $_this->type = $type;
258
  $_this->deep = $deep;
390
  */
391
  function custom($check, $regex = null) {
392
  $_this = & Toolset_CakePHP_Validation::getInstance();
393
+ $_this->reset();
394
  $_this->check = $check;
395
  $_this->regex = $regex;
396
  if (is_array($check)) {
434
  $format = $cake_date_formats[$date_format];
435
 
436
  $_this = & Toolset_CakePHP_Validation::getInstance();
437
+ $_this->reset();
438
  $_this->check = $check;
439
  $_this->regex = $regex;
440
 
472
  */
473
  function time($check) {
474
  $_this = & Toolset_CakePHP_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();
502
  */
503
  function decimal($check, $places = null, $regex = null) {
504
  $_this = & Toolset_CakePHP_Validation::getInstance();
505
+ $_this->reset();
506
  $_this->regex = $regex;
507
  $_this->check = $check;
508
 
527
  */
528
  function email($check, $deep = false, $regex = null) {
529
  $_this = & Toolset_CakePHP_Validation::getInstance();
530
+ $_this->reset();
531
  $_this->check = $check;
532
  $_this->regex = $regex;
533
  $_this->deep = $deep;
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();
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();
939
  */
940
  function url($check, $strict = false) {
941
  $_this = & Toolset_CakePHP_Validation::getInstance();
942
+ $_this->populateIp();
943
  $_this->check = $check;
944
  $validChars = '([' . preg_quote('!"$&\'()*+,-.@_:;=~[]') . '\/0-9a-z\p{L}\p{N}]|(%[0-9a-f]{2}))';
945
  $_this->regex = '/^(?:(?:https?|ftps?|file|news|gopher):\/\/)' . (!empty($strict) ? '' : '?') .
1093
  * @access private
1094
  */
1095
 
1096
+ function populateIp() {
1097
+ if( method_exists( $this, '__populateIp' ) ) {
1098
+ // support for subclasses overwritting the previous __populateIp function
1099
+ return $this->__populateIp();
1100
+ }
1101
+
1102
  if (!isset($this->__pattern['IPv6'])) {
1103
  $pattern = '((([0-9A-Fa-f]{1,4}:){7}(([0-9A-Fa-f]{1,4})|:))|(([0-9A-Fa-f]{1,4}:){6}';
1104
  $pattern .= '(:|((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})';
1129
  * @return void
1130
  * @access private
1131
  */
1132
+ function reset() {
1133
+ if( method_exists( $this, '__reset' ) ) {
1134
+ // support for subclasses overwritting the previous __reset function
1135
+ return $this->__reset();
1136
+ }
1137
  $this->check = null;
1138
  $this->regex = null;
1139
  $this->country = null;
1143
  $this->errors = array();
1144
  }
1145
 
1146
+
1147
+ /**
1148
+ * Backward compatibility
1149
+ * For PHP 7 we renamed the method __reset() and __populateIp() to reset() and populateIp().
1150
+ * As both are public methods we apply this fallback for the case someone calls the old methods.
1151
+ *
1152
+ * @param $method
1153
+ * @param $arguments
1154
+ */
1155
+ public function __call( $method, $arguments ) {
1156
+ switch ( $method ) {
1157
+ case '__reset':
1158
+ $this->reset();
1159
+ break;
1160
+ case '__populateIp':
1161
+ $this->populateIp();
1162
+ break;
1163
+ }
1164
+ }
1165
+
1166
  }
1167
 
1168
  }
vendor/toolset/toolset-common/loader.php CHANGED
@@ -27,7 +27,12 @@
27
  * Now that we have a unique version for all plugins
28
  * we define the version here
29
  */
30
- $toolset_common_version = 262000;
 
 
 
 
 
31
 
32
 
33
  /* ---------------------------------------------------------------------- *\
@@ -79,7 +84,7 @@ if ( ! function_exists( 'toolset_common_initialize' ) ) {
79
 
80
  $path = untrailingslashit( $path );
81
  $url = untrailingslashit( $url );
82
-
83
  // Save the url in the matching path
84
  foreach ( $toolset_common_paths as $key => $data ) {
85
  if ( $toolset_common_paths[ $key ]['path'] == $path ) {
27
  * Now that we have a unique version for all plugins
28
  * we define the version here
29
  */
30
+
31
+ // Note: Since the 2.8 branch is meant just for the support of the legacy Types 2.3.* branch,
32
+ // we're relaxing the rule and incrementing the loader number just by one.
33
+ //
34
+ // This may keep going on for some time and we don't want to run out of numbers for point releases.
35
+ $toolset_common_version = 280001;
36
 
37
 
38
  /* ---------------------------------------------------------------------- *\
84
 
85
  $path = untrailingslashit( $path );
86
  $url = untrailingslashit( $url );
87
+
88
  // Save the url in the matching path
89
  foreach ( $toolset_common_paths as $key => $data ) {
90
  if ( $toolset_common_paths[ $key ]['path'] == $path ) {
vendor/toolset/toolset-common/res/css/toolset-admin-notices.css CHANGED
@@ -112,6 +112,11 @@
112
  margin-right: -15px;
113
  }
114
 
 
 
 
 
 
115
  .toolset-list {
116
  padding: 2px;
117
  margin: 13px 0 13px 20px;
@@ -160,6 +165,24 @@
160
  top: 28px;
161
  }
162
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  @media screen and (max-width: 850px) {
164
  .toolset-dashboard-link-top-right {
165
  display: none;
112
  margin-right: -15px;
113
  }
114
 
115
+ .toolset-notice-wp-no-external-link-highlighting .toolset-external-link:after,
116
+ .toolset-notice-wp-no-external-link-highlighting .toolset-button-external-link:after {
117
+ content: none;
118
+ }
119
+
120
  .toolset-list {
121
  padding: 2px;
122
  margin: 13px 0 13px 20px;
165
  top: 28px;
166
  }
167
 
168
+ .toolset-notice-robot {
169
+ min-height: 20px;
170
+ padding-left: 60px;
171
+ }
172
+ .toolset-notice-robot .toolset-robot {
173
+ position: absolute;
174
+ top: 0px;
175
+ left: 0px;
176
+ bottom: 0px;
177
+ width: 50px;
178
+ display: table-cell;
179
+ text-align: center;
180
+ vertical-align: middle;
181
+ background: url(../images/icon-help-message.svg) center center no-repeat #333;
182
+ background-size: 42px 42px;
183
+ box-shadow: inset 0 0 15px #111;
184
+ }
185
+
186
  @media screen and (max-width: 850px) {
187
  .toolset-dashboard-link-top-right {
188
  display: none;
vendor/toolset/toolset-common/res/css/toolset-common.css CHANGED
@@ -327,4 +327,8 @@ Overlay
327
  padding: 5px 15px;
328
  color: #c09853;
329
  background: #fcf8e3;
330
- }
 
 
 
 
327
  padding: 5px 15px;
328
  color: #c09853;
329
  background: #fcf8e3;
330
+ }
331
+ /* ----------------------------------------------------------------------------
332
+ Import/Export page overrides
333
+ ---------------------------------------------------------------------------- */
334
+ p.toolset-tab-controls{min-width: 100%;}
vendor/toolset/toolset-common/res/css/toolset-notifications.css CHANGED
@@ -28,6 +28,10 @@ span.toolset-alert {
28
  cursor: pointer;
29
  }
30
 
 
 
 
 
31
  .toolset-alert,
32
  .toolset-alert .toolset-alert-header {
33
  color: #c09853;
@@ -44,10 +48,21 @@ span.toolset-alert {
44
  color: #999;
45
  cursor:pointer;
46
  }
47
-
48
  .toolset-alert .button {
49
  text-shadow: none;
50
  }
 
 
 
 
 
 
 
 
 
 
 
51
 
52
  .toolset-alert-success {
53
  border-color: #d6e9c6;
@@ -58,6 +73,10 @@ span.toolset-alert {
58
  .toolset-alert-success .toolset-alert-header {
59
  color: #468847;
60
  }
 
 
 
 
61
 
62
  .toolset-alert-error {
63
  border-color: #eed3d7;
@@ -68,6 +87,10 @@ span.toolset-alert {
68
  .toolset-alert-error .toolset-alert-header {
69
  color: #b94a48;
70
  }
 
 
 
 
71
 
72
  .toolset-alert-info {
73
  border-color: #bce8f1;
@@ -78,126 +101,171 @@ span.toolset-alert {
78
  .toolset-alert-info .toolset-alert-header {
79
  color: #3a87ad;
80
  }
 
 
 
 
81
 
82
  /* Explanation messages */
83
  .toolset-help {
84
- display: table;
85
- width: 100%;
86
  background: #fff;
87
- border: none;
 
88
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
 
90
  .js-show-toolset-message {
91
  display: none;
92
  }
93
 
94
- .toolset-help-content {
95
- display: table-cell;
96
- vertical-align: middle;
97
- padding: 25px 25px 15px 180px;
98
- height: 135px;
99
- color: #4f4f4f;
100
- border: solid 1px #cdcdcd;
101
- }
102
 
103
- .toolset-help-content a {
104
- display: inline-block;
105
- line-height: 18px;
106
- text-decoration: underline;
107
- }
108
- .toolset-help-content p,
109
- .toolset-help-content ul,
110
- .toolset-help-content ol {
111
- line-height: 1.6;
112
- }
113
- .toolset-help-content ul,
114
- .toolset-help-content ol {
115
- margin-left: 0;
116
- list-style-position: inside;
117
- }
118
- .toolset-help-content ul li {
119
- list-style-type: disc;
120
- }
121
- .toolset-help-content ol li {
122
- list-style-type: decimal;
123
- }
124
- .toolset-help-content p:first-child {
125
- margin-top: 0;
126
- }
127
- .toolset-help-content .btn {
128
- margin: 0 10px 0 0;
129
- padding: 4px 10px;
130
- border: 0;
131
- border-radius: 4px;
132
- background: #11a99b;
133
- color: #fff;
134
- text-decoration: none;
135
- text-shadow: none;
136
- font-weight: bold;
137
  }
138
-
139
- .toolset-help-content .btn:hover {
140
- background: #008C7D;
 
 
 
141
  }
 
 
 
 
 
142
 
143
- .toolset-help-content .toolset-help-content-toolbar {
144
- margin: 20px 0 10px 0;
145
- }
 
146
 
147
- .toolset-help-sidebar {
148
- position: absolute;
149
- top: 1px;
150
- left: 1px;
151
- bottom: 1px;
152
- width: 144px;
153
- display: table-cell;
154
- text-align: center;
155
- vertical-align: middle;
156
- background: url('../images/icon-help-message.png') center center no-repeat #333;
157
- box-shadow: inset 0 0 15px #111;
158
  }
159
- .toolset-help-sidebar-ico {
160
-
161
- }
162
 
163
- .toolset-help-footer {
164
- position: relative;
165
- z-index: 1;
166
- padding: 5px;
167
- border-top: 1px solid #cdcdcd;
168
- background: #fff;
169
- text-align: right;
170
  }
171
 
172
- .toolset-help-footer [class^="button-"] {
173
- margin-left: 5px;
174
- }
175
 
 
 
 
 
 
 
 
 
 
 
 
176
 
177
- .toolset-help .icon-remove-sign,
178
- .toolset-help .icon-remove {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  position: absolute;
180
- top: 0;
181
- right: 0;
182
- color: #999;
183
- opacity: 1;
184
- background: #fff;
185
- border: solid 1px #cdcdcd;
186
- padding: 2px 4px;
187
- font-size: 16px;
188
- cursor: pointer;
189
  }
190
-
191
- .toolset-help .icon-remove-sign:hover,
192
- .toolset-help .icon-remove:hover {
193
- background: #b94a48;
194
- color: #fff;
195
  }
196
-
197
- .toolset-help code {
198
- display: inline-block;
 
 
 
 
 
 
 
 
 
199
  }
200
 
 
201
  /* TOOLTIP */
202
  .toolset-tooltip {
203
  position: absolute;
@@ -205,7 +273,7 @@ span.toolset-alert {
205
  display: inline-block;
206
  display: none;
207
  padding: 3px 6px;
208
- max-width: 300px;
209
  background: #000;
210
  background: rgba(0,0,0,.8);
211
  color: #fff;
@@ -304,7 +372,7 @@ span.toolset-alert {
304
  }
305
 
306
  .wp-toolset-pointer .wp-pointer-buttons {
307
-
308
  }
309
 
310
  .wp-toolset-pointer .wp-pointer-buttons button.alignright {
@@ -324,6 +392,10 @@ span.toolset-alert {
324
  border-bottom-color: #EF6223;
325
  }
326
 
 
 
 
 
327
  .wp-toolset-pointer.wp-pointer-right .wp-pointer-arrow-inner {
328
  right: 2px;
329
  border-color: transparent transparent transparent #e9e9e9;
@@ -377,19 +449,19 @@ span.dont-wrap{float:right;margin-right:12px;}
377
  transition: all 0.15s linear;
378
  z-index: 1111;
379
  }
380
-
381
  .toolset-ajax-saving-messages.toolset-ajax-saving-messages-success {
382
  border-color: #d6e9c6;
383
  background-color: #dff0d8;
384
  color: #468847;
385
  }
386
-
387
  .toolset-ajax-saving-messages.toolset-ajax-saving-messages-fail {
388
  border-color: #eed3d7;
389
  background-color: #f2dede;
390
  color: #b94a48;
391
  }
392
-
393
  .toolset-ajax-saving-messages i {
394
  margin-right: 5px;
395
- }
28
  cursor: pointer;
29
  }
30
 
31
+ .toolset-alert.hidden {
32
+ display: none;
33
+ }
34
+
35
  .toolset-alert,
36
  .toolset-alert .toolset-alert-header {
37
  color: #c09853;
48
  color: #999;
49
  cursor:pointer;
50
  }
51
+
52
  .toolset-alert .button {
53
  text-shadow: none;
54
  }
55
+
56
+ .toolset-alert .toolset-rounded-icon {
57
+ width: 25px;
58
+ height: 25px;
59
+ margin-right: 10px;
60
+ line-height: 25px;
61
+ text-align: center;
62
+ color: #fff;
63
+ background: #c09853;
64
+ border-radius: 50%;
65
+ }
66
 
67
  .toolset-alert-success {
68
  border-color: #d6e9c6;
73
  .toolset-alert-success .toolset-alert-header {
74
  color: #468847;
75
  }
76
+
77
+ .toolset-alert-success .toolset-rounded-icon {
78
+ background: #468847;
79
+ }
80
 
81
  .toolset-alert-error {
82
  border-color: #eed3d7;
87
  .toolset-alert-error .toolset-alert-header {
88
  color: #b94a48;
89
  }
90
+
91
+ .toolset-alert-error .toolset-rounded-icon {
92
+ background: #b94a48;
93
+ }
94
 
95
  .toolset-alert-info {
96
  border-color: #bce8f1;
101
  .toolset-alert-info .toolset-alert-header {
102
  color: #3a87ad;
103
  }
104
+
105
+ .toolset-alert-info .toolset-rounded-icon {
106
+ background: #3a87ad;
107
+ }
108
 
109
  /* Explanation messages */
110
  .toolset-help {
 
 
111
  background: #fff;
112
+ border: solid 1px #cdcdcd;
113
+ border-radius: 0;
114
  }
115
+ .toolset-help .icon-remove-sign,
116
+ .toolset-help .icon-remove {
117
+ position: absolute;
118
+ top: -1px;
119
+ right: -1px;
120
+ color: #999;
121
+ opacity: 1;
122
+ background: #fff;
123
+ border: solid 1px #cdcdcd;
124
+ padding: 2px 4px;
125
+ font-size: 16px;
126
+ cursor: pointer;
127
+ }
128
+
129
+ .rtl .toolset-help .icon-remove-sign,
130
+ .rtl .toolset-help .icon-remove {
131
+ right: auto;
132
+ left: -1px;
133
+ }
134
+
135
+ .toolset-help .icon-remove-sign:hover,
136
+ .toolset-help .icon-remove:hover {
137
+ background: #b94a48;
138
+ color: #fff;
139
+ }
140
+
141
+ .toolset-help code {
142
+ display: inline-block;
143
+ }
144
 
145
  .js-show-toolset-message {
146
  display: none;
147
  }
148
 
149
+ .toolset-help-content {
150
+ padding: 9px 25px;
151
+ color: #4f4f4f;
152
+ -webkit-box-sizing: border-box;
153
+ box-sizing: border-box;
154
+ -webkit-margin-start: 25%;
155
+ -moz-margin-start: 25%;
156
+ margin-inline-start: 25%;
157
 
158
+ }
159
+ @media (max-width: 480px) {
160
+ .toolset-help-content {
161
+ -webkit-margin-start: 70px;
162
+ -moz-margin-start: 70px;
163
+ margin-inline-start: 70px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  }
165
+ }
166
+ @media (min-width: 960px) {
167
+ .toolset-help-content {
168
+ -webkit-margin-start: 160px;
169
+ -moz-margin-start: 160px;
170
+ margin-inline-start: 160px;
171
  }
172
+ }
173
+
174
+ .toolset-help-content a {
175
+ text-decoration: underline;
176
+ }
177
 
178
+ .toolset-help-content a.button {
179
+ display: inline-block;
180
+ line-height: 18px;
181
+ }
182
 
183
+ .toolset-help-content ul,
184
+ .toolset-help-content ol {
185
+ line-height: 1.6;
186
+ margin-left: 0;
187
+ list-style-position: inside;
 
 
 
 
 
 
188
  }
 
 
 
189
 
190
+ .toolset-help-content ul li {
191
+ list-style-type: disc;
 
 
 
 
 
192
  }
193
 
194
+ .toolset-help-content ol li {
195
+ list-style-type: decimal;
196
+ }
197
 
198
+ .toolset-help-content .btn {
199
+ margin: 0 10px 0 0;
200
+ padding: 4px 10px;
201
+ border: 0;
202
+ border-radius: 4px;
203
+ background: #11a99b;
204
+ color: #fff;
205
+ text-decoration: none;
206
+ text-shadow: none;
207
+ font-weight: bold;
208
+ }
209
 
210
+ .toolset-help-content .btn:hover {
211
+ background: #008C7D;
212
+ }
213
+
214
+ .toolset-help-content .toolset-help-content-toolbar {
215
+ margin: 20px 0 10px 0;
216
+ }
217
+
218
+ .toolset-help-sidebar {
219
+ position: absolute;
220
+ top: -1px;
221
+ bottom: -1px;
222
+ left: -1px;
223
+ width: 25%;
224
+ background: #333;
225
+ }
226
+ @media (max-width: 480px) {
227
+ .toolset-help-sidebar {
228
+ width: 70px;
229
+ }
230
+ }
231
+ @media (min-width: 960px) {
232
+ .toolset-help-sidebar {
233
+ width: 160px;
234
+ }
235
+ }
236
+ .rtl .toolset-help-sidebar {
237
+ left: auto;
238
+ right: -1px;
239
+ }
240
+ .toolset-help-sidebar::before {
241
+ content: '';
242
  position: absolute;
243
+ top: 3%;
244
+ right: 15%;
245
+ bottom: 2%;
246
+ left: 6%;
247
+ background: url('../images/icon-help-message.svg') center no-repeat;
248
+ background-size: contain;
 
 
 
249
  }
250
+ .rtl .toolset-help-sidebar::before {
251
+ right: 6%;
252
+ left: 15%;
 
 
253
  }
254
+
255
+ .toolset-help-footer {
256
+ position: relative;
257
+ z-index: 1;
258
+ padding: 5px;
259
+ border-top: 1px solid #cdcdcd;
260
+ background: #fff;
261
+ text-align: right;
262
+ }
263
+
264
+ .toolset-help-footer [class^="button-"] {
265
+ margin-left: 5px;
266
  }
267
 
268
+
269
  /* TOOLTIP */
270
  .toolset-tooltip {
271
  position: absolute;
273
  display: inline-block;
274
  display: none;
275
  padding: 3px 6px;
276
+ max-width: 300px;
277
  background: #000;
278
  background: rgba(0,0,0,.8);
279
  color: #fff;
372
  }
373
 
374
  .wp-toolset-pointer .wp-pointer-buttons {
375
+
376
  }
377
 
378
  .wp-toolset-pointer .wp-pointer-buttons button.alignright {
392
  border-bottom-color: #EF6223;
393
  }
394
 
395
+ .wp-toolset-pointer.wp-toolset-shortcode-pointer.wp-pointer-top .wp-pointer-arrow {
396
+ left: 187px;
397
+ }
398
+
399
  .wp-toolset-pointer.wp-pointer-right .wp-pointer-arrow-inner {
400
  right: 2px;
401
  border-color: transparent transparent transparent #e9e9e9;
449
  transition: all 0.15s linear;
450
  z-index: 1111;
451
  }
452
+
453
  .toolset-ajax-saving-messages.toolset-ajax-saving-messages-success {
454
  border-color: #d6e9c6;
455
  background-color: #dff0d8;
456
  color: #468847;
457
  }
458
+
459
  .toolset-ajax-saving-messages.toolset-ajax-saving-messages-fail {
460
  border-color: #eed3d7;
461
  background-color: #f2dede;
462
  color: #b94a48;
463
  }
464
+
465
  .toolset-ajax-saving-messages i {
466
  margin-right: 5px;
467
+ }
vendor/toolset/toolset-common/res/js/toolset-admin-notices.js CHANGED
@@ -1,13 +1,20 @@
1
  ;( function( $ ) {
2
-
3
  $( document ).on( 'click', '[data-' + toolset_admin_notices.triggerNoticeDismissible + ']', function() {
4
- var notice = $( this ).parent( '.toolset-notice-wp' );
5
  var ajaxRequestData = {};
6
  ajaxRequestData['action'] = toolset_admin_notices.action;
7
  ajaxRequestData[toolset_admin_notices.varnameNonce] = toolset_admin_notices.nonce;
8
  ajaxRequestData[toolset_admin_notices.varnameAction] = toolset_admin_notices.triggerNoticeDismissible;
9
  ajaxRequestData[toolset_admin_notices.varnameNoticeId] = $( this ).data( toolset_admin_notices.triggerNoticeDismissible );
10
 
 
 
 
 
 
 
 
 
11
  $.ajax( {
12
  url: ajaxurl,
13
  method: 'POST',
@@ -27,4 +34,14 @@
27
  $( elementSelectorString ).toggle();
28
  } )
29
 
30
- } ( jQuery ) );
 
 
 
 
 
 
 
 
 
 
1
  ;( function( $ ) {
 
2
  $( document ).on( 'click', '[data-' + toolset_admin_notices.triggerNoticeDismissible + ']', function() {
3
+ var notice = $( this ).parents( '.toolset-notice-wp' );
4
  var ajaxRequestData = {};
5
  ajaxRequestData['action'] = toolset_admin_notices.action;
6
  ajaxRequestData[toolset_admin_notices.varnameNonce] = toolset_admin_notices.nonce;
7
  ajaxRequestData[toolset_admin_notices.varnameAction] = toolset_admin_notices.triggerNoticeDismissible;
8
  ajaxRequestData[toolset_admin_notices.varnameNoticeId] = $( this ).data( toolset_admin_notices.triggerNoticeDismissible );
9
 
10
+ var stopSimilarNotices = [];
11
+
12
+ $("input[name='dismiss-similar-notices[]']:checked").each(function () {
13
+ stopSimilarNotices.push( $(this).val() );
14
+ });
15
+
16
+ ajaxRequestData[toolset_admin_notices.varnameDismissSimilarNotices] = stopSimilarNotices;
17
+
18
  $.ajax( {
19
  url: ajaxurl,
20
  method: 'POST',
34
  $( elementSelectorString ).toggle();
35
  } )
36
 
37
+ jQuery( '.notice.js-toolset-fadable' ).each( function() {
38
+ var $this = jQuery( this );
39
+ var text = $this.text();
40
+ // Formula taken from https://ux.stackexchange.com/a/85898
41
+ var miliseconds = Math.max( Math.min( text.length * 50, 2000 ), 7000 );
42
+ setTimeout( function() {
43
+ $this.fadeOut( );
44
+ }, miliseconds )
45
+ } );
46
+
47
+ } ( jQuery ) );
vendor/toolset/toolset-common/res/js/toolset-bs-component-buttons.js CHANGED
@@ -104,6 +104,10 @@ ToolsetCommon.BootstrapCssComponentsQuickTags = function($){
104
  if( typeof $bootstrap_components !== 'object' ){
105
  return;
106
  }
 
 
 
 
107
 
108
  if ( typeof( QTags.getInstance( instance ).getButton( 'bs_component_show_hide_button' ) ) === 'undefined' ) {
109
  QTags.addButton(
104
  if( typeof $bootstrap_components !== 'object' ){
105
  return;
106
  }
107
+
108
+ if ( _.isUndefined( QTags.getInstance( instance ) ) ) {
109
+ return;
110
+ }
111
 
112
  if ( typeof( QTags.getInstance( instance ).getButton( 'bs_component_show_hide_button' ) ) === 'undefined' ) {
113
  QTags.addButton(
vendor/toolset/toolset-common/res/js/toolset-chosen-wrapper.js CHANGED
@@ -46,6 +46,68 @@ ToolsetCommon.ToolsetChosenSelector = function( ) {
46
  });
47
 
48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  return this;
50
  },
51
 
46
  });
47
 
48
 
49
+ return this;
50
+ },
51
+
52
+ });
53
+
54
+ jQuery.fn.extend({
55
+ toolset_chosen_multiple_css_classes: function( params, options, selected_classes ) {
56
+
57
+ var chosen_element = jQuery( this ).length === 1 ? jQuery( this ) : jQuery( this.selector );
58
+ var item_selected = '';
59
+
60
+ chosen_element.chosen("destroy");
61
+
62
+ chosen_element.chosen(params);
63
+ chosen_element.empty().trigger('chosen:updated');
64
+
65
+
66
+ if(options){
67
+ jQuery.each(options, function( index, value ) {
68
+ if( jQuery.inArray( value, selected_classes ) > -1 ){
69
+ item_selected = 'selected';
70
+ }
71
+ chosen_element.append( '<option '+item_selected+' value="'+value+'">'+value+'</option>' );
72
+ item_selected = '';
73
+ });
74
+ }
75
+
76
+ jQuery('.chosen-choices').find('input').on('keyup', function(e){
77
+
78
+ // if we hit Enter, space or comma
79
+ if ( e.which == 13 || e.which == 32 || e.which == 188 )
80
+ {
81
+
82
+ var multiple_classes = this.value.split(/(?:,| )+/); // split by space or comma
83
+
84
+ if( multiple_classes.length > 0 ) {
85
+
86
+ // remove duplicates and empty strings
87
+ multiple_classes = _.compact(_.uniq( multiple_classes ) );
88
+
89
+ _.each( multiple_classes, function(single_class) {
90
+ var option = jQuery("<option>").val(single_class).text(single_class);
91
+ chosen_element.prepend(option);
92
+ chosen_element.find(option).prop('selected', true);
93
+ chosen_element.trigger("chosen:updated");
94
+
95
+ });
96
+
97
+ } else {
98
+ var option = jQuery("<option>").val(this.value).text(this.value);
99
+ chosen_element.prepend(option);
100
+ chosen_element.find(option).prop('selected', true);
101
+ chosen_element.trigger("chosen:updated");
102
+ }
103
+ }
104
+ });
105
+
106
+ _.defer(function(){
107
+ chosen_element.trigger("chosen:updated");
108
+ });
109
+
110
+
111
  return this;
112
  },
113
 
vendor/toolset/toolset-common/res/js/toolset-select2-compatibility.js CHANGED
@@ -149,6 +149,11 @@ ToolsetCommon.toolset_select2ExecMethods = function(el, method, param){
149
  jQuery(el).toolset_select2_original("close");
150
  }
151
  break;
 
 
 
 
 
152
  case "destroy":
153
  case "destory":
154
  jQuery(el).removeClass("toolset_select2_converted");
149
  jQuery(el).toolset_select2_original("close");
150
  }
151
  break;
152
+ case "open":
153
+ if(jQuery(el).data("toolset_select2") != null && jQuery(el).data("toolset_select2") != undefined){
154
+ jQuery(el).toolset_select2_original("open");
155
+ }
156
+ break;
157
  case "destroy":
158
  case "destory":
159
  jQuery(el).removeClass("toolset_select2_converted");
vendor/toolset/toolset-common/res/js/toolset-shortcode.js CHANGED
@@ -219,6 +219,13 @@ Toolset.shortcodeManager = function( $ ) {
219
  */
220
  Toolset.hooks.addAction( 'toolset-action-shortcode-dialog-loaded', self.initSelect2 );
221
 
 
 
 
 
 
 
 
222
  /**
223
  * Init a wizard dialog, set the options width, and set the right value as selected.
224
  *
@@ -520,6 +527,21 @@ Toolset.shortcodeManager = function( $ ) {
520
  self.initSelect2AjaxAttributes();
521
  };
522
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
523
  /**
524
  * Initialize the wizard GUI for a shortcode.
525
  *
@@ -870,13 +892,21 @@ Toolset.shortcodeManager = function( $ ) {
870
  });
871
  */
872
  // Special case: item selector tab
873
- if (
874
- $( '.js-toolset-shortcode-gui-item-selector:checked', evaluatedContainer ).length > 0
875
- && 'object_id' == $( '.js-toolset-shortcode-gui-item-selector:checked', evaluatedContainer ).val()
876
- ) {
877
- var itemSelection = $( '.js-toolset-shortcode-gui-item-selector_object_id', evaluatedContainer ),
878
- itemSelectionId = itemSelection.val(),
879
- itemSelectionValid = true;
 
 
 
 
 
 
 
 
880
  //$itemSelectionMessage = '';
881
  if ( '' == itemSelectionId ) {
882
  itemSelectionValid = false;
@@ -973,8 +1003,12 @@ Toolset.shortcodeManager = function( $ ) {
973
  case 'referenced':
974
  shortcodeAttributeValue = $( '[name="referenced_object"]:checked', attributeWrapper ).val();
975
  break;
976
- case 'object_id':
 
 
 
977
  shortcodeAttributeValue = $( '.js-toolset-shortcode-gui-item-selector_object_id', attributeWrapper ).val();
 
978
  case 'parent': // The value is correct out of the box
979
  default:
980
  break;
@@ -1053,7 +1087,7 @@ Toolset.shortcodeManager = function( $ ) {
1053
  // Compose the shortcodeAttributeString string
1054
  _.each( shortcodeAttributeValues, function( value, key ) {
1055
  if ( value ) {
1056
- shortcodeAttributeString += " " + key + '="' + value + '"';
1057
  }
1058
  });
1059
 
@@ -1237,6 +1271,42 @@ Toolset.shortcodeManager = function( $ ) {
1237
  $( '.js-wpv-loop-wizard-save-shortcode-ui-active' )
1238
  .removeClass( 'js-wpv-loop-wizard-save-shortcode-ui-active' );
1239
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1240
 
1241
  self.secureShortcodeFromSanitizationIfNeeded = function( shortcode_data ) {
1242
  var shortcode_string;
219
  */
220
  Toolset.hooks.addAction( 'toolset-action-shortcode-dialog-loaded', self.initSelect2 );
221
 
222
+ /**
223
+ * Init the post selectors and reference field selectors once the shortcode dialog is completely opened.
224
+ *
225
+ * @since 2.5.4
226
+ */
227
+ Toolset.hooks.addAction( 'toolset-action-shortcode-dialog-loaded', self.initPostSelector );
228
+
229
  /**
230
  * Init a wizard dialog, set the options width, and set the right value as selected.
231
  *
527
  self.initSelect2AjaxAttributes();
528
  };
529
 
530
+ /**
531
+ * Set the first post selector and post reference selector as checked, if any.
532
+ *
533
+ * @since m2m
534
+ */
535
+ self.initPostSelector = function() {
536
+ $( 'input[name="related_object"]:not(:disabled)', '.js-toolset-shortcode-gui-dialog-container' )
537
+ .first()
538
+ .prop( 'checked', true );
539
+
540
+ $( 'input[name="referenced_object"]:not(:disabled)', '.js-toolset-shortcode-gui-dialog-container' )
541
+ .first()
542
+ .prop( 'checked', true );
543
+ };
544
+
545
  /**
546
  * Initialize the wizard GUI for a shortcode.
547
  *
892
  });
893
  */
894
  // Special case: item selector tab
895
+ var $itemSelector = $( '.js-toolset-shortcode-gui-item-selector:checked', evaluatedContainer );
896
+ if (
897
+ $itemSelector.length > 0
898
+ && (
899
+ 'object_id' == $itemSelector.val() ||
900
+ 'object_id_raw' == $itemSelector.val()
901
+ )
902
+ ) {
903
+
904
+ var itemSelection = ( 'object_id' == $itemSelector.val() )
905
+ ? $( '[name="specific_object_id"]', evaluatedContainer )
906
+ : $( '[name="specific_object_id_raw"]', evaluatedContainer );
907
+
908
+ var itemSelectionId = itemSelection.val(),
909
+ itemSelectionValid = true;
910
  //$itemSelectionMessage = '';
911
  if ( '' == itemSelectionId ) {
912
  itemSelectionValid = false;
1003
  case 'referenced':
1004
  shortcodeAttributeValue = $( '[name="referenced_object"]:checked', attributeWrapper ).val();
1005
  break;
1006
+ case 'object_id_raw':
1007
+ shortcodeAttributeValue = $( '.js-toolset-shortcode-gui-item-selector_object_id_raw', attributeWrapper ).val();
1008
+ break;
1009
+ case 'object_id':
1010
  shortcodeAttributeValue = $( '.js-toolset-shortcode-gui-item-selector_object_id', attributeWrapper ).val();
1011
+ break;
1012
  case 'parent': // The value is correct out of the box
1013
  default:
1014
  break;
1087
  // Compose the shortcodeAttributeString string
1088
  _.each( shortcodeAttributeValues, function( value, key ) {
1089
  if ( value ) {
1090
+ shortcodeAttributeString += " " + key + "='" + value + "'";
1091
  }
1092
  });
1093
 
1271
  $( '.js-wpv-loop-wizard-save-shortcode-ui-active' )
1272
  .removeClass( 'js-wpv-loop-wizard-save-shortcode-ui-active' );
1273
  };
1274
+
1275
+ /**
1276
+ * Shortcodes GUI pointer management.
1277
+ *
1278
+ * @since m2m
1279
+ */
1280
+ $( document ).on( 'click', '.js-wp-toolset-shortcode-pointer-trigger', function() {
1281
+ var $tooltipTriggerer = $( this ),
1282
+ tooltipContent = $tooltipTriggerer.closest( 'li' ).find( '.js-wp-toolset-shortcode-pointer-content' ).html();
1283
+ edge = ( $( 'html[dir="rtl"]' ).length > 0 ) ? 'top' : 'top';
1284
+
1285
+ // hide this pointer if other pointer is opened.
1286
+ $( '.wp-toolset-pointer' ).fadeOut( 100 );
1287
+
1288
+ $tooltipTriggerer.pointer({
1289
+ pointerClass: 'wp-toolset-pointer wp-toolset-shortcode-pointer js-wp-toolset-shortcode-pointer',
1290
+ pointerWidth: 400,
1291
+ content: tooltipContent,
1292
+ position: {
1293
+ edge: edge,
1294
+ align: 'center',
1295
+ offset: '15 0'
1296
+ },
1297
+ buttons: function( event, t ) {
1298
+ var button_close = $( '<button class="button button-primary-toolset alignright">' + 'Close' + '</button>' );
1299
+ button_close.bind( 'click.pointer', function( e ) {
1300
+ e.preventDefault();
1301
+ t.element.pointer( 'close' );
1302
+ });
1303
+ return button_close;
1304
+ }
1305
+ }).pointer( 'open' );
1306
+ $( '.js-wp-toolset-shortcode-pointer:not(.js-wp-toolset-shortcode-pointer-indexed)' )
1307
+ .addClass( '.js-wp-toolset-shortcode-pointer-zindexed' )
1308
+ .css( 'z-index', '10000000' );
1309
+ });
1310
 
1311
  self.secureShortcodeFromSanitizationIfNeeded = function( shortcode_data ) {
1312
  var shortcode_string;
vendor/toolset/toolset-common/templates/admin/notice/commercial-plugin-installed/types-views-or-layouts-missing.phtml DELETED
@@ -1,25 +0,0 @@
1
- <?php
2
- /**
3
- * Template File
4
- * This file is only build for classes which implements Toolset_Admin_Notice_Interface
5
- *
6
- * @var Toolset_Admin_Notice_Interface $this
7
- *
8
- * @since 2.3.0 First release
9
- */
10
- ?>
11
- <p>
12
- <?php _e( 'To use Toolset in the most convenient way, we suggest always installing Types, Views and Layouts ' .
13
- 'plugins. For advanced functionality, check out the rest of Toolset plugins.', 'wpv-views' ); ?>
14
- </p>
15
- <?php
16
- echo Toolset_Admin_Notices_Manager::tpl_button_primary(
17
- __( 'Download Toolset plugins', 'wpv-views' ),
18
- 'https://wp-types.com/account/downloads/' .
19
- '?utm_source=typesplugin' .
20
- '&utm_campaign=types' .
21
- '&utm_medium=toolset-introduction-message' .
22
- '&utm_term=install-missing-toolset-plugins' .
23
- '&utm_content=insta-types-views-layouts',
24
- true
25
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/toolset/toolset-common/templates/admin/notice/installer/compatibility-reporting-setting-needed.phtml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Template for the notice from OTGS\Toolset\Common\Interop\Handler\InstallerCompatibilityReporting.
5
+ *
6
+ * Not to be used anywhere else.
7
+ *
8
+ * @var Toolset_Admin_Notice_Interface $this
9
+ *
10
+ * @since 2.3.0 First release
11
+ */
12
+
13
+ $context = $this->get_template_context();
14
+ $policy_url = toolset_getarr( $context, 'policy_url' );
15
+
16
+ ?>
17
+ <div class="toolset-notice-wp notice toolset-notice toolset-notice-installer-compatibility-setting">
18
+
19
+ <p>
20
+ <span class="toolset-notice-installer-compatibility-setting__header">
21
+ <?php _e( 'Do you want to get faster Toolset support and compatibility alerts?', 'wpv-views' ); ?>
22
+ </span>
23
+ <br/>
24
+ <span class="toolset-notice-installer-compatibility-setting__details" style="font-size: 10px;">
25
+ <?php _e( 'Report to toolset.com which theme and plugins you are using.', 'wpv-views' ); ?>
26
+ <a href="<?php echo esc_attr( $policy_url ) ?>" target="_blank">
27
+ <?php _e( 'Privacy and data usage policy', 'wpv-views' ); ?>
28
+ <i class="fa fa-external-link" aria-hidden="true"></i>
29
+ </a>
30
+ </span>
31
+ </p>
32
+
33
+ <p>
34
+ <?php
35
+ echo Toolset_Admin_Notices_Manager::tpl_button_primary(
36
+ __( 'Yes, I want faster compatibility and support', 'wpv-views' ), null, false,
37
+ 'toolset-notice-installer-compatibility-setting__accept-btn'
38
+ );
39
+ echo Toolset_Admin_Notices_Manager::tpl_button_secondary(
40
+ __( 'No, don\'t send any reports', 'wpv-views' ), null, false,
41
+ 'toolset-notice-installer-compatibility-setting__decline-btn'
42
+ );
43
+ ?>
44
+ <span class="toolset-notice-installer-compatibility-setting__error"></span>
45
+ <span class="spinner toolset-notice-installer-compatibility-setting__spinner"></span>
46
+ </p>
47
+
48
+
49
+ </div>
vendor/toolset/toolset-common/templates/admin/notice/only-types-installed/layouts-support-missing.phtml DELETED
@@ -1,19 +0,0 @@
1
- <?php
2
- /**
3
- * Template File
4
- * This file is only build for classes which implements Toolset_Admin_Notice_Interface
5
- *
6
- * @var Toolset_Admin_Notice_Interface $this
7
- *
8
- * @since 2.3.0 First release
9
- */
10
- ?>
11
- <p>
12
- <?php _e( 'Toolset Types lets you add custom post types, custom fields and taxonomies.', 'wpv-views' ); ?>
13
- </p>
14
- <?php
15
- echo Toolset_Admin_Notices_Manager::tpl_button_primary(
16
- __( 'Getting started guide', 'wpv-views' ),
17
- Types_Helper_Url::get_url( 'getting-started-types', 'notice-dismissible' ),
18
- true
19
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/toolset/toolset-common/templates/admin/notice/toolset-based-themes/active/dashboard.phtml CHANGED
@@ -27,7 +27,7 @@ $theme_name = $encrypt_plugin->get_theme() ? $encrypt_plugin->get_theme() : '';
27
 
28
  <?php echo Toolset_Admin_Notices_Manager::tpl_button_primary(
29
  __( 'Learn more about Toolset', 'wpv-views' ),
30
- 'https://wp-types.com/' .
31
  '?utm_source=typesplugin' .
32
  '&utm_campaign=types' .
33
  '&utm_medium=toolset-dashboard' .
@@ -38,7 +38,7 @@ $theme_name = $encrypt_plugin->get_theme() ? $encrypt_plugin->get_theme() : '';
38
 
39
  echo Toolset_Admin_Notices_Manager::tpl_button_primary(
40
  __( 'Pricing', 'wpv-views' ),
41
- 'https://wp-types.com/buy/' .
42
  '?utm_source=typesplugin' .
43
  '&utm_campaign=types' .
44
  '&utm_medium=toolset-dashboard' .
27
 
28
  <?php echo Toolset_Admin_Notices_Manager::tpl_button_primary(
29
  __( 'Learn more about Toolset', 'wpv-views' ),
30
+ 'https://toolset.com/' .
31
  '?utm_source=typesplugin' .
32
  '&utm_campaign=types' .
33
  '&utm_medium=toolset-dashboard' .
38
 
39
  echo Toolset_Admin_Notices_Manager::tpl_button_primary(
40
  __( 'Pricing', 'wpv-views' ),
41
+ 'https://toolset.com/buy/' .
42
  '?utm_source=typesplugin' .
43
  '&utm_campaign=types' .
44
  '&utm_medium=toolset-dashboard' .
vendor/toolset/toolset-common/templates/admin/notice/toolset-based-themes/active/plugin.phtml CHANGED
@@ -17,7 +17,7 @@ $theme_name = $encrypt_plugin->get_theme() ? $encrypt_plugin->get_theme() : '';
17
 
18
  <?php echo Toolset_Admin_Notices_Manager::tpl_button_primary(
19
  __( 'Learn more about Toolset', 'wpv-views' ),
20
- 'https://wp-types.com/' .
21
  '?utm_source=typesplugin' .
22
  '&utm_campaign=types' .
23
  '&utm_medium=wordpress-plugin-page' .
@@ -28,7 +28,7 @@ $theme_name = $encrypt_plugin->get_theme() ? $encrypt_plugin->get_theme() : '';
28
 
29
  echo Toolset_Admin_Notices_Manager::tpl_button_primary(
30
  __( 'Pricing', 'wpv-views' ),
31
- 'https://wp-types.com/buy/' .
32
  '?utm_source=typesplugin' .
33
  '&utm_campaign=types' .
34
  '&utm_medium=wordpress-plugin-page' .
17
 
18
  <?php echo Toolset_Admin_Notices_Manager::tpl_button_primary(
19
  __( 'Learn more about Toolset', 'wpv-views' ),
20
+ 'https://toolset.com/' .
21
  '?utm_source=typesplugin' .
22
  '&utm_campaign=types' .
23
  '&utm_medium=wordpress-plugin-page' .
28
 
29
  echo Toolset_Admin_Notices_Manager::tpl_button_primary(
30
  __( 'Pricing', 'wpv-views' ),
31
+ 'https://toolset.com/buy/' .
32
  '?utm_source=typesplugin' .
33
  '&utm_campaign=types' .
34
  '&utm_medium=wordpress-plugin-page' .
vendor/toolset/toolset-common/templates/admin/notice/toolset-based-themes/inactive/dashboard.phtml CHANGED
@@ -16,7 +16,7 @@ $theme_name = $encrypt_plugin->get_theme() ? $encrypt_plugin->get_theme() : '';
16
 
17
  <?php echo Toolset_Admin_Notices_Manager::tpl_button_primary(
18
  __( 'Learn more about Toolset', 'wpv-views' ),
19
- 'https://wp-types.com/' .
20
  '?utm_source=typesplugin' .
21
  '&utm_campaign=types' .
22
  '&utm_medium=toolset-dashboard' .
@@ -27,7 +27,7 @@ $theme_name = $encrypt_plugin->get_theme() ? $encrypt_plugin->get_theme() : '';
27
 
28
  echo Toolset_Admin_Notices_Manager::tpl_button_primary(
29
  __( 'Pricing', 'wpv-views' ),
30
- 'https://wp-types.com/buy/' .
31
  '?utm_source=typesplugin' .
32
  '&utm_campaign=types' .
33
  '&utm_medium=toolset-dashboard' .
16
 
17
  <?php echo Toolset_Admin_Notices_Manager::tpl_button_primary(
18
  __( 'Learn more about Toolset', 'wpv-views' ),
19
+ 'https://toolset.com/' .
20
  '?utm_source=typesplugin' .
21
  '&utm_campaign=types' .
22
  '&utm_medium=toolset-dashboard' .
27
 
28
  echo Toolset_Admin_Notices_Manager::tpl_button_primary(
29
  __( 'Pricing', 'wpv-views' ),
30
+ 'https://toolset.com/buy/' .
31
  '?utm_source=typesplugin' .
32
  '&utm_campaign=types' .
33
  '&utm_medium=toolset-dashboard' .
vendor/toolset/toolset-common/templates/admin/notice/toolset-based-themes/inactive/plugin.phtml CHANGED
@@ -16,7 +16,7 @@ $theme_name = $encrypt_plugin->get_theme() ? $encrypt_plugin->get_theme() : '';
16
 
17
  <?php echo Toolset_Admin_Notices_Manager::tpl_button_primary(
18
  __( 'Learn more about Toolset', 'wpv-views' ),
19
- 'https://wp-types.com/' .
20
  '?utm_source=typesplugin' .
21
  '&utm_campaign=types' .
22
  '&utm_medium=wordpress-plugin-page' .
@@ -27,7 +27,7 @@ $theme_name = $encrypt_plugin->get_theme() ? $encrypt_plugin->get_theme() : '';
27
 
28
  echo Toolset_Admin_Notices_Manager::tpl_button_primary(
29
  __( 'Pricing', 'wpv-views' ),
30
- 'https://wp-types.com/buy/' .
31
  '?utm_source=typesplugin' .
32
  '&utm_campaign=types' .
33
  '&utm_medium=wordpress-plugin-page' .
16
 
17
  <?php echo Toolset_Admin_Notices_Manager::tpl_button_primary(
18
  __( 'Learn more about Toolset', 'wpv-views' ),
19
+ 'https://toolset.com/' .
20
  '?utm_source=typesplugin' .
21
  '&utm_campaign=types' .
22
  '&utm_medium=wordpress-plugin-page' .
27
 
28
  echo Toolset_Admin_Notices_Manager::tpl_button_primary(
29
  __( 'Pricing', 'wpv-views' ),
30
+ 'https://toolset.com/buy/' .
31
  '?utm_source=typesplugin' .
32
  '&utm_campaign=types' .
33
  '&utm_medium=wordpress-plugin-page' .
vendor/toolset/toolset-common/templates/admin/notice/toolset-robot.phtml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Template File which shows the Toolset Robot
4
+ * This file is only build for classes which implements Toolset_Admin_Notice_Interface
5
+ *
6
+ * @var Toolset_Admin_Notice_Interface $this
7
+ */
8
+ ?>
9
+ <div class="toolset-notice-wp notice toolset-notice toolset-notice-robot">
10
+ <div class="toolset-robot"></div>
11
+ <?php $this->render_content() ?>
12
+
13
+ <?php @include( dirname( __FILE__ ) . '/presets/btn-dismiss.phtml' ); ?>
14
+ </div>
vendor/toolset/toolset-common/templates/admin/notice/types-free-version-ends.phtml DELETED
@@ -1,61 +0,0 @@
1
- <?php
2
- /**
3
- * Template File
4
- * This file is only build for classes which implements Toolset_Admin_Notice_Interface
5
- *
6
- * @var Toolset_Admin_Notice_Interface $this
7
- *
8
- * @since Types 2.2.21
9
- */
10
- ?>
11
-
12
- <p>
13
- <b>
14
- <?php printf( __( 'Development of Toolset Types is moving into the complete %sToolset%s package.', 'wpcf' ),
15
- '<a class="toolset-link" target="_blank" href="https://wp-types.com/?utm_source=typesplugin&utm_campaign=moving-types-to-toolset&utm_medium=admin-message&utm_term=toolset">',
16
- '</a>' ); ?>
17
- </b>
18
- </p>
19
-
20
- <p>
21
- <?php _e( 'You will get the most advanced features in WordPress for custom post types, taxonomies and fields, but it’s going to be a paid plugin.',
22
- 'wpcf' ) ?>
23
- </p>
24
-
25
- <p class="toolset-list-title">
26
- <?php _e( 'New versions will include:', 'wpcf' ); ?>
27
- </p>
28
-
29
- <ul class="toolset-list">
30
- <li><?php _e( 'Repeating and nested field groups', 'wpcf' ) ?></li>
31
- <li><?php _e( 'Post reference fields', 'wpcf' ); ?></li>
32
- <li><?php _e( 'Many-to-many post relationships', 'wpcf' ); ?></li>
33
- <li><?php _e( 'And more...', 'wpcf' ); ?></li>
34
- </ul>
35
-
36
- <p>
37
- <?php _e( 'This free version of Types will continue to receive bug fixes, security updates and compatibility updates through 2018.',
38
- 'wpcf' ); ?>
39
- </p>
40
-
41
- <?php
42
- // Button "See details and leave your feedback"
43
- echo Toolset_Admin_Notices_Manager::tpl_button_primary(
44
- __( 'See details and leave your feedback', 'wpcf' ),
45
- 'https://wp-types.com/2017/11/types-plugin-is-moving-to-be-a-part-of-the-complete-toolset-package/' .
46
- '?utm_source=typesplugin' .
47
- '&utm_campaign=moving-types-to-toolset' .
48
- '&utm_medium=admin-message' .
49
- '&utm_term=details-about-moving-types-to-toolset'
50
- );
51
-
52
- // Button "Pricing"
53
- echo Toolset_Admin_Notices_Manager::tpl_button_primary(
54
- __( 'Pricing', 'wpcf' ),
55
- 'https://wp-types.com/buy/' .
56
- '?utm_source=typesplugin' .
57
- '&utm_campaign=moving-types-to-toolset' .
58
- '&utm_medium=admin-message' .
59
- '&utm_term=pricing'
60
- );
61
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/toolset/toolset-common/templates/admin/notice/types-move-to-toolset.phtml DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
- /**
3
- * Template File
4
- * This file is only build for classes which implements Toolset_Admin_Notice_Interface
5
- *
6
- * @var Toolset_Admin_Notice_Interface $this
7
- *
8
- * @since 2.3.0 First release
9
- */
10
- ?>
11
-
12
- <a data-toolset-admin-notices-toggle-visibility=".js-toolset-toggle-types-free-version-ends" href="javascript:void(0)" class="js-toolset-toggle-types-free-version-ends toolset-link toolset-dashboard-link-top-right"><?php _e( 'Important information about Types updates &raquo;', 'wpcf' ); ?></a>
13
-
14
- <div class="toolset-notice-wp notice toolset-notice js-toolset-toggle-types-free-version-ends" style="display: none">
15
- <?php $this->render_content() ?>
16
-
17
- <?php @include( dirname( __FILE__ ) . '/presets/btn-dismiss.phtml' ); ?>
18
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/toolset/toolset-common/templates/maintenance.twig ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ {#
4
+ Template for a .maintenance PHP file that is being used by \OTGS\Toolset\Common\MaintenanceMode\Controller.
5
+
6
+ Note: This file MUST NOT produce any output, it would produce a "Cannot modify header information - headers
7
+ already sent" warning.
8
+
9
+ @since 2.6.8
10
+ #}
11
+
12
+ $toolset_maintenance_exception = false;
13
+
14
+ {% if allow_backend %}
15
+ if (
16
+ ( is_admin() && ! wp_doing_ajax() )
17
+ || stristr( $_SERVER['REQUEST_URI'], '/wp-login.php' )
18
+ ) {
19
+ $toolset_maintenance_exception = true;
20
+ }
21
+ {% endif %}
22
+
23
+ {% if allow_ajax %}
24
+ if( is_admin() && wp_doing_ajax() ) {
25
+ $toolset_maintenance_exception = true;
26
+ }
27
+ {% endif %}
28
+
29
+ if( ! $toolset_maintenance_exception ) {
30
+ $upgrading = {{ upgrading_time|raw }};
31
+ }
vendor/toolset/toolset-common/toolset-common-loader.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
 
3
  if( !defined('TOOLSET_VERSION') ){
4
- define('TOOLSET_VERSION', '2.6.2');
5
  }
6
 
7
  if ( ! defined('TOOLSET_COMMON_VERSION' ) ) {
8
- define( 'TOOLSET_COMMON_VERSION', '2.6.2' );
9
  }
10
 
11
  if ( ! defined('TOOLSET_COMMON_PATH' ) ) {
@@ -16,6 +16,16 @@ if ( ! defined('TOOLSET_COMMON_DIR' ) ) {
16
  define( 'TOOLSET_COMMON_DIR', basename( TOOLSET_COMMON_PATH ) );
17
  }
18
 
 
 
 
 
 
 
 
 
 
 
19
  /**
20
  * Last edit flag shared among Toolset plugins.
21
  *
1
  <?php
2
 
3
  if( !defined('TOOLSET_VERSION') ){
4
+ define('TOOLSET_VERSION', '2.8.1');
5
  }
6
 
7
  if ( ! defined('TOOLSET_COMMON_VERSION' ) ) {
8
+ define( 'TOOLSET_COMMON_VERSION', '2.8.1' );
9
  }
10
 
11
  if ( ! defined('TOOLSET_COMMON_PATH' ) ) {
16
  define( 'TOOLSET_COMMON_DIR', basename( TOOLSET_COMMON_PATH ) );
17
  }
18
 
19
+ if( ! defined( 'TOOLSET_DATA_STRUCTURE_VERSION') ) {
20
+ /**
21
+ * Determines version of Toolset data structures or other changes that need
22
+ * an upgrade routine to be executed.
23
+ *
24
+ * This constant should be used only by Toolset_Upgrade_Controller.
25
+ */
26
+ define( 'TOOLSET_DATA_STRUCTURE_VERSION', 3 );
27
+ }
28
+
29
  /**
30
  * Last edit flag shared among Toolset plugins.
31
  *
vendor/toolset/toolset-common/toolset-forms/autoload_classmap.php CHANGED
@@ -40,6 +40,7 @@ return array(
40
  'WPToolset_Field_Wysiwyg' => dirname( __FILE__ ) . '/classes/class.wysiwyg.php',
41
  'WPToolset_Forms_Bootstrap' => dirname( __FILE__ ) . '/bootstrap.php',
42
  'WPToolset_Forms_Conditional' => dirname( __FILE__ ) . '/classes/class.conditional.php',
 
43
  'WPToolset_Forms_Repetitive' => dirname( __FILE__ ) . '/classes/class.repetitive.php',
44
  'WPToolset_Forms_Validation' => dirname( __FILE__ ) . '/classes/class.validation.php',
45
  'WPToolset_Types' => dirname( __FILE__ ) . '/classes/class.types.php',
40
  'WPToolset_Field_Wysiwyg' => dirname( __FILE__ ) . '/classes/class.wysiwyg.php',
41
  'WPToolset_Forms_Bootstrap' => dirname( __FILE__ ) . '/bootstrap.php',
42
  'WPToolset_Forms_Conditional' => dirname( __FILE__ ) . '/classes/class.conditional.php',
43
+ 'WPToolset_Forms_Conditional_RFG' => dirname( __FILE__ ) . '/classes/class.conditional.rfg.php',
44
  'WPToolset_Forms_Repetitive' => dirname( __FILE__ ) . '/classes/class.repetitive.php',
45
  'WPToolset_Forms_Validation' => dirname( __FILE__ ) . '/classes/class.validation.php',
46
  'WPToolset_Types' => dirname( __FILE__ ) . '/classes/class.types.php',
vendor/toolset/toolset-common/toolset-forms/classes/class.conditional.php CHANGED
@@ -53,9 +53,15 @@
53
  if ( !class_exists('WPToolset_Forms_Conditional') ){
54
  class WPToolset_Forms_Conditional {
55
 
56
- private $__formID;
57
  protected $_collected = array(), $_triggers = array(), $_fields = array(), $_custom_triggers = array(), $_custom_fields = array();
58
 
 
 
 
 
 
 
59
  /**
60
  * Register and enqueue scripts and actions.
61
  *
@@ -63,13 +69,8 @@ class WPToolset_Forms_Conditional {
63
  */
64
  public function __construct($formID) {
65
  $this->__formID = trim($formID, '#');
66
- // Register and enqueue
67
- wp_register_script('wptoolset-form-conditional', WPTOOLSET_FORMS_RELPATH . '/js/conditional.js', array('jquery', 'jquery-effects-scale'), WPTOOLSET_FORMS_VERSION, true);
68
- wp_enqueue_script('wptoolset-form-conditional');
69
- $js_data = array(
70
- 'ajaxurl' => admin_url('admin-ajax.php', null),
71
- );
72
- wp_localize_script('wptoolset-form-conditional', 'wptConditional', $js_data);
73
 
74
  wp_enqueue_script('wptoolset-parser');
75
  $js_data = array(
@@ -94,7 +95,28 @@ class WPToolset_Forms_Conditional {
94
  add_filter('toolset_field_additional_classes', array($this, 'actionFieldClass'), 10, 2);
95
  }
96
 
97
- /**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  * Collects data.
99
  *
100
  * Called from form_factory.
@@ -478,9 +500,13 @@ class WPToolset_Forms_Conditional {
478
  */
479
  public function actionFieldClass($classes, $config) {
480
  if (
481
- !empty($config['conditional']) && array_key_exists('conditions', $config['conditional']) && !self::evaluate($config['conditional'])
482
  ) {
483
- $classes .= ' wpt-hidden js-wpt-remove-on-submit js-wpt-validation-ignore';
 
 
 
 
484
  }
485
  return $classes;
486
  }
53
  if ( !class_exists('WPToolset_Forms_Conditional') ){
54
  class WPToolset_Forms_Conditional {
55
 
56
+ protected $__formID;
57
  protected $_collected = array(), $_triggers = array(), $_fields = array(), $_custom_triggers = array(), $_custom_fields = array();
58
 
59
+ /**
60
+ * State scripts are loaded
61
+ * @var bool
62
+ */
63
+ protected static $scripts_loaded = false;
64
+
65
  /**
66
  * Register and enqueue scripts and actions.
67
  *
69
  */
70
  public function __construct($formID) {
71
  $this->__formID = trim($formID, '#');
72
+
73
+ self::load_scripts();
 
 
 
 
 
74
 
75
  wp_enqueue_script('wptoolset-parser');
76
  $js_data = array(
95
  add_filter('toolset_field_additional_classes', array($this, 'actionFieldClass'), 10, 2);
96
  }
97
 
98
+ /**
99
+ * Loads the conditional script and makes sure that it's only initiated once.
100
+ */
101
+ public static function load_scripts() {
102
+ if( self::$scripts_loaded ) {
103
+ // already loaded
104
+ return;
105
+ }
106
+ // Register and enqueue
107
+ wp_register_script('wptoolset-form-conditional', WPTOOLSET_FORMS_RELPATH . '/js/conditional.js', array('jquery', 'jquery-effects-scale'), WPTOOLSET_FORMS_VERSION, true);
108
+ wp_enqueue_script('wptoolset-form-conditional');
109
+ $js_data = array(
110
+ 'ajaxurl' => admin_url('admin-ajax.php', null),
111
+ );
112
+ wp_localize_script('wptoolset-form-conditional', 'wptConditional', $js_data);
113
+
114
+ // store state
115
+ self::$scripts_loaded = true;
116
+ }
117
+
118
+
119
+ /**
120
  * Collects data.
121
  *
122
  * Called from form_factory.
500
  */
501
  public function actionFieldClass($classes, $config) {
502
  if (
503
+ !empty($config['conditional']) && array_key_exists('conditions', $config['conditional'])
504
  ) {
505
+ $classes .= ' js-toolset-conditional';
506
+
507
+ if( !self::evaluate($config['conditional']) ) {
508
+ $classes .= ' wpt-hidden js-wpt-remove-on-submit js-wpt-validation-ignore';
509
+ }
510
  }
511
  return $classes;
512
  }
vendor/toolset/toolset-common/toolset-forms/classes/class.conditional.rfg.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPToolset_Forms_Conditional_RFG
5
+ *
6
+ * Subclass of WPToolset_Forms_Conditional, which disables parent::__construct
7
+ * and offers the method get_conditions() to allow the user getting all registered conditions.
8
+ *
9
+ * @since 2.6.5
10
+ */
11
+ class WPToolset_Forms_Conditional_RFG extends WPToolset_Forms_Conditional {
12
+
13
+ /**
14
+ * @var string
15
+ */
16
+ private $form_selector;
17
+
18
+ /**
19
+ * Other than the parent class, this does not need the $form_id
20
+ *
21
+ * @param string $form_selector Selector of the form.
22
+ */
23
+ public function __construct( $form_selector = '#post' ) {
24
+ // IMPORTANT: Do not run parent::__construct() here
25
+
26
+ // for parent usages
27
+ $this->__formID = trim( $form_selector, '#' );
28
+
29
+ // only for this subclass
30
+ $this->form_selector = $form_selector;
31
+ }
32
+
33
+ /**
34
+ * Get registered conditions (trigger & fields)
35
+ *
36
+ * @return array
37
+ */
38
+ public function get_conditions() {
39
+ $this->_parseData();
40
+
41
+ return array(
42
+ $this->form_selector => array(
43
+ 'triggers' => $this->_triggers,
44
+ 'fields' => $this->_fields,
45
+ 'custom_triggers' => $this->_custom_triggers,
46
+ 'custom_fields' => $this->_custom_fields
47
+ )
48
+ );
49
+ }
50
+ }
vendor/toolset/toolset-common/toolset-forms/classes/class.eforms.php CHANGED
@@ -459,24 +459,22 @@ class Enlimbo_Forms {
459
  }
460
 
461
  switch( $what_to_validate ){
462
- case 'required';
463
- $element['#attributes']['required'] = 'true';
464
- $element['#attributes']['data-parsley-required-message'] = $element['#validate'][ $what_to_validate ]['message'];
465
- break;
466
 
467
  case 'number':
468
  $element['#attributes']['data-parsley-type'] = 'number';
469
- $element['#attributes']['data-parsley-number-message'] = $element['#validate'][ $what_to_validate ]['message'];
470
  break;
471
-
472
  case 'url':
473
  $element['#attributes']['data-parsley-type'] = 'url';
474
- $element['#attributes']['data-parsley-url-message'] = $element['#validate'][ $what_to_validate ]['message'];
475
  break;
476
-
477
  case 'email':
478
  $element['#attributes']['data-parsley-type'] = 'email';
479
- $element['#attributes']['data-parsley-email-message'] = $element['#validate'][ $what_to_validate ]['message'];
 
 
 
 
480
  break;
481
  }
482
 
459
  }
460
 
461
  switch( $what_to_validate ){
 
 
 
 
462
 
463
  case 'number':
464
  $element['#attributes']['data-parsley-type'] = 'number';
465
+ $element['#attributes']['data-parsley-error-message'] = $element['#validate'][ $what_to_validate ]['message'];
466
  break;
 
467
  case 'url':
468
  $element['#attributes']['data-parsley-type'] = 'url';
469
+ $element['#attributes']['data-parsley-error-message'] = $element['#validate'][ $what_to_validate ]['message'];
470
  break;
 
471
  case 'email':
472
  $element['#attributes']['data-parsley-type'] = 'email';
473
+ $element['#attributes']['data-parsley-error-message'] = $element['#validate'][ $what_to_validate ]['message'];
474
+ break;
475
+ case 'required';
476
+ $element['#attributes']['data-parsley-required'] = 'true';
477
+ $element['#attributes']['data-parsley-required-message'] = $element['#validate'][ $what_to_validate ]['message'];
478
  break;
479
  }
480
 
vendor/toolset/toolset-common/toolset-forms/classes/class.file.php CHANGED
@@ -73,7 +73,7 @@ class WPToolset_Field_File extends WPToolset_Field_Textfield {
73
  $wpml_action = $this->getWPMLAction();
74
 
75
  // Get attachment by guid
76
- if ( ! empty( $value ) ) {
77
  global $wpdb;
78
  $attachment_id = $wpdb->get_var(
79
  $wpdb->prepare(
@@ -92,6 +92,10 @@ class WPToolset_Field_File extends WPToolset_Field_Textfield {
92
  $preview = wp_get_attachment_image( $attachment_id, 'thumbnail', false, $attributes );
93
  } else {
94
  // If external image set preview
 
 
 
 
95
  $file_path = parse_url( $value );
96
  if ( $file_path && isset( $file_path['path'] ) ) {
97
  $file = pathinfo( $file_path['path'] );
73
  $wpml_action = $this->getWPMLAction();
74
 
75
  // Get attachment by guid
76
+ if ( ! empty( $value ) && is_string( $value ) ) {
77
  global $wpdb;
78
  $attachment_id = $wpdb->get_var(
79
  $wpdb->prepare(
92
  $preview = wp_get_attachment_image( $attachment_id, 'thumbnail', false, $attributes );
93
  } else {
94
  // If external image set preview
95
+ while( is_array( $value ) ) {
96
+ // repeatable file field
97
+ $value = reset( $value );
98
+ }
99
  $file_path = parse_url( $value );
100
  if ( $file_path && isset( $file_path['path'] ) ) {
101
  $file = pathinfo( $file_path['path'] );
vendor/toolset/toolset-common/toolset-forms/classes/class.repetitive.php CHANGED
@@ -19,11 +19,16 @@ class WPToolset_Forms_Repetitive
19
  true );
20
  // wp_register_style( 'wptoolset-forms-repetitive', '' );
21
  // Render settings
22
- add_action( 'admin_footer', array($this, 'renderTemplates') );
23
- add_action( 'wp_footer', array($this, 'renderTemplates') );
 
 
 
 
 
24
 
25
  wp_enqueue_script( 'wptoolset-forms-repetitive' );
26
-
27
  }
28
 
29
  function add( $config, $html ) {
19
  true );
20
  // wp_register_style( 'wptoolset-forms-repetitive', '' );
21
  // Render settings
22
+ if ( ! did_action('admin_footer') ) {
23
+ add_action( 'admin_footer', array($this, 'renderTemplates') );
24
+ add_action( 'wp_footer', array($this, 'renderTemplates') );
25
+ } else {
26
+ // Related content doesn't work with hook admin_footer.
27
+ add_action( 'admin_print_footer_scripts', array($this, 'renderTemplates') );
28
+ }
29
 
30
  wp_enqueue_script( 'wptoolset-forms-repetitive' );
31
+
32
  }
33
 
34
  function add( $config, $html ) {
vendor/toolset/toolset-common/toolset-forms/classes/class.validation.php CHANGED
@@ -43,7 +43,6 @@ class WPToolset_Forms_Validation {
43
  'site_url' => get_site_url(),
44
  'form_id' => $formID,
45
  'use_ajax' => (!Toolset_Utils::is_real_admin() && isset( $formSET->form['use_ajax'] ) && $formSET->form['use_ajax'] == 1) ? true : false,
46
- 'operation_ok' => __( 'Operation completed successfully', 'wpv-views' ),
47
  'operation_ko' => __( 'There was an error while submitting the form', 'wpv-views' ),
48
  'delay_message' => __( 'You are being redirectd. Please Wait.', 'wpv-views' )
49
  )
43
  'site_url' => get_site_url(),
44
  'form_id' => $formID,
45
  'use_ajax' => (!Toolset_Utils::is_real_admin() && isset( $formSET->form['use_ajax'] ) && $formSET->form['use_ajax'] == 1) ? true : false,
 
46
  'operation_ko' => __( 'There was an error while submitting the form', 'wpv-views' ),
47
  'delay_message' => __( 'You are being redirectd. Please Wait.', 'wpv-views' )
48
  )
vendor/toolset/toolset-common/toolset-forms/classes/class.wysiwyg.php CHANGED
@@ -82,6 +82,14 @@ class WPToolset_Field_Wysiwyg extends WPToolset_Field_Textarea {
82
  if ( true === toolset_getarr( $attributes, 'types-related-content' ) ) {
83
  $id .= '_' . rand( 10000, 99999 );
84
  }
 
 
 
 
 
 
 
 
85
  wp_editor( $this->getValue(), $id, array(
86
  'wpautop' => true, // use wpautop?
87
  'media_buttons' => $media_buttons, // show insert/upload button(s)
@@ -89,7 +97,7 @@ class WPToolset_Field_Wysiwyg extends WPToolset_Field_Textarea {
89
  'textarea_rows' => get_option( 'default_post_edit_rows', 10 ), // rows="..."
90
  'tabindex' => '',
91
  'editor_css' => '', // intended for extra styles for both visual and HTML editors buttons, needs to include the <style> tags, can use "scoped".
92
- 'editor_class' => 'wpt-wysiwyg', // add extra class(es) to the editor textarea
93
  'teeny' => false, // output the minimal editor config used in Press This
94
  'dfw' => false, // replace the default fullscreen with DFW (needs specific DOM elements and css)
95
  'tinymce' => true, // load TinyMCE, can be used to pass settings directly to TinyMCE using an array()
82
  if ( true === toolset_getarr( $attributes, 'types-related-content' ) ) {
83
  $id .= '_' . rand( 10000, 99999 );
84
  }
85
+
86
+ $editor_classnames = array( 'wpt-wysiwyg' );
87
+
88
+ if ( function_exists( 'wp_enqueue_editor' ) ) {
89
+ // In WP 4.8 and above, enqueue the needed assets for dynamically initialize the editor
90
+ wp_enqueue_editor();
91
+ }
92
+
93
  wp_editor( $this->getValue(), $id, array(
94
  'wpautop' => true, // use wpautop?
95
  'media_buttons' => $media_buttons, // show insert/upload button(s)
97
  'textarea_rows' => get_option( 'default_post_edit_rows', 10 ), // rows="..."
98
  'tabindex' => '',
99
  'editor_css' => '', // intended for extra styles for both visual and HTML editors buttons, needs to include the <style> tags, can use "scoped".
100
+ 'editor_class' => implode( ' ', $editor_classnames ), // add extra class(es) to the editor textarea
101
  'teeny' => false, // output the minimal editor config used in Press This
102
  'dfw' => false, // replace the default fullscreen with DFW (needs specific DOM elements and css)
103
  'tinymce' => true, // load TinyMCE, can be used to pass settings directly to TinyMCE using an array()
vendor/toolset/toolset-common/toolset-forms/js/conditional.js CHANGED
@@ -41,6 +41,13 @@ var wptCond = (function ($) {
41
 
42
  function _getTrigger(trigger, formID)
43
  {
 
 
 
 
 
 
 
44
  var $trigger = $('[data-wpt-name="' + trigger + '"]', formID);
45
  /**
46
  * wp-admin
@@ -182,6 +189,14 @@ var wptCond = (function ($) {
182
  if (wptCondDebug) {
183
  console.info('_getAffected');
184
  }
 
 
 
 
 
 
 
 
185
  var $el = $('[data-wpt-id="' + affected + '"]', formID);
186
  if ($('body').hasClass('wp-admin')) {
187
  $el = $el.closest('.wpt-field');
@@ -773,7 +788,7 @@ var wptCond = (function ($) {
773
  }
774
 
775
  // @bug This seems to be only used by date.js on its conditional_check_date method,
776
- // which again gets only used by its ajaxConditional method,
777
  // which seems hooked into a commented out JS action.
778
  // The PHP side is in bootstrap.php :-/
779
  // I do not think we have AJAX conditionals, not even for date fields :-//
@@ -799,6 +814,7 @@ var wptCond = (function ($) {
799
 
800
  function addConditionals(data)
801
  {
 
802
  _.each(data, function (c, formID) {
803
  if (typeof c.triggers != 'undefined'
804
  && typeof wptCondTriggers[formID] != 'undefined') {
@@ -833,6 +849,9 @@ var wptCond = (function ($) {
833
  });
834
  }
835
  });
 
 
 
836
  }
837
 
838
  /**
@@ -870,7 +889,9 @@ var wptCond = (function ($) {
870
  return {
871
  init: init,
872
  ajaxCheck: ajaxCheck,
873
- addConditionals: addConditionals
 
 
874
  };
875
 
876
  })(jQuery);
41
 
42
  function _getTrigger(trigger, formID)
43
  {
44
+ // check rfg items first
45
+ if( trigger.startsWith( "types-repeatable-group" ) ) {
46
+ var $trigger = $('[name="' + trigger + '"]', formID );
47
+
48
+ return $trigger;
49
+ }
50
+
51
  var $trigger = $('[data-wpt-name="' + trigger + '"]', formID);
52
  /**
53
  * wp-admin
189
  if (wptCondDebug) {
190
  console.info('_getAffected');
191
  }
192
+
193
+ // check rfg fields first
194
+ if( affected.startsWith( "types-repeatable-group" ) ) {
195
+ var $affected = $('[name^="' + affected + '"]', formID );
196
+
197
+ return $affected;
198
+ }
199
+
200
  var $el = $('[data-wpt-id="' + affected + '"]', formID);
201
  if ($('body').hasClass('wp-admin')) {
202
  $el = $el.closest('.wpt-field');
788
  }
789
 
790
  // @bug This seems to be only used by date.js on its conditional_check_date method,
791
+ // which again gets only used by its ajaxConditional method,
792
  // which seems hooked into a commented out JS action.
793
  // The PHP side is in bootstrap.php :-/
794
  // I do not think we have AJAX conditionals, not even for date fields :-//
814
 
815
  function addConditionals(data)
816
  {
817
+
818
  _.each(data, function (c, formID) {
819
  if (typeof c.triggers != 'undefined'
820
  && typeof wptCondTriggers[formID] != 'undefined') {
849
  });
850
  }
851
  });
852
+ if ( typeof Toolset !== 'undefined' && !!Toolset.hooks ) {
853
+ Toolset.hooks.doAction( 'toolset-conditionals-add-conditionals', data );
854
+ }
855
  }
856
 
857
  /**
889
  return {
890
  init: init,
891
  ajaxCheck: ajaxCheck,
892
+ addConditionals: addConditionals,
893
+ getTrigger: _getTrigger,
894
+ check: _check
895
  };
896
 
897
  })(jQuery);
vendor/toolset/toolset-common/toolset-forms/js/recaptcha-php-1.11/recaptchalib.php CHANGED
@@ -35,15 +35,22 @@
35
  /**
36
  * The reCAPTCHA server URL's
37
  */
38
- define("RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api");
39
- define("RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api");
40
- define("RECAPTCHA_VERIFY_SERVER", "www.google.com");
 
 
 
 
 
 
41
 
42
  /**
43
  * Encodes the given data into a query string format
44
  * @param $data - array of string elements to be encoded
45
  * @return string - encoded request
46
  */
 
47
  function _recaptcha_qsencode ($data) {
48
  $req = "";
49
  foreach ( $data as $key => $value )
@@ -53,6 +60,7 @@ function _recaptcha_qsencode ($data) {
53
  $req=substr($req,0,strlen($req)-1);
54
  return $req;
55
  }
 
56
 
57
 
58
 
@@ -64,6 +72,7 @@ function _recaptcha_qsencode ($data) {
64
  * @param int port
65
  * @return array response
66
  */
 
67
  function _recaptcha_http_post($host, $path, $data, $port = 80) {
68
 
69
  $req = _recaptcha_qsencode ($data);
@@ -90,6 +99,7 @@ function _recaptcha_http_post($host, $path, $data, $port = 80) {
90
 
91
  return $response;
92
  }
 
93
 
94
 
95
 
@@ -103,6 +113,7 @@ function _recaptcha_http_post($host, $path, $data, $port = 80) {
103
 
104
  * @return string - The HTML to be embedded in the user's form.
105
  */
 
106
  function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
107
  {
108
  if ($pubkey == null || $pubkey == '') {
@@ -127,6 +138,7 @@ function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
127
  <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
128
  </noscript>';
129
  }
 
130
 
131
 
132
 
@@ -134,10 +146,12 @@ function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
134
  /**
135
  * A ReCaptchaResponse is returned from recaptcha_check_answer()
136
  */
 
137
  class ReCaptchaResponse {
138
  var $is_valid;
139
  var $error;
140
  }
 
141
 
142
 
143
  /**
@@ -149,6 +163,7 @@ class ReCaptchaResponse {
149
  * @param array $extra_params an array of extra variables to post to the server
150
  * @return ReCaptchaResponse
151
  */
 
152
  function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array())
153
  {
154
  if ($privkey == null || $privkey == '') {
@@ -191,6 +206,7 @@ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $ex
191
  return $recaptcha_response;
192
 
193
  }
 
194
 
195
  /**
196
  * gets a URL where the user can sign up for reCAPTCHA. If your application
@@ -199,34 +215,29 @@ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $ex
199
  * @param string $domain The domain where the page is hosted
200
  * @param string $appname The name of your application
201
  */
 
202
  function recaptcha_get_signup_url ($domain = null, $appname = null) {
203
  return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname));
204
  }
 
205
 
 
206
  function _recaptcha_aes_pad($val) {
207
  $block_size = 16;
208
  $numpad = $block_size - (strlen ($val) % $block_size);
209
  return str_pad($val, strlen ($val) + $numpad, chr($numpad));
210
  }
211
-
212
- /* Mailhide related code */
213
-
214
- function _recaptcha_aes_encrypt($val,$ky) {
215
- if (! function_exists ("mcrypt_encrypt")) {
216
- throw new Exception("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.");
217
- }
218
- $mode=MCRYPT_MODE_CBC;
219
- $enc=MCRYPT_RIJNDAEL_128;
220
- $val=_recaptcha_aes_pad($val);
221
- return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
222
  }
223
 
224
-
 
225
  function _recaptcha_mailhide_urlbase64 ($x) {
226
  return strtr(base64_encode ($x), '+/', '-_');
227
  }
 
228
 
229
  /* gets the reCAPTCHA Mailhide url for a given email, public key and private key */
 
230
  function recaptcha_mailhide_url($pubkey, $privkey, $email) {
231
  if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
232
  throw new Exception("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
@@ -235,16 +246,21 @@ function recaptcha_mailhide_url($pubkey, $privkey, $email) {
235
 
236
 
237
  $ky = pack('H*', $privkey);
238
- $cryptmail = _recaptcha_aes_encrypt ($email, $ky);
 
 
 
239
 
240
  return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
241
  }
 
242
 
243
  /**
244
  * gets the parts of the email to expose to the user.
245
  * eg, given johndoe@example,com return ["john", "example.com"].
246
  * the email is then displayed as john...@example.com
247
  */
 
248
  function _recaptcha_mailhide_email_parts ($email) {
249
  $arr = preg_split("/@/", $email );
250
 
@@ -257,6 +273,7 @@ function _recaptcha_mailhide_email_parts ($email) {
257
  }
258
  return $arr;
259
  }
 
260
 
261
  /**
262
  * Gets html to display an email address given a public an private key.
@@ -264,6 +281,7 @@ function _recaptcha_mailhide_email_parts ($email) {
264
  *
265
  * http://www.google.com/recaptcha/mailhide/apikey
266
  */
 
267
  function recaptcha_mailhide_html($pubkey, $privkey, $email) {
268
  $emailparts = _recaptcha_mailhide_email_parts ($email);
269
  $url = recaptcha_mailhide_url ($pubkey, $privkey, $email);
@@ -272,6 +290,7 @@ function recaptcha_mailhide_html($pubkey, $privkey, $email) {
272
  "' onclick=\"window.open('" . htmlentities ($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities ($emailparts [1]);
273
 
274
  }
 
275
 
276
 
277
  ?>
35
  /**
36
  * The reCAPTCHA server URL's
37
  */
38
+ if ( ! defined( 'RECAPTCHA_API_SERVER' ) ) {
39
+ define("RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api");
40
+ }
41
+ if ( ! defined( 'RECAPTCHA_API_SECURE_SERVER' ) ) {
42
+ define("RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api");
43
+ }
44
+ if ( ! defined( 'RECAPTCHA_VERIFY_SERVER' ) ) {
45
+ define("RECAPTCHA_VERIFY_SERVER", "www.google.com");
46
+ }
47
 
48
  /**
49
  * Encodes the given data into a query string format
50
  * @param $data - array of string elements to be encoded
51
  * @return string - encoded request
52
  */
53
+ if ( ! function_exists( '_recaptcha_qsencode' ) ) {
54
  function _recaptcha_qsencode ($data) {
55
  $req = "";
56
  foreach ( $data as $key => $value )
60
  $req=substr($req,0,strlen($req)-1);
61
  return $req;
62
  }
63
+ }
64
 
65
 
66
 
72
  * @param int port
73
  * @return array response
74
  */
75
+ if ( ! function_exists( '_recaptcha_http_post' ) ) {
76
  function _recaptcha_http_post($host, $path, $data, $port = 80) {
77
 
78
  $req = _recaptcha_qsencode ($data);
99
 
100
  return $response;
101
  }
102
+ }
103
 
104
 
105
 
113
 
114
  * @return string - The HTML to be embedded in the user's form.
115
  */
116
+ if ( ! function_exists( 'recaptcha_get_html' ) ) {
117
  function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
118
  {
119
  if ($pubkey == null || $pubkey == '') {
138
  <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
139
  </noscript>';
140
  }
141
+ }
142
 
143
 
144
 
146
  /**
147
  * A ReCaptchaResponse is returned from recaptcha_check_answer()
148
  */
149
+ if ( ! class_exists( 'ReCaptchaResponse' ) ) {
150
  class ReCaptchaResponse {
151
  var $is_valid;
152
  var $error;
153
  }
154
+ }
155
 
156
 
157
  /**
163
  * @param array $extra_params an array of extra variables to post to the server
164
  * @return ReCaptchaResponse
165
  */
166
+ if ( ! function_exists( 'recaptcha_check_answer' ) ) {
167
  function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array())
168
  {
169
  if ($privkey == null || $privkey == '') {
206
  return $recaptcha_response;
207
 
208
  }
209
+ }
210
 
211
  /**
212
  * gets a URL where the user can sign up for reCAPTCHA. If your application
215
  * @param string $domain The domain where the page is hosted
216
  * @param string $appname The name of your application
217
  */
218
+ if ( ! function_exists( 'recaptcha_get_signup_url' ) ) {
219
  function recaptcha_get_signup_url ($domain = null, $appname = null) {
220
  return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname));
221
  }
222
+ }
223
 
224
+ if ( ! function_exists( '_recaptcha_aes_pad' ) ) {
225
  function _recaptcha_aes_pad($val) {
226
  $block_size = 16;
227
  $numpad = $block_size - (strlen ($val) % $block_size);
228
  return str_pad($val, strlen ($val) + $numpad, chr($numpad));
229
  }
 
 
 
 
 
 
 
 
 
 
 
230
  }
231
 
232
+ /* Mailhide related code */
233
+ if ( ! function_exists( '_recaptcha_mailhide_urlbase64' ) ) {
234
  function _recaptcha_mailhide_urlbase64 ($x) {
235
  return strtr(base64_encode ($x), '+/', '-_');
236
  }
237
+ }
238
 
239
  /* gets the reCAPTCHA Mailhide url for a given email, public key and private key */
240
+ if ( ! function_exists( 'recaptcha_mailhide_url' ) ) {
241
  function recaptcha_mailhide_url($pubkey, $privkey, $email) {
242
  if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
243
  throw new Exception("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
246
 
247
 
248
  $ky = pack('H*', $privkey);
249
+
250
+ $cryptmail = function_exists( '_recaptcha_aes_encrypt' )
251
+ ? _recaptcha_aes_encrypt ($email, $ky)
252
+ : $email;
253
 
254
  return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
255
  }
256
+ }
257
 
258
  /**
259
  * gets the parts of the email to expose to the user.
260
  * eg, given johndoe@example,com return ["john", "example.com"].
261
  * the email is then displayed as john...@example.com
262
  */
263
+ if ( ! function_exists( '_recaptcha_mailhide_email_parts' ) ) {
264
  function _recaptcha_mailhide_email_parts ($email) {
265
  $arr = preg_split("/@/", $email );
266
 
273
  }
274
  return $arr;
275
  }
276
+ }
277
 
278
  /**
279
  * Gets html to display an email address given a public an private key.
281
  *
282
  * http://www.google.com/recaptcha/mailhide/apikey
283
  */
284
+ if ( ! function_exists( 'recaptcha_mailhide_html' ) ) {
285
  function recaptcha_mailhide_html($pubkey, $privkey, $email) {
286
  $emailparts = _recaptcha_mailhide_email_parts ($email);
287
  $url = recaptcha_mailhide_url ($pubkey, $privkey, $email);
290
  "' onclick=\"window.open('" . htmlentities ($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities ($emailparts [1]);
291
 
292
  }
293
+ }
294
 
295
 
296
  ?>
vendor/toolset/toolset-common/toolset-forms/js/validation.js CHANGED
@@ -210,7 +210,10 @@ var wptValidation = (function ($) {
210
 
211
  var currentFormId = formID.replace('#', '');
212
  currentFormId = currentFormId.replace('-', '_');
213
- var cred_settings = eval('cred_settings_' + currentFormId);
 
 
 
214
 
215
  if (wptValidationDebug) {
216
  console.log("validation...");
@@ -347,6 +350,11 @@ var wptValidation = (function ($) {
347
 
348
  })(jQuery);
349
 
 
 
 
 
 
350
  //cred_form_ready will fire when a CRED form is ready, so we init it's validation rules then
351
  jQuery(document).on('cred_form_ready', function (evt, data) {
352
  if (initialisedCREDForms.indexOf(data.form_id) == -1) {
210
 
211
  var currentFormId = formID.replace('#', '');
212
  currentFormId = currentFormId.replace('-', '_');
213
+ if ( ! _.has( window, 'cred_settings_' + currentFormId ) ) {
214
+ return;
215
+ }
216
+ var cred_settings = window[ 'cred_settings_' + currentFormId ];
217
 
218
  if (wptValidationDebug) {
219
  console.log("validation...");
350
 
351
  })(jQuery);
352
 
353
+ jQuery(document).on('toolset_ajax_fields_loaded', function (evt, data) {
354
+ wptValidation._initValidation('#' + data.form_id);
355
+ wptValidation.applyRules('#' + data.form_id);
356
+ });
357
+
358
  //cred_form_ready will fire when a CRED form is ready, so we init it's validation rules then
359
  jQuery(document).on('cred_form_ready', function (evt, data) {
360
  if (initialisedCREDForms.indexOf(data.form_id) == -1) {
vendor/toolset/toolset-common/toolset-forms/lib/CakePHP-Validation.php CHANGED
@@ -121,7 +121,7 @@ class WPToolset_Cake_Validation {
121
  */
122
  function notEmpty($check) {
123
  $_this = &WPToolset_Cake_Validation::getInstance();
124
- $_this->__reset();
125
  $_this->check = $check;
126
 
127
  if (is_array($check)) {
@@ -160,7 +160,7 @@ class WPToolset_Cake_Validation {
160
  */
161
  function alphaNumeric($check) {
162
  $_this = &WPToolset_Cake_Validation::getInstance();
163
- $_this->__reset();
164
  $_this->check = $check;
165
 
166
  if (is_array($check)) {
@@ -183,7 +183,7 @@ class WPToolset_Cake_Validation {
183
 
184
  function alphaNumericWhitespaces($check) {
185
  $_this = &WPToolset_Cake_Validation::getInstance();
186
- $_this->__reset();
187
  $_this->check = $check;
188
 
189
  if (is_array($check)) {
@@ -233,7 +233,7 @@ class WPToolset_Cake_Validation {
233
  */
234
  function blank($check) {
235
  $_this = &WPToolset_Cake_Validation::getInstance();
236
- $_this->__reset();
237
  $_this->check = $check;
238
 
239
  if (is_array($check)) {
@@ -260,7 +260,7 @@ class WPToolset_Cake_Validation {
260
  */
261
  function cc($check, $type = 'fast', $deep = false, $regex = null) {
262
  $_this = &WPToolset_Cake_Validation::getInstance();
263
- $_this->__reset();
264
  $_this->check = $check;
265
  $_this->type = $type;
266
  $_this->deep = $deep;
@@ -398,7 +398,7 @@ class WPToolset_Cake_Validation {
398
  */
399
  function custom($check, $regex = null) {
400
  $_this = &WPToolset_Cake_Validation::getInstance();
401
- $_this->__reset();
402
  $_this->check = $check;
403
  $_this->regex = $regex;
404
  if (is_array($check)) {
@@ -445,7 +445,7 @@ class WPToolset_Cake_Validation {
445
  $format = isset($cake_date_formats[$format]) ? $cake_date_formats[$format] : $format;
446
 
447
  $_this = &WPToolset_Cake_Validation::getInstance();
448
- $_this->__reset();
449
  $_this->check = $check;
450
  $_this->regex = $regex;
451
 
@@ -483,7 +483,7 @@ class WPToolset_Cake_Validation {
483
  */
484
  function time($check) {
485
  $_this = &WPToolset_Cake_Validation::getInstance();
486
- $_this->__reset();
487
  $_this->check = $check;
488
  $_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}$%';
489
  return $_this->_check();
@@ -513,7 +513,7 @@ class WPToolset_Cake_Validation {
513
  */
514
  function decimal($check, $places = null, $regex = null) {
515
  $_this = &WPToolset_Cake_Validation::getInstance();
516
- $_this->__reset();
517
  $_this->regex = $regex;
518
  $_this->check = $check;
519
 
@@ -538,7 +538,7 @@ class WPToolset_Cake_Validation {
538
  */
539
  function email($check, $deep = false, $regex = null) {
540
  $_this = &WPToolset_Cake_Validation::getInstance();
541
- $_this->__reset();
542
  $_this->check = $check;
543
  $_this->regex = $regex;
544
  $_this->deep = $deep;
@@ -646,7 +646,7 @@ class WPToolset_Cake_Validation {
646
  if (function_exists('filter_var')) {
647
  return filter_var($check, FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV4)) !== false;
648
  }
649
- $this->__populateIp();
650
  $this->check = $check;
651
  $this->regex = '/^' . $this->__pattern['IPv4'] . '$/';
652
  return $this->_check();
@@ -663,7 +663,7 @@ class WPToolset_Cake_Validation {
663
  if (function_exists('filter_var')) {
664
  return filter_var($check, FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV6)) !== false;
665
  }
666
- $this->__populateIp();
667
  $this->check = $check;
668
  $this->regex = '/^' . $this->__pattern['IPv6'] . '$/';
669
  return $this->_check();
@@ -948,7 +948,7 @@ class WPToolset_Cake_Validation {
948
  */
949
  function url($check, $strict = false, $require_tld = true) {
950
  $_this = &WPToolset_Cake_Validation::getInstance();
951
- $_this->__populateIp();
952
  $_this->check = $check;
953
  $validChars = '([' . preg_quote('!"$&\'()*+,-.@_:;=~[]') . '\/0-9\p{L}\p{N}]|(%[0-9a-f]{2}))';
954
 
@@ -1165,7 +1165,12 @@ class WPToolset_Cake_Validation {
1165
  * @access private
1166
  */
1167
 
1168
- function __populateIp() {
 
 
 
 
 
1169
  if (!isset($this->__pattern['IPv6'])) {
1170
  $pattern = '((([0-9A-Fa-f]{1,4}:){7}(([0-9A-Fa-f]{1,4})|:))|(([0-9A-Fa-f]{1,4}:){6}';
1171
  $pattern .= '(:|((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})';
@@ -1196,7 +1201,12 @@ class WPToolset_Cake_Validation {
1196
  * @return void
1197
  * @access private
1198
  */
1199
- function __reset() {
 
 
 
 
 
1200
  $this->check = null;
1201
  $this->regex = null;
1202
  $this->country = null;
@@ -1210,4 +1220,23 @@ class WPToolset_Cake_Validation {
1210
  return !( is_null($value) || $value === false || $value === '' );
1211
  }
1212
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1213
  }
121
  */
122
  function notEmpty($check) {
123
  $_this = &WPToolset_Cake_Validation::getInstance();
124
+ $_this->reset();
125
  $_this->check = $check;
126
 
127
  if (is_array($check)) {
160
  */
161
  function alphaNumeric($check) {
162
  $_this = &WPToolset_Cake_Validation::getInstance();
163
+ $_this->reset();
164
  $_this->check = $check;
165
 
166
  if (is_array($check)) {
183
 
184
  function alphaNumericWhitespaces($check) {
185
  $_this = &WPToolset_Cake_Validation::getInstance();
186
+ $_this->reset();
187
  $_this->check = $check;
188
 
189
  if (is_array($check)) {
233
  */
234
  function blank($check) {
235
  $_this = &WPToolset_Cake_Validation::getInstance();
236
+ $_this->reset();
237
  $_this->check = $check;
238
 
239
  if (is_array($check)) {
260
  */
261
  function cc($check, $type = 'fast', $deep = false, $regex = null) {
262
  $_this = &WPToolset_Cake_Validation::getInstance();
263
+ $_this->reset();
264
  $_this->check = $check;
265
  $_this->type = $type;
266
  $_this->deep = $deep;
398
  */
399
  function custom($check, $regex = null) {
400
  $_this = &WPToolset_Cake_Validation::getInstance();
401
+ $_this->reset();
402
  $_this->check = $check;
403
  $_this->regex = $regex;
404
  if (is_array($check)) {
445
  $format = isset($cake_date_formats[$format]) ? $cake_date_formats[$format] : $format;
446
 
447
  $_this = &WPToolset_Cake_Validation::getInstance();
448
+ $_this->reset();
449
  $_this->check = $check;
450
  $_this->regex = $regex;
451
 
483
  */
484
  function time($check) {
485
  $_this = &WPToolset_Cake_Validation::getInstance();
486
+ $_this->reset();
487
  $_this->check = $check;
488
  $_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}$%';
489
  return $_this->_check();
513
  */
514
  function decimal($check, $places = null, $regex = null) {
515
  $_this = &WPToolset_Cake_Validation::getInstance();
516
+ $_this->reset();
517
  $_this->regex = $regex;
518
  $_this->check = $check;
519
 
538
  */
539
  function email($check, $deep = false, $regex = null) {
540
  $_this = &WPToolset_Cake_Validation::getInstance();
541
+ $_this->reset();
542
  $_this->check = $check;
543
  $_this->regex = $regex;
544
  $_this->deep = $deep;
646
  if (function_exists('filter_var')) {
647
  return filter_var($check, FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV4)) !== false;
648
  }
649
+ $this->populateIp();
650
  $this->check = $check;
651
  $this->regex = '/^' . $this->__pattern['IPv4'] . '$/';
652
  return $this->_check();
663
  if (function_exists('filter_var')) {
664
  return filter_var($check, FILTER_VALIDATE_IP, array('flags' => FILTER_FLAG_IPV6)) !== false;
665
  }
666
+ $this->populateIp();
667
  $this->check = $check;
668
  $this->regex = '/^' . $this->__pattern['IPv6'] . '$/';
669
  return $this->_check();
948
  */
949
  function url($check, $strict = false, $require_tld = true) {
950
  $_this = &WPToolset_Cake_Validation::getInstance();
951
+ $_this->populateIp();
952
  $_this->check = $check;
953
  $validChars = '([' . preg_quote('!"$&\'()*+,-.@_:;=~[]') . '\/0-9\p{L}\p{N}]|(%[0-9a-f]{2}))';
954
 
1165
  * @access private
1166
  */
1167
 
1168
+ function populateIp() {
1169
+ if( method_exists( $this, '__populateIp' ) ) {
1170
+ // support for subclasses overwritting the previous __populateIp function
1171
+ return $this->__populateIp();
1172
+ }
1173
+
1174
  if (!isset($this->__pattern['IPv6'])) {
1175
  $pattern = '((([0-9A-Fa-f]{1,4}:){7}(([0-9A-Fa-f]{1,4})|:))|(([0-9A-Fa-f]{1,4}:){6}';
1176
  $pattern .= '(:|((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})';
1201
  * @return void
1202
  * @access private
1203
  */
1204
+ function reset() {
1205
+ if( method_exists( $this, '__reset' ) ) {
1206
+ // support for subclasses overwritting the previous __reset function
1207
+ return $this->__reset();
1208
+ }
1209
+
1210
  $this->check = null;
1211
  $this->regex = null;
1212
  $this->country = null;
1220
  return !( is_null($value) || $value === false || $value === '' );
1221
  }
1222
 
1223
+ /**
1224
+ * Backward compatibility
1225
+ * For PHP 7 we renamed the method __reset() and __populateIp() to reset() and populateIp().
1226
+ * As both are public methods we apply this fallback for the case someone calls the old methods.
1227
+ *
1228
+ * @param $method
1229
+ * @param $arguments
1230
+ */
1231
+ public function __call( $method, $arguments ) {
1232
+ switch( $method ) {
1233
+ case '__reset':
1234
+ $this->reset();
1235
+ break;
1236
+ case '__populateIp':
1237
+ $this->populateIp();
1238
+ break;
1239
+ }
1240
+ }
1241
+
1242
  }
vendor/toolset/toolset-common/toolset-forms/lib/js/jquery-form-validation/jquery.validate.js CHANGED
@@ -116,6 +116,10 @@
116
  var element = this[0];
117
 
118
  if (command) {
 
 
 
 
119
  var settings = $.data(element.form, 'validator').settings;
120
  var staticRules = settings.rules;
121
  var existingRules = $.validator.staticRules(element);
116
  var element = this[0];
117
 
118
  if (command) {
119
+ if( ! element.form || ! $.data(element.form, 'validator') ) {
120
+ // no validator for the form
121
+ return;
122
+ }
123
  var settings = $.data(element.form, 'validator').settings;
124
  var staticRules = settings.rules;
125
  var existingRules = $.validator.staticRules(element);
vendor/toolset/toolset-common/toolset-forms/plugin.php CHANGED
@@ -5,11 +5,11 @@
5
  */
6
  /*
7
  Plugin Name: Toolset forms
8
- Plugin URI: http://wp-types.com/toolset-forms/?utm_source=typesplugin&utm_campaign=types&utm_medium=plugins-listing&utm_term=Visit plugin site
9
  Description: Form factory
10
  Author: OTS Toolset team
11
  Version: 0.1
12
- Author URI: http://wp-types.com/?utm_source=typesplugin&utm_campaign=types&utm_medium=plugins-listing&utm_term=OTS Toolset team
13
  */
14
  require_once 'bootstrap.php';
15
  //include 'test.php';
5
  */
6
  /*
7
  Plugin Name: Toolset forms
8
+ Plugin URI: https://toolset.com/toolset-forms/?utm_source=typesplugin&utm_campaign=types&utm_medium=plugins-listing&utm_term=Visit plugin site
9
  Description: Form factory
10
  Author: OTS Toolset team
11
  Version: 0.1
12
+ Author URI: https://toolset.com/?utm_source=typesplugin&utm_campaign=types&utm_medium=plugins-listing&utm_term=OTS Toolset team
13
  */
14
  require_once 'bootstrap.php';
15
  //include 'test.php';
vendor/toolset/toolset-common/toolset-forms/readme.txt CHANGED
@@ -64,13 +64,11 @@ function my_toolset_valid_image_extentions($valid_extensions)
64
  2014-11-13
65
 
66
  - Fixed a problem with missing taxonomies after form fail:
67
- https://wp-types.com/forums/topic/cred-featured-image-and-tag-selector-empty-after-validation-refresh/
68
 
69
  2014-11-10
70
 
71
  - Fixed a problem with datepicker witch do not working inside a modal
72
  dialog
73
- https://wp-types.com/forums/topic/cred-forms-not-displaying-on-tabletmobile-browsers/
74
 
75
  2014-11-03
76
 
@@ -84,43 +82,29 @@ function my_toolset_valid_image_extentions($valid_extensions)
84
  - add filters to change repetitive buttons text:
85
  - toolset_button_delete_repetition_text
86
  - toolset_button_add_repetition_text
87
- https://wp-types.com/forums/topic/format-form-field-as-list/#post-255070
88
- https://wp-types.com/forums/topic/hi/
89
- https://wp-types.com/forums/topic/how-to-change-wpt-repdelete-button-value/
90
 
91
  2014-10-23
92
  - Fixed issue with missing previously saved data.
93
- https://wp-types.com/forums/topic/date-not-recorded-in-a-postype
94
- https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/191003870/comments#comment_296586170
95
 
96
  - Fixed a problem with not working build-in taxonomies (category,
97
  post_tag) when we use this in CPT and this post are not included on
98
  frontend.
99
- https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/190833102/comments
100
 
101
  - Fixed a problem with WYSIWYG field description.
102
- https://wp-types.com/forums/topic/add-a-link-in-the-custom-field-description/
103
- https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/191030746/comments
104
 
105
  2014-10-21
106
  - Fixed issue on checkbox after submit - there was wrong condition to
107
  display checked checkbox.
108
- https://wp-types.com/forums/topic/checkbox-value-not-saved/
109
- https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/190834414/comments
110
 
111
  2014-10-13
112
 
113
  - Fixed a wrong error message position, was under date field.
114
- https://wp-types.com/forums/topic/some-issues-and-feedback-on-cred-1-3-3/
115
- https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/190493441/comments
116
 
117
  2014-10-10
118
 
119
  - Improved - add class for li element for checkboxes, radio, taxonomy
120
  (both: flat and hierarchical), this class is based on checkbox label
121
  and is sanitizet by "sanitize_title" function.
122
- https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/170609656/comments
123
- http://wp-types.com/forums/topic/ugly-cred-taxonomy-cannot-style/
124
 
125
  - Added filter "cred_item_li_class" which allow to change class of LI
126
  element in checkboxes, radio and hierarchical taxonomy field.
@@ -129,42 +113,29 @@ function my_toolset_valid_image_extentions($valid_extensions)
129
 
130
  - Fixed warning on user site, when CRED is not installed and we check
131
  CRED setting
132
- https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/190474262/comments
133
- https://wp-types.com/forums/topic/i-just-updated-types-and-im-getting-this-error/
134
 
135
  - Fixed problem with validation if is empty conditions, validation
136
  should return true, not false.
137
- https://wp-types.com/forums/topic/custom-types-fields-not-saving-changes/
138
- https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/190347235/comments#295158276
139
 
140
  - Improved taxonomy buttons by adding extra class "btn-cancel" when it
141
  is needed - on "Cancel" for hierarchical and on "Hide" on
142
  non-hierarchical.
143
- https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/190492232/comments
144
 
145
  2014-10-07
146
 
147
  - Fixed problem with replacing @ char from filename
148
- https://wp-types.com/forums/topic/types-sanitizes-sign-from-file-names/
149
 
150
  2014-10-03
151
 
152
  - Fixed a problem with abandon filter wpcf_fields_*_value_get - this
153
  groups of filters was not copy to common library.
154
- https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/189095886/comments
155
- http://wp-types.com/forums/topic/default-field-value-custom-function-no-longer-works/
156
 
157
  2014-10-01
158
 
159
  - Fixed a problem with not changed label, when adding new taxonomy.
160
- https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/190086914/comments
161
 
162
  - Fixed changing the file name when upload the file
163
- https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/189560556/comments
164
- http://wp-types.com/forums/topic/types-1-6-update-breaks-layout-that-worked-in-types-1-5-7/
165
 
166
  2014-09-30
167
  - Fixed a problem with multiple CRED form on one screen.
168
- https://icanlocalize.basecamphq.com/projects/7393061-toolset/todo_items/189954041/comments
169
- http://wp-types.com/forums/topic/cred-conditional-group-3/
170
 
64
  2014-11-13
65
 
66
  - Fixed a problem with missing taxonomies after form fail:
 
67
 
68
  2014-11-10
69
 
70
  - Fixed a problem with datepicker witch do not working inside a modal
71
  dialog
 
72
 
73
  2014-11-03
74
 
82
  - add filters to change repetitive buttons text:
83
  - toolset_button_delete_repetition_text
84
  - toolset_button_add_repetition_text
 
 
 
85
 
86
  2014-10-23
87
  - Fixed issue with missing previously saved data.
 
 
88
 
89
  - Fixed a problem with not working build-in taxonomies (category,
90
  post_tag) when we use this in CPT and this post are not included on
91
  frontend.
 
92
 
93
  - Fixed a problem with WYSIWYG field description.
 
 
94
 
95
  2014-10-21
96
  - Fixed issue on checkbox after submit - there was wrong condition to
97
  display checked checkbox.
 
 
98
 
99
  2014-10-13
100
 
101
  - Fixed a wrong error message position, was under date field.
 
 
102
 
103
  2014-10-10
104
 
105
  - Improved - add class for li element for checkboxes, radio, taxonomy
106
  (both: flat and hierarchical), this class is based on checkbox label
107
  and is sanitizet by "sanitize_title" function.
 
 
108
 
109
  - Added filter "cred_item_li_class" which allow to change class of LI
110
  element in checkboxes, radio and hierarchical taxonomy field.
113
 
114
  - Fixed warning on user site, when CRED is not installed and we check
115
  CRED setting
 
 
116
 
117
  - Fixed problem with validation if is empty conditions, validation
118
  should return true, not false.
 
 
119
 
120
  - Improved taxonomy buttons by adding extra class "btn-cancel" when it
121
  is needed - on "Cancel" for hierarchical and on "Hide" on
122
  non-hierarchical.
 
123
 
124
  2014-10-07
125
 
126
  - Fixed problem with replacing @ char from filename
 
127
 
128
  2014-10-03
129
 
130
  - Fixed a problem with abandon filter wpcf_fields_*_value_get - this
131
  groups of filters was not copy to common library.
 
 
132
 
133
  2014-10-01
134
 
135
  - Fixed a problem with not changed label, when adding new taxonomy.
 
136
 
137
  - Fixed changing the file name when upload the file
 
 
138
 
139
  2014-09-30
140
  - Fixed a problem with multiple CRED form on one screen.
 
 
141
 
vendor/toolset/toolset-common/user-editors/editor/divi.php CHANGED
@@ -32,6 +32,8 @@ class Toolset_User_Editors_Editor_Divi
32
 
33
  add_action( 'wp_loaded', array( $this, 'add_filter_for_divi_modules_for_cts' ) );
34
 
 
 
35
  if (
36
  isset( $this->medium )
37
  && $this->medium->get_id()
@@ -91,4 +93,25 @@ class Toolset_User_Editors_Editor_Divi
91
  return $allowed_types;
92
  }
93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  }
32
 
33
  add_action( 'wp_loaded', array( $this, 'add_filter_for_divi_modules_for_cts' ) );
34
 
35
+ add_filter( 'get_post_metadata', array( $this, 'maybe_post_uses_divi_built_ct' ), 10, 4 );
36
+
37
  if (
38
  isset( $this->medium )
39
  && $this->medium->get_id()
93
  return $allowed_types;
94
  }
95
 
96
+ /**
97
+ * Hijack the "get_post_meta( $post_id, '_et_pb_use_builder', true )" call that checks if the post with ID equals to
98
+ * $post_id is built with Divi builder. The hijacking relates to checking on posts/pages that use content templates
99
+ * built with Divi. In this case, the post will be identified as one that uses Divi builder.
100
+ *
101
+ * @param string $meta_value The value of the meta.
102
+ * @param int $post_id The current post ID.
103
+ * @param string $meta_key The key of the meta.
104
+ * @param bool $single Whether to return a single value.
105
+ * @return mixed
106
+ */
107
+ public function maybe_post_uses_divi_built_ct( $meta_value, $post_id, $meta_key, $single ) {
108
+ if ( $meta_key === self::DIVI_BUILDER_OPTION_NAME ) {
109
+ $ct_id = get_post_meta( $post_id, '_views_template', true );
110
+ if ( $ct_id ) {
111
+ $meta_value = get_post_meta( $ct_id, self::DIVI_BUILDER_OPTION_NAME, true );
112
+ }
113
+ }
114
+
115
+ return $meta_value;
116
+ }
117
  }
vendor/toolset/toolset-common/user-editors/editor/screen/visual-composer/frontend.php CHANGED
@@ -14,6 +14,11 @@ class Toolset_User_Editors_Editor_Screen_Visual_Composer_Frontend
14
  if( array_key_exists( 'action', $_POST ) && $_POST['action'] == 'vc_edit_form' ) {
15
  add_filter( 'wpv_filter_dialog_for_editors_requires_post', '__return_false' );
16
  }
 
 
 
 
 
17
  }
18
 
19
  /**
14
  if( array_key_exists( 'action', $_POST ) && $_POST['action'] == 'vc_edit_form' ) {
15
  add_filter( 'wpv_filter_dialog_for_editors_requires_post', '__return_false' );
16
  }
17
+
18
+ // This filters the content of the Visual Composer WP Text Widget module before the global post switched from the
19
+ // current post in the loop to the top current post. The switch happens because the module calls the "the_widget()"
20
+ // method which ultimately calls WP_Widget_Text::widget.
21
+ add_filter( 'vc_wp_text_widget_shortcode', 'wpv_do_shortcode' );
22
  }
23
 
24
  /**
vendor/toolset/toolset-common/user-editors/editor/templates/inline-ct-overlay.tpl.php CHANGED
@@ -1,4 +1,8 @@
1
- <script type="text/html" id="js-wpv-layout-template-overlay-template">
 
 
 
 
2
  <div class='wpv-setting-overlay js-wpv-layout-template-overlay' style='top:36px'>
3
  <div class='wpv-transparency' style='opacity:0.9'></div>
4
  <div class='wpv-layout-template-overlay-info toolset-alert toolset-alert-info'>
1
+ <?php
2
+ /*
3
+ * Overlay Template
4
+ */
5
+ ?><script type="text/html" id="js-wpv-layout-template-overlay-template">
6
  <div class='wpv-setting-overlay js-wpv-layout-template-overlay' style='top:36px'>
7
  <div class='wpv-transparency' style='opacity:0.9'></div>
8
  <div class='wpv-layout-template-overlay-info toolset-alert toolset-alert-info'>
vendor/toolset/toolset-common/user-editors/editor/templates/inline-ct-saving-overlay.tpl.php CHANGED
@@ -1,4 +1,8 @@
1
- <script type="text/html" id="js-wpv-layout-template-saving-overlay-template">
 
 
 
 
2
  <div class="wpv-setting-overlay js-wpv-layout-template-overlay" style="top:36px;">
3
  <div class="wpv-transparency" style="opacity:0.9;"></div>
4
  <div class="wpv-layout-template-overlay-info toolset-alert toolset-alert-info">
1
+ <?php
2
+ /*
3
+ * Saving Overlay Template
4
+ */
5
+ ?><script type="text/html" id="js-wpv-layout-template-saving-overlay-template">
6
  <div class="wpv-setting-overlay js-wpv-layout-template-overlay" style="top:36px;">
7
  <div class="wpv-transparency" style="opacity:0.9;"></div>
8
  <div class="wpv-layout-template-overlay-info toolset-alert toolset-alert-info">
vendor/toolset/toolset-common/utility/admin/notice/abstract.php CHANGED
@@ -7,6 +7,7 @@
7
  * All containing properties and methods without since tag are part of the initial release
8
  */
9
  abstract class Toolset_Admin_Notice_Abstract implements Toolset_Admin_Notice_Interface {
 
10
  /**
11
  * @var string
12
  */
@@ -58,11 +59,13 @@ abstract class Toolset_Admin_Notice_Abstract implements Toolset_Admin_Notice_Int
58
  */
59
  protected $template_file;
60
 
 
61
  /**
62
  * @var Toolset_Constants
63
  */
64
  protected $constants;
65
 
 
66
  /**
67
  * Notice is only for administrators
68
  *
@@ -76,14 +79,31 @@ abstract class Toolset_Admin_Notice_Abstract implements Toolset_Admin_Notice_Int
76
  */
77
  protected $is_only_for_administrators = true;
78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  /**
80
  * Toolset_Admin_Notice constructor.
81
  *
82
  * @param string $id
83
- *
84
  * @param string $message
85
- *
86
- * @throws Exception
87
  */
88
  public function __construct( $id, $message = '', Toolset_Constants $constants = null ) {
89
 
@@ -94,13 +114,15 @@ abstract class Toolset_Admin_Notice_Abstract implements Toolset_Admin_Notice_Int
94
 
95
  if( ! function_exists( 'sanitize_title' ) ) {
96
  // abort, called to early
97
- throw new Exception( 'Toolset_Admin_Notice_Abstract Error: "sanitize_title()" does not exists. ' .
98
- 'Toolset_Admin_Notice_Abstract::create_notice() was called too early.' );
 
 
99
  }
100
 
101
  if( ! is_string( $id ) ) {
102
  // no string given
103
- throw new Exception( 'Toolset_Admin_Notice_Abstract Error: $id must be a string.' );
104
  }
105
 
106
  if( ! empty( $message ) ) {
@@ -127,6 +149,20 @@ abstract class Toolset_Admin_Notice_Abstract implements Toolset_Admin_Notice_Int
127
  $this->title = $title;
128
  }
129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  /**
131
  * @return string
132
  */
@@ -248,6 +284,8 @@ abstract class Toolset_Admin_Notice_Abstract implements Toolset_Admin_Notice_Int
248
  return;
249
  }
250
 
 
 
251
  include( $this->template_file );
252
  }
253
 
@@ -307,4 +345,61 @@ abstract class Toolset_Admin_Notice_Abstract implements Toolset_Admin_Notice_Int
307
  $this->template_file = $template_path;
308
  }
309
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
310
  }
7
  * All containing properties and methods without since tag are part of the initial release
8
  */
9
  abstract class Toolset_Admin_Notice_Abstract implements Toolset_Admin_Notice_Interface {
10
+
11
  /**
12
  * @var string
13
  */
59
  */
60
  protected $template_file;
61
 
62
+
63
  /**
64
  * @var Toolset_Constants
65
  */
66
  protected $constants;
67
 
68
+
69
  /**
70
  * Notice is only for administrators
71
  *
79
  */
80
  protected $is_only_for_administrators = true;
81
 
82
+
83
+ /**
84
+ * @var string
85
+ */
86
+ private $similar_notices_key;
87
+
88
+
89
+ /**
90
+ * @var callable[]
91
+ */
92
+ private $dependency_callbacks = array();
93
+
94
+
95
+ /**
96
+ * @var array|null
97
+ */
98
+ private $template_context;
99
+
100
+
101
  /**
102
  * Toolset_Admin_Notice constructor.
103
  *
104
  * @param string $id
 
105
  * @param string $message
106
+ * @param Toolset_Constants|null $constants
 
107
  */
108
  public function __construct( $id, $message = '', Toolset_Constants $constants = null ) {
109
 
114
 
115
  if( ! function_exists( 'sanitize_title' ) ) {
116
  // abort, called to early
117
+ throw new InvalidArgumentException(
118
+ 'Toolset_Admin_Notice_Abstract Error: "sanitize_title()" does not exists. '
119
+ . 'Toolset_Admin_Notice_Abstract::create_notice() was called too early.'
120
+ );
121
  }
122
 
123
  if( ! is_string( $id ) ) {
124
  // no string given
125
+ throw new InvalidArgumentException( 'Toolset_Admin_Notice_Abstract Error: $id must be a string.' );
126
  }
127
 
128
  if( ! empty( $message ) ) {
149
  $this->title = $title;
150
  }
151
 
152
+ /**
153
+ * @param string $key
154
+ */
155
+ public function set_similar_notices_key( $key ) {
156
+ $this->similar_notices_key = $key;
157
+ }
158
+
159
+ /**
160
+ * @return string
161
+ */
162
+ public function get_similar_notices_key() {
163
+ return $this->similar_notices_key;
164
+ }
165
+
166
  /**
167
  * @return string
168
  */
284
  return;
285
  }
286
 
287
+ $this->run_dependency_callbacks();
288
+
289
  include( $this->template_file );
290
  }
291
 
345
  $this->template_file = $template_path;
346
  }
347
  }
348
+
349
+ /**
350
+ * Template path for a notice with the Toolset Robot
351
+ */
352
+ public function set_template_toolset_robot() {
353
+ $this->template_file = TOOLSET_COMMON_PATH . '/templates/admin/notice/toolset-robot.phtml';
354
+ }
355
+
356
+
357
+ /**
358
+ * @inheritdoc
359
+ * @param callable $callback
360
+ * @since 2.8
361
+ */
362
+ public function add_dependency_callback( $callback ) {
363
+ if( ! is_callable( $callback ) ) {
364
+ throw new InvalidArgumentException();
365
+ }
366
+
367
+ $this->dependency_callbacks[] = $callback;
368
+ }
369
+
370
+
371
+ /**
372
+ * Run all callbacks previously added via add_dependency_callback().
373
+ *
374
+ * @since 2.8
375
+ */
376
+ public function run_dependency_callbacks() {
377
+ foreach( $this->dependency_callbacks as $callback ) {
378
+ $callback();
379
+ }
380
+ }
381
+
382
+
383
+ /**
384
+ * Set a context variable that will be accessible when rendering the notice template.
385
+ *
386
+ * @param array $context
387
+ *
388
+ * @return void
389
+ * @since 2.á
390
+ */
391
+ public function set_template_context( $context ) {
392
+ $this->template_context = toolset_ensarr( $context );
393
+ }
394
+
395
+
396
+ /**
397
+ * Get the context variable.
398
+ *
399
+ * @return array
400
+ */
401
+ public function get_template_context() {
402
+ return toolset_ensarr( $this->template_context );
403
+ }
404
+
405
  }
vendor/toolset/toolset-common/utility/admin/notice/interface.php CHANGED
@@ -102,4 +102,51 @@ interface Toolset_Admin_Notice_Interface {
102
  * @param bool $bool
103
  */
104
  public function set_is_only_for_administrators( $bool );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  }
102
  * @param bool $bool
103
  */
104
  public function set_is_only_for_administrators( $bool );
105
+
106
+ /**
107
+ * @param string $key
108
+ */
109
+ public function set_similar_notices_key( $key );
110
+
111
+ /**
112
+ * @return string
113
+ */
114
+ public function get_similar_notices_key();
115
+
116
+
117
+ /**
118
+ * @return string
119
+ */
120
+ public function render_content();
121
+
122
+
123
+ /**
124
+ * Add a callback that will be invoked just before rendering the notice.
125
+ *
126
+ * It can be used for enqueuing assets, etc.
127
+ *
128
+ * @param callable $callback
129
+ * @return void
130
+ * @since 2.8
131
+ */
132
+ public function add_dependency_callback( $callback );
133
+
134
+
135
+ /**
136
+ * Set a context variable that will be accessible when rendering the notice template.
137
+ *
138
+ * @param array $context
139
+ *
140
+ * @return void
141
+ * @since 2.á
142
+ */
143
+ public function set_template_context( $context );
144
+
145
+
146
+ /**
147
+ * Get the context variable.
148
+ *
149
+ * @return array
150
+ */
151
+ public function get_template_context();
152
  }
vendor/toolset/toolset-common/utility/admin/notices/Builder.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OTGS\Toolset\Common\Utility\Admin\Notices;
4
+
5
+ /**
6
+ * Class Builder
7
+ *
8
+ * Could also be called Toolset_Admin_Notices_Manager V2 or "the non static version of Toolset_Admin_Notices_Manager".
9
+ *
10
+ * @package OTGS\Toolset\Common\Utility\Admin\Notices
11
+ *
12
+ * @since 3.0
13
+ */
14
+ class Builder {
15
+ /**
16
+ * Create a notice object
17
+ *
18
+ * @param $id
19
+ * @param string $type
20
+ *
21
+ * @return \Toolset_Admin_Notice_Abstract
22
+ */
23
+ public function createNotice( $id, $type = 'success' ) {
24
+ switch( $type ) {
25
+ case 'success':
26
+ return new \Toolset_Admin_Notice_Success( $id );
27
+ case 'error':
28
+ return new \Toolset_Admin_Notice_Error( $id );
29
+ case 'warning':
30
+ return new \Toolset_Admin_Notice_Warning( $id );
31
+ case 'dismissible':
32
+ return new \Toolset_Admin_Notice_Dismissible( $id );
33
+ case 'undismissible':
34
+ return new \Toolset_Admin_Notice_Undismissible( $id );
35
+ case 'required-action':
36
+ return new \Toolset_Admin_Notice_Dismissible( $id );
37
+ case 'layouts-help':
38
+ return new \Toolset_Admin_Notice_Layouts_Help( $id );
39
+ default:
40
+ return new \Toolset_Admin_Notice_Error( $id );
41
+ }
42
+ }
43
+
44
+ /**
45
+ * Primary Button
46
+ *
47
+ * @param $title
48
+ * @param array $attributes
49
+ *
50
+ * @return string
51
+ */
52
+ public function tplButtonPrimary( $title, $attributes = array() ) {
53
+ return $this->tplCreateButton( 'toolset-button toolset-button-primary', $title, $attributes );
54
+ }
55
+
56
+ /**
57
+ * Button
58
+ *
59
+ * @param $title
60
+ * @param array $attributes
61
+ *
62
+ * @return string
63
+ */
64
+ public function tplButton( $title, $attributes = array() ) {
65
+ return $this->tplCreateButton( 'toolset-button', $title, $attributes );
66
+ }
67
+
68
+ /**
69
+ * @param \Toolset_Admin_Notice_Abstract $notice
70
+ * @param string $content
71
+ */
72
+ public function addNotice( \Toolset_Admin_Notice_Abstract $notice, $content = '' ) {
73
+ \Toolset_Admin_Notices_Manager::add_notice( $notice, $content );
74
+ }
75
+
76
+ /**
77
+ * Internal function to create a button
78
+ *
79
+ * @param $tpl_class
80
+ * @param $title
81
+ * @param $attributes
82
+ *
83
+ * @return string
84
+ */
85
+ private function tplCreateButton( $tpl_class, $title, $attributes ) {
86
+ $btnClasses = esc_attr( $tpl_class );
87
+ $title = esc_attr( $title );
88
+
89
+ if( ! is_array( $attributes ) ) {
90
+ throw new \InvalidArgumentException(
91
+ 'OTGS\Toolset\Common\Utility\Admin\Notices\Builder::tplButtonPrimary()' .
92
+ ' - Second parameter must be an array.' );
93
+ }
94
+
95
+ // define html element based on href
96
+ $html_element = isset( $attributes['href'] )
97
+ ? 'a'
98
+ : 'span';
99
+
100
+ // attribute class
101
+ $attributes['class'] = isset( $attributes['class'] )
102
+ ? $btnClasses . ' ' . esc_attr( $attributes['class'] )
103
+ : $btnClasses;
104
+
105
+ // stringify all attributes
106
+ $attributes_string = '';
107
+ foreach( $attributes as $key => $value ) {
108
+ $attributes_string .= ' ' . esc_attr( $key ). '="' . esc_attr( $value ) . '"';
109
+ }
110
+
111
+ // html link
112
+ return '<' . $html_element . $attributes_string . '>' . $title . '</' . $html_element . '>';
113
+ }
114
+ }
vendor/toolset/toolset-common/utility/admin/notices/manager.php CHANGED
@@ -15,12 +15,17 @@ class Toolset_Admin_Notices_Manager {
15
  const JS_VARNAME_NONCE = 'toolset-admin-notice-nonce';
16
  const JS_VARNAME_ACTION = 'toolset-admin-notice-action';
17
  const JS_VARNAME_NOTICE_ID = 'notice-id';
 
18
 
19
  // js triggers
20
  const JS_TRIGGER_NOTICE_DISMISSIBLE = 'toolset-dismissible';
21
 
22
  // option fields
23
  const OPTION_FIELD_DISMISSED_NOTICE = 'dismissed-notices';
 
 
 
 
24
 
25
  /**
26
  * @var Toolset_Admin_Notice_Interface[]
@@ -116,7 +121,9 @@ class Toolset_Admin_Notices_Manager {
116
  }
117
 
118
  foreach( $notices as $notice ) {
119
- if( ! $notice->conditions_met() || self::is_notice_dismissed( $notice ) ) {
 
 
120
  // visitor don't want to see the message anymore
121
  continue;
122
  }
@@ -153,6 +160,13 @@ class Toolset_Admin_Notices_Manager {
153
  : false;
154
 
155
  self::dismiss_notice_by_id( rtrim( $_REQUEST[ self::JS_VARNAME_NOTICE_ID ], '$' ), $dismiss_globally );
 
 
 
 
 
 
 
156
  die( $_REQUEST[ self::JS_VARNAME_NOTICE_ID ] );
157
  break;
158
 
@@ -196,6 +210,7 @@ class Toolset_Admin_Notices_Manager {
196
  'varnameNonce' => self::JS_VARNAME_NONCE,
197
  'varnameAction' => self::JS_VARNAME_ACTION,
198
  'varnameNoticeId' => self::JS_VARNAME_NOTICE_ID,
 
199
  'triggerNoticeDismissible' => self::JS_TRIGGER_NOTICE_DISMISSIBLE
200
  )
201
  );
@@ -215,36 +230,48 @@ class Toolset_Admin_Notices_Manager {
215
  return false;
216
  }
217
 
 
 
 
 
 
 
 
 
 
 
 
 
218
  $user_id = get_current_user_id();
219
 
220
  if( $user_id == 0 ) {
221
  return false;
222
  }
223
 
 
 
 
 
 
 
 
 
 
 
 
224
  // globally dismissed
225
  $settings = get_option( self::ID );
226
 
227
  if( is_array( $settings )
228
  && array_key_exists( self::OPTION_FIELD_DISMISSED_NOTICE, $settings )
229
- && array_key_exists( $notice->get_id(), $settings[ self::OPTION_FIELD_DISMISSED_NOTICE ] )
230
  ) {
231
  // notice globally dismissed
232
  return true;
233
  }
234
 
235
- // user settings
236
- $user_settings = get_user_meta( $user_id, self::ID, true );
237
-
238
- if( is_array( $user_settings )
239
- && array_key_exists( self::OPTION_FIELD_DISMISSED_NOTICE, $user_settings )
240
- && array_key_exists( $notice->get_id(), $user_settings[ self::OPTION_FIELD_DISMISSED_NOTICE ] )
241
- ) {
242
- // user dimissed the message
243
- return true;
244
- }
245
-
246
- return false;
247
- }
248
 
249
  /**
250
  * Store that the current user don't want to see the notice with id anymore
@@ -278,20 +305,81 @@ class Toolset_Admin_Notices_Manager {
278
  update_user_meta( $user_id, self::ID, $user_settings );
279
  }
280
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
 
282
  /**
283
- * Create a button primary
284
  *
285
- * @param $title
286
  * @param string $href
 
287
  * @param bool $external
288
  *
289
  * @return string TPL of the link
 
290
  */
291
- public static function tpl_button_primary( $title, $href, $external = false ) {
292
  $title = esc_attr( $title );
293
  $href = esc_url( $href );
294
- $class = 'toolset-button toolset-button-primary';
295
  $target = '';
296
 
297
  if( $external === true ) {
@@ -305,6 +393,37 @@ class Toolset_Admin_Notices_Manager {
305
  }
306
 
307
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
  /**
309
  * Create a link
310
  *
15
  const JS_VARNAME_NONCE = 'toolset-admin-notice-nonce';
16
  const JS_VARNAME_ACTION = 'toolset-admin-notice-action';
17
  const JS_VARNAME_NOTICE_ID = 'notice-id';
18
+ const JS_VARNAME_DISMISS_SIMILAR_NOTICES = 'dismiss-similar-notices';
19
 
20
  // js triggers
21
  const JS_TRIGGER_NOTICE_DISMISSIBLE = 'toolset-dismissible';
22
 
23
  // option fields
24
  const OPTION_FIELD_DISMISSED_NOTICE = 'dismissed-notices';
25
+ const OPTION_FIELD_DISMISSED_SIMILAR_NOTICES = 'dismissed-similar-notices';
26
+
27
+ // const similar notices keys
28
+ const SIMILAR_NOTICES_FREE_PLUGIN_SHOWS_PAID_FEATURES = 'free-plugin-shows-new-paid-features';
29
 
30
  /**
31
  * @var Toolset_Admin_Notice_Interface[]
121
  }
122
 
123
  foreach( $notices as $notice ) {
124
+ if( ! $notice->conditions_met()
125
+ || self::is_notice_dismissed( $notice )
126
+ || self::are_similar_notices_dismissed( $notice ) ) {
127
  // visitor don't want to see the message anymore
128
  continue;
129
  }
160
  : false;
161
 
162
  self::dismiss_notice_by_id( rtrim( $_REQUEST[ self::JS_VARNAME_NOTICE_ID ], '$' ), $dismiss_globally );
163
+
164
+ if( ! empty( $_REQUEST[ self::JS_VARNAME_DISMISS_SIMILAR_NOTICES ] ) ) {
165
+ foreach( $_REQUEST[ self::JS_VARNAME_DISMISS_SIMILAR_NOTICES ] as $key ) {
166
+ self::dismiss_similar_notices( $key );
167
+ }
168
+ }
169
+
170
  die( $_REQUEST[ self::JS_VARNAME_NOTICE_ID ] );
171
  break;
172
 
210
  'varnameNonce' => self::JS_VARNAME_NONCE,
211
  'varnameAction' => self::JS_VARNAME_ACTION,
212
  'varnameNoticeId' => self::JS_VARNAME_NOTICE_ID,
213
+ 'varnameDismissSimilarNotices' => self::JS_VARNAME_DISMISS_SIMILAR_NOTICES,
214
  'triggerNoticeDismissible' => self::JS_TRIGGER_NOTICE_DISMISSIBLE
215
  )
216
  );
230
  return false;
231
  }
232
 
233
+ return self::is_notice_dismissed_by_notice_id( $notice->get_id() );
234
+ }
235
+
236
+ /**
237
+ * This function can be used by using the "id" of the notice instead of Toolset_Admin_Notice_Interface
238
+ * "ID" is in this case a unique string, which describes the notice.
239
+ *
240
+ * @param $notice_id
241
+ *
242
+ * @return bool
243
+ */
244
+ public static function is_notice_dismissed_by_notice_id( $notice_id ) {
245
  $user_id = get_current_user_id();
246
 
247
  if( $user_id == 0 ) {
248
  return false;
249
  }
250
 
251
+ // user settings
252
+ $user_settings = get_user_meta( $user_id, self::ID, true );
253
+
254
+ if( is_array( $user_settings )
255
+ && array_key_exists( self::OPTION_FIELD_DISMISSED_NOTICE, $user_settings )
256
+ && array_key_exists( $notice_id, $user_settings[ self::OPTION_FIELD_DISMISSED_NOTICE ] )
257
+ ) {
258
+ // user dimissed the message
259
+ return true;
260
+ }
261
+
262
  // globally dismissed
263
  $settings = get_option( self::ID );
264
 
265
  if( is_array( $settings )
266
  && array_key_exists( self::OPTION_FIELD_DISMISSED_NOTICE, $settings )
267
+ && array_key_exists( $notice_id, $settings[ self::OPTION_FIELD_DISMISSED_NOTICE ] )
268
  ) {
269
  // notice globally dismissed
270
  return true;
271
  }
272
 
273
+ return false;
274
+ }
 
 
 
 
 
 
 
 
 
 
 
275
 
276
  /**
277
  * Store that the current user don't want to see the notice with id anymore
305
  update_user_meta( $user_id, self::ID, $user_settings );
306
  }
307
 
308
+ /**
309
+ * Set stop showing similiar notices by $key_for_similar_notices
310
+ *
311
+ * @param $key_for_similar_notices
312
+ *
313
+ * @return bool
314
+ */
315
+ public static function dismiss_similar_notices( $key_for_similar_notices ) {
316
+ $user_id = get_current_user_id();
317
+
318
+ if( $user_id == 0 ) {
319
+ return false;
320
+ }
321
+
322
+ $user_settings = get_user_meta( $user_id, self::ID, true );
323
+ $user_settings = empty( $user_settings ) ? array() : $user_settings;
324
+ $user_settings[ self::OPTION_FIELD_DISMISSED_SIMILAR_NOTICES ][ $key_for_similar_notices ] = true;
325
+ update_user_meta( $user_id, self::ID, $user_settings );
326
+ }
327
+
328
+ /**
329
+ * Check if current user has used the option to stop similar notices
330
+ *
331
+ * @param Toolset_Admin_Notice_Interface $notice
332
+ *
333
+ * @return bool
334
+ */
335
+ public static function are_similar_notices_dismissed( $notice ) {
336
+ if( ! $notice instanceof Toolset_Admin_Notice_Interface ) {
337
+ // no proper $notice (we have a filter for it, so probably that's the reason)
338
+ return false;
339
+ }
340
+
341
+ $similar_notices_key = $notice->get_similar_notices_key();
342
+ if( empty( $similar_notices_key ) ) {
343
+ // no similar notices key used for this message
344
+ return false;
345
+ }
346
+
347
+ $user_id = get_current_user_id();
348
+
349
+ if( $user_id == 0 ) {
350
+ return false;
351
+ }
352
+
353
+ // user settings
354
+ $user_settings = get_user_meta( $user_id, self::ID, true );
355
+
356
+ if( is_array( $user_settings )
357
+ && array_key_exists( self::OPTION_FIELD_DISMISSED_SIMILAR_NOTICES, $user_settings )
358
+ && array_key_exists( $notice->get_similar_notices_key(), $user_settings[ self::OPTION_FIELD_DISMISSED_SIMILAR_NOTICES ] )
359
+ ) {
360
+ // user dimissed similar notices
361
+ return true;
362
+ }
363
+
364
+ return false;
365
+ }
366
+
367
 
368
  /**
369
+ * Create a button. Use of tpl_button_primary() or tpl_button_secondary() is preferred.
370
  *
371
+ * @param string $title
372
  * @param string $href
373
+ * @param string $class
374
  * @param bool $external
375
  *
376
  * @return string TPL of the link
377
+ * @since 2.8
378
  */
379
+ public static function tpl_button( $title, $href, $class, $external = false ) {
380
  $title = esc_attr( $title );
381
  $href = esc_url( $href );
382
+ $class = 'toolset-button ' . $class;
383
  $target = '';
384
 
385
  if( $external === true ) {
393
  }
394
 
395
 
396
+ /**
397
+ * Create a primary button
398
+ *
399
+ * @param string $title
400
+ * @param string $href
401
+ * @param bool $external
402
+ * @param string $extra_class
403
+ *
404
+ * @return string HTML markup of the link.
405
+ */
406
+ public static function tpl_button_primary( $title, $href, $external = false, $extra_class = '' ) {
407
+ return self::tpl_button( $title, $href, 'toolset-button-primary ' . $extra_class, $external );
408
+ }
409
+
410
+
411
+ /**
412
+ * Create a secondary button
413
+ *
414
+ * @param string $title
415
+ * @param string $href
416
+ * @param bool $external
417
+ * @param string $extra_class
418
+ *
419
+ * @return string HTML markup of the link.
420
+ * @since 2.8
421
+ */
422
+ public static function tpl_button_secondary( $title, $href, $external = false, $extra_class = '' ) {
423
+ return self::tpl_button( $title, $href, 'toolset-button-secondary ' . $extra_class, $external );
424
+ }
425
+
426
+
427
  /**
428
  * Create a link
429
  *
vendor/toolset/toolset-common/utility/condition/plugin/installer/is_available.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OTGS\Toolset\Common\Condition\Installer;
4
+
5
+ /**
6
+ * Check whether Installer is available, by checking Types and WPML status.
7
+ *
8
+ * @package OTGS\Toolset\Common\Condition\Installer
9
+ */
10
+ class IsAvailable implements \Toolset_Condition_Interface {
11
+
12
+
13
+ /** @var \Toolset_Condition_Plugin_Types_Active */
14
+ private $is_types_active_condition;
15
+
16
+
17
+ /** @var \Toolset_Condition_Plugin_Wpml_Is_Active_And_Configured */
18
+ private $is_wpml_active_condition;
19
+
20
+
21
+ /**
22
+ * IsAvailable constructor.
23
+ *
24
+ * @param \Toolset_Condition_Plugin_Types_Active|null $is_types_active_di
25
+ * @param \Toolset_Condition_Plugin_Wpml_Is_Active_And_Configured|null $is_wpml_active_di
26
+ */
27
+ public function __construct(
28
+ \Toolset_Condition_Plugin_Types_Active $is_types_active_di = null,
29
+ \Toolset_Condition_Plugin_Wpml_Is_Active_And_Configured $is_wpml_active_di = null
30
+ ) {
31
+ $this->is_types_active_condition = $is_types_active_di ?: new \Toolset_Condition_Plugin_Types_Active();
32
+ $this->is_wpml_active_condition = $is_wpml_active_di ?: new \Toolset_Condition_Plugin_Wpml_Is_Active_And_Configured();
33
+ }
34
+
35
+
36
+ /**
37
+ * @return bool
38
+ */
39
+ public function is_met() {
40
+ return ( $this->is_types_active_condition->is_met() || $this->is_wpml_active_condition->is_met() );
41
+ }
42
+ }
vendor/toolset/toolset-common/utility/condition/plugin/installer/is_toolset_subscription_valid.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OTGS\Toolset\Common\Condition\Installer;
4
+
5
+
6
+ /**
7
+ * Check whether the client has a valid subscription for Toolset plugins.
8
+ *
9
+ * This will always return false if Installer is not available.
10
+ *
11
+ * @package OTGS\Toolset\Common\Condition\Installer
12
+ */
13
+ class IsToolsetSubscriptionValid implements \Toolset_Condition_Interface {
14
+
15
+
16
+ /** @var IsAvailable */
17
+ private $is_installer_available;
18
+
19
+
20
+ /**
21
+ * IsToolsetSubscriptionValid constructor.
22
+ *
23
+ * @param IsAvailable|null $is_available_di
24
+ */
25
+ public function __construct( IsAvailable $is_available_di = null ) {
26
+ $this->is_installer_available = $is_available_di ?: new IsAvailable();
27
+ }
28
+
29
+
30
+ /**
31
+ * @return bool
32
+ */
33
+ public function is_met() {
34
+ if( ! $this->is_installer_available->is_met() ) {
35
+ return false;
36
+ }
37
+
38
+ $subscription_status = apply_filters( 'otgs_installer_repository_subscription_status', null, 'toolset' );
39
+ $is_registered = ( 'valid' === $subscription_status );
40
+
41
+ return $is_registered;
42
+ }
43
+ }
vendor/toolset/toolset-common/utility/condition/plugin/wpml/doesnt_support_m2m.php CHANGED
@@ -13,10 +13,6 @@ class Toolset_Condition_Plugin_Wpml_Doesnt_Support_M2m implements Toolset_Condit
13
  public function is_met() {
14
  $m2m_controller = Toolset_Relationship_Controller::get_instance();
15
 
16
- if( ! $m2m_controller->is_m2m_enabled() ) {
17
- return false;
18
- }
19
-
20
  if( ! Toolset_WPML_Compatibility::get_instance()->is_wpml_active_and_configured() ) {
21
  return false;
22
  }
@@ -27,4 +23,4 @@ class Toolset_Condition_Plugin_Wpml_Doesnt_Support_M2m implements Toolset_Condit
27
  '<'
28
  );
29
  }
30
- }
13
  public function is_met() {
14
  $m2m_controller = Toolset_Relationship_Controller::get_instance();
15
 
 
 
 
 
16
  if( ! Toolset_WPML_Compatibility::get_instance()->is_wpml_active_and_configured() ) {
17
  return false;
18
  }
23
  '<'
24
  );
25
  }
26
+ }
vendor/toolset/toolset-common/utility/condition/theme/layouts-support/plugin/available.php CHANGED
@@ -60,7 +60,7 @@ class Toolset_Condition_Theme_Layouts_Support_Plugin_Available implements Toolse
60
  'Avada' => array(
61
  'theme_name' => 'Avada',
62
  'plugin_name' => 'Toolset Avada Integration',
63
- 'doc_link' => 'https://wp-types.com/documentation/user-guides/toolset-avada-integration/' .
64
  '?utm_source=typesplugin' .
65
  '&utm_campaign=types' .
66
  '&utm_medium=theme-integration-message' .
@@ -71,7 +71,7 @@ class Toolset_Condition_Theme_Layouts_Support_Plugin_Available implements Toolse
71
  'Cornerstone, for WordPress' => array(
72
  'theme_name' => 'Cornerstone',
73
  'plugin_name' => 'Toolset Cornerstone Integration',
74
- 'doc_link' => 'https://wp-types.com/documentation/user-guides/toolset-cornerstone-integration/' .
75
  '?utm_source=typesplugin' .
76
  '&utm_campaign=types' .
77
  '&utm_medium=theme-integration-message' .
@@ -82,7 +82,7 @@ class Toolset_Condition_Theme_Layouts_Support_Plugin_Available implements Toolse
82
  'Divi' => array(
83
  'theme_name' => 'Divi',
84
  'plugin_name' => 'Toolset Divi Integration',
85
- 'doc_link' => 'https://wp-types.com/documentation/user-guides/toolset-divi-integration/' .
86
  '?utm_source=typesplugin' .
87
  '&utm_campaign=types' .
88
  '&utm_medium=theme-integration-message' .
@@ -93,7 +93,7 @@ class Toolset_Condition_Theme_Layouts_Support_Plugin_Available implements Toolse
93
  'Genesis' => array(
94
  'theme_name' => 'Genesis',
95
  'plugin_name' => 'Toolset Genesis Integration',
96
- 'doc_link' => 'https://wp-types.com/documentation/user-guides/layouts-genesis-integration/' .
97
  '?utm_source=typesplugin' .
98
  '&utm_campaign=types' .
99
  '&utm_medium=theme-integration-message' .
@@ -104,7 +104,7 @@ class Toolset_Condition_Theme_Layouts_Support_Plugin_Available implements Toolse
104
  'Customizr' => array(
105
  'theme_name' => 'Customizr',
106
  'plugin_name' => 'Toolset Customizr Integration',
107
- 'doc_link' => 'https://wp-types.com/documentation/user-guides/toolset-customizr-integration/' .
108
  '?utm_source=typesplugin' .
109
  '&utm_campaign=types' .
110
  '&utm_medium=theme-integration-message' .
@@ -115,7 +115,7 @@ class Toolset_Condition_Theme_Layouts_Support_Plugin_Available implements Toolse
115
  'Twenty Sixteen' => array(
116
  'theme_name' => 'Twenty Sixteen',
117
  'plugin_name' => 'Toolset Twenty Sixteen Integration',
118
- 'doc_link' => 'https://wp-types.com/documentation/user-guides/toolset-twenty-sixteen-integration/' .
119
  '?utm_source=typesplugin' .
120
  '&utm_campaign=types' .
121
  '&utm_medium=theme-integration-message' .
@@ -126,7 +126,7 @@ class Toolset_Condition_Theme_Layouts_Support_Plugin_Available implements Toolse
126
  'Twenty Fifteen' => array(
127
  'theme_name' => 'Twenty Fifteen',
128
  'plugin_name' => 'Toolset Twenty Fifteen Integration',
129
- 'doc_link' => 'https://wp-types.com/documentation/user-guides/toolset-twenty-fifteen-integration/' .
130
  '?utm_source=typesplugin&utm_campaign=types' .
131
  '&utm_medium=theme-integration-message' .
132
  '&utm_term=how-to-design-TwentyFifteen-sites-with-Layouts' .
@@ -136,7 +136,7 @@ class Toolset_Condition_Theme_Layouts_Support_Plugin_Available implements Toolse
136
  'Twenty Seventeen' => array(
137
  'theme_name' => 'Twenty Seventeen',
138
  'plugin_name' => 'Toolset Twenty Seventeen Integration',
139
- 'doc_link' => 'https://wp-types.com/documentation/user-guides/toolset-twenty-seventeen-integration/' .
140
  '?utm_source=typesplugin' .
141
  '&utm_campaign=types' .
142
  '&utm_medium=theme-integration-message' .
60
  'Avada' => array(
61
  'theme_name' => 'Avada',
62
  'plugin_name' => 'Toolset Avada Integration',
63
+ 'doc_link' => 'https://toolset.com/documentation/user-guides/toolset-avada-integration/' .
64
  '?utm_source=typesplugin' .
65
  '&utm_campaign=types' .
66
  '&utm_medium=theme-integration-message' .
71
  'Cornerstone, for WordPress' => array(
72
  'theme_name' => 'Cornerstone',
73
  'plugin_name' => 'Toolset Cornerstone Integration',
74
+ 'doc_link' => 'https://toolset.com/documentation/user-guides/toolset-cornerstone-integration/' .
75
  '?utm_source=typesplugin' .
76
  '&utm_campaign=types' .
77
  '&utm_medium=theme-integration-message' .
82
  'Divi' => array(
83
  'theme_name' => 'Divi',
84
  'plugin_name' => 'Toolset Divi Integration',
85
+ 'doc_link' => 'https://toolset.com/documentation/user-guides/toolset-divi-integration/' .
86
  '?utm_source=typesplugin' .
87
  '&utm_campaign=types' .
88
  '&utm_medium=theme-integration-message' .
93
  'Genesis' => array(
94
  'theme_name' => 'Genesis',
95
  'plugin_name' => 'Toolset Genesis Integration',
96
+ 'doc_link' => 'https://toolset.com/documentation/user-guides/layouts-genesis-integration/' .
97
  '?utm_source=typesplugin' .
98
  '&utm_campaign=types' .
99
  '&utm_medium=theme-integration-message' .
104
  'Customizr' => array(
105
  'theme_name' => 'Customizr',
106
  'plugin_name' => 'Toolset Customizr Integration',
107
+ 'doc_link' => 'https://toolset.com/documentation/user-guides/toolset-customizr-integration/' .
108
  '?utm_source=typesplugin' .
109
  '&utm_campaign=types' .
110
  '&utm_medium=theme-integration-message' .
115
  'Twenty Sixteen' => array(
116
  'theme_name' => 'Twenty Sixteen',
117
  'plugin_name' => 'Toolset Twenty Sixteen Integration',
118
+ 'doc_link' => 'https://toolset.com/documentation/user-guides/toolset-twenty-sixteen-integration/' .
119
  '?utm_source=typesplugin' .
120
  '&utm_campaign=types' .
121
  '&utm_medium=theme-integration-message' .
126
  'Twenty Fifteen' => array(
127
  'theme_name' => 'Twenty Fifteen',
128
  'plugin_name' => 'Toolset Twenty Fifteen Integration',
129
+ 'doc_link' => 'https://toolset.com/documentation/user-guides/toolset-twenty-fifteen-integration/' .
130
  '?utm_source=typesplugin&utm_campaign=types' .
131
  '&utm_medium=theme-integration-message' .
132
  '&utm_term=how-to-design-TwentyFifteen-sites-with-Layouts' .
136
  'Twenty Seventeen' => array(
137
  'theme_name' => 'Twenty Seventeen',
138
  'plugin_name' => 'Toolset Twenty Seventeen Integration',
139
+ 'doc_link' => 'https://toolset.com/documentation/user-guides/toolset-twenty-seventeen-integration/' .
140
  '?utm_source=typesplugin' .
141
  '&utm_campaign=types' .
142
  '&utm_medium=theme-integration-message' .
vendor/toolset/toolset-common/utility/dialogs/toolset.dialog-boxes.class.php CHANGED
@@ -101,7 +101,7 @@ if( ! class_exists( 'Toolset_PopUpBlockerAlert', false ) ) {
101
  <?php printf(
102
  __( '%sTo see the preview, you need to allow this page to show popups.%sHow to enable popups in your browser%s', 'ddl-layouts' ),
103
  '<p>',
104
- '<br><a href="https://wp-types.com/documentation/user-guides/enable-pop-ups-browser/?utm_source=layoutsplugin&utm_campaign=layouts&utm_medium=enable-pop-ups-browser&utm_term=help-link" title="enable popups" target="_blank">',
105
  '</a></p>'
106
  );
107
  ?>
101
  <?php printf(
102
  __( '%sTo see the preview, you need to allow this page to show popups.%sHow to enable popups in your browser%s', 'ddl-layouts' ),
103
  '<p>',
104
+ '<br><a href="https://toolset.com/documentation/user-guides/enable-pop-ups-browser/?utm_source=layoutsplugin&utm_campaign=layouts&utm_medium=enable-pop-ups-browser&utm_term=help-link" title="enable popups" target="_blank">',
105
  '</a></p>'
106
  );
107
  ?>
vendor/toolset/toolset-common/utility/gui-base/js/ItemViewModel.js CHANGED
@@ -145,14 +145,14 @@ Toolset.Gui.ItemViewModel = function(model, itemActions) {
145
  });
146
 
147
 
148
- /**
149
- * Simulates a link when displayNameLink exists
150
- *
151
- * @since 2.3
152
- */
153
- self.onDisplayNameClick = function() {
154
- if (!_.isUndefined(model.editLink)) {
155
- document.location = model.editLink;
156
- }
157
- }
158
  };
145
  });
146
 
147
 
148
+ /**
149
+ * Simulates a link when displayNameLink exists
150
+ *
151
+ * @since 2.3
152
+ */
153
+ self.onDisplayNameClick = function() {
154
+ if (!_.isUndefined(model.editLink)) {
155
+ document.location = model.editLink;
156
+ }
157
+ }
158
  };
vendor/toolset/toolset-common/utility/gui-base/js/ListingViewModel.js CHANGED
@@ -331,6 +331,9 @@ Toolset.Gui.ListingViewModel = function(itemModels, defaults, itemSearchFunction
331
  self.hideDisplayedMessage();
332
  self.displayedMessage({text: text, type: type});
333
  self.messageVisibilityMode('show');
 
 
 
334
  };
335
 
336
 
@@ -356,6 +359,18 @@ Toolset.Gui.ListingViewModel = function(itemModels, defaults, itemSearchFunction
356
  };
357
 
358
 
 
 
 
 
 
 
 
 
 
 
 
 
359
  /**
360
  * Determine CSS class for the message, based on it's type.
361
  */
331
  self.hideDisplayedMessage();
332
  self.displayedMessage({text: text, type: type});
333
  self.messageVisibilityMode('show');
334
+ if ( type !== 'error' ) {
335
+ self.autoHideDislayedMessage( text );
336
+ }
337
  };
338
 
339
 
359
  };
360
 
361
 
362
+ /**
363
+ * Auto hide dislayed message after a time depending on text long
364
+ *
365
+ * @param {string} text Text needed for timing calculation
366
+ * @since m2m
367
+ */
368
+ self.autoHideDislayedMessage = function( text ) {
369
+ var miliseconds = Math.max( Math.min( text.length * 50, 2000 ), 7000 );
370
+ setTimeout( self.removeDisplayedMessage, miliseconds );
371
+ }
372
+
373
+
374
  /**
375
  * Determine CSS class for the message, based on it's type.
376
  */
vendor/toolset/toolset-common/utility/gui-base/twig-templates/listing.twig CHANGED
@@ -15,7 +15,7 @@
15
  {% block content %}
16
 
17
  {% block adminNotice %}
18
- <div id="message" data-bind="threeModeVisibility: messageVisibilityMode, attr: { class: 'notice is-dismissible ' + messageNagClass() }">
19
  <p data-bind="html: displayedMessage().text"></p>
20
  <button class="notice-dismiss" data-bind="click: removeDisplayedMessage"></button>
21
  </div>
@@ -160,16 +160,16 @@
160
 
161
  {% endblock %}
162
 
163
- {% macro columnHeader(displayName, isSortable, slug, classNames, sortType = 'alpha') %}
164
  {% if isSortable == true %}
165
- <td scope="col" class="manage-column {{ classNames }}">
166
  <a class="sort-column" data-bind="click: function() {onSort('{{ slug }}')}">
167
  {{ displayName }}
168
  <i data-bind="attr: { class: sortIconClass('{{ slug }}', '{{ sortType }}') }" ></i>
169
  </a>
170
  </td>
171
  {% else %}
172
- <td scope="col" class="manage-column {{ classNames }}">
173
  {{ displayName }}
174
  </td>
175
  {% endif %}
15
  {% block content %}
16
 
17
  {% block adminNotice %}
18
+ <div id="message" data-bind="threeModeVisibility: messageVisibilityMode, attr: { class: 'notice is-dismissible js-toolset-fadable ' + messageNagClass() }">
19
  <p data-bind="html: displayedMessage().text"></p>
20
  <button class="notice-dismiss" data-bind="click: removeDisplayedMessage"></button>
21
  </div>
160
 
161
  {% endblock %}
162
 
163
+ {% macro columnHeader(displayName, isSortable, slug, classNames, sortType = 'alpha', tdDataBind = '') %}
164
  {% if isSortable == true %}
165
+ <td scope="col" class="manage-column {{ classNames }}" data-bind="{{ tdDataBind }}">
166
  <a class="sort-column" data-bind="click: function() {onSort('{{ slug }}')}">
167
  {{ displayName }}
168
  <i data-bind="attr: { class: sortIconClass('{{ slug }}', '{{ sortType }}') }" ></i>
169
  </a>
170
  </td>
171
  {% else %}
172
+ <td scope="col" class="manage-column {{ classNames }}" data-bind="{{ tdDataBind }}">
173
  {{ displayName }}
174
  </td>
175
  {% endif %}
vendor/toolset/toolset-common/utility/js/utils.js CHANGED
@@ -381,7 +381,7 @@ if (typeof jQuery.fn.wpvToolsetHelp === 'undefined') {
381
 
382
  var $box = $('<div class="toolset-help ' + prms.classname + '"><div class="toolset-help-content"></div><div class="toolset-help-sidebar"></div></div>');
383
 
384
- var $footer = $('<div class="toolset-help-footer"><button class="js-toolset-help-close js-toolset-help-close-forever button-secondary">' + wpv_help_box_texts.wpv_dont_show_it_again + '</button><button class="js-toolset-help-close js-toolset-help-close-once button-primary">' + wpv_help_box_texts.wpv_close + '</button></div>');
385
 
386
  if (prms.footer === true) {
387
  $footer.appendTo($box);
381
 
382
  var $box = $('<div class="toolset-help ' + prms.classname + '"><div class="toolset-help-content"></div><div class="toolset-help-sidebar"></div></div>');
383
 
384
+ var $footer = $('<div class="toolset-help-footer"><button class="js-toolset-help-close js-toolset-help-close-forever button-secondary">' + toolset_utils_texts.wpv_dont_show_it_again + '</button><button class="js-toolset-help-close js-toolset-help-close-once button-primary">' + toolset_utils_texts.wpv_close + '</button></div>');
385
 
386
  if (prms.footer === true) {
387
  $footer.appendTo($box);
vendor/toolset/toolset-common/utility/singleton_factory.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * !! THIS FILE IS ONLY LOADED WHEN PHP VERSION IS EQUAL OR HIGHER THAN 5.6 !!
4
+ * Otherwise see: ./singleton_factory_pre_php_5_6.php
5
+ */
6
+
7
+ /**
8
+ * Class Toolset_Singleton_Factory
9
+ *
10
+ * The best would be not having Singletons at all, but sometimes it's necessary, especially in WP.
11
+ * Having get_instance() methods all over the place, is not only ugly, it also makes testing awful.
12
+ * Instead of making a class a forced singleton for every use, you can simply make it singleton when you really need to.
13
+ *
14
+ * INSTEAD OF DOING THIS:
15
+ * -------
16
+ *
17
+ * class My_Fantastic_Class {
18
+ * private function __construct() {}
19
+ *
20
+ * public function get_instance( $dependency_1, $dependency_2 ) {
21
+ *
22
+ * }
23
+ * }
24
+ *
25
+ * $singleton = My_Fantastic_Class::get_instance( new My_Dependency_1(), new My_Dependency_2() );
26
+ *
27
+ * -------
28
+ * YOU SHOULD DO THIS:
29
+ * -------
30
+ *
31
+ * class My_Fantastic_Class {
32
+ * public function __construct( $dependency_1, $dependency_2 ){
33
+ *
34
+ * }
35
+ * }
36
+ *
37
+ * /* @var My_Fantastic_Class $singleton *\/
38
+ * $singleton = Toolset_Singleton_Factory::get( 'My_Fantastic_Class', new My_Dependency_1(), new My_Dependency_2() );
39
+ *
40
+ * -------
41
+ *
42
+ * I added "/* @var My_Fantastic_Class $singleton *\/" above to let the IDE know that $singleton
43
+ * is a object of My_Fantastic_Class object. This way IDE's autocomplete still works.
44
+ *
45
+ *
46
+ * @since 2.6.3
47
+ */
48
+ class Toolset_Singleton_Factory {
49
+
50
+ /**
51
+ * @var array
52
+ */
53
+ public static $instances = array();
54
+
55
+ /**
56
+ * @param $class
57
+ *
58
+ * @return mixed|false Object of $class or false if $class not exists
59
+ */
60
+ public static function get( $class ) {
61
+ if ( isset( self::$instances[ $class ] ) ) {
62
+ // singleton already exists
63
+ return self::$instances[ $class ];
64
+ }
65
+
66
+ if ( ! class_exists( $class ) ) {
67
+ // class does not exist
68
+ return false;
69
+ }
70
+
71
+ // get all arguments
72
+ $arguments = func_get_args();
73
+
74
+ // drop $class argument
75
+ array_shift( $arguments );
76
+
77
+ self::$instances[$class] = new $class( ... $arguments );
78
+
79
+ return self::$instances[ $class ];
80
+ }
81
+ }
vendor/toolset/toolset-common/utility/singleton_factory_pre_php_5_6.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * !! THIS FILE IS ONLY LOADED WHEN PHP VERSION IS BELOW 5.6 !!
4
+ * Otherwise see: ./singleton_factory.php
5
+ */
6
+
7
+ /**
8
+ *
9
+ * Class Toolset_Singleton_Factory
10
+ *
11
+ * The best would be not having Singletons at all, but sometimes it's necessary, especially in WP.
12
+ * Having get_instance() methods all over the place, is not only ugly, it also makes testing awful.
13
+ * Instead of making a class a forced singleton for every use, you can simply make it singleton when you really need to.
14
+ *
15
+ * INSTEAD OF DOING THIS:
16
+ * -------
17
+ *
18
+ * class My_Fantastic_Class {
19
+ * private function __construct() {}
20
+ *
21
+ * public function get_instance( $dependency_1, $dependency_2 ) {
22
+ *
23
+ * }
24
+ * }
25
+ *
26
+ * $singleton = My_Fantastic_Class::get_instance( new My_Dependency_1(), new My_Dependency_2() );
27
+ *
28
+ * -------
29
+ * YOU SHOULD DO THIS:
30
+ * -------
31
+ *
32
+ * class My_Fantastic_Class {
33
+ * public function __construct( $dependency_1, $dependency_2 ){
34
+ *
35
+ * }
36
+ * }
37
+ *
38
+ * /* @var My_Fantastic_Class $singleton *\/
39
+ * $singleton = Toolset_Singleton_Factory::get( 'My_Fantastic_Class', new My_Dependency_1(), new My_Dependency_2() );
40
+ *
41
+ * -------
42
+ *
43
+ * I added "/* @var My_Fantastic_Class $singleton *\/" above to let the IDE know that $singleton
44
+ * is a object of My_Fantastic_Class object. This way IDE's autocomplete still works.
45
+ *
46
+ *
47
+ * @since 2.6.3
48
+ */
49
+ class Toolset_Singleton_Factory {
50
+
51
+ /**
52
+ * @var array
53
+ */
54
+ public static $instances = array();
55
+
56
+ /**
57
+ * @param $class
58
+ *
59
+ * @return mixed|false Object of $class or false if $class not exists
60
+ */
61
+ public static function get( $class ) {
62
+ if ( isset( self::$instances[ $class ] ) ) {
63
+ // singleton already exists
64
+ return self::$instances[ $class ];
65
+ }
66
+
67
+ if ( ! class_exists( $class ) ) {
68
+ // class does not exist
69
+ return false;
70
+ }
71
+
72
+ // get all arguments
73
+ $arguments = func_get_args();
74
+
75
+ // drop $class argument
76
+ array_shift( $arguments );
77
+
78
+ if ( ! empty( $arguments ) ) {
79
+ // use ReflectionClass to create instance of $class with $arguments
80
+ $reflect = new ReflectionClass( $class );
81
+ self::$instances[ $class ] = $reflect->newInstanceArgs( $arguments );
82
+ } else {
83
+ // no arguments, no extra magic needed
84
+ self::$instances[ $class ] = new $class();
85
+ }
86
+
87
+
88
+ return self::$instances[ $class ];
89
+ }
90
+ }
vendor/toolset/toolset-common/utility/utils.php CHANGED
@@ -293,6 +293,90 @@ if ( ! class_exists( 'Toolset_Utils', false ) ) {
293
  return null;
294
  }
295
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
  }
297
 
298
  }
293
  return null;
294
  }
295
 
296
+
297
+ /**
298
+ * Set a value in a nested array, creating the structure as needed.
299
+ *
300
+ * @param array &$array The array to be modified.
301
+ * @param string[] $path Array of keys, each element means one level of nesting.
302
+ * @param mixed $value The value to be assigned to the last level.
303
+ *
304
+ * Example:
305
+ *
306
+ * $result = Toolset_Utils::set_nested_value( $result, array( 'a', 'b', 'c' ), 'x' );
307
+ *
308
+ * Then $result would be:
309
+ *
310
+ * array(
311
+ * 'a' => array(
312
+ * 'b' => array(
313
+ * 'c' => 'x'
314
+ * )
315
+ * )
316
+ * );
317
+ *
318
+ * If there are any other elements set, they will not be touched.
319
+ *
320
+ * @return array
321
+ */
322
+ public static function set_nested_value( &$array, $path, $value ) {
323
+ if ( ! is_array( $array ) || ! is_array( $path ) ) {
324
+ throw new InvalidArgumentException();
325
+ }
326
+
327
+ if ( empty( $path ) ) {
328
+ return $value;
329
+ }
330
+
331
+ $next_level = array_shift( $path );
332
+
333
+ if ( ! array_key_exists( $next_level, $array ) ) {
334
+ $array[ $next_level ] = array();
335
+ }
336
+
337
+ $array[ $next_level ] = self::set_nested_value( $array[ $next_level ], $path, $value );
338
+
339
+ return $array;
340
+ }
341
+
342
+
343
+ /**
344
+ * Safely resolve a lowercase callback name into a handler class name even if mb_convert_case() is not available.
345
+ *
346
+ * It will always work correctly with values that contain only alphabetic characters, numbers and underscores.
347
+ * But nothing else should be used in callback names anyway.
348
+ *
349
+ * Example: "types_ajax_m2m_action" will become "Types_Ajax_M2M_Action"
350
+ *
351
+ * @param string $callback
352
+ *
353
+ * @return string Name of the handler class.
354
+ * @since 3.0
355
+ */
356
+ public static function resolve_callback_class_name( $callback ) {
357
+
358
+ // Use the native solution if available (which will happen in the vast majority of most cases).
359
+ if( function_exists( 'mb_convert_case' ) && defined( 'MB_CASE_TITLE' ) ) {
360
+ return mb_convert_case( $callback, MB_CASE_TITLE );
361
+ }
362
+
363
+ // mb_convert_case() works this way - it also capitalizes first letters after numbers
364
+ $name_parts = preg_split( "/_|[0-9]/", $callback );
365
+ $parts_ucfirst = array_map( function( $part ) { return ucfirst( $part ); }, $name_parts );
366
+
367
+ $result = '';
368
+ foreach( $parts_ucfirst as $part ) {
369
+ $result .= $part;
370
+ $delimiter_position = strlen( $result );
371
+
372
+ // Put back the delimiter (it could be a number or an underscore)
373
+ if( $delimiter_position < strlen( $callback ) ) {
374
+ $result .= $callback[ $delimiter_position ];
375
+ }
376
+ }
377
+
378
+ return $result;
379
+ }
380
  }
381
 
382
  }
vendor/toolset/types/embedded/admin.php CHANGED
@@ -98,12 +98,16 @@ function wpcf_embedded_admin_init_hook() {
98
  *
99
  * @param type $post_type
100
  * @param type $post
 
 
101
  */
102
- function wpcf_admin_add_meta_boxes( $post_type, $post ) {
103
  require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php';
104
  require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields-post.php';
105
 
106
- wpcf_add_meta_boxes( $post_type, $post );
 
 
107
  }
108
 
109
  /**
98
  *
99
  * @param type $post_type
100
  * @param type $post
101
+ *
102
+ * @since 2.2.23 Some plugins calls `add_meta_boxes` incorrectly, to prevent fatal errors it's better to avoid them and not showing Types meta boxes
103
  */
104
+ function wpcf_admin_add_meta_boxes( $post_type, $post = null ) {
105
  require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php';
106
  require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields-post.php';
107
 
108
+ if ( $post ) {
109
+ wpcf_add_meta_boxes( $post_type, $post );
110
+ }
111
  }
112
 
113
  /**
vendor/toolset/types/embedded/bootstrap.php CHANGED
@@ -30,7 +30,7 @@ if ( !defined( 'WPCF_VERSION' ) ) {
30
  */
31
  if ( !defined( 'TYPES_INIT_PRIORITY' ) ) {
32
  // Early start ( some plugins use 'init' with priority 0 ).
33
- define( 'TYPES_INIT_PRIORITY', -1 );
34
  }
35
 
36
  /**
@@ -113,6 +113,8 @@ wpcf_embedded_after_setup_theme_hook();
113
  */
114
  $GLOBALS['wpcf'] = new stdClass();
115
 
 
 
116
 
117
  /**
118
  * Main init hook.
30
  */
31
  if ( !defined( 'TYPES_INIT_PRIORITY' ) ) {
32
  // Early start ( some plugins use 'init' with priority 0 ).
33
+ define( 'TYPES_INIT_PRIORITY', 1 );
34
  }
35
 
36
  /**
113
  */
114
  $GLOBALS['wpcf'] = new stdClass();
115
 
116
+ // load fields functions (required to be loaded pre init as Elementor Pro demands on it)
117
+ require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php';
118
 
119
  /**
120
  * Main init hook.
vendor/toolset/types/embedded/classes/class.wpcf-post-types.php CHANGED
@@ -38,7 +38,7 @@ class WPCF_Post_Types
38
  /**
39
  * Check has some custom fields to display.
40
  *
41
- * Check post type for custom fields to display on custom post edit
42
  * screen.
43
  *
44
  * @since 1.7
@@ -83,8 +83,8 @@ class WPCF_Post_Types
83
  */
84
  if (
85
  $query->is_main_query()
86
- && ( $orderby = $query->get( 'orderby' ) )
87
- && ( $post_type = $query->get( 'post_type' ) )
88
  ) {
89
  $custom_post_types = wpcf_get_active_custom_types();
90
  /**
@@ -257,9 +257,9 @@ class WPCF_Post_Types
257
  /**
258
  * Width of image.
259
  *
260
- * Filter allow to change default image size displayed on
261
- * admin etry list for custom field type image. Default is
262
- * 100px - you can change it to any proper CSS width
263
  * definition.
264
  *
265
  * @since 1.7
@@ -283,6 +283,9 @@ class WPCF_Post_Types
283
  require_once WPTOOLSET_FORMS_ABSPATH . '/classes/class.date.php';
284
  $value = WPToolset_Field_Date::timetodate($value);
285
  break;
 
 
 
286
  }
287
  }
288
  if ( is_string($value ) ) {
@@ -322,7 +325,7 @@ class WPCF_Post_Types
322
  public function add_archive_checkbox( $posts, $args, $post_type )
323
  {
324
  if (
325
- is_array( $post_type )
326
  && isset( $post_type['args'] )
327
  ) {
328
  $post_type_object = $post_type['args'];
38
  /**
39
  * Check has some custom fields to display.
40
  *
41
+ * Check post type for custom fields to display on custom post edit
42
  * screen.
43
  *
44
  * @since 1.7
83
  */
84
  if (
85
  $query->is_main_query()
86
+ && ( $orderby = $query->get( 'orderby' ) )
87
+ && ( $post_type = $query->get( 'post_type' ) )
88
  ) {
89
  $custom_post_types = wpcf_get_active_custom_types();
90
  /**
257
  /**
258
  * Width of image.
259
  *
260
+ * Filter allow to change default image size displayed on
261
+ * admin etry list for custom field type image. Default is
262
+ * 100px - you can change it to any proper CSS width
263
  * definition.
264
  *
265
  * @since 1.7
283
  require_once WPTOOLSET_FORMS_ABSPATH . '/classes/class.date.php';
284
  $value = WPToolset_Field_Date::timetodate($value);
285
  break;
286
+ default:
287
+ require_once WPCF_EMBEDDED_ABSPATH . '/frontend.php';
288
+ $value = types_render_field( $field['id'] );
289
  }
290
  }
291
  if ( is_string($value ) ) {
325
  public function add_archive_checkbox( $posts, $args, $post_type )
326
  {
327
  if (
328
+ is_array( $post_type )
329
  && isset( $post_type['args'] )
330
  ) {
331
  $post_type_object = $post_type['args'];
vendor/toolset/types/embedded/classes/field.php CHANGED
@@ -321,6 +321,8 @@ class WPCF_Field
321
  * removed - if ( !empty( $value ) || is_numeric( $value ) ) {
322
  *
323
  * @param type $value
 
 
324
  */
325
  function save( $value = null )
326
  {
321
  * removed - if ( !empty( $value ) || is_numeric( $value ) ) {
322
  *
323
  * @param type $value
324
+ *
325
+ * @refactoring !! Extreme spaghetti code.
326
  */
327
  function save( $value = null )
328
  {
vendor/toolset/types/embedded/classes/relationship.php CHANGED
@@ -217,6 +217,10 @@ class WPCF_Relationship
217
  */
218
  function save_child( $parent_id, $child_id, $save_fields = array() )
219
  {
 
 
 
 
220
  $parent = get_post( intval( $parent_id ) );
221
  $child = get_post( intval( $child_id ) );
222
  $post_data = array();
@@ -304,14 +308,13 @@ class WPCF_Relationship
304
 
305
  $updated_id = wp_update_post( $post_data );
306
 
307
- remove_filter( 'types_updating_child_post', '__return_true' );
308
-
309
  if ( isset($temp_post_data) ) {
310
  $_POST = $temp_post_data;
311
  unset($temp_post_data);
312
  }
313
 
314
  if ( empty( $updated_id ) ) {
 
315
  return new WP_Error( 'relationship-update-post-failed', 'Updating post failed' );
316
  }
317
 
@@ -411,6 +414,11 @@ class WPCF_Relationship
411
  // Added because of caching meta 1.5.4
412
  wp_cache_flush();
413
 
 
 
 
 
 
414
  return true;
415
  }
416
 
217
  */
218
  function save_child( $parent_id, $child_id, $save_fields = array() )
219
  {
220
+ // this function modifies $_POST
221
+ // we need to make sure to revoke all changes to $_POST at the end (types-1644)
222
+ $POST_backup = $_POST;
223
+
224
  $parent = get_post( intval( $parent_id ) );
225
  $child = get_post( intval( $child_id ) );
226
  $post_data = array();
308
 
309
  $updated_id = wp_update_post( $post_data );
310
 
 
 
311
  if ( isset($temp_post_data) ) {
312
  $_POST = $temp_post_data;
313
  unset($temp_post_data);
314
  }
315
 
316
  if ( empty( $updated_id ) ) {
317
+ remove_filter( 'types_updating_child_post', '__return_true' );
318
  return new WP_Error( 'relationship-update-post-failed', 'Updating post failed' );
319
  }
320
 
414
  // Added because of caching meta 1.5.4
415
  wp_cache_flush();
416
 
417
+ remove_filter( 'types_updating_child_post', '__return_true' );
418
+
419
+ // re-apply original $_POST data
420
+ $_POST = $POST_backup;
421
+
422
  return true;
423
  }
424
 
vendor/toolset/types/embedded/includes/ajax.php CHANGED
@@ -3,6 +3,8 @@
3
  /**
4
  * All AJAX calls go here.
5
  *
 
 
6
  * @todo auth
7
  */
8
  function wpcf_ajax_embedded() {
3
  /**
4
  * All AJAX calls go here.
5
  *
6
+ * @refactoring ! No, they don't!!!
7
+ *
8
  * @todo auth
9
  */
10
  function wpcf_ajax_embedded() {
vendor/toolset/types/embedded/includes/custom-taxonomies.php CHANGED
@@ -245,6 +245,13 @@ function wpcf_custom_taxonomies_register( $taxonomy, $data ) {
245
  $taxonomy_args['name'] = $taxonomy;
246
  }
247
 
 
 
 
 
 
 
 
248
  $result = register_taxonomy( $taxonomy, $object_types_filtered, $taxonomy_args );
249
 
250
  $is_success = ( $result instanceof WP_Error ? false : true );
245
  $taxonomy_args['name'] = $taxonomy;
246
  }
247
 
248
+ /**
249
+ * Translate (and register with WPML) the taxonomy strings in the correct gettext context
250
+ * @link https://onthegosystems.myjetbrains.com/youtrack/issue/types-1323
251
+ */
252
+ $taxonomy_args['labels']['name'] = _x( $taxonomy_args['labels']['name'], 'taxonomy general name', 'Types-TAX' );
253
+ $taxonomy_args['labels']['singular_name'] = _x( $taxonomy_args['labels']['singular_name'], 'taxonomy singular name', 'Types-TAX' );
254
+
255
  $result = register_taxonomy( $taxonomy, $object_types_filtered, $taxonomy_args );
256
 
257
  $is_success = ( $result instanceof WP_Error ? false : true );
vendor/toolset/types/embedded/includes/fields-post.php CHANGED
@@ -588,6 +588,7 @@ function wpcf_admin_post_meta_box( $post, $group, $echo = '', $open_style_editor
588
  * @param int $post_ID
589
  * @param WP_Post $post
590
  * @since unknown
 
591
  */
592
  function wpcf_admin_post_save_post_hook( $post_ID, $post ) {
593
 
@@ -621,16 +622,23 @@ function wpcf_admin_post_save_post_hook( $post_ID, $post ) {
621
 
622
  $wpcf_form_data = wpcf_ensarr( wpcf_getarr( $_POST, 'wpcf' ) );
623
 
624
- // Check wpcf_adjust_form_input_for_checkboxlike_fields() for information about side effects.
625
- $wpcf_form_data = wpcf_adjust_form_input_for_checkboxlike_fields(
626
- $wpcf_form_data,
627
- wpcf_ensarr( wpcf_getarr( $_POST, '_wptoolset_checkbox' ) )
628
- );
629
 
630
- $wpcf_form_data = wpcf_adjust_form_input_for_checkboxlike_fields(
631
- $wpcf_form_data,
632
- wpcf_ensarr( wpcf_getarr( $_POST, '_wptoolset_radios' ) )
633
- );
 
 
 
 
 
 
 
 
 
 
 
 
634
 
635
  if ( count( $wpcf_form_data ) ) {
636
  $add_error_message = true;
588
  * @param int $post_ID
589
  * @param WP_Post $post
590
  * @since unknown
591
+ * @refactoring !! Extreme spaghetti code.
592
  */
593
  function wpcf_admin_post_save_post_hook( $post_ID, $post ) {
594
 
622
 
623
  $wpcf_form_data = wpcf_ensarr( wpcf_getarr( $_POST, 'wpcf' ) );
624
 
 
 
 
 
 
625
 
626
+ // For parent saving we need to add all checkbox/radio fields (even unchecked) to
627
+ // make sure save 0 is applied. This is NOT needed for the child update at this point
628
+ // (Including child post here will add all checkbox fields to children, even if the fields
629
+ // are not assigned to the child post cpt)
630
+ if( ! $is_child_post_update ) {
631
+ // Check wpcf_adjust_form_input_for_checkboxlike_fields() for information about side effects.
632
+ $wpcf_form_data = wpcf_adjust_form_input_for_checkboxlike_fields(
633
+ $wpcf_form_data,
634
+ wpcf_ensarr( wpcf_getarr( $_POST, '_wptoolset_checkbox' ) )
635
+ );
636
+
637
+ $wpcf_form_data = wpcf_adjust_form_input_for_checkboxlike_fields(
638
+ $wpcf_form_data,
639
+ wpcf_ensarr( wpcf_getarr( $_POST, '_wptoolset_radios' ) )
640
+ );
641
+ }
642
 
643
  if ( count( $wpcf_form_data ) ) {
644
  $add_error_message = true;
vendor/toolset/types/embedded/includes/fields/checkbox.php CHANGED
@@ -30,7 +30,15 @@ function wpcf_fields_checkbox()
30
  }
31
 
32
 
33
- add_action( 'save_post', 'wpcf_fields_checkbox_save_check', 15, 1 );
 
 
 
 
 
 
 
 
34
  add_action( 'edit_attachment', 'wpcf_fields_checkbox_save_check', 15, 1 );
35
 
36
  /**
@@ -249,10 +257,16 @@ function wpcf_fields_checkbox_view($params)
249
  *
250
  * Currently used on Relationship saving.
251
  *
252
- * @param int $post_id
253
  */
254
- function wpcf_fields_checkbox_save_check($post_id)
255
  {
 
 
 
 
 
 
256
  $meta_to_unset = array();
257
  $meta_to_unset[$post_id] = array();
258
  $cf = new WPCF_Field();
@@ -275,6 +289,10 @@ function wpcf_fields_checkbox_save_check($post_id)
275
  }
276
  }
277
 
 
 
 
 
278
  // Update edited post's checkboxes
279
  switch( $mode ) {
280
  case 'save_main':
@@ -324,7 +342,11 @@ function wpcf_fields_checkbox_save_check($post_id)
324
  $re = sprintf('/\-(%s)$/', implode('|', $children));
325
  $checkboxes = array();
326
  foreach(array_keys($_POST['_wptoolset_checkbox']) as $key) {
327
- $checkboxes[] = preg_replace($re, '', $key);
 
 
 
 
328
  }
329
  foreach( $children as $child_id ) {
330
  foreach( array_unique($checkboxes) as $slug ) {
@@ -454,9 +476,13 @@ function wpcf_update_checkboxes_field( $field_definition_array, $meta_type, $obj
454
  $meta_value = array();
455
 
456
  $field_options = wpcf_getnest( $field_definition_array, array( 'data', 'options' ), null );
 
457
 
458
  if( is_array( $field_options ) ) {
459
- $field_id = wpcf_getarr( $field_definition_array, 'id' );
 
 
 
460
  $save_zero_if_empty = ( 'yes' == wpcf_getnest( $field_definition_array, array( 'data', 'save_empty' ) ) );
461
 
462
  foreach( $field_options as $option_id => $option_settings ) {
@@ -464,9 +490,18 @@ function wpcf_update_checkboxes_field( $field_definition_array, $meta_type, $obj
464
 
465
  if( $is_option_checked ) {
466
  // Use actual option value coming from the form submission.
467
- $meta_value[ $option_id ] = $wpcf_form_data[ $field_id ][ $option_id ];
 
 
 
 
 
 
 
468
 
469
  } elseif( $save_zero_if_empty ) {
 
 
470
  $meta_value[ $option_id ] = 0;
471
  }
472
 
30
  }
31
 
32
 
33
+ // We call this function late and wherever we *think* it might be necessary
34
+ // to fix any potential mess created by other legacy code.
35
+ //
36
+ // wpcf_fields_checkbox_save_check() is the final authority when it comes to saving checkboxes
37
+ // field values.
38
+ add_action( 'save_post', 'wpcf_fields_checkbox_save_check', 100, 1 );
39
+ add_action( 'wpcf_relationship_save_child', 'wpcf_fields_checkbox_save_check', 100, 1 );
40
+
41
+
42
  add_action( 'edit_attachment', 'wpcf_fields_checkbox_save_check', 15, 1 );
43
 
44
  /**
257
  *
258
  * Currently used on Relationship saving.
259
  *
260
+ * @param int|WP_Post $post_source
261
  */
262
+ function wpcf_fields_checkbox_save_check( $post_source )
263
  {
264
+ if( $post_source instanceof WP_Post ) {
265
+ $post_id = (int) $post_source->ID;
266
+ } else {
267
+ $post_id = (int) $post_source;
268
+ }
269
+
270
  $meta_to_unset = array();
271
  $meta_to_unset[$post_id] = array();
272
  $cf = new WPCF_Field();
289
  }
290
  }
291
 
292
+ if( apply_filters( 'types_updating_child_post', false ) ) {
293
+ $mode = 'save_child';
294
+ }
295
+
296
  // Update edited post's checkboxes
297
  switch( $mode ) {
298
  case 'save_main':
342
  $re = sprintf('/\-(%s)$/', implode('|', $children));
343
  $checkboxes = array();
344
  foreach(array_keys($_POST['_wptoolset_checkbox']) as $key) {
345
+ // make sure to only collect checkboxes which are assigned to the children post type
346
+ if( preg_match( $re, $key ) ) {
347
+ $checkboxes[] = preg_replace($re, '', $key);
348
+ }
349
+
350
  }
351
  foreach( $children as $child_id ) {
352
  foreach( array_unique($checkboxes) as $slug ) {
476
  $meta_value = array();
477
 
478
  $field_options = wpcf_getnest( $field_definition_array, array( 'data', 'options' ), null );
479
+ $is_updating_types_child = apply_filters( 'types_updating_child_post', false );
480
 
481
  if( is_array( $field_options ) ) {
482
+ // When saving a legacy child post, meta keys are used instead of a field slug.
483
+ $field_id_key = ( $is_updating_types_child ? 'meta_key' : 'id' );
484
+
485
+ $field_id = wpcf_getarr( $field_definition_array, $field_id_key );
486
  $save_zero_if_empty = ( 'yes' == wpcf_getnest( $field_definition_array, array( 'data', 'save_empty' ) ) );
487
 
488
  foreach( $field_options as $option_id => $option_settings ) {
490
 
491
  if( $is_option_checked ) {
492
  // Use actual option value coming from the form submission.
493
+ $option_value = $wpcf_form_data[ $field_id ][ $option_id ];
494
+
495
+ // When saving a legacy child post, the value may not be encapsulated in the array,
496
+ // how it is supposed to be.
497
+ if( $is_updating_types_child && ! is_array( $option_value ) ) {
498
+ $option_value = array( $option_value );
499
+ }
500
+ $meta_value[ $option_id ] = $option_value;
501
 
502
  } elseif( $save_zero_if_empty ) {
503
+ // Beware, "zero if empty" value is stored as-is, without the encapsulating array,
504
+ // unlike any other values.
505
  $meta_value[ $option_id ] = 0;
506
  }
507
 
vendor/toolset/types/embedded/includes/post-relationship.php CHANGED
@@ -624,6 +624,7 @@ function wpcf_pr_admin_has_pagination( $post, $post_type, $page, $prev, $next,
624
  *
625
  * @param type $parent_post_id
626
  * @return string
 
627
  */
628
  function wpcf_pr_admin_save_post_hook( $parent_post_id ) {
629
 
624
  *
625
  * @param type $parent_post_id
626
  * @return string
627
+ * @refactoring !! Every action involving this code is extremely time-consuming.
628
  */
629
  function wpcf_pr_admin_save_post_hook( $parent_post_id ) {
630
 
vendor/toolset/types/embedded/includes/wpml.php CHANGED
@@ -175,9 +175,10 @@ function wpcf_translate( $name, $string, $context = 'plugin Types' )
175
  /**
176
  * Registers WPML translation string.
177
  *
178
- * @param type $context
179
- * @param type $name
180
- * @param type $value
 
181
  */
182
  function wpcf_translate_register_string( $context, $name, $value,
183
  $allow_empty_value = false ) {
@@ -627,9 +628,9 @@ function wpcf_custom_taxonimies_register_translation( $taxonomy, $data ) {
627
  /**
628
  * Registers labels.
629
  *
630
- * @param type $prefix
631
- * @param type $data
632
- * @param type $context
633
  */
634
  function wpcf_wpml_register_labels( $prefix, $data, $context = 'post' ) {
635
  foreach ( $data['labels'] as $label => $string ) {
@@ -639,8 +640,9 @@ function wpcf_wpml_register_labels( $prefix, $data, $context = 'post' ) {
639
  case 'tax':
640
  $default = wpcf_custom_taxonomies_default();
641
  if ( $label == 'name' || $label == 'singular_name' ) {
642
- wpcf_translate_register_string( 'Types-TAX',
643
- $prefix . ' ' . $label, $string );
 
644
  continue;
645
  }
646
  if ( isset( $default['labels'][$label] ) && $string == $default['labels'][$label] ) {
175
  /**
176
  * Registers WPML translation string.
177
  *
178
+ * @param string|array $context
179
+ * @param string $name
180
+ * @param string $value
181
+ * @param bool $allow_empty_value
182
  */
183
  function wpcf_translate_register_string( $context, $name, $value,
184
  $allow_empty_value = false ) {
628
  /**
629
  * Registers labels.
630
  *
631
+ * @param string $prefix
632
+ * @param array $data
633
+ * @param string $context
634
  */
635
  function wpcf_wpml_register_labels( $prefix, $data, $context = 'post' ) {
636
  foreach ( $data['labels'] as $label => $string ) {
640
  case 'tax':
641
  $default = wpcf_custom_taxonomies_default();
642
  if ( $label == 'name' || $label == 'singular_name' ) {
643
+ $string_context = array( 'domain' => 'Types-TAX' );
644
+ $string_context['context'] = $label === 'name' ? 'taxonomy general name' : 'taxonomy singular name';
645
+ wpcf_translate_register_string( $string_context, false, $string );
646
  continue;
647
  }
648
  if ( isset( $default['labels'][$label] ) && $string == $default['labels'][$label] ) {
vendor/toolset/types/includes/classes/class.types.admin.edit.custom.fields.group.php CHANGED
@@ -330,7 +330,7 @@ class Types_Admin_Edit_Custom_Fields_Group extends Types_Admin_Edit_Fields {
330
 
331
  $tax_currently_supported = array();
332
  $form_tax = array();
333
-
334
  if(
335
  isset( $this->update['taxonomies'] )
336
  && is_array( $this->update['taxonomies'] )
@@ -389,7 +389,7 @@ class Types_Admin_Edit_Custom_Fields_Group extends Types_Admin_Edit_Fields {
389
  $tax_currently_supported[ $term->term_taxonomy_id ] = $term->name;
390
  }
391
  }
392
-
393
  error_log( 'update-taxonomies ' . print_r( $this->update['taxonomies'], true ) );
394
  $form_tax[ $term->term_taxonomy_id ] = array(
395
  '#type' => 'hidden',
@@ -417,7 +417,7 @@ class Types_Admin_Edit_Custom_Fields_Group extends Types_Admin_Edit_Fields {
417
  $templates_views = get_posts( array(
418
  'post_type' => 'view-template',
419
  'numberposts' => - 1,
420
- 'status' => 'publish',
421
  ) );
422
  $form_templates = array();
423
 
@@ -902,7 +902,7 @@ var wpcfDefaultCss = ' . json_encode( base64_encode( $admin_styles_value ) ) . '
902
  $templates_views = get_posts( array(
903
  'post_type' => 'view-template',
904
  'numberposts' => - 1,
905
- 'status' => 'publish',
906
  ) );
907
  $form['default-template'] = array(
908
  '#type' => 'checkbox',
@@ -1258,4 +1258,3 @@ var wpcfDefaultCss = ' . json_encode( base64_encode( $admin_styles_value ) ) . '
1258
  wpcf_admin_fields_save_group_templates( $group_id, $post_templates );
1259
  }
1260
  }
1261
-
330
 
331
  $tax_currently_supported = array();
332
  $form_tax = array();
333
+
334
  if(
335
  isset( $this->update['taxonomies'] )
336
  && is_array( $this->update['taxonomies'] )
389
  $tax_currently_supported[ $term->term_taxonomy_id ] = $term->name;
390
  }
391
  }
392
+
393
  error_log( 'update-taxonomies ' . print_r( $this->update['taxonomies'], true ) );
394
  $form_tax[ $term->term_taxonomy_id ] = array(
395
  '#type' => 'hidden',
417
  $templates_views = get_posts( array(
418
  'post_type' => 'view-template',
419
  'numberposts' => - 1,
420
+ 'post_status' => 'publish',
421
  ) );
422
  $form_templates = array();
423
 
902
  $templates_views = get_posts( array(
903
  'post_type' => 'view-template',
904
  'numberposts' => - 1,
905
+ 'post_status' => 'publish',
906
  ) );
907
  $form['default-template'] = array(
908
  '#type' => 'checkbox',
1258
  wpcf_admin_fields_save_group_templates( $group_id, $post_templates );
1259
  }
1260
  }
 
vendor/toolset/types/includes/classes/class.types.admin.edit.taxonomy.php CHANGED
@@ -96,14 +96,14 @@ class Types_Admin_Edit_Taxonomy extends Types_Admin_Page
96
  {
97
  $this->save();
98
 
99
- // Flush rewrite rules if we're asked to do so.
100
- //
101
  // This must be done after all post types and taxonomies are registered, and they can be registered properly
102
  // only on 'init'. So after making changes, we need to reload the page and THEN flush.
103
  if( '1' == wpcf_getget( 'flush', '0' ) ) {
104
  flush_rewrite_rules();
105
  }
106
-
107
  global $wpcf;
108
 
109
  $id = false;
@@ -146,7 +146,7 @@ class Types_Admin_Edit_Taxonomy extends Types_Admin_Page
146
  '#value' => $id,
147
  '#name' => 'ct[wpcf-tax]',
148
  );
149
-
150
  $form['slug_conflict_check_nonce'] = array(
151
  '#type' => 'hidden',
152
  '#value' => wp_create_nonce( Types_Ajax::CALLBACK_CHECK_SLUG_CONFLICTS ),
@@ -527,6 +527,24 @@ class Types_Admin_Edit_Taxonomy extends Types_Admin_Page
527
  ),
528
  );
529
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
530
  $form['meta_box_cb-header'] = array(
531
  '#type' => 'markup',
532
  '#markup' => sprintf('<h3>%s</h3>', __('Meta box callback function', 'wpcf')),
@@ -796,7 +814,7 @@ class Types_Admin_Edit_Taxonomy extends Types_Admin_Page
796
  }
797
  $data = $_POST['ct'];
798
  $update = false;
799
-
800
  // Sanitize data
801
  $data['labels']['name'] = isset( $data['labels']['name'] )
802
  ? sanitize_text_field( $data['labels']['name'] )
@@ -1005,7 +1023,7 @@ class Types_Admin_Edit_Taxonomy extends Types_Admin_Page
1005
  'wpcf-message' => get_user_option('types-modal'),
1006
  'flush' => 1
1007
  );
1008
-
1009
  if( isset( $_GET['ref'] ) )
1010
  $args['ref'] = $_GET['ref'];
1011
 
@@ -1054,4 +1072,3 @@ class Types_Admin_Edit_Taxonomy extends Types_Admin_Page
1054
  }
1055
 
1056
  }
1057
-
96
  {
97
  $this->save();
98
 
99
+ // Flush rewrite rules if we're asked to do so.
100
+ //
101
  // This must be done after all post types and taxonomies are registered, and they can be registered properly
102
  // only on 'init'. So after making changes, we need to reload the page and THEN flush.
103
  if( '1' == wpcf_getget( 'flush', '0' ) ) {
104
  flush_rewrite_rules();
105
  }
106
+
107
  global $wpcf;
108
 
109
  $id = false;
146
  '#value' => $id,
147
  '#name' => 'ct[wpcf-tax]',
148
  );
149
+
150
  $form['slug_conflict_check_nonce'] = array(
151
  '#type' => 'hidden',
152
  '#value' => wp_create_nonce( Types_Ajax::CALLBACK_CHECK_SLUG_CONFLICTS ),
527
  ),
528
  );
529
 
530
+ $form['show_in_rest'] = array(
531
+ '#type' => 'checkbox',
532
+ '#name' => 'ct[show_in_rest]',
533
+ '#default_value' => !empty( $this->ct['show_in_rest'] ),
534
+ '#title' => __( 'show_in_rest', 'wpcf' ),
535
+ '#description' => __( 'Whether to expose this taxonomy in the REST API.', 'wpcf' ) . '<br />' . __( 'Default: false.', 'wpcf' ),
536
+ '#inline' => true,
537
+ );
538
+
539
+ $form['rest_base'] = array(
540
+ '#type' => 'textfield',
541
+ '#name' => 'ct[rest_base]',
542
+ '#title' => __( 'Rest Base', 'wpcf' ),
543
+ '#description' => __( 'The base slug that this taxonomy will use when accessed using the REST API.', 'wpcf' ) . '<br />' . __( 'Default: $taxonomy.', 'wpcf' ),
544
+ '#value' => isset( $this->ct['rest_base'] ) ? $this->ct['rest_base'] : '',
545
+ '#inline' => true,
546
+ );
547
+
548
  $form['meta_box_cb-header'] = array(
549
  '#type' => 'markup',
550
  '#markup' => sprintf('<h3>%s</h3>', __('Meta box callback function', 'wpcf')),
814
  }
815
  $data = $_POST['ct'];
816
  $update = false;
817
+
818
  // Sanitize data
819
  $data['labels']['name'] = isset( $data['labels']['name'] )
820
  ? sanitize_text_field( $data['labels']['name'] )
1023
  'wpcf-message' => get_user_option('types-modal'),
1024
  'flush' => 1
1025
  );
1026
+
1027
  if( isset( $_GET['ref'] ) )
1028
  $args['ref'] = $_GET['ref'];
1029
 
1072
  }
1073
 
1074
  }
 
wpcf.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://wordpress.org/extend/plugins/types/
5
  Description: Toolset Types defines custom content in WordPress. Easily create custom post types, fields and taxonomy and connect everything together.
6
  Author: OnTheGoSystems
7
  Author URI: http://www.onthegosystems.com
8
- Version: 2.2.24
9
  License: GPLv2 or later
10
 
11
  Types is free software: you can redistribute it and/or modify
@@ -29,7 +29,7 @@ if ( ! function_exists( 'add_action' ) ) {
29
 
30
  // version
31
  if ( ! defined( 'TYPES_VERSION' ) ) {
32
- define( 'TYPES_VERSION', '2.2.24' );
33
  }
34
 
35
  // backward compatibility
@@ -42,7 +42,7 @@ if ( ! defined( 'TYPES_RELEASE_NOTES' ) ) {
42
  define(
43
  'TYPES_RELEASE_NOTES',
44
  'https://wp-types.com/version/types-' . str_replace( '.', '-', TYPES_VERSION )
45
- . '/?utm_source=typesplugin&utm_campaign=types&utm_medium=release-notes-admin-notice&utm_term=Types%202.2.23%20release%20notes'
46
  );
47
  }
48
 
5
  Description: Toolset Types defines custom content in WordPress. Easily create custom post types, fields and taxonomy and connect everything together.
6
  Author: OnTheGoSystems
7
  Author URI: http://www.onthegosystems.com
8
+ Version: 2.3.5
9
  License: GPLv2 or later
10
 
11
  Types is free software: you can redistribute it and/or modify
29
 
30
  // version
31
  if ( ! defined( 'TYPES_VERSION' ) ) {
32
+ define( 'TYPES_VERSION', '2.3.5' );
33
  }
34
 
35
  // backward compatibility
42
  define(
43
  'TYPES_RELEASE_NOTES',
44
  'https://wp-types.com/version/types-' . str_replace( '.', '-', TYPES_VERSION )
45
+ . '/?utm_source=typesplugin&utm_campaign=types&utm_medium=release-notes-admin-notice&utm_term=Types%20' . TYPES_VERSION . '%20release%20notes'
46
  );
47
  }
48