public function sendMail($from_mail = null, $from_name = null, $to_mail, $subject, $body, $is_html = true, $cc = null, $bcc = null, $attachment = null, $reply_to = null, $reply_to_name = null) { $this->from_mail = $from_mail; $this->from_name = $from_name; $this->to_mail = $to_mail; $this->subject = $subject; $this->body = $body; $this->is_html = $is_html; $this->cc = $cc; $this->bcc = $bcc; $this->attachment = $attachment; $this->reply_to = $reply_to; $this->reply_to_name = $reply_to_name; if (empty($this->from_mail)) { $this->from_mail = MFactory::getWOption('admin_email'); } if (empty($this->from_name)) { $this->from_name = MFactory::getWOption('blogname'); } $this->fromWP(); }
protected static function _load($option) { if (isset(self::$components[$option]) and self::$components[$option] !== null) { return true; } mimport('framework.filesystem.folder'); $folders = MFolder::folders(MPATH_WP_PLG); if (empty($folders)) { self::$components[$option] = new stdClass(); return false; } self::$components = array(); $n = count($folders); for ($i = 0; $i < $n; $i++) { $folder = @$folders[$i]; if (empty($folder)) { continue; } if (substr($folder, 0, 4) != 'miwo') { continue; } $com = new stdClass(); $com->id = $i; $com->option = 'com_' . $folder; $com->params = MFactory::getWOption($folder); $com->enabled = 1; // Convert the params to an object. if (is_string($com->params)) { $temp = new MRegistry(); $temp->loadString($com->params); $com->params = $temp; } self::$components[$com->option] = $com; } return true; }
public function miwiFlushRewriteRules() { $rules = MFactory::getWOption('rewrite_rules'); if (!isset($rules['([a-z0-9-_]+)/'])) { global $wp_rewrite; $wp_rewrite->flush_rules(); } }
protected static function &_load($module_id = null) { /*if (self::$modules !== null) { return self::$modules; }*/ mimport('framework.filesystem.folder'); if (!MFolder::exists(MPATH_MODULES)) { self::$modules = 0; return self::$modules; } $folders = MFolder::folders(MPATH_MODULES); if (empty($folders)) { self::$modules = 0; return self::$modules; } self::$modules = array(); foreach ($folders as $folder) { if (strpos($folder, 'quickicons')) { continue; } $mod = new stdClass(); $mod->id = $folder; $mod->title = $folder; $mod->module = $folder; $mod->name = $folder; $mod->menuid = 0; $mod->position = $folder; $mod->user = 0; $mod->params = null; $mod->style = null; $mod->content = ''; $mod->showtitle = 0; $mod->control = ''; $params = MFactory::getWOption('widget_' . $folder . '_widget', false, $module_id); if ($params != null) { $mod->params = json_encode($params); } self::$modules[] = $mod; } return self::$modules; }
protected static function getTimezoneString() { // if site timezone string exists, return it if ($timezone = MFactory::getWOption('timezone_string')) { return $timezone; } // get UTC offset, if it isn't set then return UTC if (0 === ($utc_offset = MFactory::getWOption('gmt_offset', 0))) { return 'UTC'; } // adjust UTC offset from hours to seconds $utc_offset *= 3600; // attempt to guess the timezone string from the UTC offset $timezone = timezone_name_from_abbr('', $utc_offset); // last try, guess timezone string manually if (false === $timezone) { $is_dst = date('I'); foreach (timezone_abbreviations_list() as $abbr) { foreach ($abbr as $city) { if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) { return $city['timezone_id']; } } } } // fallback to UTC return 'UTC'; }
protected function _buildSefRoute(&$uri) { // Get the route $route = $uri->getPath(); $route = str_replace('index.php', '', $route); // Get the query data $query = $uri->getQuery(true); if (!isset($query['option'])) { return; } /* * Build the component route */ $component = preg_replace('/[^A-Z0-9_\\.-]/i', '', $query['option']); $tmp = ''; // Use the component routing handler if it exists $path = MPATH_WP_PLG . '/' . str_replace('com_', '', $component) . '/site/router.php'; // Use the custom routing handler if it exists if (file_exists($path) && !empty($query)) { require_once $path; $function = str_replace('com_', '', $component) . 'BuildRoute'; $function = str_replace(array("-", "."), "", $function); $parts = $function($query); // encode the route segments $parts = $this->_encodeSegments($parts); $result = implode('/', $parts); $tmp = $result != "" ? $result : ''; } /* * Build the application route */ if ($tmp) { $route .= '/' . $tmp; } elseif ($route == 'index.php') { $route = ''; } $option_get = str_replace('com_', '', MRequest::getWord('option', '')); if (str_replace('com_', '', $component) == $option_get) { $page_id = MRequest::getInt('page_id'); } else { $page_id = null; } if (empty($page_id)) { $page_id = MFactory::getWOption(str_replace('com_', '', $query['option']) . '_page_id'); } if (!empty($page_id)) { $post = MFactory::getWPost($page_id); if (is_object($post)) { $route = $post->post_name . '/' . ltrim($route, '/'); } $route = MUri::base(true) . '/' . ltrim($route, '/'); } // Unset unneeded query information unset($query['option']); //Set query again in the URI $uri->setQuery($query); $uri->setPath($route); }