Overview

Packages

  • ACF
  • Automation
    • Actions
    • Activation
    • LeadProfile
    • Menus
    • Queries
    • Rules
    • Triggers
  • CTA
    • Activation
    • AJAXListeners
    • Cloning
    • Core
    • Display
    • EditPage
    • Enqueues
    • GPLSettings
    • LeadsProfile
    • Loading
    • Menus
    • Notices
    • PlacementMetabox
    • PostType
    • Templates
    • Tracking
    • Variations
    • YOAST
  • InboundPro
    • Activation
    • AdminAJAX
    • AutoLoading
    • Cron
    • DataInterface
    • FieldMapping
    • Funnels
    • InboundNowAPI
    • Installer
    • LeadStatuses
    • Menus
    • Notifications
    • Ouath
    • Reports
    • Settings
    • Tracking
    • Translations
    • Updates
  • LandingPages
    • Activation
    • DataInterfaces
    • Management
    • Menus
    • NeedsAttention
    • Notices
    • Sidebars
    • Templates
    • Tracking
    • Variations
    • WelcomeScreen
    • Widgets
  • Leads
    • Activation
    • Akismet
    • BranchControl
    • BulkActions
    • Dashboard
    • Management
    • Notifications
    • Settings
    • Tracking
    • UserProfile
    • WPLogin
  • Mailer
    • Activation
    • Admin
    • ClickTracking
    • DataInterface
    • InboundForms
    • Leads
    • Management
    • Notifications
    • Scheduling
    • Sending
    • Settings
    • ShortcodesAndTokens
    • SparkPost
    • Templates
    • Unsubscribes
    • Variations
    • YoastSEO
  • None
  • Shared
    • APIs
    • CPT
    • DatabaseRoutines
    • DebugTricks
    • DoubleOptin
    • EventManagement
    • FieldMapping
    • InboundForms
    • LeadSorage
    • MarketingButton
    • Menus
    • Notifications
    • Shortcodes
    • ShortcodesAndTokens
    • StandAloneLicensing
    • Tracking
    • VisualEditor
  • xDepreciated

Classes

  • CTA_Activation
  • CTA_Activation_Update_Routines
  • CTA_Admin_Notices
  • CTA_Ajax_Listeners
  • CTA_Clone_Post
  • CTA_Conversion_Tracking
  • CTA_Dynamic_Widget
  • CTA_Enqueues
  • CTA_Load_Extensions
  • CTA_Menus
  • CTA_Metaboxes
  • CTA_Metaboxes_Global
  • CTA_Post_Type
  • CTA_Render
  • CTA_Settings
  • CTA_Static_Widget
  • CTA_Template_Manager
  • CTA_Template_Manager_List
  • CTA_Variations
  • CTA_WordPress_Leads
  • CTA_WordPress_SEO
  • Inbound_Ajax
  • Inbound_Akismet
  • Inbound_Analytics
  • Inbound_API
  • Inbound_API_Keys_Generation
  • Inbound_API_Keys_Table
  • Inbound_API_Wrapper
  • Inbound_Asset_Loader
  • Inbound_Automation_Action_Add_Remove_List
  • Inbound_Automation_Action_Add_Remove_Tag
  • Inbound_Automation_Action_Create_Lead
  • Inbound_Automation_Action_Create_User
  • Inbound_Automation_Action_Kill_Tasks
  • Inbound_Automation_Action_Relay_Data
  • Inbound_Automation_Action_Send_Email
  • Inbound_Automation_Action_Wait
  • Inbound_Automation_Activation
  • Inbound_Automation_Activation_Update_Routines
  • Inbound_Automation_Adminbar
  • Inbound_Automation_Lead_Profile
  • Inbound_Automation_Loader
  • Inbound_Automation_Plugin
  • Inbound_Automation_Post_Type
  • Inbound_Automation_Processing
  • Inbound_Automation_Query_Lead
  • Inbound_Automation_Query_User
  • Inbound_Automation_Trigger_inbound_double_optin_confirm
  • Inbound_Automation_Trigger_inbound_store_lead_post
  • Inbound_Automation_Trigger_inbound_track_link
  • Inbound_Automation_Trigger_Publish_Post
  • Inbound_Automation_Trigger_Save_Post_Deactivated
  • Inbound_Automation_Trigger_Set_Object_Terms
  • Inbound_Automation_Trigger_Update_Lead
  • Inbound_Automation_Trigger_User_Register
  • Inbound_Calls_To_Action_Plugin
  • Inbound_Confirm_Double_Optin
  • Inbound_Cron
  • Inbound_CTA_Quick_View
  • Inbound_Customizer
  • Inbound_Debug_Scripts
  • Inbound_Email_Meta
  • Inbound_Email_Preview
  • Inbound_Email_Template_Shortcodes
  • Inbound_Event_Report
  • Inbound_Events
  • Inbound_Events_Report
  • Inbound_Extension_Loads
  • Inbound_Forms
  • Inbound_Funnel_Reporting
  • Inbound_Impressions_Report
  • Inbound_Landing_Pages_Plugin
  • Inbound_Lead_Statuses
  • Inbound_Leads
  • Inbound_Leads_Custom_fields
  • Inbound_Leads_Plugin
  • Inbound_License
  • Inbound_List_Double_Optin
  • Inbound_Load_Shared
  • Inbound_Logging_Automation
  • Inbound_Login
  • Inbound_Mail_Daemon
  • Inbound_Mailer_ACF
  • Inbound_Mailer_Activation
  • Inbound_Mailer_Activation_Update_Routines
  • Inbound_Mailer_Ajax_Listeners
  • Inbound_Mailer_Clone_Post
  • Inbound_Mailer_Common_Settings
  • Inbound_Mailer_Customizer
  • Inbound_Mailer_Direct_Email_Leads
  • Inbound_Mailer_Enqueues
  • Inbound_Mailer_Forms_Integration
  • Inbound_Mailer_Load_Templates
  • Inbound_Mailer_Menus
  • Inbound_Mailer_Metaboxes
  • Inbound_Mailer_Notifications
  • Inbound_Mailer_Plugin
  • Inbound_Mailer_Post_Type
  • Inbound_Mailer_Scheduling
  • Inbound_Mailer_Settings
  • Inbound_Mailer_SparkPost
  • Inbound_Mailer_Stats_Report
  • Inbound_Mailer_Template_Manager
  • Inbound_Mailer_Template_Manager_List
  • Inbound_Mailer_Tokens
  • Inbound_Mailer_Tracking
  • Inbound_Mailer_Unsubscribe
  • Inbound_Mailer_Variations
  • Inbound_Mailer_WordPress_SEO
  • Inbound_Maintenance_Lists
  • Inbound_Marketing_Button
  • Inbound_Menus_Admin
  • Inbound_Menus_Adminbar
  • Inbound_Metaboxes_Automation
  • Inbound_Metaboxes_Leads
  • Inbound_Notifications
  • Inbound_Now_Store
  • Inbound_Options_API
  • Inbound_Pro_Activation
  • Inbound_Pro_Admin_Ajax_Listeners
  • Inbound_Pro_Automatic_Updates
  • Inbound_Pro_Downloads
  • Inbound_Pro_Notifications
  • Inbound_Pro_Oauth_Engine
  • Inbound_Pro_Plugin
  • Inbound_Pro_Settings
  • Inbound_Quick_View
  • Inbound_Reporting_Templates
  • Inbound_Search_And_Comment_Report
  • Inbound_Shared_ACF_BootStrap
  • Inbound_Shortcodes
  • Inbound_Shortcodes_Cookies
  • Inbound_Shortcodes_Fields
  • Inbound_SparkPost
  • Inbound_SparkPost_Stats
  • Inbound_Template_Utils
  • Inbound_Templating_Engine
  • Inbound_Tracking
  • Inbound_Translation_Updater
  • Inbound_Updater
  • Inbound_Upgrade_For_More_Reports
  • Inbound_Upgrade_Routines
  • Inbound_Visitor_Event_Report
  • Inbound_Visitor_Impressions_Report
  • Inbound_Visitors_Report
  • INBOUNDNOW_EXTEND
  • Landing_Pages_ACF
  • Landing_Pages_Activation
  • Landing_Pages_Activation_Update_Routines
  • Landing_Pages_Admin_Menus
  • Landing_Pages_Admin_Notices
  • Landing_Pages_Install
  • Landing_Pages_Load_Extensions
  • Landing_Pages_Meta
  • Landing_Pages_Metaboxes
  • Landing_Pages_Post_Type
  • Landing_Pages_Row_Actions
  • Landing_Pages_Settings
  • Landing_Pages_Sidebars
  • Landing_Pages_Split_Testing_Stats
  • Landing_Pages_Template_Management
  • Landing_Pages_Template_Switcher
  • Landing_Pages_Templates_List_Table
  • Landing_Pages_Variations
  • LandingPages_Welcome
  • Leads_Activation
  • Leads_Activation_Update_Routines
  • Leads_Admin_Notices
  • Leads_Batch_Processor
  • Leads_Branching
  • Leads_Dashboard
  • Leads_Field_Map
  • Leads_Manager
  • Leads_Post_Type
  • Leads_Settings
  • Leads_Tracking
  • Leads_User_Profile
  • LeadStorage
  • LP_EXTENSION_LICENSENING
  • LP_EXTENSION_UPDATER
  • LP_Variation_Rotation
  • LP_Widget_Conversion_Area

