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:  821:  822:  823:  824:  825:  826:  827:  828:  829:  830:  831:  832:  833:  834:  835:  836:  837:  838:  839:  840:  841:  842:  843:  844:  845:  846:  847:  848:  849:  850:  851:  852:  853:  854:  855:  856:  857:  858:  859:  860:  861:  862:  863:  864:  865:  866:  867:  868:  869:  870:  871:  872:  873:  874:  875:  876:  877:  878:  879:  880:  881:  882:  883:  884:  885:  886:  887:  888:  889:  890:  891:  892:  893:  894:  895:  896:  897:  898:  899:  900:  901:  902:  903:  904:  905:  906:  907:  908:  909:  910:  911:  912:  913:  914:  915:  916:  917:  918:  919:  920:  921:  922:  923:  924:  925:  926:  927:  928:  929:  930:  931:  932:  933:  934:  935:  936:  937:  938:  939:  940:  941:  942:  943:  944:  945:  946:  947:  948:  949:  950:  951:  952:  953:  954:  955:  956:  957:  958:  959:  960:  961:  962:  963:  964:  965:  966:  967:  968:  969:  970:  971:  972:  973:  974:  975:  976:  977:  978:  979:  980:  981:  982:  983:  984:  985:  986:  987:  988:  989:  990:  991:  992:  993:  994:  995:  996:  997:  998:  999: 1000: 1001: 1002: 1003: 1004: 1005: 1006: 1007: 1008: 1009: 1010: 1011: 1012: 1013: 1014: 1015: 1016: 1017: 1018: 1019: 1020: 1021: 1022: 1023: 1024: 1025: 1026: 1027: 1028: 1029: 1030: 1031: 1032: 1033: 1034: 1035: 1036: 1037: 1038: 1039: 1040: 1041: 1042: 1043: 1044: 1045: 1046: 1047: 1048: 1049: 1050: 1051: 1052: 1053: 1054: 1055: 1056: 1057: 1058: 1059: 1060: 1061: 1062: 1063: 1064: 1065: 1066: 1067: 1068: 1069: 1070: 1071: 1072: 1073: 1074: 1075: 1076: 1077: 1078: 1079: 1080: 1081: 1082: 1083: 1084: 1085: 1086: 1087: 1088: 1089: 1090: 1091: 1092: 1093: 1094: 1095: 1096: 1097: 1098: 1099: 1100: 1101: 1102: 1103: 1104: 1105: 1106: 1107: 1108: 1109: 1110: 1111: 1112: 1113: 1114: 1115: 1116: 1117: 1118: 1119: 1120: 1121: 1122: 1123: 1124: 1125: 1126: 1127: 1128: 1129: 1130: 1131: 1132: 1133: 1134: 1135: 1136: 1137: 1138: 1139: 1140: 1141: 1142: 1143: 1144: 1145: 1146: 1147: 1148: 1149: 1150: 1151: 1152: 1153: 1154: 1155: 1156: 1157: 1158: 1159: 1160: 1161: 1162: 1163: 1164: 1165: 1166: 1167: 1168: 1169: 1170: 1171: 1172: 1173: 1174: 1175: 1176: 1177: 1178: 1179: 1180: 1181: 1182: 1183: 1184: 1185: 1186: 1187: 1188: 1189: 1190: 1191: 1192: 1193: 1194: 1195: 1196: 1197: 1198: 1199: 1200: 1201: 1202: 1203: 1204: 1205: 1206: 1207: 1208: 1209: 1210: 1211: 1212: 1213: 1214: 1215: 1216: 1217: 1218: 1219: 1220: 1221: 1222: 1223: 1224: 1225: 1226: 1227: 1228: 1229: 1230: 1231: 1232: 1233: 1234: 1235: 1236: 1237: 1238: 1239: 1240: 1241: 1242: 1243: 1244: 1245: 1246: 1247: 1248: 1249: 1250: 1251: 1252: 1253: 1254: 1255: 1256: 1257: 1258: 1259: 1260: 1261: 1262: 1263: 1264: 1265: 1266: 1267: 1268: 1269: 1270: 1271: 1272: 1273: 1274: 1275: 1276: 1277: 1278: 1279: 1280: 1281: 1282: 1283: 1284: 1285: 1286: 1287: 1288: 1289: 1290: 1291: 1292: 1293: 1294: 1295: 1296: 1297: 1298: 1299: 1300: 1301: 1302: 1303: 1304: 1305: 1306: 1307: 1308: 1309: 1310: 1311: 1312: 1313: 1314: 1315: 1316: 1317: 1318: 1319: 1320: 1321: 1322: 1323: 1324: 1325: 1326: 1327: 1328: 1329: 1330: 1331: 1332: 1333: 1334: 1335: 1336: 1337: 1338: 1339: 1340: 1341: 1342: 1343: 1344: 1345: 1346: 1347: 1348: 1349: 1350: 1351: 1352: 1353: 1354: 1355: 1356: 1357: 1358: 1359: 1360: 1361: 1362: 1363: 1364: 1365: 1366: 1367: 1368: 1369: 1370: 1371: 1372: 1373: 1374: 1375: 1376: 1377: 1378: 1379: 1380: 1381: 1382: 1383: 1384: 1385: 1386: 1387: 1388: 1389: 1390: 1391: 1392: 1393: 1394: 1395: 1396: 1397: 1398: 1399: 1400: 1401: 1402: 1403: 1404: 1405: 1406: 1407: 1408: 1409: 1410: 1411: 1412: 1413: 1414: 1415: 1416: 1417: 1418: 1419: 1420: 1421: 1422: 1423: 1424: 1425: 1426: 1427: 1428: 1429: 1430: 1431: 1432: 1433: 1434: 1435: 1436: 1437: 1438: 1439: 1440: 1441: 1442: 1443: 1444: 1445: 1446: 1447: 1448: 1449: 1450: 1451: 1452: 1453: 1454: 1455: 1456: 1457: 1458: 1459: 1460: 1461: 1462: 1463: 1464: 1465: 1466: 1467: 1468: 1469: 1470: 1471: 1472: 1473: 1474: 1475: 1476: 1477: 1478: 1479: 1480: 1481: 1482: 1483: 1484: 1485: 1486: 1487: 1488: 1489: 1490: 1491: 1492: 1493: 1494: 1495: 1496: 1497: 1498: 1499: 1500: 1501: 1502: 1503: 1504: 1505: 1506: 1507: 1508: 1509: 1510: 1511: 1512: 1513: 1514: 1515: 1516: 1517: 1518: 1519: 1520: 1521: 1522: 1523: 1524: 1525: 1526: 1527: 1528: 1529: 1530: 1531: 1532: 1533: 1534: 1535: 1536: 1537: 1538: 1539: 1540: 1541: 1542: 1543: 1544: 1545: 1546: 1547: 1548: 1549: 1550: 1551: 1552: 1553: 1554: 1555: 1556: 1557: 1558: 1559: 1560: 1561: 
<?php
/**
 * Class for managing Inbound Pro core and extension settings. Also powers welcome page.
 * @package     InboundPro
 * @subpackage  Settings
 */

class Inbound_Pro_Settings {
    static $tab; /* placeholder for page currently opened */
    static $settings_fields; /* configuration dataset */
    static $settings_values; /* configuration dataset */

    /**
     *  Load hooks and listners
     */
    public static function init() {
        self::$tab = (isset($_GET['tab'])) ? sanitize_text_field($_GET['tab']) : 'inbound-pro-setup';
        self::activation_redirect();
        self::add_hooks();
    }


    /**
     *  Loads hooks and filters
     */
    public static function add_hooks() {

        /* add listener for importing settings from json file */
        add_action( 'admin_init' , array( __CLASS__ , 'import_settings_from_json' ) );

        /* enqueue js and css */
        add_action( 'admin_enqueue_scripts' , array( __CLASS__ , 'enqueue_scripts' ) );

        /* add ajax listener for setting saves */
        add_action( 'wp_ajax_inbound_pro_update_setting' , array( __CLASS__ , 'ajax_update_settings' ) );

        /* add ajax listener for custom fields setting saves */
        add_action( 'wp_ajax_inbound_pro_update_custom_fields' , array( __CLASS__ , 'ajax_update_custom_fields' ) );

        /* add ajax listener for custom fields setting saves */
        add_action( 'wp_ajax_inbound_pro_update_lead_statuses' , array( __CLASS__ , 'ajax_update_lead_statuses' ) );

        /* add ajax listener for IP Addresses setting saves */
        add_action( 'wp_ajax_inbound_pro_update_ip_addresses' , array( __CLASS__ , 'ajax_update_ip_addresses' ) );

        /* add ajax listener for export inbound now settings */
        add_action( 'wp_ajax_inbound_pro_export_settings' , array( __CLASS__ , 'ajax_export_settings' ) );

        /* listen for fast ajax installation */
        add_action( 'inbound-settings/after-field-value-update' , array( __CLASS__ , 'ajax_toggle_fast_ajax' ) , 10 , 1 );
    }

