Last active
December 15, 2015 02:09
-
-
Save MaraScott/5184973 to your computer and use it in GitHub Desktop.
Name : environment_message() - Language : PHP - type : message - Platform : generic - tag : jQuery, box, text, alert, IP, development, production, localhost
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $env = array( | |
| 'url' => array( | |
| '000.00.000.00'=>'ONLINE', | |
| '127.0.0.1'=>'OFFLINE', | |
| ), | |
| 'type' => array( | |
| 'dev' => 'DEVELOPMENT', | |
| 'www' => 'PRODUCTION' | |
| ) | |
| ); | |
| $env_url = $_SERVER['REMOTE_ADDR']; | |
| $env_type = array_shift(explode(".",$_SERVER['HTTP_HOST'])); | |
| ?> | |
| <?php if (isset($env['url'][$env_url])) { ?> | |
| <?php | |
| $message = $env['url'][$env_url] . ' ' . $env['type'][$env_type] . ' ENVIRONMENT'; | |
| if ($env['url'][$env_url] === 'ONLINE' AND $env['type'][$env_type] === 'PRODUCTION') { | |
| $message .= ' - Thanks to try this website with an external IP - Your IP is : '.$env_url.' - You can download the free VPN : <a target="_blank" href="http://dw.com.com/redir?edId=3&siteId=4&oId=3000-2092_4-10594721&ontId=2092_4&spi=fb436b5df666856258a92686079b28b0&lop=link&tag=tdw_dltext<ype=dl_dlnow&pid=13005325&mfgId=6287710&merId=6287710&pguid=UUaNLgoOYJIAACd-mBcAAACy&ctype=dm&cval=NONE&destUrl=http%3A%2F%2Fdownload.cnet.com%2F3001-2092_4-10594721.html%3Fspi%3Dfb436b5df666856258a92686079b28b0%26part%3Ddl-6287710" title="free VPN">Hotspot Shield</a>'; | |
| } | |
| ?> | |
| <script type="text/javascript">jQuery('body').prepend('<div style="background: #bada55;color: #3F370E;height: 14px;text-align: center;position: fixed;z-index: 1000000;right: 0;top: 0;font-size: 8px;line-height: 14px;padding: 0 2px 0 5px;border-radius: 0 0 0 5px;font-weight: bold;letter-spacing: 0.2em;"><?php echo $message; ?></div>');</script> | |
| <?php } ?> | |
| <?php | |
| // WORDPRESS MULTISTE CONFIGURATION | |
| // in wordpressRootFolder/wp-content/themes/davaskMultisiteOptimization.php | |
| function davaskEnvMessage () { | |
| $davaskEnv = array( | |
| 'url' => array( | |
| '000.00.000.000'=>'ONLINE', | |
| '127.0.0.1'=>'OFFLINE', | |
| ), | |
| 'type' => array( | |
| 'dev' => 'DEVELOPMENT', | |
| 'www' => 'PRODUCTION', | |
| 'domain' => 'NETWORK' | |
| ) | |
| ); | |
| $davaskEnv_url = $_SERVER['REMOTE_ADDR']; | |
| $davaskEnv_type = array_shift(explode(".",$_SERVER['HTTP_HOST'])); | |
| if (isset($davaskEnv['url'][$davaskEnv_url])) { | |
| $message = $davaskEnv['url'][$davaskEnv_url] . ' ' . $davaskEnv['type'][$davaskEnv_type] . ' ENVIRONMENT'; | |
| if ($davaskEnv['url'][$davaskEnv_url] === 'ONLINE' AND $davaskEnv['type'][$davaskEnv_type] === 'PRODUCTION') { | |
| $message .= ' - Thanks to try this website with an external IP - Your IP is : '.$davaskEnv_url.' - You can download the free VPN : <a target="_blank" href="http://dw.com.com/redir?edId=3&siteId=4&oId=3000-2092_4-10594721&ontId=2092_4&spi=fb436b5df666856258a92686079b28b0&lop=link&tag=tdw_dltext<ype=dl_dlnow&pid=13005325&mfgId=6287710&merId=6287710&pguid=UUaNLgoOYJIAACd-mBcAAACy&ctype=dm&cval=NONE&destUrl=http%3A%2F%2Fdownload.cnet.com%2F3001-2092_4-10594721.html%3Fspi%3Dfb436b5df666856258a92686079b28b0%26part%3Ddl-6287710" title="free VPN">Hotspot Shield</a>'; | |
| } | |
| return '<script type="text/javascript">jQuery(\'body\').prepend(\'<div style="background: #bada55;color: #3F370E;height: 14px;text-align: center;position: fixed;z-index: 1000000;right: 0;top: 0;font-size: 8px;line-height: 14px;padding: 0 2px 0 5px;border-radius: 0 0 0 5px;font-weight: bold;letter-spacing: 0.2em;">' . $message . '</div>\');</script>'; | |
| } // END IF | |
| } // END FUNC | |
| function adminFooterOptimization () { | |
| echo ' | |
| <!-- ### davask.42 optimization --> | |
| <p>Optimized by <a href="http://davaskdot42.wordpress.com/" target="_blank">Davask.42</a></p> | |
| ' . davaskEnvMessage() . ' | |
| <!-- davask.42 optimization ### --> | |
| '; | |
| } // END FUNC | |
| function footerOptimization () { | |
| echo ' | |
| <!-- ### davask.42 optimization --> | |
| ' . davaskEnvMessage() . ' | |
| <!-- davask.42 optimization ### --> | |
| '; | |
| } // END FUNC | |
| // in wordpressRootFolder/wp-content/themes/yourtheme/functions.php | |
| /** | |
| * WordPress.com-davask functions and definitions | |
| */ | |
| require(__DIR__.'/../davaskMultisiteOptimization.php'); | |
| add_filter('admin_footer_text', 'adminFooterOptimization'); | |
| // in wordpressRootFolder/wp-content/themes/yourtheme/footer.php | |
| /** | |
| * WordPress.com-davask functions and definitions | |
| */ | |
| footerOptimization(); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment