'), 56);
if (current_user_can($capability)) {
$submenu['bitform'][] = array(__('All Forms', 'bitform'), $capability, 'admin.php?page=bitform#/');
}
}
/**
* Load the asset libraries
*
* @return void
*/
public function AdminAssets($current_screen)
{
if (!strpos($current_screen, 'bitform')) {
return;
}
$parsed_url = parse_url(get_admin_url());
$site_url = $parsed_url['scheme'] . "://" . $parsed_url['host'];
$site_url .= empty($parsed_url['port']) ? null : ':' . $parsed_url['port'];
$base_path_admin = str_replace($site_url, null, get_admin_url());
wp_enqueue_script(
'bitforms-vendors',
BITFORMS_ASSET_URI . '/js/vendors-main.js',
null,
BITFORMS_VERSION,
true
);
wp_enqueue_script(
'bitforms-runtime',
BITFORMS_ASSET_URI . '/js/runtime.js',
null,
BITFORMS_VERSION,
true
);
wp_enqueue_script(
'bitforms-file',
BITFORMS_ASSET_URI . '/js/bitforms-file.js',
array('bitforms-vendors', 'bitforms-runtime'),
BITFORMS_VERSION,
true
);
wp_enqueue_script(
'bitforms-admin-script',
BITFORMS_ASSET_URI . '/js/index.js',
array('bitforms-vendors', 'bitforms-runtime', 'bitforms-file', 'wp-i18n'),
BITFORMS_VERSION,
true
);
wp_enqueue_script('tinymce_js', includes_url('js/tinymce/') . 'wp-tinymce.php', null, false, true);
if (!wp_script_is('media-upload')) {
wp_enqueue_media();
}
$plugin_path = BITFORMS_ASSET_URI;
echo "
";
wp_enqueue_style(
'bitforms-styles',
BITFORMS_ASSET_URI . '/css/bitforms.css',
null,
BITFORMS_VERSION,
'screen'
);
wp_enqueue_style(
'bitforms-components-styles',
BITFORMS_ASSET_URI . '/css/components.css',
null,
BITFORMS_VERSION,
'screen'
);
$formHandler = FormHandler::getInstance();
$all_forms = $formHandler->admin->getAllForm();
$urlQuery = parse_url(FileDownloadProvider::getBaseDownloadURL(), PHP_URL_QUERY);
$baseDLURL = FileDownloadProvider::getBaseDownloadURL();
$baseDLURL = empty($urlQuery) ? $baseDLURL . '?' : $baseDLURL . '&';
$ipTool = new IpTool();
$user_details = $ipTool->getUserDetail();
$integrationHandler = new IntegrationHandler(0, $user_details);
$allFormIntegrations = $integrationHandler->getAllIntegration('app');
$allFormSettings = array();
if (!is_wp_error($allFormIntegrations)) {
foreach ($allFormIntegrations as $integration) {
if (!is_null($integration->integration_type)) {
$integrationDetails = json_decode($integration->integration_details);
$integrationDetails->id = $integration->id;
$allFormSettings[$integration->integration_type] = $integrationDetails;
}
}
}
$users = get_users(['fields' => ['user_nicename', 'user_email']]);
$userMail = [];
foreach ($users as $key => $value) {
$userMail[$key]['label'] = !empty($value->user_nicename) ? $value->user_nicename : '';
$userMail[$key]['value'] = !empty($value->user_email) ? $value->user_email : '';
}
$bitforms = apply_filters(
'bitforms_localized_script',
array(
'nonce' => wp_create_nonce('bitforms_save'),
'isPro' => false,
'assetsURL' => BITFORMS_ASSET_URI,
'baseURL' => $base_path_admin . 'admin.php?page=bitform#',
'baseDLURL' => $baseDLURL,
'styleURL' => BITFORMS_UPLOAD_BASE_URL . '/form-styles',
'ajaxURL' => admin_url('admin-ajax.php'),
'allForms' => is_wp_error($all_forms) ? null : $all_forms,
'allFormSettings' => $allFormSettings,
'userMail' => !empty($userMail) ? $userMail : [],
'dateFormat' => get_option('date_format'),
'timeFormat' => get_option('time_format'),
'timeZone' => wp_timezone_string(),
)
);
wp_localize_script('bitforms-admin-script', 'bits', $bitforms);
wp_set_script_translations('bitforms-admin-script', 'bitform', BITFORMS_PLUGIN_DIR_PATH . 'languages');
}
/**
* Bitforms apps-root id provider
* @return void
*/
public function RootPage()
{
require_once BITFORMS_PLUGIN_DIR_PATH . '/views/view-root.php';
}
public function AdminNotices()
{
remove_all_actions('admin_notices');
remove_all_actions('all_admin_notices');
}
}