Functions

  • cta_check_active
  • cta_example_template_function
  • cta_load_dynamic_widget
  • CTA_Load_Extensions
  • cta_load_static_widget
  • CTA_Render
  • inbound_add_conversion_to_lead
  • inbound_automation_check_active
  • inbound_automation_load_definitions
  • inbound_automation_metaboxes
  • inbound_automation_processing
  • inbound_color
  • inbound_color_scheme
  • inbound_confirm_email_service_provider
  • inbound_email_kill_ie8
  • inbound_email_load_templates
  • inbound_form_add_lead_list
  • inbound_form_auto_publish
  • inbound_form_delete_transient
  • inbound_form_get_data
  • inbound_form_save
  • inbound_forms_change_columns
  • inbound_forms_cpt
  • inbound_forms_custom_columns
  • inbound_forms_default_content
  • inbound_get_form_names
  • inbound_get_parent_directory
  • inbound_Hex_2_RGB
  • inbound_inbound_email_example_template_function
  • inbound_load_lead_manager
  • inbound_load_token_engine
  • inbound_mailer_acf_integration
  • Inbound_Mailer_Common_Settings
  • Inbound_Mailer_Load_Templates
  • inbound_qtrans_disable
  • inbound_record_log
  • inbound_register_form_role_capabilities
  • inbound_shortcode_alert
  • inbound_shortcode_callout
  • inbound_shortcode_columns
  • inbound_shortcode_content_box
  • inbound_shortcode_divider
  • inbound_shortcode_empty_paragraph_fix
  • inbound_shortcode_four_fifth_columns
  • inbound_shortcode_full_columns
  • inbound_shortcode_gmap
  • inbound_shortcode_icon
  • inbound_shortcode_intro
  • inbound_shortcode_landing_pages
  • inbound_shortcode_leadp
  • inbound_shortcode_list_icons
  • inbound_shortcode_one_fifth_columns
  • inbound_shortcode_one_fourth_columns
  • inbound_shortcode_one_half_columns
  • inbound_shortcode_one_third_columns
  • inbound_shortcode_portfolio
  • inbound_shortcode_pricing
  • inbound_shortcode_profile
  • inbound_shortcode_social_links
  • inbound_shortcode_tabs
  • inbound_shortcode_teaser
  • inbound_shortcode_testimonial
  • inbound_shortcode_three_fifth_columns
  • inbound_shortcode_three_fourth_columns
  • inbound_shortcode_two_fifth_columns
  • inbound_shortcode_two_third_columns
  • inbound_shortcode_video
  • inbound_store_lead
  • inbound_template_brightness
  • inbound_template_color
  • Inbound_Templating_Engine
  • inbound_travis_check
  • inboundnow_add_master_license
  • json_encode_fallback
  • landingpage_fix_known_wp_title_isses
  • landingpages_is_active
  • load_CTA_Settings
  • load_CTA_Template_Manager
  • load_Inbound_API_Keys_Generation
  • load_Inbound_Lead_Statuses
  • load_Inbound_Leads_Custom_fields
  • load_inbound_mail_daemon
  • load_Inbound_Mailer_Settings
  • load_Inbound_Mailer_Template_Manager
  • load_Inbound_Pro_Downloads
  • lp_ab_testing_get_current_variation_id
  • lp_add_option
  • lp_body_class
  • lp_check_active
  • lp_content_area
  • lp_conversion_area
  • lp_discover_important_wrappers
  • lp_footer
  • lp_generate_drowndown
  • lp_get_parent_directory
  • lp_get_value
  • lp_global_config
  • lp_head
  • lp_in_admin_header
  • lp_init
  • lp_list_feature
  • lp_load_widgets
  • lp_main_headline
  • lp_manage_templates
  • lp_move_template_files
  • lp_rebuild_attributes
  • lp_templates_upload
  • mailer_check_active
  • wp_cta_check_active
  • wp_cta_kill_ie8
  • wp_cta_load_calls_to_action
  • wp_leads_get_page_final_id
  • wpl_url_to_postid
  • wpleads_add_lead_to_list
  • wpleads_check_active
  • wpleads_get_lead_lists_as_array
  • Overview
  • Package
  • Class
  1:   2:   3:   4:   5:   6:   7:   8:   9:  10:  11:  12:  13:  14:  15:  16:  17:  18:  19:  20:  21:  22:  23:  24:  25:  26:  27:  28:  29:  30:  31:  32:  33:  34:  35:  36:  37:  38:  39:  40:  41:  42:  43:  44:  45:  46:  47:  48:  49:  50:  51:  52:  53:  54:  55:  56:  57:  58:  59:  60:  61:  62:  63:  64:  65:  66:  67:  68:  69:  70:  71:  72:  73:  74:  75:  76:  77:  78:  79:  80:  81:  82:  83:  84:  85:  86:  87:  88:  89:  90:  91:  92:  93:  94:  95:  96:  97:  98:  99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: 293: 294: 295: 296: 297: 298: 299: 300: 301: 302: 303: 304: 305: 306: 307: 308: 309: 310: 311: 312: 313: 314: 315: 316: 317: 318: 319: 320: 321: 322: 323: 324: 325: 326: 327: 328: 329: 330: 331: 332: 333: 334: 335: 336: 337: 338: 339: 340: 341: 342: 343: 344: 345: 346: 347: 348: 349: 350: 351: 352: 353: 354: 355: 356: 357: 358: 359: 360: 361: 362: 363: 364: 365: 366: 367: 368: 369: 370: 371: 372: 373: 374: 375: 376: 377: 378: 379: 380: 381: 382: 383: 384: 385: 386: 387: 388: 389: 390: 391: 392: 393: 394: 395: 396: 397: 398: 399: 400: 401: 402: 403: 404: 405: 406: 407: 408: 409: 410: 411: 412: 413: 414: 415: 416: 417: 418: 419: 420: 421: 422: 423: 424: 425: 426: 427: 428: 429: 430: 431: 432: 433: 434: 435: 436: 437: 438: 439: 440: 441: 442: 443: 444: 445: 446: 447: 448: 449: 450: 451: 452: 453: 454: 455: 456: 457: 458: 459: 460: 461: 462: 463: 464: 465: 466: 467: 468: 469: 470: 471: 472: 473: 474: 475: 476: 477: 478: 479: 480: 481: 482: 483: 484: 485: 486: 487: 488: 489: 490: 491: 492: 493: 494: 495: 496: 497: 498: 499: 500: 501: 502: 503: 504: 505: 506: 507: 508: 509: 510: 511: 512: 513: 514: 515: 516: 517: 518: 519: 520: 521: 522: 523: 524: 525: 526: 527: 528: 529: 530: 531: 532: 533: 534: 535: 536: 537: 538: 539: 540: 541: 542: 543: 544: 545: 546: 547: 548: 549: 550: 551: 552: 553: 554: 555: 556: 557: 558: 559: 560: 561: 562: 563: 564: 565: 566: 567: 568: 569: 570: 571: 572: 573: 574: 575: 576: 577: 578: 579: 580: 581: 582: 583: 584: 585: 586: 587: 588: 589: 590: 591: 592: 593: 594: 595: 596: 597: 598: 599: 600: 601: 602: 603: 604: 605: 606: 607: 608: 609: 610: 611: 612: 613: 614: 615: 616: 617: 618: 619: 620: 621: 622: 623: 624: 625: 626: 627: 628: 629: 630: 631: 632: 633: 634: 635: 636: 637: 638: 639: 640: 641: 642: 643: 644: 645: 646: 647: 648: 649: 650: 651: 652: 653: 654: 655: 656: 657: 658: 659: 660: 661: 662: 663: 664: 665: 666: 667: 668: 669: 670: 671: 672: 673: 674: 675: 676: 677: 678: 679: 680: 681: 682: 683: 684: 685: 686: 687: 688: 689: 690: 691: 692: 693: 694: 695: 696: 697: 698: 699: 700: 701: 702: 703: 704: 705: 706: 707: 708: 709: 710: 711: 712: 713: 714: 715: 716: 717: 718: 719: 720: 721: 722: 723: 724: 725: 726: 727: 728: 729: 730: 731: 732: 733: 734: 735: 736: 737: 738: 739: 740: 741: 742: 743: 744: 745: 746: 747: 748: 749: 750: 751: 752: 753: 754: 755: 756: 757: 758: 759: 760: 761: 762: 763: 764: 765: 766: 767: 768: 769: 770: 771: 772: 773: 774: 775: 776: 777: 778: 779: 780: 781: 782: 783: 784: 785: 786: 787: 788: 789: 790: 791: 792: 793: 794: 795: 796: 797: 798: 799: 800: 801: 802: 803: 804: 805: 806: 807: 808: 809: 810: 811: 812: 813: 814: 815: 816: 817: 818: 819: 820: 
