当前位置: 首页>>代码示例>>PHP>>正文


PHP gpPlugin::Action方法代码示例

本文整理汇总了PHP中gpPlugin::Action方法的典型用法代码示例。如果您正苦于以下问题:PHP gpPlugin::Action方法的具体用法?PHP gpPlugin::Action怎么用?PHP gpPlugin::Action使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gpPlugin的用法示例。


在下文中一共展示了gpPlugin::Action方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GetContent

 function GetContent()
 {
     $this->GetGpxContent();
     if (!empty($this->non_admin_content)) {
         echo '<div class="filetype-text cf">';
         //echo '<div id="gpx_content" class="filetype-text">'; //id="gpx_content" conflicts with admin content
         echo $this->non_admin_content;
         echo '</div>';
     }
     echo '<div id="gpAfterContent">';
     gpOutput::Get('AfterContent');
     gpPlugin::Action('GetContent_After');
     echo '</div>';
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:14,代码来源:admin_display.php

示例2: EditLayout

 /**
  * Edit layout properties
  * 		Layout Identification
  * 		Content Arrangement
  * 		Gadget Visibility
  *
  */
 function EditLayout($layout, $cmd)
 {
     global $page, $gpLayouts, $langmessage, $config;
     $GLOBALS['GP_ARRANGE_CONTENT'] = true;
     $page->head_js[] = '/include/js/inline_edit/inline_editing.js';
     $this->curr_layout = $layout;
     $this->SetLayoutArray();
     $page->SetTheme($layout);
     $this->LoremIpsum();
     gpOutput::TemplateSettings();
     gpPlugin::Action('edit_layout_cmd', array($layout));
     switch ($cmd) {
         /**
          * Inline image editing
          *
          */
         case 'inlineedit':
             $this->InlineEdit();
             return;
         case 'gallery_folder':
         case 'gallery_images':
             $this->GalleryImages();
             return;
         case 'image_editor':
             includeFile('tool/editing.php');
             gp_edit::ImageEditor($this->curr_layout);
             return;
         case 'save_inline':
             $this->SaveHeaderImage();
             return;
         case 'theme_images':
             $this->ShowThemeImages();
             return;
         case 'drag_area':
             $this->Drag();
             break;
             //insert
         //insert
         case 'insert':
             $this->SelectContent();
             return;
         case 'addcontent':
             $this->AddContent();
             break;
             //remove
         //remove
         case 'rm_area':
             $this->RemoveArea();
             break;
     }
     if ($this->LayoutCommands($cmd)) {
         return;
     }
     //control what is displayed
     switch ($cmd) {
         //show the layout (displayed within an iframe)
         case 'save_css':
         case 'preview_css':
         case 'addcontent':
         case 'rm_area':
         case 'drag_area':
         case 'in_iframe':
             $this->ShowInIframe($cmd);
             return;
     }
     $layout_info = common::LayoutInfo($layout, false);
     $handlers_count = 0;
     if (isset($layout_info['handlers']) && is_array($layout_info['handlers'])) {
         foreach ($layout_info['handlers'] as $val) {
             $int = count($val);
             if ($int === 0) {
                 $handlers_count++;
             }
             $handlers_count += $int;
         }
     }
     $page->label = $langmessage['layouts'] . ' » ' . $layout_info['label'];
     $_REQUEST += array('gpreq' => 'body');
     //force showing only the body as a complete html document
     $page->get_theme_css = false;
     ob_start();
     $this->LayoutEditor($layout, $layout_info);
     $page->admin_html = ob_get_clean();
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:91,代码来源:admin_theme_content.php

示例3: GetContent

 function GetContent()
 {
     $this->GetGpxContent();
     echo '<div id="gpAfterContent">';
     gpOutput::Get('AfterContent');
     gpPlugin::Action('GetContent_After');
     echo '</div>';
 }
开发者ID:jozefkrz,项目名称:gpEasy-CMS,代码行数:8,代码来源:display.php

示例4: SearchDisplay

 function SearchDisplay()
 {
     global $langmessage, $gpLayouts, $gp_index, $gp_menu;
     $Inherit_Info = admin_menu_tools::Inheritance_Info();
     switch ($this->curr_menu_id) {
         case 'search':
             $show_list = $this->GetSearchList();
             break;
         case 'all':
             $show_list = array_keys($gp_index);
             break;
         case 'hidden':
             $show_list = $this->GetAvailable();
             break;
         case 'nomenus':
             $show_list = $this->GetNoMenus();
             break;
     }
     $show_list = array_values($show_list);
     //to reset the keys
     $show_list = array_reverse($show_list);
     //show newest first
     $max = count($show_list);
     while ($this->search_page * $this->search_max_per_page > $max) {
         $this->search_page--;
     }
     $start = $this->search_page * $this->search_max_per_page;
     $stop = min(($this->search_page + 1) * $this->search_max_per_page, $max);
     ob_start();
     echo '<div class="gp_search_links">';
     echo '<span class="showing">';
     echo sprintf($langmessage['SHOWING'], $start + 1, $stop, $max);
     echo '</span>';
     if ($start !== 0 || $stop < $max) {
         for ($i = 0; $i * $this->search_max_per_page < $max; $i++) {
             $class = '';
             if ($i == $this->search_page) {
                 $class = ' class="current"';
             }
             echo $this->Link('Admin_Menu', $i + 1, 'page=' . $i, 'name="gpajax"' . $class);
         }
     }
     echo $this->Link('Admin_Menu', $langmessage['create_new_file'], 'cmd=add_hidden', ' title="' . $langmessage['create_new_file'] . '" name="gpajax"');
     echo '</div>';
     $links = ob_get_clean();
     echo $links;
     echo '<table class="bordered">';
     echo '<thead>';
     echo '<tr><th>';
     echo $langmessage['file_name'];
     echo '</th><th>';
     echo $langmessage['Child Pages'];
     echo '</th>';
     echo '</tr>';
     echo '</thead>';
     echo '<tbody>';
     if (count($show_list) > 0) {
         for ($i = $start; $i < $stop; $i++) {
             $title = $show_list[$i];
             $title_index = $gp_index[$title];
             echo '<tr><td>';
             $label = common::GetLabel($title);
             echo common::Link($title, common::LabelSpecialChars($label));
             //area only display on mouseover
             echo '<div>';
             echo '<b>Options:</b>';
             $img = '<span class="menu_icon page_edit_icon"></span>';
             echo $this->Link('Admin_Menu', $img . $langmessage['rename/details'], 'cmd=renameform&title=' . urlencode($title), ' title="' . $langmessage['rename/details'] . '" name="gpajax" ');
             $img = '<span class="menu_icon copy_icon"></span>';
             echo $this->Link('Admin_Menu', $img . $langmessage['Copy'], 'cmd=copypage&title=' . urlencode($title), ' title="' . $langmessage['Copy'] . '" name="gpabox"');
             $layout = admin_menu_tools::CurrentLayout($title_index);
             $layout_info = $gpLayouts[$layout];
             $img = '<span style="background-color:' . $layout_info['color'] . ';" class="layout_icon"></span>';
             echo $this->Link('Admin_Menu', $img . $layout_info['label'], 'cmd=layout&index=' . urlencode($title_index), ' title="' . $langmessage['layout'] . '" name="gpabox"');
             $is_special = common::SpecialOrAdmin($title);
             if (!$is_special) {
                 $img = '<span class="menu_icon bin_icon"></span>';
                 echo $this->Link('Admin_Menu', $img . $langmessage['delete'], 'cmd=trash&index=' . urlencode($title_index), ' title="' . $langmessage['delete_page'] . '" name="menupost" class="gpconfirm" ');
             }
             gpPlugin::Action('MenuPageOptions', array($title, $title_index, false, $layout_info));
             //stats
             echo '<br/>';
             echo '<b>' . $langmessage['Page Info'] . ':</b>';
             $this->FileStats($title_index, $title, $is_special);
             echo '</div>';
             echo '</td><td>';
             if (isset($Inherit_Info[$title_index]) && isset($Inherit_Info[$title_index]['children'])) {
                 echo $Inherit_Info[$title_index]['children'];
             } elseif (isset($gp_menu[$title_index])) {
                 echo '0';
             } else {
                 echo $langmessage['Not In Main Menu'];
             }
             echo '</td></tr>';
         }
     }
     echo '</tbody>';
     echo '</table>';
     if (count($show_list) == 0) {
         echo '<p>';
//.........这里部分代码省略.........
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:101,代码来源:admin_menu_new.php

示例5: GetAdminLink

 /**
  * Outputs the sitemap link, admin login/logout link, powered by link, admin html and messages
  * @static
  */
 static function GetAdminLink()
 {
     global $config, $langmessage, $page;
     if (!isset($config['showsitemap']) || $config['showsitemap']) {
         echo ' <span class="sitemap_link">';
         echo common::Link('Special_Site_Map', $langmessage['site_map']);
         echo '</span>';
     }
     if (!isset($config['showlogin']) || $config['showlogin']) {
         echo ' <span class="login_link">';
         if (common::LoggedIn()) {
             echo common::Link($page->title, $langmessage['logout'], 'cmd=logout', array('data-cmd' => 'creq', 'rel' => 'nofollow'));
         } else {
             echo common::Link('Admin', $langmessage['login'], 'file=' . rawurlencode($page->title), ' rel="nofollow" data-cmd="login"');
         }
         echo '</span>';
     }
     if (!isset($config['showgplink']) || $config['showgplink']) {
         echo ' <span id="powered_by_link">';
         echo 'Powered by <a href="http://gpEasy.com" title="A Free and Easy CMS in PHP" target="_blank">gp|Easy CMS</a>';
         echo '</span>';
     }
     gpPlugin::Action('GetAdminLink');
     echo GetMessages();
     //global $gpLayouts;
     //echo pre($gpLayouts);
     //$included = get_included_files();
     //echo pre($included);
 }
开发者ID:Bomberus,项目名称:gpEasy-CMS,代码行数:33,代码来源:gpOutput.php

示例6: EditLayout

 /**
  * Edit layout properties
  * 		Layout Identification
  * 		Content Arrangement
  * 		Gadget Visibility
  *
  */
 function EditLayout($layout, $cmd)
 {
     global $page, $gpLayouts, $langmessage, $config;
     if (!isset($gpLayouts[$layout])) {
         message($langmessage['OOPS'] . ' (Invalid Layout)');
         return false;
     }
     $GLOBALS['GP_ARRANGE_CONTENT'] = true;
     $page->head .= "\n" . '<script type="text/javascript">var gpLayouts=true;</script>';
     $page->head_js[] = '/include/js/inline_edit/inline_editing.js';
     $page->show_admin_content = false;
     $this->curr_layout = $layout;
     $page->SetTheme($layout);
     $this->LoremIpsum();
     gpOutput::TemplateSettings();
     gpPlugin::Action('edit_layout_cmd', array($layout));
     switch ($cmd) {
         case 'save_css':
             $this->SaveCSS();
             break;
         case 'css':
             $this->EditCSS();
             break;
         case 'makedefault':
             $this->MakeDefault($layout);
             break;
         case 'change_layout_color':
             $this->ChangeLayoutColor($layout);
             break;
         case 'css_preferences':
             $this->CSSPreferences($layout);
             break;
         case 'rmgadget':
             $this->RmGadget($layout);
             break;
         case 'layout_details':
             $this->LayoutDetails();
             break;
         case 'restore_drag':
         case 'restore':
             $this->Restore($layout);
             break;
         case 'drag':
             $this->Drag();
             break;
             //insert
         //insert
         case 'insert':
             $this->SelectContent();
             return true;
         case 'addcontent':
             $this->AddContent();
             break;
             //remove
         //remove
         case 'rm':
             $this->RemoveArea();
             break;
     }
     $layout_info = common::LayoutInfo($layout);
     $handlers_count = 0;
     if (isset($layout_info['handlers']) && is_array($layout_info['handlers'])) {
         foreach ($layout_info['handlers'] as $val) {
             $int = count($val);
             if ($int === 0) {
                 $handlers_count++;
             }
             $handlers_count += $int;
         }
     }
     $page->label = $langmessage['layouts'] . ' » ' . $layout_info['label'];
     //display options
     switch ($cmd) {
         case 'makedefault':
         case 'details':
             $this->ShowDetails($layout, $layout_info, $handlers_count);
             return true;
     }
     $this->PrepareCSS();
     $this->Toolbar($layout, $layout_info);
     return true;
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:89,代码来源:admin_theme_content.php

示例7: RunQuery

 function RunQuery()
 {
     if (!empty($_REQUEST['q'])) {
         $this->SearchPattern();
         $this->SearchPages();
         gpPlugin::Action('Search', array($this));
     }
     $this->ShowResults();
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:9,代码来源:special_search.php

示例8: GenerateContent_Admin

 function GenerateContent_Admin()
 {
     //add to all pages in case a user adds a gallery
     gpPlugin::Action('GenerateContent_Admin');
     common::ShowingGallery();
     $content = '';
     $sections_count = count($this->file_sections);
     $section_num = 0;
     do {
         $content .= $this->GetSection($section_num);
     } while ($section_num < $sections_count);
     return $content;
 }
开发者ID:Bomberus,项目名称:gpEasy-CMS,代码行数:13,代码来源:editing_page.php

示例9: RenameFileWorker

 static function RenameFileWorker($title)
 {
     global $langmessage, $dataDir, $gp_index;
     //use new_label or new_title
     if (isset($_POST['new_title'])) {
         $new_title = admin_tools::PostedSlug($_POST['new_title']);
     } else {
         $new_title = admin_tools::LabelToSlug($_POST['new_label']);
     }
     //title unchanged
     if ($new_title == $title) {
         return $title;
     }
     $special_file = false;
     if (common::SpecialOrAdmin($title)) {
         $special_file = true;
     }
     if (!admin_tools::CheckTitle($new_title, $message)) {
         msg($message);
         return false;
     }
     $old_gp_index = $gp_index;
     //re-index: make the new title point to the same data index
     $old_file = gpFiles::PageFile($title);
     $file_index = $gp_index[$title];
     unset($gp_index[$title]);
     $gp_index[$new_title] = $file_index;
     //rename the php file
     if (!$special_file) {
         $new_file = gpFiles::PageFile($new_title);
         //we don't have to rename files if we're using the index naming convention. See gpFiles::PageFile() for more info
         if ($new_file == $old_file) {
             //if the file being renamed doesn't use the index naming convention, then we'll still need to rename it
         } elseif (!rename($old_file, $new_file)) {
             msg($langmessage['OOPS'] . ' (N3)');
             $gp_index = $old_gp_index;
             return false;
         }
         //gallery rename
         includeFile('special/special_galleries.php');
         special_galleries::RenamedGallery($title, $new_title);
     }
     //create a 301 redirect
     if (isset($_POST['add_redirect']) && $_POST['add_redirect'] == 'add') {
         includeFile('admin/admin_missing.php');
         admin_missing::AddRedirect($title, $new_title);
     }
     gpPlugin::Action('RenameFileDone', array($file_index, $title, $new_title));
     return $new_title;
 }
开发者ID:Knuzen,项目名称:gpEasy-CMS,代码行数:50,代码来源:Page_Rename.php

示例10: GetHead

 /**
  * Generate and output the <head> portion of the html document
  *
  */
 function GetHead()
 {
     global $gp_random;
     gpPlugin::Action('GetHead');
     gpOutput::PrepGadgetContent();
     echo '<!-- get_head_placeholder ' . $gp_random . ' -->';
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:11,代码来源:gpOutput.php

示例11: MoveToTrash

 /**
  * Move To Trash
  * Hide special pages
  *
  */
 function MoveToTrash($cmd)
 {
     global $gp_titles, $gp_index, $langmessage, $gp_menu;
     includeFile('admin/admin_trash.php');
     admin_trash::PrepFolder();
     $this->CacheSettings();
     $_POST += array('index' => '');
     $indexes = explode(',', $_POST['index']);
     $trash_data = array();
     foreach ($indexes as $index) {
         $title = common::IndexToTitle($index);
         // Create file in trash
         if ($title) {
             if (!admin_trash::MoveToTrash_File($title, $index, $trash_data)) {
                 message($langmessage['OOPS']);
                 $this->RestoreSettings();
                 return false;
             }
         }
         // Remove from menu
         if (isset($gp_menu[$index])) {
             if (count($gp_menu) == 1) {
                 continue;
             }
             if (!$this->RmFromMenu($index, false)) {
                 message($langmessage['OOPS']);
                 $this->RestoreSettings();
                 return false;
             }
         }
         unset($gp_titles[$index]);
         unset($gp_index[$title]);
     }
     $this->ResetHomepage();
     if (!admin_trash::ModTrashData($trash_data, null)) {
         message($langmessage['OOPS']);
         $this->RestoreSettings();
         return false;
     }
     if (!admin_tools::SaveAllConfig()) {
         $this->RestoreSettings();
         return false;
     }
     if ($cmd == 'trash_page') {
         $link = common::GetUrl('Admin_Trash');
         message(sprintf($langmessage['MOVED_TO_TRASH'], $link));
     }
     //finally, delete the files in /_pages
     foreach ($indexes as $index) {
         $title = common::IndexToTitle($index);
         if (!$title) {
             continue;
         }
         $file = gpFiles::PageFile($title);
         if (gpFiles::Exists($file)) {
             unlink($file);
         }
     }
     gpPlugin::Action('MenuPageTrashed', array($indexes));
     return true;
 }
开发者ID:Knuzen,项目名称:gpEasy-CMS,代码行数:66,代码来源:admin_menu_new.php

示例12: GenerateContent_Admin

 function GenerateContent_Admin()
 {
     global $langmessage, $GP_NESTED_EDIT;
     //add to all pages in case a user adds a gallery
     gpPlugin::Action('GenerateContent_Admin');
     common::ShowingGallery();
     $content = '';
     $section_num = 0;
     foreach ($this->file_sections as $section_key => $section_data) {
         $content .= "\n";
         $type = isset($section_data['type']) ? $section_data['type'] : 'text';
         if (gpOutput::ShowEditLink() && admin_tools::CanEdit($this->gp_index)) {
             $link_name = 'inline_edit_generic';
             $link_rel = $type . '_inline_edit';
             $title_attr = sprintf($langmessage['Section %s'], $section_key + 1);
             $link = gpOutput::EditAreaLink($edit_index, $this->title, $langmessage['edit'], 'section=' . $section_key, ' title="' . $title_attr . '" name="' . $link_name . '" rel="' . $link_rel . '"');
             //section control links
             $content .= '<span class="nodisplay" id="ExtraEditLnks' . $edit_index . '">';
             $content .= $link;
             if ($section_num > 0) {
                 $content .= common::Link($this->title, $langmessage['move_up'], 'cmd=move_up&section=' . $section_key, ' name="creq"', 'move_up' . $section_key);
             }
             $content .= common::Link($this->title, $langmessage['New Section'], 'cmd=new_section&section=' . $section_key, ' name="gpabox"');
             $q = 'cmd=add_section&copy=copy&section=' . $section_key . '&last_mod=' . rawurlencode($this->fileModTime);
             $content .= common::Link($this->title, $langmessage['Copy'], $q, ' name="creq"');
             //remove section link
             if (count($this->file_sections) > 1) {
                 $title_attr = $langmessage['rm_section_confirm'];
                 if ($type != 'include') {
                     $title_attr .= "\n\n" . $langmessage['rm_section_confirm_deleting'];
                 }
                 $content .= common::Link($this->title, $langmessage['Remove Section'], 'cmd=rm_section&section=' . $section_key . '&total=' . count($this->file_sections), ' title="' . $title_attr . '" name="creq" class="gpconfirm"');
             }
             $content .= '</span>';
             $content .= '<div class="editable_area GPAREA filetype-' . $type . '" id="ExtraEditArea' . $edit_index . '">';
             // class="edit_area" added by javascript
         } else {
             $content .= '<div class="GPAREA filetype-' . $type . '">';
         }
         $GP_NESTED_EDIT = true;
         $content .= $this->SectionToContent($section_data, $section_num);
         $GP_NESTED_EDIT = false;
         $content .= '<div class="gpclear"></div>';
         $content .= '</div>';
         $section_num++;
     }
     return $content;
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:48,代码来源:editing_page.php

示例13: ShowForm

 function ShowForm()
 {
     global $page, $langmessage, $config;
     $attr = '';
     if ($this->sent) {
         $attr = ' readonly="readonly" ';
     }
     $_GET += array('name' => '', 'email' => '', 'subject' => '', 'message' => '');
     $_POST += array('name' => $_GET['name'], 'email' => $_GET['email'], 'subject' => $_GET['subject'], 'message' => $_GET['message']);
     $require_email =& $config['require_email'];
     echo '<form class="contactform" action="' . common::GetUrl($page->title) . '" method="post">';
     //nonce fields
     echo '<div style="display:none !important">';
     echo '<input type="hidden" name="contact_nonce" value="' . htmlspecialchars(common::new_nonce('contact_post', true)) . '" />';
     echo '<input type="text" name="contact_void" value="" />';
     echo '</div>';
     echo '<label for="contact_name"><span class="title">';
     echo gpOutput::ReturnText('your_name');
     echo '</span><input id="contact_name" class="input text" type="text" name="name" value="' . htmlspecialchars($_POST['name']) . '" ' . $attr . ' />';
     echo '</label>';
     echo '<label for="contact_email"><span class="title">';
     echo gpOutput::ReturnText('your_email');
     if (strpos($require_email, 'email') !== false) {
         echo '*';
     }
     echo '</span><input id="contact_email" class="input text" type="text" name="email" value="' . htmlspecialchars($_POST['email']) . '" ' . $attr . '/>';
     echo '</label>';
     echo '<label for="contact_subject"><span class="title">';
     echo gpOutput::ReturnText('subject');
     if (strpos($require_email, 'none') === false) {
         echo '*';
     }
     echo '</span><input id="contact_subject" class="input text" type="text" name="subject" value="' . htmlspecialchars($_POST['subject']) . '" ' . $attr . '/>';
     echo '</label>';
     echo '<label for="contact_message">';
     echo gpOutput::ReturnText('message');
     if (strpos($require_email, 'none') === false) {
         echo '*';
     }
     echo '</label>';
     echo '<textarea id="contact_message" name="message" ' . $attr . ' rows="10" cols="10">';
     echo htmlspecialchars($_POST['message']);
     echo '</textarea>';
     gpPlugin::Action('contact_form_pre_captcha');
     if (!$this->sent && gp_recaptcha::isActive()) {
         echo '<div class="captchaForm">';
         echo gpOutput::ReturnText('captcha');
         gp_recaptcha::Form();
         echo '</div>';
     }
     if ($this->sent) {
         echo gpOutput::ReturnText('message_sent', '%s', 'message_sent');
     } else {
         echo '<input type="hidden" name="cmd" value="gp_send_message" />';
         $key = 'send_message';
         $text = gpOutput::SelectText($key);
         if (gpOutput::ShowEditLink('Admin_Theme_Content')) {
             $query = 'cmd=edittext&key=' . urlencode($key);
             echo gpOutput::EditAreaLink($edit_index, 'Admin_Theme_Content', $langmessage['edit'], $query, ' title="' . $key . '" data-cmd="gpabox" ');
             echo '<input type="submit" class="submit editable_area" id="ExtraEditArea' . $edit_index . '" name="aaa" value="' . $text . '" />';
         } else {
             echo '<input type="submit" class="submit" name="aaa" value="' . $text . '" />';
         }
     }
     echo '</form>';
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:66,代码来源:special_contact.php

示例14: FinderChange

 /**
  *  Performs actions after changes are made to files in elFinder
  *
  */
 static function FinderChange($cmd, $result, $args, $elfinder)
 {
     global $dataDir, $config;
     includeFile('image.php');
     gp_resized::SetIndex();
     $base_dir = $dataDir . '/data/_uploaded';
     $thumb_dir = $dataDir . '/data/_uploaded/image/thumbnails';
     admin_uploaded::SetRealPath($result, $elfinder);
     switch ($cmd) {
         case 'rename':
             admin_uploaded::RenameResized($result['removed'][0], $result['added'][0]);
             break;
         case 'rm':
             admin_uploaded::RemoveResized($result['removed']);
             break;
         case 'paste':
             admin_uploaded::MoveResized($result['removed'], $result['added']);
             break;
             //check the image size
         //check the image size
         case 'upload':
             admin_uploaded::MaxSize($result['added']);
             break;
     }
     //removed files first
     //	- Remove associated thumbnail
     if (isset($result['removed']) && count($result['removed']) > 0) {
         foreach ($result['removed'] as $removed) {
             $removed_path = $removed['realpath'];
             $thumb_path = str_replace($base_dir, $thumb_dir, $removed_path) . '.jpg';
             if (file_exists($thumb_path)) {
                 unlink($thumb_path);
             }
         }
     }
     //addded files
     if (isset($result['added']) && count($result['added']) > 0) {
         foreach ($result['added'] as $added) {
             $added_path = $added['realpath'];
             $thumb_path = str_replace($base_dir, $thumb_dir, $added_path) . '.jpg';
             gpFiles::CheckDir($thumb_dir);
             thumbnail::createSquare($added_path, $thumb_path, $config['maxthumbsize']);
             gpPlugin::Action('FileUploaded', $added_path);
         }
     }
     //changed files (resized)
     if (isset($result['changed']) && count($result['changed']) > 0) {
         foreach ($result['changed'] as $changed) {
             $changed_path = $changed['realpath'];
             $thumb_path = str_replace($base_dir, $thumb_dir, $changed_path) . '.jpg';
             gpFiles::CheckDir($thumb_dir);
             thumbnail::createSquare($changed_path, $thumb_path, $config['maxthumbsize']);
         }
     }
     gp_resized::SaveIndex();
     //debug
     /*
     $log_file = $dataDir.'/data/_temp/finder_log-all_vars.txt';
     $data = get_defined_vars();
     $content = print_r($data,true);
     gpFiles::Save($log_file,$content);
     */
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:67,代码来源:admin_uploaded.php

示例15: FinderChange

 /**
  *  Performs actions after changes are made to files in finder
  *
  */
 static function FinderChange($cmd, $result, $args, $finder)
 {
     global $dataDir, $config;
     includeFile('image.php');
     gp_resized::SetIndex();
     $base_dir = $dataDir . '/data/_uploaded';
     $thumb_dir = $dataDir . '/data/_uploaded/image/thumbnails';
     admin_uploaded::SetRealPath($result, $finder);
     switch ($cmd) {
         case 'rename':
             admin_uploaded::RenameResized($result['removed'][0], $result['added'][0]);
             break;
         case 'rm':
             admin_uploaded::RemoveResized($result['removed']);
             break;
         case 'paste':
             admin_uploaded::MoveResized($result['removed'], $result['added']);
             break;
             //check the image size
         //check the image size
         case 'upload':
             admin_uploaded::MaxSize($result['added']);
             break;
     }
     //removed files first
     //	- Remove associated thumbnail
     if (isset($result['removed']) && count($result['removed']) > 0) {
         foreach ($result['removed'] as $removed) {
             $removed_path = $removed['realpath'];
             gpPlugin::Action('FileDeleted', $removed_path);
             $thumb_path = str_replace($base_dir, $thumb_dir, $removed_path);
             if (file_exists($thumb_path)) {
                 if (is_dir($thumb_path)) {
                     gpFiles::RmAll($thumb_path);
                 } else {
                     unlink($thumb_path);
                 }
                 continue;
             }
             $thumb_path = str_replace($base_dir, $thumb_dir, $removed_path) . '.jpg';
             if (file_exists($thumb_path)) {
                 unlink($thumb_path);
             }
         }
     }
     //addded files
     if (isset($result['added']) && count($result['added']) > 0) {
         foreach ($result['added'] as $added) {
             gpPlugin::Action('FileUploaded', $added['realpath']);
             self::CreateThumbnail($added['realpath']);
         }
     }
     //changed files (resized)
     if (isset($result['changed']) && count($result['changed']) > 0) {
         foreach ($result['changed'] as $changed) {
             gpPlugin::Action('FileChanged', $changed['realpath']);
             self::CreateThumbnail($changed['realpath']);
         }
     }
     gp_resized::SaveIndex();
     //debug
     /*
     $log_file = $dataDir.'/data/_temp/finder_log-'.time().'.txt';
     $data = get_defined_vars();
     $content = print_r($data,true).'<hr/>';
     $fp = fopen($log_file,'a');
     fwrite($fp,$content);
     */
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:73,代码来源:admin_uploaded.php


注:本文中的gpPlugin::Action方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。