    /**
     *  Enqueue scripts & stylesheets
     */
    public static function enqueue_scripts() {
        global $inbound_settings;

        $screen = get_current_screen();

        $counts = array();
        $counts['extensions'] = (isset($inbound_settings['system']['counts']['needs-update']['extensions'])) ? $inbound_settings['system']['counts']['needs-update']['extensions'] : 0;
        $counts['templates'] = (isset($inbound_settings['system']['counts']['needs-update']['templates'])) ? $inbound_settings['system']['counts']['needs-update']['templates'] : 0;

        /* load wp-admin global js & css */
        wp_enqueue_style('inbound-wp-admin', INBOUND_PRO_URLPATH . 'assets/css/admin/wp-admin.css');
        wp_enqueue_script('inbound-wp-admin', INBOUND_PRO_URLPATH . 'assets/js/admin/wp-admin.js', array('jquery') );
        wp_localize_script('inbound-wp-admin', 'inboundWPAdmin' ,  array('counts' =>  $counts , 'tb_hide_nav' =>  (isset($_GET['tb_hide_nav']) && $_GET['tb_hide_nav'] == 'true') ? true : false ) );

        /* Load assets for inbound pro page */
        if (isset($screen) && $screen->base != 'toplevel_page_inbound-pro' ){
            return;
        }

        wp_enqueue_script('jquery');
        wp_enqueue_script('jquery-ui-sortable');
        wp_enqueue_script('modernizr');
        wp_enqueue_script('underscore');
        add_thickbox();

        /* load shuffle.js */
        wp_enqueue_script('shuffle', INBOUND_PRO_URLPATH . 'assets/libraries/Shuffle/jquery.shuffle.modernizr.min.js' , array( 'jquery') );

        /* load jquery minicolors.js */
        wp_enqueue_script('minicolors', INBOUND_PRO_URLPATH . 'assets/libraries/MiniColors/jquery.minicolors.js' , array( 'jquery') );
        wp_enqueue_style('minicolors', INBOUND_PRO_URLPATH . 'assets/libraries/MiniColors/jquery.minicolors.css');

        /* load custom CSS & JS for inbound pro welcome */
        wp_enqueue_style('inbound-settings', INBOUND_PRO_URLPATH . 'assets/css/admin/settings.css');
        wp_enqueue_script('inbound-settings', INBOUND_PRO_URLPATH . 'assets/js/admin/settings.js', array('jquery', 'jquery-ui-sortable') );
        wp_localize_script('inbound-settings', 'inboundSettingsLocalVars' ,  array('apiURL' => Inbound_API_Wrapper::get_api_url() , 'siteURL' => site_url() , 'inboundProURL' => INBOUND_PRO_URLPATH ) );

        /* load Ink */
        wp_enqueue_style('Ink', INBOUND_PRO_URLPATH . 'assets/libraries/Ink/css/ink-flex.min.css');

        /* Load selective bootstrap */
        wp_enqueue_style('bootstrap-tooltip', INBOUNDNOW_SHARED_URLPATH . 'assets/includes/BootStrap/css/tooltip.min.css');
        wp_enqueue_script('bootstrap-tooltip', INBOUNDNOW_SHARED_URLPATH . 'assets/includes/BootStrap/js/tooltip.min.js');

        /* load fontawesome */
        wp_enqueue_style('fontawesome', INBOUNDNOW_SHARED_URLPATH . 'assets/fonts/fontawesome/css/font-awesome.min.css');
    }

    /**
     *  Listens for the _inbound_pro_welcome transient and if it exists then redirect to the welcome page
     */
    public static function activation_redirect() {

        if ( get_transient('_inbound_pro_welcome') ) {
            $redirect = admin_url('admin.php?page=inbound-pro&tab=inbound-pro-welcome');
            header('Location: ' . $redirect);
            delete_transient( '_inbound_pro_welcome' );
            exit;
        }
    }

