Example #1
0
 public static function get_components_synchro_data($app_id)
 {
     $components = array();
     $components_data = array();
     WpakAddons::require_app_addons_php_files($app_id);
     $components_raw = WpakComponentsStorage::get_components($app_id);
     if (!empty($components_raw)) {
         $globals = array();
         foreach ($components_raw as $component) {
             $component_data = WpakComponentsTypes::get_component_data($component, $globals);
             //
             // Don't include null component into the webservice's return
             // Component data could be null if an addon's component has been added to the app and the addon isn't activated anymore
             // An addon could be seen as deactivated either if the corresponding plugin is deactivated, or if the corresponding checkbox is unchecked for the given app
             //
             if (null === $component_data) {
                 continue;
             }
             $globals = $component_data['globals'];
             $components[$component->slug] = $component_data['specific'];
         }
         $navigation_items = WpakNavigationItemsStorage::get_navigation_indexed_by_components_slugs($app_id, true);
         $navigation_items = apply_filters('wpak_navigation_items', $navigation_items, WpakApps::get_app_slug($app_id));
         $components_data['navigation'] = $navigation_items;
         $components_data['components'] = $components;
         $components_data['globals'] = $globals;
         $components_data['addons'] = WpakAddons::get_app_addons_dynamic_data($app_id);
     }
     return $components_data;
 }
 public static function read($service_answer, $query_vars, $app_id)
 {
     $service_answer = array();
     $app_id = WpakApps::get_app_id($app_id);
     $service_answer = WpakComponents::get_components_synchro_data($app_id);
     return (object) $service_answer;
 }
Example #3
0
 public static function read_one($service_answer, $id, $app_id)
 {
     $service_answer = array();
     $app_id = WpakApps::get_app_id($app_id);
     $component_slug = addslashes($id);
     $args = array();
     if (isset($_GET['before_item']) && !empty($_GET['before_item'])) {
         $args['before_item'] = addslashes($_GET['before_item']);
     }
     $service_answer = WpakComponents::get_component_data($app_id, $component_slug, $args);
     return (object) $service_answer;
 }
 public static function read($service_answer, $query_vars, $app_id)
 {
     $service_answer = array();
     $auth_params = WpakWebServiceContext::getClientAppParams();
     if (!empty($auth_params['auth_action'])) {
         $app_id = WpakApps::get_app_id($app_id);
         $auth_engine = AuthenticationSettings::get_auth_engine_instance();
         $service_answer = $auth_engine->get_webservice_answer($app_id);
     } else {
         $service_answer = array('error' => 'no-auth-action');
         //This will set webservice answer status to 0.
     }
     return (object) $service_answer;
 }
