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


PHP VQMod::modcheck方法代码示例

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


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

示例1: generateAll

 public function generateAll()
 {
     $files = array();
     $error = $message = array();
     $use_errors = libxml_use_internal_errors(true);
     // Save error setting
     $xml_dir = $this->xml;
     $dirfiles = glob($xml_dir . '*.xml');
     foreach ($dirfiles as $path) {
         $file = str_replace($xml_dir, '', $path);
         if ($file != 'vqmod_opencart.xml') {
             $xml = simplexml_load_file($path);
             // XML Error handling
             if (!$xml) {
                 $error[] = $errmsg = sprintf($this->language->get('text_xml_not_valid'), $file);
                 $this->log(array(array('info' => array('modFile' => $file, 'id' => isset($xml->id) ? $xml->id : $file, 'version' => isset($xml->version) ? $xml->version : '', 'vqmver' => isset($xml->vqmver) ? $xml->vqmver : '', 'author' => isset($xml->author) ? $xml->author : ''), 'log' => $errmsg)));
             }
             libxml_clear_errors();
             if (isset($xml->file)) {
                 foreach ($xml->file as $file) {
                     $thefiles = explode(',', $file['name']);
                     foreach ($thefiles as $filename) {
                         $filename = (isset($file['path']) ? $file['path'] : '') . trim($filename);
                         if (!in_array($filename, $files)) {
                             $files[] = $filename;
                         }
                     }
                 }
             }
         }
     }
     libxml_use_internal_errors($use_errors);
     // Reset error setting
     $success = false;
     if ($files) {
         $this->deleteAll('cache');
         if (defined('SUBFOLDER') && defined('LOCALPATH')) {
             $tests = '../../';
         } else {
             $tests = $this->config->get('vqm_test');
         }
         //$VQMod = new VQMod();
         foreach ($files as $file) {
             $genfiles = glob('../' . $file);
             foreach ($genfiles as $file) {
                 $file = str_replace('../', '', $file);
                 $genfile = VQMod::modcheck($file);
                 if (is_file($genfile)) {
                     $newfile = $tests . $this->config->get('test_vqmod') . '/' . $file;
                     $success = $this->createFile($newfile);
                     // Pre-create file, to also get dirs in place
                     if ($success) {
                         $this->renameFile($genfile, $newfile);
                     }
                 }
             }
         }
     }
 }
开发者ID:canvasprints2016,项目名称:vqmoderator,代码行数:59,代码来源:vqmod.php

示例2: generateAll

 public function generateAll()
 {
     $tests = $this->config->get('vqmod_mod_test');
     if ($tests) {
         $files = $ofiles = $json = array();
         $use_errors = libxml_use_internal_errors(true);
         // Save error setting
         $xml_dir = '../vqmod/xml/';
         $dirfiles = glob($xml_dir . '*.xml');
         // Check all vQMod xml files for files to mod
         foreach ($dirfiles as $path) {
             $file = basename($path);
             if ($file != 'vqmod_opencart.xml') {
                 $xml = simplexml_load_file($path);
                 if (isset($xml->file)) {
                     foreach ($xml->file as $file) {
                         // Collect all the files to mod
                         $thefiles = explode(',', $file['name']);
                         foreach ($thefiles as $filename) {
                             $filename = (isset($file['path']) ? $file['path'] : '') . trim($filename);
                             if (!in_array($filename, $files)) {
                                 $files[] = $filename;
                             }
                         }
                     }
                 }
             }
         }
         libxml_use_internal_errors($use_errors);
         // Reset error setting
         $this->load->language('extension/modification');
         $this->load->model('extension/modification');
         // Refresh OCMOD files, clear vQMod files, and delete previous generated files
         $this->load->controller('extension/modification/refresh', true);
         $path = array('../' . $tests . 'modded/*');
         while (count($path) != 0) {
             $next = array_shift($path);
             foreach (glob($next) as $file) {
                 if (is_dir($file)) {
                     $path[] = $file . '/*';
                 }
                 $ofiles[] = $file;
             }
         }
         rsort($ofiles);
         $this->model_extension_modification->deleteFiles($ofiles);
         // Generate and copy vQMod files
         $success = $files ? false : true;
         if ($files) {
             foreach ($files as $file) {
                 $genfiles = glob('../' . $file);
                 foreach ($genfiles as $file) {
                     if (is_file($file)) {
                         $file = str_replace('../', '', $file);
                         $getfile = (file_exists(DIR_MODIFICATION . $file) ? DIR_MODIFICATION : '') . $file;
                         $genfile = VQMod::modcheck($getfile, $file);
                         if (is_file($genfile)) {
                             $newfile = $tests . 'modded/' . $file;
                             $success = $this->model_extension_modification->copyFile($genfile, $newfile, true);
                             if (!$success) {
                                 $json['error'] = 'Could not copy <b>' . $genfile . '</b> to <b>' . $newfile . '</b>';
                                 break 2;
                             }
                         }
                     }
                 }
             }
         }
         // Copy OCMod files to test folder (if not already there)
         if ($success) {
             $files = array();
             $path = array(DIR_MODIFICATION . '*');
             while (count($path) != 0) {
                 $next = array_shift($path);
                 foreach (glob($next) as $file) {
                     if (is_dir($file)) {
                         $path[] = $file . '/*';
                     } else {
                         $files[] = $file;
                     }
                 }
             }
             rsort($files);
             // Copy all modification files
             foreach ($files as $file) {
                 $newfile = str_replace(DIR_MODIFICATION, $tests . 'modded/', $file);
                 if ($file != DIR_MODIFICATION . 'index.html' && !file_exists('../' . $newfile) && is_file($file)) {
                     $success = $this->model_extension_modification->copyFile($file, $newfile, true);
                     if (!$success) {
                         $json['error'] = 'Could not copy <b>' . $file . '</b> to <b>' . $newfile . '</b>';
                         break;
                     }
                 }
             }
             if (!$json) {
                 $json['success'] = $this->language->get('text_generate_done');
             }
         }
         $this->model_extension_modification->doFTP(false);
     }
//.........这里部分代码省略.........
开发者ID:AvanOsch,项目名称:vQModerator,代码行数:101,代码来源:vqmoderator.php


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