<?php
/**
 *   Inbound Forms Shortcode Options
 *   Forms code found in /shared/classes/form.class.php
 *   master code
 */

if (empty($lead_list_names)){
    // if lead transient doesn't exist use defaults
    $lead_list_names = array(
        'null' => 'No Lists detected',
    );
}

if (empty($lead_tag_names)){
    // if lead transient doesn't exist use defaults
    $lead_tag_names = array(
        'null' => 'No Lists detected',
    );
}


$shortcodes_config['forms'] = array(
    'no_preview' => false,
    'options' => array(
        'insert_default' => array(
            'name' => __('Choose Starting Template', 'inbound-pro' ),
            'desc' => __('Start Building Your Form from premade templates', 'inbound-pro' ),
            'type' => 'select',
            'options' => $form_names,
            'std' => 'none',
            'class' => 'main-form-settings',
        ),
        'form_name' => array(
            'name' => __('Form Name<span class="small-required-text">*</span>', 'inbound-pro' ),
            'desc' => __('This is for internal use and is not shown to visitors', 'inbound-pro' ),
            'type' => 'text',
            'placeholder' => "Example: XYZ Whitepaper Download",
            'std' => '',
            'class' => 'main-form-settings',
        ),
        /*'confirmation' => array(
                    'name' => __('Form Layout', 'inbound-pro' ),
                    'desc' => __('Choose Your Form Layout', 'inbound-pro' ),
                    'type' => 'select',
                    'options' => array(
                        "redirect" => "Redirect After Form Completion",
                        "text" => "Display Text on Same Page",
                        ),
                    'std' => 'redirect'
        ),*/
        'redirect' => array(
            'name' => __('Redirect URL', 'inbound-pro' ),
            'desc' => __('Where do you want to send people after they fill out the form? Please note: http:// is required. Leave blank to prevent redirection.', 'inbound-pro' ),
            'type' => 'text',
            'placeholder' => "http://www.yoursite.com/thank-you",
            'std' => '',
            'reveal_on' => 'redirect',
            'class' => 'main-form-settings',
        ),
        /*'thank_you_text' => array(
                'name' => __('Field Description <span class="small-optional-text">(optional)</span>',  'inbound-pro' ),
                'desc' => __('Put field description here.',  'inbound-pro' ),
                'type' => 'textarea',
                'std' => '',
                'class' => 'advanced',
                'reveal_on' => 'text'
        ), */
        'notify' => array(
            'name' => __('Notify on Form Completions<span class="small-required-text">*</span>', 'inbound-pro' ),
            'desc' => __('Who should get admin notifications on this form?<br>For multiple notifications separate email addresses with commas', 'inbound-pro' ),
            'type' => 'text',
            'placeholder' => "youremail@email.com",
            'std' => '',
            'class' => 'main-form-settings',
        ),
        'notify_subject' => array(
            'name' => __('Admin Email Subject Line<span class="small-required-text">*</span>', 'inbound-pro' ),
            'desc' => __('Customize the subject line of email notifications arriving from this form. default: {{site-name}} {{form-name}} - New Lead Conversion', 'inbound-pro' ),
            'type' => 'text',
            'std' => "{{site-name}} {{form-name}} - New Lead Conversion",
            'palceholder' => '{{site-name}} {{form-name}} - New Lead Conversion',
            'class' => 'main-form-settings',
        ),
        'lists' => array(
            'name' => __('Add to List(s)', 'inbound-pro' ),
            'desc' => __('Add the converting lead to 1 or more lead lists', 'inbound-pro' ),
            'type' => 'leadlists',
            'options' => $lead_list_names,
            'class' => 'main-form-settings exclude-from-refresh',
        ),

        'lists_hidden' => array(
            'name' => __('Hidden List Values', 'inbound-pro' ),
            'desc' => __('Hidden list values', 'inbound-pro' ),
            'type' => 'hidden',
            'class' => 'main-form-settings exclude-from-refresh',
        ),
        'tags' => array(
            'name' => __('Add Tags to Lead', 'inbound-pro' ),
            'desc' => __('Tag the lead with these tags', 'inbound-pro' ),
            'type' => 'leadtags',
            'options' => $lead_tag_names,
            'class' => 'main-form-settings exclude-from-refresh',
        ),
        'tags_hidden' => array(
            'name' => __('Hidden Tag Values', 'inbound-pro' ),
            'desc' => __('Hidden Tag values', 'inbound-pro' ),
            'type' => 'hidden',
            'class' => 'main-form-settings exclude-from-refresh',
        ),
        'helper-block-one' => array(
            'name' => __('Name Name Name',  'inbound-pro' ),
            'desc' => __('<span class="switch-to-form-insert button">Cancel Form Creation & Insert Existing Form</span>',  'inbound-pro' ),
            'type' => 'helper-block',
            'std' => '',
            'class' => 'main-form-settings',
        ),
        'heading_design' => array(
            'name' => __('Name Name Name',  'inbound-pro' ),
            'desc' => __('Layout Options',  'inbound-pro' ),
            'type' => 'helper-block',
            'std' => '',
            'class' => 'main-design-settings',
        ),
        'layout' => array(
            'name' => __('Form Layout', 'inbound-pro' ),
            'desc' => __('Choose Your Form Layout', 'inbound-pro' ),
            'type' => 'select',
            'options' => array(
                "vertical" => "Vertical",
                "horizontal" => "Horizontal",
            ),
            'std' => 'inline',
            'class' => 'main-design-settings',
        ),
        'labels' => array(
            'name' => __('Label Alignment', 'inbound-pro' ),
            'desc' => __('Choose Label Layout', 'inbound-pro' ),
            'type' => 'select',
            'options' => array(
                "top" => "Labels on Top",
                "bottom" => "Labels on Bottom",
                "inline" => "Inline",
                "placeholder" => "Use HTML5 Placeholder text only"
            ),
            'std' => 'top',
            'class' => 'main-design-settings',
        ),
        'font-size' => array(
            'name' => __('Form Font Size', 'inbound-pro' ),
            'desc' => __('Size of Label Font. This also determines default submit button size', 'inbound-pro' ),
            'type' => 'text',
            'std' => '16',
            'class' => 'main-design-settings',
        ),
        'icon' => array(
            'name' => __('Submit Button Icon', 'inbound-pro' ),
            'desc' => __('Select an icon.', 'inbound-pro' ),
            'type' => 'select',
            'options' => $fontawesome,
            'std' => 'none',
            'class' => 'main-design-settings'
        ),
        'submit' => array(
            'name' => __('Submit Button Text', 'inbound-pro' ),
            'desc' => __('Enter the text you want to show on the submit button. (or a link to a custom submit button image)', 'inbound-pro' ),
            'type' => 'text',
            'std' => 'Submit',
            'class' => 'main-design-settings',
        ),
        'submit-colors' => array(
            'name' => __('Submit Color Options', 'inbound-pro' ),
            'desc' => __('Choose Your Form Layout', 'inbound-pro' ),
            'type' => 'select',
            'options' => array(
                "on" => "Color Options On",
                "off" => "Color Options Off (use theme defaults)",
            ),
            'std' => 'off',
            'class' => 'main-design-settings',
        ),
        'submit-text-color' => array(
            'name' => __('Button Text Color', 'inbound-pro' ),
            'desc' => __('Color of text. Must toggle on "Submit Color Options" on', 'inbound-pro' ),
            'type' => 'colorpicker',
            'std' => '#434242',
            'class' => 'main-design-settings',
        ),
        'submit-bg-color' => array(
            'name' => __('Button BG Color', 'inbound-pro' ),
            'desc' => __('Background color of button.  Must toggle on "Submit Color Options" on', 'inbound-pro' ),
            'type' => 'colorpicker',
            'std' => '#E9E9E9',
            'class' => 'main-design-settings',
        ),
        'width' => array(
            'name' => __('Custom Width', 'inbound-pro' ),
            'desc' => __('Enter in pixel width or % width. Example: 400 <u>or</u> 100%', 'inbound-pro' ),
            'type' => 'text',
            'std' => '',
            'class' => 'main-design-settings',
        ),
        'custom-class' => array(
            'name' => __('Custom Class Names', 'inbound-pro' ),
            'desc' => __('Add custom classes here ', 'inbound-pro' ),
            'type' => 'text',
            'std' => '',
            'class' => 'main-design-settings',
        ),
    ),
    'child' => array(
        'options' => array(
            'label' => array(
                'name' => __('Field Label',  'inbound-pro' ),
                'desc' => '',
                'type' => 'text',
                'std' => '',
                'placeholder' => __("Enter the Form Field Label. Example: First Name" , "leads" )
            ),
            'field_type' => array(
                'name' => __('Field Type', 'inbound-pro' ),
                'desc' => __('Select an form field type', 'inbound-pro' ),
                'type' => 'select',
                'options' => array(
                    "text" => __('Single Line Text' , 'inbound-pro' ),
                    'textarea' => __('Paragraph Field' , 'inbound-pro' ),
                    'dropdown' => __('Dropdown - Custom' , 'inbound-pro' ),
                    'dropdown_countries' => __('Dropdown - Countries' , 'inbound-pro' ),
                    'radio' => __('Radio Select' , 'inbound-pro' ),
                    'checkbox' => __('Checkbox' , 'inbound-pro' ),
                    'html-block' => __('HTML Block' , 'inbound-pro' ),
                    'divider' => __('Divider' , 'inbound-pro' ),
                    'date-selector' => __('Date Dropdown Selection' , 'inbound-pro' ),
                    'date' => __('Date Picker Field' , 'inbound-pro' ),
                    'range' => __('Range Field' , 'inbound-pro' ),
                    'time' => __('Time Pick Field' , 'inbound-pro' ),
                    'hidden' => __('Hidden Field' , 'inbound-pro' ),
                    'honeypot' => __('Anti Spam Honey Pot' , 'inbound-pro' ),
                    /*
                    'url' => __('URL' , 'inbound-pro' ),
                    'email' => __( 'Email' , 'inbound-pro' ),
                    'tel' => __( 'Telephone' , 'inbound-pro' ),
                    'datetime-local' => __('Date Time Pick Selector Field' , 'inbound-pro' ),
                    'file_upload' => __('File Upload' , 'inbound-pro' ),
                    'editor' => __('HTML Editor' ,'inbound-pro' ),
                    'multi-select' => __('multi-select' ,  'inbound-pro' )
                    */
                ),
                'std' => ''
            ),
            'map_to' => array(
                'name' => __('Mapping', 'inbound-pro' ),
                'desc' => __('This is required.', 'inbound-pro' ),
                'type' => 'select',
                'options' => $lead_mapping_fields,
                'std' => 'none',
                'class' => '',
            ),
            'dropdown_options' => array(
                'name' => __('Dropdown choices',  'inbound-pro' ),
                'desc' => __('Enter Your Dropdown Options. Separate by commas. You may also use label|value to have a different value than the label stored.',  'inbound-pro' ),
                'type' => 'text',
                'std' => '',
                'placeholder' => __('Choice 1|a, Choice 2, Choice 3' , 'inbound-pro' ),
                'reveal_on' => 'dropdown' // on select choice show this
            ),
            'radio_options' => array(
                'name' => __('Radio Choices',  'inbound-pro' ),
                'desc' => __('Enter Your Radio Options. Separate by commas. You may also use label|value to have a different value than the label stored.',  'inbound-pro' ),
                'type' => 'text',
                'std' => '',
                'placeholder' => 'Choice 1|a, Choice 2',
                'reveal_on' => 'radio' // on select choice show this
            ),
            'checkbox_options' => array(
                'name' => __('Checkbox choices',  'inbound-pro' ),
                'desc' => __('Enter Your Checkbox Options. Separate by commas. You may also use label|value to have a different value than the label stored.',  'inbound-pro' ),
                'type' => 'text',
                'std' => '',
                'placeholder' => __( 'Choice 1|a, Choice 2, Choice 3', 'inbound-pro' ),
                'reveal_on' => 'checkbox' // on select choice show this
            ),
            'html_block_options' => array(
                'name' => __('HTML Block',  'inbound-pro' ),
                'desc' => __('This is a raw HTML block in the form. Insert text/HTML',  'inbound-pro' ),
                'type' => 'textarea',
                'std' => '',
                'reveal_on' => 'html-block' // on select choice show this
            ),
            'range_options' => array(
                'name' => __('Range Setup',  'inbound-pro' ),
                'desc' => __('Enter the min, max, and steps inside the range input. Separate each with a pipe, eg: min|max|steps',  'inbound-pro' ),
                'type' => 'text',
                'std' => '',
                'placeholder' => __('0|100|10' , 'inbound-pro' ),
                'reveal_on' => 'range' // on select choice show this
            ),
            'default_value' => array(
                'name' => __('Default Value',  'inbound-pro' ),
                'desc' => __('Enter the Default Value',  'inbound-pro' ),
                'type' => 'text',
                'std' => '',
                'placeholder' => 'Enter Default Value',
                'reveal_on' => 'hidden' // on select choice show this
            ),
            'divider_options' => array(
                'name' => __('Divider Text (optional)',  'inbound-pro' ),
                'desc' => __('This is the text in the divider',  'inbound-pro' ),
                'type' => 'text',
                'std' => '',
                'reveal_on' => 'divider' // on select choice show this
            ),
            'required' => array(
                'name' => __('Required Field? <span class="small-optional-text">(optional)</span>', 'inbound-pro' ),
                'checkbox_text' => __('Check to make field required', 'inbound-pro' ),
                'desc' => '',
                'type' => 'checkbox',
                'std' => '0',
                'class' => '',
            ),
            'helper' => array(
                'name' => __('Field Description <span class="small-optional-text">(optional)</span>',  'inbound-pro' ),
                'desc' => __('<span class="show-advanced-fields button">Show advanced options</span>',  'inbound-pro' ),
                'type' => 'helper-block',
                'std' => '',
                'class' => '',
            ),
            'exclude_tracking' => array(
                'name' => __('Exclude Tracking? <span class="small-optional-text">(optional)</span>', 'inbound-pro' ),
                'checkbox_text' => __('Check to exclude this form field from being tracked. Note this will not store in your Database', 'inbound-pro' ),
                'desc' => '',
                'type' => 'checkbox',
                'std' => '0',
                'class' => 'advanced',
            ),
            'placeholder' => array(
                'name' => __('Field Placeholder <span class="small-optional-text">(optional)</span>',  'inbound-pro' ),
                'desc' => __('Put field placeholder text here. Only works for normal text inputs',  'inbound-pro' ),
                'type' => 'text',
                'std' => '',
                'class' => 'advanced',
            ),
            'description' => array(
                'name' => __('Field Description <span class="small-optional-text">(optional)</span>',  'inbound-pro' ),
                'desc' => __('Put field description here.',  'inbound-pro' ),
                'type' => 'textarea',
                'std' => '',
                'class' => 'advanced',
            ),
            'field_container_class' => array(
                'name' => __('Field Container Classes <span class="small-optional-text">(optional)</span>',  'inbound-pro' ),
                'desc' => __('Add additional class ids to the div that contains this field. Separate classes with spaces.',  'inbound-pro' ),
                'type' => 'text',
                'std' => '',
                'class' => 'advanced',
            ),
            'field_input_class' => array(
                'name' => __('Field Input Classes <span class="small-optional-text">(optional)</span>',  'inbound-pro' ),
                'desc' => __('Add additional class ids to this input field. Separate classes with spaces.',  'inbound-pro' ),
                'type' => 'text',
                'std' => '',
                'class' => 'advanced',
            ),

            'hidden_input_options' => array(
                'name' => __('Dynamic Field Filling <span class="small-optional-text">(optional)</span>',  'inbound-pro' ),
                'desc' => __('Enter Your Dynamic URL parameter',  'inbound-pro' ),
                'type' => 'text',
                'std' => '',
                'placeholder' => 'enter dynamic url parameter example: utm_campaign ',
                'class' => 'advanced',
                //'reveal_on' => 'hidden' // on select choice show this
            )
        ),
        'shortcode' => '[inbound_field label="{{label}}" type="{{field_type}}" description="{{description}}" required="{{required}}" exclude_tracking={{exclude_tracking}} dropdown="{{dropdown_options}}" radio="{{radio_options}}"  checkbox="{{checkbox_options}}"  range="{{range_options}}" placeholder="{{placeholder}}" field_container_class="{{field_container_class}}"  field_input_class="{{field_input_class}}" html="{{html_block_options}}" dynamic="{{hidden_input_options}}" default="{{default_value}}" map_to="{{map_to}}" divider_options="{{divider_options}}"]',
        'clone' => __('Add Another Field',  'inbound-pro' )
    ),
    'shortcode' => '[inbound_form name="{{form_name}}" lists="{{lists_hidden}}" tags="{{tags_hidden}}" redirect="{{redirect}}" notify="{{notify}}" notify_subject="{{notify_subject}}" layout="{{layout}}" font_size="{{font-size}}"  labels="{{labels}}" icon="{{icon}}" submit="{{submit}}" submit="{{submit}}" submit_colors="{{submit-colors}}" submit_text_color="{{submit-text-color}}" submit_bg_color="{{submit-bg-color}}" custom_class="{{custom-class}}" width="{{width}}"]{{child}}[/inbound_form]',
    'popup_title' => 'Insert Inbound Form Shortcode'
);

