wordpress forse css styles version

Sometime css files version need to be set so update to be forced on all users which are visiting the site

This can be done very easy in wordpress just need to add those lines in function.php of the theme

function my_wp_default_styles($styles)
{
	//use release date for version
	$styles->default_version = "20160714";
}
add_action("wp_default_styles", "my_wp_default_styles");
С етикет: , , , ,
Публикувано в wordpress

Redirect all php files to wordpress posts or strip .php extension

If you need to redirect your old urls which are like

alabala.com/see-this-post.php to alabala.com/see-this-post/

You can use this simple .htaccess redirect

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)\.php$ /$1/ [l,R=301,NC]

С етикет: , , ,
Публикувано в wordpress

wordpress strange redirect

WordPress is using lowercase in all urls but when someone types the url in the address bar then browser uses uppercase to encode url

Uppercase is different from lowercase and wordpress can’t match url

So solution is very simply

This fragment need to be pasted in functions.php

function unFocus_insensitivity() {
    if (preg_match('/[A-ZА-Я]/', $_SERVER['REQUEST_URI'])) {
        $_SERVER['REQUEST_URI'] = strtolower($_SERVER['REQUEST_URI']);
        $_SERVER['PATH_INFO']   = strtolower($_SERVER['PATH_INFO']);
    }
}
add_action('init', 'unFocus_insensitivity');

Code is working for Latin and Cyrillic letters

С етикет: , , , ,
Публикувано в wordpress

cisco 7961 as standalone phone connected to astersik

This is working example for configuration of cisco 7961

You need to change sip server form 192.168.0.1 to your one

Also authPassword and authName, displayName

To work this config you need to enable tcp on your asterisk box and allow this extension to connect with tcp too and disable nat

in sip_custom.conf you should have something like this

tcpenable=yes
tcpbindaddr=0.0.0.0
callcounter=yes
transport=udp, tcp

Proxy should be <proxy>USECALLMANAGER</proxy> you don’t need to change with your sip server ip/name it’s working when is set like this

This is content of the config file SEPXXXXXXXXXXXX.cnf

