Skip to content

Commit

Permalink
oops sorry, Acutually i'll fix Upskirt signature.
Browse files Browse the repository at this point in the history
$upskirt = new Upskirt(string $string [, array $extensions]);
$upskirt->to_html();
$upskirt->to_toc();
$upskirt->__toString();
  • Loading branch information
chobie committed Jun 26, 2011
1 parent 9a0bdc6 commit 9346d75
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -34,6 +34,6 @@ Install
Example Example
------- -------


$markdown = new Upskirt([array $extensions]); $markdown = new Upskirt(string $string [, array $extensions]);
echo $markdown->to_html($string); echo $markdown->to_html();
echo $markdown->to_toc($string); echo $markdown->to_toc();
27 changes: 20 additions & 7 deletions src/phpskirt.c
Expand Up @@ -141,10 +141,8 @@ static void phpskirt__render(PHPSkirtRendererType render_type, INTERNAL_FUNCTION
int buffer_len = 0; int buffer_len = 0;
HashTable *table; HashTable *table;


if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,"s",&buffer,&buffer_len) == FAILURE) { buffer = Z_STRVAL_P(zend_read_property(phpskirt_class_entry, getThis(),"data",sizeof("data")-1, 0 TSRMLS_CC));
return; buffer_len = strlen(buffer);
}



memset(&input_buf, 0x0, sizeof(struct buf)); memset(&input_buf, 0x0, sizeof(struct buf));
input_buf.data = buffer; input_buf.data = buffer;
Expand Down Expand Up @@ -184,27 +182,42 @@ static void phpskirt__render(PHPSkirtRendererType render_type, INTERNAL_FUNCTION
upshtml_free_renderer(&phpskirt_render); upshtml_free_renderer(&phpskirt_render);
} }


/* {{{ proto string __construct(string $string [, array $extensions])
setup Upskirt extension */
PHP_METHOD(phpskirt, __construct) PHP_METHOD(phpskirt, __construct)
{ {
zval *extensions = NULL; zval *extensions = NULL;
char *buffer;
int buffer_len = 0;


if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,"|z",&extensions) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,"s|z",&buffer, &buffer_len, &extensions) == FAILURE) {
return; return;
} }


add_property_string_ex(getThis(),"data",sizeof("data"),buffer,1 TSRMLS_CC);
if (extensions != NULL) { if (extensions != NULL) {
add_property_zval_ex(getThis(),"extensions",sizeof("extensions"),extensions TSRMLS_CC); add_property_zval_ex(getThis(),"extensions",sizeof("extensions"),extensions TSRMLS_CC);
} }
} }
/* {{{ proto string to_html(string data) /* }}} */

/* {{{ proto string to_html()
Returns converted HTML string */ Returns converted HTML string */
PHP_METHOD(phpskirt, to_html) PHP_METHOD(phpskirt, to_html)
{ {
phpskirt__render(PHPSKIRT_RENDER_HTML,INTERNAL_FUNCTION_PARAM_PASSTHRU); phpskirt__render(PHPSKIRT_RENDER_HTML,INTERNAL_FUNCTION_PARAM_PASSTHRU);
} }
/* }}} */ /* }}} */


/* {{{ proto string to_toc(string data) /* {{{ proto string __toString()
Returns converted HTML string */
PHP_METHOD(phpskirt, __toString)
{
phpskirt__render(PHPSKIRT_RENDER_HTML,INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* }}} */

/* {{{ proto string to_toc()
Returns table of contents*/ Returns table of contents*/
PHP_METHOD(phpskirt, to_toc) PHP_METHOD(phpskirt, to_toc)
{ {
Expand Down

0 comments on commit 9346d75

Please sign in to comment.