/* CPT Lead Lists */
add_action('init', 'inbound_forms_cpt',11);
if (!function_exists('inbound_forms_cpt')) {
    function inbound_forms_cpt() {
        //echo $slug;exit;
        $labels = array(
            'name' => _x('Inbound Forms' , 'inbound-pro'),
            'singular_name' => _x('Form' , 'inbound-pro'),
            'add_new' => _x('Add New', 'Form'),
            'add_new_item' => __('Create New Form' , 'inbound-pro'),
            'edit_item' => __('Edit Form' , 'inbound-pro'),
            'new_item' => __('New Form' , 'inbound-pro'),
            'view_item' => __('View Form' , 'inbound-pro'),
            'search_items' => __('Search Forms' , 'inbound-pro'),
            'not_found' =>  __('Nothing found' , 'inbound-pro'),
            'not_found_in_trash' => __('Nothing found in Trash' , 'inbound-pro'),
            'parent_item_colon' => ''
        );

        $args = array(
            'labels' => $labels,
            'public' => false,
            'publicly_queryable' => false,
            'show_ui' => true,
            'query_var' => true,
            'show_in_menu'  => true,
            'capability_type' => array('inbound-form','inbound-forms'),
            'map_meta_cap' => true,
            'hierarchical' => false,
            'menu_position' => 34,
            'supports' => array('title','custom-fields', 'editor')
        );

        register_post_type( 'inbound-forms' , $args );
        //flush_rewrite_rules( false );

        /*
        add_action('admin_menu', 'remove_list_cat_menu');
        function remove_list_cat_menu() {
            global $submenu;
            unset($submenu['edit.php?post_type=wp-lead'][15]);
            //print_r($submenu); exit;
        }*/
    }

    /**
     * Register Role Capabilities
     */
    add_action( 'admin_init' , 'inbound_register_form_role_capabilities' ,999);
    function inbound_register_form_role_capabilities() {
        // Add the roles you'd like to administer the custom post types
        $roles = array('inbound_marketer','administrator');

        // Loop through each role and assign capabilities
        foreach($roles as $the_role) {

            $role = get_role($the_role);
            if (!$role) {
                continue;
            }

            $role->add_cap( 'read' );
            $role->add_cap( 'read_inbound-form');
            $role->add_cap( 'read_private_inbound-forms' );
            $role->add_cap( 'edit_inbound-form' );
            $role->add_cap( 'edit_inbound-forms' );
            $role->add_cap( 'edit_others_inbound-forms' );
            $role->add_cap( 'edit_published_inbound-forms' );
            $role->add_cap( 'publish_inbound-form' );
            $role->add_cap( 'delete_inbound-form' );
            $role->add_cap( 'delete_inbound-forms' );
            $role->add_cap( 'delete_others_inbound-forms' );
            $role->add_cap( 'delete_private_inbound-forms' );
            $role->add_cap( 'delete_published_inbound-forms' );
        }
    }
}


