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


PHP html::script_source方法代码示例

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


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

示例1: init

 /**
  * Initializes Facebook Connect
  */
 public static function init()
 {
     widget::add('foot', html::script(array('js/fbconnect.js', 'http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US')));
     widget::add('foot', html::script_source("FB.init('" . FB::$config['api_key'] . "');"));
     // Add logged in Facebook user id to session for easier access
     if ($logged_in = FB::instance()->get_loggedin_user()) {
         $_SESSION['fb_uid'] = $logged_in;
     }
 }
开发者ID:anqqa,项目名称:Anqh,代码行数:12,代码来源:FB.php

示例2: filters

Widget::add('footer', html::script_source('
function filters(all) {
	if (all) {

		// Open all
		$("form.filters input").each(function() {
			$("." + this.id + ":hidden").slideDown("normal");
		});

	} else {

		// Filter individually
		$("form.filters input").each(function() {
			if ($(this).is(":checked")) {
				$("." + this.id + ":hidden").slideDown("normal");
			} else {
				$("." + this.id + ":visible").slideUp("normal");
			}
		});

	}
}

head.ready("jquery-ui", function() {

	// Hook clicks
	$("form.filters :checkbox").click(function() {

		var checked = $(this).is(":checked");

		if ($(this).val() != "all") {

			// Individual filters
			if (checked) {

				// Uncheck "all"
				$("form.filters input[value=all]").attr("checked", false);

			}

			// Check "all" if no other filters
			if ($("form.filters input[value!=all]").is(":checked") == false) {
				$("form.filters input[value=all]").attr("checked", "checked");
				filters(true);
			} else {
				filters();
			}

		} else {

			// All filters
			if (!checked) {
				return false;
			}

			$("form.filters input[value!=all]").attr("checked", false);
			filters(checked);

		}

	});
});
'));
开发者ID:anqh,项目名称:core,代码行数:63,代码来源:filters.php

示例3: __

</dd>
				</dl>
				<?php 
}
?>
			</li>

			<?php 
if ($venue->latitude && $venue->longitude) {
    ?>
			<li class="grid-7 alpha omega map">
				<div id="map" style="display: none"><?php 
    echo __('Map loading');
    ?>
</div>
				<?php 
    $map = new Gmap('map', array('ScrollWheelZoom' => true));
    $map->center($venue->latitude, $venue->longitude, 15)->controls('small')->types();
    $map->add_marker($venue->latitude, $venue->longitude, '<strong>' . html::specialchars($venue->name) . '</strong><p>' . html::specialchars($venue->address) . '<br />' . html::specialchars($venue->zip) . ' ' . html::specialchars($venue->city_name) . '</p>');
    widget::add('foot', html::script_source($map->render('gmaps/jquery_event')));
    widget::add('foot', html::script_source("\$('.contact a:first').click(function() { \$('#map').toggle('normal', gmap_open); return false; });"));
    ?>
			</li>
			<?php 
}
?>

		</ul>
	</div>
</section>
开发者ID:anqqa,项目名称:Anqh,代码行数:30,代码来源:venue.php

示例4: array

				<?php 
    echo Form::checkbox('filter[]', 'all', true, array('id' => 'all-' . $type));
    ?>
				<?php 
    echo Form::label('all-' . $type, __('All'));
    ?>
			</li>
			<?php 
    foreach ($filter['filters'] as $key => $name) {
        ?>
			<li>
				<?php 
        echo Form::checkbox('filter[]', $type . '-' . $key, false, array('id' => $type . '-' . $key));
        ?>
				<?php 
        echo Form::label($type . '-' . $key, $name);
        ?>
			</li>
			<?php 
    }
    ?>
		</ul>
	</fieldset>
	<?php 
}
?>

