Changeset 9410


Ignore:
Timestamp:
Feb 28, 2011, 10:50:28 AM (13 years ago)
Author:
patdenice
Message:

Some optimizations.

Location:
extensions/PWG_Stuffs
Files:
10 edited
2 copied

Legend:

Unmodified
Added
Removed
  • extensions/PWG_Stuffs/admin/add_module.inc.php

    r9383 r9410  
    7272
    7373        $query = '
    74 INSERT INTO ' . STUFFS_TABLE . ' ( id, pos, name, descr, path, parent, datas, users, groups, show_title, on_home, on_root, on_cats, on_picture, id_line, width )
     74INSERT INTO ' . STUFFS_TABLE . ' ( id, pos, name, descr, path, datas, users, groups, show_title, on_home, on_root, on_cats, on_picture, id_line, width )
    7575VALUES (' . $next_element_id . ' ,
    7676  ' . $pos . ',
     
    7878  ' . $desc . ',
    7979  "' . $module_path . '",
    80   ' . (isset($modules[$module_path]['parent']) ? '"'.$modules[$module_path]['parent'].'"' : 'NULL') .',
    8180  ' . $sav_datas . ',
    8281  ' . $users . ',
  • extensions/PWG_Stuffs/admin/admin.php

    r9383 r9410  
    77load_language('plugin.lang', STUFFS_PATH);
    88include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
    9 include_once(STUFFS_PATH . 'include/functions.inc.php');
     9include_once(STUFFS_PATH . 'functions.inc.php');
    1010$my_base_url = get_admin_plugin_menu_link(__FILE__);
    1111
     
    4242{
    4343  $module['path'] = PHPWG_ROOT_PATH.trim($module['path'], './').'/';
    44 
    45   if (preg_match('#^'.preg_quote(PHPWG_PLUGINS_PATH).'([^/]*?)/#', $module['path'], $match) and $match[1] != 'PWG_Stuffs')
    46   {
    47    $module['parent'] = $match[1];
    48   }
    4944  $modules[$module['path']] = $module;
    5045}
  • extensions/PWG_Stuffs/admin/manage.inc.php

    r9383 r9410  
    3737
    3838// Display
    39 $q = 'SELECT id, name, descr, path, parent, id_line, width, datas
     39$q = 'SELECT id, name, descr, path, id_line, width, datas
    4040FROM ' . STUFFS_TABLE . '
    4141ORDER BY pos ASC;';
     
    6060  $module['name'] = !empty($module['path']) ? $module['name'] : l10n('stuffs_main_block');
    6161
     62  $missing = false;
     63  if (!empty($module['path']))
     64  {
     65    preg_match('#^'.preg_quote(PHPWG_PLUGINS_PATH).'([^/]*?)/#', $module['path'], $match);
     66    $missing = !isset($pwg_loaded_plugins[$match[1]]);
     67  }
     68
    6269  $template->append('modules', array(
    6370    'ID' => $module['id'],
     
    7380    'U_EDIT' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . STUFFS_DIR . '%2Fadmin%2Fadmin.php&tab=edit_module&edit='.$module['id'],
    7481    'U_DELETE' => !is_adviser() ? PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . STUFFS_DIR . '%2Fadmin%2Fadmin.php&del=' . $module['id'] : '',
    75     'MISSING' => (isset($module['parent']) and !isset($pwg_loaded_plugins[$module['parent']])),
     82    'MISSING' => $missing,
    7683    )
    7784  );
  • extensions/PWG_Stuffs/admin/upgrade.inc.php

    r9383 r9410  
    9292  $query = 'ALTER TABLE ' . $prefixeTable . 'stuffs
    9393CHANGE `type` `path` VARCHAR( 255 ) NULL DEFAULT NULL,
    94 ADD `parent` VARCHAR( 255 ) NULL DEFAULT NULL AFTER `path`,
    9594ADD `level` TINYINT( 3 ) NOT NULL default "0" AFTER `groups`,
    9695ADD `on_root` enum(\'true\',\'false\') NOT NULL AFTER `on_home`
  • extensions/PWG_Stuffs/class.inc.php

    r9383 r9410  
    99  var $blocks = array();
    1010  var $pos = 'begin';
    11   var $template_var = array();
     11  var $prefixe = 'PLUGIN_INDEX_CONTENT_';
    1212
    1313  function stuffs()
     
    1717    if ($page['stuffs_section'] == 'on_picture')
    1818    {
    19       $this->template_var['begin'] = 'PLUGIN_PICTURE_BEFORE';
    20       $this->template_var['end'] = 'PLUGIN_PICTURE_AFTER';
     19      $this->prefixe = 'PLUGIN_PICTURE_';
    2120      $template->set_prefilter('header', array('stuffs', 'prefilter_picture_css'));
    2221      pwgs_picture_special_sections();
     
    2423    else
    2524    {
    26       $this->template_var['begin'] = 'PLUGIN_INDEX_CONTENT_BEFORE';
    27       $this->template_var['end'] = 'PLUGIN_INDEX_CONTENT_AFTER';
    2825      $template->set_prefilter( 'header', array('stuffs', 'prefilter_index_css') );
    2926    }
     
    5552
    5653    $query = '
    57 SELECT DISTINCT id, name, path, parent, datas, groups, show_title, id_line, width
     54SELECT DISTINCT id, name, path, datas, groups, show_title, id_line, width
    5855FROM ' . STUFFS_TABLE . '
    5956LEFT JOIN ' . USER_GROUP_TABLE . '
     
    9289        continue;
    9390      }
    94       if (isset($module['parent']) and !isset($pwg_loaded_plugins[$module['parent']]))
     91
     92      preg_match('#^'.preg_quote(PHPWG_PLUGINS_PATH).'([^/]*?)/#', $module['path'], $match);
     93      if (!isset($pwg_loaded_plugins[$match[1]]))
    9594      {
    9695        continue;
  • extensions/PWG_Stuffs/main.inc.php

    r9383 r9410  
    3737  global $template;
    3838
    39   include(STUFFS_PATH . 'include/class.inc.php');
    40   include(STUFFS_PATH . 'include/functions.inc.php');
     39  include(STUFFS_PATH . 'class.inc.php');
     40  include(STUFFS_PATH . 'functions.inc.php');
    4141
    4242  $template->set_template_dir(STUFFS_PATH.'theme/template/');
     
    4848  {
    4949    $template->assign('blocks', $stuffs->blocks['begin']);
    50     $template->concat($stuffs->template_var['begin'],  $template->parse('stuffs', true));
     50    $template->concat($stuffs->prefixe.'BEFORE',  $template->parse('stuffs', true));
    5151  }
    5252  if (!empty($stuffs->blocks['end']))
    5353  {
    5454    $template->assign('blocks', $stuffs->blocks['end']);
    55     $template->concat($stuffs->template_var['end'],  $template->parse('stuffs', true));
     55    $template->concat($stuffs->prefixe.'AFTER',  $template->parse('stuffs', true));
    5656  }
    5757}
  • extensions/PWG_Stuffs/maintain.inc.php

    r9383 r9410  
    1717`descr` varchar(255) default NULL,
    1818`path` varchar(255) default NULL,
    19 `parent` varchar(255) default NULL,
    2019`datas` longtext default NULL,
    2120`users` varchar(255) default NULL,
  • extensions/PWG_Stuffs/modules/BestRated/config.inc.php

    r9383 r9410  
    3030  'cat_display' => $datas['cat_display'],
    3131  'category_selected' => $datas['cat_selection'],
    32   'on_picture_option' => false,
    33 ));
     32  )
     33);
     34
     35$display_options = & $template->get_template_vars('display_options');
     36$display_options['on_picture'] = false;
    3437
    3538$template->set_filenames(array('module_options' => dirname(__FILE__) . '/config.tpl'));
  • extensions/PWG_Stuffs/modules/MostVisited/config.inc.php

    r9383 r9410  
    3030  'cat_display' => $datas['cat_display'],
    3131  'category_selected' => $datas['cat_selection'],
    32   'on_picture_option' => false,
    33 ));
     32  )
     33);
     34
     35$display_options = & $template->get_template_vars('display_options');
     36$display_options['on_picture'] = false;
    3437
    3538$template->set_filenames(array('module_options' => dirname(__FILE__) . '/config.tpl'));
  • extensions/PWG_Stuffs/modules/Random/config.inc.php

    r9383 r9410  
    3030  'cat_display' => $datas['cat_display'],
    3131  'category_selected' => $datas['cat_selection'],
    32   'on_picture_option' => false,
    33 ));
     32  )
     33);
     34
     35$display_options = & $template->get_template_vars('display_options');
     36$display_options['on_picture'] = false;
    3437
    3538$template->set_filenames(array('module_options' => dirname(__FILE__) . '/config.tpl'));
  • extensions/PWG_Stuffs/modules/Recent/config.inc.php

    r9383 r9410  
    3030  'cat_display' => $datas['cat_display'],
    3131  'category_selected' => $datas['cat_selection'],
    32   'on_picture_option' => false,
    33 ));
     32  )
     33);
     34
     35$display_options = & $template->get_template_vars('display_options');
     36$display_options['on_picture'] = false;
    3437
    3538$template->set_filenames(array('module_options' => dirname(__FILE__) . '/config.tpl'));
Note: See TracChangeset for help on using the changeset viewer.