Example #5
0
 /**
  * Retrieve "Live query" web service answer.
  * 
  * Any custom input params passed through the web service GET data can be
  * retrieved via WpakWebServiceContext::getClientAppParam( 'my_param' );
  * 
  * The following input params are automatically recognized and interpreted :
  * - 'wpak_component_slug' : if present, the WS automatically retrieve data
  *   about the given component
  * - 'wpak_query_action' : optionnaly use along with 'wpak_component_slug'. Can be :
  *     -- 'get-component' : default value : retrieves default component data
  *     -- 'get-items' : retrieves only the 'wpak_items_ids' items 
  * - 'wpak_items_ids' : array of items ids to retrieve (when wpak_query_action = get-items)
  * 
  * @return array $service_answer Web service answer : Advised answer structure :
  * By default, app core automatically knows what to do with an answer containing 
  * the following keys :
  * - 'globals'
  * - 'component' or 'components'
  * But the answer structure can be totally overriden, provided it is understood on
  * app side using the dedicated hooks.
  */
 public static function read($service_answer, $query_vars, $app_id)
 {
     $app_id = WpakApps::get_app_id($app_id);
     $component_slug = WpakWebServiceContext::getClientAppParam('wpak_component_slug');
     $action = WpakWebServiceContext::getClientAppParam('wpak_query_action');
     $action = empty($action) || !in_array($action, array('get-component', 'get-items')) ? 'get-component' : $action;
     if (!empty($component_slug)) {
         $service_answer = array('globals' => array(), 'component' => array());
         if (is_array($component_slug)) {
             //The only valid action is 'get-component' if $component_slug is an array :
             if ($action == 'get-component') {
                 //Retrieve data for all given components and merge globals :
                 unset($service_answer['component']);
                 $service_answer['components'] = array();
                 foreach ($component_slug as $slug) {
                     $component_data = WpakComponents::get_component_data($app_id, $slug);
                     if (!empty($component_data)) {
                         foreach ($component_data['globals'] as $global => $items) {
                             foreach ($items as $k => $item) {
                                 $service_answer['globals'][$global][$k] = $item;
                             }
                         }
                         $service_answer['components'][$slug] = $component_data['component'];
                     }
                 }
             }
         } else {
             //Only one component given : simply retrieve its data :
             switch ($action) {
                 case 'get-component':
                     $service_answer = WpakComponents::get_component_data($app_id, $component_slug);
                     break;
                 case 'get-items':
                     $items_ids = WpakWebServiceContext::getClientAppParam('wpak_items_ids');
                     if (!empty($items_ids)) {
                         $items_ids = !is_array($items_ids) && is_numeric($items_ids) ? array(intval($items_ids)) : array_map('intval', $items_ids);
                         $service_answer = WpakComponents::get_component_items($app_id, $component_slug, $items_ids);
                     }
                     break;
             }
         }
     }
     $query_params = WpakWebServiceContext::getClientAppParams();
     $service_answer = apply_filters('wpak_live_query', $service_answer, $query_params, $app_id, $query_vars);
     return (object) $service_answer;
 }
Example #6
0
 /**
  * Export app sources for PhoneGap CLI compilation
  * 
  * ## OPTIONS
  * 
  * <app_id_or_slug> : Application ID or Application slug
  * 
  * <target_directory> : Target directory where the export files will be copied
  * 
  * <export_type> : (Optionnal) Export type can be "phonegap-cli" (default if not provided) or "phonegap-build"
  * 
  * ## EXAMPLES
  * 
  *     PhoneGap CLI export : wp wpak export 123 /target/directory/
  *     PhoneGap Build export : wp wpak export 123 /target/directory/ "phonegap-build"
  *
  * @synopsis <app_id> <target_directory> [<export_type>]
  * 
  * @subcommand export
  */
 public function export($args, $assoc_args)
 {
     list($app_id_or_slug, $target_directory, $export_type) = $args;
     if (empty($export_type)) {
         $export_type = "phonegap-cli";
     }
     if (!in_array($export_type, array("phonegap-cli", "phonegap-build"))) {
         WP_CLI::error('Unknown export type "' . $export_type . '"');
     }
     //Check that the given app exists :
     if (WpakApps::app_exists($app_id_or_slug)) {
         if (is_dir($target_directory)) {
             WP_CLI::line('Export app "' . $app_id_or_slug . '" to ' . $target_directory);
             $app_id = WpakApps::get_app_id($app_id_or_slug);
             $answer = WpakBuild::build_app_sources($app_id, $export_type);
             if ($answer['ok'] === 1) {
                 $zip_file = $answer['export_full_name'];
                 WP_CLI::line("App sources zipped to " . $zip_file);
                 WP_CLI::line("Extract zip to destination");
                 //Extract to target directory :
                 WP_Filesystem();
                 $result = unzip_file($zip_file, $target_directory);
                 if (!is_wp_error($result)) {
                     WP_CLI::success("App sources extracted successfully to {$target_directory}");
                 } else {
                     WP_CLI::line('Could not extract ZIP export to : ' . $target_directory);
                     WP_CLI::error($result->get_error_message());
                 }
             } else {
                 WP_CLI::error('Export error : ' . $answer['msg']);
             }
         } else {
             WP_CLI::error('Destination directory not found : ' . $target_directory);
         }
     } else {
         WP_CLI::error('Application "' . $app_id_or_slug . '" not found');
     }
 }