if (is_admin()) {
    // Change the columns for the edit CPT screen
    add_filter( "manage_inbound-forms_posts_columns", "inbound_forms_change_columns" );
    if (!function_exists('inbound_forms_change_columns')) {
        function inbound_forms_change_columns( $cols ) {
            $cols = array(
                "cb" => "<input type=\"checkbox\" />",
                'title' => "Form Name",
                "inbound-form-shortcode" => "Shortcode",
                "inbound-form-converions" => "Conversion Count",
                "date" => "Date"
            );
            return $cols;
        }
    }

    add_action( "manage_posts_custom_column", "inbound_forms_custom_columns", 10, 2 );
    if (!function_exists('inbound_forms_custom_columns')) {
        function inbound_forms_custom_columns( $column, $post_id )
        {
            switch ( $column ) {

                case "inbound-form-shortcode":
                    $shortcode = get_post_meta( $post_id , 'inbound_shortcode', true );
                    $form_name = get_the_title( $post_id );
                    if ($shortcode == "") {
                        $shortcode = 'N/A';
                    }

                    echo '<input type="text" onclick="select()" class="regular-text code short-shortcode-input" readonly="readonly" id="shortcode" name="shortcode" value=\'[inbound_forms id="'.$post_id.'" name="'.$form_name.'"]\'>';
                    break;
                case "inbound-form-converions":
                    $count = get_post_meta( $post_id, 'inbound_form_conversion_count', true);
                    if (get_post_meta( $post_id, 'inbound_form_conversion_count', true) == "") {
                        $count = 'N/A';
                    }
                    echo $count;
                    break;
            }
        }
    }
}