<?php 
echo form::close();
Widget::add('footer', html::script_source("\nfunction filters(all) {\n\tif (all) {\n\n\t\t// Open all\n\t\t\$('form.filters input').each(function() {\n\t\t\t\$('.' + this.id + ':hidden').slideDown('normal');\n\t\t});\n\n\t} else {\n\n\t\t// Filter individually\n\t\t\$('form.filters input').each(function() {\n\t\t\tif (\$(this).is(':checked')) {\n\t\t\t\t\$('.' + this.id + ':hidden').slideDown('normal');\n\t\t\t} else {\n\t\t\t\t\$('.' + this.id + ':visible').slideUp('normal');\n\t\t\t}\n\t\t});\n\n\t}\n}\n\n\$(function() {\n\n\t// Hook clicks\n\t\$('form.filters :checkbox').click(function() {\n\n\t\tvar checked = \$(this).is(':checked');\n\n\t\tif (\$(this).val() != 'all') {\n\n\t\t\t// Individual filters\n\t\t\tif (checked) {\n\n\t\t\t\t// Uncheck 'all'\n\t\t\t\t\$('form.filters input[value=\"all\"]').attr('checked', false);\n\n\t\t\t}\n\n\t\t\t// Check 'all' if no other filters\n\t\t\tif (\$('form.filters input[value!=\"all\"]').is(':checked') == false) {\n\t\t\t\t\$('form.filters input[value=\"all\"]').attr('checked', 'checked');\n\t\t\t\tfilters(true);\n\t\t\t} else {\n\t\t\t\tfilters();\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// All filters\n\t\t\tif (!checked) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t\$('form.filters input[value!=\"all\"]').attr('checked', false);\n\t\t\tfilters(checked);\n\n\t\t}\n\n\t});\n});\n"));
开发者ID:netbiel,项目名称:core,代码行数:30,代码来源:filters.php

示例5: _event_edit


//.........这里部分代码省略.........
     $form_values['start_date'] = '';
     $form_values['start_hour'] = '';
     $form_values['end_hour'] = '';
     /***** CHECK POST *****/
     if (request::method() == 'post') {
         $post = array_merge($this->input->post(), $_FILES);
         $extra = array('start_time' => date::unix2sql(strtotime($post['start_date'] . ' ' . date::time_24h($post['start_hour']))));
         if (!empty($post['end_hour'])) {
             $end_time = strtotime($post['start_date']);
             // end hour is earlier than start hour = event ends the next day
             if ($post['end_hour'] < $post['start_hour']) {
                 $end_time = strtotime('+1 day', $end_time);
             }
             $extra['end_time'] = date('Y-m-d', $end_time) . ' ' . date::time_24h($post['end_hour']) . ':00';
         }
         // update
         $editing = (bool) $event->id;
         if ($editing) {
             $extra['modified'] = date::unix2sql(time());
             $extra['modifies'] = (int) $event->modifies + 1;
         } else {
             $extra['author_id'] = $this->user->id;
         }
         $city = ORM::factory('city', $post['city_id']);
         if ($city) {
             $extra['country_id'] = $city->country_id;
         }
         if (csrf::valid() && $event->validate($post, true, $extra)) {
             // Update tags
             $event->remove(ORM::factory('tag'));
             if (!empty($post['tags'])) {
                 foreach ($post['tags'] as $tag_id => $tag) {
                     $event->add(ORM::factory('tag', $tag_id));
                 }
                 $event->save();
             }
             // Handle flyer uploads
             foreach (array('flyer_front_image_id' => $post->flyer_front, 'flyer_back_image_id' => $post->flyer_back) as $image_id => $flyer) {
                 if (isset($flyer) && empty($flyer['error'])) {
                     $image = Image_Model::factory('events.flyer', $flyer, $this->user->id);
                     if ($image->id) {
                         $event->add($image);
                         $event->{$image_id} = $image->id;
                         $event->save();
                     }
                 }
             }
             if (!$editing) {
                 newsfeeditem_events::event($this->user, $event);
             }
             url::redirect(url::model($event));
         } else {
             $form_errors = $post->errors();
         }
         $form_values = arr::overwrite($form_values, $post->as_array());
     }
     /***** /CHECK POST *****/
     /***** SHOW FORM *****/
     if ($event->id) {
         $this->page_actions[] = array('link' => url::model($event) . '/delete/?token=' . csrf::token(), 'text' => __('Delete event'), 'class' => 'event-delete');
         $this->page_title = text::title($event->name);
         $this->page_subtitle = __('Edit event');
         list($form_values['start_date'], $form_values['start_hour']) = explode(' ', date('Y-m-d H', strtotime($event->start_time)));
         if (!empty($event->end_time)) {
             list($temp, $form_values['end_hour']) = explode(' ', date('Y-m-d H', strtotime($event->end_time)));
         }
     } else {
         $this->page_title = __('New event');
     }
     $form = $event->get_form();
     // Tags
     if ($tag_group = Kohana::config('events.tag_group')) {
         $form['tags'] = $form_values['tags'] = array();
         $tags = ORM::factory('tag_group', $tag_group);
         foreach ($tags->tags as $tag) {
             $form['tags'][$tag->id] = $tag->name;
             if ($event->has($tag)) {
                 $form_values['tags'][$tag->id] = $tag->name;
             }
         }
     }
     // City autocomplete
     $this->_autocomplete_city('city_name');
     // Venue autocomplete
     $venues = ORM::factory('venue')->where('event_host', '=', 1)->find_all();
     $hosts = array();
     foreach ($venues as $venue) {
         $hosts[] = "{ id: '" . $venue->id . "', text: '" . html::chars($venue->name) . "' }";
     }
     widget::add('foot', html::script_source('var venues = [' . implode(', ', $hosts) . "];\n\$('input[name=venue_name]').autocomplete(venues, {\n\tformatItem: function(item) {\n\t\treturn item.text;\n\t}\n}).result(function(event, item) {\n\t\$('input[name=venue_id]').val(item.id);\n});"));
     // Date pickers
     widget::add('foot', html::script_source("\$('input#start_date').datepicker({ dateFormat: 'd.m.yy', firstDay: 1, changeFirstDay: false, showOtherMonths: true, showWeeks: true, showStatus: true, showOn: 'both' });"));
     if (empty($errors)) {
         widget::add('main', View::factory('events/event_edit', array('form' => $form, 'values' => $form_values, 'errors' => $form_errors)));
     } else {
         //			$this->_error(Kohana::lang('generic.error'), $errors);
     }
     /***** /SHOW FORM *****/
     $this->_side_views();
 }
