Developers

This section is code snippets, apps, etc, for developers. There is no warranty or guarantee, assume every thing in this section is protected under the DBAD License unless otherwise stated. I might specifically change a license from DBAD to MIT or another free license that offers greater protection for the consumers of the code. If you need something contained in here to be under a specific license for a project or something, contact me (you can send a PM to Michael) and I'll see about changing the license. 

4 files

  1. Free

    Storm is a collection of dev tools from the past year of working with IPS 4. It includes the follow:
    Profiler:
    Profiles information about your dev board. logs queries and their execution time. Memory total. Include files and their size. Speed, how fast things are executin (profiles db execution and percentage of time it takes to query, as well parseoutputfordisplay in system/Lang.php). Cache, shows what caches are being used and as well which ones being set. Logs, includes the output from \IPS\Log.

    To enable:
    in your constants.php, add define('CJ_STORM_PROFILER', true);
    DB queries, Files, cache, logs are handled automatically.
    Memory, Speed are partially handled automatically. you can utilize these tabs in your own application:
    Memory:
    place this at the beginning of your method:
    if( ( defined( 'CJ_STORM_PROFILER') and CJ_STORM_PROFILER ) or ( defined( 'CJ_STORM_PROFILER_SAFE_MODE' ) and CJ_STORM_PROFILER_SAFE_MODE and \IPS\storm\Profiler::profilePassCheck() ) ){
            \IPS\storm\Profiler::i()->memStart();
    }
    and then this at the end of your method:
    if( ( defined( 'CJ_STORM_PROFILER') and CJ_STORM_PROFILER ) or ( defined( 'CJ_STORM_PROFILER_SAFE_MODE' ) and CJ_STORM_PROFILER_SAFE_MODE and \IPS\storm\Profiler::profilePassCheck() ) ){
            \IPS\storm\Profiler::i()->memEnd( 'myMethod' );
    }
    **the memEnd method requires a paramter so you can easily identify it in the tab/console.

    Speed:
    place this at the beginning of your method:
    if( ( defined( 'CJ_STORM_PROFILER') and CJ_STORM_PROFILER ) or ( defined( 'CJ_STORM_PROFILER_SAFE_MODE' ) and CJ_STORM_PROFILER_SAFE_MODE and \IPS\storm\Profiler::profilePassCheck() ) ){
            \IPS\storm\Profiler::i()->timeStart();
    }
    and then this at the end of your method:
    if( ( defined( 'CJ_STORM_PROFILER') and CJ_STORM_PROFILER ) or ( defined( 'CJ_STORM_PROFILER_SAFE_MODE' ) and CJ_STORM_PROFILER_SAFE_MODE and \IPS\storm\Profiler::profilePassCheck() ) ){
            \IPS\storm\Profiler::i()->timeEnd( 'myMethod' );
    }
    **the timeEnd method requires a paramter so you can easily identify it in the tab/console.

    Autoloader:
    you can add:
            require_once ( \IPS\ROOT_PATH ."/applications/storm/sources/Profiler/Autoloader.php" );
    to public static function init() in init.php and then use any of the above methods in the autoloader. There is a special method included in this class called "autoloaded". add this below the require_once($path) in the autoloader method:
                \IPS\storm\Profiler\Autoloader::i()->autoloaded($path);
    and the files include will gain the ability to tell you which files are autoloaded and which ones are manually included. 

    Special Use:
    you can use this with IN_DEV disabled, and with CJ_STORM_PROFILER not defined or set to false (if set to true will show to any one).
    inf you constant.php set:
    define( 'CJ_STORM_PROFILER_SAFE_MODE');
    define( 'CJ_STORM_PROFILER_PASS', 'somepassword');
    and if you pass &profilerPass=somepassword it will display for you thru out the remainder of your session.
    ProxyClassGenerator:
    generates proxy class for IPS 4 framework, to allow tools of your IDE like autocomplete and hinting to work.
    Dev Folder Tools:
    allows you to recreate the dev folder for a majority of most applications and plugins. this is useful if you are a developer and want to debug issues with third party apps/plugins while in in_dev mode. or replace the Dev Folder incase of them being lost, very useful for plugins.
    Headerdoc:
    adds a doc block to the head of each php class in your application on build. On build it adds a temp doc block (this process only runs if the file doesn't have a temp doc block or a doc block that doesn't match the temp block. this will trigger git/svn as the file changing). If the file already has a matching doc block no changes will be made. On download, it will swap out the temp doc block with a permanent doc block in the tar only (this is useful if you use git/svn and so it doesn't mark all files as needing pushed again).
    Temp Block:
    /**  * @brief       Test Class  * @author      -storm_author-  * @copyright   -storm_copyright-  * @package     IPS Social Suite  * @subpackage  Storm  * @since       1.0.0  * @version     -storm_version-  */ Permanent Block in tar:
    /**  * @brief       Test Class  * @author      <a href='http://codingjungle.com'>Michael Edwards</a>  * @copyright   (c) 2016 Michael Edwards  * @package     IPS Social Suite  * @subpackage  Storm  * @since       1.0.0  * @version     1.0.0  */ Headerdoc has the ability to be enabled or disabled and if enabled, which applications it runs on build/download. You will need to create a "storm extensions" for your application. you can do this in the dev center. click on the extensions tab, choose to create a headerdoc from the storm option. the extension has directions on how to use it.
    Sources Tab:
    adds a tab to the developer center, to allow you to create class types (normal, active record, node, content item, content comment), creates a basic class file that you can work from.
    Universal Console Debugger:
    outputs messages to console, without a browser extension, should support all browsers that support the browser api for console:
    example:
    if( defined( 'CJ_STORM_DEBUG_CONSOLE' ) and CJ_STORM_DEBUG_CONSOLE ) {     \IPS\storm\Debug::console( [string|array], [type:log,debug,dir,dirxml,error,info], [include backtrace (bool)] ); } to enable, add to your constants.php:
    define( 'CJ_STORM_DEBUG_CONSOLE', true);

    File Logger:
    IPS debug log is sorta annoying to work with, this will write to a log file to disk. to enable, add to your constants.php:
    define( 'CJ_STORM_DEBUG_LOG', true);

    Example:
    if( defined( 'CJ_STORM_DEBUG_LOG' ) and CJ_STORM_DEBUG_LOG ) {     \IPS\storm\Debug::log( [string|array] ); } will store by default to uploads/logs, the file will be created without a file extension.

    Template Debugging:
    building on IPS DEBUG_TEMPLATES, will store the compiled templates in /templates instead of your OS's temp folder, so if they do error out, the file is accessible. will not auto delete the files after shutdown, will need to be cleared manually. will also only rewrite the file if the contents have changed. to enable, in your constants.php add these two lines:
    define( 'DEBUG_TEMPLATES', true );
    define( 'CJ_STORM_DEBUG_TEMPLATES', true );
    if you already have a DEBUG_TEMPLATES constant, just set the value to true.
    Bitbuck webhook Push:
    use a bitbuck webhook, only supports "push" for right now. there is a widget that will display the hash, who made the push, and the push message. 
    webhook url: 
    http://mysite.com/index.php?app=storm&module=bitbucket&controller=index
     

    0 downloads

       (0 reviews)

    0 comments

    Updated

  2. Free

    download the file, directions are in there.

    1 download

       (0 reviews)

    0 comments

    Updated

  3. Free

    Any one who follows me over on IPS knows I have had many complaints about the forms and form helpers. Tired of sounds of crickets chirping while waiting for IPS to make improvements or take in considerations from the community, I built this class file for applications. 
     
    Usage:
    \IPS\myapp\Forms::i( $elements, $instancename, $form ) ( after $form, all the parameters are the same that you would find for \IPS\Helpers\Form\__construct method, but most of the time you will only need to set the $elements, $instancename is if you have multiple forms on the same page).
    $elements:
    tab, header, sidebar:
    'type' = tab|header|sidebar
    'name' =  used for all these to create them, if it is a lang/string, this is what is passed to the appropriate form command.
    example:
    $el[] = [ 'type' => 'tab|header|sidebar', 'name' => 'my_lang_string' ]; separator:
    'type' = 'separator'
    example:
    $el[] = [ 'type' => 'separator' ]; message: ->addMessage( $lang, $css='', $parse=TRUE, $_id=NULL)
    'type' = 'message'
    'msg' = this options is require for this type, the message you want to display
    optional:
    'css' = any additional css classes
    'parse' = default is true, set to false if msg is an already parsed lang string
    'id' = id of the element, default is null
    Example:
    $el[] = [ 'type' => 'message', 'msg' => 'my_message_lang_string' 'css' => 'myMessageClass myMessageClassWarning" ];
    helper:
    required:
    'name' = name of the element
    'class' = IPS Form Help Class (without the \IPS\Helpers\Form portion) or a FQN for a custom class.
    optional:
    'default' = the default value
    'required' = is it required or not
    'options' = an array of options for the class (identical to how options are set for form helpers)
    'validation' = validation method, can use a closure here, identical to how its set on the form helper.
    'prefix' = prefix for the form helper
    'suffix' = suffix for the form helper
    'id' = id for the form helper (if not set, the class will automatically configure name parameter with js_ prepend to it)
    'skip_id' = (bool) if 'id' isn't set, and you want it not to set it to js_name
    'label' = a lang string to use as the label instead of 'name'
    'description' => a lang string to use as an alternative description (this requires a hook to work, more on that later).
    'appearRequired' => (bool) make the form helper appear required.
     
    Example:
    $el[] = [ 'class' => 'Select', 'name' => 'my_select_element', 'required' => true, 'options' => [ 'options' => [ 1, 2, 3, 4 ] ] ];  
    dummy: ->addDummy( $langKey, $value, $desc='', $warning='', $id='' )
    Required:
    'type' = 'dummy'
    'name' = name of the element
    'default' = value that will be display
    Optional:
    'desc' = description
    'warning' = warning
    'id' = html id (if not set, js_$name is used)
    Example:
    $el[] = [ 'type' => 'dummy', 'name' => 'my_dummy_element', 'default' => "content for the dummy element" ];  
    html: ->addHtml( $html )
    Required:
    'type' = 'html'
    'html' = the html to display
    Example:
    $el[] = [ 'type' => 'html', 'html' => "<a href='#'>some html</a>" ];  
    Matrix: ->addMatrix( $name, $matrix )
    Required:
    'type' = 'matrix'
    'matrix = must be an instance of \IPS\Helpers\Form\Matrix
    'name' = elements name.
    Example:
    $matrix = new \IPS\Helpers\Form\Matrix; $el[] = [ 'type' => 'matrix', 'matrix' => $matrix, 'name' => 'my_matrix_element' ];  
    i() method:
    public static function i( array $elements, $name = 'default', $form = null, $id = 'form', $submitLang = 'save', $action = null, $attributes = [] ) the instantiation method is pretty straight forward, you pass the array of elements to it, if you have multiple forms on the page, you can give the instance a name. if you have a form object already (like in nodes) just pass it Forms, the other parameters are for creating a new form, same parameters as \IPS\Form.
     
    Bringing it all together:
    $elements = [ [ 'type' => 'tab', 'name' => 'my_tab_1' ], [ 'class' => 'Text', 'name' => 'my_title', 'required' => true 'validation' => function( $data ){ if( !$data ) { throw new \InvalidArgumentException; } } ], [ 'class' => "Select", 'name' => "my_select', 'options' => [ 'options' => [ 1, 2, 3, 4 ] ] ], [ 'type' => 'tab', 'name' => 'my_tab_2' ], [ 'class' => "TexArea", 'name' => 'my_text_area', 'default' => 'im a default' ], [ 'type' => 'separator' ], [ 'class' => 'Text', 'name' => 'my_text_2' ] ]; $form = \IPS\myapp\Form::i( $elements ); \IPS\Output::i()->output = $form;  
    this will return an instance of \IPS\Form. 
     
     
    Advance Usage form helpers 'description':
    you will need to create a theme hook for Core/System: global:forms

    and then select 'span.ipsFieldRow_desc" as the css "selector" and "replace" for the action.

     
    and in the content include this:
     
    <span class="ipsFieldRow_desc"> {{if isset( $object->options['description']) }} {$object->options['description']} {{else}} %s {{endif}} </span> this in not a ideal method, but the formAbstract is pretty muddy, would not be an easy way to "hook" into it, to alter this. this is only if you want to be able to have dynamic descriptions.

    0 downloads

       (0 reviews)

    0 comments

    Updated

  4. Free

    This tool is for developers who have files on the IPS market (or not, its not a requirement).
    Features:
    receives push notifications from IPS marketplace make pull request to the IPS marketplace for previous purchase/expirations/renewals generate invoices on the IPS marketplace File management (special features if you have downloads, you can link to files to retrieve information from it) News api (allows you to output news to your application if you want) Version checks (can manage update checks for applications/plugins, if you have downloads, create a custom field for "long versions" so all the info can be pulled from the download file) Create forum topics for push notifications Create Members for your site based on push notifications for purchases. (will send out an email to the user with username, password)

    0 downloads

       (0 reviews)

    0 comments

    Updated