/wp-content/plugins/premium-seo-pack/modules/local_seo/options-shortcodes.php

https://gitlab.com/iamgraeme/royalmile · PHP · 555 lines · 483 code · 51 blank · 21 comment · 3 complexity · b2f97e2c5eefb9e930f0aa4e7ce21c42 MD5 · raw file

  1. <?php
  2. if ( !function_exists('psp_getLocationsList') ) { function psp_getLocationsList() {
  3. global $psp;
  4. global $wpdb;
  5. ob_start();
  6. $sqlClause = '';
  7. $sql = "SELECT a.ID
  8. FROM " . $wpdb->prefix . "posts as a
  9. LEFT JOIN " . $wpdb->prefix . "postmeta as b
  10. ON b.post_id = a.ID
  11. WHERE 1=1 " . $sqlClause . " AND a.post_status = 'publish' AND a.post_password = ''
  12. AND a.post_type = 'psp_locations'
  13. AND (b.meta_key = 'psp_locations_meta' AND !ISNULL(b.meta_value) AND b.meta_value != '')
  14. ORDER BY a.post_title ASC
  15. LIMIT 1000;";
  16. $res = $wpdb->get_col( $sql );
  17. ?>
  18. <div class="psp-form-row">
  19. <label><?php _e('Select location:', 'psp'); ?></label>
  20. <div class="psp-form-item large">
  21. <span class="formNote">&nbsp;</span>
  22. <select id="psp-location-id" name="location_id" style="width:120px;">
  23. <option value="all">All locations</option>
  24. <?php
  25. foreach ($res as $key => $value) {
  26. $val = '';
  27. echo '<option value="' . ( $value ) . '" ' . ( $val == $value ? 'selected="true"' : '' ) . '>' . ( $value ) . '</option>';
  28. }
  29. ?>
  30. </select>&nbsp;&nbsp;&nbsp;&nbsp;
  31. </div>
  32. </div>
  33. <?php
  34. $output = ob_get_contents();
  35. ob_end_clean();
  36. return $output;
  37. } }
  38. global $psp;
  39. echo json_encode(
  40. array(
  41. array(
  42. /* business shortcode */
  43. // [psp_business id=all show_name=true show_desc=true show_img_logo=true show_img_building=true]
  44. 'psp_business' => array(
  45. 'title' => __('Insert Business Shortcode', 'psp'),
  46. 'icon' => '{plugin_folder_uri}assets/menu_icon.png',
  47. 'size' => 'grid_4', // grid_1|grid_2|grid_3|grid_4
  48. 'header' => true, // true|false
  49. 'toggler' => false, // true|false
  50. 'buttons' => false, // true|false
  51. 'style' => 'panel', // panel|panel-widget
  52. 'shortcode' => '[psp_business id={location_id} show_name={show_name} show_desc={show_desc} show_img_logo={show_img_logo} show_img_building={show_img_building}]',
  53. // create the box elements array
  54. 'elements' => array(
  55. 'location_id' => array(
  56. 'type' => 'html',
  57. 'html' => psp_getLocationsList()
  58. ),
  59. 'show_name' => array(
  60. 'type' => 'select',
  61. 'std' => 'no',
  62. 'size' => 'large',
  63. 'force_width'=> '120',
  64. 'title' => __('Show Name:', 'psp'),
  65. 'desc' => __('show business name', 'psp'),
  66. 'options' => array(
  67. 'true' => __('YES', 'psp'),
  68. 'false' => __('NO', 'psp')
  69. )
  70. ),
  71. 'show_desc' => array(
  72. 'type' => 'select',
  73. 'std' => 'no',
  74. 'size' => 'large',
  75. 'force_width'=> '120',
  76. 'title' => __('Show Description:', 'psp'),
  77. 'desc' => __('show business description', 'psp'),
  78. 'options' => array(
  79. 'true' => __('YES', 'psp'),
  80. 'false' => __('NO', 'psp')
  81. )
  82. ),
  83. 'show_img_logo' => array(
  84. 'type' => 'select',
  85. 'std' => 'no',
  86. 'size' => 'large',
  87. 'force_width'=> '120',
  88. 'title' => __('Show Business Logo:', 'psp'),
  89. 'desc' => __('show business logo image', 'psp'),
  90. 'options' => array(
  91. 'true' => __('YES', 'psp'),
  92. 'false' => __('NO', 'psp')
  93. )
  94. ),
  95. 'show_img_building' => array(
  96. 'type' => 'select',
  97. 'std' => 'no',
  98. 'size' => 'large',
  99. 'force_width'=> '120',
  100. 'title' => __('Show Business Building:', 'psp'),
  101. 'desc' => __('show business building image', 'psp'),
  102. 'options' => array(
  103. 'true' => __('YES', 'psp'),
  104. 'false' => __('NO', 'psp')
  105. )
  106. )
  107. )
  108. ) // end shortcode
  109. /* address shortcode */
  110. // [psp_address id=all show_street=true show_city=true show_state=true show_zipcode=true show_country=true]
  111. ,'psp_address' => array(
  112. 'title' => __('Insert Address Shortcode', 'psp'),
  113. 'icon' => '{plugin_folder_uri}assets/menu_icon.png',
  114. 'size' => 'grid_4', // grid_1|grid_2|grid_3|grid_4
  115. 'header' => true, // true|false
  116. 'toggler' => false, // true|false
  117. 'buttons' => false, // true|false
  118. 'style' => 'panel', // panel|panel-widget
  119. 'shortcode' => '[psp_address id={location_id} show_street={show_street} show_city={show_city} show_state={show_state} show_zipcode={show_zipcode} show_country={show_country}]',
  120. // create the box elements array
  121. 'elements' => array(
  122. 'location_id' => array(
  123. 'type' => 'html',
  124. 'html' => psp_getLocationsList()
  125. ),
  126. 'show_street' => array(
  127. 'type' => 'select',
  128. 'std' => 'no',
  129. 'size' => 'large',
  130. 'force_width'=> '120',
  131. 'title' => __('Show Street:', 'psp'),
  132. 'desc' => __('show street address', 'psp'),
  133. 'options' => array(
  134. 'true' => __('YES', 'psp'),
  135. 'false' => __('NO', 'psp')
  136. )
  137. ),
  138. 'show_city' => array(
  139. 'type' => 'select',
  140. 'std' => 'no',
  141. 'size' => 'large',
  142. 'force_width'=> '120',
  143. 'title' => __('Show City:', 'psp'),
  144. 'desc' => __('show address city', 'psp'),
  145. 'options' => array(
  146. 'true' => __('YES', 'psp'),
  147. 'false' => __('NO', 'psp')
  148. )
  149. ),
  150. 'show_state' => array(
  151. 'type' => 'select',
  152. 'std' => 'no',
  153. 'size' => 'large',
  154. 'force_width'=> '120',
  155. 'title' => __('Show State:', 'psp'),
  156. 'desc' => __('show address state', 'psp'),
  157. 'options' => array(
  158. 'true' => __('YES', 'psp'),
  159. 'false' => __('NO', 'psp')
  160. )
  161. ),
  162. 'show_zipcode' => array(
  163. 'type' => 'select',
  164. 'std' => 'no',
  165. 'size' => 'large',
  166. 'force_width'=> '120',
  167. 'title' => __('Show Zipcode:', 'psp'),
  168. 'desc' => __('show address zipcode', 'psp'),
  169. 'options' => array(
  170. 'true' => __('YES', 'psp'),
  171. 'false' => __('NO', 'psp')
  172. )
  173. ),
  174. 'show_country' => array(
  175. 'type' => 'select',
  176. 'std' => 'no',
  177. 'size' => 'large',
  178. 'force_width'=> '120',
  179. 'title' => __('Show Country:', 'psp'),
  180. 'desc' => __('show address country', 'psp'),
  181. 'options' => array(
  182. 'true' => __('YES', 'psp'),
  183. 'false' => __('NO', 'psp')
  184. )
  185. )
  186. )
  187. ) // end shortcode
  188. /* contact shortcode */
  189. // [psp_contact id=all show_phone=true show_altphone=true show_fax=true show_email=true]
  190. ,'psp_contact' => array(
  191. 'title' => __('Insert Contact Shortcode', 'psp'),
  192. 'icon' => '{plugin_folder_uri}assets/menu_icon.png',
  193. 'size' => 'grid_4', // grid_1|grid_2|grid_3|grid_4
  194. 'header' => true, // true|false
  195. 'toggler' => false, // true|false
  196. 'buttons' => false, // true|false
  197. 'style' => 'panel', // panel|panel-widget
  198. 'shortcode' => '[psp_contact id={location_id} show_phone={show_phone} show_altphone={show_altphone} show_fax={show_fax} show_email={show_email}]',
  199. // create the box elements array
  200. 'elements' => array(
  201. 'location_id' => array(
  202. 'type' => 'html',
  203. 'html' => psp_getLocationsList()
  204. ),
  205. 'show_phone' => array(
  206. 'type' => 'select',
  207. 'std' => 'no',
  208. 'size' => 'large',
  209. 'force_width'=> '120',
  210. 'title' => __('Show Phone:', 'psp'),
  211. 'desc' => __('show phone contact', 'psp'),
  212. 'options' => array(
  213. 'true' => __('YES', 'psp'),
  214. 'false' => __('NO', 'psp')
  215. )
  216. ),
  217. 'show_altphone' => array(
  218. 'type' => 'select',
  219. 'std' => 'no',
  220. 'size' => 'large',
  221. 'force_width'=> '120',
  222. 'title' => __('Show Alt. Phone:', 'psp'),
  223. 'desc' => __('show alternative phone contact', 'psp'),
  224. 'options' => array(
  225. 'true' => __('YES', 'psp'),
  226. 'false' => __('NO', 'psp')
  227. )
  228. ),
  229. 'show_fax' => array(
  230. 'type' => 'select',
  231. 'std' => 'no',
  232. 'size' => 'large',
  233. 'force_width'=> '120',
  234. 'title' => __('Show Fax:', 'psp'),
  235. 'desc' => __('show fax contact', 'psp'),
  236. 'options' => array(
  237. 'true' => __('YES', 'psp'),
  238. 'false' => __('NO', 'psp')
  239. )
  240. ),
  241. 'show_email' => array(
  242. 'type' => 'select',
  243. 'std' => 'no',
  244. 'size' => 'large',
  245. 'force_width'=> '120',
  246. 'title' => __('Show Email:', 'psp'),
  247. 'desc' => __('show email contact', 'psp'),
  248. 'options' => array(
  249. 'true' => __('YES', 'psp'),
  250. 'false' => __('NO', 'psp')
  251. )
  252. )
  253. )
  254. ) // end shortcode
  255. /* payment shortcode */
  256. // [psp_payment id=all show_payment=true show_currencies=true show_pricerange=true]
  257. ,'psp_payment' => array(
  258. 'title' => __('Insert Payment Shortcode', 'psp'),
  259. 'icon' => '{plugin_folder_uri}assets/menu_icon.png',
  260. 'size' => 'grid_4', // grid_1|grid_2|grid_3|grid_4
  261. 'header' => true, // true|false
  262. 'toggler' => false, // true|false
  263. 'buttons' => false, // true|false
  264. 'style' => 'panel', // panel|panel-widget
  265. 'shortcode' => '[psp_payment id={location_id} show_payment={show_payment} show_currencies={show_currencies} show_pricerange={show_pricerange}]',
  266. // create the box elements array
  267. 'elements' => array(
  268. 'location_id' => array(
  269. 'type' => 'html',
  270. 'html' => psp_getLocationsList()
  271. ),
  272. 'show_payment' => array(
  273. 'type' => 'select',
  274. 'std' => 'no',
  275. 'size' => 'large',
  276. 'force_width'=> '120',
  277. 'title' => __('Show Payment:', 'psp'),
  278. 'desc' => __('show payment', 'psp'),
  279. 'options' => array(
  280. 'true' => __('YES', 'psp'),
  281. 'false' => __('NO', 'psp')
  282. )
  283. ),
  284. 'show_currencies' => array(
  285. 'type' => 'select',
  286. 'std' => 'no',
  287. 'size' => 'large',
  288. 'force_width'=> '120',
  289. 'title' => __('Show Currencies:', 'psp'),
  290. 'desc' => __('show currencies', 'psp'),
  291. 'options' => array(
  292. 'true' => __('YES', 'psp'),
  293. 'false' => __('NO', 'psp')
  294. )
  295. ),
  296. 'show_pricerange' => array(
  297. 'type' => 'select',
  298. 'std' => 'no',
  299. 'size' => 'large',
  300. 'force_width'=> '120',
  301. 'title' => __('Show Price Range:', 'psp'),
  302. 'desc' => __('show price range', 'psp'),
  303. 'options' => array(
  304. 'true' => __('YES', 'psp'),
  305. 'false' => __('NO', 'psp')
  306. )
  307. )
  308. )
  309. ) // end shortcode
  310. /* opening hours shortcode */
  311. // [psp_opening_hours id=all show_head=true]
  312. ,'psp_opening_hours' => array(
  313. 'title' => __('Insert Opening Hours Shortcode', 'psp'),
  314. 'icon' => '{plugin_folder_uri}assets/menu_icon.png',
  315. 'size' => 'grid_4', // grid_1|grid_2|grid_3|grid_4
  316. 'header' => true, // true|false
  317. 'toggler' => false, // true|false
  318. 'buttons' => false, // true|false
  319. 'style' => 'panel', // panel|panel-widget
  320. 'shortcode' => '[psp_opening_hours id={location_id} show_head={show_head}]',
  321. // create the box elements array
  322. 'elements' => array(
  323. 'location_id' => array(
  324. 'type' => 'html',
  325. 'html' => psp_getLocationsList()
  326. ),
  327. 'show_head' => array(
  328. 'type' => 'select',
  329. 'std' => 'no',
  330. 'size' => 'large',
  331. 'force_width'=> '120',
  332. 'title' => __('Show Heading:', 'psp'),
  333. 'desc' => __('show heading', 'psp'),
  334. 'options' => array(
  335. 'true' => __('YES', 'psp'),
  336. 'false' => __('NO', 'psp')
  337. )
  338. )
  339. )
  340. ) // end shortcode
  341. /* full shortcode */
  342. // [psp_full id=all show_business=true show_address=true show_contact=true show_opening_hours=true show_payment=true show_gmap=true]
  343. ,'psp_full' => array(
  344. 'title' => __('Insert Full Shortcode', 'psp'),
  345. 'icon' => '{plugin_folder_uri}assets/menu_icon.png',
  346. 'size' => 'grid_4', // grid_1|grid_2|grid_3|grid_4
  347. 'header' => true, // true|false
  348. 'toggler' => false, // true|false
  349. 'buttons' => false, // true|false
  350. 'style' => 'panel', // panel|panel-widget
  351. 'shortcode' => '[psp_full id={location_id} show_business={show_business} show_address={show_address} show_contact={show_contact} show_opening_hours={show_opening_hours} show_payment={show_payment} show_gmap={show_gmap}]',
  352. // create the box elements array
  353. 'elements' => array(
  354. 'location_id' => array(
  355. 'type' => 'html',
  356. 'html' => psp_getLocationsList()
  357. ),
  358. 'show_business' => array(
  359. 'type' => 'select',
  360. 'std' => 'no',
  361. 'size' => 'large',
  362. 'force_width'=> '120',
  363. 'title' => __('Show Business:', 'psp'),
  364. 'desc' => __('show business details', 'psp'),
  365. 'options' => array(
  366. 'true' => __('YES', 'psp'),
  367. 'false' => __('NO', 'psp')
  368. )
  369. ),
  370. 'show_address' => array(
  371. 'type' => 'select',
  372. 'std' => 'no',
  373. 'size' => 'large',
  374. 'force_width'=> '120',
  375. 'title' => __('Show Address:', 'psp'),
  376. 'desc' => __('show address details', 'psp'),
  377. 'options' => array(
  378. 'true' => __('YES', 'psp'),
  379. 'false' => __('NO', 'psp')
  380. )
  381. ),
  382. 'show_contact' => array(
  383. 'type' => 'select',
  384. 'std' => 'no',
  385. 'size' => 'large',
  386. 'force_width'=> '120',
  387. 'title' => __('Show Contact:', 'psp'),
  388. 'desc' => __('show contact details', 'psp'),
  389. 'options' => array(
  390. 'true' => __('YES', 'psp'),
  391. 'false' => __('NO', 'psp')
  392. )
  393. ),
  394. 'show_opening_hours' => array(
  395. 'type' => 'select',
  396. 'std' => 'no',
  397. 'size' => 'large',
  398. 'force_width'=> '120',
  399. 'title' => __('Show Opening Hours:', 'psp'),
  400. 'desc' => __('show opening hours details', 'psp'),
  401. 'options' => array(
  402. 'true' => __('YES', 'psp'),
  403. 'false' => __('NO', 'psp')
  404. )
  405. ),
  406. 'show_payment' => array(
  407. 'type' => 'select',
  408. 'std' => 'no',
  409. 'size' => 'large',
  410. 'force_width'=> '120',
  411. 'title' => __('Show Payment:', 'psp'),
  412. 'desc' => __('show payment details', 'psp'),
  413. 'options' => array(
  414. 'true' => __('YES', 'psp'),
  415. 'false' => __('NO', 'psp')
  416. )
  417. ),
  418. 'show_gmap' => array(
  419. 'type' => 'select',
  420. 'std' => 'no',
  421. 'size' => 'large',
  422. 'force_width'=> '120',
  423. 'title' => __('Show Google Map:', 'psp'),
  424. 'desc' => __('show google map details', 'psp'),
  425. 'options' => array(
  426. 'true' => __('YES', 'psp'),
  427. 'false' => __('NO', 'psp')
  428. )
  429. )
  430. )
  431. ) // end shortcode
  432. /* google map shortcode */
  433. // [psp_gmap id=all width=320 height=240 zoom=12 maptype="roadmap" type="static"]
  434. ,'psp_gmap' => array(
  435. 'title' => __('Insert Google Map', 'psp'),
  436. 'icon' => '{plugin_folder_uri}assets/menu_icon.png',
  437. 'size' => 'grid_4', // grid_1|grid_2|grid_3|grid_4
  438. 'header' => true, // true|false
  439. 'toggler' => false, // true|false
  440. 'buttons' => false, // true|false
  441. 'style' => 'panel', // panel|panel-widget
  442. 'shortcode' => '[psp_gmap id={location_id} width={width} height={height} zoom={zoom} maptype="{maptype}" type="{type}"]',
  443. // create the box elements array
  444. 'elements' => array(
  445. 'location_id' => array(
  446. 'type' => 'html',
  447. 'html' => psp_getLocationsList()
  448. ),
  449. 'width' => array(
  450. 'type' => 'text',
  451. 'std' => '320',
  452. 'size' => 'large',
  453. 'force_width'=> '150',
  454. 'title' => __('Width: ', 'psp'),
  455. 'desc' => __('google map width', 'psp')
  456. ),
  457. 'height' => array(
  458. 'type' => 'text',
  459. 'std' => '240',
  460. 'size' => 'large',
  461. 'force_width'=> '150',
  462. 'title' => __('Height: ', 'psp'),
  463. 'desc' => __('google map height', 'psp')
  464. ),
  465. 'zoom' => array(
  466. 'type' => 'text',
  467. 'std' => '12',
  468. 'size' => 'large',
  469. 'force_width'=> '150',
  470. 'title' => __('Zoom: ', 'psp'),
  471. 'desc' => __('google map zoom (recommended values: 1-20)', 'psp')
  472. ),
  473. 'maptype' => array(
  474. 'type' => 'select',
  475. 'std' => 'no',
  476. 'size' => 'large',
  477. 'force_width'=> '120',
  478. 'title' => __('Map type:', 'psp'),
  479. 'desc' => __('google map type', 'psp'),
  480. 'options' => array(
  481. 'roadmap' => __('Roadmap', 'psp'),
  482. 'satellite' => __('Satellite', 'psp'),
  483. 'terrain' => __('Terrain', 'psp'),
  484. 'hybrid' => __('Hybrid', 'psp')
  485. )
  486. ),
  487. 'type' => array(
  488. 'type' => 'select',
  489. 'std' => 'no',
  490. 'size' => 'large',
  491. 'force_width'=> '120',
  492. 'title' => __('What map do you want to display? ', 'psp'),
  493. 'desc' => __('static: image map; dynamic: javascript map', 'psp'),
  494. 'options' => array(
  495. 'static' => __('Static', 'psp'),
  496. 'dynamic' => __('Dynamic', 'psp')
  497. )
  498. )
  499. )
  500. ) // end shortcode
  501. )
  502. )
  503. );
  504. ?>