开发者ID:anqqa,项目名称:Anqh,代码行数:101,代码来源:events.php

示例6: foreach

<section id="<?php 
echo $id;
?>
" class="mod tabs">
	<ul>
		<?php 
$t = 0;
$selected = 0;
foreach ($tabs as $tab) {
    $selected = !empty($tab['selected']) ? $t : $selected;
    $t++;
    ?>
		<li><?php 
    echo html::anchor($tab['href'], $tab['title']);
    ?>
</li>
		<?php 
}
?>
	</ul>
	<?php 
foreach ($tabs as $tab) {
    echo $tab['tab'];
}
?>
</section>
<?php 
// Initialize tabs immediately to aviod ugly jumping
echo html::script_source('$("#' . $id . '").tabs({ selected: ' . $selected . ', collapsible: true, fx: { height: "toggle", opacity: "toggle", duration: "fast" } });');
//echo html::script_source('$("#' . $id . ' > ul").tabs("#' . $id . ' .tab", { initialIndex: ' . $selected . ', effect: "fade" });');
开发者ID:anqqa,项目名称:Anqh,代码行数:30,代码来源:tabs.php

示例7: array

			<?php 
    $names = array();
    foreach (explode(',', $image->description) as $name) {
        $names[] = html::user(trim($name));
    }
    ?>
		<footer>
			<?php 
    echo __('In picture: :users', array(':users' => implode(', ', $names)));
    ?>
		</footer>
		<?php 
}
?>
	</div>