    /**
     *  Setup Core Settings
     */
    public static function extend_settings() {

        self::$settings_fields = array(
            'inbound-pro-setup' => array(
                /* add api key group to setup page */
                array(
                    'group_name' => 'api-key',
                    'keywords' => __('api key' , 'inbound-pro'),
                    'fields' => array (
                        array (
                            'id'    => 'api-key',
                            'type'  => 'api-key',
                            'default'   => '',
                            'placeholder'   => __( 'Enter api key here' , 'inbound-pro' ),
                            'options' => null,
                            'hidden' => false,
                            'reveal' => array(
                                'selector' => null ,
                                'value' => null
                            )
                        ),
                    ),
                ),

                /* add core plugin exclusion options */
                array(
                    'group_name' => 'inbound-core-loading',
                    'keywords' => __('activate,deactivate,enable,disable,turn off,turn on' , 'inbound-pro'),
                    'fields' => array (
                        array (
                            'id'    => 'load-core-comonents-header',
                            'type'  => 'header',
                            'default'   => __( 'Toggle Core Components On/Off' , 'inbound-pro' ),
                            'placeholder'   => null,
                            'options' => false,
                            'hidden' => false,
                            'reveal' => array(
                                'selector' => null ,
                                'value' => null
                            )
                        ),
                        array (
                            'id'    => 'toggle-landing-pages',
                            'type'  => 'radio',
                            'label' => __( 'Landing Pages' , 'inbound-pro' ),
                            'description'   => __( 'Toggle this off to stop loading Landing Pages component.' , 'inbound-pro' ),
                            'default'   => 'on',
                            'placeholder'   => null,
                            'options' => array(
                                'on' => __( 'On' , 'inbound-pro' ),
                                'off' => __( 'Off' , 'inbound-pro' ),
                            ),
                            'hidden' => false,
                            'reveal' => array(
                                'selector' => null ,
                                'value' => null
                            )
                        ),
                        array (
                            'id'    => 'toggle-calls-to-action',
                            'type'  => 'radio',
                            'label' => __( 'Calls to Action' , 'inbound-pro' ),
                            'description'   => __( 'Toggle this off to stop loading Calls to Action component.' , 'inbound-pro' ),
                            'default'   => 'on',
                            'placeholder'   => null,
                            'options' => array(
                                'on' => __( 'On' , 'inbound-pro' ),
                                'off' => __( 'Off' , 'inbound-pro' ),

                            ),
                            'hidden' => false,
                            'reveal' => array(
                                'selector' => null ,
                                'value' => null
                            )
                        ),
                        array (
                            'id'    => 'toggle-leads',
                            'type'  => 'radio',
                            'label' => __( 'Leads' , 'inbound-pro' ),
                            'description'   => __( 'Toggle this off to stop loading Leads component.' , 'inbound-pro' ),
                            'default'   => 'on',
                            'placeholder'   => null,
                            'options' => array(
                                'on' => __( 'On' , 'inbound-pro' ),
                                'off' => __( 'Off' , 'inbound-pro' ),

                            ),
                            'hidden' => false,
                            'reveal' => array(
                                'selector' => null ,
                                'value' => null
                            )
                        ),
                        array (
                            'id'    => 'toggle-email-automation',
                            'type'  => 'radio',
                            'label' => __( 'Mailer & Automation' , 'inbound-pro' ),
                            'description'   => __( 'Toggle this off to stop loading Mailer & Marketing Automation component. These components require an active pro membership.' , 'inbound-pro' ),
                            'default'   => 'on',
                            'placeholder'   => null,
                            'options' => array(
                                'on' => __( 'On' , 'inbound-pro' ),
                                'off' => __( 'Off' , 'inbound-pro' ),
                            ),
                            'hidden' => (INBOUND_ACCESS_LEVEL > 0 && INBOUND_ACCESS_LEVEL != 9  ? false : true ),
                            'reveal' => array(
                                'selector' => null ,
                                'value' => null
                            )
                        )
                    )
                ),
                /* add custom lead fields field group to setup page */
                array(
                    'group_name' => 'leads-custom-fields',
                    'keywords' => __('leads, field mapping, custom fields' , 'inbound-pro'),
                    'fields' => array (
                        array(
                            'id'  => 'header-lead-fields',
                            'type'  => 'header',
                            'default'  => __('Lead Field Management', 'inbound-pro' ),
                            'options' => null
                        ),
                        array (
                            'id'    => 'leads-custom-fields',
                            'type'  => 'custom-fields-repeater',
                            'default'   => '',
                            'placeholder'   => null,
                            'options' => null,
                            'hidden' => false,
                            'reveal' => array(
                                'selector' => null ,
                                'value' => null
                            )
                        ),
                    ),
                ),
                /* add custom lead fields field group to setup page */
                array(
                    'group_name' => 'lead-statuses',
                    'keywords' => __('labels,status,tags,fields' , 'inbound-pro'),
                    'fields' => array (
                        array (
                            'id'    => 'lead-statuses',
                            'type'  => 'lead-status-repeater',
                            'default'   => '',
                            'placeholder'   => null,
                            'options' => null,
                            'hidden' => false,
                            'reveal' => array(
                                'selector' => null ,
                                'value' => null
                            )
                        ),
                    ),
                ),
                /* add Analytics exclusion options */
                array(
                    'group_name' => 'inbound-analytics-rules',
                    'keywords' => __('analytics,tracking,ipaddress,ip address,admin tracking' , 'inbound-pro'),
                    'fields' => array (
                        array (
                            'id'    => 'analytics-header',
                            'type'  => 'header',
                            'default'   => __( 'Inbound Analytics' , 'inbound-pro' ),
                            'placeholder'   => null,
                            'options' => false,
                            'hidden' => false,
                            'reveal' => array(
                                'selector' => null ,
                                'value' => null
                            )
                        ),
                        array (
                            'id'    => 'page-tracking',
                            'type'  => 'radio',
                            'label' => __( 'Page Tracking' , 'inbound-pro' ),
                            'description'   => __( 'Turning this off will disable the visitor impression tracking engine. Does not affect impression recording for CTAs, Landing Pages, or Emails. Will affect lead visit statistics. This should not be turned off unless your server is experiencing resource shortage issues.' , 'inbound-pro' ),
                            'default'   => 'on',
                            'placeholder'   => null,
                            'options' => array(
                                'off' => __( 'Off' , 'inbound-pro' ),
                                'on' => __( 'On' , 'inbound-pro' ),
                            ),
                            'hidden' => false,
                            'reveal' => array(
                                'selector' => null ,
                                'value' => null
                            )
                        ),
                        array (
                            'id'    => 'admin-tracking',
                            'type'  => 'radio',
                            'label' => __( 'Admin Tracking' , 'inbound-pro' ),
                            'description'   => __( 'Toggle this to on to prevent impression/conversion tracking for logged in administrators.' , 'inbound-pro' ),
                            'default'   => 'on',
                            'placeholder'   => null,
                            'options' => array(
                                'off' => __( 'Off' , 'inbound-pro' ),
                                'on' => __( 'On' , 'inbound-pro' ),
                            ),
                            'hidden' => false,
                            'reveal' => array(
                                'selector' => null ,
                                'value' => null
                            )
                        ),
                        array (
                            'id'    => 'exclude-ip-addresses',
                            'type'  => 'ip-address-repeater',
                            'default'   => '',
                            'placeholder'   => null,
                            'options' => null,
                            'hidden' => false,
                            'reveal' => array(
                                'selector' => null ,
                                'value' => null
                            )
                        ),
                    ),
                ),
                /* add core plugin exclusion options */
                array(
                    'group_name' => 'inbound-acf',
                    'keywords' => __('advanced custom fields,acf' , 'inbound-pro'),
                    'fields' => array (
                        array (
                            'id'    => 'acf-header',
                            'type'  => 'header',
                            'default'   => __( 'ACF Options' , 'inbound-pro' ),
                            'placeholder'   => null,
                            'options' => false,
                            'hidden' => ( INBOUND_ACCESS_LEVEL > 0 && INBOUND_ACCESS_LEVEL != 9  ? false : true ),
                            'reveal' => array(
                                'selector' => null ,
                                'value' => null
                            )
                        ),
                        array (
                            'id'    => 'toggle-acf-lite',
                            'type'  => 'radio',
                            'label' => __( 'ACF Lite Mode' , 'inbound-pro' ),
                            'description'   => __( 'If you are presented with this option then ACF5 is being loaded. Turning Lite Mode to off will tell it to also load it\'s additional UI features.' , 'inbound-pro' ),
                            'default'   => 'on',
                            'placeholder'   => null,
                            'options' => array(
                                'on' => __( 'On' , 'inbound-pro' ),
                                'off' => __( 'Off' , 'inbound-pro' ),
                            ),
                            'hidden' => ( INBOUND_ACCESS_LEVEL > 0 && INBOUND_ACCESS_LEVEL != 9 ? false : true ),
                            'reveal' => array(
                                'selector' => null ,
                                'value' => null
                            )
                        )
                    ),
                ),
                /* add core plugin exclusion options */
                array(
                    'group_name' => 'inbound-fast-ajax',
                    'keywords' => __('ajax,speed,optimization' , 'inbound-pro'),
                    'fields' => array (
                        array (
                            'id'    => 'fast-ajax-header',
                            'type'  => 'header',
                            'default'   => __( 'Fast(er) Ajax' , 'inbound-pro' ),
                            'placeholder'   => null,
                            'options' => false,
                            'hidden' => false,
                            'reveal' => array(
                                'selector' => null ,
                                'value' => null
                            )
                        ),
                        array (
                            'id'    => 'toggle-fast-ajax',
                            'type'  => 'radio',
                            'label' => __( 'Enable Fast Ajax' , 'inbound-pro' ),
                            'description'   => __( 'Turning this feature will install a mu-plugin that Inbound Now will use to improve ajax response times. We recommend turning this on.' , 'inbound-pro' ),
                            'default'   => 'off',
                            'placeholder'   => null,
                            'options' => array(
                                'on' => __( 'On' , 'inbound-pro' ),
                                'off' => __( 'Off' , 'inbound-pro' ),
                            ),
                            'hidden' => false,
                            'reveal' => array(
                                'selector' => null ,
                                'value' => null
                            )
                        )
                    ),
                ),
                /* add custom lead fields field group to setup page */
                array(
                    'group_name' => 'translations',
                    'keywords' => __('translations,enable,disable,notifications' , 'inbound-pro'),
                    'fields' => array (
                        array(
                            'id'  => 'header-notifications',
                            'type'  => 'header',
                            'default'  => __('Translations', 'inbound-pro' ),
                            'options' => null
                        ),
                        array (
                            'id'    => 'toggle-translations',
                            'type'  => 'radio',
                            'label' => __( 'Enable Translations' , 'inbound-pro' ),
                            'description'   => __( 'Enabling this feature will tell Inbound Now to load translated strings if they are available.' , 'inbound-pro' ),
                            'default'   => 'off',
                            'placeholder'   => null,
                            'options' => array(
                                'on' => __( 'On' , 'inbound-pro' ),
                                'off' => __( 'Off' , 'inbound-pro' ),
                            ),
                            'hidden' => false,
                            'reveal' => array(
                                'selector' => null ,
                                'value' => null
                            )
                        ),
                        array (
                            'id'    => 'toggle-translations-updater',
                            'type'  => 'radio',
                            'label' => __( 'Translation Update Notifications' , 'inbound-pro' ),
                            'description'   => __( 'This is a consmetic feature that enables customers not to be notified when new trasnlation packages are available.' , 'inbound-pro' ),
                            'default'   => 'on',
                            'placeholder'   => null,
                            'options' => array(
                                'on' => __( 'On' , 'inbound-pro' ),
                                'off' => __( 'Off' , 'inbound-pro' ),
                            ),
                            'hidden' => false,
                            'reveal' => array(
                                'selector' => null ,
                                'value' => null
                            )
                        ),
                        array (
                            'id'    => 'translations-html',
                            'type'  => 'html',
                            'label' => __( 'Help Inbound Now Translate' , 'inbound-pro' ),
                            'description'   => sprintf( __( 'Click %shere%s to help improve the quality of Inbound Now translations.' , 'inbound-pro' ), '<a href="http://docs.inboundnow.com/guide/inbound-translations-project/">' , '</a>' ),
                        )
                    ),
                )
            )
        );

        self::$settings_fields = apply_filters( 'inbound_settings/extend' , self::$settings_fields );

    }

    /**
     *  Render Pro Display
     */
    public static function display() {

        ?>

        <div class="ink-grid">


            <?php
            self::display_nav_menu();

            echo '<section class="column-group gutters article">';

            switch ( self::$tab ) {
                case 'inbound-pro-welcome':
                    echo '<section class="xlarge-70 large-70 medium-60 small-100 tiny-100 welcome-screen-content">';
                    self::display_welcome();
                    echo '</section>';
                    echo '<section class="xlarge-30 large-30 medium-30 small-100 tiny-100">';
                    self::display_blog_posts();
                    self::display_social_ctas();
                    echo '</section>';
                    BREAK;
                case 'inbound-pro-settings':
                    echo '<section class="xlarge-70 large-70 medium-60 small-100 tiny-100 welcome-screen-content">';
                    self::display_settings();
                    echo '</section>';
                    echo '<section class="xlarge-30 large-30 medium-30 small-100 tiny-100">';
                    self::display_blog_posts();
                    self::display_social_ctas();
                    echo '</section>';
                    BREAK;
                case 'inbound-pro-import-export':
                    self::display_import_export();
                    BREAK;
                case 'inbound-pro-setup':
                    self::display_setup();
                    BREAK;
                case 'inbound-my-account':
                    self::display_setup();
                    BREAK;
            }
            echo '</section>';
            self::display_footer();
            ?>
        </div>
        <?php
    }