Example #7
0
 public static function get_app_web_service_url($app_id_or_slug, $web_service_slug)
 {
     $url = self::get_app_web_service_base_url($app_id_or_slug);
     $app_slug = WpakApps::get_app_slug($app_id_or_slug);
     $app_id = WpakApps::get_app_id($app_id_or_slug);
     if (WpakApps::get_app_is_secured($app_id)) {
         $token = WpakToken::get_token($app_slug, $web_service_slug);
         $url .= '/' . $token;
     }
     $url .= '/' . $web_service_slug;
     return $url;
 }
Example #8
0
 public static function get_app_addons($app_id_or_slug)
 {
     $app_addons = array();
     $app_id = WpakApps::get_app_id($app_id_or_slug);
     if (!empty($app_id)) {
         $app_addons_raw = get_post_meta($app_id, self::meta_id, true);
         if (!empty($app_addons_raw)) {
             //Check if the app addons are still installed :
             $all_addons = self::get_addons();
             foreach ($app_addons_raw as $addon_slug) {
                 if (array_key_exists($addon_slug, $all_addons)) {
                     $addon = $all_addons[$addon_slug];
                     $addon->set_app_static_data($app_id);
                     $addon->set_app_dynamic_data($app_id);
                     $app_addons[$addon_slug] = $addon;
                 }
             }
         }
     }
     return $app_addons;
 }
Example #9
0
    public static function get_config_xml($app_id, $echo = false, $export_type = 'phonegap-build')
    {
        $app_main_infos = WpakApps::get_app_main_infos($app_id);
        $app_name = $app_main_infos['name'];
        $app_description = $app_main_infos['desc'];
        $app_phonegap_id = $app_main_infos['app_phonegap_id'];
        $app_version = $app_main_infos['version'];
        $app_version_code = $app_main_infos['version_code'];
        $app_phonegap_version = $app_main_infos['phonegap_version'];
        $app_author = $app_main_infos['author'];
        $app_author_email = $app_main_infos['author_email'];
        $app_author_website = $app_main_infos['author_website'];
        $app_platform = $app_main_infos['platform'];
        $app_icons = $app_main_infos['icons'];
        $whitelist_settings = self::get_whitelist_settings($app_id, $export_type);
        //Merge our default Phonegap Build plugins to those set in BO :
        $app_phonegap_plugins = WpakApps::get_merged_phonegap_plugins_xml($app_id, $app_main_infos['phonegap_plugins']);
        $xmlns = 'http://www.w3.org/ns/widgets';
        $xmlns_gap = 'http://phonegap.com/ns/1.0';
        if (!$echo) {
            ob_start();
        }
        echo '<?xml version="1.0" encoding="UTF-8" ?>';
        ?>

<widget xmlns       = "<?php 
        echo $xmlns;
        ?>
"
        xmlns:gap   = "<?php 
        echo $xmlns_gap;
        ?>
"
        id          = "<?php 
        echo $app_phonegap_id;
        ?>
"
        versionCode = "<?php 
        echo $app_version_code;
        ?>
"
        version     = "<?php 
        echo $app_version;
        ?>
" >

	<name><?php 
        echo $app_name;
        ?>
</name>

	<description><?php 
        echo $app_description;
        ?>
</description>

	<author href="<?php 
        echo $app_author_website;
        ?>
" email="<?php 
        echo $app_author_email;
        ?>
"><?php 
        echo $app_author;
        ?>
</author>

	<gap:platform name="<?php 
        echo $app_platform;
        ?>
" />
<?php 
        if (!empty($app_phonegap_version)) {
            ?>

	<preference name="phonegap-version" value="<?php 
            echo $app_phonegap_version;
            ?>
" />
<?php 
        }
        /**
         * Filter to handle the  "Webview bounce effect" on devices.
         * Pass false to this filter to allow the "Webview bounce effect".
         *
         * @param boolean	true		Bounce effect is disallowed by default.
         * @param int		$app_id		Application id
         */
        if (apply_filters('wpak_config_xml_preference_disallow_overscroll', true, $app_id)) {
            ?>

	<preference name="<?php 
            echo $app_platform == 'android' ? 'd' : 'D';
            ?>
isallowOverscroll" value="true" />
	<preference name="webviewbounce" value="false" />
<?php 
        }
        ?>

	<!-- PhoneGap plugin declaration -->
<?php 
        if (!empty($app_phonegap_plugins)) {
            ?>
	<?php 
            echo str_replace("\n", "\n\t", $app_phonegap_plugins);
            ?>

<?php 
        }
        if (!empty($whitelist_settings)) {
            ?>
	
	<!-- Whitelist policy  -->
<?php 
            foreach ($whitelist_settings as $whitelist_setting => $attributes) {
                if (empty($attributes) || !is_array($attributes)) {
                    continue;
                }
                $attributes_str = '';
                foreach ($attributes as $attribute => $value) {
                    $attributes_str .= ' ' . $attribute . '="' . $value . '"';
                }
                ?>
	<<?php 
                echo $whitelist_setting;
                echo $attributes_str;
                ?>
 />
<?php 
            }
        }
        ?>

	<!-- Icon and Splash screen declaration -->
<?php 
        if (!empty($app_icons)) {
            ?>

	<?php 
            echo str_replace("\n", "\n\t", $app_icons);
            ?>

<?php 
        }
        ?>
</widget>
<?php 
        $content = '';
        if (!$echo) {
            $content = ob_get_contents();
            ob_end_clean();
        }
        return !$echo ? $content : '';
    }
