@@ -1977,12 +1977,24 @@ function($accumulator, $functions)
19771977 'data ' => array (
19781978 'function ' => function ($ data ) use ($ txt , $ scripturl , $ context , $ filter_url )
19791979 {
1980- $ change_status = array ('before ' => '' , 'after ' => '' );
1981-
1982- $ change_status ['before ' ] = '<a href=" ' . $ scripturl . '?action=admin;area=maintain;sa=hooks;do= ' . ($ data ['enabled ' ] ? 'disable ' : 'enable ' ) . ';hook= ' . $ data ['hook_name ' ] . ';function= ' . urlencode ($ data ['function_name ' ]) . $ filter_url . '; ' . $ context ['admin-hook_token_var ' ] . '= ' . $ context ['admin-hook_token ' ] . '; ' . $ context ['session_var ' ] . '= ' . $ context ['session_id ' ] . '" data-confirm=" ' . $ txt ['quickmod_confirm ' ] . '" class="you_sure"> ' ;
1983- $ change_status ['after ' ] = '</a> ' ;
1984-
1985- return $ change_status ['before ' ] . '<span class="main_icons post_moderation_ ' . $ data ['status ' ] . '" title=" ' . $ data ['img_text ' ] . '"></span> ' . $ change_status ['after ' ];
1980+ // Cannot update temp hooks in any way, really. Just show the appropriate icon.
1981+ if ($ data ['status ' ] == 'temp ' )
1982+ {
1983+ return '<span class="main_icons ' . ($ data ['hook_exists ' ] ? 'posts ' : 'error ' ) . '" title=" ' . $ data ['img_text ' ] . '"></span> ' ;
1984+ }
1985+ else
1986+ {
1987+ $ change_status = array ('before ' => '' , 'after ' => '' );
1988+
1989+ // Can only enable/disable if it exists...
1990+ if ($ data ['hook_exists ' ])
1991+ {
1992+ $ change_status ['before ' ] = '<a href=" ' . $ scripturl . '?action=admin;area=maintain;sa=hooks;do= ' . ($ data ['enabled ' ] ? 'disable ' : 'enable ' ) . ';hook= ' . $ data ['hook_name ' ] . ';function= ' . urlencode ($ data ['function_name ' ]) . $ filter_url . '; ' . $ context ['admin-hook_token_var ' ] . '= ' . $ context ['admin-hook_token ' ] . '; ' . $ context ['session_var ' ] . '= ' . $ context ['session_id ' ] . '" data-confirm=" ' . $ txt ['quickmod_confirm ' ] . '" class="you_sure"> ' ;
1993+ $ change_status ['after ' ] = '</a> ' ;
1994+ }
1995+
1996+ return $ change_status ['before ' ] . '<span class="main_icons post_moderation_ ' . $ data ['status ' ] . '" title=" ' . $ data ['img_text ' ] . '"></span> ' . $ change_status ['after ' ];
1997+ }
19861998 },
19871999 'class ' => 'centertext ' ,
19882000 ),
@@ -2001,6 +2013,8 @@ function($accumulator, $functions)
20012013 <li><span class="main_icons post_moderation_allow"></span> ' . $ txt ['hooks_disable_legend_exists ' ] . '</li>
20022014 <li><span class="main_icons post_moderation_moderate"></span> ' . $ txt ['hooks_disable_legend_disabled ' ] . '</li>
20032015 <li><span class="main_icons post_moderation_deny"></span> ' . $ txt ['hooks_disable_legend_missing ' ] . '</li>
2016+ <li><span class="main_icons posts"></span> ' . $ txt ['hooks_disable_legend_temp ' ] . '</li>
2017+ <li><span class="main_icons error"></span> ' . $ txt ['hooks_disable_legend_temp_missing ' ] . '</li>
20042018 </ul> '
20052019 ),
20062020 ),
@@ -2014,7 +2028,8 @@ function($accumulator, $functions)
20142028 'data ' => array (
20152029 'function ' => function ($ data ) use ($ txt , $ scripturl , $ context , $ filter_url )
20162030 {
2017- if (!$ data ['hook_exists ' ])
2031+ // Note: Cannot remove temp hooks via the UI...
2032+ if (!$ data ['hook_exists ' ] && $ data ['status ' ] != 'temp ' )
20182033 return '
20192034 <a href=" ' . $ scripturl . '?action=admin;area=maintain;sa=hooks;do=remove;hook= ' . $ data ['hook_name ' ] . ';function= ' . urlencode ($ data ['function_name ' ]) . $ filter_url . '; ' . $ context ['admin-hook_token_var ' ] . '= ' . $ context ['admin-hook_token ' ] . '; ' . $ context ['session_var ' ] . '= ' . $ context ['session_id ' ] . '" data-confirm=" ' . $ txt ['quickmod_confirm ' ] . '" class="you_sure">
20202035 <span class="main_icons delete" title=" ' . $ txt ['hooks_button_remove ' ] . '"></span>
@@ -2100,6 +2115,7 @@ function get_integration_hooks_data($start, $per_page, $sort, $filtered_hooks, $
21002115 $ function_list += get_defined_functions_in_file ($ absPath_clean );
21012116
21022117 $ hook_exists = isset ($ function_list [$ hookParsedData ['call ' ]]) || (substr ($ hook , -8 ) === '_include ' && isset ($ files [$ absPath_clean ]));
2118+ $ hook_temp = !empty ($ context ['integration_hooks_temporary ' ][$ hook ][$ hookParsedData ['rawData ' ]]);
21032119 $ temp = array (
21042120 'hook_name ' => $ hook ,
21052121 'function_name ' => $ hookParsedData ['rawData ' ],
@@ -2108,8 +2124,8 @@ function get_integration_hooks_data($start, $per_page, $sort, $filtered_hooks, $
21082124 'file_name ' => strtr ($ hookParsedData ['absPath ' ] ?: ($ function_list [$ hookParsedData ['call ' ]] ?? '' ), [$ normalized_boarddir => '. ' ]),
21092125 'instance ' => $ hookParsedData ['object ' ],
21102126 'hook_exists ' => $ hook_exists ,
2111- 'status ' => $ hook_exists ? ($ hookParsedData ['enabled ' ] ? 'allow ' : 'moderate ' ) : 'deny ' ,
2112- 'img_text ' => $ txt ['hooks_ ' . ($ hook_exists ? ($ hookParsedData ['enabled ' ] ? 'active ' : 'disabled ' ) : 'missing ' )],
2127+ 'status ' => ( $ hook_temp ? ' temp ' : ( $ hook_exists ? ($ hookParsedData ['enabled ' ] ? 'allow ' : 'moderate ' ) : 'deny ' )) ,
2128+ 'img_text ' => $ txt ['hooks_ ' . ($ hook_exists ? ($ hook_temp ? ' temp ' : ( $ hookParsedData ['enabled ' ] ? 'active ' : 'disabled ' ) ) : 'missing ' )],
21132129 'enabled ' => $ hookParsedData ['enabled ' ],
21142130 );
21152131 $ sort_array [] = $ temp [$ sort_types [$ sort ][0 ]];
0 commit comments