コード例 #1
0
 private function _checkSelectors($theme)
 {
     $mapper = Application_Model_ApplicationMapper::getInstance();
     $appSettings = $mapper->fetchAll();
     $settings = $appSettings[0]->get_theme_settings();
     if (isset($settings[$theme])) {
         $editorProperties = json_decode($this->_getPropertiesJson($theme), true)['pages']['/themes/' . $theme . '/theme_edit/preview/complex.html']['def'];
         $dbJson = isset($settings[$theme]['json']['/themes/' . $theme . '/theme_edit/preview/complex.html']) ? $settings[$theme]['json']['/themes/' . $theme . '/theme_edit/preview/complex.html'] : '';
         $dbCss = $settings[$theme]['css'];
         $flag = false;
         if (is_array($dbJson)) {
             foreach ($dbJson as $property => $value) {
                 if (!array_key_exists($property, $editorProperties)) {
                     unset($dbJson[$property]);
                     preg_replace("/" . $property . "{(.*?)}/", " ", $dbCss);
                     $flag = true;
                 }
             }
         }
     }
     if ($flag) {
         $settings[$theme]['css'] = $dbCss;
         $settings[$theme]['json'] = $dbJson;
         $app = new Application_Model_Application();
         $app->set_theme_settings($settings);
         $app->set_id(1);
         $mapper->save($app);
     }
 }