Changeset 24182


Ignore:
Timestamp:
Aug 18, 2013, 4:08:14 PM (11 years ago)
Author:
mistic100
Message:

remove php end tags, remove at symbol in template, add example of class handlers, remove useless files

Location:
extensions/skeleton/trunk
Files:
1 added
1 deleted
20 edited

Legend:

Unmodified
Added
Removed
  • extensions/skeleton/trunk/admin.php

    r21304 r24182  
    3232// template vars
    3333$template->assign(array(
    34   'SKELETON_PATH'=> get_root_url() . SKELETON_PATH, // used for images, scripts, ... access
     34  'SKELETON_PATH'=> SKELETON_PATH, // used for images, scripts, ... access
    3535  'SKELETON_ABS_PATH'=> realpath(SKELETON_PATH),    // used for template inclusion (Smarty needs a real path)
    3636  'SKELETON_ADMIN' => SKELETON_ADMIN,
     
    3939// send page content
    4040$template->assign_var_from_handle('ADMIN_CONTENT', 'skeleton_content');
    41 
    42 ?>
  • extensions/skeleton/trunk/admin/config.php

    r23395 r24182  
    3333// define template file
    3434$template->set_filename('skeleton_content', realpath(SKELETON_PATH . 'admin/template/config.tpl'));
    35 
    36 ?>
  • extensions/skeleton/trunk/admin/home.php

    r17899 r24182  
    1414// define template file
    1515$template->set_filename('skeleton_content', realpath(SKELETON_PATH . 'admin/template/home.tpl'));
    16 
    17 ?>
  • extensions/skeleton/trunk/admin/photo.php

    r21659 r24182  
    4747
    4848$template->set_filename('skeleton_content', realpath(SKELETON_PATH . 'admin/template/photo.tpl'));
    49 
    50 ?>
  • extensions/skeleton/trunk/admin/template/config.tpl

    r23395 r24182  
    2121<form method="post" action="" class="properties">
    2222<fieldset>
    23   <legend>{'Common configuration'|@translate}</legend>
     23  <legend>{'Common configuration'|translate}</legend>
    2424 
    2525  <ul>
     
    2727      <label>
    2828        <input type="checkbox" name="option2" value="1" {if $skeleton.option2}checked="checked"{/if}>
    29         <b>{'Checkbox'|@translate}</b>
     29        <b>{'Checkbox'|translate}</b>
    3030      </label>
    31       <a class="showInfo" title="{'Check me!'|@translate}">i</a>
     31      <a class="icon-info-circled-1 showInfo" title="{'Check me!'|translate}"></a>
    3232    </li>
    3333    <li class="option1" {if not $skeleton.option2}style="display:none;"{/if}>
    3434      <label>
    35         <b>{'Integer'|@translate}</b>
     35        <b>{'Integer'|translate}</b>
    3636        <input type="text" name="option1" value="{$skeleton.option1}" size="4">
    3737      </label>
     
    3939    <li>
    4040      <label>
    41         <b>{'Select'|@translate}</b>
     41        <b>{'Select'|translate}</b>
    4242        {html_options name=option3 options=$select_options selected=$skeleton.option3}
    4343      </label>
     
    4646</fieldset>
    4747
    48 <p class="formButtons"><input type="submit" name="save_config" value="{'Save Settings'|@translate}"></p>
     48<p class="formButtons"><input type="submit" name="save_config" value="{'Save Settings'|translate}"></p>
    4949
    5050</form>
  • extensions/skeleton/trunk/admin/template/home.tpl

    r23395 r24182  
    1111<form method="post" action="" class="properties">
    1212<fieldset>
    13   <legend>{'What Skeleton can do for me?'|@translate}</legend>
     13  <legend>{'What Skeleton can do for me?'|translate}</legend>
    1414 
    1515  {$INTRO_CONTENT}
  • extensions/skeleton/trunk/admin/template/photo.tpl

    r17899 r24182  
    11{combine_css path=$SKELETON_PATH|@cat:"admin/template/style.css"}
    22
    3 <h2>{$TITLE} &#8250; {'Edit photo'|@translate} {$TABSHEET_TITLE}</h2>
     3<h2>{$TITLE} &#8250; {'Edit photo'|translate} {$TABSHEET_TITLE}</h2>
    44
    55
    66<form action="{$F_ACTION}" method="post" id="catModify">
    77  <fieldset>
    8     <legend>{'My awesome photo tab'|@translate}</legend>
     8    <legend>{'My awesome photo tab'|translate}</legend>
    99
    1010    <p>
    11       <img src="{$TN_SRC}" alt="{'Thumbnail'|@translate}" class="Thumbnail">
     11      <img src="{$TN_SRC}" alt="{'Thumbnail'|translate}" class="Thumbnail">
    1212    </p>
    1313
    1414    <p>
    15       <input class="submit" type="submit" value="{'Save'|@translate}" name="save_skeleton">
     15      <input class="submit" type="submit" value="{'Save'|translate}" name="save_skeleton">
    1616    </p>
    1717  </fieldset>
  • extensions/skeleton/trunk/admin/template/style.css

    r17899 r24182  
    1 .showInfo {
    2   position:static;
    3   display:inline-block;
    4   padding:1px 6px;
    5   width:4px;
    6   height:14px;
    7   line-height:14px;
    8   font-size:0.8em;
    9 }
    10 
    111.square-list {
    122  list-style:square !important;
  • extensions/skeleton/trunk/include/admin_events.inc.php

    r18858 r24182  
    9494  }
    9595}
    96 
    97 ?>
  • extensions/skeleton/trunk/include/functions.inc.php

    r18858 r24182  
    22defined('SKELETON_PATH') or die('Hacking attempt!');
    33
    4 
    5 
    6 ?>
     4// you can add something here :-)
  • extensions/skeleton/trunk/include/install.inc.php

    r23395 r24182  
    6666
    6767}
    68 
    69 ?>
  • extensions/skeleton/trunk/include/public_events.inc.php

    r23398 r24182  
    5757
    5858/**
    59  * add link in existing menu
    60  */
    61 function skeleton_blockmanager_apply1($menu_ref_arr)
    62 {
    63   $menu = &$menu_ref_arr[0]; 
    64  
    65   if ( ($block = $menu->get_block('mbMenu')) != null )
    66   {
    67     array_push($block->data, array(
    68       'URL' => SKELETON_PUBLIC,
    69       'TITLE' => l10n('Skeleton'),
    70       'NAME' => l10n('Skeleton'),
    71     ));
    72   }
    73 }
    74 
    75 /**
    76  * add a nbew menu block
    77  */
    78 function skeleton_blockmanager_register_blocks($menu_ref_arr)
    79 {
    80   $menu = &$menu_ref_arr[0];
    81  
    82   if ($menu->get_id() == 'menubar')
    83   {
    84     $menu->register_block(new RegisteredBlock('mbSkeleton', l10n('Skeleton'), 'skeleton'));
    85   }
    86 }
    87 
    88 /**
    89  * fill the added menu block
    90  */
    91 function skeleton_blockmanager_apply2($menu_ref_arr)
    92 {
    93   $menu = &$menu_ref_arr[0];
    94  
    95   if ( ($block = $menu->get_block('mbSkeleton')) != null )
    96   {
    97     global $template;
    98    
    99     $block->set_title(l10n('Skeleton'));
    100    
    101     $block->data['link1'] =
    102       array(
    103         'URL' => get_absolute_root_url(),
    104         'TITLE' => l10n('First link'),
    105         'NAME' => l10n('Link 1'),
    106         'REL'=> 'rel="nofollow"',
    107       );
    108 
    109     $block->data['link2'] =
    110       array(
    111         'URL' => SKELETON_PUBLIC,
    112         'TITLE' => l10n('Second link'),
    113         'NAME' => l10n('Link 2'),
    114       );
    115    
    116     $template->set_template_dir(SKELETON_PATH . 'template/');
    117     $block->template = 'menubar_skeleton.tpl';
    118   }
    119 }
    120 
    121 /**
    12259 * add a prefilter on photo page
    12360 */
     
    14077  return str_replace($search, $replace, $content);
    14178}
    142  
    143 
    144 ?>
  • extensions/skeleton/trunk/include/skeleton_page.inc.php

    r23398 r24182  
    1616$template->set_filename('skeleton_page', realpath(SKELETON_PATH . 'template/skeleton_page.tpl'));
    1717$template->assign_var_from_handle('CONTENT', 'skeleton_page');
    18 
    19 ?>
  • extensions/skeleton/trunk/include/ws_functions.inc.php

    r23395 r24182  
    2626  return phpinfo(constant($params['what']));
    2727}
    28 
    29 
    30 ?>
  • extensions/skeleton/trunk/main.inc.php

    r21307 r24182  
    1919global $prefixeTable;
    2020
     21
    2122// +-----------------------------------------------------------------------+
    2223// | Define plugin constants                                               |
     
    3233
    3334
     35
    3436// +-----------------------------------------------------------------------+
    3537// | Add event handlers                                                    |
     
    3840add_event_handler('init', 'skeleton_init');
    3941
     42/*
     43 * this is the common way to define event functions: create a new function for each event you want to handle
     44 */
    4045if (defined('IN_ADMIN'))
    4146{
     47  // file containing all admin handlers functions
     48  include_once(SKELETON_PATH . 'include/admin_events.inc.php');
     49 
    4250  // admin plugins menu link
    4351  add_event_handler('get_admin_plugin_menu_links', 'skeleton_admin_plugin_menu_links');
     
    5361  add_event_handler('loc_end_element_set_global', 'skeleton_loc_end_element_set_global');
    5462  add_event_handler('element_set_global_action', 'skeleton_element_set_global_action', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
    55  
    56   // file containing all previous handlers functions
    57   include_once(SKELETON_PATH . 'include/admin_events.inc.php');
    5863}
    5964else
    6065{
     66  // file containing all public handlers functions
     67  include_once(SKELETON_PATH . 'include/public_events.inc.php');
     68 
    6169  // add a public section
    6270  add_event_handler('loc_end_section_init', 'skeleton_loc_end_section_init');
    6371  add_event_handler('loc_end_index', 'skeleton_loc_end_page');
    64  
    65   // add item to existing menu (EVENT_HANDLER_PRIORITY_NEUTRAL+10 is for compatibility with Advanced Menu Manager)
    66   add_event_handler('blockmanager_apply', 'skeleton_blockmanager_apply1', EVENT_HANDLER_PRIORITY_NEUTRAL+10);
    67  
    68   // add a new menu block
    69   add_event_handler('blockmanager_register_blocks', 'skeleton_blockmanager_register_blocks');
    70   add_event_handler('blockmanager_apply', 'skeleton_blockmanager_apply2');
    71   // NOTE: skeleton_blockmanager_apply1() and skeleton_blockmanager_apply2() can (should) be merged
    7272 
    7373  // add button on album and photos pages
     
    7777  // prefilter on photo page
    7878  add_event_handler('loc_end_picture', 'skeleton_loc_end_picture');
    79  
    80   // file containing all previous handlers functions
    81   include_once(SKELETON_PATH . 'include/public_events.inc.php');
    8279}
    8380
    8481// add API function
    8582add_event_handler('ws_add_methods', 'skeleton_ws_add_methods');
     83
     84
     85/*
     86 * event functions can also be wrapped in a class
     87 */
     88
     89// file containing the class for menu handlers functions
     90include_once(SKELETON_PATH . 'include/menu_events.class.php');
     91
     92// add item to existing menu (EVENT_HANDLER_PRIORITY_NEUTRAL+10 is for compatibility with Advanced Menu Manager plugin)
     93add_event_handler('blockmanager_apply', array('SkeletonMenu', 'blockmanager_apply1'), EVENT_HANDLER_PRIORITY_NEUTRAL+10);
     94
     95// add a new menu block (the declaration must be done every time, in order to be able to manage the menu block in "Menus" screen and Advanced Menu Manager)
     96add_event_handler('blockmanager_register_blocks', array('SkeletonMenu', 'blockmanager_register_blocks'));
     97add_event_handler('blockmanager_apply', array('SkeletonMenu', 'blockmanager_apply2'));
     98// NOTE: blockmanager_apply1() and blockmanager_apply2() can (must) be merged
     99
    86100
    87101
     
    104118 
    105119  // apply upgrade if needed
    106   if (
    107     SKELETON_VERSION == 'auto' or
    108     $pwg_loaded_plugins[SKELETON_ID]['version'] == 'auto' or
    109     version_compare($pwg_loaded_plugins[SKELETON_ID]['version'], SKELETON_VERSION, '<')
    110   )
    111   {
    112     // call install function
    113     include_once(SKELETON_PATH . 'include/install.inc.php');
    114     skeleton_install();
    115    
    116     // update plugin version in database
    117     if ( $pwg_loaded_plugins[SKELETON_ID]['version'] != 'auto' and SKELETON_VERSION != 'auto' )
    118     {
    119       $query = '
    120 UPDATE '. PLUGINS_TABLE .'
    121 SET version = "'. SKELETON_VERSION .'"
    122 WHERE id = "'. SKELETON_ID .'"';
    123       pwg_query($query);
    124      
    125       $pwg_loaded_plugins[SKELETON_ID]['version'] = SKELETON_VERSION;
    126      
    127       if (defined('IN_ADMIN'))
    128       {
    129         $_SESSION['page_infos'][] = 'Skeleton updated to version '. SKELETON_VERSION;
    130       }
    131     }
    132   }
     120  include_once(SKELETON_PATH . 'include/install.inc.php');
     121  request_plugin_update(SKELETON_ID, SKELETON_VERSION, 'skeleton_install');
    133122 
    134123  // load plugin language file
     
    138127  $conf['skeleton'] = unserialize($conf['skeleton']);
    139128}
    140 
    141 ?>
  • extensions/skeleton/trunk/maintain.inc.php

    r21304 r24182  
    7070  rmdir($dir);
    7171}
    72 
    73 ?>
  • extensions/skeleton/trunk/template/menubar_skeleton.tpl

    r23395 r24182  
    11<dt>{$block->get_title()}</dt>
    22<dd>
    3   {'Menublock added by Skeleton plugin'|@translate}
     3  {'Menublock added by Skeleton plugin'|translate}
    44        <ul>{strip}
    55                {foreach from=$block->data item=link}
  • extensions/skeleton/trunk/template/my_button.tpl

    r21307 r24182  
    11{strip}
    2 <a href="javascript:alert('Hello world!');" title="{'This is not the button you are looking for'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
     2<a href="javascript:alert('Hello world!');" title="{'This is not the button you are looking for'|translate}" class="pwg-state-default pwg-button" rel="nofollow">
    33  <span class="pwg-icon" style="background:url('{$ROOT_URL}{$SKELETON_PATH}template/head.png') center center no-repeat;"> </span>
    4   <span class="pwg-button-text">{'Skeleton'|@translate}</span>
     4  <span class="pwg-button-text">{'Skeleton'|translate}</span>
    55</a>
    66{/strip}
  • extensions/skeleton/trunk/template/skeleton_page.tpl

    r23398 r24182  
    2020
    2121{* <!-- add page content here --> *}
    22 <h1>{'What Skeleton can do for me?'|@translate}</h1>
     22<h1>{'What Skeleton can do for me?'|translate}</h1>
    2323<blockquote>
    2424  {$INTRO_CONTENT}
    2525</blockquote>
    2626
    27 <div id="test">Click for fun</div>
     27<div id="test">{'Click for fun'|translate}</div>
  • extensions/skeleton/trunk/template/style.css

    r17899 r24182  
    1919  -webkit-transform:rotate(5deg);
    2020  -o-transform:rotate(5deg);
     21  transform:rotate(5deg);
    2122  letter-spacing:10px;
    2223  box-shadow:10px 10px 10px rgba(0,0,0,0.5);
     
    2728  -webkit-transform:rotate(175deg);
    2829  -o-transform:rotate(175deg);
     30  transform:rotate(175deg);
    2931}
Note: See TracChangeset for help on using the changeset viewer.