Changeset 1500421
- Timestamp:
- 09/22/2016 02:31:20 PM (10 years ago)
- File:
-
- 1 edited
-
webapp-builder/trunk/webapp2.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
webapp-builder/trunk/webapp2.php
r1490240 r1500421 11 11 12 12 register_activation_hook(__FILE__, 'myxnamewp2_activation'); 13 register_deactivation_hook(__FILE__, 'myxnamewp2_deactivation'); 13 14 14 15 15 function myxnamewp2_activation() { … … 90 90 91 91 92 function Zip ($source, $destination){92 function Zipwa2($source, $destination){ 93 93 if (!extension_loaded('zip') || !file_exists($source)) { 94 94 return false; 95 95 } 96 96 97 $zip = new ZipArchive();98 if (!$zip ->open($destination, ZIPARCHIVE::CREATE)) {97 $zipwa2 = new ZipArchive(); 98 if (!$zipwa2->open($destination, ZIPARCHIVE::CREATE)) { 99 99 return false; 100 100 } … … 118 118 if (is_dir($file) === true) 119 119 { 120 $zip ->addEmptyDir(str_replace($source . '/', '', $file . '/'));120 $zipwa2->addEmptyDir(str_replace($source . '/', '', $file . '/')); 121 121 } 122 122 else if (is_file($file) === true) 123 123 { 124 $zip ->addFromString(str_replace($source . '/', '', $file), file_get_contents($file));124 $zipwa2->addFromString(str_replace($source . '/', '', $file), file_get_contents($file)); 125 125 } 126 126 } … … 128 128 else if (is_file($source) === true) 129 129 { 130 $zip ->addFromString(basename($source), file_get_contents($source));131 } 132 133 return $zip ->close();134 } 135 136 137 138 139 140 add_action('admin_menu', ' register_my_custom_submenu_page');141 function register_my_custom_submenu_page() {142 add_submenu_page( 'options-general.php', 'Web app builder', 'Web app builder', 'manage_options', ' my-custom-submenu-page', 'my_custom_submenu_page_callback' );143 } 144 145 function my_custom_submenu_page_callback() {130 $zipwa2->addFromString(basename($source), file_get_contents($source)); 131 } 132 133 return $zipwa2->close(); 134 } 135 136 137 138 139 140 add_action('admin_menu', 'wa2submenu'); 141 function wa2submenu() { 142 add_submenu_page( 'options-general.php', 'Web app builder', 'Web app builder', 'manage_options', 'wa2submenu', 'wa2submenucallback' ); 143 } 144 145 function wa2submenucallback() { 146 146 147 147 148 148 149 149 if(isset($_POST['createzip'])){ 150 Zip (plugin_dir_path( __FILE__ ).'android', plugin_dir_path( __FILE__ ).'android-'.date('d-m-Y').'.zip');150 Zipwa2(plugin_dir_path( __FILE__ ).'android', plugin_dir_path( __FILE__ ).'android-'.date('d-m-Y').'.zip'); 151 151 echo ' 152 152 <div id="setting-error-settings_updated" class="updated settings-error">
Note: See TracChangeset
for help on using the changeset viewer.