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


PHP gpFiles::ArrayInsert方法代码示例

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


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

示例1: CopyLayout

 /**
  * Copy a layout
  *
  */
 function CopyLayout()
 {
     global $gpLayouts, $langmessage, $config, $page, $dataDir;
     $copy_id =& $_REQUEST['layout'];
     if (empty($copy_id) || !isset($gpLayouts[$copy_id])) {
         message($langmessage['OOPS'] . '(Invalid Request)');
         return;
     }
     if (empty($_POST['label'])) {
         message($langmessage['OOPS'] . '(Empty Label)');
         return;
     }
     $newLayout = $gpLayouts[$copy_id];
     $newLayout['color'] = self::GetRandColor();
     $newLayout['label'] = htmlspecialchars($_POST['label']);
     //get new unique layout id
     do {
         $layout_id = rand(1000, 9999);
     } while (isset($gpLayouts[$layout_id]));
     $gpLayoutsBefore = $gpLayouts;
     $gpLayouts[$layout_id] = $newLayout;
     if (!gpFiles::ArrayInsert($copy_id, $layout_id, $newLayout, $gpLayouts, 1)) {
         message($langmessage['OOPS'] . '(Not Inserted)');
         return;
     }
     //copy any css
     $css = $this->layoutCSS($copy_id);
     if (!empty($css)) {
         $path = $dataDir . '/data/_layouts/' . $layout_id . '/custom.css';
         if (!gpFiles::Save($path, $css)) {
             message($langmessage['OOPS'] . ' (CSS not saved)');
             return false;
         }
     }
     if (admin_tools::SavePagesPHP()) {
         message($langmessage['SAVED']);
     } else {
         $gpLayouts = $gpLayoutsBefore;
         message($langmessage['OOPS'] . '(Not Saved)');
     }
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:45,代码来源:admin_theme_content.php

示例2: RenamedGallery

 /**
  * Handle the renaming of galleries for admin_menu_tools.php
  *
  * @static
  *
  */
 function RenamedGallery($old_title, $new_title)
 {
     $galleries = special_galleries::GetData();
     if (!isset($galleries[$old_title])) {
         return;
     }
     if (gpFiles::ArrayInsert($old_title, $new_title, $galleries[$old_title], $galleries, 0, 1)) {
         special_galleries::SaveIndex($galleries);
     }
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:16,代码来源:special_galleries.php

示例3: ArrayReplace

 /**
  * Replace a key-value pair in an associative array
  * ArrayReplace() is a shortcut for using gpFiles::ArrayInsert() with $offset = 0 and $length = 1
  */
 public static function ArrayReplace($search_key, $new_key, $new_value, &$array)
 {
     return gpFiles::ArrayInsert($search_key, $new_key, $new_value, $array, 0, 1);
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:8,代码来源:Files.php

示例4: NewDrag

 function NewDrag()
 {
     global $page, $langmessage;
     $page->ajaxReplace = array();
     //get the title of the gallery that was moved
     $dragging = $_POST['title'];
     if (!isset($this->galleries[$dragging])) {
         message($langmessage['OOPS'] . ' (Title not in gallery list)');
         return false;
     }
     $info = $this->galleries[$dragging];
     unset($this->galleries[$dragging]);
     //set visibility
     if (isset($_POST['active'])) {
         $info['visibility'] = 'show';
     } else {
         $info['visibility'] = 'hide';
     }
     //place before the element represented by $_POST['next'] if it's set
     if (isset($_POST['next'])) {
         $next = $_POST['next'];
         if (!isset($this->galleries[$next])) {
             message($langmessage['OOPS'] . ' (Next not found)');
             return false;
         }
         if (!gpFiles::ArrayInsert($next, $dragging, $info, $this->galleries)) {
             message($langmessage['OOPS'] . ' (Insert Failed)');
             return false;
         }
         //place at the end
     } else {
         $this->galleries[$dragging] = $info;
     }
     //save it
     if (!special_galleries::SaveIndex($this->galleries)) {
         message($langmessage['OOPS'] . ' (Not Saved)');
         return false;
     }
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:39,代码来源:admin_galleries.php


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