Plugin Directory

Changeset 1729600


Ignore:
Timestamp:
09/13/2017 10:58:46 PM (8 years ago)
Author:
radovank
Message:

added new field type post-multiple and get method

Location:
template-dictionary/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • template-dictionary/trunk/admin/admin.php

    r1713705 r1729600  
    8181        include_once __DIR__ . '/types/date.php';
    8282        include_once __DIR__ . '/types/post.php';
     83        include_once __DIR__ . '/types/post-multiple.php';
    8384        include_once __DIR__ . '/types/media.php';
    8485        include_once __DIR__ . '/types/check.php';
    8586
    8687        $types = array(
    87             'string'  => 'TemplateDictionary_Type_String',
    88             'number'  => 'TemplateDictionary_Type_Number',
    89             'text'    => 'TemplateDictionary_Type_Text',
    90             'wysiwyg' => 'TemplateDictionary_Type_Wysiwyg',
    91             'email'   => 'TemplateDictionary_Type_Email',
    92             'select'  => 'TemplateDictionary_Type_Select',
    93             'date'    => 'TemplateDictionary_Type_Date',
    94             'post'    => 'TemplateDictionary_Type_Post',
    95             'media'   => 'TemplateDictionary_Type_Media',
    96             'check'   => 'TemplateDictionary_Type_Check',
     88            'string'           => 'TemplateDictionary_Type_String',
     89            'number'           => 'TemplateDictionary_Type_Number',
     90            'text'             => 'TemplateDictionary_Type_Text',
     91            'wysiwyg'          => 'TemplateDictionary_Type_Wysiwyg',
     92            'email'            => 'TemplateDictionary_Type_Email',
     93            'select'           => 'TemplateDictionary_Type_Select',
     94            'date'             => 'TemplateDictionary_Type_Date',
     95            'post'             => 'TemplateDictionary_Type_Post',
     96            'post_multiple'    => 'TemplateDictionary_Type_PostMultiple',
     97            'media'            => 'TemplateDictionary_Type_Media',
     98            'check'            => 'TemplateDictionary_Type_Check',
    9799        );
    98100       
  • template-dictionary/trunk/admin/types/post.php

    r1713594 r1729600  
    1111    protected $table_type = 'int';
    1212
    13     protected $changeable_to = array( 'number', 'string', 'text', 'wysiwyg' );
     13    protected $changeable_to = array( 'number', 'string', 'text', 'wysiwyg', 'post_multiple' );
    1414
    1515    public function __construct( $options = null ){
  • template-dictionary/trunk/readme.txt

    r1713705 r1729600  
    3434This function returns the value. If you need to echo the value, you can use function `eget`. Both functions have an optional argument `$default`, which is the default returned/echoed value, if the admin value is empty.
    3535
     36You can also get the value by accessing the code as property:
     37
     38`$value = TmplDict()->the_code;`
     39
    3640= Usage with shortcode =
    3741You can also use a shortcode `[tmpl_dict]` with attributes `code`, `default` and `do_shortcode`. The last attribute says, if the function `do_shortcode` will be called on the value.
     
    5862== Changelog ==
    5963
     64= 1.02 =
     65* Added post-multiple field type.
     66* Added method __get for accessing dictionary values as properties.
     67
    6068= 1.01 =
    6169* Fix: notice after deleting setting
  • template-dictionary/trunk/template-dictionary.php

    r1713705 r1729600  
    33 * Plugin Name: Template Dictionary
    44 * Description: A plugin for developers which provides template variables dictionary editable in backend.
    5  * Version:     1.01
     5 * Version:     1.02
    66 * Author:      Radovan Kneblík
    77 * License:     GPL2
     
    2424     * @var string
    2525     */
    26     public $version = '1.01';
     26    private $version = '1.02';
    2727
    2828    /**
     
    287287
    288288    /**
     289     * Get the dictionary value for given code as property.
     290     * @param string $code
     291     * @return string|int
     292     */
     293    public function __get( $code ){
     294        return $this->get( $code );
     295    }
     296
     297    /**
    289298     * Set the dictionary value for given code.
    290299     * @param string $code
Note: See TracChangeset for help on using the changeset viewer.