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


PHP admin_tools::CanEdit方法代码示例

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


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

示例1: GenerateOutput

 function GenerateOutput()
 {
     global $langmessage, $page;
     common::ShowingGallery();
     echo '<h2>';
     echo gpOutput::ReturnText('galleries');
     echo '</h2>';
     includeFile('admin/admin_tools.php');
     $wrap = admin_tools::CanEdit($page->gp_index);
     if ($wrap) {
         echo gpOutput::EditAreaLink($edit_index, 'Admin_Galleries', $langmessage['edit']);
         echo '<div class="editable_area cf" id="ExtraEditArea' . $edit_index . '">';
         // class="edit_area" added by javascript
     }
     $image_text = gpOutput::ReturnText('image');
     $images_text = gpOutput::ReturnText('images');
     $list = '';
     $shown = 0;
     foreach ($this->galleries as $title => $info) {
         //page is hidden
         if (!$this->GalleryVisible($title, $info)) {
             continue;
         }
         $count = '';
         if (is_array($info)) {
             $icon = $info['icon'];
             if ($info['count'] == 1) {
                 $count = $info['count'] . ' ' . gpOutput::ReturnText('image');
             } elseif ($info['count'] > 1) {
                 $count = $info['count'] . ' ' . gpOutput::ReturnText('images');
             }
         } else {
             $icon = $info;
         }
         if (empty($icon)) {
             continue;
         }
         $icon = rawurldecode($icon);
         //prevent double encoding
         if (strpos($icon, '/thumbnails/') === false) {
             $thumbPath = common::GetDir('/data/_uploaded/image/thumbnails' . $icon . '.jpg');
         } else {
             $thumbPath = common::GetDir('/data/_uploaded' . $icon);
         }
         $label = common::GetLabel($title);
         $title_attr = ' title="' . common::GetBrowserTitle($title) . '"';
         $label_img = ' <img src="' . $thumbPath . '" alt=""/>';
         $list .= '<li>' . common::Link($title, $label_img, '', $title_attr) . '<div>' . common::Link($title, $label, '', $title_attr) . '<p>' . $count . '</p>' . '</div>' . '</li>';
     }
     if (!empty($list)) {
         echo '<ul class="gp_gallery gp_galleries">';
         echo $list;
         echo '</ul>';
     }
     if ($wrap) {
         echo '</div>';
     }
     $this->PostSave();
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:59,代码来源:special_galleries.php

示例2: 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

示例3: GetSection

 function GetSection(&$section_num)
 {
     global $langmessage, $GP_NESTED_EDIT;
     if (!isset($this->file_sections[$section_num])) {
         trigger_error('invalid section number');
         return;
     }
     $curr_section_num = $section_num;
     $section_num++;
     $content = '';
     $section_data = $this->file_sections[$curr_section_num];
     $section_data += array('attributes' => array(), 'type' => 'text');
     $section_data['attributes'] += array('class' => '');
     $orig_attrs = json_encode($section_data['attributes']);
     $section_data['attributes']['data-gp-section'] = $curr_section_num;
     $section_types = section_content::GetTypes();
     if (gpOutput::ShowEditLink() && admin_tools::CanEdit($this->gp_index)) {
         if (isset($section_types[$section_data['type']])) {
             $title_attr = $section_types[$section_data['type']]['label'];
         } else {
             $title_attr = sprintf($langmessage['Section %s'], $curr_section_num + 1);
         }
         $attrs = array('title' => $title_attr, 'data-cmd' => 'inline_edit_generic', 'data-arg' => $section_data['type'] . '_inline_edit');
         $link = gpOutput::EditAreaLink($edit_index, $this->title, $langmessage['edit'], 'section=' . $curr_section_num . '&amp;revision=' . $this->fileModTime, $attrs);
         //section control links
         if ($section_data['type'] != 'wrapper_section') {
             ob_start();
             echo '<span class="nodisplay" id="ExtraEditLnks' . $edit_index . '">';
             echo $link;
             echo common::Link($this->title, $langmessage['Manage Sections'] . '...', 'cmd=ManageSections', array('class' => 'manage_sections', 'data-cmd' => 'inline_edit_generic', 'data-arg' => 'manage_sections'));
             echo '</span>';
             gpOutput::$editlinks .= ob_get_clean();
         }
         $section_data['attributes']['id'] = 'ExtraEditArea' . $edit_index;
         $section_data['attributes']['class'] .= ' editable_area';
         // class="edit_area" added by javascript
         //$section_data['attributes']['data-gp-editarea']	= $edit_index;
     }
     if (!isset($section_data['nodeName'])) {
         $content .= "\n" . '<div' . section_content::SectionAttributes($section_data['attributes'], $section_data['type']) . ' data-gp-attrs=\'' . htmlspecialchars($orig_attrs, ENT_QUOTES & ~ENT_COMPAT) . '\'>';
     } else {
         $content .= "\n" . '<' . $section_data['nodeName'] . section_content::SectionAttributes($section_data['attributes'], $section_data['type']) . ' data-gp-attrs=\'' . htmlspecialchars($orig_attrs, ENT_QUOTES & ~ENT_COMPAT) . '\'>';
     }
     if ($section_data['type'] == 'wrapper_section') {
         for ($cc = 0; $cc < $section_data['contains_sections']; $cc++) {
             $content .= $this->GetSection($section_num);
         }
     } else {
         $GP_NESTED_EDIT = true;
         $content .= section_content::RenderSection($section_data, $curr_section_num, $this->title, $this->file_stats);
         $GP_NESTED_EDIT = false;
     }
     if (!isset($section_data['nodeName'])) {
         $content .= '<div class="gpclear"></div>';
         $content .= '</div>';
     } else {
         $content .= '</' . $section_data['nodeName'] . '>';
     }
     return $content;
 }
开发者ID:Bomberus,项目名称:gpEasy-CMS,代码行数:60,代码来源:editing_page.php

示例4: GetSection

 public function GetSection(&$section_num)
 {
     global $langmessage;
     if (!isset($this->file_sections[$section_num])) {
         trigger_error('invalid section number');
         return;
     }
     $curr_section_num = $section_num;
     $section_num++;
     $content = '';
     $section_data = $this->file_sections[$curr_section_num];
     //make sure section_data is an array
     $type = gettype($section_data);
     if ($type !== 'array') {
         trigger_error('$section_data is ' . $type . '. Array expected');
         return;
     }
     $section_data += array('attributes' => array(), 'type' => 'text');
     $section_data['attributes'] += array('class' => '');
     $orig_attrs = $section_data['attributes'];
     $section_data['attributes']['data-gp-section'] = $curr_section_num;
     $section_types = section_content::GetTypes();
     if (gpOutput::ShowEditLink() && admin_tools::CanEdit($this->gp_index)) {
         if (isset($section_types[$section_data['type']])) {
             $title_attr = $section_types[$section_data['type']]['label'];
         } else {
             $title_attr = sprintf($langmessage['Section %s'], $curr_section_num + 1);
         }
         $attrs = array('title' => $title_attr, 'data-cmd' => 'inline_edit_generic', 'data-arg' => $section_data['type'] . '_inline_edit');
         $link = gpOutput::EditAreaLink($edit_index, $this->title, $langmessage['edit'], 'section=' . $curr_section_num . '&amp;revision=' . $this->fileModTime, $attrs);
         //section control links
         if ($section_data['type'] != 'wrapper_section') {
             ob_start();
             echo '<span class="nodisplay" id="ExtraEditLnks' . $edit_index . '">';
             echo $link;
             echo common::Link($this->title, $langmessage['Manage Sections'], 'cmd=ManageSections', array('class' => 'manage_sections', 'data-cmd' => 'inline_edit_generic', 'data-arg' => 'manage_sections'));
             echo '<hr/>';
             echo common::Link($this->title, $langmessage['rename/details'], 'cmd=renameform', 'data-cmd="gpajax"');
             echo common::Link($this->title, $langmessage['Revision History'], 'cmd=ViewHistory', array('data-cmd' => 'gpabox'));
             echo '</span>';
             gpOutput::$editlinks .= ob_get_clean();
         }
         $section_data['attributes']['id'] = 'ExtraEditArea' . $edit_index;
         $section_data['attributes']['class'] .= ' editable_area';
         // class="edit_area" added by javascript
     }
     $content .= $this->SectionNode($section_data, $orig_attrs);
     if ($section_data['type'] == 'wrapper_section') {
         for ($cc = 0; $cc < $section_data['contains_sections']; $cc++) {
             $content .= $this->GetSection($section_num);
         }
     } else {
         gpOutput::$nested_edit = true;
         $content .= section_content::RenderSection($section_data, $curr_section_num, $this->title, $this->file_stats);
         gpOutput::$nested_edit = false;
     }
     if (!isset($section_data['nodeName'])) {
         $content .= '<div class="gpclear"></div>';
         $content .= '</div>';
     } else {
         $content .= section_content::EndTag($section_data['nodeName']);
     }
     return $content;
 }
开发者ID:jozefkrz,项目名称:gpEasy-CMS,代码行数:64,代码来源:editing_page.php


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