Plugin Directory

Changeset 1089508


Ignore:
Timestamp:
02/13/2015 11:45:02 PM (11 years ago)
Author:
GreatBlakes
Message:

Prefixed more functions, closing div fix too

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gearside-developer-dashboard/trunk/gearside_developer_dashboard.php

    r1044543 r1089508  
    8989        $todo_file_counter = 0;
    9090        $todo_instance_counter = 0;
    91         foreach ( glob_r($todo_dirpath . '/*') as $todo_file ) {
     91        foreach ( gearside_glob_r($todo_dirpath . '/*') as $todo_file ) {
    9292            $todo_counted = 0;
    9393            $todo_hidden = 0;
     
    102102                $todo_skipFilenames = array('README.md', 'nebula_admin_functions.php', 'error_log', 'Mobile_Detect.php', 'class-tgm-plugin-activation.php');
    103103
    104                 if ( !contains(basename($todo_file), $todo_skipExtensions) && !contains(basename($todo_file), $todo_skipFilenames) ) {
     104                if ( !gearside_contains(basename($todo_file), $todo_skipExtensions) && !gearside_contains(basename($todo_file), $todo_skipFilenames) ) {
    105105                    foreach ( file($todo_file) as $todo_lineNumber => $todo_line ) {
    106106                        $todo_hidden = 0;
     
    210210            echo '<style>.todo_results {height: auto !important; resize: none;}</style>';
    211211        }
    212         echo '</div><!--/todo_results-->';
     212        echo '</div><!--/todo_results--></div>';
    213213    }
    214214
     
    228228    function dashboard_developer_info() {
    229229
    230         $whois = getwhois(nebula_url_components('sld'), ltrim(nebula_url_components('tld'), '.'));
     230        $whois = getwhois(gearside_url_components('sld'), ltrim(gearside_url_components('tld'), '.'));
    231231
    232232        //Get Expiration Date
    233         if ( contains($whois, array('Registrar Registration Expiration Date: ')) ) {
     233        if ( gearside_contains($whois, array('Registrar Registration Expiration Date: ')) ) {
    234234            $domain_exp_detected = substr($whois, strpos($whois, "Registrar Registration Expiration Date: ")+40, 10);
    235         } elseif ( contains($whois, array('Registry Expiry Date: ')) ) {
     235        } elseif ( gearside_contains($whois, array('Registry Expiry Date: ')) ) {
    236236            $domain_exp_detected = substr($whois, strpos($whois, "Registry Expiry Date: ")+22, 10);
    237237        } else {
     
    246246
    247247        //Get Registrar URL
    248         if ( contains($whois, array('Registrar URL: ')) && contains($whois, array('Updated Date: ')) ) {
     248        if ( gearside_contains($whois, array('Registrar URL: ')) && gearside_contains($whois, array('Updated Date: ')) ) {
    249249            $domain_registrar_url_start = strpos($whois, "Registrar URL: ")+15;
    250250            $domain_registrar_url_stop = strpos($whois, "Updated Date: ")-$domain_registrar_url_start;
    251251            $domain_registrar_url = substr($whois, $domain_registrar_url_start, $domain_registrar_url_stop);
    252         } elseif ( contains($whois, array('Registrar URL: ')) && contains($whois, array('Update Date: ')) ) {
     252        } elseif ( gearside_contains($whois, array('Registrar URL: ')) && gearside_contains($whois, array('Update Date: ')) ) {
    253253            $domain_registrar_url_start = strpos($whois, "Registrar URL: ")+15;
    254254            $domain_registrar_url_stop = strpos($whois, "Update Date: ")-$domain_registrar_url_start;
    255255            $domain_registrar_url = substr($whois, $domain_registrar_url_start, $domain_registrar_url_stop);
    256         } elseif ( contains($whois, array('URL: ')) && contains($whois, array('Relevant dates:')) ) { //co.uk
     256        } elseif ( gearside_contains($whois, array('URL: ')) && gearside_contains($whois, array('Relevant dates:')) ) { //co.uk
    257257            $domain_registrar_url_start = strpos($whois, "URL: ")+5;
    258258            $domain_registrar_url_stop = strpos($whois, "Relevant dates: ")-$domain_registrar_url_start;
     
    264264        $domain_registrar_start = '';
    265265        $domain_registrar_stop = '';
    266         if ( contains($whois, array('Registrar: ')) && contains($whois, array('Sponsoring Registrar IANA ID:')) ) {
     266        if ( gearside_contains($whois, array('Registrar: ')) && gearside_contains($whois, array('Sponsoring Registrar IANA ID:')) ) {
    267267            $domain_registrar_start = strpos($whois, "Registrar: ")+11;
    268268            $domain_registrar_stop = strpos($whois, "Sponsoring Registrar IANA ID:")-$domain_registrar_start;
    269269            $domain_registrar = substr($whois, $domain_registrar_start, $domain_registrar_stop);
    270         } elseif ( contains($whois, array('Registrar: ')) && contains($whois, array('Registrar IANA ID: ')) ) {
     270        } elseif ( gearside_contains($whois, array('Registrar: ')) && gearside_contains($whois, array('Registrar IANA ID: ')) ) {
    271271            $domain_registrar_start = strpos($whois, "Registrar: ")+11;
    272272            $domain_registrar_stop = strpos($whois, "Registrar IANA ID: ")-$domain_registrar_start;
    273273            $domain_registrar = substr($whois, $domain_registrar_start, $domain_registrar_stop);
    274         } elseif ( contains($whois, array('Registrar: ')) && contains($whois, array('Registrar IANA ID: ')) ) {
     274        } elseif ( gearside_contains($whois, array('Registrar: ')) && gearside_contains($whois, array('Registrar IANA ID: ')) ) {
    275275            $domain_registrar_start = strpos($whois, "Registrar: ")+11;
    276276            $domain_registrar_stop = strpos($whois, "Registrar IANA ID: ")-$domain_registrar_start;
    277277            $domain_registrar = substr($whois, $domain_registrar_start, $domain_registrar_stop);
    278         } elseif ( contains($whois, array('Sponsoring Registrar:')) && contains($whois, array('Sponsoring Registrar IANA ID:')) ) {
     278        } elseif ( gearside_contains($whois, array('Sponsoring Registrar:')) && gearside_contains($whois, array('Sponsoring Registrar IANA ID:')) ) {
    279279            $domain_registrar_start = strpos($whois, "Sponsoring Registrar:")+21;
    280280            $domain_registrar_stop = strpos($whois, "Sponsoring Registrar IANA ID:")-$domain_registrar_start;
    281281            $domain_registrar = substr($whois, $domain_registrar_start, $domain_registrar_stop);
    282         } elseif ( contains($whois, array('Registrar:')) && contains($whois, array('Number: ')) ) {
     282        } elseif ( gearside_contains($whois, array('Registrar:')) && gearside_contains($whois, array('Number: ')) ) {
    283283            $domain_registrar_start = strpos($whois, "Registrar:")+17;
    284284            $domain_registrar_stop = strpos($whois, "Number: ")-$domain_registrar_start;
    285285            $domain_registrar = substr($whois, $domain_registrar_start, $domain_registrar_stop);
    286         } elseif ( contains($whois, array('Registrar:')) && contains($whois, array('URL:')) ) { //co.uk
     286        } elseif ( gearside_contains($whois, array('Registrar:')) && gearside_contains($whois, array('URL:')) ) { //co.uk
    287287            $domain_registrar_start = strpos($whois, "Registrar: ")+11;
    288288            $domain_registrar_stop = strpos($whois, "URL: ")-$domain_registrar_start;
     
    293293        //Get Reseller Name
    294294        $domain_reseller = '';
    295         if ( contains($whois, array('Reseller: ')) && contains($whois, array('Domain Status: ')) ) {
     295        if ( gearside_contains($whois, array('Reseller: ')) && gearside_contains($whois, array('Domain Status: ')) ) {
    296296            $reseller1 = strpos($whois, 'Reseller: ');
    297297            $reseller2 = strpos($whois, 'Reseller: ', $reseller1 + strlen('Reseller: '));
     
    323323
    324324        //Get last modified filename and date
    325         $dir = glob_r( get_template_directory() . '/*');
     325        $dir = gearside_glob_r( get_template_directory() . '/*');
    326326        $last_date = 0;
    327327        $skip_files = array();
     
    330330            if( is_file($file) ) {
    331331                $mod_date = filemtime($file);
    332                 if ( $mod_date > $last_date && !contains(basename($file), $skip_files) ) {
     332                if ( $mod_date > $last_date && !gearside_contains(basename($file), $skip_files) ) {
    333333                    $last_date = $mod_date;
    334334                    $last_filename = basename($file);
     
    337337            }
    338338        }
    339         $nebula_size = foldersize(get_template_directory());
     339        $nebula_size = gearside_foldersize(get_template_directory());
    340340        $upload_dir = wp_upload_dir();
    341         $uploads_size = foldersize($upload_dir['basedir']);
     341        $uploads_size = gearside_foldersize($upload_dir['basedir']);
    342342
    343343        $secureServer = '';
     
    435435
    436436    //Search theme or plugin files via Gearside Developer Metabox
    437     add_action('wp_ajax_search_theme_files', 'search_theme_files');
    438     add_action('wp_ajax_nopriv_search_theme_files', 'search_theme_files');
    439     function search_theme_files() {
     437    add_action('wp_ajax_gearside_search_theme_files', 'gearside_search_theme_files');
     438    add_action('wp_ajax_nopriv_gearside_search_theme_files', 'gearside_search_theme_files');
     439    function gearside_search_theme_files() {
    440440        if ( strlen($_POST['data'][0]['searchData']) < 3 ) {
    441441            echo '<p><strong>Error:</strong> Minimum 3 characters needed to search!</p>';
     
    459459        $file_counter = 0;
    460460        $instance_counter = 0;
    461         foreach ( glob_r($dirpath . '/*') as $file ) {
     461        foreach ( gearside_glob_r($dirpath . '/*') as $file ) {
    462462            $counted = 0;
    463463            if ( is_file($file) ) {
     
    470470                $skipExtensions = array('.jpg', '.jpeg', '.png', '.gif', '.ico', '.tiff', '.psd', '.ai',  '.apng', '.bmp', '.otf', '.ttf', '.ogv', '.flv', '.fla', '.mpg', '.mpeg', '.avi', '.mov', '.woff', '.eot', '.mp3', '.mp4', '.wmv', '.wma', '.aiff', '.zip', '.zipx', '.rar', '.exe', '.dmg', '.swf', '.pdf', '.pdfx', '.pem');
    471471                $skipFilenames = array('error_log');
    472                 if ( !contains(basename($file), $skipExtensions) && !contains(basename($file), $skipFilenames) ) {
     472                if ( !gearside_contains(basename($file), $skipExtensions) && !gearside_contains(basename($file), $skipFilenames) ) {
    473473                    foreach ( file($file) as $lineNumber => $line ) {
    474474                        if ( stripos($line, $_POST['data'][0]['searchData']) !== false ) {
     
    510510
    511511     //Get the full URL. Not intended for secure use ($_SERVER var can be manipulated by client/server).
    512     function nebula_requested_url($host="HTTP_HOST") { //Can use "SERVER_NAME" as an alternative to "HTTP_HOST".
     512    function gearside_requested_url($host="HTTP_HOST") { //Can use "SERVER_NAME" as an alternative to "HTTP_HOST".
    513513        $protocol = ( (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443 ) ? 'https' : 'http';
    514514        $full_url = $protocol . '://' . $_SERVER["$host"] . $_SERVER["REQUEST_URI"];
     
    518518
    519519    //Separate a URL into it's components.
    520     function nebula_url_components($segment="all", $url=null) {
     520    function gearside_url_components($segment="all", $url=null) {
    521521        if ( !$url ) {
    522             $url = nebula_requested_url();
     522            $url = gearside_requested_url();
    523523        }
    524524
     
    598598            case ('file') : //Filename will be just the filename/extension.
    599599            case ('filename') :
    600                 if ( contains(basename($url_compontents['path']), array('.')) ) {
     600                if ( gearside_contains(basename($url_compontents['path']), array('.')) ) {
    601601                    return basename($url_compontents['path']);
    602602                } else {
     
    606606
    607607            case ('path') : //Path should be just the path without the filename/extension.
    608                 if ( contains(basename($url_compontents['path']), array('.')) ) { //@TODO "Nebula" 0: This will possibly give bad data if the directory name has a "." in it
     608                if ( gearside_contains(basename($url_compontents['path']), array('.')) ) { //@TODO "Nebula" 0: This will possibly give bad data if the directory name has a "." in it
    609609                    return str_replace(basename($url_compontents['path']), '', $url_compontents['path']);
    610610                } else {
     
    626626
    627627    //Traverse multidimensional arrays
    628     function in_array_r($needle, $haystack, $strict = true) {
     628    function gearside_in_array_r($needle, $haystack, $strict = true) {
    629629        foreach ($haystack as $item) {
    630             if (($strict ? $item === $needle : $item == $needle) || (is_array($item) && in_array_r($needle, $item, $strict))) {
     630            if (($strict ? $item === $needle : $item == $needle) || (is_array($item) && gearside_in_array_r($needle, $item, $strict))) {
    631631                return true;
    632632            }
     
    636636
    637637    //Recursive Glob
    638     function glob_r($pattern, $flags = 0) {
     638    function gearside_glob_r($pattern, $flags = 0) {
    639639        $files = glob($pattern, $flags);
    640640        foreach (glob(dirname($pattern) . '/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) {
    641             $files = array_merge($files, glob_r($dir . '/' . basename($pattern), $flags));
     641            $files = array_merge($files, gearside_glob_r($dir . '/' . basename($pattern), $flags));
    642642        }
    643643        return $files;
     
    645645
    646646    //Add up the filesizes of files in a directory (and it's sub-directories)
    647     function foldersize($path) {
     647    function gearside_foldersize($path) {
    648648        $total_size = 0;
    649649        $files = scandir($path);
     
    653653                $currentFile = $cleanPath . $t;
    654654                if (is_dir($currentFile)) {
    655                     $size = foldersize($currentFile);
     655                    $size = gearside_foldersize($currentFile);
    656656                    $total_size += $size;
    657657                } else {
     
    665665
    666666    //Checks to see if an array contains a string.
    667     function contains($str, array $arr) {
     667    function gearside_contains($str, array $arr) {
    668668        foreach( $arr as $a ) {
    669669            if ( stripos($str, $a) !== false ) {
Note: See TracChangeset for help on using the changeset viewer.