Skip to content
Snippets Groups Projects
Commit 76c076f8 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Merge tag 'v2.9.5' of https://github.com/github/linguist

Linguist 2.9.5
parents c3d6fc5a a00967dd
No related branches found
No related tags found
No related merge requests found
Showing
with 3089 additions and 9 deletions
require 'strscan'
module Linguist
# Generic programming language tokenizer.
#
# Tokens are designed for use in the language bayes classifier.
# It strips any data strings or comments and preserves significant
# language symbols.
class Tokenizer
# Public: Extract tokens from data
#
# data - String to tokenize
#
# Returns Array of token Strings.
def self.tokenize(data)
new.extract_tokens(data)
end
# Read up to 100KB
BYTE_LIMIT = 100_000
# Start state on token, ignore anything till the next newline
SINGLE_LINE_COMMENTS = [
'//', # C
'#', # Ruby
'%', # Tex
]
# Start state on opening token, ignore anything until the closing
# token is reached.
MULTI_LINE_COMMENTS = [
['/*', '*/'], # C
['<!--', '-->'], # XML
['{-', '-}'], # Haskell
['(*', '*)'], # Coq
['"""', '"""'] # Python
]
START_SINGLE_LINE_COMMENT = Regexp.compile(SINGLE_LINE_COMMENTS.map { |c|
"\s*#{Regexp.escape(c)} "
}.join("|"))
START_MULTI_LINE_COMMENT = Regexp.compile(MULTI_LINE_COMMENTS.map { |c|
Regexp.escape(c[0])
}.join("|"))
# Internal: Extract generic tokens from data.
#
# data - String to scan.
#
# Examples
#
# extract_tokens("printf('Hello')")
# # => ['printf', '(', ')']
#
# Returns Array of token Strings.
def extract_tokens(data)
s = StringScanner.new(data)
tokens = []
until s.eos?
break if s.pos >= BYTE_LIMIT
if token = s.scan(/^#!.+$/)
if name = extract_shebang(token)
tokens << "SHEBANG#!#{name}"
end
# Single line comment
elsif s.beginning_of_line? && token = s.scan(START_SINGLE_LINE_COMMENT)
# tokens << token.strip
s.skip_until(/\n|\Z/)
# Multiline comments
elsif token = s.scan(START_MULTI_LINE_COMMENT)
# tokens << token
close_token = MULTI_LINE_COMMENTS.assoc(token)[1]
s.skip_until(Regexp.compile(Regexp.escape(close_token)))
# tokens << close_token
# Skip single or double quoted strings
elsif s.scan(/"/)
if s.peek(1) == "\""
s.getch
else
s.skip_until(/[^\\]"/)
end
elsif s.scan(/'/)
if s.peek(1) == "'"
s.getch
else
s.skip_until(/[^\\]'/)
end
# Skip number literals
elsif s.scan(/(0x)?\d(\d|\.)*/)
# SGML style brackets
elsif token = s.scan(/<[^\s<>][^<>]*>/)
extract_sgml_tokens(token).each { |t| tokens << t }
# Common programming punctuation
elsif token = s.scan(/;|\{|\}|\(|\)|\[|\]/)
tokens << token
# Regular token
elsif token = s.scan(/[\w\.@#\/\*]+/)
tokens << token
# Common operators
elsif token = s.scan(/<<?|\+|\-|\*|\/|%|&&?|\|\|?/)
tokens << token
else
s.getch
end
end
tokens
end
# Internal: Extract normalized shebang command token.
#
# Examples
#
# extract_shebang("#!/usr/bin/ruby")
# # => "ruby"
#
# extract_shebang("#!/usr/bin/env node")
# # => "node"
#
# Returns String token or nil it couldn't be parsed.
def extract_shebang(data)
s = StringScanner.new(data)
if path = s.scan(/^#!\s*\S+/)
script = path.split('/').last
if script == 'env'
s.scan(/\s+/)
script = s.scan(/\S+/)
end
script = script[/[^\d]+/, 0] if script
return script
end
nil
end
# Internal: Extract tokens from inside SGML tag.
#
# data - SGML tag String.
#
# Examples
#
# extract_sgml_tokens("<a href='' class=foo>")
# # => ["<a>", "href="]
#
# Returns Array of token Strings.
def extract_sgml_tokens(data)
s = StringScanner.new(data)
tokens = []
until s.eos?
# Emit start token
if token = s.scan(/<\/?[^\s>]+/)
tokens << "#{token}>"
# Emit attributes with trailing =
elsif token = s.scan(/\w+=/)
tokens << token
# Then skip over attribute value
if s.scan(/"/)
s.skip_until(/[^\\]"/)
elsif s.scan(/'/)
s.skip_until(/[^\\]'/)
else
s.skip_until(/\w+/)
end
# Emit lone attributes
elsif token = s.scan(/\w+/)
tokens << token
# Stop at the end of the tag
elsif s.scan(/>/)
s.terminate
else
s.getch
end
end
tokens
end
end
end
Loading
Loading
@@ -16,19 +16,32 @@
# https://github.com/joyent/node
- ^deps/
- ^tools/
- (^|/)configure$
- (^|/)configure.ac$
- (^|/)config.guess$
- (^|/)config.sub$
 
# Node depedencies
# Node dependencies
- node_modules/
 
# Vendored depedencies
# Erlang bundles
- ^rebar$
# Vendored dependencies
- vendor/
 
# Debian packaging
- ^debian/
 
## Commonly Bundled JavaScript frameworks ##
 
# jQuery
- (^|/)jquery([^.]*)(\.min)?\.js$
- (^|/)jquery\-\d\.\d(\.\d)?(\.min)?\.js$
- (^|/)jquery\-\d\.\d+(\.\d+)?(\.min)?\.js$
# jQuery UI
- (^|/)jquery\-ui(\-\d\.\d+(\.\d+)?)?(\.\w+)?(\.min)?\.(js|css)$
- (^|/)jquery\.(ui|effects)\.([^.]*)(\.min)?\.(js|css)$
 
# Prototype
- (^|/)prototype(.*)\.js$
Loading
Loading
@@ -49,10 +62,6 @@
- (^|/)yahoo-([^.]*)\.js$
- (^|/)yui([^.]*)\.js$
 
# LESS css
- (^|/)less([^.]*)(\.min)?\.js$
- (^|/)less\-\d+\.\d+\.\d+(\.min)?\.js$
# WYS editors
- (^|/)ckeditor\.js$
- (^|/)tiny_mce([^.]*)\.js$
Loading
Loading
@@ -61,8 +70,16 @@
# MathJax
- (^|/)MathJax/
 
# SyntaxHighlighter - http://alexgorbatchev.com/
- (^|/)shBrush([^.]*)\.js$
- (^|/)shCore\.js$
- (^|/)shLegacy\.js$
## Python ##
 
# django
- (^|/)admin_media/
# Fabric
- ^fabfile\.py$
 
Loading
Loading
@@ -81,7 +98,8 @@
- -vsdoc\.js$
 
# jQuery validation plugin (MS bundles this with asp.net mvc)
- (^|/)jquery([^.]*)\.validate(\.min)?\.js$
- (^|/)jquery([^.]*)\.validate(\.unobtrusive)?(\.min)?\.js$
- (^|/)jquery([^.]*)\.unobtrusive\-ajax(\.min)?\.js$
 
# Microsoft Ajax
- (^|/)[Mm]icrosoft([Mm]vc)?([Aa]jax|[Vv]alidation)(\.debug)?\.js$
Loading
Loading
@@ -90,7 +108,22 @@
- ^[Pp]ackages/
 
# ExtJS
- (^|/)ext(js)?(-\d\.\d\.\d)?(-gpl)?/
- (^|/)extjs/
 
# Samples folders
- ^[Ss]amples/
# LICENSE, README, git config files
- ^COPYING$
- ^LICENSE$
- gitattributes$
- gitignore$
- gitmodules$
- ^README$
- ^readme$
# Test fixtures
- ^[Tt]est/fixtures/
# .DS_Store's
- .[Dd][Ss]_[Ss]tore$
*/**
* The MIT License (MIT)
* Copyright (c) 2012 René van Mil
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
*----------------------------------------------------------------------*
* CLASS CL_CSV_PARSER DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class cl_csv_parser definition
public
inheriting from cl_object
final
create public .
public section.
*"* public components of class CL_CSV_PARSER
*"* do not include other source files here!!!
type-pools abap .
methods constructor
importing
!delegate type ref to if_csv_parser_delegate
!csvstring type string
!separator type c
!skip_first_line type abap_bool .
methods parse
raising
cx_csv_parse_error .
protected section.
*"* protected components of class CL_CSV_PARSER
*"* do not include other source files here!!!
private section.
*"* private components of class CL_CSV_PARSER
*"* do not include other source files here!!!
constants _textindicator type c value '"'. "#EC NOTEXT
data _delegate type ref to if_csv_parser_delegate .
data _csvstring type string .
data _separator type c .
type-pools abap .
data _skip_first_line type abap_bool .
methods _lines
returning
value(returning) type stringtab .
methods _parse_line
importing
!line type string
returning
value(returning) type stringtab
raising
cx_csv_parse_error .
endclass. "CL_CSV_PARSER DEFINITION
*----------------------------------------------------------------------*
* CLASS CL_CSV_PARSER IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class cl_csv_parser implementation.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method CL_CSV_PARSER->CONSTRUCTOR
* +-------------------------------------------------------------------------------------------------+
* | [--->] DELEGATE TYPE REF TO IF_CSV_PARSER_DELEGATE
* | [--->] CSVSTRING TYPE STRING
* | [--->] SEPARATOR TYPE C
* | [--->] SKIP_FIRST_LINE TYPE ABAP_BOOL
* +--------------------------------------------------------------------------------------</SIGNATURE>
method constructor.
super->constructor( ).
_delegate = delegate.
_csvstring = csvstring.
_separator = separator.
_skip_first_line = skip_first_line.
endmethod. "constructor
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method CL_CSV_PARSER->PARSE
* +-------------------------------------------------------------------------------------------------+
* | [!CX!] CX_CSV_PARSE_ERROR
* +--------------------------------------------------------------------------------------</SIGNATURE>
method parse.
data msg type string.
if _csvstring is initial.
message e002(csv) into msg.
raise exception type cx_csv_parse_error
exporting
message = msg.
endif.
" Get the lines
data is_first_line type abap_bool value abap_true.
data lines type standard table of string.
lines = _lines( ).
field-symbols <line> type string.
loop at lines assigning <line>.
" Should we skip the first line?
if _skip_first_line = abap_true and is_first_line = abap_true.
is_first_line = abap_false.
continue.
endif.
" Parse the line
data values type standard table of string.
values = _parse_line( <line> ).
" Send values to delegate
_delegate->values_found( values ).
endloop.
endmethod. "parse
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Private Method CL_CSV_PARSER->_LINES
* +-------------------------------------------------------------------------------------------------+
* | [<-()] RETURNING TYPE STRINGTAB
* +--------------------------------------------------------------------------------------</SIGNATURE>
method _lines.
split _csvstring at cl_abap_char_utilities=>cr_lf into table returning.
endmethod. "_lines
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Private Method CL_CSV_PARSER->_PARSE_LINE
* +-------------------------------------------------------------------------------------------------+
* | [--->] LINE TYPE STRING
* | [<-()] RETURNING TYPE STRINGTAB
* | [!CX!] CX_CSV_PARSE_ERROR
* +--------------------------------------------------------------------------------------</SIGNATURE>
method _parse_line.
data msg type string.
data csvvalue type string.
data csvvalues type standard table of string.
data char type c.
data pos type i value 0.
data len type i.
len = strlen( line ).
while pos < len.
char = line+pos(1).
if char <> _separator.
if char = _textindicator.
data text_ended type abap_bool.
text_ended = abap_false.
while text_ended = abap_false.
pos = pos + 1.
if pos < len.
char = line+pos(1).
if char = _textindicator.
text_ended = abap_true.
else.
if char is initial. " Space
concatenate csvvalue ` ` into csvvalue.
else.
concatenate csvvalue char into csvvalue.
endif.
endif.
else.
" Reached the end of the line while inside a text value
" This indicates an error in the CSV formatting
text_ended = abap_true.
message e003(csv) into msg.
raise exception type cx_csv_parse_error
exporting
message = msg.
endif.
endwhile.
" Check if next character is a separator, otherwise the CSV formatting is incorrect
data nextpos type i.
nextpos = pos + 1.
if nextpos < len and line+nextpos(1) <> _separator.
message e003(csv) into msg.
raise exception type cx_csv_parse_error
exporting
message = msg.
endif.
else.
if char is initial. " Space
concatenate csvvalue ` ` into csvvalue.
else.
concatenate csvvalue char into csvvalue.
endif.
endif.
else.
append csvvalue to csvvalues.
clear csvvalue.
endif.
pos = pos + 1.
endwhile.
append csvvalue to csvvalues. " Don't forget the last value
returning = csvvalues.
endmethod. "_parse_line
endclass. "CL_CSV_PARSER IMPLEMENTATION
\ No newline at end of file
ServerSignature Off
RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]
RewriteCond %{THE_REQUEST} (\\r|\\n|%0A|%0D) [NC,OR]
RewriteCond %{HTTP_REFERER} (<|>|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]
RewriteCond %{HTTP_COOKIE} (<|>|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]
RewriteCond %{REQUEST_URI} ^/(,|;|:|<|>|”>|”<|/|\\\.\.\\).{0,9999} [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^$ [OR]
RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} (winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} (libwww-perl|curl|wget|python|nikto|scan) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} (<|>|’|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]
#Block mySQL injects
RewriteCond %{QUERY_STRING} (;|<|>|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark) [NC,OR]
RewriteCond %{QUERY_STRING} \.\./\.\. [OR]
RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]
RewriteCond %{QUERY_STRING} \.[a-z0-9] [NC,OR]
RewriteCond %{QUERY_STRING} (<|>|’|%0A|%0D|%27|%3C|%3E|%00) [NC]
# Note: The final RewriteCond must NOT use the [OR] flag.
# Return 403 Forbidden error.
RewriteRule .* index.php [F]
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "/var/log/apache2/foo.log"
# with ServerRoot set to "" will be interpreted by the
# server as "//var/log/apache2/foo.log".
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot ""
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module /usr/lib/apache2/modules/mod_authn_file.so
LoadModule authn_dbm_module /usr/lib/apache2/modules/mod_authn_dbm.so
LoadModule authn_anon_module /usr/lib/apache2/modules/mod_authn_anon.so
LoadModule authn_dbd_module /usr/lib/apache2/modules/mod_authn_dbd.so
LoadModule authn_default_module /usr/lib/apache2/modules/mod_authn_default.so
LoadModule authn_alias_module /usr/lib/apache2/modules/mod_authn_alias.so
LoadModule authz_host_module /usr/lib/apache2/modules/mod_authz_host.so
LoadModule authz_groupfile_module /usr/lib/apache2/modules/mod_authz_groupfile.so
LoadModule authz_user_module /usr/lib/apache2/modules/mod_authz_user.so
LoadModule authz_dbm_module /usr/lib/apache2/modules/mod_authz_dbm.so
LoadModule authz_owner_module /usr/lib/apache2/modules/mod_authz_owner.so
LoadModule authnz_ldap_module /usr/lib/apache2/modules/mod_authnz_ldap.so
LoadModule authz_default_module /usr/lib/apache2/modules/mod_authz_default.so
LoadModule auth_basic_module /usr/lib/apache2/modules/mod_auth_basic.so
LoadModule auth_digest_module /usr/lib/apache2/modules/mod_auth_digest.so
LoadModule file_cache_module /usr/lib/apache2/modules/mod_file_cache.so
LoadModule cache_module /usr/lib/apache2/modules/mod_cache.so
LoadModule disk_cache_module /usr/lib/apache2/modules/mod_disk_cache.so
LoadModule mem_cache_module /usr/lib/apache2/modules/mod_mem_cache.so
LoadModule dbd_module /usr/lib/apache2/modules/mod_dbd.so
LoadModule dumpio_module /usr/lib/apache2/modules/mod_dumpio.so
LoadModule ext_filter_module /usr/lib/apache2/modules/mod_ext_filter.so
LoadModule include_module /usr/lib/apache2/modules/mod_include.so
LoadModule filter_module /usr/lib/apache2/modules/mod_filter.so
LoadModule charset_lite_module /usr/lib/apache2/modules/mod_charset_lite.so
LoadModule deflate_module /usr/lib/apache2/modules/mod_deflate.so
LoadModule ldap_module /usr/lib/apache2/modules/mod_ldap.so
LoadModule log_forensic_module /usr/lib/apache2/modules/mod_log_forensic.so
LoadModule env_module /usr/lib/apache2/modules/mod_env.so
LoadModule mime_magic_module /usr/lib/apache2/modules/mod_mime_magic.so
LoadModule cern_meta_module /usr/lib/apache2/modules/mod_cern_meta.so
LoadModule expires_module /usr/lib/apache2/modules/mod_expires.so
LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so
LoadModule ident_module /usr/lib/apache2/modules/mod_ident.so
LoadModule usertrack_module /usr/lib/apache2/modules/mod_usertrack.so
LoadModule unique_id_module /usr/lib/apache2/modules/mod_unique_id.so
LoadModule setenvif_module /usr/lib/apache2/modules/mod_setenvif.so
LoadModule version_module /usr/lib/apache2/modules/mod_version.so
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_connect_module /usr/lib/apache2/modules/mod_proxy_connect.so
LoadModule proxy_ftp_module /usr/lib/apache2/modules/mod_proxy_ftp.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
LoadModule proxy_ajp_module /usr/lib/apache2/modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module /usr/lib/apache2/modules/mod_proxy_balancer.so
LoadModule ssl_module /usr/lib/apache2/modules/mod_ssl.so
LoadModule mime_module /usr/lib/apache2/modules/mod_mime.so
LoadModule dav_module /usr/lib/apache2/modules/mod_dav.so
LoadModule status_module /usr/lib/apache2/modules/mod_status.so
LoadModule autoindex_module /usr/lib/apache2/modules/mod_autoindex.so
LoadModule asis_module /usr/lib/apache2/modules/mod_asis.so
LoadModule info_module /usr/lib/apache2/modules/mod_info.so
LoadModule suexec_module /usr/lib/apache2/modules/mod_suexec.so
LoadModule cgid_module /usr/lib/apache2/modules/mod_cgid.so
LoadModule cgi_module /usr/lib/apache2/modules/mod_cgi.so
LoadModule dav_fs_module /usr/lib/apache2/modules/mod_dav_fs.so
LoadModule dav_lock_module /usr/lib/apache2/modules/mod_dav_lock.so
LoadModule vhost_alias_module /usr/lib/apache2/modules/mod_vhost_alias.so
LoadModule negotiation_module /usr/lib/apache2/modules/mod_negotiation.so
LoadModule dir_module /usr/lib/apache2/modules/mod_dir.so
LoadModule imagemap_module /usr/lib/apache2/modules/mod_imagemap.so
LoadModule actions_module /usr/lib/apache2/modules/mod_actions.so
LoadModule speling_module /usr/lib/apache2/modules/mod_speling.so
LoadModule userdir_module /usr/lib/apache2/modules/mod_userdir.so
LoadModule alias_module /usr/lib/apache2/modules/mod_alias.so
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
<IfModule !mpm_netware_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User daemon
Group daemon
</IfModule>
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin you@example.com
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/usr/share/apache2/default-site/htdocs"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/usr/share/apache2/default-site/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog /var/log/apache2/error_log
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog /var/log/apache2/access_log common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog /var/log/apache2/access_log combined
</IfModule>
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "/usr/lib/cgi-bin/"
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock /var/run/apache2/cgisock
</IfModule>
#
# "/usr/lib/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig /etc/apache2/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile /etc/apache2/magic
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off
# Supplemental configuration
#
# The configuration files in the /etc/apache2/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
# Server-pool management (MPM specific)
#Include /etc/apache2/extra/httpd-mpm.conf
# Multi-language error messages
#Include /etc/apache2/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include /etc/apache2/extra/httpd-autoindex.conf
# Language settings
#Include /etc/apache2/extra/httpd-languages.conf
# User home directories
#Include /etc/apache2/extra/httpd-userdir.conf
# Real-time info on requests and configuration
#Include /etc/apache2/extra/httpd-info.conf
# Virtual hosts
#Include /etc/apache2/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
#Include /etc/apache2/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include /etc/apache2/extra/httpd-dav.conf
# Various default settings
#Include /etc/apache2/extra/httpd-default.conf
# Secure (SSL/TLS) connections
#Include /etc/apache2/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "log/foo_log"
# with ServerRoot set to "/usr" will be interpreted by the
# server as "/usr/log/foo_log".
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk. If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/usr"
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module libexec/apache2/mod_authn_file.so
LoadModule authn_dbm_module libexec/apache2/mod_authn_dbm.so
LoadModule authn_anon_module libexec/apache2/mod_authn_anon.so
LoadModule authn_dbd_module libexec/apache2/mod_authn_dbd.so
LoadModule authn_default_module libexec/apache2/mod_authn_default.so
LoadModule authz_host_module libexec/apache2/mod_authz_host.so
LoadModule authz_groupfile_module libexec/apache2/mod_authz_groupfile.so
LoadModule authz_user_module libexec/apache2/mod_authz_user.so
LoadModule authz_dbm_module libexec/apache2/mod_authz_dbm.so
LoadModule authz_owner_module libexec/apache2/mod_authz_owner.so
LoadModule authz_default_module libexec/apache2/mod_authz_default.so
LoadModule auth_basic_module libexec/apache2/mod_auth_basic.so
LoadModule auth_digest_module libexec/apache2/mod_auth_digest.so
LoadModule cache_module libexec/apache2/mod_cache.so
LoadModule disk_cache_module libexec/apache2/mod_disk_cache.so
LoadModule mem_cache_module libexec/apache2/mod_mem_cache.so
LoadModule dbd_module libexec/apache2/mod_dbd.so
LoadModule dumpio_module libexec/apache2/mod_dumpio.so
LoadModule reqtimeout_module libexec/apache2/mod_reqtimeout.so
LoadModule ext_filter_module libexec/apache2/mod_ext_filter.so
LoadModule include_module libexec/apache2/mod_include.so
LoadModule filter_module libexec/apache2/mod_filter.so
LoadModule substitute_module libexec/apache2/mod_substitute.so
LoadModule deflate_module libexec/apache2/mod_deflate.so
LoadModule log_config_module libexec/apache2/mod_log_config.so
LoadModule log_forensic_module libexec/apache2/mod_log_forensic.so
LoadModule logio_module libexec/apache2/mod_logio.so
LoadModule env_module libexec/apache2/mod_env.so
LoadModule mime_magic_module libexec/apache2/mod_mime_magic.so
LoadModule cern_meta_module libexec/apache2/mod_cern_meta.so
LoadModule expires_module libexec/apache2/mod_expires.so
LoadModule headers_module libexec/apache2/mod_headers.so
LoadModule ident_module libexec/apache2/mod_ident.so
LoadModule usertrack_module libexec/apache2/mod_usertrack.so
#LoadModule unique_id_module libexec/apache2/mod_unique_id.so
LoadModule setenvif_module libexec/apache2/mod_setenvif.so
LoadModule version_module libexec/apache2/mod_version.so
LoadModule proxy_module libexec/apache2/mod_proxy.so
LoadModule proxy_connect_module libexec/apache2/mod_proxy_connect.so
LoadModule proxy_ftp_module libexec/apache2/mod_proxy_ftp.so
LoadModule proxy_http_module libexec/apache2/mod_proxy_http.so
LoadModule proxy_scgi_module libexec/apache2/mod_proxy_scgi.so
LoadModule proxy_ajp_module libexec/apache2/mod_proxy_ajp.so
LoadModule proxy_balancer_module libexec/apache2/mod_proxy_balancer.so
LoadModule ssl_module libexec/apache2/mod_ssl.so
LoadModule mime_module libexec/apache2/mod_mime.so
LoadModule dav_module libexec/apache2/mod_dav.so
LoadModule status_module libexec/apache2/mod_status.so
LoadModule autoindex_module libexec/apache2/mod_autoindex.so
LoadModule asis_module libexec/apache2/mod_asis.so
LoadModule info_module libexec/apache2/mod_info.so
LoadModule cgi_module libexec/apache2/mod_cgi.so
LoadModule dav_fs_module libexec/apache2/mod_dav_fs.so
LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so
LoadModule negotiation_module libexec/apache2/mod_negotiation.so
LoadModule dir_module libexec/apache2/mod_dir.so
LoadModule imagemap_module libexec/apache2/mod_imagemap.so
LoadModule actions_module libexec/apache2/mod_actions.so
LoadModule speling_module libexec/apache2/mod_speling.so
LoadModule userdir_module libexec/apache2/mod_userdir.so
LoadModule alias_module libexec/apache2/mod_alias.so
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
#LoadModule perl_module libexec/apache2/mod_perl.so
#LoadModule php5_module libexec/apache2/libphp5.so
#LoadModule hfs_apple_module libexec/apache2/mod_hfs_apple.so
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User _www
Group _www
</IfModule>
</IfModule>
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin you@example.com
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/Library/WebServer/Documents"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/Library/WebServer/Documents">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks MultiViews
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.([Hh][Tt]|[Dd][Ss]_[Ss])">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
#
# Apple specific filesystem protection.
#
<Files "rsrc">
Order allow,deny
Deny from all
Satisfy All
</Files>
<DirectoryMatch ".*\.\.namedfork">
Order allow,deny
Deny from all
Satisfy All
</DirectoryMatch>
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "/private/var/log/apache2/error_log"
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog "/private/var/log/apache2/access_log" common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "/private/var/log/apache2/access_log" combined
</IfModule>
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAliasMatch ^/cgi-bin/((?!(?i:webobjects)).*$) "/Library/WebServer/CGI-Executables/$1"
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock /private/var/run/cgisock
</IfModule>
#
# "/Library/WebServer/CGI-Executables" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/Library/WebServer/CGI-Executables">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig /private/etc/apache2/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile /private/etc/apache2/magic
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# MaxRanges: Maximum number of Ranges in a request before
# returning the entire resource, or one of the special
# values 'default', 'none' or 'unlimited'.
# Default setting is to accept 200 Ranges.
#MaxRanges unlimited
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off
# 6894961
TraceEnable off
# Supplemental configuration
#
# The configuration files in the /private/etc/apache2/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
# Server-pool management (MPM specific)
Include /private/etc/apache2/extra/httpd-mpm.conf
# Multi-language error messages
#Include /private/etc/apache2/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
Include /private/etc/apache2/extra/httpd-autoindex.conf
# Language settings
Include /private/etc/apache2/extra/httpd-languages.conf
# User home directories
Include /private/etc/apache2/extra/httpd-userdir.conf
# Real-time info on requests and configuration
#Include /private/etc/apache2/extra/httpd-info.conf
# Virtual hosts
#Include /private/etc/apache2/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
Include /private/etc/apache2/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include /private/etc/apache2/extra/httpd-dav.conf
# Various default settings
#Include /private/etc/apache2/extra/httpd-default.conf
# Secure (SSL/TLS) connections
#Include /private/etc/apache2/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
Include /private/etc/apache2/other/*.conf
File moved
/* ============================================================
* This code is part of the "apex-lang" open source project avaiable at:
*
* http://code.google.com/p/apex-lang/
*
* This code is licensed under the Apache License, Version 2.0. You may obtain a
* copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
* ============================================================
*/
global class BooleanUtils {
global static Boolean isFalse(Boolean bool)
{
if(bool==null)
return false;
else
return !bool;
}
global static Boolean isNotFalse(Boolean bool)
{
if(bool==null)
return true;
else
return bool;
}
global static Boolean isNotTrue(Boolean bool)
{
if(bool==null)
return true;
else
return !bool;
}
global static Boolean isTrue(Boolean bool)
{
if(bool==null)
return false;
else
return bool;
}
global static Boolean negate(Boolean bool)
{
if(bool==null)
return null;
else
return !bool;
}
global static Boolean toBooleanDefaultIfNull(Boolean bool, Boolean defaultVal)
{
if(bool==null)
return defaultVal;
else
return bool;
}
global static Boolean toBoolean(Integer value)
{
if(value==null)
return false;
else
{
if(value==0)
return false;
else
return true;
}
}
global static Boolean strToBoolean(String value)
{
if(value==null)
return false;
else
{
if(StringUtils.equalsIgnoreCase(value,'true'))
return true;
else
return false;
}
}
/************************************/
//Converts an int to a boolean specifying
//the conversion values.
// Parameters:
// value - the Integer to convert, may be null
// trueValue - the value to match for true, may be null
// falseValue - the value to match for false, may be null
//Returns:
// true or false
//Throws:
// java.lang.IllegalArgumentException - if no match
/************************************/
global static Boolean toBoolean(Integer value,
Integer trueValue,
Integer falseValue)
{
if(value==trueValue)
return true;
else if(value==falseValue)
return false;
else
throw new IllegalArgumentException();
}
global static Integer toInteger(Boolean bool)
{
if(bool==null)
throw new IllegalArgumentException();
else
{
if(bool)
return 1;
else
return 0;
}
}
global static String toStringYesNo(Boolean bool)
{
if(bool==null)
return null;
else
{
if(bool)
return 'yes';
else
return 'no';
}
}
global static String toStringYN(Boolean bool)
{
if(bool==null)
return null;
else
{
if(bool)
return 'Y';
else
return 'N';
}
}
global static String toString(Boolean bool,
String trueString,
String falseString)
{
if(bool==null)
return null;
else
{
if(bool)
return trueString;
else
return falseString;
}
}
global static Boolean xor(Boolean[] boolArray)
{
if(boolArray==null || boolArray.size()==0)
throw new IllegalArgumentException();
else
{
Boolean firstItem=boolArray[0];
for(Boolean bool:boolArray)
{
if(bool!=firstItem)
return false;
}
return true;
}
}
}
\ No newline at end of file
/* ============================================================
* Contributor: Caleb Sidel
*
* This code is part of the "apex-lang" open source project avaiable at:
*
* http://code.google.com/p/apex-lang/
*
* This code is licensed under the Apache License, Version 2.0. You may obtain a
* copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
* ============================================================
*/
global class EmailUtils {
global static void sendEmailWithStandardAttachments(List<String> recipients,String emailSubject,String body,Boolean useHTML,List<Id> attachmentIDs) {
List<Attachment> stdAttachments = [SELECT id, name, body FROM Attachment WHERE Id IN:attachmentIDs];
sendEmailWithStandardAttachments(recipients, emailSubject, body, useHTML, stdAttachments);
}
global static void sendEmailWithStandardAttachments(List<String> recipients,String emailSubject,String body,Boolean useHTML,List<Attachment> stdAttachments) {
List<Messaging.EmailFileAttachment> fileAttachments = new List<Messaging.EmailFileAttachment>();
for(Attachment attachment : stdAttachments) {
Messaging.EmailFileAttachment fileAttachment = new Messaging.EmailFileAttachment();
fileAttachment.setFileName(attachment.Name);
fileAttachment.setBody(attachment.Body);
fileAttachments.add(fileAttachment);
}
sendEmail(recipients, emailSubject, body, useHTML, fileAttachments);
}
global static void sendTextEmail(List<String> recipients,String emailSubject,String textBody) {
sendEmail(recipients, emailSubject, textBody, false, null);
}
global static void sendHTMLEmail(List<String> recipients,String emailSubject,String htmlBody) {
sendEmail(recipients, emailSubject, htmlBody, true, null);
}
global static void sendEmail(List<String> recipients,String emailSubject,String body,Boolean useHTML,List<Messaging.EmailFileAttachment> fileAttachments) {
if(recipients == null) return;
if(recipients.size() == 0) return;
// Create a new single email message object
// that will send out a single email to the addresses in the To, CC & BCC list.
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
//the email is not saved as an activity.
mail.setSaveAsActivity(false);
// Assign the addresses for the To lists to the mail object.
mail.setToAddresses(recipients);
// Specify the subject line for your email address.
mail.setSubject(emailSubject);
// Set to True if you want to BCC yourself on the email.
mail.setBccSender(false);
// The email address of the user executing the Apex Code will be used.
mail.setUseSignature(false);
if (useHTML) {
// Specify the html content of the email.
mail.setHtmlBody(body);
} else {
// Specify the text content of the email.
mail.setPlainTextBody(body);
}
// Specify FileAttachments
if(fileAttachments != null && fileAttachments.size() > 0) {
mail.setFileAttachments(fileAttachments);
}
// Send the email you have created.
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
/**
* null => false
* '' => false
* ' ' => false
* 'x' => false
* 'x@' => false
* 'x@x' => false
* 'x@x.x' => true
*/
global static Boolean isValidEmailAddress(String str){
if(str != null && str.trim() != null && str.trim().length() > 0){
String[] split = str.split('@');
if(split != null && split.size() == 2){
split = split[1].split('\\.');
if(split != null && split.size() >= 2){
return true;
}
}
}
return false;
}
global static Boolean isNotValidEmailAddress(String str){
return !isValidEmailAddress(str);
}
}
\ No newline at end of file
public class GeoUtils {
// generate a KML string given a page reference, call getContent()
// then cleanup the output.
public static string generateFromContent(PageReference pr) {
string ret = '';
try {
ret = (string) pr.getContent().toString();
ret = ret.replaceAll('"','\'' ); // get content produces quote chars \"
ret = ret.replaceAll( '&','&amp;');// we need to escape these in the node value
} catch (exception e ) {
system.debug( 'ERROR '+e);
}
ret = ret.replaceAll('\n',' '); // must use ALL since many new line may get
ret = ret.replaceAll('\r',' '); // get these also!
// system.debug( ret); // dump the KML
return ret ;
}
public static Map<String, String> geo_response = new Map<String, String>{'200'=>'G_GEO_SUCCESS',
'400'=>'G_GEO_BAD_REQUEST',
'500'=>'G_GEO_SERVER_ERROR',
'601'=>'G_GEO_MISSING_ADDRESS',
'602'=>'G_GEO_UNKNOWN_ADDRESS',
'603'=>'G_GEO_UNAVAILABLE_ADDRESS',
'604'=>'G_GEO_UNKNOWN_DIRECTIONS',
'610'=>'G_GEO_BAD_KEY',
'620'=>'G_GEO_TOO_MANY_QUERIES'
};
public static string accountAddressString ( account acct ) {
// form an address string given an account object
string adr = acct.billingstreet + ',' + acct.billingcity + ',' + acct.billingstate;
if ( acct.billingpostalcode != null ) adr += ',' + acct.billingpostalcode;
if ( acct.billingcountry != null ) adr += ',' + acct.billingcountry;
adr = adr.replaceAll('\"', '' );
adr = adr.replaceAll('\'', '' );
adr = adr.replaceAll( '\n', ' ' );
adr = adr.replaceAll( '\r', ' ' );
system.debug( adr );
return adr;
}
public static testmethod void t1() {
PageReference pageRef = Page.kmlPreviewTemplate;
Test.setCurrentPage(pageRef);
system.assert ( GeoUtils.generateFromContent( pageRef ) != null );
Account a = new Account( name='foo', billingstreet='main', billingcity='springfield',billingstate='il',
billingpostalcode='9',billingcountry='us');
insert a;
system.assertEquals( 'main,springfield,il,9,us',accountAddressString( a) );
}
}
\ No newline at end of file
/* ============================================================
* This code is part of the "apex-lang" open source project avaiable at:
*
* http://code.google.com/p/apex-lang/
*
* This code is licensed under the Apache License, Version 2.0. You may obtain a
* copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
* ============================================================
*/
global class LanguageUtils {
global static final String HTTP_LANGUAGE_CODE_PARAMETER_KEY = 'l';
global static final String DEFAULT_LANGUAGE_CODE = 'en_us';
global static Set<String> SUPPORTED_LANGUAGE_CODES = new Set<String>{
'zh-cn' //Chinese (Simplified)
,'zh-tw' //Chinese (Traditional)
,'nl-nl' //Dutch
,'en-us' //English
,'fi' //Finnish
,'fr' //French
,'de' //German
,'it' //Italian
,'ja' //Japanese
,'ko' //Korean
,'pl' //Polish
,'pt-br' //Portuguese (Brazilian)
,'ru' //Russian
,'es' //Spanish
,'sv' //Swedish
,'th' //Thai
,'cs' //Czech
,'da' //Danish
,'hu' //Hungarian
,'in' //Indonesian
,'tr' //Turkish
};
private static Map<String,String> DEFAULTS = new Map<String,String>{
'en'=>'en-us'
,'zh'=>'zh-cn'
,'nl'=>'nl-nl'
,'pt'=>'pt-br'
};
global static String getLangCodeByHttpParam(){
String returnValue = null;
final Set<String> LANGUAGE_CODE_SET = getSuppLangCodeSet();
if(ApexPages.currentPage() != null && ApexPages.currentPage().getParameters() != null){
String LANGUAGE_HTTP_PARAMETER =
StringUtils.lowerCase(
StringUtils.replaceChars(
ApexPages.currentPage().getParameters().get(HTTP_LANGUAGE_CODE_PARAMETER_KEY)
, '_' //underscore
, '-' //dash
)
);
if(DEFAULTS.containsKey(LANGUAGE_HTTP_PARAMETER)){
LANGUAGE_HTTP_PARAMETER = DEFAULTS.get(LANGUAGE_HTTP_PARAMETER);
}
if(StringUtils.isNotBlank(LANGUAGE_HTTP_PARAMETER)
&& SUPPORTED_LANGUAGE_CODES.contains(LANGUAGE_HTTP_PARAMETER)){
returnValue = LANGUAGE_HTTP_PARAMETER;
}
}
return returnValue;
}
global static String getLangCodeByBrowser(){
final String LANGUAGES_FROM_BROWSER_AS_STRING = ApexPages.currentPage().getHeaders().get('Accept-Language');
final List<String> LANGUAGES_FROM_BROWSER_AS_LIST = splitAndFilterAcceptLanguageHeader(LANGUAGES_FROM_BROWSER_AS_STRING);
if(LANGUAGES_FROM_BROWSER_AS_LIST != null && LANGUAGES_FROM_BROWSER_AS_LIST.size() > 0){
for(String languageFromBrowser : LANGUAGES_FROM_BROWSER_AS_LIST){
if(DEFAULTS.containsKey(languageFromBrowser)){
languageFromBrowser = DEFAULTS.get(languageFromBrowser);
}
if(SUPPORTED_LANGUAGE_CODES.contains(languageFromBrowser)){
return languageFromBrowser;
}
}
}
return null;
}
global static String getLangCodeByUser(){
return UserInfo.getLanguage();
}
global static String getLangCodeByHttpParamOrIfNullThenBrowser(){
return StringUtils.defaultString(getLangCodeByHttpParam(),getLangCodeByBrowser());
}
global static String getLangCodeByHttpParamOrIfNullThenUser(){
return StringUtils.defaultString(getLangCodeByHttpParam(),getLangCodeByUser());
}
global static String getLangCodeByBrowserOrIfNullThenHttpParam(){
return StringUtils.defaultString(getLangCodeByBrowser(),getLangCodeByHttpParam());
}
global static String getLangCodeByBrowserOrIfNullThenUser(){
return StringUtils.defaultString(getLangCodeByBrowser(),getLangCodeByUser());
}
private static List<String> splitAndFilterAcceptLanguageHeader(String header){
List<String> returnList = new List<String>();
String[] tokens = StringUtils.split(header,',');
if(tokens != null){
for(String token : tokens){
if(token != null ){
if(token.contains(';')){
token = token.substring(0,token.indexOf(';',0));
}
returnList.add(token);
if(StringUtils.length(token) > 2){
returnList.add(StringUtils.substring(token,0,2));
}
}
}
}
return returnList;
}
private static Set<String> getSuppLangCodeSet(){
Set<String> langCodes = new Set<String>();
for(String langCode : SUPPORTED_LANGUAGE_CODES){
if(langCode != null){
langCodes.add(StringUtils.lowerCase(langCode));
}
}
return langCodes;
}
global static String getLanguageName(String displayLanguageCode, String languageCode){
return translatedLanguageNames.get(filterLanguageCode(displayLanguageCode)).get(filterLanguageCode(languageCode));
}
global static Map<String,String> getAllLanguages(){
return getAllLanguages(DEFAULT_LANGUAGE_CODE);
}
global static Map<String,String> getAllLanguages(String displayLanguageCode){
return translatedLanguageNames.get(filterLanguageCode(displayLanguageCode));
}
private static String filterLanguageCode(String displayLanguageCode){
displayLanguageCode = StringUtils.lowerCase(displayLanguageCode);
if(DEFAULTS.containsKey(displayLanguageCode)){
displayLanguageCode = StringUtils.replaceChars(DEFAULTS.get(displayLanguageCode),'-','_');
}
if(!translatedLanguageNames.containsKey(displayLanguageCode)){
displayLanguageCode = DEFAULT_LANGUAGE_CODE;
}
return displayLanguageCode;
}
private static final Map<String,Map<String,String>> translatedLanguageNames = new Map<String,Map<String,String>>{
'cs'=> new Map<String,String>{
'cs'=>'Čeština'
,'da'=>'Dánština'
,'de'=>'Němčina'
,'en_us'=>'Angličtina (Spojené státy)'
,'es'=>'Španělština'
,'es_mx'=>'Mexická španělština'
,'fi'=>'Finština'
,'fr'=>'Francouzština'
,'hu'=>'Maďarština'
,'in'=>'Indonéština'
,'it'=>'Italština'
,'ja'=>'Japonština'
,'ko'=>'Korejština'
,'nl_nl'=>'Nizozemština'
,'pl'=>'Polština'
,'pt_br'=>'Portugalština (Brazílie)'
,'ro'=>'Rumunština'
,'ru'=>'Ruština'
,'sv'=>'Švédština'
,'th'=>'Thajská'
,'tr'=>'Turečtina'
,'zh_cn'=>'Čínština (zjednodušená)'
,'zh_tw'=>'Čínština (tradiční)'
}
,'da'=> new Map<String,String>{
'cs'=>'Tjekkisk'
,'da'=>'Dansk'
,'de'=>'Tysk'
,'en_us'=>'Engelsk (USA)'
,'es'=>'Spansk'
,'es_mx'=>'Mexicansk spansk'
,'fi'=>'Finsk'
,'fr'=>'Fransk'
,'hu'=>'Ungarsk'
,'in'=>'Indonesisk'
,'it'=>'Italiensk'
,'ja'=>'Japansk'
,'ko'=>'Koreansk'
,'nl_nl'=>'Hollandsk'
,'pl'=>'Polsk'
,'pt_br'=>'Portugisisk (Brasilien)'
,'ro'=>'Rumænsk'
,'ru'=>'Russisk'
,'sv'=>'Svensk'
,'th'=>'Thai'
,'tr'=>'Tyrkisk'
,'zh_cn'=>'Kinesisk (forenklet)'
,'zh_tw'=>'Kinesisk (traditionelt)'
}
,'de'=> new Map<String,String>{
'cs'=>'Tschechisch'
,'da'=>'Dänisch'
,'de'=>'Deutsch'
,'en_us'=>'Englisch (Vereinigte Staaten)'
,'es'=>'Spanisch'
,'es_mx'=>'Mexican Spanish'
,'fi'=>'Finnisch'
,'fr'=>'Französisch'
,'hu'=>'Ungarisch'
,'in'=>'Indonesisch'
,'it'=>'Italienisch'
,'ja'=>'Japanisch'
,'ko'=>'Koreanisch'
,'nl_nl'=>'Niederländisch'
,'pl'=>'Polnisch'
,'pt_br'=>'Portugiesisch (Brasilien)'
,'ro'=>'Rumänisch'
,'ru'=>'Russisch'
,'sv'=>'Schwedisch'
,'th'=>'Thai'
,'tr'=>'Türkisch'
,'zh_cn'=>'Chinesisch (Taiwan)'
,'zh_tw'=>'Chinesisch (traditionell)'
}
,'en_us'=> new Map<String,String>{
'cs'=>'Czech'
,'da'=>'Danish'
,'de'=>'German'
,'en_us'=>'English (United States)'
,'es'=>'Spanish'
,'es_mx'=>'Mexican Spanish'
,'fi'=>'Finnish'
,'fr'=>'French'
,'hu'=>'Hungarian'
,'in'=>'Indonesian'
,'it'=>'Italian'
,'ja'=>'Japanese'
,'ko'=>'Korean'
,'nl_nl'=>'Dutch'
,'pl'=>'Polish'
,'pt_br'=>'Portuguese (Brazilian)'
,'ro'=>'Romanian'
,'ru'=>'Russian'
,'sv'=>'Swedish'
,'th'=>'Thai'
,'tr'=>'Turkish'
,'zh_cn'=>'Chinese (Simplified)'
,'zh_tw'=>'Chinese (Traditional)'
}
,'es'=> new Map<String,String>{
'cs'=>'Checa'
,'da'=>'Danés'
,'de'=>'Alemán'
,'en_us'=>'Inglés (Estados Unidos)'
,'es'=>'Español'
,'es_mx'=>'El español de México'
,'fi'=>'Finlandés'
,'fr'=>'Francés'
,'hu'=>'Húngaro'
,'in'=>'Indonesia'
,'it'=>'Italiano'
,'ja'=>'Japonés'
,'ko'=>'Corea'
,'nl_nl'=>'Neerlandés'
,'pl'=>'Polaco'
,'pt_br'=>'Portugués (brasileño)'
,'ro'=>'Rumano'
,'ru'=>'Rusia'
,'sv'=>'Sueco'
,'th'=>'Tailandia'
,'tr'=>'Turquía'
,'zh_cn'=>'Chino (simplificado)'
,'zh_tw'=>'Chino (tradicional)'
}
,'es_mx'=> new Map<String,String>{
'cs'=>'Checa'
,'da'=>'Danés'
,'de'=>'Alemán'
,'en_us'=>'Inglés (Estados Unidos)'
,'es'=>'Español'
,'es_mx'=>'El español de México'
,'fi'=>'Finlandés'
,'fr'=>'Francés'
,'hu'=>'Húngaro'
,'in'=>'Indonesia'
,'it'=>'Italiano'
,'ja'=>'Japonés'
,'ko'=>'Corea'
,'nl_nl'=>'Neerlandés'
,'pl'=>'Polaco'
,'pt_br'=>'Portugués (brasileño)'
,'ro'=>'Rumano'
,'ru'=>'Rusia'
,'sv'=>'Sueco'
,'th'=>'Tailandia'
,'tr'=>'Turquía'
,'zh_cn'=>'Chino (simplificado)'
,'zh_tw'=>'Chino (tradicional)'
}
,'fi'=> new Map<String,String>{
'cs'=>'Tšekki'
,'da'=>'Tanska'
,'de'=>'Saksa'
,'en_us'=>'Englanti (Yhdysvallat)'
,'es'=>'Espanja'
,'es_mx'=>'Meksikon espanja'
,'fi'=>'Suomen'
,'fr'=>'Ranska'
,'hu'=>'Unkari'
,'in'=>'Indonesia'
,'it'=>'Italia'
,'ja'=>'Japani'
,'ko'=>'Korea'
,'nl_nl'=>'Hollanti'
,'pl'=>'Puola'
,'pt_br'=>'Portugali (Brasilia)'
,'ro'=>'Romania'
,'ru'=>'Venäjä'
,'sv'=>'Ruotsi'
,'th'=>'Thaimaalaisen'
,'tr'=>'Turkki'
,'zh_cn'=>'Kiina (yksinkertaistettu)'
,'zh_tw'=>'Kiina (perinteinen)'
}
,'fr'=> new Map<String,String>{
'cs'=>'Tchèque'
,'da'=>'Danois'
,'de'=>'Allemand'
,'en_us'=>'Anglais (Etats Unis)'
,'es'=>'Espagnol'
,'es_mx'=>'Espagnol mexicain'
,'fi'=>'Finnois'
,'fr'=>'Français'
,'hu'=>'Hongrois'
,'in'=>'Indonésien'
,'it'=>'Italien'
,'ja'=>'Japonais'
,'ko'=>'Coréen'
,'nl_nl'=>'Néerlandais'
,'pl'=>'Polonais'
,'pt_br'=>'Portugais (brésilien)'
,'ro'=>'Roumain'
,'ru'=>'Russe'
,'sv'=>'Suédois'
,'th'=>'Thai'
,'tr'=>'Turc'
,'zh_cn'=>'Chinois (simplifié)'
,'zh_tw'=>'Chinois (Traditionnel)'
}
,'hu'=> new Map<String,String>{
'cs'=>'Cseh'
,'da'=>'Dán'
,'de'=>'Német'
,'en_us'=>'Angol (Egyesült Államok)'
,'es'=>'Spanyol'
,'es_mx'=>'Mexikói spanyol'
,'fi'=>'Finn'
,'fr'=>'Francia'
,'hu'=>'Magyar'
,'in'=>'Indonéz'
,'it'=>'Olasz'
,'ja'=>'Japán'
,'ko'=>'Koreai'
,'nl_nl'=>'Holland'
,'pl'=>'Lengyel'
,'pt_br'=>'Portugál (brazíliai)'
,'ro'=>'Román'
,'ru'=>'Orosz'
,'sv'=>'Svéd'
,'th'=>'Thaiföldi'
,'tr'=>'Török'
,'zh_cn'=>'Kínai (egyszerűsített)'
,'zh_tw'=>'Kínai (hagyományos)'
}
,'in'=> new Map<String,String>{
'cs'=>'Ceko'
,'da'=>'Denmark'
,'de'=>'Jerman'
,'en_us'=>'Inggris (Amerika Serikat)'
,'es'=>'Spanyol'
,'es_mx'=>'Meksiko Spanyol'
,'fi'=>'Finlandia'
,'fr'=>'Prancis'
,'hu'=>'Hungaria'
,'in'=>'Indonesia'
,'it'=>'Italia'
,'ja'=>'Jepang'
,'ko'=>'Korea'
,'nl_nl'=>'Belanda'
,'pl'=>'Polish'
,'pt_br'=>'Portugis (Brasil)'
,'ro'=>'Romanian'
,'ru'=>'Russian'
,'sv'=>'Swedia'
,'th'=>'Thai'
,'tr'=>'Turkish'
,'zh_cn'=>'Cina (Sederhana)'
,'zh_tw'=>'Cina (Tradisional)'
}
,'it'=> new Map<String,String>{
'cs'=>'Ceco'
,'da'=>'Danese'
,'de'=>'Tedesco'
,'en_us'=>'Inglese (Stati Uniti)'
,'es'=>'Spagnolo'
,'es_mx'=>'Spagnolo messicano'
,'fi'=>'Finlandese'
,'fr'=>'Francese'
,'hu'=>'Ungherese'
,'in'=>'Indonesiano'
,'it'=>'Italiano'
,'ja'=>'Giapponese'
,'ko'=>'Coreano'
,'nl_nl'=>'Olandese'
,'pl'=>'Polacco'
,'pt_br'=>'Portoghese (brasiliano)'
,'ro'=>'Rumeno'
,'ru'=>'Russo'
,'sv'=>'Svedese'
,'th'=>'Thai'
,'tr'=>'Turco'
,'zh_cn'=>'Cinese (semplificato)'
,'zh_tw'=>'Cinese (tradizionale)'
}
,'ja'=> new Map<String,String>{
'cs'=>'チェコ語'
,'da'=>'デンマーク語'
,'de'=>'ドイツ語'
,'en_us'=>'英語(アメリカ合衆国)'
,'es'=>'スペイン語'
,'es_mx'=>'メキシコのスペイン語'
,'fi'=>'フィンランド語'
,'fr'=>'フランス語'
,'hu'=>'ハンガリー語'
,'in'=>'インドネシア語'
,'it'=>'イタリア語'
,'ja'=>'日本語'
,'ko'=>'韓国語'
,'nl_nl'=>'オランダ語'
,'pl'=>'ポーランド語'
,'pt_br'=>'ポルトガル語(ブラジル)'
,'ro'=>'ルーマニア語'
,'ru'=>'ロシア語'
,'sv'=>'スウェーデン語'
,'th'=>'タイ'
,'tr'=>'トルコ語'
,'zh_cn'=>'中国語(簡体字)'
,'zh_tw'=>'中国語(繁体字)'
}
,'ko'=> new Map<String,String>{
'cs'=>'체코어'
,'da'=>'덴마크어'
,'de'=>'독일어'
,'en_us'=>'영어 (미국)'
,'es'=>'스페인어'
,'es_mx'=>'멕시코 스페인'
,'fi'=>'핀란드어'
,'fr'=>'프랑스어'
,'hu'=>'헝가리어'
,'in'=>'인도네시 아어'
,'it'=>'이탈리아어'
,'ja'=>'일본어'
,'ko'=>'한국어'
,'nl_nl'=>'네덜란드'
,'pl'=>'폴란드어'
,'pt_br'=>'포르투갈어 (브라질)'
,'ro'=>'루마니아어'
,'ru'=>'러시아어'
,'sv'=>'스웨덴어'
,'th'=>'타이어'
,'tr'=>'터키어'
,'zh_cn'=>'중국어 (간체)'
,'zh_tw'=>'중국어 (번체)'
}
,'nl_nl'=> new Map<String,String>{
'cs'=>'Tsjechisch'
,'da'=>'Deens'
,'de'=>'Duits'
,'en_us'=>'Engels (Verenigde Staten)'
,'es'=>'Spaans'
,'es_mx'=>'Mexicaans Spaans'
,'fi'=>'Fins'
,'fr'=>'Frans'
,'hu'=>'Hongaars'
,'in'=>'Indonesisch'
,'it'=>'Italiaans'
,'ja'=>'Japans'
,'ko'=>'Koreaans'
,'nl_nl'=>'Nederlandse'
,'pl'=>'Pools'
,'pt_br'=>'Portugees (Braziliaans)'
,'ro'=>'Roemeens'
,'ru'=>'Russisch'
,'sv'=>'Zweeds'
,'th'=>'Thais'
,'tr'=>'Turks'
,'zh_cn'=>'Chinese (Simplified)'
,'zh_tw'=>'Chinees (traditioneel)'
}
,'pl'=> new Map<String,String>{
'cs'=>'Czeski'
,'da'=>'Duński'
,'de'=>'Niemiecki'
,'en_us'=>'Angielski (Stany Zjednoczone)'
,'es'=>'Hiszpański'
,'es_mx'=>'Mexican hiszpański'
,'fi'=>'Fiński'
,'fr'=>'Francuski'
,'hu'=>'Węgierski'
,'in'=>'Indonezyjski'
,'it'=>'Włoski'
,'ja'=>'Japoński'
,'ko'=>'Koreański'
,'nl_nl'=>'Niderlandzki'
,'pl'=>'Polska'
,'pt_br'=>'Portugalski (Brazylia)'
,'ro'=>'Rumuński'
,'ru'=>'Rosyjski'
,'sv'=>'Szwedzki'
,'th'=>'Taj'
,'tr'=>'Turecki'
,'zh_cn'=>'Chiński (uproszczony)'
,'zh_tw'=>'Chiński (tradycyjny)'
}
,'pt_br'=> new Map<String,String>{
'cs'=>'Tcheco'
,'da'=>'Dinamarquês'
,'de'=>'Alemão'
,'en_us'=>'Inglês (Estados Unidos)'
,'es'=>'Espanhol'
,'es_mx'=>'Espanhol mexicano'
,'fi'=>'Finlandês'
,'fr'=>'Francês'
,'hu'=>'Húngaro'
,'in'=>'Indonésio'
,'it'=>'Italiano'
,'ja'=>'Japonês'
,'ko'=>'Coreano'
,'nl_nl'=>'Holandês'
,'pl'=>'Polonês'
,'pt_br'=>'Português (Brasil)'
,'ro'=>'Romeno'
,'ru'=>'Russo'
,'sv'=>'Sueco'
,'th'=>'Tailandês'
,'tr'=>'Turco'
,'zh_cn'=>'Chinês (simplificado)'
,'zh_tw'=>'Chinês (Tradicional)'
}
,'ro'=> new Map<String,String>{
'cs'=>'Cehă'
,'da'=>'Daneză'
,'de'=>'Germană'
,'en_us'=>'În limba engleză (Statele Unite)'
,'es'=>'Spaniolă'
,'es_mx'=>'Mexicane Spanish'
,'fi'=>'Finlandeză'
,'fr'=>'Franţuzesc'
,'hu'=>'Maghiară'
,'in'=>'Indoneziană'
,'it'=>'Italiană'
,'ja'=>'Japoneză'
,'ko'=>'Coreeană'
,'nl_nl'=>'Olandeză'
,'pl'=>'Poloneză'
,'pt_br'=>'Portuguese (Brazilian)'
,'ro'=>'Român'
,'ru'=>'Rus'
,'sv'=>'Suedez'
,'th'=>'Thai'
,'tr'=>'Turcă'
,'zh_cn'=>'Chineză (simplificată)'
,'zh_tw'=>'Chineză (Tradiţională)'
}
,'ru'=> new Map<String,String>{
'cs'=>'Чешский'
,'da'=>'Датский'
,'de'=>'Немецкий'
,'en_us'=>'Английский (США)'
,'es'=>'Испанский'
,'es_mx'=>'Мексиканские Испанский'
,'fi'=>'Финский'
,'fr'=>'Французский'
,'hu'=>'Венгерский'
,'in'=>'Индонезийский'
,'it'=>'Итальянский'
,'ja'=>'Японский'
,'ko'=>'Корейский'
,'nl_nl'=>'Голландский'
,'pl'=>'Польский'
,'pt_br'=>'Португальский (бразильский)'
,'ro'=>'Румынский'
,'ru'=>'Русский'
,'sv'=>'Шведский'
,'th'=>'Тайский'
,'tr'=>'Турецкий'
,'zh_cn'=>'Китайский (упрощенный)'
,'zh_tw'=>'Китайский (традиционный)'
}
,'sv'=> new Map<String,String>{
'cs'=>'Tjeckiska'
,'da'=>'Danska'
,'de'=>'Tyska'
,'en_us'=>'Engelska (USA)'
,'es'=>'Spanska'
,'es_mx'=>'Mexikansk spanska'
,'fi'=>'Finska'
,'fr'=>'Franska'
,'hu'=>'Ungerska'
,'in'=>'Indonesiska'
,'it'=>'Italienska'
,'ja'=>'Japanska'
,'ko'=>'Koreanska'
,'nl_nl'=>'Nederländska'
,'pl'=>'Polska'
,'pt_br'=>'Portugisiska (Brasilien)'
,'ro'=>'Rumänska'
,'ru'=>'Ryska'
,'sv'=>'Svenska'
,'th'=>'Thai'
,'tr'=>'Turkiska'
,'zh_cn'=>'Kinesiska (förenklad)'
,'zh_tw'=>'Kinesiska (traditionell)'
}
,'th'=> new Map<String,String>{
'cs'=>'สาธารณรัฐ เช็ ก'
,'da'=>'เดนมาร์ก'
,'de'=>'เยอรมัน'
,'en_us'=>'ภาษา อังกฤษ States (United)'
,'es'=>'สเปน'
,'es_mx'=>'สเปน เม็ก ซิ กัน'
,'fi'=>'ฟินแลนด์'
,'fr'=>'ฝรั่งเศส'
,'hu'=>'ฮังการี'
,'in'=>'อินโดนีเซีย'
,'it'=>'อิตาเลียน'
,'ja'=>'ญี่ปุ่น'
,'ko'=>'เกาหลี'
,'nl_nl'=>'ดัตช์'
,'pl'=>'เงา'
,'pt_br'=>'โปรตุเกส (บราซิล)'
,'ro'=>'โรมาเนีย'
,'ru'=>'ภาษา รัสเซีย'
,'sv'=>'สวีเดน'
,'th'=>'ไทย'
,'tr'=>'ภาษา ตุรกี'
,'zh_cn'=>'จีน (ประยุกต์)'
,'zh_tw'=>'ภาษา จีน (ดั้งเดิม)'
}
,'tr'=> new Map<String,String>{
'cs'=>'Çekçe'
,'da'=>'Danca'
,'de'=>'Almanca'
,'en_us'=>'İngilizce (ABD)'
,'es'=>'İspanyolca'
,'es_mx'=>'Mexican İspanyolca'
,'fi'=>'Fince'
,'fr'=>'Fransızca'
,'hu'=>'Macarca'
,'in'=>'Endonezya Dili'
,'it'=>'İtalyanca'
,'ja'=>'Japonca'
,'ko'=>'Korece'
,'nl_nl'=>'Hollanda Dili'
,'pl'=>'Lehçe'
,'pt_br'=>'Portekizce (Brezilya)'
,'ro'=>'Romence'
,'ru'=>'Rusça'
,'sv'=>'İsveççe'
,'th'=>'Tay'
,'tr'=>'Türkçe'
,'zh_cn'=>'Çince (Basitleştirilmiş)'
,'zh_tw'=>'Çince (Geleneksel)'
}
,'zh_cn'=> new Map<String,String>{
'cs'=>'捷克文'
,'da'=>'丹麦文'
,'de'=>'德语'
,'en_us'=>'英语(美国)'
,'es'=>'西班牙语'
,'es_mx'=>'墨西哥西班牙语'
,'fi'=>'芬兰文'
,'fr'=>'法语'
,'hu'=>'匈牙利文'
,'in'=>'印度尼西亚文'
,'it'=>'意大利语'
,'ja'=>'日语'
,'ko'=>'韩文'
,'nl_nl'=>'荷兰文'
,'pl'=>'波兰文'
,'pt_br'=>'葡萄牙语(巴西)'
,'ro'=>'罗马尼亚文'
,'ru'=>'俄文'
,'sv'=>'瑞典文'
,'th'=>'泰国'
,'tr'=>'土耳其文'
,'zh_cn'=>'中文(简体)'
,'zh_tw'=>'中文(繁体)'
}
,'zh_tw'=> new Map<String,String>{
'cs'=>'捷克文'
,'da'=>'丹麥文'
,'de'=>'德語'
,'en_us'=>'英語(美國)'
,'es'=>'西班牙語'
,'es_mx'=>'墨西哥西班牙語'
,'fi'=>'芬蘭文'
,'fr'=>'法語'
,'hu'=>'匈牙利文'
,'in'=>'印度尼西亞文'
,'it'=>'意大利語'
,'ja'=>'日語'
,'ko'=>'韓文'
,'nl_nl'=>'荷蘭文'
,'pl'=>'波蘭文'
,'pt_br'=>'葡萄牙語(巴西)'
,'ro'=>'羅馬尼亞文'
,'ru'=>'俄文'
,'sv'=>'瑞典文'
,'th'=>'泰國'
,'tr'=>'土耳其文'
,'zh_cn'=>'中文(簡體)'
,'zh_tw'=>'中文(繁體)'
}
};
}
\ No newline at end of file
/*
Copyright (c) 2012 Twilio, Inc.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* Entry point for accessing Twilio resources that are pre-configured
* with credentials from the Twilio Config custom setting (TwilioConfig__c).
*
* To set up your Twilio credentials:
* 1. Get a Twilio account at http://www.twilio.com/try-twilio
* 2. Find your Twilio Account Sid and Auth Token at https://www.twilio.com/user/account
* 3. Log into Salesforce and go to: Setup | Develop | Custom Settings | Manage Twilio Config
* 4. Create a new Twilo Config instance
* 5. Copy and paste your Account Sid and Auth Token and click Save
*
* NOTE: The Application Sid field is for use with the Twilio Client softphone
* SDK for Javascript. It is not required for the rest of the Twilio API.
*
* Now you can get easy access to Twilio from your Apex code by calling:
*
* TwilioRestClient restClient = TwilioAPI.getDefaultClient();
* restClient.getAccount().getCalls();
* // etc.
*/
global class TwilioAPI {
private class MissingTwilioConfigCustomSettingsException extends Exception {}
private static TwilioRestClient client;
private TwilioAPI() {}
/**
* Get a TwilioRestClient pre-populated with your TwilioConfig credentials
*/
public static TwilioRestClient getDefaultClient() {
if (client==null) {
TwilioConfig__c twilioCfg = getTwilioConfig();
TwilioAPI.client = new TwilioRestClient(twilioCfg.AccountSid__c, twilioCfg.AuthToken__c);
}
return TwilioAPI.client;
}
/**
* Get your primary account using your TwilioConfig credentials
*/
public static TwilioAccount getDefaultAccount() {
return getDefaultClient().getAccount();
}
/**
* Get a new Twilio Client capability token generator pre-populated
* with your TwilioConfig credentials
*/
public static TwilioCapability createCapability() {
TwilioConfig__c twilioCfg = getTwilioConfig();
return new TwilioCapability(twilioCfg.AccountSid__c, twilioCfg.AuthToken__c);
}
/**
* Get a new TwilioRestClient authorized with the credentials provided
*/
public static TwilioRestClient createClient(String accountSid, String authToken) {
return new TwilioRestClient(accountSid, authToken);
}
/**
* Load the org default TwilioConfig record
*/
public static TwilioConfig__c getTwilioConfig() {
TwilioConfig__c twilioCfg;
if (Test.isRunningTest()) {
twilioCfg = new TwilioConfig__c();
twilioCfg.AccountSid__c = 'ACba8bc05eacf94afdae398e642c9cc32d'; // dummy sid
twilioCfg.AuthToken__c = '12345678901234567890123456789012'; // dummy token
} else {
twilioCfg = TwilioConfig__c.getOrgDefaults();
if (twilioCfg==null)
throw new MissingTwilioConfigCustomSettingsException('Please enter your Twilio account credentials under Twilio Config custom settings (go to Setup | Develop | Custom Settings | Manage Twilio Config)');
}
return twilioCfg;
}
@isTest
static void test_TwilioAPI() {
System.assertEquals('ACba8bc05eacf94afdae398e642c9cc32d', TwilioAPI.getTwilioConfig().AccountSid__c);
System.assertEquals('12345678901234567890123456789012', TwilioAPI.getTwilioConfig().AuthToken__c);
System.assertEquals('ACba8bc05eacf94afdae398e642c9cc32d', TwilioAPI.getDefaultClient().getAccountSid());
System.assertEquals('ACba8bc05eacf94afdae398e642c9cc32d', TwilioAPI.getDefaultClient().getAccount().getSid());
System.assertEquals('ACba8bc05eacf94afdae398e642c9cc32d', TwilioAPI.getDefaultAccount().getSid());
}
}
\ No newline at end of file
(*
Copyright 2003 Apple Computer, Inc.
You may incorporate this Apple sample code into your program(s) without
restriction. This Apple sample code has been provided "AS IS" and the
responsibility for its operation is yours. You are not permitted to
redistribute this Apple sample code as "Apple sample code" after having
made changes. If you're going to redistribute the code, we require
that you make it clear that the code was descended from Apple sample
code, but that you've made changes.
*)
property type_list : {"JPEG", "GIFf", "PICT", "TIFF", "PDF", "TEXT"}
property extension_list : {"jpg", "gif", "pct", "tif", "pdf", "rtf"}
--html is not currently handled
on run {}
tell application "Finder" to set FinderSelection to the selection as alias list
set FS to FinderSelection
--Ideally, this list could be passed to the open handler
set SelectionCount to number of FS -- count
if SelectionCount is 0 then
set FS to userPicksFolder()
else if the SelectionCount is 1 then
set MyPath to path to me
if MyPath is item 1 of FS then
--If I'm a droplet then I was double-clicked
set FS to userPicksFolder()
end if
else
--I'm not a double-clicked droplet
end if
open FS
end run
on userPicksFolder()
set these_items to {}
set these_items to (choose file with prompt "Select a file to convert to PDF:" of type {"JPEG", "GIFf", "PICT", "TIFF", "TEXT", "RTF"}) as list
end userPicksFolder
on open these_items
set thesefiles to {}
set the item_info to {}
repeat with i from 1 to the count of these_items
set this_item to (item i of these_items)
set the item_info to info for this_item
if folder of the item_info is true then --if the item is a folder
processFolder(this_item)
else if ((folder of the item_info is false) and (alias of the item_info is false)) and (the file type of the item_info is in the type_list) or ((the name extension of the item_info) is in the extension_list) then
set theFilePath to (item i of these_items as string)
set thePOSIXFilePath to POSIX path of theFilePath as string
processFile(thePOSIXFilePath)
end if
end repeat
end open
--process folders
on processFolder(theFolder)
set these_items to list folder theFolder without invisibles
repeat with i from 1 to the count of these_items
set this_item to alias ((theFolder as text) & (item i of these_items))
set the item_info to info for this_item
if folder of the item_info is true then
processFolder(this_item)
else if (alias of the item_info is false) and ((the file type of the item_info is in the type_list) or the name extension of the item_info is in the extension_list) then
set theFilePath to (this_item as string)
set thePOSIXFilePath to POSIX path of theFilePath as string
processFile(thePOSIXFilePath)
end if
end repeat
end processFolder
on processFile(thePOSIXFileName)
try
set terminalCommand to ""
set convertCommand to "/System/Library/Printers/Libraries/./convert "
set newFileName to thePOSIXFileName & ".pdf"
set terminalCommand to convertCommand & "-f " & "\"" & thePOSIXFileName & "\"" & " -o " & "\"" & newFileName & "\"" & " -j \"application/pdf\""
do shell script terminalCommand
end try
end processFile
(*
Copyright 2003 Apple Computer, Inc.
You may incorporate this Apple sample code into your program(s) without
restriction. This Apple sample code has been provided "AS IS" and the
responsibility for its operation is yours. You are not permitted to
redistribute this Apple sample code as "Apple sample code" after having
made changes. If you're going to redistribute the code, we require
that you make it clear that the code was descended from Apple sample
code, but that you've made changes.
*)
property type_list : {"JPEG", "GIFf", "PICT", "TIFF", "PDF", "TEXT"}
property extension_list : {"jpg", "gif", "pct", "tif", "pdf", "rtf"}
--html is not currently handled
on run {}
tell application "Finder" to set FinderSelection to the selection as alias list
set FS to FinderSelection
--Ideally, this list could be passed to the open handler
set SelectionCount to number of FS -- count
if SelectionCount is 0 then
set FS to userPicksFolder()
else if the SelectionCount is 1 then
set MyPath to path to me
if MyPath is item 1 of FS then
--If I'm a droplet then I was double-clicked
set FS to userPicksFolder()
end if
else
--I'm not a double-clicked droplet
end if
open FS
end run
on userPicksFolder()
set these_items to {}
set these_items to (choose file with prompt "Select a file to convert to PostScript:" of type {"JPEG", "GIFf", "PICT", "TIFF", "TEXT", "RTF"}) as list
end userPicksFolder
on open these_items
set thesefiles to {}
set the item_info to {}
repeat with i from 1 to the count of these_items
set this_item to (item i of these_items)
set the item_info to info for this_item
if folder of the item_info is true then --if the item is a folder
processFolder(this_item)
else if ((folder of the item_info is false) and (alias of the item_info is false)) and (the file type of the item_info is in the type_list) or ((the name extension of the item_info) is in the extension_list) then
set theFilePath to (item i of these_items as string)
set thePOSIXFilePath to POSIX path of theFilePath as string
processFile(thePOSIXFilePath)
end if
end repeat
end open
--process folders
on processFolder(theFolder)
set these_items to list folder theFolder without invisibles
repeat with i from 1 to the count of these_items
set this_item to alias ((theFolder as text) & (item i of these_items))
set the item_info to info for this_item
if folder of the item_info is true then
processFolder(this_item)
else if (alias of the item_info is false) and ((the file type of the item_info is in the type_list) or the name extension of the item_info is in the extension_list) then
set theFilePath to (this_item as string)
set thePOSIXFilePath to POSIX path of theFilePath as string
processFile(thePOSIXFilePath)
end if
end repeat
end processFolder
--need to pass the URL to Terminal
on processFile(thePOSIXFileName)
try
set terminalCommand to ""
set convertCommand to "/System/Library/Printers/Libraries/./convert "
set newFileName to thePOSIXFileName & ".ps"
set terminalCommand to convertCommand & "-f " & "\"" & thePOSIXFileName & "\"" & " -o " & "\"" & newFileName & "\"" & " -j \"application/postscript\""
do shell script terminalCommand
end try
end processFile
(*
Count Messages in All Mailboxes
Copyright 2002-2012 Apple Inc. All rights reserved.
You may incorporate this Apple sample code into your program(s) without
restriction. This Apple sample code has been provided "AS IS" and the
responsibility for its operation is yours. You are not permitted to
redistribute this Apple sample code as "Apple sample code" after having
made changes. If you're going to redistribute the code, we require
that you make it clear that the code was descended from Apple sample
code, but that you've made changes.
*)
(*
This script goes through each mailbox, gets the total message count and
the unread count, then displays the final output in a new email message.
*)
tell application "Mail"
set localMailboxes to every mailbox
if (count of localMailboxes) is greater than 0 then
set messageCountDisplay to "Local mailboxes (On My Mac)" & return & my getMessageCountsForMailboxes(localMailboxes)
else
set messageCountDisplay to ""
end if
set everyAccount to every account
repeat with eachAccount in everyAccount
set accountMailboxes to every mailbox of eachAccount
if (count of accountMailboxes) is greater than 0 then
set messageCountDisplay to messageCountDisplay & return & "Mailboxes for Account: " & name of eachAccount & return & my getMessageCountsForMailboxes(accountMailboxes)
end if
end repeat
set outputMessage to make new outgoing message with properties {content:messageCountDisplay, subject:"Message counts for all my mailboxes", visible:true}
tell outputMessage
set font to "Courier"
set size to 12
end tell
end tell
on getMessageCountsForMailboxes(theMailboxes)
-- (list of mailboxes)
-- returns string
set displayString to ""
tell application "Mail"
repeat with eachMailbox in theMailboxes
set mailboxName to name of eachMailbox
set messageCount to (count of (messages of eachMailbox)) as string
set unreadCount to unread count of eachMailbox as string
set displayString to displayString & " " & my padString(mailboxName, 40) & " " & messageCount & " (" & unreadCount & " unread)" & return
end repeat
end tell
return displayString
end getMessageCountsForMailboxes
on padString(theString, fieldLength)
-- (string, integer)
-- returns string
set stringLength to length of theString
if stringLength is greater than fieldLength then
set paddedString to (text from character 1 to character (fieldLength - 3) of theString) & "..."
else -- stringLength is less than or equal to fieldLength
set paddedString to theString
set paddingLength to fieldLength - stringLength
repeat paddingLength times
set paddedString to paddedString & space
end repeat
end if
return paddedString
end padString
\ No newline at end of file
(*
Crazy Message Text
Copyright 2002-2012 Apple Inc. All rights reserved.
You may incorporate this Apple sample code into your program(s) without
restriction. This Apple sample code has been provided "AS IS" and the
responsibility for its operation is yours. You are not permitted to
redistribute this Apple sample code as "Apple sample code" after having
made changes. If you're going to redistribute the code, we require
that you make it clear that the code was descended from Apple sample
code, but that you've made changes.
*)
(*
This script takes a string from the user and then makes a new message
where each letter has a different font, size, and color.
*)
property lowFontSize : 36
property highFontSize : 72
property messageText : "Happy Birthday!"
repeat
set userInput to display dialog "Enter some message text:" & return & return & "Minimum Character Size: " & (lowFontSize as string) & return & "Maximum Character Size: " & (highFontSize as string) default answer messageText buttons {"Cancel", "Set Prefs", "Continue"} default button 3
if the button returned of userInput is "Set Prefs" then
set minimumFontSize to 9
display dialog "Enter the minimum font size to use:" & return & return & "(Must be at least " & (minimumFontSize as string) & ")" default answer lowFontSize buttons {"OK"}
set newFontSize to text returned of the result as integer
if newFontSize is greater than or equal to minimumFontSize then
set lowFontSize to newFontSize
else
set lowFontSize to minimumFontSize
end if
display dialog "Enter the maximum font size to use:" & return & return & "(Must be greater than " & (lowFontSize as string) & ")" default answer highFontSize buttons {"OK"}
set newFontSize to text returned of the result as integer
if newFontSize is greater than lowFontSize then
set highFontSize to newFontSize
else
set highFontSize to lowFontSize
end if
else -- button returned of userInput is "Continue"
set theText to text returned of userInput
if theText is not "" then
set messageText to theText
end if
exit repeat
end if
end repeat
set fontList to {"American Typewriter", "American Typewriter Light", "American Typewriter Bold", "American Typewriter Condensed", "American Typewriter Condensed Light", "American Typewriter Condensed Bold", "Arial", "Arial Italic", "Arial Bold", "Arial Bold Italic", "Arial Black", "Baskerville", "Baskerville Italic", "Baskerville SemiBold", "Baskerville Bold", "Baskerville SemiBold Italic", "Baskerville Bold Italic", "Big Caslon Medium", "Comic Sans MS", "Comic Sans MS Bold", "Copperplate", "Copperplate Light", "Copperplate Bold", "Didot", "Didot Italic", "Didot Bold", "Futura Medium", "Futura Medium Italic", "Futura Condensed Medium", "Futura Condensed ExtraBold", "Geneva", "Gill Sans", "Gill Sans Italic", "Gill Sans Light", "Gill Sans Light Italic", "Gill Sans Bold", "Gill Sans Bold Italic", "Herculanum", "Lucida Grande", "Lucida Grande Bold", "Marker Felt Thin", "Marker Felt Wide", "Optima Regular", "Optima Italic", "Optima Bold", "Optima Bold Italic", "Optima ExtraBlack", "Papyrus", "Verdana", "Verdana Italic", "Verdana Bold", "Verdana Bold Italic", "Zapfino"}
tell application "Mail"
activate
set crazyTextMessage to make new outgoing message with properties {content:messageText, visible:true}
tell crazyTextMessage
repeat with eachCharacter in characters
set font of eachCharacter to (some item of fontList)
set size of eachCharacter to (random number from lowFontSize to highFontSize)
set color of eachCharacter to {random number from 0 to 65535, random number from 0 to 65535, random number from 0 to 65535}
end repeat
end tell
end tell
\ No newline at end of file
(*
Get User Name
This script uses UI element scripting to get the name for the
current user.
If "Enable access for assistive devices" is not checked,
this script will open the Universal Access System Preference and ask
the user to check the checkbox.
Copyright 2007 Apple Inc.
You may incorporate this Apple sample code into your program(s) without
restriction. This Apple sample code has been provided "AS IS" and the
responsibility for its operation is yours. You are not permitted to
redistribute this Apple sample code as "Apple sample code" after having
made changes. If you're going to redistribute the code, we require
that you make it clear that the code was descended from Apple sample
code, but that you've made changes.
*)
tell application "System Preferences"
activate
set current pane to pane "com.apple.preferences.users"
end tell
tell application "System Events"
if UI elements enabled then
tell tab group 1 of window "Accounts" of process "System Preferences"
click radio button 1
delay 2
get value of text field 1
end tell
else
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.universalaccess"
display dialog "UI element scripting is not enabled. Check \"Enable access for assistive devices\""
end tell
end if
end tell
\ No newline at end of file
(*
Speaks the date and time of day
Copyright 2008 Apple Inc. All rights reserved.
You may incorporate this Apple sample code into your program(s) without
restriction. This Apple sample code has been provided "AS IS" and the
responsibility for its operation is yours. You are not permitted to
redistribute this Apple sample code as "Apple sample code" after having
made changes. If you're going to redistribute the code, we require
that you make it clear that the code was descended from Apple sample
code, but that you've made changes.
*)
on isVoiceOverRunning()
set isRunning to false
tell application "System Events"
set isRunning to (name of processes) contains "VoiceOver"
end tell
return isRunning
end isVoiceOverRunning
on isVoiceOverRunningWithAppleScript()
if isVoiceOverRunning() then
set isRunningWithAppleScript to true
-- is AppleScript enabled on VoiceOver --
tell application "VoiceOver"
try
set x to bounds of vo cursor
on error
set isRunningWithAppleScript to false
end try
end tell
return isRunningWithAppleScript
end if
return false
end isVoiceOverRunningWithAppleScript
set currentDate to current date
set amPM to "AM"
set currentHour to (currentDate's hours)
set currentMinutes to currentDate's minutes
if (currentHour > 12 and currentHour < 24) then
set amPM to "PM"
else
set amPM to "AM"
end if
-- make minutes below 10 sound nice
if currentMinutes < 10 then
set currentMinutes to ("0" & currentMinutes) as text
end if
-- ensure 0:nn gets set to 12:nn AM
if currentHour is equal to 0 then
set currentHour to 12
end if
-- readjust for 12 hour time
if (currentHour > 12) then
set currentHour to (currentHour - 12)
end if
set currentTime to ((currentDate's month) as text) & " " & ((currentDate's day) as text) & ", " & (currentHour as text) & ":" & ((currentMinutes) as text) & " " & amPM as text
if isVoiceOverRunningWithAppleScript() then
tell application "VoiceOver"
output currentTime
end tell
else
say currentTime
delay 2
end if
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment