Example #1
0
 /**
  * Retrieves whitelist settings. 
  * Will be active only if the "cordova-plugin-whitelist" plugin is added to config.xml.
  * (see https://github.com/apache/cordova-plugin-whitelist).
  * 
  * @param int $app_id Application ID
  * @param string $export_type 'phonegap-build', 'phonegap-cli' etc
  */
 protected static function get_whitelist_settings($app_id, $export_type = 'phonegap-build')
 {
     //By default we allow everything :
     $whitelist_settings = array('access' => array('origin' => '*'), 'allow-intent' => array('href' => '*'), 'allow-navigation' => array('href' => '*'));
     //No whitelist setting if the 'cordova-plugin-whitelist' plugin is not here :
     $whitelist_plugin_here = true;
     $current_phonegap_plugins = WpakApps::get_merged_phonegap_plugins($app_id);
     if (!array_key_exists('cordova-plugin-whitelist', $current_phonegap_plugins)) {
         $whitelist_settings = array();
         $whitelist_plugin_here = false;
     }
     /**
      * Filter : allows to modify config.xml whitelist configuration.
      * See https://github.com/apache/cordova-plugin-whitelist for detailed info.
      *
      * @param array  	$whitelist_settings     Array of whitelist settings : contains :
      *											 'access' => array( 'origin' => '*' ),
      *											 'allow-intent' => array( 'href' => '*' ),
      *											 'allow-navigation' => array( 'href' => '*' )
      * @param int		$app_id		            Application id
      * @param string    $export_type            'phonegap-build' (default) or 'phonegap-cli'
      * @param boolean   $whitelist_plugin_here  Whether or not the whitelist plugin is add for this app.
      */
     $whitelist_settings = apply_filters('wpak_config_xml_whitelist', $whitelist_settings, $app_id, $export_type, $current_phonegap_plugins, $whitelist_plugin_here);
     return $whitelist_settings;
 }