</section>
<?php 
echo html::script_source('
	$(document).keyup(function(e) {
		var key = e.keyCode || e.which;
		if (e.target.type === undefined) {
			switch (key) {
				case 37: var link = $(".gallery-image a.prev").first().attr("href"); break;
				case 39: var link = $(".gallery-image a.next").first().attr("href"); break;
			}
			if (link) {
				window.location = link;
			}
		}
	});
');
开发者ID:anqqa,项目名称:Anqh,代码行数:31,代码来源:image.php

示例8: __

    ?>
		<li><?php 
    echo form::submit(false, __('Shout'));
    ?>
</li>
	</ul>
	<?php 
    echo form::csrf();
    ?>
</fieldset>
<?php 
    echo form::close();
    ?>

<?php 
    // AJAX hooks
    echo html::script_source('
$(function() {

	$("section.shout form").live("submit", function(e) {
		e.preventDefault();
		var shouts = $(this).closest("section.shout");
		$.post($(this).attr("action"), $(this).serialize(), function(data) {
			shouts.replaceWith(data);
		});
		return false;
	});

});
');
}
开发者ID:anqqa,项目名称:Anqh,代码行数:31,代码来源:shout.php

示例9: function

echo html::script_source('
$(function() {

	$("a.comment-delete").each(function(i) {
		var action = $(this);
		action.data("action", function() {
			var comment = action.attr("href").match(/([0-9]*)\\/delete/);
			if (comment) {
				$.get(action.attr("href"), function() {
					$("#comment-" + comment[1]).slideUp();
				});
			}
		});
	});

	$("a.comment-private").live("click", function(e) {
		e.preventDefault();
		var href = $(this).attr("href");
		var comment = href.match(/([0-9]*)\\/private/);
		$(this).fadeOut()
		if (comment) {
			$.get(href, function() {
				$("#comment-" + comment[1]).addClass("private");
			});
		}
		return false;
	});

	$("section.comments form").live("submit", function(e) {
		e.preventDefault();
		var comment = $(this).closest("section.comments");
		$.post($(this).attr("action"), $(this).serialize(), function(data) {
			comment.replaceWith(data);
		});
		return false;
	});

});
');
开发者ID:anqqa,项目名称:Anqh,代码行数:39,代码来源:comments.php

示例10: __

			<section id="invitation" class="grid-2 prefix-5">
				<?php 
echo form::open('sign/up');
?>
				<fieldset>
					<ul>
						<?php 
echo form::input_wrap('code', null, 'title="' . __('Invitation code') . '" maxlength="32"', __('Got invited?'));
?>
						<li><?php 
echo form::submit('invitation_check', __('Sign up'));
?>
</li>
					</ul>
				</fieldset>
				<?php 
echo form::close();
?>
			</section>

		</div>
	</section>

<?php 
echo html::script_source("\$('input:text, input:password').hint('hint');");
echo widget::get('foot');
?>

</body>
</html>
开发者ID:anqqa,项目名称:Anqh,代码行数:30,代码来源:invite.php

示例11: script_source

 /**
  * JavaScript source code block
  *
  * @param   string  $source
  * @return  string
  */
 public static function script_source($source)
 {
     $complied = '';
     if (is_array($source)) {
         foreach ($source as $script) {
             $compiled .= html::script_source($script);
         }
     } else {
         $compiled = implode("\n", array('<script>', trim($source), '</script>'));
     }
     return $compiled;
 }
开发者ID:anqqa,项目名称:Anqh,代码行数:18,代码来源:MY_html.php

示例12: function

echo html::script_source('
$(function() {
	$("a.post-edit").live("click", function(e) {
		e.preventDefault();
		var href = $(this).attr("href");
		var post = href.match(/([0-9]*)\\/edit/);
		$("#post-" + post[1] + " .actions").fadeOut();
		$.get(href, function(data) {
			$("#post-" + post[1] + " .post-content").html(data);
		});
	});

	$("a.post-delete").each(function(i) {
		var action = $(this);
		action.data("action", function() {
			var post = action.attr("href").match(/([0-9]*)\\/delete/);
			if (post) {
				$.get(action.attr("href"), function(data) {
					$("#post-" + post[1]).slideUp();
				});
			}
		});
	});

	$("a.post-quote").live("click", function(e) {
		e.preventDefault();
		var href = $(this).attr("href");
		var post = href.match(/([0-9]*)\\/quote/);
		var article = $(this).closest("article");
		$("#post-" + post[1] + " .actions").fadeOut();
		$.get(href, function(data) {
			article.append(data);
			window.scrollTo(0, article.find("#quote").offset().top - 20);
		});
	});

	$("section.post-content form").live("submit", function(e) {
		e.preventDefault();
		var post = $(this).closest("article");
		$.post($(this).attr("action"), $(this).serialize(), function(data) {
			post.replaceWith(data);
		});
	});

	$("section.post-content form a").live("click", function(e) {
		e.preventDefault();
		var post = $(this).closest("article");
		$.get($(this).attr("href"), function(data) {
			post.replaceWith(data);
		});
	});

	$("section#quote form a").live("click", function(e) {
		e.preventDefault();
		var section = $(this).closest("section");
		var article = section.closest("article");
		section.slideUp(null, function() { section.remove(); });
		article.find(".actions").fadeIn();
	});
});
');
开发者ID:anqqa,项目名称:Anqh,代码行数:61,代码来源:topic.php

示例13: _autocomplete_city

    /**
     * Add autocomplete for city
     *
     * @param string $field
     * @param string $hidden
     */
    public function _autocomplete_city($field = 'city_name', $hidden = 'city_id')
    {
        $countries = array();
        foreach (Kohana::config('locale.countries') as $country) {
            $countries[] = $country[1];
        }
        $countries = ORM::factory('country')->where('country', 'IN', $countries)->find_all();
        $cities = array();
        foreach ($countries as $country) {
            foreach ($country->cities->find_all() as $city) {
                $cities[] = array('id' => $city->id, 'text' => html::chars($city->city));
            }
        }
        widget::add('foot', html::script_source('
var cities = ' . json_encode($cities) . ';
$("input#' . $field . '").autocomplete(cities, {
	formatItem: function(item) {
		return item.text;
	}
}).result(function(event, item) {
	$("input[name=' . $hidden . ']").val(item.id);
});
'));
    }
开发者ID:anqqa,项目名称:Anqh,代码行数:30,代码来源:website.php

示例14: __

<div class="lightbox" id="slideshow">
	<a class="prev" title="<?php 
echo __('Previous');
?>
">&laquo;</a>
	<a class="next" title="<?php 
echo __('Next');
?>
">&raquo;</a>
	<a class="action close" title="<?php 
echo __('Close');
?>
">&#10006;</a>
	<div class="info"></div>
</div>
<?php 
echo html::script_source('
$(function() {
	$(".lightboxed a").overlay({
		effect: "apple",
		target: "#slideshow",
		expose: {
			color: "#222",
			loadSpeed: 200,
			opacity: 0.75
		}
	}).gallery({
		template: "<strong>${title}</strong> <span class=\\"details\\">' . __('Image ${index} of ${total}') . '</span>"
	});
});
');
开发者ID:anqqa,项目名称:Anqh,代码行数:31,代码来源:venue_info.php

示例15: empty

echo form::textarea_wrap(array('name' => 'post', 'id' => $post_id, 'rows' => 20, 'cols' => 25), $post, '', true, '', $errors);
?>

	</ul>
</fieldset>

<fieldset>
	<?php 
echo form::csrf();
?>
	<?php 
echo empty($post['id']) ? '' : form::hidden('id', $post['id']);
?>
	<?php 
echo empty($parent_id) ? '' : form::hidden('parent_id', $parent_id);
?>
	<?php 
echo form::submit(false, __('Save'));
?>
	<?php 
echo html::anchor(request::is_ajax() ? 'forum/post/' . ($post['id'] ? $post['id'] : $parent_id) : url::back('/forum', true), __('Cancel'));
?>
</fieldset>

<?php 
echo form::close();
?>

<?php 
echo html::script_source('$(function() { $("#' . $post_id . '").markItUp(bbCodeSettings); });');
开发者ID:anqqa,项目名称:Anqh,代码行数:30,代码来源:post_edit.php


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