项目作者: lcherone

项目描述 :
Parse wordpress visual composer / wordpress bakery shortcode markup into workable array.
高级语言: PHP
项目地址: git://github.com/lcherone/vc-parse.git
创建时间: 2021-01-18T15:59:36Z
项目社区:https://github.com/lcherone/vc-parse

开源协议:

下载


VC Parse

Parse wordpress visual composer / wordpress bakery shortcode markup into workable array, for laying out an external app or intergration.

If you know of something already which does this functionality? Please open an issue and let me know, I looked for an age. Note: I built the function using the markup below, if it doesn’t work on yours, then let me know, or open a PR if you have fixed it.

Online example: @lcherone/WP-Visual-Composer-Parser"">https://repl.it/@lcherone/WP-Visual-Composer-Parser

Turn:

  1. <p>[vc_row vc_row_background=""][vc_column][jnews_hero_13 compatible_column_notice="" hero_margin="0" content_filter_number_alert="" post_offset="0" include_tag="49"][jnews_block_22 compatible_column_notice="" number_post="8" post_offset="1" exclude_post="407"][jnews_slider_7 compatible_column_notice="" excerpt_length="24" number_post="6" post_offset="0"][vc_custom_heading text="<strong>Latest News</strong>" font_container="tag:h3|font_size:26|text_align:left|line_height:1" use_theme_fonts="yes" css=".vc_custom_1610377441161{margin-bottom: 5px !important;}"][vc_separator color="custom" border_width="3" css=".vc_custom_1610308826626{margin-top: 0px !important;margin-bottom: 10px !important;padding-bottom: 10px !important;}" accent_color="#111111"][/vc_column][/vc_row][vc_row][vc_column width="2/3"][jnews_block_5 compatible_column_notice="" header_type="heading_7" number_post="1" post_offset="0" unique_content="unique1" include_category="17" excerpt_length="20"][/jnews_block_5][jnews_block_22 compatible_column_notice="" number_post="6" post_offset="0" unique_content="unique1" include_category="17"][/vc_column][vc_column width="1/3" set_as_sidebar="yes"][vc_widget_sidebar sidebar_id="news-list"][jnews_block_19 compatible_column_notice="" number_post="4" post_offset="0" unique_content="unique1"][/vc_column][/vc_row][vc_row vc_row_background=""][vc_column][vc_custom_heading text="<strong>Latest Video Picks</strong>" font_container="tag:h3|font_size:26|text_align:left|line_height:1" use_theme_fonts="yes"][vc_separator color="black" border_width="3"][jnews_video_block4 compatible_column_notice="" post_meta_style="style_1" author_avatar="" number_post="4" post_offset="0"][/vc_column][/vc_row][vc_row][vc_column width="2/3"][vc_custom_heading text="<strong>Special Reports</strong>" font_container="tag:h3|font_size:26|text_align:left|line_height:1" use_theme_fonts="yes"][vc_separator color="custom" border_width="3" css=".vc_custom_1498462112764{margin-top: 0px !important;}" accent_color="#111111"][jnews_block_15 compatible_column_notice="" number_post="6" post_offset="0" unique_content="unique1" include_category="54,53,2,15"][jnews_element_ads compatible_column_notice="" ads_type="image" ads_image_new_tab="yes" ads_image="24" ads_image_link="#"][/jnews_element_ads][jnews_block_3 compatible_column_notice="" header_filter_category="14,13,17" number_post="2" post_offset="0" include_category="54,14" excerpt_length="20" first_title="Opinion"][/jnews_block_3][jnews_block_3 compatible_column_notice="" header_filter_category="56,15,2" number_post="2" post_offset="0" include_category="56,15,2" excerpt_length="20" first_title="Interviews"][/jnews_block_3][jnews_block_3 compatible_column_notice="" number_post="2" post_offset="0" include_category="8" excerpt_length="20" first_title="Books"][/jnews_block_3][jnews_block_3 compatible_column_notice="" number_post="2" post_offset="0" include_category="57" excerpt_length="20" first_title="Film"][/jnews_block_3][vc_single_image image="24" img_size="full" alignment="center" onclick="custom_link" img_link_target="_blank" link="http://127.0.0.1:8081/"][jnews_block_3 compatible_column_notice="" number_post="2" post_offset="0" include_category="3" excerpt_length="20" first_title="Theatre"][/jnews_block_3][/vc_column][vc_column width="1/3" sticky_sidebar="yes" set_as_sidebar="yes"][vc_custom_heading text="<strong>Spotlight</strong>" font_container="tag:h3|font_size:26|text_align:left|line_height:1" use_theme_fonts="yes"][vc_separator color="custom" border_width="3" css=".vc_custom_1498462112764{margin-top: 0px !important;}" accent_color="#111111"][jnews_block_1 compatible_column_notice="" header_type="heading_5" number_post="6" post_offset="0" unique_content="unique1" include_category="3" excerpt_length="20"][vc_row_inner][vc_column_inner][jnews_block_14 compatible_column_notice="" header_icon="fas fa-eye" number_post="5" post_offset="0" unique_content="unique2" sort_by="popular_post_week" first_title="Top" second_title="Stories"][vc_single_image image="44706" img_size="full" alignment="center" onclick="custom_link" img_link_target="_blank" link="http://127.0.0.1:8081/"][jnews_block_31 compatible_column_notice="" header_icon="far fa-thumbs-up" number_post="3" post_offset="0" unique_content="unique3" sort_by="like" first_title="Most" second_title="Liked"][/jnews_block_31][jnews_block_20 compatible_column_notice="" header_icon="fas fa-share" number_post="4" post_offset="0" unique_content="unique4" sort_by="share" first_title="Most" second_title="Shared"][/vc_column_inner][/vc_row_inner][/vc_column][/vc_row]</p>