    /**
     *  Display Pro Welcome Screen
     */
    public static function display_welcome() {
        self::extend_settings();
        self::$settings_values = Inbound_Options_API::get_option( 'inbound-pro' , 'settings' , array() );

        ?>


        <h1><?php _e('Welcome to Inbound Pro ' . INBOUND_PRO_CURRENT_VERSION ,'inbound-pro'); ?></h1>

        <p><?php _e('Is this your first time? Please take a moment to review the sections below before getting started.','inbound-pro'); ?></p>

        <h2>Overview/Quick Links</h2>

        <ul class="features">
            <li><a href='https://www.inboundnow.com/inbound-analytics/' target="_blank"><?php _e('Inbound Analytics' , 'inbound-pro'); ?></a></li>
            <li><a href='https://www.inboundnow.com/landing-pages/' target="_blank"><?php _e('Landing Pages' , 'inbound-pro'); ?></a></li>
            <li><a href='https://www.inboundnow.com/cta/' target="_blank"><?php _e('Calls to Action' , 'inbound-pro'); ?></a></li>
            <li><a href='https://www.inboundnow.com/leads/' target="_blank"><?php _e('Leads' , 'inbound-pro'); ?></a></li>
            <li><a href='https://www.inboundnow.com/double-optin/' target="_blank"><?php _e('Double Optin' , 'inbound-pro'); ?></a></li>
            <li><a href='https://www.inboundnow.com/mailer/' target="_blank"><?php _e('Email Component' , 'inbound-pro'); ?></a></li>
            <li><a href='https://www.inboundnow.com/automation/' target="_blank"><?php _e('Marketing Automation' , 'inbound-pro'); ?></a></li>
        </ul>
        <h2>Inbound Pro API Key</h2>

        <p>Setting up your Inbound Pro API Key enables plugin updates and subscriber features. You can find your API Key inside the Inbound Now website's customer <a href="https://www.inboundnow.com/account/">account area</a>. </p>


        <h2>Tracking Controls</h2>
        <p>In your Inbound Pro Settings area you will see a new place where you can disable tracking on admin accounts and disable tracking by IP addresses.</p>

        <img class="size-full wp-image-138044" src="http://www.inboundnow.com/wp-content/uploads/2012/05/2015-10-13_1746.png" alt="Disable tracking by ip and admin"  />

        <h2>Creating Mappable Fields</h2>
        <p>In our current setup we have to use PHP code inserts to add non-native lead fields. Now we can do it straight from the settings area. We can also edit the labels of core fields and change the order they appear within a Lead Profile.</p>

        <img class="size-full wp-image-138045" src="http://www.inboundnow.com/wp-content/uploads/2012/05/2015-10-13_1748.png" alt="Add and edit mappable lead fields"  />

        <h2>Better Extension Management</h2>
        <p>It's now easier to work with extension settings. Quickly view installed extensions and jump right to their settings area at the click of a button. Uninstallation is easy too.</p>

        <img class="aligncenter size-full wp-image-138164" src="http://www.inboundnow.com/wp-content/uploads/2012/05/extension-settings.gif" alt="extension settings"  />


        <h2>SparkPost for Email</h2>

        <p>Inbound Pro's email component is currently provided by SparkPost. SparkPost provides it's users with 15,000 free sends a month and then an affordable rate their after. You can read more about SparkPost from their <a href="http://www.sparkpost.com" target="_blank">website</a>.</p>

        <h2>Subscribers Only: One click extension/theme installations</h2>

        <p>Our new Inbound Pro component will read the permissions of you API key and allow for one-click installations and uninstallations of all Inbound Now templates and plugins. </p>

        <img class="wp-image-138043 size-full" src="http://www.inboundnow.com/wp-content/uploads/2012/05/2015-10-13_1743.png" alt="One click template installations"  />

        <?php
        //self::render_fields( 'inbound-pro-welcome' );
        ?>
        <?php
    }

    /**
     *  Display Inbound Pro Setup page
     */
    public static function display_setup() {
        self::extend_settings();
        self::$settings_values = Inbound_Options_API::get_option( 'inbound-pro' , 'settings' , array() );

        ?>

        <div class="xlarge-100 large-100 medium-100 small-100 tiny-100">
            <?php
            self::render_fields( 'inbound-pro-setup' );
            ?>
        </div>
        <?php
    }

    /**
     *  Display Inbound Pro Import Export Settings Option
     */
    public static function display_import_export() {

        ?>

        <div class="xlarge-100 large-100 medium-100 small-100 tiny-100">
            <div class="import-export-container">
                <h2><?php _e('Export Inbound Now Settings' , 'inbound-pro'); ?></h2>
                <p><?php _e('This will export all Inbound Now core settings and extension settings for use with future installs. Extensions and templates will still need to be activated manually.' , 'inbound-pro'); ?></p>
                <span class="button button-secondary" id="export-settings">
                    <?php _e('Generate JSON Backup' , 'inbound-pro'); ?>
                </span>
                <br><br>
                <br>
                <h2><?php _e('Import Inbound Now Settings' , 'inbound-pro'); ?></h2>
                <?php
                if (isset($_FILES) && $_FILES ) {
                    ?>
                    <p><?php _e('Your settings have been imported!.' , 'inbound-pro'); ?></p>
                    <?php
                } else {
                ?>
                <p><?php _e('Warning, this will overwrite Inbound Now settings already in place for this WordPress instance.' , 'inbound-pro'); ?></p>

                <form action="<?php echo admin_url('admin.php?tab=inbound-pro-import-export&page=inbound-pro'); ?>" class="wp-upload-form" enctype="multipart/form-data" method="post">
                <input type="file" name="jsonfile" id="jsonfile">
                <input type="hidden" name="inbound-action" value="import-json">
                <input type="submit" value="<?php _e('Import JSON' , 'inbound-pro'); ?>" class="button" id="import-settings" name="install-template-submit" disabled="">
                </form>
                <?php
                }
                ?>
                <br><br><br>
            </div>
        </div>
        <?php
    }

    /**
     *  Display Inbound Pro Settings page
     */
    public static function display_settings() {
        self::extend_settings();
        self::$settings_values = Inbound_Options_API::get_option( 'inbound-pro' , 'settings' , array() );

        self::render_fields( 'inbound-pro-settings' );
    }


    /**
     *  Display Sidebar
     */
    public static function display_sidebar() {


        ?>

        <!--    Nav to Tools -->
        <?php
        self::display_social_ctas();

        ?>

        <?php
    }

    /**
     *  Display latest news from Inbound Now
     */
    public static function display_blog_posts() {
        $blogs = Inbound_API_Wrapper::get_blog_posts();
        ?>
        <ul class="unstyled">
            <!--- Show blog posts --->
            <?php
            $i=0;
            $limit = 20;
            foreach ($blogs as $item) {
                if ($i>5) {
                    break;
                }

                $excerpt = explode('The post' ,  $item['description']);
                $excerpt = $excerpt[0];

                ?>
                <div class="all-80 small-50 tiny-50">
                    <h6 class='sidebar-h6'><?php echo $item['title']; ?></h6>
                    <!--<img class="half-bottom-space" src="holder.js/1200x600/auto/ink" alt="">-->
                    <p><a href='<?php echo $item['guid']; ?>' target='_blank'><?php _e( 'Read more &#8594;' , 'inbound-pro'); ?></a></p>
                </div>
                <?php
                $i++;
            }
            ?>
        </ul>
        <?php
    }


    public static function display_social_ctas() {
        ?>

        <a href="https://twitter.com/inboundnow" class="twitter-follow-button" data-show-count="false">Follow @inboundnow</a>
        <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
        <iframe src='//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Finboundnow&amp;width=234&amp;height=65&amp;colorscheme=light&amp;show_faces=false&amp;border_color&amp;stream=false&amp;header=false&amp;appId=364256913591848' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:234px; height:116px;' allowTransparency='true'>
        </iframe>
        <?php
    }

    /**
     *  Display Footer
     */
    public static function display_footer() {
        $docs = Inbound_API_Wrapper::get_docs();
        if (!$docs) {
            $docs = array();
        }
        ?>


        <footer class="clearfix pro-footer">
            <div class="ink-grid">
                <ul class="unstyled inline half-vertical-space">
                    <li class="active"><a href="http://www.inboundnow.com" target='_blank'><?php _e( 'Inbound Now' , 'inbound-pro' ); ?></a></li>
                    <li class="active"><a href="http://www.twitter.com/inboundnow" target='_blank'><?php _e( 'Twitter' , 'inbound-pro' ); ?></a></li>
                    <li class="active"><a href="http://www.github.com/inboundnow" target='_blank'><?php _e( 'GitHub' , 'inbound-pro' ); ?></a></li>
                    <li class="active"><a href="http://support.inboundnow.com" target='_blank'><?php _e( 'Support' , 'inbound-pro' ); ?></a></li>
                    <li class="active"><a href="http://docs.inboundnow.com" target='_blank'><?php _e( 'Documentation' , 'inbound-pro' ); ?></a></li>
                    <li class="active"><a href="http://www.inboundnow.com/translate-inbound-now/" target='_blank'><?php _e( 'Translations' , 'inbound-pro' ); ?></a></li>
                </ul>
            </div>
        </footer>
        <?php
    }

