本文整理汇总了PHP中gpPlugin::Filter方法的典型用法代码示例。如果您正苦于以下问题:PHP gpPlugin::Filter方法的具体用法?PHP gpPlugin::Filter怎么用?PHP gpPlugin::Filter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gpPlugin
的用法示例。
在下文中一共展示了gpPlugin::Filter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gp_html_output
function gp_html_output($text)
{
$this->gp_html_parse($text);
$this->dom_array = gpPlugin::Filter('Html_Output', array($this->dom_array));
$this->Clean();
$this->Rebuild();
}
示例2: __construct
function __construct($text)
{
parent::__construct($text);
$this->dom_array = gpPlugin::Filter('Html_Output', array($this->dom_array));
$this->Clean();
$this->Rebuild();
}
示例3: Check
/**
* Verify the user submitted form by checking anti-spam hooks and/or recaptcha if they exist
* @static
*
*/
static function Check()
{
global $page, $langmessage, $config, $dataDir;
// if hooks return false, stop
if (!gpPlugin::Filter('AntiSpam_Check', array(true))) {
return false;
}
// if recaptcha inactive, stop
if (!gp_recaptcha::hasRecaptcha()) {
return true;
}
//prevent undefined index warnings if there is a bot
$_POST += array('recaptcha_challenge_field' => '', 'recaptcha_response_field' => '');
//includeFile('thirdparty/recaptchalib.php');
require_once $dataDir . '/include/thirdparty/recaptchalib.php';
$resp = recaptcha_check_answer($config['recaptcha_private'], $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
if (!$resp->is_valid) {
message($langmessage['INCORRECT_CAPTCHA']);
//if( common::LoggedIn() ){
// message($langmessage['recaptcha_said'],$resp->error);
//}
return false;
}
return true;
}
示例4: RunScript
function RunScript()
{
global $gp_index, $langmessage, $page;
$scriptinfo = special_display::GetScriptInfo($this->requested);
if ($scriptinfo === false) {
switch ($this->requested) {
case 'Special_ExtraJS':
$this->ExtraJS();
//dies
}
$this->Error_404($this->title);
return;
}
$this->gp_index = $gp_index[$this->requested];
$this->label = common::GetLabel($this->requested);
$this->TitleInfo = $scriptinfo;
$menu_permissions = false;
if (common::LoggedIn()) {
$menu_permissions = admin_tools::HasPermission('Admin_Menu');
if ($menu_permissions) {
$page->admin_links[] = common::Link($this->title, $langmessage['rename/details'], 'cmd=renameform', ' name="gpajax" ');
$page->admin_links[] = common::Link('Admin_Menu', $langmessage['current_layout'], 'cmd=layout&from=page&index=' . urlencode($this->gp_index), ' title="' . $langmessage['current_layout'] . '" name="gpabox"');
}
if (admin_tools::HasPermission('Admin_User')) {
$page->admin_links[] = common::Link('Admin_Users', $langmessage['permissions'], 'cmd=file_permissions&index=' . urlencode($this->gp_index), ' title="' . $langmessage['permissions'] . '" name="gpabox" ');
}
}
//allow addons to affect page actions and how a page is displayed
$cmd = common::GetCommand();
$cmd_after = gpPlugin::Filter('PageRunScript', array($cmd));
if ($cmd !== $cmd_after) {
$cmd = $cmd_after;
if ($cmd === 'return') {
return;
}
}
if ($menu_permissions) {
switch ($cmd) {
// rename & details
case 'renameform':
$this->RenameForm();
return;
case 'renameit':
if ($this->RenameFile()) {
return;
}
break;
}
}
$this->contentBuffer = special_display::ExecInfo($scriptinfo);
}
示例5: HighlighterSettings
function HighlighterSettings()
{
$this->config = gpPlugin::GetConfig();
$this->config += array('theme' => 'default');
$this->themes = array('default' => 'Default', 'django' => 'Django', 'eclipse' => 'Eclipse', 'emacs' => 'Emacs', 'fadetogrey' => 'Fade to Grey', 'midnight' => 'Midnight', 'rdark' => 'RDark', 'none' => '[None]');
$this->themes = gpPlugin::Filter('syntaxhighlighter_themes', array($this->themes));
$cmd = common::GetCommand();
switch ($cmd) {
case 'save':
$this->Save();
break;
}
$this->ShowForm();
}
示例6: RunScript
function RunScript()
{
global $gp_index, $langmessage, $page;
$scriptinfo = special_display::GetScriptInfo($this->title);
if ($scriptinfo === false) {
switch ($this->title) {
case 'Special_ExtraJS':
$this->ExtraJS();
//dies
}
$this->Error_404($this->title);
return;
}
$this->gp_index = $gp_index[$this->title];
$this->TitleInfo = $scriptinfo;
if (!$this->CheckVisibility()) {
return false;
}
//allow addons to affect page actions and how a page is displayed
$cmd = common::GetCommand();
$cmd_after = gpPlugin::Filter('PageRunScript', array($cmd));
if ($cmd !== $cmd_after) {
$cmd = $cmd_after;
if ($cmd === 'return') {
return;
}
}
if (common::LoggedIn()) {
$menu_permissions = admin_tools::HasPermission('Admin_Menu');
if ($menu_permissions) {
switch ($cmd) {
// rename & details
case 'renameform':
$this->RenameForm();
return;
case 'renameit':
if ($this->RenameFile()) {
return;
}
break;
case 'ToggleVisibility':
$this->ToggleVisibility();
break;
}
}
$this->AdminLinks();
}
$this->contentBuffer = special_display::ExecInfo($scriptinfo);
}
示例7: Check
/**
* Verify the user submitted form by checking anti-spam hooks and/or recaptcha if they exist
* @static
*
*/
static function Check()
{
global $page, $langmessage, $config, $dataDir;
// if hooks return false, stop
if (!gpPlugin::Filter('AntiSpam_Check', array(true))) {
return false;
}
// if recaptcha inactive, stop
if (!gp_recaptcha::hasRecaptcha()) {
return true;
}
if (empty($_POST['g-recaptcha-response'])) {
return false;
}
require_once $dataDir . '/include/thirdparty/recaptcha/autoload.php';
if (!ini_get('allow_url_fopen')) {
// allow_url_fopen = Off
$recaptcha = new \ReCaptcha\ReCaptcha($config['recaptcha_private'], new \ReCaptcha\RequestMethod\SocketPost());
} else {
// allow_url_fopen = On
$recaptcha = new \ReCaptcha\ReCaptcha($config['recaptcha_private']);
}
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
$resp = $recaptcha->verify($_POST['g-recaptcha-response'], $ip);
if (!$resp->isSuccess()) {
//$error_codes = $resp->getErrorCodes();
//error_log();
msg($langmessage['INCORRECT_CAPTCHA']);
return false;
}
return true;
}
示例8: GetMenuArray
/**
* Return the data for the requested menu, return the main menu if the requested menu doesn't exist
* @param string $id String identifying the requested menu
* @return array menu data
*/
static function GetMenuArray($id)
{
global $dataDir, $gp_menu;
$menu_file = $dataDir . '/data/_menus/' . $id . '.php';
if (empty($id) || !gpFiles::Exists($menu_file)) {
return gpPlugin::Filter('GetMenuArray', array($gp_menu));
}
$menu = gpFiles::Get('_menus/' . $id, 'menu');
if (gpFiles::$last_version && version_compare(gpFiles::$last_version, '3.0b1', '<')) {
$menu = gpOutput::FixMenu($menu);
}
return gpPlugin::Filter('GetMenuArray', array($menu));
}
示例9: admin_menu_new
function admin_menu_new()
{
global $langmessage, $page, $config;
$page->ajaxReplace = array();
$page->css_admin[] = '/include/css/admin_menu_new.css';
$page->head_js[] = '/include/thirdparty/js/nestedSortable.js';
$page->head_js[] = '/include/thirdparty/js/jquery_cookie.js';
$page->head_js[] = '/include/js/admin_menu_new.js';
$this->max_level_index = max(3, gp_max_menu_level - 1);
$page->head_script .= 'var max_level_index = ' . $this->max_level_index . ';';
$cmd = common::GetCommand();
$this->avail_menus['gpmenu'] = $langmessage['Main Menu'];
$this->avail_menus['all'] = $langmessage['All Pages'];
$this->avail_menus['hidden'] = $langmessage['Not In Main Menu'];
$this->avail_menus['nomenus'] = $langmessage['Not In Any Menus'];
$this->avail_menus['search'] = $langmessage['search pages'];
if (isset($config['menus'])) {
foreach ($config['menus'] as $id => $menu_label) {
$this->avail_menus[$id] = $menu_label;
}
}
//early commands
switch ($cmd) {
case 'altmenu_create':
$this->AltMenu_Create();
break;
case 'rm_menu':
$this->AltMenu_Remove();
break;
case 'alt_menu_rename':
$this->AltMenu_Rename();
break;
}
//read cookie settings
if (isset($_COOKIE['gp_menu_prefs'])) {
parse_str($_COOKIE['gp_menu_prefs'], $this->cookie_settings);
}
$this->SetMenuID();
$this->SetMenuArray();
$this->SetCollapseSettings();
$this->SetQueryInfo();
$cmd_after = gpPlugin::Filter('MenuCommand', array($cmd));
if ($cmd !== $cmd_after) {
$cmd = $cmd_after;
if ($cmd === 'return') {
return;
}
}
switch ($cmd) {
case 'rename_menu_prompt':
$this->RenameMenuPrompt();
return;
//menu creation
//menu creation
case 'newmenu':
$this->NewMenu();
return;
//rename
//rename
case 'renameform':
$this->RenameForm();
//will die()
return;
case 'renameit':
$this->RenameFile();
break;
case 'hide':
$this->Hide();
break;
case 'drag':
$this->SaveDrag();
break;
case 'trash_page':
case 'trash':
$this->MoveToTrash($cmd);
break;
case 'add_hidden':
$this->AddHidden();
return;
case 'new_hidden':
$this->NewHiddenFile();
break;
case 'new_redir':
$this->NewHiddenFile_Redir();
return;
case 'copyit':
$this->CopyPage();
break;
case 'copypage':
$this->CopyForm();
return;
// Page Insertion
// Page Insertion
case 'insert_before':
case 'insert_after':
case 'insert_child':
$this->InsertDialog($cmd);
return;
case 'restore':
$this->RestoreFromTrash();
//.........这里部分代码省略.........
示例10: SectionToContent
/**
* Return formatted content for the $section_data
* @return string
*
*/
static function SectionToContent($section_data, $section_num)
{
$section_data = gpPlugin::Filter('SectionToContent', array($section_data, $section_num));
switch ($section_data['type']) {
case 'text':
return self::TextContent($section_data['content']);
case 'include':
return self::IncludeContent($section_data);
case 'gallery':
common::ShowingGallery();
return $section_data['content'];
}
return $section_data['content'];
}
示例11: CleanText
/**
* Clean a string of html that may be used as file content
*
* @param string $text The string to be cleansed. Passed by reference
*/
public static function CleanText(&$text)
{
includeFile('tool/editing.php');
gp_edit::tidyFix($text);
gpFiles::rmPHP($text);
gpFiles::FixTags($text);
$text = gpPlugin::Filter('CleanText', array($text));
}
示例12: rename_check
return $args;
}
function rename_check($event, $args, $finder)
{
$name = $args['name'];
if (gp_restrict_uploads && !admin_uploaded::AllowedExtension($name)) {
return false;
}
$args['name'] = $name;
return $args;
}
function SaveFinderData($data)
{
global $config;
$config['finder_data'] = $data;
admin_tools::SaveConfig();
}
function ReturnFinderData()
{
global $config;
if (isset($config['finder_data'])) {
return $config['finder_data'];
}
return false;
}
$opts = array('debug' => gpdebug, 'saveData' => 'SaveFinderData', 'returnData' => 'ReturnFinderData', 'roots' => array(array('driver' => 'LocalFileSystem', 'path' => $dataDir . '/data/_uploaded/', 'URL' => common::GetDir('data/_uploaded'), 'accessControl' => 'access', 'tmbPath' => $dataDir . '/data/_elthumbs', 'tmbURL' => common::GetDir('data/_elthumbs'), 'separator' => '/', 'tmbBgColor' => 'transparent', 'copyOverwrite' => false, 'uploadOverwrite' => false, 'tmbPathMode' => gp_chmod_dir, 'dirMode' => gp_chmod_dir, 'fileMode' => gp_chmod_file)), 'bind' => array('duplicate upload rename rm paste resize' => array('admin_uploaded', 'FinderChange'), 'upload-before' => 'upload_check', 'rename-before' => 'rename_check'));
$opts = gpPlugin::Filter('FinderOptionsServer', array($opts));
gpSettingsOverride('finder_options_server', $opts);
// run Finder
$connector = new Finder($opts);
$connector->run();
示例13: InlineEdit
static function InlineEdit($section_data)
{
$section_data += array('type' => '', 'content' => '');
$scripts = array();
$scripts[] = '/include/js/inline_edit/inline_editing.js';
$type = 'text';
if (!empty($section_data['type'])) {
$type = $section_data['type'];
}
switch ($type) {
case 'gallery':
$scripts = gpAjax::InlineEdit_Gallery($scripts);
break;
case 'include':
$scripts = gpAjax::InlineEdit_Include($scripts);
break;
case 'text':
$scripts = gpAjax::InlineEdit_Text($scripts);
break;
case 'image':
echo 'var gp_blank_img = ' . gpAjax::quote(common::GetDir('/include/imgs/blank.gif')) . ';';
$scripts[] = '/include/js/jquery.auto_upload.js';
$scripts[] = '/include/js/inline_edit/image_common.js';
$scripts[] = '/include/js/inline_edit/image_edit.js';
break;
}
$scripts = gpPlugin::Filter('InlineEdit_Scripts', array($scripts, $type));
self::SendScripts($scripts);
//replace resized images with their originals
if (isset($section_data['resized_imgs']) && is_array($section_data['resized_imgs']) && count($section_data['resized_imgs'])) {
includeFile('tool/editing.php');
$section_data['content'] = gp_edit::RestoreImages($section_data['content'], $section_data['resized_imgs']);
}
//create the section object that will be passed to gp_init_inline_edit
$section_object = common::JsonEncode($section_data);
//send call to gp_init_inline_edit()
echo ';if( typeof(gp_init_inline_edit) == "function" ){';
echo 'gp_init_inline_edit(';
echo gpAjax::quote($_GET['area_id']);
echo ',' . $section_object;
echo ');';
echo '}else{alert("gp_init_inline_edit() is not defined");}';
}
示例14: NewSections
/**
* Return a list of section types
* @static
*/
static function NewSections($checkboxes = false)
{
$types_with_imgs = array('text', 'image', 'gallery');
$section_types = section_content::GetTypes();
$links = array();
foreach ($section_types as $type => $type_info) {
$img = '';
if (in_array($type, $types_with_imgs)) {
$img = common::GetDir('/include/imgs/section-' . $type . '.png');
}
$links[] = array($type, $img);
}
$links[] = array(array('text.gpCol-6', 'image.gpCol-6'), common::GetDir('/include/imgs/section-combo-text-image.png'));
$links[] = array(array('text.gpCol-6', 'gallery.gpCol-6'), common::GetDir('/include/imgs/section-combo-text-gallery.png'));
//section combo: text & gallery
$links = gpPlugin::Filter('NewSections', array($links));
foreach ($links as $link) {
$link += array('', '', 'gpRow');
echo self::NewSectionLink($link[0], $link[1], $link[2], $checkboxes);
}
}
示例15: RunScript
function RunScript()
{
global $langmessage, $page;
$cmd = common::GetCommand();
//prevent overwriting the content to maintain overlay editin links
//$page->ajaxReplace = array();
if (!$this->SetVars()) {
return;
}
$this->GetFile();
//original alpha versions of 1.8 didn't maintain the file_type
if (!isset($this->meta_data['file_type'])) {
$this->ResetFileTypes();
}
//admin toolbar links
$menu_permissions = admin_tools::HasPermission('Admin_Menu');
$can_edit = admin_tools::CanEdit($this->gp_index);
if ($menu_permissions) {
$page->admin_links[] = common::Link($this->title, $langmessage['rename/details'], 'cmd=renameform', 'data-cmd="gpajax"');
// Having the layout link here complicates things.. would need layout link for special pages
$page->admin_links[] = common::Link('Admin_Menu', $langmessage['current_layout'], 'cmd=layout&from=page&index=' . urlencode($this->gp_index), array('title' => $langmessage['current_layout'], 'data-cmd' => 'gpabox'));
$page->admin_links[] = common::Link('Admin_Menu', $langmessage['Copy'], 'cmd=copypage&redir=redir&index=' . urlencode($this->gp_index), array('title' => $langmessage['Copy'], 'data-cmd' => 'gpabox'));
}
if (admin_tools::HasPermission('Admin_User')) {
$page->admin_links[] = common::Link('Admin_Users', $langmessage['permissions'], 'cmd=file_permissions&index=' . urlencode($this->gp_index), array('title' => $langmessage['permissions'], 'data-cmd' => 'gpabox'));
}
if ($can_edit) {
$page->admin_links[] = common::Link($this->title, $langmessage['Revision History'], 'cmd=view_history', array('title' => $langmessage['Revision History'], 'data-cmd' => 'gpabox'));
}
if ($menu_permissions) {
$page->admin_links[] = common::Link('Admin_Menu', $langmessage['delete_file'], 'cmd=trash_page&index=' . urlencode($this->gp_index), array('data-cmd' => 'postlink', 'title' => $langmessage['delete_page'], 'class' => 'gpconfirm'));
}
//allow addons to effect page actions and how a page is displayed
$cmd_after = gpPlugin::Filter('PageRunScript', array($cmd));
if ($cmd !== $cmd_after) {
$cmd = $cmd_after;
if ($cmd === 'return') {
return;
}
}
//admin actions
if ($menu_permissions) {
switch ($cmd) {
// rename & details
case 'renameform':
$this->RenameForm();
return;
case 'renameit':
if ($this->RenameFile()) {
return;
}
break;
}
}
//file editing actions
if ($can_edit) {
switch ($cmd) {
case 'rawcontent':
$this->RawContent();
break;
/* gallery editing */
/* gallery editing */
case 'gallery_folder':
case 'gallery_images':
$this->GalleryImages();
return;
case 'new_dir':
$this->contentBuffer = gp_edit::NewDirForm();
return;
/* inline editing */
/* inline editing */
case 'save':
case 'preview':
case 'inlineedit':
case 'include_dialog':
$this->SectionEdit($cmd);
return;
/* Manage section */
/* Manage section */
case 'ManageSections':
$this->ManageSections();
//dies
//dies
case 'NewSectionContent':
$this->NewSectionContent();
return;
case 'SaveSections':
$this->SaveSections();
return;
/* revision history */
/* revision history */
case 'view_revision':
$this->ViewRevision();
return;
case 'use_revision':
$this->UseRevision();
break;
case 'view_history':
$this->ViewHistory();
return;
//.........这里部分代码省略.........