Into:

  1. Array
  2. (
  3. [0] => Array
  4. (
  5. [0] => Array
  6. (
  7. [0] => Array
  8. (
  9. [shortcode] => jnews_hero_13
  10. [properties] => Array
  11. (
  12. [compatible_column_notice] =>
  13. [hero_margin] => 0
  14. [content_filter_number_alert] =>
  15. [post_offset] => 0
  16. [include_tag] => 49
  17. )
  18. )
  19. [1] => Array
  20. (
  21. [shortcode] => jnews_block_22
  22. [properties] => Array
  23. (
  24. [compatible_column_notice] =>
  25. [number_post] => 8
  26. [post_offset] => 1
  27. [exclude_post] => 407
  28. )
  29. )
  30. [2] => Array
  31. (
  32. [shortcode] => jnews_slider_7
  33. [properties] => Array
  34. (
  35. [compatible_column_notice] =>
  36. [excerpt_length] => 24
  37. [number_post] => 6
  38. [post_offset] => 0
  39. )
  40. )
  41. [3] => Array
  42. (
  43. [shortcode] => vc_custom_heading
  44. [properties] => Array
  45. (
  46. [text] => <strong>Latest News</strong>
  47. [font_container] => tag:h3|font_size:26|text_align:left|line_height:1
  48. [use_theme_fonts] => yes
  49. [css] => .vc_custom_1610377441161{margin-bottom: 5px !important;}
  50. )
  51. )
  52. [4] => Array
  53. (
  54. [shortcode] => vc_separator
  55. [properties] => Array
  56. (
  57. [color] => custom
  58. [border_width] => 3
  59. [css] => .vc_custom_1610308826626{margin-top: 0px !important;margin-bottom: 10px !important;padding-bottom: 10px !important;}
  60. [accent_color] => #111111
  61. )
  62. )
  63. )
  64. )
  65. [1] => Array
  66. (
  67. [0] => Array
  68. (
  69. [0] => Array
  70. (
  71. [shortcode] => jnews_block_5
  72. [properties] => Array
  73. (
  74. [compatible_column_notice] =>
  75. [header_type] => heading_7
  76. [number_post] => 1
  77. [post_offset] => 0
  78. [unique_content] => unique1
  79. [include_category] => 17
  80. [excerpt_length] => 20
  81. )
  82. )
  83. [1] => Array
  84. (
  85. [shortcode] => jnews_block_22
  86. [properties] => Array
  87. (
  88. [compatible_column_notice] =>
  89. [number_post] => 6
  90. [post_offset] => 0
  91. [unique_content] => unique1
  92. [include_category] => 17
  93. )
  94. )
  95. )
  96. [1] => Array
  97. (
  98. [0] => Array
  99. (
  100. [shortcode] => vc_widget_sidebar
  101. [properties] => Array
  102. (
  103. [sidebar_id] => news-list
  104. )
  105. )
  106. [1] => Array
  107. (
  108. [shortcode] => jnews_block_19
  109. [properties] => Array
  110. (
  111. [compatible_column_notice] =>
  112. [number_post] => 4
  113. [post_offset] => 0
  114. [unique_content] => unique1
  115. )
  116. )
  117. )
  118. )
  119. [2] => Array
  120. (
  121. [0] => Array
  122. (
  123. [0] => Array
  124. (
  125. [shortcode] => vc_custom_heading
  126. [properties] => Array
  127. (
  128. [text] => <strong>Latest Video Picks</strong>
  129. [font_container] => tag:h3|font_size:26|text_align:left|line_height:1
  130. [use_theme_fonts] => yes
  131. )
  132. )
  133. [1] => Array
  134. (
  135. [shortcode] => vc_separator
  136. [properties] => Array
  137. (
  138. [color] => black
  139. [border_width] => 3
  140. )
  141. )
  142. [2] => Array
  143. (
  144. [shortcode] => jnews_video_block4
  145. [properties] => Array
  146. (
  147. [compatible_column_notice] =>
  148. [post_meta_style] => style_1
  149. [author_avatar] =>
  150. [number_post] => 4
  151. [post_offset] => 0
  152. )
  153. )
  154. )
  155. )
  156. [3] => Array
  157. (
  158. [0] => Array
  159. (
  160. [0] => Array
  161. (
  162. [shortcode] => vc_custom_heading
  163. [properties] => Array
  164. (
  165. [text] => <strong>Special Reports</strong>
  166. [font_container] => tag:h3|font_size:26|text_align:left|line_height:1
  167. [use_theme_fonts] => yes
  168. )
  169. )
  170. [1] => Array
  171. (
  172. [shortcode] => vc_separator
  173. [properties] => Array
  174. (
  175. [color] => custom
  176. [border_width] => 3
  177. [css] => .vc_custom_1498462112764{margin-top: 0px !important;}
  178. [accent_color] => #111111
  179. )
  180. )
  181. [2] => Array
  182. (
  183. [shortcode] => jnews_block_15
  184. [properties] => Array
  185. (
  186. [compatible_column_notice] =>
  187. [number_post] => 6
  188. [post_offset] => 0
  189. [unique_content] => unique1
  190. [include_category] => 54,53,2,15
  191. )
  192. )
  193. [3] => Array
  194. (
  195. [shortcode] => jnews_element_ads
  196. [properties] => Array
  197. (
  198. [compatible_column_notice] =>
  199. [ads_type] => image
  200. [ads_image_new_tab] => yes
  201. [ads_image] => 24
  202. [ads_image_link] => #
  203. )
  204. )
  205. [4] => Array
  206. (
  207. [shortcode] => jnews_block_3
  208. [properties] => Array
  209. (
  210. [compatible_column_notice] =>
  211. [header_filter_category] => 14,13,17
  212. [number_post] => 2
  213. [post_offset] => 0
  214. [include_category] => 54,14
  215. [excerpt_length] => 20
  216. [first_title] => Opinion
  217. )
  218. )
  219. [5] => Array
  220. (
  221. [shortcode] => jnews_block_3
  222. [properties] => Array
  223. (
  224. [compatible_column_notice] =>
  225. [header_filter_category] => 56,15,2
  226. [number_post] => 2
  227. [post_offset] => 0
  228. [include_category] => 56,15,2
  229. [excerpt_length] => 20
  230. [first_title] => Interviews
  231. )
  232. )
  233. [6] => Array
  234. (
  235. [shortcode] => jnews_block_3
  236. [properties] => Array
  237. (
  238. [compatible_column_notice] =>
  239. [number_post] => 2
  240. [post_offset] => 0
  241. [include_category] => 8
  242. [excerpt_length] => 20
  243. [first_title] => Books
  244. )
  245. )
  246. [7] => Array
  247. (
  248. [shortcode] => jnews_block_3
  249. [properties] => Array
  250. (
  251. [compatible_column_notice] =>
  252. [number_post] => 2
  253. [post_offset] => 0
  254. [include_category] => 57
  255. [excerpt_length] => 20
  256. [first_title] => Film
  257. )
  258. )
  259. [8] => Array
  260. (
  261. [shortcode] => vc_single_image
  262. [properties] => Array
  263. (
  264. [image] => 24
  265. [img_size] => full
  266. [alignment] => center
  267. [onclick] => custom_link
  268. [img_link_target] => _blank
  269. [link] => http://127.0.0.1:8081/
  270. )
  271. )
  272. [9] => Array
  273. (
  274. [shortcode] => jnews_block_3
  275. [properties] => Array
  276. (
  277. [compatible_column_notice] =>
  278. [number_post] => 2
  279. [post_offset] => 0
  280. [include_category] => 3
  281. [excerpt_length] => 20
  282. [first_title] => Theatre
  283. )
  284. )
  285. )
  286. [1] => Array
  287. (
  288. [0] => Array
  289. (
  290. [shortcode] => vc_custom_heading
  291. [properties] => Array
  292. (
  293. [text] => <strong>Spotlight</strong>
  294. [font_container] => tag:h3|font_size:26|text_align:left|line_height:1
  295. [use_theme_fonts] => yes
  296. )
  297. )
  298. [1] => Array
  299. (
  300. [shortcode] => vc_separator
  301. [properties] => Array
  302. (
  303. [color] => custom
  304. [border_width] => 3
  305. [css] => .vc_custom_1498462112764{margin-top: 0px !important;}
  306. [accent_color] => #111111
  307. )
  308. )
  309. [2] => Array
  310. (
  311. [shortcode] => jnews_block_1
  312. [properties] => Array
  313. (
  314. [compatible_column_notice] =>
  315. [header_type] => heading_5
  316. [number_post] => 6
  317. [post_offset] => 0
  318. [unique_content] => unique1
  319. [include_category] => 3
  320. [excerpt_length] => 20
  321. )
  322. )
  323. [3] => Array
  324. (
  325. [0] => Array
  326. (
  327. [0] => Array
  328. (
  329. [shortcode] => jnews_block_14
  330. [properties] => Array
  331. (
  332. [compatible_column_notice] =>
  333. [header_icon] => fas fa-eye
  334. [number_post] => 5
  335. [post_offset] => 0
  336. [unique_content] => unique2
  337. [sort_by] => popular_post_week
  338. [first_title] => Top
  339. [second_title] => Stories
  340. )
  341. )
  342. [1] => Array
  343. (
  344. [shortcode] => vc_single_image
  345. [properties] => Array
  346. (
  347. [image] => 44706
  348. [img_size] => full
  349. [alignment] => center
  350. [onclick] => custom_link
  351. [img_link_target] => _blank
  352. [link] => http://127.0.0.1:8081/
  353. )
  354. )
  355. [2] => Array
  356. (
  357. [shortcode] => jnews_block_31
  358. [properties] => Array
  359. (
  360. [compatible_column_notice] =>
  361. [header_icon] => far fa-thumbs-up
  362. [number_post] => 3
  363. [post_offset] => 0
  364. [unique_content] => unique3
  365. [sort_by] => like
  366. [first_title] => Most
  367. [second_title] => Liked
  368. )
  369. )
  370. [3] => Array
  371. (
  372. [shortcode] => jnews_block_20
  373. [properties] => Array
  374. (
  375. [compatible_column_notice] =>
  376. [header_icon] => fas fa-share
  377. [number_post] => 4
  378. [post_offset] => 0
  379. [unique_content] => unique4
  380. [sort_by] => share
  381. [first_title] => Most
  382. [second_title] => Shared
  383. )
  384. )
  385. )
  386. )
  387. )
  388. )
  389. )

I sorry you scrolled this far, there isn’t anything down here..