    /**
     *  Render About InboundNow Nav
     */
    static function display_nav_menu() {

        $pages_array = array(
            'inbound-pro-setup' => __( 'Core Settings' , 'inbound-pro' ),
            'inbound-pro-settings' => __( 'Extension Settings' , 'inbound-pro' ),
            'inbound-pro-import-export' => __( 'Import/Export Settings' , 'inbound-pro' ),
            'inbound-pro-welcome' => __( 'Welcome Screen' , 'inbound-pro' ),
            'inbound-my-account' => __( 'My Account' , 'inbound-pro' )
        );

        $pages_array = apply_filters( 'inbound_pro_nav' , $pages_array );

        echo '<header class="vertical-space">';
        echo '  <h1><img src="'. INBOUND_PRO_URLPATH . 'assets/images/logos/inbound-now-logo.png" style="width:262px;" title="' . __( 'Inbound Now Professional Suite' , 'inbound-pro' ) .'"></h1>';
        echo '  <nav class="ink-navigation">';
        echo '      <ul class="menu horizontal black">';

        foreach ($pages_array as $key => $value) {

            if ($key=='inbound-my-account') {
                echo '<li class=""><a target="_blank" href="https://www.inboundnow.com/account">'.$value.'</a></li>';
                continue;
            }

            $active = ( self::$tab === $key) ? 'active' : '';
            echo '<li class="'.$active.'"><a href="'.esc_url(admin_url(add_query_arg( array( 'tab' => $key , 'page' => 'inbound-pro' ), 'admin.php' ) ) ).'">';
            echo $value;
            echo '</a>';
            echo '</li>';
        }

        echo '      </ul>';
        echo '  </nav>';
        echo '</header>';

    }

    /**
     *  Displays search filter
     */
    public static function display_search() {
        ?>
        <div class="">
            <div class='templates-filter-group'>
                <input class="filter-search" type="search" placeholder="<?php _e(' Search Settings... ' , 'inbound-pro' ); ?>">
            </div>
        </div>

        <?php
    }

    /**
     *  Renders settings given a fields dataset
     *  @param STRING $fieldgroup_key identification key for which field group to render
     */
    public static function render_fields( $page ) {
        echo '<div class="wrap">';
        /* render search filter */
        self::display_search();

        echo '  <div id="grid" class="container-fluid">';

        self::$settings_fields[ $page ] = (isset(self::$settings_fields[ $page ])) ? self::$settings_fields[ $page ] : array();

        if (isset($_GET['debug']) && $_GET['debug'] == 2) {
            echo '<pre>';
            print_r(self::$settings_fields[ $page ]);
            echo '</pre>';
        }

        foreach( self::$settings_fields[ $page ] as $priority => $group ) {
            echo '<div class="inbound-settings-group " data-keywords="'.$group['keywords'].','.$group['group_name'].'" data-group-name="'.$group['group_name'].'" id="'.$group['group_name'].'">';
            foreach( $group['fields'] as $field ) {

                /* get value if available else set to default */
                $field['default'] =  (isset($field['default'])) ? $field['default'] : '';
                $field['class'] =  (isset($field['class'])) ? $field['class'] : '';
                $field['value'] = (isset(self::$settings_values[ $group['group_name'] ][ $field['id'] ])) ? self::$settings_values[ $group['group_name'] ][ $field['id'] ] : $field['default'];

                if (isset($_GET['debug'])) {
                    echo '<pre>';
                    echo $group['group_name'];
                    echo '<br>';
                    print_r($field);
                    echo '</pre>';
                    continue;
                }

                /* rend field */
                self::render_field( $field , $group );

            }

            echo '</div>';
        }
        echo '  </div>';
        echo '</div>';
    }

