当前位置: 首页>>代码示例>>PHP>>正文


PHP ZendX_JQuery_View_Helper_JQuery::getNoConflictMode方法代码示例

本文整理汇总了PHP中ZendX_JQuery_View_Helper_JQuery::getNoConflictMode方法的典型用法代码示例。如果您正苦于以下问题:PHP ZendX_JQuery_View_Helper_JQuery::getNoConflictMode方法的具体用法?PHP ZendX_JQuery_View_Helper_JQuery::getNoConflictMode怎么用?PHP ZendX_JQuery_View_Helper_JQuery::getNoConflictMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ZendX_JQuery_View_Helper_JQuery的用法示例。


在下文中一共展示了ZendX_JQuery_View_Helper_JQuery::getNoConflictMode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ajaxLink

 /**
  * Create an anchor that enables ajax-based requests and handling of the response.
  *
  * This helper creates links that make XmlHttpRequests to the server. It allows to
  * inject the response into the DOM. Fancy effects going with the links can be enabled
  * via simple callback shortnames. The functionality is mostly controlled by the $options
  * array:
  *
  * $options
  *  Key				Behaviour
  *  =================================================================================
  *  'update'        Update a container with the content fetched from $url
  *  'method'        Explicit Requesting method mimicing the jQuery functionality: GET, POST
  *  'inline'        True or false, wheater to inline the javascript in onClick=""
  * 					atttribute or append it to jQuery onLoad Stack.
  *  'complete'      String specifies javascript called after successful request or a
  * 					shortname of a jQuery effect that should be applied to the 'update' element.
  *  'beforeSend'	String specifies javascript called before the request is sent, or a
  * 					shortname of a jQuery effect that should be applied to the link clicked.
  *  'noscript'		True/false, include a noscript variant that directly requests
  * 					the given $url (make sure to check $request->isXmlHttpRequest())
  *  'dataType'		What type of data is the response returning? text, html, json?
  *  'title'			HTML Attribute title of the Anchor
  *  'class'			HTML Attribute class of the Anchor
  *  'id'			HTML Attribute id of the Anchor
  *  'attribs'		Array of Key-Value pairs with HTML Attribute names and their content.
  *
  * BeforeSend Callback:
  * Can include shortcuts as a string assignment to fire of effects before sending of request.
  * Possible shortcuts are 'fadeOut', 'fadeOutSlow', 'hide', 'hideSlow', 'slideUp', 'flash',
  * @example $options = array('beforeSend' => 'hideSlow', 'complete' => 'show');
  *
  * @link   http://docs.jquery.com/Ajax
  * @param  String $label Urls Title
  * @param  String $url Link to Point to
  * @param  Array $options
  * @param  Array $params Key Value Pairs of GET/POST Parameters
  * @return String
  */
 public function ajaxLink($label, $url, $options = null, $params = null)
 {
     $jquery = $this->view->jQuery();
     $jquery->enable();
     $jqHandler = ZendX_JQuery_View_Helper_JQuery::getNoConflictMode() == true ? '$j' : '$';
     $attribs = array();
     if (isset($options['attribs']) && is_array($options['attribs'])) {
         $attribs = $options['attribs'];
     }
     //
     // The next following 4 conditions check for html attributes that the link might need
     //
     if (empty($options['noscript']) || $options['noscript'] == false) {
         $attribs['href'] = "#";
     } else {
         $attribs['href'] = $url;
     }
     if (!empty($options['title'])) {
         $attribs['title'] = $options['title'];
     }
     // class value is an array because the jQuery CSS selector
     // click event needs its own classname later on
     if (!isset($attribs['class'])) {
         $attribs['class'] = array();
     } elseif (is_string($attribs['class'])) {
         $attribs['class'] = explode(" ", $attribs['class']);
     }
     if (!empty($options['class'])) {
         $attribs['class'][] = $options['class'];
     }
     if (!empty($options['id'])) {
         $attribs['id'] = $options['id'];
     }
     //
     // Execute Javascript inline?
     //
     $inline = false;
     if (!empty($options['inline']) && $options['inline'] == true) {
         $inline = true;
     }
     //
     // Detect the callbacks:
     // Just those two callbacks, beforeSend and complete can be defined for the $.get and $.post options.
     // Pick all the defined callbacks and put them on their respective stacks.
     //
     $callbacks = array('beforeSend' => null, 'complete' => null);
     if (isset($options['beforeSend'])) {
         $callbacks['beforeSend'] = $options['beforeSend'];
     }
     if (isset($options['complete'])) {
         $callbacks['complete'] = $options['complete'];
     }
     $updateContainer = false;
     if (!empty($options['update']) && is_string($options['update'])) {
         $updateContainer = $options['update'];
         // Additionally check if there is a callback complete that is a shortcut to be executed
         // on the specified update container
         if (!empty($callbacks['complete'])) {
             switch (strtolower($callbacks['complete'])) {
                 case 'show':
                     $callbacks['complete'] = sprintf('%s("%s").show();', $jqHandler, $updateContainer);
//.........这里部分代码省略.........
开发者ID:be-dmitry,项目名称:zf1,代码行数:101,代码来源:AjaxLink.php

示例2: testNoConflictShouldBeDisabledDefault

 public function testNoConflictShouldBeDisabledDefault()
 {
     $this->assertFalse(ZendX_JQuery_View_Helper_JQuery::getNoConflictMode());
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:4,代码来源:jQueryTest.php

示例3: _renderExtras

 /**
  * Renders all javascript code related stuff of the jQuery enviroment.
  *
  * @return string
  */
 protected function _renderExtras()
 {
     $onLoadActions = array();
     if (($this->getRenderMode() & ZendX_JQuery::RENDER_JQUERY_ON_LOAD) > 0) {
         foreach ($this->getOnLoadActions() as $callback) {
             $onLoadActions[] = $callback;
         }
     }
     $javascript = '';
     if (($this->getRenderMode() & ZendX_JQuery::RENDER_JAVASCRIPT) > 0) {
         $javascript = implode("\n    ", $this->getJavascript());
     }
     $content = '';
     if (!empty($onLoadActions)) {
         if (ZendX_JQuery_View_Helper_JQuery::getNoConflictMode() == true) {
             $content .= '$j(document).ready(function() {' . "\n    ";
         } else {
             $content .= '$(document).ready(function() {' . "\n    ";
         }
         $content .= implode("\n    ", $onLoadActions) . "\n";
         $content .= '});' . "\n";
     }
     if (!empty($javascript)) {
         $content .= $javascript . "\n";
     }
     if (preg_match('/^\\s*$/s', $content)) {
         return '';
     }
     $html = '<script type="text/javascript">' . PHP_EOL . ($this->_isXhtml ? '//<![CDATA[' : '//<!--') . PHP_EOL . $content . ($this->_isXhtml ? '//]]>' : '//-->') . PHP_EOL . PHP_EOL . '</script>';
     return $html;
 }
开发者ID:Zerone,项目名称:ImJob.org,代码行数:36,代码来源:Container.php

示例4: testOptionsArePassedOn

 public function testOptionsArePassedOn()
 {
     $options = array('noconflictmode' => true, 'version' => '1.2.3', 'localpath' => '/foo/bar/', 'ui_version' => '2.3.4', 'uilocalpath' => '/bar/foo/', 'cdn_ssl' => true, 'rendermode' => 192, 'javascriptfile' => '/fooBar.js', 'javascriptfiles' => array('johndoe.js', 'janedoe.js'), 'stylesheet' => '/fooBar.css', 'stylesheets' => array('johndoe.css', 'janedoe.css'));
     $this->bootstrap->registerPluginResource('view');
     $resource = new ZendX_Application_Resource_Jquery(array());
     $resource->setBootstrap($this->bootstrap);
     $resource->setOptions($options);
     $res = $resource->init();
     $this->assertTrue(ZendX_JQuery_View_Helper_JQuery::getNoConflictMode());
     $this->assertEquals('1.2.3', $res->getVersion());
     $this->assertEquals('/foo/bar/', $res->getLocalPath());
     $this->assertEquals('2.3.4', $res->getUiVersion());
     $this->assertEquals('/bar/foo/', $res->getUiLocalPath());
     $this->assertTrue($res->getCdnSsl());
     $this->assertEquals(192, $res->getRenderMode());
     $this->assertEquals(array('/fooBar.css', 'johndoe.css', 'janedoe.css'), $res->getStylesheets());
     $this->assertEquals(array('/fooBar.js', 'johndoe.js', 'janedoe.js'), $res->getJavascriptFiles());
 }
开发者ID:ThorstenSuckow,项目名称:conjoon,代码行数:18,代码来源:JqueryTest.php


注:本文中的ZendX_JQuery_View_Helper_JQuery::getNoConflictMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。