automapper.php 790 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3. die( '-1' );
  4. }
  5. /**
  6. * Build and enqueue js/css for automapper settings tab.
  7. * @since 4.5
  8. */
  9. function vc_automapper_init() {
  10. if ( vc_user_access()->wpAny( 'manage_options' )->part( 'settings' )->can( 'vc-automapper-tab' )->get() ) {
  11. vc_automapper()->addAjaxActions();
  12. }
  13. }
  14. /**
  15. * Returns automapper template.
  16. *
  17. * @return string
  18. * @since 4.5
  19. */
  20. function vc_page_automapper_build() {
  21. return 'pages/vc-settings/vc-automapper.php';
  22. }
  23. // TODO: move to separate file in autoload
  24. add_filter( 'vc_settings-render-tab-vc-automapper', 'vc_page_automapper_build' );
  25. is_admin() && ( strpos( vc_request_param( 'action' ), 'vc_automapper' ) !== false || 'vc-automapper' === vc_get_param( 'page' ) ) && add_action( 'admin_init', 'vc_automapper_init' );