    /**
     *  Renders label and input given field dataset
     *  @param ARRAY $field dataset containing field information
     *  @param ARRAY $group dataset containing fieldgroup information
     */
    public static function render_field( $field , $group ) {

        if (isset($field['reveal']) && is_array($field['reveal'])) {
            $data = ' data-reveal-selector="'.$field['reveal']['selector'].'" data-reveal-value="'.$field['reveal']['value'].'" ';
        } else {
            $data = '';
        }

        /* prepare additional classes */
        if ( isset($field['hidden']) && $field['hidden'] ) {
            $field['class'] = $field['class'] . ' hidden';
        }

        /* run class variable through filter */
        $field['class'] = apply_filters('inbound-settings/field/class', $field['class'] );

        echo '<div class="inbound-setting '.$field['class'].' " '.$data.' data-field-id="'.$field['id'].'" id="field-'.$field['id'].'">';
        switch($field['type']) {
            // text
            case 'api-key':

                echo '<div class="api-key">';
                echo '  <label>'.__('Inbound API Key:' , 'inbound-pro' ) .'</label>';
                echo '      <input type="text" class="api" name="'.$field['id'].'" id="'.$field['id'].'" placeholder="'.$field['placeholder'].'" value="'.$field['value'].'" data-field-type="'.$field['type'].'" data-field-group="'.$group['group_name'].'"  data-special-handler="true"/>';
                echo '</div>';
                echo '<div class="api-key-reauth">';
                echo '      <span class="ink-button blue" id="reauthorize-api-key" />' . __('Rebuild Permissions' , 'inbound-pro') . '</span>';
                echo '</div>';
                break;
            case 'header':
                $extra = (isset($field['default'])) ? $field['default'] : '';
                echo '<h3 class="inbound-header">'.$extra.'</h3>';
                break;
            case 'sub-header':
                $extra = (isset($field['default'])) ? $field['default'] : '';
                echo '<h4 class="inbound-header">'.$extra.'</h4>';
                break;
            case 'oauth-button':
                $data = '';
                $oauth_class = '';
                $unauth_class = '';

                /* build data attriubtes */
                foreach ( $field['oauth_map'] as $key => $selector ) {
                    $data .= " data-".$key."='".$selector."'";
                }

                /* discover if access key and access token already exists */
                if (isset(self::$settings_values[ $group['group_name'] ][ 'oauth' ])) {
                    $params['action'] = 'revoke_oauth_tokens';
                    $params['group'] = $group['group_name'];
                    $oauth_class = "hidden";
                    $unauth_class = "";
                } else {
                    $oauth_class = "";
                    $unauth_class = "hidden";
                }
                echo '<button class="ink-button orange unauth thickbox '.$unauth_class.'" id="'.$field['id'].'" data-field-type="'.$field['type'].'" data-field-group="'.$group['group_name'].'" '.$data.' >'.__( 'Un-Authorize' , 'inbound-pro' ).'</button>';
                $class = 'hidden';

                $params['action'] = 'request_access_token';
                $params['group'] = $group['group_name'];
                $params['oauth_urls'] = (isset($field['oauth_urls'])) ? $field['oauth_urls'] : '';
                $params['oauth_map'] = $field['oauth_map'];
                $params['TB_iframe'] = 'true';
                $params['width'] = '800';
                $params['height'] = '500';

                echo '<a href="'. admin_url( add_query_arg( $params , 'admin.php' ) ) .'"  class="ink-button green oauth thickbox '.$oauth_class.'" id="'.$field['id'].'" data-field-type="'.$field['type'].'" data-field-group="'.$group['group_name'].'" '.$data.' >'.__( 'Authorize' , 'inbound-pro' ).'</a>';


                break;
            case 'text':
                echo '<div class="inbound-field">';
                echo '  <div class="inbound-label-field">';
                echo '      <label>'.$field['label'] .'</label>';
                echo '  </div>';
                echo '  <div class="inbound-text-field">';
                echo '      <input type="text" name="'.$field['id'].'" id="'.$field['id'].'" placeholder="'.( isset( $field['placeholder'] ) ? $field['placeholder'] : '' ) .'"  value="'.$field['value'].'" size="30"  data-field-type="'.$field['type'].'" data-field-group="'.$group['group_name'].'" '.( isset( $field['readonly'] ) ? 'readonly' : '' ) .'/>';
                echo '  </div>';
                echo '  <div class="inbound-tooltip-field">';
                echo '      <i class="inbound-tooltip fa fa-question-circle tool_text" title="'.$field['description'].'"></i>';
                echo '  </div>';
                echo '</div>';
                BREAK;
            case 'number':
                echo '<div class="inbound-field">';
                echo '  <div class="inbound-label-field">';
                echo '      <label>'.$field['label'] .'</label>';
                echo '  </div>';
                echo '  <div class="inbound-text-field">';
                echo '      <input type="number" min="0" name="'.$field['id'].'" id="'.$field['id'].'" placeholder="'.( isset( $field['placeholder'] ) ? $field['placeholder'] : '' ) .'"  value="'.$field['value'].'" size="2"  data-field-type="'.$field['type'].'" data-field-group="'.$group['group_name'].'"/>';
                echo '  </div>';
                echo '  <div class="inbound-tooltip-field">';
                echo '      <i class="inbound-tooltip fa fa-question-circle tool_text" title="'.$field['description'].'"></i>';
                echo '  </div>';
                echo '</div>';
                BREAK;
            // ol
            case 'ol':
                echo '<div class="inbound-field">';
                echo '  <div class="inbound-label-field">';
                echo '      <label><strong>'.$field['label'] .'</strong></label>';
                echo '  </div><br>';
                echo '  <div class="inbound-ol-field">';
                echo '      <ol>';
                foreach ($field['options'] as $option) {
                    echo '      <li>'. $option. '</li>';
                }
                echo '      </ol>';
                echo '  </div>';
                echo '</div>';
                BREAK;
            // ul
            case 'ul':
                echo '<div class="inbound-field">';
                echo '  <div class="inbound-label-field">';
                echo '      <label><strong>'.$field['label'] .'</strong></label>';
                echo '  </div><br>';
                echo '  <div class="inbound-ul-field">';
                echo '      <ul>';
                foreach ($field['options'] as $option) {
                    echo '      <li>'. $option. '</li>';
                }
                echo '      </ul>';
                echo '  </div>';
                echo '</div>';
                BREAK;
            // textarea
            case 'textarea':
                echo '<textarea name="'.$field['id'].'" id="'.$field['id'].'" cols="106" rows="6"  data-field-type="'.$field['type'].'" data-field-group="'.$group['group_name'].'">'.$field['value'].'</textarea>
                        <i class="inbound-tooltip fa-question-circle tool_textarea" title="'.$field['description'].'"></i>';
                break;
            // wysiwyg
            case 'wysiwyg':
                wp_editor( $field['value'], $field['id'], $settings = array() );
                echo    '<span class="description">'.$field['description'].'</span><br><br>';
                break;
            // media
            case 'media':

                echo '<label for="upload_image">';
                echo '<input name="'.$field['id'].'"    id="'.$field['id'].'" type="text" size="36" name="upload_image" value="'.$field['value'].'"  data-field-type="'.$field['type'].'" data-field-group="'.$group['group_name'].'"/>';
                echo '<input class="upload_image_button" id="uploader_'.$field['id'].'" type="button" value="Upload Image" />';
                echo '<br /><i class="inbound-tooltip fa-question-circle tool_media" title="'.$field['description'].'"></i>';
                break;
            // checkbox
            case 'checkbox':
                $i = 1;
                echo "<table>";
                if (!isset($field['value'])){$field['value']=array();}
                elseif (!is_array($field['value'])){
                    $field['value'] = array($field['value']);
                }
                foreach ($field['options'] as $value=>$label) {
                    if ($i==5||$i==1)
                    {
                        echo "<tr>";
                        $i=1;
                    }
                    echo '<td><input type="checkbox" name="'.$field['id'].'[]" id="'.$field['id'].'" value="'.$value.'" ',in_array($value,$field['value']) ? ' checked="checked"' : '','  data-field-type="'.$field['type'].'"  data-field-group="'.$group['group_name'].'"/>';
                    echo '<label for="'.$value.'">&nbsp;&nbsp;'.$label.'</label></td>';
                    if ($i==4)
                    {
                        echo "</tr>";
                    }
                    $i++;
                }
                echo "</table>";
                echo '<br><i class="inbound-tooltip fa-question-circle tool_checkbox" title="'.$field['description'].'"></i>';
                break;
            // radio
            case 'radio':

                echo '<div class="inbound-field">';
                echo '  <div class="inbound-label-field">';
                echo '      <label>'.$field['label'] .'</label>';
                echo '  </div>';

                echo '  <div class="inbound-radio-field">';
                foreach ($field['options'] as $value=>$label) {
                    //echo $meta.":".$field['id'];
                    //echo "<br>";
                    echo '<input type="radio" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$value.'" ',$field['value']==$value ? ' checked="checked"' : '','  data-field-type="'.$field['type'].'" data-field-group="'.$group['group_name'].'"/>';
                    echo '<label for="'.$value.'">&nbsp;&nbsp;'.$label.'</label> &nbsp;&nbsp;&nbsp;&nbsp;';
                }
                echo '  </div>';

                echo '  <div class="inbound-tooltip-field">';
                echo '      <br /><i class="inbound-tooltip fa fa-question-circle tool_dropdown" title="'.$field['description'].'"></i>';
                echo '  </div>';
                echo '</div>';


                break;
            // select
            case 'dropdown':
                echo '<div class="inbound-field">';
                echo '  <div class="inbound-label-field">';
                echo '      <label>'.$field['label'] .'</label>';
                echo '  </div>';
                echo '  <div class="inbound-dropdown-field">';

                echo '      <select name="'.$field['id'].'" id="'.$field['id'].'"  data-field-type="'.$field['type'].'" data-field-group="'.$group['group_name'].'">';
                /* no objects allowed - bug fix */
                $field['value'] = (!is_object($field['value'])) ? $field['value'] : '';

                foreach ($field['options'] as $value=>$label) {
                    echo '      <option', $field['value'] == $value ? ' selected="selected"' : '', ' value="'.$value.'">'.$label.'</option>';
                }

                echo '      </select>';
                echo '  </div>';
                echo '  <div class="inbound-tooltip-field">';
                echo '      <br /><i class="inbound-tooltip fa fa-question-circle tool_dropdown" title="'.$field['description'].'"></i>';
                echo '  </div>';
                echo '</div>';
                break;
            case 'html':
                echo $field['value'];
                echo ( !empty($field['description']) ) ? $field['description'] : '';

                if ( isset($field['callback']) ) {
                    if (is_array($field['callback'])) {
                        call_user_func(
                            array($field['callback'][0], $field['callback'][1]),
                            $field
                        );
                    } else {
                        call_user_func( $field['callback'] , $field );
                    }
                }

                break;
            case 'custom-fields-repeater':
                $fields = Leads_Field_Map::get_lead_fields();
                $fields = Leads_Field_Map::prioritize_lead_fields( $fields );
                $field_types = Leads_Field_Map::build_field_types_array();
                $mandatory = array('wpleads_email_address','wpleads_first_name','wpleads_last_name');

                /* add hide/show toggle */
                echo '<div class="toggle-custom-fields-container">';
                echo '  <label><input type="checkbox" data-special-handler="true" id="show-hide-disabled-custom-fields"> ' .__('Show Disabled Fields' , 'inbound-pro') . '</label>';
                echo '</div>';
                echo '<div class="repeater-custom-fields">';
                echo '      <div class="map-row-headers column-group">';
                echo '          <div class="map-key-header all-5">';
                echo '              <th>' . __( 'Order' , 'inbound-pro' ) .'</th>';
                echo '          </div>';
                echo '          <div class="map-key-header all-5">';
                echo '              <th>' . __( 'Delete' , 'inbound-pro' ) .'</th>';
                echo '          </div>';
                echo '          <div class="map-key-header all-5">';
                echo '              <th>' . __( 'Enable' , 'inbound-pro' ) .'</th>';
                echo '          </div>';
                echo '          <div class="map-key-header all-25">';
                echo '              <th>' . __( 'Field Key' , 'inbound-pro' ) .'</th>';
                echo '          </div>';
                echo '          <div class="map-key-header all-30">';
                echo '          <th>' . __( 'Field Label' , 'inbound-pro' ) .'</th>';
                echo '          </div>';
                echo '          <div class="map-key-header all-20">';
                echo '          <th>' . __( 'Field Type' , 'inbound-pro' ) .'</th>';
                echo '          </div>';
                echo '      </div>';

                echo '  <form data="'.$field['type'].'" id="custom-fields-form">';
                echo '  <ul class="field-map" id="field-map">';

                foreach( $fields as $key => $field ) {

                    $read_only =  (isset($field['enable']) && $field['enable'] == 'off') ? 'readonly' : '';


                    echo '  <li class="map-row custom-fields-row column-group '.$read_only.'"  status-priority="'.$key.'">';
                    echo '      <div class="map-handle all-5">';
                    echo '          <span class="drag-handle">';
                    echo '              <input type="hidden" class="field-priority" name="fields['.$field['key'].'][priority]" value="'.$key.'">';
                    echo '              <i class="fa fa-arrows"></i>';
                    echo '          </span>';
                    echo '      </div>';
                    echo '      <div class="map-actions all-5">';
                    echo '          <div class="edit-btn-group ">';
                    if (!isset($field['nature']) || $field['nature'] != 'core') {
                        echo '          <span class="fa fa-trash ink-button green  delete-custom-field" id="remove-field"></span>';
                        echo '          <span class="ink-button red delete-custom-field-confirm hidden" id="remove-field-confirm" title="confirm">'.__( 'Confirm' , ' inbound-pro' ).'</span>';

                    } else {
                        echo '          <i class="fa fa-lock" title="'.__( 'This field cannot be deleted' , 'inbound-pro' ).'"></i>';
                    }
                    echo '          </div>';
                    echo '      </div>';
                    echo '      <div class="map-handle all-5">';
                    if (!in_array($field['key'],$mandatory)) {
                        echo '              <input type="hidden" class="toggle-lead-field" name="fields['.$field['key'].'][enable]" value="off" data-special-handler="true"  data-field-type="mapped-field">';
                        echo '              <input type="checkbox" class="toggle-lead-field" name="fields['.$field['key'].'][enable]" '. ( !isset($field['enable']) || $field['enable'] == 'on' ? 'checked="true"' : '' ) .' data-special-handler="true"  data-field-type="mapped-field">';
                    } else {
                        echo '<i class="fa fa-lock" aria-hidden="true" title="'.__('This field cannot be disbled.','inbound-pro').'"></i>';
                    }
                    echo '      </div>';
                    echo '      <div class="map-key all-25">';
                    echo '              <input '.$read_only.' type="text" class="field-key" data-special-handler="true" data-field-type="mapped-field" name="fields['.$field['key'].'][key]" value="'.$field['key'].'" '. ( isset($field['nature']) && $field['nature'] == 'core' ? 'disabled' : '' ) .' required>';
                    echo '      </div>';
                    echo '      <div class="map-label all-30">';
                    echo '              <input '.$read_only.' type="text" class="field-label" data-special-handler="true" data-field-type="mapped-field"  name="fields['.$field['key'].'][label]" value="'.$field['label'].'" required>';
                    echo '      </div>';
                    echo '      <div class="map-label all-20">';
                    echo '              <select '.$read_only.' type="text" class="field-type" data-special-handler="true" data-field-type="mapped-field"  name="fields['.$field['key'].'][type]"  '. ( isset($field['nature']) && $field['nature'] == 'core' ? 'disabled' : '' ) .'>';

                    foreach ( $field_types as $type => $label ) {
                        echo                '<option value="'.$type.'" '.( isset($field['type']) && $field['type'] == $type ? 'selected="selected"' : '' ).'>'.$label.'</option>';
                    }

                    echo '              </select>';
                    echo '      </div>';
                    echo '  </li>';
                }

                echo '  </ul>';
                echo '  </form>';
                echo '  <form id="add-new-custom-field-form">';
                echo '  <div class="map-row-addnew column-group">';
                echo '      <div class="map-handle all-5 ">';
                echo '          <span class="drag-handle">';
                echo '              <i class="fa fa-arrows"></i>';
                echo '          </span>';

                echo '      </div>';
                echo '      <div class="map-key all-25">';
                echo '              <input type="text"  name="fields[new][key]" data-special-handler="true" id="new-key" placeholder="'.__('Enter field key here' , 'inbound-pro' ).'" required>';
                echo '      </div>';
                echo '      <div class="map-label all-30">';
                echo '              <input type="text" name="fields[new][label]" data-special-handler="true" id="new-label" placeholder="'.__('Enter field label here' , 'inbound-pro' ).'" required>';
                echo '      </div>';

                echo '      <div class="map-label all-20">';
                echo '              <select type="text" class="field-type" data-special-handler="true" id="new-type"  name="fields[new][type]">';
                foreach ( $field_types as $type => $label ) {
                    echo                '<option value="'.$type.'">'.$label.'</option>';
                }
                echo '              </select>';
                echo '      </div>';
                echo '      <div class="map-actions all-30">';
                echo '          <div class="edit-btn-group">';
                echo '              <button type="submit" class="ink-button blue" id="add-custom-field">'.__( 'Create new field' , ' inbound-pro' ).'</button>';
                echo '          </div>';
                echo '      </div>';
                echo '  </div>';
                echo '  </form>';
                echo '</div>';
                BREAK;
            case 'lead-status-repeater':
                $statuses = Inbound_Leads::get_lead_statuses();

                echo '<div class="repeater-lead-statuses">';
                echo '  <h4>'.__('Manage Lead Statuses:' , 'inbound-pro' ) .'</h4>';

                echo '      <div class="status-row-headers column-group">';
                echo '          <div class="status-key-header all-5">';
                echo '              <th> </th>';
                echo '          </div>';
                echo '          <div class="status-key-header all-25">';
                echo '              <th>' . __( 'Label' , 'inbound-pro' ) .'</th>';
                echo '          </div>';
                echo '          <div class="status-key-header all-30">';
                echo '          <th>' . __( 'Color' , 'inbound-pro' ) .'</th>';
                echo '          </div>';
                echo '          <div class="status-key-header all-15">';
                echo '          <th>' . __( 'Action' , 'inbound-pro' ) .'</th>';
                echo '          </div>';
                echo '      </div>';

                echo '  <form data="'.$field['type'].'" id="lead-statuses-form">';
                echo '  <ul class="lead-statuses ui-sortable" id="lead-statuses">';


                foreach( $statuses as $key => $status ) {

                    echo '  <li class="status-row column-group"  status-priority="'.$status['priority'].'">';
                    echo '      <div class="map-handle all-5">';
                    echo '          <span class="drag-handle">';
                    echo '              <i class="fa fa-arrows"></i>';
                    echo '          </span>';
                    echo '      </div>';
                    echo '      <div class="map-key all-25">';
                    echo '              <input type="hidden" class="status-priority" name="statuses['.$status['key'].'][priority]" value="'.$status['priority'].'">';
                    echo '              <input type="hidden" class="status-key" name="statuses['.$status['key'].'][key]" value="'.$status['key'].'">';
                    echo '              <input type="text" class="status-label" data-special-handler="true" data-field-type="lead-status-field" name="statuses['.$status['key'].'][label]" value="'.$status['label'].'" '. ( isset($status['nature']) && $status['nature'] == 'core' ? '' : '' ) .' required>';
                    echo '      </div>';
                    echo '      <div class="map-label all-30">';
                    echo '              <input type="text" class="status-colorpicker form-control" data-special-handler="true" data-field-type="lead-status-field"  name="statuses['.$status['key'].'][color]" value="'.$status['color'].'" required>';
                    echo '      </div>';
                    echo '      <div class="map-actions all-30">';

                    echo '          <div class="edit-btn-group ">';
                    echo '              <span class="ink-button red delete-lead-status '.( !isset($status['nature']) || $status['nature'] != 'core'  ? '' : 'hidden' ).'" id="remove-field">'.__( 'remove' , ' inbound-pro' ).'</span>';
                    echo '          </div>';
                    echo '          <div class="edit-btn-group ">';
                    echo '              <span class="ink-button red delete-lead-status-confirm hidden" id="remove-status-confirm">'.__( 'confirm removal' , ' inbound-pro' ).'</span>';
                    echo '          </div>';

                    echo '      </div>';
                    echo '  </li>';
                }

                echo '  </ul>';
                echo '  </form>';
                echo '  <form id="add-new-lead-status-form">';
                echo '  <div class="map-row-addnew column-group">';
                echo '      <div class="map-handle all-5 ">';
                echo '          <span class="drag-handle">';
                echo '              <i class="fa fa-arrows"></i>';
                echo '          </span>';

                echo '      </div>';
                echo '      <div class="map-label all-30">';
                echo '              <input type="text" name="statuses[new][label]" data-special-handler="true" id="new-status-label" placeholder="'.__('Enter field label here' , 'inbound-pro' ).'" required>';
                echo '      </div>';

                echo '      <div class="map-color all-25">';
                echo '              <input type="text"  name="statuses[new][color]" class="status-colorpicker" data-special-handler="true" id="new-status-color" placeholder="'.__('Color' , 'inbound-pro' ).'" required>';
                echo '      </div>';

                echo '      <div class="map-actions all-30">';
                echo '      </div>';
                echo '  </div>';
                echo '  <div class="map-row-addnew">';
                echo '      <div class="edit-btn-group all-30">';
                echo '              <button type="submit" class="ink-button blue" id="add-lead-status">'.__( 'create status' , ' inbound-pro' ).'</button>';
                echo '      </div>';
                echo '  </div>';
                echo '  </form>';
                echo '</div>';
                BREAK;

            case 'ip-address-repeater':
                self::$settings_values = Inbound_Options_API::get_option( 'inbound-pro' , 'settings' , array() );
                $ip_addresses = ( isset(self::$settings_values['inbound-analytics-rules']['ip-addresses']) && self::$settings_values['inbound-analytics-rules']['ip-addresses'] ) ? self::$settings_values['inbound-analytics-rules']['ip-addresses'] : array('') ;

                echo '<div class="repeater-ip-addresses">';
                echo '  <h4>'.__('Exclude IPs from Tracking:' , 'inbound-pro' ) .'</h4>';
                echo '  <form data="'.$field['type'].'" id="ip-addresses-form">';
                echo '      <ul class="field-ip-addresses" id="field-ip-address">';


                foreach( $ip_addresses as $key => $ip_address ) {

                    echo '      <li class="ip-address-row column-group '. ( !$ip_address ? 'hidden' : '' ) .'"  data-priority="'.$key.'">';
                    echo '          <div class="ip-address all-70">';
                    echo '              <input type="ip-address" class="field-ip-address" data-special-handler="true" data-field-type="ip-address" name="ip-addresses[]" value="'.$ip_address.'" required>';
                    echo '          </div>';
                    echo '          <div class="ip-address-actions all-20">';

                    echo '              <div class="edit-btn-group ">';
                    echo '                  <span class="ink-button red delete-ip-address '.( !isset($field['nature']) || $field['nature'] != 'core'  ? '' : 'hidden' ).'" id="remove-field">'.__( 'remove' , ' inbound-pro' ).'</span>';
                    echo '              </div>';
                    echo '              <div class="edit-btn-group ">';
                    echo '                  <span class="ink-button red delete-ip-address-confirm hidden" id="remove-ip-confirm">'.__( 'confirm removal' , ' inbound-pro' ).'</span>';
                    echo '              </div>';

                    echo '          </div>';
                    echo '      </li>';
                }

                echo '      </ul>';
                echo '  </form>';

                /* add new ip address html */
                echo '  <form id="add-new-ip-address-form">';
                echo '      <div class="ip-address-row-addnew column-group">';
                echo '          <div class="ip-address all-80">';
                echo '                  <input type="text"  name="ip-addresses" data-special-handler="true" id="new-ip-address" placeholder="'.__('Enter IP Address ' , 'inbound-pro' ).'" required>';
                echo '          </div>';
                echo '          <div class="ip-address-actions all-20">';
                echo '              <div class="edit-btn-group">';
                echo '                  <button type="submit" class="ink-button blue" id="add-ip-address">'.__( 'add new ip address' , ' inbound-pro' ).'</button>';
                echo '              </div>';
                echo '          </div>';
                echo '      </div>';
                echo '  </form>';

                echo '</div>';
                break;
        } //end switch
        echo '</div>';

    }