Example #10
0
 public static function template_redirect()
 {
     global $wp_query;
     //The following is only for app simulation in browser
     if (isset($wp_query->query_vars['wpak_theme_file']) && !empty($wp_query->query_vars['wpak_theme_file'])) {
         $file = $wp_query->query_vars['wpak_theme_file'];
         //For assets files like fonts, images or css we can't
         //be sure that the wpak_app_id GET arg is there, because they can
         //be included directly in themes sources (CSS/HTML) where the WP AppKit API can't
         //be used. So, we can't check that the file comes from the right app
         //or theme > we just check that the theme the asset belongs to is a real
         //WP AppKit theme and that at least one app uses this theme :
         if (self::is_asset_file($file)) {
             if (preg_match('/([^\\/]+?)\\/(.+)$/', $file, $matches)) {
                 $theme_slug = $matches[1];
                 $theme_file = $matches[2];
                 if (self::is_theme($theme_slug) && self::theme_is_used($theme_slug)) {
                     if ($file_full_path = self::get_theme_file($theme_slug, $theme_file)) {
                         self::exit_send_theme_file($file_full_path);
                     }
                 } else {
                     header("HTTP/1.0 404 Not Found");
                     _e('Not a valid theme file', WpAppKit::i18n_domain);
                     exit;
                 }
             } else {
                 header("HTTP/1.0 404 Not Found");
                 _e('Not a valid theme file path', WpAppKit::i18n_domain);
                 exit;
             }
         } else {
             if (!empty($_GET['wpak_app_id'])) {
                 //For non considered asset files (like JS) we check that the file is
                 //asked for the correct app and for the theme of the app:
                 $app_id = esc_attr($_GET['wpak_app_id']);
                 //can be ID or slug
                 $app = WpakApps::get_app($app_id);
                 if (!empty($app)) {
                     $app_id = $app->ID;
                     $default_capability = current_user_can('wpak_edit_apps') ? 'wpak_edit_apps' : 'manage_options';
                     $capability = apply_filters('wpak_private_simulation_capability', $default_capability, $app_id);
                     if (WpakApps::get_app_simulation_is_secured($app_id) && !current_user_can($capability)) {
                         wp_nonce_ays('wpak-theme-file');
                     }
                     if (preg_match('/([^\\/]+?)\\/(.+)$/', $file, $matches)) {
                         $theme_slug = $matches[1];
                         $theme_file = $matches[2];
                         $app_theme = WpakThemesStorage::get_current_theme($app_id);
                         if ($theme_slug == $app_theme) {
                             if ($file_full_path = self::get_theme_file($theme_slug, $theme_file)) {
                                 self::exit_send_theme_file($file_full_path);
                             } else {
                                 header("HTTP/1.0 404 Not Found");
                                 _e('Theme file not found', WpAppKit::i18n_domain);
                                 exit;
                             }
                         } else {
                             header("HTTP/1.0 404 Not Found");
                             _e('Asked theme is not activated for the given app', WpAppKit::i18n_domain);
                             exit;
                         }
                     } else {
                         header("HTTP/1.0 404 Not Found");
                         _e('Wrong theme file', WpAppKit::i18n_domain);
                         exit;
                     }
                 } else {
                     header("HTTP/1.0 404 Not Found");
                     _e('App not found', WpAppKit::i18n_domain) . ' : [' . $app_id . ']';
                     exit;
                 }
             } else {
                 header("HTTP/1.0 404 Not Found");
                 _e('App id not found in _GET parmeters', WpAppKit::i18n_domain);
                 exit;
             }
         }
     }
 }
