XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
seo.admin.controller.php
Go to the documentation of this file.
1 <?php
2 class seoAdminController extends seo
3 {
5  {
7 
8  $vars = Context::getRequestVars();
9  $config = $this->getConfig();
10 
11  if ($vars->setting_section == 'general') {
12  // 기본 설정
13  $config->enable = ($vars->enable === 'Y') ? 'Y' : 'N';
14  $config->use_optimize_title = $vars->use_optimize_title;
15  $config->site_name = $vars->site_name;
16  $config->site_slogan = $vars->site_slogan;
17  $config->site_description = $vars->site_description;
18  $config->site_keywords = $vars->site_keywords;
19 
20  if ($vars->site_image) {
21  $path = _XE_PATH_ . 'files/attach/site_image/';
22  $ext = strtolower(array_pop(explode('.', $vars->site_image['name'])));
23  $timestamp = time();
24  $filename = "site_image.{$timestamp}.{$ext}";
25  FileHandler::copyFile($vars->site_image['tmp_name'], $path . $filename);
26  $config->site_image = $filename;
27 
28  $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
29  if($oCacheHandler->isSupport()) {
30  list($width, $height) = @getimagesize($path . $filename);
31  $site_image_dimension = array(
32  'width' => $width,
33  'height' => $height
34  );
35  $cache_key = 'seo:site_image';
36  $oCacheHandler->put($cache_key, $site_image_dimension);
37  }
38  }
39  } elseif ($vars->setting_section == 'analytics') {
40  // analytics
41 
42  // Google
43  $config->ga_id = trim($vars->ga_id);
44  $config->ga_except_admin = $vars->ga_except_admin;
45 
46  // Naver
47  $config->na_id = trim($vars->na_id);
48  $config->na_except_admin = $vars->na_except_admin;
49  } elseif ($vars->setting_section == 'miscellaneous') {
50  // miscellaneous
51 
52  // Facebook
53  $config->fb_app_id = trim($vars->fb_app_id);
54  $config->fb_admins = trim($vars->fb_admins);
55  }
56 
57  $config->site_image_url = NULL;
58 
59  $oModuleController->updateModuleConfig('seo', $config);
60 
61  if($config->enable === 'Y') {
62  $this->moduleUpdate();
63  } else {
64  // Delete Triggers
66  $oModuleController->deleteModuleTriggers('seo');
67  }
68 
69  $this->setMessage('success_updated');
70  if (Context::get('success_return_url')) {
71  $this->setRedirectUrl(Context::get('success_return_url'));
72  }
73  }
74 
76  {
77  $vars = Context::getRequestVars();
78  $oModule = getModel('module');
79 
80  $modulePartConfig = $oModule->getModulePartConfig('seo', $vars->target_module_srl);
81 
82  if (!$modulePartConfig) {
83  $modulePartConfig = new stdClass();
84  }
85 
86 
87  $modulePartConfig->meta_description = htmlspecialchars($vars->meta_description, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
88 
90  $output = $oModuleController->insertModulePartConfig('seo', $vars->target_module_srl, $modulePartConfig);
91 
92  $this->setMessage('success_updated', 'info');
93  $this->setRedirectUrl($vars->success_return_url);
94  }
95 }
96 /* !End of file */
getConfig()
Definition: seo.class.php:19
setMessage($message= 'success', $type=NULL)
getController($module_name)
Definition: func.inc.php:90
$output
Definition: ko.install.php:193
& getInstance($target= 'object', $info=null, $always_use_file=false)
setRedirectUrl($url= './', $output=NULL)
moduleUpdate()
Definition: seo.class.php:152
copyFile($source, $target, $force= 'Y')
const _XE_PATH_
Definition: config.inc.php:49
getModel($module_name)
Definition: func.inc.php:145
Definition: seo.class.php:2
$oModuleController
Definition: ko.install.php:287