add_action('admin_head', 'inbound_get_form_names',16);
if (!function_exists('inbound_get_form_names')) {
    function inbound_get_form_names() {
        global $post;

        $loop = get_transient( 'inbound-form-names' );
        if ( false === $loop ) {
            $args = array(
                'posts_per_page'  => -1,
                'post_type'=> 'inbound-forms');
            $form_list = get_posts($args);
            $form_array = array();

            foreach ( $form_list as $form ) {
                $this_id = $form->ID;
                $this_link = get_permalink( $this_id );
                $title = $form->post_title;
                $form_array['form_' . $this_id] = $title;

            }

            set_transient('inbound-form-names', $form_array, 24 * HOUR_IN_SECONDS);
        }

    }
}

add_action('save_post', 'inbound_form_delete_transient', 10, 2);
add_action('edit_post', 'inbound_form_delete_transient', 10, 2);
add_action('wp_insert_post', 'inbound_form_delete_transient', 10, 2);
if (!function_exists('inbound_form_delete_transient')) {
    // Refresh transient
    function inbound_form_delete_transient($post_id){

        if(get_post_type( $post_id ) != 'inbound-forms') {
            return;
        }

        delete_transient('inbound-form-names');
        inbound_get_form_names();

    }
}

if (!function_exists('inbound_form_save')) {
    /*  Shortcode moved to shared form class */
    add_action('wp_ajax_inbound_form_save', 'inbound_form_save');

    function inbound_form_save() {

        global $user_ID, $wpdb;
        $check_nonce = wp_verify_nonce( $_POST['nonce'], 'inbound-shortcode-nonce' );
        if( !$check_nonce ) {
            exit;
        }

        /* Post Values */
        $form_name = (isset( $_POST['name'] )) ? $_POST['name'] : "";
        $shortcode = (isset( $_POST['shortcode'] )) ? $_POST['shortcode'] : "";
        $form_settings =  (isset( $_POST['form_settings'] )) ? $_POST['form_settings'] : "";
        $form_values =  (isset( $_POST['form_values'] )) ? $_POST['form_values'] : "";
        $field_count =  (isset( $_POST['field_count'] )) ? $_POST['field_count'] : "";
        $page_id = (isset( $_POST['post_id'] )) ? $_POST['post_id'] : "";
        $post_type = (isset( $_POST['post_type'] )) ? $_POST['post_type'] : "";
        $redirect_value = (isset( $_POST['redirect_value'] )) ? $_POST['redirect_value'] : "";
        $notify_email = (isset( $_POST['notify_email'] )) ? $_POST['notify_email'] : "";
        $notify_email_subject = (isset( $_POST['notify_email_subject'] )) ? $_POST['notify_email_subject'] : "";
        $email_contents = (isset( $_POST['email_contents'] )) ? $_POST['email_contents'] : "";
        $send_email = (isset( $_POST['send_email'] )) ? $_POST['send_email'] : "off";
        $send_email_template = (isset( $_POST['send_email_template'] )) ? $_POST['send_email_template'] : "custom";
        $send_subject = (isset( $_POST['send_subject'] )) ? $_POST['send_subject'] : "off";

        if ($post_type === 'inbound-forms'){
            $post_ID = $page_id;
            $update_post = array(
                'ID'           => $post_ID,
                'post_title'   => $form_name,
                'post_status'       => 'publish',
                'post_content' => $email_contents
            );
            wp_update_post( $update_post );
            $form_settings_data = get_post_meta( $post_ID, 'form_settings', TRUE );
            update_post_meta( $post_ID, 'inbound_form_settings', $form_settings );
            update_post_meta( $post_ID, 'inbound_form_created_on', $page_id );
            $shortcode = str_replace("[inbound_form", "[inbound_form id=\"" . $post_ID . "\"", $shortcode);
            update_post_meta( $post_ID, 'inbound_shortcode', $shortcode );
            update_post_meta( $post_ID, 'inbound_form_values', $form_values );
            update_post_meta( $post_ID, 'inbound_form_field_count', $field_count );
            update_post_meta( $post_ID, 'inbound_redirect_value', $redirect_value );
            update_post_meta( $post_ID, 'inbound_notify_email', $notify_email );
            update_post_meta( $post_ID, 'inbound_notify_email_subject', $notify_email_subject );
            update_post_meta( $post_ID, 'inbound_email_send_notification', $send_email );
            update_post_meta( $post_ID, 'inbound_email_send_notification_template', $send_email_template );
            update_post_meta( $post_ID, 'inbound_confirmation_subject', $send_subject );

            $output =  array('post_id'=> $post_ID,
                'form_name'=>$form_name,
                'redirect' => $redirect_value);

            echo json_encode($output,JSON_FORCE_OBJECT);
            wp_die();
        } else {

            // If from popup run this
            $query = $wpdb->prepare(
                'SELECT ID FROM ' . $wpdb->posts . '
                WHERE post_title = %s
                AND post_type = \'inbound-forms\'',
                $form_name
            );
            $wpdb->query( $query );

            // If form exists
            if ( $wpdb->num_rows ) {
                $post_ID = $wpdb->get_var( $query );

                if ($post_ID != $page_id) {
                    // if form name exists already in popup mode
                    echo json_encode("Found");
                    exit;
                } else {
                    update_post_meta( $post_ID, 'inbound_form_settings', $form_settings );
                    update_post_meta( $post_ID, 'inbound_form_created_on', $page_id );
                    update_post_meta( $post_ID, 'inbound_shortcode', $shortcode );
                    update_post_meta( $post_ID, 'inbound_form_values', $form_values );
                    update_post_meta( $post_ID, 'inbound_form_field_count', $field_count );
                    update_post_meta( $post_ID, 'inbound_redirect_value', $redirect_value );
                    update_post_meta( $post_ID, 'inbound_notify_email', $notify_email );
                    update_post_meta( $post_ID, 'inbound_notify_email_subject', $notify_email_subject );
                    update_post_meta( $post_ID, 'inbound_email_send_notification', $send_email );
                    update_post_meta( $post_ID, 'inbound_email_send_notification_template', $send_email_template );
                    update_post_meta( $post_ID, 'inbound_confirmation_subject', $send_subject );
                }

            } else {

                // If form doesn't exist create it
                $post = array(
                    'post_title'        => $form_name,
                    'post_content' => $email_contents,
                    'post_status'       => 'publish',
                    'post_type'     => 'inbound-forms',
                    'post_author'       => 1
                );

                $post_ID = wp_insert_post($post);
                update_post_meta( $post_ID, 'inbound_form_settings', $form_settings );
                update_post_meta( $post_ID, 'inbound_form_created_on', $page_id );
                update_post_meta( $post_ID, 'inbound_shortcode', $shortcode );
                update_post_meta( $post_ID, 'inbound_form_values', $form_values );
                update_post_meta( $post_ID, 'inbound_form_field_count', $field_count );
                update_post_meta( $post_ID, 'inbound_redirect_value', $redirect_value );
                update_post_meta( $post_ID, 'inbound_notify_email', $notify_email );
                update_post_meta( $post_ID, 'inbound_notify_email_subject', $notify_email_subject );
                update_post_meta( $post_ID, 'inbound_email_send_notification', $send_email );
                update_post_meta( $post_ID, 'inbound_email_send_notification_template', $send_email_template );
                update_post_meta( $post_ID, 'inbound_confirmation_subject', $send_subject );
            }
            $shortcode = str_replace("[inbound_form", "[inbound_form id=\"" . $post_ID . "\"", $shortcode);
            update_post_meta( $post_ID, 'inbound_shortcode', $shortcode );

            inbound_form_delete_transient( $post_ID );


            $output =  array('post_id'=> $post_ID,
                'form_name'=>$form_name,
                'redirect' => $redirect_value);

            echo json_encode($output,JSON_FORCE_OBJECT);
            wp_die();
        }
    }
}