<device>
<fullConfig>true</fullConfig>
<deviceProtocol>SIP</deviceProtocol>
<sshUserId>cisco</sshUserId>
<sshPassword>cisco</sshPassword>
<devicePool>
<name></name>
<dateTimeSetting>
<dateTemplate>D-M-Y </dateTemplate>
<timeZone>W. Europe Standard/Daylight Time</timeZone>
<ntps>
<ntp>
<name>pool.ntp.org</name>
<ntpMode>Unicast</ntpMode>
</ntp>
</ntps>
</dateTimeSetting>
<callManagerGroup>
<name>5.0 Beta</name>
<tftpDefault>true</tftpDefault>
<members>
<member priority=“0″>
<callManager>
<name>ccm-beta-5-1</name>
<description>CallManager 5.0 Beta Pub – 5.0.1.032</description>
<ports>
<ethernetPhonePort>2000</ethernetPhonePort>
<sipPort>5060</sipPort>
<securedSipPort>5061</securedSipPort>
<mgcpPorts>
<listen>2427</listen>
<keepAlive>2428</keepAlive>
</mgcpPorts>
</ports>
<processNodeName>192.168.0.1</processNodeName>
</callManager>
</member>
</members>
</callManagerGroup>
<srstInfo>
<name>Disable</name>
<srstOption>Disable</srstOption>
<userModifiable>false</userModifiable>
<ipAddr1></ipAddr1>
<port1>2000</port1>
<ipAddr2></ipAddr2>
<port2>2000</port2>
<ipAddr3></ipAddr3>
<port3>2000</port3>
<sipIpAddr1>192.168.0.1</sipIpAddr1>
<sipPort1>5060</sipPort1>
<sipIpAddr2>192.168.0.1</sipIpAddr2>
<sipPort2>5060</sipPort2>
<sipIpAddr3></sipIpAddr3>
<sipPort3>5060</sipPort3>
<isSecure>false</isSecure>
</srstInfo>
<mlppDomainId>-1</mlppDomainId>
<mlppIndicationStatus>Default</mlppIndicationStatus>
Default
<connectionMonitorDuration>120</connectionMonitorDuration>
</devicePool>
<sipProfile>
<sipProxies>
<backupProxy>192.168.0.1</backupProxy>
<backupProxyPort>5060</backupProxyPort>
<emergencyProxy>192.168.0.1</emergencyProxy>
<emergencyProxyPort>5060</emergencyProxyPort>
<outboundProxy></outboundProxy>
<outboundProxyPort>5060</outboundProxyPort>
<registerWithProxy>true</registerWithProxy>
</sipProxies>
<sipCallFeatures>
<cnfJoinEnabled>true</cnfJoinEnabled>
<callForwardURI>x-cisco-serviceuri-cfwdall</callForwardURI>
<callPickupURI>x-cisco-serviceuri-pickup</callPickupURI>
<callPickupListURI>x-cisco-serviceuri-opickup</callPickupListURI>
<callPickupGroupURI>x-cisco-serviceuri-gpickup</callPickupGroupURI>
<meetMeServiceURI>x-cisco-serviceuri-meetme</meetMeServiceURI>
<abbreviatedDialURI>x-cisco-serviceuri-abbrdial</abbreviatedDialURI>
<rfc2543Hold>false</rfc2543Hold>
<callHoldRingback>2</callHoldRingback>
<localCfwdEnable>true</localCfwdEnable>
<semiAttendedTransfer>true</semiAttendedTransfer>
<anonymousCallBlock>2</anonymousCallBlock>
<callerIdBlocking>2</callerIdBlocking>
<dndControl>1</dndControl>
<remoteCcEnable>true</remoteCcEnable>
</sipCallFeatures>
<sipStack>
<sipInviteRetx>6</sipInviteRetx>
<sipRetx>10</sipRetx>
<timerInviteExpires>180</timerInviteExpires>
<timerRegisterExpires>3600</timerRegisterExpires>
<timerRegisterDelta>5</timerRegisterDelta>
<timerKeepAliveExpires>120</timerKeepAliveExpires>
<timerSubscribeExpires>120</timerSubscribeExpires>
<timerSubscribeDelta>5</timerSubscribeDelta>
<timerT1>500</timerT1>
<timerT2>4000</timerT2>
<maxRedirects>70</maxRedirects>
<remotePartyID>true</remotePartyID>
<userInfo>None</userInfo>
</sipStack>
<autoAnswerTimer>1</autoAnswerTimer>
<autoAnswerAltBehavior>false</autoAnswerAltBehavior>
<autoAnswerOverride>true</autoAnswerOverride>
<transferOnhookEnabled>false</transferOnhookEnabled>
<enableVad>false</enableVad>
g711ulaw
<dtmfAvtPayload>101</dtmfAvtPayload>
<dtmfDbLevel>3</dtmfDbLevel>
<dtmfOutofBand>avt</dtmfOutofBand>
<alwaysUsePrimeLine>false</alwaysUsePrimeLine>
<alwaysUsePrimeLineVoiceMail>false</alwaysUsePrimeLineVoiceMail>
<kpml>3</kpml>
<phoneLabel>Phone Label</phoneLabel>
<stutterMsgWaiting>2</stutterMsgWaiting>
<callStats>false</callStats>
<offhookToFirstDigitTimer>15000</offhookToFirstDigitTimer>
<silentPeriodBetweenCallWaitingBursts>10</silentPeriodBetweenCallWaitingBursts>
<disableLocalSpeedDialConfig>false</disableLocalSpeedDialConfig>
<startMediaPort>16384</startMediaPort>
<stopMediaPort>32766</stopMediaPort>
<sipLines>
<line button=“1″>
<featureID>9</featureID>
<featureLabel>104</featureLabel>
<proxy>USECALLMANAGER</proxy>
<port>5060</port>
<name>104</name>
<displayName>104</displayName>
<autoAnswer>
<autoAnswerEnabled>2</autoAnswerEnabled>
</autoAnswer>
<callWaiting>3</callWaiting>
<authName>104</authName>
<authPassword>password</authPassword>
<sharedLine>false</sharedLine>
<messageWaitingLampPolicy>1</messageWaitingLampPolicy>
<messagesNumber>*97</messagesNumber>
<ringSettingIdle>4</ringSettingIdle>
<ringSettingActive>5</ringSettingActive>
<contact>104</contact>
<forwardCallInfoDisplay>
<callerName>true</callerName>
<callerNumber>false</callerNumber>
<redirectedNumber>false</redirectedNumber>
<dialedNumber>true</dialedNumber>
</forwardCallInfoDisplay>
</line>
</sipLines>
<voipControlPort>5060</voipControlPort>
<dscpForAudio>184</dscpForAudio>
<ringSettingBusyStationPolicy>0</ringSettingBusyStationPolicy>
<dialTemplate>dialplan.xml</dialTemplate>
<softKeyFile></softKeyFile>
</sipProfile>
<commonProfile>
<phonePassword></phonePassword>
<backgroundImageAccess>true</backgroundImageAccess>
<callLogBlfEnabled>2</callLogBlfEnabled>
</commonProfile>
<vendorConfig>
<disableSpeaker>false</disableSpeaker>
<disableSpeakerAndHeadset>false</disableSpeakerAndHeadset>
<pcPort>0</pcPort>
<settingsAccess>1</settingsAccess>
<garp>0</garp>
<voiceVlanAccess>0</voiceVlanAccess>
<videoCapability>0</videoCapability>
<autoSelectLineEnable>0</autoSelectLineEnable>
<webAccess>0</webAccess>
<daysDisplayNotActive>1,7</daysDisplayNotActive>
<displayOnTime>08:00</displayOnTime>
<displayOnDuration>10:30</displayOnDuration>
<displayIdleTimeout>01:00</displayIdleTimeout>
<spanToPCPort>1</spanToPCPort>
</vendorConfig>
<versionStamp></versionStamp>
<userLocale>
<name></name>
<uid></uid>
<langCode>en_US</langCode>
<version></version>
<winCharSet></winCharSet>
</userLocale>
<networkLocale></networkLocale>
<networkLocaleInfo>
<name></name>
<uid></uid>
<version>1.0.0.0-1</version>
</networkLocaleInfo>
<deviceSecurityMode>1</deviceSecurityMode>
<idleTimeout>0</idleTimeout>
<authenticationURL></authenticationURL>
<directoryURL></directoryURL>
<idleURL></idleURL>
<informationURL></informationURL>
<messagesURL></messagesURL>
<proxyServerURL></proxyServerURL>
<servicesURL>http://192.168.0.1/directory/directory.xml</servicesURL>
<dscpForSCCPPhoneConfig>96</dscpForSCCPPhoneConfig>
<dscpForSCCPPhoneServices>0</dscpForSCCPPhoneServices>
<dscpForCm2Dvce>96</dscpForCm2Dvce>
<transportLayerProtocol>4</transportLayerProtocol>
<capfAuthMode>0</capfAuthMode>
<capfList>
<capf>
<phonePort>3804</phonePort>
<processNodeName>ccm-beta-5-1</processNodeName>
</capf>
</capfList>
<certHash></certHash>
<encrConfig>false</encrConfig>
</device>

Публикувано в cisco, sip

most userful joomla function to debug database query

// Get a db connection.
$db = JFactory::getDbo();
 
// Create a new query object.
$query = $db->getQuery(true);
 
// Select all articles for users who have a username which starts with 'a'.
// Order it by the created date.
// Note by putting 'a' as a second parameter will generate `#__content` AS `a`
$query
    ->select($db->quoteName(array('a.*', 'b.username', 'b.name')))
    ->from($db->quoteName('#__content', 'a'))
    ->join('INNER', $db->quoteName('#__users', 'b') . ' ON (' . $db->quoteName('a.created_by') . ' = ' . $db->quoteName('b.id') . ')')
    ->where($db->quoteName('b.username') . ' LIKE \'a%\'')
    ->order($db->quoteName('a.created') . ' DESC');

// echo sql query so you can see it and debug it ;)
echo $db->replacePrefix( (string) $query );
 
// Reset the query using our newly populated query object.
$db->setQuery($query);

// Get array with information of the query
$rows = $db->loadAssocList();


С етикет: , , , , , ,
Публикувано в Joomla