    /**
     *  Ajax listener for saving updated field data
     */
    public static function ajax_update_settings() {
        /* parse string */
        parse_str($_POST['input'] , $data );

        /* Update Setting */
        $settings = Inbound_Options_API::get_option( 'inbound-pro' , 'settings' , array() );
        $settings[ $data['fieldGroup'] ][ $data['name'] ] = $data['value'];
        Inbound_Options_API::update_option( 'inbound-pro' , 'settings' , $settings );

        do_action('inbound-settings/after-field-value-update' , $data );

        /* echo id of field being modified for js to use in callback */
        echo $data['name'];exit;
    }

    /**
     *  Ajax listener for saving updated custom field data
     */
    public static function ajax_update_custom_fields() {
        /* parse string */
        parse_str($_POST['input'] , $data );

        /* Update Setting */
        $settings = Inbound_Options_API::get_option( 'inbound-pro' , 'settings' , array() );
        $settings[ 'leads-custom-fields' ] =  $data;

        Inbound_Options_API::update_option( 'inbound-pro' , 'settings' , $settings );
    }

    /**
     *  Ajax listener for saving updated custom field data
     */
    public static function ajax_export_settings() {

        /* GETTING CORRECT FILE PATH */
        $path = INBOUND_PRO_UPLOADS_PATH . 'settings/';
        $filename = "inbound-settings-".date("m.d.y.") . substr( md5(rand()), 0, 7);


        if(!file_exists($path)){
            mkdir($path, 0755, true);
            $indexphp = fopen( $path. 'index.php' ,"x+");
            fclose($indexphp);
        }

        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        header('Content-Description: File Transfer');
        header("Content-type: text/json");
        header("Content-Disposition: attachment; filename=".$path."/".$filename.".json");
        header("Expires: 0");
        header("Pragma: public");

        $file = @fopen($path."/".$filename.".json","a");

        if(!$file){
            $returnArray = array(
                'status' => 0,
                'error' => 'Unable to create file. Please check you uploads folder permission!!.',
                'url' => ''
            );
            die(json_encode($returnArray));
        }

        /* Get Setting */
        $settings = get_option( 'inbound-pro' , array() );

        /* unset configuration memory */
        unset($settings['configuration']);

        fwrite($file, json_encode($settings));
        fclose($file);

        die( INBOUND_PRO_UPLOADS_URLPATH . 'settings/' . $filename.".json" );

    }