add_filter( 'default_content', 'inbound_forms_default_content', 10, 2 );
if (!function_exists('inbound_forms_default_content')) {
    function inbound_forms_default_content( $content, $post ) {
        if (!isset($post))
            return;
        if( $post->post_type === 'inbound-forms' ) {

            $content = 'This is the email response. Do not use shortcodes or forms here. They will not work in this email setup component. (Delete this text)';

        }

        return $content;
    }
}

/*  Shortcode moved to shared form class */
if (!function_exists('inbound_form_get_data')) {
    add_action('wp_ajax_inbound_form_get_data', 'inbound_form_get_data');

    function inbound_form_get_data()
    {
        // Post Values
        $post_ID = (isset( $_POST['form_id'] )) ? $_POST['form_id'] : "";

        if (isset( $_POST['form_id'])&&!empty( $_POST['form_id']))
        {
            $check_nonce = wp_verify_nonce( $_POST['nonce'], 'inbound-shortcode-nonce' );
            if( !$check_nonce ) {
                //echo json_encode("Found");
                exit;
            }

            $form_settings_data = get_post_meta( $post_ID, 'inbound_form_settings', TRUE );
            $field_count = get_post_meta( $post_ID, 'inbound_form_field_count', TRUE );
            $shortcode = get_post_meta( $post_ID, 'inbound_shortcode', TRUE );
            $inbound_form_values = get_post_meta( $post_ID, 'inbound_form_values', TRUE );


            /**get stored email response info. Mainly used when selecting a form starting template**/
            $send_email = get_post_meta( $post_ID, 'inbound_email_send_notification', true);//yes/no select send response email
            $send_email = '&inbound_email_send_notification=' . $send_email;//format the data into a string which fill_form_fields() over in shortcodes.js will use to fill in the field

            $email_template_id = get_post_meta( $post_ID, 'inbound_email_send_notification_template', true );// email template id, or 'custom' email flag

            /*if a custom email response is to be used, custom will be true*/
            if($email_template_id == 'custom'){
                $content = get_post($post_ID); //the email is contained in the post content
                $content = $content->post_content;
                $custom_email_response = '&content=' . $content;

                $custom_email_subject = get_post_meta( $post_ID, 'inbound_confirmation_subject', true ); //the subject is in the meta
                $custom_email_subject = '&inbound_confirmation_subject=' . $custom_email_subject;
            }else{
                $custom_email_response = '';
                $custom_email_subject = '';
            }

            $email_template_id = '&inbound_email_send_notification_template=' . $email_template_id;

            /*concatenate into a big string and add it to $inbound_form_values*/
            $inbound_form_values .= ($send_email . $email_template_id . $custom_email_response . $custom_email_subject);


            $output =  array('inbound_shortcode'=> $shortcode,
                'field_count'=>$field_count,
                'form_settings_data' => $form_settings_data,
                'field_values'=>$inbound_form_values);

            echo json_encode($output,JSON_FORCE_OBJECT);

        }
        wp_die();
    }
}