Example #11
0
 protected static function get_default_phonegap_plugins($app_id)
 {
     $default_plugins = array('cordova-plugin-inappbrowser' => array('version' => '', 'source' => 'npm'), 'cordova-plugin-network-information' => array('version' => '', 'source' => 'npm'), 'cordova-plugin-whitelist' => array('version' => '', 'source' => 'npm'));
     $app_main_infos = WpakApps::get_app_main_infos($app_id);
     if ($app_main_infos['platform'] == 'ios') {
         $default_plugins['cordova-plugin-statusbar'] = array('version' => '', 'source' => 'npm');
         unset($default_plugins['cordova-plugin-whitelist']);
     }
     /**
      * Filter the Phonegap Build plugins that are included by default by WP AppKit
      *
      * @param array		$default_plugins	Array of default Phonegap plugins.
      * @param int		$app_id				Application id
      */
     $default_plugins = apply_filters('wpak_default_phonegap_build_plugins', $default_plugins, $app_id);
     return $default_plugins;
 }
Example #12
0
 private static function get_export_file_base_name($app_id)
 {
     return 'phonegap-export-' . WpakApps::get_app_slug($app_id);
 }
    public static function inner_main_infos_box($post, $current_box)
    {
        $available_themes = WpakThemes::get_available_themes(true);
        $current_theme = WpakThemesStorage::get_current_theme($post->ID);
        $main_infos = WpakApps::get_app_main_infos($post->ID);
        ?>

		<?php 
        if (!empty($available_themes)) {
            ?>
			<label><?php 
            _e('Choose theme', WpAppKit::i18n_domain);
            ?>
 : </label>
			<select name="wpak_app_theme_choice" id="wpak_app_theme_choice">
				<?php 
            foreach ($available_themes as $theme_slug => $theme_data) {
                ?>
					<?php 
                $selected = $theme_slug == $current_theme ? 'selected="selected"' : '';
                ?>
					<option value="<?php 
                echo $theme_slug;
                ?>
" <?php 
                echo $selected;
                ?>
><?php 
                echo $theme_data['Name'];
                ?>
 </option>
				<?php 
            }
            ?>
			</select>
		<?php 
        } else {
            ?>
			<div class="wpak_no_theme">
				<strong><?php 
            _e('No WP AppKit theme found!', WpAppKit::i18n_domain);
            ?>
</strong>
				<br/>
				<?php 
            echo sprintf(__('Please upload a WP AppKit theme from the "<a href="%s" >Upload Themes</a>" panel or copy a theme directly to the %s directory.', WpAppKit::i18n_domain), '/wp-admin/admin.php?page=wpak_bo_upload_themes', basename(WP_CONTENT_DIR) . '/' . WpakThemes::themes_directory);
            ?>
			</div>
		<?php 
        }
        ?>

		<?php 
        foreach ($available_themes as $theme => $theme_data) {
            ?>
			<div class="wpak-theme-data" id="wpak-theme-data-<?php 
            echo $theme;
            ?>
" style="display:none">
				<div class="theme-data-content">
					<?php 
            echo $theme_data['Description'];
            ?>

					<?php 
            $theme_meta = array();
            if (!empty($theme_data['Version'])) {
                $theme_meta[] = sprintf(__('Version %s'), $theme_data['Version']);
            }
            if (!empty($theme_data['Author'])) {
                $author = $theme_data['Author'];
                if (!empty($theme_data['AuthorURI'])) {
                    $author = '<a href="' . $theme_data['AuthorURI'] . '">' . $theme_data['Author'] . '</a>';
                }
                $theme_meta[] = sprintf(__('By %s'), $author);
            }
            if (!empty($theme_data['ThemeURI'])) {
                $theme_meta[] = sprintf('<a href="%s">%s</a>', esc_url($theme_data['ThemeURI']), __('Visit theme site'));
            }
            ?>

					<?php 
            if (!empty($theme_meta)) {
                ?>
						<div class="theme-meta-data"><?php 
                echo implode(' | ', $theme_meta);
                ?>
</div>
					<?php 
            }
            ?>
				</div>
			</div>
		<?php 
        }
        ?>

		<div class="wpak-app-title wpak_settings">
			<label><?php 
        _e('Application Title (displayed in app top bar)', WpAppKit::i18n_domain);
        ?>
</label> : <br/>
			<input id="wpak_app_title" type="text" name="wpak_app_title" value="<?php 
        echo $main_infos['title'];
        ?>
" />
		</div>

		<?php 
        wp_nonce_field('wpak-theme-data-' . $post->ID, 'wpak-nonce-theme-data');
        ?>

		<style>
			.wpak-theme-data{ padding:9px 12px; margin-bottom: 10px }
			.theme-data-content{ margin-top: 0 }
			.wpak-app-title{ margin-top: 15px; border-top: 1px solid #ddd; padding-top:10px }
			.theme-meta-data{ margin-top: 7px }
			.wpak_no_theme{ text-align: center; font-size:120%; line-height: 2em; margin:30px }
		</style>

		<script>
			(function(){
				var $ = jQuery;
				$('#wpak_app_theme_choice').change(function(){
					$('.wpak-theme-data').hide();
					var theme = this.value;
					$('#wpak-theme-data-'+ theme).show();
				});
				$('#wpak_app_theme_choice').change();
			})();
		</script>

		<?php 
        do_action('wpak_inner_main_infos_box', $post, $current_box);
    }
    public static function get_config_xml($app_id, $echo = false, $export_type = '')
    {
        $app_main_infos = WpakApps::get_app_main_infos($app_id);
        $app_name = $app_main_infos['name'];
        $app_description = $app_main_infos['desc'];
        $app_phonegap_id = $app_main_infos['app_phonegap_id'];
        $app_version = $app_main_infos['version'];
        $app_version_code = $app_main_infos['version_code'];
        $app_phonegap_version = $app_main_infos['phonegap_version'];
        $app_author = $app_main_infos['author'];
        $app_author_email = $app_main_infos['author_email'];
        $app_author_website = $app_main_infos['author_website'];
        $app_platform = $app_main_infos['platform'];
        $app_icons = $app_main_infos['icons'];
        $access = array();
        if ($export_type == 'phonegap-cli') {
            $access[] = array('origin' => '*', 'subdomains' => '');
        }
        /**
         * Filter : allows to modify config.xml <access> element
         *
         * @param array  	array		array of <access> elements 
         *                              Each <access> element is an array with the following attributes :
         *								- 'origin' string The domain of where the resource lives
         *								- 'subdomains' bool Whether to allow subdomains on the 
         *								  host specified in the origin parameter. Pass an empty
         *								  string to ignore this optional attribute.
         * @param int		$app_id		Application id
         */
        $access = apply_filters('wpak_config_xml_access', $access, $app_id);
        //Merge our default Phonegap Build plugins to those set in BO :
        $app_phonegap_plugins = WpakApps::get_merged_phonegap_plugins_xml($app_id, $app_main_infos['phonegap_plugins']);
        $xmlns = 'http://www.w3.org/ns/widgets';
        $xmlns_gap = 'http://phonegap.com/ns/1.0';
        if (!$echo) {
            ob_start();
        }
        echo '<?xml version="1.0" encoding="UTF-8" ?>';
        ?>

<widget xmlns       = "<?php 
        echo $xmlns;
        ?>
"
        xmlns:gap   = "<?php 
        echo $xmlns_gap;
        ?>
"
        id          = "<?php 
        echo $app_phonegap_id;
        ?>
"
        versionCode = "<?php 
        echo $app_version_code;
        ?>
"
        version     = "<?php 
        echo $app_version;
        ?>
" >

	<name><?php 
        echo $app_name;
        ?>
</name>

	<description><?php 
        echo $app_description;
        ?>
</description>

	<author href="<?php 
        echo $app_author_website;
        ?>
" email="<?php 
        echo $app_author_email;
        ?>
"><?php 
        echo $app_author;
        ?>
</author>

	<gap:platform name="<?php 
        echo $app_platform;
        ?>
" />
<?php 
        if (!empty($app_phonegap_version)) {
            ?>

	<preference name="phonegap-version" value="<?php 
            echo $app_phonegap_version;
            ?>
" />
<?php 
        }
        if (!empty($access)) {
            ?>

<?php 
            foreach ($access as $access_element) {
                if (empty($access_element['origin'])) {
                    continue;
                }
                $subdomains = '';
                if (isset($access_element['subdomains']) && is_bool($access_element['subdomains'])) {
                    $subdomains = ' subdomains="' . ($access_element['subdomains'] ? 'true' : 'false') . '"';
                }
                ?>
	<access origin="<?php 
                echo $access_element['origin'];
                ?>
"<?php 
                echo $subdomains;
                ?>
 />
<?php 
            }
        }
        /**
         * Filter to handle the  "Webview bounce effect" on devices.
         * Pass false to this filter to allow the "Webview bounce effect".
         *
         * @param boolean	true		Bounce effect is disallowed by default.
         * @param int		$app_id		Application id
         */
        if (apply_filters('wpak_config_xml_preference_disallow_overscroll', true, $app_id)) {
            ?>

	<preference name="<?php 
            echo $app_platform == 'android' ? 'd' : 'D';
            ?>
isallowOverscroll" value="true" />
	<preference name="webviewbounce" value="false" />
<?php 
        }
        ?>

	<!-- Add Icon, Splash screen and any PhoneGap plugin declaration here -->
<?php 
        if (!empty($app_icons)) {
            ?>

	<?php 
            echo str_replace("\n", "\n\t", $app_icons);
            ?>

<?php 
        }
        if (!empty($app_phonegap_plugins)) {
            ?>

	<?php 
            echo str_replace("\n", "\n\t", $app_phonegap_plugins);
            ?>

<?php 
        }
        ?>

</widget>
<?php 
        $content = '';
        if (!$echo) {
            $content = ob_get_contents();
            ob_end_clean();
        }
        return !$echo ? $content : '';
    }