    /**
     *  Ajax listener for saving updated custom field data
     */
    public static function ajax_update_lead_statuses() {
        /* parse string */
        parse_str($_POST['input'] , $data );

        /* Update Setting */
        $settings = Inbound_Options_API::get_option( 'inbound-pro' , 'settings' , array() );

        $settings[ 'lead-statuses' ] =  $data;
        Inbound_Options_API::update_option( 'inbound-pro' , 'settings' , $settings );
    }

    /**
     *  Ajax listener for saving updated ip addresses to not track
     */
    public static function ajax_update_ip_addresses() {
        /* parse string */
        parse_str($_POST['input'] , $data );

        $ip_addresses = array_filter($data['ip-addresses']);
        $ip_addresses = array_map('trim',$ip_addresses);

        /* Update Setting */
        $settings = Inbound_Options_API::get_option( 'inbound-pro' , 'settings' , array() );
        $settings['inbound-analytics-rules'][ 'ip-addresses' ] = $ip_addresses;

        Inbound_Options_API::update_option( 'inbound-pro' , 'settings' , $settings );
    }

    /**
     * listen for request to install / uninstall fast ajax
     */
    public static function ajax_toggle_fast_ajax( $data ) {

        if ( !isset($data['toggle-fast-ajax']) ) {
            return;
        }

        switch ( $data['toggle-fast-ajax'] ) {
            case "on":
                self::install_mu_plugin_fast_ajax();
                break;
            case "off":
                self::install_mu_plugin_fast_ajax( true );
                break;
        }
    }

    /**
     * Listen for command to import settings from uploaded json file
     */
    public static function import_settings_from_json() {
        if (!isset($_POST['inbound-action'])) {
            return;
        }

        if ($_GET['tab'] != 'inbound-pro-import-export') {
            return;
        }

        $file_name = $_FILES['jsonfile']['name'];
        $file_size = $_FILES['jsonfile']['size'];
        $file_temp = $_FILES['jsonfile']['tmp_name'];
        $file_ext = strtolower(end(explode('.', $file_name)));

        if ($file_ext != 'json') {
            die(__('Error: This is not an Inbound Now Settings .json file.','inbound-pro'));
        }

        $json = file_get_contents($_FILES["jsonfile"]["tmp_name"]);
        $settings_array = json_decode($json,true);

        if (!is_array($settings_array)) {
            die(__('Error: json file is corrupt.','inbound-pro'));
        }

        /* get current settings */
        $settings = get_option( 'inbound-pro' , array() );

        /* set configuration memory */
        $settings_array['configuration'] = $settings['configuration'];

        /* update with new imported settings */
        update_option( 'inbound-pro' , $settings_array );

    }

    /**
     * Installs fast-ajax.php mu plugin
     */
    public static function install_mu_plugin_fast_ajax( $delete = false ) {

        $mu_dir = ( defined( 'WPMU_PLUGIN_DIR' ) && defined( 'WPMU_PLUGIN_URL' ) ) ? WPMU_PLUGIN_DIR : trailingslashit( WP_CONTENT_DIR ) . 'mu-plugins';
        $mu_dir = untrailingslashit( $mu_dir );

        $source = INBOUND_PRO_PATH . 'assets/mu-plugins/fast-ajax.php';
        $dest = $mu_dir . '/fast-ajax.php';

        $result = array( 'status' => 'OK', 'error' => '' );

        if ( file_exists( $dest ) && !unlink( $dest ) ) {
            $result['error'] = sprintf(
                __( '<strong>Error!</strong> Could not remove the mu plugin.', 'inbound-pro' ),
                $dest );
            $result['status'] = 'ERROR';
        } else {

            /* delete only */
            if ($delete) {
                return;
            }

            // INSTALL
            if ( !wp_mkdir_p( $mu_dir ) ) {
                $result['error'] = sprintf(
                    __( '<strong>Error!</strong> The following directory could not be created: <code>%s</code>.', 'nelioab' ),
                    $mu_dir );
                $result['status'] = 'ERROR';
            }
            if ( $result['status'] !== 'ERROR' && !copy( $source, $dest ) ) {
                $result['error'] = sprintf(
                    __( '<strong>Error!</strong> Could not copy Nelio\'s performance MU-Plugin from <code>%1$s</code> to <code>%2$s</code>.', 'nelioab' ),
                    $source, $dest );
                $result['status'] = 'ERROR';
            }

            /* if there was an error installing set to off */
            if ($result['status'] == 'ERROR') {
                /* Update Setting */
                $settings = Inbound_Options_API::get_option( 'inbound-pro' , 'settings' , array() );
                $settings[ $data['fieldGroup'] ][ $data['name'] ] = 'Off';
                Inbound_Options_API::update_option( 'inbound-pro' , 'settings' , $settings );
            }
        }


        header( 'Content-Type: application/json' );
        echo 'toggle-fast-ajax';
        die();
    }
}

Inbound_Pro_Settings::init();
Inbound Pro Plugin - PHP Codex API documentation generated by ApiGen