if (!function_exists('inbound_form_auto_publish')) {
    /*  Shortcode moved to shared form class */
    add_action('wp_ajax_inbound_form_auto_publish', 'inbound_form_auto_publish');
    //add_action('wp_ajax_nopriv_inbound_form_auto_publish', 'inbound_form_auto_publish');

    function inbound_form_auto_publish()
    {
        // Post Values
        $post_ID = (isset( $_POST['post_id'] )) ? $_POST['post_id'] : "";
        $post_title = (isset( $_POST['post_title'] )) ? $_POST['post_title'] : "";

        if (isset( $_POST['post_id'])&&!empty( $_POST['post_id']))
        {
            // Update Post status to published immediately
            // Update post 37
            $my_post = array(
                'ID'           => $post_ID,
                'post_title'   => $post_title,
                'post_status'  => 'publish'
            );

            // Update the post into the database
            wp_update_post( $my_post );
        }
        wp_die();
    }
}

if (!function_exists('inbound_form_add_lead_list')) {

    add_action('wp_ajax_inbound_form_add_lead_list', 'inbound_form_add_lead_list');

    function inbound_form_add_lead_list()
    {
        if(isset($_POST['list_val']) && !empty($_POST['list_val'])){

            $list_title = $_POST['list_val'];

            $taxonomy = 'wplead_list_category';

            $list_parent = $_POST['list_parent_val'];

            $term_array = wp_insert_term( $list_title, $taxonomy, $args = array('parent' => $list_parent) );

            if($term_array['term_id']){

                $term_id = $term_array['term_id'];

                $term = get_term( $term_id, $taxonomy );

                $name = $term->name;

                $response_arr = array('status' => true, 'term_id' => $term_id, 'name' => $name);

            } else {

                $response_arr = array('status' => false);
            }

            echo json_encode($response_arr);

        }

        wp_die();
    }
}
Inbound Pro Plugin - PHP Codex API documentation generated by ApiGen