PHP Classes

File: tests/sample-plugin.php

Recommend this page to a friend!
  Classes of Josantonius  >  WP_Register  >  tests/sample-plugin.php  >  Download  
File: tests/sample-plugin.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: WP_Register
Minify and unify CSS and JavaScript for WordPress
Author: By
Last change:
Date: 4 years ago
Size: 1,456 bytes
 

Contents

Class file image Download
<?php
/**
 * Register, minify and unify CSS and JavaScript resources.
 *
 * @author Josantonius - hello@josantonius.com
 * @copyright Copyright (c) 2017
 * @license https://opensource.org/licenses/MIT - The MIT License (MIT)
 * @link https://github.com/Josantonius/WP_Register
 * @since 1.0.4
 */

use Josantonius\File\File;

createFiles();

function
createFiles() {

   
File::createDir($css = WP_CORE_DIR . 'wp-content/themes/tests/css/');

   
File::createDir($js = WP_CORE_DIR . 'wp-content/themes/tests/js/');

    if (!
File::exists($css . 'editor-style.css')) {
       
       
file_put_contents($css . 'editor-style.css', "
           
            body, h1, h2, h3, h4, h5, h6 {
             font-family: 'Open Sans', sans-serif;
            }

            body {
             font-size: 1.6em;
             line-height: 1.6;
            }
        "
);
    }

    if (!
File::exists($css . 'style.css')) {
       
       
file_put_contents($css . 'style.css', "
           
            body, h1, h2, h3, h4, h5, h6 {
             font-family: 'Open Sans', sans-serif;
            }

            body {
             font-size: 1.6em;
             line-height: 1.6;
            }
        "
);
    }

    if (!
File::exists($js . 'html5.js')) {
       
       
file_put_contents($js . 'html5.js', "
           
            function myFunction() {

                document.getElementById('myCheck').click();
            }
        "
);
    }

    if (!
File::exists($js . 'navigation.js')) {
       
       
file_put_contents($js . 'navigation.js', "
           
            $('p').click(function(){
                alert('The paragraph was clicked.');
            });
        "
);
    }
}

For more information send a message to info at phpclasses dot org.