Plugin Directory

Changeset 1500421


Ignore:
Timestamp:
09/22/2016 02:31:20 PM (10 years ago)
Author:
2leonkaden
Message:

change function name v4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • webapp-builder/trunk/webapp2.php

    r1490240 r1500421  
    1111
    1212register_activation_hook(__FILE__, 'myxnamewp2_activation');
    13 register_deactivation_hook(__FILE__, 'myxnamewp2_deactivation');
     13
    1414
    1515function myxnamewp2_activation() {
     
    9090
    9191
    92 function Zip($source, $destination){
     92function Zipwa2($source, $destination){
    9393    if (!extension_loaded('zip') || !file_exists($source)) {
    9494        return false;
    9595    }
    9696
    97     $zip = new ZipArchive();
    98     if (!$zip->open($destination, ZIPARCHIVE::CREATE)) {
     97    $zipwa2 = new ZipArchive();
     98    if (!$zipwa2->open($destination, ZIPARCHIVE::CREATE)) {
    9999        return false;
    100100    }
     
    118118            if (is_dir($file) === true)
    119119            {
    120                 $zip->addEmptyDir(str_replace($source . '/', '', $file . '/'));
     120                $zipwa2->addEmptyDir(str_replace($source . '/', '', $file . '/'));
    121121            }
    122122            else if (is_file($file) === true)
    123123            {
    124                 $zip->addFromString(str_replace($source . '/', '', $file), file_get_contents($file));
     124                $zipwa2->addFromString(str_replace($source . '/', '', $file), file_get_contents($file));
    125125            }
    126126        }
     
    128128    else if (is_file($source) === true)
    129129    {
    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
     140add_action('admin_menu', 'wa2submenu');
     141function wa2submenu() {
     142  add_submenu_page( 'options-general.php', 'Web app builder', 'Web app builder', 'manage_options', 'wa2submenu', 'wa2submenucallback' );
     143}
     144
     145function wa2submenucallback() {
    146146
    147147 
    148148
    149149  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');
    151151    echo '
    152152    <div id="setting-error-settings_updated" class="updated settings-error">
Note: See TracChangeset for help on using the changeset viewer.